##// END OF EJS Templates
add autoexec option
vivainio -
Show More
@@ -1,82 +1,86 b''
1 1 """ User configuration file for IPython
2 2
3 3 This is a more flexible and safe way to configure ipython than *rc files
4 4 (ipythonrc, ipythonrc-pysh etc.)
5 5
6 6 This file is always imported on ipython startup. You can import the
7 7 ipython extensions you need here (see IPython/Extensions directory).
8 8
9 9 Feel free to edit this file to customize your ipython experience.
10 10
11 11 Note that as such this file does nothing, for backwards compatibility.
12 12 Consult e.g. file 'ipy_profile_sh.py' for an example of the things
13 13 you can do here.
14 14
15 15 See http://ipython.scipy.org/moin/IpythonExtensionApi for detailed
16 16 description on what you could do here.
17 17 """
18 18
19 19 # Most of your config files and extensions will probably start with this import
20 20
21 21 import IPython.ipapi
22 22 ip = IPython.ipapi.get()
23 23
24 24 # You probably want to uncomment this if you did %upgrade -nolegacy
25 25 # import ipy_defaults
26 26
27 27 import os
28 28
29 def main():
30 # Handy tab-completers for %cd, %run, import etc.
31 # Try commenting this out if you have completion problems/slowness
32 # import ipy_stock_completers
33
29 def main():
30
34 31 # uncomment if you want to get ipython -p sh behaviour
35 # without having to use command line switches
36
32 # without having to use command line switches
37 33 # import ipy_profile_sh
38 34
39
40 35 # Configure your favourite editor?
41 36 # Good idea e.g. for %edit os.path.isfile
42 37
43 38 #import ipy_editors
44 39
45 40 # Choose one of these:
46 41
47 42 #ipy_editors.scite()
48 43 #ipy_editors.scite('c:/opt/scite/scite.exe')
49 44 #ipy_editors.komodo()
50 45 #ipy_editors.idle()
51 46 # ... or many others, try 'ipy_editors??' after import to see them
52 47
53 48 # Or roll your own:
54 49 #ipy_editors.install_editor("c:/opt/jed +$line $file")
55 50
56 51
57 52 o = ip.options
58 53 # An example on how to set options
59 54 #o.autocall = 1
60 55 o.system_verbose = 0
61 56
62 57 #import_all("os sys")
63 58 #execf('~/_ipython/ns.py')
64 59
60
61 # -- prompt
65 62 # A different, more compact set of prompts from the default ones, that
66 63 # always show your current location in the filesystem:
67
64
68 65 #o.prompt_in1 = r'\C_LightBlue[\C_LightCyan\Y2\C_LightBlue]\C_Normal\n\C_Green|\#>'
69 66 #o.prompt_in2 = r'.\D: '
70 67 #o.prompt_out = r'[\#] '
71
68
69 # Try one of these color settings if you can't read the text easily
70 # autoexec is a list of IPython commands to execute on startup
71 #o.autoexec.append('%colors LightBG')
72 #o.autoexec.append('%colors NoColor')
73 #o.autoexec.append('%colors Linux')
74
75
72 76 # some config helper functions you can use
73 77 def import_all(modules):
74 78 """ Usage: import_all("os sys") """
75 79 for m in modules.split():
76 80 ip.ex("from %s import *" % m)
77 81
78 82 def execf(fname):
79 83 """ Execute a file in user namespace """
80 84 ip.ex('execfile("%s")' % os.path.expanduser(fname))
81 85
82 86 main()
@@ -1,2603 +1,2611 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 2919 2007-12-31 14:45:55Z vivainio $
9 $Id: iplib.py 2930 2008-01-11 07:03:11Z vivainio $
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 from sets import Set
59 59 from pprint import pprint, pformat
60 60
61 61 # IPython's own modules
62 62 #import IPython
63 63 from IPython import Debugger,OInspect,PyColorize,ultraTB
64 64 from IPython.ColorANSI import ColorScheme,ColorSchemeTable # too long names
65 65 from IPython.Extensions import pickleshare
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 # Job manager (for jobs run as background threads)
222 222 self.jobs = BackgroundJobManager()
223 223
224 224 # Store the actual shell's name
225 225 self.name = name
226 226
227 227 # We need to know whether the instance is meant for embedding, since
228 228 # global/local namespaces need to be handled differently in that case
229 229 self.embedded = embedded
230 230 if embedded:
231 231 # Control variable so users can, from within the embedded instance,
232 232 # permanently deactivate it.
233 233 self.embedded_active = True
234 234
235 235 # command compiler
236 236 self.compile = codeop.CommandCompiler()
237 237
238 238 # User input buffer
239 239 self.buffer = []
240 240
241 241 # Default name given in compilation of code
242 242 self.filename = '<ipython console>'
243 243
244 244 # Install our own quitter instead of the builtins. For python2.3-2.4,
245 245 # this brings in behavior like 2.5, and for 2.5 it's identical.
246 246 __builtin__.exit = Quitter(self,'exit')
247 247 __builtin__.quit = Quitter(self,'quit')
248 248
249 249 # Make an empty namespace, which extension writers can rely on both
250 250 # existing and NEVER being used by ipython itself. This gives them a
251 251 # convenient location for storing additional information and state
252 252 # their extensions may require, without fear of collisions with other
253 253 # ipython names that may develop later.
254 254 self.meta = Struct()
255 255
256 256 # Create the namespace where the user will operate. user_ns is
257 257 # normally the only one used, and it is passed to the exec calls as
258 258 # the locals argument. But we do carry a user_global_ns namespace
259 259 # given as the exec 'globals' argument, This is useful in embedding
260 260 # situations where the ipython shell opens in a context where the
261 261 # distinction between locals and globals is meaningful.
262 262
263 263 # FIXME. For some strange reason, __builtins__ is showing up at user
264 264 # level as a dict instead of a module. This is a manual fix, but I
265 265 # should really track down where the problem is coming from. Alex
266 266 # Schmolck reported this problem first.
267 267
268 268 # A useful post by Alex Martelli on this topic:
269 269 # Re: inconsistent value from __builtins__
270 270 # Von: Alex Martelli <aleaxit@yahoo.com>
271 271 # Datum: Freitag 01 Oktober 2004 04:45:34 nachmittags/abends
272 272 # Gruppen: comp.lang.python
273 273
274 274 # Michael Hohn <hohn@hooknose.lbl.gov> wrote:
275 275 # > >>> print type(builtin_check.get_global_binding('__builtins__'))
276 276 # > <type 'dict'>
277 277 # > >>> print type(__builtins__)
278 278 # > <type 'module'>
279 279 # > Is this difference in return value intentional?
280 280
281 281 # Well, it's documented that '__builtins__' can be either a dictionary
282 282 # or a module, and it's been that way for a long time. Whether it's
283 283 # intentional (or sensible), I don't know. In any case, the idea is
284 284 # that if you need to access the built-in namespace directly, you
285 285 # should start with "import __builtin__" (note, no 's') which will
286 286 # definitely give you a module. Yeah, it's somewhat confusing:-(.
287 287
288 288 # These routines return properly built dicts as needed by the rest of
289 289 # the code, and can also be used by extension writers to generate
290 290 # properly initialized namespaces.
291 291 user_ns = IPython.ipapi.make_user_ns(user_ns)
292 292 user_global_ns = IPython.ipapi.make_user_global_ns(user_global_ns)
293 293
294 294 # Assign namespaces
295 295 # This is the namespace where all normal user variables live
296 296 self.user_ns = user_ns
297 297 # Embedded instances require a separate namespace for globals.
298 298 # Normally this one is unused by non-embedded instances.
299 299 self.user_global_ns = user_global_ns
300 300 # A namespace to keep track of internal data structures to prevent
301 301 # them from cluttering user-visible stuff. Will be updated later
302 302 self.internal_ns = {}
303 303
304 304 # Namespace of system aliases. Each entry in the alias
305 305 # table must be a 2-tuple of the form (N,name), where N is the number
306 306 # of positional arguments of the alias.
307 307 self.alias_table = {}
308 308
309 309 # A table holding all the namespaces IPython deals with, so that
310 310 # introspection facilities can search easily.
311 311 self.ns_table = {'user':user_ns,
312 312 'user_global':user_global_ns,
313 313 'alias':self.alias_table,
314 314 'internal':self.internal_ns,
315 315 'builtin':__builtin__.__dict__
316 316 }
317 317 # The user namespace MUST have a pointer to the shell itself.
318 318 self.user_ns[name] = self
319 319
320 320 # We need to insert into sys.modules something that looks like a
321 321 # module but which accesses the IPython namespace, for shelve and
322 322 # pickle to work interactively. Normally they rely on getting
323 323 # everything out of __main__, but for embedding purposes each IPython
324 324 # instance has its own private namespace, so we can't go shoving
325 325 # everything into __main__.
326 326
327 327 # note, however, that we should only do this for non-embedded
328 328 # ipythons, which really mimic the __main__.__dict__ with their own
329 329 # namespace. Embedded instances, on the other hand, should not do
330 330 # this because they need to manage the user local/global namespaces
331 331 # only, but they live within a 'normal' __main__ (meaning, they
332 332 # shouldn't overtake the execution environment of the script they're
333 333 # embedded in).
334 334
335 335 if not embedded:
336 336 try:
337 337 main_name = self.user_ns['__name__']
338 338 except KeyError:
339 339 raise KeyError,'user_ns dictionary MUST have a "__name__" key'
340 340 else:
341 341 #print "pickle hack in place" # dbg
342 342 #print 'main_name:',main_name # dbg
343 343 sys.modules[main_name] = FakeModule(self.user_ns)
344 344
345 345 # Now that FakeModule produces a real module, we've run into a nasty
346 346 # problem: after script execution (via %run), the module where the user
347 347 # code ran is deleted. Now that this object is a true module (needed
348 348 # so docetst and other tools work correctly), the Python module
349 349 # teardown mechanism runs over it, and sets to None every variable
350 350 # present in that module. This means that later calls to functions
351 351 # defined in the script (which have become interactively visible after
352 352 # script exit) fail, because they hold references to objects that have
353 353 # become overwritten into None. The only solution I see right now is
354 354 # to protect every FakeModule used by %run by holding an internal
355 355 # reference to it. This private list will be used for that. The
356 356 # %reset command will flush it as well.
357 357 self._user_main_modules = []
358 358
359 359 # List of input with multi-line handling.
360 360 # Fill its zero entry, user counter starts at 1
361 361 self.input_hist = InputList(['\n'])
362 362 # This one will hold the 'raw' input history, without any
363 363 # pre-processing. This will allow users to retrieve the input just as
364 364 # it was exactly typed in by the user, with %hist -r.
365 365 self.input_hist_raw = InputList(['\n'])
366 366
367 367 # list of visited directories
368 368 try:
369 369 self.dir_hist = [os.getcwd()]
370 370 except OSError:
371 371 self.dir_hist = []
372 372
373 373 # dict of output history
374 374 self.output_hist = {}
375 375
376 376 # Get system encoding at startup time. Certain terminals (like Emacs
377 377 # under Win32 have it set to None, and we need to have a known valid
378 378 # encoding to use in the raw_input() method
379 379 self.stdin_encoding = sys.stdin.encoding or 'ascii'
380 380
381 381 # dict of things NOT to alias (keywords, builtins and some magics)
382 382 no_alias = {}
383 383 no_alias_magics = ['cd','popd','pushd','dhist','alias','unalias']
384 384 for key in keyword.kwlist + no_alias_magics:
385 385 no_alias[key] = 1
386 386 no_alias.update(__builtin__.__dict__)
387 387 self.no_alias = no_alias
388 388
389 389 # make global variables for user access to these
390 390 self.user_ns['_ih'] = self.input_hist
391 391 self.user_ns['_oh'] = self.output_hist
392 392 self.user_ns['_dh'] = self.dir_hist
393 393
394 394 # user aliases to input and output histories
395 395 self.user_ns['In'] = self.input_hist
396 396 self.user_ns['Out'] = self.output_hist
397 397
398 398 self.user_ns['_sh'] = IPython.shadowns
399 399 # Object variable to store code object waiting execution. This is
400 400 # used mainly by the multithreaded shells, but it can come in handy in
401 401 # other situations. No need to use a Queue here, since it's a single
402 402 # item which gets cleared once run.
403 403 self.code_to_run = None
404 404
405 405 # escapes for automatic behavior on the command line
406 406 self.ESC_SHELL = '!'
407 407 self.ESC_SH_CAP = '!!'
408 408 self.ESC_HELP = '?'
409 409 self.ESC_MAGIC = '%'
410 410 self.ESC_QUOTE = ','
411 411 self.ESC_QUOTE2 = ';'
412 412 self.ESC_PAREN = '/'
413 413
414 414 # And their associated handlers
415 415 self.esc_handlers = {self.ESC_PAREN : self.handle_auto,
416 416 self.ESC_QUOTE : self.handle_auto,
417 417 self.ESC_QUOTE2 : self.handle_auto,
418 418 self.ESC_MAGIC : self.handle_magic,
419 419 self.ESC_HELP : self.handle_help,
420 420 self.ESC_SHELL : self.handle_shell_escape,
421 421 self.ESC_SH_CAP : self.handle_shell_escape,
422 422 }
423 423
424 424 # class initializations
425 425 Magic.__init__(self,self)
426 426
427 427 # Python source parser/formatter for syntax highlighting
428 428 pyformat = PyColorize.Parser().format
429 429 self.pycolorize = lambda src: pyformat(src,'str',self.rc['colors'])
430 430
431 431 # hooks holds pointers used for user-side customizations
432 432 self.hooks = Struct()
433 433
434 434 self.strdispatchers = {}
435 435
436 436 # Set all default hooks, defined in the IPython.hooks module.
437 437 hooks = IPython.hooks
438 438 for hook_name in hooks.__all__:
439 439 # default hooks have priority 100, i.e. low; user hooks should have
440 440 # 0-100 priority
441 441 self.set_hook(hook_name,getattr(hooks,hook_name), 100)
442 442 #print "bound hook",hook_name
443 443
444 444 # Flag to mark unconditional exit
445 445 self.exit_now = False
446 446
447 447 self.usage_min = """\
448 448 An enhanced console for Python.
449 449 Some of its features are:
450 450 - Readline support if the readline library is present.
451 451 - Tab completion in the local namespace.
452 452 - Logging of input, see command-line options.
453 453 - System shell escape via ! , eg !ls.
454 454 - Magic commands, starting with a % (like %ls, %pwd, %cd, etc.)
455 455 - Keeps track of locally defined variables via %who, %whos.
456 456 - Show object information with a ? eg ?x or x? (use ?? for more info).
457 457 """
458 458 if usage: self.usage = usage
459 459 else: self.usage = self.usage_min
460 460
461 461 # Storage
462 462 self.rc = rc # This will hold all configuration information
463 463 self.pager = 'less'
464 464 # temporary files used for various purposes. Deleted at exit.
465 465 self.tempfiles = []
466 466
467 467 # Keep track of readline usage (later set by init_readline)
468 468 self.has_readline = False
469 469
470 470 # template for logfile headers. It gets resolved at runtime by the
471 471 # logstart method.
472 472 self.loghead_tpl = \
473 473 """#log# Automatic Logger file. *** THIS MUST BE THE FIRST LINE ***
474 474 #log# DO NOT CHANGE THIS LINE OR THE TWO BELOW
475 475 #log# opts = %s
476 476 #log# args = %s
477 477 #log# It is safe to make manual edits below here.
478 478 #log#-----------------------------------------------------------------------
479 479 """
480 480 # for pushd/popd management
481 481 try:
482 482 self.home_dir = get_home_dir()
483 483 except HomeDirError,msg:
484 484 fatal(msg)
485 485
486 486 self.dir_stack = []
487 487
488 488 # Functions to call the underlying shell.
489 489
490 490 # The first is similar to os.system, but it doesn't return a value,
491 491 # and it allows interpolation of variables in the user's namespace.
492 492 self.system = lambda cmd: \
493 493 shell(self.var_expand(cmd,depth=2),
494 494 header=self.rc.system_header,
495 495 verbose=self.rc.system_verbose)
496 496
497 497 # These are for getoutput and getoutputerror:
498 498 self.getoutput = lambda cmd: \
499 499 getoutput(self.var_expand(cmd,depth=2),
500 500 header=self.rc.system_header,
501 501 verbose=self.rc.system_verbose)
502 502
503 503 self.getoutputerror = lambda cmd: \
504 504 getoutputerror(self.var_expand(cmd,depth=2),
505 505 header=self.rc.system_header,
506 506 verbose=self.rc.system_verbose)
507 507
508 508
509 509 # keep track of where we started running (mainly for crash post-mortem)
510 510 self.starting_dir = os.getcwd()
511 511
512 512 # Various switches which can be set
513 513 self.CACHELENGTH = 5000 # this is cheap, it's just text
514 514 self.BANNER = "Python %(version)s on %(platform)s\n" % sys.__dict__
515 515 self.banner2 = banner2
516 516
517 517 # TraceBack handlers:
518 518
519 519 # Syntax error handler.
520 520 self.SyntaxTB = SyntaxTB(color_scheme='NoColor')
521 521
522 522 # The interactive one is initialized with an offset, meaning we always
523 523 # want to remove the topmost item in the traceback, which is our own
524 524 # internal code. Valid modes: ['Plain','Context','Verbose']
525 525 self.InteractiveTB = ultraTB.AutoFormattedTB(mode = 'Plain',
526 526 color_scheme='NoColor',
527 527 tb_offset = 1)
528 528
529 529 # IPython itself shouldn't crash. This will produce a detailed
530 530 # post-mortem if it does. But we only install the crash handler for
531 531 # non-threaded shells, the threaded ones use a normal verbose reporter
532 532 # and lose the crash handler. This is because exceptions in the main
533 533 # thread (such as in GUI code) propagate directly to sys.excepthook,
534 534 # and there's no point in printing crash dumps for every user exception.
535 535 if self.isthreaded:
536 536 ipCrashHandler = ultraTB.FormattedTB()
537 537 else:
538 538 from IPython import CrashHandler
539 539 ipCrashHandler = CrashHandler.IPythonCrashHandler(self)
540 540 self.set_crash_handler(ipCrashHandler)
541 541
542 542 # and add any custom exception handlers the user may have specified
543 543 self.set_custom_exc(*custom_exceptions)
544 544
545 545 # indentation management
546 546 self.autoindent = False
547 547 self.indent_current_nsp = 0
548 548
549 549 # Make some aliases automatically
550 550 # Prepare list of shell aliases to auto-define
551 551 if os.name == 'posix':
552 552 auto_alias = ('mkdir mkdir', 'rmdir rmdir',
553 553 'mv mv -i','rm rm -i','cp cp -i',
554 554 'cat cat','less less','clear clear',
555 555 # a better ls
556 556 'ls ls -F',
557 557 # long ls
558 558 'll ls -lF')
559 559 # Extra ls aliases with color, which need special treatment on BSD
560 560 # variants
561 561 ls_extra = ( # color ls
562 562 'lc ls -F -o --color',
563 563 # ls normal files only
564 564 'lf ls -F -o --color %l | grep ^-',
565 565 # ls symbolic links
566 566 'lk ls -F -o --color %l | grep ^l',
567 567 # directories or links to directories,
568 568 'ldir ls -F -o --color %l | grep /$',
569 569 # things which are executable
570 570 'lx ls -F -o --color %l | grep ^-..x',
571 571 )
572 572 # The BSDs don't ship GNU ls, so they don't understand the
573 573 # --color switch out of the box
574 574 if 'bsd' in sys.platform:
575 575 ls_extra = ( # ls normal files only
576 576 'lf ls -lF | grep ^-',
577 577 # ls symbolic links
578 578 'lk ls -lF | grep ^l',
579 579 # directories or links to directories,
580 580 'ldir ls -lF | grep /$',
581 581 # things which are executable
582 582 'lx ls -lF | grep ^-..x',
583 583 )
584 584 auto_alias = auto_alias + ls_extra
585 585 elif os.name in ['nt','dos']:
586 586 auto_alias = ('ls dir /on',
587 587 'ddir dir /ad /on', 'ldir dir /ad /on',
588 588 'mkdir mkdir','rmdir rmdir','echo echo',
589 589 'ren ren','cls cls','copy copy')
590 590 else:
591 591 auto_alias = ()
592 592 self.auto_alias = [s.split(None,1) for s in auto_alias]
593 593
594
594 595 # Produce a public API instance
595 596 self.api = IPython.ipapi.IPApi(self)
596 597
597 598 # Call the actual (public) initializer
598 599 self.init_auto_alias()
599 600
600 601 # track which builtins we add, so we can clean up later
601 602 self.builtins_added = {}
602 603 # This method will add the necessary builtins for operation, but
603 604 # tracking what it did via the builtins_added dict.
605
606 #TODO: remove this, redundant
604 607 self.add_builtins()
605 608
606 609
610
607 611
608 612 # end __init__
609 613
610 614 def var_expand(self,cmd,depth=0):
611 615 """Expand python variables in a string.
612 616
613 617 The depth argument indicates how many frames above the caller should
614 618 be walked to look for the local namespace where to expand variables.
615 619
616 620 The global namespace for expansion is always the user's interactive
617 621 namespace.
618 622 """
619 623
620 624 return str(ItplNS(cmd,
621 625 self.user_ns, # globals
622 626 # Skip our own frame in searching for locals:
623 627 sys._getframe(depth+1).f_locals # locals
624 628 ))
625 629
626 630 def pre_config_initialization(self):
627 631 """Pre-configuration init method
628 632
629 633 This is called before the configuration files are processed to
630 634 prepare the services the config files might need.
631 635
632 636 self.rc already has reasonable default values at this point.
633 637 """
634 638 rc = self.rc
635 639 try:
636 640 self.db = pickleshare.PickleShareDB(rc.ipythondir + "/db")
637 641 except exceptions.UnicodeDecodeError:
638 642 print "Your ipythondir can't be decoded to unicode!"
639 643 print "Please set HOME environment variable to something that"
640 644 print r"only has ASCII characters, e.g. c:\home"
641 645 print "Now it is",rc.ipythondir
642 646 sys.exit()
643 647 self.shadowhist = IPython.history.ShadowHist(self.db)
644 648
645 649
646 650 def post_config_initialization(self):
647 651 """Post configuration init method
648 652
649 653 This is called after the configuration files have been processed to
650 654 'finalize' the initialization."""
651 655
652 656 rc = self.rc
653 657
654 658 # Object inspector
655 659 self.inspector = OInspect.Inspector(OInspect.InspectColors,
656 660 PyColorize.ANSICodeColors,
657 661 'NoColor',
658 662 rc.object_info_string_level)
659 663
660 664 self.rl_next_input = None
661 665 self.rl_do_indent = False
662 666 # Load readline proper
663 667 if rc.readline:
664 668 self.init_readline()
665 669
666 670
667 671 # local shortcut, this is used a LOT
668 672 self.log = self.logger.log
669 673
670 674 # Initialize cache, set in/out prompts and printing system
671 675 self.outputcache = CachedOutput(self,
672 676 rc.cache_size,
673 677 rc.pprint,
674 678 input_sep = rc.separate_in,
675 679 output_sep = rc.separate_out,
676 680 output_sep2 = rc.separate_out2,
677 681 ps1 = rc.prompt_in1,
678 682 ps2 = rc.prompt_in2,
679 683 ps_out = rc.prompt_out,
680 684 pad_left = rc.prompts_pad_left)
681 685
682 686 # user may have over-ridden the default print hook:
683 687 try:
684 688 self.outputcache.__class__.display = self.hooks.display
685 689 except AttributeError:
686 690 pass
687 691
688 692 # I don't like assigning globally to sys, because it means when
689 693 # embedding instances, each embedded instance overrides the previous
690 694 # choice. But sys.displayhook seems to be called internally by exec,
691 695 # so I don't see a way around it. We first save the original and then
692 696 # overwrite it.
693 697 self.sys_displayhook = sys.displayhook
694 698 sys.displayhook = self.outputcache
695 699
696 700 # Do a proper resetting of doctest, including the necessary displayhook
697 701 # monkeypatching
698 702 doctest_reload()
699 703
700 704 # Set user colors (don't do it in the constructor above so that it
701 705 # doesn't crash if colors option is invalid)
702 706 self.magic_colors(rc.colors)
703 707
704 708 # Set calling of pdb on exceptions
705 709 self.call_pdb = rc.pdb
706 710
707 711 # Load user aliases
708 712 for alias in rc.alias:
709 713 self.magic_alias(alias)
710 714
711 715 self.hooks.late_startup_hook()
712 716
717 for cmd in self.rc.autoexec:
718 #print "autoexec>",cmd #dbg
719 self.api.runlines(cmd)
720
713 721 batchrun = False
714 722 for batchfile in [path(arg) for arg in self.rc.args
715 723 if arg.lower().endswith('.ipy')]:
716 724 if not batchfile.isfile():
717 725 print "No such batch file:", batchfile
718 726 continue
719 727 self.api.runlines(batchfile.text())
720 728 batchrun = True
721 729 # without -i option, exit after running the batch file
722 730 if batchrun and not self.rc.interact:
723 731 self.exit_now = True
724 732
725 733 def add_builtins(self):
726 734 """Store ipython references into the builtin namespace.
727 735
728 736 Some parts of ipython operate via builtins injected here, which hold a
729 737 reference to IPython itself."""
730 738
731 739 # TODO: deprecate all of these, they are unsafe
732 740 builtins_new = dict(__IPYTHON__ = self,
733 741 ip_set_hook = self.set_hook,
734 742 jobs = self.jobs,
735 743 ipmagic = wrap_deprecated(self.ipmagic,'_ip.magic()'),
736 744 ipalias = wrap_deprecated(self.ipalias),
737 745 ipsystem = wrap_deprecated(self.ipsystem,'_ip.system()'),
738 746 #_ip = self.api
739 747 )
740 748 for biname,bival in builtins_new.items():
741 749 try:
742 750 # store the orignal value so we can restore it
743 751 self.builtins_added[biname] = __builtin__.__dict__[biname]
744 752 except KeyError:
745 753 # or mark that it wasn't defined, and we'll just delete it at
746 754 # cleanup
747 755 self.builtins_added[biname] = Undefined
748 756 __builtin__.__dict__[biname] = bival
749 757
750 758 # Keep in the builtins a flag for when IPython is active. We set it
751 759 # with setdefault so that multiple nested IPythons don't clobber one
752 760 # another. Each will increase its value by one upon being activated,
753 761 # which also gives us a way to determine the nesting level.
754 762 __builtin__.__dict__.setdefault('__IPYTHON__active',0)
755 763
756 764 def clean_builtins(self):
757 765 """Remove any builtins which might have been added by add_builtins, or
758 766 restore overwritten ones to their previous values."""
759 767 for biname,bival in self.builtins_added.items():
760 768 if bival is Undefined:
761 769 del __builtin__.__dict__[biname]
762 770 else:
763 771 __builtin__.__dict__[biname] = bival
764 772 self.builtins_added.clear()
765 773
766 774 def set_hook(self,name,hook, priority = 50, str_key = None, re_key = None):
767 775 """set_hook(name,hook) -> sets an internal IPython hook.
768 776
769 777 IPython exposes some of its internal API as user-modifiable hooks. By
770 778 adding your function to one of these hooks, you can modify IPython's
771 779 behavior to call at runtime your own routines."""
772 780
773 781 # At some point in the future, this should validate the hook before it
774 782 # accepts it. Probably at least check that the hook takes the number
775 783 # of args it's supposed to.
776 784
777 785 f = new.instancemethod(hook,self,self.__class__)
778 786
779 787 # check if the hook is for strdispatcher first
780 788 if str_key is not None:
781 789 sdp = self.strdispatchers.get(name, StrDispatch())
782 790 sdp.add_s(str_key, f, priority )
783 791 self.strdispatchers[name] = sdp
784 792 return
785 793 if re_key is not None:
786 794 sdp = self.strdispatchers.get(name, StrDispatch())
787 795 sdp.add_re(re.compile(re_key), f, priority )
788 796 self.strdispatchers[name] = sdp
789 797 return
790 798
791 799 dp = getattr(self.hooks, name, None)
792 800 if name not in IPython.hooks.__all__:
793 801 print "Warning! Hook '%s' is not one of %s" % (name, IPython.hooks.__all__ )
794 802 if not dp:
795 803 dp = IPython.hooks.CommandChainDispatcher()
796 804
797 805 try:
798 806 dp.add(f,priority)
799 807 except AttributeError:
800 808 # it was not commandchain, plain old func - replace
801 809 dp = f
802 810
803 811 setattr(self.hooks,name, dp)
804 812
805 813
806 814 #setattr(self.hooks,name,new.instancemethod(hook,self,self.__class__))
807 815
808 816 def set_crash_handler(self,crashHandler):
809 817 """Set the IPython crash handler.
810 818
811 819 This must be a callable with a signature suitable for use as
812 820 sys.excepthook."""
813 821
814 822 # Install the given crash handler as the Python exception hook
815 823 sys.excepthook = crashHandler
816 824
817 825 # The instance will store a pointer to this, so that runtime code
818 826 # (such as magics) can access it. This is because during the
819 827 # read-eval loop, it gets temporarily overwritten (to deal with GUI
820 828 # frameworks).
821 829 self.sys_excepthook = sys.excepthook
822 830
823 831
824 832 def set_custom_exc(self,exc_tuple,handler):
825 833 """set_custom_exc(exc_tuple,handler)
826 834
827 835 Set a custom exception handler, which will be called if any of the
828 836 exceptions in exc_tuple occur in the mainloop (specifically, in the
829 837 runcode() method.
830 838
831 839 Inputs:
832 840
833 841 - exc_tuple: a *tuple* of valid exceptions to call the defined
834 842 handler for. It is very important that you use a tuple, and NOT A
835 843 LIST here, because of the way Python's except statement works. If
836 844 you only want to trap a single exception, use a singleton tuple:
837 845
838 846 exc_tuple == (MyCustomException,)
839 847
840 848 - handler: this must be defined as a function with the following
841 849 basic interface: def my_handler(self,etype,value,tb).
842 850
843 851 This will be made into an instance method (via new.instancemethod)
844 852 of IPython itself, and it will be called if any of the exceptions
845 853 listed in the exc_tuple are caught. If the handler is None, an
846 854 internal basic one is used, which just prints basic info.
847 855
848 856 WARNING: by putting in your own exception handler into IPython's main
849 857 execution loop, you run a very good chance of nasty crashes. This
850 858 facility should only be used if you really know what you are doing."""
851 859
852 860 assert type(exc_tuple)==type(()) , \
853 861 "The custom exceptions must be given AS A TUPLE."
854 862
855 863 def dummy_handler(self,etype,value,tb):
856 864 print '*** Simple custom exception handler ***'
857 865 print 'Exception type :',etype
858 866 print 'Exception value:',value
859 867 print 'Traceback :',tb
860 868 print 'Source code :','\n'.join(self.buffer)
861 869
862 870 if handler is None: handler = dummy_handler
863 871
864 872 self.CustomTB = new.instancemethod(handler,self,self.__class__)
865 873 self.custom_exceptions = exc_tuple
866 874
867 875 def set_custom_completer(self,completer,pos=0):
868 876 """set_custom_completer(completer,pos=0)
869 877
870 878 Adds a new custom completer function.
871 879
872 880 The position argument (defaults to 0) is the index in the completers
873 881 list where you want the completer to be inserted."""
874 882
875 883 newcomp = new.instancemethod(completer,self.Completer,
876 884 self.Completer.__class__)
877 885 self.Completer.matchers.insert(pos,newcomp)
878 886
879 887 def set_completer(self):
880 888 """reset readline's completer to be our own."""
881 889 self.readline.set_completer(self.Completer.complete)
882 890
883 891 def _get_call_pdb(self):
884 892 return self._call_pdb
885 893
886 894 def _set_call_pdb(self,val):
887 895
888 896 if val not in (0,1,False,True):
889 897 raise ValueError,'new call_pdb value must be boolean'
890 898
891 899 # store value in instance
892 900 self._call_pdb = val
893 901
894 902 # notify the actual exception handlers
895 903 self.InteractiveTB.call_pdb = val
896 904 if self.isthreaded:
897 905 try:
898 906 self.sys_excepthook.call_pdb = val
899 907 except:
900 908 warn('Failed to activate pdb for threaded exception handler')
901 909
902 910 call_pdb = property(_get_call_pdb,_set_call_pdb,None,
903 911 'Control auto-activation of pdb at exceptions')
904 912
905 913
906 914 # These special functions get installed in the builtin namespace, to
907 915 # provide programmatic (pure python) access to magics, aliases and system
908 916 # calls. This is important for logging, user scripting, and more.
909 917
910 918 # We are basically exposing, via normal python functions, the three
911 919 # mechanisms in which ipython offers special call modes (magics for
912 920 # internal control, aliases for direct system access via pre-selected
913 921 # names, and !cmd for calling arbitrary system commands).
914 922
915 923 def ipmagic(self,arg_s):
916 924 """Call a magic function by name.
917 925
918 926 Input: a string containing the name of the magic function to call and any
919 927 additional arguments to be passed to the magic.
920 928
921 929 ipmagic('name -opt foo bar') is equivalent to typing at the ipython
922 930 prompt:
923 931
924 932 In[1]: %name -opt foo bar
925 933
926 934 To call a magic without arguments, simply use ipmagic('name').
927 935
928 936 This provides a proper Python function to call IPython's magics in any
929 937 valid Python code you can type at the interpreter, including loops and
930 938 compound statements. It is added by IPython to the Python builtin
931 939 namespace upon initialization."""
932 940
933 941 args = arg_s.split(' ',1)
934 942 magic_name = args[0]
935 943 magic_name = magic_name.lstrip(self.ESC_MAGIC)
936 944
937 945 try:
938 946 magic_args = args[1]
939 947 except IndexError:
940 948 magic_args = ''
941 949 fn = getattr(self,'magic_'+magic_name,None)
942 950 if fn is None:
943 951 error("Magic function `%s` not found." % magic_name)
944 952 else:
945 953 magic_args = self.var_expand(magic_args,1)
946 954 return fn(magic_args)
947 955
948 956 def ipalias(self,arg_s):
949 957 """Call an alias by name.
950 958
951 959 Input: a string containing the name of the alias to call and any
952 960 additional arguments to be passed to the magic.
953 961
954 962 ipalias('name -opt foo bar') is equivalent to typing at the ipython
955 963 prompt:
956 964
957 965 In[1]: name -opt foo bar
958 966
959 967 To call an alias without arguments, simply use ipalias('name').
960 968
961 969 This provides a proper Python function to call IPython's aliases in any
962 970 valid Python code you can type at the interpreter, including loops and
963 971 compound statements. It is added by IPython to the Python builtin
964 972 namespace upon initialization."""
965 973
966 974 args = arg_s.split(' ',1)
967 975 alias_name = args[0]
968 976 try:
969 977 alias_args = args[1]
970 978 except IndexError:
971 979 alias_args = ''
972 980 if alias_name in self.alias_table:
973 981 self.call_alias(alias_name,alias_args)
974 982 else:
975 983 error("Alias `%s` not found." % alias_name)
976 984
977 985 def ipsystem(self,arg_s):
978 986 """Make a system call, using IPython."""
979 987
980 988 self.system(arg_s)
981 989
982 990 def complete(self,text):
983 991 """Return a sorted list of all possible completions on text.
984 992
985 993 Inputs:
986 994
987 995 - text: a string of text to be completed on.
988 996
989 997 This is a wrapper around the completion mechanism, similar to what
990 998 readline does at the command line when the TAB key is hit. By
991 999 exposing it as a method, it can be used by other non-readline
992 1000 environments (such as GUIs) for text completion.
993 1001
994 1002 Simple usage example:
995 1003
996 1004 In [1]: x = 'hello'
997 1005
998 1006 In [2]: __IP.complete('x.l')
999 1007 Out[2]: ['x.ljust', 'x.lower', 'x.lstrip']"""
1000 1008
1001 1009 complete = self.Completer.complete
1002 1010 state = 0
1003 1011 # use a dict so we get unique keys, since ipyhton's multiple
1004 1012 # completers can return duplicates. When we make 2.4 a requirement,
1005 1013 # start using sets instead, which are faster.
1006 1014 comps = {}
1007 1015 while True:
1008 1016 newcomp = complete(text,state,line_buffer=text)
1009 1017 if newcomp is None:
1010 1018 break
1011 1019 comps[newcomp] = 1
1012 1020 state += 1
1013 1021 outcomps = comps.keys()
1014 1022 outcomps.sort()
1015 1023 return outcomps
1016 1024
1017 1025 def set_completer_frame(self, frame=None):
1018 1026 if frame:
1019 1027 self.Completer.namespace = frame.f_locals
1020 1028 self.Completer.global_namespace = frame.f_globals
1021 1029 else:
1022 1030 self.Completer.namespace = self.user_ns
1023 1031 self.Completer.global_namespace = self.user_global_ns
1024 1032
1025 1033 def init_auto_alias(self):
1026 1034 """Define some aliases automatically.
1027 1035
1028 1036 These are ALL parameter-less aliases"""
1029 1037
1030 1038 for alias,cmd in self.auto_alias:
1031 1039 self.getapi().defalias(alias,cmd)
1032 1040
1033 1041
1034 1042 def alias_table_validate(self,verbose=0):
1035 1043 """Update information about the alias table.
1036 1044
1037 1045 In particular, make sure no Python keywords/builtins are in it."""
1038 1046
1039 1047 no_alias = self.no_alias
1040 1048 for k in self.alias_table.keys():
1041 1049 if k in no_alias:
1042 1050 del self.alias_table[k]
1043 1051 if verbose:
1044 1052 print ("Deleting alias <%s>, it's a Python "
1045 1053 "keyword or builtin." % k)
1046 1054
1047 1055 def set_autoindent(self,value=None):
1048 1056 """Set the autoindent flag, checking for readline support.
1049 1057
1050 1058 If called with no arguments, it acts as a toggle."""
1051 1059
1052 1060 if not self.has_readline:
1053 1061 if os.name == 'posix':
1054 1062 warn("The auto-indent feature requires the readline library")
1055 1063 self.autoindent = 0
1056 1064 return
1057 1065 if value is None:
1058 1066 self.autoindent = not self.autoindent
1059 1067 else:
1060 1068 self.autoindent = value
1061 1069
1062 1070 def rc_set_toggle(self,rc_field,value=None):
1063 1071 """Set or toggle a field in IPython's rc config. structure.
1064 1072
1065 1073 If called with no arguments, it acts as a toggle.
1066 1074
1067 1075 If called with a non-existent field, the resulting AttributeError
1068 1076 exception will propagate out."""
1069 1077
1070 1078 rc_val = getattr(self.rc,rc_field)
1071 1079 if value is None:
1072 1080 value = not rc_val
1073 1081 setattr(self.rc,rc_field,value)
1074 1082
1075 1083 def user_setup(self,ipythondir,rc_suffix,mode='install'):
1076 1084 """Install the user configuration directory.
1077 1085
1078 1086 Can be called when running for the first time or to upgrade the user's
1079 1087 .ipython/ directory with the mode parameter. Valid modes are 'install'
1080 1088 and 'upgrade'."""
1081 1089
1082 1090 def wait():
1083 1091 try:
1084 1092 raw_input("Please press <RETURN> to start IPython.")
1085 1093 except EOFError:
1086 1094 print >> Term.cout
1087 1095 print '*'*70
1088 1096
1089 1097 cwd = os.getcwd() # remember where we started
1090 1098 glb = glob.glob
1091 1099 print '*'*70
1092 1100 if mode == 'install':
1093 1101 print \
1094 1102 """Welcome to IPython. I will try to create a personal configuration directory
1095 1103 where you can customize many aspects of IPython's functionality in:\n"""
1096 1104 else:
1097 1105 print 'I am going to upgrade your configuration in:'
1098 1106
1099 1107 print ipythondir
1100 1108
1101 1109 rcdirend = os.path.join('IPython','UserConfig')
1102 1110 cfg = lambda d: os.path.join(d,rcdirend)
1103 1111 try:
1104 1112 rcdir = filter(os.path.isdir,map(cfg,sys.path))[0]
1105 1113 print "Initializing from configuration",rcdir
1106 1114 except IndexError:
1107 1115 warning = """
1108 1116 Installation error. IPython's directory was not found.
1109 1117
1110 1118 Check the following:
1111 1119
1112 1120 The ipython/IPython directory should be in a directory belonging to your
1113 1121 PYTHONPATH environment variable (that is, it should be in a directory
1114 1122 belonging to sys.path). You can copy it explicitly there or just link to it.
1115 1123
1116 1124 IPython will create a minimal default configuration for you.
1117 1125
1118 1126 """
1119 1127 warn(warning)
1120 1128 wait()
1121 1129
1122 1130 if sys.platform =='win32':
1123 1131 inif = 'ipythonrc.ini'
1124 1132 else:
1125 1133 inif = 'ipythonrc'
1126 1134 minimal_setup = {'ipy_user_conf.py' : 'import ipy_defaults', inif : '# intentionally left blank' }
1127 1135 os.makedirs(ipythondir, mode = 0777)
1128 1136 for f, cont in minimal_setup.items():
1129 1137 open(ipythondir + '/' + f,'w').write(cont)
1130 1138
1131 1139 return
1132 1140
1133 1141 if mode == 'install':
1134 1142 try:
1135 1143 shutil.copytree(rcdir,ipythondir)
1136 1144 os.chdir(ipythondir)
1137 1145 rc_files = glb("ipythonrc*")
1138 1146 for rc_file in rc_files:
1139 1147 os.rename(rc_file,rc_file+rc_suffix)
1140 1148 except:
1141 1149 warning = """
1142 1150
1143 1151 There was a problem with the installation:
1144 1152 %s
1145 1153 Try to correct it or contact the developers if you think it's a bug.
1146 1154 IPython will proceed with builtin defaults.""" % sys.exc_info()[1]
1147 1155 warn(warning)
1148 1156 wait()
1149 1157 return
1150 1158
1151 1159 elif mode == 'upgrade':
1152 1160 try:
1153 1161 os.chdir(ipythondir)
1154 1162 except:
1155 1163 print """
1156 1164 Can not upgrade: changing to directory %s failed. Details:
1157 1165 %s
1158 1166 """ % (ipythondir,sys.exc_info()[1])
1159 1167 wait()
1160 1168 return
1161 1169 else:
1162 1170 sources = glb(os.path.join(rcdir,'[A-Za-z]*'))
1163 1171 for new_full_path in sources:
1164 1172 new_filename = os.path.basename(new_full_path)
1165 1173 if new_filename.startswith('ipythonrc'):
1166 1174 new_filename = new_filename + rc_suffix
1167 1175 # The config directory should only contain files, skip any
1168 1176 # directories which may be there (like CVS)
1169 1177 if os.path.isdir(new_full_path):
1170 1178 continue
1171 1179 if os.path.exists(new_filename):
1172 1180 old_file = new_filename+'.old'
1173 1181 if os.path.exists(old_file):
1174 1182 os.remove(old_file)
1175 1183 os.rename(new_filename,old_file)
1176 1184 shutil.copy(new_full_path,new_filename)
1177 1185 else:
1178 1186 raise ValueError,'unrecognized mode for install:',`mode`
1179 1187
1180 1188 # Fix line-endings to those native to each platform in the config
1181 1189 # directory.
1182 1190 try:
1183 1191 os.chdir(ipythondir)
1184 1192 except:
1185 1193 print """
1186 1194 Problem: changing to directory %s failed.
1187 1195 Details:
1188 1196 %s
1189 1197
1190 1198 Some configuration files may have incorrect line endings. This should not
1191 1199 cause any problems during execution. """ % (ipythondir,sys.exc_info()[1])
1192 1200 wait()
1193 1201 else:
1194 1202 for fname in glb('ipythonrc*'):
1195 1203 try:
1196 1204 native_line_ends(fname,backup=0)
1197 1205 except IOError:
1198 1206 pass
1199 1207
1200 1208 if mode == 'install':
1201 1209 print """
1202 1210 Successful installation!
1203 1211
1204 1212 Please read the sections 'Initial Configuration' and 'Quick Tips' in the
1205 1213 IPython manual (there are both HTML and PDF versions supplied with the
1206 1214 distribution) to make sure that your system environment is properly configured
1207 1215 to take advantage of IPython's features.
1208 1216
1209 1217 Important note: the configuration system has changed! The old system is
1210 1218 still in place, but its setting may be partly overridden by the settings in
1211 1219 "~/.ipython/ipy_user_conf.py" config file. Please take a look at the file
1212 1220 if some of the new settings bother you.
1213 1221
1214 1222 """
1215 1223 else:
1216 1224 print """
1217 1225 Successful upgrade!
1218 1226
1219 1227 All files in your directory:
1220 1228 %(ipythondir)s
1221 1229 which would have been overwritten by the upgrade were backed up with a .old
1222 1230 extension. If you had made particular customizations in those files you may
1223 1231 want to merge them back into the new files.""" % locals()
1224 1232 wait()
1225 1233 os.chdir(cwd)
1226 1234 # end user_setup()
1227 1235
1228 1236 def atexit_operations(self):
1229 1237 """This will be executed at the time of exit.
1230 1238
1231 1239 Saving of persistent data should be performed here. """
1232 1240
1233 1241 #print '*** IPython exit cleanup ***' # dbg
1234 1242 # input history
1235 1243 self.savehist()
1236 1244
1237 1245 # Cleanup all tempfiles left around
1238 1246 for tfile in self.tempfiles:
1239 1247 try:
1240 1248 os.unlink(tfile)
1241 1249 except OSError:
1242 1250 pass
1243 1251
1244 1252 self.hooks.shutdown_hook()
1245 1253
1246 1254 def savehist(self):
1247 1255 """Save input history to a file (via readline library)."""
1248 1256
1249 1257 if not self.has_readline:
1250 1258 return
1251 1259
1252 1260 try:
1253 1261 self.readline.write_history_file(self.histfile)
1254 1262 except:
1255 1263 print 'Unable to save IPython command history to file: ' + \
1256 1264 `self.histfile`
1257 1265
1258 1266 def reloadhist(self):
1259 1267 """Reload the input history from disk file."""
1260 1268
1261 1269 if self.has_readline:
1262 1270 self.readline.clear_history()
1263 1271 self.readline.read_history_file(self.shell.histfile)
1264 1272
1265 1273 def history_saving_wrapper(self, func):
1266 1274 """ Wrap func for readline history saving
1267 1275
1268 1276 Convert func into callable that saves & restores
1269 1277 history around the call """
1270 1278
1271 1279 if not self.has_readline:
1272 1280 return func
1273 1281
1274 1282 def wrapper():
1275 1283 self.savehist()
1276 1284 try:
1277 1285 func()
1278 1286 finally:
1279 1287 readline.read_history_file(self.histfile)
1280 1288 return wrapper
1281 1289
1282 1290
1283 1291 def pre_readline(self):
1284 1292 """readline hook to be used at the start of each line.
1285 1293
1286 1294 Currently it handles auto-indent only."""
1287 1295
1288 1296 #debugx('self.indent_current_nsp','pre_readline:')
1289 1297
1290 1298 if self.rl_do_indent:
1291 1299 self.readline.insert_text(self.indent_current_str())
1292 1300 if self.rl_next_input is not None:
1293 1301 self.readline.insert_text(self.rl_next_input)
1294 1302 self.rl_next_input = None
1295 1303
1296 1304 def init_readline(self):
1297 1305 """Command history completion/saving/reloading."""
1298 1306
1299 1307
1300 1308 import IPython.rlineimpl as readline
1301 1309
1302 1310 if not readline.have_readline:
1303 1311 self.has_readline = 0
1304 1312 self.readline = None
1305 1313 # no point in bugging windows users with this every time:
1306 1314 warn('Readline services not available on this platform.')
1307 1315 else:
1308 1316 sys.modules['readline'] = readline
1309 1317 import atexit
1310 1318 from IPython.completer import IPCompleter
1311 1319 self.Completer = IPCompleter(self,
1312 1320 self.user_ns,
1313 1321 self.user_global_ns,
1314 1322 self.rc.readline_omit__names,
1315 1323 self.alias_table)
1316 1324 sdisp = self.strdispatchers.get('complete_command', StrDispatch())
1317 1325 self.strdispatchers['complete_command'] = sdisp
1318 1326 self.Completer.custom_completers = sdisp
1319 1327 # Platform-specific configuration
1320 1328 if os.name == 'nt':
1321 1329 self.readline_startup_hook = readline.set_pre_input_hook
1322 1330 else:
1323 1331 self.readline_startup_hook = readline.set_startup_hook
1324 1332
1325 1333 # Load user's initrc file (readline config)
1326 1334 # Or if libedit is used, load editrc.
1327 1335 inputrc_name = os.environ.get('INPUTRC')
1328 1336 if inputrc_name is None:
1329 1337 home_dir = get_home_dir()
1330 1338 if home_dir is not None:
1331 1339 inputrc_name = '.inputrc'
1332 1340 if readline.uses_libedit:
1333 1341 inputrc_name = '.editrc'
1334 1342 inputrc_name = os.path.join(home_dir, inputrc_name)
1335 1343 if os.path.isfile(inputrc_name):
1336 1344 try:
1337 1345 readline.read_init_file(inputrc_name)
1338 1346 except:
1339 1347 warn('Problems reading readline initialization file <%s>'
1340 1348 % inputrc_name)
1341 1349
1342 1350 self.has_readline = 1
1343 1351 self.readline = readline
1344 1352 # save this in sys so embedded copies can restore it properly
1345 1353 sys.ipcompleter = self.Completer.complete
1346 1354 self.set_completer()
1347 1355
1348 1356 # Configure readline according to user's prefs
1349 1357 # This is only done if GNU readline is being used. If libedit
1350 1358 # is being used (as on Leopard) the readline config is
1351 1359 # not run as the syntax for libedit is different.
1352 1360 if not readline.uses_libedit:
1353 1361 for rlcommand in self.rc.readline_parse_and_bind:
1354 1362 readline.parse_and_bind(rlcommand)
1355 1363
1356 1364 # remove some chars from the delimiters list
1357 1365 delims = readline.get_completer_delims()
1358 1366 delims = delims.translate(string._idmap,
1359 1367 self.rc.readline_remove_delims)
1360 1368 readline.set_completer_delims(delims)
1361 1369 # otherwise we end up with a monster history after a while:
1362 1370 readline.set_history_length(1000)
1363 1371 try:
1364 1372 #print '*** Reading readline history' # dbg
1365 1373 readline.read_history_file(self.histfile)
1366 1374 except IOError:
1367 1375 pass # It doesn't exist yet.
1368 1376
1369 1377 atexit.register(self.atexit_operations)
1370 1378 del atexit
1371 1379
1372 1380 # Configure auto-indent for all platforms
1373 1381 self.set_autoindent(self.rc.autoindent)
1374 1382
1375 1383 def ask_yes_no(self,prompt,default=True):
1376 1384 if self.rc.quiet:
1377 1385 return True
1378 1386 return ask_yes_no(prompt,default)
1379 1387
1380 1388 def _should_recompile(self,e):
1381 1389 """Utility routine for edit_syntax_error"""
1382 1390
1383 1391 if e.filename in ('<ipython console>','<input>','<string>',
1384 1392 '<console>','<BackgroundJob compilation>',
1385 1393 None):
1386 1394
1387 1395 return False
1388 1396 try:
1389 1397 if (self.rc.autoedit_syntax and
1390 1398 not self.ask_yes_no('Return to editor to correct syntax error? '
1391 1399 '[Y/n] ','y')):
1392 1400 return False
1393 1401 except EOFError:
1394 1402 return False
1395 1403
1396 1404 def int0(x):
1397 1405 try:
1398 1406 return int(x)
1399 1407 except TypeError:
1400 1408 return 0
1401 1409 # always pass integer line and offset values to editor hook
1402 1410 self.hooks.fix_error_editor(e.filename,
1403 1411 int0(e.lineno),int0(e.offset),e.msg)
1404 1412 return True
1405 1413
1406 1414 def edit_syntax_error(self):
1407 1415 """The bottom half of the syntax error handler called in the main loop.
1408 1416
1409 1417 Loop until syntax error is fixed or user cancels.
1410 1418 """
1411 1419
1412 1420 while self.SyntaxTB.last_syntax_error:
1413 1421 # copy and clear last_syntax_error
1414 1422 err = self.SyntaxTB.clear_err_state()
1415 1423 if not self._should_recompile(err):
1416 1424 return
1417 1425 try:
1418 1426 # may set last_syntax_error again if a SyntaxError is raised
1419 1427 self.safe_execfile(err.filename,self.user_ns)
1420 1428 except:
1421 1429 self.showtraceback()
1422 1430 else:
1423 1431 try:
1424 1432 f = file(err.filename)
1425 1433 try:
1426 1434 sys.displayhook(f.read())
1427 1435 finally:
1428 1436 f.close()
1429 1437 except:
1430 1438 self.showtraceback()
1431 1439
1432 1440 def showsyntaxerror(self, filename=None):
1433 1441 """Display the syntax error that just occurred.
1434 1442
1435 1443 This doesn't display a stack trace because there isn't one.
1436 1444
1437 1445 If a filename is given, it is stuffed in the exception instead
1438 1446 of what was there before (because Python's parser always uses
1439 1447 "<string>" when reading from a string).
1440 1448 """
1441 1449 etype, value, last_traceback = sys.exc_info()
1442 1450
1443 1451 # See note about these variables in showtraceback() below
1444 1452 sys.last_type = etype
1445 1453 sys.last_value = value
1446 1454 sys.last_traceback = last_traceback
1447 1455
1448 1456 if filename and etype is SyntaxError:
1449 1457 # Work hard to stuff the correct filename in the exception
1450 1458 try:
1451 1459 msg, (dummy_filename, lineno, offset, line) = value
1452 1460 except:
1453 1461 # Not the format we expect; leave it alone
1454 1462 pass
1455 1463 else:
1456 1464 # Stuff in the right filename
1457 1465 try:
1458 1466 # Assume SyntaxError is a class exception
1459 1467 value = SyntaxError(msg, (filename, lineno, offset, line))
1460 1468 except:
1461 1469 # If that failed, assume SyntaxError is a string
1462 1470 value = msg, (filename, lineno, offset, line)
1463 1471 self.SyntaxTB(etype,value,[])
1464 1472
1465 1473 def debugger(self,force=False):
1466 1474 """Call the pydb/pdb debugger.
1467 1475
1468 1476 Keywords:
1469 1477
1470 1478 - force(False): by default, this routine checks the instance call_pdb
1471 1479 flag and does not actually invoke the debugger if the flag is false.
1472 1480 The 'force' option forces the debugger to activate even if the flag
1473 1481 is false.
1474 1482 """
1475 1483
1476 1484 if not (force or self.call_pdb):
1477 1485 return
1478 1486
1479 1487 if not hasattr(sys,'last_traceback'):
1480 1488 error('No traceback has been produced, nothing to debug.')
1481 1489 return
1482 1490
1483 1491 # use pydb if available
1484 1492 if Debugger.has_pydb:
1485 1493 from pydb import pm
1486 1494 else:
1487 1495 # fallback to our internal debugger
1488 1496 pm = lambda : self.InteractiveTB.debugger(force=True)
1489 1497 self.history_saving_wrapper(pm)()
1490 1498
1491 1499 def showtraceback(self,exc_tuple = None,filename=None,tb_offset=None):
1492 1500 """Display the exception that just occurred.
1493 1501
1494 1502 If nothing is known about the exception, this is the method which
1495 1503 should be used throughout the code for presenting user tracebacks,
1496 1504 rather than directly invoking the InteractiveTB object.
1497 1505
1498 1506 A specific showsyntaxerror() also exists, but this method can take
1499 1507 care of calling it if needed, so unless you are explicitly catching a
1500 1508 SyntaxError exception, don't try to analyze the stack manually and
1501 1509 simply call this method."""
1502 1510
1503 1511
1504 1512 # Though this won't be called by syntax errors in the input line,
1505 1513 # there may be SyntaxError cases whith imported code.
1506 1514
1507 1515 try:
1508 1516 if exc_tuple is None:
1509 1517 etype, value, tb = sys.exc_info()
1510 1518 else:
1511 1519 etype, value, tb = exc_tuple
1512 1520
1513 1521 if etype is SyntaxError:
1514 1522 self.showsyntaxerror(filename)
1515 1523 elif etype is IPython.ipapi.UsageError:
1516 1524 print "UsageError:", value
1517 1525 else:
1518 1526 # WARNING: these variables are somewhat deprecated and not
1519 1527 # necessarily safe to use in a threaded environment, but tools
1520 1528 # like pdb depend on their existence, so let's set them. If we
1521 1529 # find problems in the field, we'll need to revisit their use.
1522 1530 sys.last_type = etype
1523 1531 sys.last_value = value
1524 1532 sys.last_traceback = tb
1525 1533
1526 1534 if etype in self.custom_exceptions:
1527 1535 self.CustomTB(etype,value,tb)
1528 1536 else:
1529 1537 self.InteractiveTB(etype,value,tb,tb_offset=tb_offset)
1530 1538 if self.InteractiveTB.call_pdb and self.has_readline:
1531 1539 # pdb mucks up readline, fix it back
1532 1540 self.set_completer()
1533 1541 except KeyboardInterrupt:
1534 1542 self.write("\nKeyboardInterrupt\n")
1535 1543
1536 1544
1537 1545
1538 1546 def mainloop(self,banner=None):
1539 1547 """Creates the local namespace and starts the mainloop.
1540 1548
1541 1549 If an optional banner argument is given, it will override the
1542 1550 internally created default banner."""
1543 1551
1544 1552 if self.rc.c: # Emulate Python's -c option
1545 1553 self.exec_init_cmd()
1546 1554 if banner is None:
1547 1555 if not self.rc.banner:
1548 1556 banner = ''
1549 1557 # banner is string? Use it directly!
1550 1558 elif isinstance(self.rc.banner,basestring):
1551 1559 banner = self.rc.banner
1552 1560 else:
1553 1561 banner = self.BANNER+self.banner2
1554 1562
1555 1563 while 1:
1556 1564 try:
1557 1565 self.interact(banner)
1558 1566 break
1559 1567 except KeyboardInterrupt:
1560 1568 # this should not be necessary, but KeyboardInterrupt
1561 1569 # handling seems rather unpredictable...
1562 1570 self.write("\nKeyboardInterrupt in interact()\n")
1563 1571
1564 1572 def exec_init_cmd(self):
1565 1573 """Execute a command given at the command line.
1566 1574
1567 1575 This emulates Python's -c option."""
1568 1576
1569 1577 #sys.argv = ['-c']
1570 1578 self.push(self.prefilter(self.rc.c, False))
1571 1579 if not self.rc.interact:
1572 1580 self.exit_now = True
1573 1581
1574 1582 def embed_mainloop(self,header='',local_ns=None,global_ns=None,stack_depth=0):
1575 1583 """Embeds IPython into a running python program.
1576 1584
1577 1585 Input:
1578 1586
1579 1587 - header: An optional header message can be specified.
1580 1588
1581 1589 - local_ns, global_ns: working namespaces. If given as None, the
1582 1590 IPython-initialized one is updated with __main__.__dict__, so that
1583 1591 program variables become visible but user-specific configuration
1584 1592 remains possible.
1585 1593
1586 1594 - stack_depth: specifies how many levels in the stack to go to
1587 1595 looking for namespaces (when local_ns and global_ns are None). This
1588 1596 allows an intermediate caller to make sure that this function gets
1589 1597 the namespace from the intended level in the stack. By default (0)
1590 1598 it will get its locals and globals from the immediate caller.
1591 1599
1592 1600 Warning: it's possible to use this in a program which is being run by
1593 1601 IPython itself (via %run), but some funny things will happen (a few
1594 1602 globals get overwritten). In the future this will be cleaned up, as
1595 1603 there is no fundamental reason why it can't work perfectly."""
1596 1604
1597 1605 # Get locals and globals from caller
1598 1606 if local_ns is None or global_ns is None:
1599 1607 call_frame = sys._getframe(stack_depth).f_back
1600 1608
1601 1609 if local_ns is None:
1602 1610 local_ns = call_frame.f_locals
1603 1611 if global_ns is None:
1604 1612 global_ns = call_frame.f_globals
1605 1613
1606 1614 # Update namespaces and fire up interpreter
1607 1615
1608 1616 # The global one is easy, we can just throw it in
1609 1617 self.user_global_ns = global_ns
1610 1618
1611 1619 # but the user/local one is tricky: ipython needs it to store internal
1612 1620 # data, but we also need the locals. We'll copy locals in the user
1613 1621 # one, but will track what got copied so we can delete them at exit.
1614 1622 # This is so that a later embedded call doesn't see locals from a
1615 1623 # previous call (which most likely existed in a separate scope).
1616 1624 local_varnames = local_ns.keys()
1617 1625 self.user_ns.update(local_ns)
1618 1626
1619 1627 # Patch for global embedding to make sure that things don't overwrite
1620 1628 # user globals accidentally. Thanks to Richard <rxe@renre-europe.com>
1621 1629 # FIXME. Test this a bit more carefully (the if.. is new)
1622 1630 if local_ns is None and global_ns is None:
1623 1631 self.user_global_ns.update(__main__.__dict__)
1624 1632
1625 1633 # make sure the tab-completer has the correct frame information, so it
1626 1634 # actually completes using the frame's locals/globals
1627 1635 self.set_completer_frame()
1628 1636
1629 1637 # before activating the interactive mode, we need to make sure that
1630 1638 # all names in the builtin namespace needed by ipython point to
1631 1639 # ourselves, and not to other instances.
1632 1640 self.add_builtins()
1633 1641
1634 1642 self.interact(header)
1635 1643
1636 1644 # now, purge out the user namespace from anything we might have added
1637 1645 # from the caller's local namespace
1638 1646 delvar = self.user_ns.pop
1639 1647 for var in local_varnames:
1640 1648 delvar(var,None)
1641 1649 # and clean builtins we may have overridden
1642 1650 self.clean_builtins()
1643 1651
1644 1652 def interact(self, banner=None):
1645 1653 """Closely emulate the interactive Python console.
1646 1654
1647 1655 The optional banner argument specify the banner to print
1648 1656 before the first interaction; by default it prints a banner
1649 1657 similar to the one printed by the real Python interpreter,
1650 1658 followed by the current class name in parentheses (so as not
1651 1659 to confuse this with the real interpreter -- since it's so
1652 1660 close!).
1653 1661
1654 1662 """
1655 1663
1656 1664 if self.exit_now:
1657 1665 # batch run -> do not interact
1658 1666 return
1659 1667 cprt = 'Type "copyright", "credits" or "license" for more information.'
1660 1668 if banner is None:
1661 1669 self.write("Python %s on %s\n%s\n(%s)\n" %
1662 1670 (sys.version, sys.platform, cprt,
1663 1671 self.__class__.__name__))
1664 1672 else:
1665 1673 self.write(banner)
1666 1674
1667 1675 more = 0
1668 1676
1669 1677 # Mark activity in the builtins
1670 1678 __builtin__.__dict__['__IPYTHON__active'] += 1
1671 1679
1672 1680 if self.has_readline:
1673 1681 self.readline_startup_hook(self.pre_readline)
1674 1682 # exit_now is set by a call to %Exit or %Quit
1675 1683
1676 1684 while not self.exit_now:
1677 1685 if more:
1678 1686 try:
1679 1687 prompt = self.hooks.generate_prompt(True)
1680 1688 except:
1681 1689 self.showtraceback()
1682 1690 if self.autoindent:
1683 1691 self.rl_do_indent = True
1684 1692
1685 1693 else:
1686 1694 try:
1687 1695 prompt = self.hooks.generate_prompt(False)
1688 1696 except:
1689 1697 self.showtraceback()
1690 1698 try:
1691 1699 line = self.raw_input(prompt,more)
1692 1700 if self.exit_now:
1693 1701 # quick exit on sys.std[in|out] close
1694 1702 break
1695 1703 if self.autoindent:
1696 1704 self.rl_do_indent = False
1697 1705
1698 1706 except KeyboardInterrupt:
1699 1707 #double-guard against keyboardinterrupts during kbdint handling
1700 1708 try:
1701 1709 self.write('\nKeyboardInterrupt\n')
1702 1710 self.resetbuffer()
1703 1711 # keep cache in sync with the prompt counter:
1704 1712 self.outputcache.prompt_count -= 1
1705 1713
1706 1714 if self.autoindent:
1707 1715 self.indent_current_nsp = 0
1708 1716 more = 0
1709 1717 except KeyboardInterrupt:
1710 1718 pass
1711 1719 except EOFError:
1712 1720 if self.autoindent:
1713 1721 self.rl_do_indent = False
1714 1722 self.readline_startup_hook(None)
1715 1723 self.write('\n')
1716 1724 self.exit()
1717 1725 except bdb.BdbQuit:
1718 1726 warn('The Python debugger has exited with a BdbQuit exception.\n'
1719 1727 'Because of how pdb handles the stack, it is impossible\n'
1720 1728 'for IPython to properly format this particular exception.\n'
1721 1729 'IPython will resume normal operation.')
1722 1730 except:
1723 1731 # exceptions here are VERY RARE, but they can be triggered
1724 1732 # asynchronously by signal handlers, for example.
1725 1733 self.showtraceback()
1726 1734 else:
1727 1735 more = self.push(line)
1728 1736 if (self.SyntaxTB.last_syntax_error and
1729 1737 self.rc.autoedit_syntax):
1730 1738 self.edit_syntax_error()
1731 1739
1732 1740 # We are off again...
1733 1741 __builtin__.__dict__['__IPYTHON__active'] -= 1
1734 1742
1735 1743 def excepthook(self, etype, value, tb):
1736 1744 """One more defense for GUI apps that call sys.excepthook.
1737 1745
1738 1746 GUI frameworks like wxPython trap exceptions and call
1739 1747 sys.excepthook themselves. I guess this is a feature that
1740 1748 enables them to keep running after exceptions that would
1741 1749 otherwise kill their mainloop. This is a bother for IPython
1742 1750 which excepts to catch all of the program exceptions with a try:
1743 1751 except: statement.
1744 1752
1745 1753 Normally, IPython sets sys.excepthook to a CrashHandler instance, so if
1746 1754 any app directly invokes sys.excepthook, it will look to the user like
1747 1755 IPython crashed. In order to work around this, we can disable the
1748 1756 CrashHandler and replace it with this excepthook instead, which prints a
1749 1757 regular traceback using our InteractiveTB. In this fashion, apps which
1750 1758 call sys.excepthook will generate a regular-looking exception from
1751 1759 IPython, and the CrashHandler will only be triggered by real IPython
1752 1760 crashes.
1753 1761
1754 1762 This hook should be used sparingly, only in places which are not likely
1755 1763 to be true IPython errors.
1756 1764 """
1757 1765 self.showtraceback((etype,value,tb),tb_offset=0)
1758 1766
1759 1767 def expand_aliases(self,fn,rest):
1760 1768 """ Expand multiple levels of aliases:
1761 1769
1762 1770 if:
1763 1771
1764 1772 alias foo bar /tmp
1765 1773 alias baz foo
1766 1774
1767 1775 then:
1768 1776
1769 1777 baz huhhahhei -> bar /tmp huhhahhei
1770 1778
1771 1779 """
1772 1780 line = fn + " " + rest
1773 1781
1774 1782 done = Set()
1775 1783 while 1:
1776 1784 pre,fn,rest = prefilter.splitUserInput(line,
1777 1785 prefilter.shell_line_split)
1778 1786 if fn in self.alias_table:
1779 1787 if fn in done:
1780 1788 warn("Cyclic alias definition, repeated '%s'" % fn)
1781 1789 return ""
1782 1790 done.add(fn)
1783 1791
1784 1792 l2 = self.transform_alias(fn,rest)
1785 1793 # dir -> dir
1786 1794 # print "alias",line, "->",l2 #dbg
1787 1795 if l2 == line:
1788 1796 break
1789 1797 # ls -> ls -F should not recurse forever
1790 1798 if l2.split(None,1)[0] == line.split(None,1)[0]:
1791 1799 line = l2
1792 1800 break
1793 1801
1794 1802 line=l2
1795 1803
1796 1804
1797 1805 # print "al expand to",line #dbg
1798 1806 else:
1799 1807 break
1800 1808
1801 1809 return line
1802 1810
1803 1811 def transform_alias(self, alias,rest=''):
1804 1812 """ Transform alias to system command string.
1805 1813 """
1806 1814 trg = self.alias_table[alias]
1807 1815
1808 1816 nargs,cmd = trg
1809 1817 # print trg #dbg
1810 1818 if ' ' in cmd and os.path.isfile(cmd):
1811 1819 cmd = '"%s"' % cmd
1812 1820
1813 1821 # Expand the %l special to be the user's input line
1814 1822 if cmd.find('%l') >= 0:
1815 1823 cmd = cmd.replace('%l',rest)
1816 1824 rest = ''
1817 1825 if nargs==0:
1818 1826 # Simple, argument-less aliases
1819 1827 cmd = '%s %s' % (cmd,rest)
1820 1828 else:
1821 1829 # Handle aliases with positional arguments
1822 1830 args = rest.split(None,nargs)
1823 1831 if len(args)< nargs:
1824 1832 error('Alias <%s> requires %s arguments, %s given.' %
1825 1833 (alias,nargs,len(args)))
1826 1834 return None
1827 1835 cmd = '%s %s' % (cmd % tuple(args[:nargs]),' '.join(args[nargs:]))
1828 1836 # Now call the macro, evaluating in the user's namespace
1829 1837 #print 'new command: <%r>' % cmd # dbg
1830 1838 return cmd
1831 1839
1832 1840 def call_alias(self,alias,rest=''):
1833 1841 """Call an alias given its name and the rest of the line.
1834 1842
1835 1843 This is only used to provide backwards compatibility for users of
1836 1844 ipalias(), use of which is not recommended for anymore."""
1837 1845
1838 1846 # Now call the macro, evaluating in the user's namespace
1839 1847 cmd = self.transform_alias(alias, rest)
1840 1848 try:
1841 1849 self.system(cmd)
1842 1850 except:
1843 1851 self.showtraceback()
1844 1852
1845 1853 def indent_current_str(self):
1846 1854 """return the current level of indentation as a string"""
1847 1855 return self.indent_current_nsp * ' '
1848 1856
1849 1857 def autoindent_update(self,line):
1850 1858 """Keep track of the indent level."""
1851 1859
1852 1860 #debugx('line')
1853 1861 #debugx('self.indent_current_nsp')
1854 1862 if self.autoindent:
1855 1863 if line:
1856 1864 inisp = num_ini_spaces(line)
1857 1865 if inisp < self.indent_current_nsp:
1858 1866 self.indent_current_nsp = inisp
1859 1867
1860 1868 if line[-1] == ':':
1861 1869 self.indent_current_nsp += 4
1862 1870 elif dedent_re.match(line):
1863 1871 self.indent_current_nsp -= 4
1864 1872 else:
1865 1873 self.indent_current_nsp = 0
1866 1874
1867 1875 def runlines(self,lines):
1868 1876 """Run a string of one or more lines of source.
1869 1877
1870 1878 This method is capable of running a string containing multiple source
1871 1879 lines, as if they had been entered at the IPython prompt. Since it
1872 1880 exposes IPython's processing machinery, the given strings can contain
1873 1881 magic calls (%magic), special shell access (!cmd), etc."""
1874 1882
1875 1883 # We must start with a clean buffer, in case this is run from an
1876 1884 # interactive IPython session (via a magic, for example).
1877 1885 self.resetbuffer()
1878 1886 lines = lines.split('\n')
1879 1887 more = 0
1880 1888
1881 1889 for line in lines:
1882 1890 # skip blank lines so we don't mess up the prompt counter, but do
1883 1891 # NOT skip even a blank line if we are in a code block (more is
1884 1892 # true)
1885 1893
1886 1894
1887 1895 if line or more:
1888 1896 # push to raw history, so hist line numbers stay in sync
1889 1897 self.input_hist_raw.append("# " + line + "\n")
1890 1898 more = self.push(self.prefilter(line,more))
1891 1899 # IPython's runsource returns None if there was an error
1892 1900 # compiling the code. This allows us to stop processing right
1893 1901 # away, so the user gets the error message at the right place.
1894 1902 if more is None:
1895 1903 break
1896 1904 else:
1897 1905 self.input_hist_raw.append("\n")
1898 1906 # final newline in case the input didn't have it, so that the code
1899 1907 # actually does get executed
1900 1908 if more:
1901 1909 self.push('\n')
1902 1910
1903 1911 def runsource(self, source, filename='<input>', symbol='single'):
1904 1912 """Compile and run some source in the interpreter.
1905 1913
1906 1914 Arguments are as for compile_command().
1907 1915
1908 1916 One several things can happen:
1909 1917
1910 1918 1) The input is incorrect; compile_command() raised an
1911 1919 exception (SyntaxError or OverflowError). A syntax traceback
1912 1920 will be printed by calling the showsyntaxerror() method.
1913 1921
1914 1922 2) The input is incomplete, and more input is required;
1915 1923 compile_command() returned None. Nothing happens.
1916 1924
1917 1925 3) The input is complete; compile_command() returned a code
1918 1926 object. The code is executed by calling self.runcode() (which
1919 1927 also handles run-time exceptions, except for SystemExit).
1920 1928
1921 1929 The return value is:
1922 1930
1923 1931 - True in case 2
1924 1932
1925 1933 - False in the other cases, unless an exception is raised, where
1926 1934 None is returned instead. This can be used by external callers to
1927 1935 know whether to continue feeding input or not.
1928 1936
1929 1937 The return value can be used to decide whether to use sys.ps1 or
1930 1938 sys.ps2 to prompt the next line."""
1931 1939
1932 1940 # if the source code has leading blanks, add 'if 1:\n' to it
1933 1941 # this allows execution of indented pasted code. It is tempting
1934 1942 # to add '\n' at the end of source to run commands like ' a=1'
1935 1943 # directly, but this fails for more complicated scenarios
1936 1944 source=source.encode(self.stdin_encoding)
1937 1945 if source[:1] in [' ', '\t']:
1938 1946 source = 'if 1:\n%s' % source
1939 1947
1940 1948 try:
1941 1949 code = self.compile(source,filename,symbol)
1942 1950 except (OverflowError, SyntaxError, ValueError):
1943 1951 # Case 1
1944 1952 self.showsyntaxerror(filename)
1945 1953 return None
1946 1954
1947 1955 if code is None:
1948 1956 # Case 2
1949 1957 return True
1950 1958
1951 1959 # Case 3
1952 1960 # We store the code object so that threaded shells and
1953 1961 # custom exception handlers can access all this info if needed.
1954 1962 # The source corresponding to this can be obtained from the
1955 1963 # buffer attribute as '\n'.join(self.buffer).
1956 1964 self.code_to_run = code
1957 1965 # now actually execute the code object
1958 1966 if self.runcode(code) == 0:
1959 1967 return False
1960 1968 else:
1961 1969 return None
1962 1970
1963 1971 def runcode(self,code_obj):
1964 1972 """Execute a code object.
1965 1973
1966 1974 When an exception occurs, self.showtraceback() is called to display a
1967 1975 traceback.
1968 1976
1969 1977 Return value: a flag indicating whether the code to be run completed
1970 1978 successfully:
1971 1979
1972 1980 - 0: successful execution.
1973 1981 - 1: an error occurred.
1974 1982 """
1975 1983
1976 1984 # Set our own excepthook in case the user code tries to call it
1977 1985 # directly, so that the IPython crash handler doesn't get triggered
1978 1986 old_excepthook,sys.excepthook = sys.excepthook, self.excepthook
1979 1987
1980 1988 # we save the original sys.excepthook in the instance, in case config
1981 1989 # code (such as magics) needs access to it.
1982 1990 self.sys_excepthook = old_excepthook
1983 1991 outflag = 1 # happens in more places, so it's easier as default
1984 1992 try:
1985 1993 try:
1986 1994 # Embedded instances require separate global/local namespaces
1987 1995 # so they can see both the surrounding (local) namespace and
1988 1996 # the module-level globals when called inside another function.
1989 1997 if self.embedded:
1990 1998 exec code_obj in self.user_global_ns, self.user_ns
1991 1999 # Normal (non-embedded) instances should only have a single
1992 2000 # namespace for user code execution, otherwise functions won't
1993 2001 # see interactive top-level globals.
1994 2002 else:
1995 2003 exec code_obj in self.user_ns
1996 2004 finally:
1997 2005 # Reset our crash handler in place
1998 2006 sys.excepthook = old_excepthook
1999 2007 except SystemExit:
2000 2008 self.resetbuffer()
2001 2009 self.showtraceback()
2002 2010 warn("Type %exit or %quit to exit IPython "
2003 2011 "(%Exit or %Quit do so unconditionally).",level=1)
2004 2012 except self.custom_exceptions:
2005 2013 etype,value,tb = sys.exc_info()
2006 2014 self.CustomTB(etype,value,tb)
2007 2015 except:
2008 2016 self.showtraceback()
2009 2017 else:
2010 2018 outflag = 0
2011 2019 if softspace(sys.stdout, 0):
2012 2020 print
2013 2021 # Flush out code object which has been run (and source)
2014 2022 self.code_to_run = None
2015 2023 return outflag
2016 2024
2017 2025 def push(self, line):
2018 2026 """Push a line to the interpreter.
2019 2027
2020 2028 The line should not have a trailing newline; it may have
2021 2029 internal newlines. The line is appended to a buffer and the
2022 2030 interpreter's runsource() method is called with the
2023 2031 concatenated contents of the buffer as source. If this
2024 2032 indicates that the command was executed or invalid, the buffer
2025 2033 is reset; otherwise, the command is incomplete, and the buffer
2026 2034 is left as it was after the line was appended. The return
2027 2035 value is 1 if more input is required, 0 if the line was dealt
2028 2036 with in some way (this is the same as runsource()).
2029 2037 """
2030 2038
2031 2039 # autoindent management should be done here, and not in the
2032 2040 # interactive loop, since that one is only seen by keyboard input. We
2033 2041 # need this done correctly even for code run via runlines (which uses
2034 2042 # push).
2035 2043
2036 2044 #print 'push line: <%s>' % line # dbg
2037 2045 for subline in line.splitlines():
2038 2046 self.autoindent_update(subline)
2039 2047 self.buffer.append(line)
2040 2048 more = self.runsource('\n'.join(self.buffer), self.filename)
2041 2049 if not more:
2042 2050 self.resetbuffer()
2043 2051 return more
2044 2052
2045 2053 def split_user_input(self, line):
2046 2054 # This is really a hold-over to support ipapi and some extensions
2047 2055 return prefilter.splitUserInput(line)
2048 2056
2049 2057 def resetbuffer(self):
2050 2058 """Reset the input buffer."""
2051 2059 self.buffer[:] = []
2052 2060
2053 2061 def raw_input(self,prompt='',continue_prompt=False):
2054 2062 """Write a prompt and read a line.
2055 2063
2056 2064 The returned line does not include the trailing newline.
2057 2065 When the user enters the EOF key sequence, EOFError is raised.
2058 2066
2059 2067 Optional inputs:
2060 2068
2061 2069 - prompt(''): a string to be printed to prompt the user.
2062 2070
2063 2071 - continue_prompt(False): whether this line is the first one or a
2064 2072 continuation in a sequence of inputs.
2065 2073 """
2066 2074
2067 2075 # Code run by the user may have modified the readline completer state.
2068 2076 # We must ensure that our completer is back in place.
2069 2077 if self.has_readline:
2070 2078 self.set_completer()
2071 2079
2072 2080 try:
2073 2081 line = raw_input_original(prompt).decode(self.stdin_encoding)
2074 2082 except ValueError:
2075 2083 warn("\n********\nYou or a %run:ed script called sys.stdin.close()"
2076 2084 " or sys.stdout.close()!\nExiting IPython!")
2077 2085 self.exit_now = True
2078 2086 return ""
2079 2087
2080 2088 # Try to be reasonably smart about not re-indenting pasted input more
2081 2089 # than necessary. We do this by trimming out the auto-indent initial
2082 2090 # spaces, if the user's actual input started itself with whitespace.
2083 2091 #debugx('self.buffer[-1]')
2084 2092
2085 2093 if self.autoindent:
2086 2094 if num_ini_spaces(line) > self.indent_current_nsp:
2087 2095 line = line[self.indent_current_nsp:]
2088 2096 self.indent_current_nsp = 0
2089 2097
2090 2098 # store the unfiltered input before the user has any chance to modify
2091 2099 # it.
2092 2100 if line.strip():
2093 2101 if continue_prompt:
2094 2102 self.input_hist_raw[-1] += '%s\n' % line
2095 2103 if self.has_readline: # and some config option is set?
2096 2104 try:
2097 2105 histlen = self.readline.get_current_history_length()
2098 2106 if histlen > 1:
2099 2107 newhist = self.input_hist_raw[-1].rstrip()
2100 2108 self.readline.remove_history_item(histlen-1)
2101 2109 self.readline.replace_history_item(histlen-2,
2102 2110 newhist.encode(self.stdin_encoding))
2103 2111 except AttributeError:
2104 2112 pass # re{move,place}_history_item are new in 2.4.
2105 2113 else:
2106 2114 self.input_hist_raw.append('%s\n' % line)
2107 2115 # only entries starting at first column go to shadow history
2108 2116 if line.lstrip() == line:
2109 2117 self.shadowhist.add(line.strip())
2110 2118 elif not continue_prompt:
2111 2119 self.input_hist_raw.append('\n')
2112 2120 try:
2113 2121 lineout = self.prefilter(line,continue_prompt)
2114 2122 except:
2115 2123 # blanket except, in case a user-defined prefilter crashes, so it
2116 2124 # can't take all of ipython with it.
2117 2125 self.showtraceback()
2118 2126 return ''
2119 2127 else:
2120 2128 return lineout
2121 2129
2122 2130 def _prefilter(self, line, continue_prompt):
2123 2131 """Calls different preprocessors, depending on the form of line."""
2124 2132
2125 2133 # All handlers *must* return a value, even if it's blank ('').
2126 2134
2127 2135 # Lines are NOT logged here. Handlers should process the line as
2128 2136 # needed, update the cache AND log it (so that the input cache array
2129 2137 # stays synced).
2130 2138
2131 2139 #.....................................................................
2132 2140 # Code begins
2133 2141
2134 2142 #if line.startswith('%crash'): raise RuntimeError,'Crash now!' # dbg
2135 2143
2136 2144 # save the line away in case we crash, so the post-mortem handler can
2137 2145 # record it
2138 2146 self._last_input_line = line
2139 2147
2140 2148 #print '***line: <%s>' % line # dbg
2141 2149
2142 2150 if not line:
2143 2151 # Return immediately on purely empty lines, so that if the user
2144 2152 # previously typed some whitespace that started a continuation
2145 2153 # prompt, he can break out of that loop with just an empty line.
2146 2154 # This is how the default python prompt works.
2147 2155
2148 2156 # Only return if the accumulated input buffer was just whitespace!
2149 2157 if ''.join(self.buffer).isspace():
2150 2158 self.buffer[:] = []
2151 2159 return ''
2152 2160
2153 2161 line_info = prefilter.LineInfo(line, continue_prompt)
2154 2162
2155 2163 # the input history needs to track even empty lines
2156 2164 stripped = line.strip()
2157 2165
2158 2166 if not stripped:
2159 2167 if not continue_prompt:
2160 2168 self.outputcache.prompt_count -= 1
2161 2169 return self.handle_normal(line_info)
2162 2170
2163 2171 # print '***cont',continue_prompt # dbg
2164 2172 # special handlers are only allowed for single line statements
2165 2173 if continue_prompt and not self.rc.multi_line_specials:
2166 2174 return self.handle_normal(line_info)
2167 2175
2168 2176
2169 2177 # See whether any pre-existing handler can take care of it
2170 2178 rewritten = self.hooks.input_prefilter(stripped)
2171 2179 if rewritten != stripped: # ok, some prefilter did something
2172 2180 rewritten = line_info.pre + rewritten # add indentation
2173 2181 return self.handle_normal(prefilter.LineInfo(rewritten,
2174 2182 continue_prompt))
2175 2183
2176 2184 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
2177 2185
2178 2186 return prefilter.prefilter(line_info, self)
2179 2187
2180 2188
2181 2189 def _prefilter_dumb(self, line, continue_prompt):
2182 2190 """simple prefilter function, for debugging"""
2183 2191 return self.handle_normal(line,continue_prompt)
2184 2192
2185 2193
2186 2194 def multiline_prefilter(self, line, continue_prompt):
2187 2195 """ Run _prefilter for each line of input
2188 2196
2189 2197 Covers cases where there are multiple lines in the user entry,
2190 2198 which is the case when the user goes back to a multiline history
2191 2199 entry and presses enter.
2192 2200
2193 2201 """
2194 2202 out = []
2195 2203 for l in line.rstrip('\n').split('\n'):
2196 2204 out.append(self._prefilter(l, continue_prompt))
2197 2205 return '\n'.join(out)
2198 2206
2199 2207 # Set the default prefilter() function (this can be user-overridden)
2200 2208 prefilter = multiline_prefilter
2201 2209
2202 2210 def handle_normal(self,line_info):
2203 2211 """Handle normal input lines. Use as a template for handlers."""
2204 2212
2205 2213 # With autoindent on, we need some way to exit the input loop, and I
2206 2214 # don't want to force the user to have to backspace all the way to
2207 2215 # clear the line. The rule will be in this case, that either two
2208 2216 # lines of pure whitespace in a row, or a line of pure whitespace but
2209 2217 # of a size different to the indent level, will exit the input loop.
2210 2218 line = line_info.line
2211 2219 continue_prompt = line_info.continue_prompt
2212 2220
2213 2221 if (continue_prompt and self.autoindent and line.isspace() and
2214 2222 (0 < abs(len(line) - self.indent_current_nsp) <= 2 or
2215 2223 (self.buffer[-1]).isspace() )):
2216 2224 line = ''
2217 2225
2218 2226 self.log(line,line,continue_prompt)
2219 2227 return line
2220 2228
2221 2229 def handle_alias(self,line_info):
2222 2230 """Handle alias input lines. """
2223 2231 tgt = self.alias_table[line_info.iFun]
2224 2232 # print "=>",tgt #dbg
2225 2233 if callable(tgt):
2226 2234 if '$' in line_info.line:
2227 2235 call_meth = '(_ip, _ip.itpl(%s))'
2228 2236 else:
2229 2237 call_meth = '(_ip,%s)'
2230 2238 line_out = ("%s_sh.%s" + call_meth) % (line_info.preWhitespace,
2231 2239 line_info.iFun,
2232 2240 make_quoted_expr(line_info.line))
2233 2241 else:
2234 2242 transformed = self.expand_aliases(line_info.iFun,line_info.theRest)
2235 2243
2236 2244 # pre is needed, because it carries the leading whitespace. Otherwise
2237 2245 # aliases won't work in indented sections.
2238 2246 line_out = '%s_ip.system(%s)' % (line_info.preWhitespace,
2239 2247 make_quoted_expr( transformed ))
2240 2248
2241 2249 self.log(line_info.line,line_out,line_info.continue_prompt)
2242 2250 #print 'line out:',line_out # dbg
2243 2251 return line_out
2244 2252
2245 2253 def handle_shell_escape(self, line_info):
2246 2254 """Execute the line in a shell, empty return value"""
2247 2255 #print 'line in :', `line` # dbg
2248 2256 line = line_info.line
2249 2257 if line.lstrip().startswith('!!'):
2250 2258 # rewrite LineInfo's line, iFun and theRest to properly hold the
2251 2259 # call to %sx and the actual command to be executed, so
2252 2260 # handle_magic can work correctly. Note that this works even if
2253 2261 # the line is indented, so it handles multi_line_specials
2254 2262 # properly.
2255 2263 new_rest = line.lstrip()[2:]
2256 2264 line_info.line = '%ssx %s' % (self.ESC_MAGIC,new_rest)
2257 2265 line_info.iFun = 'sx'
2258 2266 line_info.theRest = new_rest
2259 2267 return self.handle_magic(line_info)
2260 2268 else:
2261 2269 cmd = line.lstrip().lstrip('!')
2262 2270 line_out = '%s_ip.system(%s)' % (line_info.preWhitespace,
2263 2271 make_quoted_expr(cmd))
2264 2272 # update cache/log and return
2265 2273 self.log(line,line_out,line_info.continue_prompt)
2266 2274 return line_out
2267 2275
2268 2276 def handle_magic(self, line_info):
2269 2277 """Execute magic functions."""
2270 2278 iFun = line_info.iFun
2271 2279 theRest = line_info.theRest
2272 2280 cmd = '%s_ip.magic(%s)' % (line_info.preWhitespace,
2273 2281 make_quoted_expr(iFun + " " + theRest))
2274 2282 self.log(line_info.line,cmd,line_info.continue_prompt)
2275 2283 #print 'in handle_magic, cmd=<%s>' % cmd # dbg
2276 2284 return cmd
2277 2285
2278 2286 def handle_auto(self, line_info):
2279 2287 """Hande lines which can be auto-executed, quoting if requested."""
2280 2288
2281 2289 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
2282 2290 line = line_info.line
2283 2291 iFun = line_info.iFun
2284 2292 theRest = line_info.theRest
2285 2293 pre = line_info.pre
2286 2294 continue_prompt = line_info.continue_prompt
2287 2295 obj = line_info.ofind(self)['obj']
2288 2296
2289 2297 # This should only be active for single-line input!
2290 2298 if continue_prompt:
2291 2299 self.log(line,line,continue_prompt)
2292 2300 return line
2293 2301
2294 2302 force_auto = isinstance(obj, IPython.ipapi.IPyAutocall)
2295 2303 auto_rewrite = True
2296 2304
2297 2305 if pre == self.ESC_QUOTE:
2298 2306 # Auto-quote splitting on whitespace
2299 2307 newcmd = '%s("%s")' % (iFun,'", "'.join(theRest.split()) )
2300 2308 elif pre == self.ESC_QUOTE2:
2301 2309 # Auto-quote whole string
2302 2310 newcmd = '%s("%s")' % (iFun,theRest)
2303 2311 elif pre == self.ESC_PAREN:
2304 2312 newcmd = '%s(%s)' % (iFun,",".join(theRest.split()))
2305 2313 else:
2306 2314 # Auto-paren.
2307 2315 # We only apply it to argument-less calls if the autocall
2308 2316 # parameter is set to 2. We only need to check that autocall is <
2309 2317 # 2, since this function isn't called unless it's at least 1.
2310 2318 if not theRest and (self.rc.autocall < 2) and not force_auto:
2311 2319 newcmd = '%s %s' % (iFun,theRest)
2312 2320 auto_rewrite = False
2313 2321 else:
2314 2322 if not force_auto and theRest.startswith('['):
2315 2323 if hasattr(obj,'__getitem__'):
2316 2324 # Don't autocall in this case: item access for an object
2317 2325 # which is BOTH callable and implements __getitem__.
2318 2326 newcmd = '%s %s' % (iFun,theRest)
2319 2327 auto_rewrite = False
2320 2328 else:
2321 2329 # if the object doesn't support [] access, go ahead and
2322 2330 # autocall
2323 2331 newcmd = '%s(%s)' % (iFun.rstrip(),theRest)
2324 2332 elif theRest.endswith(';'):
2325 2333 newcmd = '%s(%s);' % (iFun.rstrip(),theRest[:-1])
2326 2334 else:
2327 2335 newcmd = '%s(%s)' % (iFun.rstrip(), theRest)
2328 2336
2329 2337 if auto_rewrite:
2330 2338 rw = self.outputcache.prompt1.auto_rewrite() + newcmd
2331 2339
2332 2340 try:
2333 2341 # plain ascii works better w/ pyreadline, on some machines, so
2334 2342 # we use it and only print uncolored rewrite if we have unicode
2335 2343 rw = str(rw)
2336 2344 print >>Term.cout, rw
2337 2345 except UnicodeEncodeError:
2338 2346 print "-------------->" + newcmd
2339 2347
2340 2348 # log what is now valid Python, not the actual user input (without the
2341 2349 # final newline)
2342 2350 self.log(line,newcmd,continue_prompt)
2343 2351 return newcmd
2344 2352
2345 2353 def handle_help(self, line_info):
2346 2354 """Try to get some help for the object.
2347 2355
2348 2356 obj? or ?obj -> basic information.
2349 2357 obj?? or ??obj -> more details.
2350 2358 """
2351 2359
2352 2360 line = line_info.line
2353 2361 # We need to make sure that we don't process lines which would be
2354 2362 # otherwise valid python, such as "x=1 # what?"
2355 2363 try:
2356 2364 codeop.compile_command(line)
2357 2365 except SyntaxError:
2358 2366 # We should only handle as help stuff which is NOT valid syntax
2359 2367 if line[0]==self.ESC_HELP:
2360 2368 line = line[1:]
2361 2369 elif line[-1]==self.ESC_HELP:
2362 2370 line = line[:-1]
2363 2371 self.log(line,'#?'+line,line_info.continue_prompt)
2364 2372 if line:
2365 2373 #print 'line:<%r>' % line # dbg
2366 2374 self.magic_pinfo(line)
2367 2375 else:
2368 2376 page(self.usage,screen_lines=self.rc.screen_length)
2369 2377 return '' # Empty string is needed here!
2370 2378 except:
2371 2379 # Pass any other exceptions through to the normal handler
2372 2380 return self.handle_normal(line_info)
2373 2381 else:
2374 2382 # If the code compiles ok, we should handle it normally
2375 2383 return self.handle_normal(line_info)
2376 2384
2377 2385 def getapi(self):
2378 2386 """ Get an IPApi object for this shell instance
2379 2387
2380 2388 Getting an IPApi object is always preferable to accessing the shell
2381 2389 directly, but this holds true especially for extensions.
2382 2390
2383 2391 It should always be possible to implement an extension with IPApi
2384 2392 alone. If not, contact maintainer to request an addition.
2385 2393
2386 2394 """
2387 2395 return self.api
2388 2396
2389 2397 def handle_emacs(self, line_info):
2390 2398 """Handle input lines marked by python-mode."""
2391 2399
2392 2400 # Currently, nothing is done. Later more functionality can be added
2393 2401 # here if needed.
2394 2402
2395 2403 # The input cache shouldn't be updated
2396 2404 return line_info.line
2397 2405
2398 2406
2399 2407 def mktempfile(self,data=None):
2400 2408 """Make a new tempfile and return its filename.
2401 2409
2402 2410 This makes a call to tempfile.mktemp, but it registers the created
2403 2411 filename internally so ipython cleans it up at exit time.
2404 2412
2405 2413 Optional inputs:
2406 2414
2407 2415 - data(None): if data is given, it gets written out to the temp file
2408 2416 immediately, and the file is closed again."""
2409 2417
2410 2418 filename = tempfile.mktemp('.py','ipython_edit_')
2411 2419 self.tempfiles.append(filename)
2412 2420
2413 2421 if data:
2414 2422 tmp_file = open(filename,'w')
2415 2423 tmp_file.write(data)
2416 2424 tmp_file.close()
2417 2425 return filename
2418 2426
2419 2427 def write(self,data):
2420 2428 """Write a string to the default output"""
2421 2429 Term.cout.write(data)
2422 2430
2423 2431 def write_err(self,data):
2424 2432 """Write a string to the default error output"""
2425 2433 Term.cerr.write(data)
2426 2434
2427 2435 def exit(self):
2428 2436 """Handle interactive exit.
2429 2437
2430 2438 This method sets the exit_now attribute."""
2431 2439
2432 2440 if self.rc.confirm_exit:
2433 2441 if self.ask_yes_no('Do you really want to exit ([y]/n)?','y'):
2434 2442 self.exit_now = True
2435 2443 else:
2436 2444 self.exit_now = True
2437 2445
2438 2446 def safe_execfile(self,fname,*where,**kw):
2439 2447 """A safe version of the builtin execfile().
2440 2448
2441 2449 This version will never throw an exception, and knows how to handle
2442 2450 ipython logs as well.
2443 2451
2444 2452 :Parameters:
2445 2453 fname : string
2446 2454 Name of the file to be executed.
2447 2455
2448 2456 where : tuple
2449 2457 One or two namespaces, passed to execfile() as (globals,locals).
2450 2458 If only one is given, it is passed as both.
2451 2459
2452 2460 :Keywords:
2453 2461 islog : boolean (False)
2454 2462
2455 2463 quiet : boolean (True)
2456 2464
2457 2465 exit_ignore : boolean (False)
2458 2466 """
2459 2467
2460 2468 def syspath_cleanup():
2461 2469 """Internal cleanup routine for sys.path."""
2462 2470 if add_dname:
2463 2471 try:
2464 2472 sys.path.remove(dname)
2465 2473 except ValueError:
2466 2474 # For some reason the user has already removed it, ignore.
2467 2475 pass
2468 2476
2469 2477 fname = os.path.expanduser(fname)
2470 2478
2471 2479 # Find things also in current directory. This is needed to mimic the
2472 2480 # behavior of running a script from the system command line, where
2473 2481 # Python inserts the script's directory into sys.path
2474 2482 dname = os.path.dirname(os.path.abspath(fname))
2475 2483 add_dname = False
2476 2484 if dname not in sys.path:
2477 2485 sys.path.insert(0,dname)
2478 2486 add_dname = True
2479 2487
2480 2488 try:
2481 2489 xfile = open(fname)
2482 2490 except:
2483 2491 print >> Term.cerr, \
2484 2492 'Could not open file <%s> for safe execution.' % fname
2485 2493 syspath_cleanup()
2486 2494 return None
2487 2495
2488 2496 kw.setdefault('islog',0)
2489 2497 kw.setdefault('quiet',1)
2490 2498 kw.setdefault('exit_ignore',0)
2491 2499
2492 2500 first = xfile.readline()
2493 2501 loghead = str(self.loghead_tpl).split('\n',1)[0].strip()
2494 2502 xfile.close()
2495 2503 # line by line execution
2496 2504 if first.startswith(loghead) or kw['islog']:
2497 2505 print 'Loading log file <%s> one line at a time...' % fname
2498 2506 if kw['quiet']:
2499 2507 stdout_save = sys.stdout
2500 2508 sys.stdout = StringIO.StringIO()
2501 2509 try:
2502 2510 globs,locs = where[0:2]
2503 2511 except:
2504 2512 try:
2505 2513 globs = locs = where[0]
2506 2514 except:
2507 2515 globs = locs = globals()
2508 2516 badblocks = []
2509 2517
2510 2518 # we also need to identify indented blocks of code when replaying
2511 2519 # logs and put them together before passing them to an exec
2512 2520 # statement. This takes a bit of regexp and look-ahead work in the
2513 2521 # file. It's easiest if we swallow the whole thing in memory
2514 2522 # first, and manually walk through the lines list moving the
2515 2523 # counter ourselves.
2516 2524 indent_re = re.compile('\s+\S')
2517 2525 xfile = open(fname)
2518 2526 filelines = xfile.readlines()
2519 2527 xfile.close()
2520 2528 nlines = len(filelines)
2521 2529 lnum = 0
2522 2530 while lnum < nlines:
2523 2531 line = filelines[lnum]
2524 2532 lnum += 1
2525 2533 # don't re-insert logger status info into cache
2526 2534 if line.startswith('#log#'):
2527 2535 continue
2528 2536 else:
2529 2537 # build a block of code (maybe a single line) for execution
2530 2538 block = line
2531 2539 try:
2532 2540 next = filelines[lnum] # lnum has already incremented
2533 2541 except:
2534 2542 next = None
2535 2543 while next and indent_re.match(next):
2536 2544 block += next
2537 2545 lnum += 1
2538 2546 try:
2539 2547 next = filelines[lnum]
2540 2548 except:
2541 2549 next = None
2542 2550 # now execute the block of one or more lines
2543 2551 try:
2544 2552 exec block in globs,locs
2545 2553 except SystemExit:
2546 2554 pass
2547 2555 except:
2548 2556 badblocks.append(block.rstrip())
2549 2557 if kw['quiet']: # restore stdout
2550 2558 sys.stdout.close()
2551 2559 sys.stdout = stdout_save
2552 2560 print 'Finished replaying log file <%s>' % fname
2553 2561 if badblocks:
2554 2562 print >> sys.stderr, ('\nThe following lines/blocks in file '
2555 2563 '<%s> reported errors:' % fname)
2556 2564
2557 2565 for badline in badblocks:
2558 2566 print >> sys.stderr, badline
2559 2567 else: # regular file execution
2560 2568 try:
2561 2569 if sys.platform == 'win32' and sys.version_info < (2,5,1):
2562 2570 # Work around a bug in Python for Windows. The bug was
2563 2571 # fixed in in Python 2.5 r54159 and 54158, but that's still
2564 2572 # SVN Python as of March/07. For details, see:
2565 2573 # http://projects.scipy.org/ipython/ipython/ticket/123
2566 2574 try:
2567 2575 globs,locs = where[0:2]
2568 2576 except:
2569 2577 try:
2570 2578 globs = locs = where[0]
2571 2579 except:
2572 2580 globs = locs = globals()
2573 2581 exec file(fname) in globs,locs
2574 2582 else:
2575 2583 execfile(fname,*where)
2576 2584 except SyntaxError:
2577 2585 self.showsyntaxerror()
2578 2586 warn('Failure executing file: <%s>' % fname)
2579 2587 except SystemExit,status:
2580 2588 # Code that correctly sets the exit status flag to success (0)
2581 2589 # shouldn't be bothered with a traceback. Note that a plain
2582 2590 # sys.exit() does NOT set the message to 0 (it's empty) so that
2583 2591 # will still get a traceback. Note that the structure of the
2584 2592 # SystemExit exception changed between Python 2.4 and 2.5, so
2585 2593 # the checks must be done in a version-dependent way.
2586 2594 show = False
2587 2595
2588 2596 if sys.version_info[:2] > (2,5):
2589 2597 if status.message!=0 and not kw['exit_ignore']:
2590 2598 show = True
2591 2599 else:
2592 2600 if status.code and not kw['exit_ignore']:
2593 2601 show = True
2594 2602 if show:
2595 2603 self.showtraceback()
2596 2604 warn('Failure executing file: <%s>' % fname)
2597 2605 except:
2598 2606 self.showtraceback()
2599 2607 warn('Failure executing file: <%s>' % fname)
2600 2608
2601 2609 syspath_cleanup()
2602 2610
2603 2611 #************************* end of file <iplib.py> *****************************
@@ -1,764 +1,765 b''
1 1 # -*- coding: utf-8 -*-
2 2 """
3 3 IPython -- An enhanced Interactive Python
4 4
5 5 Requires Python 2.1 or better.
6 6
7 7 This file contains the main make_IPython() starter function.
8 8
9 $Id: ipmaker.py 2913 2007-12-31 12:42:14Z vivainio $"""
9 $Id: ipmaker.py 2930 2008-01-11 07:03:11Z vivainio $"""
10 10
11 11 #*****************************************************************************
12 12 # Copyright (C) 2001-2006 Fernando Perez. <fperez@colorado.edu>
13 13 #
14 14 # Distributed under the terms of the BSD License. The full license is in
15 15 # the file COPYING, distributed as part of this software.
16 16 #*****************************************************************************
17 17
18 18 from IPython import Release
19 19 __author__ = '%s <%s>' % Release.authors['Fernando']
20 20 __license__ = Release.license
21 21 __version__ = Release.version
22 22
23 23 try:
24 24 credits._Printer__data = """
25 25 Python: %s
26 26
27 27 IPython: Fernando Perez, Janko Hauser, Nathan Gray, and many users.
28 28 See http://ipython.scipy.org for more information.""" \
29 29 % credits._Printer__data
30 30
31 31 copyright._Printer__data += """
32 32
33 33 Copyright (c) 2001-2004 Fernando Perez, Janko Hauser, Nathan Gray.
34 34 All Rights Reserved."""
35 35 except NameError:
36 36 # Can happen if ipython was started with 'python -S', so that site.py is
37 37 # not loaded
38 38 pass
39 39
40 40 #****************************************************************************
41 41 # Required modules
42 42
43 43 # From the standard library
44 44 import __main__
45 45 import __builtin__
46 46 import os
47 47 import re
48 48 import sys
49 49 import types
50 50 from pprint import pprint,pformat
51 51
52 52 # Our own
53 53 from IPython import DPyGetOpt
54 54 from IPython.ipstruct import Struct
55 55 from IPython.OutputTrap import OutputTrap
56 56 from IPython.ConfigLoader import ConfigLoader
57 57 from IPython.iplib import InteractiveShell
58 58 from IPython.usage import cmd_line_usage,interactive_usage
59 59 from IPython.genutils import *
60 60
61 61 #-----------------------------------------------------------------------------
62 62 def make_IPython(argv=None,user_ns=None,user_global_ns=None,debug=1,
63 63 rc_override=None,shell_class=InteractiveShell,
64 64 embedded=False,**kw):
65 65 """This is a dump of IPython into a single function.
66 66
67 67 Later it will have to be broken up in a sensible manner.
68 68
69 69 Arguments:
70 70
71 71 - argv: a list similar to sys.argv[1:]. It should NOT contain the desired
72 72 script name, b/c DPyGetOpt strips the first argument only for the real
73 73 sys.argv.
74 74
75 75 - user_ns: a dict to be used as the user's namespace."""
76 76
77 77 #----------------------------------------------------------------------
78 78 # Defaults and initialization
79 79
80 80 # For developer debugging, deactivates crash handler and uses pdb.
81 81 DEVDEBUG = False
82 82
83 83 if argv is None:
84 84 argv = sys.argv
85 85
86 86 # __IP is the main global that lives throughout and represents the whole
87 87 # application. If the user redefines it, all bets are off as to what
88 88 # happens.
89 89
90 90 # __IP is the name of he global which the caller will have accessible as
91 91 # __IP.name. We set its name via the first parameter passed to
92 92 # InteractiveShell:
93 93
94 94 IP = shell_class('__IP',user_ns=user_ns,user_global_ns=user_global_ns,
95 95 embedded=embedded,**kw)
96 96
97 97 # Put 'help' in the user namespace
98 98 from site import _Helper
99 99 IP.user_config_ns = {}
100 100 IP.user_ns['help'] = _Helper()
101 101
102 102
103 103 if DEVDEBUG:
104 104 # For developer debugging only (global flag)
105 105 from IPython import ultraTB
106 106 sys.excepthook = ultraTB.VerboseTB(call_pdb=1)
107 107
108 108 IP.BANNER_PARTS = ['Python %s\n'
109 109 'Type "copyright", "credits" or "license" '
110 110 'for more information.\n'
111 111 % (sys.version.split('\n')[0],),
112 112 "IPython %s -- An enhanced Interactive Python."
113 113 % (__version__,),
114 114 """\
115 115 ? -> Introduction and overview of IPython's features.
116 116 %quickref -> Quick reference.
117 117 help -> Python's own help system.
118 118 object? -> Details about 'object'. ?object also works, ?? prints more.
119 119 """ ]
120 120
121 121 IP.usage = interactive_usage
122 122
123 123 # Platform-dependent suffix and directory names. We use _ipython instead
124 124 # of .ipython under win32 b/c there's software that breaks with .named
125 125 # directories on that platform.
126 126 if os.name == 'posix':
127 127 rc_suffix = ''
128 128 ipdir_def = '.ipython'
129 129 else:
130 130 rc_suffix = '.ini'
131 131 ipdir_def = '_ipython'
132 132
133 133 # default directory for configuration
134 134 ipythondir_def = os.path.abspath(os.environ.get('IPYTHONDIR',
135 135 os.path.join(IP.home_dir,ipdir_def)))
136 136
137 137 sys.path.insert(0, '') # add . to sys.path. Fix from Prabhu Ramachandran
138 138
139 139 # we need the directory where IPython itself is installed
140 140 import IPython
141 141 IPython_dir = os.path.dirname(IPython.__file__)
142 142 del IPython
143 143
144 144 #-------------------------------------------------------------------------
145 145 # Command line handling
146 146
147 147 # Valid command line options (uses DPyGetOpt syntax, like Perl's
148 148 # GetOpt::Long)
149 149
150 150 # Any key not listed here gets deleted even if in the file (like session
151 151 # or profile). That's deliberate, to maintain the rc namespace clean.
152 152
153 153 # Each set of options appears twice: under _conv only the names are
154 154 # listed, indicating which type they must be converted to when reading the
155 155 # ipythonrc file. And under DPyGetOpt they are listed with the regular
156 156 # DPyGetOpt syntax (=s,=i,:f,etc).
157 157
158 158 # Make sure there's a space before each end of line (they get auto-joined!)
159 159 cmdline_opts = ('autocall=i autoindent! automagic! banner! cache_size|cs=i '
160 160 'c=s classic|cl color_info! colors=s confirm_exit! '
161 161 'debug! deep_reload! editor=s log|l messages! nosep '
162 162 'object_info_string_level=i pdb! '
163 163 'pprint! prompt_in1|pi1=s prompt_in2|pi2=s prompt_out|po=s '
164 164 'pydb! '
165 165 'pylab_import_all! '
166 166 'quick screen_length|sl=i prompts_pad_left=i '
167 167 'logfile|lf=s logplay|lp=s profile|p=s '
168 168 'readline! readline_merge_completions! '
169 169 'readline_omit__names! '
170 170 'rcfile=s separate_in|si=s separate_out|so=s '
171 171 'separate_out2|so2=s xmode=s wildcards_case_sensitive! '
172 172 'magic_docstrings system_verbose! '
173 173 'multi_line_specials! '
174 174 'term_title! wxversion=s '
175 175 'autoedit_syntax!')
176 176
177 177 # Options that can *only* appear at the cmd line (not in rcfiles).
178 178
179 179 # The "ignore" option is a kludge so that Emacs buffers don't crash, since
180 180 # the 'C-c !' command in emacs automatically appends a -i option at the end.
181 181 cmdline_only = ('help interact|i ipythondir=s Version upgrade '
182 182 'gthread! qthread! q4thread! wthread! tkthread! pylab! tk!')
183 183
184 184 # Build the actual name list to be used by DPyGetOpt
185 185 opts_names = qw(cmdline_opts) + qw(cmdline_only)
186 186
187 187 # Set sensible command line defaults.
188 188 # This should have everything from cmdline_opts and cmdline_only
189 189 opts_def = Struct(autocall = 1,
190 190 autoedit_syntax = 0,
191 191 autoindent = 0,
192 192 automagic = 1,
193 autoexec = [],
193 194 banner = 1,
194 195 c = '',
195 196 cache_size = 1000,
196 197 classic = 0,
197 198 color_info = 0,
198 199 colors = 'NoColor',
199 200 confirm_exit = 1,
200 201 debug = 0,
201 202 deep_reload = 0,
202 203 editor = '0',
203 204 gthread = 0,
204 205 help = 0,
205 206 interact = 1,
206 207 ipythondir = ipythondir_def,
207 208 log = 0,
208 209 logfile = '',
209 210 logplay = '',
210 211 messages = 1,
211 212 multi_line_specials = 1,
212 213 nosep = 0,
213 214 object_info_string_level = 0,
214 215 pdb = 0,
215 216 pprint = 0,
216 217 profile = '',
217 218 prompt_in1 = 'In [\\#]: ',
218 219 prompt_in2 = ' .\\D.: ',
219 220 prompt_out = 'Out[\\#]: ',
220 221 prompts_pad_left = 1,
221 222 pylab = 0,
222 223 pylab_import_all = 1,
223 224 q4thread = 0,
224 225 qthread = 0,
225 226 quick = 0,
226 227 quiet = 0,
227 228 rcfile = 'ipythonrc' + rc_suffix,
228 229 readline = 1,
229 230 readline_merge_completions = 1,
230 231 readline_omit__names = 0,
231 232 screen_length = 0,
232 233 separate_in = '\n',
233 234 separate_out = '\n',
234 235 separate_out2 = '',
235 236 system_header = 'IPython system call: ',
236 237 system_verbose = 0,
237 238 term_title = 1,
238 239 tk = 0,
239 240 upgrade = 0,
240 241 Version = 0,
241 242 wildcards_case_sensitive = 1,
242 243 wthread = 0,
243 244 wxversion = '0',
244 245 xmode = 'Context',
245 246 magic_docstrings = 0, # undocumented, for doc generation
246 247 )
247 248
248 249 # Things that will *only* appear in rcfiles (not at the command line).
249 250 # Make sure there's a space before each end of line (they get auto-joined!)
250 251 rcfile_opts = { qwflat: 'include import_mod import_all execfile ',
251 252 qw_lol: 'import_some ',
252 253 # for things with embedded whitespace:
253 254 list_strings:'execute alias readline_parse_and_bind ',
254 255 # Regular strings need no conversion:
255 256 None:'readline_remove_delims ',
256 257 }
257 258 # Default values for these
258 259 rc_def = Struct(include = [],
259 260 import_mod = [],
260 261 import_all = [],
261 262 import_some = [[]],
262 263 execute = [],
263 264 execfile = [],
264 265 alias = [],
265 266 readline_parse_and_bind = [],
266 267 readline_remove_delims = '',
267 268 )
268 269
269 270 # Build the type conversion dictionary from the above tables:
270 271 typeconv = rcfile_opts.copy()
271 272 typeconv.update(optstr2types(cmdline_opts))
272 273
273 274 # FIXME: the None key appears in both, put that back together by hand. Ugly!
274 275 typeconv[None] += ' ' + rcfile_opts[None]
275 276
276 277 # Remove quotes at ends of all strings (used to protect spaces)
277 278 typeconv[unquote_ends] = typeconv[None]
278 279 del typeconv[None]
279 280
280 281 # Build the list we'll use to make all config decisions with defaults:
281 282 opts_all = opts_def.copy()
282 283 opts_all.update(rc_def)
283 284
284 285 # Build conflict resolver for recursive loading of config files:
285 286 # - preserve means the outermost file maintains the value, it is not
286 287 # overwritten if an included file has the same key.
287 288 # - add_flip applies + to the two values, so it better make sense to add
288 289 # those types of keys. But it flips them first so that things loaded
289 290 # deeper in the inclusion chain have lower precedence.
290 291 conflict = {'preserve': ' '.join([ typeconv[int],
291 292 typeconv[unquote_ends] ]),
292 293 'add_flip': ' '.join([ typeconv[qwflat],
293 294 typeconv[qw_lol],
294 295 typeconv[list_strings] ])
295 296 }
296 297
297 298 # Now actually process the command line
298 299 getopt = DPyGetOpt.DPyGetOpt()
299 300 getopt.setIgnoreCase(0)
300 301
301 302 getopt.parseConfiguration(opts_names)
302 303
303 304 try:
304 305 getopt.processArguments(argv)
305 306 except DPyGetOpt.ArgumentError, exc:
306 307 print cmd_line_usage
307 308 warn('\nError in Arguments: "%s"' % exc)
308 309 sys.exit(1)
309 310
310 311 # convert the options dict to a struct for much lighter syntax later
311 312 opts = Struct(getopt.optionValues)
312 313 args = getopt.freeValues
313 314
314 315 # this is the struct (which has default values at this point) with which
315 316 # we make all decisions:
316 317 opts_all.update(opts)
317 318
318 319 # Options that force an immediate exit
319 320 if opts_all.help:
320 321 page(cmd_line_usage)
321 322 sys.exit()
322 323
323 324 if opts_all.Version:
324 325 print __version__
325 326 sys.exit()
326 327
327 328 if opts_all.magic_docstrings:
328 329 IP.magic_magic('-latex')
329 330 sys.exit()
330 331
331 332 # add personal ipythondir to sys.path so that users can put things in
332 333 # there for customization
333 334 sys.path.append(os.path.abspath(opts_all.ipythondir))
334 335
335 336 # Create user config directory if it doesn't exist. This must be done
336 337 # *after* getting the cmd line options.
337 338 if not os.path.isdir(opts_all.ipythondir):
338 339 IP.user_setup(opts_all.ipythondir,rc_suffix,'install')
339 340
340 341 # upgrade user config files while preserving a copy of the originals
341 342 if opts_all.upgrade:
342 343 IP.user_setup(opts_all.ipythondir,rc_suffix,'upgrade')
343 344
344 345 # check mutually exclusive options in the *original* command line
345 346 mutex_opts(opts,[qw('log logfile'),qw('rcfile profile'),
346 347 qw('classic profile'),qw('classic rcfile')])
347 348
348 349 #---------------------------------------------------------------------------
349 350 # Log replay
350 351
351 352 # if -logplay, we need to 'become' the other session. That basically means
352 353 # replacing the current command line environment with that of the old
353 354 # session and moving on.
354 355
355 356 # this is needed so that later we know we're in session reload mode, as
356 357 # opts_all will get overwritten:
357 358 load_logplay = 0
358 359
359 360 if opts_all.logplay:
360 361 load_logplay = opts_all.logplay
361 362 opts_debug_save = opts_all.debug
362 363 try:
363 364 logplay = open(opts_all.logplay)
364 365 except IOError:
365 366 if opts_all.debug: IP.InteractiveTB()
366 367 warn('Could not open logplay file '+`opts_all.logplay`)
367 368 # restore state as if nothing had happened and move on, but make
368 369 # sure that later we don't try to actually load the session file
369 370 logplay = None
370 371 load_logplay = 0
371 372 del opts_all.logplay
372 373 else:
373 374 try:
374 375 logplay.readline()
375 376 logplay.readline();
376 377 # this reloads that session's command line
377 378 cmd = logplay.readline()[6:]
378 379 exec cmd
379 380 # restore the true debug flag given so that the process of
380 381 # session loading itself can be monitored.
381 382 opts.debug = opts_debug_save
382 383 # save the logplay flag so later we don't overwrite the log
383 384 opts.logplay = load_logplay
384 385 # now we must update our own structure with defaults
385 386 opts_all.update(opts)
386 387 # now load args
387 388 cmd = logplay.readline()[6:]
388 389 exec cmd
389 390 logplay.close()
390 391 except:
391 392 logplay.close()
392 393 if opts_all.debug: IP.InteractiveTB()
393 394 warn("Logplay file lacking full configuration information.\n"
394 395 "I'll try to read it, but some things may not work.")
395 396
396 397 #-------------------------------------------------------------------------
397 398 # set up output traps: catch all output from files, being run, modules
398 399 # loaded, etc. Then give it to the user in a clean form at the end.
399 400
400 401 msg_out = 'Output messages. '
401 402 msg_err = 'Error messages. '
402 403 msg_sep = '\n'
403 404 msg = Struct(config = OutputTrap('Configuration Loader',msg_out,
404 405 msg_err,msg_sep,debug,
405 406 quiet_out=1),
406 407 user_exec = OutputTrap('User File Execution',msg_out,
407 408 msg_err,msg_sep,debug),
408 409 logplay = OutputTrap('Log Loader',msg_out,
409 410 msg_err,msg_sep,debug),
410 411 summary = ''
411 412 )
412 413
413 414 #-------------------------------------------------------------------------
414 415 # Process user ipythonrc-type configuration files
415 416
416 417 # turn on output trapping and log to msg.config
417 418 # remember that with debug on, trapping is actually disabled
418 419 msg.config.trap_all()
419 420
420 421 # look for rcfile in current or default directory
421 422 try:
422 423 opts_all.rcfile = filefind(opts_all.rcfile,opts_all.ipythondir)
423 424 except IOError:
424 425 if opts_all.debug: IP.InteractiveTB()
425 426 warn('Configuration file %s not found. Ignoring request.'
426 427 % (opts_all.rcfile) )
427 428
428 429 # 'profiles' are a shorthand notation for config filenames
429 430 profile_handled_by_legacy = False
430 431 if opts_all.profile:
431 432
432 433 try:
433 434 opts_all.rcfile = filefind('ipythonrc-' + opts_all.profile
434 435 + rc_suffix,
435 436 opts_all.ipythondir)
436 437 profile_handled_by_legacy = True
437 438 except IOError:
438 439 if opts_all.debug: IP.InteractiveTB()
439 440 opts.profile = '' # remove profile from options if invalid
440 441 # We won't warn anymore, primary method is ipy_profile_PROFNAME
441 442 # which does trigger a warning.
442 443
443 444 # load the config file
444 445 rcfiledata = None
445 446 if opts_all.quick:
446 447 print 'Launching IPython in quick mode. No config file read.'
447 448 elif opts_all.rcfile:
448 449 try:
449 450 cfg_loader = ConfigLoader(conflict)
450 451 rcfiledata = cfg_loader.load(opts_all.rcfile,typeconv,
451 452 'include',opts_all.ipythondir,
452 453 purge = 1,
453 454 unique = conflict['preserve'])
454 455 except:
455 456 IP.InteractiveTB()
456 457 warn('Problems loading configuration file '+
457 458 `opts_all.rcfile`+
458 459 '\nStarting with default -bare bones- configuration.')
459 460 else:
460 461 warn('No valid configuration file found in either currrent directory\n'+
461 462 'or in the IPython config. directory: '+`opts_all.ipythondir`+
462 463 '\nProceeding with internal defaults.')
463 464
464 465 #------------------------------------------------------------------------
465 466 # Set exception handlers in mode requested by user.
466 467 otrap = OutputTrap(trap_out=1) # trap messages from magic_xmode
467 468 IP.magic_xmode(opts_all.xmode)
468 469 otrap.release_out()
469 470
470 471 #------------------------------------------------------------------------
471 472 # Execute user config
472 473
473 474 # Create a valid config structure with the right precedence order:
474 475 # defaults < rcfile < command line. This needs to be in the instance, so
475 476 # that method calls below that rely on it find it.
476 477 IP.rc = rc_def.copy()
477 478
478 479 # Work with a local alias inside this routine to avoid unnecessary
479 480 # attribute lookups.
480 481 IP_rc = IP.rc
481 482
482 483 IP_rc.update(opts_def)
483 484 if rcfiledata:
484 485 # now we can update
485 486 IP_rc.update(rcfiledata)
486 487 IP_rc.update(opts)
487 488 IP_rc.update(rc_override)
488 489
489 490 # Store the original cmd line for reference:
490 491 IP_rc.opts = opts
491 492 IP_rc.args = args
492 493
493 494 # create a *runtime* Struct like rc for holding parameters which may be
494 495 # created and/or modified by runtime user extensions.
495 496 IP.runtime_rc = Struct()
496 497
497 498 # from this point on, all config should be handled through IP_rc,
498 499 # opts* shouldn't be used anymore.
499 500
500 501
501 502 # update IP_rc with some special things that need manual
502 503 # tweaks. Basically options which affect other options. I guess this
503 504 # should just be written so that options are fully orthogonal and we
504 505 # wouldn't worry about this stuff!
505 506
506 507 if IP_rc.classic:
507 508 IP_rc.quick = 1
508 509 IP_rc.cache_size = 0
509 510 IP_rc.pprint = 0
510 511 IP_rc.prompt_in1 = '>>> '
511 512 IP_rc.prompt_in2 = '... '
512 513 IP_rc.prompt_out = ''
513 514 IP_rc.separate_in = IP_rc.separate_out = IP_rc.separate_out2 = '0'
514 515 IP_rc.colors = 'NoColor'
515 516 IP_rc.xmode = 'Plain'
516 517
517 518 IP.pre_config_initialization()
518 519 # configure readline
519 520 # Define the history file for saving commands in between sessions
520 521 if IP_rc.profile:
521 522 histfname = 'history-%s' % IP_rc.profile
522 523 else:
523 524 histfname = 'history'
524 525 IP.histfile = os.path.join(opts_all.ipythondir,histfname)
525 526
526 527 # update exception handlers with rc file status
527 528 otrap.trap_out() # I don't want these messages ever.
528 529 IP.magic_xmode(IP_rc.xmode)
529 530 otrap.release_out()
530 531
531 532 # activate logging if requested and not reloading a log
532 533 if IP_rc.logplay:
533 534 IP.magic_logstart(IP_rc.logplay + ' append')
534 535 elif IP_rc.logfile:
535 536 IP.magic_logstart(IP_rc.logfile)
536 537 elif IP_rc.log:
537 538 IP.magic_logstart()
538 539
539 540 # find user editor so that it we don't have to look it up constantly
540 541 if IP_rc.editor.strip()=='0':
541 542 try:
542 543 ed = os.environ['EDITOR']
543 544 except KeyError:
544 545 if os.name == 'posix':
545 546 ed = 'vi' # the only one guaranteed to be there!
546 547 else:
547 548 ed = 'notepad' # same in Windows!
548 549 IP_rc.editor = ed
549 550
550 551 # Keep track of whether this is an embedded instance or not (useful for
551 552 # post-mortems).
552 553 IP_rc.embedded = IP.embedded
553 554
554 555 # Recursive reload
555 556 try:
556 557 from IPython import deep_reload
557 558 if IP_rc.deep_reload:
558 559 __builtin__.reload = deep_reload.reload
559 560 else:
560 561 __builtin__.dreload = deep_reload.reload
561 562 del deep_reload
562 563 except ImportError:
563 564 pass
564 565
565 566 # Save the current state of our namespace so that the interactive shell
566 567 # can later know which variables have been created by us from config files
567 568 # and loading. This way, loading a file (in any way) is treated just like
568 569 # defining things on the command line, and %who works as expected.
569 570
570 571 # DON'T do anything that affects the namespace beyond this point!
571 572 IP.internal_ns.update(__main__.__dict__)
572 573
573 574 #IP.internal_ns.update(locals()) # so our stuff doesn't show up in %who
574 575
575 576 # Now run through the different sections of the users's config
576 577 if IP_rc.debug:
577 578 print 'Trying to execute the following configuration structure:'
578 579 print '(Things listed first are deeper in the inclusion tree and get'
579 580 print 'loaded first).\n'
580 581 pprint(IP_rc.__dict__)
581 582
582 583 for mod in IP_rc.import_mod:
583 584 try:
584 585 exec 'import '+mod in IP.user_ns
585 586 except :
586 587 IP.InteractiveTB()
587 588 import_fail_info(mod)
588 589
589 590 for mod_fn in IP_rc.import_some:
590 591 if not mod_fn == []:
591 592 mod,fn = mod_fn[0],','.join(mod_fn[1:])
592 593 try:
593 594 exec 'from '+mod+' import '+fn in IP.user_ns
594 595 except :
595 596 IP.InteractiveTB()
596 597 import_fail_info(mod,fn)
597 598
598 599 for mod in IP_rc.import_all:
599 600 try:
600 601 exec 'from '+mod+' import *' in IP.user_ns
601 602 except :
602 603 IP.InteractiveTB()
603 604 import_fail_info(mod)
604 605
605 606 for code in IP_rc.execute:
606 607 try:
607 608 exec code in IP.user_ns
608 609 except:
609 610 IP.InteractiveTB()
610 611 warn('Failure executing code: ' + `code`)
611 612
612 613 # Execute the files the user wants in ipythonrc
613 614 for file in IP_rc.execfile:
614 615 try:
615 616 file = filefind(file,sys.path+[IPython_dir])
616 617 except IOError:
617 618 warn(itpl('File $file not found. Skipping it.'))
618 619 else:
619 620 IP.safe_execfile(os.path.expanduser(file),IP.user_ns)
620 621
621 622 # finally, try importing ipy_*_conf for final configuration
622 623 try:
623 624 import ipy_system_conf
624 625 except ImportError:
625 626 if opts_all.debug: IP.InteractiveTB()
626 627 warn("Could not import 'ipy_system_conf'")
627 628 except:
628 629 IP.InteractiveTB()
629 630 import_fail_info('ipy_system_conf')
630 631
631 632 # only import prof module if ipythonrc-PROF was not found
632 633 if opts_all.profile and not profile_handled_by_legacy:
633 634 profmodname = 'ipy_profile_' + opts_all.profile
634 635 try:
635 636 __import__(profmodname)
636 637 except:
637 638 IP.InteractiveTB()
638 639 print "Error importing",profmodname,"- perhaps you should run %upgrade?"
639 640 import_fail_info(profmodname)
640 641 else:
641 642 import ipy_profile_none
642 643 try:
643 644 import ipy_user_conf
644 645
645 646 except:
646 647 conf = opts_all.ipythondir + "/ipy_user_conf.py"
647 648 IP.InteractiveTB()
648 649 if not os.path.isfile(conf):
649 650 warn(conf + ' does not exist, please run %upgrade!')
650 651
651 652 import_fail_info("ipy_user_conf")
652 653
653 654 # finally, push the argv to options again to ensure highest priority
654 655 IP_rc.update(opts)
655 656
656 657 # release stdout and stderr and save config log into a global summary
657 658 msg.config.release_all()
658 659 if IP_rc.messages:
659 660 msg.summary += msg.config.summary_all()
660 661
661 662 #------------------------------------------------------------------------
662 663 # Setup interactive session
663 664
664 665 # Now we should be fully configured. We can then execute files or load
665 666 # things only needed for interactive use. Then we'll open the shell.
666 667
667 668 # Take a snapshot of the user namespace before opening the shell. That way
668 669 # we'll be able to identify which things were interactively defined and
669 670 # which were defined through config files.
670 671 IP.user_config_ns.update(IP.user_ns)
671 672
672 673 # Force reading a file as if it were a session log. Slower but safer.
673 674 if load_logplay:
674 675 print 'Replaying log...'
675 676 try:
676 677 if IP_rc.debug:
677 678 logplay_quiet = 0
678 679 else:
679 680 logplay_quiet = 1
680 681
681 682 msg.logplay.trap_all()
682 683 IP.safe_execfile(load_logplay,IP.user_ns,
683 684 islog = 1, quiet = logplay_quiet)
684 685 msg.logplay.release_all()
685 686 if IP_rc.messages:
686 687 msg.summary += msg.logplay.summary_all()
687 688 except:
688 689 warn('Problems replaying logfile %s.' % load_logplay)
689 690 IP.InteractiveTB()
690 691
691 692 # Load remaining files in command line
692 693 msg.user_exec.trap_all()
693 694
694 695 # Do NOT execute files named in the command line as scripts to be loaded
695 696 # by embedded instances. Doing so has the potential for an infinite
696 697 # recursion if there are exceptions thrown in the process.
697 698
698 699 # XXX FIXME: the execution of user files should be moved out to after
699 700 # ipython is fully initialized, just as if they were run via %run at the
700 701 # ipython prompt. This would also give them the benefit of ipython's
701 702 # nice tracebacks.
702 703
703 704 if (not embedded and IP_rc.args and
704 705 not IP_rc.args[0].lower().endswith('.ipy')):
705 706 name_save = IP.user_ns['__name__']
706 707 IP.user_ns['__name__'] = '__main__'
707 708 # Set our own excepthook in case the user code tries to call it
708 709 # directly. This prevents triggering the IPython crash handler.
709 710 old_excepthook,sys.excepthook = sys.excepthook, IP.excepthook
710 711
711 712 save_argv = sys.argv[1:] # save it for later restoring
712 713
713 714 sys.argv = args
714 715
715 716 try:
716 717 IP.safe_execfile(args[0], IP.user_ns)
717 718 finally:
718 719 # Reset our crash handler in place
719 720 sys.excepthook = old_excepthook
720 721 sys.argv[:] = save_argv
721 722 IP.user_ns['__name__'] = name_save
722 723
723 724 msg.user_exec.release_all()
724 725
725 726 if IP_rc.messages:
726 727 msg.summary += msg.user_exec.summary_all()
727 728
728 729 # since we can't specify a null string on the cmd line, 0 is the equivalent:
729 730 if IP_rc.nosep:
730 731 IP_rc.separate_in = IP_rc.separate_out = IP_rc.separate_out2 = '0'
731 732 if IP_rc.separate_in == '0': IP_rc.separate_in = ''
732 733 if IP_rc.separate_out == '0': IP_rc.separate_out = ''
733 734 if IP_rc.separate_out2 == '0': IP_rc.separate_out2 = ''
734 735 IP_rc.separate_in = IP_rc.separate_in.replace('\\n','\n')
735 736 IP_rc.separate_out = IP_rc.separate_out.replace('\\n','\n')
736 737 IP_rc.separate_out2 = IP_rc.separate_out2.replace('\\n','\n')
737 738
738 739 # Determine how many lines at the bottom of the screen are needed for
739 740 # showing prompts, so we can know wheter long strings are to be printed or
740 741 # paged:
741 742 num_lines_bot = IP_rc.separate_in.count('\n')+1
742 743 IP_rc.screen_length = IP_rc.screen_length - num_lines_bot
743 744
744 745 # configure startup banner
745 746 if IP_rc.c: # regular python doesn't print the banner with -c
746 747 IP_rc.banner = 0
747 748 if IP_rc.banner:
748 749 BANN_P = IP.BANNER_PARTS
749 750 else:
750 751 BANN_P = []
751 752
752 753 if IP_rc.profile: BANN_P.append('IPython profile: %s\n' % IP_rc.profile)
753 754
754 755 # add message log (possibly empty)
755 756 if msg.summary: BANN_P.append(msg.summary)
756 757 # Final banner is a string
757 758 IP.BANNER = '\n'.join(BANN_P)
758 759
759 760 # Finalize the IPython instance. This assumes the rc structure is fully
760 761 # in place.
761 762 IP.post_config_initialization()
762 763
763 764 return IP
764 765 #************************ end of file <ipmaker.py> **************************
@@ -1,7357 +1,7366 b''
1 2008-01-11 Ville Vainio <vivainio@gmail.com>
2
3 * iplib.py, ipmaker.py: new rc option - autoexec. It's a list
4 of ipython commands to be run when IPython has started up
5 (just before running the scripts and -c arg on command line).
6
7 * ipy_user_conf.py: Added an example on how to change term
8 colors in config file (through using autoexec).
9
1 10 2008-01-10 Ville Vainio <vivainio@gmail.com>
2 11
3 12 * Prompts.py (set_p_str): do not crash on illegal prompt strings
4 13
5 14 2008-01-08 Ville Vainio <vivainio@gmail.com>
6 15
7 16 * '%macro -r' (raw mode) is now default in sh profile.
8 17
9 18 2007-12-31 Ville Vainio <vivainio@gmail.com>
10 19
11 20 * completer.py: custom completer matching is now case sensitive
12 21 (#207).
13 22
14 23 * ultraTB.py, iplib.py: Add some KeyboardInterrupt catching in
15 24 an attempt to prevent occasional crashes.
16 25
17 26 * CrashHandler.py: Crash log dump now asks user to press enter
18 27 before exiting.
19 28
20 29 * Store _ip in user_ns instead of __builtin__, enabling safer
21 30 coexistence of multiple IPython instances in the same python
22 31 interpreter (#197).
23 32
24 33 * Debugger.py, ipmaker.py: Need to add '-pydb' command line
25 34 switch to enable pydb in post-mortem debugging and %run -d.
26 35
27 36 2007-12-28 Ville Vainio <vivainio@gmail.com>
28 37
29 38 * ipy_server.py: TCP socket server for "remote control" of an IPython
30 39 instance.
31 40
32 41 * Debugger.py: Change to PSF license
33 42
34 43 * simplegeneric.py: Add license & author notes.
35 44
36 45 * ipy_fsops.py: Added PathObj and FileObj, an object-oriented way
37 46 to navigate file system with a custom completer. Run
38 47 ipy_fsops.test_pathobj() to play with it.
39 48
40 49 2007-12-28 Fernando Perez <Fernando.Perez@colorado.edu>
41 50
42 51 * IPython/dtutils.py: Add utilities for interactively running
43 52 doctests. Still needs work to more easily handle the namespace of
44 53 the package one may be working on, but the basics are in place.
45 54
46 55 2007-12-27 Ville Vainio <vivainio@gmail.com>
47 56
48 57 * ipy_completers.py: Applied arno's patch to get proper list of
49 58 packages in import completer. Closes #196.
50 59
51 60 2007-12-20 Ville Vainio <vivainio@gmail.com>
52 61
53 62 * completer.py, generics.py(complete_object): Allow
54 63 custom complers based on python objects via simplegeneric.
55 64 See generics.py / my_demo_complete_object
56 65
57 66 2007-12-13 Fernando Perez <Fernando.Perez@colorado.edu>
58 67
59 68 * IPython/Prompts.py (BasePrompt.__nonzero__): add proper boolean
60 69 behavior to prompt objects, useful for display hooks to adjust
61 70 themselves depending on whether prompts will be there or not.
62 71
63 72 2007-12-13 Ville Vainio <vivainio@gmail.com>
64 73
65 74 * iplib.py(raw_input): unix readline does not allow unicode in
66 75 history, encode to normal string. After patch by Tiago.
67 76 Close #201
68 77
69 78 2007-12-12 Ville Vainio <vivainio@gmail.com>
70 79
71 80 * genutils.py (abbrev_cwd): Terminal title now shows 2 levels of
72 81 current directory.
73 82
74 83 2007-12-12 Fernando Perez <Fernando.Perez@colorado.edu>
75 84
76 85 * IPython/Shell.py (_select_shell): add support for controlling
77 86 the pylab threading mode directly at the command line, without
78 87 having to modify MPL config files. Added unit tests for this
79 88 feature, though manual/docs update is still pending, will do later.
80 89
81 90 2007-12-11 Ville Vainio <vivainio@gmail.com>
82 91
83 92 * ext_rescapture.py: var = !cmd is no longer verbose (to facilitate
84 93 use in scripts)
85 94
86 95 2007-12-07 Ville Vainio <vivainio@gmail.com>
87 96
88 97 * iplib.py, ipy_profile_sh.py: Do not escape # on command lines
89 98 anymore (to \#) - even if it is a comment char that is implicitly
90 99 escaped in some unix shells in interactive mode, it is ok to leave
91 100 it in IPython as such.
92 101
93 102
94 103 2007-12-01 Robert Kern <robert.kern@gmail.com>
95 104
96 105 * IPython/ultraTB.py (findsource): Improve the monkeypatch to
97 106 inspect.findsource(). It can now find source lines inside zipped
98 107 packages.
99 108
100 109 * IPython/ultraTB.py: When constructing tracebacks, try to use __file__
101 110 in the frame's namespace before trusting the filename in the code object
102 111 which created the frame.
103 112
104 113 2007-11-29 *** Released version 0.8.2
105 114
106 115 2007-11-25 Fernando Perez <Fernando.Perez@colorado.edu>
107 116
108 117 * IPython/Logger.py (Logger.logstop): add a proper logstop()
109 118 method to fully stop the logger, along with a corresponding
110 119 %logstop magic for interactive use.
111 120
112 121 * IPython/Extensions/ipy_host_completers.py: added new host
113 122 completers functionality, contributed by Gael Pasgrimaud
114 123 <gawel-AT-afpy.org>.
115 124
116 125 2007-11-24 Fernando Perez <Fernando.Perez@colorado.edu>
117 126
118 127 * IPython/DPyGetOpt.py (ArgumentError): Apply patch by Paul Mueller
119 128 <gakusei-AT-dakotacom.net>, to fix deprecated string exceptions in
120 129 options handling. Unicode fix in %whos (committed a while ago)
121 130 was also contributed by Paul.
122 131
123 132 2007-11-23 Darren Dale <darren.dale@cornell.edu>
124 133 * ipy_traits_completer.py: let traits_completer respect the user's
125 134 readline_omit__names setting.
126 135
127 136 2007-11-08 Ville Vainio <vivainio@gmail.com>
128 137
129 138 * ipy_completers.py (import completer): assume 'xml' module exists.
130 139 Do not add every module twice anymore. Closes #196.
131 140
132 141 * ipy_completers.py, ipy_app_completers.py: Add proper apt-get
133 142 completer that uses apt-cache to search for existing packages.
134 143
135 144 2007-11-06 Ville Vainio <vivainio@gmail.com>
136 145
137 146 * Prompts.py: Do not update _oh and _123 when do_full_cache is not
138 147 true. Closes #194.
139 148
140 149 2007-11-01 Brian Granger <ellisonbg@gmail.com>
141 150
142 151 * iplib.py, rlineimpl.py: Applied Body Water's patches to get IPython
143 152 working with OS X 10.5 libedit implementation of readline.
144 153
145 154 2007-10-24 Ville Vainio <vivainio@gmail.com>
146 155
147 156 * iplib.py(user_setup): To route around buggy installations where
148 157 UserConfig is not available, create a minimal _ipython.
149 158
150 159 * iplib.py: Unicode fixes from Jorgen.
151 160
152 161 * genutils.py: Slist now has new method 'fields()' for extraction of
153 162 whitespace-separated fields from line-oriented data.
154 163
155 164 2007-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
156 165
157 166 * IPython/OInspect.py (Inspector.pinfo): fix bug that could arise
158 167 when querying objects with no __class__ attribute (such as
159 168 f2py-generated modules).
160 169
161 170 2007-10-09 Fernando Perez <Fernando.Perez@colorado.edu>
162 171
163 172 * IPython/Magic.py (magic_time): track compilation time and report
164 173 it if longer than 0.1s (fix done to %time and %timeit). After a
165 174 SAGE bug report: http://trac.sagemath.org/sage_trac/ticket/632.
166 175
167 176 2007-09-18 Ville Vainio <vivainio@gmail.com>
168 177
169 178 * genutils.py(make_quoted_expr): Do not use Itpl, it does
170 179 not support unicode at the moment. Fixes (many) magic calls with
171 180 special characters.
172 181
173 182 2007-09-14 Fernando Perez <Fernando.Perez@colorado.edu>
174 183
175 184 * IPython/genutils.py (doctest_reload): expose the doctest
176 185 reloader to the user so that people can easily reset doctest while
177 186 using it interactively. Fixes a problem reported by Jorgen.
178 187
179 188 * IPython/iplib.py (InteractiveShell.__init__): protect the
180 189 FakeModule instances used for __main__ in %run calls from
181 190 deletion, so that user code defined in them isn't left with
182 191 dangling references due to the Python module deletion machinery.
183 192 This should fix the problems reported by Darren.
184 193
185 194 2007-09-10 Darren Dale <dd55@cornell.edu>
186 195
187 196 * Cleanup of IPShellQt and IPShellQt4
188 197
189 198 2007-09-09 Fernando Perez <Fernando.Perez@colorado.edu>
190 199
191 200 * IPython/FakeModule.py (FakeModule.__init__): further fixes for
192 201 doctest support.
193 202
194 203 * IPython/iplib.py (safe_execfile): minor docstring improvements.
195 204
196 205 2007-09-08 Ville Vainio <vivainio@gmail.com>
197 206
198 207 * Magic.py (%pushd, %popd, %dirs): Fix dir stack - push *current*
199 208 directory, not the target directory.
200 209
201 210 * ipapi.py, Magic.py, iplib.py: Add ipapi.UsageError, a lighter weight
202 211 exception that won't print the tracebacks. Switched many magics to
203 212 raise them on error situations, also GetoptError is not printed
204 213 anymore.
205 214
206 215 2007-09-07 Ville Vainio <vivainio@gmail.com>
207 216
208 217 * iplib.py: do not auto-alias "dir", it screws up other dir auto
209 218 aliases.
210 219
211 220 * genutils.py: SList.grep() implemented.
212 221
213 222 * ipy_editors.py, UserConfig/ipy_user_conf.py: Add some editors
214 223 for easy "out of the box" setup of several common editors, so that
215 224 e.g. '%edit os.path.isfile' will jump to the correct line
216 225 automatically. Contributions for command lines of your favourite
217 226 editors welcome.
218 227
219 228 2007-09-07 Fernando Perez <Fernando.Perez@colorado.edu>
220 229
221 230 * IPython/OInspect.py (Inspector.pinfo): fixed bug that was
222 231 preventing source display in certain cases. In reality I think
223 232 the problem is with Ubuntu's Python build, but this change works
224 233 around the issue in some cases (not in all, unfortunately). I'd
225 234 filed a Python bug on this with more details, but in the change of
226 235 bug trackers it seems to have been lost.
227 236
228 237 * IPython/Magic.py (magic_dhist): restore %dhist. No, cd -TAB is
229 238 not the same, it's not self-documenting, doesn't allow range
230 239 selection, and sorts alphabetically instead of numerically.
231 240 (magic_r): restore %r. No, "up + enter. One char magic" is not
232 241 the same thing, since %r takes parameters to allow fast retrieval
233 242 of old commands. I've received emails from users who use this a
234 243 LOT, so it stays.
235 244 (magic_automagic): restore %automagic. "use _ip.option.automagic"
236 245 is not a valid replacement b/c it doesn't provide an complete
237 246 explanation (which the automagic docstring does).
238 247 (magic_autocall): restore %autocall, with improved docstring.
239 248 Same argument as for others, "use _ip.options.autocall" is not a
240 249 valid replacement.
241 250 (magic_pdef): restore %pdef & friends. Used widely, mentioned in
242 251 tutorials and online docs.
243 252
244 253 2007-09-06 Fernando Perez <Fernando.Perez@colorado.edu>
245 254
246 255 * IPython/usage.py (quick_reference): mention magics in quickref,
247 256 modified main banner to mention %quickref.
248 257
249 258 * IPython/FakeModule.py (FakeModule): fixes for doctest compatibility.
250 259
251 260 2007-09-06 Ville Vainio <vivainio@gmail.com>
252 261
253 262 * ipy_rehashdir.py, ipy_workdir.py, ipy_fsops.py, iplib.py:
254 263 Callable aliases now pass the _ip as first arg. This breaks
255 264 compatibility with earlier 0.8.2.svn series! (though they should
256 265 not have been in use yet outside these few extensions)
257 266
258 267 2007-09-05 Ville Vainio <vivainio@gmail.com>
259 268
260 269 * external/mglob.py: expand('dirname') => ['dirname'], instead
261 270 of ['dirname/foo','dirname/bar', ...].
262 271
263 272 * Extensions/ipy_fsops.py: added, has usefull shell utils for plain
264 273 win32 installations: icp, imv, imkdir, igrep, irm, collect (collect
265 274 is useful for others as well).
266 275
267 276 * iplib.py: on callable aliases (as opposed to old style aliases),
268 277 do var_expand() immediately, and use make_quoted_expr instead
269 278 of hardcoded r"""
270 279
271 280 * Extensions/ipy_profile_sh.py: Try to detect cygwin on win32,
272 281 if not available load ipy_fsops.py for cp, mv, etc. replacements
273 282
274 283 * OInspect.py, ipy_which.py: improve %which and obj? for callable
275 284 aliases
276 285
277 286 2007-09-04 Ville Vainio <vivainio@gmail.com>
278 287
279 288 * ipy_profile_zope.py: add zope profile, by Stefan Eletzhofer.
280 289 Relicensed under BSD with the authors approval.
281 290
282 291 * ipmaker.py, usage.py: Remove %magic from default banner, improve
283 292 %quickref
284 293
285 294 2007-09-03 Ville Vainio <vivainio@gmail.com>
286 295
287 296 * Magic.py: %time now passes expression through prefilter,
288 297 allowing IPython syntax.
289 298
290 299 2007-09-01 Ville Vainio <vivainio@gmail.com>
291 300
292 301 * ipmaker.py: Always show full traceback when newstyle config fails
293 302
294 303 2007-08-27 Ville Vainio <vivainio@gmail.com>
295 304
296 305 * Magic.py: fix %cd for nonexistent dir when dhist is empty, close #180
297 306
298 307 2007-08-26 Ville Vainio <vivainio@gmail.com>
299 308
300 309 * ipmaker.py: Command line args have the highest priority again
301 310
302 311 * iplib.py, ipmaker.py: -i command line argument now behaves as in
303 312 normal python, i.e. leaves the IPython session running after -c
304 313 command or running a batch file from command line.
305 314
306 315 2007-08-22 Ville Vainio <vivainio@gmail.com>
307 316
308 317 * iplib.py: no extra empty (last) line in raw hist w/ multiline
309 318 statements
310 319
311 320 * logger.py: Fix bug where blank lines in history were not
312 321 added until AFTER adding the current line; translated and raw
313 322 history should finally be in sync with prompt now.
314 323
315 324 * ipy_completers.py: quick_completer now makes it easy to create
316 325 trivial custom completers
317 326
318 327 * clearcmd.py: shadow history compression & erasing, fixed input hist
319 328 clearing.
320 329
321 330 * envpersist.py, history.py: %env (sh profile only), %hist completers
322 331
323 332 * genutils.py, Prompts.py, Magic.py: win32 - prompt (with \yDEPTH) and
324 333 term title now include the drive letter, and always use / instead of
325 334 os.sep (as per recommended approach for win32 ipython in general).
326 335
327 336 * ipykit.py, ipy_kitcfg.py: special launcher for ipykit. Allows running
328 337 plain python scripts from ipykit command line by running
329 338 "py myscript.py", even w/o installed python.
330 339
331 340 2007-08-21 Ville Vainio <vivainio@gmail.com>
332 341
333 342 * ipmaker.py: finding ipythonrc-PROF now skips ipy_profile_PROF.
334 343 (for backwards compatibility)
335 344
336 345 * history.py: switch back to %hist -t from %hist -r as default.
337 346 At least until raw history is fixed for good.
338 347
339 348 2007-08-20 Ville Vainio <vivainio@gmail.com>
340 349
341 350 * ipapi.py, iplib.py: DebugTools accessible via _ip.dbg, to catch &
342 351 locate alias redeclarations etc. Also, avoid handling
343 352 _ip.IP.alias_table directly, prefer using _ip.defalias.
344 353
345 354
346 355 2007-08-15 Ville Vainio <vivainio@gmail.com>
347 356
348 357 * prefilter.py: ! is now always served first
349 358
350 359 2007-08-15 Fernando Perez <Fernando.Perez@colorado.edu>
351 360
352 361 * IPython/iplib.py (safe_execfile): fix the SystemExit
353 362 auto-suppression code to work in Python2.4 (the internal structure
354 363 of that exception changed and I'd only tested the code with 2.5).
355 364 Bug reported by a SciPy attendee.
356 365
357 366 2007-08-13 Ville Vainio <vivainio@gmail.com>
358 367
359 368 * prefilter.py: reverted !c:/bin/foo fix, made % in
360 369 multiline specials work again
361 370
362 371 2007-08-13 Ville Vainio <vivainio@gmail.com>
363 372
364 373 * prefilter.py: Take more care to special-case !, so that
365 374 !c:/bin/foo.exe works.
366 375
367 376 * setup.py: if we are building eggs, strip all docs and
368 377 examples (it doesn't make sense to bytecompile examples,
369 378 and docs would be in an awkward place anyway).
370 379
371 380 * Ryan Krauss' patch fixes start menu shortcuts when IPython
372 381 is installed into a directory that has spaces in the name.
373 382
374 383 2007-08-13 Fernando Perez <Fernando.Perez@colorado.edu>
375 384
376 385 * IPython/Magic.py (magic_doctest_mode): fix prompt separators in
377 386 doctest profile and %doctest_mode, so they actually generate the
378 387 blank lines needed by doctest to separate individual tests.
379 388
380 389 * IPython/iplib.py (safe_execfile): modify so that running code
381 390 which calls sys.exit(0) (or equivalently, raise SystemExit(0))
382 391 doesn't get a printed traceback. Any other value in sys.exit(),
383 392 including the empty call, still generates a traceback. This
384 393 enables use of %run without having to pass '-e' for codes that
385 394 correctly set the exit status flag.
386 395
387 396 2007-08-12 Fernando Perez <Fernando.Perez@colorado.edu>
388 397
389 398 * IPython/iplib.py (InteractiveShell.post_config_initialization):
390 399 fix problems with doctests failing when run inside IPython due to
391 400 IPython's modifications of sys.displayhook.
392 401
393 402 2007-8-9 Fernando Perez <fperez@planck.colorado.edu>
394 403
395 404 * IPython/ipapi.py (to_user_ns): update to accept a dict as well as
396 405 a string with names.
397 406
398 407 2007-08-09 Fernando Perez <Fernando.Perez@colorado.edu>
399 408
400 409 * IPython/Magic.py (magic_doctest_mode): added new %doctest_mode
401 410 magic to toggle on/off the doctest pasting support without having
402 411 to leave a session to switch to a separate profile.
403 412
404 413 2007-08-08 Fernando Perez <Fernando.Perez@colorado.edu>
405 414
406 415 * IPython/Extensions/ipy_profile_doctest.py (main): fix prompt to
407 416 introduce a blank line between inputs, to conform to doctest
408 417 requirements.
409 418
410 419 * IPython/OInspect.py (Inspector.pinfo): fix another part where
411 420 auto-generated docstrings for new-style classes were showing up.
412 421
413 422 2007-08-07 Fernando Perez <Fernando.Perez@colorado.edu>
414 423
415 424 * api_changes: Add new file to track backward-incompatible
416 425 user-visible changes.
417 426
418 427 2007-08-06 Ville Vainio <vivainio@gmail.com>
419 428
420 429 * ipmaker.py: fix bug where user_config_ns didn't exist at all
421 430 before all the config files were handled.
422 431
423 432 2007-08-04 Fernando Perez <Fernando.Perez@colorado.edu>
424 433
425 434 * IPython/irunner.py (RunnerFactory): Add new factory class for
426 435 creating reusable runners based on filenames.
427 436
428 437 * IPython/Extensions/ipy_profile_doctest.py: New profile for
429 438 doctest support. It sets prompts/exceptions as similar to
430 439 standard Python as possible, so that ipython sessions in this
431 440 profile can be easily pasted as doctests with minimal
432 441 modifications. It also enables pasting of doctests from external
433 442 sources (even if they have leading whitespace), so that you can
434 443 rerun doctests from existing sources.
435 444
436 445 * IPython/iplib.py (_prefilter): fix a buglet where after entering
437 446 some whitespace, the prompt would become a continuation prompt
438 447 with no way of exiting it other than Ctrl-C. This fix brings us
439 448 into conformity with how the default python prompt works.
440 449
441 450 * IPython/Extensions/InterpreterPasteInput.py (prefilter_paste):
442 451 Add support for pasting not only lines that start with '>>>', but
443 452 also with ' >>>'. That is, arbitrary whitespace can now precede
444 453 the prompts. This makes the system useful for pasting doctests
445 454 from docstrings back into a normal session.
446 455
447 456 2007-08-02 Fernando Perez <Fernando.Perez@colorado.edu>
448 457
449 458 * IPython/Shell.py (IPShellEmbed.__call__): fix bug introduced in
450 459 r1357, which had killed multiple invocations of an embedded
451 460 ipython (this means that example-embed has been broken for over 1
452 461 year!!!). Rather than possibly breaking the batch stuff for which
453 462 the code in iplib.py/interact was introduced, I worked around the
454 463 problem in the embedding class in Shell.py. We really need a
455 464 bloody test suite for this code, I'm sick of finding stuff that
456 465 used to work breaking left and right every time I use an old
457 466 feature I hadn't touched in a few months.
458 467 (kill_embedded): Add a new magic that only shows up in embedded
459 468 mode, to allow users to permanently deactivate an embedded instance.
460 469
461 470 2007-08-01 Ville Vainio <vivainio@gmail.com>
462 471
463 472 * iplib.py, ipy_profile_sh.py (runlines): Fix the bug where raw
464 473 history gets out of sync on runlines (e.g. when running macros).
465 474
466 475 2007-07-31 Fernando Perez <Fernando.Perez@colorado.edu>
467 476
468 477 * IPython/Magic.py (magic_colors): fix win32-related error message
469 478 that could appear under *nix when readline was missing. Patch by
470 479 Scott Jackson, closes #175.
471 480
472 481 2007-07-29 Fernando Perez <Fernando.Perez@colorado.edu>
473 482
474 483 * IPython/Extensions/ipy_traits_completer.py: Add a new custom
475 484 completer that it traits-aware, so that traits objects don't show
476 485 all of their internal attributes all the time.
477 486
478 487 * IPython/genutils.py (dir2): moved this code from inside
479 488 completer.py to expose it publicly, so I could use it in the
480 489 wildcards bugfix.
481 490
482 491 * IPython/wildcard.py (NameSpace.__init__): fix a bug reported by
483 492 Stefan with Traits.
484 493
485 494 * IPython/completer.py (Completer.attr_matches): change internal
486 495 var name from 'object' to 'obj', since 'object' is now a builtin
487 496 and this can lead to weird bugs if reusing this code elsewhere.
488 497
489 498 2007-07-25 Fernando Perez <Fernando.Perez@colorado.edu>
490 499
491 500 * IPython/OInspect.py (Inspector.pinfo): fix small glitches in
492 501 'foo?' and update the code to prevent printing of default
493 502 docstrings that started appearing after I added support for
494 503 new-style classes. The approach I'm using isn't ideal (I just
495 504 special-case those strings) but I'm not sure how to more robustly
496 505 differentiate between truly user-written strings and Python's
497 506 automatic ones.
498 507
499 508 2007-07-09 Ville Vainio <vivainio@gmail.com>
500 509
501 510 * completer.py: Applied Matthew Neeley's patch:
502 511 Dynamic attributes from trait_names and _getAttributeNames are added
503 512 to the list of tab completions, but when this happens, the attribute
504 513 list is turned into a set, so the attributes are unordered when
505 514 printed, which makes it hard to find the right completion. This patch
506 515 turns this set back into a list and sort it.
507 516
508 517 2007-07-06 Fernando Perez <Fernando.Perez@colorado.edu>
509 518
510 519 * IPython/OInspect.py (Inspector.pinfo): Add support for new-style
511 520 classes in various inspector functions.
512 521
513 522 2007-06-28 Ville Vainio <vivainio@gmail.com>
514 523
515 524 * shadowns.py, iplib.py, ipapi.py, OInspect.py:
516 525 Implement "shadow" namespace, and callable aliases that reside there.
517 526 Use them by:
518 527
519 528 _ip.defalias('foo',myfunc) # creates _sh.foo that points to myfunc
520 529
521 530 foo hello world
522 531 (gets translated to:)
523 532 _sh.foo(r"""hello world""")
524 533
525 534 In practice, this kind of alias can take the role of a magic function
526 535
527 536 * New generic inspect_object, called on obj? and obj??
528 537
529 538 2007-06-15 Fernando Perez <Fernando.Perez@colorado.edu>
530 539
531 540 * IPython/ultraTB.py (findsource): fix a problem with
532 541 inspect.getfile that can cause crashes during traceback construction.
533 542
534 543 2007-06-14 Ville Vainio <vivainio@gmail.com>
535 544
536 545 * iplib.py (handle_auto): Try to use ascii for printing "--->"
537 546 autocall rewrite indication, becausesometimes unicode fails to print
538 547 properly (and you get ' - - - '). Use plain uncoloured ---> for
539 548 unicode.
540 549
541 550 * shadow history. Usable through "%hist -g <pat>" and "%rep 0123".
542 551
543 552 . pickleshare 'hash' commands (hget, hset, hcompress,
544 553 hdict) for efficient shadow history storage.
545 554
546 555 2007-06-13 Ville Vainio <vivainio@gmail.com>
547 556
548 557 * ipapi.py: _ip.to_user_ns(vars, interactive = True).
549 558 Added kw arg 'interactive', tell whether vars should be visible
550 559 with %whos.
551 560
552 561 2007-06-11 Ville Vainio <vivainio@gmail.com>
553 562
554 563 * pspersistence.py, Magic.py, iplib.py: directory history now saved
555 564 to db
556 565
557 566 * iplib.py: "ipython -c <cmd>" now passes the command through prefilter.
558 567 Also, it exits IPython immediately after evaluating the command (just like
559 568 std python)
560 569
561 570 2007-06-05 Walter Doerwald <walter@livinglogic.de>
562 571
563 572 * IPython/Extensions/ipipe.py: Added a new table icap, which executes a
564 573 Python string and captures the output. (Idea and original patch by
565 574 Stefan van der Walt)
566 575
567 576 2007-06-01 Fernando Perez <Fernando.Perez@colorado.edu>
568 577
569 578 * IPython/ultraTB.py (VerboseTB.text): update printing of
570 579 exception types for Python 2.5 (now all exceptions in the stdlib
571 580 are new-style classes).
572 581
573 582 2007-05-31 Walter Doerwald <walter@livinglogic.de>
574 583
575 584 * IPython/Extensions/igrid.py: Add new commands refresh and
576 585 refresh_timer (mapped to "R"/"F5" and to the menu) which restarts
577 586 the iterator once (refresh) or after every x seconds (refresh_timer).
578 587 Add a working implementation of "searchexpression", where the text
579 588 entered is not the text to search for, but an expression that must
580 589 be true. Added display of shortcuts to the menu. Added commands "pickinput"
581 590 and "pickinputattr" that put the object or attribute under the cursor
582 591 in the input line. Split the statusbar to be able to display the currently
583 592 active refresh interval. (Patch by Nik Tautenhahn)
584 593
585 594 2007-05-29 Jorgen Stenarson <jorgen.stenarson@bostream.nu>
586 595
587 596 * fixing set_term_title to use ctypes as default
588 597
589 598 * fixing set_term_title fallback to work when curent dir
590 599 is on a windows network share
591 600
592 601 2007-05-28 Ville Vainio <vivainio@gmail.com>
593 602
594 603 * %cpaste: strip + with > from left (diffs).
595 604
596 605 * iplib.py: Fix crash when readline not installed
597 606
598 607 2007-05-26 Ville Vainio <vivainio@gmail.com>
599 608
600 609 * generics.py: intruduce easy to extend result_display generic
601 610 function (using simplegeneric.py).
602 611
603 612 * Fixed the append functionality of %set.
604 613
605 614 2007-05-25 Ville Vainio <vivainio@gmail.com>
606 615
607 616 * New magic: %rep (fetch / run old commands from history)
608 617
609 618 * New extension: mglob (%mglob magic), for powerful glob / find /filter
610 619 like functionality
611 620
612 621 % maghistory.py: %hist -g PATTERM greps the history for pattern
613 622
614 623 2007-05-24 Walter Doerwald <walter@livinglogic.de>
615 624
616 625 * IPython/Extensions/ipipe.py: Added a Table ihist that can be used to
617 626 browse the IPython input history
618 627
619 628 * IPython/Extensions/ibrowse.py: Added two command to ibrowse: pickinput
620 629 (mapped to "i") can be used to put the object under the curser in the input
621 630 line. pickinputattr (mapped to "I") does the same for the attribute under
622 631 the cursor.
623 632
624 633 2007-05-24 Ville Vainio <vivainio@gmail.com>
625 634
626 635 * Grand magic cleansing (changeset [2380]):
627 636
628 637 * Introduce ipy_legacy.py where the following magics were
629 638 moved:
630 639
631 640 pdef pdoc psource pfile rehash dhist Quit p r automagic autocall
632 641
633 642 If you need them, either use default profile or "import ipy_legacy"
634 643 in your ipy_user_conf.py
635 644
636 645 * Move sh and scipy profile to Extensions from UserConfig. this implies
637 646 you should not edit them, but you don't need to run %upgrade when
638 647 upgrading IPython anymore.
639 648
640 649 * %hist/%history now operates in "raw" mode by default. To get the old
641 650 behaviour, run '%hist -n' (native mode).
642 651
643 652 * split ipy_stock_completers.py to ipy_stock_completers.py and
644 653 ipy_app_completers.py. Stock completers (%cd, import, %run) are now
645 654 installed as default.
646 655
647 656 * sh profile now installs ipy_signals.py, for (hopefully) better ctrl+c
648 657 handling.
649 658
650 659 * iplib.py, ipapi.py: _ip.set_next_input(s) sets the next ("default")
651 660 input if readline is available.
652 661
653 662 2007-05-23 Ville Vainio <vivainio@gmail.com>
654 663
655 664 * macro.py: %store uses __getstate__ properly
656 665
657 666 * exesetup.py: added new setup script for creating
658 667 standalone IPython executables with py2exe (i.e.
659 668 no python installation required).
660 669
661 670 * Removed ipythonrc-scipy, ipy_profile_scipy.py takes
662 671 its place.
663 672
664 673 * rlineimpl.py, genutils.py (get_home_dir): py2exe support
665 674
666 675 2007-05-21 Ville Vainio <vivainio@gmail.com>
667 676
668 677 * platutil_win32.py (set_term_title): handle
669 678 failure of 'title' system call properly.
670 679
671 680 2007-05-17 Walter Doerwald <walter@livinglogic.de>
672 681
673 682 * IPython/Extensions/ipipe.py: Fix xrepr for ifiles.
674 683 (Bug detected by Paul Mueller).
675 684
676 685 2007-05-16 Ville Vainio <vivainio@gmail.com>
677 686
678 687 * ipy_profile_sci.py, ipython_win_post_install.py: Create
679 688 new "sci" profile, effectively a modern version of the old
680 689 "scipy" profile (which is now slated for deprecation).
681 690
682 691 2007-05-15 Ville Vainio <vivainio@gmail.com>
683 692
684 693 * pycolorize.py, pycolor.1: Paul Mueller's patches that
685 694 make pycolorize read input from stdin when run without arguments.
686 695
687 696 * Magic.py: do not require 'PATH' in %rehash/%rehashx. Closes #155
688 697
689 698 * ipy_rehashdir.py: rename ext_rehashdir to ipy_rehashdir, import
690 699 it in sh profile (instead of ipy_system_conf.py).
691 700
692 701 * Magic.py, ipy_rehashdir.py, ipy_profile_sh.py: System command
693 702 aliases are now lower case on windows (MyCommand.exe => mycommand).
694 703
695 704 * macro.py, ipapi.py, iplib.py, Prompts.py: Macro system rehaul.
696 705 Macros are now callable objects that inherit from ipapi.IPyAutocall,
697 706 i.e. get autocalled regardless of system autocall setting.
698 707
699 708 2007-05-10 Fernando Perez <Fernando.Perez@colorado.edu>
700 709
701 710 * IPython/rlineimpl.py: check for clear_history in readline and
702 711 make it a dummy no-op if not available. This function isn't
703 712 guaranteed to be in the API and appeared in Python 2.4, so we need
704 713 to check it ourselves. Also, clean up this file quite a bit.
705 714
706 715 * ipython.1: update man page and full manual with information
707 716 about threads (remove outdated warning). Closes #151.
708 717
709 718 2007-05-09 Fernando Perez <Fernando.Perez@colorado.edu>
710 719
711 720 * IPython/Extensions/ipy_constants.py: Add Gael's constants module
712 721 in trunk (note that this made it into the 0.8.1 release already,
713 722 but the changelogs didn't get coordinated). Many thanks to Gael
714 723 Varoquaux <gael.varoquaux-AT-normalesup.org>
715 724
716 725 2007-05-09 *** Released version 0.8.1
717 726
718 727 2007-05-10 Walter Doerwald <walter@livinglogic.de>
719 728
720 729 * IPython/Extensions/igrid.py: Incorporate html help into
721 730 the module, so we don't have to search for the file.
722 731
723 732 2007-05-02 Fernando Perez <Fernando.Perez@colorado.edu>
724 733
725 734 * test/test_irunner.py (RunnerTestCase._test_runner): Close #147.
726 735
727 736 2007-04-30 Ville Vainio <vivainio@gmail.com>
728 737
729 738 * iplib.py: (pre_config_initialization) Catch UnicodeDecodeError if the
730 739 user has illegal (non-ascii) home directory name
731 740
732 741 2007-04-27 Ville Vainio <vivainio@gmail.com>
733 742
734 743 * platutils_win32.py: implement set_term_title for windows
735 744
736 745 * Update version number
737 746
738 747 * ipy_profile_sh.py: more informative prompt (2 dir levels)
739 748
740 749 2007-04-26 Walter Doerwald <walter@livinglogic.de>
741 750
742 751 * IPython/Extensions/igrid.py: (igrid) Fix bug that surfaced
743 752 when the igrid input raised an exception. (Patch by Nik Tautenhahn,
744 753 bug discovered by Ville).
745 754
746 755 2007-04-26 Ville Vainio <vivainio@gmail.com>
747 756
748 757 * Extensions/ipy_completers.py: Olivier's module completer now
749 758 saves the list of root modules if it takes > 4 secs on the first run.
750 759
751 760 * Magic.py (%rehashx): %rehashx now clears the completer cache
752 761
753 762
754 763 2007-04-26 Fernando Perez <Fernando.Perez@colorado.edu>
755 764
756 765 * ipython.el: fix incorrect color scheme, reported by Stefan.
757 766 Closes #149.
758 767
759 768 * IPython/PyColorize.py (Parser.format2): fix state-handling
760 769 logic. I still don't like how that code handles state, but at
761 770 least now it should be correct, if inelegant. Closes #146.
762 771
763 772 2007-04-25 Ville Vainio <vivainio@gmail.com>
764 773
765 774 * Extensions/ipy_which.py: added extension for %which magic, works
766 775 a lot like unix 'which' but also finds and expands aliases, and
767 776 allows wildcards.
768 777
769 778 * ipapi.py (expand_alias): Now actually *return* the expanded alias,
770 779 as opposed to returning nothing.
771 780
772 781 * UserConfig/ipy_user_conf.py, ipy_profile_sh.py: do not import
773 782 ipy_stock_completers on default profile, do import on sh profile.
774 783
775 784 2007-04-22 Jorgen Stenarson <jorgen.stenarson@bostream.nu>
776 785
777 786 * Fix bug in iplib.py/safe_execfile when launching ipython with a script
778 787 like ipython.py foo.py which raised a IndexError.
779 788
780 789 2007-04-21 Ville Vainio <vivainio@gmail.com>
781 790
782 791 * Extensions/ipy_extutil.py: added extension to manage other ipython
783 792 extensions. Now only supports 'ls' == list extensions.
784 793
785 794 2007-04-20 Fernando Perez <Fernando.Perez@colorado.edu>
786 795
787 796 * IPython/Debugger.py (BdbQuit_excepthook): fix small bug that
788 797 would prevent use of the exception system outside of a running
789 798 IPython instance.
790 799
791 800 2007-04-20 Ville Vainio <vivainio@gmail.com>
792 801
793 802 * Extensions/ipy_render.py: added extension for easy
794 803 interactive text template rendering (to clipboard). Uses Ka-Ping Yee's
795 804 'Iptl' template notation,
796 805
797 806 * Extensions/ipy_completers.py: introduced Olivier Lauzanne's
798 807 safer & faster 'import' completer.
799 808
800 809 * ipapi.py: Introduced new ipapi methods, _ip.defmacro(name, value)
801 810 and _ip.defalias(name, command).
802 811
803 812 * Extensions/ipy_exportdb.py: New extension for exporting all the
804 813 %store'd data in a portable format (normal ipapi calls like
805 814 defmacro() etc.)
806 815
807 816 2007-04-19 Ville Vainio <vivainio@gmail.com>
808 817
809 818 * upgrade_dir.py: skip junk files like *.pyc
810 819
811 820 * Release.py: version number to 0.8.1
812 821
813 822 2007-04-18 Ville Vainio <vivainio@gmail.com>
814 823
815 824 * iplib.py (safe_execfile): make "ipython foo.py" work with 2.5.1c1
816 825 and later on win32.
817 826
818 827 2007-04-16 Ville Vainio <vivainio@gmail.com>
819 828
820 829 * iplib.py (showtraceback): Do not crash when running w/o readline.
821 830
822 831 2007-04-12 Walter Doerwald <walter@livinglogic.de>
823 832
824 833 * IPython/Extensions/ipipe.py: (ils) Directoy listings are now
825 834 sorted (case sensitive with files and dirs mixed).
826 835
827 836 2007-04-10 Fernando Perez <Fernando.Perez@colorado.edu>
828 837
829 838 * IPython/Release.py (version): Open trunk for 0.8.1 development.
830 839
831 840 2007-04-10 *** Released version 0.8.0
832 841
833 842 2007-04-07 Fernando Perez <Fernando.Perez@colorado.edu>
834 843
835 844 * Tag 0.8.0 for release.
836 845
837 846 * IPython/iplib.py (reloadhist): add API function to cleanly
838 847 reload the readline history, which was growing inappropriately on
839 848 every %run call.
840 849
841 850 * win32_manual_post_install.py (run): apply last part of Nicolas
842 851 Pernetty's patch (I'd accidentally applied it in a different
843 852 directory and this particular file didn't get patched).
844 853
845 854 2007-04-05 Fernando Perez <Fernando.Perez@colorado.edu>
846 855
847 856 * IPython/Shell.py (MAIN_THREAD_ID): get rid of my stupid hack to
848 857 find the main thread id and use the proper API call. Thanks to
849 858 Stefan for the fix.
850 859
851 860 * test/test_prefilter.py (esc_handler_tests): udpate one of Dan's
852 861 unit tests to reflect fixed ticket #52, and add more tests sent by
853 862 him.
854 863
855 864 * IPython/iplib.py (raw_input): restore the readline completer
856 865 state on every input, in case third-party code messed it up.
857 866 (_prefilter): revert recent addition of early-escape checks which
858 867 prevent many valid alias calls from working.
859 868
860 869 * IPython/Shell.py (MTInteractiveShell.runcode): add a tracking
861 870 flag for sigint handler so we don't run a full signal() call on
862 871 each runcode access.
863 872
864 873 * IPython/Magic.py (magic_whos): small improvement to diagnostic
865 874 message.
866 875
867 876 2007-04-04 Fernando Perez <Fernando.Perez@colorado.edu>
868 877
869 878 * IPython/Shell.py (sigint_handler): I *THINK* I finally got
870 879 asynchronous exceptions working, i.e., Ctrl-C can actually
871 880 interrupt long-running code in the multithreaded shells.
872 881
873 882 This is using Tomer Filiba's great ctypes-based trick:
874 883 http://sebulba.wikispaces.com/recipe+thread2. I'd already tried
875 884 this in the past, but hadn't been able to make it work before. So
876 885 far it looks like it's actually running, but this needs more
877 886 testing. If it really works, I'll be *very* happy, and we'll owe
878 887 a huge thank you to Tomer. My current implementation is ugly,
879 888 hackish and uses nasty globals, but I don't want to try and clean
880 889 anything up until we know if it actually works.
881 890
882 891 NOTE: this feature needs ctypes to work. ctypes is included in
883 892 Python2.5, but 2.4 users will need to manually install it. This
884 893 feature makes multi-threaded shells so much more usable that it's
885 894 a minor price to pay (ctypes is very easy to install, already a
886 895 requirement for win32 and available in major linux distros).
887 896
888 897 2007-04-04 Ville Vainio <vivainio@gmail.com>
889 898
890 899 * Extensions/ipy_completers.py, ipy_stock_completers.py:
891 900 Moved implementations of 'bundled' completers to ipy_completers.py,
892 901 they are only enabled in ipy_stock_completers.py.
893 902
894 903 2007-04-04 Fernando Perez <Fernando.Perez@colorado.edu>
895 904
896 905 * IPython/PyColorize.py (Parser.format2): Fix identation of
897 906 colorzied output and return early if color scheme is NoColor, to
898 907 avoid unnecessary and expensive tokenization. Closes #131.
899 908
900 909 2007-04-03 Fernando Perez <Fernando.Perez@colorado.edu>
901 910
902 911 * IPython/Debugger.py: disable the use of pydb version 1.17. It
903 912 has a critical bug (a missing import that makes post-mortem not
904 913 work at all). Unfortunately as of this time, this is the version
905 914 shipped with Ubuntu Edgy, so quite a few people have this one. I
906 915 hope Edgy will update to a more recent package.
907 916
908 917 2007-04-02 Fernando Perez <Fernando.Perez@colorado.edu>
909 918
910 919 * IPython/iplib.py (_prefilter): close #52, second part of a patch
911 920 set by Stefan (only the first part had been applied before).
912 921
913 922 * IPython/Extensions/ipy_stock_completers.py (module_completer):
914 923 remove usage of the dangerous pkgutil.walk_packages(). See
915 924 details in comments left in the code.
916 925
917 926 * IPython/Magic.py (magic_whos): add support for numpy arrays
918 927 similar to what we had for Numeric.
919 928
920 929 * IPython/completer.py (IPCompleter.complete): extend the
921 930 complete() call API to support completions by other mechanisms
922 931 than readline. Closes #109.
923 932
924 933 * IPython/iplib.py (safe_execfile): add a safeguard under Win32 to
925 934 protect against a bug in Python's execfile(). Closes #123.
926 935
927 936 2007-04-01 Fernando Perez <Fernando.Perez@colorado.edu>
928 937
929 938 * IPython/iplib.py (split_user_input): ensure that when splitting
930 939 user input, the part that can be treated as a python name is pure
931 940 ascii (Python identifiers MUST be pure ascii). Part of the
932 941 ongoing Unicode support work.
933 942
934 943 * IPython/Prompts.py (prompt_specials_color): Add \N for the
935 944 actual prompt number, without any coloring. This allows users to
936 945 produce numbered prompts with their own colors. Added after a
937 946 report/request by Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
938 947
939 948 2007-03-31 Walter Doerwald <walter@livinglogic.de>
940 949
941 950 * IPython/Extensions/igrid.py: Map the return key
942 951 to enter() and shift-return to enterattr().
943 952
944 953 2007-03-30 Fernando Perez <Fernando.Perez@colorado.edu>
945 954
946 955 * IPython/Magic.py (magic_psearch): add unicode support by
947 956 encoding to ascii the input, since this routine also only deals
948 957 with valid Python names. Fixes a bug reported by Stefan.
949 958
950 959 2007-03-29 Fernando Perez <Fernando.Perez@colorado.edu>
951 960
952 961 * IPython/Magic.py (_inspect): convert unicode input into ascii
953 962 before trying to evaluate it as a Python identifier. This fixes a
954 963 problem that the new unicode support had introduced when analyzing
955 964 long definition lines for functions.
956 965
957 966 2007-03-24 Walter Doerwald <walter@livinglogic.de>
958 967
959 968 * IPython/Extensions/igrid.py: Fix picking. Using
960 969 igrid with wxPython 2.6 and -wthread should work now.
961 970 igrid.display() simply tries to create a frame without
962 971 an application. Only if this fails an application is created.
963 972
964 973 2007-03-23 Walter Doerwald <walter@livinglogic.de>
965 974
966 975 * IPython/Extensions/path.py: Updated to version 2.2.
967 976
968 977 2007-03-23 Ville Vainio <vivainio@gmail.com>
969 978
970 979 * iplib.py: recursive alias expansion now works better, so that
971 980 cases like 'top' -> 'd:/cygwin/top' -> 'ls :/cygwin/top'
972 981 doesn't trip up the process, if 'd' has been aliased to 'ls'.
973 982
974 983 * Extensions/ipy_gnuglobal.py added, provides %global magic
975 984 for users of http://www.gnu.org/software/global
976 985
977 986 * iplib.py: '!command /?' now doesn't invoke IPython's help system.
978 987 Closes #52. Patch by Stefan van der Walt.
979 988
980 989 2007-03-23 Fernando Perez <Fernando.Perez@colorado.edu>
981 990
982 991 * IPython/FakeModule.py (FakeModule.__init__): Small fix to
983 992 respect the __file__ attribute when using %run. Thanks to a bug
984 993 report by Sebastian Rooks <sebastian.rooks-AT-free.fr>.
985 994
986 995 2007-03-22 Fernando Perez <Fernando.Perez@colorado.edu>
987 996
988 997 * IPython/iplib.py (raw_input): Fix mishandling of unicode at
989 998 input. Patch sent by Stefan.
990 999
991 1000 2007-03-20 Jorgen Stenarson <jorgen.stenarson@bostream.nu>
992 1001 * IPython/Extensions/ipy_stock_completer.py
993 1002 shlex_split, fix bug in shlex_split. len function
994 1003 call was missing an if statement. Caused shlex_split to
995 1004 sometimes return "" as last element.
996 1005
997 1006 2007-03-18 Fernando Perez <Fernando.Perez@colorado.edu>
998 1007
999 1008 * IPython/completer.py
1000 1009 (IPCompleter.file_matches.single_dir_expand): fix a problem
1001 1010 reported by Stefan, where directories containign a single subdir
1002 1011 would be completed too early.
1003 1012
1004 1013 * IPython/Shell.py (_load_pylab): Make the execution of 'from
1005 1014 pylab import *' when -pylab is given be optional. A new flag,
1006 1015 pylab_import_all controls this behavior, the default is True for
1007 1016 backwards compatibility.
1008 1017
1009 1018 * IPython/ultraTB.py (_formatTracebackLines): Added (slightly
1010 1019 modified) R. Bernstein's patch for fully syntax highlighted
1011 1020 tracebacks. The functionality is also available under ultraTB for
1012 1021 non-ipython users (someone using ultraTB but outside an ipython
1013 1022 session). They can select the color scheme by setting the
1014 1023 module-level global DEFAULT_SCHEME. The highlight functionality
1015 1024 also works when debugging.
1016 1025
1017 1026 * IPython/genutils.py (IOStream.close): small patch by
1018 1027 R. Bernstein for improved pydb support.
1019 1028
1020 1029 * IPython/Debugger.py (Pdb.format_stack_entry): Added patch by
1021 1030 DaveS <davls@telus.net> to improve support of debugging under
1022 1031 NTEmacs, including improved pydb behavior.
1023 1032
1024 1033 * IPython/Magic.py (magic_prun): Fix saving of profile info for
1025 1034 Python 2.5, where the stats object API changed a little. Thanks
1026 1035 to a bug report by Paul Smith <paul.smith-AT-catugmt.com>.
1027 1036
1028 1037 * IPython/ColorANSI.py (InputTermColors.Normal): applied Nicolas
1029 1038 Pernetty's patch to improve support for (X)Emacs under Win32.
1030 1039
1031 1040 2007-03-17 Fernando Perez <Fernando.Perez@colorado.edu>
1032 1041
1033 1042 * IPython/Shell.py (hijack_wx): ipmort WX with current semantics
1034 1043 to quiet a deprecation warning that fires with Wx 2.8. Thanks to
1035 1044 a report by Nik Tautenhahn.
1036 1045
1037 1046 2007-03-16 Walter Doerwald <walter@livinglogic.de>
1038 1047
1039 1048 * setup.py: Add the igrid help files to the list of data files
1040 1049 to be installed alongside igrid.
1041 1050 * IPython/Extensions/igrid.py: (Patch by Nik Tautenhahn)
1042 1051 Show the input object of the igrid browser as the window tile.
1043 1052 Show the object the cursor is on in the statusbar.
1044 1053
1045 1054 2007-03-15 Ville Vainio <vivainio@gmail.com>
1046 1055
1047 1056 * Extensions/ipy_stock_completers.py: Fixed exception
1048 1057 on mismatching quotes in %run completer. Patch by
1049 1058 Jorgen Stenarson. Closes #127.
1050 1059
1051 1060 2007-03-14 Ville Vainio <vivainio@gmail.com>
1052 1061
1053 1062 * Extensions/ext_rehashdir.py: Do not do auto_alias
1054 1063 in %rehashdir, it clobbers %store'd aliases.
1055 1064
1056 1065 * UserConfig/ipy_profile_sh.py: envpersist.py extension
1057 1066 (beefed up %env) imported for sh profile.
1058 1067
1059 1068 2007-03-10 Walter Doerwald <walter@livinglogic.de>
1060 1069
1061 1070 * IPython/Extensions/ipipe.py: Prefer ibrowse over igrid
1062 1071 as the default browser.
1063 1072 * IPython/Extensions/igrid.py: Make a few igrid attributes private.
1064 1073 As igrid displays all attributes it ever encounters, fetch() (which has
1065 1074 been renamed to _fetch()) doesn't have to recalculate the display attributes
1066 1075 every time a new item is fetched. This should speed up scrolling.
1067 1076
1068 1077 2007-03-10 Fernando Perez <Fernando.Perez@colorado.edu>
1069 1078
1070 1079 * IPython/iplib.py (InteractiveShell.__init__): fix for Alex
1071 1080 Schmolck's recently reported tab-completion bug (my previous one
1072 1081 had a problem). Patch by Dan Milstein <danmil-AT-comcast.net>.
1073 1082
1074 1083 2007-03-09 Walter Doerwald <walter@livinglogic.de>
1075 1084
1076 1085 * IPython/Extensions/igrid.py: Patch by Nik Tautenhahn:
1077 1086 Close help window if exiting igrid.
1078 1087
1079 1088 2007-03-02 Jorgen Stenarson <jorgen.stenarson@bostream.nu>
1080 1089
1081 1090 * IPython/Extensions/ipy_defaults.py: Check if readline is available
1082 1091 before calling functions from readline.
1083 1092
1084 1093 2007-03-02 Walter Doerwald <walter@livinglogic.de>
1085 1094
1086 1095 * IPython/Extensions/igrid.py: Add Nik Tautenhahns igrid extension.
1087 1096 igrid is a wxPython-based display object for ipipe. If your system has
1088 1097 wx installed igrid will be the default display. Without wx ipipe falls
1089 1098 back to ibrowse (which needs curses). If no curses is installed ipipe
1090 1099 falls back to idump.
1091 1100
1092 1101 2007-03-01 Fernando Perez <Fernando.Perez@colorado.edu>
1093 1102
1094 1103 * IPython/iplib.py (split_user_inputBROKEN): temporarily disable
1095 1104 my changes from yesterday, they introduced bugs. Will reactivate
1096 1105 once I get a correct solution, which will be much easier thanks to
1097 1106 Dan Milstein's new prefilter test suite.
1098 1107
1099 1108 2007-02-28 Fernando Perez <Fernando.Perez@colorado.edu>
1100 1109
1101 1110 * IPython/iplib.py (split_user_input): fix input splitting so we
1102 1111 don't attempt attribute accesses on things that can't possibly be
1103 1112 valid Python attributes. After a bug report by Alex Schmolck.
1104 1113 (InteractiveShell.__init__): brown-paper bag fix; regexp broke
1105 1114 %magic with explicit % prefix.
1106 1115
1107 1116 2007-02-27 Fernando Perez <Fernando.Perez@colorado.edu>
1108 1117
1109 1118 * IPython/Shell.py (IPShellGTK.mainloop): update threads calls to
1110 1119 avoid a DeprecationWarning from GTK.
1111 1120
1112 1121 2007-02-22 Fernando Perez <Fernando.Perez@colorado.edu>
1113 1122
1114 1123 * IPython/genutils.py (clock): I modified clock() to return total
1115 1124 time, user+system. This is a more commonly needed metric. I also
1116 1125 introduced the new clocku/clocks to get only user/system time if
1117 1126 one wants those instead.
1118 1127
1119 1128 ***WARNING: API CHANGE*** clock() used to return only user time,
1120 1129 so if you want exactly the same results as before, use clocku
1121 1130 instead.
1122 1131
1123 1132 2007-02-22 Ville Vainio <vivainio@gmail.com>
1124 1133
1125 1134 * IPython/Extensions/ipy_p4.py: Extension for improved
1126 1135 p4 (perforce version control system) experience.
1127 1136 Adds %p4 magic with p4 command completion and
1128 1137 automatic -G argument (marshall output as python dict)
1129 1138
1130 1139 2007-02-19 Fernando Perez <Fernando.Perez@colorado.edu>
1131 1140
1132 1141 * IPython/demo.py (Demo.re_stop): make dashes optional in demo
1133 1142 stop marks.
1134 1143 (ClearingMixin): a simple mixin to easily make a Demo class clear
1135 1144 the screen in between blocks and have empty marquees. The
1136 1145 ClearDemo and ClearIPDemo classes that use it are included.
1137 1146
1138 1147 2007-02-18 Fernando Perez <Fernando.Perez@colorado.edu>
1139 1148
1140 1149 * IPython/irunner.py (pexpect_monkeypatch): patch pexpect to
1141 1150 protect against exceptions at Python shutdown time. Patch
1142 1151 sumbmitted to upstream.
1143 1152
1144 1153 2007-02-14 Walter Doerwald <walter@livinglogic.de>
1145 1154
1146 1155 * IPython/Extensions/ibrowse.py: If entering the first object level
1147 1156 (i.e. the object for which the browser has been started) fails,
1148 1157 now the error is raised directly (aborting the browser) instead of
1149 1158 running into an empty levels list later.
1150 1159
1151 1160 2007-02-03 Walter Doerwald <walter@livinglogic.de>
1152 1161
1153 1162 * IPython/Extensions/ipipe.py: Add an xrepr implementation
1154 1163 for the noitem object.
1155 1164
1156 1165 2007-01-31 Fernando Perez <Fernando.Perez@colorado.edu>
1157 1166
1158 1167 * IPython/completer.py (Completer.attr_matches): Fix small
1159 1168 tab-completion bug with Enthought Traits objects with units.
1160 1169 Thanks to a bug report by Tom Denniston
1161 1170 <tom.denniston-AT-alum.dartmouth.org>.
1162 1171
1163 1172 2007-01-27 Fernando Perez <Fernando.Perez@colorado.edu>
1164 1173
1165 1174 * IPython/Extensions/ipy_stock_completers.py (runlistpy): fix a
1166 1175 bug where only .ipy or .py would be completed. Once the first
1167 1176 argument to %run has been given, all completions are valid because
1168 1177 they are the arguments to the script, which may well be non-python
1169 1178 filenames.
1170 1179
1171 1180 * IPython/irunner.py (InteractiveRunner.run_source): major updates
1172 1181 to irunner to allow it to correctly support real doctesting of
1173 1182 out-of-process ipython code.
1174 1183
1175 1184 * IPython/Magic.py (magic_cd): Make the setting of the terminal
1176 1185 title an option (-noterm_title) because it completely breaks
1177 1186 doctesting.
1178 1187
1179 1188 * IPython/demo.py: fix IPythonDemo class that was not actually working.
1180 1189
1181 1190 2007-01-24 Fernando Perez <Fernando.Perez@colorado.edu>
1182 1191
1183 1192 * IPython/irunner.py (main): fix small bug where extensions were
1184 1193 not being correctly recognized.
1185 1194
1186 1195 2007-01-23 Walter Doerwald <walter@livinglogic.de>
1187 1196
1188 1197 * IPython/Extensions/ipipe.py (xiter): Make sure that iterating
1189 1198 a string containing a single line yields the string itself as the
1190 1199 only item.
1191 1200
1192 1201 * IPython/Extensions/ibrowse.py (ibrowse): Avoid entering an
1193 1202 object if it's the same as the one on the last level (This avoids
1194 1203 infinite recursion for one line strings).
1195 1204
1196 1205 2007-01-17 Fernando Perez <Fernando.Perez@colorado.edu>
1197 1206
1198 1207 * IPython/ultraTB.py (AutoFormattedTB.__call__): properly flush
1199 1208 all output streams before printing tracebacks. This ensures that
1200 1209 user output doesn't end up interleaved with traceback output.
1201 1210
1202 1211 2007-01-10 Ville Vainio <vivainio@gmail.com>
1203 1212
1204 1213 * Extensions/envpersist.py: Turbocharged %env that remembers
1205 1214 env vars across sessions; e.g. "%env PATH+=;/opt/scripts" or
1206 1215 "%env VISUAL=jed".
1207 1216
1208 1217 2007-01-05 Fernando Perez <Fernando.Perez@colorado.edu>
1209 1218
1210 1219 * IPython/iplib.py (showtraceback): ensure that we correctly call
1211 1220 custom handlers in all cases (some with pdb were slipping through,
1212 1221 but I'm not exactly sure why).
1213 1222
1214 1223 * IPython/Debugger.py (Tracer.__init__): added new class to
1215 1224 support set_trace-like usage of IPython's enhanced debugger.
1216 1225
1217 1226 2006-12-24 Ville Vainio <vivainio@gmail.com>
1218 1227
1219 1228 * ipmaker.py: more informative message when ipy_user_conf
1220 1229 import fails (suggest running %upgrade).
1221 1230
1222 1231 * tools/run_ipy_in_profiler.py: Utility to see where
1223 1232 the time during IPython startup is spent.
1224 1233
1225 1234 2006-12-20 Ville Vainio <vivainio@gmail.com>
1226 1235
1227 1236 * 0.7.3 is out - merge all from 0.7.3 branch to trunk
1228 1237
1229 1238 * ipapi.py: Add new ipapi method, expand_alias.
1230 1239
1231 1240 * Release.py: Bump up version to 0.7.4.svn
1232 1241
1233 1242 2006-12-17 Ville Vainio <vivainio@gmail.com>
1234 1243
1235 1244 * Extensions/jobctrl.py: Fixed &cmd arg arg...
1236 1245 to work properly on posix too
1237 1246
1238 1247 * Release.py: Update revnum (version is still just 0.7.3).
1239 1248
1240 1249 2006-12-15 Ville Vainio <vivainio@gmail.com>
1241 1250
1242 1251 * scripts/ipython_win_post_install: create ipython.py in
1243 1252 prefix + "/scripts".
1244 1253
1245 1254 * Release.py: Update version to 0.7.3.
1246 1255
1247 1256 2006-12-14 Ville Vainio <vivainio@gmail.com>
1248 1257
1249 1258 * scripts/ipython_win_post_install: Overwrite old shortcuts
1250 1259 if they already exist
1251 1260
1252 1261 * Release.py: release 0.7.3rc2
1253 1262
1254 1263 2006-12-13 Ville Vainio <vivainio@gmail.com>
1255 1264
1256 1265 * Branch and update Release.py for 0.7.3rc1
1257 1266
1258 1267 2006-12-13 Fernando Perez <Fernando.Perez@colorado.edu>
1259 1268
1260 1269 * IPython/Shell.py (IPShellWX): update for current WX naming
1261 1270 conventions, to avoid a deprecation warning with current WX
1262 1271 versions. Thanks to a report by Danny Shevitz.
1263 1272
1264 1273 2006-12-12 Ville Vainio <vivainio@gmail.com>
1265 1274
1266 1275 * ipmaker.py: apply david cournapeau's patch to make
1267 1276 import_some work properly even when ipythonrc does
1268 1277 import_some on empty list (it was an old bug!).
1269 1278
1270 1279 * UserConfig/ipy_user_conf.py, UserConfig/ipythonrc:
1271 1280 Add deprecation note to ipythonrc and a url to wiki
1272 1281 in ipy_user_conf.py
1273 1282
1274 1283
1275 1284 * Magic.py (%run): %run myscript.ipy now runs myscript.ipy
1276 1285 as if it was typed on IPython command prompt, i.e.
1277 1286 as IPython script.
1278 1287
1279 1288 * example-magic.py, magic_grepl.py: remove outdated examples
1280 1289
1281 1290 2006-12-11 Fernando Perez <Fernando.Perez@colorado.edu>
1282 1291
1283 1292 * IPython/iplib.py (debugger): prevent a nasty traceback if %debug
1284 1293 is called before any exception has occurred.
1285 1294
1286 1295 2006-12-08 Ville Vainio <vivainio@gmail.com>
1287 1296
1288 1297 * Extensions/ipy_stock_completers.py: fix cd completer
1289 1298 to translate /'s to \'s again.
1290 1299
1291 1300 * completer.py: prevent traceback on file completions w/
1292 1301 backslash.
1293 1302
1294 1303 * Release.py: Update release number to 0.7.3b3 for release
1295 1304
1296 1305 2006-12-07 Ville Vainio <vivainio@gmail.com>
1297 1306
1298 1307 * Extensions/ipy_signals.py: Ignore ctrl+C in IPython process
1299 1308 while executing external code. Provides more shell-like behaviour
1300 1309 and overall better response to ctrl + C / ctrl + break.
1301 1310
1302 1311 * tools/make_tarball.py: new script to create tarball straight from svn
1303 1312 (setup.py sdist doesn't work on win32).
1304 1313
1305 1314 * Extensions/ipy_stock_completers.py: fix cd completer to give up
1306 1315 on dirnames with spaces and use the default completer instead.
1307 1316
1308 1317 * Revision.py: Change version to 0.7.3b2 for release.
1309 1318
1310 1319 2006-12-05 Ville Vainio <vivainio@gmail.com>
1311 1320
1312 1321 * Magic.py, iplib.py, completer.py: Apply R. Bernstein's
1313 1322 pydb patch 4 (rm debug printing, py 2.5 checking)
1314 1323
1315 1324 2006-11-30 Walter Doerwald <walter@livinglogic.de>
1316 1325 * IPython/Extensions/ibrowse.py: Add two new commands to ibrowse:
1317 1326 "refresh" (mapped to "r") refreshes the screen by restarting the iterator.
1318 1327 "refreshfind" (mapped to "R") does the same but tries to go back to the same
1319 1328 object the cursor was on before the refresh. The command "markrange" is
1320 1329 mapped to "%" now.
1321 1330 * IPython/Extensions/ibrowse.py: Make igrpentry and ipwdentry comparable.
1322 1331
1323 1332 2006-11-29 Fernando Perez <Fernando.Perez@colorado.edu>
1324 1333
1325 1334 * IPython/Magic.py (magic_debug): new %debug magic to activate the
1326 1335 interactive debugger on the last traceback, without having to call
1327 1336 %pdb and rerun your code. Made minor changes in various modules,
1328 1337 should automatically recognize pydb if available.
1329 1338
1330 1339 2006-11-28 Ville Vainio <vivainio@gmail.com>
1331 1340
1332 1341 * completer.py: If the text start with !, show file completions
1333 1342 properly. This helps when trying to complete command name
1334 1343 for shell escapes.
1335 1344
1336 1345 2006-11-27 Ville Vainio <vivainio@gmail.com>
1337 1346
1338 1347 * ipy_stock_completers.py: bzr completer submitted by Stefan van
1339 1348 der Walt. Clean up svn and hg completers by using a common
1340 1349 vcs_completer.
1341 1350
1342 1351 2006-11-26 Ville Vainio <vivainio@gmail.com>
1343 1352
1344 1353 * Remove ipconfig and %config; you should use _ip.options structure
1345 1354 directly instead!
1346 1355
1347 1356 * genutils.py: add wrap_deprecated function for deprecating callables
1348 1357
1349 1358 * iplib.py: deprecate ipmagic, ipsystem, ipalias. Use _ip.magic and
1350 1359 _ip.system instead. ipalias is redundant.
1351 1360
1352 1361 * Magic.py: %rehashdir no longer aliases 'cmdname' to 'cmdname.exe' on
1353 1362 win32, but just 'cmdname'. Other extensions (non-'exe') are still made
1354 1363 explicit.
1355 1364
1356 1365 * ipy_stock_completers.py: 'hg' (mercurial VCS) now has a custom
1357 1366 completer. Try it by entering 'hg ' and pressing tab.
1358 1367
1359 1368 * macro.py: Give Macro a useful __repr__ method
1360 1369
1361 1370 * Magic.py: %whos abbreviates the typename of Macro for brevity.
1362 1371
1363 1372 2006-11-24 Walter Doerwald <walter@livinglogic.de>
1364 1373 * IPython/Extensions/astyle.py: Do a relative import of ipipe, so that
1365 1374 we don't get a duplicate ipipe module, where registration of the xrepr
1366 1375 implementation for Text is useless.
1367 1376
1368 1377 * IPython/Extensions/ipipe.py: Fix __xrepr__() implementation for ils.
1369 1378
1370 1379 * IPython/Extensions/ibrowse.py: Fix keymapping for the enter command.
1371 1380
1372 1381 2006-11-24 Ville Vainio <vivainio@gmail.com>
1373 1382
1374 1383 * Magic.py, manual_base.lyx: Kirill Smelkov patch:
1375 1384 try to use "cProfile" instead of the slower pure python
1376 1385 "profile"
1377 1386
1378 1387 2006-11-23 Ville Vainio <vivainio@gmail.com>
1379 1388
1380 1389 * manual_base.lyx: Kirill Smelkov patch: Fix wrong
1381 1390 Qt+IPython+Designer link in documentation.
1382 1391
1383 1392 * Extensions/ipy_pydb.py: R. Bernstein's patch for passing
1384 1393 correct Pdb object to %pydb.
1385 1394
1386 1395
1387 1396 2006-11-22 Walter Doerwald <walter@livinglogic.de>
1388 1397 * IPython/Extensions/astyle.py: Text needs it's own implemenation of the
1389 1398 generic xrepr(), otherwise the list implementation would kick in.
1390 1399
1391 1400 2006-11-21 Ville Vainio <vivainio@gmail.com>
1392 1401
1393 1402 * upgrade_dir.py: Now actually overwrites a nonmodified user file
1394 1403 with one from UserConfig.
1395 1404
1396 1405 * ipy_profile_sh.py: Add dummy "depth" to var_expand lambda,
1397 1406 it was missing which broke the sh profile.
1398 1407
1399 1408 * completer.py: file completer now uses explicit '/' instead
1400 1409 of os.path.join, expansion of 'foo' was broken on win32
1401 1410 if there was one directory with name 'foobar'.
1402 1411
1403 1412 * A bunch of patches from Kirill Smelkov:
1404 1413
1405 1414 * [patch 9/9] doc: point bug-tracker URL to IPythons trac-tickets.
1406 1415
1407 1416 * [patch 7/9] Implement %page -r (page in raw mode) -
1408 1417
1409 1418 * [patch 5/9] ScientificPython webpage has moved
1410 1419
1411 1420 * [patch 4/9] The manual mentions %ds, should be %dhist
1412 1421
1413 1422 * [patch 3/9] Kill old bits from %prun doc.
1414 1423
1415 1424 * [patch 1/9] Fix typos here and there.
1416 1425
1417 1426 2006-11-08 Ville Vainio <vivainio@gmail.com>
1418 1427
1419 1428 * completer.py (attr_matches): catch all exceptions raised
1420 1429 by eval of expr with dots.
1421 1430
1422 1431 2006-11-07 Fernando Perez <Fernando.Perez@colorado.edu>
1423 1432
1424 1433 * IPython/iplib.py (runsource): Prepend an 'if 1:' to the user
1425 1434 input if it starts with whitespace. This allows you to paste
1426 1435 indented input from any editor without manually having to type in
1427 1436 the 'if 1:', which is convenient when working interactively.
1428 1437 Slightly modifed version of a patch by Bo Peng
1429 1438 <bpeng-AT-rice.edu>.
1430 1439
1431 1440 2006-11-03 Fernando Perez <Fernando.Perez@colorado.edu>
1432 1441
1433 1442 * IPython/irunner.py (main): modified irunner so it automatically
1434 1443 recognizes the right runner to use based on the extension (.py for
1435 1444 python, .ipy for ipython and .sage for sage).
1436 1445
1437 1446 * IPython/iplib.py (InteractiveShell.ipconfig): new builtin, also
1438 1447 visible in ipapi as ip.config(), to programatically control the
1439 1448 internal rc object. There's an accompanying %config magic for
1440 1449 interactive use, which has been enhanced to match the
1441 1450 funtionality in ipconfig.
1442 1451
1443 1452 * IPython/Magic.py (magic_system_verbose): Change %system_verbose
1444 1453 so it's not just a toggle, it now takes an argument. Add support
1445 1454 for a customizable header when making system calls, as the new
1446 1455 system_header variable in the ipythonrc file.
1447 1456
1448 1457 2006-11-03 Walter Doerwald <walter@livinglogic.de>
1449 1458
1450 1459 * IPython/Extensions/ipipe.py: xrepr(), xiter() and xattrs() are now
1451 1460 generic functions (using Philip J. Eby's simplegeneric package).
1452 1461 This makes it possible to customize the display of third-party classes
1453 1462 without having to monkeypatch them. xiter() no longer supports a mode
1454 1463 argument and the XMode class has been removed. The same functionality can
1455 1464 be implemented via IterAttributeDescriptor and IterMethodDescriptor.
1456 1465 One consequence of the switch to generic functions is that xrepr() and
1457 1466 xattrs() implementation must define the default value for the mode
1458 1467 argument themselves and xattrs() implementations must return real
1459 1468 descriptors.
1460 1469
1461 1470 * IPython/external: This new subpackage will contain all third-party
1462 1471 packages that are bundled with IPython. (The first one is simplegeneric).
1463 1472
1464 1473 * IPython/Extensions/ipipe.py (ifile/ils): Readd output of the parent
1465 1474 directory which as been dropped in r1703.
1466 1475
1467 1476 * IPython/Extensions/ipipe.py (iless): Fixed.
1468 1477
1469 1478 * IPython/Extensions/ibrowse: Fixed sorting under Python 2.3.
1470 1479
1471 1480 2006-11-03 Fernando Perez <Fernando.Perez@colorado.edu>
1472 1481
1473 1482 * IPython/iplib.py (InteractiveShell.var_expand): fix stack
1474 1483 handling in variable expansion so that shells and magics recognize
1475 1484 function local scopes correctly. Bug reported by Brian.
1476 1485
1477 1486 * scripts/ipython: remove the very first entry in sys.path which
1478 1487 Python auto-inserts for scripts, so that sys.path under IPython is
1479 1488 as similar as possible to that under plain Python.
1480 1489
1481 1490 * IPython/completer.py (IPCompleter.file_matches): Fix
1482 1491 tab-completion so that quotes are not closed unless the completion
1483 1492 is unambiguous. After a request by Stefan. Minor cleanups in
1484 1493 ipy_stock_completers.
1485 1494
1486 1495 2006-11-02 Ville Vainio <vivainio@gmail.com>
1487 1496
1488 1497 * ipy_stock_completers.py: Add %run and %cd completers.
1489 1498
1490 1499 * completer.py: Try running custom completer for both
1491 1500 "foo" and "%foo" if the command is just "foo". Ignore case
1492 1501 when filtering possible completions.
1493 1502
1494 1503 * UserConfig/ipy_user_conf.py: install stock completers as default
1495 1504
1496 1505 * iplib.py (history_saving_wrapper), debugger(), ipy_pydb.py:
1497 1506 simplified readline history save / restore through a wrapper
1498 1507 function
1499 1508
1500 1509
1501 1510 2006-10-31 Ville Vainio <vivainio@gmail.com>
1502 1511
1503 1512 * strdispatch.py, completer.py, ipy_stock_completers.py:
1504 1513 Allow str_key ("command") in completer hooks. Implement
1505 1514 trivial completer for 'import' (stdlib modules only). Rename
1506 1515 ipy_linux_package_managers.py to ipy_stock_completers.py.
1507 1516 SVN completer.
1508 1517
1509 1518 * Extensions/ledit.py: %magic line editor for easily and
1510 1519 incrementally manipulating lists of strings. The magic command
1511 1520 name is %led.
1512 1521
1513 1522 2006-10-30 Ville Vainio <vivainio@gmail.com>
1514 1523
1515 1524 * Debugger.py, iplib.py (debugger()): Add last set of Rocky
1516 1525 Bernsteins's patches for pydb integration.
1517 1526 http://bashdb.sourceforge.net/pydb/
1518 1527
1519 1528 * strdispatch.py, iplib.py, completer.py, IPython/__init__.py,
1520 1529 Extensions/ipy_linux_package_managers.py, hooks.py: Implement
1521 1530 custom completer hook to allow the users to implement their own
1522 1531 completers. See ipy_linux_package_managers.py for example. The
1523 1532 hook name is 'complete_command'.
1524 1533
1525 1534 2006-10-28 Fernando Perez <Fernando.Perez@colorado.edu>
1526 1535
1527 1536 * IPython/UserConfig/ipythonrc-scipy: minor cleanups to remove old
1528 1537 Numeric leftovers.
1529 1538
1530 1539 * ipython.el (py-execute-region): apply Stefan's patch to fix
1531 1540 garbled results if the python shell hasn't been previously started.
1532 1541
1533 1542 * IPython/genutils.py (arg_split): moved to genutils, since it's a
1534 1543 pretty generic function and useful for other things.
1535 1544
1536 1545 * IPython/OInspect.py (getsource): Add customizable source
1537 1546 extractor. After a request/patch form W. Stein (SAGE).
1538 1547
1539 1548 * IPython/irunner.py (InteractiveRunner.run_source): reset tty
1540 1549 window size to a more reasonable value from what pexpect does,
1541 1550 since their choice causes wrapping bugs with long input lines.
1542 1551
1543 1552 2006-10-28 Ville Vainio <vivainio@gmail.com>
1544 1553
1545 1554 * Magic.py (%run): Save and restore the readline history from
1546 1555 file around %run commands to prevent side effects from
1547 1556 %runned programs that might use readline (e.g. pydb).
1548 1557
1549 1558 * extensions/ipy_pydb.py: Adds %pydb magic when imported, for
1550 1559 invoking the pydb enhanced debugger.
1551 1560
1552 1561 2006-10-23 Walter Doerwald <walter@livinglogic.de>
1553 1562
1554 1563 * IPython/Extensions/ipipe.py (ifile): Remove all methods that
1555 1564 call the base class method and propagate the return value to
1556 1565 ifile. This is now done by path itself.
1557 1566
1558 1567 2006-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
1559 1568
1560 1569 * IPython/ipapi.py (IPApi.__init__): Added new entry to public
1561 1570 api: set_crash_handler(), to expose the ability to change the
1562 1571 internal crash handler.
1563 1572
1564 1573 * IPython/CrashHandler.py (CrashHandler.__init__): abstract out
1565 1574 the various parameters of the crash handler so that apps using
1566 1575 IPython as their engine can customize crash handling. Ipmlemented
1567 1576 at the request of SAGE.
1568 1577
1569 1578 2006-10-14 Ville Vainio <vivainio@gmail.com>
1570 1579
1571 1580 * Magic.py, ipython.el: applied first "safe" part of Rocky
1572 1581 Bernstein's patch set for pydb integration.
1573 1582
1574 1583 * Magic.py (%unalias, %alias): %store'd aliases can now be
1575 1584 removed with '%unalias'. %alias w/o args now shows most
1576 1585 interesting (stored / manually defined) aliases last
1577 1586 where they catch the eye w/o scrolling.
1578 1587
1579 1588 * Magic.py (%rehashx), ext_rehashdir.py: files with
1580 1589 'py' extension are always considered executable, even
1581 1590 when not in PATHEXT environment variable.
1582 1591
1583 1592 2006-10-12 Ville Vainio <vivainio@gmail.com>
1584 1593
1585 1594 * jobctrl.py: Add new "jobctrl" extension for spawning background
1586 1595 processes with "&find /". 'import jobctrl' to try it out. Requires
1587 1596 'subprocess' module, standard in python 2.4+.
1588 1597
1589 1598 * iplib.py (expand_aliases, handle_alias): Aliases expand transitively,
1590 1599 so if foo -> bar and bar -> baz, then foo -> baz.
1591 1600
1592 1601 2006-10-09 Fernando Perez <Fernando.Perez@colorado.edu>
1593 1602
1594 1603 * IPython/Magic.py (Magic.parse_options): add a new posix option
1595 1604 to allow parsing of input args in magics that doesn't strip quotes
1596 1605 (if posix=False). This also closes %timeit bug reported by
1597 1606 Stefan.
1598 1607
1599 1608 2006-10-03 Ville Vainio <vivainio@gmail.com>
1600 1609
1601 1610 * iplib.py (raw_input, interact): Return ValueError catching for
1602 1611 raw_input. Fixes infinite loop for sys.stdin.close() or
1603 1612 sys.stdout.close().
1604 1613
1605 1614 2006-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
1606 1615
1607 1616 * IPython/irunner.py (InteractiveRunner.run_source): small fixes
1608 1617 to help in handling doctests. irunner is now pretty useful for
1609 1618 running standalone scripts and simulate a full interactive session
1610 1619 in a format that can be then pasted as a doctest.
1611 1620
1612 1621 * IPython/iplib.py (InteractiveShell.__init__): Install exit/quit
1613 1622 on top of the default (useless) ones. This also fixes the nasty
1614 1623 way in which 2.5's Quitter() exits (reverted [1785]).
1615 1624
1616 1625 * IPython/Debugger.py (Pdb.__init__): Fix ipdb to work with python
1617 1626 2.5.
1618 1627
1619 1628 * IPython/ultraTB.py (TBTools.set_colors): Make sure that ipdb
1620 1629 color scheme is updated as well when color scheme is changed
1621 1630 interactively.
1622 1631
1623 1632 2006-09-27 Ville Vainio <vivainio@gmail.com>
1624 1633
1625 1634 * iplib.py (raw_input): python 2.5 closes stdin on quit -> avoid
1626 1635 infinite loop and just exit. It's a hack, but will do for a while.
1627 1636
1628 1637 2006-08-25 Walter Doerwald <walter@livinglogic.de>
1629 1638
1630 1639 * IPython/Extensions/ipipe.py (ils): Add arguments dirs and files to
1631 1640 the constructor, this makes it possible to get a list of only directories
1632 1641 or only files.
1633 1642
1634 1643 2006-08-12 Ville Vainio <vivainio@gmail.com>
1635 1644
1636 1645 * Fakemodule.py, OInspect.py: Reverted 2006-08-11 mods,
1637 1646 they broke unittest
1638 1647
1639 1648 2006-08-11 Ville Vainio <vivainio@gmail.com>
1640 1649
1641 1650 * Fakemodule.py, OInspect.py: remove 2006-08-09 monkepatch
1642 1651 by resolving issue properly, i.e. by inheriting FakeModule
1643 1652 from types.ModuleType. Pickling ipython interactive data
1644 1653 should still work as usual (testing appreciated).
1645 1654
1646 1655 2006-08-09 Fernando Perez <Fernando.Perez@colorado.edu>
1647 1656
1648 1657 * IPython/OInspect.py: monkeypatch inspect from the stdlib if
1649 1658 running under python 2.3 with code from 2.4 to fix a bug with
1650 1659 help(). Reported by the Debian maintainers, Norbert Tretkowski
1651 1660 <norbert-AT-tretkowski.de> and Alexandre Fayolle
1652 1661 <afayolle-AT-debian.org>.
1653 1662
1654 1663 2006-08-04 Walter Doerwald <walter@livinglogic.de>
1655 1664
1656 1665 * IPython/Extensions/ibrowse.py: Fixed the help message in the footer
1657 1666 (which was displaying "quit" twice).
1658 1667
1659 1668 2006-07-28 Walter Doerwald <walter@livinglogic.de>
1660 1669
1661 1670 * IPython/Extensions/ipipe.py: Fix isort.__iter__() (was still using
1662 1671 the mode argument).
1663 1672
1664 1673 2006-07-27 Walter Doerwald <walter@livinglogic.de>
1665 1674
1666 1675 * IPython/Extensions/ipipe.py: Fix getglobals() if we're
1667 1676 not running under IPython.
1668 1677
1669 1678 * IPython/Extensions/ipipe.py: Rename XAttr to AttributeDetail
1670 1679 and make it iterable (iterating over the attribute itself). Add two new
1671 1680 magic strings for __xattrs__(): If the string starts with "-", the attribute
1672 1681 will not be displayed in ibrowse's detail view (but it can still be
1673 1682 iterated over). This makes it possible to add attributes that are large
1674 1683 lists or generator methods to the detail view. Replace magic attribute names
1675 1684 and _attrname() and _getattr() with "descriptors": For each type of magic
1676 1685 attribute name there's a subclass of Descriptor: None -> SelfDescriptor();
1677 1686 "foo" -> AttributeDescriptor("foo"); "foo()" -> MethodDescriptor("foo");
1678 1687 "-foo" -> IterAttributeDescriptor("foo"); "-foo()" -> IterMethodDescriptor("foo");
1679 1688 foo() -> FunctionDescriptor(foo). Magic strings returned from __xattrs__()
1680 1689 are still supported.
1681 1690
1682 1691 * IPython/Extensions/ibrowse.py: If fetching the next row from the input
1683 1692 fails in ibrowse.fetch(), the exception object is added as the last item
1684 1693 and item fetching is canceled. This prevents ibrowse from aborting if e.g.
1685 1694 a generator throws an exception midway through execution.
1686 1695
1687 1696 * IPython/Extensions/ipipe.py: Turn ifile's properties mimetype and
1688 1697 encoding into methods.
1689 1698
1690 1699 2006-07-26 Ville Vainio <vivainio@gmail.com>
1691 1700
1692 1701 * iplib.py: history now stores multiline input as single
1693 1702 history entries. Patch by Jorgen Cederlof.
1694 1703
1695 1704 2006-07-18 Walter Doerwald <walter@livinglogic.de>
1696 1705
1697 1706 * IPython/Extensions/ibrowse.py: Make cursor visible over
1698 1707 non existing attributes.
1699 1708
1700 1709 2006-07-14 Walter Doerwald <walter@livinglogic.de>
1701 1710
1702 1711 * IPython/Extensions/ipipe.py (ix): Use os.popen4() so that the
1703 1712 error output of the running command doesn't mess up the screen.
1704 1713
1705 1714 2006-07-13 Walter Doerwald <walter@livinglogic.de>
1706 1715
1707 1716 * IPython/Extensions/ipipe.py (isort): Make isort usable without
1708 1717 argument. This sorts the items themselves.
1709 1718
1710 1719 2006-07-12 Walter Doerwald <walter@livinglogic.de>
1711 1720
1712 1721 * IPython/Extensions/ipipe.py (eval, ifilter, isort, ieval):
1713 1722 Compile expression strings into code objects. This should speed
1714 1723 up ifilter and friends somewhat.
1715 1724
1716 1725 2006-07-08 Ville Vainio <vivainio@gmail.com>
1717 1726
1718 1727 * Magic.py: %cpaste now strips > from the beginning of lines
1719 1728 to ease pasting quoted code from emails. Contributed by
1720 1729 Stefan van der Walt.
1721 1730
1722 1731 2006-06-29 Ville Vainio <vivainio@gmail.com>
1723 1732
1724 1733 * ipmaker.py, Shell.py: qt4agg matplotlib backend support for pylab
1725 1734 mode, patch contributed by Darren Dale. NEEDS TESTING!
1726 1735
1727 1736 2006-06-28 Walter Doerwald <walter@livinglogic.de>
1728 1737
1729 1738 * IPython/Extensions/ibrowse.py: Give the ibrowse cursor row
1730 1739 a blue background. Fix fetching new display rows when the browser
1731 1740 scrolls more than a screenful (e.g. by using the goto command).
1732 1741
1733 1742 2006-06-27 Ville Vainio <vivainio@gmail.com>
1734 1743
1735 1744 * Magic.py (_inspect, _ofind) Apply David Huard's
1736 1745 patch for displaying the correct docstring for 'property'
1737 1746 attributes.
1738 1747
1739 1748 2006-06-23 Walter Doerwald <walter@livinglogic.de>
1740 1749
1741 1750 * IPython/Extensions/ibrowse.py: Put the documentation of the keyboard
1742 1751 commands into the methods implementing them.
1743 1752
1744 1753 2006-06-22 Fernando Perez <Fernando.Perez@colorado.edu>
1745 1754
1746 1755 * ipython.el (ipython-indentation-hook): cleanup patch, submitted
1747 1756 by Kov Chai <tchaikov-AT-gmail.com>. He notes that the original
1748 1757 autoindent support was authored by Jin Liu.
1749 1758
1750 1759 2006-06-22 Walter Doerwald <walter@livinglogic.de>
1751 1760
1752 1761 * IPython/Extensions/ibrowse.py: Replace the plain dictionaries used
1753 1762 for keymaps with a custom class that simplifies handling.
1754 1763
1755 1764 2006-06-19 Walter Doerwald <walter@livinglogic.de>
1756 1765
1757 1766 * IPython/Extensions/ibrowse.py: ibrowse now properly handles terminal
1758 1767 resizing. This requires Python 2.5 to work.
1759 1768
1760 1769 2006-06-16 Walter Doerwald <walter@livinglogic.de>
1761 1770
1762 1771 * IPython/Extensions/ibrowse.py: Add two new commands to
1763 1772 ibrowse: "hideattr" (mapped to "h") hides the attribute under
1764 1773 the cursor. "unhiderattrs" (mapped to "H") reveals all hidden
1765 1774 attributes again. Remapped the help command to "?". Display
1766 1775 keycodes in the range 0x01-0x1F as CTRL-xx. Add CTRL-a and CTRL-e
1767 1776 as keys for the "home" and "end" commands. Add three new commands
1768 1777 to the input mode for "find" and friends: "delend" (CTRL-K)
1769 1778 deletes to the end of line. "incsearchup" searches upwards in the
1770 1779 command history for an input that starts with the text before the cursor.
1771 1780 "incsearchdown" does the same downwards. Removed a bogus mapping of
1772 1781 the x key to "delete".
1773 1782
1774 1783 2006-06-15 Ville Vainio <vivainio@gmail.com>
1775 1784
1776 1785 * iplib.py, hooks.py: Added new generate_prompt hook that can be
1777 1786 used to create prompts dynamically, instead of the "old" way of
1778 1787 assigning "magic" strings to prompt_in1 and prompt_in2. The old
1779 1788 way still works (it's invoked by the default hook), of course.
1780 1789
1781 1790 * Prompts.py: added generate_output_prompt hook for altering output
1782 1791 prompt
1783 1792
1784 1793 * Release.py: Changed version string to 0.7.3.svn.
1785 1794
1786 1795 2006-06-15 Walter Doerwald <walter@livinglogic.de>
1787 1796
1788 1797 * IPython/Extensions/ibrowse.py: Change _BrowserLevel.moveto() so that
1789 1798 the call to fetch() always tries to fetch enough data for at least one
1790 1799 full screen. This makes it possible to simply call moveto(0,0,True) in
1791 1800 the constructor. Fix typos and removed the obsolete goto attribute.
1792 1801
1793 1802 2006-06-12 Ville Vainio <vivainio@gmail.com>
1794 1803
1795 1804 * ipy_profile_sh.py: applied Krisha Mohan Gundu's patch for
1796 1805 allowing $variable interpolation within multiline statements,
1797 1806 though so far only with "sh" profile for a testing period.
1798 1807 The patch also enables splitting long commands with \ but it
1799 1808 doesn't work properly yet.
1800 1809
1801 1810 2006-06-12 Walter Doerwald <walter@livinglogic.de>
1802 1811
1803 1812 * IPython/Extensions/ibrowse.py (_dodisplay): Display the length of the
1804 1813 input history and the position of the cursor in the input history for
1805 1814 the find, findbackwards and goto command.
1806 1815
1807 1816 2006-06-10 Walter Doerwald <walter@livinglogic.de>
1808 1817
1809 1818 * IPython/Extensions/ibrowse.py: Add a class _CommandInput that
1810 1819 implements the basic functionality of browser commands that require
1811 1820 input. Reimplement the goto, find and findbackwards commands as
1812 1821 subclasses of _CommandInput. Add an input history and keymaps to those
1813 1822 commands. Add "\r" as a keyboard shortcut for the enterdefault and
1814 1823 execute commands.
1815 1824
1816 1825 2006-06-07 Ville Vainio <vivainio@gmail.com>
1817 1826
1818 1827 * iplib.py: ipython mybatch.ipy exits ipython immediately after
1819 1828 running the batch files instead of leaving the session open.
1820 1829
1821 1830 2006-06-07 Fernando Perez <Fernando.Perez@colorado.edu>
1822 1831
1823 1832 * IPython/iplib.py (InteractiveShell.__init__): update BSD fix, as
1824 1833 the original fix was incomplete. Patch submitted by W. Maier.
1825 1834
1826 1835 2006-06-07 Ville Vainio <vivainio@gmail.com>
1827 1836
1828 1837 * iplib.py,Magic.py, ipmaker.py (magic_rehashx):
1829 1838 Confirmation prompts can be supressed by 'quiet' option.
1830 1839 _ip.options.quiet = 1 means "assume yes for all yes/no queries".
1831 1840
1832 1841 2006-06-06 *** Released version 0.7.2
1833 1842
1834 1843 2006-06-06 Fernando Perez <Fernando.Perez@colorado.edu>
1835 1844
1836 1845 * IPython/Release.py (version): Made 0.7.2 final for release.
1837 1846 Repo tagged and release cut.
1838 1847
1839 1848 2006-06-05 Ville Vainio <vivainio@gmail.com>
1840 1849
1841 1850 * Magic.py (magic_rehashx): Honor no_alias list earlier in
1842 1851 %rehashx, to avoid clobbering builtins in ipy_profile_sh.py
1843 1852
1844 1853 * upgrade_dir.py: try import 'path' module a bit harder
1845 1854 (for %upgrade)
1846 1855
1847 1856 2006-06-03 Fernando Perez <Fernando.Perez@colorado.edu>
1848 1857
1849 1858 * IPython/genutils.py (ask_yes_no): treat EOF as a default answer
1850 1859 instead of looping 20 times.
1851 1860
1852 1861 * IPython/ipmaker.py (make_IPython): honor -ipythondir flag
1853 1862 correctly at initialization time. Bug reported by Krishna Mohan
1854 1863 Gundu <gkmohan-AT-gmail.com> on the user list.
1855 1864
1856 1865 * IPython/Release.py (version): Mark 0.7.2 version to start
1857 1866 testing for release on 06/06.
1858 1867
1859 1868 2006-05-31 Fernando Perez <Fernando.Perez@colorado.edu>
1860 1869
1861 1870 * scripts/irunner: thin script interface so users don't have to
1862 1871 find the module and call it as an executable, since modules rarely
1863 1872 live in people's PATH.
1864 1873
1865 1874 * IPython/irunner.py (InteractiveRunner.__init__): added
1866 1875 delaybeforesend attribute to control delays with newer versions of
1867 1876 pexpect. Thanks to detailed help from pexpect's author, Noah
1868 1877 Spurrier <noah-AT-noah.org>. Noted how to use the SAGE runner
1869 1878 correctly (it works in NoColor mode).
1870 1879
1871 1880 * IPython/iplib.py (handle_normal): fix nasty crash reported on
1872 1881 SAGE list, from improper log() calls.
1873 1882
1874 1883 2006-05-31 Ville Vainio <vivainio@gmail.com>
1875 1884
1876 1885 * upgrade_dir.py, Magic.py (magic_upgrade): call upgrade_dir
1877 1886 with args in parens to work correctly with dirs that have spaces.
1878 1887
1879 1888 2006-05-30 Fernando Perez <Fernando.Perez@colorado.edu>
1880 1889
1881 1890 * IPython/Logger.py (Logger.logstart): add option to log raw input
1882 1891 instead of the processed one. A -r flag was added to the
1883 1892 %logstart magic used for controlling logging.
1884 1893
1885 1894 2006-05-29 Fernando Perez <Fernando.Perez@colorado.edu>
1886 1895
1887 1896 * IPython/iplib.py (InteractiveShell.__init__): add check for the
1888 1897 *BSDs to omit --color from all 'ls' aliases, since *BSD ls doesn't
1889 1898 recognize the option. After a bug report by Will Maier. This
1890 1899 closes #64 (will do it after confirmation from W. Maier).
1891 1900
1892 1901 * IPython/irunner.py: New module to run scripts as if manually
1893 1902 typed into an interactive environment, based on pexpect. After a
1894 1903 submission by Ken Schutte <kschutte-AT-csail.mit.edu> on the
1895 1904 ipython-user list. Simple unittests in the tests/ directory.
1896 1905
1897 1906 * tools/release: add Will Maier, OpenBSD port maintainer, to
1898 1907 recepients list. We are now officially part of the OpenBSD ports:
1899 1908 http://www.openbsd.org/ports.html ! Many thanks to Will for the
1900 1909 work.
1901 1910
1902 1911 2006-05-26 Fernando Perez <Fernando.Perez@colorado.edu>
1903 1912
1904 1913 * IPython/ipmaker.py (make_IPython): modify sys.argv fix (below)
1905 1914 so that it doesn't break tkinter apps.
1906 1915
1907 1916 * IPython/iplib.py (_prefilter): fix bug where aliases would
1908 1917 shadow variables when autocall was fully off. Reported by SAGE
1909 1918 author William Stein.
1910 1919
1911 1920 * IPython/OInspect.py (Inspector.__init__): add a flag to control
1912 1921 at what detail level strings are computed when foo? is requested.
1913 1922 This allows users to ask for example that the string form of an
1914 1923 object is only computed when foo?? is called, or even never, by
1915 1924 setting the object_info_string_level >= 2 in the configuration
1916 1925 file. This new option has been added and documented. After a
1917 1926 request by SAGE to be able to control the printing of very large
1918 1927 objects more easily.
1919 1928
1920 1929 2006-05-25 Fernando Perez <Fernando.Perez@colorado.edu>
1921 1930
1922 1931 * IPython/ipmaker.py (make_IPython): remove the ipython call path
1923 1932 from sys.argv, to be 100% consistent with how Python itself works
1924 1933 (as seen for example with python -i file.py). After a bug report
1925 1934 by Jeffrey Collins.
1926 1935
1927 1936 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix
1928 1937 nasty bug which was preventing custom namespaces with -pylab,
1929 1938 reported by M. Foord. Minor cleanup, remove old matplotlib.matlab
1930 1939 compatibility (long gone from mpl).
1931 1940
1932 1941 * IPython/ipapi.py (make_session): name change: create->make. We
1933 1942 use make in other places (ipmaker,...), it's shorter and easier to
1934 1943 type and say, etc. I'm trying to clean things before 0.7.2 so
1935 1944 that I can keep things stable wrt to ipapi in the chainsaw branch.
1936 1945
1937 1946 * ipython.el: fix the py-pdbtrack-input-prompt variable so that
1938 1947 python-mode recognizes our debugger mode. Add support for
1939 1948 autoindent inside (X)emacs. After a patch sent in by Jin Liu
1940 1949 <m.liu.jin-AT-gmail.com> originally written by
1941 1950 doxgen-AT-newsmth.net (with minor modifications for xemacs
1942 1951 compatibility)
1943 1952
1944 1953 * IPython/Debugger.py (Pdb.format_stack_entry): fix formatting of
1945 1954 tracebacks when walking the stack so that the stack tracking system
1946 1955 in emacs' python-mode can identify the frames correctly.
1947 1956
1948 1957 * IPython/ipmaker.py (make_IPython): make the internal (and
1949 1958 default config) autoedit_syntax value false by default. Too many
1950 1959 users have complained to me (both on and off-list) about problems
1951 1960 with this option being on by default, so I'm making it default to
1952 1961 off. It can still be enabled by anyone via the usual mechanisms.
1953 1962
1954 1963 * IPython/completer.py (Completer.attr_matches): add support for
1955 1964 PyCrust-style _getAttributeNames magic method. Patch contributed
1956 1965 by <mscott-AT-goldenspud.com>. Closes #50.
1957 1966
1958 1967 * IPython/iplib.py (InteractiveShell.__init__): remove the
1959 1968 deletion of exit/quit from __builtin__, which can break
1960 1969 third-party tools like the Zope debugging console. The
1961 1970 %exit/%quit magics remain. In general, it's probably a good idea
1962 1971 not to delete anything from __builtin__, since we never know what
1963 1972 that will break. In any case, python now (for 2.5) will support
1964 1973 'real' exit/quit, so this issue is moot. Closes #55.
1965 1974
1966 1975 * IPython/genutils.py (with_obj): rename the 'with' function to
1967 1976 'withobj' to avoid incompatibilities with Python 2.5, where 'with'
1968 1977 becomes a language keyword. Closes #53.
1969 1978
1970 1979 * IPython/FakeModule.py (FakeModule.__init__): add a proper
1971 1980 __file__ attribute to this so it fools more things into thinking
1972 1981 it is a real module. Closes #59.
1973 1982
1974 1983 * IPython/Magic.py (magic_edit): add -n option to open the editor
1975 1984 at a specific line number. After a patch by Stefan van der Walt.
1976 1985
1977 1986 2006-05-23 Fernando Perez <Fernando.Perez@colorado.edu>
1978 1987
1979 1988 * IPython/iplib.py (edit_syntax_error): fix crash when for some
1980 1989 reason the file could not be opened. After automatic crash
1981 1990 reports sent by James Graham <jgraham-AT-ast.cam.ac.uk> and
1982 1991 Charles Dolan <charlespatrickdolan-AT-yahoo.com>.
1983 1992 (_should_recompile): Don't fire editor if using %bg, since there
1984 1993 is no file in the first place. From the same report as above.
1985 1994 (raw_input): protect against faulty third-party prefilters. After
1986 1995 an automatic crash report sent by Dirk Laurie <dirk-AT-sun.ac.za>
1987 1996 while running under SAGE.
1988 1997
1989 1998 2006-05-23 Ville Vainio <vivainio@gmail.com>
1990 1999
1991 2000 * ipapi.py: Stripped down ip.to_user_ns() to work only as
1992 2001 ip.to_user_ns("x1 y1"), which exposes vars x1 and y1. ipapi.get()
1993 2002 now returns None (again), unless dummy is specifically allowed by
1994 2003 ipapi.get(allow_dummy=True).
1995 2004
1996 2005 2006-05-18 Fernando Perez <Fernando.Perez@colorado.edu>
1997 2006
1998 2007 * IPython: remove all 2.2-compatibility objects and hacks from
1999 2008 everywhere, since we only support 2.3 at this point. Docs
2000 2009 updated.
2001 2010
2002 2011 * IPython/ipapi.py (IPApi.__init__): Cleanup of all getters.
2003 2012 Anything requiring extra validation can be turned into a Python
2004 2013 property in the future. I used a property for the db one b/c
2005 2014 there was a nasty circularity problem with the initialization
2006 2015 order, which right now I don't have time to clean up.
2007 2016
2008 2017 * IPython/Shell.py (MTInteractiveShell.runcode): Fix, I think,
2009 2018 another locking bug reported by Jorgen. I'm not 100% sure though,
2010 2019 so more testing is needed...
2011 2020
2012 2021 2006-05-17 Fernando Perez <Fernando.Perez@colorado.edu>
2013 2022
2014 2023 * IPython/ipapi.py (IPApi.to_user_ns): New function to inject
2015 2024 local variables from any routine in user code (typically executed
2016 2025 with %run) directly into the interactive namespace. Very useful
2017 2026 when doing complex debugging.
2018 2027 (IPythonNotRunning): Changed the default None object to a dummy
2019 2028 whose attributes can be queried as well as called without
2020 2029 exploding, to ease writing code which works transparently both in
2021 2030 and out of ipython and uses some of this API.
2022 2031
2023 2032 2006-05-16 Fernando Perez <Fernando.Perez@colorado.edu>
2024 2033
2025 2034 * IPython/hooks.py (result_display): Fix the fact that our display
2026 2035 hook was using str() instead of repr(), as the default python
2027 2036 console does. This had gone unnoticed b/c it only happened if
2028 2037 %Pprint was off, but the inconsistency was there.
2029 2038
2030 2039 2006-05-15 Ville Vainio <vivainio@gmail.com>
2031 2040
2032 2041 * Oinspect.py: Only show docstring for nonexisting/binary files
2033 2042 when doing object??, closing ticket #62
2034 2043
2035 2044 2006-05-13 Fernando Perez <Fernando.Perez@colorado.edu>
2036 2045
2037 2046 * IPython/Shell.py (MTInteractiveShell.runsource): Fix threading
2038 2047 bug, closes http://www.scipy.net/roundup/ipython/issue55. A lock
2039 2048 was being released in a routine which hadn't checked if it had
2040 2049 been the one to acquire it.
2041 2050
2042 2051 2006-05-07 Fernando Perez <Fernando.Perez@colorado.edu>
2043 2052
2044 2053 * IPython/Release.py (version): put out 0.7.2.rc1 for testing.
2045 2054
2046 2055 2006-04-11 Ville Vainio <vivainio@gmail.com>
2047 2056
2048 2057 * iplib.py, ipmaker.py: .ipy extension now means "ipython batch file"
2049 2058 in command line. E.g. "ipython test.ipy" runs test.ipy with ipython
2050 2059 prefilters, allowing stuff like magics and aliases in the file.
2051 2060
2052 2061 * Prompts.py, Extensions/clearcmd.py, ipy_system_conf.py: %clear magic
2053 2062 added. Supported now are "%clear in" and "%clear out" (clear input and
2054 2063 output history, respectively). Also fixed CachedOutput.flush to
2055 2064 properly flush the output cache.
2056 2065
2057 2066 * Extensions/pspersistence.py: Fix %store to avoid "%store obj.attr"
2058 2067 half-success (and fail explicitly).
2059 2068
2060 2069 2006-03-28 Ville Vainio <vivainio@gmail.com>
2061 2070
2062 2071 * iplib.py: Fix quoting of aliases so that only argless ones
2063 2072 are quoted
2064 2073
2065 2074 2006-03-28 Ville Vainio <vivainio@gmail.com>
2066 2075
2067 2076 * iplib.py: Quote aliases with spaces in the name.
2068 2077 "c:\program files\blah\bin" is now legal alias target.
2069 2078
2070 2079 * ext_rehashdir.py: Space no longer allowed as arg
2071 2080 separator, since space is legal in path names.
2072 2081
2073 2082 2006-03-16 Ville Vainio <vivainio@gmail.com>
2074 2083
2075 2084 * upgrade_dir.py: Take path.py from Extensions, correcting
2076 2085 %upgrade magic
2077 2086
2078 2087 * ipmaker.py: Suggest using %upgrade if ipy_user_conf.py isn't found.
2079 2088
2080 2089 * hooks.py: Only enclose editor binary in quotes if legal and
2081 2090 necessary (space in the name, and is an existing file). Fixes a bug
2082 2091 reported by Zachary Pincus.
2083 2092
2084 2093 2006-03-13 Fernando Perez <Fernando.Perez@colorado.edu>
2085 2094
2086 2095 * Manual: thanks to a tip on proper color handling for Emacs, by
2087 2096 Eric J Haywiser <ejh1-AT-MIT.EDU>.
2088 2097
2089 2098 * ipython.el: close http://www.scipy.net/roundup/ipython/issue57
2090 2099 by applying the provided patch. Thanks to Liu Jin
2091 2100 <m.liu.jin-AT-gmail.com> for the contribution. No problems under
2092 2101 XEmacs/Linux, I'm trusting the submitter that it actually helps
2093 2102 under win32/GNU Emacs. Will revisit if any problems are reported.
2094 2103
2095 2104 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
2096 2105
2097 2106 * IPython/Gnuplot2.py (_FileClass): update for current Gnuplot.py
2098 2107 from SVN, thanks to a patch by Ryan Woodard <rywo@bas.ac.uk>.
2099 2108
2100 2109 2006-03-12 Ville Vainio <vivainio@gmail.com>
2101 2110
2102 2111 * Magic.py (magic_timeit): Added %timeit magic, contributed by
2103 2112 Torsten Marek.
2104 2113
2105 2114 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
2106 2115
2107 2116 * IPython/Magic.py (magic_macro): fix so that the n1-n2 syntax for
2108 2117 line ranges works again.
2109 2118
2110 2119 2006-03-11 Fernando Perez <Fernando.Perez@colorado.edu>
2111 2120
2112 2121 * IPython/iplib.py (showtraceback): add back sys.last_traceback
2113 2122 and friends, after a discussion with Zach Pincus on ipython-user.
2114 2123 I'm not 100% sure, but after thinking about it quite a bit, it may
2115 2124 be OK. Testing with the multithreaded shells didn't reveal any
2116 2125 problems, but let's keep an eye out.
2117 2126
2118 2127 In the process, I fixed a few things which were calling
2119 2128 self.InteractiveTB() directly (like safe_execfile), which is a
2120 2129 mistake: ALL exception reporting should be done by calling
2121 2130 self.showtraceback(), which handles state and tab-completion and
2122 2131 more.
2123 2132
2124 2133 2006-03-01 Ville Vainio <vivainio@gmail.com>
2125 2134
2126 2135 * Extensions/ipipe.py: Added Walter Doerwald's "ipipe" module.
2127 2136 To use, do "from ipipe import *".
2128 2137
2129 2138 2006-02-24 Ville Vainio <vivainio@gmail.com>
2130 2139
2131 2140 * Magic.py, upgrade_dir.py: %upgrade magic added. Does things more
2132 2141 "cleanly" and safely than the older upgrade mechanism.
2133 2142
2134 2143 2006-02-21 Ville Vainio <vivainio@gmail.com>
2135 2144
2136 2145 * Magic.py: %save works again.
2137 2146
2138 2147 2006-02-15 Ville Vainio <vivainio@gmail.com>
2139 2148
2140 2149 * Magic.py: %Pprint works again
2141 2150
2142 2151 * Extensions/ipy_sane_defaults.py: Provide everything provided
2143 2152 in default ipythonrc, to make it possible to have a completely empty
2144 2153 ipythonrc (and thus completely rc-file free configuration)
2145 2154
2146 2155 2006-02-11 Fernando Perez <Fernando.Perez@colorado.edu>
2147 2156
2148 2157 * IPython/hooks.py (editor): quote the call to the editor command,
2149 2158 to allow commands with spaces in them. Problem noted by watching
2150 2159 Ian Oswald's video about textpad under win32 at
2151 2160 http://showmedo.com/videoListPage?listKey=PythonIPythonSeries
2152 2161
2153 2162 * IPython/UserConfig/ipythonrc: Replace @ signs with % when
2154 2163 describing magics (we haven't used @ for a loong time).
2155 2164
2156 2165 * IPython/ultraTB.py (VerboseTB.text.text_repr): Added patch
2157 2166 contributed by marienz to close
2158 2167 http://www.scipy.net/roundup/ipython/issue53.
2159 2168
2160 2169 2006-02-10 Ville Vainio <vivainio@gmail.com>
2161 2170
2162 2171 * genutils.py: getoutput now works in win32 too
2163 2172
2164 2173 * completer.py: alias and magic completion only invoked
2165 2174 at the first "item" in the line, to avoid "cd %store"
2166 2175 nonsense.
2167 2176
2168 2177 2006-02-09 Ville Vainio <vivainio@gmail.com>
2169 2178
2170 2179 * test/*: Added a unit testing framework (finally).
2171 2180 '%run runtests.py' to run test_*.
2172 2181
2173 2182 * ipapi.py: Exposed runlines and set_custom_exc
2174 2183
2175 2184 2006-02-07 Ville Vainio <vivainio@gmail.com>
2176 2185
2177 2186 * iplib.py: don't split "f 1 2" to "f(1,2)" in autocall,
2178 2187 instead use "f(1 2)" as before.
2179 2188
2180 2189 2006-02-05 Fernando Perez <Fernando.Perez@colorado.edu>
2181 2190
2182 2191 * IPython/demo.py (IPythonDemo): Add new classes to the demo
2183 2192 facilities, for demos processed by the IPython input filter
2184 2193 (IPythonDemo), and for running a script one-line-at-a-time as a
2185 2194 demo, both for pure Python (LineDemo) and for IPython-processed
2186 2195 input (IPythonLineDemo). After a request by Dave Kohel, from the
2187 2196 SAGE team.
2188 2197 (Demo.edit): added an edit() method to the demo objects, to edit
2189 2198 the in-memory copy of the last executed block.
2190 2199
2191 2200 * IPython/Magic.py (magic_edit): add '-r' option for 'raw'
2192 2201 processing to %edit, %macro and %save. These commands can now be
2193 2202 invoked on the unprocessed input as it was typed by the user
2194 2203 (without any prefilters applied). After requests by the SAGE team
2195 2204 at SAGE days 2006: http://modular.ucsd.edu/sage/days1/schedule.html.
2196 2205
2197 2206 2006-02-01 Ville Vainio <vivainio@gmail.com>
2198 2207
2199 2208 * setup.py, eggsetup.py: easy_install ipython==dev works
2200 2209 correctly now (on Linux)
2201 2210
2202 2211 * ipy_user_conf,ipmaker: user config changes, removed spurious
2203 2212 warnings
2204 2213
2205 2214 * iplib: if rc.banner is string, use it as is.
2206 2215
2207 2216 * Magic: %pycat accepts a string argument and pages it's contents.
2208 2217
2209 2218
2210 2219 2006-01-30 Ville Vainio <vivainio@gmail.com>
2211 2220
2212 2221 * pickleshare,pspersistence,ipapi,Magic: persistence overhaul.
2213 2222 Now %store and bookmarks work through PickleShare, meaning that
2214 2223 concurrent access is possible and all ipython sessions see the
2215 2224 same database situation all the time, instead of snapshot of
2216 2225 the situation when the session was started. Hence, %bookmark
2217 2226 results are immediately accessible from othes sessions. The database
2218 2227 is also available for use by user extensions. See:
2219 2228 http://www.python.org/pypi/pickleshare
2220 2229
2221 2230 * hooks.py: Two new hooks, 'shutdown_hook' and 'late_startup_hook'.
2222 2231
2223 2232 * aliases can now be %store'd
2224 2233
2225 2234 * path.py moved to Extensions so that pickleshare does not need
2226 2235 IPython-specific import. Extensions added to pythonpath right
2227 2236 at __init__.
2228 2237
2229 2238 * iplib.py: ipalias deprecated/redundant; aliases are converted and
2230 2239 called with _ip.system and the pre-transformed command string.
2231 2240
2232 2241 2006-01-29 Fernando Perez <Fernando.Perez@colorado.edu>
2233 2242
2234 2243 * IPython/iplib.py (interact): Fix that we were not catching
2235 2244 KeyboardInterrupt exceptions properly. I'm not quite sure why the
2236 2245 logic here had to change, but it's fixed now.
2237 2246
2238 2247 2006-01-29 Ville Vainio <vivainio@gmail.com>
2239 2248
2240 2249 * iplib.py: Try to import pyreadline on Windows.
2241 2250
2242 2251 2006-01-27 Ville Vainio <vivainio@gmail.com>
2243 2252
2244 2253 * iplib.py: Expose ipapi as _ip in builtin namespace.
2245 2254 Makes ipmagic (-> _ip.magic), ipsystem (-> _ip.system)
2246 2255 and ip_set_hook (-> _ip.set_hook) redundant. % and !
2247 2256 syntax now produce _ip.* variant of the commands.
2248 2257
2249 2258 * "_ip.options().autoedit_syntax = 2" automatically throws
2250 2259 user to editor for syntax error correction without prompting.
2251 2260
2252 2261 2006-01-27 Ville Vainio <vivainio@gmail.com>
2253 2262
2254 2263 * ipmaker.py: Give "realistic" sys.argv for scripts (without
2255 2264 'ipython' at argv[0]) executed through command line.
2256 2265 NOTE: this DEPRECATES calling ipython with multiple scripts
2257 2266 ("ipython a.py b.py c.py")
2258 2267
2259 2268 * iplib.py, hooks.py: Added configurable input prefilter,
2260 2269 named 'input_prefilter'. See ext_rescapture.py for example
2261 2270 usage.
2262 2271
2263 2272 * ext_rescapture.py, Magic.py: Better system command output capture
2264 2273 through 'var = !ls' (deprecates user-visible %sc). Same notation
2265 2274 applies for magics, 'var = %alias' assigns alias list to var.
2266 2275
2267 2276 * ipapi.py: added meta() for accessing extension-usable data store.
2268 2277
2269 2278 * iplib.py: added InteractiveShell.getapi(). New magics should be
2270 2279 written doing self.getapi() instead of using the shell directly.
2271 2280
2272 2281 * Magic.py: %store now allows doing %store foo > ~/myfoo.txt and
2273 2282 %store foo >> ~/myfoo.txt to store variables to files (in clean
2274 2283 textual form, not a restorable pickle).
2275 2284
2276 2285 * ipmaker.py: now import ipy_profile_PROFILENAME automatically
2277 2286
2278 2287 * usage.py, Magic.py: added %quickref
2279 2288
2280 2289 * iplib.py: ESC_PAREN fixes: /f 1 2 -> f(1,2), not f(1 2).
2281 2290
2282 2291 * GetoptErrors when invoking magics etc. with wrong args
2283 2292 are now more helpful:
2284 2293 GetoptError: option -l not recognized (allowed: "qb" )
2285 2294
2286 2295 2006-01-25 Fernando Perez <Fernando.Perez@colorado.edu>
2287 2296
2288 2297 * IPython/demo.py (Demo.show): Flush stdout after each block, so
2289 2298 computationally intensive blocks don't appear to stall the demo.
2290 2299
2291 2300 2006-01-24 Ville Vainio <vivainio@gmail.com>
2292 2301
2293 2302 * iplib.py, hooks.py: 'result_display' hook can return a non-None
2294 2303 value to manipulate resulting history entry.
2295 2304
2296 2305 * ipapi.py: Moved TryNext here from hooks.py. Moved functions
2297 2306 to instance methods of IPApi class, to make extending an embedded
2298 2307 IPython feasible. See ext_rehashdir.py for example usage.
2299 2308
2300 2309 * Merged 1071-1076 from branches/0.7.1
2301 2310
2302 2311
2303 2312 2006-01-23 Fernando Perez <Fernando.Perez@colorado.edu>
2304 2313
2305 2314 * tools/release (daystamp): Fix build tools to use the new
2306 2315 eggsetup.py script to build lightweight eggs.
2307 2316
2308 2317 * Applied changesets 1062 and 1064 before 0.7.1 release.
2309 2318
2310 2319 * IPython/Magic.py (magic_history): Add '-r' option to %hist, to
2311 2320 see the raw input history (without conversions like %ls ->
2312 2321 ipmagic("ls")). After a request from W. Stein, SAGE
2313 2322 (http://modular.ucsd.edu/sage) developer. This information is
2314 2323 stored in the input_hist_raw attribute of the IPython instance, so
2315 2324 developers can access it if needed (it's an InputList instance).
2316 2325
2317 2326 * Versionstring = 0.7.2.svn
2318 2327
2319 2328 * eggsetup.py: A separate script for constructing eggs, creates
2320 2329 proper launch scripts even on Windows (an .exe file in
2321 2330 \python24\scripts).
2322 2331
2323 2332 * ipapi.py: launch_new_instance, launch entry point needed for the
2324 2333 egg.
2325 2334
2326 2335 2006-01-23 Ville Vainio <vivainio@gmail.com>
2327 2336
2328 2337 * Added %cpaste magic for pasting python code
2329 2338
2330 2339 2006-01-22 Ville Vainio <vivainio@gmail.com>
2331 2340
2332 2341 * Merge from branches/0.7.1 into trunk, revs 1052-1057
2333 2342
2334 2343 * Versionstring = 0.7.2.svn
2335 2344
2336 2345 * eggsetup.py: A separate script for constructing eggs, creates
2337 2346 proper launch scripts even on Windows (an .exe file in
2338 2347 \python24\scripts).
2339 2348
2340 2349 * ipapi.py: launch_new_instance, launch entry point needed for the
2341 2350 egg.
2342 2351
2343 2352 2006-01-22 Fernando Perez <Fernando.Perez@colorado.edu>
2344 2353
2345 2354 * IPython/OInspect.py (Inspector.pinfo): fix bug where foo?? or
2346 2355 %pfile foo would print the file for foo even if it was a binary.
2347 2356 Now, extensions '.so' and '.dll' are skipped.
2348 2357
2349 2358 * IPython/Shell.py (MTInteractiveShell.__init__): Fix threading
2350 2359 bug, where macros would fail in all threaded modes. I'm not 100%
2351 2360 sure, so I'm going to put out an rc instead of making a release
2352 2361 today, and wait for feedback for at least a few days.
2353 2362
2354 2363 * IPython/iplib.py (handle_normal): fix (finally? somehow I doubt
2355 2364 it...) the handling of pasting external code with autoindent on.
2356 2365 To get out of a multiline input, the rule will appear for most
2357 2366 users unchanged: two blank lines or change the indent level
2358 2367 proposed by IPython. But there is a twist now: you can
2359 2368 add/subtract only *one or two spaces*. If you add/subtract three
2360 2369 or more (unless you completely delete the line), IPython will
2361 2370 accept that line, and you'll need to enter a second one of pure
2362 2371 whitespace. I know it sounds complicated, but I can't find a
2363 2372 different solution that covers all the cases, with the right
2364 2373 heuristics. Hopefully in actual use, nobody will really notice
2365 2374 all these strange rules and things will 'just work'.
2366 2375
2367 2376 2006-01-21 Fernando Perez <Fernando.Perez@colorado.edu>
2368 2377
2369 2378 * IPython/iplib.py (interact): catch exceptions which can be
2370 2379 triggered asynchronously by signal handlers. Thanks to an
2371 2380 automatic crash report, submitted by Colin Kingsley
2372 2381 <tercel-AT-gentoo.org>.
2373 2382
2374 2383 2006-01-20 Ville Vainio <vivainio@gmail.com>
2375 2384
2376 2385 * Ipython/Extensions/ext_rehashdir.py: Created a usable example
2377 2386 (%rehashdir, very useful, try it out) of how to extend ipython
2378 2387 with new magics. Also added Extensions dir to pythonpath to make
2379 2388 importing extensions easy.
2380 2389
2381 2390 * %store now complains when trying to store interactively declared
2382 2391 classes / instances of those classes.
2383 2392
2384 2393 * Extensions/ipy_system_conf.py, UserConfig/ipy_user_conf.py,
2385 2394 ipmaker.py: Config rehaul. Now ipy_..._conf.py are always imported
2386 2395 if they exist, and ipy_user_conf.py with some defaults is created for
2387 2396 the user.
2388 2397
2389 2398 * Startup rehashing done by the config file, not InterpreterExec.
2390 2399 This means system commands are available even without selecting the
2391 2400 pysh profile. It's the sensible default after all.
2392 2401
2393 2402 2006-01-20 Fernando Perez <Fernando.Perez@colorado.edu>
2394 2403
2395 2404 * IPython/iplib.py (raw_input): I _think_ I got the pasting of
2396 2405 multiline code with autoindent on working. But I am really not
2397 2406 sure, so this needs more testing. Will commit a debug-enabled
2398 2407 version for now, while I test it some more, so that Ville and
2399 2408 others may also catch any problems. Also made
2400 2409 self.indent_current_str() a method, to ensure that there's no
2401 2410 chance of the indent space count and the corresponding string
2402 2411 falling out of sync. All code needing the string should just call
2403 2412 the method.
2404 2413
2405 2414 2006-01-18 Fernando Perez <Fernando.Perez@colorado.edu>
2406 2415
2407 2416 * IPython/Magic.py (magic_edit): fix check for when users don't
2408 2417 save their output files, the try/except was in the wrong section.
2409 2418
2410 2419 2006-01-17 Fernando Perez <Fernando.Perez@colorado.edu>
2411 2420
2412 2421 * IPython/Magic.py (magic_run): fix __file__ global missing from
2413 2422 script's namespace when executed via %run. After a report by
2414 2423 Vivian.
2415 2424
2416 2425 * IPython/Debugger.py (Pdb.__init__): Fix breakage with '%run -d'
2417 2426 when using python 2.4. The parent constructor changed in 2.4, and
2418 2427 we need to track it directly (we can't call it, as it messes up
2419 2428 readline and tab-completion inside our pdb would stop working).
2420 2429 After a bug report by R. Bernstein <rocky-AT-panix.com>.
2421 2430
2422 2431 2006-01-16 Ville Vainio <vivainio@gmail.com>
2423 2432
2424 2433 * Ipython/magic.py: Reverted back to old %edit functionality
2425 2434 that returns file contents on exit.
2426 2435
2427 2436 * IPython/path.py: Added Jason Orendorff's "path" module to
2428 2437 IPython tree, http://www.jorendorff.com/articles/python/path/.
2429 2438 You can get path objects conveniently through %sc, and !!, e.g.:
2430 2439 sc files=ls
2431 2440 for p in files.paths: # or files.p
2432 2441 print p,p.mtime
2433 2442
2434 2443 * Ipython/iplib.py:"," and ";" autoquoting-upon-autocall
2435 2444 now work again without considering the exclusion regexp -
2436 2445 hence, things like ',foo my/path' turn to 'foo("my/path")'
2437 2446 instead of syntax error.
2438 2447
2439 2448
2440 2449 2006-01-14 Ville Vainio <vivainio@gmail.com>
2441 2450
2442 2451 * IPython/ipapi.py (ashook, asmagic, options): Added convenience
2443 2452 ipapi decorators for python 2.4 users, options() provides access to rc
2444 2453 data.
2445 2454
2446 2455 * IPython/Magic.py (magic_cd): %cd now accepts backslashes
2447 2456 as path separators (even on Linux ;-). Space character after
2448 2457 backslash (as yielded by tab completer) is still space;
2449 2458 "%cd long\ name" works as expected.
2450 2459
2451 2460 * IPython/ipapi.py,hooks.py,iplib.py: Hooks now implemented
2452 2461 as "chain of command", with priority. API stays the same,
2453 2462 TryNext exception raised by a hook function signals that
2454 2463 current hook failed and next hook should try handling it, as
2455 2464 suggested by Walter DΓΆrwald <walter@livinglogic.de>. Walter also
2456 2465 requested configurable display hook, which is now implemented.
2457 2466
2458 2467 2006-01-13 Ville Vainio <vivainio@gmail.com>
2459 2468
2460 2469 * IPython/platutils*.py: platform specific utility functions,
2461 2470 so far only set_term_title is implemented (change terminal
2462 2471 label in windowing systems). %cd now changes the title to
2463 2472 current dir.
2464 2473
2465 2474 * IPython/Release.py: Added myself to "authors" list,
2466 2475 had to create new files.
2467 2476
2468 2477 * IPython/iplib.py (handle_shell_escape): fixed logical flaw in
2469 2478 shell escape; not a known bug but had potential to be one in the
2470 2479 future.
2471 2480
2472 2481 * IPython/ipapi.py (added),OInspect.py,iplib.py: "Public"
2473 2482 extension API for IPython! See the module for usage example. Fix
2474 2483 OInspect for docstring-less magic functions.
2475 2484
2476 2485
2477 2486 2006-01-13 Fernando Perez <Fernando.Perez@colorado.edu>
2478 2487
2479 2488 * IPython/iplib.py (raw_input): temporarily deactivate all
2480 2489 attempts at allowing pasting of code with autoindent on. It
2481 2490 introduced bugs (reported by Prabhu) and I can't seem to find a
2482 2491 robust combination which works in all cases. Will have to revisit
2483 2492 later.
2484 2493
2485 2494 * IPython/genutils.py: remove isspace() function. We've dropped
2486 2495 2.2 compatibility, so it's OK to use the string method.
2487 2496
2488 2497 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
2489 2498
2490 2499 * IPython/iplib.py (InteractiveShell.__init__): fix regexp
2491 2500 matching what NOT to autocall on, to include all python binary
2492 2501 operators (including things like 'and', 'or', 'is' and 'in').
2493 2502 Prompted by a bug report on 'foo & bar', but I realized we had
2494 2503 many more potential bug cases with other operators. The regexp is
2495 2504 self.re_exclude_auto, it's fairly commented.
2496 2505
2497 2506 2006-01-12 Ville Vainio <vivainio@gmail.com>
2498 2507
2499 2508 * IPython/iplib.py (make_quoted_expr,handle_shell_escape):
2500 2509 Prettified and hardened string/backslash quoting with ipsystem(),
2501 2510 ipalias() and ipmagic(). Now even \ characters are passed to
2502 2511 %magics, !shell escapes and aliases exactly as they are in the
2503 2512 ipython command line. Should improve backslash experience,
2504 2513 particularly in Windows (path delimiter for some commands that
2505 2514 won't understand '/'), but Unix benefits as well (regexps). %cd
2506 2515 magic still doesn't support backslash path delimiters, though. Also
2507 2516 deleted all pretense of supporting multiline command strings in
2508 2517 !system or %magic commands. Thanks to Jerry McRae for suggestions.
2509 2518
2510 2519 * doc/build_doc_instructions.txt added. Documentation on how to
2511 2520 use doc/update_manual.py, added yesterday. Both files contributed
2512 2521 by JΓΆrgen Stenarson <jorgen.stenarson-AT-bostream.nu>. This slates
2513 2522 doc/*.sh for deprecation at a later date.
2514 2523
2515 2524 * /ipython.py Added ipython.py to root directory for
2516 2525 zero-installation (tar xzvf ipython.tgz; cd ipython; python
2517 2526 ipython.py) and development convenience (no need to keep doing
2518 2527 "setup.py install" between changes).
2519 2528
2520 2529 * Made ! and !! shell escapes work (again) in multiline expressions:
2521 2530 if 1:
2522 2531 !ls
2523 2532 !!ls
2524 2533
2525 2534 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
2526 2535
2527 2536 * IPython/ipstruct.py (Struct): Rename IPython.Struct to
2528 2537 IPython.ipstruct, to avoid local shadowing of the stdlib 'struct'
2529 2538 module in case-insensitive installation. Was causing crashes
2530 2539 under win32. Closes http://www.scipy.net/roundup/ipython/issue49.
2531 2540
2532 2541 * IPython/Magic.py (magic_pycat): Fix pycat, patch by Marien Zwart
2533 2542 <marienz-AT-gentoo.org>, closes
2534 2543 http://www.scipy.net/roundup/ipython/issue51.
2535 2544
2536 2545 2006-01-11 Fernando Perez <Fernando.Perez@colorado.edu>
2537 2546
2538 2547 * IPython/Shell.py (IPShellGTK.on_timer): Finally fix the
2539 2548 problem of excessive CPU usage under *nix and keyboard lag under
2540 2549 win32.
2541 2550
2542 2551 2006-01-10 *** Released version 0.7.0
2543 2552
2544 2553 2006-01-10 Fernando Perez <Fernando.Perez@colorado.edu>
2545 2554
2546 2555 * IPython/Release.py (revision): tag version number to 0.7.0,
2547 2556 ready for release.
2548 2557
2549 2558 * IPython/Magic.py (magic_edit): Add print statement to %edit so
2550 2559 it informs the user of the name of the temp. file used. This can
2551 2560 help if you decide later to reuse that same file, so you know
2552 2561 where to copy the info from.
2553 2562
2554 2563 2006-01-09 Fernando Perez <Fernando.Perez@colorado.edu>
2555 2564
2556 2565 * setup_bdist_egg.py: little script to build an egg. Added
2557 2566 support in the release tools as well.
2558 2567
2559 2568 2006-01-08 Fernando Perez <Fernando.Perez@colorado.edu>
2560 2569
2561 2570 * IPython/Shell.py (IPShellWX.__init__): add support for WXPython
2562 2571 version selection (new -wxversion command line and ipythonrc
2563 2572 parameter). Patch contributed by Arnd Baecker
2564 2573 <arnd.baecker-AT-web.de>.
2565 2574
2566 2575 * IPython/iplib.py (embed_mainloop): fix tab-completion in
2567 2576 embedded instances, for variables defined at the interactive
2568 2577 prompt of the embedded ipython. Reported by Arnd.
2569 2578
2570 2579 * IPython/Magic.py (magic_autocall): Fix %autocall magic. Now
2571 2580 it can be used as a (stateful) toggle, or with a direct parameter.
2572 2581
2573 2582 * IPython/ultraTB.py (_fixed_getinnerframes): remove debug assert which
2574 2583 could be triggered in certain cases and cause the traceback
2575 2584 printer not to work.
2576 2585
2577 2586 2006-01-07 Fernando Perez <Fernando.Perez@colorado.edu>
2578 2587
2579 2588 * IPython/iplib.py (_should_recompile): Small fix, closes
2580 2589 http://www.scipy.net/roundup/ipython/issue48. Patch by Scott.
2581 2590
2582 2591 2006-01-04 Fernando Perez <Fernando.Perez@colorado.edu>
2583 2592
2584 2593 * IPython/Shell.py (IPShellGTK.mainloop): fix bug in the GTK
2585 2594 backend for matplotlib (100% cpu utiliziation). Thanks to Charlie
2586 2595 Moad for help with tracking it down.
2587 2596
2588 2597 * IPython/iplib.py (handle_auto): fix autocall handling for
2589 2598 objects which support BOTH __getitem__ and __call__ (so that f [x]
2590 2599 is left alone, instead of becoming f([x]) automatically).
2591 2600
2592 2601 * IPython/Magic.py (magic_cd): fix crash when cd -b was used.
2593 2602 Ville's patch.
2594 2603
2595 2604 2006-01-03 Fernando Perez <Fernando.Perez@colorado.edu>
2596 2605
2597 2606 * IPython/iplib.py (handle_auto): changed autocall semantics to
2598 2607 include 'smart' mode, where the autocall transformation is NOT
2599 2608 applied if there are no arguments on the line. This allows you to
2600 2609 just type 'foo' if foo is a callable to see its internal form,
2601 2610 instead of having it called with no arguments (typically a
2602 2611 mistake). The old 'full' autocall still exists: for that, you
2603 2612 need to set the 'autocall' parameter to 2 in your ipythonrc file.
2604 2613
2605 2614 * IPython/completer.py (Completer.attr_matches): add
2606 2615 tab-completion support for Enthoughts' traits. After a report by
2607 2616 Arnd and a patch by Prabhu.
2608 2617
2609 2618 2006-01-02 Fernando Perez <Fernando.Perez@colorado.edu>
2610 2619
2611 2620 * IPython/ultraTB.py (_fixed_getinnerframes): added Alex
2612 2621 Schmolck's patch to fix inspect.getinnerframes().
2613 2622
2614 2623 * IPython/iplib.py (InteractiveShell.__init__): significant fixes
2615 2624 for embedded instances, regarding handling of namespaces and items
2616 2625 added to the __builtin__ one. Multiple embedded instances and
2617 2626 recursive embeddings should work better now (though I'm not sure
2618 2627 I've got all the corner cases fixed, that code is a bit of a brain
2619 2628 twister).
2620 2629
2621 2630 * IPython/Magic.py (magic_edit): added support to edit in-memory
2622 2631 macros (automatically creates the necessary temp files). %edit
2623 2632 also doesn't return the file contents anymore, it's just noise.
2624 2633
2625 2634 * IPython/completer.py (Completer.attr_matches): revert change to
2626 2635 complete only on attributes listed in __all__. I realized it
2627 2636 cripples the tab-completion system as a tool for exploring the
2628 2637 internals of unknown libraries (it renders any non-__all__
2629 2638 attribute off-limits). I got bit by this when trying to see
2630 2639 something inside the dis module.
2631 2640
2632 2641 2005-12-31 Fernando Perez <Fernando.Perez@colorado.edu>
2633 2642
2634 2643 * IPython/iplib.py (InteractiveShell.__init__): add .meta
2635 2644 namespace for users and extension writers to hold data in. This
2636 2645 follows the discussion in
2637 2646 http://projects.scipy.org/ipython/ipython/wiki/RefactoringIPython.
2638 2647
2639 2648 * IPython/completer.py (IPCompleter.complete): small patch to help
2640 2649 tab-completion under Emacs, after a suggestion by John Barnard
2641 2650 <barnarj-AT-ccf.org>.
2642 2651
2643 2652 * IPython/Magic.py (Magic.extract_input_slices): added support for
2644 2653 the slice notation in magics to use N-M to represent numbers N...M
2645 2654 (closed endpoints). This is used by %macro and %save.
2646 2655
2647 2656 * IPython/completer.py (Completer.attr_matches): for modules which
2648 2657 define __all__, complete only on those. After a patch by Jeffrey
2649 2658 Collins <jcollins_boulder-AT-earthlink.net>. Also, clean up and
2650 2659 speed up this routine.
2651 2660
2652 2661 * IPython/Logger.py (Logger.log): fix a history handling bug. I
2653 2662 don't know if this is the end of it, but the behavior now is
2654 2663 certainly much more correct. Note that coupled with macros,
2655 2664 slightly surprising (at first) behavior may occur: a macro will in
2656 2665 general expand to multiple lines of input, so upon exiting, the
2657 2666 in/out counters will both be bumped by the corresponding amount
2658 2667 (as if the macro's contents had been typed interactively). Typing
2659 2668 %hist will reveal the intermediate (silently processed) lines.
2660 2669
2661 2670 * IPython/Magic.py (magic_run): fix a subtle bug which could cause
2662 2671 pickle to fail (%run was overwriting __main__ and not restoring
2663 2672 it, but pickle relies on __main__ to operate).
2664 2673
2665 2674 * IPython/iplib.py (InteractiveShell): fix pdb calling: I'm now
2666 2675 using properties, but forgot to make the main InteractiveShell
2667 2676 class a new-style class. Properties fail silently, and
2668 2677 mysteriously, with old-style class (getters work, but
2669 2678 setters don't do anything).
2670 2679
2671 2680 2005-12-30 Fernando Perez <Fernando.Perez@colorado.edu>
2672 2681
2673 2682 * IPython/Magic.py (magic_history): fix history reporting bug (I
2674 2683 know some nasties are still there, I just can't seem to find a
2675 2684 reproducible test case to track them down; the input history is
2676 2685 falling out of sync...)
2677 2686
2678 2687 * IPython/iplib.py (handle_shell_escape): fix bug where both
2679 2688 aliases and system accesses where broken for indented code (such
2680 2689 as loops).
2681 2690
2682 2691 * IPython/genutils.py (shell): fix small but critical bug for
2683 2692 win32 system access.
2684 2693
2685 2694 2005-12-29 Fernando Perez <Fernando.Perez@colorado.edu>
2686 2695
2687 2696 * IPython/iplib.py (showtraceback): remove use of the
2688 2697 sys.last_{type/value/traceback} structures, which are non
2689 2698 thread-safe.
2690 2699 (_prefilter): change control flow to ensure that we NEVER
2691 2700 introspect objects when autocall is off. This will guarantee that
2692 2701 having an input line of the form 'x.y', where access to attribute
2693 2702 'y' has side effects, doesn't trigger the side effect TWICE. It
2694 2703 is important to note that, with autocall on, these side effects
2695 2704 can still happen.
2696 2705 (ipsystem): new builtin, to complete the ip{magic/alias/system}
2697 2706 trio. IPython offers these three kinds of special calls which are
2698 2707 not python code, and it's a good thing to have their call method
2699 2708 be accessible as pure python functions (not just special syntax at
2700 2709 the command line). It gives us a better internal implementation
2701 2710 structure, as well as exposing these for user scripting more
2702 2711 cleanly.
2703 2712
2704 2713 * IPython/macro.py (Macro.__init__): moved macros to a standalone
2705 2714 file. Now that they'll be more likely to be used with the
2706 2715 persistance system (%store), I want to make sure their module path
2707 2716 doesn't change in the future, so that we don't break things for
2708 2717 users' persisted data.
2709 2718
2710 2719 * IPython/iplib.py (autoindent_update): move indentation
2711 2720 management into the _text_ processing loop, not the keyboard
2712 2721 interactive one. This is necessary to correctly process non-typed
2713 2722 multiline input (such as macros).
2714 2723
2715 2724 * IPython/Magic.py (Magic.format_latex): patch by Stefan van der
2716 2725 Walt <stefan-AT-sun.ac.za> to fix latex formatting of docstrings,
2717 2726 which was producing problems in the resulting manual.
2718 2727 (magic_whos): improve reporting of instances (show their class,
2719 2728 instead of simply printing 'instance' which isn't terribly
2720 2729 informative).
2721 2730
2722 2731 * IPython/genutils.py (shell): commit Jorgen Stenarson's patch
2723 2732 (minor mods) to support network shares under win32.
2724 2733
2725 2734 * IPython/winconsole.py (get_console_size): add new winconsole
2726 2735 module and fixes to page_dumb() to improve its behavior under
2727 2736 win32. Contributed by Alexander Belchenko <bialix-AT-ukr.net>.
2728 2737
2729 2738 * IPython/Magic.py (Macro): simplified Macro class to just
2730 2739 subclass list. We've had only 2.2 compatibility for a very long
2731 2740 time, yet I was still avoiding subclassing the builtin types. No
2732 2741 more (I'm also starting to use properties, though I won't shift to
2733 2742 2.3-specific features quite yet).
2734 2743 (magic_store): added Ville's patch for lightweight variable
2735 2744 persistence, after a request on the user list by Matt Wilkie
2736 2745 <maphew-AT-gmail.com>. The new %store magic's docstring has full
2737 2746 details.
2738 2747
2739 2748 * IPython/iplib.py (InteractiveShell.post_config_initialization):
2740 2749 changed the default logfile name from 'ipython.log' to
2741 2750 'ipython_log.py'. These logs are real python files, and now that
2742 2751 we have much better multiline support, people are more likely to
2743 2752 want to use them as such. Might as well name them correctly.
2744 2753
2745 2754 * IPython/Magic.py: substantial cleanup. While we can't stop
2746 2755 using magics as mixins, due to the existing customizations 'out
2747 2756 there' which rely on the mixin naming conventions, at least I
2748 2757 cleaned out all cross-class name usage. So once we are OK with
2749 2758 breaking compatibility, the two systems can be separated.
2750 2759
2751 2760 * IPython/Logger.py: major cleanup. This one is NOT a mixin
2752 2761 anymore, and the class is a fair bit less hideous as well. New
2753 2762 features were also introduced: timestamping of input, and logging
2754 2763 of output results. These are user-visible with the -t and -o
2755 2764 options to %logstart. Closes
2756 2765 http://www.scipy.net/roundup/ipython/issue11 and a request by
2757 2766 William Stein (SAGE developer - http://modular.ucsd.edu/sage).
2758 2767
2759 2768 2005-12-28 Fernando Perez <Fernando.Perez@colorado.edu>
2760 2769
2761 2770 * IPython/iplib.py (handle_shell_escape): add Ville's patch to
2762 2771 better handle backslashes in paths. See the thread 'More Windows
2763 2772 questions part 2 - \/ characters revisited' on the iypthon user
2764 2773 list:
2765 2774 http://scipy.net/pipermail/ipython-user/2005-June/000907.html
2766 2775
2767 2776 (InteractiveShell.__init__): fix tab-completion bug in threaded shells.
2768 2777
2769 2778 (InteractiveShell.__init__): change threaded shells to not use the
2770 2779 ipython crash handler. This was causing more problems than not,
2771 2780 as exceptions in the main thread (GUI code, typically) would
2772 2781 always show up as a 'crash', when they really weren't.
2773 2782
2774 2783 The colors and exception mode commands (%colors/%xmode) have been
2775 2784 synchronized to also take this into account, so users can get
2776 2785 verbose exceptions for their threaded code as well. I also added
2777 2786 support for activating pdb inside this exception handler as well,
2778 2787 so now GUI authors can use IPython's enhanced pdb at runtime.
2779 2788
2780 2789 * IPython/ipmaker.py (make_IPython): make the autoedit_syntax flag
2781 2790 true by default, and add it to the shipped ipythonrc file. Since
2782 2791 this asks the user before proceeding, I think it's OK to make it
2783 2792 true by default.
2784 2793
2785 2794 * IPython/Magic.py (magic_exit): make new exit/quit magics instead
2786 2795 of the previous special-casing of input in the eval loop. I think
2787 2796 this is cleaner, as they really are commands and shouldn't have
2788 2797 a special role in the middle of the core code.
2789 2798
2790 2799 2005-12-27 Fernando Perez <Fernando.Perez@colorado.edu>
2791 2800
2792 2801 * IPython/iplib.py (edit_syntax_error): added support for
2793 2802 automatically reopening the editor if the file had a syntax error
2794 2803 in it. Thanks to scottt who provided the patch at:
2795 2804 http://www.scipy.net/roundup/ipython/issue36 (slightly modified
2796 2805 version committed).
2797 2806
2798 2807 * IPython/iplib.py (handle_normal): add suport for multi-line
2799 2808 input with emtpy lines. This fixes
2800 2809 http://www.scipy.net/roundup/ipython/issue43 and a similar
2801 2810 discussion on the user list.
2802 2811
2803 2812 WARNING: a behavior change is necessarily introduced to support
2804 2813 blank lines: now a single blank line with whitespace does NOT
2805 2814 break the input loop, which means that when autoindent is on, by
2806 2815 default hitting return on the next (indented) line does NOT exit.
2807 2816
2808 2817 Instead, to exit a multiline input you can either have:
2809 2818
2810 2819 - TWO whitespace lines (just hit return again), or
2811 2820 - a single whitespace line of a different length than provided
2812 2821 by the autoindent (add or remove a space).
2813 2822
2814 2823 * IPython/completer.py (MagicCompleter.__init__): new 'completer'
2815 2824 module to better organize all readline-related functionality.
2816 2825 I've deleted FlexCompleter and put all completion clases here.
2817 2826
2818 2827 * IPython/iplib.py (raw_input): improve indentation management.
2819 2828 It is now possible to paste indented code with autoindent on, and
2820 2829 the code is interpreted correctly (though it still looks bad on
2821 2830 screen, due to the line-oriented nature of ipython).
2822 2831 (MagicCompleter.complete): change behavior so that a TAB key on an
2823 2832 otherwise empty line actually inserts a tab, instead of completing
2824 2833 on the entire global namespace. This makes it easier to use the
2825 2834 TAB key for indentation. After a request by Hans Meine
2826 2835 <hans_meine-AT-gmx.net>
2827 2836 (_prefilter): add support so that typing plain 'exit' or 'quit'
2828 2837 does a sensible thing. Originally I tried to deviate as little as
2829 2838 possible from the default python behavior, but even that one may
2830 2839 change in this direction (thread on python-dev to that effect).
2831 2840 Regardless, ipython should do the right thing even if CPython's
2832 2841 '>>>' prompt doesn't.
2833 2842 (InteractiveShell): removed subclassing code.InteractiveConsole
2834 2843 class. By now we'd overridden just about all of its methods: I've
2835 2844 copied the remaining two over, and now ipython is a standalone
2836 2845 class. This will provide a clearer picture for the chainsaw
2837 2846 branch refactoring.
2838 2847
2839 2848 2005-12-26 Fernando Perez <Fernando.Perez@colorado.edu>
2840 2849
2841 2850 * IPython/ultraTB.py (VerboseTB.text): harden reporting against
2842 2851 failures for objects which break when dir() is called on them.
2843 2852
2844 2853 * IPython/FlexCompleter.py (Completer.__init__): Added support for
2845 2854 distinct local and global namespaces in the completer API. This
2846 2855 change allows us to properly handle completion with distinct
2847 2856 scopes, including in embedded instances (this had never really
2848 2857 worked correctly).
2849 2858
2850 2859 Note: this introduces a change in the constructor for
2851 2860 MagicCompleter, as a new global_namespace parameter is now the
2852 2861 second argument (the others were bumped one position).
2853 2862
2854 2863 2005-12-25 Fernando Perez <Fernando.Perez@colorado.edu>
2855 2864
2856 2865 * IPython/iplib.py (embed_mainloop): fix tab-completion in
2857 2866 embedded instances (which can be done now thanks to Vivian's
2858 2867 frame-handling fixes for pdb).
2859 2868 (InteractiveShell.__init__): Fix namespace handling problem in
2860 2869 embedded instances. We were overwriting __main__ unconditionally,
2861 2870 and this should only be done for 'full' (non-embedded) IPython;
2862 2871 embedded instances must respect the caller's __main__. Thanks to
2863 2872 a bug report by Yaroslav Bulatov <yaroslavvb-AT-gmail.com>
2864 2873
2865 2874 2005-12-24 Fernando Perez <Fernando.Perez@colorado.edu>
2866 2875
2867 2876 * setup.py: added download_url to setup(). This registers the
2868 2877 download address at PyPI, which is not only useful to humans
2869 2878 browsing the site, but is also picked up by setuptools (the Eggs
2870 2879 machinery). Thanks to Ville and R. Kern for the info/discussion
2871 2880 on this.
2872 2881
2873 2882 2005-12-23 Fernando Perez <Fernando.Perez@colorado.edu>
2874 2883
2875 2884 * IPython/Debugger.py (Pdb.__init__): Major pdb mode enhancements.
2876 2885 This brings a lot of nice functionality to the pdb mode, which now
2877 2886 has tab-completion, syntax highlighting, and better stack handling
2878 2887 than before. Many thanks to Vivian De Smedt
2879 2888 <vivian-AT-vdesmedt.com> for the original patches.
2880 2889
2881 2890 2005-12-08 Fernando Perez <Fernando.Perez@colorado.edu>
2882 2891
2883 2892 * IPython/Shell.py (IPShellGTK.mainloop): fix mainloop() calling
2884 2893 sequence to consistently accept the banner argument. The
2885 2894 inconsistency was tripping SAGE, thanks to Gary Zablackis
2886 2895 <gzabl-AT-yahoo.com> for the report.
2887 2896
2888 2897 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
2889 2898
2890 2899 * IPython/iplib.py (InteractiveShell.post_config_initialization):
2891 2900 Fix bug where a naked 'alias' call in the ipythonrc file would
2892 2901 cause a crash. Bug reported by Jorgen Stenarson.
2893 2902
2894 2903 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
2895 2904
2896 2905 * IPython/ipmaker.py (make_IPython): cleanups which should improve
2897 2906 startup time.
2898 2907
2899 2908 * IPython/iplib.py (runcode): my globals 'fix' for embedded
2900 2909 instances had introduced a bug with globals in normal code. Now
2901 2910 it's working in all cases.
2902 2911
2903 2912 * IPython/Magic.py (magic_psearch): Finish wildcard cleanup and
2904 2913 API changes. A new ipytonrc option, 'wildcards_case_sensitive'
2905 2914 has been introduced to set the default case sensitivity of the
2906 2915 searches. Users can still select either mode at runtime on a
2907 2916 per-search basis.
2908 2917
2909 2918 2005-11-13 Fernando Perez <Fernando.Perez@colorado.edu>
2910 2919
2911 2920 * IPython/wildcard.py (NameSpace.__init__): fix resolution of
2912 2921 attributes in wildcard searches for subclasses. Modified version
2913 2922 of a patch by Jorgen.
2914 2923
2915 2924 2005-11-12 Fernando Perez <Fernando.Perez@colorado.edu>
2916 2925
2917 2926 * IPython/iplib.py (embed_mainloop): Fix handling of globals for
2918 2927 embedded instances. I added a user_global_ns attribute to the
2919 2928 InteractiveShell class to handle this.
2920 2929
2921 2930 2005-10-31 Fernando Perez <Fernando.Perez@colorado.edu>
2922 2931
2923 2932 * IPython/Shell.py (IPShellGTK.mainloop): Change timeout_add to
2924 2933 idle_add, which fixes horrible keyboard lag problems under gtk 2.6
2925 2934 (reported under win32, but may happen also in other platforms).
2926 2935 Bug report and fix courtesy of Sean Moore <smm-AT-logic.bm>
2927 2936
2928 2937 2005-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
2929 2938
2930 2939 * IPython/Magic.py (magic_psearch): new support for wildcard
2931 2940 patterns. Now, typing ?a*b will list all names which begin with a
2932 2941 and end in b, for example. The %psearch magic has full
2933 2942 docstrings. Many thanks to JΓΆrgen Stenarson
2934 2943 <jorgen.stenarson-AT-bostream.nu>, author of the patches
2935 2944 implementing this functionality.
2936 2945
2937 2946 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
2938 2947
2939 2948 * Manual: fixed long-standing annoyance of double-dashes (as in
2940 2949 --prefix=~, for example) being stripped in the HTML version. This
2941 2950 is a latex2html bug, but a workaround was provided. Many thanks
2942 2951 to George K. Thiruvathukal <gthiruv-AT-luc.edu> for the detailed
2943 2952 help, and Michael Tobis <mtobis-AT-gmail.com> for getting the ball
2944 2953 rolling. This seemingly small issue had tripped a number of users
2945 2954 when first installing, so I'm glad to see it gone.
2946 2955
2947 2956 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
2948 2957
2949 2958 * IPython/Extensions/numeric_formats.py: fix missing import,
2950 2959 reported by Stephen Walton.
2951 2960
2952 2961 2005-09-24 Fernando Perez <Fernando.Perez@colorado.edu>
2953 2962
2954 2963 * IPython/demo.py: finish demo module, fully documented now.
2955 2964
2956 2965 * IPython/genutils.py (file_read): simple little utility to read a
2957 2966 file and ensure it's closed afterwards.
2958 2967
2959 2968 2005-09-23 Fernando Perez <Fernando.Perez@colorado.edu>
2960 2969
2961 2970 * IPython/demo.py (Demo.__init__): added support for individually
2962 2971 tagging blocks for automatic execution.
2963 2972
2964 2973 * IPython/Magic.py (magic_pycat): new %pycat magic for showing
2965 2974 syntax-highlighted python sources, requested by John.
2966 2975
2967 2976 2005-09-22 Fernando Perez <Fernando.Perez@colorado.edu>
2968 2977
2969 2978 * IPython/demo.py (Demo.again): fix bug where again() blocks after
2970 2979 finishing.
2971 2980
2972 2981 * IPython/genutils.py (shlex_split): moved from Magic to here,
2973 2982 where all 2.2 compatibility stuff lives. I needed it for demo.py.
2974 2983
2975 2984 * IPython/demo.py (Demo.__init__): added support for silent
2976 2985 blocks, improved marks as regexps, docstrings written.
2977 2986 (Demo.__init__): better docstring, added support for sys.argv.
2978 2987
2979 2988 * IPython/genutils.py (marquee): little utility used by the demo
2980 2989 code, handy in general.
2981 2990
2982 2991 * IPython/demo.py (Demo.__init__): new class for interactive
2983 2992 demos. Not documented yet, I just wrote it in a hurry for
2984 2993 scipy'05. Will docstring later.
2985 2994
2986 2995 2005-09-20 Fernando Perez <Fernando.Perez@colorado.edu>
2987 2996
2988 2997 * IPython/Shell.py (sigint_handler): Drastic simplification which
2989 2998 also seems to make Ctrl-C work correctly across threads! This is
2990 2999 so simple, that I can't beleive I'd missed it before. Needs more
2991 3000 testing, though.
2992 3001 (KBINT): Never mind, revert changes. I'm sure I'd tried something
2993 3002 like this before...
2994 3003
2995 3004 * IPython/genutils.py (get_home_dir): add protection against
2996 3005 non-dirs in win32 registry.
2997 3006
2998 3007 * IPython/iplib.py (InteractiveShell.alias_table_validate): fix
2999 3008 bug where dict was mutated while iterating (pysh crash).
3000 3009
3001 3010 2005-09-06 Fernando Perez <Fernando.Perez@colorado.edu>
3002 3011
3003 3012 * IPython/iplib.py (handle_auto): Fix inconsistency arising from
3004 3013 spurious newlines added by this routine. After a report by
3005 3014 F. Mantegazza.
3006 3015
3007 3016 2005-09-05 Fernando Perez <Fernando.Perez@colorado.edu>
3008 3017
3009 3018 * IPython/Shell.py (hijack_gtk): remove pygtk.require("2.0")
3010 3019 calls. These were a leftover from the GTK 1.x days, and can cause
3011 3020 problems in certain cases (after a report by John Hunter).
3012 3021
3013 3022 * IPython/iplib.py (InteractiveShell.__init__): Trap exception if
3014 3023 os.getcwd() fails at init time. Thanks to patch from David Remahl
3015 3024 <chmod007-AT-mac.com>.
3016 3025 (InteractiveShell.__init__): prevent certain special magics from
3017 3026 being shadowed by aliases. Closes
3018 3027 http://www.scipy.net/roundup/ipython/issue41.
3019 3028
3020 3029 2005-08-31 Fernando Perez <Fernando.Perez@colorado.edu>
3021 3030
3022 3031 * IPython/iplib.py (InteractiveShell.complete): Added new
3023 3032 top-level completion method to expose the completion mechanism
3024 3033 beyond readline-based environments.
3025 3034
3026 3035 2005-08-19 Fernando Perez <Fernando.Perez@colorado.edu>
3027 3036
3028 3037 * tools/ipsvnc (svnversion): fix svnversion capture.
3029 3038
3030 3039 * IPython/iplib.py (InteractiveShell.__init__): Add has_readline
3031 3040 attribute to self, which was missing. Before, it was set by a
3032 3041 routine which in certain cases wasn't being called, so the
3033 3042 instance could end up missing the attribute. This caused a crash.
3034 3043 Closes http://www.scipy.net/roundup/ipython/issue40.
3035 3044
3036 3045 2005-08-16 Fernando Perez <fperez@colorado.edu>
3037 3046
3038 3047 * IPython/ultraTB.py (VerboseTB.text): don't crash if object
3039 3048 contains non-string attribute. Closes
3040 3049 http://www.scipy.net/roundup/ipython/issue38.
3041 3050
3042 3051 2005-08-14 Fernando Perez <fperez@colorado.edu>
3043 3052
3044 3053 * tools/ipsvnc: Minor improvements, to add changeset info.
3045 3054
3046 3055 2005-08-12 Fernando Perez <fperez@colorado.edu>
3047 3056
3048 3057 * IPython/iplib.py (runsource): remove self.code_to_run_src
3049 3058 attribute. I realized this is nothing more than
3050 3059 '\n'.join(self.buffer), and having the same data in two different
3051 3060 places is just asking for synchronization bugs. This may impact
3052 3061 people who have custom exception handlers, so I need to warn
3053 3062 ipython-dev about it (F. Mantegazza may use them).
3054 3063
3055 3064 2005-07-29 Fernando Perez <Fernando.Perez@colorado.edu>
3056 3065
3057 3066 * IPython/genutils.py: fix 2.2 compatibility (generators)
3058 3067
3059 3068 2005-07-18 Fernando Perez <fperez@colorado.edu>
3060 3069
3061 3070 * IPython/genutils.py (get_home_dir): fix to help users with
3062 3071 invalid $HOME under win32.
3063 3072
3064 3073 2005-07-17 Fernando Perez <fperez@colorado.edu>
3065 3074
3066 3075 * IPython/Prompts.py (str_safe): Make unicode-safe. Also remove
3067 3076 some old hacks and clean up a bit other routines; code should be
3068 3077 simpler and a bit faster.
3069 3078
3070 3079 * IPython/iplib.py (interact): removed some last-resort attempts
3071 3080 to survive broken stdout/stderr. That code was only making it
3072 3081 harder to abstract out the i/o (necessary for gui integration),
3073 3082 and the crashes it could prevent were extremely rare in practice
3074 3083 (besides being fully user-induced in a pretty violent manner).
3075 3084
3076 3085 * IPython/genutils.py (IOStream.__init__): Simplify the i/o stuff.
3077 3086 Nothing major yet, but the code is simpler to read; this should
3078 3087 make it easier to do more serious modifications in the future.
3079 3088
3080 3089 * IPython/Extensions/InterpreterExec.py: Fix auto-quoting in pysh,
3081 3090 which broke in .15 (thanks to a report by Ville).
3082 3091
3083 3092 * IPython/Itpl.py (Itpl.__init__): add unicode support (it may not
3084 3093 be quite correct, I know next to nothing about unicode). This
3085 3094 will allow unicode strings to be used in prompts, amongst other
3086 3095 cases. It also will prevent ipython from crashing when unicode
3087 3096 shows up unexpectedly in many places. If ascii encoding fails, we
3088 3097 assume utf_8. Currently the encoding is not a user-visible
3089 3098 setting, though it could be made so if there is demand for it.
3090 3099
3091 3100 * IPython/ipmaker.py (make_IPython): remove old 2.1-specific hack.
3092 3101
3093 3102 * IPython/Struct.py (Struct.merge): switch keys() to iterator.
3094 3103
3095 3104 * IPython/background_jobs.py: moved 2.2 compatibility to genutils.
3096 3105
3097 3106 * IPython/genutils.py: Add 2.2 compatibility here, so all other
3098 3107 code can work transparently for 2.2/2.3.
3099 3108
3100 3109 2005-07-16 Fernando Perez <fperez@colorado.edu>
3101 3110
3102 3111 * IPython/ultraTB.py (ExceptionColors): Make a global variable
3103 3112 out of the color scheme table used for coloring exception
3104 3113 tracebacks. This allows user code to add new schemes at runtime.
3105 3114 This is a minimally modified version of the patch at
3106 3115 http://www.scipy.net/roundup/ipython/issue35, many thanks to pabw
3107 3116 for the contribution.
3108 3117
3109 3118 * IPython/FlexCompleter.py (Completer.attr_matches): Add a
3110 3119 slightly modified version of the patch in
3111 3120 http://www.scipy.net/roundup/ipython/issue34, which also allows me
3112 3121 to remove the previous try/except solution (which was costlier).
3113 3122 Thanks to Gaetan Lehmann <gaetan.lehmann-AT-jouy.inra.fr> for the fix.
3114 3123
3115 3124 2005-06-08 Fernando Perez <fperez@colorado.edu>
3116 3125
3117 3126 * IPython/iplib.py (write/write_err): Add methods to abstract all
3118 3127 I/O a bit more.
3119 3128
3120 3129 * IPython/Shell.py (IPShellGTK.mainloop): Fix GTK deprecation
3121 3130 warning, reported by Aric Hagberg, fix by JD Hunter.
3122 3131
3123 3132 2005-06-02 *** Released version 0.6.15
3124 3133
3125 3134 2005-06-01 Fernando Perez <fperez@colorado.edu>
3126 3135
3127 3136 * IPython/iplib.py (MagicCompleter.file_matches): Fix
3128 3137 tab-completion of filenames within open-quoted strings. Note that
3129 3138 this requires that in ~/.ipython/ipythonrc, users change the
3130 3139 readline delimiters configuration to read:
3131 3140
3132 3141 readline_remove_delims -/~
3133 3142
3134 3143
3135 3144 2005-05-31 *** Released version 0.6.14
3136 3145
3137 3146 2005-05-29 Fernando Perez <fperez@colorado.edu>
3138 3147
3139 3148 * IPython/ultraTB.py (VerboseTB.text): Fix crash for tracebacks
3140 3149 with files not on the filesystem. Reported by Eliyahu Sandler
3141 3150 <eli@gondolin.net>
3142 3151
3143 3152 2005-05-22 Fernando Perez <fperez@colorado.edu>
3144 3153
3145 3154 * IPython/iplib.py: Fix a few crashes in the --upgrade option.
3146 3155 After an initial report by LUK ShunTim <shuntim.luk@polyu.edu.hk>.
3147 3156
3148 3157 2005-05-19 Fernando Perez <fperez@colorado.edu>
3149 3158
3150 3159 * IPython/iplib.py (safe_execfile): close a file which could be
3151 3160 left open (causing problems in win32, which locks open files).
3152 3161 Thanks to a bug report by D Brown <dbrown2@yahoo.com>.
3153 3162
3154 3163 2005-05-18 Fernando Perez <fperez@colorado.edu>
3155 3164
3156 3165 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): pass all
3157 3166 keyword arguments correctly to safe_execfile().
3158 3167
3159 3168 2005-05-13 Fernando Perez <fperez@colorado.edu>
3160 3169
3161 3170 * ipython.1: Added info about Qt to manpage, and threads warning
3162 3171 to usage page (invoked with --help).
3163 3172
3164 3173 * IPython/iplib.py (MagicCompleter.python_func_kw_matches): Added
3165 3174 new matcher (it goes at the end of the priority list) to do
3166 3175 tab-completion on named function arguments. Submitted by George
3167 3176 Sakkis <gsakkis-AT-eden.rutgers.edu>. See the thread at
3168 3177 http://www.scipy.net/pipermail/ipython-dev/2005-April/000436.html
3169 3178 for more details.
3170 3179
3171 3180 * IPython/Magic.py (magic_run): Added new -e flag to ignore
3172 3181 SystemExit exceptions in the script being run. Thanks to a report
3173 3182 by danny shevitz <danny_shevitz-AT-yahoo.com>, about this
3174 3183 producing very annoying behavior when running unit tests.
3175 3184
3176 3185 2005-05-12 Fernando Perez <fperez@colorado.edu>
3177 3186
3178 3187 * IPython/iplib.py (handle_auto): fixed auto-quoting and parens,
3179 3188 which I'd broken (again) due to a changed regexp. In the process,
3180 3189 added ';' as an escape to auto-quote the whole line without
3181 3190 splitting its arguments. Thanks to a report by Jerry McRae
3182 3191 <qrs0xyc02-AT-sneakemail.com>.
3183 3192
3184 3193 * IPython/ultraTB.py (VerboseTB.text): protect against rare but
3185 3194 possible crashes caused by a TokenError. Reported by Ed Schofield
3186 3195 <schofield-AT-ftw.at>.
3187 3196
3188 3197 2005-05-06 Fernando Perez <fperez@colorado.edu>
3189 3198
3190 3199 * IPython/Shell.py (hijack_wx): Fix to work with WX v.2.6.
3191 3200
3192 3201 2005-04-29 Fernando Perez <fperez@colorado.edu>
3193 3202
3194 3203 * IPython/Shell.py (IPShellQt): Thanks to Denis Rivière
3195 3204 <nudz-AT-free.fr>, Yann Cointepas <yann-AT-sapetnioc.org> and Benjamin
3196 3205 Thyreau <Benji2-AT-decideur.info>, we now have a -qthread option
3197 3206 which provides support for Qt interactive usage (similar to the
3198 3207 existing one for WX and GTK). This had been often requested.
3199 3208
3200 3209 2005-04-14 *** Released version 0.6.13
3201 3210
3202 3211 2005-04-08 Fernando Perez <fperez@colorado.edu>
3203 3212
3204 3213 * IPython/Magic.py (Magic._ofind): remove docstring evaluation
3205 3214 from _ofind, which gets called on almost every input line. Now,
3206 3215 we only try to get docstrings if they are actually going to be
3207 3216 used (the overhead of fetching unnecessary docstrings can be
3208 3217 noticeable for certain objects, such as Pyro proxies).
3209 3218
3210 3219 * IPython/iplib.py (MagicCompleter.python_matches): Change the API
3211 3220 for completers. For some reason I had been passing them the state
3212 3221 variable, which completers never actually need, and was in
3213 3222 conflict with the rlcompleter API. Custom completers ONLY need to
3214 3223 take the text parameter.
3215 3224
3216 3225 * IPython/Extensions/InterpreterExec.py: Fix regexp so that magics
3217 3226 work correctly in pysh. I've also moved all the logic which used
3218 3227 to be in pysh.py here, which will prevent problems with future
3219 3228 upgrades. However, this time I must warn users to update their
3220 3229 pysh profile to include the line
3221 3230
3222 3231 import_all IPython.Extensions.InterpreterExec
3223 3232
3224 3233 because otherwise things won't work for them. They MUST also
3225 3234 delete pysh.py and the line
3226 3235
3227 3236 execfile pysh.py
3228 3237
3229 3238 from their ipythonrc-pysh.
3230 3239
3231 3240 * IPython/FlexCompleter.py (Completer.attr_matches): Make more
3232 3241 robust in the face of objects whose dir() returns non-strings
3233 3242 (which it shouldn't, but some broken libs like ITK do). Thanks to
3234 3243 a patch by John Hunter (implemented differently, though). Also
3235 3244 minor improvements by using .extend instead of + on lists.
3236 3245
3237 3246 * pysh.py:
3238 3247
3239 3248 2005-04-06 Fernando Perez <fperez@colorado.edu>
3240 3249
3241 3250 * IPython/ipmaker.py (make_IPython): Make multi_line_specials on
3242 3251 by default, so that all users benefit from it. Those who don't
3243 3252 want it can still turn it off.
3244 3253
3245 3254 * IPython/UserConfig/ipythonrc: Add multi_line_specials to the
3246 3255 config file, I'd forgotten about this, so users were getting it
3247 3256 off by default.
3248 3257
3249 3258 * IPython/iplib.py (ipmagic): big overhaul of the magic system for
3250 3259 consistency. Now magics can be called in multiline statements,
3251 3260 and python variables can be expanded in magic calls via $var.
3252 3261 This makes the magic system behave just like aliases or !system
3253 3262 calls.
3254 3263
3255 3264 2005-03-28 Fernando Perez <fperez@colorado.edu>
3256 3265
3257 3266 * IPython/iplib.py (handle_auto): cleanup to use %s instead of
3258 3267 expensive string additions for building command. Add support for
3259 3268 trailing ';' when autocall is used.
3260 3269
3261 3270 2005-03-26 Fernando Perez <fperez@colorado.edu>
3262 3271
3263 3272 * ipython.el: Fix http://www.scipy.net/roundup/ipython/issue31.
3264 3273 Bugfix by A. Schmolck, the ipython.el maintainer. Also make
3265 3274 ipython.el robust against prompts with any number of spaces
3266 3275 (including 0) after the ':' character.
3267 3276
3268 3277 * IPython/Prompts.py (Prompt2.set_p_str): Fix spurious space in
3269 3278 continuation prompt, which misled users to think the line was
3270 3279 already indented. Closes debian Bug#300847, reported to me by
3271 3280 Norbert Tretkowski <tretkowski-AT-inittab.de>.
3272 3281
3273 3282 2005-03-23 Fernando Perez <fperez@colorado.edu>
3274 3283
3275 3284 * IPython/Prompts.py (Prompt1.__str__): Make sure that prompts are
3276 3285 properly aligned if they have embedded newlines.
3277 3286
3278 3287 * IPython/iplib.py (runlines): Add a public method to expose
3279 3288 IPython's code execution machinery, so that users can run strings
3280 3289 as if they had been typed at the prompt interactively.
3281 3290 (InteractiveShell.__init__): Added getoutput() to the __IPYTHON__
3282 3291 methods which can call the system shell, but with python variable
3283 3292 expansion. The three such methods are: __IPYTHON__.system,
3284 3293 .getoutput and .getoutputerror. These need to be documented in a
3285 3294 'public API' section (to be written) of the manual.
3286 3295
3287 3296 2005-03-20 Fernando Perez <fperez@colorado.edu>
3288 3297
3289 3298 * IPython/iplib.py (InteractiveShell.set_custom_exc): new system
3290 3299 for custom exception handling. This is quite powerful, and it
3291 3300 allows for user-installable exception handlers which can trap
3292 3301 custom exceptions at runtime and treat them separately from
3293 3302 IPython's default mechanisms. At the request of FrΓ©dΓ©ric
3294 3303 Mantegazza <mantegazza-AT-ill.fr>.
3295 3304 (InteractiveShell.set_custom_completer): public API function to
3296 3305 add new completers at runtime.
3297 3306
3298 3307 2005-03-19 Fernando Perez <fperez@colorado.edu>
3299 3308
3300 3309 * IPython/OInspect.py (getdoc): Add a call to obj.getdoc(), to
3301 3310 allow objects which provide their docstrings via non-standard
3302 3311 mechanisms (like Pyro proxies) to still be inspected by ipython's
3303 3312 ? system.
3304 3313
3305 3314 * IPython/iplib.py (InteractiveShell.__init__): back off the _o/_e
3306 3315 automatic capture system. I tried quite hard to make it work
3307 3316 reliably, and simply failed. I tried many combinations with the
3308 3317 subprocess module, but eventually nothing worked in all needed
3309 3318 cases (not blocking stdin for the child, duplicating stdout
3310 3319 without blocking, etc). The new %sc/%sx still do capture to these
3311 3320 magical list/string objects which make shell use much more
3312 3321 conveninent, so not all is lost.
3313 3322
3314 3323 XXX - FIX MANUAL for the change above!
3315 3324
3316 3325 (runsource): I copied code.py's runsource() into ipython to modify
3317 3326 it a bit. Now the code object and source to be executed are
3318 3327 stored in ipython. This makes this info accessible to third-party
3319 3328 tools, like custom exception handlers. After a request by FrΓ©dΓ©ric
3320 3329 Mantegazza <mantegazza-AT-ill.fr>.
3321 3330
3322 3331 * IPython/UserConfig/ipythonrc: Add up/down arrow keys to
3323 3332 history-search via readline (like C-p/C-n). I'd wanted this for a
3324 3333 long time, but only recently found out how to do it. For users
3325 3334 who already have their ipythonrc files made and want this, just
3326 3335 add:
3327 3336
3328 3337 readline_parse_and_bind "\e[A": history-search-backward
3329 3338 readline_parse_and_bind "\e[B": history-search-forward
3330 3339
3331 3340 2005-03-18 Fernando Perez <fperez@colorado.edu>
3332 3341
3333 3342 * IPython/Magic.py (magic_sc): %sc and %sx now use the fancy
3334 3343 LSString and SList classes which allow transparent conversions
3335 3344 between list mode and whitespace-separated string.
3336 3345 (magic_r): Fix recursion problem in %r.
3337 3346
3338 3347 * IPython/genutils.py (LSString): New class to be used for
3339 3348 automatic storage of the results of all alias/system calls in _o
3340 3349 and _e (stdout/err). These provide a .l/.list attribute which
3341 3350 does automatic splitting on newlines. This means that for most
3342 3351 uses, you'll never need to do capturing of output with %sc/%sx
3343 3352 anymore, since ipython keeps this always done for you. Note that
3344 3353 only the LAST results are stored, the _o/e variables are
3345 3354 overwritten on each call. If you need to save their contents
3346 3355 further, simply bind them to any other name.
3347 3356
3348 3357 2005-03-17 Fernando Perez <fperez@colorado.edu>
3349 3358
3350 3359 * IPython/Prompts.py (BasePrompt.cwd_filt): a few more fixes for
3351 3360 prompt namespace handling.
3352 3361
3353 3362 2005-03-16 Fernando Perez <fperez@colorado.edu>
3354 3363
3355 3364 * IPython/Prompts.py (CachedOutput.__init__): Fix default and
3356 3365 classic prompts to be '>>> ' (final space was missing, and it
3357 3366 trips the emacs python mode).
3358 3367 (BasePrompt.__str__): Added safe support for dynamic prompt
3359 3368 strings. Now you can set your prompt string to be '$x', and the
3360 3369 value of x will be printed from your interactive namespace. The
3361 3370 interpolation syntax includes the full Itpl support, so
3362 3371 ${foo()+x+bar()} is a valid prompt string now, and the function
3363 3372 calls will be made at runtime.
3364 3373
3365 3374 2005-03-15 Fernando Perez <fperez@colorado.edu>
3366 3375
3367 3376 * IPython/Magic.py (magic_history): renamed %hist to %history, to
3368 3377 avoid name clashes in pylab. %hist still works, it just forwards
3369 3378 the call to %history.
3370 3379
3371 3380 2005-03-02 *** Released version 0.6.12
3372 3381
3373 3382 2005-03-02 Fernando Perez <fperez@colorado.edu>
3374 3383
3375 3384 * IPython/iplib.py (handle_magic): log magic calls properly as
3376 3385 ipmagic() function calls.
3377 3386
3378 3387 * IPython/Magic.py (magic_time): Improved %time to support
3379 3388 statements and provide wall-clock as well as CPU time.
3380 3389
3381 3390 2005-02-27 Fernando Perez <fperez@colorado.edu>
3382 3391
3383 3392 * IPython/hooks.py: New hooks module, to expose user-modifiable
3384 3393 IPython functionality in a clean manner. For now only the editor
3385 3394 hook is actually written, and other thigns which I intend to turn
3386 3395 into proper hooks aren't yet there. The display and prefilter
3387 3396 stuff, for example, should be hooks. But at least now the
3388 3397 framework is in place, and the rest can be moved here with more
3389 3398 time later. IPython had had a .hooks variable for a long time for
3390 3399 this purpose, but I'd never actually used it for anything.
3391 3400
3392 3401 2005-02-26 Fernando Perez <fperez@colorado.edu>
3393 3402
3394 3403 * IPython/ipmaker.py (make_IPython): make the default ipython
3395 3404 directory be called _ipython under win32, to follow more the
3396 3405 naming peculiarities of that platform (where buggy software like
3397 3406 Visual Sourcesafe breaks with .named directories). Reported by
3398 3407 Ville Vainio.
3399 3408
3400 3409 2005-02-23 Fernando Perez <fperez@colorado.edu>
3401 3410
3402 3411 * IPython/iplib.py (InteractiveShell.__init__): removed a few
3403 3412 auto_aliases for win32 which were causing problems. Users can
3404 3413 define the ones they personally like.
3405 3414
3406 3415 2005-02-21 Fernando Perez <fperez@colorado.edu>
3407 3416
3408 3417 * IPython/Magic.py (magic_time): new magic to time execution of
3409 3418 expressions. After a request by Charles Moad <cmoad-AT-indiana.edu>.
3410 3419
3411 3420 2005-02-19 Fernando Perez <fperez@colorado.edu>
3412 3421
3413 3422 * IPython/ConfigLoader.py (ConfigLoader.load): Allow empty strings
3414 3423 into keys (for prompts, for example).
3415 3424
3416 3425 * IPython/Prompts.py (BasePrompt.set_p_str): Fix to allow empty
3417 3426 prompts in case users want them. This introduces a small behavior
3418 3427 change: ipython does not automatically add a space to all prompts
3419 3428 anymore. To get the old prompts with a space, users should add it
3420 3429 manually to their ipythonrc file, so for example prompt_in1 should
3421 3430 now read 'In [\#]: ' instead of 'In [\#]:'.
3422 3431 (BasePrompt.__init__): New option prompts_pad_left (only in rc
3423 3432 file) to control left-padding of secondary prompts.
3424 3433
3425 3434 * IPython/Magic.py (Magic.profile_missing_notice): Don't crash if
3426 3435 the profiler can't be imported. Fix for Debian, which removed
3427 3436 profile.py because of License issues. I applied a slightly
3428 3437 modified version of the original Debian patch at
3429 3438 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=294500.
3430 3439
3431 3440 2005-02-17 Fernando Perez <fperez@colorado.edu>
3432 3441
3433 3442 * IPython/genutils.py (native_line_ends): Fix bug which would
3434 3443 cause improper line-ends under win32 b/c I was not opening files
3435 3444 in binary mode. Bug report and fix thanks to Ville.
3436 3445
3437 3446 * IPython/iplib.py (handle_auto): Fix bug which I introduced when
3438 3447 trying to catch spurious foo[1] autocalls. My fix actually broke
3439 3448 ',/' autoquote/call with explicit escape (bad regexp).
3440 3449
3441 3450 2005-02-15 *** Released version 0.6.11
3442 3451
3443 3452 2005-02-14 Fernando Perez <fperez@colorado.edu>
3444 3453
3445 3454 * IPython/background_jobs.py: New background job management
3446 3455 subsystem. This is implemented via a new set of classes, and
3447 3456 IPython now provides a builtin 'jobs' object for background job
3448 3457 execution. A convenience %bg magic serves as a lightweight
3449 3458 frontend for starting the more common type of calls. This was
3450 3459 inspired by discussions with B. Granger and the BackgroundCommand
3451 3460 class described in the book Python Scripting for Computational
3452 3461 Science, by H. P. Langtangen: http://folk.uio.no/hpl/scripting
3453 3462 (although ultimately no code from this text was used, as IPython's
3454 3463 system is a separate implementation).
3455 3464
3456 3465 * IPython/iplib.py (MagicCompleter.python_matches): add new option
3457 3466 to control the completion of single/double underscore names
3458 3467 separately. As documented in the example ipytonrc file, the
3459 3468 readline_omit__names variable can now be set to 2, to omit even
3460 3469 single underscore names. Thanks to a patch by Brian Wong
3461 3470 <BrianWong-AT-AirgoNetworks.Com>.
3462 3471 (InteractiveShell.__init__): Fix bug which would cause foo[1] to
3463 3472 be autocalled as foo([1]) if foo were callable. A problem for
3464 3473 things which are both callable and implement __getitem__.
3465 3474 (init_readline): Fix autoindentation for win32. Thanks to a patch
3466 3475 by Vivian De Smedt <vivian-AT-vdesmedt.com>.
3467 3476
3468 3477 2005-02-12 Fernando Perez <fperez@colorado.edu>
3469 3478
3470 3479 * IPython/ipmaker.py (make_IPython): Disabled the stout traps
3471 3480 which I had written long ago to sort out user error messages which
3472 3481 may occur during startup. This seemed like a good idea initially,
3473 3482 but it has proven a disaster in retrospect. I don't want to
3474 3483 change much code for now, so my fix is to set the internal 'debug'
3475 3484 flag to true everywhere, whose only job was precisely to control
3476 3485 this subsystem. This closes issue 28 (as well as avoiding all
3477 3486 sorts of strange hangups which occur from time to time).
3478 3487
3479 3488 2005-02-07 Fernando Perez <fperez@colorado.edu>
3480 3489
3481 3490 * IPython/Magic.py (magic_edit): Fix 'ed -p' not working when the
3482 3491 previous call produced a syntax error.
3483 3492
3484 3493 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
3485 3494 classes without constructor.
3486 3495
3487 3496 2005-02-06 Fernando Perez <fperez@colorado.edu>
3488 3497
3489 3498 * IPython/iplib.py (MagicCompleter.complete): Extend the list of
3490 3499 completions with the results of each matcher, so we return results
3491 3500 to the user from all namespaces. This breaks with ipython
3492 3501 tradition, but I think it's a nicer behavior. Now you get all
3493 3502 possible completions listed, from all possible namespaces (python,
3494 3503 filesystem, magics...) After a request by John Hunter
3495 3504 <jdhunter-AT-nitace.bsd.uchicago.edu>.
3496 3505
3497 3506 2005-02-05 Fernando Perez <fperez@colorado.edu>
3498 3507
3499 3508 * IPython/Magic.py (magic_prun): Fix bug where prun would fail if
3500 3509 the call had quote characters in it (the quotes were stripped).
3501 3510
3502 3511 2005-01-31 Fernando Perez <fperez@colorado.edu>
3503 3512
3504 3513 * IPython/iplib.py (InteractiveShell.__init__): reduce reliance on
3505 3514 Itpl.itpl() to make the code more robust against psyco
3506 3515 optimizations.
3507 3516
3508 3517 * IPython/Itpl.py (Itpl.__str__): Use a _getframe() call instead
3509 3518 of causing an exception. Quicker, cleaner.
3510 3519
3511 3520 2005-01-28 Fernando Perez <fperez@colorado.edu>
3512 3521
3513 3522 * scripts/ipython_win_post_install.py (install): hardcode
3514 3523 sys.prefix+'python.exe' as the executable path. It turns out that
3515 3524 during the post-installation run, sys.executable resolves to the
3516 3525 name of the binary installer! I should report this as a distutils
3517 3526 bug, I think. I updated the .10 release with this tiny fix, to
3518 3527 avoid annoying the lists further.
3519 3528
3520 3529 2005-01-27 *** Released version 0.6.10
3521 3530
3522 3531 2005-01-27 Fernando Perez <fperez@colorado.edu>
3523 3532
3524 3533 * IPython/numutils.py (norm): Added 'inf' as optional name for
3525 3534 L-infinity norm, included references to mathworld.com for vector
3526 3535 norm definitions.
3527 3536 (amin/amax): added amin/amax for array min/max. Similar to what
3528 3537 pylab ships with after the recent reorganization of names.
3529 3538 (spike/spike_odd): removed deprecated spike/spike_odd functions.
3530 3539
3531 3540 * ipython.el: committed Alex's recent fixes and improvements.
3532 3541 Tested with python-mode from CVS, and it looks excellent. Since
3533 3542 python-mode hasn't released anything in a while, I'm temporarily
3534 3543 putting a copy of today's CVS (v 4.70) of python-mode in:
3535 3544 http://ipython.scipy.org/tmp/python-mode.el
3536 3545
3537 3546 * scripts/ipython_win_post_install.py (install): Win32 fix to use
3538 3547 sys.executable for the executable name, instead of assuming it's
3539 3548 called 'python.exe' (the post-installer would have produced broken
3540 3549 setups on systems with a differently named python binary).
3541 3550
3542 3551 * IPython/PyColorize.py (Parser.__call__): change explicit '\n'
3543 3552 references to os.linesep, to make the code more
3544 3553 platform-independent. This is also part of the win32 coloring
3545 3554 fixes.
3546 3555
3547 3556 * IPython/genutils.py (page_dumb): Remove attempts to chop long
3548 3557 lines, which actually cause coloring bugs because the length of
3549 3558 the line is very difficult to correctly compute with embedded
3550 3559 escapes. This was the source of all the coloring problems under
3551 3560 Win32. I think that _finally_, Win32 users have a properly
3552 3561 working ipython in all respects. This would never have happened
3553 3562 if not for Gary Bishop and Viktor Ransmayr's great help and work.
3554 3563
3555 3564 2005-01-26 *** Released version 0.6.9
3556 3565
3557 3566 2005-01-25 Fernando Perez <fperez@colorado.edu>
3558 3567
3559 3568 * setup.py: finally, we have a true Windows installer, thanks to
3560 3569 the excellent work of Viktor Ransmayr
3561 3570 <viktor.ransmayr-AT-t-online.de>. The docs have been updated for
3562 3571 Windows users. The setup routine is quite a bit cleaner thanks to
3563 3572 this, and the post-install script uses the proper functions to
3564 3573 allow a clean de-installation using the standard Windows Control
3565 3574 Panel.
3566 3575
3567 3576 * IPython/genutils.py (get_home_dir): changed to use the $HOME
3568 3577 environment variable under all OSes (including win32) if
3569 3578 available. This will give consistency to win32 users who have set
3570 3579 this variable for any reason. If os.environ['HOME'] fails, the
3571 3580 previous policy of using HOMEDRIVE\HOMEPATH kicks in.
3572 3581
3573 3582 2005-01-24 Fernando Perez <fperez@colorado.edu>
3574 3583
3575 3584 * IPython/numutils.py (empty_like): add empty_like(), similar to
3576 3585 zeros_like() but taking advantage of the new empty() Numeric routine.
3577 3586
3578 3587 2005-01-23 *** Released version 0.6.8
3579 3588
3580 3589 2005-01-22 Fernando Perez <fperez@colorado.edu>
3581 3590
3582 3591 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): I removed the
3583 3592 automatic show() calls. After discussing things with JDH, it
3584 3593 turns out there are too many corner cases where this can go wrong.
3585 3594 It's best not to try to be 'too smart', and simply have ipython
3586 3595 reproduce as much as possible the default behavior of a normal
3587 3596 python shell.
3588 3597
3589 3598 * IPython/iplib.py (InteractiveShell.__init__): Modified the
3590 3599 line-splitting regexp and _prefilter() to avoid calling getattr()
3591 3600 on assignments. This closes
3592 3601 http://www.scipy.net/roundup/ipython/issue24. Note that Python's
3593 3602 readline uses getattr(), so a simple <TAB> keypress is still
3594 3603 enough to trigger getattr() calls on an object.
3595 3604
3596 3605 2005-01-21 Fernando Perez <fperez@colorado.edu>
3597 3606
3598 3607 * IPython/Shell.py (MatplotlibShellBase.magic_run): Fix the %run
3599 3608 docstring under pylab so it doesn't mask the original.
3600 3609
3601 3610 2005-01-21 *** Released version 0.6.7
3602 3611
3603 3612 2005-01-21 Fernando Perez <fperez@colorado.edu>
3604 3613
3605 3614 * IPython/Shell.py (MTInteractiveShell.runcode): Trap a crash with
3606 3615 signal handling for win32 users in multithreaded mode.
3607 3616
3608 3617 2005-01-17 Fernando Perez <fperez@colorado.edu>
3609 3618
3610 3619 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
3611 3620 instances with no __init__. After a crash report by Norbert Nemec
3612 3621 <Norbert-AT-nemec-online.de>.
3613 3622
3614 3623 2005-01-14 Fernando Perez <fperez@colorado.edu>
3615 3624
3616 3625 * IPython/ultraTB.py (VerboseTB.text): Fix bug in reporting of
3617 3626 names for verbose exceptions, when multiple dotted names and the
3618 3627 'parent' object were present on the same line.
3619 3628
3620 3629 2005-01-11 Fernando Perez <fperez@colorado.edu>
3621 3630
3622 3631 * IPython/genutils.py (flag_calls): new utility to trap and flag
3623 3632 calls in functions. I need it to clean up matplotlib support.
3624 3633 Also removed some deprecated code in genutils.
3625 3634
3626 3635 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): small fix so
3627 3636 that matplotlib scripts called with %run, which don't call show()
3628 3637 themselves, still have their plotting windows open.
3629 3638
3630 3639 2005-01-05 Fernando Perez <fperez@colorado.edu>
3631 3640
3632 3641 * IPython/Shell.py (IPShellGTK.__init__): Patch by Andrew Straw
3633 3642 <astraw-AT-caltech.edu>, to fix gtk deprecation warnings.
3634 3643
3635 3644 2004-12-19 Fernando Perez <fperez@colorado.edu>
3636 3645
3637 3646 * IPython/Shell.py (MTInteractiveShell.runcode): Get rid of
3638 3647 parent_runcode, which was an eyesore. The same result can be
3639 3648 obtained with Python's regular superclass mechanisms.
3640 3649
3641 3650 2004-12-17 Fernando Perez <fperez@colorado.edu>
3642 3651
3643 3652 * IPython/Magic.py (Magic.magic_sc): Fix quote stripping problem
3644 3653 reported by Prabhu.
3645 3654 (Magic.magic_sx): direct all errors to Term.cerr (defaults to
3646 3655 sys.stderr) instead of explicitly calling sys.stderr. This helps
3647 3656 maintain our I/O abstractions clean, for future GUI embeddings.
3648 3657
3649 3658 * IPython/genutils.py (info): added new utility for sys.stderr
3650 3659 unified info message handling (thin wrapper around warn()).
3651 3660
3652 3661 * IPython/ultraTB.py (VerboseTB.text): Fix misreported global
3653 3662 composite (dotted) names on verbose exceptions.
3654 3663 (VerboseTB.nullrepr): harden against another kind of errors which
3655 3664 Python's inspect module can trigger, and which were crashing
3656 3665 IPython. Thanks to a report by Marco Lombardi
3657 3666 <mlombard-AT-ma010192.hq.eso.org>.
3658 3667
3659 3668 2004-12-13 *** Released version 0.6.6
3660 3669
3661 3670 2004-12-12 Fernando Perez <fperez@colorado.edu>
3662 3671
3663 3672 * IPython/Shell.py (IPShellGTK.mainloop): catch RuntimeErrors
3664 3673 generated by pygtk upon initialization if it was built without
3665 3674 threads (for matplotlib users). After a crash reported by
3666 3675 Leguijt, Jaap J SIEP-EPT-RES <Jaap.Leguijt-AT-shell.com>.
3667 3676
3668 3677 * IPython/ipmaker.py (make_IPython): fix small bug in the
3669 3678 import_some parameter for multiple imports.
3670 3679
3671 3680 * IPython/iplib.py (ipmagic): simplified the interface of
3672 3681 ipmagic() to take a single string argument, just as it would be
3673 3682 typed at the IPython cmd line.
3674 3683 (ipalias): Added new ipalias() with an interface identical to
3675 3684 ipmagic(). This completes exposing a pure python interface to the
3676 3685 alias and magic system, which can be used in loops or more complex
3677 3686 code where IPython's automatic line mangling is not active.
3678 3687
3679 3688 * IPython/genutils.py (timing): changed interface of timing to
3680 3689 simply run code once, which is the most common case. timings()
3681 3690 remains unchanged, for the cases where you want multiple runs.
3682 3691
3683 3692 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix a
3684 3693 bug where Python2.2 crashes with exec'ing code which does not end
3685 3694 in a single newline. Python 2.3 is OK, so I hadn't noticed this
3686 3695 before.
3687 3696
3688 3697 2004-12-10 Fernando Perez <fperez@colorado.edu>
3689 3698
3690 3699 * IPython/Magic.py (Magic.magic_prun): changed name of option from
3691 3700 -t to -T, to accomodate the new -t flag in %run (the %run and
3692 3701 %prun options are kind of intermixed, and it's not easy to change
3693 3702 this with the limitations of python's getopt).
3694 3703
3695 3704 * IPython/Magic.py (Magic.magic_run): Added new -t option to time
3696 3705 the execution of scripts. It's not as fine-tuned as timeit.py,
3697 3706 but it works from inside ipython (and under 2.2, which lacks
3698 3707 timeit.py). Optionally a number of runs > 1 can be given for
3699 3708 timing very short-running code.
3700 3709
3701 3710 * IPython/genutils.py (uniq_stable): new routine which returns a
3702 3711 list of unique elements in any iterable, but in stable order of
3703 3712 appearance. I needed this for the ultraTB fixes, and it's a handy
3704 3713 utility.
3705 3714
3706 3715 * IPython/ultraTB.py (VerboseTB.text): Fix proper reporting of
3707 3716 dotted names in Verbose exceptions. This had been broken since
3708 3717 the very start, now x.y will properly be printed in a Verbose
3709 3718 traceback, instead of x being shown and y appearing always as an
3710 3719 'undefined global'. Getting this to work was a bit tricky,
3711 3720 because by default python tokenizers are stateless. Saved by
3712 3721 python's ability to easily add a bit of state to an arbitrary
3713 3722 function (without needing to build a full-blown callable object).
3714 3723
3715 3724 Also big cleanup of this code, which had horrendous runtime
3716 3725 lookups of zillions of attributes for colorization. Moved all
3717 3726 this code into a few templates, which make it cleaner and quicker.
3718 3727
3719 3728 Printout quality was also improved for Verbose exceptions: one
3720 3729 variable per line, and memory addresses are printed (this can be
3721 3730 quite handy in nasty debugging situations, which is what Verbose
3722 3731 is for).
3723 3732
3724 3733 * IPython/ipmaker.py (make_IPython): Do NOT execute files named in
3725 3734 the command line as scripts to be loaded by embedded instances.
3726 3735 Doing so has the potential for an infinite recursion if there are
3727 3736 exceptions thrown in the process. This fixes a strange crash
3728 3737 reported by Philippe MULLER <muller-AT-irit.fr>.
3729 3738
3730 3739 2004-12-09 Fernando Perez <fperez@colorado.edu>
3731 3740
3732 3741 * IPython/Shell.py (MatplotlibShellBase.use): Change pylab support
3733 3742 to reflect new names in matplotlib, which now expose the
3734 3743 matlab-compatible interface via a pylab module instead of the
3735 3744 'matlab' name. The new code is backwards compatible, so users of
3736 3745 all matplotlib versions are OK. Patch by J. Hunter.
3737 3746
3738 3747 * IPython/OInspect.py (Inspector.pinfo): Add to object? printing
3739 3748 of __init__ docstrings for instances (class docstrings are already
3740 3749 automatically printed). Instances with customized docstrings
3741 3750 (indep. of the class) are also recognized and all 3 separate
3742 3751 docstrings are printed (instance, class, constructor). After some
3743 3752 comments/suggestions by J. Hunter.
3744 3753
3745 3754 2004-12-05 Fernando Perez <fperez@colorado.edu>
3746 3755
3747 3756 * IPython/iplib.py (MagicCompleter.complete): Remove annoying
3748 3757 warnings when tab-completion fails and triggers an exception.
3749 3758
3750 3759 2004-12-03 Fernando Perez <fperez@colorado.edu>
3751 3760
3752 3761 * IPython/Magic.py (magic_prun): Fix bug where an exception would
3753 3762 be triggered when using 'run -p'. An incorrect option flag was
3754 3763 being set ('d' instead of 'D').
3755 3764 (manpage): fix missing escaped \- sign.
3756 3765
3757 3766 2004-11-30 *** Released version 0.6.5
3758 3767
3759 3768 2004-11-30 Fernando Perez <fperez@colorado.edu>
3760 3769
3761 3770 * IPython/Magic.py (Magic.magic_run): Fix bug in breakpoint
3762 3771 setting with -d option.
3763 3772
3764 3773 * setup.py (docfiles): Fix problem where the doc glob I was using
3765 3774 was COMPLETELY BROKEN. It was giving the right files by pure
3766 3775 accident, but failed once I tried to include ipython.el. Note:
3767 3776 glob() does NOT allow you to do exclusion on multiple endings!
3768 3777
3769 3778 2004-11-29 Fernando Perez <fperez@colorado.edu>
3770 3779
3771 3780 * IPython/usage.py (__doc__): cleaned up usage docstring, by using
3772 3781 the manpage as the source. Better formatting & consistency.
3773 3782
3774 3783 * IPython/Magic.py (magic_run): Added new -d option, to run
3775 3784 scripts under the control of the python pdb debugger. Note that
3776 3785 this required changing the %prun option -d to -D, to avoid a clash
3777 3786 (since %run must pass options to %prun, and getopt is too dumb to
3778 3787 handle options with string values with embedded spaces). Thanks
3779 3788 to a suggestion by Matthew Arnison <maffew-AT-cat.org.au>.
3780 3789 (magic_who_ls): added type matching to %who and %whos, so that one
3781 3790 can filter their output to only include variables of certain
3782 3791 types. Another suggestion by Matthew.
3783 3792 (magic_whos): Added memory summaries in kb and Mb for arrays.
3784 3793 (magic_who): Improve formatting (break lines every 9 vars).
3785 3794
3786 3795 2004-11-28 Fernando Perez <fperez@colorado.edu>
3787 3796
3788 3797 * IPython/Logger.py (Logger.log): Fix bug in syncing the input
3789 3798 cache when empty lines were present.
3790 3799
3791 3800 2004-11-24 Fernando Perez <fperez@colorado.edu>
3792 3801
3793 3802 * IPython/usage.py (__doc__): document the re-activated threading
3794 3803 options for WX and GTK.
3795 3804
3796 3805 2004-11-23 Fernando Perez <fperez@colorado.edu>
3797 3806
3798 3807 * IPython/Shell.py (start): Added Prabhu's big patch to reactivate
3799 3808 the -wthread and -gthread options, along with a new -tk one to try
3800 3809 and coordinate Tk threading with wx/gtk. The tk support is very
3801 3810 platform dependent, since it seems to require Tcl and Tk to be
3802 3811 built with threads (Fedora1/2 appears NOT to have it, but in
3803 3812 Prabhu's Debian boxes it works OK). But even with some Tk
3804 3813 limitations, this is a great improvement.
3805 3814
3806 3815 * IPython/Prompts.py (prompt_specials_color): Added \t for time
3807 3816 info in user prompts. Patch by Prabhu.
3808 3817
3809 3818 2004-11-18 Fernando Perez <fperez@colorado.edu>
3810 3819
3811 3820 * IPython/genutils.py (ask_yes_no): Add check for a max of 20
3812 3821 EOFErrors and bail, to avoid infinite loops if a non-terminating
3813 3822 file is fed into ipython. Patch submitted in issue 19 by user,
3814 3823 many thanks.
3815 3824
3816 3825 * IPython/iplib.py (InteractiveShell.handle_auto): do NOT trigger
3817 3826 autoquote/parens in continuation prompts, which can cause lots of
3818 3827 problems. Closes roundup issue 20.
3819 3828
3820 3829 2004-11-17 Fernando Perez <fperez@colorado.edu>
3821 3830
3822 3831 * debian/control (Build-Depends-Indep): Fix dpatch dependency,
3823 3832 reported as debian bug #280505. I'm not sure my local changelog
3824 3833 entry has the proper debian format (Jack?).
3825 3834
3826 3835 2004-11-08 *** Released version 0.6.4
3827 3836
3828 3837 2004-11-08 Fernando Perez <fperez@colorado.edu>
3829 3838
3830 3839 * IPython/iplib.py (init_readline): Fix exit message for Windows
3831 3840 when readline is active. Thanks to a report by Eric Jones
3832 3841 <eric-AT-enthought.com>.
3833 3842
3834 3843 2004-11-07 Fernando Perez <fperez@colorado.edu>
3835 3844
3836 3845 * IPython/genutils.py (page): Add a trap for OSError exceptions,
3837 3846 sometimes seen by win2k/cygwin users.
3838 3847
3839 3848 2004-11-06 Fernando Perez <fperez@colorado.edu>
3840 3849
3841 3850 * IPython/iplib.py (interact): Change the handling of %Exit from
3842 3851 trying to propagate a SystemExit to an internal ipython flag.
3843 3852 This is less elegant than using Python's exception mechanism, but
3844 3853 I can't get that to work reliably with threads, so under -pylab
3845 3854 %Exit was hanging IPython. Cross-thread exception handling is
3846 3855 really a bitch. Thaks to a bug report by Stephen Walton
3847 3856 <stephen.walton-AT-csun.edu>.
3848 3857
3849 3858 2004-11-04 Fernando Perez <fperez@colorado.edu>
3850 3859
3851 3860 * IPython/iplib.py (raw_input_original): store a pointer to the
3852 3861 true raw_input to harden against code which can modify it
3853 3862 (wx.py.PyShell does this and would otherwise crash ipython).
3854 3863 Thanks to a bug report by Jim Flowers <james.flowers-AT-lgx.com>.
3855 3864
3856 3865 * IPython/Shell.py (MTInteractiveShell.runsource): Cleaner fix for
3857 3866 Ctrl-C problem, which does not mess up the input line.
3858 3867
3859 3868 2004-11-03 Fernando Perez <fperez@colorado.edu>
3860 3869
3861 3870 * IPython/Release.py: Changed licensing to BSD, in all files.
3862 3871 (name): lowercase name for tarball/RPM release.
3863 3872
3864 3873 * IPython/OInspect.py (getdoc): wrap inspect.getdoc() safely for
3865 3874 use throughout ipython.
3866 3875
3867 3876 * IPython/Magic.py (Magic._ofind): Switch to using the new
3868 3877 OInspect.getdoc() function.
3869 3878
3870 3879 * IPython/Shell.py (sigint_handler): Hack to ignore the execution
3871 3880 of the line currently being canceled via Ctrl-C. It's extremely
3872 3881 ugly, but I don't know how to do it better (the problem is one of
3873 3882 handling cross-thread exceptions).
3874 3883
3875 3884 2004-10-28 Fernando Perez <fperez@colorado.edu>
3876 3885
3877 3886 * IPython/Shell.py (signal_handler): add signal handlers to trap
3878 3887 SIGINT and SIGSEGV in threaded code properly. Thanks to a bug
3879 3888 report by Francesc Alted.
3880 3889
3881 3890 2004-10-21 Fernando Perez <fperez@colorado.edu>
3882 3891
3883 3892 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Fix @
3884 3893 to % for pysh syntax extensions.
3885 3894
3886 3895 2004-10-09 Fernando Perez <fperez@colorado.edu>
3887 3896
3888 3897 * IPython/Magic.py (Magic.magic_whos): modify output of Numeric
3889 3898 arrays to print a more useful summary, without calling str(arr).
3890 3899 This avoids the problem of extremely lengthy computations which
3891 3900 occur if arr is large, and appear to the user as a system lockup
3892 3901 with 100% cpu activity. After a suggestion by Kristian Sandberg
3893 3902 <Kristian.Sandberg@colorado.edu>.
3894 3903 (Magic.__init__): fix bug in global magic escapes not being
3895 3904 correctly set.
3896 3905
3897 3906 2004-10-08 Fernando Perez <fperez@colorado.edu>
3898 3907
3899 3908 * IPython/Magic.py (__license__): change to absolute imports of
3900 3909 ipython's own internal packages, to start adapting to the absolute
3901 3910 import requirement of PEP-328.
3902 3911
3903 3912 * IPython/genutils.py (__author__): Fix coding to utf-8 on all
3904 3913 files, and standardize author/license marks through the Release
3905 3914 module instead of having per/file stuff (except for files with
3906 3915 particular licenses, like the MIT/PSF-licensed codes).
3907 3916
3908 3917 * IPython/Debugger.py: remove dead code for python 2.1
3909 3918
3910 3919 2004-10-04 Fernando Perez <fperez@colorado.edu>
3911 3920
3912 3921 * IPython/iplib.py (ipmagic): New function for accessing magics
3913 3922 via a normal python function call.
3914 3923
3915 3924 * IPython/Magic.py (Magic.magic_magic): Change the magic escape
3916 3925 from '@' to '%', to accomodate the new @decorator syntax of python
3917 3926 2.4.
3918 3927
3919 3928 2004-09-29 Fernando Perez <fperez@colorado.edu>
3920 3929
3921 3930 * IPython/Shell.py (MatplotlibShellBase.use): Added a wrapper to
3922 3931 matplotlib.use to prevent running scripts which try to switch
3923 3932 interactive backends from within ipython. This will just crash
3924 3933 the python interpreter, so we can't allow it (but a detailed error
3925 3934 is given to the user).
3926 3935
3927 3936 2004-09-28 Fernando Perez <fperez@colorado.edu>
3928 3937
3929 3938 * IPython/Shell.py (MatplotlibShellBase.mplot_exec):
3930 3939 matplotlib-related fixes so that using @run with non-matplotlib
3931 3940 scripts doesn't pop up spurious plot windows. This requires
3932 3941 matplotlib >= 0.63, where I had to make some changes as well.
3933 3942
3934 3943 * IPython/ipmaker.py (make_IPython): update version requirement to
3935 3944 python 2.2.
3936 3945
3937 3946 * IPython/iplib.py (InteractiveShell.mainloop): Add an optional
3938 3947 banner arg for embedded customization.
3939 3948
3940 3949 * IPython/Magic.py (Magic.__init__): big cleanup to remove all
3941 3950 explicit uses of __IP as the IPython's instance name. Now things
3942 3951 are properly handled via the shell.name value. The actual code
3943 3952 is a bit ugly b/c I'm doing it via a global in Magic.py, but this
3944 3953 is much better than before. I'll clean things completely when the
3945 3954 magic stuff gets a real overhaul.
3946 3955
3947 3956 * ipython.1: small fixes, sent in by Jack Moffit. He also sent in
3948 3957 minor changes to debian dir.
3949 3958
3950 3959 * IPython/iplib.py (InteractiveShell.__init__): Fix adding a
3951 3960 pointer to the shell itself in the interactive namespace even when
3952 3961 a user-supplied dict is provided. This is needed for embedding
3953 3962 purposes (found by tests with Michel Sanner).
3954 3963
3955 3964 2004-09-27 Fernando Perez <fperez@colorado.edu>
3956 3965
3957 3966 * IPython/UserConfig/ipythonrc: remove []{} from
3958 3967 readline_remove_delims, so that things like [modname.<TAB> do
3959 3968 proper completion. This disables [].TAB, but that's a less common
3960 3969 case than module names in list comprehensions, for example.
3961 3970 Thanks to a report by Andrea Riciputi.
3962 3971
3963 3972 2004-09-09 Fernando Perez <fperez@colorado.edu>
3964 3973
3965 3974 * IPython/Shell.py (IPShellGTK.mainloop): reorder to avoid
3966 3975 blocking problems in win32 and osx. Fix by John.
3967 3976
3968 3977 2004-09-08 Fernando Perez <fperez@colorado.edu>
3969 3978
3970 3979 * IPython/Shell.py (IPShellWX.OnInit): Fix output redirection bug
3971 3980 for Win32 and OSX. Fix by John Hunter.
3972 3981
3973 3982 2004-08-30 *** Released version 0.6.3
3974 3983
3975 3984 2004-08-30 Fernando Perez <fperez@colorado.edu>
3976 3985
3977 3986 * setup.py (isfile): Add manpages to list of dependent files to be
3978 3987 updated.
3979 3988
3980 3989 2004-08-27 Fernando Perez <fperez@colorado.edu>
3981 3990
3982 3991 * IPython/Shell.py (start): I've disabled -wthread and -gthread
3983 3992 for now. They don't really work with standalone WX/GTK code
3984 3993 (though matplotlib IS working fine with both of those backends).
3985 3994 This will neeed much more testing. I disabled most things with
3986 3995 comments, so turning it back on later should be pretty easy.
3987 3996
3988 3997 * IPython/iplib.py (InteractiveShell.__init__): Fix accidental
3989 3998 autocalling of expressions like r'foo', by modifying the line
3990 3999 split regexp. Closes
3991 4000 http://www.scipy.net/roundup/ipython/issue18, reported by Nicholas
3992 4001 Riley <ipythonbugs-AT-sabi.net>.
3993 4002 (InteractiveShell.mainloop): honor --nobanner with banner
3994 4003 extensions.
3995 4004
3996 4005 * IPython/Shell.py: Significant refactoring of all classes, so
3997 4006 that we can really support ALL matplotlib backends and threading
3998 4007 models (John spotted a bug with Tk which required this). Now we
3999 4008 should support single-threaded, WX-threads and GTK-threads, both
4000 4009 for generic code and for matplotlib.
4001 4010
4002 4011 * IPython/ipmaker.py (__call__): Changed -mpthread option to
4003 4012 -pylab, to simplify things for users. Will also remove the pylab
4004 4013 profile, since now all of matplotlib configuration is directly
4005 4014 handled here. This also reduces startup time.
4006 4015
4007 4016 * IPython/Shell.py (IPShellGTK.run): Fixed bug where mainloop() of
4008 4017 shell wasn't being correctly called. Also in IPShellWX.
4009 4018
4010 4019 * IPython/iplib.py (InteractiveShell.__init__): Added option to
4011 4020 fine-tune banner.
4012 4021
4013 4022 * IPython/numutils.py (spike): Deprecate these spike functions,
4014 4023 delete (long deprecated) gnuplot_exec handler.
4015 4024
4016 4025 2004-08-26 Fernando Perez <fperez@colorado.edu>
4017 4026
4018 4027 * ipython.1: Update for threading options, plus some others which
4019 4028 were missing.
4020 4029
4021 4030 * IPython/ipmaker.py (__call__): Added -wthread option for
4022 4031 wxpython thread handling. Make sure threading options are only
4023 4032 valid at the command line.
4024 4033
4025 4034 * scripts/ipython: moved shell selection into a factory function
4026 4035 in Shell.py, to keep the starter script to a minimum.
4027 4036
4028 4037 2004-08-25 Fernando Perez <fperez@colorado.edu>
4029 4038
4030 4039 * IPython/Shell.py (IPShellWX.wxexit): fixes to WX threading, by
4031 4040 John. Along with some recent changes he made to matplotlib, the
4032 4041 next versions of both systems should work very well together.
4033 4042
4034 4043 2004-08-24 Fernando Perez <fperez@colorado.edu>
4035 4044
4036 4045 * IPython/Magic.py (Magic.magic_prun): cleanup some dead code. I
4037 4046 tried to switch the profiling to using hotshot, but I'm getting
4038 4047 strange errors from prof.runctx() there. I may be misreading the
4039 4048 docs, but it looks weird. For now the profiling code will
4040 4049 continue to use the standard profiler.
4041 4050
4042 4051 2004-08-23 Fernando Perez <fperez@colorado.edu>
4043 4052
4044 4053 * IPython/Shell.py (IPShellWX.__init__): Improvements to the WX
4045 4054 threaded shell, by John Hunter. It's not quite ready yet, but
4046 4055 close.
4047 4056
4048 4057 2004-08-22 Fernando Perez <fperez@colorado.edu>
4049 4058
4050 4059 * IPython/iplib.py (InteractiveShell.interact): tab cleanups, also
4051 4060 in Magic and ultraTB.
4052 4061
4053 4062 * ipython.1: document threading options in manpage.
4054 4063
4055 4064 * scripts/ipython: Changed name of -thread option to -gthread,
4056 4065 since this is GTK specific. I want to leave the door open for a
4057 4066 -wthread option for WX, which will most likely be necessary. This
4058 4067 change affects usage and ipmaker as well.
4059 4068
4060 4069 * IPython/Shell.py (matplotlib_shell): Add a factory function to
4061 4070 handle the matplotlib shell issues. Code by John Hunter
4062 4071 <jdhunter-AT-nitace.bsd.uchicago.edu>.
4063 4072 (IPShellMatplotlibWX.__init__): Rudimentary WX support. It's
4064 4073 broken (and disabled for end users) for now, but it puts the
4065 4074 infrastructure in place.
4066 4075
4067 4076 2004-08-21 Fernando Perez <fperez@colorado.edu>
4068 4077
4069 4078 * ipythonrc-pylab: Add matplotlib support.
4070 4079
4071 4080 * matplotlib_config.py: new files for matplotlib support, part of
4072 4081 the pylab profile.
4073 4082
4074 4083 * IPython/usage.py (__doc__): documented the threading options.
4075 4084
4076 4085 2004-08-20 Fernando Perez <fperez@colorado.edu>
4077 4086
4078 4087 * ipython: Modified the main calling routine to handle the -thread
4079 4088 and -mpthread options. This needs to be done as a top-level hack,
4080 4089 because it determines which class to instantiate for IPython
4081 4090 itself.
4082 4091
4083 4092 * IPython/Shell.py (MTInteractiveShell.__init__): New set of
4084 4093 classes to support multithreaded GTK operation without blocking,
4085 4094 and matplotlib with all backends. This is a lot of still very
4086 4095 experimental code, and threads are tricky. So it may still have a
4087 4096 few rough edges... This code owes a lot to
4088 4097 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65109, by
4089 4098 Brian # McErlean and John Finlay, to Antoon Pardon for fixes, and
4090 4099 to John Hunter for all the matplotlib work.
4091 4100
4092 4101 * IPython/ipmaker.py (__call__): Added -thread and -mpthread
4093 4102 options for gtk thread and matplotlib support.
4094 4103
4095 4104 2004-08-16 Fernando Perez <fperez@colorado.edu>
4096 4105
4097 4106 * IPython/iplib.py (InteractiveShell.__init__): don't trigger
4098 4107 autocall for things like p*q,p/q,p+q,p-q, when p is callable. Bug
4099 4108 reported by Stephen Walton <stephen.walton-AT-csun.edu>.
4100 4109
4101 4110 2004-08-11 Fernando Perez <fperez@colorado.edu>
4102 4111
4103 4112 * setup.py (isfile): Fix build so documentation gets updated for
4104 4113 rpms (it was only done for .tgz builds).
4105 4114
4106 4115 2004-08-10 Fernando Perez <fperez@colorado.edu>
4107 4116
4108 4117 * genutils.py (Term): Fix misspell of stdin stream (sin->cin).
4109 4118
4110 4119 * iplib.py : Silence syntax error exceptions in tab-completion.
4111 4120
4112 4121 2004-08-05 Fernando Perez <fperez@colorado.edu>
4113 4122
4114 4123 * IPython/Prompts.py (Prompt2.set_colors): Fix incorrectly set
4115 4124 'color off' mark for continuation prompts. This was causing long
4116 4125 continuation lines to mis-wrap.
4117 4126
4118 4127 2004-08-01 Fernando Perez <fperez@colorado.edu>
4119 4128
4120 4129 * IPython/ipmaker.py (make_IPython): Allow the shell class used
4121 4130 for building ipython to be a parameter. All this is necessary
4122 4131 right now to have a multithreaded version, but this insane
4123 4132 non-design will be cleaned up soon. For now, it's a hack that
4124 4133 works.
4125 4134
4126 4135 * IPython/Shell.py (IPShell.__init__): Stop using mutable default
4127 4136 args in various places. No bugs so far, but it's a dangerous
4128 4137 practice.
4129 4138
4130 4139 2004-07-31 Fernando Perez <fperez@colorado.edu>
4131 4140
4132 4141 * IPython/iplib.py (complete): ignore SyntaxError exceptions to
4133 4142 fix completion of files with dots in their names under most
4134 4143 profiles (pysh was OK because the completion order is different).
4135 4144
4136 4145 2004-07-27 Fernando Perez <fperez@colorado.edu>
4137 4146
4138 4147 * IPython/iplib.py (InteractiveShell.__init__): build dict of
4139 4148 keywords manually, b/c the one in keyword.py was removed in python
4140 4149 2.4. Patch by Anakim Border <aborder-AT-users.sourceforge.net>.
4141 4150 This is NOT a bug under python 2.3 and earlier.
4142 4151
4143 4152 2004-07-26 Fernando Perez <fperez@colorado.edu>
4144 4153
4145 4154 * IPython/ultraTB.py (VerboseTB.text): Add another
4146 4155 linecache.checkcache() call to try to prevent inspect.py from
4147 4156 crashing under python 2.3. I think this fixes
4148 4157 http://www.scipy.net/roundup/ipython/issue17.
4149 4158
4150 4159 2004-07-26 *** Released version 0.6.2
4151 4160
4152 4161 2004-07-26 Fernando Perez <fperez@colorado.edu>
4153 4162
4154 4163 * IPython/Magic.py (Magic.magic_cd): Fix bug where 'cd -N' would
4155 4164 fail for any number.
4156 4165 (Magic.magic_bookmark): Fix bug where 'bookmark -l' would fail for
4157 4166 empty bookmarks.
4158 4167
4159 4168 2004-07-26 *** Released version 0.6.1
4160 4169
4161 4170 2004-07-26 Fernando Perez <fperez@colorado.edu>
4162 4171
4163 4172 * ipython_win_post_install.py (run): Added pysh shortcut for Windows.
4164 4173
4165 4174 * IPython/iplib.py (protect_filename): Applied Ville's patch for
4166 4175 escaping '()[]{}' in filenames.
4167 4176
4168 4177 * IPython/Magic.py (shlex_split): Fix handling of '*' and '?' for
4169 4178 Python 2.2 users who lack a proper shlex.split.
4170 4179
4171 4180 2004-07-19 Fernando Perez <fperez@colorado.edu>
4172 4181
4173 4182 * IPython/iplib.py (InteractiveShell.init_readline): Add support
4174 4183 for reading readline's init file. I follow the normal chain:
4175 4184 $INPUTRC is honored, otherwise ~/.inputrc is used. Thanks to a
4176 4185 report by Mike Heeter. This closes
4177 4186 http://www.scipy.net/roundup/ipython/issue16.
4178 4187
4179 4188 2004-07-18 Fernando Perez <fperez@colorado.edu>
4180 4189
4181 4190 * IPython/iplib.py (__init__): Add better handling of '\' under
4182 4191 Win32 for filenames. After a patch by Ville.
4183 4192
4184 4193 2004-07-17 Fernando Perez <fperez@colorado.edu>
4185 4194
4186 4195 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
4187 4196 autocalling would be triggered for 'foo is bar' if foo is
4188 4197 callable. I also cleaned up the autocall detection code to use a
4189 4198 regexp, which is faster. Bug reported by Alexander Schmolck.
4190 4199
4191 4200 * IPython/Magic.py (Magic.magic_pinfo): Fix bug where strings with
4192 4201 '?' in them would confuse the help system. Reported by Alex
4193 4202 Schmolck.
4194 4203
4195 4204 2004-07-16 Fernando Perez <fperez@colorado.edu>
4196 4205
4197 4206 * IPython/GnuplotInteractive.py (__all__): added plot2.
4198 4207
4199 4208 * IPython/Gnuplot2.py (Gnuplot.plot2): added new function for
4200 4209 plotting dictionaries, lists or tuples of 1d arrays.
4201 4210
4202 4211 * IPython/Magic.py (Magic.magic_hist): small clenaups and
4203 4212 optimizations.
4204 4213
4205 4214 * IPython/iplib.py:Remove old Changelog info for cleanup. This is
4206 4215 the information which was there from Janko's original IPP code:
4207 4216
4208 4217 03.05.99 20:53 porto.ifm.uni-kiel.de
4209 4218 --Started changelog.
4210 4219 --make clear do what it say it does
4211 4220 --added pretty output of lines from inputcache
4212 4221 --Made Logger a mixin class, simplifies handling of switches
4213 4222 --Added own completer class. .string<TAB> expands to last history
4214 4223 line which starts with string. The new expansion is also present
4215 4224 with Ctrl-r from the readline library. But this shows, who this
4216 4225 can be done for other cases.
4217 4226 --Added convention that all shell functions should accept a
4218 4227 parameter_string This opens the door for different behaviour for
4219 4228 each function. @cd is a good example of this.
4220 4229
4221 4230 04.05.99 12:12 porto.ifm.uni-kiel.de
4222 4231 --added logfile rotation
4223 4232 --added new mainloop method which freezes first the namespace
4224 4233
4225 4234 07.05.99 21:24 porto.ifm.uni-kiel.de
4226 4235 --added the docreader classes. Now there is a help system.
4227 4236 -This is only a first try. Currently it's not easy to put new
4228 4237 stuff in the indices. But this is the way to go. Info would be
4229 4238 better, but HTML is every where and not everybody has an info
4230 4239 system installed and it's not so easy to change html-docs to info.
4231 4240 --added global logfile option
4232 4241 --there is now a hook for object inspection method pinfo needs to
4233 4242 be provided for this. Can be reached by two '??'.
4234 4243
4235 4244 08.05.99 20:51 porto.ifm.uni-kiel.de
4236 4245 --added a README
4237 4246 --bug in rc file. Something has changed so functions in the rc
4238 4247 file need to reference the shell and not self. Not clear if it's a
4239 4248 bug or feature.
4240 4249 --changed rc file for new behavior
4241 4250
4242 4251 2004-07-15 Fernando Perez <fperez@colorado.edu>
4243 4252
4244 4253 * IPython/Logger.py (Logger.log): fixed recent bug where the input
4245 4254 cache was falling out of sync in bizarre manners when multi-line
4246 4255 input was present. Minor optimizations and cleanup.
4247 4256
4248 4257 (Logger): Remove old Changelog info for cleanup. This is the
4249 4258 information which was there from Janko's original code:
4250 4259
4251 4260 Changes to Logger: - made the default log filename a parameter
4252 4261
4253 4262 - put a check for lines beginning with !@? in log(). Needed
4254 4263 (even if the handlers properly log their lines) for mid-session
4255 4264 logging activation to work properly. Without this, lines logged
4256 4265 in mid session, which get read from the cache, would end up
4257 4266 'bare' (with !@? in the open) in the log. Now they are caught
4258 4267 and prepended with a #.
4259 4268
4260 4269 * IPython/iplib.py (InteractiveShell.init_readline): added check
4261 4270 in case MagicCompleter fails to be defined, so we don't crash.
4262 4271
4263 4272 2004-07-13 Fernando Perez <fperez@colorado.edu>
4264 4273
4265 4274 * IPython/Gnuplot2.py (Gnuplot.hardcopy): add automatic generation
4266 4275 of EPS if the requested filename ends in '.eps'.
4267 4276
4268 4277 2004-07-04 Fernando Perez <fperez@colorado.edu>
4269 4278
4270 4279 * IPython/iplib.py (InteractiveShell.handle_shell_escape): Fix
4271 4280 escaping of quotes when calling the shell.
4272 4281
4273 4282 2004-07-02 Fernando Perez <fperez@colorado.edu>
4274 4283
4275 4284 * IPython/Prompts.py (CachedOutput.update): Fix problem with
4276 4285 gettext not working because we were clobbering '_'. Fixes
4277 4286 http://www.scipy.net/roundup/ipython/issue6.
4278 4287
4279 4288 2004-07-01 Fernando Perez <fperez@colorado.edu>
4280 4289
4281 4290 * IPython/Magic.py (Magic.magic_cd): integrated bookmark handling
4282 4291 into @cd. Patch by Ville.
4283 4292
4284 4293 * IPython/iplib.py (InteractiveShell.post_config_initialization):
4285 4294 new function to store things after ipmaker runs. Patch by Ville.
4286 4295 Eventually this will go away once ipmaker is removed and the class
4287 4296 gets cleaned up, but for now it's ok. Key functionality here is
4288 4297 the addition of the persistent storage mechanism, a dict for
4289 4298 keeping data across sessions (for now just bookmarks, but more can
4290 4299 be implemented later).
4291 4300
4292 4301 * IPython/Magic.py (Magic.magic_bookmark): New bookmark system,
4293 4302 persistent across sections. Patch by Ville, I modified it
4294 4303 soemwhat to allow bookmarking arbitrary dirs other than CWD. Also
4295 4304 added a '-l' option to list all bookmarks.
4296 4305
4297 4306 * IPython/iplib.py (InteractiveShell.atexit_operations): new
4298 4307 center for cleanup. Registered with atexit.register(). I moved
4299 4308 here the old exit_cleanup(). After a patch by Ville.
4300 4309
4301 4310 * IPython/Magic.py (get_py_filename): added '~' to the accepted
4302 4311 characters in the hacked shlex_split for python 2.2.
4303 4312
4304 4313 * IPython/iplib.py (file_matches): more fixes to filenames with
4305 4314 whitespace in them. It's not perfect, but limitations in python's
4306 4315 readline make it impossible to go further.
4307 4316
4308 4317 2004-06-29 Fernando Perez <fperez@colorado.edu>
4309 4318
4310 4319 * IPython/iplib.py (file_matches): escape whitespace correctly in
4311 4320 filename completions. Bug reported by Ville.
4312 4321
4313 4322 2004-06-28 Fernando Perez <fperez@colorado.edu>
4314 4323
4315 4324 * IPython/ipmaker.py (__call__): Added per-profile histories. Now
4316 4325 the history file will be called 'history-PROFNAME' (or just
4317 4326 'history' if no profile is loaded). I was getting annoyed at
4318 4327 getting my Numerical work history clobbered by pysh sessions.
4319 4328
4320 4329 * IPython/iplib.py (InteractiveShell.__init__): Internal
4321 4330 getoutputerror() function so that we can honor the system_verbose
4322 4331 flag for _all_ system calls. I also added escaping of #
4323 4332 characters here to avoid confusing Itpl.
4324 4333
4325 4334 * IPython/Magic.py (shlex_split): removed call to shell in
4326 4335 parse_options and replaced it with shlex.split(). The annoying
4327 4336 part was that in Python 2.2, shlex.split() doesn't exist, so I had
4328 4337 to backport it from 2.3, with several frail hacks (the shlex
4329 4338 module is rather limited in 2.2). Thanks to a suggestion by Ville
4330 4339 Vainio <vivainio@kolumbus.fi>. For Python 2.3 there should be no
4331 4340 problem.
4332 4341
4333 4342 (Magic.magic_system_verbose): new toggle to print the actual
4334 4343 system calls made by ipython. Mainly for debugging purposes.
4335 4344
4336 4345 * IPython/GnuplotRuntime.py (gnu_out): fix bug for cygwin, which
4337 4346 doesn't support persistence. Reported (and fix suggested) by
4338 4347 Travis Caldwell <travis_caldwell2000@yahoo.com>.
4339 4348
4340 4349 2004-06-26 Fernando Perez <fperez@colorado.edu>
4341 4350
4342 4351 * IPython/Logger.py (Logger.log): fix to handle correctly empty
4343 4352 continue prompts.
4344 4353
4345 4354 * IPython/Extensions/InterpreterExec.py (pysh): moved the pysh()
4346 4355 function (basically a big docstring) and a few more things here to
4347 4356 speedup startup. pysh.py is now very lightweight. We want because
4348 4357 it gets execfile'd, while InterpreterExec gets imported, so
4349 4358 byte-compilation saves time.
4350 4359
4351 4360 2004-06-25 Fernando Perez <fperez@colorado.edu>
4352 4361
4353 4362 * IPython/Magic.py (Magic.magic_cd): Fixed to restore usage of 'cd
4354 4363 -NUM', which was recently broken.
4355 4364
4356 4365 * IPython/iplib.py (InteractiveShell.handle_shell_escape): allow !
4357 4366 in multi-line input (but not !!, which doesn't make sense there).
4358 4367
4359 4368 * IPython/UserConfig/ipythonrc: made autoindent on by default.
4360 4369 It's just too useful, and people can turn it off in the less
4361 4370 common cases where it's a problem.
4362 4371
4363 4372 2004-06-24 Fernando Perez <fperez@colorado.edu>
4364 4373
4365 4374 * IPython/iplib.py (InteractiveShell._prefilter): big change -
4366 4375 special syntaxes (like alias calling) is now allied in multi-line
4367 4376 input. This is still _very_ experimental, but it's necessary for
4368 4377 efficient shell usage combining python looping syntax with system
4369 4378 calls. For now it's restricted to aliases, I don't think it
4370 4379 really even makes sense to have this for magics.
4371 4380
4372 4381 2004-06-23 Fernando Perez <fperez@colorado.edu>
4373 4382
4374 4383 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Added
4375 4384 $var=cmd <=> @sc var=cmd and $$var=cmd <=> @sc -l var=cmd.
4376 4385
4377 4386 * IPython/Magic.py (Magic.magic_rehashx): modified to handle
4378 4387 extensions under Windows (after code sent by Gary Bishop). The
4379 4388 extensions considered 'executable' are stored in IPython's rc
4380 4389 structure as win_exec_ext.
4381 4390
4382 4391 * IPython/genutils.py (shell): new function, like system() but
4383 4392 without return value. Very useful for interactive shell work.
4384 4393
4385 4394 * IPython/Magic.py (Magic.magic_unalias): New @unalias function to
4386 4395 delete aliases.
4387 4396
4388 4397 * IPython/iplib.py (InteractiveShell.alias_table_update): make
4389 4398 sure that the alias table doesn't contain python keywords.
4390 4399
4391 4400 2004-06-21 Fernando Perez <fperez@colorado.edu>
4392 4401
4393 4402 * IPython/Magic.py (Magic.magic_rehash): Fix crash when
4394 4403 non-existent items are found in $PATH. Reported by Thorsten.
4395 4404
4396 4405 2004-06-20 Fernando Perez <fperez@colorado.edu>
4397 4406
4398 4407 * IPython/iplib.py (complete): modified the completer so that the
4399 4408 order of priorities can be easily changed at runtime.
4400 4409
4401 4410 * IPython/Extensions/InterpreterExec.py (prefilter_shell):
4402 4411 Modified to auto-execute all lines beginning with '~', '/' or '.'.
4403 4412
4404 4413 * IPython/Magic.py (Magic.magic_sx): modified @sc and @sx to
4405 4414 expand Python variables prepended with $ in all system calls. The
4406 4415 same was done to InteractiveShell.handle_shell_escape. Now all
4407 4416 system access mechanisms (!, !!, @sc, @sx and aliases) allow the
4408 4417 expansion of python variables and expressions according to the
4409 4418 syntax of PEP-215 - http://www.python.org/peps/pep-0215.html.
4410 4419
4411 4420 Though PEP-215 has been rejected, a similar (but simpler) one
4412 4421 seems like it will go into Python 2.4, PEP-292 -
4413 4422 http://www.python.org/peps/pep-0292.html.
4414 4423
4415 4424 I'll keep the full syntax of PEP-215, since IPython has since the
4416 4425 start used Ka-Ping Yee's reference implementation discussed there
4417 4426 (Itpl), and I actually like the powerful semantics it offers.
4418 4427
4419 4428 In order to access normal shell variables, the $ has to be escaped
4420 4429 via an extra $. For example:
4421 4430
4422 4431 In [7]: PATH='a python variable'
4423 4432
4424 4433 In [8]: !echo $PATH
4425 4434 a python variable
4426 4435
4427 4436 In [9]: !echo $$PATH
4428 4437 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
4429 4438
4430 4439 (Magic.parse_options): escape $ so the shell doesn't evaluate
4431 4440 things prematurely.
4432 4441
4433 4442 * IPython/iplib.py (InteractiveShell.call_alias): added the
4434 4443 ability for aliases to expand python variables via $.
4435 4444
4436 4445 * IPython/Magic.py (Magic.magic_rehash): based on the new alias
4437 4446 system, now there's a @rehash/@rehashx pair of magics. These work
4438 4447 like the csh rehash command, and can be invoked at any time. They
4439 4448 build a table of aliases to everything in the user's $PATH
4440 4449 (@rehash uses everything, @rehashx is slower but only adds
4441 4450 executable files). With this, the pysh.py-based shell profile can
4442 4451 now simply call rehash upon startup, and full access to all
4443 4452 programs in the user's path is obtained.
4444 4453
4445 4454 * IPython/iplib.py (InteractiveShell.call_alias): The new alias
4446 4455 functionality is now fully in place. I removed the old dynamic
4447 4456 code generation based approach, in favor of a much lighter one
4448 4457 based on a simple dict. The advantage is that this allows me to
4449 4458 now have thousands of aliases with negligible cost (unthinkable
4450 4459 with the old system).
4451 4460
4452 4461 2004-06-19 Fernando Perez <fperez@colorado.edu>
4453 4462
4454 4463 * IPython/iplib.py (__init__): extended MagicCompleter class to
4455 4464 also complete (last in priority) on user aliases.
4456 4465
4457 4466 * IPython/Itpl.py (Itpl.__str__): fixed order of globals/locals in
4458 4467 call to eval.
4459 4468 (ItplNS.__init__): Added a new class which functions like Itpl,
4460 4469 but allows configuring the namespace for the evaluation to occur
4461 4470 in.
4462 4471
4463 4472 2004-06-18 Fernando Perez <fperez@colorado.edu>
4464 4473
4465 4474 * IPython/iplib.py (InteractiveShell.runcode): modify to print a
4466 4475 better message when 'exit' or 'quit' are typed (a common newbie
4467 4476 confusion).
4468 4477
4469 4478 * IPython/Magic.py (Magic.magic_colors): Added the runtime color
4470 4479 check for Windows users.
4471 4480
4472 4481 * IPython/iplib.py (InteractiveShell.user_setup): removed
4473 4482 disabling of colors for Windows. I'll test at runtime and issue a
4474 4483 warning if Gary's readline isn't found, as to nudge users to
4475 4484 download it.
4476 4485
4477 4486 2004-06-16 Fernando Perez <fperez@colorado.edu>
4478 4487
4479 4488 * IPython/genutils.py (Stream.__init__): changed to print errors
4480 4489 to sys.stderr. I had a circular dependency here. Now it's
4481 4490 possible to run ipython as IDLE's shell (consider this pre-alpha,
4482 4491 since true stdout things end up in the starting terminal instead
4483 4492 of IDLE's out).
4484 4493
4485 4494 * IPython/Prompts.py (Prompt2.set_colors): prevent crashes for
4486 4495 users who haven't # updated their prompt_in2 definitions. Remove
4487 4496 eventually.
4488 4497 (multiple_replace): added credit to original ASPN recipe.
4489 4498
4490 4499 2004-06-15 Fernando Perez <fperez@colorado.edu>
4491 4500
4492 4501 * IPython/iplib.py (InteractiveShell.__init__): add 'cp' to the
4493 4502 list of auto-defined aliases.
4494 4503
4495 4504 2004-06-13 Fernando Perez <fperez@colorado.edu>
4496 4505
4497 4506 * setup.py (scriptfiles): Don't trigger win_post_install unless an
4498 4507 install was really requested (so setup.py can be used for other
4499 4508 things under Windows).
4500 4509
4501 4510 2004-06-10 Fernando Perez <fperez@colorado.edu>
4502 4511
4503 4512 * IPython/Logger.py (Logger.create_log): Manually remove any old
4504 4513 backup, since os.remove may fail under Windows. Fixes bug
4505 4514 reported by Thorsten.
4506 4515
4507 4516 2004-06-09 Fernando Perez <fperez@colorado.edu>
4508 4517
4509 4518 * examples/example-embed.py: fixed all references to %n (replaced
4510 4519 with \\# for ps1/out prompts and with \\D for ps2 prompts). Done
4511 4520 for all examples and the manual as well.
4512 4521
4513 4522 2004-06-08 Fernando Perez <fperez@colorado.edu>
4514 4523
4515 4524 * IPython/Prompts.py (Prompt2.set_p_str): fixed all prompt
4516 4525 alignment and color management. All 3 prompt subsystems now
4517 4526 inherit from BasePrompt.
4518 4527
4519 4528 * tools/release: updates for windows installer build and tag rpms
4520 4529 with python version (since paths are fixed).
4521 4530
4522 4531 * IPython/UserConfig/ipythonrc: modified to use \# instead of %n,
4523 4532 which will become eventually obsolete. Also fixed the default
4524 4533 prompt_in2 to use \D, so at least new users start with the correct
4525 4534 defaults.
4526 4535 WARNING: Users with existing ipythonrc files will need to apply
4527 4536 this fix manually!
4528 4537
4529 4538 * setup.py: make windows installer (.exe). This is finally the
4530 4539 integration of an old patch by Cory Dodt <dodt-AT-fcoe.k12.ca.us>,
4531 4540 which I hadn't included because it required Python 2.3 (or recent
4532 4541 distutils).
4533 4542
4534 4543 * IPython/usage.py (__doc__): update docs (and manpage) to reflect
4535 4544 usage of new '\D' escape.
4536 4545
4537 4546 * IPython/Prompts.py (ROOT_SYMBOL): Small fix for Windows (which
4538 4547 lacks os.getuid())
4539 4548 (CachedOutput.set_colors): Added the ability to turn coloring
4540 4549 on/off with @colors even for manually defined prompt colors. It
4541 4550 uses a nasty global, but it works safely and via the generic color
4542 4551 handling mechanism.
4543 4552 (Prompt2.__init__): Introduced new escape '\D' for continuation
4544 4553 prompts. It represents the counter ('\#') as dots.
4545 4554 *** NOTE *** THIS IS A BACKWARDS-INCOMPATIBLE CHANGE. Users will
4546 4555 need to update their ipythonrc files and replace '%n' with '\D' in
4547 4556 their prompt_in2 settings everywhere. Sorry, but there's
4548 4557 otherwise no clean way to get all prompts to properly align. The
4549 4558 ipythonrc shipped with IPython has been updated.
4550 4559
4551 4560 2004-06-07 Fernando Perez <fperez@colorado.edu>
4552 4561
4553 4562 * setup.py (isfile): Pass local_icons option to latex2html, so the
4554 4563 resulting HTML file is self-contained. Thanks to
4555 4564 dryice-AT-liu.com.cn for the tip.
4556 4565
4557 4566 * pysh.py: I created a new profile 'shell', which implements a
4558 4567 _rudimentary_ IPython-based shell. This is in NO WAY a realy
4559 4568 system shell, nor will it become one anytime soon. It's mainly
4560 4569 meant to illustrate the use of the new flexible bash-like prompts.
4561 4570 I guess it could be used by hardy souls for true shell management,
4562 4571 but it's no tcsh/bash... pysh.py is loaded by the 'shell'
4563 4572 profile. This uses the InterpreterExec extension provided by
4564 4573 W.J. van der Laan <gnufnork-AT-hetdigitalegat.nl>
4565 4574
4566 4575 * IPython/Prompts.py (PromptOut.__str__): now it will correctly
4567 4576 auto-align itself with the length of the previous input prompt
4568 4577 (taking into account the invisible color escapes).
4569 4578 (CachedOutput.__init__): Large restructuring of this class. Now
4570 4579 all three prompts (primary1, primary2, output) are proper objects,
4571 4580 managed by the 'parent' CachedOutput class. The code is still a
4572 4581 bit hackish (all prompts share state via a pointer to the cache),
4573 4582 but it's overall far cleaner than before.
4574 4583
4575 4584 * IPython/genutils.py (getoutputerror): modified to add verbose,
4576 4585 debug and header options. This makes the interface of all getout*
4577 4586 functions uniform.
4578 4587 (SystemExec.getoutputerror): added getoutputerror to SystemExec.
4579 4588
4580 4589 * IPython/Magic.py (Magic.default_option): added a function to
4581 4590 allow registering default options for any magic command. This
4582 4591 makes it easy to have profiles which customize the magics globally
4583 4592 for a certain use. The values set through this function are
4584 4593 picked up by the parse_options() method, which all magics should
4585 4594 use to parse their options.
4586 4595
4587 4596 * IPython/genutils.py (warn): modified the warnings framework to
4588 4597 use the Term I/O class. I'm trying to slowly unify all of
4589 4598 IPython's I/O operations to pass through Term.
4590 4599
4591 4600 * IPython/Prompts.py (Prompt2._str_other): Added functionality in
4592 4601 the secondary prompt to correctly match the length of the primary
4593 4602 one for any prompt. Now multi-line code will properly line up
4594 4603 even for path dependent prompts, such as the new ones available
4595 4604 via the prompt_specials.
4596 4605
4597 4606 2004-06-06 Fernando Perez <fperez@colorado.edu>
4598 4607
4599 4608 * IPython/Prompts.py (prompt_specials): Added the ability to have
4600 4609 bash-like special sequences in the prompts, which get
4601 4610 automatically expanded. Things like hostname, current working
4602 4611 directory and username are implemented already, but it's easy to
4603 4612 add more in the future. Thanks to a patch by W.J. van der Laan
4604 4613 <gnufnork-AT-hetdigitalegat.nl>
4605 4614 (prompt_specials): Added color support for prompt strings, so
4606 4615 users can define arbitrary color setups for their prompts.
4607 4616
4608 4617 2004-06-05 Fernando Perez <fperez@colorado.edu>
4609 4618
4610 4619 * IPython/genutils.py (Term.reopen_all): Added Windows-specific
4611 4620 code to load Gary Bishop's readline and configure it
4612 4621 automatically. Thanks to Gary for help on this.
4613 4622
4614 4623 2004-06-01 Fernando Perez <fperez@colorado.edu>
4615 4624
4616 4625 * IPython/Logger.py (Logger.create_log): fix bug for logging
4617 4626 with no filename (previous fix was incomplete).
4618 4627
4619 4628 2004-05-25 Fernando Perez <fperez@colorado.edu>
4620 4629
4621 4630 * IPython/Magic.py (Magic.parse_options): fix bug where naked
4622 4631 parens would get passed to the shell.
4623 4632
4624 4633 2004-05-20 Fernando Perez <fperez@colorado.edu>
4625 4634
4626 4635 * IPython/Magic.py (Magic.magic_prun): changed default profile
4627 4636 sort order to 'time' (the more common profiling need).
4628 4637
4629 4638 * IPython/OInspect.py (Inspector.pinfo): flush the inspect cache
4630 4639 so that source code shown is guaranteed in sync with the file on
4631 4640 disk (also changed in psource). Similar fix to the one for
4632 4641 ultraTB on 2004-05-06. Thanks to a bug report by Yann Le Du
4633 4642 <yann.ledu-AT-noos.fr>.
4634 4643
4635 4644 * IPython/Magic.py (Magic.parse_options): Fixed bug where commands
4636 4645 with a single option would not be correctly parsed. Closes
4637 4646 http://www.scipy.net/roundup/ipython/issue14. This bug had been
4638 4647 introduced in 0.6.0 (on 2004-05-06).
4639 4648
4640 4649 2004-05-13 *** Released version 0.6.0
4641 4650
4642 4651 2004-05-13 Fernando Perez <fperez@colorado.edu>
4643 4652
4644 4653 * debian/: Added debian/ directory to CVS, so that debian support
4645 4654 is publicly accessible. The debian package is maintained by Jack
4646 4655 Moffit <jack-AT-xiph.org>.
4647 4656
4648 4657 * Documentation: included the notes about an ipython-based system
4649 4658 shell (the hypothetical 'pysh') into the new_design.pdf document,
4650 4659 so that these ideas get distributed to users along with the
4651 4660 official documentation.
4652 4661
4653 4662 2004-05-10 Fernando Perez <fperez@colorado.edu>
4654 4663
4655 4664 * IPython/Logger.py (Logger.create_log): fix recently introduced
4656 4665 bug (misindented line) where logstart would fail when not given an
4657 4666 explicit filename.
4658 4667
4659 4668 2004-05-09 Fernando Perez <fperez@colorado.edu>
4660 4669
4661 4670 * IPython/Magic.py (Magic.parse_options): skip system call when
4662 4671 there are no options to look for. Faster, cleaner for the common
4663 4672 case.
4664 4673
4665 4674 * Documentation: many updates to the manual: describing Windows
4666 4675 support better, Gnuplot updates, credits, misc small stuff. Also
4667 4676 updated the new_design doc a bit.
4668 4677
4669 4678 2004-05-06 *** Released version 0.6.0.rc1
4670 4679
4671 4680 2004-05-06 Fernando Perez <fperez@colorado.edu>
4672 4681
4673 4682 * IPython/ultraTB.py (ListTB.text): modified a ton of string +=
4674 4683 operations to use the vastly more efficient list/''.join() method.
4675 4684 (FormattedTB.text): Fix
4676 4685 http://www.scipy.net/roundup/ipython/issue12 - exception source
4677 4686 extract not updated after reload. Thanks to Mike Salib
4678 4687 <msalib-AT-mit.edu> for pinning the source of the problem.
4679 4688 Fortunately, the solution works inside ipython and doesn't require
4680 4689 any changes to python proper.
4681 4690
4682 4691 * IPython/Magic.py (Magic.parse_options): Improved to process the
4683 4692 argument list as a true shell would (by actually using the
4684 4693 underlying system shell). This way, all @magics automatically get
4685 4694 shell expansion for variables. Thanks to a comment by Alex
4686 4695 Schmolck.
4687 4696
4688 4697 2004-04-04 Fernando Perez <fperez@colorado.edu>
4689 4698
4690 4699 * IPython/iplib.py (InteractiveShell.interact): Added a special
4691 4700 trap for a debugger quit exception, which is basically impossible
4692 4701 to handle by normal mechanisms, given what pdb does to the stack.
4693 4702 This fixes a crash reported by <fgibbons-AT-llama.med.harvard.edu>.
4694 4703
4695 4704 2004-04-03 Fernando Perez <fperez@colorado.edu>
4696 4705
4697 4706 * IPython/genutils.py (Term): Standardized the names of the Term
4698 4707 class streams to cin/cout/cerr, following C++ naming conventions
4699 4708 (I can't use in/out/err because 'in' is not a valid attribute
4700 4709 name).
4701 4710
4702 4711 * IPython/iplib.py (InteractiveShell.interact): don't increment
4703 4712 the prompt if there's no user input. By Daniel 'Dang' Griffith
4704 4713 <pythondev-dang-AT-lazytwinacres.net>, after a suggestion from
4705 4714 Francois Pinard.
4706 4715
4707 4716 2004-04-02 Fernando Perez <fperez@colorado.edu>
4708 4717
4709 4718 * IPython/genutils.py (Stream.__init__): Modified to survive at
4710 4719 least importing in contexts where stdin/out/err aren't true file
4711 4720 objects, such as PyCrust (they lack fileno() and mode). However,
4712 4721 the recovery facilities which rely on these things existing will
4713 4722 not work.
4714 4723
4715 4724 2004-04-01 Fernando Perez <fperez@colorado.edu>
4716 4725
4717 4726 * IPython/Magic.py (Magic.magic_sx): modified (as well as @sc) to
4718 4727 use the new getoutputerror() function, so it properly
4719 4728 distinguishes stdout/err.
4720 4729
4721 4730 * IPython/genutils.py (getoutputerror): added a function to
4722 4731 capture separately the standard output and error of a command.
4723 4732 After a comment from dang on the mailing lists. This code is
4724 4733 basically a modified version of commands.getstatusoutput(), from
4725 4734 the standard library.
4726 4735
4727 4736 * IPython/iplib.py (InteractiveShell.handle_shell_escape): added
4728 4737 '!!' as a special syntax (shorthand) to access @sx.
4729 4738
4730 4739 * IPython/Magic.py (Magic.magic_sx): new magic, to execute a shell
4731 4740 command and return its output as a list split on '\n'.
4732 4741
4733 4742 2004-03-31 Fernando Perez <fperez@colorado.edu>
4734 4743
4735 4744 * IPython/FakeModule.py (FakeModule.__init__): added __nonzero__
4736 4745 method to dictionaries used as FakeModule instances if they lack
4737 4746 it. At least pydoc in python2.3 breaks for runtime-defined
4738 4747 functions without this hack. At some point I need to _really_
4739 4748 understand what FakeModule is doing, because it's a gross hack.
4740 4749 But it solves Arnd's problem for now...
4741 4750
4742 4751 2004-02-27 Fernando Perez <fperez@colorado.edu>
4743 4752
4744 4753 * IPython/Logger.py (Logger.create_log): Fix bug where 'rotate'
4745 4754 mode would behave erratically. Also increased the number of
4746 4755 possible logs in rotate mod to 999. Thanks to Rod Holland
4747 4756 <rhh@StructureLABS.com> for the report and fixes.
4748 4757
4749 4758 2004-02-26 Fernando Perez <fperez@colorado.edu>
4750 4759
4751 4760 * IPython/genutils.py (page): Check that the curses module really
4752 4761 has the initscr attribute before trying to use it. For some
4753 4762 reason, the Solaris curses module is missing this. I think this
4754 4763 should be considered a Solaris python bug, but I'm not sure.
4755 4764
4756 4765 2004-01-17 Fernando Perez <fperez@colorado.edu>
4757 4766
4758 4767 * IPython/genutils.py (Stream.__init__): Changes to try to make
4759 4768 ipython robust against stdin/out/err being closed by the user.
4760 4769 This is 'user error' (and blocks a normal python session, at least
4761 4770 the stdout case). However, Ipython should be able to survive such
4762 4771 instances of abuse as gracefully as possible. To simplify the
4763 4772 coding and maintain compatibility with Gary Bishop's Term
4764 4773 contributions, I've made use of classmethods for this. I think
4765 4774 this introduces a dependency on python 2.2.
4766 4775
4767 4776 2004-01-13 Fernando Perez <fperez@colorado.edu>
4768 4777
4769 4778 * IPython/numutils.py (exp_safe): simplified the code a bit and
4770 4779 removed the need for importing the kinds module altogether.
4771 4780
4772 4781 2004-01-06 Fernando Perez <fperez@colorado.edu>
4773 4782
4774 4783 * IPython/Magic.py (Magic.magic_sc): Made the shell capture system
4775 4784 a magic function instead, after some community feedback. No
4776 4785 special syntax will exist for it, but its name is deliberately
4777 4786 very short.
4778 4787
4779 4788 2003-12-20 Fernando Perez <fperez@colorado.edu>
4780 4789
4781 4790 * IPython/iplib.py (InteractiveShell.handle_shell_assign): Added
4782 4791 new functionality, to automagically assign the result of a shell
4783 4792 command to a variable. I'll solicit some community feedback on
4784 4793 this before making it permanent.
4785 4794
4786 4795 * IPython/OInspect.py (Inspector.pinfo): Fix crash when info was
4787 4796 requested about callables for which inspect couldn't obtain a
4788 4797 proper argspec. Thanks to a crash report sent by Etienne
4789 4798 Posthumus <etienne-AT-apple01.cs.vu.nl>.
4790 4799
4791 4800 2003-12-09 Fernando Perez <fperez@colorado.edu>
4792 4801
4793 4802 * IPython/genutils.py (page): patch for the pager to work across
4794 4803 various versions of Windows. By Gary Bishop.
4795 4804
4796 4805 2003-12-04 Fernando Perez <fperez@colorado.edu>
4797 4806
4798 4807 * IPython/Gnuplot2.py (PlotItems): Fixes for working with
4799 4808 Gnuplot.py version 1.7, whose internal names changed quite a bit.
4800 4809 While I tested this and it looks ok, there may still be corner
4801 4810 cases I've missed.
4802 4811
4803 4812 2003-12-01 Fernando Perez <fperez@colorado.edu>
4804 4813
4805 4814 * IPython/iplib.py (InteractiveShell._prefilter): Fixed a bug
4806 4815 where a line like 'p,q=1,2' would fail because the automagic
4807 4816 system would be triggered for @p.
4808 4817
4809 4818 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): Tab-related
4810 4819 cleanups, code unmodified.
4811 4820
4812 4821 * IPython/genutils.py (Term): added a class for IPython to handle
4813 4822 output. In most cases it will just be a proxy for stdout/err, but
4814 4823 having this allows modifications to be made for some platforms,
4815 4824 such as handling color escapes under Windows. All of this code
4816 4825 was contributed by Gary Bishop, with minor modifications by me.
4817 4826 The actual changes affect many files.
4818 4827
4819 4828 2003-11-30 Fernando Perez <fperez@colorado.edu>
4820 4829
4821 4830 * IPython/iplib.py (file_matches): new completion code, courtesy
4822 4831 of Jeff Collins. This enables filename completion again under
4823 4832 python 2.3, which disabled it at the C level.
4824 4833
4825 4834 2003-11-11 Fernando Perez <fperez@colorado.edu>
4826 4835
4827 4836 * IPython/numutils.py (amap): Added amap() fn. Simple shorthand
4828 4837 for Numeric.array(map(...)), but often convenient.
4829 4838
4830 4839 2003-11-05 Fernando Perez <fperez@colorado.edu>
4831 4840
4832 4841 * IPython/numutils.py (frange): Changed a call from int() to
4833 4842 int(round()) to prevent a problem reported with arange() in the
4834 4843 numpy list.
4835 4844
4836 4845 2003-10-06 Fernando Perez <fperez@colorado.edu>
4837 4846
4838 4847 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): changed to
4839 4848 prevent crashes if sys lacks an argv attribute (it happens with
4840 4849 embedded interpreters which build a bare-bones sys module).
4841 4850 Thanks to a report/bugfix by Adam Hupp <hupp-AT-cs.wisc.edu>.
4842 4851
4843 4852 2003-09-24 Fernando Perez <fperez@colorado.edu>
4844 4853
4845 4854 * IPython/Magic.py (Magic._ofind): blanket except around getattr()
4846 4855 to protect against poorly written user objects where __getattr__
4847 4856 raises exceptions other than AttributeError. Thanks to a bug
4848 4857 report by Oliver Sander <osander-AT-gmx.de>.
4849 4858
4850 4859 * IPython/FakeModule.py (FakeModule.__repr__): this method was
4851 4860 missing. Thanks to bug report by Ralf Schmitt <ralf-AT-brainbot.com>.
4852 4861
4853 4862 2003-09-09 Fernando Perez <fperez@colorado.edu>
4854 4863
4855 4864 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
4856 4865 unpacking a list whith a callable as first element would
4857 4866 mistakenly trigger autocalling. Thanks to a bug report by Jeffery
4858 4867 Collins.
4859 4868
4860 4869 2003-08-25 *** Released version 0.5.0
4861 4870
4862 4871 2003-08-22 Fernando Perez <fperez@colorado.edu>
4863 4872
4864 4873 * IPython/ultraTB.py (VerboseTB.linereader): Improved handling of
4865 4874 improperly defined user exceptions. Thanks to feedback from Mark
4866 4875 Russell <mrussell-AT-verio.net>.
4867 4876
4868 4877 2003-08-20 Fernando Perez <fperez@colorado.edu>
4869 4878
4870 4879 * IPython/OInspect.py (Inspector.pinfo): changed String Form
4871 4880 printing so that it would print multi-line string forms starting
4872 4881 with a new line. This way the formatting is better respected for
4873 4882 objects which work hard to make nice string forms.
4874 4883
4875 4884 * IPython/iplib.py (InteractiveShell.handle_auto): Fix bug where
4876 4885 autocall would overtake data access for objects with both
4877 4886 __getitem__ and __call__.
4878 4887
4879 4888 2003-08-19 *** Released version 0.5.0-rc1
4880 4889
4881 4890 2003-08-19 Fernando Perez <fperez@colorado.edu>
4882 4891
4883 4892 * IPython/deep_reload.py (load_tail): single tiny change here
4884 4893 seems to fix the long-standing bug of dreload() failing to work
4885 4894 for dotted names. But this module is pretty tricky, so I may have
4886 4895 missed some subtlety. Needs more testing!.
4887 4896
4888 4897 * IPython/ultraTB.py (VerboseTB.linereader): harden against user
4889 4898 exceptions which have badly implemented __str__ methods.
4890 4899 (VerboseTB.text): harden against inspect.getinnerframes crashing,
4891 4900 which I've been getting reports about from Python 2.3 users. I
4892 4901 wish I had a simple test case to reproduce the problem, so I could
4893 4902 either write a cleaner workaround or file a bug report if
4894 4903 necessary.
4895 4904
4896 4905 * IPython/Magic.py (Magic.magic_edit): fixed bug where after
4897 4906 making a class 'foo', file 'foo.py' couldn't be edited. Thanks to
4898 4907 a bug report by Tjabo Kloppenburg.
4899 4908
4900 4909 * IPython/ultraTB.py (VerboseTB.debugger): hardened against pdb
4901 4910 crashes. Wrapped the pdb call in a blanket try/except, since pdb
4902 4911 seems rather unstable. Thanks to a bug report by Tjabo
4903 4912 Kloppenburg <tjabo.kloppenburg-AT-unix-ag.uni-siegen.de>.
4904 4913
4905 4914 * IPython/Release.py (version): release 0.5.0-rc1. I want to put
4906 4915 this out soon because of the critical fixes in the inner loop for
4907 4916 generators.
4908 4917
4909 4918 * IPython/Magic.py (Magic.getargspec): removed. This (and
4910 4919 _get_def) have been obsoleted by OInspect for a long time, I
4911 4920 hadn't noticed that they were dead code.
4912 4921 (Magic._ofind): restored _ofind functionality for a few literals
4913 4922 (those in ["''",'""','[]','{}','()']). But it won't work anymore
4914 4923 for things like "hello".capitalize?, since that would require a
4915 4924 potentially dangerous eval() again.
4916 4925
4917 4926 * IPython/iplib.py (InteractiveShell._prefilter): reorganized the
4918 4927 logic a bit more to clean up the escapes handling and minimize the
4919 4928 use of _ofind to only necessary cases. The interactive 'feel' of
4920 4929 IPython should have improved quite a bit with the changes in
4921 4930 _prefilter and _ofind (besides being far safer than before).
4922 4931
4923 4932 * IPython/Magic.py (Magic.magic_edit): Fixed old bug (but rather
4924 4933 obscure, never reported). Edit would fail to find the object to
4925 4934 edit under some circumstances.
4926 4935 (Magic._ofind): CRITICAL FIX. Finally removed the eval() calls
4927 4936 which were causing double-calling of generators. Those eval calls
4928 4937 were _very_ dangerous, since code with side effects could be
4929 4938 triggered. As they say, 'eval is evil'... These were the
4930 4939 nastiest evals in IPython. Besides, _ofind is now far simpler,
4931 4940 and it should also be quite a bit faster. Its use of inspect is
4932 4941 also safer, so perhaps some of the inspect-related crashes I've
4933 4942 seen lately with Python 2.3 might be taken care of. That will
4934 4943 need more testing.
4935 4944
4936 4945 2003-08-17 Fernando Perez <fperez@colorado.edu>
4937 4946
4938 4947 * IPython/iplib.py (InteractiveShell._prefilter): significant
4939 4948 simplifications to the logic for handling user escapes. Faster
4940 4949 and simpler code.
4941 4950
4942 4951 2003-08-14 Fernando Perez <fperez@colorado.edu>
4943 4952
4944 4953 * IPython/numutils.py (sum_flat): rewrote to be non-recursive.
4945 4954 Now it requires O(N) storage (N=size(a)) for non-contiguous input,
4946 4955 but it should be quite a bit faster. And the recursive version
4947 4956 generated O(log N) intermediate storage for all rank>1 arrays,
4948 4957 even if they were contiguous.
4949 4958 (l1norm): Added this function.
4950 4959 (norm): Added this function for arbitrary norms (including
4951 4960 l-infinity). l1 and l2 are still special cases for convenience
4952 4961 and speed.
4953 4962
4954 4963 2003-08-03 Fernando Perez <fperez@colorado.edu>
4955 4964
4956 4965 * IPython/Magic.py (Magic.magic_edit): Removed all remaining string
4957 4966 exceptions, which now raise PendingDeprecationWarnings in Python
4958 4967 2.3. There were some in Magic and some in Gnuplot2.
4959 4968
4960 4969 2003-06-30 Fernando Perez <fperez@colorado.edu>
4961 4970
4962 4971 * IPython/genutils.py (page): modified to call curses only for
4963 4972 terminals where TERM=='xterm'. After problems under many other
4964 4973 terminals were reported by Keith Beattie <KSBeattie-AT-lbl.gov>.
4965 4974
4966 4975 * IPython/iplib.py (complete): removed spurious 'print "IE"' which
4967 4976 would be triggered when readline was absent. This was just an old
4968 4977 debugging statement I'd forgotten to take out.
4969 4978
4970 4979 2003-06-20 Fernando Perez <fperez@colorado.edu>
4971 4980
4972 4981 * IPython/genutils.py (clock): modified to return only user time
4973 4982 (not counting system time), after a discussion on scipy. While
4974 4983 system time may be a useful quantity occasionally, it may much
4975 4984 more easily be skewed by occasional swapping or other similar
4976 4985 activity.
4977 4986
4978 4987 2003-06-05 Fernando Perez <fperez@colorado.edu>
4979 4988
4980 4989 * IPython/numutils.py (identity): new function, for building
4981 4990 arbitrary rank Kronecker deltas (mostly backwards compatible with
4982 4991 Numeric.identity)
4983 4992
4984 4993 2003-06-03 Fernando Perez <fperez@colorado.edu>
4985 4994
4986 4995 * IPython/iplib.py (InteractiveShell.handle_magic): protect
4987 4996 arguments passed to magics with spaces, to allow trailing '\' to
4988 4997 work normally (mainly for Windows users).
4989 4998
4990 4999 2003-05-29 Fernando Perez <fperez@colorado.edu>
4991 5000
4992 5001 * IPython/ipmaker.py (make_IPython): Load site._Helper() as help
4993 5002 instead of pydoc.help. This fixes a bizarre behavior where
4994 5003 printing '%s' % locals() would trigger the help system. Now
4995 5004 ipython behaves like normal python does.
4996 5005
4997 5006 Note that if one does 'from pydoc import help', the bizarre
4998 5007 behavior returns, but this will also happen in normal python, so
4999 5008 it's not an ipython bug anymore (it has to do with how pydoc.help
5000 5009 is implemented).
5001 5010
5002 5011 2003-05-22 Fernando Perez <fperez@colorado.edu>
5003 5012
5004 5013 * IPython/FlexCompleter.py (Completer.attr_matches): fixed to
5005 5014 return [] instead of None when nothing matches, also match to end
5006 5015 of line. Patch by Gary Bishop.
5007 5016
5008 5017 * IPython/ipmaker.py (make_IPython): Added same sys.excepthook
5009 5018 protection as before, for files passed on the command line. This
5010 5019 prevents the CrashHandler from kicking in if user files call into
5011 5020 sys.excepthook (such as PyQt and WxWindows have a nasty habit of
5012 5021 doing). After a report by Kasper Souren <Kasper.Souren-AT-ircam.fr>
5013 5022
5014 5023 2003-05-20 *** Released version 0.4.0
5015 5024
5016 5025 2003-05-20 Fernando Perez <fperez@colorado.edu>
5017 5026
5018 5027 * setup.py: added support for manpages. It's a bit hackish b/c of
5019 5028 a bug in the way the bdist_rpm distutils target handles gzipped
5020 5029 manpages, but it works. After a patch by Jack.
5021 5030
5022 5031 2003-05-19 Fernando Perez <fperez@colorado.edu>
5023 5032
5024 5033 * IPython/numutils.py: added a mockup of the kinds module, since
5025 5034 it was recently removed from Numeric. This way, numutils will
5026 5035 work for all users even if they are missing kinds.
5027 5036
5028 5037 * IPython/Magic.py (Magic._ofind): Harden against an inspect
5029 5038 failure, which can occur with SWIG-wrapped extensions. After a
5030 5039 crash report from Prabhu.
5031 5040
5032 5041 2003-05-16 Fernando Perez <fperez@colorado.edu>
5033 5042
5034 5043 * IPython/iplib.py (InteractiveShell.excepthook): New method to
5035 5044 protect ipython from user code which may call directly
5036 5045 sys.excepthook (this looks like an ipython crash to the user, even
5037 5046 when it isn't). After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
5038 5047 This is especially important to help users of WxWindows, but may
5039 5048 also be useful in other cases.
5040 5049
5041 5050 * IPython/ultraTB.py (AutoFormattedTB.__call__): Changed to allow
5042 5051 an optional tb_offset to be specified, and to preserve exception
5043 5052 info if given. After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
5044 5053
5045 5054 * ipython.1 (Default): Thanks to Jack's work, we now have manpages!
5046 5055
5047 5056 2003-05-15 Fernando Perez <fperez@colorado.edu>
5048 5057
5049 5058 * IPython/iplib.py (InteractiveShell.user_setup): Fix crash when
5050 5059 installing for a new user under Windows.
5051 5060
5052 5061 2003-05-12 Fernando Perez <fperez@colorado.edu>
5053 5062
5054 5063 * IPython/iplib.py (InteractiveShell.handle_emacs): New line
5055 5064 handler for Emacs comint-based lines. Currently it doesn't do
5056 5065 much (but importantly, it doesn't update the history cache). In
5057 5066 the future it may be expanded if Alex needs more functionality
5058 5067 there.
5059 5068
5060 5069 * IPython/CrashHandler.py (CrashHandler.__call__): Added platform
5061 5070 info to crash reports.
5062 5071
5063 5072 * IPython/iplib.py (InteractiveShell.mainloop): Added -c option,
5064 5073 just like Python's -c. Also fixed crash with invalid -color
5065 5074 option value at startup. Thanks to Will French
5066 5075 <wfrench-AT-bestweb.net> for the bug report.
5067 5076
5068 5077 2003-05-09 Fernando Perez <fperez@colorado.edu>
5069 5078
5070 5079 * IPython/genutils.py (EvalDict.__getitem__): Renamed EvalString
5071 5080 to EvalDict (it's a mapping, after all) and simplified its code
5072 5081 quite a bit, after a nice discussion on c.l.py where Gustavo
5073 5082 CΓ³rdova <gcordova-AT-sismex.com> suggested the new version.
5074 5083
5075 5084 2003-04-30 Fernando Perez <fperez@colorado.edu>
5076 5085
5077 5086 * IPython/genutils.py (timings_out): modified it to reduce its
5078 5087 overhead in the common reps==1 case.
5079 5088
5080 5089 2003-04-29 Fernando Perez <fperez@colorado.edu>
5081 5090
5082 5091 * IPython/genutils.py (timings_out): Modified to use the resource
5083 5092 module, which avoids the wraparound problems of time.clock().
5084 5093
5085 5094 2003-04-17 *** Released version 0.2.15pre4
5086 5095
5087 5096 2003-04-17 Fernando Perez <fperez@colorado.edu>
5088 5097
5089 5098 * setup.py (scriptfiles): Split windows-specific stuff over to a
5090 5099 separate file, in an attempt to have a Windows GUI installer.
5091 5100 That didn't work, but part of the groundwork is done.
5092 5101
5093 5102 * IPython/UserConfig/ipythonrc: Added M-i, M-o and M-I for
5094 5103 indent/unindent with 4 spaces. Particularly useful in combination
5095 5104 with the new auto-indent option.
5096 5105
5097 5106 2003-04-16 Fernando Perez <fperez@colorado.edu>
5098 5107
5099 5108 * IPython/Magic.py: various replacements of self.rc for
5100 5109 self.shell.rc. A lot more remains to be done to fully disentangle
5101 5110 this class from the main Shell class.
5102 5111
5103 5112 * IPython/GnuplotRuntime.py: added checks for mouse support so
5104 5113 that we don't try to enable it if the current gnuplot doesn't
5105 5114 really support it. Also added checks so that we don't try to
5106 5115 enable persist under Windows (where Gnuplot doesn't recognize the
5107 5116 option).
5108 5117
5109 5118 * IPython/iplib.py (InteractiveShell.interact): Added optional
5110 5119 auto-indenting code, after a patch by King C. Shu
5111 5120 <kingshu-AT-myrealbox.com>. It's off by default because it doesn't
5112 5121 get along well with pasting indented code. If I ever figure out
5113 5122 how to make that part go well, it will become on by default.
5114 5123
5115 5124 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixed bug which would
5116 5125 crash ipython if there was an unmatched '%' in the user's prompt
5117 5126 string. Reported by Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
5118 5127
5119 5128 * IPython/iplib.py (InteractiveShell.interact): removed the
5120 5129 ability to ask the user whether he wants to crash or not at the
5121 5130 'last line' exception handler. Calling functions at that point
5122 5131 changes the stack, and the error reports would have incorrect
5123 5132 tracebacks.
5124 5133
5125 5134 * IPython/Magic.py (Magic.magic_page): Added new @page magic, to
5126 5135 pass through a peger a pretty-printed form of any object. After a
5127 5136 contribution by Olivier Aubert <oaubert-AT-bat710.univ-lyon1.fr>
5128 5137
5129 5138 2003-04-14 Fernando Perez <fperez@colorado.edu>
5130 5139
5131 5140 * IPython/iplib.py (InteractiveShell.user_setup): Fixed bug where
5132 5141 all files in ~ would be modified at first install (instead of
5133 5142 ~/.ipython). This could be potentially disastrous, as the
5134 5143 modification (make line-endings native) could damage binary files.
5135 5144
5136 5145 2003-04-10 Fernando Perez <fperez@colorado.edu>
5137 5146
5138 5147 * IPython/iplib.py (InteractiveShell.handle_help): Modified to
5139 5148 handle only lines which are invalid python. This now means that
5140 5149 lines like 'x=1 #?' execute properly. Thanks to Jeffery Collins
5141 5150 for the bug report.
5142 5151
5143 5152 2003-04-01 Fernando Perez <fperez@colorado.edu>
5144 5153
5145 5154 * IPython/iplib.py (InteractiveShell.showtraceback): Fixed bug
5146 5155 where failing to set sys.last_traceback would crash pdb.pm().
5147 5156 Thanks to Jeffery D. Collins <Jeff.Collins-AT-vexcel.com> for the bug
5148 5157 report.
5149 5158
5150 5159 2003-03-25 Fernando Perez <fperez@colorado.edu>
5151 5160
5152 5161 * IPython/Magic.py (Magic.magic_prun): rstrip() output of profiler
5153 5162 before printing it (it had a lot of spurious blank lines at the
5154 5163 end).
5155 5164
5156 5165 * IPython/Gnuplot2.py (Gnuplot.hardcopy): fixed bug where lpr
5157 5166 output would be sent 21 times! Obviously people don't use this
5158 5167 too often, or I would have heard about it.
5159 5168
5160 5169 2003-03-24 Fernando Perez <fperez@colorado.edu>
5161 5170
5162 5171 * setup.py (scriptfiles): renamed the data_files parameter from
5163 5172 'base' to 'data' to fix rpm build issues. Thanks to Ralf Ahlbrink
5164 5173 for the patch.
5165 5174
5166 5175 2003-03-20 Fernando Perez <fperez@colorado.edu>
5167 5176
5168 5177 * IPython/genutils.py (error): added error() and fatal()
5169 5178 functions.
5170 5179
5171 5180 2003-03-18 *** Released version 0.2.15pre3
5172 5181
5173 5182 2003-03-18 Fernando Perez <fperez@colorado.edu>
5174 5183
5175 5184 * setupext/install_data_ext.py
5176 5185 (install_data_ext.initialize_options): Class contributed by Jack
5177 5186 Moffit for fixing the old distutils hack. He is sending this to
5178 5187 the distutils folks so in the future we may not need it as a
5179 5188 private fix.
5180 5189
5181 5190 * MANIFEST.in: Extensive reorganization, based on Jack Moffit's
5182 5191 changes for Debian packaging. See his patch for full details.
5183 5192 The old distutils hack of making the ipythonrc* files carry a
5184 5193 bogus .py extension is gone, at last. Examples were moved to a
5185 5194 separate subdir under doc/, and the separate executable scripts
5186 5195 now live in their own directory. Overall a great cleanup. The
5187 5196 manual was updated to use the new files, and setup.py has been
5188 5197 fixed for this setup.
5189 5198
5190 5199 * IPython/PyColorize.py (Parser.usage): made non-executable and
5191 5200 created a pycolor wrapper around it to be included as a script.
5192 5201
5193 5202 2003-03-12 *** Released version 0.2.15pre2
5194 5203
5195 5204 2003-03-12 Fernando Perez <fperez@colorado.edu>
5196 5205
5197 5206 * IPython/ColorANSI.py (make_color_table): Finally fixed the
5198 5207 long-standing problem with garbage characters in some terminals.
5199 5208 The issue was really that the \001 and \002 escapes must _only_ be
5200 5209 passed to input prompts (which call readline), but _never_ to
5201 5210 normal text to be printed on screen. I changed ColorANSI to have
5202 5211 two classes: TermColors and InputTermColors, each with the
5203 5212 appropriate escapes for input prompts or normal text. The code in
5204 5213 Prompts.py got slightly more complicated, but this very old and
5205 5214 annoying bug is finally fixed.
5206 5215
5207 5216 All the credit for nailing down the real origin of this problem
5208 5217 and the correct solution goes to Jack Moffit <jack-AT-xiph.org>.
5209 5218 *Many* thanks to him for spending quite a bit of effort on this.
5210 5219
5211 5220 2003-03-05 *** Released version 0.2.15pre1
5212 5221
5213 5222 2003-03-03 Fernando Perez <fperez@colorado.edu>
5214 5223
5215 5224 * IPython/FakeModule.py: Moved the former _FakeModule to a
5216 5225 separate file, because it's also needed by Magic (to fix a similar
5217 5226 pickle-related issue in @run).
5218 5227
5219 5228 2003-03-02 Fernando Perez <fperez@colorado.edu>
5220 5229
5221 5230 * IPython/Magic.py (Magic.magic_autocall): new magic to control
5222 5231 the autocall option at runtime.
5223 5232 (Magic.magic_dhist): changed self.user_ns to self.shell.user_ns
5224 5233 across Magic.py to start separating Magic from InteractiveShell.
5225 5234 (Magic._ofind): Fixed to return proper namespace for dotted
5226 5235 names. Before, a dotted name would always return 'not currently
5227 5236 defined', because it would find the 'parent'. s.x would be found,
5228 5237 but since 'x' isn't defined by itself, it would get confused.
5229 5238 (Magic.magic_run): Fixed pickling problems reported by Ralf
5230 5239 Ahlbrink <RAhlbrink-AT-RosenInspection.net>. The fix was similar to
5231 5240 that I'd used when Mike Heeter reported similar issues at the
5232 5241 top-level, but now for @run. It boils down to injecting the
5233 5242 namespace where code is being executed with something that looks
5234 5243 enough like a module to fool pickle.dump(). Since a pickle stores
5235 5244 a named reference to the importing module, we need this for
5236 5245 pickles to save something sensible.
5237 5246
5238 5247 * IPython/ipmaker.py (make_IPython): added an autocall option.
5239 5248
5240 5249 * IPython/iplib.py (InteractiveShell._prefilter): reordered all of
5241 5250 the auto-eval code. Now autocalling is an option, and the code is
5242 5251 also vastly safer. There is no more eval() involved at all.
5243 5252
5244 5253 2003-03-01 Fernando Perez <fperez@colorado.edu>
5245 5254
5246 5255 * IPython/Magic.py (Magic._ofind): Changed interface to return a
5247 5256 dict with named keys instead of a tuple.
5248 5257
5249 5258 * IPython: Started using CVS for IPython as of 0.2.15pre1.
5250 5259
5251 5260 * setup.py (make_shortcut): Fixed message about directories
5252 5261 created during Windows installation (the directories were ok, just
5253 5262 the printed message was misleading). Thanks to Chris Liechti
5254 5263 <cliechti-AT-gmx.net> for the heads up.
5255 5264
5256 5265 2003-02-21 Fernando Perez <fperez@colorado.edu>
5257 5266
5258 5267 * IPython/iplib.py (InteractiveShell._prefilter): Fixed catching
5259 5268 of ValueError exception when checking for auto-execution. This
5260 5269 one is raised by things like Numeric arrays arr.flat when the
5261 5270 array is non-contiguous.
5262 5271
5263 5272 2003-01-31 Fernando Perez <fperez@colorado.edu>
5264 5273
5265 5274 * IPython/genutils.py (SystemExec.bq): Fixed bug where bq would
5266 5275 not return any value at all (even though the command would get
5267 5276 executed).
5268 5277 (xsys): Flush stdout right after printing the command to ensure
5269 5278 proper ordering of commands and command output in the total
5270 5279 output.
5271 5280 (SystemExec/xsys/bq): Switched the names of xsys/bq and
5272 5281 system/getoutput as defaults. The old ones are kept for
5273 5282 compatibility reasons, so no code which uses this library needs
5274 5283 changing.
5275 5284
5276 5285 2003-01-27 *** Released version 0.2.14
5277 5286
5278 5287 2003-01-25 Fernando Perez <fperez@colorado.edu>
5279 5288
5280 5289 * IPython/Magic.py (Magic.magic_edit): Fixed problem where
5281 5290 functions defined in previous edit sessions could not be re-edited
5282 5291 (because the temp files were immediately removed). Now temp files
5283 5292 are removed only at IPython's exit.
5284 5293 (Magic.magic_run): Improved @run to perform shell-like expansions
5285 5294 on its arguments (~users and $VARS). With this, @run becomes more
5286 5295 like a normal command-line.
5287 5296
5288 5297 * IPython/Shell.py (IPShellEmbed.__call__): Fixed a bunch of small
5289 5298 bugs related to embedding and cleaned up that code. A fairly
5290 5299 important one was the impossibility to access the global namespace
5291 5300 through the embedded IPython (only local variables were visible).
5292 5301
5293 5302 2003-01-14 Fernando Perez <fperez@colorado.edu>
5294 5303
5295 5304 * IPython/iplib.py (InteractiveShell._prefilter): Fixed
5296 5305 auto-calling to be a bit more conservative. Now it doesn't get
5297 5306 triggered if any of '!=()<>' are in the rest of the input line, to
5298 5307 allow comparing callables. Thanks to Alex for the heads up.
5299 5308
5300 5309 2003-01-07 Fernando Perez <fperez@colorado.edu>
5301 5310
5302 5311 * IPython/genutils.py (page): fixed estimation of the number of
5303 5312 lines in a string to be paged to simply count newlines. This
5304 5313 prevents over-guessing due to embedded escape sequences. A better
5305 5314 long-term solution would involve stripping out the control chars
5306 5315 for the count, but it's potentially so expensive I just don't
5307 5316 think it's worth doing.
5308 5317
5309 5318 2002-12-19 *** Released version 0.2.14pre50
5310 5319
5311 5320 2002-12-19 Fernando Perez <fperez@colorado.edu>
5312 5321
5313 5322 * tools/release (version): Changed release scripts to inform
5314 5323 Andrea and build a NEWS file with a list of recent changes.
5315 5324
5316 5325 * IPython/ColorANSI.py (__all__): changed terminal detection
5317 5326 code. Seems to work better for xterms without breaking
5318 5327 konsole. Will need more testing to determine if WinXP and Mac OSX
5319 5328 also work ok.
5320 5329
5321 5330 2002-12-18 *** Released version 0.2.14pre49
5322 5331
5323 5332 2002-12-18 Fernando Perez <fperez@colorado.edu>
5324 5333
5325 5334 * Docs: added new info about Mac OSX, from Andrea.
5326 5335
5327 5336 * IPython/Gnuplot2.py (String): Added a String PlotItem class to
5328 5337 allow direct plotting of python strings whose format is the same
5329 5338 of gnuplot data files.
5330 5339
5331 5340 2002-12-16 Fernando Perez <fperez@colorado.edu>
5332 5341
5333 5342 * IPython/iplib.py (InteractiveShell.interact): fixed default (y)
5334 5343 value of exit question to be acknowledged.
5335 5344
5336 5345 2002-12-03 Fernando Perez <fperez@colorado.edu>
5337 5346
5338 5347 * IPython/ipmaker.py: removed generators, which had been added
5339 5348 by mistake in an earlier debugging run. This was causing trouble
5340 5349 to users of python 2.1.x. Thanks to Abel Daniel <abli-AT-freemail.hu>
5341 5350 for pointing this out.
5342 5351
5343 5352 2002-11-17 Fernando Perez <fperez@colorado.edu>
5344 5353
5345 5354 * Manual: updated the Gnuplot section.
5346 5355
5347 5356 * IPython/GnuplotRuntime.py: refactored a lot all this code, with
5348 5357 a much better split of what goes in Runtime and what goes in
5349 5358 Interactive.
5350 5359
5351 5360 * IPython/ipmaker.py: fixed bug where import_fail_info wasn't
5352 5361 being imported from iplib.
5353 5362
5354 5363 * IPython/GnuplotInteractive.py (magic_gpc): renamed @gp to @gpc
5355 5364 for command-passing. Now the global Gnuplot instance is called
5356 5365 'gp' instead of 'g', which was really a far too fragile and
5357 5366 common name.
5358 5367
5359 5368 * IPython/Gnuplot2.py (eps_fix_bbox): added this to fix broken
5360 5369 bounding boxes generated by Gnuplot for square plots.
5361 5370
5362 5371 * IPython/genutils.py (popkey): new function added. I should
5363 5372 suggest this on c.l.py as a dict method, it seems useful.
5364 5373
5365 5374 * IPython/Gnuplot2.py (Gnuplot.plot): Overhauled plot and replot
5366 5375 to transparently handle PostScript generation. MUCH better than
5367 5376 the previous plot_eps/replot_eps (which I removed now). The code
5368 5377 is also fairly clean and well documented now (including
5369 5378 docstrings).
5370 5379
5371 5380 2002-11-13 Fernando Perez <fperez@colorado.edu>
5372 5381
5373 5382 * IPython/Magic.py (Magic.magic_edit): fixed docstring
5374 5383 (inconsistent with options).
5375 5384
5376 5385 * IPython/Gnuplot2.py (Gnuplot.hardcopy): hardcopy had been
5377 5386 manually disabled, I don't know why. Fixed it.
5378 5387 (Gnuplot._plot_eps): added new plot_eps/replot_eps to get directly
5379 5388 eps output.
5380 5389
5381 5390 2002-11-12 Fernando Perez <fperez@colorado.edu>
5382 5391
5383 5392 * IPython/genutils.py (ask_yes_no): trap EOF and ^C so that they
5384 5393 don't propagate up to caller. Fixes crash reported by François
5385 5394 Pinard.
5386 5395
5387 5396 2002-11-09 Fernando Perez <fperez@colorado.edu>
5388 5397
5389 5398 * IPython/ipmaker.py (make_IPython): fixed problem with writing
5390 5399 history file for new users.
5391 5400 (make_IPython): fixed bug where initial install would leave the
5392 5401 user running in the .ipython dir.
5393 5402 (make_IPython): fixed bug where config dir .ipython would be
5394 5403 created regardless of the given -ipythondir option. Thanks to Cory
5395 5404 Dodt <cdodt-AT-fcoe.k12.ca.us> for the bug report.
5396 5405
5397 5406 * IPython/genutils.py (ask_yes_no): new function for asking yes/no
5398 5407 type confirmations. Will need to use it in all of IPython's code
5399 5408 consistently.
5400 5409
5401 5410 * IPython/CrashHandler.py (CrashHandler.__call__): changed the
5402 5411 context to print 31 lines instead of the default 5. This will make
5403 5412 the crash reports extremely detailed in case the problem is in
5404 5413 libraries I don't have access to.
5405 5414
5406 5415 * IPython/iplib.py (InteractiveShell.interact): changed the 'last
5407 5416 line of defense' code to still crash, but giving users fair
5408 5417 warning. I don't want internal errors to go unreported: if there's
5409 5418 an internal problem, IPython should crash and generate a full
5410 5419 report.
5411 5420
5412 5421 2002-11-08 Fernando Perez <fperez@colorado.edu>
5413 5422
5414 5423 * IPython/iplib.py (InteractiveShell.interact): added code to trap
5415 5424 otherwise uncaught exceptions which can appear if people set
5416 5425 sys.stdout to something badly broken. Thanks to a crash report
5417 5426 from henni-AT-mail.brainbot.com.
5418 5427
5419 5428 2002-11-04 Fernando Perez <fperez@colorado.edu>
5420 5429
5421 5430 * IPython/iplib.py (InteractiveShell.interact): added
5422 5431 __IPYTHON__active to the builtins. It's a flag which goes on when
5423 5432 the interaction starts and goes off again when it stops. This
5424 5433 allows embedding code to detect being inside IPython. Before this
5425 5434 was done via __IPYTHON__, but that only shows that an IPython
5426 5435 instance has been created.
5427 5436
5428 5437 * IPython/Magic.py (Magic.magic_env): I realized that in a
5429 5438 UserDict, instance.data holds the data as a normal dict. So I
5430 5439 modified @env to return os.environ.data instead of rebuilding a
5431 5440 dict by hand.
5432 5441
5433 5442 2002-11-02 Fernando Perez <fperez@colorado.edu>
5434 5443
5435 5444 * IPython/genutils.py (warn): changed so that level 1 prints no
5436 5445 header. Level 2 is now the default (with 'WARNING' header, as
5437 5446 before). I think I tracked all places where changes were needed in
5438 5447 IPython, but outside code using the old level numbering may have
5439 5448 broken.
5440 5449
5441 5450 * IPython/iplib.py (InteractiveShell.runcode): added this to
5442 5451 handle the tracebacks in SystemExit traps correctly. The previous
5443 5452 code (through interact) was printing more of the stack than
5444 5453 necessary, showing IPython internal code to the user.
5445 5454
5446 5455 * IPython/UserConfig/ipythonrc.py: Made confirm_exit 1 by
5447 5456 default. Now that the default at the confirmation prompt is yes,
5448 5457 it's not so intrusive. François' argument that ipython sessions
5449 5458 tend to be complex enough not to lose them from an accidental C-d,
5450 5459 is a valid one.
5451 5460
5452 5461 * IPython/iplib.py (InteractiveShell.interact): added a
5453 5462 showtraceback() call to the SystemExit trap, and modified the exit
5454 5463 confirmation to have yes as the default.
5455 5464
5456 5465 * IPython/UserConfig/ipythonrc.py: removed 'session' option from
5457 5466 this file. It's been gone from the code for a long time, this was
5458 5467 simply leftover junk.
5459 5468
5460 5469 2002-11-01 Fernando Perez <fperez@colorado.edu>
5461 5470
5462 5471 * IPython/UserConfig/ipythonrc.py: new confirm_exit option
5463 5472 added. If set, IPython now traps EOF and asks for
5464 5473 confirmation. After a request by François Pinard.
5465 5474
5466 5475 * IPython/Magic.py (Magic.magic_Exit): New @Exit and @Quit instead
5467 5476 of @abort, and with a new (better) mechanism for handling the
5468 5477 exceptions.
5469 5478
5470 5479 2002-10-27 Fernando Perez <fperez@colorado.edu>
5471 5480
5472 5481 * IPython/usage.py (__doc__): updated the --help information and
5473 5482 the ipythonrc file to indicate that -log generates
5474 5483 ./ipython.log. Also fixed the corresponding info in @logstart.
5475 5484 This and several other fixes in the manuals thanks to reports by
5476 5485 François Pinard <pinard-AT-iro.umontreal.ca>.
5477 5486
5478 5487 * IPython/Logger.py (Logger.switch_log): Fixed error message to
5479 5488 refer to @logstart (instead of @log, which doesn't exist).
5480 5489
5481 5490 * IPython/iplib.py (InteractiveShell._prefilter): fixed
5482 5491 AttributeError crash. Thanks to Christopher Armstrong
5483 5492 <radix-AT-twistedmatrix.com> for the report/fix. This bug had been
5484 5493 introduced recently (in 0.2.14pre37) with the fix to the eval
5485 5494 problem mentioned below.
5486 5495
5487 5496 2002-10-17 Fernando Perez <fperez@colorado.edu>
5488 5497
5489 5498 * IPython/ConfigLoader.py (ConfigLoader.load): Fixes for Windows
5490 5499 installation. Thanks to Leonardo Santagada <retype-AT-terra.com.br>.
5491 5500
5492 5501 * IPython/iplib.py (InteractiveShell._prefilter): Many changes to
5493 5502 this function to fix a problem reported by Alex Schmolck. He saw
5494 5503 it with list comprehensions and generators, which were getting
5495 5504 called twice. The real problem was an 'eval' call in testing for
5496 5505 automagic which was evaluating the input line silently.
5497 5506
5498 5507 This is a potentially very nasty bug, if the input has side
5499 5508 effects which must not be repeated. The code is much cleaner now,
5500 5509 without any blanket 'except' left and with a regexp test for
5501 5510 actual function names.
5502 5511
5503 5512 But an eval remains, which I'm not fully comfortable with. I just
5504 5513 don't know how to find out if an expression could be a callable in
5505 5514 the user's namespace without doing an eval on the string. However
5506 5515 that string is now much more strictly checked so that no code
5507 5516 slips by, so the eval should only happen for things that can
5508 5517 really be only function/method names.
5509 5518
5510 5519 2002-10-15 Fernando Perez <fperez@colorado.edu>
5511 5520
5512 5521 * Updated LyX to 1.2.1 so I can work on the docs again. Added Mac
5513 5522 OSX information to main manual, removed README_Mac_OSX file from
5514 5523 distribution. Also updated credits for recent additions.
5515 5524
5516 5525 2002-10-10 Fernando Perez <fperez@colorado.edu>
5517 5526
5518 5527 * README_Mac_OSX: Added a README for Mac OSX users for fixing
5519 5528 terminal-related issues. Many thanks to Andrea Riciputi
5520 5529 <andrea.riciputi-AT-libero.it> for writing it.
5521 5530
5522 5531 * IPython/UserConfig/ipythonrc.py: Fixes to various small issues,
5523 5532 thanks to Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
5524 5533
5525 5534 * setup.py (make_shortcut): Fixes for Windows installation. Thanks
5526 5535 to Fredrik Kant <fredrik.kant-AT-front.com> and Syver Enstad
5527 5536 <syver-en-AT-online.no> who both submitted patches for this problem.
5528 5537
5529 5538 * IPython/iplib.py (InteractiveShell.embed_mainloop): Patch for
5530 5539 global embedding to make sure that things don't overwrite user
5531 5540 globals accidentally. Thanks to Richard <rxe-AT-renre-europe.com>
5532 5541
5533 5542 * IPython/Gnuplot2.py (gp): Patch for Gnuplot.py 1.6
5534 5543 compatibility. Thanks to Hayden Callow
5535 5544 <h.callow-AT-elec.canterbury.ac.nz>
5536 5545
5537 5546 2002-10-04 Fernando Perez <fperez@colorado.edu>
5538 5547
5539 5548 * IPython/Gnuplot2.py (PlotItem): Added 'index' option for
5540 5549 Gnuplot.File objects.
5541 5550
5542 5551 2002-07-23 Fernando Perez <fperez@colorado.edu>
5543 5552
5544 5553 * IPython/genutils.py (timing): Added timings() and timing() for
5545 5554 quick access to the most commonly needed data, the execution
5546 5555 times. Old timing() renamed to timings_out().
5547 5556
5548 5557 2002-07-18 Fernando Perez <fperez@colorado.edu>
5549 5558
5550 5559 * IPython/Shell.py (IPShellEmbed.restore_system_completer): fixed
5551 5560 bug with nested instances disrupting the parent's tab completion.
5552 5561
5553 5562 * IPython/iplib.py (all_completions): Added Alex Schmolck's
5554 5563 all_completions code to begin the emacs integration.
5555 5564
5556 5565 * IPython/Gnuplot2.py (zip_items): Added optional 'titles'
5557 5566 argument to allow titling individual arrays when plotting.
5558 5567
5559 5568 2002-07-15 Fernando Perez <fperez@colorado.edu>
5560 5569
5561 5570 * setup.py (make_shortcut): changed to retrieve the value of
5562 5571 'Program Files' directory from the registry (this value changes in
5563 5572 non-english versions of Windows). Thanks to Thomas Fanslau
5564 5573 <tfanslau-AT-gmx.de> for the report.
5565 5574
5566 5575 2002-07-10 Fernando Perez <fperez@colorado.edu>
5567 5576
5568 5577 * IPython/ultraTB.py (VerboseTB.debugger): enabled workaround for
5569 5578 a bug in pdb, which crashes if a line with only whitespace is
5570 5579 entered. Bug report submitted to sourceforge.
5571 5580
5572 5581 2002-07-09 Fernando Perez <fperez@colorado.edu>
5573 5582
5574 5583 * IPython/ultraTB.py (VerboseTB.nullrepr): fixed rare crash when
5575 5584 reporting exceptions (it's a bug in inspect.py, I just set a
5576 5585 workaround).
5577 5586
5578 5587 2002-07-08 Fernando Perez <fperez@colorado.edu>
5579 5588
5580 5589 * IPython/iplib.py (InteractiveShell.__init__): fixed reference to
5581 5590 __IPYTHON__ in __builtins__ to show up in user_ns.
5582 5591
5583 5592 2002-07-03 Fernando Perez <fperez@colorado.edu>
5584 5593
5585 5594 * IPython/GnuplotInteractive.py (magic_gp_set_default): changed
5586 5595 name from @gp_set_instance to @gp_set_default.
5587 5596
5588 5597 * IPython/ipmaker.py (make_IPython): default editor value set to
5589 5598 '0' (a string), to match the rc file. Otherwise will crash when
5590 5599 .strip() is called on it.
5591 5600
5592 5601
5593 5602 2002-06-28 Fernando Perez <fperez@colorado.edu>
5594 5603
5595 5604 * IPython/iplib.py (InteractiveShell.safe_execfile): fix importing
5596 5605 of files in current directory when a file is executed via
5597 5606 @run. Patch also by RA <ralf_ahlbrink-AT-web.de>.
5598 5607
5599 5608 * setup.py (manfiles): fix for rpm builds, submitted by RA
5600 5609 <ralf_ahlbrink-AT-web.de>. Now we have RPMs!
5601 5610
5602 5611 * IPython/ipmaker.py (make_IPython): fixed lookup of default
5603 5612 editor when set to '0'. Problem was, '0' evaluates to True (it's a
5604 5613 string!). A. Schmolck caught this one.
5605 5614
5606 5615 2002-06-27 Fernando Perez <fperez@colorado.edu>
5607 5616
5608 5617 * IPython/ipmaker.py (make_IPython): fixed bug when running user
5609 5618 defined files at the cmd line. __name__ wasn't being set to
5610 5619 __main__.
5611 5620
5612 5621 * IPython/Gnuplot2.py (zip_items): improved it so it can plot also
5613 5622 regular lists and tuples besides Numeric arrays.
5614 5623
5615 5624 * IPython/Prompts.py (CachedOutput.__call__): Added output
5616 5625 supression for input ending with ';'. Similar to Mathematica and
5617 5626 Matlab. The _* vars and Out[] list are still updated, just like
5618 5627 Mathematica behaves.
5619 5628
5620 5629 2002-06-25 Fernando Perez <fperez@colorado.edu>
5621 5630
5622 5631 * IPython/ConfigLoader.py (ConfigLoader.load): fixed checking of
5623 5632 .ini extensions for profiels under Windows.
5624 5633
5625 5634 * IPython/OInspect.py (Inspector.pinfo): improved alignment of
5626 5635 string form. Fix contributed by Alexander Schmolck
5627 5636 <a.schmolck-AT-gmx.net>
5628 5637
5629 5638 * IPython/GnuplotRuntime.py (gp_new): new function. Returns a
5630 5639 pre-configured Gnuplot instance.
5631 5640
5632 5641 2002-06-21 Fernando Perez <fperez@colorado.edu>
5633 5642
5634 5643 * IPython/numutils.py (exp_safe): new function, works around the
5635 5644 underflow problems in Numeric.
5636 5645 (log2): New fn. Safe log in base 2: returns exact integer answer
5637 5646 for exact integer powers of 2.
5638 5647
5639 5648 * IPython/Magic.py (get_py_filename): fixed it not expanding '~'
5640 5649 properly.
5641 5650
5642 5651 2002-06-20 Fernando Perez <fperez@colorado.edu>
5643 5652
5644 5653 * IPython/genutils.py (timing): new function like
5645 5654 Mathematica's. Similar to time_test, but returns more info.
5646 5655
5647 5656 2002-06-18 Fernando Perez <fperez@colorado.edu>
5648 5657
5649 5658 * IPython/Magic.py (Magic.magic_save): modified @save and @r
5650 5659 according to Mike Heeter's suggestions.
5651 5660
5652 5661 2002-06-16 Fernando Perez <fperez@colorado.edu>
5653 5662
5654 5663 * IPython/GnuplotRuntime.py: Massive overhaul to the Gnuplot
5655 5664 system. GnuplotMagic is gone as a user-directory option. New files
5656 5665 make it easier to use all the gnuplot stuff both from external
5657 5666 programs as well as from IPython. Had to rewrite part of
5658 5667 hardcopy() b/c of a strange bug: often the ps files simply don't
5659 5668 get created, and require a repeat of the command (often several
5660 5669 times).
5661 5670
5662 5671 * IPython/ultraTB.py (AutoFormattedTB.__call__): changed to
5663 5672 resolve output channel at call time, so that if sys.stderr has
5664 5673 been redirected by user this gets honored.
5665 5674
5666 5675 2002-06-13 Fernando Perez <fperez@colorado.edu>
5667 5676
5668 5677 * IPython/Shell.py (IPShell.__init__): Changed IPythonShell to
5669 5678 IPShell. Kept a copy with the old names to avoid breaking people's
5670 5679 embedded code.
5671 5680
5672 5681 * IPython/ipython: simplified it to the bare minimum after
5673 5682 Holger's suggestions. Added info about how to use it in
5674 5683 PYTHONSTARTUP.
5675 5684
5676 5685 * IPython/Shell.py (IPythonShell): changed the options passing
5677 5686 from a string with funky %s replacements to a straight list. Maybe
5678 5687 a bit more typing, but it follows sys.argv conventions, so there's
5679 5688 less special-casing to remember.
5680 5689
5681 5690 2002-06-12 Fernando Perez <fperez@colorado.edu>
5682 5691
5683 5692 * IPython/Magic.py (Magic.magic_r): new magic auto-repeat
5684 5693 command. Thanks to a suggestion by Mike Heeter.
5685 5694 (Magic.magic_pfile): added behavior to look at filenames if given
5686 5695 arg is not a defined object.
5687 5696 (Magic.magic_save): New @save function to save code snippets. Also
5688 5697 a Mike Heeter idea.
5689 5698
5690 5699 * IPython/UserConfig/GnuplotMagic.py (plot): Improvements to
5691 5700 plot() and replot(). Much more convenient now, especially for
5692 5701 interactive use.
5693 5702
5694 5703 * IPython/Magic.py (Magic.magic_run): Added .py automatically to
5695 5704 filenames.
5696 5705
5697 5706 2002-06-02 Fernando Perez <fperez@colorado.edu>
5698 5707
5699 5708 * IPython/Struct.py (Struct.__init__): modified to admit
5700 5709 initialization via another struct.
5701 5710
5702 5711 * IPython/genutils.py (SystemExec.__init__): New stateful
5703 5712 interface to xsys and bq. Useful for writing system scripts.
5704 5713
5705 5714 2002-05-30 Fernando Perez <fperez@colorado.edu>
5706 5715
5707 5716 * MANIFEST.in: Changed docfile selection to exclude all the lyx
5708 5717 documents. This will make the user download smaller (it's getting
5709 5718 too big).
5710 5719
5711 5720 2002-05-29 Fernando Perez <fperez@colorado.edu>
5712 5721
5713 5722 * IPython/iplib.py (_FakeModule.__init__): New class introduced to
5714 5723 fix problems with shelve and pickle. Seems to work, but I don't
5715 5724 know if corner cases break it. Thanks to Mike Heeter
5716 5725 <korora-AT-SDF.LONESTAR.ORG> for the bug reports and test cases.
5717 5726
5718 5727 2002-05-24 Fernando Perez <fperez@colorado.edu>
5719 5728
5720 5729 * IPython/Magic.py (Macro.__init__): fixed magics embedded in
5721 5730 macros having broken.
5722 5731
5723 5732 2002-05-21 Fernando Perez <fperez@colorado.edu>
5724 5733
5725 5734 * IPython/Magic.py (Magic.magic_logstart): fixed recently
5726 5735 introduced logging bug: all history before logging started was
5727 5736 being written one character per line! This came from the redesign
5728 5737 of the input history as a special list which slices to strings,
5729 5738 not to lists.
5730 5739
5731 5740 2002-05-20 Fernando Perez <fperez@colorado.edu>
5732 5741
5733 5742 * IPython/Prompts.py (CachedOutput.__init__): made the color table
5734 5743 be an attribute of all classes in this module. The design of these
5735 5744 classes needs some serious overhauling.
5736 5745
5737 5746 * IPython/DPyGetOpt.py (DPyGetOpt.setPosixCompliance): fixed bug
5738 5747 which was ignoring '_' in option names.
5739 5748
5740 5749 * IPython/ultraTB.py (FormattedTB.__init__): Changed
5741 5750 'Verbose_novars' to 'Context' and made it the new default. It's a
5742 5751 bit more readable and also safer than verbose.
5743 5752
5744 5753 * IPython/PyColorize.py (Parser.__call__): Fixed coloring of
5745 5754 triple-quoted strings.
5746 5755
5747 5756 * IPython/OInspect.py (__all__): new module exposing the object
5748 5757 introspection facilities. Now the corresponding magics are dummy
5749 5758 wrappers around this. Having this module will make it much easier
5750 5759 to put these functions into our modified pdb.
5751 5760 This new object inspector system uses the new colorizing module,
5752 5761 so source code and other things are nicely syntax highlighted.
5753 5762
5754 5763 2002-05-18 Fernando Perez <fperez@colorado.edu>
5755 5764
5756 5765 * IPython/ColorANSI.py: Split the coloring tools into a separate
5757 5766 module so I can use them in other code easier (they were part of
5758 5767 ultraTB).
5759 5768
5760 5769 2002-05-17 Fernando Perez <fperez@colorado.edu>
5761 5770
5762 5771 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
5763 5772 fixed it to set the global 'g' also to the called instance, as
5764 5773 long as 'g' was still a gnuplot instance (so it doesn't overwrite
5765 5774 user's 'g' variables).
5766 5775
5767 5776 * IPython/iplib.py (InteractiveShell.__init__): Added In/Out
5768 5777 global variables (aliases to _ih,_oh) so that users which expect
5769 5778 In[5] or Out[7] to work aren't unpleasantly surprised.
5770 5779 (InputList.__getslice__): new class to allow executing slices of
5771 5780 input history directly. Very simple class, complements the use of
5772 5781 macros.
5773 5782
5774 5783 2002-05-16 Fernando Perez <fperez@colorado.edu>
5775 5784
5776 5785 * setup.py (docdirbase): make doc directory be just doc/IPython
5777 5786 without version numbers, it will reduce clutter for users.
5778 5787
5779 5788 * IPython/Magic.py (Magic.magic_run): Add explicit local dict to
5780 5789 execfile call to prevent possible memory leak. See for details:
5781 5790 http://mail.python.org/pipermail/python-list/2002-February/088476.html
5782 5791
5783 5792 2002-05-15 Fernando Perez <fperez@colorado.edu>
5784 5793
5785 5794 * IPython/Magic.py (Magic.magic_psource): made the object
5786 5795 introspection names be more standard: pdoc, pdef, pfile and
5787 5796 psource. They all print/page their output, and it makes
5788 5797 remembering them easier. Kept old names for compatibility as
5789 5798 aliases.
5790 5799
5791 5800 2002-05-14 Fernando Perez <fperez@colorado.edu>
5792 5801
5793 5802 * IPython/UserConfig/GnuplotMagic.py: I think I finally understood
5794 5803 what the mouse problem was. The trick is to use gnuplot with temp
5795 5804 files and NOT with pipes (for data communication), because having
5796 5805 both pipes and the mouse on is bad news.
5797 5806
5798 5807 2002-05-13 Fernando Perez <fperez@colorado.edu>
5799 5808
5800 5809 * IPython/Magic.py (Magic._ofind): fixed namespace order search
5801 5810 bug. Information would be reported about builtins even when
5802 5811 user-defined functions overrode them.
5803 5812
5804 5813 2002-05-11 Fernando Perez <fperez@colorado.edu>
5805 5814
5806 5815 * IPython/__init__.py (__all__): removed FlexCompleter from
5807 5816 __all__ so that things don't fail in platforms without readline.
5808 5817
5809 5818 2002-05-10 Fernando Perez <fperez@colorado.edu>
5810 5819
5811 5820 * IPython/__init__.py (__all__): removed numutils from __all__ b/c
5812 5821 it requires Numeric, effectively making Numeric a dependency for
5813 5822 IPython.
5814 5823
5815 5824 * Released 0.2.13
5816 5825
5817 5826 * IPython/Magic.py (Magic.magic_prun): big overhaul to the
5818 5827 profiler interface. Now all the major options from the profiler
5819 5828 module are directly supported in IPython, both for single
5820 5829 expressions (@prun) and for full programs (@run -p).
5821 5830
5822 5831 2002-05-09 Fernando Perez <fperez@colorado.edu>
5823 5832
5824 5833 * IPython/Magic.py (Magic.magic_doc): fixed to show docstrings of
5825 5834 magic properly formatted for screen.
5826 5835
5827 5836 * setup.py (make_shortcut): Changed things to put pdf version in
5828 5837 doc/ instead of doc/manual (had to change lyxport a bit).
5829 5838
5830 5839 * IPython/Magic.py (Profile.string_stats): made profile runs go
5831 5840 through pager (they are long and a pager allows searching, saving,
5832 5841 etc.)
5833 5842
5834 5843 2002-05-08 Fernando Perez <fperez@colorado.edu>
5835 5844
5836 5845 * Released 0.2.12
5837 5846
5838 5847 2002-05-06 Fernando Perez <fperez@colorado.edu>
5839 5848
5840 5849 * IPython/Magic.py (Magic.magic_hist): small bug fixed (recently
5841 5850 introduced); 'hist n1 n2' was broken.
5842 5851 (Magic.magic_pdb): added optional on/off arguments to @pdb
5843 5852 (Magic.magic_run): added option -i to @run, which executes code in
5844 5853 the IPython namespace instead of a clean one. Also added @irun as
5845 5854 an alias to @run -i.
5846 5855
5847 5856 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
5848 5857 fixed (it didn't really do anything, the namespaces were wrong).
5849 5858
5850 5859 * IPython/Debugger.py (__init__): Added workaround for python 2.1
5851 5860
5852 5861 * IPython/__init__.py (__all__): Fixed package namespace, now
5853 5862 'import IPython' does give access to IPython.<all> as
5854 5863 expected. Also renamed __release__ to Release.
5855 5864
5856 5865 * IPython/Debugger.py (__license__): created new Pdb class which
5857 5866 functions like a drop-in for the normal pdb.Pdb but does NOT
5858 5867 import readline by default. This way it doesn't muck up IPython's
5859 5868 readline handling, and now tab-completion finally works in the
5860 5869 debugger -- sort of. It completes things globally visible, but the
5861 5870 completer doesn't track the stack as pdb walks it. That's a bit
5862 5871 tricky, and I'll have to implement it later.
5863 5872
5864 5873 2002-05-05 Fernando Perez <fperez@colorado.edu>
5865 5874
5866 5875 * IPython/Magic.py (Magic.magic_oinfo): fixed formatting bug for
5867 5876 magic docstrings when printed via ? (explicit \'s were being
5868 5877 printed).
5869 5878
5870 5879 * IPython/ipmaker.py (make_IPython): fixed namespace
5871 5880 identification bug. Now variables loaded via logs or command-line
5872 5881 files are recognized in the interactive namespace by @who.
5873 5882
5874 5883 * IPython/iplib.py (InteractiveShell.safe_execfile): Fixed bug in
5875 5884 log replay system stemming from the string form of Structs.
5876 5885
5877 5886 * IPython/Magic.py (Macro.__init__): improved macros to properly
5878 5887 handle magic commands in them.
5879 5888 (Magic.magic_logstart): usernames are now expanded so 'logstart
5880 5889 ~/mylog' now works.
5881 5890
5882 5891 * IPython/iplib.py (complete): fixed bug where paths starting with
5883 5892 '/' would be completed as magic names.
5884 5893
5885 5894 2002-05-04 Fernando Perez <fperez@colorado.edu>
5886 5895
5887 5896 * IPython/Magic.py (Magic.magic_run): added options -p and -f to
5888 5897 allow running full programs under the profiler's control.
5889 5898
5890 5899 * IPython/ultraTB.py (FormattedTB.__init__): Added Verbose_novars
5891 5900 mode to report exceptions verbosely but without formatting
5892 5901 variables. This addresses the issue of ipython 'freezing' (it's
5893 5902 not frozen, but caught in an expensive formatting loop) when huge
5894 5903 variables are in the context of an exception.
5895 5904 (VerboseTB.text): Added '--->' markers at line where exception was
5896 5905 triggered. Much clearer to read, especially in NoColor modes.
5897 5906
5898 5907 * IPython/Magic.py (Magic.magic_run): bugfix: -n option had been
5899 5908 implemented in reverse when changing to the new parse_options().
5900 5909
5901 5910 2002-05-03 Fernando Perez <fperez@colorado.edu>
5902 5911
5903 5912 * IPython/Magic.py (Magic.parse_options): new function so that
5904 5913 magics can parse options easier.
5905 5914 (Magic.magic_prun): new function similar to profile.run(),
5906 5915 suggested by Chris Hart.
5907 5916 (Magic.magic_cd): fixed behavior so that it only changes if
5908 5917 directory actually is in history.
5909 5918
5910 5919 * IPython/usage.py (__doc__): added information about potential
5911 5920 slowness of Verbose exception mode when there are huge data
5912 5921 structures to be formatted (thanks to Archie Paulson).
5913 5922
5914 5923 * IPython/ipmaker.py (make_IPython): Changed default logging
5915 5924 (when simply called with -log) to use curr_dir/ipython.log in
5916 5925 rotate mode. Fixed crash which was occuring with -log before
5917 5926 (thanks to Jim Boyle).
5918 5927
5919 5928 2002-05-01 Fernando Perez <fperez@colorado.edu>
5920 5929
5921 5930 * Released 0.2.11 for these fixes (mainly the ultraTB one which
5922 5931 was nasty -- though somewhat of a corner case).
5923 5932
5924 5933 * IPython/ultraTB.py (AutoFormattedTB.text): renamed __text to
5925 5934 text (was a bug).
5926 5935
5927 5936 2002-04-30 Fernando Perez <fperez@colorado.edu>
5928 5937
5929 5938 * IPython/UserConfig/GnuplotMagic.py (magic_gp): Minor fix to add
5930 5939 a print after ^D or ^C from the user so that the In[] prompt
5931 5940 doesn't over-run the gnuplot one.
5932 5941
5933 5942 2002-04-29 Fernando Perez <fperez@colorado.edu>
5934 5943
5935 5944 * Released 0.2.10
5936 5945
5937 5946 * IPython/__release__.py (version): get date dynamically.
5938 5947
5939 5948 * Misc. documentation updates thanks to Arnd's comments. Also ran
5940 5949 a full spellcheck on the manual (hadn't been done in a while).
5941 5950
5942 5951 2002-04-27 Fernando Perez <fperez@colorado.edu>
5943 5952
5944 5953 * IPython/Magic.py (Magic.magic_logstart): Fixed bug where
5945 5954 starting a log in mid-session would reset the input history list.
5946 5955
5947 5956 2002-04-26 Fernando Perez <fperez@colorado.edu>
5948 5957
5949 5958 * IPython/iplib.py (InteractiveShell.wait): Fixed bug where not
5950 5959 all files were being included in an update. Now anything in
5951 5960 UserConfig that matches [A-Za-z]*.py will go (this excludes
5952 5961 __init__.py)
5953 5962
5954 5963 2002-04-25 Fernando Perez <fperez@colorado.edu>
5955 5964
5956 5965 * IPython/iplib.py (InteractiveShell.__init__): Added __IPYTHON__
5957 5966 to __builtins__ so that any form of embedded or imported code can
5958 5967 test for being inside IPython.
5959 5968
5960 5969 * IPython/UserConfig/GnuplotMagic.py: (magic_gp_set_instance):
5961 5970 changed to GnuplotMagic because it's now an importable module,
5962 5971 this makes the name follow that of the standard Gnuplot module.
5963 5972 GnuplotMagic can now be loaded at any time in mid-session.
5964 5973
5965 5974 2002-04-24 Fernando Perez <fperez@colorado.edu>
5966 5975
5967 5976 * IPython/numutils.py: removed SIUnits. It doesn't properly set
5968 5977 the globals (IPython has its own namespace) and the
5969 5978 PhysicalQuantity stuff is much better anyway.
5970 5979
5971 5980 * IPython/UserConfig/example-gnuplot.py (g2): Added gnuplot
5972 5981 embedding example to standard user directory for
5973 5982 distribution. Also put it in the manual.
5974 5983
5975 5984 * IPython/numutils.py (gnuplot_exec): Changed to take a gnuplot
5976 5985 instance as first argument (so it doesn't rely on some obscure
5977 5986 hidden global).
5978 5987
5979 5988 * IPython/UserConfig/ipythonrc.py: put () back in accepted
5980 5989 delimiters. While it prevents ().TAB from working, it allows
5981 5990 completions in open (... expressions. This is by far a more common
5982 5991 case.
5983 5992
5984 5993 2002-04-23 Fernando Perez <fperez@colorado.edu>
5985 5994
5986 5995 * IPython/Extensions/InterpreterPasteInput.py: new
5987 5996 syntax-processing module for pasting lines with >>> or ... at the
5988 5997 start.
5989 5998
5990 5999 * IPython/Extensions/PhysicalQ_Interactive.py
5991 6000 (PhysicalQuantityInteractive.__int__): fixed to work with either
5992 6001 Numeric or math.
5993 6002
5994 6003 * IPython/UserConfig/ipythonrc-numeric.py: reorganized the
5995 6004 provided profiles. Now we have:
5996 6005 -math -> math module as * and cmath with its own namespace.
5997 6006 -numeric -> Numeric as *, plus gnuplot & grace
5998 6007 -physics -> same as before
5999 6008
6000 6009 * IPython/Magic.py (Magic.magic_magic): Fixed bug where
6001 6010 user-defined magics wouldn't be found by @magic if they were
6002 6011 defined as class methods. Also cleaned up the namespace search
6003 6012 logic and the string building (to use %s instead of many repeated
6004 6013 string adds).
6005 6014
6006 6015 * IPython/UserConfig/example-magic.py (magic_foo): updated example
6007 6016 of user-defined magics to operate with class methods (cleaner, in
6008 6017 line with the gnuplot code).
6009 6018
6010 6019 2002-04-22 Fernando Perez <fperez@colorado.edu>
6011 6020
6012 6021 * setup.py: updated dependency list so that manual is updated when
6013 6022 all included files change.
6014 6023
6015 6024 * IPython/ipmaker.py (make_IPython): Fixed bug which was ignoring
6016 6025 the delimiter removal option (the fix is ugly right now).
6017 6026
6018 6027 * IPython/UserConfig/ipythonrc-physics.py: simplified not to load
6019 6028 all of the math profile (quicker loading, no conflict between
6020 6029 g-9.8 and g-gnuplot).
6021 6030
6022 6031 * IPython/CrashHandler.py (CrashHandler.__call__): changed default
6023 6032 name of post-mortem files to IPython_crash_report.txt.
6024 6033
6025 6034 * Cleanup/update of the docs. Added all the new readline info and
6026 6035 formatted all lists as 'real lists'.
6027 6036
6028 6037 * IPython/ipmaker.py (make_IPython): removed now-obsolete
6029 6038 tab-completion options, since the full readline parse_and_bind is
6030 6039 now accessible.
6031 6040
6032 6041 * IPython/iplib.py (InteractiveShell.init_readline): Changed
6033 6042 handling of readline options. Now users can specify any string to
6034 6043 be passed to parse_and_bind(), as well as the delimiters to be
6035 6044 removed.
6036 6045 (InteractiveShell.__init__): Added __name__ to the global
6037 6046 namespace so that things like Itpl which rely on its existence
6038 6047 don't crash.
6039 6048 (InteractiveShell._prefilter): Defined the default with a _ so
6040 6049 that prefilter() is easier to override, while the default one
6041 6050 remains available.
6042 6051
6043 6052 2002-04-18 Fernando Perez <fperez@colorado.edu>
6044 6053
6045 6054 * Added information about pdb in the docs.
6046 6055
6047 6056 2002-04-17 Fernando Perez <fperez@colorado.edu>
6048 6057
6049 6058 * IPython/ipmaker.py (make_IPython): added rc_override option to
6050 6059 allow passing config options at creation time which may override
6051 6060 anything set in the config files or command line. This is
6052 6061 particularly useful for configuring embedded instances.
6053 6062
6054 6063 2002-04-15 Fernando Perez <fperez@colorado.edu>
6055 6064
6056 6065 * IPython/Logger.py (Logger.log): Fixed a nasty bug which could
6057 6066 crash embedded instances because of the input cache falling out of
6058 6067 sync with the output counter.
6059 6068
6060 6069 * IPython/Shell.py (IPythonShellEmbed.__init__): added a debug
6061 6070 mode which calls pdb after an uncaught exception in IPython itself.
6062 6071
6063 6072 2002-04-14 Fernando Perez <fperez@colorado.edu>
6064 6073
6065 6074 * IPython/iplib.py (InteractiveShell.showtraceback): pdb mucks up
6066 6075 readline, fix it back after each call.
6067 6076
6068 6077 * IPython/ultraTB.py (AutoFormattedTB.__text): made text a private
6069 6078 method to force all access via __call__(), which guarantees that
6070 6079 traceback references are properly deleted.
6071 6080
6072 6081 * IPython/Prompts.py (CachedOutput._display): minor fixes to
6073 6082 improve printing when pprint is in use.
6074 6083
6075 6084 2002-04-13 Fernando Perez <fperez@colorado.edu>
6076 6085
6077 6086 * IPython/Shell.py (IPythonShellEmbed.__call__): SystemExit
6078 6087 exceptions aren't caught anymore. If the user triggers one, he
6079 6088 should know why he's doing it and it should go all the way up,
6080 6089 just like any other exception. So now @abort will fully kill the
6081 6090 embedded interpreter and the embedding code (unless that happens
6082 6091 to catch SystemExit).
6083 6092
6084 6093 * IPython/ultraTB.py (VerboseTB.__init__): added a call_pdb flag
6085 6094 and a debugger() method to invoke the interactive pdb debugger
6086 6095 after printing exception information. Also added the corresponding
6087 6096 -pdb option and @pdb magic to control this feature, and updated
6088 6097 the docs. After a suggestion from Christopher Hart
6089 6098 (hart-AT-caltech.edu).
6090 6099
6091 6100 2002-04-12 Fernando Perez <fperez@colorado.edu>
6092 6101
6093 6102 * IPython/Shell.py (IPythonShellEmbed.__init__): modified to use
6094 6103 the exception handlers defined by the user (not the CrashHandler)
6095 6104 so that user exceptions don't trigger an ipython bug report.
6096 6105
6097 6106 * IPython/ultraTB.py (ColorTB.__init__): made the color scheme
6098 6107 configurable (it should have always been so).
6099 6108
6100 6109 2002-03-26 Fernando Perez <fperez@colorado.edu>
6101 6110
6102 6111 * IPython/Shell.py (IPythonShellEmbed.__call__): many changes here
6103 6112 and there to fix embedding namespace issues. This should all be
6104 6113 done in a more elegant way.
6105 6114
6106 6115 2002-03-25 Fernando Perez <fperez@colorado.edu>
6107 6116
6108 6117 * IPython/genutils.py (get_home_dir): Try to make it work under
6109 6118 win9x also.
6110 6119
6111 6120 2002-03-20 Fernando Perez <fperez@colorado.edu>
6112 6121
6113 6122 * IPython/Shell.py (IPythonShellEmbed.__init__): leave
6114 6123 sys.displayhook untouched upon __init__.
6115 6124
6116 6125 2002-03-19 Fernando Perez <fperez@colorado.edu>
6117 6126
6118 6127 * Released 0.2.9 (for embedding bug, basically).
6119 6128
6120 6129 * IPython/Shell.py (IPythonShellEmbed.__call__): Trap SystemExit
6121 6130 exceptions so that enclosing shell's state can be restored.
6122 6131
6123 6132 * Changed magic_gnuplot.py to magic-gnuplot.py to standardize
6124 6133 naming conventions in the .ipython/ dir.
6125 6134
6126 6135 * IPython/iplib.py (InteractiveShell.init_readline): removed '-'
6127 6136 from delimiters list so filenames with - in them get expanded.
6128 6137
6129 6138 * IPython/Shell.py (IPythonShellEmbed.__call__): fixed bug with
6130 6139 sys.displayhook not being properly restored after an embedded call.
6131 6140
6132 6141 2002-03-18 Fernando Perez <fperez@colorado.edu>
6133 6142
6134 6143 * Released 0.2.8
6135 6144
6136 6145 * IPython/iplib.py (InteractiveShell.user_setup): fixed bug where
6137 6146 some files weren't being included in a -upgrade.
6138 6147 (InteractiveShell.init_readline): Added 'set show-all-if-ambiguous
6139 6148 on' so that the first tab completes.
6140 6149 (InteractiveShell.handle_magic): fixed bug with spaces around
6141 6150 quotes breaking many magic commands.
6142 6151
6143 6152 * setup.py: added note about ignoring the syntax error messages at
6144 6153 installation.
6145 6154
6146 6155 * IPython/UserConfig/magic_gnuplot.py (magic_gp): finished
6147 6156 streamlining the gnuplot interface, now there's only one magic @gp.
6148 6157
6149 6158 2002-03-17 Fernando Perez <fperez@colorado.edu>
6150 6159
6151 6160 * IPython/UserConfig/magic_gnuplot.py: new name for the
6152 6161 example-magic_pm.py file. Much enhanced system, now with a shell
6153 6162 for communicating directly with gnuplot, one command at a time.
6154 6163
6155 6164 * IPython/Magic.py (Magic.magic_run): added option -n to prevent
6156 6165 setting __name__=='__main__'.
6157 6166
6158 6167 * IPython/UserConfig/example-magic_pm.py (magic_pm): Added
6159 6168 mini-shell for accessing gnuplot from inside ipython. Should
6160 6169 extend it later for grace access too. Inspired by Arnd's
6161 6170 suggestion.
6162 6171
6163 6172 * IPython/iplib.py (InteractiveShell.handle_magic): fixed bug when
6164 6173 calling magic functions with () in their arguments. Thanks to Arnd
6165 6174 Baecker for pointing this to me.
6166 6175
6167 6176 * IPython/numutils.py (sum_flat): fixed bug. Would recurse
6168 6177 infinitely for integer or complex arrays (only worked with floats).
6169 6178
6170 6179 2002-03-16 Fernando Perez <fperez@colorado.edu>
6171 6180
6172 6181 * setup.py: Merged setup and setup_windows into a single script
6173 6182 which properly handles things for windows users.
6174 6183
6175 6184 2002-03-15 Fernando Perez <fperez@colorado.edu>
6176 6185
6177 6186 * Big change to the manual: now the magics are all automatically
6178 6187 documented. This information is generated from their docstrings
6179 6188 and put in a latex file included by the manual lyx file. This way
6180 6189 we get always up to date information for the magics. The manual
6181 6190 now also has proper version information, also auto-synced.
6182 6191
6183 6192 For this to work, an undocumented --magic_docstrings option was added.
6184 6193
6185 6194 2002-03-13 Fernando Perez <fperez@colorado.edu>
6186 6195
6187 6196 * IPython/ultraTB.py (TermColors): fixed problem with dark colors
6188 6197 under CDE terminals. An explicit ;2 color reset is needed in the escapes.
6189 6198
6190 6199 2002-03-12 Fernando Perez <fperez@colorado.edu>
6191 6200
6192 6201 * IPython/ultraTB.py (TermColors): changed color escapes again to
6193 6202 fix the (old, reintroduced) line-wrapping bug. Basically, if
6194 6203 \001..\002 aren't given in the color escapes, lines get wrapped
6195 6204 weirdly. But giving those screws up old xterms and emacs terms. So
6196 6205 I added some logic for emacs terms to be ok, but I can't identify old
6197 6206 xterms separately ($TERM=='xterm' for many terminals, like konsole).
6198 6207
6199 6208 2002-03-10 Fernando Perez <fperez@colorado.edu>
6200 6209
6201 6210 * IPython/usage.py (__doc__): Various documentation cleanups and
6202 6211 updates, both in usage docstrings and in the manual.
6203 6212
6204 6213 * IPython/Prompts.py (CachedOutput.set_colors): cleanups for
6205 6214 handling of caching. Set minimum acceptabe value for having a
6206 6215 cache at 20 values.
6207 6216
6208 6217 * IPython/iplib.py (InteractiveShell.user_setup): moved the
6209 6218 install_first_time function to a method, renamed it and added an
6210 6219 'upgrade' mode. Now people can update their config directory with
6211 6220 a simple command line switch (-upgrade, also new).
6212 6221
6213 6222 * IPython/Magic.py (Magic.magic_pfile): Made @pfile an alias to
6214 6223 @file (convenient for automagic users under Python >= 2.2).
6215 6224 Removed @files (it seemed more like a plural than an abbrev. of
6216 6225 'file show').
6217 6226
6218 6227 * IPython/iplib.py (install_first_time): Fixed crash if there were
6219 6228 backup files ('~') in .ipython/ install directory.
6220 6229
6221 6230 * IPython/ipmaker.py (make_IPython): fixes for new prompt
6222 6231 system. Things look fine, but these changes are fairly
6223 6232 intrusive. Test them for a few days.
6224 6233
6225 6234 * IPython/Prompts.py (CachedOutput.__init__): Massive rewrite of
6226 6235 the prompts system. Now all in/out prompt strings are user
6227 6236 controllable. This is particularly useful for embedding, as one
6228 6237 can tag embedded instances with particular prompts.
6229 6238
6230 6239 Also removed global use of sys.ps1/2, which now allows nested
6231 6240 embeddings without any problems. Added command-line options for
6232 6241 the prompt strings.
6233 6242
6234 6243 2002-03-08 Fernando Perez <fperez@colorado.edu>
6235 6244
6236 6245 * IPython/UserConfig/example-embed-short.py (ipshell): added
6237 6246 example file with the bare minimum code for embedding.
6238 6247
6239 6248 * IPython/Shell.py (IPythonShellEmbed.set_dummy_mode): added
6240 6249 functionality for the embeddable shell to be activated/deactivated
6241 6250 either globally or at each call.
6242 6251
6243 6252 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixes the problem of
6244 6253 rewriting the prompt with '--->' for auto-inputs with proper
6245 6254 coloring. Now the previous UGLY hack in handle_auto() is gone, and
6246 6255 this is handled by the prompts class itself, as it should.
6247 6256
6248 6257 2002-03-05 Fernando Perez <fperez@colorado.edu>
6249 6258
6250 6259 * IPython/Magic.py (Magic.magic_logstart): Changed @log to
6251 6260 @logstart to avoid name clashes with the math log function.
6252 6261
6253 6262 * Big updates to X/Emacs section of the manual.
6254 6263
6255 6264 * Removed ipython_emacs. Milan explained to me how to pass
6256 6265 arguments to ipython through Emacs. Some day I'm going to end up
6257 6266 learning some lisp...
6258 6267
6259 6268 2002-03-04 Fernando Perez <fperez@colorado.edu>
6260 6269
6261 6270 * IPython/ipython_emacs: Created script to be used as the
6262 6271 py-python-command Emacs variable so we can pass IPython
6263 6272 parameters. I can't figure out how to tell Emacs directly to pass
6264 6273 parameters to IPython, so a dummy shell script will do it.
6265 6274
6266 6275 Other enhancements made for things to work better under Emacs'
6267 6276 various types of terminals. Many thanks to Milan Zamazal
6268 6277 <pdm-AT-zamazal.org> for all the suggestions and pointers.
6269 6278
6270 6279 2002-03-01 Fernando Perez <fperez@colorado.edu>
6271 6280
6272 6281 * IPython/ipmaker.py (make_IPython): added a --readline! option so
6273 6282 that loading of readline is now optional. This gives better
6274 6283 control to emacs users.
6275 6284
6276 6285 * IPython/ultraTB.py (__date__): Modified color escape sequences
6277 6286 and now things work fine under xterm and in Emacs' term buffers
6278 6287 (though not shell ones). Well, in emacs you get colors, but all
6279 6288 seem to be 'light' colors (no difference between dark and light
6280 6289 ones). But the garbage chars are gone, and also in xterms. It
6281 6290 seems that now I'm using 'cleaner' ansi sequences.
6282 6291
6283 6292 2002-02-21 Fernando Perez <fperez@colorado.edu>
6284 6293
6285 6294 * Released 0.2.7 (mainly to publish the scoping fix).
6286 6295
6287 6296 * IPython/Logger.py (Logger.logstate): added. A corresponding
6288 6297 @logstate magic was created.
6289 6298
6290 6299 * IPython/Magic.py: fixed nested scoping problem under Python
6291 6300 2.1.x (automagic wasn't working).
6292 6301
6293 6302 2002-02-20 Fernando Perez <fperez@colorado.edu>
6294 6303
6295 6304 * Released 0.2.6.
6296 6305
6297 6306 * IPython/OutputTrap.py (OutputTrap.__init__): added a 'quiet'
6298 6307 option so that logs can come out without any headers at all.
6299 6308
6300 6309 * IPython/UserConfig/ipythonrc-scipy.py: created a profile for
6301 6310 SciPy.
6302 6311
6303 6312 * IPython/iplib.py (InteractiveShell.embed_mainloop): Changed so
6304 6313 that embedded IPython calls don't require vars() to be explicitly
6305 6314 passed. Now they are extracted from the caller's frame (code
6306 6315 snatched from Eric Jones' weave). Added better documentation to
6307 6316 the section on embedding and the example file.
6308 6317
6309 6318 * IPython/genutils.py (page): Changed so that under emacs, it just
6310 6319 prints the string. You can then page up and down in the emacs
6311 6320 buffer itself. This is how the builtin help() works.
6312 6321
6313 6322 * IPython/Prompts.py (CachedOutput.__call__): Fixed issue with
6314 6323 macro scoping: macros need to be executed in the user's namespace
6315 6324 to work as if they had been typed by the user.
6316 6325
6317 6326 * IPython/Magic.py (Magic.magic_macro): Changed macros so they
6318 6327 execute automatically (no need to type 'exec...'). They then
6319 6328 behave like 'true macros'. The printing system was also modified
6320 6329 for this to work.
6321 6330
6322 6331 2002-02-19 Fernando Perez <fperez@colorado.edu>
6323 6332
6324 6333 * IPython/genutils.py (page_file): new function for paging files
6325 6334 in an OS-independent way. Also necessary for file viewing to work
6326 6335 well inside Emacs buffers.
6327 6336 (page): Added checks for being in an emacs buffer.
6328 6337 (page): fixed bug for Windows ($TERM isn't set in Windows). Fixed
6329 6338 same bug in iplib.
6330 6339
6331 6340 2002-02-18 Fernando Perez <fperez@colorado.edu>
6332 6341
6333 6342 * IPython/iplib.py (InteractiveShell.init_readline): modified use
6334 6343 of readline so that IPython can work inside an Emacs buffer.
6335 6344
6336 6345 * IPython/ultraTB.py (AutoFormattedTB.__call__): some fixes to
6337 6346 method signatures (they weren't really bugs, but it looks cleaner
6338 6347 and keeps PyChecker happy).
6339 6348
6340 6349 * IPython/ipmaker.py (make_IPython): added hooks Struct to __IP
6341 6350 for implementing various user-defined hooks. Currently only
6342 6351 display is done.
6343 6352
6344 6353 * IPython/Prompts.py (CachedOutput._display): changed display
6345 6354 functions so that they can be dynamically changed by users easily.
6346 6355
6347 6356 * IPython/Extensions/numeric_formats.py (num_display): added an
6348 6357 extension for printing NumPy arrays in flexible manners. It
6349 6358 doesn't do anything yet, but all the structure is in
6350 6359 place. Ultimately the plan is to implement output format control
6351 6360 like in Octave.
6352 6361
6353 6362 * IPython/Magic.py (Magic.lsmagic): changed so that bound magic
6354 6363 methods are found at run-time by all the automatic machinery.
6355 6364
6356 6365 2002-02-17 Fernando Perez <fperez@colorado.edu>
6357 6366
6358 6367 * setup_Windows.py (make_shortcut): documented. Cleaned up the
6359 6368 whole file a little.
6360 6369
6361 6370 * ToDo: closed this document. Now there's a new_design.lyx
6362 6371 document for all new ideas. Added making a pdf of it for the
6363 6372 end-user distro.
6364 6373
6365 6374 * IPython/Logger.py (Logger.switch_log): Created this to replace
6366 6375 logon() and logoff(). It also fixes a nasty crash reported by
6367 6376 Philip Hisley <compsys-AT-starpower.net>. Many thanks to him.
6368 6377
6369 6378 * IPython/iplib.py (complete): got auto-completion to work with
6370 6379 automagic (I had wanted this for a long time).
6371 6380
6372 6381 * IPython/Magic.py (Magic.magic_files): Added @files as an alias
6373 6382 to @file, since file() is now a builtin and clashes with automagic
6374 6383 for @file.
6375 6384
6376 6385 * Made some new files: Prompts, CrashHandler, Magic, Logger. All
6377 6386 of this was previously in iplib, which had grown to more than 2000
6378 6387 lines, way too long. No new functionality, but it makes managing
6379 6388 the code a bit easier.
6380 6389
6381 6390 * IPython/iplib.py (IPythonCrashHandler.__call__): Added version
6382 6391 information to crash reports.
6383 6392
6384 6393 2002-02-12 Fernando Perez <fperez@colorado.edu>
6385 6394
6386 6395 * Released 0.2.5.
6387 6396
6388 6397 2002-02-11 Fernando Perez <fperez@colorado.edu>
6389 6398
6390 6399 * Wrote a relatively complete Windows installer. It puts
6391 6400 everything in place, creates Start Menu entries and fixes the
6392 6401 color issues. Nothing fancy, but it works.
6393 6402
6394 6403 2002-02-10 Fernando Perez <fperez@colorado.edu>
6395 6404
6396 6405 * IPython/iplib.py (InteractiveShell.safe_execfile): added an
6397 6406 os.path.expanduser() call so that we can type @run ~/myfile.py and
6398 6407 have thigs work as expected.
6399 6408
6400 6409 * IPython/genutils.py (page): fixed exception handling so things
6401 6410 work both in Unix and Windows correctly. Quitting a pager triggers
6402 6411 an IOError/broken pipe in Unix, and in windows not finding a pager
6403 6412 is also an IOError, so I had to actually look at the return value
6404 6413 of the exception, not just the exception itself. Should be ok now.
6405 6414
6406 6415 * IPython/ultraTB.py (ColorSchemeTable.set_active_scheme):
6407 6416 modified to allow case-insensitive color scheme changes.
6408 6417
6409 6418 2002-02-09 Fernando Perez <fperez@colorado.edu>
6410 6419
6411 6420 * IPython/genutils.py (native_line_ends): new function to leave
6412 6421 user config files with os-native line-endings.
6413 6422
6414 6423 * README and manual updates.
6415 6424
6416 6425 * IPython/genutils.py: fixed unicode bug: use types.StringTypes
6417 6426 instead of StringType to catch Unicode strings.
6418 6427
6419 6428 * IPython/genutils.py (filefind): fixed bug for paths with
6420 6429 embedded spaces (very common in Windows).
6421 6430
6422 6431 * IPython/ipmaker.py (make_IPython): added a '.ini' to the rc
6423 6432 files under Windows, so that they get automatically associated
6424 6433 with a text editor. Windows makes it a pain to handle
6425 6434 extension-less files.
6426 6435
6427 6436 * IPython/iplib.py (InteractiveShell.init_readline): Made the
6428 6437 warning about readline only occur for Posix. In Windows there's no
6429 6438 way to get readline, so why bother with the warning.
6430 6439
6431 6440 * IPython/Struct.py (Struct.__str__): fixed to use self.__dict__
6432 6441 for __str__ instead of dir(self), since dir() changed in 2.2.
6433 6442
6434 6443 * Ported to Windows! Tested on XP, I suspect it should work fine
6435 6444 on NT/2000, but I don't think it will work on 98 et al. That
6436 6445 series of Windows is such a piece of junk anyway that I won't try
6437 6446 porting it there. The XP port was straightforward, showed a few
6438 6447 bugs here and there (fixed all), in particular some string
6439 6448 handling stuff which required considering Unicode strings (which
6440 6449 Windows uses). This is good, but hasn't been too tested :) No
6441 6450 fancy installer yet, I'll put a note in the manual so people at
6442 6451 least make manually a shortcut.
6443 6452
6444 6453 * IPython/iplib.py (Magic.magic_colors): Unified the color options
6445 6454 into a single one, "colors". This now controls both prompt and
6446 6455 exception color schemes, and can be changed both at startup
6447 6456 (either via command-line switches or via ipythonrc files) and at
6448 6457 runtime, with @colors.
6449 6458 (Magic.magic_run): renamed @prun to @run and removed the old
6450 6459 @run. The two were too similar to warrant keeping both.
6451 6460
6452 6461 2002-02-03 Fernando Perez <fperez@colorado.edu>
6453 6462
6454 6463 * IPython/iplib.py (install_first_time): Added comment on how to
6455 6464 configure the color options for first-time users. Put a <return>
6456 6465 request at the end so that small-terminal users get a chance to
6457 6466 read the startup info.
6458 6467
6459 6468 2002-01-23 Fernando Perez <fperez@colorado.edu>
6460 6469
6461 6470 * IPython/iplib.py (CachedOutput.update): Changed output memory
6462 6471 variable names from _o,_oo,_ooo,_o<n> to simply _,__,___,_<n>. For
6463 6472 input history we still use _i. Did this b/c these variable are
6464 6473 very commonly used in interactive work, so the less we need to
6465 6474 type the better off we are.
6466 6475 (Magic.magic_prun): updated @prun to better handle the namespaces
6467 6476 the file will run in, including a fix for __name__ not being set
6468 6477 before.
6469 6478
6470 6479 2002-01-20 Fernando Perez <fperez@colorado.edu>
6471 6480
6472 6481 * IPython/ultraTB.py (VerboseTB.linereader): Fixed printing of
6473 6482 extra garbage for Python 2.2. Need to look more carefully into
6474 6483 this later.
6475 6484
6476 6485 2002-01-19 Fernando Perez <fperez@colorado.edu>
6477 6486
6478 6487 * IPython/iplib.py (InteractiveShell.showtraceback): fixed to
6479 6488 display SyntaxError exceptions properly formatted when they occur
6480 6489 (they can be triggered by imported code).
6481 6490
6482 6491 2002-01-18 Fernando Perez <fperez@colorado.edu>
6483 6492
6484 6493 * IPython/iplib.py (InteractiveShell.safe_execfile): now
6485 6494 SyntaxError exceptions are reported nicely formatted, instead of
6486 6495 spitting out only offset information as before.
6487 6496 (Magic.magic_prun): Added the @prun function for executing
6488 6497 programs with command line args inside IPython.
6489 6498
6490 6499 2002-01-16 Fernando Perez <fperez@colorado.edu>
6491 6500
6492 6501 * IPython/iplib.py (Magic.magic_hist): Changed @hist and @dhist
6493 6502 to *not* include the last item given in a range. This brings their
6494 6503 behavior in line with Python's slicing:
6495 6504 a[n1:n2] -> a[n1]...a[n2-1]
6496 6505 It may be a bit less convenient, but I prefer to stick to Python's
6497 6506 conventions *everywhere*, so users never have to wonder.
6498 6507 (Magic.magic_macro): Added @macro function to ease the creation of
6499 6508 macros.
6500 6509
6501 6510 2002-01-05 Fernando Perez <fperez@colorado.edu>
6502 6511
6503 6512 * Released 0.2.4.
6504 6513
6505 6514 * IPython/iplib.py (Magic.magic_pdef):
6506 6515 (InteractiveShell.safe_execfile): report magic lines and error
6507 6516 lines without line numbers so one can easily copy/paste them for
6508 6517 re-execution.
6509 6518
6510 6519 * Updated manual with recent changes.
6511 6520
6512 6521 * IPython/iplib.py (Magic.magic_oinfo): added constructor
6513 6522 docstring printing when class? is called. Very handy for knowing
6514 6523 how to create class instances (as long as __init__ is well
6515 6524 documented, of course :)
6516 6525 (Magic.magic_doc): print both class and constructor docstrings.
6517 6526 (Magic.magic_pdef): give constructor info if passed a class and
6518 6527 __call__ info for callable object instances.
6519 6528
6520 6529 2002-01-04 Fernando Perez <fperez@colorado.edu>
6521 6530
6522 6531 * Made deep_reload() off by default. It doesn't always work
6523 6532 exactly as intended, so it's probably safer to have it off. It's
6524 6533 still available as dreload() anyway, so nothing is lost.
6525 6534
6526 6535 2002-01-02 Fernando Perez <fperez@colorado.edu>
6527 6536
6528 6537 * Released 0.2.3 (contacted R.Singh at CU about biopython course,
6529 6538 so I wanted an updated release).
6530 6539
6531 6540 2001-12-27 Fernando Perez <fperez@colorado.edu>
6532 6541
6533 6542 * IPython/iplib.py (InteractiveShell.interact): Added the original
6534 6543 code from 'code.py' for this module in order to change the
6535 6544 handling of a KeyboardInterrupt. This was necessary b/c otherwise
6536 6545 the history cache would break when the user hit Ctrl-C, and
6537 6546 interact() offers no way to add any hooks to it.
6538 6547
6539 6548 2001-12-23 Fernando Perez <fperez@colorado.edu>
6540 6549
6541 6550 * setup.py: added check for 'MANIFEST' before trying to remove
6542 6551 it. Thanks to Sean Reifschneider.
6543 6552
6544 6553 2001-12-22 Fernando Perez <fperez@colorado.edu>
6545 6554
6546 6555 * Released 0.2.2.
6547 6556
6548 6557 * Finished (reasonably) writing the manual. Later will add the
6549 6558 python-standard navigation stylesheets, but for the time being
6550 6559 it's fairly complete. Distribution will include html and pdf
6551 6560 versions.
6552 6561
6553 6562 * Bugfix: '.' wasn't being added to sys.path. Thanks to Prabhu
6554 6563 (MayaVi author).
6555 6564
6556 6565 2001-12-21 Fernando Perez <fperez@colorado.edu>
6557 6566
6558 6567 * Released 0.2.1. Barring any nasty bugs, this is it as far as a
6559 6568 good public release, I think (with the manual and the distutils
6560 6569 installer). The manual can use some work, but that can go
6561 6570 slowly. Otherwise I think it's quite nice for end users. Next
6562 6571 summer, rewrite the guts of it...
6563 6572
6564 6573 * Changed format of ipythonrc files to use whitespace as the
6565 6574 separator instead of an explicit '='. Cleaner.
6566 6575
6567 6576 2001-12-20 Fernando Perez <fperez@colorado.edu>
6568 6577
6569 6578 * Started a manual in LyX. For now it's just a quick merge of the
6570 6579 various internal docstrings and READMEs. Later it may grow into a
6571 6580 nice, full-blown manual.
6572 6581
6573 6582 * Set up a distutils based installer. Installation should now be
6574 6583 trivially simple for end-users.
6575 6584
6576 6585 2001-12-11 Fernando Perez <fperez@colorado.edu>
6577 6586
6578 6587 * Released 0.2.0. First public release, announced it at
6579 6588 comp.lang.python. From now on, just bugfixes...
6580 6589
6581 6590 * Went through all the files, set copyright/license notices and
6582 6591 cleaned up things. Ready for release.
6583 6592
6584 6593 2001-12-10 Fernando Perez <fperez@colorado.edu>
6585 6594
6586 6595 * Changed the first-time installer not to use tarfiles. It's more
6587 6596 robust now and less unix-dependent. Also makes it easier for
6588 6597 people to later upgrade versions.
6589 6598
6590 6599 * Changed @exit to @abort to reflect the fact that it's pretty
6591 6600 brutal (a sys.exit()). The difference between @abort and Ctrl-D
6592 6601 becomes significant only when IPyhton is embedded: in that case,
6593 6602 C-D closes IPython only, but @abort kills the enclosing program
6594 6603 too (unless it had called IPython inside a try catching
6595 6604 SystemExit).
6596 6605
6597 6606 * Created Shell module which exposes the actuall IPython Shell
6598 6607 classes, currently the normal and the embeddable one. This at
6599 6608 least offers a stable interface we won't need to change when
6600 6609 (later) the internals are rewritten. That rewrite will be confined
6601 6610 to iplib and ipmaker, but the Shell interface should remain as is.
6602 6611
6603 6612 * Added embed module which offers an embeddable IPShell object,
6604 6613 useful to fire up IPython *inside* a running program. Great for
6605 6614 debugging or dynamical data analysis.
6606 6615
6607 6616 2001-12-08 Fernando Perez <fperez@colorado.edu>
6608 6617
6609 6618 * Fixed small bug preventing seeing info from methods of defined
6610 6619 objects (incorrect namespace in _ofind()).
6611 6620
6612 6621 * Documentation cleanup. Moved the main usage docstrings to a
6613 6622 separate file, usage.py (cleaner to maintain, and hopefully in the
6614 6623 future some perlpod-like way of producing interactive, man and
6615 6624 html docs out of it will be found).
6616 6625
6617 6626 * Added @profile to see your profile at any time.
6618 6627
6619 6628 * Added @p as an alias for 'print'. It's especially convenient if
6620 6629 using automagic ('p x' prints x).
6621 6630
6622 6631 * Small cleanups and fixes after a pychecker run.
6623 6632
6624 6633 * Changed the @cd command to handle @cd - and @cd -<n> for
6625 6634 visiting any directory in _dh.
6626 6635
6627 6636 * Introduced _dh, a history of visited directories. @dhist prints
6628 6637 it out with numbers.
6629 6638
6630 6639 2001-12-07 Fernando Perez <fperez@colorado.edu>
6631 6640
6632 6641 * Released 0.1.22
6633 6642
6634 6643 * Made initialization a bit more robust against invalid color
6635 6644 options in user input (exit, not traceback-crash).
6636 6645
6637 6646 * Changed the bug crash reporter to write the report only in the
6638 6647 user's .ipython directory. That way IPython won't litter people's
6639 6648 hard disks with crash files all over the place. Also print on
6640 6649 screen the necessary mail command.
6641 6650
6642 6651 * With the new ultraTB, implemented LightBG color scheme for light
6643 6652 background terminals. A lot of people like white backgrounds, so I
6644 6653 guess we should at least give them something readable.
6645 6654
6646 6655 2001-12-06 Fernando Perez <fperez@colorado.edu>
6647 6656
6648 6657 * Modified the structure of ultraTB. Now there's a proper class
6649 6658 for tables of color schemes which allow adding schemes easily and
6650 6659 switching the active scheme without creating a new instance every
6651 6660 time (which was ridiculous). The syntax for creating new schemes
6652 6661 is also cleaner. I think ultraTB is finally done, with a clean
6653 6662 class structure. Names are also much cleaner (now there's proper
6654 6663 color tables, no need for every variable to also have 'color' in
6655 6664 its name).
6656 6665
6657 6666 * Broke down genutils into separate files. Now genutils only
6658 6667 contains utility functions, and classes have been moved to their
6659 6668 own files (they had enough independent functionality to warrant
6660 6669 it): ConfigLoader, OutputTrap, Struct.
6661 6670
6662 6671 2001-12-05 Fernando Perez <fperez@colorado.edu>
6663 6672
6664 6673 * IPython turns 21! Released version 0.1.21, as a candidate for
6665 6674 public consumption. If all goes well, release in a few days.
6666 6675
6667 6676 * Fixed path bug (files in Extensions/ directory wouldn't be found
6668 6677 unless IPython/ was explicitly in sys.path).
6669 6678
6670 6679 * Extended the FlexCompleter class as MagicCompleter to allow
6671 6680 completion of @-starting lines.
6672 6681
6673 6682 * Created __release__.py file as a central repository for release
6674 6683 info that other files can read from.
6675 6684
6676 6685 * Fixed small bug in logging: when logging was turned on in
6677 6686 mid-session, old lines with special meanings (!@?) were being
6678 6687 logged without the prepended comment, which is necessary since
6679 6688 they are not truly valid python syntax. This should make session
6680 6689 restores produce less errors.
6681 6690
6682 6691 * The namespace cleanup forced me to make a FlexCompleter class
6683 6692 which is nothing but a ripoff of rlcompleter, but with selectable
6684 6693 namespace (rlcompleter only works in __main__.__dict__). I'll try
6685 6694 to submit a note to the authors to see if this change can be
6686 6695 incorporated in future rlcompleter releases (Dec.6: done)
6687 6696
6688 6697 * More fixes to namespace handling. It was a mess! Now all
6689 6698 explicit references to __main__.__dict__ are gone (except when
6690 6699 really needed) and everything is handled through the namespace
6691 6700 dicts in the IPython instance. We seem to be getting somewhere
6692 6701 with this, finally...
6693 6702
6694 6703 * Small documentation updates.
6695 6704
6696 6705 * Created the Extensions directory under IPython (with an
6697 6706 __init__.py). Put the PhysicalQ stuff there. This directory should
6698 6707 be used for all special-purpose extensions.
6699 6708
6700 6709 * File renaming:
6701 6710 ipythonlib --> ipmaker
6702 6711 ipplib --> iplib
6703 6712 This makes a bit more sense in terms of what these files actually do.
6704 6713
6705 6714 * Moved all the classes and functions in ipythonlib to ipplib, so
6706 6715 now ipythonlib only has make_IPython(). This will ease up its
6707 6716 splitting in smaller functional chunks later.
6708 6717
6709 6718 * Cleaned up (done, I think) output of @whos. Better column
6710 6719 formatting, and now shows str(var) for as much as it can, which is
6711 6720 typically what one gets with a 'print var'.
6712 6721
6713 6722 2001-12-04 Fernando Perez <fperez@colorado.edu>
6714 6723
6715 6724 * Fixed namespace problems. Now builtin/IPyhton/user names get
6716 6725 properly reported in their namespace. Internal namespace handling
6717 6726 is finally getting decent (not perfect yet, but much better than
6718 6727 the ad-hoc mess we had).
6719 6728
6720 6729 * Removed -exit option. If people just want to run a python
6721 6730 script, that's what the normal interpreter is for. Less
6722 6731 unnecessary options, less chances for bugs.
6723 6732
6724 6733 * Added a crash handler which generates a complete post-mortem if
6725 6734 IPython crashes. This will help a lot in tracking bugs down the
6726 6735 road.
6727 6736
6728 6737 * Fixed nasty bug in auto-evaluation part of prefilter(). Names
6729 6738 which were boud to functions being reassigned would bypass the
6730 6739 logger, breaking the sync of _il with the prompt counter. This
6731 6740 would then crash IPython later when a new line was logged.
6732 6741
6733 6742 2001-12-02 Fernando Perez <fperez@colorado.edu>
6734 6743
6735 6744 * Made IPython a package. This means people don't have to clutter
6736 6745 their sys.path with yet another directory. Changed the INSTALL
6737 6746 file accordingly.
6738 6747
6739 6748 * Cleaned up the output of @who_ls, @who and @whos. @who_ls now
6740 6749 sorts its output (so @who shows it sorted) and @whos formats the
6741 6750 table according to the width of the first column. Nicer, easier to
6742 6751 read. Todo: write a generic table_format() which takes a list of
6743 6752 lists and prints it nicely formatted, with optional row/column
6744 6753 separators and proper padding and justification.
6745 6754
6746 6755 * Released 0.1.20
6747 6756
6748 6757 * Fixed bug in @log which would reverse the inputcache list (a
6749 6758 copy operation was missing).
6750 6759
6751 6760 * Code cleanup. @config was changed to use page(). Better, since
6752 6761 its output is always quite long.
6753 6762
6754 6763 * Itpl is back as a dependency. I was having too many problems
6755 6764 getting the parametric aliases to work reliably, and it's just
6756 6765 easier to code weird string operations with it than playing %()s
6757 6766 games. It's only ~6k, so I don't think it's too big a deal.
6758 6767
6759 6768 * Found (and fixed) a very nasty bug with history. !lines weren't
6760 6769 getting cached, and the out of sync caches would crash
6761 6770 IPython. Fixed it by reorganizing the prefilter/handlers/logger
6762 6771 division of labor a bit better. Bug fixed, cleaner structure.
6763 6772
6764 6773 2001-12-01 Fernando Perez <fperez@colorado.edu>
6765 6774
6766 6775 * Released 0.1.19
6767 6776
6768 6777 * Added option -n to @hist to prevent line number printing. Much
6769 6778 easier to copy/paste code this way.
6770 6779
6771 6780 * Created global _il to hold the input list. Allows easy
6772 6781 re-execution of blocks of code by slicing it (inspired by Janko's
6773 6782 comment on 'macros').
6774 6783
6775 6784 * Small fixes and doc updates.
6776 6785
6777 6786 * Rewrote @history function (was @h). Renamed it to @hist, @h is
6778 6787 much too fragile with automagic. Handles properly multi-line
6779 6788 statements and takes parameters.
6780 6789
6781 6790 2001-11-30 Fernando Perez <fperez@colorado.edu>
6782 6791
6783 6792 * Version 0.1.18 released.
6784 6793
6785 6794 * Fixed nasty namespace bug in initial module imports.
6786 6795
6787 6796 * Added copyright/license notes to all code files (except
6788 6797 DPyGetOpt). For the time being, LGPL. That could change.
6789 6798
6790 6799 * Rewrote a much nicer README, updated INSTALL, cleaned up
6791 6800 ipythonrc-* samples.
6792 6801
6793 6802 * Overall code/documentation cleanup. Basically ready for
6794 6803 release. Only remaining thing: licence decision (LGPL?).
6795 6804
6796 6805 * Converted load_config to a class, ConfigLoader. Now recursion
6797 6806 control is better organized. Doesn't include the same file twice.
6798 6807
6799 6808 2001-11-29 Fernando Perez <fperez@colorado.edu>
6800 6809
6801 6810 * Got input history working. Changed output history variables from
6802 6811 _p to _o so that _i is for input and _o for output. Just cleaner
6803 6812 convention.
6804 6813
6805 6814 * Implemented parametric aliases. This pretty much allows the
6806 6815 alias system to offer full-blown shell convenience, I think.
6807 6816
6808 6817 * Version 0.1.17 released, 0.1.18 opened.
6809 6818
6810 6819 * dot_ipython/ipythonrc (alias): added documentation.
6811 6820 (xcolor): Fixed small bug (xcolors -> xcolor)
6812 6821
6813 6822 * Changed the alias system. Now alias is a magic command to define
6814 6823 aliases just like the shell. Rationale: the builtin magics should
6815 6824 be there for things deeply connected to IPython's
6816 6825 architecture. And this is a much lighter system for what I think
6817 6826 is the really important feature: allowing users to define quickly
6818 6827 magics that will do shell things for them, so they can customize
6819 6828 IPython easily to match their work habits. If someone is really
6820 6829 desperate to have another name for a builtin alias, they can
6821 6830 always use __IP.magic_newname = __IP.magic_oldname. Hackish but
6822 6831 works.
6823 6832
6824 6833 2001-11-28 Fernando Perez <fperez@colorado.edu>
6825 6834
6826 6835 * Changed @file so that it opens the source file at the proper
6827 6836 line. Since it uses less, if your EDITOR environment is
6828 6837 configured, typing v will immediately open your editor of choice
6829 6838 right at the line where the object is defined. Not as quick as
6830 6839 having a direct @edit command, but for all intents and purposes it
6831 6840 works. And I don't have to worry about writing @edit to deal with
6832 6841 all the editors, less does that.
6833 6842
6834 6843 * Version 0.1.16 released, 0.1.17 opened.
6835 6844
6836 6845 * Fixed some nasty bugs in the page/page_dumb combo that could
6837 6846 crash IPython.
6838 6847
6839 6848 2001-11-27 Fernando Perez <fperez@colorado.edu>
6840 6849
6841 6850 * Version 0.1.15 released, 0.1.16 opened.
6842 6851
6843 6852 * Finally got ? and ?? to work for undefined things: now it's
6844 6853 possible to type {}.get? and get information about the get method
6845 6854 of dicts, or os.path? even if only os is defined (so technically
6846 6855 os.path isn't). Works at any level. For example, after import os,
6847 6856 os?, os.path?, os.path.abspath? all work. This is great, took some
6848 6857 work in _ofind.
6849 6858
6850 6859 * Fixed more bugs with logging. The sanest way to do it was to add
6851 6860 to @log a 'mode' parameter. Killed two in one shot (this mode
6852 6861 option was a request of Janko's). I think it's finally clean
6853 6862 (famous last words).
6854 6863
6855 6864 * Added a page_dumb() pager which does a decent job of paging on
6856 6865 screen, if better things (like less) aren't available. One less
6857 6866 unix dependency (someday maybe somebody will port this to
6858 6867 windows).
6859 6868
6860 6869 * Fixed problem in magic_log: would lock of logging out if log
6861 6870 creation failed (because it would still think it had succeeded).
6862 6871
6863 6872 * Improved the page() function using curses to auto-detect screen
6864 6873 size. Now it can make a much better decision on whether to print
6865 6874 or page a string. Option screen_length was modified: a value 0
6866 6875 means auto-detect, and that's the default now.
6867 6876
6868 6877 * Version 0.1.14 released, 0.1.15 opened. I think this is ready to
6869 6878 go out. I'll test it for a few days, then talk to Janko about
6870 6879 licences and announce it.
6871 6880
6872 6881 * Fixed the length of the auto-generated ---> prompt which appears
6873 6882 for auto-parens and auto-quotes. Getting this right isn't trivial,
6874 6883 with all the color escapes, different prompt types and optional
6875 6884 separators. But it seems to be working in all the combinations.
6876 6885
6877 6886 2001-11-26 Fernando Perez <fperez@colorado.edu>
6878 6887
6879 6888 * Wrote a regexp filter to get option types from the option names
6880 6889 string. This eliminates the need to manually keep two duplicate
6881 6890 lists.
6882 6891
6883 6892 * Removed the unneeded check_option_names. Now options are handled
6884 6893 in a much saner manner and it's easy to visually check that things
6885 6894 are ok.
6886 6895
6887 6896 * Updated version numbers on all files I modified to carry a
6888 6897 notice so Janko and Nathan have clear version markers.
6889 6898
6890 6899 * Updated docstring for ultraTB with my changes. I should send
6891 6900 this to Nathan.
6892 6901
6893 6902 * Lots of small fixes. Ran everything through pychecker again.
6894 6903
6895 6904 * Made loading of deep_reload an cmd line option. If it's not too
6896 6905 kosher, now people can just disable it. With -nodeep_reload it's
6897 6906 still available as dreload(), it just won't overwrite reload().
6898 6907
6899 6908 * Moved many options to the no| form (-opt and -noopt
6900 6909 accepted). Cleaner.
6901 6910
6902 6911 * Changed magic_log so that if called with no parameters, it uses
6903 6912 'rotate' mode. That way auto-generated logs aren't automatically
6904 6913 over-written. For normal logs, now a backup is made if it exists
6905 6914 (only 1 level of backups). A new 'backup' mode was added to the
6906 6915 Logger class to support this. This was a request by Janko.
6907 6916
6908 6917 * Added @logoff/@logon to stop/restart an active log.
6909 6918
6910 6919 * Fixed a lot of bugs in log saving/replay. It was pretty
6911 6920 broken. Now special lines (!@,/) appear properly in the command
6912 6921 history after a log replay.
6913 6922
6914 6923 * Tried and failed to implement full session saving via pickle. My
6915 6924 idea was to pickle __main__.__dict__, but modules can't be
6916 6925 pickled. This would be a better alternative to replaying logs, but
6917 6926 seems quite tricky to get to work. Changed -session to be called
6918 6927 -logplay, which more accurately reflects what it does. And if we
6919 6928 ever get real session saving working, -session is now available.
6920 6929
6921 6930 * Implemented color schemes for prompts also. As for tracebacks,
6922 6931 currently only NoColor and Linux are supported. But now the
6923 6932 infrastructure is in place, based on a generic ColorScheme
6924 6933 class. So writing and activating new schemes both for the prompts
6925 6934 and the tracebacks should be straightforward.
6926 6935
6927 6936 * Version 0.1.13 released, 0.1.14 opened.
6928 6937
6929 6938 * Changed handling of options for output cache. Now counter is
6930 6939 hardwired starting at 1 and one specifies the maximum number of
6931 6940 entries *in the outcache* (not the max prompt counter). This is
6932 6941 much better, since many statements won't increase the cache
6933 6942 count. It also eliminated some confusing options, now there's only
6934 6943 one: cache_size.
6935 6944
6936 6945 * Added 'alias' magic function and magic_alias option in the
6937 6946 ipythonrc file. Now the user can easily define whatever names he
6938 6947 wants for the magic functions without having to play weird
6939 6948 namespace games. This gives IPython a real shell-like feel.
6940 6949
6941 6950 * Fixed doc/?/?? for magics. Now all work, in all forms (explicit
6942 6951 @ or not).
6943 6952
6944 6953 This was one of the last remaining 'visible' bugs (that I know
6945 6954 of). I think if I can clean up the session loading so it works
6946 6955 100% I'll release a 0.2.0 version on c.p.l (talk to Janko first
6947 6956 about licensing).
6948 6957
6949 6958 2001-11-25 Fernando Perez <fperez@colorado.edu>
6950 6959
6951 6960 * Rewrote somewhat oinfo (?/??). Nicer, now uses page() and
6952 6961 there's a cleaner distinction between what ? and ?? show.
6953 6962
6954 6963 * Added screen_length option. Now the user can define his own
6955 6964 screen size for page() operations.
6956 6965
6957 6966 * Implemented magic shell-like functions with automatic code
6958 6967 generation. Now adding another function is just a matter of adding
6959 6968 an entry to a dict, and the function is dynamically generated at
6960 6969 run-time. Python has some really cool features!
6961 6970
6962 6971 * Renamed many options to cleanup conventions a little. Now all
6963 6972 are lowercase, and only underscores where needed. Also in the code
6964 6973 option name tables are clearer.
6965 6974
6966 6975 * Changed prompts a little. Now input is 'In [n]:' instead of
6967 6976 'In[n]:='. This allows it the numbers to be aligned with the
6968 6977 Out[n] numbers, and removes usage of ':=' which doesn't exist in
6969 6978 Python (it was a Mathematica thing). The '...' continuation prompt
6970 6979 was also changed a little to align better.
6971 6980
6972 6981 * Fixed bug when flushing output cache. Not all _p<n> variables
6973 6982 exist, so their deletion needs to be wrapped in a try:
6974 6983
6975 6984 * Figured out how to properly use inspect.formatargspec() (it
6976 6985 requires the args preceded by *). So I removed all the code from
6977 6986 _get_pdef in Magic, which was just replicating that.
6978 6987
6979 6988 * Added test to prefilter to allow redefining magic function names
6980 6989 as variables. This is ok, since the @ form is always available,
6981 6990 but whe should allow the user to define a variable called 'ls' if
6982 6991 he needs it.
6983 6992
6984 6993 * Moved the ToDo information from README into a separate ToDo.
6985 6994
6986 6995 * General code cleanup and small bugfixes. I think it's close to a
6987 6996 state where it can be released, obviously with a big 'beta'
6988 6997 warning on it.
6989 6998
6990 6999 * Got the magic function split to work. Now all magics are defined
6991 7000 in a separate class. It just organizes things a bit, and now
6992 7001 Xemacs behaves nicer (it was choking on InteractiveShell b/c it
6993 7002 was too long).
6994 7003
6995 7004 * Changed @clear to @reset to avoid potential confusions with
6996 7005 the shell command clear. Also renamed @cl to @clear, which does
6997 7006 exactly what people expect it to from their shell experience.
6998 7007
6999 7008 Added a check to the @reset command (since it's so
7000 7009 destructive, it's probably a good idea to ask for confirmation).
7001 7010 But now reset only works for full namespace resetting. Since the
7002 7011 del keyword is already there for deleting a few specific
7003 7012 variables, I don't see the point of having a redundant magic
7004 7013 function for the same task.
7005 7014
7006 7015 2001-11-24 Fernando Perez <fperez@colorado.edu>
7007 7016
7008 7017 * Updated the builtin docs (esp. the ? ones).
7009 7018
7010 7019 * Ran all the code through pychecker. Not terribly impressed with
7011 7020 it: lots of spurious warnings and didn't really find anything of
7012 7021 substance (just a few modules being imported and not used).
7013 7022
7014 7023 * Implemented the new ultraTB functionality into IPython. New
7015 7024 option: xcolors. This chooses color scheme. xmode now only selects
7016 7025 between Plain and Verbose. Better orthogonality.
7017 7026
7018 7027 * Large rewrite of ultraTB. Much cleaner now, with a separation of
7019 7028 mode and color scheme for the exception handlers. Now it's
7020 7029 possible to have the verbose traceback with no coloring.
7021 7030
7022 7031 2001-11-23 Fernando Perez <fperez@colorado.edu>
7023 7032
7024 7033 * Version 0.1.12 released, 0.1.13 opened.
7025 7034
7026 7035 * Removed option to set auto-quote and auto-paren escapes by
7027 7036 user. The chances of breaking valid syntax are just too high. If
7028 7037 someone *really* wants, they can always dig into the code.
7029 7038
7030 7039 * Made prompt separators configurable.
7031 7040
7032 7041 2001-11-22 Fernando Perez <fperez@colorado.edu>
7033 7042
7034 7043 * Small bugfixes in many places.
7035 7044
7036 7045 * Removed the MyCompleter class from ipplib. It seemed redundant
7037 7046 with the C-p,C-n history search functionality. Less code to
7038 7047 maintain.
7039 7048
7040 7049 * Moved all the original ipython.py code into ipythonlib.py. Right
7041 7050 now it's just one big dump into a function called make_IPython, so
7042 7051 no real modularity has been gained. But at least it makes the
7043 7052 wrapper script tiny, and since ipythonlib is a module, it gets
7044 7053 compiled and startup is much faster.
7045 7054
7046 7055 This is a reasobably 'deep' change, so we should test it for a
7047 7056 while without messing too much more with the code.
7048 7057
7049 7058 2001-11-21 Fernando Perez <fperez@colorado.edu>
7050 7059
7051 7060 * Version 0.1.11 released, 0.1.12 opened for further work.
7052 7061
7053 7062 * Removed dependency on Itpl. It was only needed in one place. It
7054 7063 would be nice if this became part of python, though. It makes life
7055 7064 *a lot* easier in some cases.
7056 7065
7057 7066 * Simplified the prefilter code a bit. Now all handlers are
7058 7067 expected to explicitly return a value (at least a blank string).
7059 7068
7060 7069 * Heavy edits in ipplib. Removed the help system altogether. Now
7061 7070 obj?/?? is used for inspecting objects, a magic @doc prints
7062 7071 docstrings, and full-blown Python help is accessed via the 'help'
7063 7072 keyword. This cleans up a lot of code (less to maintain) and does
7064 7073 the job. Since 'help' is now a standard Python component, might as
7065 7074 well use it and remove duplicate functionality.
7066 7075
7067 7076 Also removed the option to use ipplib as a standalone program. By
7068 7077 now it's too dependent on other parts of IPython to function alone.
7069 7078
7070 7079 * Fixed bug in genutils.pager. It would crash if the pager was
7071 7080 exited immediately after opening (broken pipe).
7072 7081
7073 7082 * Trimmed down the VerboseTB reporting a little. The header is
7074 7083 much shorter now and the repeated exception arguments at the end
7075 7084 have been removed. For interactive use the old header seemed a bit
7076 7085 excessive.
7077 7086
7078 7087 * Fixed small bug in output of @whos for variables with multi-word
7079 7088 types (only first word was displayed).
7080 7089
7081 7090 2001-11-17 Fernando Perez <fperez@colorado.edu>
7082 7091
7083 7092 * Version 0.1.10 released, 0.1.11 opened for further work.
7084 7093
7085 7094 * Modified dirs and friends. dirs now *returns* the stack (not
7086 7095 prints), so one can manipulate it as a variable. Convenient to
7087 7096 travel along many directories.
7088 7097
7089 7098 * Fixed bug in magic_pdef: would only work with functions with
7090 7099 arguments with default values.
7091 7100
7092 7101 2001-11-14 Fernando Perez <fperez@colorado.edu>
7093 7102
7094 7103 * Added the PhysicsInput stuff to dot_ipython so it ships as an
7095 7104 example with IPython. Various other minor fixes and cleanups.
7096 7105
7097 7106 * Version 0.1.9 released, 0.1.10 opened for further work.
7098 7107
7099 7108 * Added sys.path to the list of directories searched in the
7100 7109 execfile= option. It used to be the current directory and the
7101 7110 user's IPYTHONDIR only.
7102 7111
7103 7112 2001-11-13 Fernando Perez <fperez@colorado.edu>
7104 7113
7105 7114 * Reinstated the raw_input/prefilter separation that Janko had
7106 7115 initially. This gives a more convenient setup for extending the
7107 7116 pre-processor from the outside: raw_input always gets a string,
7108 7117 and prefilter has to process it. We can then redefine prefilter
7109 7118 from the outside and implement extensions for special
7110 7119 purposes.
7111 7120
7112 7121 Today I got one for inputting PhysicalQuantity objects
7113 7122 (from Scientific) without needing any function calls at
7114 7123 all. Extremely convenient, and it's all done as a user-level
7115 7124 extension (no IPython code was touched). Now instead of:
7116 7125 a = PhysicalQuantity(4.2,'m/s**2')
7117 7126 one can simply say
7118 7127 a = 4.2 m/s**2
7119 7128 or even
7120 7129 a = 4.2 m/s^2
7121 7130
7122 7131 I use this, but it's also a proof of concept: IPython really is
7123 7132 fully user-extensible, even at the level of the parsing of the
7124 7133 command line. It's not trivial, but it's perfectly doable.
7125 7134
7126 7135 * Added 'add_flip' method to inclusion conflict resolver. Fixes
7127 7136 the problem of modules being loaded in the inverse order in which
7128 7137 they were defined in
7129 7138
7130 7139 * Version 0.1.8 released, 0.1.9 opened for further work.
7131 7140
7132 7141 * Added magics pdef, source and file. They respectively show the
7133 7142 definition line ('prototype' in C), source code and full python
7134 7143 file for any callable object. The object inspector oinfo uses
7135 7144 these to show the same information.
7136 7145
7137 7146 * Version 0.1.7 released, 0.1.8 opened for further work.
7138 7147
7139 7148 * Separated all the magic functions into a class called Magic. The
7140 7149 InteractiveShell class was becoming too big for Xemacs to handle
7141 7150 (de-indenting a line would lock it up for 10 seconds while it
7142 7151 backtracked on the whole class!)
7143 7152
7144 7153 FIXME: didn't work. It can be done, but right now namespaces are
7145 7154 all messed up. Do it later (reverted it for now, so at least
7146 7155 everything works as before).
7147 7156
7148 7157 * Got the object introspection system (magic_oinfo) working! I
7149 7158 think this is pretty much ready for release to Janko, so he can
7150 7159 test it for a while and then announce it. Pretty much 100% of what
7151 7160 I wanted for the 'phase 1' release is ready. Happy, tired.
7152 7161
7153 7162 2001-11-12 Fernando Perez <fperez@colorado.edu>
7154 7163
7155 7164 * Version 0.1.6 released, 0.1.7 opened for further work.
7156 7165
7157 7166 * Fixed bug in printing: it used to test for truth before
7158 7167 printing, so 0 wouldn't print. Now checks for None.
7159 7168
7160 7169 * Fixed bug where auto-execs increase the prompt counter by 2 (b/c
7161 7170 they have to call len(str(sys.ps1)) ). But the fix is ugly, it
7162 7171 reaches by hand into the outputcache. Think of a better way to do
7163 7172 this later.
7164 7173
7165 7174 * Various small fixes thanks to Nathan's comments.
7166 7175
7167 7176 * Changed magic_pprint to magic_Pprint. This way it doesn't
7168 7177 collide with pprint() and the name is consistent with the command
7169 7178 line option.
7170 7179
7171 7180 * Changed prompt counter behavior to be fully like
7172 7181 Mathematica's. That is, even input that doesn't return a result
7173 7182 raises the prompt counter. The old behavior was kind of confusing
7174 7183 (getting the same prompt number several times if the operation
7175 7184 didn't return a result).
7176 7185
7177 7186 * Fixed Nathan's last name in a couple of places (Gray, not Graham).
7178 7187
7179 7188 * Fixed -Classic mode (wasn't working anymore).
7180 7189
7181 7190 * Added colored prompts using Nathan's new code. Colors are
7182 7191 currently hardwired, they can be user-configurable. For
7183 7192 developers, they can be chosen in file ipythonlib.py, at the
7184 7193 beginning of the CachedOutput class def.
7185 7194
7186 7195 2001-11-11 Fernando Perez <fperez@colorado.edu>
7187 7196
7188 7197 * Version 0.1.5 released, 0.1.6 opened for further work.
7189 7198
7190 7199 * Changed magic_env to *return* the environment as a dict (not to
7191 7200 print it). This way it prints, but it can also be processed.
7192 7201
7193 7202 * Added Verbose exception reporting to interactive
7194 7203 exceptions. Very nice, now even 1/0 at the prompt gives a verbose
7195 7204 traceback. Had to make some changes to the ultraTB file. This is
7196 7205 probably the last 'big' thing in my mental todo list. This ties
7197 7206 in with the next entry:
7198 7207
7199 7208 * Changed -Xi and -Xf to a single -xmode option. Now all the user
7200 7209 has to specify is Plain, Color or Verbose for all exception
7201 7210 handling.
7202 7211
7203 7212 * Removed ShellServices option. All this can really be done via
7204 7213 the magic system. It's easier to extend, cleaner and has automatic
7205 7214 namespace protection and documentation.
7206 7215
7207 7216 2001-11-09 Fernando Perez <fperez@colorado.edu>
7208 7217
7209 7218 * Fixed bug in output cache flushing (missing parameter to
7210 7219 __init__). Other small bugs fixed (found using pychecker).
7211 7220
7212 7221 * Version 0.1.4 opened for bugfixing.
7213 7222
7214 7223 2001-11-07 Fernando Perez <fperez@colorado.edu>
7215 7224
7216 7225 * Version 0.1.3 released, mainly because of the raw_input bug.
7217 7226
7218 7227 * Fixed NASTY bug in raw_input: input line wasn't properly parsed
7219 7228 and when testing for whether things were callable, a call could
7220 7229 actually be made to certain functions. They would get called again
7221 7230 once 'really' executed, with a resulting double call. A disaster
7222 7231 in many cases (list.reverse() would never work!).
7223 7232
7224 7233 * Removed prefilter() function, moved its code to raw_input (which
7225 7234 after all was just a near-empty caller for prefilter). This saves
7226 7235 a function call on every prompt, and simplifies the class a tiny bit.
7227 7236
7228 7237 * Fix _ip to __ip name in magic example file.
7229 7238
7230 7239 * Changed 'tar -x -f' to 'tar xvf' in auto-installer. This should
7231 7240 work with non-gnu versions of tar.
7232 7241
7233 7242 2001-11-06 Fernando Perez <fperez@colorado.edu>
7234 7243
7235 7244 * Version 0.1.2. Just to keep track of the recent changes.
7236 7245
7237 7246 * Fixed nasty bug in output prompt routine. It used to check 'if
7238 7247 arg != None...'. Problem is, this fails if arg implements a
7239 7248 special comparison (__cmp__) which disallows comparing to
7240 7249 None. Found it when trying to use the PhysicalQuantity module from
7241 7250 ScientificPython.
7242 7251
7243 7252 2001-11-05 Fernando Perez <fperez@colorado.edu>
7244 7253
7245 7254 * Also added dirs. Now the pushd/popd/dirs family functions
7246 7255 basically like the shell, with the added convenience of going home
7247 7256 when called with no args.
7248 7257
7249 7258 * pushd/popd slightly modified to mimic shell behavior more
7250 7259 closely.
7251 7260
7252 7261 * Added env,pushd,popd from ShellServices as magic functions. I
7253 7262 think the cleanest will be to port all desired functions from
7254 7263 ShellServices as magics and remove ShellServices altogether. This
7255 7264 will provide a single, clean way of adding functionality
7256 7265 (shell-type or otherwise) to IP.
7257 7266
7258 7267 2001-11-04 Fernando Perez <fperez@colorado.edu>
7259 7268
7260 7269 * Added .ipython/ directory to sys.path. This way users can keep
7261 7270 customizations there and access them via import.
7262 7271
7263 7272 2001-11-03 Fernando Perez <fperez@colorado.edu>
7264 7273
7265 7274 * Opened version 0.1.1 for new changes.
7266 7275
7267 7276 * Changed version number to 0.1.0: first 'public' release, sent to
7268 7277 Nathan and Janko.
7269 7278
7270 7279 * Lots of small fixes and tweaks.
7271 7280
7272 7281 * Minor changes to whos format. Now strings are shown, snipped if
7273 7282 too long.
7274 7283
7275 7284 * Changed ShellServices to work on __main__ so they show up in @who
7276 7285
7277 7286 * Help also works with ? at the end of a line:
7278 7287 ?sin and sin?
7279 7288 both produce the same effect. This is nice, as often I use the
7280 7289 tab-complete to find the name of a method, but I used to then have
7281 7290 to go to the beginning of the line to put a ? if I wanted more
7282 7291 info. Now I can just add the ? and hit return. Convenient.
7283 7292
7284 7293 2001-11-02 Fernando Perez <fperez@colorado.edu>
7285 7294
7286 7295 * Python version check (>=2.1) added.
7287 7296
7288 7297 * Added LazyPython documentation. At this point the docs are quite
7289 7298 a mess. A cleanup is in order.
7290 7299
7291 7300 * Auto-installer created. For some bizarre reason, the zipfiles
7292 7301 module isn't working on my system. So I made a tar version
7293 7302 (hopefully the command line options in various systems won't kill
7294 7303 me).
7295 7304
7296 7305 * Fixes to Struct in genutils. Now all dictionary-like methods are
7297 7306 protected (reasonably).
7298 7307
7299 7308 * Added pager function to genutils and changed ? to print usage
7300 7309 note through it (it was too long).
7301 7310
7302 7311 * Added the LazyPython functionality. Works great! I changed the
7303 7312 auto-quote escape to ';', it's on home row and next to '. But
7304 7313 both auto-quote and auto-paren (still /) escapes are command-line
7305 7314 parameters.
7306 7315
7307 7316
7308 7317 2001-11-01 Fernando Perez <fperez@colorado.edu>
7309 7318
7310 7319 * Version changed to 0.0.7. Fairly large change: configuration now
7311 7320 is all stored in a directory, by default .ipython. There, all
7312 7321 config files have normal looking names (not .names)
7313 7322
7314 7323 * Version 0.0.6 Released first to Lucas and Archie as a test
7315 7324 run. Since it's the first 'semi-public' release, change version to
7316 7325 > 0.0.6 for any changes now.
7317 7326
7318 7327 * Stuff I had put in the ipplib.py changelog:
7319 7328
7320 7329 Changes to InteractiveShell:
7321 7330
7322 7331 - Made the usage message a parameter.
7323 7332
7324 7333 - Require the name of the shell variable to be given. It's a bit
7325 7334 of a hack, but allows the name 'shell' not to be hardwired in the
7326 7335 magic (@) handler, which is problematic b/c it requires
7327 7336 polluting the global namespace with 'shell'. This in turn is
7328 7337 fragile: if a user redefines a variable called shell, things
7329 7338 break.
7330 7339
7331 7340 - magic @: all functions available through @ need to be defined
7332 7341 as magic_<name>, even though they can be called simply as
7333 7342 @<name>. This allows the special command @magic to gather
7334 7343 information automatically about all existing magic functions,
7335 7344 even if they are run-time user extensions, by parsing the shell
7336 7345 instance __dict__ looking for special magic_ names.
7337 7346
7338 7347 - mainloop: added *two* local namespace parameters. This allows
7339 7348 the class to differentiate between parameters which were there
7340 7349 before and after command line initialization was processed. This
7341 7350 way, later @who can show things loaded at startup by the
7342 7351 user. This trick was necessary to make session saving/reloading
7343 7352 really work: ideally after saving/exiting/reloading a session,
7344 7353 *everything* should look the same, including the output of @who. I
7345 7354 was only able to make this work with this double namespace
7346 7355 trick.
7347 7356
7348 7357 - added a header to the logfile which allows (almost) full
7349 7358 session restoring.
7350 7359
7351 7360 - prepend lines beginning with @ or !, with a and log
7352 7361 them. Why? !lines: may be useful to know what you did @lines:
7353 7362 they may affect session state. So when restoring a session, at
7354 7363 least inform the user of their presence. I couldn't quite get
7355 7364 them to properly re-execute, but at least the user is warned.
7356 7365
7357 7366 * Started ChangeLog.
General Comments 0
You need to be logged in to leave comments. Login now