##// END OF EJS Templates
add .meta namespace for extension writers.
fperez -
Show More
@@ -1,76 +1,76 b''
1 1 # -*- coding: utf-8 -*-
2 2 """Release data for the IPython project.
3 3
4 $Id: Release.py 986 2005-12-31 23:07:31Z fperez $"""
4 $Id: Release.py 987 2005-12-31 23:50:31Z fperez $"""
5 5
6 6 #*****************************************************************************
7 7 # Copyright (C) 2001-2005 Fernando Perez <fperez@colorado.edu>
8 8 #
9 9 # Copyright (c) 2001 Janko Hauser <jhauser@zscout.de> and Nathaniel Gray
10 10 # <n8gray@caltech.edu>
11 11 #
12 12 # Distributed under the terms of the BSD License. The full license is in
13 13 # the file COPYING, distributed as part of this software.
14 14 #*****************************************************************************
15 15
16 16 # Name of the package for release purposes. This is the name which labels
17 17 # the tarballs and RPMs made by distutils, so it's best to lowercase it.
18 18 name = 'ipython'
19 19
20 20 # For versions with substrings (like 0.6.16.svn), use an extra . to separate
21 21 # the new substring. We have to avoid using either dashes or underscores,
22 22 # because bdist_rpm does not accept dashes (an RPM) convention, and
23 23 # bdist_deb does not accept underscores (a Debian convention).
24 24
25 version = '0.7.0.rc5'
25 version = '0.7.0.rc6'
26 26
27 revision = '$Revision: 986 $'
27 revision = '$Revision: 987 $'
28 28
29 29 description = "An enhanced interactive Python shell."
30 30
31 31 long_description = \
32 32 """
33 33 IPython provides a replacement for the interactive Python interpreter with
34 34 extra functionality.
35 35
36 36 Main features:
37 37
38 38 * Comprehensive object introspection.
39 39
40 40 * Input history, persistent across sessions.
41 41
42 42 * Caching of output results during a session with automatically generated
43 43 references.
44 44
45 45 * Readline based name completion.
46 46
47 47 * Extensible system of 'magic' commands for controlling the environment and
48 48 performing many tasks related either to IPython or the operating system.
49 49
50 50 * Configuration system with easy switching between different setups (simpler
51 51 than changing $PYTHONSTARTUP environment variables every time).
52 52
53 53 * Session logging and reloading.
54 54
55 55 * Extensible syntax processing for special purpose situations.
56 56
57 57 * Access to the system shell with user-extensible alias system.
58 58
59 59 * Easily embeddable in other Python programs.
60 60
61 61 * Integrated access to the pdb debugger and the Python profiler. """
62 62
63 63 license = 'BSD'
64 64
65 65 authors = {'Fernando' : ('Fernando Perez','fperez@colorado.edu'),
66 66 'Janko' : ('Janko Hauser','jhauser@zscout.de'),
67 67 'Nathan' : ('Nathaniel Gray','n8gray@caltech.edu')
68 68 }
69 69
70 70 url = 'http://ipython.scipy.org'
71 71
72 72 download_url = 'http://ipython.scipy.org/dist'
73 73
74 74 platforms = ['Linux','Mac OSX','Windows XP/2000/NT','Windows 95/98/ME']
75 75
76 76 keywords = ['Interactive','Interpreter','Shell']
@@ -1,2058 +1,2065 b''
1 1 # -*- coding: utf-8 -*-
2 2 """
3 3 IPython -- An enhanced Interactive Python
4 4
5 5 Requires Python 2.1 or newer.
6 6
7 7 This file contains all the classes and helper functions specific to IPython.
8 8
9 $Id: iplib.py 984 2005-12-31 08:40:31Z fperez $
9 $Id: iplib.py 987 2005-12-31 23:50:31Z fperez $
10 10 """
11 11
12 12 #*****************************************************************************
13 13 # Copyright (C) 2001 Janko Hauser <jhauser@zscout.de> and
14 14 # Copyright (C) 2001-2005 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 __future__ import generators # for 2.2 backwards-compatibility
32 32
33 33 from IPython import Release
34 34 __author__ = '%s <%s>\n%s <%s>' % \
35 35 ( Release.authors['Janko'] + Release.authors['Fernando'] )
36 36 __license__ = Release.license
37 37 __version__ = Release.version
38 38
39 39 # Python standard modules
40 40 import __main__
41 41 import __builtin__
42 42 import StringIO
43 43 import bdb
44 44 import cPickle as pickle
45 45 import codeop
46 46 import exceptions
47 47 import glob
48 48 import inspect
49 49 import keyword
50 50 import new
51 51 import os
52 52 import pdb
53 53 import pydoc
54 54 import re
55 55 import shutil
56 56 import string
57 57 import sys
58 58 import traceback
59 59 import types
60 60
61 61 from pprint import pprint, pformat
62 62
63 63 # IPython's own modules
64 64 import IPython
65 65 from IPython import OInspect,PyColorize,ultraTB
66 66 from IPython.ColorANSI import ColorScheme,ColorSchemeTable # too long names
67 67 from IPython.FakeModule import FakeModule
68 68 from IPython.Itpl import Itpl,itpl,printpl,ItplNS,itplns
69 69 from IPython.Logger import Logger
70 70 from IPython.Magic import Magic
71 71 from IPython.Prompts import CachedOutput
72 72 from IPython.Struct import Struct
73 73 from IPython.background_jobs import BackgroundJobManager
74 74 from IPython.usage import cmd_line_usage,interactive_usage
75 75 from IPython.genutils import *
76 76
77 77 # store the builtin raw_input globally, and use this always, in case user code
78 78 # overwrites it (like wx.py.PyShell does)
79 79 raw_input_original = raw_input
80 80
81 81 # compiled regexps for autoindent management
82 82 ini_spaces_re = re.compile(r'^(\s+)')
83 83 dedent_re = re.compile(r'^\s+raise|^\s+return|^\s+pass')
84 84
85 85 #****************************************************************************
86 86 # Some utility function definitions
87 87
88 88 def softspace(file, newvalue):
89 89 """Copied from code.py, to remove the dependency"""
90 90 oldvalue = 0
91 91 try:
92 92 oldvalue = file.softspace
93 93 except AttributeError:
94 94 pass
95 95 try:
96 96 file.softspace = newvalue
97 97 except (AttributeError, TypeError):
98 98 # "attribute-less object" or "read-only attributes"
99 99 pass
100 100 return oldvalue
101 101
102 102 #****************************************************************************
103 103 # These special functions get installed in the builtin namespace, to provide
104 104 # programmatic (pure python) access to magics, aliases and system calls. This
105 105 # is important for logging, user scripting, and more.
106 106
107 107 # We are basically exposing, via normal python functions, the three mechanisms
108 108 # in which ipython offers special call modes (magics for internal control,
109 109 # aliases for direct system access via pre-selected names, and !cmd for
110 110 # calling arbitrary system commands).
111 111
112 112 def ipmagic(arg_s):
113 113 """Call a magic function by name.
114 114
115 115 Input: a string containing the name of the magic function to call and any
116 116 additional arguments to be passed to the magic.
117 117
118 118 ipmagic('name -opt foo bar') is equivalent to typing at the ipython
119 119 prompt:
120 120
121 121 In[1]: %name -opt foo bar
122 122
123 123 To call a magic without arguments, simply use ipmagic('name').
124 124
125 125 This provides a proper Python function to call IPython's magics in any
126 126 valid Python code you can type at the interpreter, including loops and
127 127 compound statements. It is added by IPython to the Python builtin
128 128 namespace upon initialization."""
129 129
130 130 args = arg_s.split(' ',1)
131 131 magic_name = args[0]
132 132 if magic_name.startswith(__IPYTHON__.ESC_MAGIC):
133 133 magic_name = magic_name[1:]
134 134 try:
135 135 magic_args = args[1]
136 136 except IndexError:
137 137 magic_args = ''
138 138 fn = getattr(__IPYTHON__,'magic_'+magic_name,None)
139 139 if fn is None:
140 140 error("Magic function `%s` not found." % magic_name)
141 141 else:
142 142 magic_args = __IPYTHON__.var_expand(magic_args)
143 143 return fn(magic_args)
144 144
145 145 def ipalias(arg_s):
146 146 """Call an alias by name.
147 147
148 148 Input: a string containing the name of the alias to call and any
149 149 additional arguments to be passed to the magic.
150 150
151 151 ipalias('name -opt foo bar') is equivalent to typing at the ipython
152 152 prompt:
153 153
154 154 In[1]: name -opt foo bar
155 155
156 156 To call an alias without arguments, simply use ipalias('name').
157 157
158 158 This provides a proper Python function to call IPython's aliases in any
159 159 valid Python code you can type at the interpreter, including loops and
160 160 compound statements. It is added by IPython to the Python builtin
161 161 namespace upon initialization."""
162 162
163 163 args = arg_s.split(' ',1)
164 164 alias_name = args[0]
165 165 try:
166 166 alias_args = args[1]
167 167 except IndexError:
168 168 alias_args = ''
169 169 if alias_name in __IPYTHON__.alias_table:
170 170 __IPYTHON__.call_alias(alias_name,alias_args)
171 171 else:
172 172 error("Alias `%s` not found." % alias_name)
173 173
174 174 def ipsystem(arg_s):
175 175 """Make a system call, using IPython."""
176 176 __IPYTHON__.system(arg_s)
177 177
178 178
179 179 #****************************************************************************
180 180 # Local use exceptions
181 181 class SpaceInInput(exceptions.Exception): pass
182 182
183 183 #****************************************************************************
184 184 # Local use classes
185 185 class Bunch: pass
186 186
187 187 class InputList(list):
188 188 """Class to store user input.
189 189
190 190 It's basically a list, but slices return a string instead of a list, thus
191 191 allowing things like (assuming 'In' is an instance):
192 192
193 193 exec In[4:7]
194 194
195 195 or
196 196
197 197 exec In[5:9] + In[14] + In[21:25]"""
198 198
199 199 def __getslice__(self,i,j):
200 200 return ''.join(list.__getslice__(self,i,j))
201 201
202 202 class SyntaxTB(ultraTB.ListTB):
203 203 """Extension which holds some state: the last exception value"""
204 204
205 205 def __init__(self,color_scheme = 'NoColor'):
206 206 ultraTB.ListTB.__init__(self,color_scheme)
207 207 self.last_syntax_error = None
208 208
209 209 def __call__(self, etype, value, elist):
210 210 self.last_syntax_error = value
211 211 ultraTB.ListTB.__call__(self,etype,value,elist)
212 212
213 213 def clear_err_state(self):
214 214 """Return the current error state and clear it"""
215 215 e = self.last_syntax_error
216 216 self.last_syntax_error = None
217 217 return e
218 218
219 219 #****************************************************************************
220 220 # Main IPython class
221 221
222 222 # FIXME: the Magic class is a mixin for now, and will unfortunately remain so
223 223 # until a full rewrite is made. I've cleaned all cross-class uses of
224 224 # attributes and methods, but too much user code out there relies on the
225 225 # equlity %foo == __IP.magic_foo, so I can't actually remove the mixin usage.
226 226 #
227 227 # But at least now, all the pieces have been separated and we could, in
228 228 # principle, stop using the mixin. This will ease the transition to the
229 229 # chainsaw branch.
230 230
231 231 # For reference, the following is the list of 'self.foo' uses in the Magic
232 232 # class as of 2005-12-28. These are names we CAN'T use in the main ipython
233 233 # class, to prevent clashes.
234 234
235 235 # ['self.__class__', 'self.__dict__', 'self._inspect', 'self._ofind',
236 236 # 'self.arg_err', 'self.extract_input', 'self.format_', 'self.lsmagic',
237 237 # 'self.magic_', 'self.options_table', 'self.parse', 'self.shell',
238 238 # 'self.value']
239 239
240 240 class InteractiveShell(object,Magic):
241 241 """An enhanced console for Python."""
242 242
243 243 # class attribute to indicate whether the class supports threads or not.
244 244 # Subclasses with thread support should override this as needed.
245 245 isthreaded = False
246 246
247 247 def __init__(self,name,usage=None,rc=Struct(opts=None,args=None),
248 248 user_ns = None,user_global_ns=None,banner2='',
249 249 custom_exceptions=((),None),embedded=False):
250 250
251 251 # some minimal strict typechecks. For some core data structures, I
252 252 # want actual basic python types, not just anything that looks like
253 253 # one. This is especially true for namespaces.
254 254 for ns in (user_ns,user_global_ns):
255 255 if ns is not None and type(ns) != types.DictType:
256 256 raise TypeError,'namespace must be a dictionary'
257 257
258 258 # Put a reference to self in builtins so that any form of embedded or
259 259 # imported code can test for being inside IPython.
260 260 __builtin__.__IPYTHON__ = self
261 261
262 262 # And load into builtins ipmagic/ipalias/ipsystem as well
263 263 __builtin__.ipmagic = ipmagic
264 264 __builtin__.ipalias = ipalias
265 265 __builtin__.ipsystem = ipsystem
266 266
267 267 # Add to __builtin__ other parts of IPython's public API
268 268 __builtin__.ip_set_hook = self.set_hook
269 269
270 270 # Keep in the builtins a flag for when IPython is active. We set it
271 271 # with setdefault so that multiple nested IPythons don't clobber one
272 272 # another. Each will increase its value by one upon being activated,
273 273 # which also gives us a way to determine the nesting level.
274 274 __builtin__.__dict__.setdefault('__IPYTHON__active',0)
275 275
276 276 # Do the intuitively correct thing for quit/exit: we remove the
277 277 # builtins if they exist, and our own prefilter routine will handle
278 278 # these special cases
279 279 try:
280 280 del __builtin__.exit, __builtin__.quit
281 281 except AttributeError:
282 282 pass
283 283
284 284 # Store the actual shell's name
285 285 self.name = name
286 286
287 287 # We need to know whether the instance is meant for embedding, since
288 288 # global/local namespaces need to be handled differently in that case
289 289 self.embedded = embedded
290 290
291 291 # command compiler
292 292 self.compile = codeop.CommandCompiler()
293 293
294 294 # User input buffer
295 295 self.buffer = []
296 296
297 297 # Default name given in compilation of code
298 298 self.filename = '<ipython console>'
299 299
300 # Make an empty namespace, which extension writers can rely on both
301 # existing and NEVER being used by ipython itself. This gives them a
302 # convenient location for storing additional information and state
303 # their extensions may require, without fear of collisions with other
304 # ipython names that may develop later.
305 self.meta = Bunch()
306
300 307 # Create the namespace where the user will operate. user_ns is
301 308 # normally the only one used, and it is passed to the exec calls as
302 309 # the locals argument. But we do carry a user_global_ns namespace
303 310 # given as the exec 'globals' argument, This is useful in embedding
304 311 # situations where the ipython shell opens in a context where the
305 312 # distinction between locals and globals is meaningful.
306 313
307 314 # FIXME. For some strange reason, __builtins__ is showing up at user
308 315 # level as a dict instead of a module. This is a manual fix, but I
309 316 # should really track down where the problem is coming from. Alex
310 317 # Schmolck reported this problem first.
311 318
312 319 # A useful post by Alex Martelli on this topic:
313 320 # Re: inconsistent value from __builtins__
314 321 # Von: Alex Martelli <aleaxit@yahoo.com>
315 322 # Datum: Freitag 01 Oktober 2004 04:45:34 nachmittags/abends
316 323 # Gruppen: comp.lang.python
317 324
318 325 # Michael Hohn <hohn@hooknose.lbl.gov> wrote:
319 326 # > >>> print type(builtin_check.get_global_binding('__builtins__'))
320 327 # > <type 'dict'>
321 328 # > >>> print type(__builtins__)
322 329 # > <type 'module'>
323 330 # > Is this difference in return value intentional?
324 331
325 332 # Well, it's documented that '__builtins__' can be either a dictionary
326 333 # or a module, and it's been that way for a long time. Whether it's
327 334 # intentional (or sensible), I don't know. In any case, the idea is
328 335 # that if you need to access the built-in namespace directly, you
329 336 # should start with "import __builtin__" (note, no 's') which will
330 337 # definitely give you a module. Yeah, it's somewhatΒ confusing:-(.
331 338
332 339 if user_ns is None:
333 340 # Set __name__ to __main__ to better match the behavior of the
334 341 # normal interpreter.
335 342 user_ns = {'__name__' :'__main__',
336 343 '__builtins__' : __builtin__,
337 344 }
338 345
339 346 if user_global_ns is None:
340 347 user_global_ns = {}
341 348
342 349 # Assign namespaces
343 350 # This is the namespace where all normal user variables live
344 351 self.user_ns = user_ns
345 352 # Embedded instances require a separate namespace for globals.
346 353 # Normally this one is unused by non-embedded instances.
347 354 self.user_global_ns = user_global_ns
348 355 # A namespace to keep track of internal data structures to prevent
349 356 # them from cluttering user-visible stuff. Will be updated later
350 357 self.internal_ns = {}
351 358
352 359 # Namespace of system aliases. Each entry in the alias
353 360 # table must be a 2-tuple of the form (N,name), where N is the number
354 361 # of positional arguments of the alias.
355 362 self.alias_table = {}
356 363
357 364 # A table holding all the namespaces IPython deals with, so that
358 365 # introspection facilities can search easily.
359 366 self.ns_table = {'user':user_ns,
360 367 'user_global':user_global_ns,
361 368 'alias':self.alias_table,
362 369 'internal':self.internal_ns,
363 370 'builtin':__builtin__.__dict__
364 371 }
365 372
366 373 # The user namespace MUST have a pointer to the shell itself.
367 374 self.user_ns[name] = self
368 375
369 376 # We need to insert into sys.modules something that looks like a
370 377 # module but which accesses the IPython namespace, for shelve and
371 378 # pickle to work interactively. Normally they rely on getting
372 379 # everything out of __main__, but for embedding purposes each IPython
373 380 # instance has its own private namespace, so we can't go shoving
374 381 # everything into __main__.
375 382
376 383 # note, however, that we should only do this for non-embedded
377 384 # ipythons, which really mimic the __main__.__dict__ with their own
378 385 # namespace. Embedded instances, on the other hand, should not do
379 386 # this because they need to manage the user local/global namespaces
380 387 # only, but they live within a 'normal' __main__ (meaning, they
381 388 # shouldn't overtake the execution environment of the script they're
382 389 # embedded in).
383 390
384 391 if not embedded:
385 392 try:
386 393 main_name = self.user_ns['__name__']
387 394 except KeyError:
388 395 raise KeyError,'user_ns dictionary MUST have a "__name__" key'
389 396 else:
390 397 #print "pickle hack in place" # dbg
391 398 #print 'main_name:',main_name # dbg
392 399 sys.modules[main_name] = FakeModule(self.user_ns)
393 400
394 401 # List of input with multi-line handling.
395 402 # Fill its zero entry, user counter starts at 1
396 403 self.input_hist = InputList(['\n'])
397 404
398 405 # list of visited directories
399 406 try:
400 407 self.dir_hist = [os.getcwd()]
401 408 except IOError, e:
402 409 self.dir_hist = []
403 410
404 411 # dict of output history
405 412 self.output_hist = {}
406 413
407 414 # dict of things NOT to alias (keywords, builtins and some magics)
408 415 no_alias = {}
409 416 no_alias_magics = ['cd','popd','pushd','dhist','alias','unalias']
410 417 for key in keyword.kwlist + no_alias_magics:
411 418 no_alias[key] = 1
412 419 no_alias.update(__builtin__.__dict__)
413 420 self.no_alias = no_alias
414 421
415 422 # make global variables for user access to these
416 423 self.user_ns['_ih'] = self.input_hist
417 424 self.user_ns['_oh'] = self.output_hist
418 425 self.user_ns['_dh'] = self.dir_hist
419 426
420 427 # user aliases to input and output histories
421 428 self.user_ns['In'] = self.input_hist
422 429 self.user_ns['Out'] = self.output_hist
423 430
424 431 # Object variable to store code object waiting execution. This is
425 432 # used mainly by the multithreaded shells, but it can come in handy in
426 433 # other situations. No need to use a Queue here, since it's a single
427 434 # item which gets cleared once run.
428 435 self.code_to_run = None
429 436
430 437 # Job manager (for jobs run as background threads)
431 438 self.jobs = BackgroundJobManager()
432 439 # Put the job manager into builtins so it's always there.
433 440 __builtin__.jobs = self.jobs
434 441
435 442 # escapes for automatic behavior on the command line
436 443 self.ESC_SHELL = '!'
437 444 self.ESC_HELP = '?'
438 445 self.ESC_MAGIC = '%'
439 446 self.ESC_QUOTE = ','
440 447 self.ESC_QUOTE2 = ';'
441 448 self.ESC_PAREN = '/'
442 449
443 450 # And their associated handlers
444 451 self.esc_handlers = {self.ESC_PAREN : self.handle_auto,
445 452 self.ESC_QUOTE : self.handle_auto,
446 453 self.ESC_QUOTE2 : self.handle_auto,
447 454 self.ESC_MAGIC : self.handle_magic,
448 455 self.ESC_HELP : self.handle_help,
449 456 self.ESC_SHELL : self.handle_shell_escape,
450 457 }
451 458
452 459 # class initializations
453 460 Magic.__init__(self,self)
454 461
455 462 # Python source parser/formatter for syntax highlighting
456 463 pyformat = PyColorize.Parser().format
457 464 self.pycolorize = lambda src: pyformat(src,'str',self.rc['colors'])
458 465
459 466 # hooks holds pointers used for user-side customizations
460 467 self.hooks = Struct()
461 468
462 469 # Set all default hooks, defined in the IPython.hooks module.
463 470 hooks = IPython.hooks
464 471 for hook_name in hooks.__all__:
465 472 self.set_hook(hook_name,getattr(hooks,hook_name))
466 473
467 474 # Flag to mark unconditional exit
468 475 self.exit_now = False
469 476
470 477 self.usage_min = """\
471 478 An enhanced console for Python.
472 479 Some of its features are:
473 480 - Readline support if the readline library is present.
474 481 - Tab completion in the local namespace.
475 482 - Logging of input, see command-line options.
476 483 - System shell escape via ! , eg !ls.
477 484 - Magic commands, starting with a % (like %ls, %pwd, %cd, etc.)
478 485 - Keeps track of locally defined variables via %who, %whos.
479 486 - Show object information with a ? eg ?x or x? (use ?? for more info).
480 487 """
481 488 if usage: self.usage = usage
482 489 else: self.usage = self.usage_min
483 490
484 491 # Storage
485 492 self.rc = rc # This will hold all configuration information
486 493 self.pager = 'less'
487 494 # temporary files used for various purposes. Deleted at exit.
488 495 self.tempfiles = []
489 496
490 497 # Keep track of readline usage (later set by init_readline)
491 498 self.has_readline = False
492 499
493 500 # template for logfile headers. It gets resolved at runtime by the
494 501 # logstart method.
495 502 self.loghead_tpl = \
496 503 """#log# Automatic Logger file. *** THIS MUST BE THE FIRST LINE ***
497 504 #log# DO NOT CHANGE THIS LINE OR THE TWO BELOW
498 505 #log# opts = %s
499 506 #log# args = %s
500 507 #log# It is safe to make manual edits below here.
501 508 #log#-----------------------------------------------------------------------
502 509 """
503 510 # for pushd/popd management
504 511 try:
505 512 self.home_dir = get_home_dir()
506 513 except HomeDirError,msg:
507 514 fatal(msg)
508 515
509 516 self.dir_stack = [os.getcwd().replace(self.home_dir,'~')]
510 517
511 518 # Functions to call the underlying shell.
512 519
513 520 # utility to expand user variables via Itpl
514 521 self.var_expand = lambda cmd: str(ItplNS(cmd.replace('#','\#'),
515 522 self.user_ns))
516 523 # The first is similar to os.system, but it doesn't return a value,
517 524 # and it allows interpolation of variables in the user's namespace.
518 525 self.system = lambda cmd: shell(self.var_expand(cmd),
519 526 header='IPython system call: ',
520 527 verbose=self.rc.system_verbose)
521 528 # These are for getoutput and getoutputerror:
522 529 self.getoutput = lambda cmd: \
523 530 getoutput(self.var_expand(cmd),
524 531 header='IPython system call: ',
525 532 verbose=self.rc.system_verbose)
526 533 self.getoutputerror = lambda cmd: \
527 534 getoutputerror(str(ItplNS(cmd.replace('#','\#'),
528 535 self.user_ns)),
529 536 header='IPython system call: ',
530 537 verbose=self.rc.system_verbose)
531 538
532 539 # RegExp for splitting line contents into pre-char//first
533 540 # word-method//rest. For clarity, each group in on one line.
534 541
535 542 # WARNING: update the regexp if the above escapes are changed, as they
536 543 # are hardwired in.
537 544
538 545 # Don't get carried away with trying to make the autocalling catch too
539 546 # much: it's better to be conservative rather than to trigger hidden
540 547 # evals() somewhere and end up causing side effects.
541 548
542 549 self.line_split = re.compile(r'^([\s*,;/])'
543 550 r'([\?\w\.]+\w*\s*)'
544 551 r'(\(?.*$)')
545 552
546 553 # Original re, keep around for a while in case changes break something
547 554 #self.line_split = re.compile(r'(^[\s*!\?%,/]?)'
548 555 # r'(\s*[\?\w\.]+\w*\s*)'
549 556 # r'(\(?.*$)')
550 557
551 558 # RegExp to identify potential function names
552 559 self.re_fun_name = re.compile(r'[a-zA-Z_]([a-zA-Z0-9_.]*) *$')
553 560 # RegExp to exclude strings with this start from autocalling
554 561 self.re_exclude_auto = re.compile('^[!=()<>,\*/\+-]|^is ')
555 562
556 563 # try to catch also methods for stuff in lists/tuples/dicts: off
557 564 # (experimental). For this to work, the line_split regexp would need
558 565 # to be modified so it wouldn't break things at '['. That line is
559 566 # nasty enough that I shouldn't change it until I can test it _well_.
560 567 #self.re_fun_name = re.compile (r'[a-zA-Z_]([a-zA-Z0-9_.\[\]]*) ?$')
561 568
562 569 # keep track of where we started running (mainly for crash post-mortem)
563 570 self.starting_dir = os.getcwd()
564 571
565 572 # Various switches which can be set
566 573 self.CACHELENGTH = 5000 # this is cheap, it's just text
567 574 self.BANNER = "Python %(version)s on %(platform)s\n" % sys.__dict__
568 575 self.banner2 = banner2
569 576
570 577 # TraceBack handlers:
571 578
572 579 # Syntax error handler.
573 580 self.SyntaxTB = SyntaxTB(color_scheme='NoColor')
574 581
575 582 # The interactive one is initialized with an offset, meaning we always
576 583 # want to remove the topmost item in the traceback, which is our own
577 584 # internal code. Valid modes: ['Plain','Context','Verbose']
578 585 self.InteractiveTB = ultraTB.AutoFormattedTB(mode = 'Plain',
579 586 color_scheme='NoColor',
580 587 tb_offset = 1)
581 588
582 589 # IPython itself shouldn't crash. This will produce a detailed
583 590 # post-mortem if it does. But we only install the crash handler for
584 591 # non-threaded shells, the threaded ones use a normal verbose reporter
585 592 # and lose the crash handler. This is because exceptions in the main
586 593 # thread (such as in GUI code) propagate directly to sys.excepthook,
587 594 # and there's no point in printing crash dumps for every user exception.
588 595 if self.isthreaded:
589 596 sys.excepthook = ultraTB.FormattedTB()
590 597 else:
591 598 from IPython import CrashHandler
592 599 sys.excepthook = CrashHandler.CrashHandler(self)
593 600
594 601 # The instance will store a pointer to this, so that runtime code
595 602 # (such as magics) can access it. This is because during the
596 603 # read-eval loop, it gets temporarily overwritten (to deal with GUI
597 604 # frameworks).
598 605 self.sys_excepthook = sys.excepthook
599 606
600 607 # and add any custom exception handlers the user may have specified
601 608 self.set_custom_exc(*custom_exceptions)
602 609
603 610 # Object inspector
604 611 self.inspector = OInspect.Inspector(OInspect.InspectColors,
605 612 PyColorize.ANSICodeColors,
606 613 'NoColor')
607 614 # indentation management
608 615 self.autoindent = False
609 616 self.indent_current_nsp = 0
610 617 self.indent_current = '' # actual indent string
611 618
612 619 # Make some aliases automatically
613 620 # Prepare list of shell aliases to auto-define
614 621 if os.name == 'posix':
615 622 auto_alias = ('mkdir mkdir', 'rmdir rmdir',
616 623 'mv mv -i','rm rm -i','cp cp -i',
617 624 'cat cat','less less','clear clear',
618 625 # a better ls
619 626 'ls ls -F',
620 627 # long ls
621 628 'll ls -lF',
622 629 # color ls
623 630 'lc ls -F -o --color',
624 631 # ls normal files only
625 632 'lf ls -F -o --color %l | grep ^-',
626 633 # ls symbolic links
627 634 'lk ls -F -o --color %l | grep ^l',
628 635 # directories or links to directories,
629 636 'ldir ls -F -o --color %l | grep /$',
630 637 # things which are executable
631 638 'lx ls -F -o --color %l | grep ^-..x',
632 639 )
633 640 elif os.name in ['nt','dos']:
634 641 auto_alias = ('dir dir /on', 'ls dir /on',
635 642 'ddir dir /ad /on', 'ldir dir /ad /on',
636 643 'mkdir mkdir','rmdir rmdir','echo echo',
637 644 'ren ren','cls cls','copy copy')
638 645 else:
639 646 auto_alias = ()
640 647 self.auto_alias = map(lambda s:s.split(None,1),auto_alias)
641 648 # Call the actual (public) initializer
642 649 self.init_auto_alias()
643 650 # end __init__
644 651
645 652 def post_config_initialization(self):
646 653 """Post configuration init method
647 654
648 655 This is called after the configuration files have been processed to
649 656 'finalize' the initialization."""
650 657
651 658 rc = self.rc
652 659
653 660 # Load readline proper
654 661 if rc.readline:
655 662 self.init_readline()
656 663
657 664 # log system
658 665 self.logger = Logger(self,logfname='ipython_log.py',logmode='rotate')
659 666 # local shortcut, this is used a LOT
660 667 self.log = self.logger.log
661 668
662 669 # Initialize cache, set in/out prompts and printing system
663 670 self.outputcache = CachedOutput(self,
664 671 rc.cache_size,
665 672 rc.pprint,
666 673 input_sep = rc.separate_in,
667 674 output_sep = rc.separate_out,
668 675 output_sep2 = rc.separate_out2,
669 676 ps1 = rc.prompt_in1,
670 677 ps2 = rc.prompt_in2,
671 678 ps_out = rc.prompt_out,
672 679 pad_left = rc.prompts_pad_left)
673 680
674 681 # user may have over-ridden the default print hook:
675 682 try:
676 683 self.outputcache.__class__.display = self.hooks.display
677 684 except AttributeError:
678 685 pass
679 686
680 687 # I don't like assigning globally to sys, because it means when embedding
681 688 # instances, each embedded instance overrides the previous choice. But
682 689 # sys.displayhook seems to be called internally by exec, so I don't see a
683 690 # way around it.
684 691 sys.displayhook = self.outputcache
685 692
686 693 # Set user colors (don't do it in the constructor above so that it
687 694 # doesn't crash if colors option is invalid)
688 695 self.magic_colors(rc.colors)
689 696
690 697 # Set calling of pdb on exceptions
691 698 self.call_pdb = rc.pdb
692 699
693 700 # Load user aliases
694 701 for alias in rc.alias:
695 702 self.magic_alias(alias)
696 703
697 704 # dynamic data that survives through sessions
698 705 # XXX make the filename a config option?
699 706 persist_base = 'persist'
700 707 if rc.profile:
701 708 persist_base += '_%s' % rc.profile
702 709 self.persist_fname = os.path.join(rc.ipythondir,persist_base)
703 710
704 711 try:
705 712 self.persist = pickle.load(file(self.persist_fname))
706 713 except:
707 714 self.persist = {}
708 715
709 716
710 717 for (key, value) in [(k[2:],v) for (k,v) in self.persist.items() if k.startswith('S:')]:
711 718 try:
712 719 obj = pickle.loads(value)
713 720 except:
714 721
715 722 print "Unable to restore variable '%s', ignoring (use %%store -d to forget!)" % key
716 723 print "The error was:",sys.exc_info()[0]
717 724 continue
718 725
719 726
720 727 self.user_ns[key] = obj
721 728
722 729 def set_hook(self,name,hook):
723 730 """set_hook(name,hook) -> sets an internal IPython hook.
724 731
725 732 IPython exposes some of its internal API as user-modifiable hooks. By
726 733 resetting one of these hooks, you can modify IPython's behavior to
727 734 call at runtime your own routines."""
728 735
729 736 # At some point in the future, this should validate the hook before it
730 737 # accepts it. Probably at least check that the hook takes the number
731 738 # of args it's supposed to.
732 739 setattr(self.hooks,name,new.instancemethod(hook,self,self.__class__))
733 740
734 741 def set_custom_exc(self,exc_tuple,handler):
735 742 """set_custom_exc(exc_tuple,handler)
736 743
737 744 Set a custom exception handler, which will be called if any of the
738 745 exceptions in exc_tuple occur in the mainloop (specifically, in the
739 746 runcode() method.
740 747
741 748 Inputs:
742 749
743 750 - exc_tuple: a *tuple* of valid exceptions to call the defined
744 751 handler for. It is very important that you use a tuple, and NOT A
745 752 LIST here, because of the way Python's except statement works. If
746 753 you only want to trap a single exception, use a singleton tuple:
747 754
748 755 exc_tuple == (MyCustomException,)
749 756
750 757 - handler: this must be defined as a function with the following
751 758 basic interface: def my_handler(self,etype,value,tb).
752 759
753 760 This will be made into an instance method (via new.instancemethod)
754 761 of IPython itself, and it will be called if any of the exceptions
755 762 listed in the exc_tuple are caught. If the handler is None, an
756 763 internal basic one is used, which just prints basic info.
757 764
758 765 WARNING: by putting in your own exception handler into IPython's main
759 766 execution loop, you run a very good chance of nasty crashes. This
760 767 facility should only be used if you really know what you are doing."""
761 768
762 769 assert type(exc_tuple)==type(()) , \
763 770 "The custom exceptions must be given AS A TUPLE."
764 771
765 772 def dummy_handler(self,etype,value,tb):
766 773 print '*** Simple custom exception handler ***'
767 774 print 'Exception type :',etype
768 775 print 'Exception value:',value
769 776 print 'Traceback :',tb
770 777 print 'Source code :','\n'.join(self.buffer)
771 778
772 779 if handler is None: handler = dummy_handler
773 780
774 781 self.CustomTB = new.instancemethod(handler,self,self.__class__)
775 782 self.custom_exceptions = exc_tuple
776 783
777 784 def set_custom_completer(self,completer,pos=0):
778 785 """set_custom_completer(completer,pos=0)
779 786
780 787 Adds a new custom completer function.
781 788
782 789 The position argument (defaults to 0) is the index in the completers
783 790 list where you want the completer to be inserted."""
784 791
785 792 newcomp = new.instancemethod(completer,self.Completer,
786 793 self.Completer.__class__)
787 794 self.Completer.matchers.insert(pos,newcomp)
788 795
789 796 def _get_call_pdb(self):
790 797 return self._call_pdb
791 798
792 799 def _set_call_pdb(self,val):
793 800
794 801 if val not in (0,1,False,True):
795 802 raise ValueError,'new call_pdb value must be boolean'
796 803
797 804 # store value in instance
798 805 self._call_pdb = val
799 806
800 807 # notify the actual exception handlers
801 808 self.InteractiveTB.call_pdb = val
802 809 if self.isthreaded:
803 810 try:
804 811 self.sys_excepthook.call_pdb = val
805 812 except:
806 813 warn('Failed to activate pdb for threaded exception handler')
807 814
808 815 call_pdb = property(_get_call_pdb,_set_call_pdb,None,
809 816 'Control auto-activation of pdb at exceptions')
810 817
811 818 def complete(self,text):
812 819 """Return a sorted list of all possible completions on text.
813 820
814 821 Inputs:
815 822
816 823 - text: a string of text to be completed on.
817 824
818 825 This is a wrapper around the completion mechanism, similar to what
819 826 readline does at the command line when the TAB key is hit. By
820 827 exposing it as a method, it can be used by other non-readline
821 828 environments (such as GUIs) for text completion.
822 829
823 830 Simple usage example:
824 831
825 832 In [1]: x = 'hello'
826 833
827 834 In [2]: __IP.complete('x.l')
828 835 Out[2]: ['x.ljust', 'x.lower', 'x.lstrip']"""
829 836
830 837 complete = self.Completer.complete
831 838 state = 0
832 839 # use a dict so we get unique keys, since ipyhton's multiple
833 840 # completers can return duplicates.
834 841 comps = {}
835 842 while True:
836 843 newcomp = complete(text,state)
837 844 if newcomp is None:
838 845 break
839 846 comps[newcomp] = 1
840 847 state += 1
841 848 outcomps = comps.keys()
842 849 outcomps.sort()
843 850 return outcomps
844 851
845 852 def set_completer_frame(self, frame):
846 853 if frame:
847 854 self.Completer.namespace = frame.f_locals
848 855 self.Completer.global_namespace = frame.f_globals
849 856 else:
850 857 self.Completer.namespace = self.user_ns
851 858 self.Completer.global_namespace = self.user_global_ns
852 859
853 860 def init_auto_alias(self):
854 861 """Define some aliases automatically.
855 862
856 863 These are ALL parameter-less aliases"""
857 864 for alias,cmd in self.auto_alias:
858 865 self.alias_table[alias] = (0,cmd)
859 866
860 867 def alias_table_validate(self,verbose=0):
861 868 """Update information about the alias table.
862 869
863 870 In particular, make sure no Python keywords/builtins are in it."""
864 871
865 872 no_alias = self.no_alias
866 873 for k in self.alias_table.keys():
867 874 if k in no_alias:
868 875 del self.alias_table[k]
869 876 if verbose:
870 877 print ("Deleting alias <%s>, it's a Python "
871 878 "keyword or builtin." % k)
872 879
873 880 def set_autoindent(self,value=None):
874 881 """Set the autoindent flag, checking for readline support.
875 882
876 883 If called with no arguments, it acts as a toggle."""
877 884
878 885 if not self.has_readline:
879 886 if os.name == 'posix':
880 887 warn("The auto-indent feature requires the readline library")
881 888 self.autoindent = 0
882 889 return
883 890 if value is None:
884 891 self.autoindent = not self.autoindent
885 892 else:
886 893 self.autoindent = value
887 894
888 895 def rc_set_toggle(self,rc_field,value=None):
889 896 """Set or toggle a field in IPython's rc config. structure.
890 897
891 898 If called with no arguments, it acts as a toggle.
892 899
893 900 If called with a non-existent field, the resulting AttributeError
894 901 exception will propagate out."""
895 902
896 903 rc_val = getattr(self.rc,rc_field)
897 904 if value is None:
898 905 value = not rc_val
899 906 setattr(self.rc,rc_field,value)
900 907
901 908 def user_setup(self,ipythondir,rc_suffix,mode='install'):
902 909 """Install the user configuration directory.
903 910
904 911 Can be called when running for the first time or to upgrade the user's
905 912 .ipython/ directory with the mode parameter. Valid modes are 'install'
906 913 and 'upgrade'."""
907 914
908 915 def wait():
909 916 try:
910 917 raw_input("Please press <RETURN> to start IPython.")
911 918 except EOFError:
912 919 print >> Term.cout
913 920 print '*'*70
914 921
915 922 cwd = os.getcwd() # remember where we started
916 923 glb = glob.glob
917 924 print '*'*70
918 925 if mode == 'install':
919 926 print \
920 927 """Welcome to IPython. I will try to create a personal configuration directory
921 928 where you can customize many aspects of IPython's functionality in:\n"""
922 929 else:
923 930 print 'I am going to upgrade your configuration in:'
924 931
925 932 print ipythondir
926 933
927 934 rcdirend = os.path.join('IPython','UserConfig')
928 935 cfg = lambda d: os.path.join(d,rcdirend)
929 936 try:
930 937 rcdir = filter(os.path.isdir,map(cfg,sys.path))[0]
931 938 except IOError:
932 939 warning = """
933 940 Installation error. IPython's directory was not found.
934 941
935 942 Check the following:
936 943
937 944 The ipython/IPython directory should be in a directory belonging to your
938 945 PYTHONPATH environment variable (that is, it should be in a directory
939 946 belonging to sys.path). You can copy it explicitly there or just link to it.
940 947
941 948 IPython will proceed with builtin defaults.
942 949 """
943 950 warn(warning)
944 951 wait()
945 952 return
946 953
947 954 if mode == 'install':
948 955 try:
949 956 shutil.copytree(rcdir,ipythondir)
950 957 os.chdir(ipythondir)
951 958 rc_files = glb("ipythonrc*")
952 959 for rc_file in rc_files:
953 960 os.rename(rc_file,rc_file+rc_suffix)
954 961 except:
955 962 warning = """
956 963
957 964 There was a problem with the installation:
958 965 %s
959 966 Try to correct it or contact the developers if you think it's a bug.
960 967 IPython will proceed with builtin defaults.""" % sys.exc_info()[1]
961 968 warn(warning)
962 969 wait()
963 970 return
964 971
965 972 elif mode == 'upgrade':
966 973 try:
967 974 os.chdir(ipythondir)
968 975 except:
969 976 print """
970 977 Can not upgrade: changing to directory %s failed. Details:
971 978 %s
972 979 """ % (ipythondir,sys.exc_info()[1])
973 980 wait()
974 981 return
975 982 else:
976 983 sources = glb(os.path.join(rcdir,'[A-Za-z]*'))
977 984 for new_full_path in sources:
978 985 new_filename = os.path.basename(new_full_path)
979 986 if new_filename.startswith('ipythonrc'):
980 987 new_filename = new_filename + rc_suffix
981 988 # The config directory should only contain files, skip any
982 989 # directories which may be there (like CVS)
983 990 if os.path.isdir(new_full_path):
984 991 continue
985 992 if os.path.exists(new_filename):
986 993 old_file = new_filename+'.old'
987 994 if os.path.exists(old_file):
988 995 os.remove(old_file)
989 996 os.rename(new_filename,old_file)
990 997 shutil.copy(new_full_path,new_filename)
991 998 else:
992 999 raise ValueError,'unrecognized mode for install:',`mode`
993 1000
994 1001 # Fix line-endings to those native to each platform in the config
995 1002 # directory.
996 1003 try:
997 1004 os.chdir(ipythondir)
998 1005 except:
999 1006 print """
1000 1007 Problem: changing to directory %s failed.
1001 1008 Details:
1002 1009 %s
1003 1010
1004 1011 Some configuration files may have incorrect line endings. This should not
1005 1012 cause any problems during execution. """ % (ipythondir,sys.exc_info()[1])
1006 1013 wait()
1007 1014 else:
1008 1015 for fname in glb('ipythonrc*'):
1009 1016 try:
1010 1017 native_line_ends(fname,backup=0)
1011 1018 except IOError:
1012 1019 pass
1013 1020
1014 1021 if mode == 'install':
1015 1022 print """
1016 1023 Successful installation!
1017 1024
1018 1025 Please read the sections 'Initial Configuration' and 'Quick Tips' in the
1019 1026 IPython manual (there are both HTML and PDF versions supplied with the
1020 1027 distribution) to make sure that your system environment is properly configured
1021 1028 to take advantage of IPython's features."""
1022 1029 else:
1023 1030 print """
1024 1031 Successful upgrade!
1025 1032
1026 1033 All files in your directory:
1027 1034 %(ipythondir)s
1028 1035 which would have been overwritten by the upgrade were backed up with a .old
1029 1036 extension. If you had made particular customizations in those files you may
1030 1037 want to merge them back into the new files.""" % locals()
1031 1038 wait()
1032 1039 os.chdir(cwd)
1033 1040 # end user_setup()
1034 1041
1035 1042 def atexit_operations(self):
1036 1043 """This will be executed at the time of exit.
1037 1044
1038 1045 Saving of persistent data should be performed here. """
1039 1046
1040 1047 # input history
1041 1048 self.savehist()
1042 1049
1043 1050 # Cleanup all tempfiles left around
1044 1051 for tfile in self.tempfiles:
1045 1052 try:
1046 1053 os.unlink(tfile)
1047 1054 except OSError:
1048 1055 pass
1049 1056
1050 1057 # save the "persistent data" catch-all dictionary
1051 1058 try:
1052 1059 pickle.dump(self.persist, open(self.persist_fname,"w"))
1053 1060 except:
1054 1061 print "*** ERROR *** persistent data saving failed."
1055 1062
1056 1063 def savehist(self):
1057 1064 """Save input history to a file (via readline library)."""
1058 1065 try:
1059 1066 self.readline.write_history_file(self.histfile)
1060 1067 except:
1061 1068 print 'Unable to save IPython command history to file: ' + \
1062 1069 `self.histfile`
1063 1070
1064 1071 def pre_readline(self):
1065 1072 """readline hook to be used at the start of each line.
1066 1073
1067 1074 Currently it handles auto-indent only."""
1068 1075
1069 1076 self.readline.insert_text(self.indent_current)
1070 1077
1071 1078 def init_readline(self):
1072 1079 """Command history completion/saving/reloading."""
1073 1080 try:
1074 1081 import readline
1075 1082 except ImportError:
1076 1083 self.has_readline = 0
1077 1084 self.readline = None
1078 1085 # no point in bugging windows users with this every time:
1079 1086 if os.name == 'posix':
1080 1087 warn('Readline services not available on this platform.')
1081 1088 else:
1082 1089 import atexit
1083 1090 from IPython.completer import IPCompleter
1084 1091 self.Completer = IPCompleter(self,
1085 1092 self.user_ns,
1086 1093 self.user_global_ns,
1087 1094 self.rc.readline_omit__names,
1088 1095 self.alias_table)
1089 1096
1090 1097 # Platform-specific configuration
1091 1098 if os.name == 'nt':
1092 1099 self.readline_startup_hook = readline.set_pre_input_hook
1093 1100 else:
1094 1101 self.readline_startup_hook = readline.set_startup_hook
1095 1102
1096 1103 # Load user's initrc file (readline config)
1097 1104 inputrc_name = os.environ.get('INPUTRC')
1098 1105 if inputrc_name is None:
1099 1106 home_dir = get_home_dir()
1100 1107 if home_dir is not None:
1101 1108 inputrc_name = os.path.join(home_dir,'.inputrc')
1102 1109 if os.path.isfile(inputrc_name):
1103 1110 try:
1104 1111 readline.read_init_file(inputrc_name)
1105 1112 except:
1106 1113 warn('Problems reading readline initialization file <%s>'
1107 1114 % inputrc_name)
1108 1115
1109 1116 self.has_readline = 1
1110 1117 self.readline = readline
1111 1118 # save this in sys so embedded copies can restore it properly
1112 1119 sys.ipcompleter = self.Completer.complete
1113 1120 readline.set_completer(self.Completer.complete)
1114 1121
1115 1122 # Configure readline according to user's prefs
1116 1123 for rlcommand in self.rc.readline_parse_and_bind:
1117 1124 readline.parse_and_bind(rlcommand)
1118 1125
1119 1126 # remove some chars from the delimiters list
1120 1127 delims = readline.get_completer_delims()
1121 1128 delims = delims.translate(string._idmap,
1122 1129 self.rc.readline_remove_delims)
1123 1130 readline.set_completer_delims(delims)
1124 1131 # otherwise we end up with a monster history after a while:
1125 1132 readline.set_history_length(1000)
1126 1133 try:
1127 1134 #print '*** Reading readline history' # dbg
1128 1135 readline.read_history_file(self.histfile)
1129 1136 except IOError:
1130 1137 pass # It doesn't exist yet.
1131 1138
1132 1139 atexit.register(self.atexit_operations)
1133 1140 del atexit
1134 1141
1135 1142 # Configure auto-indent for all platforms
1136 1143 self.set_autoindent(self.rc.autoindent)
1137 1144
1138 1145 def _should_recompile(self,e):
1139 1146 """Utility routine for edit_syntax_error"""
1140 1147
1141 1148 if e.filename in ('<ipython console>','<input>','<string>',
1142 1149 '<console>'):
1143 1150 return False
1144 1151 try:
1145 1152 if not ask_yes_no('Return to editor to correct syntax error? '
1146 1153 '[Y/n] ','y'):
1147 1154 return False
1148 1155 except EOFError:
1149 1156 return False
1150 1157 self.hooks.fix_error_editor(e.filename,e.lineno,e.offset,e.msg)
1151 1158 return True
1152 1159
1153 1160 def edit_syntax_error(self):
1154 1161 """The bottom half of the syntax error handler called in the main loop.
1155 1162
1156 1163 Loop until syntax error is fixed or user cancels.
1157 1164 """
1158 1165
1159 1166 while self.SyntaxTB.last_syntax_error:
1160 1167 # copy and clear last_syntax_error
1161 1168 err = self.SyntaxTB.clear_err_state()
1162 1169 if not self._should_recompile(err):
1163 1170 return
1164 1171 try:
1165 1172 # may set last_syntax_error again if a SyntaxError is raised
1166 1173 self.safe_execfile(err.filename,self.shell.user_ns)
1167 1174 except:
1168 1175 self.showtraceback()
1169 1176 else:
1170 1177 f = file(err.filename)
1171 1178 try:
1172 1179 sys.displayhook(f.read())
1173 1180 finally:
1174 1181 f.close()
1175 1182
1176 1183 def showsyntaxerror(self, filename=None):
1177 1184 """Display the syntax error that just occurred.
1178 1185
1179 1186 This doesn't display a stack trace because there isn't one.
1180 1187
1181 1188 If a filename is given, it is stuffed in the exception instead
1182 1189 of what was there before (because Python's parser always uses
1183 1190 "<string>" when reading from a string).
1184 1191 """
1185 1192 etype, value, last_traceback = sys.exc_info()
1186 1193 if filename and etype is SyntaxError:
1187 1194 # Work hard to stuff the correct filename in the exception
1188 1195 try:
1189 1196 msg, (dummy_filename, lineno, offset, line) = value
1190 1197 except:
1191 1198 # Not the format we expect; leave it alone
1192 1199 pass
1193 1200 else:
1194 1201 # Stuff in the right filename
1195 1202 try:
1196 1203 # Assume SyntaxError is a class exception
1197 1204 value = SyntaxError(msg, (filename, lineno, offset, line))
1198 1205 except:
1199 1206 # If that failed, assume SyntaxError is a string
1200 1207 value = msg, (filename, lineno, offset, line)
1201 1208 self.SyntaxTB(etype,value,[])
1202 1209
1203 1210 def debugger(self):
1204 1211 """Call the pdb debugger."""
1205 1212
1206 1213 if not self.rc.pdb:
1207 1214 return
1208 1215 pdb.pm()
1209 1216
1210 1217 def showtraceback(self,exc_tuple = None,filename=None):
1211 1218 """Display the exception that just occurred."""
1212 1219
1213 1220 # Though this won't be called by syntax errors in the input line,
1214 1221 # there may be SyntaxError cases whith imported code.
1215 1222 if exc_tuple is None:
1216 1223 type, value, tb = sys.exc_info()
1217 1224 else:
1218 1225 type, value, tb = exc_tuple
1219 1226 if type is SyntaxError:
1220 1227 self.showsyntaxerror(filename)
1221 1228 else:
1222 1229 self.InteractiveTB()
1223 1230 if self.InteractiveTB.call_pdb and self.has_readline:
1224 1231 # pdb mucks up readline, fix it back
1225 1232 self.readline.set_completer(self.Completer.complete)
1226 1233
1227 1234 def mainloop(self,banner=None):
1228 1235 """Creates the local namespace and starts the mainloop.
1229 1236
1230 1237 If an optional banner argument is given, it will override the
1231 1238 internally created default banner."""
1232 1239
1233 1240 if self.rc.c: # Emulate Python's -c option
1234 1241 self.exec_init_cmd()
1235 1242 if banner is None:
1236 1243 if self.rc.banner:
1237 1244 banner = self.BANNER+self.banner2
1238 1245 else:
1239 1246 banner = ''
1240 1247 self.interact(banner)
1241 1248
1242 1249 def exec_init_cmd(self):
1243 1250 """Execute a command given at the command line.
1244 1251
1245 1252 This emulates Python's -c option."""
1246 1253
1247 1254 sys.argv = ['-c']
1248 1255 self.push(self.rc.c)
1249 1256
1250 1257 def embed_mainloop(self,header='',local_ns=None,global_ns=None,stack_depth=0):
1251 1258 """Embeds IPython into a running python program.
1252 1259
1253 1260 Input:
1254 1261
1255 1262 - header: An optional header message can be specified.
1256 1263
1257 1264 - local_ns, global_ns: working namespaces. If given as None, the
1258 1265 IPython-initialized one is updated with __main__.__dict__, so that
1259 1266 program variables become visible but user-specific configuration
1260 1267 remains possible.
1261 1268
1262 1269 - stack_depth: specifies how many levels in the stack to go to
1263 1270 looking for namespaces (when local_ns and global_ns are None). This
1264 1271 allows an intermediate caller to make sure that this function gets
1265 1272 the namespace from the intended level in the stack. By default (0)
1266 1273 it will get its locals and globals from the immediate caller.
1267 1274
1268 1275 Warning: it's possible to use this in a program which is being run by
1269 1276 IPython itself (via %run), but some funny things will happen (a few
1270 1277 globals get overwritten). In the future this will be cleaned up, as
1271 1278 there is no fundamental reason why it can't work perfectly."""
1272 1279
1273 1280 # Get locals and globals from caller
1274 1281 if local_ns is None or global_ns is None:
1275 1282 call_frame = sys._getframe(stack_depth).f_back
1276 1283
1277 1284 if local_ns is None:
1278 1285 local_ns = call_frame.f_locals
1279 1286 if global_ns is None:
1280 1287 global_ns = call_frame.f_globals
1281 1288
1282 1289 # Update namespaces and fire up interpreter
1283 1290 self.user_ns = local_ns
1284 1291 self.user_global_ns = global_ns
1285 1292
1286 1293 # Patch for global embedding to make sure that things don't overwrite
1287 1294 # user globals accidentally. Thanks to Richard <rxe@renre-europe.com>
1288 1295 # FIXME. Test this a bit more carefully (the if.. is new)
1289 1296 if local_ns is None and global_ns is None:
1290 1297 self.user_global_ns.update(__main__.__dict__)
1291 1298
1292 1299 # make sure the tab-completer has the correct frame information, so it
1293 1300 # actually completes using the frame's locals/globals
1294 1301 self.set_completer_frame(call_frame)
1295 1302
1296 1303 self.interact(header)
1297 1304
1298 1305 def interact(self, banner=None):
1299 1306 """Closely emulate the interactive Python console.
1300 1307
1301 1308 The optional banner argument specify the banner to print
1302 1309 before the first interaction; by default it prints a banner
1303 1310 similar to the one printed by the real Python interpreter,
1304 1311 followed by the current class name in parentheses (so as not
1305 1312 to confuse this with the real interpreter -- since it's so
1306 1313 close!).
1307 1314
1308 1315 """
1309 1316 cprt = 'Type "copyright", "credits" or "license" for more information.'
1310 1317 if banner is None:
1311 1318 self.write("Python %s on %s\n%s\n(%s)\n" %
1312 1319 (sys.version, sys.platform, cprt,
1313 1320 self.__class__.__name__))
1314 1321 else:
1315 1322 self.write(banner)
1316 1323
1317 1324 more = 0
1318 1325
1319 1326 # Mark activity in the builtins
1320 1327 __builtin__.__dict__['__IPYTHON__active'] += 1
1321 1328
1322 1329 # exit_now is set by a call to %Exit or %Quit
1323 1330 while not self.exit_now:
1324 1331 try:
1325 1332 if more:
1326 1333 prompt = self.outputcache.prompt2
1327 1334 if self.autoindent:
1328 1335 self.readline_startup_hook(self.pre_readline)
1329 1336 else:
1330 1337 prompt = self.outputcache.prompt1
1331 1338 try:
1332 1339 line = self.raw_input(prompt,more)
1333 1340 if self.autoindent:
1334 1341 self.readline_startup_hook(None)
1335 1342 except EOFError:
1336 1343 if self.autoindent:
1337 1344 self.readline_startup_hook(None)
1338 1345 self.write("\n")
1339 1346 self.exit()
1340 1347 else:
1341 1348 more = self.push(line)
1342 1349
1343 1350 if (self.SyntaxTB.last_syntax_error and
1344 1351 self.rc.autoedit_syntax):
1345 1352 self.edit_syntax_error()
1346 1353
1347 1354 except KeyboardInterrupt:
1348 1355 self.write("\nKeyboardInterrupt\n")
1349 1356 self.resetbuffer()
1350 1357 more = 0
1351 1358 # keep cache in sync with the prompt counter:
1352 1359 self.outputcache.prompt_count -= 1
1353 1360
1354 1361 if self.autoindent:
1355 1362 self.indent_current_nsp = 0
1356 1363 self.indent_current = ' '* self.indent_current_nsp
1357 1364
1358 1365 except bdb.BdbQuit:
1359 1366 warn("The Python debugger has exited with a BdbQuit exception.\n"
1360 1367 "Because of how pdb handles the stack, it is impossible\n"
1361 1368 "for IPython to properly format this particular exception.\n"
1362 1369 "IPython will resume normal operation.")
1363 1370
1364 1371 # We are off again...
1365 1372 __builtin__.__dict__['__IPYTHON__active'] -= 1
1366 1373
1367 1374 def excepthook(self, type, value, tb):
1368 1375 """One more defense for GUI apps that call sys.excepthook.
1369 1376
1370 1377 GUI frameworks like wxPython trap exceptions and call
1371 1378 sys.excepthook themselves. I guess this is a feature that
1372 1379 enables them to keep running after exceptions that would
1373 1380 otherwise kill their mainloop. This is a bother for IPython
1374 1381 which excepts to catch all of the program exceptions with a try:
1375 1382 except: statement.
1376 1383
1377 1384 Normally, IPython sets sys.excepthook to a CrashHandler instance, so if
1378 1385 any app directly invokes sys.excepthook, it will look to the user like
1379 1386 IPython crashed. In order to work around this, we can disable the
1380 1387 CrashHandler and replace it with this excepthook instead, which prints a
1381 1388 regular traceback using our InteractiveTB. In this fashion, apps which
1382 1389 call sys.excepthook will generate a regular-looking exception from
1383 1390 IPython, and the CrashHandler will only be triggered by real IPython
1384 1391 crashes.
1385 1392
1386 1393 This hook should be used sparingly, only in places which are not likely
1387 1394 to be true IPython errors.
1388 1395 """
1389 1396
1390 1397 self.InteractiveTB(type, value, tb, tb_offset=0)
1391 1398 if self.InteractiveTB.call_pdb and self.has_readline:
1392 1399 self.readline.set_completer(self.Completer.complete)
1393 1400
1394 1401 def call_alias(self,alias,rest=''):
1395 1402 """Call an alias given its name and the rest of the line.
1396 1403
1397 1404 This function MUST be given a proper alias, because it doesn't make
1398 1405 any checks when looking up into the alias table. The caller is
1399 1406 responsible for invoking it only with a valid alias."""
1400 1407
1401 1408 #print 'ALIAS: <%s>+<%s>' % (alias,rest) # dbg
1402 1409 nargs,cmd = self.alias_table[alias]
1403 1410 # Expand the %l special to be the user's input line
1404 1411 if cmd.find('%l') >= 0:
1405 1412 cmd = cmd.replace('%l',rest)
1406 1413 rest = ''
1407 1414 if nargs==0:
1408 1415 # Simple, argument-less aliases
1409 1416 cmd = '%s %s' % (cmd,rest)
1410 1417 else:
1411 1418 # Handle aliases with positional arguments
1412 1419 args = rest.split(None,nargs)
1413 1420 if len(args)< nargs:
1414 1421 error('Alias <%s> requires %s arguments, %s given.' %
1415 1422 (alias,nargs,len(args)))
1416 1423 return
1417 1424 cmd = '%s %s' % (cmd % tuple(args[:nargs]),' '.join(args[nargs:]))
1418 1425 # Now call the macro, evaluating in the user's namespace
1419 1426 try:
1420 1427 self.system(cmd)
1421 1428 except:
1422 1429 self.showtraceback()
1423 1430
1424 1431 def autoindent_update(self,line):
1425 1432 """Keep track of the indent level."""
1426 1433 if self.autoindent:
1427 1434 if line:
1428 1435 ini_spaces = ini_spaces_re.match(line)
1429 1436 if ini_spaces:
1430 1437 nspaces = ini_spaces.end()
1431 1438 else:
1432 1439 nspaces = 0
1433 1440 self.indent_current_nsp = nspaces
1434 1441
1435 1442 if line[-1] == ':':
1436 1443 self.indent_current_nsp += 4
1437 1444 elif dedent_re.match(line):
1438 1445 self.indent_current_nsp -= 4
1439 1446 else:
1440 1447 self.indent_current_nsp = 0
1441 1448
1442 1449 # indent_current is the actual string to be inserted
1443 1450 # by the readline hooks for indentation
1444 1451 self.indent_current = ' '* self.indent_current_nsp
1445 1452
1446 1453 def runlines(self,lines):
1447 1454 """Run a string of one or more lines of source.
1448 1455
1449 1456 This method is capable of running a string containing multiple source
1450 1457 lines, as if they had been entered at the IPython prompt. Since it
1451 1458 exposes IPython's processing machinery, the given strings can contain
1452 1459 magic calls (%magic), special shell access (!cmd), etc."""
1453 1460
1454 1461 # We must start with a clean buffer, in case this is run from an
1455 1462 # interactive IPython session (via a magic, for example).
1456 1463 self.resetbuffer()
1457 1464 lines = lines.split('\n')
1458 1465 more = 0
1459 1466 for line in lines:
1460 1467 # skip blank lines so we don't mess up the prompt counter, but do
1461 1468 # NOT skip even a blank line if we are in a code block (more is
1462 1469 # true)
1463 1470 if line or more:
1464 1471 more = self.push(self.prefilter(line,more))
1465 1472 # IPython's runsource returns None if there was an error
1466 1473 # compiling the code. This allows us to stop processing right
1467 1474 # away, so the user gets the error message at the right place.
1468 1475 if more is None:
1469 1476 break
1470 1477 # final newline in case the input didn't have it, so that the code
1471 1478 # actually does get executed
1472 1479 if more:
1473 1480 self.push('\n')
1474 1481
1475 1482 def runsource(self, source, filename='<input>', symbol='single'):
1476 1483 """Compile and run some source in the interpreter.
1477 1484
1478 1485 Arguments are as for compile_command().
1479 1486
1480 1487 One several things can happen:
1481 1488
1482 1489 1) The input is incorrect; compile_command() raised an
1483 1490 exception (SyntaxError or OverflowError). A syntax traceback
1484 1491 will be printed by calling the showsyntaxerror() method.
1485 1492
1486 1493 2) The input is incomplete, and more input is required;
1487 1494 compile_command() returned None. Nothing happens.
1488 1495
1489 1496 3) The input is complete; compile_command() returned a code
1490 1497 object. The code is executed by calling self.runcode() (which
1491 1498 also handles run-time exceptions, except for SystemExit).
1492 1499
1493 1500 The return value is:
1494 1501
1495 1502 - True in case 2
1496 1503
1497 1504 - False in the other cases, unless an exception is raised, where
1498 1505 None is returned instead. This can be used by external callers to
1499 1506 know whether to continue feeding input or not.
1500 1507
1501 1508 The return value can be used to decide whether to use sys.ps1 or
1502 1509 sys.ps2 to prompt the next line."""
1503 1510
1504 1511 try:
1505 1512 code = self.compile(source,filename,symbol)
1506 1513 except (OverflowError, SyntaxError, ValueError):
1507 1514 # Case 1
1508 1515 self.showsyntaxerror(filename)
1509 1516 return None
1510 1517
1511 1518 if code is None:
1512 1519 # Case 2
1513 1520 return True
1514 1521
1515 1522 # Case 3
1516 1523 # We store the code object so that threaded shells and
1517 1524 # custom exception handlers can access all this info if needed.
1518 1525 # The source corresponding to this can be obtained from the
1519 1526 # buffer attribute as '\n'.join(self.buffer).
1520 1527 self.code_to_run = code
1521 1528 # now actually execute the code object
1522 1529 if self.runcode(code) == 0:
1523 1530 return False
1524 1531 else:
1525 1532 return None
1526 1533
1527 1534 def runcode(self,code_obj):
1528 1535 """Execute a code object.
1529 1536
1530 1537 When an exception occurs, self.showtraceback() is called to display a
1531 1538 traceback.
1532 1539
1533 1540 Return value: a flag indicating whether the code to be run completed
1534 1541 successfully:
1535 1542
1536 1543 - 0: successful execution.
1537 1544 - 1: an error occurred.
1538 1545 """
1539 1546
1540 1547 # Set our own excepthook in case the user code tries to call it
1541 1548 # directly, so that the IPython crash handler doesn't get triggered
1542 1549 old_excepthook,sys.excepthook = sys.excepthook, self.excepthook
1543 1550
1544 1551 # we save the original sys.excepthook in the instance, in case config
1545 1552 # code (such as magics) needs access to it.
1546 1553 self.sys_excepthook = old_excepthook
1547 1554 outflag = 1 # happens in more places, so it's easier as default
1548 1555 try:
1549 1556 try:
1550 1557 # Embedded instances require separate global/local namespaces
1551 1558 # so they can see both the surrounding (local) namespace and
1552 1559 # the module-level globals when called inside another function.
1553 1560 if self.embedded:
1554 1561 exec code_obj in self.user_global_ns, self.user_ns
1555 1562 # Normal (non-embedded) instances should only have a single
1556 1563 # namespace for user code execution, otherwise functions won't
1557 1564 # see interactive top-level globals.
1558 1565 else:
1559 1566 exec code_obj in self.user_ns
1560 1567 finally:
1561 1568 # Reset our crash handler in place
1562 1569 sys.excepthook = old_excepthook
1563 1570 except SystemExit:
1564 1571 self.resetbuffer()
1565 1572 self.showtraceback()
1566 1573 warn("Type exit or quit to exit IPython "
1567 1574 "(%Exit or %Quit do so unconditionally).",level=1)
1568 1575 except self.custom_exceptions:
1569 1576 etype,value,tb = sys.exc_info()
1570 1577 self.CustomTB(etype,value,tb)
1571 1578 except:
1572 1579 self.showtraceback()
1573 1580 else:
1574 1581 outflag = 0
1575 1582 if softspace(sys.stdout, 0):
1576 1583 print
1577 1584 # Flush out code object which has been run (and source)
1578 1585 self.code_to_run = None
1579 1586 return outflag
1580 1587
1581 1588 def push(self, line):
1582 1589 """Push a line to the interpreter.
1583 1590
1584 1591 The line should not have a trailing newline; it may have
1585 1592 internal newlines. The line is appended to a buffer and the
1586 1593 interpreter's runsource() method is called with the
1587 1594 concatenated contents of the buffer as source. If this
1588 1595 indicates that the command was executed or invalid, the buffer
1589 1596 is reset; otherwise, the command is incomplete, and the buffer
1590 1597 is left as it was after the line was appended. The return
1591 1598 value is 1 if more input is required, 0 if the line was dealt
1592 1599 with in some way (this is the same as runsource()).
1593 1600 """
1594 1601
1595 1602 # autoindent management should be done here, and not in the
1596 1603 # interactive loop, since that one is only seen by keyboard input. We
1597 1604 # need this done correctly even for code run via runlines (which uses
1598 1605 # push).
1599 1606
1600 1607 #print 'push line: <%s>' % line # dbg
1601 1608 self.autoindent_update(line)
1602 1609
1603 1610 self.buffer.append(line)
1604 1611 more = self.runsource('\n'.join(self.buffer), self.filename)
1605 1612 if not more:
1606 1613 self.resetbuffer()
1607 1614 return more
1608 1615
1609 1616 def resetbuffer(self):
1610 1617 """Reset the input buffer."""
1611 1618 self.buffer[:] = []
1612 1619
1613 1620 def raw_input(self,prompt='',continue_prompt=False):
1614 1621 """Write a prompt and read a line.
1615 1622
1616 1623 The returned line does not include the trailing newline.
1617 1624 When the user enters the EOF key sequence, EOFError is raised.
1618 1625
1619 1626 Optional inputs:
1620 1627
1621 1628 - prompt(''): a string to be printed to prompt the user.
1622 1629
1623 1630 - continue_prompt(False): whether this line is the first one or a
1624 1631 continuation in a sequence of inputs.
1625 1632 """
1626 1633
1627 1634 line = raw_input_original(prompt)
1628 1635 # Try to be reasonably smart about not re-indenting pasted input more
1629 1636 # than necessary. We do this by trimming out the auto-indent initial
1630 1637 # spaces, if the user's actual input started itself with whitespace.
1631 1638 if self.autoindent:
1632 1639 line2 = line[self.indent_current_nsp:]
1633 1640 if line2[0:1] in (' ','\t'):
1634 1641 line = line2
1635 1642 return self.prefilter(line,continue_prompt)
1636 1643
1637 1644 def split_user_input(self,line):
1638 1645 """Split user input into pre-char, function part and rest."""
1639 1646
1640 1647 lsplit = self.line_split.match(line)
1641 1648 if lsplit is None: # no regexp match returns None
1642 1649 try:
1643 1650 iFun,theRest = line.split(None,1)
1644 1651 except ValueError:
1645 1652 iFun,theRest = line,''
1646 1653 pre = re.match('^(\s*)(.*)',line).groups()[0]
1647 1654 else:
1648 1655 pre,iFun,theRest = lsplit.groups()
1649 1656
1650 1657 #print 'line:<%s>' % line # dbg
1651 1658 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun.strip(),theRest) # dbg
1652 1659 return pre,iFun.strip(),theRest
1653 1660
1654 1661 def _prefilter(self, line, continue_prompt):
1655 1662 """Calls different preprocessors, depending on the form of line."""
1656 1663
1657 1664 # All handlers *must* return a value, even if it's blank ('').
1658 1665
1659 1666 # Lines are NOT logged here. Handlers should process the line as
1660 1667 # needed, update the cache AND log it (so that the input cache array
1661 1668 # stays synced).
1662 1669
1663 1670 # This function is _very_ delicate, and since it's also the one which
1664 1671 # determines IPython's response to user input, it must be as efficient
1665 1672 # as possible. For this reason it has _many_ returns in it, trying
1666 1673 # always to exit as quickly as it can figure out what it needs to do.
1667 1674
1668 1675 # This function is the main responsible for maintaining IPython's
1669 1676 # behavior respectful of Python's semantics. So be _very_ careful if
1670 1677 # making changes to anything here.
1671 1678
1672 1679 #.....................................................................
1673 1680 # Code begins
1674 1681
1675 1682 #if line.startswith('%crash'): raise RuntimeError,'Crash now!' # dbg
1676 1683
1677 1684 # save the line away in case we crash, so the post-mortem handler can
1678 1685 # record it
1679 1686 self._last_input_line = line
1680 1687
1681 1688 #print '***line: <%s>' % line # dbg
1682 1689
1683 1690 # the input history needs to track even empty lines
1684 1691 if not line.strip():
1685 1692 if not continue_prompt:
1686 1693 self.outputcache.prompt_count -= 1
1687 1694 return self.handle_normal(line,continue_prompt)
1688 1695 #return self.handle_normal('',continue_prompt)
1689 1696
1690 1697 # print '***cont',continue_prompt # dbg
1691 1698 # special handlers are only allowed for single line statements
1692 1699 if continue_prompt and not self.rc.multi_line_specials:
1693 1700 return self.handle_normal(line,continue_prompt)
1694 1701
1695 1702 # For the rest, we need the structure of the input
1696 1703 pre,iFun,theRest = self.split_user_input(line)
1697 1704 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
1698 1705
1699 1706 # First check for explicit escapes in the last/first character
1700 1707 handler = None
1701 1708 if line[-1] == self.ESC_HELP:
1702 1709 handler = self.esc_handlers.get(line[-1]) # the ? can be at the end
1703 1710 if handler is None:
1704 1711 # look at the first character of iFun, NOT of line, so we skip
1705 1712 # leading whitespace in multiline input
1706 1713 handler = self.esc_handlers.get(iFun[0:1])
1707 1714 if handler is not None:
1708 1715 return handler(line,continue_prompt,pre,iFun,theRest)
1709 1716 # Emacs ipython-mode tags certain input lines
1710 1717 if line.endswith('# PYTHON-MODE'):
1711 1718 return self.handle_emacs(line,continue_prompt)
1712 1719
1713 1720 # Next, check if we can automatically execute this thing
1714 1721
1715 1722 # Allow ! in multi-line statements if multi_line_specials is on:
1716 1723 if continue_prompt and self.rc.multi_line_specials and \
1717 1724 iFun.startswith(self.ESC_SHELL):
1718 1725 return self.handle_shell_escape(line,continue_prompt,
1719 1726 pre=pre,iFun=iFun,
1720 1727 theRest=theRest)
1721 1728
1722 1729 # Let's try to find if the input line is a magic fn
1723 1730 oinfo = None
1724 1731 if hasattr(self,'magic_'+iFun):
1725 1732 # WARNING: _ofind uses getattr(), so it can consume generators and
1726 1733 # cause other side effects.
1727 1734 oinfo = self._ofind(iFun) # FIXME - _ofind is part of Magic
1728 1735 if oinfo['ismagic']:
1729 1736 # Be careful not to call magics when a variable assignment is
1730 1737 # being made (ls='hi', for example)
1731 1738 if self.rc.automagic and \
1732 1739 (len(theRest)==0 or theRest[0] not in '!=()<>,') and \
1733 1740 (self.rc.multi_line_specials or not continue_prompt):
1734 1741 return self.handle_magic(line,continue_prompt,
1735 1742 pre,iFun,theRest)
1736 1743 else:
1737 1744 return self.handle_normal(line,continue_prompt)
1738 1745
1739 1746 # If the rest of the line begins with an (in)equality, assginment or
1740 1747 # function call, we should not call _ofind but simply execute it.
1741 1748 # This avoids spurious geattr() accesses on objects upon assignment.
1742 1749 #
1743 1750 # It also allows users to assign to either alias or magic names true
1744 1751 # python variables (the magic/alias systems always take second seat to
1745 1752 # true python code).
1746 1753 if theRest and theRest[0] in '!=()':
1747 1754 return self.handle_normal(line,continue_prompt)
1748 1755
1749 1756 if oinfo is None:
1750 1757 # let's try to ensure that _oinfo is ONLY called when autocall is
1751 1758 # on. Since it has inevitable potential side effects, at least
1752 1759 # having autocall off should be a guarantee to the user that no
1753 1760 # weird things will happen.
1754 1761
1755 1762 if self.rc.autocall:
1756 1763 oinfo = self._ofind(iFun) # FIXME - _ofind is part of Magic
1757 1764 else:
1758 1765 # in this case, all that's left is either an alias or
1759 1766 # processing the line normally.
1760 1767 if iFun in self.alias_table:
1761 1768 return self.handle_alias(line,continue_prompt,
1762 1769 pre,iFun,theRest)
1763 1770 else:
1764 1771 return self.handle_normal(line,continue_prompt)
1765 1772
1766 1773 if not oinfo['found']:
1767 1774 return self.handle_normal(line,continue_prompt)
1768 1775 else:
1769 1776 #print 'iFun <%s> rest <%s>' % (iFun,theRest) # dbg
1770 1777 if oinfo['isalias']:
1771 1778 return self.handle_alias(line,continue_prompt,
1772 1779 pre,iFun,theRest)
1773 1780
1774 1781 if self.rc.autocall and \
1775 1782 not self.re_exclude_auto.match(theRest) and \
1776 1783 self.re_fun_name.match(iFun) and \
1777 1784 callable(oinfo['obj']) :
1778 1785 #print 'going auto' # dbg
1779 1786 return self.handle_auto(line,continue_prompt,pre,iFun,theRest)
1780 1787 else:
1781 1788 #print 'was callable?', callable(oinfo['obj']) # dbg
1782 1789 return self.handle_normal(line,continue_prompt)
1783 1790
1784 1791 # If we get here, we have a normal Python line. Log and return.
1785 1792 return self.handle_normal(line,continue_prompt)
1786 1793
1787 1794 def _prefilter_dumb(self, line, continue_prompt):
1788 1795 """simple prefilter function, for debugging"""
1789 1796 return self.handle_normal(line,continue_prompt)
1790 1797
1791 1798 # Set the default prefilter() function (this can be user-overridden)
1792 1799 prefilter = _prefilter
1793 1800
1794 1801 def handle_normal(self,line,continue_prompt=None,
1795 1802 pre=None,iFun=None,theRest=None):
1796 1803 """Handle normal input lines. Use as a template for handlers."""
1797 1804
1798 1805 # With autoindent on, we need some way to exit the input loop, and I
1799 1806 # don't want to force the user to have to backspace all the way to
1800 1807 # clear the line. The rule will be in this case, that either two
1801 1808 # lines of pure whitespace in a row, or a line of pure whitespace but
1802 1809 # of a size different to the indent level, will exit the input loop.
1803 1810
1804 1811 if (continue_prompt and self.autoindent and isspace(line) and
1805 1812 (line != self.indent_current or isspace(self.buffer[-1]))):
1806 1813 line = ''
1807 1814
1808 1815 self.log(line,continue_prompt)
1809 1816 return line
1810 1817
1811 1818 def handle_alias(self,line,continue_prompt=None,
1812 1819 pre=None,iFun=None,theRest=None):
1813 1820 """Handle alias input lines. """
1814 1821
1815 1822 # pre is needed, because it carries the leading whitespace. Otherwise
1816 1823 # aliases won't work in indented sections.
1817 1824 line_out = '%sipalias("%s %s")' % (pre,iFun,esc_quotes(theRest))
1818 1825 self.log(line_out,continue_prompt)
1819 1826 return line_out
1820 1827
1821 1828 def handle_shell_escape(self, line, continue_prompt=None,
1822 1829 pre=None,iFun=None,theRest=None):
1823 1830 """Execute the line in a shell, empty return value"""
1824 1831
1825 1832 #print 'line in :', `line` # dbg
1826 1833 # Example of a special handler. Others follow a similar pattern.
1827 1834 if continue_prompt: # multi-line statements
1828 1835 if iFun.startswith('!!'):
1829 1836 print 'SyntaxError: !! is not allowed in multiline statements'
1830 1837 return pre
1831 1838 else:
1832 1839 cmd = ("%s %s" % (iFun[1:],theRest))
1833 1840 line_out = '%sipsystem(r"""%s"""[:-1])' % (pre,cmd + "_")
1834 1841 else: # single-line input
1835 1842 if line.startswith('!!'):
1836 1843 # rewrite iFun/theRest to properly hold the call to %sx and
1837 1844 # the actual command to be executed, so handle_magic can work
1838 1845 # correctly
1839 1846 theRest = '%s %s' % (iFun[2:],theRest)
1840 1847 iFun = 'sx'
1841 1848 return self.handle_magic('%ssx %s' % (self.ESC_MAGIC,line[2:]),
1842 1849 continue_prompt,pre,iFun,theRest)
1843 1850 else:
1844 1851 cmd=line[1:]
1845 1852 line_out = '%sipsystem(r"""%s"""[:-1])' % (pre,cmd +"_")
1846 1853 # update cache/log and return
1847 1854 self.log(line_out,continue_prompt)
1848 1855 return line_out
1849 1856
1850 1857 def handle_magic(self, line, continue_prompt=None,
1851 1858 pre=None,iFun=None,theRest=None):
1852 1859 """Execute magic functions.
1853 1860
1854 1861 Also log them with a prepended # so the log is clean Python."""
1855 1862
1856 1863 cmd = '%sipmagic("%s")' % (pre,esc_quotes('%s %s' % (iFun,theRest)))
1857 1864 self.log(cmd,continue_prompt)
1858 1865 #print 'in handle_magic, cmd=<%s>' % cmd # dbg
1859 1866 return cmd
1860 1867
1861 1868 def handle_auto(self, line, continue_prompt=None,
1862 1869 pre=None,iFun=None,theRest=None):
1863 1870 """Hande lines which can be auto-executed, quoting if requested."""
1864 1871
1865 1872 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
1866 1873
1867 1874 # This should only be active for single-line input!
1868 1875 if continue_prompt:
1869 1876 return line
1870 1877
1871 1878 if pre == self.ESC_QUOTE:
1872 1879 # Auto-quote splitting on whitespace
1873 1880 newcmd = '%s("%s")' % (iFun,'", "'.join(theRest.split()) )
1874 1881 elif pre == self.ESC_QUOTE2:
1875 1882 # Auto-quote whole string
1876 1883 newcmd = '%s("%s")' % (iFun,theRest)
1877 1884 else:
1878 1885 # Auto-paren
1879 1886 if theRest[0:1] in ('=','['):
1880 1887 # Don't autocall in these cases. They can be either
1881 1888 # rebindings of an existing callable's name, or item access
1882 1889 # for an object which is BOTH callable and implements
1883 1890 # __getitem__.
1884 1891 return '%s %s' % (iFun,theRest)
1885 1892 if theRest.endswith(';'):
1886 1893 newcmd = '%s(%s);' % (iFun.rstrip(),theRest[:-1])
1887 1894 else:
1888 1895 newcmd = '%s(%s)' % (iFun.rstrip(),theRest)
1889 1896
1890 1897 print >>Term.cout, self.outputcache.prompt1.auto_rewrite() + newcmd
1891 1898 # log what is now valid Python, not the actual user input (without the
1892 1899 # final newline)
1893 1900 self.log(newcmd,continue_prompt)
1894 1901 return newcmd
1895 1902
1896 1903 def handle_help(self, line, continue_prompt=None,
1897 1904 pre=None,iFun=None,theRest=None):
1898 1905 """Try to get some help for the object.
1899 1906
1900 1907 obj? or ?obj -> basic information.
1901 1908 obj?? or ??obj -> more details.
1902 1909 """
1903 1910
1904 1911 # We need to make sure that we don't process lines which would be
1905 1912 # otherwise valid python, such as "x=1 # what?"
1906 1913 try:
1907 1914 codeop.compile_command(line)
1908 1915 except SyntaxError:
1909 1916 # We should only handle as help stuff which is NOT valid syntax
1910 1917 if line[0]==self.ESC_HELP:
1911 1918 line = line[1:]
1912 1919 elif line[-1]==self.ESC_HELP:
1913 1920 line = line[:-1]
1914 1921 self.log('#?'+line)
1915 1922 if line:
1916 1923 self.magic_pinfo(line)
1917 1924 else:
1918 1925 page(self.usage,screen_lines=self.rc.screen_length)
1919 1926 return '' # Empty string is needed here!
1920 1927 except:
1921 1928 # Pass any other exceptions through to the normal handler
1922 1929 return self.handle_normal(line,continue_prompt)
1923 1930 else:
1924 1931 # If the code compiles ok, we should handle it normally
1925 1932 return self.handle_normal(line,continue_prompt)
1926 1933
1927 1934 def handle_emacs(self,line,continue_prompt=None,
1928 1935 pre=None,iFun=None,theRest=None):
1929 1936 """Handle input lines marked by python-mode."""
1930 1937
1931 1938 # Currently, nothing is done. Later more functionality can be added
1932 1939 # here if needed.
1933 1940
1934 1941 # The input cache shouldn't be updated
1935 1942
1936 1943 return line
1937 1944
1938 1945 def write(self,data):
1939 1946 """Write a string to the default output"""
1940 1947 Term.cout.write(data)
1941 1948
1942 1949 def write_err(self,data):
1943 1950 """Write a string to the default error output"""
1944 1951 Term.cerr.write(data)
1945 1952
1946 1953 def exit(self):
1947 1954 """Handle interactive exit.
1948 1955
1949 1956 This method sets the exit_now attribute."""
1950 1957
1951 1958 if self.rc.confirm_exit:
1952 1959 if ask_yes_no('Do you really want to exit ([y]/n)?','y'):
1953 1960 self.exit_now = True
1954 1961 else:
1955 1962 self.exit_now = True
1956 1963 return self.exit_now
1957 1964
1958 1965 def safe_execfile(self,fname,*where,**kw):
1959 1966 fname = os.path.expanduser(fname)
1960 1967
1961 1968 # find things also in current directory
1962 1969 dname = os.path.dirname(fname)
1963 1970 if not sys.path.count(dname):
1964 1971 sys.path.append(dname)
1965 1972
1966 1973 try:
1967 1974 xfile = open(fname)
1968 1975 except:
1969 1976 print >> Term.cerr, \
1970 1977 'Could not open file <%s> for safe execution.' % fname
1971 1978 return None
1972 1979
1973 1980 kw.setdefault('islog',0)
1974 1981 kw.setdefault('quiet',1)
1975 1982 kw.setdefault('exit_ignore',0)
1976 1983 first = xfile.readline()
1977 1984 loghead = str(self.loghead_tpl).split('\n',1)[0].strip()
1978 1985 xfile.close()
1979 1986 # line by line execution
1980 1987 if first.startswith(loghead) or kw['islog']:
1981 1988 print 'Loading log file <%s> one line at a time...' % fname
1982 1989 if kw['quiet']:
1983 1990 stdout_save = sys.stdout
1984 1991 sys.stdout = StringIO.StringIO()
1985 1992 try:
1986 1993 globs,locs = where[0:2]
1987 1994 except:
1988 1995 try:
1989 1996 globs = locs = where[0]
1990 1997 except:
1991 1998 globs = locs = globals()
1992 1999 badblocks = []
1993 2000
1994 2001 # we also need to identify indented blocks of code when replaying
1995 2002 # logs and put them together before passing them to an exec
1996 2003 # statement. This takes a bit of regexp and look-ahead work in the
1997 2004 # file. It's easiest if we swallow the whole thing in memory
1998 2005 # first, and manually walk through the lines list moving the
1999 2006 # counter ourselves.
2000 2007 indent_re = re.compile('\s+\S')
2001 2008 xfile = open(fname)
2002 2009 filelines = xfile.readlines()
2003 2010 xfile.close()
2004 2011 nlines = len(filelines)
2005 2012 lnum = 0
2006 2013 while lnum < nlines:
2007 2014 line = filelines[lnum]
2008 2015 lnum += 1
2009 2016 # don't re-insert logger status info into cache
2010 2017 if line.startswith('#log#'):
2011 2018 continue
2012 2019 else:
2013 2020 # build a block of code (maybe a single line) for execution
2014 2021 block = line
2015 2022 try:
2016 2023 next = filelines[lnum] # lnum has already incremented
2017 2024 except:
2018 2025 next = None
2019 2026 while next and indent_re.match(next):
2020 2027 block += next
2021 2028 lnum += 1
2022 2029 try:
2023 2030 next = filelines[lnum]
2024 2031 except:
2025 2032 next = None
2026 2033 # now execute the block of one or more lines
2027 2034 try:
2028 2035 exec block in globs,locs
2029 2036 except SystemExit:
2030 2037 pass
2031 2038 except:
2032 2039 badblocks.append(block.rstrip())
2033 2040 if kw['quiet']: # restore stdout
2034 2041 sys.stdout.close()
2035 2042 sys.stdout = stdout_save
2036 2043 print 'Finished replaying log file <%s>' % fname
2037 2044 if badblocks:
2038 2045 print >> sys.stderr, ('\nThe following lines/blocks in file '
2039 2046 '<%s> reported errors:' % fname)
2040 2047
2041 2048 for badline in badblocks:
2042 2049 print >> sys.stderr, badline
2043 2050 else: # regular file execution
2044 2051 try:
2045 2052 execfile(fname,*where)
2046 2053 except SyntaxError:
2047 2054 etype,evalue = sys.exc_info()[:2]
2048 2055 self.SyntaxTB(etype,evalue,[])
2049 2056 warn('Failure executing file: <%s>' % fname)
2050 2057 except SystemExit,status:
2051 2058 if not kw['exit_ignore']:
2052 2059 self.InteractiveTB()
2053 2060 warn('Failure executing file: <%s>' % fname)
2054 2061 except:
2055 2062 self.InteractiveTB()
2056 2063 warn('Failure executing file: <%s>' % fname)
2057 2064
2058 2065 #************************* end of file <iplib.py> *****************************
@@ -1,4721 +1,4726 b''
1 1 2005-12-31 Fernando Perez <Fernando.Perez@colorado.edu>
2 2
3 * IPython/iplib.py (InteractiveShell.__init__): add .meta
4 namespace for users and extension writers to hold data in. This
5 follows the discussion in
6 http://projects.scipy.org/ipython/ipython/wiki/RefactoringIPython.
7
3 8 * IPython/completer.py (IPCompleter.complete): small patch to help
4 9 tab-completion under Emacs, after a suggestion by John Barnard
5 10 <barnarj-AT-ccf.org>.
6 11
7 12 * IPython/Magic.py (Magic.extract_input_slices): added support for
8 13 the slice notation in magics to use N-M to represent numbers N...M
9 14 (closed endpoints). This is used by %macro and %save.
10 15
11 16 * IPython/completer.py (Completer.attr_matches): for modules which
12 17 define __all__, complete only on those. After a patch by Jeffrey
13 18 Collins <jcollins_boulder-AT-earthlink.net>. Also, clean up and
14 19 speed up this routine.
15 20
16 21 * IPython/Logger.py (Logger.log): fix a history handling bug. I
17 22 don't know if this is the end of it, but the behavior now is
18 23 certainly much more correct. Note that coupled with macros,
19 24 slightly surprising (at first) behavior may occur: a macro will in
20 25 general expand to multiple lines of input, so upon exiting, the
21 26 in/out counters will both be bumped by the corresponding amount
22 27 (as if the macro's contents had been typed interactively). Typing
23 28 %hist will reveal the intermediate (silently processed) lines.
24 29
25 30 * IPython/Magic.py (magic_run): fix a subtle bug which could cause
26 31 pickle to fail (%run was overwriting __main__ and not restoring
27 32 it, but pickle relies on __main__ to operate).
28 33
29 34 * IPython/iplib.py (InteractiveShell): fix pdb calling: I'm now
30 35 using properties, but forgot to make the main InteractiveShell
31 36 class a new-style class. Properties fail silently, and
32 37 misteriously, with old-style class (getters work, but
33 38 setters don't do anything).
34 39
35 40 2005-12-30 Fernando Perez <Fernando.Perez@colorado.edu>
36 41
37 42 * IPython/Magic.py (magic_history): fix history reporting bug (I
38 43 know some nasties are still there, I just can't seem to find a
39 44 reproducible test case to track them down; the input history is
40 45 falling out of sync...)
41 46
42 47 * IPython/iplib.py (handle_shell_escape): fix bug where both
43 48 aliases and system accesses where broken for indented code (such
44 49 as loops).
45 50
46 51 * IPython/genutils.py (shell): fix small but critical bug for
47 52 win32 system access.
48 53
49 54 2005-12-29 Fernando Perez <Fernando.Perez@colorado.edu>
50 55
51 56 * IPython/iplib.py (showtraceback): remove use of the
52 57 sys.last_{type/value/traceback} structures, which are non
53 58 thread-safe.
54 59 (_prefilter): change control flow to ensure that we NEVER
55 60 introspect objects when autocall is off. This will guarantee that
56 61 having an input line of the form 'x.y', where access to attribute
57 62 'y' has side effects, doesn't trigger the side effect TWICE. It
58 63 is important to note that, with autocall on, these side effects
59 64 can still happen.
60 65 (ipsystem): new builtin, to complete the ip{magic/alias/system}
61 66 trio. IPython offers these three kinds of special calls which are
62 67 not python code, and it's a good thing to have their call method
63 68 be accessible as pure python functions (not just special syntax at
64 69 the command line). It gives us a better internal implementation
65 70 structure, as well as exposing these for user scripting more
66 71 cleanly.
67 72
68 73 * IPython/macro.py (Macro.__init__): moved macros to a standalone
69 74 file. Now that they'll be more likely to be used with the
70 75 persistance system (%store), I want to make sure their module path
71 76 doesn't change in the future, so that we don't break things for
72 77 users' persisted data.
73 78
74 79 * IPython/iplib.py (autoindent_update): move indentation
75 80 management into the _text_ processing loop, not the keyboard
76 81 interactive one. This is necessary to correctly process non-typed
77 82 multiline input (such as macros).
78 83
79 84 * IPython/Magic.py (Magic.format_latex): patch by Stefan van der
80 85 Walt <stefan-AT-sun.ac.za> to fix latex formatting of docstrings,
81 86 which was producing problems in the resulting manual.
82 87 (magic_whos): improve reporting of instances (show their class,
83 88 instead of simply printing 'instance' which isn't terribly
84 89 informative).
85 90
86 91 * IPython/genutils.py (shell): commit Jorgen Stenarson's patch
87 92 (minor mods) to support network shares under win32.
88 93
89 94 * IPython/winconsole.py (get_console_size): add new winconsole
90 95 module and fixes to page_dumb() to improve its behavior under
91 96 win32. Contributed by Alexander Belchenko <bialix-AT-ukr.net>.
92 97
93 98 * IPython/Magic.py (Macro): simplified Macro class to just
94 99 subclass list. We've had only 2.2 compatibility for a very long
95 100 time, yet I was still avoiding subclassing the builtin types. No
96 101 more (I'm also starting to use properties, though I won't shift to
97 102 2.3-specific features quite yet).
98 103 (magic_store): added Ville's patch for lightweight variable
99 104 persistence, after a request on the user list by Matt Wilkie
100 105 <maphew-AT-gmail.com>. The new %store magic's docstring has full
101 106 details.
102 107
103 108 * IPython/iplib.py (InteractiveShell.post_config_initialization):
104 109 changed the default logfile name from 'ipython.log' to
105 110 'ipython_log.py'. These logs are real python files, and now that
106 111 we have much better multiline support, people are more likely to
107 112 want to use them as such. Might as well name them correctly.
108 113
109 114 * IPython/Magic.py: substantial cleanup. While we can't stop
110 115 using magics as mixins, due to the existing customizations 'out
111 116 there' which rely on the mixin naming conventions, at least I
112 117 cleaned out all cross-class name usage. So once we are OK with
113 118 breaking compatibility, the two systems can be separated.
114 119
115 120 * IPython/Logger.py: major cleanup. This one is NOT a mixin
116 121 anymore, and the class is a fair bit less hideous as well. New
117 122 features were also introduced: timestamping of input, and logging
118 123 of output results. These are user-visible with the -t and -o
119 124 options to %logstart. Closes
120 125 http://www.scipy.net/roundup/ipython/issue11 and a request by
121 126 William Stein (SAGE developer - http://modular.ucsd.edu/sage).
122 127
123 128 2005-12-28 Fernando Perez <Fernando.Perez@colorado.edu>
124 129
125 130 * IPython/iplib.py (handle_shell_escape): add Ville's patch to
126 131 better hadnle backslashes in paths. See the thread 'More Windows
127 132 questions part 2 - \/ characters revisited' on the iypthon user
128 133 list:
129 134 http://scipy.net/pipermail/ipython-user/2005-June/000907.html
130 135
131 136 (InteractiveShell.__init__): fix tab-completion bug in threaded shells.
132 137
133 138 (InteractiveShell.__init__): change threaded shells to not use the
134 139 ipython crash handler. This was causing more problems than not,
135 140 as exceptions in the main thread (GUI code, typically) would
136 141 always show up as a 'crash', when they really weren't.
137 142
138 143 The colors and exception mode commands (%colors/%xmode) have been
139 144 synchronized to also take this into account, so users can get
140 145 verbose exceptions for their threaded code as well. I also added
141 146 support for activating pdb inside this exception handler as well,
142 147 so now GUI authors can use IPython's enhanced pdb at runtime.
143 148
144 149 * IPython/ipmaker.py (make_IPython): make the autoedit_syntax flag
145 150 true by default, and add it to the shipped ipythonrc file. Since
146 151 this asks the user before proceeding, I think it's OK to make it
147 152 true by default.
148 153
149 154 * IPython/Magic.py (magic_exit): make new exit/quit magics instead
150 155 of the previous special-casing of input in the eval loop. I think
151 156 this is cleaner, as they really are commands and shouldn't have
152 157 a special role in the middle of the core code.
153 158
154 159 2005-12-27 Fernando Perez <Fernando.Perez@colorado.edu>
155 160
156 161 * IPython/iplib.py (edit_syntax_error): added support for
157 162 automatically reopening the editor if the file had a syntax error
158 163 in it. Thanks to scottt who provided the patch at:
159 164 http://www.scipy.net/roundup/ipython/issue36 (slightly modified
160 165 version committed).
161 166
162 167 * IPython/iplib.py (handle_normal): add suport for multi-line
163 168 input with emtpy lines. This fixes
164 169 http://www.scipy.net/roundup/ipython/issue43 and a similar
165 170 discussion on the user list.
166 171
167 172 WARNING: a behavior change is necessarily introduced to support
168 173 blank lines: now a single blank line with whitespace does NOT
169 174 break the input loop, which means that when autoindent is on, by
170 175 default hitting return on the next (indented) line does NOT exit.
171 176
172 177 Instead, to exit a multiline input you can either have:
173 178
174 179 - TWO whitespace lines (just hit return again), or
175 180 - a single whitespace line of a different length than provided
176 181 by the autoindent (add or remove a space).
177 182
178 183 * IPython/completer.py (MagicCompleter.__init__): new 'completer'
179 184 module to better organize all readline-related functionality.
180 185 I've deleted FlexCompleter and put all completion clases here.
181 186
182 187 * IPython/iplib.py (raw_input): improve indentation management.
183 188 It is now possible to paste indented code with autoindent on, and
184 189 the code is interpreted correctly (though it still looks bad on
185 190 screen, due to the line-oriented nature of ipython).
186 191 (MagicCompleter.complete): change behavior so that a TAB key on an
187 192 otherwise empty line actually inserts a tab, instead of completing
188 193 on the entire global namespace. This makes it easier to use the
189 194 TAB key for indentation. After a request by Hans Meine
190 195 <hans_meine-AT-gmx.net>
191 196 (_prefilter): add support so that typing plain 'exit' or 'quit'
192 197 does a sensible thing. Originally I tried to deviate as little as
193 198 possible from the default python behavior, but even that one may
194 199 change in this direction (thread on python-dev to that effect).
195 200 Regardless, ipython should do the right thing even if CPython's
196 201 '>>>' prompt doesn't.
197 202 (InteractiveShell): removed subclassing code.InteractiveConsole
198 203 class. By now we'd overridden just about all of its methods: I've
199 204 copied the remaining two over, and now ipython is a standalone
200 205 class. This will provide a clearer picture for the chainsaw
201 206 branch refactoring.
202 207
203 208 2005-12-26 Fernando Perez <Fernando.Perez@colorado.edu>
204 209
205 210 * IPython/ultraTB.py (VerboseTB.text): harden reporting against
206 211 failures for objects which break when dir() is called on them.
207 212
208 213 * IPython/FlexCompleter.py (Completer.__init__): Added support for
209 214 distinct local and global namespaces in the completer API. This
210 215 change allows us top properly handle completion with distinct
211 216 scopes, including in embedded instances (this had never really
212 217 worked correctly).
213 218
214 219 Note: this introduces a change in the constructor for
215 220 MagicCompleter, as a new global_namespace parameter is now the
216 221 second argument (the others were bumped one position).
217 222
218 223 2005-12-25 Fernando Perez <Fernando.Perez@colorado.edu>
219 224
220 225 * IPython/iplib.py (embed_mainloop): fix tab-completion in
221 226 embedded instances (which can be done now thanks to Vivian's
222 227 frame-handling fixes for pdb).
223 228 (InteractiveShell.__init__): Fix namespace handling problem in
224 229 embedded instances. We were overwriting __main__ unconditionally,
225 230 and this should only be done for 'full' (non-embedded) IPython;
226 231 embedded instances must respect the caller's __main__. Thanks to
227 232 a bug report by Yaroslav Bulatov <yaroslavvb-AT-gmail.com>
228 233
229 234 2005-12-24 Fernando Perez <Fernando.Perez@colorado.edu>
230 235
231 236 * setup.py: added download_url to setup(). This registers the
232 237 download address at PyPI, which is not only useful to humans
233 238 browsing the site, but is also picked up by setuptools (the Eggs
234 239 machinery). Thanks to Ville and R. Kern for the info/discussion
235 240 on this.
236 241
237 242 2005-12-23 Fernando Perez <Fernando.Perez@colorado.edu>
238 243
239 244 * IPython/Debugger.py (Pdb.__init__): Major pdb mode enhancements.
240 245 This brings a lot of nice functionality to the pdb mode, which now
241 246 has tab-completion, syntax highlighting, and better stack handling
242 247 than before. Many thanks to Vivian De Smedt
243 248 <vivian-AT-vdesmedt.com> for the original patches.
244 249
245 250 2005-12-08 Fernando Perez <Fernando.Perez@colorado.edu>
246 251
247 252 * IPython/Shell.py (IPShellGTK.mainloop): fix mainloop() calling
248 253 sequence to consistently accept the banner argument. The
249 254 inconsistency was tripping SAGE, thanks to Gary Zablackis
250 255 <gzabl-AT-yahoo.com> for the report.
251 256
252 257 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
253 258
254 259 * IPython/iplib.py (InteractiveShell.post_config_initialization):
255 260 Fix bug where a naked 'alias' call in the ipythonrc file would
256 261 cause a crash. Bug reported by Jorgen Stenarson.
257 262
258 263 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
259 264
260 265 * IPython/ipmaker.py (make_IPython): cleanups which should improve
261 266 startup time.
262 267
263 268 * IPython/iplib.py (runcode): my globals 'fix' for embedded
264 269 instances had introduced a bug with globals in normal code. Now
265 270 it's working in all cases.
266 271
267 272 * IPython/Magic.py (magic_psearch): Finish wildcard cleanup and
268 273 API changes. A new ipytonrc option, 'wildcards_case_sensitive'
269 274 has been introduced to set the default case sensitivity of the
270 275 searches. Users can still select either mode at runtime on a
271 276 per-search basis.
272 277
273 278 2005-11-13 Fernando Perez <Fernando.Perez@colorado.edu>
274 279
275 280 * IPython/wildcard.py (NameSpace.__init__): fix resolution of
276 281 attributes in wildcard searches for subclasses. Modified version
277 282 of a patch by Jorgen.
278 283
279 284 2005-11-12 Fernando Perez <Fernando.Perez@colorado.edu>
280 285
281 286 * IPython/iplib.py (embed_mainloop): Fix handling of globals for
282 287 embedded instances. I added a user_global_ns attribute to the
283 288 InteractiveShell class to handle this.
284 289
285 290 2005-10-31 Fernando Perez <Fernando.Perez@colorado.edu>
286 291
287 292 * IPython/Shell.py (IPShellGTK.mainloop): Change timeout_add to
288 293 idle_add, which fixes horrible keyboard lag problems under gtk 2.6
289 294 (reported under win32, but may happen also in other platforms).
290 295 Bug report and fix courtesy of Sean Moore <smm-AT-logic.bm>
291 296
292 297 2005-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
293 298
294 299 * IPython/Magic.py (magic_psearch): new support for wildcard
295 300 patterns. Now, typing ?a*b will list all names which begin with a
296 301 and end in b, for example. The %psearch magic has full
297 302 docstrings. Many thanks to JΓΆrgen Stenarson
298 303 <jorgen.stenarson-AT-bostream.nu>, author of the patches
299 304 implementing this functionality.
300 305
301 306 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
302 307
303 308 * Manual: fixed long-standing annoyance of double-dashes (as in
304 309 --prefix=~, for example) being stripped in the HTML version. This
305 310 is a latex2html bug, but a workaround was provided. Many thanks
306 311 to George K. Thiruvathukal <gthiruv-AT-luc.edu> for the detailed
307 312 help, and Michael Tobis <mtobis-AT-gmail.com> for getting the ball
308 313 rolling. This seemingly small issue had tripped a number of users
309 314 when first installing, so I'm glad to see it gone.
310 315
311 316 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
312 317
313 318 * IPython/Extensions/numeric_formats.py: fix missing import,
314 319 reported by Stephen Walton.
315 320
316 321 2005-09-24 Fernando Perez <Fernando.Perez@colorado.edu>
317 322
318 323 * IPython/demo.py: finish demo module, fully documented now.
319 324
320 325 * IPython/genutils.py (file_read): simple little utility to read a
321 326 file and ensure it's closed afterwards.
322 327
323 328 2005-09-23 Fernando Perez <Fernando.Perez@colorado.edu>
324 329
325 330 * IPython/demo.py (Demo.__init__): added support for individually
326 331 tagging blocks for automatic execution.
327 332
328 333 * IPython/Magic.py (magic_pycat): new %pycat magic for showing
329 334 syntax-highlighted python sources, requested by John.
330 335
331 336 2005-09-22 Fernando Perez <Fernando.Perez@colorado.edu>
332 337
333 338 * IPython/demo.py (Demo.again): fix bug where again() blocks after
334 339 finishing.
335 340
336 341 * IPython/genutils.py (shlex_split): moved from Magic to here,
337 342 where all 2.2 compatibility stuff lives. I needed it for demo.py.
338 343
339 344 * IPython/demo.py (Demo.__init__): added support for silent
340 345 blocks, improved marks as regexps, docstrings written.
341 346 (Demo.__init__): better docstring, added support for sys.argv.
342 347
343 348 * IPython/genutils.py (marquee): little utility used by the demo
344 349 code, handy in general.
345 350
346 351 * IPython/demo.py (Demo.__init__): new class for interactive
347 352 demos. Not documented yet, I just wrote it in a hurry for
348 353 scipy'05. Will docstring later.
349 354
350 355 2005-09-20 Fernando Perez <Fernando.Perez@colorado.edu>
351 356
352 357 * IPython/Shell.py (sigint_handler): Drastic simplification which
353 358 also seems to make Ctrl-C work correctly across threads! This is
354 359 so simple, that I can't beleive I'd missed it before. Needs more
355 360 testing, though.
356 361 (KBINT): Never mind, revert changes. I'm sure I'd tried something
357 362 like this before...
358 363
359 364 * IPython/genutils.py (get_home_dir): add protection against
360 365 non-dirs in win32 registry.
361 366
362 367 * IPython/iplib.py (InteractiveShell.alias_table_validate): fix
363 368 bug where dict was mutated while iterating (pysh crash).
364 369
365 370 2005-09-06 Fernando Perez <Fernando.Perez@colorado.edu>
366 371
367 372 * IPython/iplib.py (handle_auto): Fix inconsistency arising from
368 373 spurious newlines added by this routine. After a report by
369 374 F. Mantegazza.
370 375
371 376 2005-09-05 Fernando Perez <Fernando.Perez@colorado.edu>
372 377
373 378 * IPython/Shell.py (hijack_gtk): remove pygtk.require("2.0")
374 379 calls. These were a leftover from the GTK 1.x days, and can cause
375 380 problems in certain cases (after a report by John Hunter).
376 381
377 382 * IPython/iplib.py (InteractiveShell.__init__): Trap exception if
378 383 os.getcwd() fails at init time. Thanks to patch from David Remahl
379 384 <chmod007-AT-mac.com>.
380 385 (InteractiveShell.__init__): prevent certain special magics from
381 386 being shadowed by aliases. Closes
382 387 http://www.scipy.net/roundup/ipython/issue41.
383 388
384 389 2005-08-31 Fernando Perez <Fernando.Perez@colorado.edu>
385 390
386 391 * IPython/iplib.py (InteractiveShell.complete): Added new
387 392 top-level completion method to expose the completion mechanism
388 393 beyond readline-based environments.
389 394
390 395 2005-08-19 Fernando Perez <Fernando.Perez@colorado.edu>
391 396
392 397 * tools/ipsvnc (svnversion): fix svnversion capture.
393 398
394 399 * IPython/iplib.py (InteractiveShell.__init__): Add has_readline
395 400 attribute to self, which was missing. Before, it was set by a
396 401 routine which in certain cases wasn't being called, so the
397 402 instance could end up missing the attribute. This caused a crash.
398 403 Closes http://www.scipy.net/roundup/ipython/issue40.
399 404
400 405 2005-08-16 Fernando Perez <fperez@colorado.edu>
401 406
402 407 * IPython/ultraTB.py (VerboseTB.text): don't crash if object
403 408 contains non-string attribute. Closes
404 409 http://www.scipy.net/roundup/ipython/issue38.
405 410
406 411 2005-08-14 Fernando Perez <fperez@colorado.edu>
407 412
408 413 * tools/ipsvnc: Minor improvements, to add changeset info.
409 414
410 415 2005-08-12 Fernando Perez <fperez@colorado.edu>
411 416
412 417 * IPython/iplib.py (runsource): remove self.code_to_run_src
413 418 attribute. I realized this is nothing more than
414 419 '\n'.join(self.buffer), and having the same data in two different
415 420 places is just asking for synchronization bugs. This may impact
416 421 people who have custom exception handlers, so I need to warn
417 422 ipython-dev about it (F. Mantegazza may use them).
418 423
419 424 2005-07-29 Fernando Perez <Fernando.Perez@colorado.edu>
420 425
421 426 * IPython/genutils.py: fix 2.2 compatibility (generators)
422 427
423 428 2005-07-18 Fernando Perez <fperez@colorado.edu>
424 429
425 430 * IPython/genutils.py (get_home_dir): fix to help users with
426 431 invalid $HOME under win32.
427 432
428 433 2005-07-17 Fernando Perez <fperez@colorado.edu>
429 434
430 435 * IPython/Prompts.py (str_safe): Make unicode-safe. Also remove
431 436 some old hacks and clean up a bit other routines; code should be
432 437 simpler and a bit faster.
433 438
434 439 * IPython/iplib.py (interact): removed some last-resort attempts
435 440 to survive broken stdout/stderr. That code was only making it
436 441 harder to abstract out the i/o (necessary for gui integration),
437 442 and the crashes it could prevent were extremely rare in practice
438 443 (besides being fully user-induced in a pretty violent manner).
439 444
440 445 * IPython/genutils.py (IOStream.__init__): Simplify the i/o stuff.
441 446 Nothing major yet, but the code is simpler to read; this should
442 447 make it easier to do more serious modifications in the future.
443 448
444 449 * IPython/Extensions/InterpreterExec.py: Fix auto-quoting in pysh,
445 450 which broke in .15 (thanks to a report by Ville).
446 451
447 452 * IPython/Itpl.py (Itpl.__init__): add unicode support (it may not
448 453 be quite correct, I know next to nothing about unicode). This
449 454 will allow unicode strings to be used in prompts, amongst other
450 455 cases. It also will prevent ipython from crashing when unicode
451 456 shows up unexpectedly in many places. If ascii encoding fails, we
452 457 assume utf_8. Currently the encoding is not a user-visible
453 458 setting, though it could be made so if there is demand for it.
454 459
455 460 * IPython/ipmaker.py (make_IPython): remove old 2.1-specific hack.
456 461
457 462 * IPython/Struct.py (Struct.merge): switch keys() to iterator.
458 463
459 464 * IPython/background_jobs.py: moved 2.2 compatibility to genutils.
460 465
461 466 * IPython/genutils.py: Add 2.2 compatibility here, so all other
462 467 code can work transparently for 2.2/2.3.
463 468
464 469 2005-07-16 Fernando Perez <fperez@colorado.edu>
465 470
466 471 * IPython/ultraTB.py (ExceptionColors): Make a global variable
467 472 out of the color scheme table used for coloring exception
468 473 tracebacks. This allows user code to add new schemes at runtime.
469 474 This is a minimally modified version of the patch at
470 475 http://www.scipy.net/roundup/ipython/issue35, many thanks to pabw
471 476 for the contribution.
472 477
473 478 * IPython/FlexCompleter.py (Completer.attr_matches): Add a
474 479 slightly modified version of the patch in
475 480 http://www.scipy.net/roundup/ipython/issue34, which also allows me
476 481 to remove the previous try/except solution (which was costlier).
477 482 Thanks to Gaetan Lehmann <gaetan.lehmann-AT-jouy.inra.fr> for the fix.
478 483
479 484 2005-06-08 Fernando Perez <fperez@colorado.edu>
480 485
481 486 * IPython/iplib.py (write/write_err): Add methods to abstract all
482 487 I/O a bit more.
483 488
484 489 * IPython/Shell.py (IPShellGTK.mainloop): Fix GTK deprecation
485 490 warning, reported by Aric Hagberg, fix by JD Hunter.
486 491
487 492 2005-06-02 *** Released version 0.6.15
488 493
489 494 2005-06-01 Fernando Perez <fperez@colorado.edu>
490 495
491 496 * IPython/iplib.py (MagicCompleter.file_matches): Fix
492 497 tab-completion of filenames within open-quoted strings. Note that
493 498 this requires that in ~/.ipython/ipythonrc, users change the
494 499 readline delimiters configuration to read:
495 500
496 501 readline_remove_delims -/~
497 502
498 503
499 504 2005-05-31 *** Released version 0.6.14
500 505
501 506 2005-05-29 Fernando Perez <fperez@colorado.edu>
502 507
503 508 * IPython/ultraTB.py (VerboseTB.text): Fix crash for tracebacks
504 509 with files not on the filesystem. Reported by Eliyahu Sandler
505 510 <eli@gondolin.net>
506 511
507 512 2005-05-22 Fernando Perez <fperez@colorado.edu>
508 513
509 514 * IPython/iplib.py: Fix a few crashes in the --upgrade option.
510 515 After an initial report by LUK ShunTim <shuntim.luk@polyu.edu.hk>.
511 516
512 517 2005-05-19 Fernando Perez <fperez@colorado.edu>
513 518
514 519 * IPython/iplib.py (safe_execfile): close a file which could be
515 520 left open (causing problems in win32, which locks open files).
516 521 Thanks to a bug report by D Brown <dbrown2@yahoo.com>.
517 522
518 523 2005-05-18 Fernando Perez <fperez@colorado.edu>
519 524
520 525 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): pass all
521 526 keyword arguments correctly to safe_execfile().
522 527
523 528 2005-05-13 Fernando Perez <fperez@colorado.edu>
524 529
525 530 * ipython.1: Added info about Qt to manpage, and threads warning
526 531 to usage page (invoked with --help).
527 532
528 533 * IPython/iplib.py (MagicCompleter.python_func_kw_matches): Added
529 534 new matcher (it goes at the end of the priority list) to do
530 535 tab-completion on named function arguments. Submitted by George
531 536 Sakkis <gsakkis-AT-eden.rutgers.edu>. See the thread at
532 537 http://www.scipy.net/pipermail/ipython-dev/2005-April/000436.html
533 538 for more details.
534 539
535 540 * IPython/Magic.py (magic_run): Added new -e flag to ignore
536 541 SystemExit exceptions in the script being run. Thanks to a report
537 542 by danny shevitz <danny_shevitz-AT-yahoo.com>, about this
538 543 producing very annoying behavior when running unit tests.
539 544
540 545 2005-05-12 Fernando Perez <fperez@colorado.edu>
541 546
542 547 * IPython/iplib.py (handle_auto): fixed auto-quoting and parens,
543 548 which I'd broken (again) due to a changed regexp. In the process,
544 549 added ';' as an escape to auto-quote the whole line without
545 550 splitting its arguments. Thanks to a report by Jerry McRae
546 551 <qrs0xyc02-AT-sneakemail.com>.
547 552
548 553 * IPython/ultraTB.py (VerboseTB.text): protect against rare but
549 554 possible crashes caused by a TokenError. Reported by Ed Schofield
550 555 <schofield-AT-ftw.at>.
551 556
552 557 2005-05-06 Fernando Perez <fperez@colorado.edu>
553 558
554 559 * IPython/Shell.py (hijack_wx): Fix to work with WX v.2.6.
555 560
556 561 2005-04-29 Fernando Perez <fperez@colorado.edu>
557 562
558 563 * IPython/Shell.py (IPShellQt): Thanks to Denis Rivière
559 564 <nudz-AT-free.fr>, Yann Cointepas <yann-AT-sapetnioc.org> and Benjamin
560 565 Thyreau <Benji2-AT-decideur.info>, we now have a -qthread option
561 566 which provides support for Qt interactive usage (similar to the
562 567 existing one for WX and GTK). This had been often requested.
563 568
564 569 2005-04-14 *** Released version 0.6.13
565 570
566 571 2005-04-08 Fernando Perez <fperez@colorado.edu>
567 572
568 573 * IPython/Magic.py (Magic._ofind): remove docstring evaluation
569 574 from _ofind, which gets called on almost every input line. Now,
570 575 we only try to get docstrings if they are actually going to be
571 576 used (the overhead of fetching unnecessary docstrings can be
572 577 noticeable for certain objects, such as Pyro proxies).
573 578
574 579 * IPython/iplib.py (MagicCompleter.python_matches): Change the API
575 580 for completers. For some reason I had been passing them the state
576 581 variable, which completers never actually need, and was in
577 582 conflict with the rlcompleter API. Custom completers ONLY need to
578 583 take the text parameter.
579 584
580 585 * IPython/Extensions/InterpreterExec.py: Fix regexp so that magics
581 586 work correctly in pysh. I've also moved all the logic which used
582 587 to be in pysh.py here, which will prevent problems with future
583 588 upgrades. However, this time I must warn users to update their
584 589 pysh profile to include the line
585 590
586 591 import_all IPython.Extensions.InterpreterExec
587 592
588 593 because otherwise things won't work for them. They MUST also
589 594 delete pysh.py and the line
590 595
591 596 execfile pysh.py
592 597
593 598 from their ipythonrc-pysh.
594 599
595 600 * IPython/FlexCompleter.py (Completer.attr_matches): Make more
596 601 robust in the face of objects whose dir() returns non-strings
597 602 (which it shouldn't, but some broken libs like ITK do). Thanks to
598 603 a patch by John Hunter (implemented differently, though). Also
599 604 minor improvements by using .extend instead of + on lists.
600 605
601 606 * pysh.py:
602 607
603 608 2005-04-06 Fernando Perez <fperez@colorado.edu>
604 609
605 610 * IPython/ipmaker.py (make_IPython): Make multi_line_specials on
606 611 by default, so that all users benefit from it. Those who don't
607 612 want it can still turn it off.
608 613
609 614 * IPython/UserConfig/ipythonrc: Add multi_line_specials to the
610 615 config file, I'd forgotten about this, so users were getting it
611 616 off by default.
612 617
613 618 * IPython/iplib.py (ipmagic): big overhaul of the magic system for
614 619 consistency. Now magics can be called in multiline statements,
615 620 and python variables can be expanded in magic calls via $var.
616 621 This makes the magic system behave just like aliases or !system
617 622 calls.
618 623
619 624 2005-03-28 Fernando Perez <fperez@colorado.edu>
620 625
621 626 * IPython/iplib.py (handle_auto): cleanup to use %s instead of
622 627 expensive string additions for building command. Add support for
623 628 trailing ';' when autocall is used.
624 629
625 630 2005-03-26 Fernando Perez <fperez@colorado.edu>
626 631
627 632 * ipython.el: Fix http://www.scipy.net/roundup/ipython/issue31.
628 633 Bugfix by A. Schmolck, the ipython.el maintainer. Also make
629 634 ipython.el robust against prompts with any number of spaces
630 635 (including 0) after the ':' character.
631 636
632 637 * IPython/Prompts.py (Prompt2.set_p_str): Fix spurious space in
633 638 continuation prompt, which misled users to think the line was
634 639 already indented. Closes debian Bug#300847, reported to me by
635 640 Norbert Tretkowski <tretkowski-AT-inittab.de>.
636 641
637 642 2005-03-23 Fernando Perez <fperez@colorado.edu>
638 643
639 644 * IPython/Prompts.py (Prompt1.__str__): Make sure that prompts are
640 645 properly aligned if they have embedded newlines.
641 646
642 647 * IPython/iplib.py (runlines): Add a public method to expose
643 648 IPython's code execution machinery, so that users can run strings
644 649 as if they had been typed at the prompt interactively.
645 650 (InteractiveShell.__init__): Added getoutput() to the __IPYTHON__
646 651 methods which can call the system shell, but with python variable
647 652 expansion. The three such methods are: __IPYTHON__.system,
648 653 .getoutput and .getoutputerror. These need to be documented in a
649 654 'public API' section (to be written) of the manual.
650 655
651 656 2005-03-20 Fernando Perez <fperez@colorado.edu>
652 657
653 658 * IPython/iplib.py (InteractiveShell.set_custom_exc): new system
654 659 for custom exception handling. This is quite powerful, and it
655 660 allows for user-installable exception handlers which can trap
656 661 custom exceptions at runtime and treat them separately from
657 662 IPython's default mechanisms. At the request of FrΓ©dΓ©ric
658 663 Mantegazza <mantegazza-AT-ill.fr>.
659 664 (InteractiveShell.set_custom_completer): public API function to
660 665 add new completers at runtime.
661 666
662 667 2005-03-19 Fernando Perez <fperez@colorado.edu>
663 668
664 669 * IPython/OInspect.py (getdoc): Add a call to obj.getdoc(), to
665 670 allow objects which provide their docstrings via non-standard
666 671 mechanisms (like Pyro proxies) to still be inspected by ipython's
667 672 ? system.
668 673
669 674 * IPython/iplib.py (InteractiveShell.__init__): back off the _o/_e
670 675 automatic capture system. I tried quite hard to make it work
671 676 reliably, and simply failed. I tried many combinations with the
672 677 subprocess module, but eventually nothing worked in all needed
673 678 cases (not blocking stdin for the child, duplicating stdout
674 679 without blocking, etc). The new %sc/%sx still do capture to these
675 680 magical list/string objects which make shell use much more
676 681 conveninent, so not all is lost.
677 682
678 683 XXX - FIX MANUAL for the change above!
679 684
680 685 (runsource): I copied code.py's runsource() into ipython to modify
681 686 it a bit. Now the code object and source to be executed are
682 687 stored in ipython. This makes this info accessible to third-party
683 688 tools, like custom exception handlers. After a request by FrΓ©dΓ©ric
684 689 Mantegazza <mantegazza-AT-ill.fr>.
685 690
686 691 * IPython/UserConfig/ipythonrc: Add up/down arrow keys to
687 692 history-search via readline (like C-p/C-n). I'd wanted this for a
688 693 long time, but only recently found out how to do it. For users
689 694 who already have their ipythonrc files made and want this, just
690 695 add:
691 696
692 697 readline_parse_and_bind "\e[A": history-search-backward
693 698 readline_parse_and_bind "\e[B": history-search-forward
694 699
695 700 2005-03-18 Fernando Perez <fperez@colorado.edu>
696 701
697 702 * IPython/Magic.py (magic_sc): %sc and %sx now use the fancy
698 703 LSString and SList classes which allow transparent conversions
699 704 between list mode and whitespace-separated string.
700 705 (magic_r): Fix recursion problem in %r.
701 706
702 707 * IPython/genutils.py (LSString): New class to be used for
703 708 automatic storage of the results of all alias/system calls in _o
704 709 and _e (stdout/err). These provide a .l/.list attribute which
705 710 does automatic splitting on newlines. This means that for most
706 711 uses, you'll never need to do capturing of output with %sc/%sx
707 712 anymore, since ipython keeps this always done for you. Note that
708 713 only the LAST results are stored, the _o/e variables are
709 714 overwritten on each call. If you need to save their contents
710 715 further, simply bind them to any other name.
711 716
712 717 2005-03-17 Fernando Perez <fperez@colorado.edu>
713 718
714 719 * IPython/Prompts.py (BasePrompt.cwd_filt): a few more fixes for
715 720 prompt namespace handling.
716 721
717 722 2005-03-16 Fernando Perez <fperez@colorado.edu>
718 723
719 724 * IPython/Prompts.py (CachedOutput.__init__): Fix default and
720 725 classic prompts to be '>>> ' (final space was missing, and it
721 726 trips the emacs python mode).
722 727 (BasePrompt.__str__): Added safe support for dynamic prompt
723 728 strings. Now you can set your prompt string to be '$x', and the
724 729 value of x will be printed from your interactive namespace. The
725 730 interpolation syntax includes the full Itpl support, so
726 731 ${foo()+x+bar()} is a valid prompt string now, and the function
727 732 calls will be made at runtime.
728 733
729 734 2005-03-15 Fernando Perez <fperez@colorado.edu>
730 735
731 736 * IPython/Magic.py (magic_history): renamed %hist to %history, to
732 737 avoid name clashes in pylab. %hist still works, it just forwards
733 738 the call to %history.
734 739
735 740 2005-03-02 *** Released version 0.6.12
736 741
737 742 2005-03-02 Fernando Perez <fperez@colorado.edu>
738 743
739 744 * IPython/iplib.py (handle_magic): log magic calls properly as
740 745 ipmagic() function calls.
741 746
742 747 * IPython/Magic.py (magic_time): Improved %time to support
743 748 statements and provide wall-clock as well as CPU time.
744 749
745 750 2005-02-27 Fernando Perez <fperez@colorado.edu>
746 751
747 752 * IPython/hooks.py: New hooks module, to expose user-modifiable
748 753 IPython functionality in a clean manner. For now only the editor
749 754 hook is actually written, and other thigns which I intend to turn
750 755 into proper hooks aren't yet there. The display and prefilter
751 756 stuff, for example, should be hooks. But at least now the
752 757 framework is in place, and the rest can be moved here with more
753 758 time later. IPython had had a .hooks variable for a long time for
754 759 this purpose, but I'd never actually used it for anything.
755 760
756 761 2005-02-26 Fernando Perez <fperez@colorado.edu>
757 762
758 763 * IPython/ipmaker.py (make_IPython): make the default ipython
759 764 directory be called _ipython under win32, to follow more the
760 765 naming peculiarities of that platform (where buggy software like
761 766 Visual Sourcesafe breaks with .named directories). Reported by
762 767 Ville Vainio.
763 768
764 769 2005-02-23 Fernando Perez <fperez@colorado.edu>
765 770
766 771 * IPython/iplib.py (InteractiveShell.__init__): removed a few
767 772 auto_aliases for win32 which were causing problems. Users can
768 773 define the ones they personally like.
769 774
770 775 2005-02-21 Fernando Perez <fperez@colorado.edu>
771 776
772 777 * IPython/Magic.py (magic_time): new magic to time execution of
773 778 expressions. After a request by Charles Moad <cmoad-AT-indiana.edu>.
774 779
775 780 2005-02-19 Fernando Perez <fperez@colorado.edu>
776 781
777 782 * IPython/ConfigLoader.py (ConfigLoader.load): Allow empty strings
778 783 into keys (for prompts, for example).
779 784
780 785 * IPython/Prompts.py (BasePrompt.set_p_str): Fix to allow empty
781 786 prompts in case users want them. This introduces a small behavior
782 787 change: ipython does not automatically add a space to all prompts
783 788 anymore. To get the old prompts with a space, users should add it
784 789 manually to their ipythonrc file, so for example prompt_in1 should
785 790 now read 'In [\#]: ' instead of 'In [\#]:'.
786 791 (BasePrompt.__init__): New option prompts_pad_left (only in rc
787 792 file) to control left-padding of secondary prompts.
788 793
789 794 * IPython/Magic.py (Magic.profile_missing_notice): Don't crash if
790 795 the profiler can't be imported. Fix for Debian, which removed
791 796 profile.py because of License issues. I applied a slightly
792 797 modified version of the original Debian patch at
793 798 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=294500.
794 799
795 800 2005-02-17 Fernando Perez <fperez@colorado.edu>
796 801
797 802 * IPython/genutils.py (native_line_ends): Fix bug which would
798 803 cause improper line-ends under win32 b/c I was not opening files
799 804 in binary mode. Bug report and fix thanks to Ville.
800 805
801 806 * IPython/iplib.py (handle_auto): Fix bug which I introduced when
802 807 trying to catch spurious foo[1] autocalls. My fix actually broke
803 808 ',/' autoquote/call with explicit escape (bad regexp).
804 809
805 810 2005-02-15 *** Released version 0.6.11
806 811
807 812 2005-02-14 Fernando Perez <fperez@colorado.edu>
808 813
809 814 * IPython/background_jobs.py: New background job management
810 815 subsystem. This is implemented via a new set of classes, and
811 816 IPython now provides a builtin 'jobs' object for background job
812 817 execution. A convenience %bg magic serves as a lightweight
813 818 frontend for starting the more common type of calls. This was
814 819 inspired by discussions with B. Granger and the BackgroundCommand
815 820 class described in the book Python Scripting for Computational
816 821 Science, by H. P. Langtangen: http://folk.uio.no/hpl/scripting
817 822 (although ultimately no code from this text was used, as IPython's
818 823 system is a separate implementation).
819 824
820 825 * IPython/iplib.py (MagicCompleter.python_matches): add new option
821 826 to control the completion of single/double underscore names
822 827 separately. As documented in the example ipytonrc file, the
823 828 readline_omit__names variable can now be set to 2, to omit even
824 829 single underscore names. Thanks to a patch by Brian Wong
825 830 <BrianWong-AT-AirgoNetworks.Com>.
826 831 (InteractiveShell.__init__): Fix bug which would cause foo[1] to
827 832 be autocalled as foo([1]) if foo were callable. A problem for
828 833 things which are both callable and implement __getitem__.
829 834 (init_readline): Fix autoindentation for win32. Thanks to a patch
830 835 by Vivian De Smedt <vivian-AT-vdesmedt.com>.
831 836
832 837 2005-02-12 Fernando Perez <fperez@colorado.edu>
833 838
834 839 * IPython/ipmaker.py (make_IPython): Disabled the stout traps
835 840 which I had written long ago to sort out user error messages which
836 841 may occur during startup. This seemed like a good idea initially,
837 842 but it has proven a disaster in retrospect. I don't want to
838 843 change much code for now, so my fix is to set the internal 'debug'
839 844 flag to true everywhere, whose only job was precisely to control
840 845 this subsystem. This closes issue 28 (as well as avoiding all
841 846 sorts of strange hangups which occur from time to time).
842 847
843 848 2005-02-07 Fernando Perez <fperez@colorado.edu>
844 849
845 850 * IPython/Magic.py (magic_edit): Fix 'ed -p' not working when the
846 851 previous call produced a syntax error.
847 852
848 853 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
849 854 classes without constructor.
850 855
851 856 2005-02-06 Fernando Perez <fperez@colorado.edu>
852 857
853 858 * IPython/iplib.py (MagicCompleter.complete): Extend the list of
854 859 completions with the results of each matcher, so we return results
855 860 to the user from all namespaces. This breaks with ipython
856 861 tradition, but I think it's a nicer behavior. Now you get all
857 862 possible completions listed, from all possible namespaces (python,
858 863 filesystem, magics...) After a request by John Hunter
859 864 <jdhunter-AT-nitace.bsd.uchicago.edu>.
860 865
861 866 2005-02-05 Fernando Perez <fperez@colorado.edu>
862 867
863 868 * IPython/Magic.py (magic_prun): Fix bug where prun would fail if
864 869 the call had quote characters in it (the quotes were stripped).
865 870
866 871 2005-01-31 Fernando Perez <fperez@colorado.edu>
867 872
868 873 * IPython/iplib.py (InteractiveShell.__init__): reduce reliance on
869 874 Itpl.itpl() to make the code more robust against psyco
870 875 optimizations.
871 876
872 877 * IPython/Itpl.py (Itpl.__str__): Use a _getframe() call instead
873 878 of causing an exception. Quicker, cleaner.
874 879
875 880 2005-01-28 Fernando Perez <fperez@colorado.edu>
876 881
877 882 * scripts/ipython_win_post_install.py (install): hardcode
878 883 sys.prefix+'python.exe' as the executable path. It turns out that
879 884 during the post-installation run, sys.executable resolves to the
880 885 name of the binary installer! I should report this as a distutils
881 886 bug, I think. I updated the .10 release with this tiny fix, to
882 887 avoid annoying the lists further.
883 888
884 889 2005-01-27 *** Released version 0.6.10
885 890
886 891 2005-01-27 Fernando Perez <fperez@colorado.edu>
887 892
888 893 * IPython/numutils.py (norm): Added 'inf' as optional name for
889 894 L-infinity norm, included references to mathworld.com for vector
890 895 norm definitions.
891 896 (amin/amax): added amin/amax for array min/max. Similar to what
892 897 pylab ships with after the recent reorganization of names.
893 898 (spike/spike_odd): removed deprecated spike/spike_odd functions.
894 899
895 900 * ipython.el: committed Alex's recent fixes and improvements.
896 901 Tested with python-mode from CVS, and it looks excellent. Since
897 902 python-mode hasn't released anything in a while, I'm temporarily
898 903 putting a copy of today's CVS (v 4.70) of python-mode in:
899 904 http://ipython.scipy.org/tmp/python-mode.el
900 905
901 906 * scripts/ipython_win_post_install.py (install): Win32 fix to use
902 907 sys.executable for the executable name, instead of assuming it's
903 908 called 'python.exe' (the post-installer would have produced broken
904 909 setups on systems with a differently named python binary).
905 910
906 911 * IPython/PyColorize.py (Parser.__call__): change explicit '\n'
907 912 references to os.linesep, to make the code more
908 913 platform-independent. This is also part of the win32 coloring
909 914 fixes.
910 915
911 916 * IPython/genutils.py (page_dumb): Remove attempts to chop long
912 917 lines, which actually cause coloring bugs because the length of
913 918 the line is very difficult to correctly compute with embedded
914 919 escapes. This was the source of all the coloring problems under
915 920 Win32. I think that _finally_, Win32 users have a properly
916 921 working ipython in all respects. This would never have happened
917 922 if not for Gary Bishop and Viktor Ransmayr's great help and work.
918 923
919 924 2005-01-26 *** Released version 0.6.9
920 925
921 926 2005-01-25 Fernando Perez <fperez@colorado.edu>
922 927
923 928 * setup.py: finally, we have a true Windows installer, thanks to
924 929 the excellent work of Viktor Ransmayr
925 930 <viktor.ransmayr-AT-t-online.de>. The docs have been updated for
926 931 Windows users. The setup routine is quite a bit cleaner thanks to
927 932 this, and the post-install script uses the proper functions to
928 933 allow a clean de-installation using the standard Windows Control
929 934 Panel.
930 935
931 936 * IPython/genutils.py (get_home_dir): changed to use the $HOME
932 937 environment variable under all OSes (including win32) if
933 938 available. This will give consistency to win32 users who have set
934 939 this variable for any reason. If os.environ['HOME'] fails, the
935 940 previous policy of using HOMEDRIVE\HOMEPATH kicks in.
936 941
937 942 2005-01-24 Fernando Perez <fperez@colorado.edu>
938 943
939 944 * IPython/numutils.py (empty_like): add empty_like(), similar to
940 945 zeros_like() but taking advantage of the new empty() Numeric routine.
941 946
942 947 2005-01-23 *** Released version 0.6.8
943 948
944 949 2005-01-22 Fernando Perez <fperez@colorado.edu>
945 950
946 951 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): I removed the
947 952 automatic show() calls. After discussing things with JDH, it
948 953 turns out there are too many corner cases where this can go wrong.
949 954 It's best not to try to be 'too smart', and simply have ipython
950 955 reproduce as much as possible the default behavior of a normal
951 956 python shell.
952 957
953 958 * IPython/iplib.py (InteractiveShell.__init__): Modified the
954 959 line-splitting regexp and _prefilter() to avoid calling getattr()
955 960 on assignments. This closes
956 961 http://www.scipy.net/roundup/ipython/issue24. Note that Python's
957 962 readline uses getattr(), so a simple <TAB> keypress is still
958 963 enough to trigger getattr() calls on an object.
959 964
960 965 2005-01-21 Fernando Perez <fperez@colorado.edu>
961 966
962 967 * IPython/Shell.py (MatplotlibShellBase.magic_run): Fix the %run
963 968 docstring under pylab so it doesn't mask the original.
964 969
965 970 2005-01-21 *** Released version 0.6.7
966 971
967 972 2005-01-21 Fernando Perez <fperez@colorado.edu>
968 973
969 974 * IPython/Shell.py (MTInteractiveShell.runcode): Trap a crash with
970 975 signal handling for win32 users in multithreaded mode.
971 976
972 977 2005-01-17 Fernando Perez <fperez@colorado.edu>
973 978
974 979 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
975 980 instances with no __init__. After a crash report by Norbert Nemec
976 981 <Norbert-AT-nemec-online.de>.
977 982
978 983 2005-01-14 Fernando Perez <fperez@colorado.edu>
979 984
980 985 * IPython/ultraTB.py (VerboseTB.text): Fix bug in reporting of
981 986 names for verbose exceptions, when multiple dotted names and the
982 987 'parent' object were present on the same line.
983 988
984 989 2005-01-11 Fernando Perez <fperez@colorado.edu>
985 990
986 991 * IPython/genutils.py (flag_calls): new utility to trap and flag
987 992 calls in functions. I need it to clean up matplotlib support.
988 993 Also removed some deprecated code in genutils.
989 994
990 995 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): small fix so
991 996 that matplotlib scripts called with %run, which don't call show()
992 997 themselves, still have their plotting windows open.
993 998
994 999 2005-01-05 Fernando Perez <fperez@colorado.edu>
995 1000
996 1001 * IPython/Shell.py (IPShellGTK.__init__): Patch by Andrew Straw
997 1002 <astraw-AT-caltech.edu>, to fix gtk deprecation warnings.
998 1003
999 1004 2004-12-19 Fernando Perez <fperez@colorado.edu>
1000 1005
1001 1006 * IPython/Shell.py (MTInteractiveShell.runcode): Get rid of
1002 1007 parent_runcode, which was an eyesore. The same result can be
1003 1008 obtained with Python's regular superclass mechanisms.
1004 1009
1005 1010 2004-12-17 Fernando Perez <fperez@colorado.edu>
1006 1011
1007 1012 * IPython/Magic.py (Magic.magic_sc): Fix quote stripping problem
1008 1013 reported by Prabhu.
1009 1014 (Magic.magic_sx): direct all errors to Term.cerr (defaults to
1010 1015 sys.stderr) instead of explicitly calling sys.stderr. This helps
1011 1016 maintain our I/O abstractions clean, for future GUI embeddings.
1012 1017
1013 1018 * IPython/genutils.py (info): added new utility for sys.stderr
1014 1019 unified info message handling (thin wrapper around warn()).
1015 1020
1016 1021 * IPython/ultraTB.py (VerboseTB.text): Fix misreported global
1017 1022 composite (dotted) names on verbose exceptions.
1018 1023 (VerboseTB.nullrepr): harden against another kind of errors which
1019 1024 Python's inspect module can trigger, and which were crashing
1020 1025 IPython. Thanks to a report by Marco Lombardi
1021 1026 <mlombard-AT-ma010192.hq.eso.org>.
1022 1027
1023 1028 2004-12-13 *** Released version 0.6.6
1024 1029
1025 1030 2004-12-12 Fernando Perez <fperez@colorado.edu>
1026 1031
1027 1032 * IPython/Shell.py (IPShellGTK.mainloop): catch RuntimeErrors
1028 1033 generated by pygtk upon initialization if it was built without
1029 1034 threads (for matplotlib users). After a crash reported by
1030 1035 Leguijt, Jaap J SIEP-EPT-RES <Jaap.Leguijt-AT-shell.com>.
1031 1036
1032 1037 * IPython/ipmaker.py (make_IPython): fix small bug in the
1033 1038 import_some parameter for multiple imports.
1034 1039
1035 1040 * IPython/iplib.py (ipmagic): simplified the interface of
1036 1041 ipmagic() to take a single string argument, just as it would be
1037 1042 typed at the IPython cmd line.
1038 1043 (ipalias): Added new ipalias() with an interface identical to
1039 1044 ipmagic(). This completes exposing a pure python interface to the
1040 1045 alias and magic system, which can be used in loops or more complex
1041 1046 code where IPython's automatic line mangling is not active.
1042 1047
1043 1048 * IPython/genutils.py (timing): changed interface of timing to
1044 1049 simply run code once, which is the most common case. timings()
1045 1050 remains unchanged, for the cases where you want multiple runs.
1046 1051
1047 1052 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix a
1048 1053 bug where Python2.2 crashes with exec'ing code which does not end
1049 1054 in a single newline. Python 2.3 is OK, so I hadn't noticed this
1050 1055 before.
1051 1056
1052 1057 2004-12-10 Fernando Perez <fperez@colorado.edu>
1053 1058
1054 1059 * IPython/Magic.py (Magic.magic_prun): changed name of option from
1055 1060 -t to -T, to accomodate the new -t flag in %run (the %run and
1056 1061 %prun options are kind of intermixed, and it's not easy to change
1057 1062 this with the limitations of python's getopt).
1058 1063
1059 1064 * IPython/Magic.py (Magic.magic_run): Added new -t option to time
1060 1065 the execution of scripts. It's not as fine-tuned as timeit.py,
1061 1066 but it works from inside ipython (and under 2.2, which lacks
1062 1067 timeit.py). Optionally a number of runs > 1 can be given for
1063 1068 timing very short-running code.
1064 1069
1065 1070 * IPython/genutils.py (uniq_stable): new routine which returns a
1066 1071 list of unique elements in any iterable, but in stable order of
1067 1072 appearance. I needed this for the ultraTB fixes, and it's a handy
1068 1073 utility.
1069 1074
1070 1075 * IPython/ultraTB.py (VerboseTB.text): Fix proper reporting of
1071 1076 dotted names in Verbose exceptions. This had been broken since
1072 1077 the very start, now x.y will properly be printed in a Verbose
1073 1078 traceback, instead of x being shown and y appearing always as an
1074 1079 'undefined global'. Getting this to work was a bit tricky,
1075 1080 because by default python tokenizers are stateless. Saved by
1076 1081 python's ability to easily add a bit of state to an arbitrary
1077 1082 function (without needing to build a full-blown callable object).
1078 1083
1079 1084 Also big cleanup of this code, which had horrendous runtime
1080 1085 lookups of zillions of attributes for colorization. Moved all
1081 1086 this code into a few templates, which make it cleaner and quicker.
1082 1087
1083 1088 Printout quality was also improved for Verbose exceptions: one
1084 1089 variable per line, and memory addresses are printed (this can be
1085 1090 quite handy in nasty debugging situations, which is what Verbose
1086 1091 is for).
1087 1092
1088 1093 * IPython/ipmaker.py (make_IPython): Do NOT execute files named in
1089 1094 the command line as scripts to be loaded by embedded instances.
1090 1095 Doing so has the potential for an infinite recursion if there are
1091 1096 exceptions thrown in the process. This fixes a strange crash
1092 1097 reported by Philippe MULLER <muller-AT-irit.fr>.
1093 1098
1094 1099 2004-12-09 Fernando Perez <fperez@colorado.edu>
1095 1100
1096 1101 * IPython/Shell.py (MatplotlibShellBase.use): Change pylab support
1097 1102 to reflect new names in matplotlib, which now expose the
1098 1103 matlab-compatible interface via a pylab module instead of the
1099 1104 'matlab' name. The new code is backwards compatible, so users of
1100 1105 all matplotlib versions are OK. Patch by J. Hunter.
1101 1106
1102 1107 * IPython/OInspect.py (Inspector.pinfo): Add to object? printing
1103 1108 of __init__ docstrings for instances (class docstrings are already
1104 1109 automatically printed). Instances with customized docstrings
1105 1110 (indep. of the class) are also recognized and all 3 separate
1106 1111 docstrings are printed (instance, class, constructor). After some
1107 1112 comments/suggestions by J. Hunter.
1108 1113
1109 1114 2004-12-05 Fernando Perez <fperez@colorado.edu>
1110 1115
1111 1116 * IPython/iplib.py (MagicCompleter.complete): Remove annoying
1112 1117 warnings when tab-completion fails and triggers an exception.
1113 1118
1114 1119 2004-12-03 Fernando Perez <fperez@colorado.edu>
1115 1120
1116 1121 * IPython/Magic.py (magic_prun): Fix bug where an exception would
1117 1122 be triggered when using 'run -p'. An incorrect option flag was
1118 1123 being set ('d' instead of 'D').
1119 1124 (manpage): fix missing escaped \- sign.
1120 1125
1121 1126 2004-11-30 *** Released version 0.6.5
1122 1127
1123 1128 2004-11-30 Fernando Perez <fperez@colorado.edu>
1124 1129
1125 1130 * IPython/Magic.py (Magic.magic_run): Fix bug in breakpoint
1126 1131 setting with -d option.
1127 1132
1128 1133 * setup.py (docfiles): Fix problem where the doc glob I was using
1129 1134 was COMPLETELY BROKEN. It was giving the right files by pure
1130 1135 accident, but failed once I tried to include ipython.el. Note:
1131 1136 glob() does NOT allow you to do exclusion on multiple endings!
1132 1137
1133 1138 2004-11-29 Fernando Perez <fperez@colorado.edu>
1134 1139
1135 1140 * IPython/usage.py (__doc__): cleaned up usage docstring, by using
1136 1141 the manpage as the source. Better formatting & consistency.
1137 1142
1138 1143 * IPython/Magic.py (magic_run): Added new -d option, to run
1139 1144 scripts under the control of the python pdb debugger. Note that
1140 1145 this required changing the %prun option -d to -D, to avoid a clash
1141 1146 (since %run must pass options to %prun, and getopt is too dumb to
1142 1147 handle options with string values with embedded spaces). Thanks
1143 1148 to a suggestion by Matthew Arnison <maffew-AT-cat.org.au>.
1144 1149 (magic_who_ls): added type matching to %who and %whos, so that one
1145 1150 can filter their output to only include variables of certain
1146 1151 types. Another suggestion by Matthew.
1147 1152 (magic_whos): Added memory summaries in kb and Mb for arrays.
1148 1153 (magic_who): Improve formatting (break lines every 9 vars).
1149 1154
1150 1155 2004-11-28 Fernando Perez <fperez@colorado.edu>
1151 1156
1152 1157 * IPython/Logger.py (Logger.log): Fix bug in syncing the input
1153 1158 cache when empty lines were present.
1154 1159
1155 1160 2004-11-24 Fernando Perez <fperez@colorado.edu>
1156 1161
1157 1162 * IPython/usage.py (__doc__): document the re-activated threading
1158 1163 options for WX and GTK.
1159 1164
1160 1165 2004-11-23 Fernando Perez <fperez@colorado.edu>
1161 1166
1162 1167 * IPython/Shell.py (start): Added Prabhu's big patch to reactivate
1163 1168 the -wthread and -gthread options, along with a new -tk one to try
1164 1169 and coordinate Tk threading with wx/gtk. The tk support is very
1165 1170 platform dependent, since it seems to require Tcl and Tk to be
1166 1171 built with threads (Fedora1/2 appears NOT to have it, but in
1167 1172 Prabhu's Debian boxes it works OK). But even with some Tk
1168 1173 limitations, this is a great improvement.
1169 1174
1170 1175 * IPython/Prompts.py (prompt_specials_color): Added \t for time
1171 1176 info in user prompts. Patch by Prabhu.
1172 1177
1173 1178 2004-11-18 Fernando Perez <fperez@colorado.edu>
1174 1179
1175 1180 * IPython/genutils.py (ask_yes_no): Add check for a max of 20
1176 1181 EOFErrors and bail, to avoid infinite loops if a non-terminating
1177 1182 file is fed into ipython. Patch submitted in issue 19 by user,
1178 1183 many thanks.
1179 1184
1180 1185 * IPython/iplib.py (InteractiveShell.handle_auto): do NOT trigger
1181 1186 autoquote/parens in continuation prompts, which can cause lots of
1182 1187 problems. Closes roundup issue 20.
1183 1188
1184 1189 2004-11-17 Fernando Perez <fperez@colorado.edu>
1185 1190
1186 1191 * debian/control (Build-Depends-Indep): Fix dpatch dependency,
1187 1192 reported as debian bug #280505. I'm not sure my local changelog
1188 1193 entry has the proper debian format (Jack?).
1189 1194
1190 1195 2004-11-08 *** Released version 0.6.4
1191 1196
1192 1197 2004-11-08 Fernando Perez <fperez@colorado.edu>
1193 1198
1194 1199 * IPython/iplib.py (init_readline): Fix exit message for Windows
1195 1200 when readline is active. Thanks to a report by Eric Jones
1196 1201 <eric-AT-enthought.com>.
1197 1202
1198 1203 2004-11-07 Fernando Perez <fperez@colorado.edu>
1199 1204
1200 1205 * IPython/genutils.py (page): Add a trap for OSError exceptions,
1201 1206 sometimes seen by win2k/cygwin users.
1202 1207
1203 1208 2004-11-06 Fernando Perez <fperez@colorado.edu>
1204 1209
1205 1210 * IPython/iplib.py (interact): Change the handling of %Exit from
1206 1211 trying to propagate a SystemExit to an internal ipython flag.
1207 1212 This is less elegant than using Python's exception mechanism, but
1208 1213 I can't get that to work reliably with threads, so under -pylab
1209 1214 %Exit was hanging IPython. Cross-thread exception handling is
1210 1215 really a bitch. Thaks to a bug report by Stephen Walton
1211 1216 <stephen.walton-AT-csun.edu>.
1212 1217
1213 1218 2004-11-04 Fernando Perez <fperez@colorado.edu>
1214 1219
1215 1220 * IPython/iplib.py (raw_input_original): store a pointer to the
1216 1221 true raw_input to harden against code which can modify it
1217 1222 (wx.py.PyShell does this and would otherwise crash ipython).
1218 1223 Thanks to a bug report by Jim Flowers <james.flowers-AT-lgx.com>.
1219 1224
1220 1225 * IPython/Shell.py (MTInteractiveShell.runsource): Cleaner fix for
1221 1226 Ctrl-C problem, which does not mess up the input line.
1222 1227
1223 1228 2004-11-03 Fernando Perez <fperez@colorado.edu>
1224 1229
1225 1230 * IPython/Release.py: Changed licensing to BSD, in all files.
1226 1231 (name): lowercase name for tarball/RPM release.
1227 1232
1228 1233 * IPython/OInspect.py (getdoc): wrap inspect.getdoc() safely for
1229 1234 use throughout ipython.
1230 1235
1231 1236 * IPython/Magic.py (Magic._ofind): Switch to using the new
1232 1237 OInspect.getdoc() function.
1233 1238
1234 1239 * IPython/Shell.py (sigint_handler): Hack to ignore the execution
1235 1240 of the line currently being canceled via Ctrl-C. It's extremely
1236 1241 ugly, but I don't know how to do it better (the problem is one of
1237 1242 handling cross-thread exceptions).
1238 1243
1239 1244 2004-10-28 Fernando Perez <fperez@colorado.edu>
1240 1245
1241 1246 * IPython/Shell.py (signal_handler): add signal handlers to trap
1242 1247 SIGINT and SIGSEGV in threaded code properly. Thanks to a bug
1243 1248 report by Francesc Alted.
1244 1249
1245 1250 2004-10-21 Fernando Perez <fperez@colorado.edu>
1246 1251
1247 1252 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Fix @
1248 1253 to % for pysh syntax extensions.
1249 1254
1250 1255 2004-10-09 Fernando Perez <fperez@colorado.edu>
1251 1256
1252 1257 * IPython/Magic.py (Magic.magic_whos): modify output of Numeric
1253 1258 arrays to print a more useful summary, without calling str(arr).
1254 1259 This avoids the problem of extremely lengthy computations which
1255 1260 occur if arr is large, and appear to the user as a system lockup
1256 1261 with 100% cpu activity. After a suggestion by Kristian Sandberg
1257 1262 <Kristian.Sandberg@colorado.edu>.
1258 1263 (Magic.__init__): fix bug in global magic escapes not being
1259 1264 correctly set.
1260 1265
1261 1266 2004-10-08 Fernando Perez <fperez@colorado.edu>
1262 1267
1263 1268 * IPython/Magic.py (__license__): change to absolute imports of
1264 1269 ipython's own internal packages, to start adapting to the absolute
1265 1270 import requirement of PEP-328.
1266 1271
1267 1272 * IPython/genutils.py (__author__): Fix coding to utf-8 on all
1268 1273 files, and standardize author/license marks through the Release
1269 1274 module instead of having per/file stuff (except for files with
1270 1275 particular licenses, like the MIT/PSF-licensed codes).
1271 1276
1272 1277 * IPython/Debugger.py: remove dead code for python 2.1
1273 1278
1274 1279 2004-10-04 Fernando Perez <fperez@colorado.edu>
1275 1280
1276 1281 * IPython/iplib.py (ipmagic): New function for accessing magics
1277 1282 via a normal python function call.
1278 1283
1279 1284 * IPython/Magic.py (Magic.magic_magic): Change the magic escape
1280 1285 from '@' to '%', to accomodate the new @decorator syntax of python
1281 1286 2.4.
1282 1287
1283 1288 2004-09-29 Fernando Perez <fperez@colorado.edu>
1284 1289
1285 1290 * IPython/Shell.py (MatplotlibShellBase.use): Added a wrapper to
1286 1291 matplotlib.use to prevent running scripts which try to switch
1287 1292 interactive backends from within ipython. This will just crash
1288 1293 the python interpreter, so we can't allow it (but a detailed error
1289 1294 is given to the user).
1290 1295
1291 1296 2004-09-28 Fernando Perez <fperez@colorado.edu>
1292 1297
1293 1298 * IPython/Shell.py (MatplotlibShellBase.mplot_exec):
1294 1299 matplotlib-related fixes so that using @run with non-matplotlib
1295 1300 scripts doesn't pop up spurious plot windows. This requires
1296 1301 matplotlib >= 0.63, where I had to make some changes as well.
1297 1302
1298 1303 * IPython/ipmaker.py (make_IPython): update version requirement to
1299 1304 python 2.2.
1300 1305
1301 1306 * IPython/iplib.py (InteractiveShell.mainloop): Add an optional
1302 1307 banner arg for embedded customization.
1303 1308
1304 1309 * IPython/Magic.py (Magic.__init__): big cleanup to remove all
1305 1310 explicit uses of __IP as the IPython's instance name. Now things
1306 1311 are properly handled via the shell.name value. The actual code
1307 1312 is a bit ugly b/c I'm doing it via a global in Magic.py, but this
1308 1313 is much better than before. I'll clean things completely when the
1309 1314 magic stuff gets a real overhaul.
1310 1315
1311 1316 * ipython.1: small fixes, sent in by Jack Moffit. He also sent in
1312 1317 minor changes to debian dir.
1313 1318
1314 1319 * IPython/iplib.py (InteractiveShell.__init__): Fix adding a
1315 1320 pointer to the shell itself in the interactive namespace even when
1316 1321 a user-supplied dict is provided. This is needed for embedding
1317 1322 purposes (found by tests with Michel Sanner).
1318 1323
1319 1324 2004-09-27 Fernando Perez <fperez@colorado.edu>
1320 1325
1321 1326 * IPython/UserConfig/ipythonrc: remove []{} from
1322 1327 readline_remove_delims, so that things like [modname.<TAB> do
1323 1328 proper completion. This disables [].TAB, but that's a less common
1324 1329 case than module names in list comprehensions, for example.
1325 1330 Thanks to a report by Andrea Riciputi.
1326 1331
1327 1332 2004-09-09 Fernando Perez <fperez@colorado.edu>
1328 1333
1329 1334 * IPython/Shell.py (IPShellGTK.mainloop): reorder to avoid
1330 1335 blocking problems in win32 and osx. Fix by John.
1331 1336
1332 1337 2004-09-08 Fernando Perez <fperez@colorado.edu>
1333 1338
1334 1339 * IPython/Shell.py (IPShellWX.OnInit): Fix output redirection bug
1335 1340 for Win32 and OSX. Fix by John Hunter.
1336 1341
1337 1342 2004-08-30 *** Released version 0.6.3
1338 1343
1339 1344 2004-08-30 Fernando Perez <fperez@colorado.edu>
1340 1345
1341 1346 * setup.py (isfile): Add manpages to list of dependent files to be
1342 1347 updated.
1343 1348
1344 1349 2004-08-27 Fernando Perez <fperez@colorado.edu>
1345 1350
1346 1351 * IPython/Shell.py (start): I've disabled -wthread and -gthread
1347 1352 for now. They don't really work with standalone WX/GTK code
1348 1353 (though matplotlib IS working fine with both of those backends).
1349 1354 This will neeed much more testing. I disabled most things with
1350 1355 comments, so turning it back on later should be pretty easy.
1351 1356
1352 1357 * IPython/iplib.py (InteractiveShell.__init__): Fix accidental
1353 1358 autocalling of expressions like r'foo', by modifying the line
1354 1359 split regexp. Closes
1355 1360 http://www.scipy.net/roundup/ipython/issue18, reported by Nicholas
1356 1361 Riley <ipythonbugs-AT-sabi.net>.
1357 1362 (InteractiveShell.mainloop): honor --nobanner with banner
1358 1363 extensions.
1359 1364
1360 1365 * IPython/Shell.py: Significant refactoring of all classes, so
1361 1366 that we can really support ALL matplotlib backends and threading
1362 1367 models (John spotted a bug with Tk which required this). Now we
1363 1368 should support single-threaded, WX-threads and GTK-threads, both
1364 1369 for generic code and for matplotlib.
1365 1370
1366 1371 * IPython/ipmaker.py (__call__): Changed -mpthread option to
1367 1372 -pylab, to simplify things for users. Will also remove the pylab
1368 1373 profile, since now all of matplotlib configuration is directly
1369 1374 handled here. This also reduces startup time.
1370 1375
1371 1376 * IPython/Shell.py (IPShellGTK.run): Fixed bug where mainloop() of
1372 1377 shell wasn't being correctly called. Also in IPShellWX.
1373 1378
1374 1379 * IPython/iplib.py (InteractiveShell.__init__): Added option to
1375 1380 fine-tune banner.
1376 1381
1377 1382 * IPython/numutils.py (spike): Deprecate these spike functions,
1378 1383 delete (long deprecated) gnuplot_exec handler.
1379 1384
1380 1385 2004-08-26 Fernando Perez <fperez@colorado.edu>
1381 1386
1382 1387 * ipython.1: Update for threading options, plus some others which
1383 1388 were missing.
1384 1389
1385 1390 * IPython/ipmaker.py (__call__): Added -wthread option for
1386 1391 wxpython thread handling. Make sure threading options are only
1387 1392 valid at the command line.
1388 1393
1389 1394 * scripts/ipython: moved shell selection into a factory function
1390 1395 in Shell.py, to keep the starter script to a minimum.
1391 1396
1392 1397 2004-08-25 Fernando Perez <fperez@colorado.edu>
1393 1398
1394 1399 * IPython/Shell.py (IPShellWX.wxexit): fixes to WX threading, by
1395 1400 John. Along with some recent changes he made to matplotlib, the
1396 1401 next versions of both systems should work very well together.
1397 1402
1398 1403 2004-08-24 Fernando Perez <fperez@colorado.edu>
1399 1404
1400 1405 * IPython/Magic.py (Magic.magic_prun): cleanup some dead code. I
1401 1406 tried to switch the profiling to using hotshot, but I'm getting
1402 1407 strange errors from prof.runctx() there. I may be misreading the
1403 1408 docs, but it looks weird. For now the profiling code will
1404 1409 continue to use the standard profiler.
1405 1410
1406 1411 2004-08-23 Fernando Perez <fperez@colorado.edu>
1407 1412
1408 1413 * IPython/Shell.py (IPShellWX.__init__): Improvements to the WX
1409 1414 threaded shell, by John Hunter. It's not quite ready yet, but
1410 1415 close.
1411 1416
1412 1417 2004-08-22 Fernando Perez <fperez@colorado.edu>
1413 1418
1414 1419 * IPython/iplib.py (InteractiveShell.interact): tab cleanups, also
1415 1420 in Magic and ultraTB.
1416 1421
1417 1422 * ipython.1: document threading options in manpage.
1418 1423
1419 1424 * scripts/ipython: Changed name of -thread option to -gthread,
1420 1425 since this is GTK specific. I want to leave the door open for a
1421 1426 -wthread option for WX, which will most likely be necessary. This
1422 1427 change affects usage and ipmaker as well.
1423 1428
1424 1429 * IPython/Shell.py (matplotlib_shell): Add a factory function to
1425 1430 handle the matplotlib shell issues. Code by John Hunter
1426 1431 <jdhunter-AT-nitace.bsd.uchicago.edu>.
1427 1432 (IPShellMatplotlibWX.__init__): Rudimentary WX support. It's
1428 1433 broken (and disabled for end users) for now, but it puts the
1429 1434 infrastructure in place.
1430 1435
1431 1436 2004-08-21 Fernando Perez <fperez@colorado.edu>
1432 1437
1433 1438 * ipythonrc-pylab: Add matplotlib support.
1434 1439
1435 1440 * matplotlib_config.py: new files for matplotlib support, part of
1436 1441 the pylab profile.
1437 1442
1438 1443 * IPython/usage.py (__doc__): documented the threading options.
1439 1444
1440 1445 2004-08-20 Fernando Perez <fperez@colorado.edu>
1441 1446
1442 1447 * ipython: Modified the main calling routine to handle the -thread
1443 1448 and -mpthread options. This needs to be done as a top-level hack,
1444 1449 because it determines which class to instantiate for IPython
1445 1450 itself.
1446 1451
1447 1452 * IPython/Shell.py (MTInteractiveShell.__init__): New set of
1448 1453 classes to support multithreaded GTK operation without blocking,
1449 1454 and matplotlib with all backends. This is a lot of still very
1450 1455 experimental code, and threads are tricky. So it may still have a
1451 1456 few rough edges... This code owes a lot to
1452 1457 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65109, by
1453 1458 Brian # McErlean and John Finlay, to Antoon Pardon for fixes, and
1454 1459 to John Hunter for all the matplotlib work.
1455 1460
1456 1461 * IPython/ipmaker.py (__call__): Added -thread and -mpthread
1457 1462 options for gtk thread and matplotlib support.
1458 1463
1459 1464 2004-08-16 Fernando Perez <fperez@colorado.edu>
1460 1465
1461 1466 * IPython/iplib.py (InteractiveShell.__init__): don't trigger
1462 1467 autocall for things like p*q,p/q,p+q,p-q, when p is callable. Bug
1463 1468 reported by Stephen Walton <stephen.walton-AT-csun.edu>.
1464 1469
1465 1470 2004-08-11 Fernando Perez <fperez@colorado.edu>
1466 1471
1467 1472 * setup.py (isfile): Fix build so documentation gets updated for
1468 1473 rpms (it was only done for .tgz builds).
1469 1474
1470 1475 2004-08-10 Fernando Perez <fperez@colorado.edu>
1471 1476
1472 1477 * genutils.py (Term): Fix misspell of stdin stream (sin->cin).
1473 1478
1474 1479 * iplib.py : Silence syntax error exceptions in tab-completion.
1475 1480
1476 1481 2004-08-05 Fernando Perez <fperez@colorado.edu>
1477 1482
1478 1483 * IPython/Prompts.py (Prompt2.set_colors): Fix incorrectly set
1479 1484 'color off' mark for continuation prompts. This was causing long
1480 1485 continuation lines to mis-wrap.
1481 1486
1482 1487 2004-08-01 Fernando Perez <fperez@colorado.edu>
1483 1488
1484 1489 * IPython/ipmaker.py (make_IPython): Allow the shell class used
1485 1490 for building ipython to be a parameter. All this is necessary
1486 1491 right now to have a multithreaded version, but this insane
1487 1492 non-design will be cleaned up soon. For now, it's a hack that
1488 1493 works.
1489 1494
1490 1495 * IPython/Shell.py (IPShell.__init__): Stop using mutable default
1491 1496 args in various places. No bugs so far, but it's a dangerous
1492 1497 practice.
1493 1498
1494 1499 2004-07-31 Fernando Perez <fperez@colorado.edu>
1495 1500
1496 1501 * IPython/iplib.py (complete): ignore SyntaxError exceptions to
1497 1502 fix completion of files with dots in their names under most
1498 1503 profiles (pysh was OK because the completion order is different).
1499 1504
1500 1505 2004-07-27 Fernando Perez <fperez@colorado.edu>
1501 1506
1502 1507 * IPython/iplib.py (InteractiveShell.__init__): build dict of
1503 1508 keywords manually, b/c the one in keyword.py was removed in python
1504 1509 2.4. Patch by Anakim Border <aborder-AT-users.sourceforge.net>.
1505 1510 This is NOT a bug under python 2.3 and earlier.
1506 1511
1507 1512 2004-07-26 Fernando Perez <fperez@colorado.edu>
1508 1513
1509 1514 * IPython/ultraTB.py (VerboseTB.text): Add another
1510 1515 linecache.checkcache() call to try to prevent inspect.py from
1511 1516 crashing under python 2.3. I think this fixes
1512 1517 http://www.scipy.net/roundup/ipython/issue17.
1513 1518
1514 1519 2004-07-26 *** Released version 0.6.2
1515 1520
1516 1521 2004-07-26 Fernando Perez <fperez@colorado.edu>
1517 1522
1518 1523 * IPython/Magic.py (Magic.magic_cd): Fix bug where 'cd -N' would
1519 1524 fail for any number.
1520 1525 (Magic.magic_bookmark): Fix bug where 'bookmark -l' would fail for
1521 1526 empty bookmarks.
1522 1527
1523 1528 2004-07-26 *** Released version 0.6.1
1524 1529
1525 1530 2004-07-26 Fernando Perez <fperez@colorado.edu>
1526 1531
1527 1532 * ipython_win_post_install.py (run): Added pysh shortcut for Windows.
1528 1533
1529 1534 * IPython/iplib.py (protect_filename): Applied Ville's patch for
1530 1535 escaping '()[]{}' in filenames.
1531 1536
1532 1537 * IPython/Magic.py (shlex_split): Fix handling of '*' and '?' for
1533 1538 Python 2.2 users who lack a proper shlex.split.
1534 1539
1535 1540 2004-07-19 Fernando Perez <fperez@colorado.edu>
1536 1541
1537 1542 * IPython/iplib.py (InteractiveShell.init_readline): Add support
1538 1543 for reading readline's init file. I follow the normal chain:
1539 1544 $INPUTRC is honored, otherwise ~/.inputrc is used. Thanks to a
1540 1545 report by Mike Heeter. This closes
1541 1546 http://www.scipy.net/roundup/ipython/issue16.
1542 1547
1543 1548 2004-07-18 Fernando Perez <fperez@colorado.edu>
1544 1549
1545 1550 * IPython/iplib.py (__init__): Add better handling of '\' under
1546 1551 Win32 for filenames. After a patch by Ville.
1547 1552
1548 1553 2004-07-17 Fernando Perez <fperez@colorado.edu>
1549 1554
1550 1555 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
1551 1556 autocalling would be triggered for 'foo is bar' if foo is
1552 1557 callable. I also cleaned up the autocall detection code to use a
1553 1558 regexp, which is faster. Bug reported by Alexander Schmolck.
1554 1559
1555 1560 * IPython/Magic.py (Magic.magic_pinfo): Fix bug where strings with
1556 1561 '?' in them would confuse the help system. Reported by Alex
1557 1562 Schmolck.
1558 1563
1559 1564 2004-07-16 Fernando Perez <fperez@colorado.edu>
1560 1565
1561 1566 * IPython/GnuplotInteractive.py (__all__): added plot2.
1562 1567
1563 1568 * IPython/Gnuplot2.py (Gnuplot.plot2): added new function for
1564 1569 plotting dictionaries, lists or tuples of 1d arrays.
1565 1570
1566 1571 * IPython/Magic.py (Magic.magic_hist): small clenaups and
1567 1572 optimizations.
1568 1573
1569 1574 * IPython/iplib.py:Remove old Changelog info for cleanup. This is
1570 1575 the information which was there from Janko's original IPP code:
1571 1576
1572 1577 03.05.99 20:53 porto.ifm.uni-kiel.de
1573 1578 --Started changelog.
1574 1579 --make clear do what it say it does
1575 1580 --added pretty output of lines from inputcache
1576 1581 --Made Logger a mixin class, simplifies handling of switches
1577 1582 --Added own completer class. .string<TAB> expands to last history
1578 1583 line which starts with string. The new expansion is also present
1579 1584 with Ctrl-r from the readline library. But this shows, who this
1580 1585 can be done for other cases.
1581 1586 --Added convention that all shell functions should accept a
1582 1587 parameter_string This opens the door for different behaviour for
1583 1588 each function. @cd is a good example of this.
1584 1589
1585 1590 04.05.99 12:12 porto.ifm.uni-kiel.de
1586 1591 --added logfile rotation
1587 1592 --added new mainloop method which freezes first the namespace
1588 1593
1589 1594 07.05.99 21:24 porto.ifm.uni-kiel.de
1590 1595 --added the docreader classes. Now there is a help system.
1591 1596 -This is only a first try. Currently it's not easy to put new
1592 1597 stuff in the indices. But this is the way to go. Info would be
1593 1598 better, but HTML is every where and not everybody has an info
1594 1599 system installed and it's not so easy to change html-docs to info.
1595 1600 --added global logfile option
1596 1601 --there is now a hook for object inspection method pinfo needs to
1597 1602 be provided for this. Can be reached by two '??'.
1598 1603
1599 1604 08.05.99 20:51 porto.ifm.uni-kiel.de
1600 1605 --added a README
1601 1606 --bug in rc file. Something has changed so functions in the rc
1602 1607 file need to reference the shell and not self. Not clear if it's a
1603 1608 bug or feature.
1604 1609 --changed rc file for new behavior
1605 1610
1606 1611 2004-07-15 Fernando Perez <fperez@colorado.edu>
1607 1612
1608 1613 * IPython/Logger.py (Logger.log): fixed recent bug where the input
1609 1614 cache was falling out of sync in bizarre manners when multi-line
1610 1615 input was present. Minor optimizations and cleanup.
1611 1616
1612 1617 (Logger): Remove old Changelog info for cleanup. This is the
1613 1618 information which was there from Janko's original code:
1614 1619
1615 1620 Changes to Logger: - made the default log filename a parameter
1616 1621
1617 1622 - put a check for lines beginning with !@? in log(). Needed
1618 1623 (even if the handlers properly log their lines) for mid-session
1619 1624 logging activation to work properly. Without this, lines logged
1620 1625 in mid session, which get read from the cache, would end up
1621 1626 'bare' (with !@? in the open) in the log. Now they are caught
1622 1627 and prepended with a #.
1623 1628
1624 1629 * IPython/iplib.py (InteractiveShell.init_readline): added check
1625 1630 in case MagicCompleter fails to be defined, so we don't crash.
1626 1631
1627 1632 2004-07-13 Fernando Perez <fperez@colorado.edu>
1628 1633
1629 1634 * IPython/Gnuplot2.py (Gnuplot.hardcopy): add automatic generation
1630 1635 of EPS if the requested filename ends in '.eps'.
1631 1636
1632 1637 2004-07-04 Fernando Perez <fperez@colorado.edu>
1633 1638
1634 1639 * IPython/iplib.py (InteractiveShell.handle_shell_escape): Fix
1635 1640 escaping of quotes when calling the shell.
1636 1641
1637 1642 2004-07-02 Fernando Perez <fperez@colorado.edu>
1638 1643
1639 1644 * IPython/Prompts.py (CachedOutput.update): Fix problem with
1640 1645 gettext not working because we were clobbering '_'. Fixes
1641 1646 http://www.scipy.net/roundup/ipython/issue6.
1642 1647
1643 1648 2004-07-01 Fernando Perez <fperez@colorado.edu>
1644 1649
1645 1650 * IPython/Magic.py (Magic.magic_cd): integrated bookmark handling
1646 1651 into @cd. Patch by Ville.
1647 1652
1648 1653 * IPython/iplib.py (InteractiveShell.post_config_initialization):
1649 1654 new function to store things after ipmaker runs. Patch by Ville.
1650 1655 Eventually this will go away once ipmaker is removed and the class
1651 1656 gets cleaned up, but for now it's ok. Key functionality here is
1652 1657 the addition of the persistent storage mechanism, a dict for
1653 1658 keeping data across sessions (for now just bookmarks, but more can
1654 1659 be implemented later).
1655 1660
1656 1661 * IPython/Magic.py (Magic.magic_bookmark): New bookmark system,
1657 1662 persistent across sections. Patch by Ville, I modified it
1658 1663 soemwhat to allow bookmarking arbitrary dirs other than CWD. Also
1659 1664 added a '-l' option to list all bookmarks.
1660 1665
1661 1666 * IPython/iplib.py (InteractiveShell.atexit_operations): new
1662 1667 center for cleanup. Registered with atexit.register(). I moved
1663 1668 here the old exit_cleanup(). After a patch by Ville.
1664 1669
1665 1670 * IPython/Magic.py (get_py_filename): added '~' to the accepted
1666 1671 characters in the hacked shlex_split for python 2.2.
1667 1672
1668 1673 * IPython/iplib.py (file_matches): more fixes to filenames with
1669 1674 whitespace in them. It's not perfect, but limitations in python's
1670 1675 readline make it impossible to go further.
1671 1676
1672 1677 2004-06-29 Fernando Perez <fperez@colorado.edu>
1673 1678
1674 1679 * IPython/iplib.py (file_matches): escape whitespace correctly in
1675 1680 filename completions. Bug reported by Ville.
1676 1681
1677 1682 2004-06-28 Fernando Perez <fperez@colorado.edu>
1678 1683
1679 1684 * IPython/ipmaker.py (__call__): Added per-profile histories. Now
1680 1685 the history file will be called 'history-PROFNAME' (or just
1681 1686 'history' if no profile is loaded). I was getting annoyed at
1682 1687 getting my Numerical work history clobbered by pysh sessions.
1683 1688
1684 1689 * IPython/iplib.py (InteractiveShell.__init__): Internal
1685 1690 getoutputerror() function so that we can honor the system_verbose
1686 1691 flag for _all_ system calls. I also added escaping of #
1687 1692 characters here to avoid confusing Itpl.
1688 1693
1689 1694 * IPython/Magic.py (shlex_split): removed call to shell in
1690 1695 parse_options and replaced it with shlex.split(). The annoying
1691 1696 part was that in Python 2.2, shlex.split() doesn't exist, so I had
1692 1697 to backport it from 2.3, with several frail hacks (the shlex
1693 1698 module is rather limited in 2.2). Thanks to a suggestion by Ville
1694 1699 Vainio <vivainio@kolumbus.fi>. For Python 2.3 there should be no
1695 1700 problem.
1696 1701
1697 1702 (Magic.magic_system_verbose): new toggle to print the actual
1698 1703 system calls made by ipython. Mainly for debugging purposes.
1699 1704
1700 1705 * IPython/GnuplotRuntime.py (gnu_out): fix bug for cygwin, which
1701 1706 doesn't support persistence. Reported (and fix suggested) by
1702 1707 Travis Caldwell <travis_caldwell2000@yahoo.com>.
1703 1708
1704 1709 2004-06-26 Fernando Perez <fperez@colorado.edu>
1705 1710
1706 1711 * IPython/Logger.py (Logger.log): fix to handle correctly empty
1707 1712 continue prompts.
1708 1713
1709 1714 * IPython/Extensions/InterpreterExec.py (pysh): moved the pysh()
1710 1715 function (basically a big docstring) and a few more things here to
1711 1716 speedup startup. pysh.py is now very lightweight. We want because
1712 1717 it gets execfile'd, while InterpreterExec gets imported, so
1713 1718 byte-compilation saves time.
1714 1719
1715 1720 2004-06-25 Fernando Perez <fperez@colorado.edu>
1716 1721
1717 1722 * IPython/Magic.py (Magic.magic_cd): Fixed to restore usage of 'cd
1718 1723 -NUM', which was recently broken.
1719 1724
1720 1725 * IPython/iplib.py (InteractiveShell.handle_shell_escape): allow !
1721 1726 in multi-line input (but not !!, which doesn't make sense there).
1722 1727
1723 1728 * IPython/UserConfig/ipythonrc: made autoindent on by default.
1724 1729 It's just too useful, and people can turn it off in the less
1725 1730 common cases where it's a problem.
1726 1731
1727 1732 2004-06-24 Fernando Perez <fperez@colorado.edu>
1728 1733
1729 1734 * IPython/iplib.py (InteractiveShell._prefilter): big change -
1730 1735 special syntaxes (like alias calling) is now allied in multi-line
1731 1736 input. This is still _very_ experimental, but it's necessary for
1732 1737 efficient shell usage combining python looping syntax with system
1733 1738 calls. For now it's restricted to aliases, I don't think it
1734 1739 really even makes sense to have this for magics.
1735 1740
1736 1741 2004-06-23 Fernando Perez <fperez@colorado.edu>
1737 1742
1738 1743 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Added
1739 1744 $var=cmd <=> @sc var=cmd and $$var=cmd <=> @sc -l var=cmd.
1740 1745
1741 1746 * IPython/Magic.py (Magic.magic_rehashx): modified to handle
1742 1747 extensions under Windows (after code sent by Gary Bishop). The
1743 1748 extensions considered 'executable' are stored in IPython's rc
1744 1749 structure as win_exec_ext.
1745 1750
1746 1751 * IPython/genutils.py (shell): new function, like system() but
1747 1752 without return value. Very useful for interactive shell work.
1748 1753
1749 1754 * IPython/Magic.py (Magic.magic_unalias): New @unalias function to
1750 1755 delete aliases.
1751 1756
1752 1757 * IPython/iplib.py (InteractiveShell.alias_table_update): make
1753 1758 sure that the alias table doesn't contain python keywords.
1754 1759
1755 1760 2004-06-21 Fernando Perez <fperez@colorado.edu>
1756 1761
1757 1762 * IPython/Magic.py (Magic.magic_rehash): Fix crash when
1758 1763 non-existent items are found in $PATH. Reported by Thorsten.
1759 1764
1760 1765 2004-06-20 Fernando Perez <fperez@colorado.edu>
1761 1766
1762 1767 * IPython/iplib.py (complete): modified the completer so that the
1763 1768 order of priorities can be easily changed at runtime.
1764 1769
1765 1770 * IPython/Extensions/InterpreterExec.py (prefilter_shell):
1766 1771 Modified to auto-execute all lines beginning with '~', '/' or '.'.
1767 1772
1768 1773 * IPython/Magic.py (Magic.magic_sx): modified @sc and @sx to
1769 1774 expand Python variables prepended with $ in all system calls. The
1770 1775 same was done to InteractiveShell.handle_shell_escape. Now all
1771 1776 system access mechanisms (!, !!, @sc, @sx and aliases) allow the
1772 1777 expansion of python variables and expressions according to the
1773 1778 syntax of PEP-215 - http://www.python.org/peps/pep-0215.html.
1774 1779
1775 1780 Though PEP-215 has been rejected, a similar (but simpler) one
1776 1781 seems like it will go into Python 2.4, PEP-292 -
1777 1782 http://www.python.org/peps/pep-0292.html.
1778 1783
1779 1784 I'll keep the full syntax of PEP-215, since IPython has since the
1780 1785 start used Ka-Ping Yee's reference implementation discussed there
1781 1786 (Itpl), and I actually like the powerful semantics it offers.
1782 1787
1783 1788 In order to access normal shell variables, the $ has to be escaped
1784 1789 via an extra $. For example:
1785 1790
1786 1791 In [7]: PATH='a python variable'
1787 1792
1788 1793 In [8]: !echo $PATH
1789 1794 a python variable
1790 1795
1791 1796 In [9]: !echo $$PATH
1792 1797 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
1793 1798
1794 1799 (Magic.parse_options): escape $ so the shell doesn't evaluate
1795 1800 things prematurely.
1796 1801
1797 1802 * IPython/iplib.py (InteractiveShell.call_alias): added the
1798 1803 ability for aliases to expand python variables via $.
1799 1804
1800 1805 * IPython/Magic.py (Magic.magic_rehash): based on the new alias
1801 1806 system, now there's a @rehash/@rehashx pair of magics. These work
1802 1807 like the csh rehash command, and can be invoked at any time. They
1803 1808 build a table of aliases to everything in the user's $PATH
1804 1809 (@rehash uses everything, @rehashx is slower but only adds
1805 1810 executable files). With this, the pysh.py-based shell profile can
1806 1811 now simply call rehash upon startup, and full access to all
1807 1812 programs in the user's path is obtained.
1808 1813
1809 1814 * IPython/iplib.py (InteractiveShell.call_alias): The new alias
1810 1815 functionality is now fully in place. I removed the old dynamic
1811 1816 code generation based approach, in favor of a much lighter one
1812 1817 based on a simple dict. The advantage is that this allows me to
1813 1818 now have thousands of aliases with negligible cost (unthinkable
1814 1819 with the old system).
1815 1820
1816 1821 2004-06-19 Fernando Perez <fperez@colorado.edu>
1817 1822
1818 1823 * IPython/iplib.py (__init__): extended MagicCompleter class to
1819 1824 also complete (last in priority) on user aliases.
1820 1825
1821 1826 * IPython/Itpl.py (Itpl.__str__): fixed order of globals/locals in
1822 1827 call to eval.
1823 1828 (ItplNS.__init__): Added a new class which functions like Itpl,
1824 1829 but allows configuring the namespace for the evaluation to occur
1825 1830 in.
1826 1831
1827 1832 2004-06-18 Fernando Perez <fperez@colorado.edu>
1828 1833
1829 1834 * IPython/iplib.py (InteractiveShell.runcode): modify to print a
1830 1835 better message when 'exit' or 'quit' are typed (a common newbie
1831 1836 confusion).
1832 1837
1833 1838 * IPython/Magic.py (Magic.magic_colors): Added the runtime color
1834 1839 check for Windows users.
1835 1840
1836 1841 * IPython/iplib.py (InteractiveShell.user_setup): removed
1837 1842 disabling of colors for Windows. I'll test at runtime and issue a
1838 1843 warning if Gary's readline isn't found, as to nudge users to
1839 1844 download it.
1840 1845
1841 1846 2004-06-16 Fernando Perez <fperez@colorado.edu>
1842 1847
1843 1848 * IPython/genutils.py (Stream.__init__): changed to print errors
1844 1849 to sys.stderr. I had a circular dependency here. Now it's
1845 1850 possible to run ipython as IDLE's shell (consider this pre-alpha,
1846 1851 since true stdout things end up in the starting terminal instead
1847 1852 of IDLE's out).
1848 1853
1849 1854 * IPython/Prompts.py (Prompt2.set_colors): prevent crashes for
1850 1855 users who haven't # updated their prompt_in2 definitions. Remove
1851 1856 eventually.
1852 1857 (multiple_replace): added credit to original ASPN recipe.
1853 1858
1854 1859 2004-06-15 Fernando Perez <fperez@colorado.edu>
1855 1860
1856 1861 * IPython/iplib.py (InteractiveShell.__init__): add 'cp' to the
1857 1862 list of auto-defined aliases.
1858 1863
1859 1864 2004-06-13 Fernando Perez <fperez@colorado.edu>
1860 1865
1861 1866 * setup.py (scriptfiles): Don't trigger win_post_install unless an
1862 1867 install was really requested (so setup.py can be used for other
1863 1868 things under Windows).
1864 1869
1865 1870 2004-06-10 Fernando Perez <fperez@colorado.edu>
1866 1871
1867 1872 * IPython/Logger.py (Logger.create_log): Manually remove any old
1868 1873 backup, since os.remove may fail under Windows. Fixes bug
1869 1874 reported by Thorsten.
1870 1875
1871 1876 2004-06-09 Fernando Perez <fperez@colorado.edu>
1872 1877
1873 1878 * examples/example-embed.py: fixed all references to %n (replaced
1874 1879 with \\# for ps1/out prompts and with \\D for ps2 prompts). Done
1875 1880 for all examples and the manual as well.
1876 1881
1877 1882 2004-06-08 Fernando Perez <fperez@colorado.edu>
1878 1883
1879 1884 * IPython/Prompts.py (Prompt2.set_p_str): fixed all prompt
1880 1885 alignment and color management. All 3 prompt subsystems now
1881 1886 inherit from BasePrompt.
1882 1887
1883 1888 * tools/release: updates for windows installer build and tag rpms
1884 1889 with python version (since paths are fixed).
1885 1890
1886 1891 * IPython/UserConfig/ipythonrc: modified to use \# instead of %n,
1887 1892 which will become eventually obsolete. Also fixed the default
1888 1893 prompt_in2 to use \D, so at least new users start with the correct
1889 1894 defaults.
1890 1895 WARNING: Users with existing ipythonrc files will need to apply
1891 1896 this fix manually!
1892 1897
1893 1898 * setup.py: make windows installer (.exe). This is finally the
1894 1899 integration of an old patch by Cory Dodt <dodt-AT-fcoe.k12.ca.us>,
1895 1900 which I hadn't included because it required Python 2.3 (or recent
1896 1901 distutils).
1897 1902
1898 1903 * IPython/usage.py (__doc__): update docs (and manpage) to reflect
1899 1904 usage of new '\D' escape.
1900 1905
1901 1906 * IPython/Prompts.py (ROOT_SYMBOL): Small fix for Windows (which
1902 1907 lacks os.getuid())
1903 1908 (CachedOutput.set_colors): Added the ability to turn coloring
1904 1909 on/off with @colors even for manually defined prompt colors. It
1905 1910 uses a nasty global, but it works safely and via the generic color
1906 1911 handling mechanism.
1907 1912 (Prompt2.__init__): Introduced new escape '\D' for continuation
1908 1913 prompts. It represents the counter ('\#') as dots.
1909 1914 *** NOTE *** THIS IS A BACKWARDS-INCOMPATIBLE CHANGE. Users will
1910 1915 need to update their ipythonrc files and replace '%n' with '\D' in
1911 1916 their prompt_in2 settings everywhere. Sorry, but there's
1912 1917 otherwise no clean way to get all prompts to properly align. The
1913 1918 ipythonrc shipped with IPython has been updated.
1914 1919
1915 1920 2004-06-07 Fernando Perez <fperez@colorado.edu>
1916 1921
1917 1922 * setup.py (isfile): Pass local_icons option to latex2html, so the
1918 1923 resulting HTML file is self-contained. Thanks to
1919 1924 dryice-AT-liu.com.cn for the tip.
1920 1925
1921 1926 * pysh.py: I created a new profile 'shell', which implements a
1922 1927 _rudimentary_ IPython-based shell. This is in NO WAY a realy
1923 1928 system shell, nor will it become one anytime soon. It's mainly
1924 1929 meant to illustrate the use of the new flexible bash-like prompts.
1925 1930 I guess it could be used by hardy souls for true shell management,
1926 1931 but it's no tcsh/bash... pysh.py is loaded by the 'shell'
1927 1932 profile. This uses the InterpreterExec extension provided by
1928 1933 W.J. van der Laan <gnufnork-AT-hetdigitalegat.nl>
1929 1934
1930 1935 * IPython/Prompts.py (PromptOut.__str__): now it will correctly
1931 1936 auto-align itself with the length of the previous input prompt
1932 1937 (taking into account the invisible color escapes).
1933 1938 (CachedOutput.__init__): Large restructuring of this class. Now
1934 1939 all three prompts (primary1, primary2, output) are proper objects,
1935 1940 managed by the 'parent' CachedOutput class. The code is still a
1936 1941 bit hackish (all prompts share state via a pointer to the cache),
1937 1942 but it's overall far cleaner than before.
1938 1943
1939 1944 * IPython/genutils.py (getoutputerror): modified to add verbose,
1940 1945 debug and header options. This makes the interface of all getout*
1941 1946 functions uniform.
1942 1947 (SystemExec.getoutputerror): added getoutputerror to SystemExec.
1943 1948
1944 1949 * IPython/Magic.py (Magic.default_option): added a function to
1945 1950 allow registering default options for any magic command. This
1946 1951 makes it easy to have profiles which customize the magics globally
1947 1952 for a certain use. The values set through this function are
1948 1953 picked up by the parse_options() method, which all magics should
1949 1954 use to parse their options.
1950 1955
1951 1956 * IPython/genutils.py (warn): modified the warnings framework to
1952 1957 use the Term I/O class. I'm trying to slowly unify all of
1953 1958 IPython's I/O operations to pass through Term.
1954 1959
1955 1960 * IPython/Prompts.py (Prompt2._str_other): Added functionality in
1956 1961 the secondary prompt to correctly match the length of the primary
1957 1962 one for any prompt. Now multi-line code will properly line up
1958 1963 even for path dependent prompts, such as the new ones available
1959 1964 via the prompt_specials.
1960 1965
1961 1966 2004-06-06 Fernando Perez <fperez@colorado.edu>
1962 1967
1963 1968 * IPython/Prompts.py (prompt_specials): Added the ability to have
1964 1969 bash-like special sequences in the prompts, which get
1965 1970 automatically expanded. Things like hostname, current working
1966 1971 directory and username are implemented already, but it's easy to
1967 1972 add more in the future. Thanks to a patch by W.J. van der Laan
1968 1973 <gnufnork-AT-hetdigitalegat.nl>
1969 1974 (prompt_specials): Added color support for prompt strings, so
1970 1975 users can define arbitrary color setups for their prompts.
1971 1976
1972 1977 2004-06-05 Fernando Perez <fperez@colorado.edu>
1973 1978
1974 1979 * IPython/genutils.py (Term.reopen_all): Added Windows-specific
1975 1980 code to load Gary Bishop's readline and configure it
1976 1981 automatically. Thanks to Gary for help on this.
1977 1982
1978 1983 2004-06-01 Fernando Perez <fperez@colorado.edu>
1979 1984
1980 1985 * IPython/Logger.py (Logger.create_log): fix bug for logging
1981 1986 with no filename (previous fix was incomplete).
1982 1987
1983 1988 2004-05-25 Fernando Perez <fperez@colorado.edu>
1984 1989
1985 1990 * IPython/Magic.py (Magic.parse_options): fix bug where naked
1986 1991 parens would get passed to the shell.
1987 1992
1988 1993 2004-05-20 Fernando Perez <fperez@colorado.edu>
1989 1994
1990 1995 * IPython/Magic.py (Magic.magic_prun): changed default profile
1991 1996 sort order to 'time' (the more common profiling need).
1992 1997
1993 1998 * IPython/OInspect.py (Inspector.pinfo): flush the inspect cache
1994 1999 so that source code shown is guaranteed in sync with the file on
1995 2000 disk (also changed in psource). Similar fix to the one for
1996 2001 ultraTB on 2004-05-06. Thanks to a bug report by Yann Le Du
1997 2002 <yann.ledu-AT-noos.fr>.
1998 2003
1999 2004 * IPython/Magic.py (Magic.parse_options): Fixed bug where commands
2000 2005 with a single option would not be correctly parsed. Closes
2001 2006 http://www.scipy.net/roundup/ipython/issue14. This bug had been
2002 2007 introduced in 0.6.0 (on 2004-05-06).
2003 2008
2004 2009 2004-05-13 *** Released version 0.6.0
2005 2010
2006 2011 2004-05-13 Fernando Perez <fperez@colorado.edu>
2007 2012
2008 2013 * debian/: Added debian/ directory to CVS, so that debian support
2009 2014 is publicly accessible. The debian package is maintained by Jack
2010 2015 Moffit <jack-AT-xiph.org>.
2011 2016
2012 2017 * Documentation: included the notes about an ipython-based system
2013 2018 shell (the hypothetical 'pysh') into the new_design.pdf document,
2014 2019 so that these ideas get distributed to users along with the
2015 2020 official documentation.
2016 2021
2017 2022 2004-05-10 Fernando Perez <fperez@colorado.edu>
2018 2023
2019 2024 * IPython/Logger.py (Logger.create_log): fix recently introduced
2020 2025 bug (misindented line) where logstart would fail when not given an
2021 2026 explicit filename.
2022 2027
2023 2028 2004-05-09 Fernando Perez <fperez@colorado.edu>
2024 2029
2025 2030 * IPython/Magic.py (Magic.parse_options): skip system call when
2026 2031 there are no options to look for. Faster, cleaner for the common
2027 2032 case.
2028 2033
2029 2034 * Documentation: many updates to the manual: describing Windows
2030 2035 support better, Gnuplot updates, credits, misc small stuff. Also
2031 2036 updated the new_design doc a bit.
2032 2037
2033 2038 2004-05-06 *** Released version 0.6.0.rc1
2034 2039
2035 2040 2004-05-06 Fernando Perez <fperez@colorado.edu>
2036 2041
2037 2042 * IPython/ultraTB.py (ListTB.text): modified a ton of string +=
2038 2043 operations to use the vastly more efficient list/''.join() method.
2039 2044 (FormattedTB.text): Fix
2040 2045 http://www.scipy.net/roundup/ipython/issue12 - exception source
2041 2046 extract not updated after reload. Thanks to Mike Salib
2042 2047 <msalib-AT-mit.edu> for pinning the source of the problem.
2043 2048 Fortunately, the solution works inside ipython and doesn't require
2044 2049 any changes to python proper.
2045 2050
2046 2051 * IPython/Magic.py (Magic.parse_options): Improved to process the
2047 2052 argument list as a true shell would (by actually using the
2048 2053 underlying system shell). This way, all @magics automatically get
2049 2054 shell expansion for variables. Thanks to a comment by Alex
2050 2055 Schmolck.
2051 2056
2052 2057 2004-04-04 Fernando Perez <fperez@colorado.edu>
2053 2058
2054 2059 * IPython/iplib.py (InteractiveShell.interact): Added a special
2055 2060 trap for a debugger quit exception, which is basically impossible
2056 2061 to handle by normal mechanisms, given what pdb does to the stack.
2057 2062 This fixes a crash reported by <fgibbons-AT-llama.med.harvard.edu>.
2058 2063
2059 2064 2004-04-03 Fernando Perez <fperez@colorado.edu>
2060 2065
2061 2066 * IPython/genutils.py (Term): Standardized the names of the Term
2062 2067 class streams to cin/cout/cerr, following C++ naming conventions
2063 2068 (I can't use in/out/err because 'in' is not a valid attribute
2064 2069 name).
2065 2070
2066 2071 * IPython/iplib.py (InteractiveShell.interact): don't increment
2067 2072 the prompt if there's no user input. By Daniel 'Dang' Griffith
2068 2073 <pythondev-dang-AT-lazytwinacres.net>, after a suggestion from
2069 2074 Francois Pinard.
2070 2075
2071 2076 2004-04-02 Fernando Perez <fperez@colorado.edu>
2072 2077
2073 2078 * IPython/genutils.py (Stream.__init__): Modified to survive at
2074 2079 least importing in contexts where stdin/out/err aren't true file
2075 2080 objects, such as PyCrust (they lack fileno() and mode). However,
2076 2081 the recovery facilities which rely on these things existing will
2077 2082 not work.
2078 2083
2079 2084 2004-04-01 Fernando Perez <fperez@colorado.edu>
2080 2085
2081 2086 * IPython/Magic.py (Magic.magic_sx): modified (as well as @sc) to
2082 2087 use the new getoutputerror() function, so it properly
2083 2088 distinguishes stdout/err.
2084 2089
2085 2090 * IPython/genutils.py (getoutputerror): added a function to
2086 2091 capture separately the standard output and error of a command.
2087 2092 After a comment from dang on the mailing lists. This code is
2088 2093 basically a modified version of commands.getstatusoutput(), from
2089 2094 the standard library.
2090 2095
2091 2096 * IPython/iplib.py (InteractiveShell.handle_shell_escape): added
2092 2097 '!!' as a special syntax (shorthand) to access @sx.
2093 2098
2094 2099 * IPython/Magic.py (Magic.magic_sx): new magic, to execute a shell
2095 2100 command and return its output as a list split on '\n'.
2096 2101
2097 2102 2004-03-31 Fernando Perez <fperez@colorado.edu>
2098 2103
2099 2104 * IPython/FakeModule.py (FakeModule.__init__): added __nonzero__
2100 2105 method to dictionaries used as FakeModule instances if they lack
2101 2106 it. At least pydoc in python2.3 breaks for runtime-defined
2102 2107 functions without this hack. At some point I need to _really_
2103 2108 understand what FakeModule is doing, because it's a gross hack.
2104 2109 But it solves Arnd's problem for now...
2105 2110
2106 2111 2004-02-27 Fernando Perez <fperez@colorado.edu>
2107 2112
2108 2113 * IPython/Logger.py (Logger.create_log): Fix bug where 'rotate'
2109 2114 mode would behave erratically. Also increased the number of
2110 2115 possible logs in rotate mod to 999. Thanks to Rod Holland
2111 2116 <rhh@StructureLABS.com> for the report and fixes.
2112 2117
2113 2118 2004-02-26 Fernando Perez <fperez@colorado.edu>
2114 2119
2115 2120 * IPython/genutils.py (page): Check that the curses module really
2116 2121 has the initscr attribute before trying to use it. For some
2117 2122 reason, the Solaris curses module is missing this. I think this
2118 2123 should be considered a Solaris python bug, but I'm not sure.
2119 2124
2120 2125 2004-01-17 Fernando Perez <fperez@colorado.edu>
2121 2126
2122 2127 * IPython/genutils.py (Stream.__init__): Changes to try to make
2123 2128 ipython robust against stdin/out/err being closed by the user.
2124 2129 This is 'user error' (and blocks a normal python session, at least
2125 2130 the stdout case). However, Ipython should be able to survive such
2126 2131 instances of abuse as gracefully as possible. To simplify the
2127 2132 coding and maintain compatibility with Gary Bishop's Term
2128 2133 contributions, I've made use of classmethods for this. I think
2129 2134 this introduces a dependency on python 2.2.
2130 2135
2131 2136 2004-01-13 Fernando Perez <fperez@colorado.edu>
2132 2137
2133 2138 * IPython/numutils.py (exp_safe): simplified the code a bit and
2134 2139 removed the need for importing the kinds module altogether.
2135 2140
2136 2141 2004-01-06 Fernando Perez <fperez@colorado.edu>
2137 2142
2138 2143 * IPython/Magic.py (Magic.magic_sc): Made the shell capture system
2139 2144 a magic function instead, after some community feedback. No
2140 2145 special syntax will exist for it, but its name is deliberately
2141 2146 very short.
2142 2147
2143 2148 2003-12-20 Fernando Perez <fperez@colorado.edu>
2144 2149
2145 2150 * IPython/iplib.py (InteractiveShell.handle_shell_assign): Added
2146 2151 new functionality, to automagically assign the result of a shell
2147 2152 command to a variable. I'll solicit some community feedback on
2148 2153 this before making it permanent.
2149 2154
2150 2155 * IPython/OInspect.py (Inspector.pinfo): Fix crash when info was
2151 2156 requested about callables for which inspect couldn't obtain a
2152 2157 proper argspec. Thanks to a crash report sent by Etienne
2153 2158 Posthumus <etienne-AT-apple01.cs.vu.nl>.
2154 2159
2155 2160 2003-12-09 Fernando Perez <fperez@colorado.edu>
2156 2161
2157 2162 * IPython/genutils.py (page): patch for the pager to work across
2158 2163 various versions of Windows. By Gary Bishop.
2159 2164
2160 2165 2003-12-04 Fernando Perez <fperez@colorado.edu>
2161 2166
2162 2167 * IPython/Gnuplot2.py (PlotItems): Fixes for working with
2163 2168 Gnuplot.py version 1.7, whose internal names changed quite a bit.
2164 2169 While I tested this and it looks ok, there may still be corner
2165 2170 cases I've missed.
2166 2171
2167 2172 2003-12-01 Fernando Perez <fperez@colorado.edu>
2168 2173
2169 2174 * IPython/iplib.py (InteractiveShell._prefilter): Fixed a bug
2170 2175 where a line like 'p,q=1,2' would fail because the automagic
2171 2176 system would be triggered for @p.
2172 2177
2173 2178 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): Tab-related
2174 2179 cleanups, code unmodified.
2175 2180
2176 2181 * IPython/genutils.py (Term): added a class for IPython to handle
2177 2182 output. In most cases it will just be a proxy for stdout/err, but
2178 2183 having this allows modifications to be made for some platforms,
2179 2184 such as handling color escapes under Windows. All of this code
2180 2185 was contributed by Gary Bishop, with minor modifications by me.
2181 2186 The actual changes affect many files.
2182 2187
2183 2188 2003-11-30 Fernando Perez <fperez@colorado.edu>
2184 2189
2185 2190 * IPython/iplib.py (file_matches): new completion code, courtesy
2186 2191 of Jeff Collins. This enables filename completion again under
2187 2192 python 2.3, which disabled it at the C level.
2188 2193
2189 2194 2003-11-11 Fernando Perez <fperez@colorado.edu>
2190 2195
2191 2196 * IPython/numutils.py (amap): Added amap() fn. Simple shorthand
2192 2197 for Numeric.array(map(...)), but often convenient.
2193 2198
2194 2199 2003-11-05 Fernando Perez <fperez@colorado.edu>
2195 2200
2196 2201 * IPython/numutils.py (frange): Changed a call from int() to
2197 2202 int(round()) to prevent a problem reported with arange() in the
2198 2203 numpy list.
2199 2204
2200 2205 2003-10-06 Fernando Perez <fperez@colorado.edu>
2201 2206
2202 2207 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): changed to
2203 2208 prevent crashes if sys lacks an argv attribute (it happens with
2204 2209 embedded interpreters which build a bare-bones sys module).
2205 2210 Thanks to a report/bugfix by Adam Hupp <hupp-AT-cs.wisc.edu>.
2206 2211
2207 2212 2003-09-24 Fernando Perez <fperez@colorado.edu>
2208 2213
2209 2214 * IPython/Magic.py (Magic._ofind): blanket except around getattr()
2210 2215 to protect against poorly written user objects where __getattr__
2211 2216 raises exceptions other than AttributeError. Thanks to a bug
2212 2217 report by Oliver Sander <osander-AT-gmx.de>.
2213 2218
2214 2219 * IPython/FakeModule.py (FakeModule.__repr__): this method was
2215 2220 missing. Thanks to bug report by Ralf Schmitt <ralf-AT-brainbot.com>.
2216 2221
2217 2222 2003-09-09 Fernando Perez <fperez@colorado.edu>
2218 2223
2219 2224 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
2220 2225 unpacking a list whith a callable as first element would
2221 2226 mistakenly trigger autocalling. Thanks to a bug report by Jeffery
2222 2227 Collins.
2223 2228
2224 2229 2003-08-25 *** Released version 0.5.0
2225 2230
2226 2231 2003-08-22 Fernando Perez <fperez@colorado.edu>
2227 2232
2228 2233 * IPython/ultraTB.py (VerboseTB.linereader): Improved handling of
2229 2234 improperly defined user exceptions. Thanks to feedback from Mark
2230 2235 Russell <mrussell-AT-verio.net>.
2231 2236
2232 2237 2003-08-20 Fernando Perez <fperez@colorado.edu>
2233 2238
2234 2239 * IPython/OInspect.py (Inspector.pinfo): changed String Form
2235 2240 printing so that it would print multi-line string forms starting
2236 2241 with a new line. This way the formatting is better respected for
2237 2242 objects which work hard to make nice string forms.
2238 2243
2239 2244 * IPython/iplib.py (InteractiveShell.handle_auto): Fix bug where
2240 2245 autocall would overtake data access for objects with both
2241 2246 __getitem__ and __call__.
2242 2247
2243 2248 2003-08-19 *** Released version 0.5.0-rc1
2244 2249
2245 2250 2003-08-19 Fernando Perez <fperez@colorado.edu>
2246 2251
2247 2252 * IPython/deep_reload.py (load_tail): single tiny change here
2248 2253 seems to fix the long-standing bug of dreload() failing to work
2249 2254 for dotted names. But this module is pretty tricky, so I may have
2250 2255 missed some subtlety. Needs more testing!.
2251 2256
2252 2257 * IPython/ultraTB.py (VerboseTB.linereader): harden against user
2253 2258 exceptions which have badly implemented __str__ methods.
2254 2259 (VerboseTB.text): harden against inspect.getinnerframes crashing,
2255 2260 which I've been getting reports about from Python 2.3 users. I
2256 2261 wish I had a simple test case to reproduce the problem, so I could
2257 2262 either write a cleaner workaround or file a bug report if
2258 2263 necessary.
2259 2264
2260 2265 * IPython/Magic.py (Magic.magic_edit): fixed bug where after
2261 2266 making a class 'foo', file 'foo.py' couldn't be edited. Thanks to
2262 2267 a bug report by Tjabo Kloppenburg.
2263 2268
2264 2269 * IPython/ultraTB.py (VerboseTB.debugger): hardened against pdb
2265 2270 crashes. Wrapped the pdb call in a blanket try/except, since pdb
2266 2271 seems rather unstable. Thanks to a bug report by Tjabo
2267 2272 Kloppenburg <tjabo.kloppenburg-AT-unix-ag.uni-siegen.de>.
2268 2273
2269 2274 * IPython/Release.py (version): release 0.5.0-rc1. I want to put
2270 2275 this out soon because of the critical fixes in the inner loop for
2271 2276 generators.
2272 2277
2273 2278 * IPython/Magic.py (Magic.getargspec): removed. This (and
2274 2279 _get_def) have been obsoleted by OInspect for a long time, I
2275 2280 hadn't noticed that they were dead code.
2276 2281 (Magic._ofind): restored _ofind functionality for a few literals
2277 2282 (those in ["''",'""','[]','{}','()']). But it won't work anymore
2278 2283 for things like "hello".capitalize?, since that would require a
2279 2284 potentially dangerous eval() again.
2280 2285
2281 2286 * IPython/iplib.py (InteractiveShell._prefilter): reorganized the
2282 2287 logic a bit more to clean up the escapes handling and minimize the
2283 2288 use of _ofind to only necessary cases. The interactive 'feel' of
2284 2289 IPython should have improved quite a bit with the changes in
2285 2290 _prefilter and _ofind (besides being far safer than before).
2286 2291
2287 2292 * IPython/Magic.py (Magic.magic_edit): Fixed old bug (but rather
2288 2293 obscure, never reported). Edit would fail to find the object to
2289 2294 edit under some circumstances.
2290 2295 (Magic._ofind): CRITICAL FIX. Finally removed the eval() calls
2291 2296 which were causing double-calling of generators. Those eval calls
2292 2297 were _very_ dangerous, since code with side effects could be
2293 2298 triggered. As they say, 'eval is evil'... These were the
2294 2299 nastiest evals in IPython. Besides, _ofind is now far simpler,
2295 2300 and it should also be quite a bit faster. Its use of inspect is
2296 2301 also safer, so perhaps some of the inspect-related crashes I've
2297 2302 seen lately with Python 2.3 might be taken care of. That will
2298 2303 need more testing.
2299 2304
2300 2305 2003-08-17 Fernando Perez <fperez@colorado.edu>
2301 2306
2302 2307 * IPython/iplib.py (InteractiveShell._prefilter): significant
2303 2308 simplifications to the logic for handling user escapes. Faster
2304 2309 and simpler code.
2305 2310
2306 2311 2003-08-14 Fernando Perez <fperez@colorado.edu>
2307 2312
2308 2313 * IPython/numutils.py (sum_flat): rewrote to be non-recursive.
2309 2314 Now it requires O(N) storage (N=size(a)) for non-contiguous input,
2310 2315 but it should be quite a bit faster. And the recursive version
2311 2316 generated O(log N) intermediate storage for all rank>1 arrays,
2312 2317 even if they were contiguous.
2313 2318 (l1norm): Added this function.
2314 2319 (norm): Added this function for arbitrary norms (including
2315 2320 l-infinity). l1 and l2 are still special cases for convenience
2316 2321 and speed.
2317 2322
2318 2323 2003-08-03 Fernando Perez <fperez@colorado.edu>
2319 2324
2320 2325 * IPython/Magic.py (Magic.magic_edit): Removed all remaining string
2321 2326 exceptions, which now raise PendingDeprecationWarnings in Python
2322 2327 2.3. There were some in Magic and some in Gnuplot2.
2323 2328
2324 2329 2003-06-30 Fernando Perez <fperez@colorado.edu>
2325 2330
2326 2331 * IPython/genutils.py (page): modified to call curses only for
2327 2332 terminals where TERM=='xterm'. After problems under many other
2328 2333 terminals were reported by Keith Beattie <KSBeattie-AT-lbl.gov>.
2329 2334
2330 2335 * IPython/iplib.py (complete): removed spurious 'print "IE"' which
2331 2336 would be triggered when readline was absent. This was just an old
2332 2337 debugging statement I'd forgotten to take out.
2333 2338
2334 2339 2003-06-20 Fernando Perez <fperez@colorado.edu>
2335 2340
2336 2341 * IPython/genutils.py (clock): modified to return only user time
2337 2342 (not counting system time), after a discussion on scipy. While
2338 2343 system time may be a useful quantity occasionally, it may much
2339 2344 more easily be skewed by occasional swapping or other similar
2340 2345 activity.
2341 2346
2342 2347 2003-06-05 Fernando Perez <fperez@colorado.edu>
2343 2348
2344 2349 * IPython/numutils.py (identity): new function, for building
2345 2350 arbitrary rank Kronecker deltas (mostly backwards compatible with
2346 2351 Numeric.identity)
2347 2352
2348 2353 2003-06-03 Fernando Perez <fperez@colorado.edu>
2349 2354
2350 2355 * IPython/iplib.py (InteractiveShell.handle_magic): protect
2351 2356 arguments passed to magics with spaces, to allow trailing '\' to
2352 2357 work normally (mainly for Windows users).
2353 2358
2354 2359 2003-05-29 Fernando Perez <fperez@colorado.edu>
2355 2360
2356 2361 * IPython/ipmaker.py (make_IPython): Load site._Helper() as help
2357 2362 instead of pydoc.help. This fixes a bizarre behavior where
2358 2363 printing '%s' % locals() would trigger the help system. Now
2359 2364 ipython behaves like normal python does.
2360 2365
2361 2366 Note that if one does 'from pydoc import help', the bizarre
2362 2367 behavior returns, but this will also happen in normal python, so
2363 2368 it's not an ipython bug anymore (it has to do with how pydoc.help
2364 2369 is implemented).
2365 2370
2366 2371 2003-05-22 Fernando Perez <fperez@colorado.edu>
2367 2372
2368 2373 * IPython/FlexCompleter.py (Completer.attr_matches): fixed to
2369 2374 return [] instead of None when nothing matches, also match to end
2370 2375 of line. Patch by Gary Bishop.
2371 2376
2372 2377 * IPython/ipmaker.py (make_IPython): Added same sys.excepthook
2373 2378 protection as before, for files passed on the command line. This
2374 2379 prevents the CrashHandler from kicking in if user files call into
2375 2380 sys.excepthook (such as PyQt and WxWindows have a nasty habit of
2376 2381 doing). After a report by Kasper Souren <Kasper.Souren-AT-ircam.fr>
2377 2382
2378 2383 2003-05-20 *** Released version 0.4.0
2379 2384
2380 2385 2003-05-20 Fernando Perez <fperez@colorado.edu>
2381 2386
2382 2387 * setup.py: added support for manpages. It's a bit hackish b/c of
2383 2388 a bug in the way the bdist_rpm distutils target handles gzipped
2384 2389 manpages, but it works. After a patch by Jack.
2385 2390
2386 2391 2003-05-19 Fernando Perez <fperez@colorado.edu>
2387 2392
2388 2393 * IPython/numutils.py: added a mockup of the kinds module, since
2389 2394 it was recently removed from Numeric. This way, numutils will
2390 2395 work for all users even if they are missing kinds.
2391 2396
2392 2397 * IPython/Magic.py (Magic._ofind): Harden against an inspect
2393 2398 failure, which can occur with SWIG-wrapped extensions. After a
2394 2399 crash report from Prabhu.
2395 2400
2396 2401 2003-05-16 Fernando Perez <fperez@colorado.edu>
2397 2402
2398 2403 * IPython/iplib.py (InteractiveShell.excepthook): New method to
2399 2404 protect ipython from user code which may call directly
2400 2405 sys.excepthook (this looks like an ipython crash to the user, even
2401 2406 when it isn't). After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
2402 2407 This is especially important to help users of WxWindows, but may
2403 2408 also be useful in other cases.
2404 2409
2405 2410 * IPython/ultraTB.py (AutoFormattedTB.__call__): Changed to allow
2406 2411 an optional tb_offset to be specified, and to preserve exception
2407 2412 info if given. After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
2408 2413
2409 2414 * ipython.1 (Default): Thanks to Jack's work, we now have manpages!
2410 2415
2411 2416 2003-05-15 Fernando Perez <fperez@colorado.edu>
2412 2417
2413 2418 * IPython/iplib.py (InteractiveShell.user_setup): Fix crash when
2414 2419 installing for a new user under Windows.
2415 2420
2416 2421 2003-05-12 Fernando Perez <fperez@colorado.edu>
2417 2422
2418 2423 * IPython/iplib.py (InteractiveShell.handle_emacs): New line
2419 2424 handler for Emacs comint-based lines. Currently it doesn't do
2420 2425 much (but importantly, it doesn't update the history cache). In
2421 2426 the future it may be expanded if Alex needs more functionality
2422 2427 there.
2423 2428
2424 2429 * IPython/CrashHandler.py (CrashHandler.__call__): Added platform
2425 2430 info to crash reports.
2426 2431
2427 2432 * IPython/iplib.py (InteractiveShell.mainloop): Added -c option,
2428 2433 just like Python's -c. Also fixed crash with invalid -color
2429 2434 option value at startup. Thanks to Will French
2430 2435 <wfrench-AT-bestweb.net> for the bug report.
2431 2436
2432 2437 2003-05-09 Fernando Perez <fperez@colorado.edu>
2433 2438
2434 2439 * IPython/genutils.py (EvalDict.__getitem__): Renamed EvalString
2435 2440 to EvalDict (it's a mapping, after all) and simplified its code
2436 2441 quite a bit, after a nice discussion on c.l.py where Gustavo
2437 2442 CΓ³rdova <gcordova-AT-sismex.com> suggested the new version.
2438 2443
2439 2444 2003-04-30 Fernando Perez <fperez@colorado.edu>
2440 2445
2441 2446 * IPython/genutils.py (timings_out): modified it to reduce its
2442 2447 overhead in the common reps==1 case.
2443 2448
2444 2449 2003-04-29 Fernando Perez <fperez@colorado.edu>
2445 2450
2446 2451 * IPython/genutils.py (timings_out): Modified to use the resource
2447 2452 module, which avoids the wraparound problems of time.clock().
2448 2453
2449 2454 2003-04-17 *** Released version 0.2.15pre4
2450 2455
2451 2456 2003-04-17 Fernando Perez <fperez@colorado.edu>
2452 2457
2453 2458 * setup.py (scriptfiles): Split windows-specific stuff over to a
2454 2459 separate file, in an attempt to have a Windows GUI installer.
2455 2460 That didn't work, but part of the groundwork is done.
2456 2461
2457 2462 * IPython/UserConfig/ipythonrc: Added M-i, M-o and M-I for
2458 2463 indent/unindent with 4 spaces. Particularly useful in combination
2459 2464 with the new auto-indent option.
2460 2465
2461 2466 2003-04-16 Fernando Perez <fperez@colorado.edu>
2462 2467
2463 2468 * IPython/Magic.py: various replacements of self.rc for
2464 2469 self.shell.rc. A lot more remains to be done to fully disentangle
2465 2470 this class from the main Shell class.
2466 2471
2467 2472 * IPython/GnuplotRuntime.py: added checks for mouse support so
2468 2473 that we don't try to enable it if the current gnuplot doesn't
2469 2474 really support it. Also added checks so that we don't try to
2470 2475 enable persist under Windows (where Gnuplot doesn't recognize the
2471 2476 option).
2472 2477
2473 2478 * IPython/iplib.py (InteractiveShell.interact): Added optional
2474 2479 auto-indenting code, after a patch by King C. Shu
2475 2480 <kingshu-AT-myrealbox.com>. It's off by default because it doesn't
2476 2481 get along well with pasting indented code. If I ever figure out
2477 2482 how to make that part go well, it will become on by default.
2478 2483
2479 2484 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixed bug which would
2480 2485 crash ipython if there was an unmatched '%' in the user's prompt
2481 2486 string. Reported by Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
2482 2487
2483 2488 * IPython/iplib.py (InteractiveShell.interact): removed the
2484 2489 ability to ask the user whether he wants to crash or not at the
2485 2490 'last line' exception handler. Calling functions at that point
2486 2491 changes the stack, and the error reports would have incorrect
2487 2492 tracebacks.
2488 2493
2489 2494 * IPython/Magic.py (Magic.magic_page): Added new @page magic, to
2490 2495 pass through a peger a pretty-printed form of any object. After a
2491 2496 contribution by Olivier Aubert <oaubert-AT-bat710.univ-lyon1.fr>
2492 2497
2493 2498 2003-04-14 Fernando Perez <fperez@colorado.edu>
2494 2499
2495 2500 * IPython/iplib.py (InteractiveShell.user_setup): Fixed bug where
2496 2501 all files in ~ would be modified at first install (instead of
2497 2502 ~/.ipython). This could be potentially disastrous, as the
2498 2503 modification (make line-endings native) could damage binary files.
2499 2504
2500 2505 2003-04-10 Fernando Perez <fperez@colorado.edu>
2501 2506
2502 2507 * IPython/iplib.py (InteractiveShell.handle_help): Modified to
2503 2508 handle only lines which are invalid python. This now means that
2504 2509 lines like 'x=1 #?' execute properly. Thanks to Jeffery Collins
2505 2510 for the bug report.
2506 2511
2507 2512 2003-04-01 Fernando Perez <fperez@colorado.edu>
2508 2513
2509 2514 * IPython/iplib.py (InteractiveShell.showtraceback): Fixed bug
2510 2515 where failing to set sys.last_traceback would crash pdb.pm().
2511 2516 Thanks to Jeffery D. Collins <Jeff.Collins-AT-vexcel.com> for the bug
2512 2517 report.
2513 2518
2514 2519 2003-03-25 Fernando Perez <fperez@colorado.edu>
2515 2520
2516 2521 * IPython/Magic.py (Magic.magic_prun): rstrip() output of profiler
2517 2522 before printing it (it had a lot of spurious blank lines at the
2518 2523 end).
2519 2524
2520 2525 * IPython/Gnuplot2.py (Gnuplot.hardcopy): fixed bug where lpr
2521 2526 output would be sent 21 times! Obviously people don't use this
2522 2527 too often, or I would have heard about it.
2523 2528
2524 2529 2003-03-24 Fernando Perez <fperez@colorado.edu>
2525 2530
2526 2531 * setup.py (scriptfiles): renamed the data_files parameter from
2527 2532 'base' to 'data' to fix rpm build issues. Thanks to Ralf Ahlbrink
2528 2533 for the patch.
2529 2534
2530 2535 2003-03-20 Fernando Perez <fperez@colorado.edu>
2531 2536
2532 2537 * IPython/genutils.py (error): added error() and fatal()
2533 2538 functions.
2534 2539
2535 2540 2003-03-18 *** Released version 0.2.15pre3
2536 2541
2537 2542 2003-03-18 Fernando Perez <fperez@colorado.edu>
2538 2543
2539 2544 * setupext/install_data_ext.py
2540 2545 (install_data_ext.initialize_options): Class contributed by Jack
2541 2546 Moffit for fixing the old distutils hack. He is sending this to
2542 2547 the distutils folks so in the future we may not need it as a
2543 2548 private fix.
2544 2549
2545 2550 * MANIFEST.in: Extensive reorganization, based on Jack Moffit's
2546 2551 changes for Debian packaging. See his patch for full details.
2547 2552 The old distutils hack of making the ipythonrc* files carry a
2548 2553 bogus .py extension is gone, at last. Examples were moved to a
2549 2554 separate subdir under doc/, and the separate executable scripts
2550 2555 now live in their own directory. Overall a great cleanup. The
2551 2556 manual was updated to use the new files, and setup.py has been
2552 2557 fixed for this setup.
2553 2558
2554 2559 * IPython/PyColorize.py (Parser.usage): made non-executable and
2555 2560 created a pycolor wrapper around it to be included as a script.
2556 2561
2557 2562 2003-03-12 *** Released version 0.2.15pre2
2558 2563
2559 2564 2003-03-12 Fernando Perez <fperez@colorado.edu>
2560 2565
2561 2566 * IPython/ColorANSI.py (make_color_table): Finally fixed the
2562 2567 long-standing problem with garbage characters in some terminals.
2563 2568 The issue was really that the \001 and \002 escapes must _only_ be
2564 2569 passed to input prompts (which call readline), but _never_ to
2565 2570 normal text to be printed on screen. I changed ColorANSI to have
2566 2571 two classes: TermColors and InputTermColors, each with the
2567 2572 appropriate escapes for input prompts or normal text. The code in
2568 2573 Prompts.py got slightly more complicated, but this very old and
2569 2574 annoying bug is finally fixed.
2570 2575
2571 2576 All the credit for nailing down the real origin of this problem
2572 2577 and the correct solution goes to Jack Moffit <jack-AT-xiph.org>.
2573 2578 *Many* thanks to him for spending quite a bit of effort on this.
2574 2579
2575 2580 2003-03-05 *** Released version 0.2.15pre1
2576 2581
2577 2582 2003-03-03 Fernando Perez <fperez@colorado.edu>
2578 2583
2579 2584 * IPython/FakeModule.py: Moved the former _FakeModule to a
2580 2585 separate file, because it's also needed by Magic (to fix a similar
2581 2586 pickle-related issue in @run).
2582 2587
2583 2588 2003-03-02 Fernando Perez <fperez@colorado.edu>
2584 2589
2585 2590 * IPython/Magic.py (Magic.magic_autocall): new magic to control
2586 2591 the autocall option at runtime.
2587 2592 (Magic.magic_dhist): changed self.user_ns to self.shell.user_ns
2588 2593 across Magic.py to start separating Magic from InteractiveShell.
2589 2594 (Magic._ofind): Fixed to return proper namespace for dotted
2590 2595 names. Before, a dotted name would always return 'not currently
2591 2596 defined', because it would find the 'parent'. s.x would be found,
2592 2597 but since 'x' isn't defined by itself, it would get confused.
2593 2598 (Magic.magic_run): Fixed pickling problems reported by Ralf
2594 2599 Ahlbrink <RAhlbrink-AT-RosenInspection.net>. The fix was similar to
2595 2600 that I'd used when Mike Heeter reported similar issues at the
2596 2601 top-level, but now for @run. It boils down to injecting the
2597 2602 namespace where code is being executed with something that looks
2598 2603 enough like a module to fool pickle.dump(). Since a pickle stores
2599 2604 a named reference to the importing module, we need this for
2600 2605 pickles to save something sensible.
2601 2606
2602 2607 * IPython/ipmaker.py (make_IPython): added an autocall option.
2603 2608
2604 2609 * IPython/iplib.py (InteractiveShell._prefilter): reordered all of
2605 2610 the auto-eval code. Now autocalling is an option, and the code is
2606 2611 also vastly safer. There is no more eval() involved at all.
2607 2612
2608 2613 2003-03-01 Fernando Perez <fperez@colorado.edu>
2609 2614
2610 2615 * IPython/Magic.py (Magic._ofind): Changed interface to return a
2611 2616 dict with named keys instead of a tuple.
2612 2617
2613 2618 * IPython: Started using CVS for IPython as of 0.2.15pre1.
2614 2619
2615 2620 * setup.py (make_shortcut): Fixed message about directories
2616 2621 created during Windows installation (the directories were ok, just
2617 2622 the printed message was misleading). Thanks to Chris Liechti
2618 2623 <cliechti-AT-gmx.net> for the heads up.
2619 2624
2620 2625 2003-02-21 Fernando Perez <fperez@colorado.edu>
2621 2626
2622 2627 * IPython/iplib.py (InteractiveShell._prefilter): Fixed catching
2623 2628 of ValueError exception when checking for auto-execution. This
2624 2629 one is raised by things like Numeric arrays arr.flat when the
2625 2630 array is non-contiguous.
2626 2631
2627 2632 2003-01-31 Fernando Perez <fperez@colorado.edu>
2628 2633
2629 2634 * IPython/genutils.py (SystemExec.bq): Fixed bug where bq would
2630 2635 not return any value at all (even though the command would get
2631 2636 executed).
2632 2637 (xsys): Flush stdout right after printing the command to ensure
2633 2638 proper ordering of commands and command output in the total
2634 2639 output.
2635 2640 (SystemExec/xsys/bq): Switched the names of xsys/bq and
2636 2641 system/getoutput as defaults. The old ones are kept for
2637 2642 compatibility reasons, so no code which uses this library needs
2638 2643 changing.
2639 2644
2640 2645 2003-01-27 *** Released version 0.2.14
2641 2646
2642 2647 2003-01-25 Fernando Perez <fperez@colorado.edu>
2643 2648
2644 2649 * IPython/Magic.py (Magic.magic_edit): Fixed problem where
2645 2650 functions defined in previous edit sessions could not be re-edited
2646 2651 (because the temp files were immediately removed). Now temp files
2647 2652 are removed only at IPython's exit.
2648 2653 (Magic.magic_run): Improved @run to perform shell-like expansions
2649 2654 on its arguments (~users and $VARS). With this, @run becomes more
2650 2655 like a normal command-line.
2651 2656
2652 2657 * IPython/Shell.py (IPShellEmbed.__call__): Fixed a bunch of small
2653 2658 bugs related to embedding and cleaned up that code. A fairly
2654 2659 important one was the impossibility to access the global namespace
2655 2660 through the embedded IPython (only local variables were visible).
2656 2661
2657 2662 2003-01-14 Fernando Perez <fperez@colorado.edu>
2658 2663
2659 2664 * IPython/iplib.py (InteractiveShell._prefilter): Fixed
2660 2665 auto-calling to be a bit more conservative. Now it doesn't get
2661 2666 triggered if any of '!=()<>' are in the rest of the input line, to
2662 2667 allow comparing callables. Thanks to Alex for the heads up.
2663 2668
2664 2669 2003-01-07 Fernando Perez <fperez@colorado.edu>
2665 2670
2666 2671 * IPython/genutils.py (page): fixed estimation of the number of
2667 2672 lines in a string to be paged to simply count newlines. This
2668 2673 prevents over-guessing due to embedded escape sequences. A better
2669 2674 long-term solution would involve stripping out the control chars
2670 2675 for the count, but it's potentially so expensive I just don't
2671 2676 think it's worth doing.
2672 2677
2673 2678 2002-12-19 *** Released version 0.2.14pre50
2674 2679
2675 2680 2002-12-19 Fernando Perez <fperez@colorado.edu>
2676 2681
2677 2682 * tools/release (version): Changed release scripts to inform
2678 2683 Andrea and build a NEWS file with a list of recent changes.
2679 2684
2680 2685 * IPython/ColorANSI.py (__all__): changed terminal detection
2681 2686 code. Seems to work better for xterms without breaking
2682 2687 konsole. Will need more testing to determine if WinXP and Mac OSX
2683 2688 also work ok.
2684 2689
2685 2690 2002-12-18 *** Released version 0.2.14pre49
2686 2691
2687 2692 2002-12-18 Fernando Perez <fperez@colorado.edu>
2688 2693
2689 2694 * Docs: added new info about Mac OSX, from Andrea.
2690 2695
2691 2696 * IPython/Gnuplot2.py (String): Added a String PlotItem class to
2692 2697 allow direct plotting of python strings whose format is the same
2693 2698 of gnuplot data files.
2694 2699
2695 2700 2002-12-16 Fernando Perez <fperez@colorado.edu>
2696 2701
2697 2702 * IPython/iplib.py (InteractiveShell.interact): fixed default (y)
2698 2703 value of exit question to be acknowledged.
2699 2704
2700 2705 2002-12-03 Fernando Perez <fperez@colorado.edu>
2701 2706
2702 2707 * IPython/ipmaker.py: removed generators, which had been added
2703 2708 by mistake in an earlier debugging run. This was causing trouble
2704 2709 to users of python 2.1.x. Thanks to Abel Daniel <abli-AT-freemail.hu>
2705 2710 for pointing this out.
2706 2711
2707 2712 2002-11-17 Fernando Perez <fperez@colorado.edu>
2708 2713
2709 2714 * Manual: updated the Gnuplot section.
2710 2715
2711 2716 * IPython/GnuplotRuntime.py: refactored a lot all this code, with
2712 2717 a much better split of what goes in Runtime and what goes in
2713 2718 Interactive.
2714 2719
2715 2720 * IPython/ipmaker.py: fixed bug where import_fail_info wasn't
2716 2721 being imported from iplib.
2717 2722
2718 2723 * IPython/GnuplotInteractive.py (magic_gpc): renamed @gp to @gpc
2719 2724 for command-passing. Now the global Gnuplot instance is called
2720 2725 'gp' instead of 'g', which was really a far too fragile and
2721 2726 common name.
2722 2727
2723 2728 * IPython/Gnuplot2.py (eps_fix_bbox): added this to fix broken
2724 2729 bounding boxes generated by Gnuplot for square plots.
2725 2730
2726 2731 * IPython/genutils.py (popkey): new function added. I should
2727 2732 suggest this on c.l.py as a dict method, it seems useful.
2728 2733
2729 2734 * IPython/Gnuplot2.py (Gnuplot.plot): Overhauled plot and replot
2730 2735 to transparently handle PostScript generation. MUCH better than
2731 2736 the previous plot_eps/replot_eps (which I removed now). The code
2732 2737 is also fairly clean and well documented now (including
2733 2738 docstrings).
2734 2739
2735 2740 2002-11-13 Fernando Perez <fperez@colorado.edu>
2736 2741
2737 2742 * IPython/Magic.py (Magic.magic_edit): fixed docstring
2738 2743 (inconsistent with options).
2739 2744
2740 2745 * IPython/Gnuplot2.py (Gnuplot.hardcopy): hardcopy had been
2741 2746 manually disabled, I don't know why. Fixed it.
2742 2747 (Gnuplot._plot_eps): added new plot_eps/replot_eps to get directly
2743 2748 eps output.
2744 2749
2745 2750 2002-11-12 Fernando Perez <fperez@colorado.edu>
2746 2751
2747 2752 * IPython/genutils.py (ask_yes_no): trap EOF and ^C so that they
2748 2753 don't propagate up to caller. Fixes crash reported by François
2749 2754 Pinard.
2750 2755
2751 2756 2002-11-09 Fernando Perez <fperez@colorado.edu>
2752 2757
2753 2758 * IPython/ipmaker.py (make_IPython): fixed problem with writing
2754 2759 history file for new users.
2755 2760 (make_IPython): fixed bug where initial install would leave the
2756 2761 user running in the .ipython dir.
2757 2762 (make_IPython): fixed bug where config dir .ipython would be
2758 2763 created regardless of the given -ipythondir option. Thanks to Cory
2759 2764 Dodt <cdodt-AT-fcoe.k12.ca.us> for the bug report.
2760 2765
2761 2766 * IPython/genutils.py (ask_yes_no): new function for asking yes/no
2762 2767 type confirmations. Will need to use it in all of IPython's code
2763 2768 consistently.
2764 2769
2765 2770 * IPython/CrashHandler.py (CrashHandler.__call__): changed the
2766 2771 context to print 31 lines instead of the default 5. This will make
2767 2772 the crash reports extremely detailed in case the problem is in
2768 2773 libraries I don't have access to.
2769 2774
2770 2775 * IPython/iplib.py (InteractiveShell.interact): changed the 'last
2771 2776 line of defense' code to still crash, but giving users fair
2772 2777 warning. I don't want internal errors to go unreported: if there's
2773 2778 an internal problem, IPython should crash and generate a full
2774 2779 report.
2775 2780
2776 2781 2002-11-08 Fernando Perez <fperez@colorado.edu>
2777 2782
2778 2783 * IPython/iplib.py (InteractiveShell.interact): added code to trap
2779 2784 otherwise uncaught exceptions which can appear if people set
2780 2785 sys.stdout to something badly broken. Thanks to a crash report
2781 2786 from henni-AT-mail.brainbot.com.
2782 2787
2783 2788 2002-11-04 Fernando Perez <fperez@colorado.edu>
2784 2789
2785 2790 * IPython/iplib.py (InteractiveShell.interact): added
2786 2791 __IPYTHON__active to the builtins. It's a flag which goes on when
2787 2792 the interaction starts and goes off again when it stops. This
2788 2793 allows embedding code to detect being inside IPython. Before this
2789 2794 was done via __IPYTHON__, but that only shows that an IPython
2790 2795 instance has been created.
2791 2796
2792 2797 * IPython/Magic.py (Magic.magic_env): I realized that in a
2793 2798 UserDict, instance.data holds the data as a normal dict. So I
2794 2799 modified @env to return os.environ.data instead of rebuilding a
2795 2800 dict by hand.
2796 2801
2797 2802 2002-11-02 Fernando Perez <fperez@colorado.edu>
2798 2803
2799 2804 * IPython/genutils.py (warn): changed so that level 1 prints no
2800 2805 header. Level 2 is now the default (with 'WARNING' header, as
2801 2806 before). I think I tracked all places where changes were needed in
2802 2807 IPython, but outside code using the old level numbering may have
2803 2808 broken.
2804 2809
2805 2810 * IPython/iplib.py (InteractiveShell.runcode): added this to
2806 2811 handle the tracebacks in SystemExit traps correctly. The previous
2807 2812 code (through interact) was printing more of the stack than
2808 2813 necessary, showing IPython internal code to the user.
2809 2814
2810 2815 * IPython/UserConfig/ipythonrc.py: Made confirm_exit 1 by
2811 2816 default. Now that the default at the confirmation prompt is yes,
2812 2817 it's not so intrusive. François' argument that ipython sessions
2813 2818 tend to be complex enough not to lose them from an accidental C-d,
2814 2819 is a valid one.
2815 2820
2816 2821 * IPython/iplib.py (InteractiveShell.interact): added a
2817 2822 showtraceback() call to the SystemExit trap, and modified the exit
2818 2823 confirmation to have yes as the default.
2819 2824
2820 2825 * IPython/UserConfig/ipythonrc.py: removed 'session' option from
2821 2826 this file. It's been gone from the code for a long time, this was
2822 2827 simply leftover junk.
2823 2828
2824 2829 2002-11-01 Fernando Perez <fperez@colorado.edu>
2825 2830
2826 2831 * IPython/UserConfig/ipythonrc.py: new confirm_exit option
2827 2832 added. If set, IPython now traps EOF and asks for
2828 2833 confirmation. After a request by François Pinard.
2829 2834
2830 2835 * IPython/Magic.py (Magic.magic_Exit): New @Exit and @Quit instead
2831 2836 of @abort, and with a new (better) mechanism for handling the
2832 2837 exceptions.
2833 2838
2834 2839 2002-10-27 Fernando Perez <fperez@colorado.edu>
2835 2840
2836 2841 * IPython/usage.py (__doc__): updated the --help information and
2837 2842 the ipythonrc file to indicate that -log generates
2838 2843 ./ipython.log. Also fixed the corresponding info in @logstart.
2839 2844 This and several other fixes in the manuals thanks to reports by
2840 2845 François Pinard <pinard-AT-iro.umontreal.ca>.
2841 2846
2842 2847 * IPython/Logger.py (Logger.switch_log): Fixed error message to
2843 2848 refer to @logstart (instead of @log, which doesn't exist).
2844 2849
2845 2850 * IPython/iplib.py (InteractiveShell._prefilter): fixed
2846 2851 AttributeError crash. Thanks to Christopher Armstrong
2847 2852 <radix-AT-twistedmatrix.com> for the report/fix. This bug had been
2848 2853 introduced recently (in 0.2.14pre37) with the fix to the eval
2849 2854 problem mentioned below.
2850 2855
2851 2856 2002-10-17 Fernando Perez <fperez@colorado.edu>
2852 2857
2853 2858 * IPython/ConfigLoader.py (ConfigLoader.load): Fixes for Windows
2854 2859 installation. Thanks to Leonardo Santagada <retype-AT-terra.com.br>.
2855 2860
2856 2861 * IPython/iplib.py (InteractiveShell._prefilter): Many changes to
2857 2862 this function to fix a problem reported by Alex Schmolck. He saw
2858 2863 it with list comprehensions and generators, which were getting
2859 2864 called twice. The real problem was an 'eval' call in testing for
2860 2865 automagic which was evaluating the input line silently.
2861 2866
2862 2867 This is a potentially very nasty bug, if the input has side
2863 2868 effects which must not be repeated. The code is much cleaner now,
2864 2869 without any blanket 'except' left and with a regexp test for
2865 2870 actual function names.
2866 2871
2867 2872 But an eval remains, which I'm not fully comfortable with. I just
2868 2873 don't know how to find out if an expression could be a callable in
2869 2874 the user's namespace without doing an eval on the string. However
2870 2875 that string is now much more strictly checked so that no code
2871 2876 slips by, so the eval should only happen for things that can
2872 2877 really be only function/method names.
2873 2878
2874 2879 2002-10-15 Fernando Perez <fperez@colorado.edu>
2875 2880
2876 2881 * Updated LyX to 1.2.1 so I can work on the docs again. Added Mac
2877 2882 OSX information to main manual, removed README_Mac_OSX file from
2878 2883 distribution. Also updated credits for recent additions.
2879 2884
2880 2885 2002-10-10 Fernando Perez <fperez@colorado.edu>
2881 2886
2882 2887 * README_Mac_OSX: Added a README for Mac OSX users for fixing
2883 2888 terminal-related issues. Many thanks to Andrea Riciputi
2884 2889 <andrea.riciputi-AT-libero.it> for writing it.
2885 2890
2886 2891 * IPython/UserConfig/ipythonrc.py: Fixes to various small issues,
2887 2892 thanks to Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
2888 2893
2889 2894 * setup.py (make_shortcut): Fixes for Windows installation. Thanks
2890 2895 to Fredrik Kant <fredrik.kant-AT-front.com> and Syver Enstad
2891 2896 <syver-en-AT-online.no> who both submitted patches for this problem.
2892 2897
2893 2898 * IPython/iplib.py (InteractiveShell.embed_mainloop): Patch for
2894 2899 global embedding to make sure that things don't overwrite user
2895 2900 globals accidentally. Thanks to Richard <rxe-AT-renre-europe.com>
2896 2901
2897 2902 * IPython/Gnuplot2.py (gp): Patch for Gnuplot.py 1.6
2898 2903 compatibility. Thanks to Hayden Callow
2899 2904 <h.callow-AT-elec.canterbury.ac.nz>
2900 2905
2901 2906 2002-10-04 Fernando Perez <fperez@colorado.edu>
2902 2907
2903 2908 * IPython/Gnuplot2.py (PlotItem): Added 'index' option for
2904 2909 Gnuplot.File objects.
2905 2910
2906 2911 2002-07-23 Fernando Perez <fperez@colorado.edu>
2907 2912
2908 2913 * IPython/genutils.py (timing): Added timings() and timing() for
2909 2914 quick access to the most commonly needed data, the execution
2910 2915 times. Old timing() renamed to timings_out().
2911 2916
2912 2917 2002-07-18 Fernando Perez <fperez@colorado.edu>
2913 2918
2914 2919 * IPython/Shell.py (IPShellEmbed.restore_system_completer): fixed
2915 2920 bug with nested instances disrupting the parent's tab completion.
2916 2921
2917 2922 * IPython/iplib.py (all_completions): Added Alex Schmolck's
2918 2923 all_completions code to begin the emacs integration.
2919 2924
2920 2925 * IPython/Gnuplot2.py (zip_items): Added optional 'titles'
2921 2926 argument to allow titling individual arrays when plotting.
2922 2927
2923 2928 2002-07-15 Fernando Perez <fperez@colorado.edu>
2924 2929
2925 2930 * setup.py (make_shortcut): changed to retrieve the value of
2926 2931 'Program Files' directory from the registry (this value changes in
2927 2932 non-english versions of Windows). Thanks to Thomas Fanslau
2928 2933 <tfanslau-AT-gmx.de> for the report.
2929 2934
2930 2935 2002-07-10 Fernando Perez <fperez@colorado.edu>
2931 2936
2932 2937 * IPython/ultraTB.py (VerboseTB.debugger): enabled workaround for
2933 2938 a bug in pdb, which crashes if a line with only whitespace is
2934 2939 entered. Bug report submitted to sourceforge.
2935 2940
2936 2941 2002-07-09 Fernando Perez <fperez@colorado.edu>
2937 2942
2938 2943 * IPython/ultraTB.py (VerboseTB.nullrepr): fixed rare crash when
2939 2944 reporting exceptions (it's a bug in inspect.py, I just set a
2940 2945 workaround).
2941 2946
2942 2947 2002-07-08 Fernando Perez <fperez@colorado.edu>
2943 2948
2944 2949 * IPython/iplib.py (InteractiveShell.__init__): fixed reference to
2945 2950 __IPYTHON__ in __builtins__ to show up in user_ns.
2946 2951
2947 2952 2002-07-03 Fernando Perez <fperez@colorado.edu>
2948 2953
2949 2954 * IPython/GnuplotInteractive.py (magic_gp_set_default): changed
2950 2955 name from @gp_set_instance to @gp_set_default.
2951 2956
2952 2957 * IPython/ipmaker.py (make_IPython): default editor value set to
2953 2958 '0' (a string), to match the rc file. Otherwise will crash when
2954 2959 .strip() is called on it.
2955 2960
2956 2961
2957 2962 2002-06-28 Fernando Perez <fperez@colorado.edu>
2958 2963
2959 2964 * IPython/iplib.py (InteractiveShell.safe_execfile): fix importing
2960 2965 of files in current directory when a file is executed via
2961 2966 @run. Patch also by RA <ralf_ahlbrink-AT-web.de>.
2962 2967
2963 2968 * setup.py (manfiles): fix for rpm builds, submitted by RA
2964 2969 <ralf_ahlbrink-AT-web.de>. Now we have RPMs!
2965 2970
2966 2971 * IPython/ipmaker.py (make_IPython): fixed lookup of default
2967 2972 editor when set to '0'. Problem was, '0' evaluates to True (it's a
2968 2973 string!). A. Schmolck caught this one.
2969 2974
2970 2975 2002-06-27 Fernando Perez <fperez@colorado.edu>
2971 2976
2972 2977 * IPython/ipmaker.py (make_IPython): fixed bug when running user
2973 2978 defined files at the cmd line. __name__ wasn't being set to
2974 2979 __main__.
2975 2980
2976 2981 * IPython/Gnuplot2.py (zip_items): improved it so it can plot also
2977 2982 regular lists and tuples besides Numeric arrays.
2978 2983
2979 2984 * IPython/Prompts.py (CachedOutput.__call__): Added output
2980 2985 supression for input ending with ';'. Similar to Mathematica and
2981 2986 Matlab. The _* vars and Out[] list are still updated, just like
2982 2987 Mathematica behaves.
2983 2988
2984 2989 2002-06-25 Fernando Perez <fperez@colorado.edu>
2985 2990
2986 2991 * IPython/ConfigLoader.py (ConfigLoader.load): fixed checking of
2987 2992 .ini extensions for profiels under Windows.
2988 2993
2989 2994 * IPython/OInspect.py (Inspector.pinfo): improved alignment of
2990 2995 string form. Fix contributed by Alexander Schmolck
2991 2996 <a.schmolck-AT-gmx.net>
2992 2997
2993 2998 * IPython/GnuplotRuntime.py (gp_new): new function. Returns a
2994 2999 pre-configured Gnuplot instance.
2995 3000
2996 3001 2002-06-21 Fernando Perez <fperez@colorado.edu>
2997 3002
2998 3003 * IPython/numutils.py (exp_safe): new function, works around the
2999 3004 underflow problems in Numeric.
3000 3005 (log2): New fn. Safe log in base 2: returns exact integer answer
3001 3006 for exact integer powers of 2.
3002 3007
3003 3008 * IPython/Magic.py (get_py_filename): fixed it not expanding '~'
3004 3009 properly.
3005 3010
3006 3011 2002-06-20 Fernando Perez <fperez@colorado.edu>
3007 3012
3008 3013 * IPython/genutils.py (timing): new function like
3009 3014 Mathematica's. Similar to time_test, but returns more info.
3010 3015
3011 3016 2002-06-18 Fernando Perez <fperez@colorado.edu>
3012 3017
3013 3018 * IPython/Magic.py (Magic.magic_save): modified @save and @r
3014 3019 according to Mike Heeter's suggestions.
3015 3020
3016 3021 2002-06-16 Fernando Perez <fperez@colorado.edu>
3017 3022
3018 3023 * IPython/GnuplotRuntime.py: Massive overhaul to the Gnuplot
3019 3024 system. GnuplotMagic is gone as a user-directory option. New files
3020 3025 make it easier to use all the gnuplot stuff both from external
3021 3026 programs as well as from IPython. Had to rewrite part of
3022 3027 hardcopy() b/c of a strange bug: often the ps files simply don't
3023 3028 get created, and require a repeat of the command (often several
3024 3029 times).
3025 3030
3026 3031 * IPython/ultraTB.py (AutoFormattedTB.__call__): changed to
3027 3032 resolve output channel at call time, so that if sys.stderr has
3028 3033 been redirected by user this gets honored.
3029 3034
3030 3035 2002-06-13 Fernando Perez <fperez@colorado.edu>
3031 3036
3032 3037 * IPython/Shell.py (IPShell.__init__): Changed IPythonShell to
3033 3038 IPShell. Kept a copy with the old names to avoid breaking people's
3034 3039 embedded code.
3035 3040
3036 3041 * IPython/ipython: simplified it to the bare minimum after
3037 3042 Holger's suggestions. Added info about how to use it in
3038 3043 PYTHONSTARTUP.
3039 3044
3040 3045 * IPython/Shell.py (IPythonShell): changed the options passing
3041 3046 from a string with funky %s replacements to a straight list. Maybe
3042 3047 a bit more typing, but it follows sys.argv conventions, so there's
3043 3048 less special-casing to remember.
3044 3049
3045 3050 2002-06-12 Fernando Perez <fperez@colorado.edu>
3046 3051
3047 3052 * IPython/Magic.py (Magic.magic_r): new magic auto-repeat
3048 3053 command. Thanks to a suggestion by Mike Heeter.
3049 3054 (Magic.magic_pfile): added behavior to look at filenames if given
3050 3055 arg is not a defined object.
3051 3056 (Magic.magic_save): New @save function to save code snippets. Also
3052 3057 a Mike Heeter idea.
3053 3058
3054 3059 * IPython/UserConfig/GnuplotMagic.py (plot): Improvements to
3055 3060 plot() and replot(). Much more convenient now, especially for
3056 3061 interactive use.
3057 3062
3058 3063 * IPython/Magic.py (Magic.magic_run): Added .py automatically to
3059 3064 filenames.
3060 3065
3061 3066 2002-06-02 Fernando Perez <fperez@colorado.edu>
3062 3067
3063 3068 * IPython/Struct.py (Struct.__init__): modified to admit
3064 3069 initialization via another struct.
3065 3070
3066 3071 * IPython/genutils.py (SystemExec.__init__): New stateful
3067 3072 interface to xsys and bq. Useful for writing system scripts.
3068 3073
3069 3074 2002-05-30 Fernando Perez <fperez@colorado.edu>
3070 3075
3071 3076 * MANIFEST.in: Changed docfile selection to exclude all the lyx
3072 3077 documents. This will make the user download smaller (it's getting
3073 3078 too big).
3074 3079
3075 3080 2002-05-29 Fernando Perez <fperez@colorado.edu>
3076 3081
3077 3082 * IPython/iplib.py (_FakeModule.__init__): New class introduced to
3078 3083 fix problems with shelve and pickle. Seems to work, but I don't
3079 3084 know if corner cases break it. Thanks to Mike Heeter
3080 3085 <korora-AT-SDF.LONESTAR.ORG> for the bug reports and test cases.
3081 3086
3082 3087 2002-05-24 Fernando Perez <fperez@colorado.edu>
3083 3088
3084 3089 * IPython/Magic.py (Macro.__init__): fixed magics embedded in
3085 3090 macros having broken.
3086 3091
3087 3092 2002-05-21 Fernando Perez <fperez@colorado.edu>
3088 3093
3089 3094 * IPython/Magic.py (Magic.magic_logstart): fixed recently
3090 3095 introduced logging bug: all history before logging started was
3091 3096 being written one character per line! This came from the redesign
3092 3097 of the input history as a special list which slices to strings,
3093 3098 not to lists.
3094 3099
3095 3100 2002-05-20 Fernando Perez <fperez@colorado.edu>
3096 3101
3097 3102 * IPython/Prompts.py (CachedOutput.__init__): made the color table
3098 3103 be an attribute of all classes in this module. The design of these
3099 3104 classes needs some serious overhauling.
3100 3105
3101 3106 * IPython/DPyGetOpt.py (DPyGetOpt.setPosixCompliance): fixed bug
3102 3107 which was ignoring '_' in option names.
3103 3108
3104 3109 * IPython/ultraTB.py (FormattedTB.__init__): Changed
3105 3110 'Verbose_novars' to 'Context' and made it the new default. It's a
3106 3111 bit more readable and also safer than verbose.
3107 3112
3108 3113 * IPython/PyColorize.py (Parser.__call__): Fixed coloring of
3109 3114 triple-quoted strings.
3110 3115
3111 3116 * IPython/OInspect.py (__all__): new module exposing the object
3112 3117 introspection facilities. Now the corresponding magics are dummy
3113 3118 wrappers around this. Having this module will make it much easier
3114 3119 to put these functions into our modified pdb.
3115 3120 This new object inspector system uses the new colorizing module,
3116 3121 so source code and other things are nicely syntax highlighted.
3117 3122
3118 3123 2002-05-18 Fernando Perez <fperez@colorado.edu>
3119 3124
3120 3125 * IPython/ColorANSI.py: Split the coloring tools into a separate
3121 3126 module so I can use them in other code easier (they were part of
3122 3127 ultraTB).
3123 3128
3124 3129 2002-05-17 Fernando Perez <fperez@colorado.edu>
3125 3130
3126 3131 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
3127 3132 fixed it to set the global 'g' also to the called instance, as
3128 3133 long as 'g' was still a gnuplot instance (so it doesn't overwrite
3129 3134 user's 'g' variables).
3130 3135
3131 3136 * IPython/iplib.py (InteractiveShell.__init__): Added In/Out
3132 3137 global variables (aliases to _ih,_oh) so that users which expect
3133 3138 In[5] or Out[7] to work aren't unpleasantly surprised.
3134 3139 (InputList.__getslice__): new class to allow executing slices of
3135 3140 input history directly. Very simple class, complements the use of
3136 3141 macros.
3137 3142
3138 3143 2002-05-16 Fernando Perez <fperez@colorado.edu>
3139 3144
3140 3145 * setup.py (docdirbase): make doc directory be just doc/IPython
3141 3146 without version numbers, it will reduce clutter for users.
3142 3147
3143 3148 * IPython/Magic.py (Magic.magic_run): Add explicit local dict to
3144 3149 execfile call to prevent possible memory leak. See for details:
3145 3150 http://mail.python.org/pipermail/python-list/2002-February/088476.html
3146 3151
3147 3152 2002-05-15 Fernando Perez <fperez@colorado.edu>
3148 3153
3149 3154 * IPython/Magic.py (Magic.magic_psource): made the object
3150 3155 introspection names be more standard: pdoc, pdef, pfile and
3151 3156 psource. They all print/page their output, and it makes
3152 3157 remembering them easier. Kept old names for compatibility as
3153 3158 aliases.
3154 3159
3155 3160 2002-05-14 Fernando Perez <fperez@colorado.edu>
3156 3161
3157 3162 * IPython/UserConfig/GnuplotMagic.py: I think I finally understood
3158 3163 what the mouse problem was. The trick is to use gnuplot with temp
3159 3164 files and NOT with pipes (for data communication), because having
3160 3165 both pipes and the mouse on is bad news.
3161 3166
3162 3167 2002-05-13 Fernando Perez <fperez@colorado.edu>
3163 3168
3164 3169 * IPython/Magic.py (Magic._ofind): fixed namespace order search
3165 3170 bug. Information would be reported about builtins even when
3166 3171 user-defined functions overrode them.
3167 3172
3168 3173 2002-05-11 Fernando Perez <fperez@colorado.edu>
3169 3174
3170 3175 * IPython/__init__.py (__all__): removed FlexCompleter from
3171 3176 __all__ so that things don't fail in platforms without readline.
3172 3177
3173 3178 2002-05-10 Fernando Perez <fperez@colorado.edu>
3174 3179
3175 3180 * IPython/__init__.py (__all__): removed numutils from __all__ b/c
3176 3181 it requires Numeric, effectively making Numeric a dependency for
3177 3182 IPython.
3178 3183
3179 3184 * Released 0.2.13
3180 3185
3181 3186 * IPython/Magic.py (Magic.magic_prun): big overhaul to the
3182 3187 profiler interface. Now all the major options from the profiler
3183 3188 module are directly supported in IPython, both for single
3184 3189 expressions (@prun) and for full programs (@run -p).
3185 3190
3186 3191 2002-05-09 Fernando Perez <fperez@colorado.edu>
3187 3192
3188 3193 * IPython/Magic.py (Magic.magic_doc): fixed to show docstrings of
3189 3194 magic properly formatted for screen.
3190 3195
3191 3196 * setup.py (make_shortcut): Changed things to put pdf version in
3192 3197 doc/ instead of doc/manual (had to change lyxport a bit).
3193 3198
3194 3199 * IPython/Magic.py (Profile.string_stats): made profile runs go
3195 3200 through pager (they are long and a pager allows searching, saving,
3196 3201 etc.)
3197 3202
3198 3203 2002-05-08 Fernando Perez <fperez@colorado.edu>
3199 3204
3200 3205 * Released 0.2.12
3201 3206
3202 3207 2002-05-06 Fernando Perez <fperez@colorado.edu>
3203 3208
3204 3209 * IPython/Magic.py (Magic.magic_hist): small bug fixed (recently
3205 3210 introduced); 'hist n1 n2' was broken.
3206 3211 (Magic.magic_pdb): added optional on/off arguments to @pdb
3207 3212 (Magic.magic_run): added option -i to @run, which executes code in
3208 3213 the IPython namespace instead of a clean one. Also added @irun as
3209 3214 an alias to @run -i.
3210 3215
3211 3216 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
3212 3217 fixed (it didn't really do anything, the namespaces were wrong).
3213 3218
3214 3219 * IPython/Debugger.py (__init__): Added workaround for python 2.1
3215 3220
3216 3221 * IPython/__init__.py (__all__): Fixed package namespace, now
3217 3222 'import IPython' does give access to IPython.<all> as
3218 3223 expected. Also renamed __release__ to Release.
3219 3224
3220 3225 * IPython/Debugger.py (__license__): created new Pdb class which
3221 3226 functions like a drop-in for the normal pdb.Pdb but does NOT
3222 3227 import readline by default. This way it doesn't muck up IPython's
3223 3228 readline handling, and now tab-completion finally works in the
3224 3229 debugger -- sort of. It completes things globally visible, but the
3225 3230 completer doesn't track the stack as pdb walks it. That's a bit
3226 3231 tricky, and I'll have to implement it later.
3227 3232
3228 3233 2002-05-05 Fernando Perez <fperez@colorado.edu>
3229 3234
3230 3235 * IPython/Magic.py (Magic.magic_oinfo): fixed formatting bug for
3231 3236 magic docstrings when printed via ? (explicit \'s were being
3232 3237 printed).
3233 3238
3234 3239 * IPython/ipmaker.py (make_IPython): fixed namespace
3235 3240 identification bug. Now variables loaded via logs or command-line
3236 3241 files are recognized in the interactive namespace by @who.
3237 3242
3238 3243 * IPython/iplib.py (InteractiveShell.safe_execfile): Fixed bug in
3239 3244 log replay system stemming from the string form of Structs.
3240 3245
3241 3246 * IPython/Magic.py (Macro.__init__): improved macros to properly
3242 3247 handle magic commands in them.
3243 3248 (Magic.magic_logstart): usernames are now expanded so 'logstart
3244 3249 ~/mylog' now works.
3245 3250
3246 3251 * IPython/iplib.py (complete): fixed bug where paths starting with
3247 3252 '/' would be completed as magic names.
3248 3253
3249 3254 2002-05-04 Fernando Perez <fperez@colorado.edu>
3250 3255
3251 3256 * IPython/Magic.py (Magic.magic_run): added options -p and -f to
3252 3257 allow running full programs under the profiler's control.
3253 3258
3254 3259 * IPython/ultraTB.py (FormattedTB.__init__): Added Verbose_novars
3255 3260 mode to report exceptions verbosely but without formatting
3256 3261 variables. This addresses the issue of ipython 'freezing' (it's
3257 3262 not frozen, but caught in an expensive formatting loop) when huge
3258 3263 variables are in the context of an exception.
3259 3264 (VerboseTB.text): Added '--->' markers at line where exception was
3260 3265 triggered. Much clearer to read, especially in NoColor modes.
3261 3266
3262 3267 * IPython/Magic.py (Magic.magic_run): bugfix: -n option had been
3263 3268 implemented in reverse when changing to the new parse_options().
3264 3269
3265 3270 2002-05-03 Fernando Perez <fperez@colorado.edu>
3266 3271
3267 3272 * IPython/Magic.py (Magic.parse_options): new function so that
3268 3273 magics can parse options easier.
3269 3274 (Magic.magic_prun): new function similar to profile.run(),
3270 3275 suggested by Chris Hart.
3271 3276 (Magic.magic_cd): fixed behavior so that it only changes if
3272 3277 directory actually is in history.
3273 3278
3274 3279 * IPython/usage.py (__doc__): added information about potential
3275 3280 slowness of Verbose exception mode when there are huge data
3276 3281 structures to be formatted (thanks to Archie Paulson).
3277 3282
3278 3283 * IPython/ipmaker.py (make_IPython): Changed default logging
3279 3284 (when simply called with -log) to use curr_dir/ipython.log in
3280 3285 rotate mode. Fixed crash which was occuring with -log before
3281 3286 (thanks to Jim Boyle).
3282 3287
3283 3288 2002-05-01 Fernando Perez <fperez@colorado.edu>
3284 3289
3285 3290 * Released 0.2.11 for these fixes (mainly the ultraTB one which
3286 3291 was nasty -- though somewhat of a corner case).
3287 3292
3288 3293 * IPython/ultraTB.py (AutoFormattedTB.text): renamed __text to
3289 3294 text (was a bug).
3290 3295
3291 3296 2002-04-30 Fernando Perez <fperez@colorado.edu>
3292 3297
3293 3298 * IPython/UserConfig/GnuplotMagic.py (magic_gp): Minor fix to add
3294 3299 a print after ^D or ^C from the user so that the In[] prompt
3295 3300 doesn't over-run the gnuplot one.
3296 3301
3297 3302 2002-04-29 Fernando Perez <fperez@colorado.edu>
3298 3303
3299 3304 * Released 0.2.10
3300 3305
3301 3306 * IPython/__release__.py (version): get date dynamically.
3302 3307
3303 3308 * Misc. documentation updates thanks to Arnd's comments. Also ran
3304 3309 a full spellcheck on the manual (hadn't been done in a while).
3305 3310
3306 3311 2002-04-27 Fernando Perez <fperez@colorado.edu>
3307 3312
3308 3313 * IPython/Magic.py (Magic.magic_logstart): Fixed bug where
3309 3314 starting a log in mid-session would reset the input history list.
3310 3315
3311 3316 2002-04-26 Fernando Perez <fperez@colorado.edu>
3312 3317
3313 3318 * IPython/iplib.py (InteractiveShell.wait): Fixed bug where not
3314 3319 all files were being included in an update. Now anything in
3315 3320 UserConfig that matches [A-Za-z]*.py will go (this excludes
3316 3321 __init__.py)
3317 3322
3318 3323 2002-04-25 Fernando Perez <fperez@colorado.edu>
3319 3324
3320 3325 * IPython/iplib.py (InteractiveShell.__init__): Added __IPYTHON__
3321 3326 to __builtins__ so that any form of embedded or imported code can
3322 3327 test for being inside IPython.
3323 3328
3324 3329 * IPython/UserConfig/GnuplotMagic.py: (magic_gp_set_instance):
3325 3330 changed to GnuplotMagic because it's now an importable module,
3326 3331 this makes the name follow that of the standard Gnuplot module.
3327 3332 GnuplotMagic can now be loaded at any time in mid-session.
3328 3333
3329 3334 2002-04-24 Fernando Perez <fperez@colorado.edu>
3330 3335
3331 3336 * IPython/numutils.py: removed SIUnits. It doesn't properly set
3332 3337 the globals (IPython has its own namespace) and the
3333 3338 PhysicalQuantity stuff is much better anyway.
3334 3339
3335 3340 * IPython/UserConfig/example-gnuplot.py (g2): Added gnuplot
3336 3341 embedding example to standard user directory for
3337 3342 distribution. Also put it in the manual.
3338 3343
3339 3344 * IPython/numutils.py (gnuplot_exec): Changed to take a gnuplot
3340 3345 instance as first argument (so it doesn't rely on some obscure
3341 3346 hidden global).
3342 3347
3343 3348 * IPython/UserConfig/ipythonrc.py: put () back in accepted
3344 3349 delimiters. While it prevents ().TAB from working, it allows
3345 3350 completions in open (... expressions. This is by far a more common
3346 3351 case.
3347 3352
3348 3353 2002-04-23 Fernando Perez <fperez@colorado.edu>
3349 3354
3350 3355 * IPython/Extensions/InterpreterPasteInput.py: new
3351 3356 syntax-processing module for pasting lines with >>> or ... at the
3352 3357 start.
3353 3358
3354 3359 * IPython/Extensions/PhysicalQ_Interactive.py
3355 3360 (PhysicalQuantityInteractive.__int__): fixed to work with either
3356 3361 Numeric or math.
3357 3362
3358 3363 * IPython/UserConfig/ipythonrc-numeric.py: reorganized the
3359 3364 provided profiles. Now we have:
3360 3365 -math -> math module as * and cmath with its own namespace.
3361 3366 -numeric -> Numeric as *, plus gnuplot & grace
3362 3367 -physics -> same as before
3363 3368
3364 3369 * IPython/Magic.py (Magic.magic_magic): Fixed bug where
3365 3370 user-defined magics wouldn't be found by @magic if they were
3366 3371 defined as class methods. Also cleaned up the namespace search
3367 3372 logic and the string building (to use %s instead of many repeated
3368 3373 string adds).
3369 3374
3370 3375 * IPython/UserConfig/example-magic.py (magic_foo): updated example
3371 3376 of user-defined magics to operate with class methods (cleaner, in
3372 3377 line with the gnuplot code).
3373 3378
3374 3379 2002-04-22 Fernando Perez <fperez@colorado.edu>
3375 3380
3376 3381 * setup.py: updated dependency list so that manual is updated when
3377 3382 all included files change.
3378 3383
3379 3384 * IPython/ipmaker.py (make_IPython): Fixed bug which was ignoring
3380 3385 the delimiter removal option (the fix is ugly right now).
3381 3386
3382 3387 * IPython/UserConfig/ipythonrc-physics.py: simplified not to load
3383 3388 all of the math profile (quicker loading, no conflict between
3384 3389 g-9.8 and g-gnuplot).
3385 3390
3386 3391 * IPython/CrashHandler.py (CrashHandler.__call__): changed default
3387 3392 name of post-mortem files to IPython_crash_report.txt.
3388 3393
3389 3394 * Cleanup/update of the docs. Added all the new readline info and
3390 3395 formatted all lists as 'real lists'.
3391 3396
3392 3397 * IPython/ipmaker.py (make_IPython): removed now-obsolete
3393 3398 tab-completion options, since the full readline parse_and_bind is
3394 3399 now accessible.
3395 3400
3396 3401 * IPython/iplib.py (InteractiveShell.init_readline): Changed
3397 3402 handling of readline options. Now users can specify any string to
3398 3403 be passed to parse_and_bind(), as well as the delimiters to be
3399 3404 removed.
3400 3405 (InteractiveShell.__init__): Added __name__ to the global
3401 3406 namespace so that things like Itpl which rely on its existence
3402 3407 don't crash.
3403 3408 (InteractiveShell._prefilter): Defined the default with a _ so
3404 3409 that prefilter() is easier to override, while the default one
3405 3410 remains available.
3406 3411
3407 3412 2002-04-18 Fernando Perez <fperez@colorado.edu>
3408 3413
3409 3414 * Added information about pdb in the docs.
3410 3415
3411 3416 2002-04-17 Fernando Perez <fperez@colorado.edu>
3412 3417
3413 3418 * IPython/ipmaker.py (make_IPython): added rc_override option to
3414 3419 allow passing config options at creation time which may override
3415 3420 anything set in the config files or command line. This is
3416 3421 particularly useful for configuring embedded instances.
3417 3422
3418 3423 2002-04-15 Fernando Perez <fperez@colorado.edu>
3419 3424
3420 3425 * IPython/Logger.py (Logger.log): Fixed a nasty bug which could
3421 3426 crash embedded instances because of the input cache falling out of
3422 3427 sync with the output counter.
3423 3428
3424 3429 * IPython/Shell.py (IPythonShellEmbed.__init__): added a debug
3425 3430 mode which calls pdb after an uncaught exception in IPython itself.
3426 3431
3427 3432 2002-04-14 Fernando Perez <fperez@colorado.edu>
3428 3433
3429 3434 * IPython/iplib.py (InteractiveShell.showtraceback): pdb mucks up
3430 3435 readline, fix it back after each call.
3431 3436
3432 3437 * IPython/ultraTB.py (AutoFormattedTB.__text): made text a private
3433 3438 method to force all access via __call__(), which guarantees that
3434 3439 traceback references are properly deleted.
3435 3440
3436 3441 * IPython/Prompts.py (CachedOutput._display): minor fixes to
3437 3442 improve printing when pprint is in use.
3438 3443
3439 3444 2002-04-13 Fernando Perez <fperez@colorado.edu>
3440 3445
3441 3446 * IPython/Shell.py (IPythonShellEmbed.__call__): SystemExit
3442 3447 exceptions aren't caught anymore. If the user triggers one, he
3443 3448 should know why he's doing it and it should go all the way up,
3444 3449 just like any other exception. So now @abort will fully kill the
3445 3450 embedded interpreter and the embedding code (unless that happens
3446 3451 to catch SystemExit).
3447 3452
3448 3453 * IPython/ultraTB.py (VerboseTB.__init__): added a call_pdb flag
3449 3454 and a debugger() method to invoke the interactive pdb debugger
3450 3455 after printing exception information. Also added the corresponding
3451 3456 -pdb option and @pdb magic to control this feature, and updated
3452 3457 the docs. After a suggestion from Christopher Hart
3453 3458 (hart-AT-caltech.edu).
3454 3459
3455 3460 2002-04-12 Fernando Perez <fperez@colorado.edu>
3456 3461
3457 3462 * IPython/Shell.py (IPythonShellEmbed.__init__): modified to use
3458 3463 the exception handlers defined by the user (not the CrashHandler)
3459 3464 so that user exceptions don't trigger an ipython bug report.
3460 3465
3461 3466 * IPython/ultraTB.py (ColorTB.__init__): made the color scheme
3462 3467 configurable (it should have always been so).
3463 3468
3464 3469 2002-03-26 Fernando Perez <fperez@colorado.edu>
3465 3470
3466 3471 * IPython/Shell.py (IPythonShellEmbed.__call__): many changes here
3467 3472 and there to fix embedding namespace issues. This should all be
3468 3473 done in a more elegant way.
3469 3474
3470 3475 2002-03-25 Fernando Perez <fperez@colorado.edu>
3471 3476
3472 3477 * IPython/genutils.py (get_home_dir): Try to make it work under
3473 3478 win9x also.
3474 3479
3475 3480 2002-03-20 Fernando Perez <fperez@colorado.edu>
3476 3481
3477 3482 * IPython/Shell.py (IPythonShellEmbed.__init__): leave
3478 3483 sys.displayhook untouched upon __init__.
3479 3484
3480 3485 2002-03-19 Fernando Perez <fperez@colorado.edu>
3481 3486
3482 3487 * Released 0.2.9 (for embedding bug, basically).
3483 3488
3484 3489 * IPython/Shell.py (IPythonShellEmbed.__call__): Trap SystemExit
3485 3490 exceptions so that enclosing shell's state can be restored.
3486 3491
3487 3492 * Changed magic_gnuplot.py to magic-gnuplot.py to standardize
3488 3493 naming conventions in the .ipython/ dir.
3489 3494
3490 3495 * IPython/iplib.py (InteractiveShell.init_readline): removed '-'
3491 3496 from delimiters list so filenames with - in them get expanded.
3492 3497
3493 3498 * IPython/Shell.py (IPythonShellEmbed.__call__): fixed bug with
3494 3499 sys.displayhook not being properly restored after an embedded call.
3495 3500
3496 3501 2002-03-18 Fernando Perez <fperez@colorado.edu>
3497 3502
3498 3503 * Released 0.2.8
3499 3504
3500 3505 * IPython/iplib.py (InteractiveShell.user_setup): fixed bug where
3501 3506 some files weren't being included in a -upgrade.
3502 3507 (InteractiveShell.init_readline): Added 'set show-all-if-ambiguous
3503 3508 on' so that the first tab completes.
3504 3509 (InteractiveShell.handle_magic): fixed bug with spaces around
3505 3510 quotes breaking many magic commands.
3506 3511
3507 3512 * setup.py: added note about ignoring the syntax error messages at
3508 3513 installation.
3509 3514
3510 3515 * IPython/UserConfig/magic_gnuplot.py (magic_gp): finished
3511 3516 streamlining the gnuplot interface, now there's only one magic @gp.
3512 3517
3513 3518 2002-03-17 Fernando Perez <fperez@colorado.edu>
3514 3519
3515 3520 * IPython/UserConfig/magic_gnuplot.py: new name for the
3516 3521 example-magic_pm.py file. Much enhanced system, now with a shell
3517 3522 for communicating directly with gnuplot, one command at a time.
3518 3523
3519 3524 * IPython/Magic.py (Magic.magic_run): added option -n to prevent
3520 3525 setting __name__=='__main__'.
3521 3526
3522 3527 * IPython/UserConfig/example-magic_pm.py (magic_pm): Added
3523 3528 mini-shell for accessing gnuplot from inside ipython. Should
3524 3529 extend it later for grace access too. Inspired by Arnd's
3525 3530 suggestion.
3526 3531
3527 3532 * IPython/iplib.py (InteractiveShell.handle_magic): fixed bug when
3528 3533 calling magic functions with () in their arguments. Thanks to Arnd
3529 3534 Baecker for pointing this to me.
3530 3535
3531 3536 * IPython/numutils.py (sum_flat): fixed bug. Would recurse
3532 3537 infinitely for integer or complex arrays (only worked with floats).
3533 3538
3534 3539 2002-03-16 Fernando Perez <fperez@colorado.edu>
3535 3540
3536 3541 * setup.py: Merged setup and setup_windows into a single script
3537 3542 which properly handles things for windows users.
3538 3543
3539 3544 2002-03-15 Fernando Perez <fperez@colorado.edu>
3540 3545
3541 3546 * Big change to the manual: now the magics are all automatically
3542 3547 documented. This information is generated from their docstrings
3543 3548 and put in a latex file included by the manual lyx file. This way
3544 3549 we get always up to date information for the magics. The manual
3545 3550 now also has proper version information, also auto-synced.
3546 3551
3547 3552 For this to work, an undocumented --magic_docstrings option was added.
3548 3553
3549 3554 2002-03-13 Fernando Perez <fperez@colorado.edu>
3550 3555
3551 3556 * IPython/ultraTB.py (TermColors): fixed problem with dark colors
3552 3557 under CDE terminals. An explicit ;2 color reset is needed in the escapes.
3553 3558
3554 3559 2002-03-12 Fernando Perez <fperez@colorado.edu>
3555 3560
3556 3561 * IPython/ultraTB.py (TermColors): changed color escapes again to
3557 3562 fix the (old, reintroduced) line-wrapping bug. Basically, if
3558 3563 \001..\002 aren't given in the color escapes, lines get wrapped
3559 3564 weirdly. But giving those screws up old xterms and emacs terms. So
3560 3565 I added some logic for emacs terms to be ok, but I can't identify old
3561 3566 xterms separately ($TERM=='xterm' for many terminals, like konsole).
3562 3567
3563 3568 2002-03-10 Fernando Perez <fperez@colorado.edu>
3564 3569
3565 3570 * IPython/usage.py (__doc__): Various documentation cleanups and
3566 3571 updates, both in usage docstrings and in the manual.
3567 3572
3568 3573 * IPython/Prompts.py (CachedOutput.set_colors): cleanups for
3569 3574 handling of caching. Set minimum acceptabe value for having a
3570 3575 cache at 20 values.
3571 3576
3572 3577 * IPython/iplib.py (InteractiveShell.user_setup): moved the
3573 3578 install_first_time function to a method, renamed it and added an
3574 3579 'upgrade' mode. Now people can update their config directory with
3575 3580 a simple command line switch (-upgrade, also new).
3576 3581
3577 3582 * IPython/Magic.py (Magic.magic_pfile): Made @pfile an alias to
3578 3583 @file (convenient for automagic users under Python >= 2.2).
3579 3584 Removed @files (it seemed more like a plural than an abbrev. of
3580 3585 'file show').
3581 3586
3582 3587 * IPython/iplib.py (install_first_time): Fixed crash if there were
3583 3588 backup files ('~') in .ipython/ install directory.
3584 3589
3585 3590 * IPython/ipmaker.py (make_IPython): fixes for new prompt
3586 3591 system. Things look fine, but these changes are fairly
3587 3592 intrusive. Test them for a few days.
3588 3593
3589 3594 * IPython/Prompts.py (CachedOutput.__init__): Massive rewrite of
3590 3595 the prompts system. Now all in/out prompt strings are user
3591 3596 controllable. This is particularly useful for embedding, as one
3592 3597 can tag embedded instances with particular prompts.
3593 3598
3594 3599 Also removed global use of sys.ps1/2, which now allows nested
3595 3600 embeddings without any problems. Added command-line options for
3596 3601 the prompt strings.
3597 3602
3598 3603 2002-03-08 Fernando Perez <fperez@colorado.edu>
3599 3604
3600 3605 * IPython/UserConfig/example-embed-short.py (ipshell): added
3601 3606 example file with the bare minimum code for embedding.
3602 3607
3603 3608 * IPython/Shell.py (IPythonShellEmbed.set_dummy_mode): added
3604 3609 functionality for the embeddable shell to be activated/deactivated
3605 3610 either globally or at each call.
3606 3611
3607 3612 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixes the problem of
3608 3613 rewriting the prompt with '--->' for auto-inputs with proper
3609 3614 coloring. Now the previous UGLY hack in handle_auto() is gone, and
3610 3615 this is handled by the prompts class itself, as it should.
3611 3616
3612 3617 2002-03-05 Fernando Perez <fperez@colorado.edu>
3613 3618
3614 3619 * IPython/Magic.py (Magic.magic_logstart): Changed @log to
3615 3620 @logstart to avoid name clashes with the math log function.
3616 3621
3617 3622 * Big updates to X/Emacs section of the manual.
3618 3623
3619 3624 * Removed ipython_emacs. Milan explained to me how to pass
3620 3625 arguments to ipython through Emacs. Some day I'm going to end up
3621 3626 learning some lisp...
3622 3627
3623 3628 2002-03-04 Fernando Perez <fperez@colorado.edu>
3624 3629
3625 3630 * IPython/ipython_emacs: Created script to be used as the
3626 3631 py-python-command Emacs variable so we can pass IPython
3627 3632 parameters. I can't figure out how to tell Emacs directly to pass
3628 3633 parameters to IPython, so a dummy shell script will do it.
3629 3634
3630 3635 Other enhancements made for things to work better under Emacs'
3631 3636 various types of terminals. Many thanks to Milan Zamazal
3632 3637 <pdm-AT-zamazal.org> for all the suggestions and pointers.
3633 3638
3634 3639 2002-03-01 Fernando Perez <fperez@colorado.edu>
3635 3640
3636 3641 * IPython/ipmaker.py (make_IPython): added a --readline! option so
3637 3642 that loading of readline is now optional. This gives better
3638 3643 control to emacs users.
3639 3644
3640 3645 * IPython/ultraTB.py (__date__): Modified color escape sequences
3641 3646 and now things work fine under xterm and in Emacs' term buffers
3642 3647 (though not shell ones). Well, in emacs you get colors, but all
3643 3648 seem to be 'light' colors (no difference between dark and light
3644 3649 ones). But the garbage chars are gone, and also in xterms. It
3645 3650 seems that now I'm using 'cleaner' ansi sequences.
3646 3651
3647 3652 2002-02-21 Fernando Perez <fperez@colorado.edu>
3648 3653
3649 3654 * Released 0.2.7 (mainly to publish the scoping fix).
3650 3655
3651 3656 * IPython/Logger.py (Logger.logstate): added. A corresponding
3652 3657 @logstate magic was created.
3653 3658
3654 3659 * IPython/Magic.py: fixed nested scoping problem under Python
3655 3660 2.1.x (automagic wasn't working).
3656 3661
3657 3662 2002-02-20 Fernando Perez <fperez@colorado.edu>
3658 3663
3659 3664 * Released 0.2.6.
3660 3665
3661 3666 * IPython/OutputTrap.py (OutputTrap.__init__): added a 'quiet'
3662 3667 option so that logs can come out without any headers at all.
3663 3668
3664 3669 * IPython/UserConfig/ipythonrc-scipy.py: created a profile for
3665 3670 SciPy.
3666 3671
3667 3672 * IPython/iplib.py (InteractiveShell.embed_mainloop): Changed so
3668 3673 that embedded IPython calls don't require vars() to be explicitly
3669 3674 passed. Now they are extracted from the caller's frame (code
3670 3675 snatched from Eric Jones' weave). Added better documentation to
3671 3676 the section on embedding and the example file.
3672 3677
3673 3678 * IPython/genutils.py (page): Changed so that under emacs, it just
3674 3679 prints the string. You can then page up and down in the emacs
3675 3680 buffer itself. This is how the builtin help() works.
3676 3681
3677 3682 * IPython/Prompts.py (CachedOutput.__call__): Fixed issue with
3678 3683 macro scoping: macros need to be executed in the user's namespace
3679 3684 to work as if they had been typed by the user.
3680 3685
3681 3686 * IPython/Magic.py (Magic.magic_macro): Changed macros so they
3682 3687 execute automatically (no need to type 'exec...'). They then
3683 3688 behave like 'true macros'. The printing system was also modified
3684 3689 for this to work.
3685 3690
3686 3691 2002-02-19 Fernando Perez <fperez@colorado.edu>
3687 3692
3688 3693 * IPython/genutils.py (page_file): new function for paging files
3689 3694 in an OS-independent way. Also necessary for file viewing to work
3690 3695 well inside Emacs buffers.
3691 3696 (page): Added checks for being in an emacs buffer.
3692 3697 (page): fixed bug for Windows ($TERM isn't set in Windows). Fixed
3693 3698 same bug in iplib.
3694 3699
3695 3700 2002-02-18 Fernando Perez <fperez@colorado.edu>
3696 3701
3697 3702 * IPython/iplib.py (InteractiveShell.init_readline): modified use
3698 3703 of readline so that IPython can work inside an Emacs buffer.
3699 3704
3700 3705 * IPython/ultraTB.py (AutoFormattedTB.__call__): some fixes to
3701 3706 method signatures (they weren't really bugs, but it looks cleaner
3702 3707 and keeps PyChecker happy).
3703 3708
3704 3709 * IPython/ipmaker.py (make_IPython): added hooks Struct to __IP
3705 3710 for implementing various user-defined hooks. Currently only
3706 3711 display is done.
3707 3712
3708 3713 * IPython/Prompts.py (CachedOutput._display): changed display
3709 3714 functions so that they can be dynamically changed by users easily.
3710 3715
3711 3716 * IPython/Extensions/numeric_formats.py (num_display): added an
3712 3717 extension for printing NumPy arrays in flexible manners. It
3713 3718 doesn't do anything yet, but all the structure is in
3714 3719 place. Ultimately the plan is to implement output format control
3715 3720 like in Octave.
3716 3721
3717 3722 * IPython/Magic.py (Magic.lsmagic): changed so that bound magic
3718 3723 methods are found at run-time by all the automatic machinery.
3719 3724
3720 3725 2002-02-17 Fernando Perez <fperez@colorado.edu>
3721 3726
3722 3727 * setup_Windows.py (make_shortcut): documented. Cleaned up the
3723 3728 whole file a little.
3724 3729
3725 3730 * ToDo: closed this document. Now there's a new_design.lyx
3726 3731 document for all new ideas. Added making a pdf of it for the
3727 3732 end-user distro.
3728 3733
3729 3734 * IPython/Logger.py (Logger.switch_log): Created this to replace
3730 3735 logon() and logoff(). It also fixes a nasty crash reported by
3731 3736 Philip Hisley <compsys-AT-starpower.net>. Many thanks to him.
3732 3737
3733 3738 * IPython/iplib.py (complete): got auto-completion to work with
3734 3739 automagic (I had wanted this for a long time).
3735 3740
3736 3741 * IPython/Magic.py (Magic.magic_files): Added @files as an alias
3737 3742 to @file, since file() is now a builtin and clashes with automagic
3738 3743 for @file.
3739 3744
3740 3745 * Made some new files: Prompts, CrashHandler, Magic, Logger. All
3741 3746 of this was previously in iplib, which had grown to more than 2000
3742 3747 lines, way too long. No new functionality, but it makes managing
3743 3748 the code a bit easier.
3744 3749
3745 3750 * IPython/iplib.py (IPythonCrashHandler.__call__): Added version
3746 3751 information to crash reports.
3747 3752
3748 3753 2002-02-12 Fernando Perez <fperez@colorado.edu>
3749 3754
3750 3755 * Released 0.2.5.
3751 3756
3752 3757 2002-02-11 Fernando Perez <fperez@colorado.edu>
3753 3758
3754 3759 * Wrote a relatively complete Windows installer. It puts
3755 3760 everything in place, creates Start Menu entries and fixes the
3756 3761 color issues. Nothing fancy, but it works.
3757 3762
3758 3763 2002-02-10 Fernando Perez <fperez@colorado.edu>
3759 3764
3760 3765 * IPython/iplib.py (InteractiveShell.safe_execfile): added an
3761 3766 os.path.expanduser() call so that we can type @run ~/myfile.py and
3762 3767 have thigs work as expected.
3763 3768
3764 3769 * IPython/genutils.py (page): fixed exception handling so things
3765 3770 work both in Unix and Windows correctly. Quitting a pager triggers
3766 3771 an IOError/broken pipe in Unix, and in windows not finding a pager
3767 3772 is also an IOError, so I had to actually look at the return value
3768 3773 of the exception, not just the exception itself. Should be ok now.
3769 3774
3770 3775 * IPython/ultraTB.py (ColorSchemeTable.set_active_scheme):
3771 3776 modified to allow case-insensitive color scheme changes.
3772 3777
3773 3778 2002-02-09 Fernando Perez <fperez@colorado.edu>
3774 3779
3775 3780 * IPython/genutils.py (native_line_ends): new function to leave
3776 3781 user config files with os-native line-endings.
3777 3782
3778 3783 * README and manual updates.
3779 3784
3780 3785 * IPython/genutils.py: fixed unicode bug: use types.StringTypes
3781 3786 instead of StringType to catch Unicode strings.
3782 3787
3783 3788 * IPython/genutils.py (filefind): fixed bug for paths with
3784 3789 embedded spaces (very common in Windows).
3785 3790
3786 3791 * IPython/ipmaker.py (make_IPython): added a '.ini' to the rc
3787 3792 files under Windows, so that they get automatically associated
3788 3793 with a text editor. Windows makes it a pain to handle
3789 3794 extension-less files.
3790 3795
3791 3796 * IPython/iplib.py (InteractiveShell.init_readline): Made the
3792 3797 warning about readline only occur for Posix. In Windows there's no
3793 3798 way to get readline, so why bother with the warning.
3794 3799
3795 3800 * IPython/Struct.py (Struct.__str__): fixed to use self.__dict__
3796 3801 for __str__ instead of dir(self), since dir() changed in 2.2.
3797 3802
3798 3803 * Ported to Windows! Tested on XP, I suspect it should work fine
3799 3804 on NT/2000, but I don't think it will work on 98 et al. That
3800 3805 series of Windows is such a piece of junk anyway that I won't try
3801 3806 porting it there. The XP port was straightforward, showed a few
3802 3807 bugs here and there (fixed all), in particular some string
3803 3808 handling stuff which required considering Unicode strings (which
3804 3809 Windows uses). This is good, but hasn't been too tested :) No
3805 3810 fancy installer yet, I'll put a note in the manual so people at
3806 3811 least make manually a shortcut.
3807 3812
3808 3813 * IPython/iplib.py (Magic.magic_colors): Unified the color options
3809 3814 into a single one, "colors". This now controls both prompt and
3810 3815 exception color schemes, and can be changed both at startup
3811 3816 (either via command-line switches or via ipythonrc files) and at
3812 3817 runtime, with @colors.
3813 3818 (Magic.magic_run): renamed @prun to @run and removed the old
3814 3819 @run. The two were too similar to warrant keeping both.
3815 3820
3816 3821 2002-02-03 Fernando Perez <fperez@colorado.edu>
3817 3822
3818 3823 * IPython/iplib.py (install_first_time): Added comment on how to
3819 3824 configure the color options for first-time users. Put a <return>
3820 3825 request at the end so that small-terminal users get a chance to
3821 3826 read the startup info.
3822 3827
3823 3828 2002-01-23 Fernando Perez <fperez@colorado.edu>
3824 3829
3825 3830 * IPython/iplib.py (CachedOutput.update): Changed output memory
3826 3831 variable names from _o,_oo,_ooo,_o<n> to simply _,__,___,_<n>. For
3827 3832 input history we still use _i. Did this b/c these variable are
3828 3833 very commonly used in interactive work, so the less we need to
3829 3834 type the better off we are.
3830 3835 (Magic.magic_prun): updated @prun to better handle the namespaces
3831 3836 the file will run in, including a fix for __name__ not being set
3832 3837 before.
3833 3838
3834 3839 2002-01-20 Fernando Perez <fperez@colorado.edu>
3835 3840
3836 3841 * IPython/ultraTB.py (VerboseTB.linereader): Fixed printing of
3837 3842 extra garbage for Python 2.2. Need to look more carefully into
3838 3843 this later.
3839 3844
3840 3845 2002-01-19 Fernando Perez <fperez@colorado.edu>
3841 3846
3842 3847 * IPython/iplib.py (InteractiveShell.showtraceback): fixed to
3843 3848 display SyntaxError exceptions properly formatted when they occur
3844 3849 (they can be triggered by imported code).
3845 3850
3846 3851 2002-01-18 Fernando Perez <fperez@colorado.edu>
3847 3852
3848 3853 * IPython/iplib.py (InteractiveShell.safe_execfile): now
3849 3854 SyntaxError exceptions are reported nicely formatted, instead of
3850 3855 spitting out only offset information as before.
3851 3856 (Magic.magic_prun): Added the @prun function for executing
3852 3857 programs with command line args inside IPython.
3853 3858
3854 3859 2002-01-16 Fernando Perez <fperez@colorado.edu>
3855 3860
3856 3861 * IPython/iplib.py (Magic.magic_hist): Changed @hist and @dhist
3857 3862 to *not* include the last item given in a range. This brings their
3858 3863 behavior in line with Python's slicing:
3859 3864 a[n1:n2] -> a[n1]...a[n2-1]
3860 3865 It may be a bit less convenient, but I prefer to stick to Python's
3861 3866 conventions *everywhere*, so users never have to wonder.
3862 3867 (Magic.magic_macro): Added @macro function to ease the creation of
3863 3868 macros.
3864 3869
3865 3870 2002-01-05 Fernando Perez <fperez@colorado.edu>
3866 3871
3867 3872 * Released 0.2.4.
3868 3873
3869 3874 * IPython/iplib.py (Magic.magic_pdef):
3870 3875 (InteractiveShell.safe_execfile): report magic lines and error
3871 3876 lines without line numbers so one can easily copy/paste them for
3872 3877 re-execution.
3873 3878
3874 3879 * Updated manual with recent changes.
3875 3880
3876 3881 * IPython/iplib.py (Magic.magic_oinfo): added constructor
3877 3882 docstring printing when class? is called. Very handy for knowing
3878 3883 how to create class instances (as long as __init__ is well
3879 3884 documented, of course :)
3880 3885 (Magic.magic_doc): print both class and constructor docstrings.
3881 3886 (Magic.magic_pdef): give constructor info if passed a class and
3882 3887 __call__ info for callable object instances.
3883 3888
3884 3889 2002-01-04 Fernando Perez <fperez@colorado.edu>
3885 3890
3886 3891 * Made deep_reload() off by default. It doesn't always work
3887 3892 exactly as intended, so it's probably safer to have it off. It's
3888 3893 still available as dreload() anyway, so nothing is lost.
3889 3894
3890 3895 2002-01-02 Fernando Perez <fperez@colorado.edu>
3891 3896
3892 3897 * Released 0.2.3 (contacted R.Singh at CU about biopython course,
3893 3898 so I wanted an updated release).
3894 3899
3895 3900 2001-12-27 Fernando Perez <fperez@colorado.edu>
3896 3901
3897 3902 * IPython/iplib.py (InteractiveShell.interact): Added the original
3898 3903 code from 'code.py' for this module in order to change the
3899 3904 handling of a KeyboardInterrupt. This was necessary b/c otherwise
3900 3905 the history cache would break when the user hit Ctrl-C, and
3901 3906 interact() offers no way to add any hooks to it.
3902 3907
3903 3908 2001-12-23 Fernando Perez <fperez@colorado.edu>
3904 3909
3905 3910 * setup.py: added check for 'MANIFEST' before trying to remove
3906 3911 it. Thanks to Sean Reifschneider.
3907 3912
3908 3913 2001-12-22 Fernando Perez <fperez@colorado.edu>
3909 3914
3910 3915 * Released 0.2.2.
3911 3916
3912 3917 * Finished (reasonably) writing the manual. Later will add the
3913 3918 python-standard navigation stylesheets, but for the time being
3914 3919 it's fairly complete. Distribution will include html and pdf
3915 3920 versions.
3916 3921
3917 3922 * Bugfix: '.' wasn't being added to sys.path. Thanks to Prabhu
3918 3923 (MayaVi author).
3919 3924
3920 3925 2001-12-21 Fernando Perez <fperez@colorado.edu>
3921 3926
3922 3927 * Released 0.2.1. Barring any nasty bugs, this is it as far as a
3923 3928 good public release, I think (with the manual and the distutils
3924 3929 installer). The manual can use some work, but that can go
3925 3930 slowly. Otherwise I think it's quite nice for end users. Next
3926 3931 summer, rewrite the guts of it...
3927 3932
3928 3933 * Changed format of ipythonrc files to use whitespace as the
3929 3934 separator instead of an explicit '='. Cleaner.
3930 3935
3931 3936 2001-12-20 Fernando Perez <fperez@colorado.edu>
3932 3937
3933 3938 * Started a manual in LyX. For now it's just a quick merge of the
3934 3939 various internal docstrings and READMEs. Later it may grow into a
3935 3940 nice, full-blown manual.
3936 3941
3937 3942 * Set up a distutils based installer. Installation should now be
3938 3943 trivially simple for end-users.
3939 3944
3940 3945 2001-12-11 Fernando Perez <fperez@colorado.edu>
3941 3946
3942 3947 * Released 0.2.0. First public release, announced it at
3943 3948 comp.lang.python. From now on, just bugfixes...
3944 3949
3945 3950 * Went through all the files, set copyright/license notices and
3946 3951 cleaned up things. Ready for release.
3947 3952
3948 3953 2001-12-10 Fernando Perez <fperez@colorado.edu>
3949 3954
3950 3955 * Changed the first-time installer not to use tarfiles. It's more
3951 3956 robust now and less unix-dependent. Also makes it easier for
3952 3957 people to later upgrade versions.
3953 3958
3954 3959 * Changed @exit to @abort to reflect the fact that it's pretty
3955 3960 brutal (a sys.exit()). The difference between @abort and Ctrl-D
3956 3961 becomes significant only when IPyhton is embedded: in that case,
3957 3962 C-D closes IPython only, but @abort kills the enclosing program
3958 3963 too (unless it had called IPython inside a try catching
3959 3964 SystemExit).
3960 3965
3961 3966 * Created Shell module which exposes the actuall IPython Shell
3962 3967 classes, currently the normal and the embeddable one. This at
3963 3968 least offers a stable interface we won't need to change when
3964 3969 (later) the internals are rewritten. That rewrite will be confined
3965 3970 to iplib and ipmaker, but the Shell interface should remain as is.
3966 3971
3967 3972 * Added embed module which offers an embeddable IPShell object,
3968 3973 useful to fire up IPython *inside* a running program. Great for
3969 3974 debugging or dynamical data analysis.
3970 3975
3971 3976 2001-12-08 Fernando Perez <fperez@colorado.edu>
3972 3977
3973 3978 * Fixed small bug preventing seeing info from methods of defined
3974 3979 objects (incorrect namespace in _ofind()).
3975 3980
3976 3981 * Documentation cleanup. Moved the main usage docstrings to a
3977 3982 separate file, usage.py (cleaner to maintain, and hopefully in the
3978 3983 future some perlpod-like way of producing interactive, man and
3979 3984 html docs out of it will be found).
3980 3985
3981 3986 * Added @profile to see your profile at any time.
3982 3987
3983 3988 * Added @p as an alias for 'print'. It's especially convenient if
3984 3989 using automagic ('p x' prints x).
3985 3990
3986 3991 * Small cleanups and fixes after a pychecker run.
3987 3992
3988 3993 * Changed the @cd command to handle @cd - and @cd -<n> for
3989 3994 visiting any directory in _dh.
3990 3995
3991 3996 * Introduced _dh, a history of visited directories. @dhist prints
3992 3997 it out with numbers.
3993 3998
3994 3999 2001-12-07 Fernando Perez <fperez@colorado.edu>
3995 4000
3996 4001 * Released 0.1.22
3997 4002
3998 4003 * Made initialization a bit more robust against invalid color
3999 4004 options in user input (exit, not traceback-crash).
4000 4005
4001 4006 * Changed the bug crash reporter to write the report only in the
4002 4007 user's .ipython directory. That way IPython won't litter people's
4003 4008 hard disks with crash files all over the place. Also print on
4004 4009 screen the necessary mail command.
4005 4010
4006 4011 * With the new ultraTB, implemented LightBG color scheme for light
4007 4012 background terminals. A lot of people like white backgrounds, so I
4008 4013 guess we should at least give them something readable.
4009 4014
4010 4015 2001-12-06 Fernando Perez <fperez@colorado.edu>
4011 4016
4012 4017 * Modified the structure of ultraTB. Now there's a proper class
4013 4018 for tables of color schemes which allow adding schemes easily and
4014 4019 switching the active scheme without creating a new instance every
4015 4020 time (which was ridiculous). The syntax for creating new schemes
4016 4021 is also cleaner. I think ultraTB is finally done, with a clean
4017 4022 class structure. Names are also much cleaner (now there's proper
4018 4023 color tables, no need for every variable to also have 'color' in
4019 4024 its name).
4020 4025
4021 4026 * Broke down genutils into separate files. Now genutils only
4022 4027 contains utility functions, and classes have been moved to their
4023 4028 own files (they had enough independent functionality to warrant
4024 4029 it): ConfigLoader, OutputTrap, Struct.
4025 4030
4026 4031 2001-12-05 Fernando Perez <fperez@colorado.edu>
4027 4032
4028 4033 * IPython turns 21! Released version 0.1.21, as a candidate for
4029 4034 public consumption. If all goes well, release in a few days.
4030 4035
4031 4036 * Fixed path bug (files in Extensions/ directory wouldn't be found
4032 4037 unless IPython/ was explicitly in sys.path).
4033 4038
4034 4039 * Extended the FlexCompleter class as MagicCompleter to allow
4035 4040 completion of @-starting lines.
4036 4041
4037 4042 * Created __release__.py file as a central repository for release
4038 4043 info that other files can read from.
4039 4044
4040 4045 * Fixed small bug in logging: when logging was turned on in
4041 4046 mid-session, old lines with special meanings (!@?) were being
4042 4047 logged without the prepended comment, which is necessary since
4043 4048 they are not truly valid python syntax. This should make session
4044 4049 restores produce less errors.
4045 4050
4046 4051 * The namespace cleanup forced me to make a FlexCompleter class
4047 4052 which is nothing but a ripoff of rlcompleter, but with selectable
4048 4053 namespace (rlcompleter only works in __main__.__dict__). I'll try
4049 4054 to submit a note to the authors to see if this change can be
4050 4055 incorporated in future rlcompleter releases (Dec.6: done)
4051 4056
4052 4057 * More fixes to namespace handling. It was a mess! Now all
4053 4058 explicit references to __main__.__dict__ are gone (except when
4054 4059 really needed) and everything is handled through the namespace
4055 4060 dicts in the IPython instance. We seem to be getting somewhere
4056 4061 with this, finally...
4057 4062
4058 4063 * Small documentation updates.
4059 4064
4060 4065 * Created the Extensions directory under IPython (with an
4061 4066 __init__.py). Put the PhysicalQ stuff there. This directory should
4062 4067 be used for all special-purpose extensions.
4063 4068
4064 4069 * File renaming:
4065 4070 ipythonlib --> ipmaker
4066 4071 ipplib --> iplib
4067 4072 This makes a bit more sense in terms of what these files actually do.
4068 4073
4069 4074 * Moved all the classes and functions in ipythonlib to ipplib, so
4070 4075 now ipythonlib only has make_IPython(). This will ease up its
4071 4076 splitting in smaller functional chunks later.
4072 4077
4073 4078 * Cleaned up (done, I think) output of @whos. Better column
4074 4079 formatting, and now shows str(var) for as much as it can, which is
4075 4080 typically what one gets with a 'print var'.
4076 4081
4077 4082 2001-12-04 Fernando Perez <fperez@colorado.edu>
4078 4083
4079 4084 * Fixed namespace problems. Now builtin/IPyhton/user names get
4080 4085 properly reported in their namespace. Internal namespace handling
4081 4086 is finally getting decent (not perfect yet, but much better than
4082 4087 the ad-hoc mess we had).
4083 4088
4084 4089 * Removed -exit option. If people just want to run a python
4085 4090 script, that's what the normal interpreter is for. Less
4086 4091 unnecessary options, less chances for bugs.
4087 4092
4088 4093 * Added a crash handler which generates a complete post-mortem if
4089 4094 IPython crashes. This will help a lot in tracking bugs down the
4090 4095 road.
4091 4096
4092 4097 * Fixed nasty bug in auto-evaluation part of prefilter(). Names
4093 4098 which were boud to functions being reassigned would bypass the
4094 4099 logger, breaking the sync of _il with the prompt counter. This
4095 4100 would then crash IPython later when a new line was logged.
4096 4101
4097 4102 2001-12-02 Fernando Perez <fperez@colorado.edu>
4098 4103
4099 4104 * Made IPython a package. This means people don't have to clutter
4100 4105 their sys.path with yet another directory. Changed the INSTALL
4101 4106 file accordingly.
4102 4107
4103 4108 * Cleaned up the output of @who_ls, @who and @whos. @who_ls now
4104 4109 sorts its output (so @who shows it sorted) and @whos formats the
4105 4110 table according to the width of the first column. Nicer, easier to
4106 4111 read. Todo: write a generic table_format() which takes a list of
4107 4112 lists and prints it nicely formatted, with optional row/column
4108 4113 separators and proper padding and justification.
4109 4114
4110 4115 * Released 0.1.20
4111 4116
4112 4117 * Fixed bug in @log which would reverse the inputcache list (a
4113 4118 copy operation was missing).
4114 4119
4115 4120 * Code cleanup. @config was changed to use page(). Better, since
4116 4121 its output is always quite long.
4117 4122
4118 4123 * Itpl is back as a dependency. I was having too many problems
4119 4124 getting the parametric aliases to work reliably, and it's just
4120 4125 easier to code weird string operations with it than playing %()s
4121 4126 games. It's only ~6k, so I don't think it's too big a deal.
4122 4127
4123 4128 * Found (and fixed) a very nasty bug with history. !lines weren't
4124 4129 getting cached, and the out of sync caches would crash
4125 4130 IPython. Fixed it by reorganizing the prefilter/handlers/logger
4126 4131 division of labor a bit better. Bug fixed, cleaner structure.
4127 4132
4128 4133 2001-12-01 Fernando Perez <fperez@colorado.edu>
4129 4134
4130 4135 * Released 0.1.19
4131 4136
4132 4137 * Added option -n to @hist to prevent line number printing. Much
4133 4138 easier to copy/paste code this way.
4134 4139
4135 4140 * Created global _il to hold the input list. Allows easy
4136 4141 re-execution of blocks of code by slicing it (inspired by Janko's
4137 4142 comment on 'macros').
4138 4143
4139 4144 * Small fixes and doc updates.
4140 4145
4141 4146 * Rewrote @history function (was @h). Renamed it to @hist, @h is
4142 4147 much too fragile with automagic. Handles properly multi-line
4143 4148 statements and takes parameters.
4144 4149
4145 4150 2001-11-30 Fernando Perez <fperez@colorado.edu>
4146 4151
4147 4152 * Version 0.1.18 released.
4148 4153
4149 4154 * Fixed nasty namespace bug in initial module imports.
4150 4155
4151 4156 * Added copyright/license notes to all code files (except
4152 4157 DPyGetOpt). For the time being, LGPL. That could change.
4153 4158
4154 4159 * Rewrote a much nicer README, updated INSTALL, cleaned up
4155 4160 ipythonrc-* samples.
4156 4161
4157 4162 * Overall code/documentation cleanup. Basically ready for
4158 4163 release. Only remaining thing: licence decision (LGPL?).
4159 4164
4160 4165 * Converted load_config to a class, ConfigLoader. Now recursion
4161 4166 control is better organized. Doesn't include the same file twice.
4162 4167
4163 4168 2001-11-29 Fernando Perez <fperez@colorado.edu>
4164 4169
4165 4170 * Got input history working. Changed output history variables from
4166 4171 _p to _o so that _i is for input and _o for output. Just cleaner
4167 4172 convention.
4168 4173
4169 4174 * Implemented parametric aliases. This pretty much allows the
4170 4175 alias system to offer full-blown shell convenience, I think.
4171 4176
4172 4177 * Version 0.1.17 released, 0.1.18 opened.
4173 4178
4174 4179 * dot_ipython/ipythonrc (alias): added documentation.
4175 4180 (xcolor): Fixed small bug (xcolors -> xcolor)
4176 4181
4177 4182 * Changed the alias system. Now alias is a magic command to define
4178 4183 aliases just like the shell. Rationale: the builtin magics should
4179 4184 be there for things deeply connected to IPython's
4180 4185 architecture. And this is a much lighter system for what I think
4181 4186 is the really important feature: allowing users to define quickly
4182 4187 magics that will do shell things for them, so they can customize
4183 4188 IPython easily to match their work habits. If someone is really
4184 4189 desperate to have another name for a builtin alias, they can
4185 4190 always use __IP.magic_newname = __IP.magic_oldname. Hackish but
4186 4191 works.
4187 4192
4188 4193 2001-11-28 Fernando Perez <fperez@colorado.edu>
4189 4194
4190 4195 * Changed @file so that it opens the source file at the proper
4191 4196 line. Since it uses less, if your EDITOR environment is
4192 4197 configured, typing v will immediately open your editor of choice
4193 4198 right at the line where the object is defined. Not as quick as
4194 4199 having a direct @edit command, but for all intents and purposes it
4195 4200 works. And I don't have to worry about writing @edit to deal with
4196 4201 all the editors, less does that.
4197 4202
4198 4203 * Version 0.1.16 released, 0.1.17 opened.
4199 4204
4200 4205 * Fixed some nasty bugs in the page/page_dumb combo that could
4201 4206 crash IPython.
4202 4207
4203 4208 2001-11-27 Fernando Perez <fperez@colorado.edu>
4204 4209
4205 4210 * Version 0.1.15 released, 0.1.16 opened.
4206 4211
4207 4212 * Finally got ? and ?? to work for undefined things: now it's
4208 4213 possible to type {}.get? and get information about the get method
4209 4214 of dicts, or os.path? even if only os is defined (so technically
4210 4215 os.path isn't). Works at any level. For example, after import os,
4211 4216 os?, os.path?, os.path.abspath? all work. This is great, took some
4212 4217 work in _ofind.
4213 4218
4214 4219 * Fixed more bugs with logging. The sanest way to do it was to add
4215 4220 to @log a 'mode' parameter. Killed two in one shot (this mode
4216 4221 option was a request of Janko's). I think it's finally clean
4217 4222 (famous last words).
4218 4223
4219 4224 * Added a page_dumb() pager which does a decent job of paging on
4220 4225 screen, if better things (like less) aren't available. One less
4221 4226 unix dependency (someday maybe somebody will port this to
4222 4227 windows).
4223 4228
4224 4229 * Fixed problem in magic_log: would lock of logging out if log
4225 4230 creation failed (because it would still think it had succeeded).
4226 4231
4227 4232 * Improved the page() function using curses to auto-detect screen
4228 4233 size. Now it can make a much better decision on whether to print
4229 4234 or page a string. Option screen_length was modified: a value 0
4230 4235 means auto-detect, and that's the default now.
4231 4236
4232 4237 * Version 0.1.14 released, 0.1.15 opened. I think this is ready to
4233 4238 go out. I'll test it for a few days, then talk to Janko about
4234 4239 licences and announce it.
4235 4240
4236 4241 * Fixed the length of the auto-generated ---> prompt which appears
4237 4242 for auto-parens and auto-quotes. Getting this right isn't trivial,
4238 4243 with all the color escapes, different prompt types and optional
4239 4244 separators. But it seems to be working in all the combinations.
4240 4245
4241 4246 2001-11-26 Fernando Perez <fperez@colorado.edu>
4242 4247
4243 4248 * Wrote a regexp filter to get option types from the option names
4244 4249 string. This eliminates the need to manually keep two duplicate
4245 4250 lists.
4246 4251
4247 4252 * Removed the unneeded check_option_names. Now options are handled
4248 4253 in a much saner manner and it's easy to visually check that things
4249 4254 are ok.
4250 4255
4251 4256 * Updated version numbers on all files I modified to carry a
4252 4257 notice so Janko and Nathan have clear version markers.
4253 4258
4254 4259 * Updated docstring for ultraTB with my changes. I should send
4255 4260 this to Nathan.
4256 4261
4257 4262 * Lots of small fixes. Ran everything through pychecker again.
4258 4263
4259 4264 * Made loading of deep_reload an cmd line option. If it's not too
4260 4265 kosher, now people can just disable it. With -nodeep_reload it's
4261 4266 still available as dreload(), it just won't overwrite reload().
4262 4267
4263 4268 * Moved many options to the no| form (-opt and -noopt
4264 4269 accepted). Cleaner.
4265 4270
4266 4271 * Changed magic_log so that if called with no parameters, it uses
4267 4272 'rotate' mode. That way auto-generated logs aren't automatically
4268 4273 over-written. For normal logs, now a backup is made if it exists
4269 4274 (only 1 level of backups). A new 'backup' mode was added to the
4270 4275 Logger class to support this. This was a request by Janko.
4271 4276
4272 4277 * Added @logoff/@logon to stop/restart an active log.
4273 4278
4274 4279 * Fixed a lot of bugs in log saving/replay. It was pretty
4275 4280 broken. Now special lines (!@,/) appear properly in the command
4276 4281 history after a log replay.
4277 4282
4278 4283 * Tried and failed to implement full session saving via pickle. My
4279 4284 idea was to pickle __main__.__dict__, but modules can't be
4280 4285 pickled. This would be a better alternative to replaying logs, but
4281 4286 seems quite tricky to get to work. Changed -session to be called
4282 4287 -logplay, which more accurately reflects what it does. And if we
4283 4288 ever get real session saving working, -session is now available.
4284 4289
4285 4290 * Implemented color schemes for prompts also. As for tracebacks,
4286 4291 currently only NoColor and Linux are supported. But now the
4287 4292 infrastructure is in place, based on a generic ColorScheme
4288 4293 class. So writing and activating new schemes both for the prompts
4289 4294 and the tracebacks should be straightforward.
4290 4295
4291 4296 * Version 0.1.13 released, 0.1.14 opened.
4292 4297
4293 4298 * Changed handling of options for output cache. Now counter is
4294 4299 hardwired starting at 1 and one specifies the maximum number of
4295 4300 entries *in the outcache* (not the max prompt counter). This is
4296 4301 much better, since many statements won't increase the cache
4297 4302 count. It also eliminated some confusing options, now there's only
4298 4303 one: cache_size.
4299 4304
4300 4305 * Added 'alias' magic function and magic_alias option in the
4301 4306 ipythonrc file. Now the user can easily define whatever names he
4302 4307 wants for the magic functions without having to play weird
4303 4308 namespace games. This gives IPython a real shell-like feel.
4304 4309
4305 4310 * Fixed doc/?/?? for magics. Now all work, in all forms (explicit
4306 4311 @ or not).
4307 4312
4308 4313 This was one of the last remaining 'visible' bugs (that I know
4309 4314 of). I think if I can clean up the session loading so it works
4310 4315 100% I'll release a 0.2.0 version on c.p.l (talk to Janko first
4311 4316 about licensing).
4312 4317
4313 4318 2001-11-25 Fernando Perez <fperez@colorado.edu>
4314 4319
4315 4320 * Rewrote somewhat oinfo (?/??). Nicer, now uses page() and
4316 4321 there's a cleaner distinction between what ? and ?? show.
4317 4322
4318 4323 * Added screen_length option. Now the user can define his own
4319 4324 screen size for page() operations.
4320 4325
4321 4326 * Implemented magic shell-like functions with automatic code
4322 4327 generation. Now adding another function is just a matter of adding
4323 4328 an entry to a dict, and the function is dynamically generated at
4324 4329 run-time. Python has some really cool features!
4325 4330
4326 4331 * Renamed many options to cleanup conventions a little. Now all
4327 4332 are lowercase, and only underscores where needed. Also in the code
4328 4333 option name tables are clearer.
4329 4334
4330 4335 * Changed prompts a little. Now input is 'In [n]:' instead of
4331 4336 'In[n]:='. This allows it the numbers to be aligned with the
4332 4337 Out[n] numbers, and removes usage of ':=' which doesn't exist in
4333 4338 Python (it was a Mathematica thing). The '...' continuation prompt
4334 4339 was also changed a little to align better.
4335 4340
4336 4341 * Fixed bug when flushing output cache. Not all _p<n> variables
4337 4342 exist, so their deletion needs to be wrapped in a try:
4338 4343
4339 4344 * Figured out how to properly use inspect.formatargspec() (it
4340 4345 requires the args preceded by *). So I removed all the code from
4341 4346 _get_pdef in Magic, which was just replicating that.
4342 4347
4343 4348 * Added test to prefilter to allow redefining magic function names
4344 4349 as variables. This is ok, since the @ form is always available,
4345 4350 but whe should allow the user to define a variable called 'ls' if
4346 4351 he needs it.
4347 4352
4348 4353 * Moved the ToDo information from README into a separate ToDo.
4349 4354
4350 4355 * General code cleanup and small bugfixes. I think it's close to a
4351 4356 state where it can be released, obviously with a big 'beta'
4352 4357 warning on it.
4353 4358
4354 4359 * Got the magic function split to work. Now all magics are defined
4355 4360 in a separate class. It just organizes things a bit, and now
4356 4361 Xemacs behaves nicer (it was choking on InteractiveShell b/c it
4357 4362 was too long).
4358 4363
4359 4364 * Changed @clear to @reset to avoid potential confusions with
4360 4365 the shell command clear. Also renamed @cl to @clear, which does
4361 4366 exactly what people expect it to from their shell experience.
4362 4367
4363 4368 Added a check to the @reset command (since it's so
4364 4369 destructive, it's probably a good idea to ask for confirmation).
4365 4370 But now reset only works for full namespace resetting. Since the
4366 4371 del keyword is already there for deleting a few specific
4367 4372 variables, I don't see the point of having a redundant magic
4368 4373 function for the same task.
4369 4374
4370 4375 2001-11-24 Fernando Perez <fperez@colorado.edu>
4371 4376
4372 4377 * Updated the builtin docs (esp. the ? ones).
4373 4378
4374 4379 * Ran all the code through pychecker. Not terribly impressed with
4375 4380 it: lots of spurious warnings and didn't really find anything of
4376 4381 substance (just a few modules being imported and not used).
4377 4382
4378 4383 * Implemented the new ultraTB functionality into IPython. New
4379 4384 option: xcolors. This chooses color scheme. xmode now only selects
4380 4385 between Plain and Verbose. Better orthogonality.
4381 4386
4382 4387 * Large rewrite of ultraTB. Much cleaner now, with a separation of
4383 4388 mode and color scheme for the exception handlers. Now it's
4384 4389 possible to have the verbose traceback with no coloring.
4385 4390
4386 4391 2001-11-23 Fernando Perez <fperez@colorado.edu>
4387 4392
4388 4393 * Version 0.1.12 released, 0.1.13 opened.
4389 4394
4390 4395 * Removed option to set auto-quote and auto-paren escapes by
4391 4396 user. The chances of breaking valid syntax are just too high. If
4392 4397 someone *really* wants, they can always dig into the code.
4393 4398
4394 4399 * Made prompt separators configurable.
4395 4400
4396 4401 2001-11-22 Fernando Perez <fperez@colorado.edu>
4397 4402
4398 4403 * Small bugfixes in many places.
4399 4404
4400 4405 * Removed the MyCompleter class from ipplib. It seemed redundant
4401 4406 with the C-p,C-n history search functionality. Less code to
4402 4407 maintain.
4403 4408
4404 4409 * Moved all the original ipython.py code into ipythonlib.py. Right
4405 4410 now it's just one big dump into a function called make_IPython, so
4406 4411 no real modularity has been gained. But at least it makes the
4407 4412 wrapper script tiny, and since ipythonlib is a module, it gets
4408 4413 compiled and startup is much faster.
4409 4414
4410 4415 This is a reasobably 'deep' change, so we should test it for a
4411 4416 while without messing too much more with the code.
4412 4417
4413 4418 2001-11-21 Fernando Perez <fperez@colorado.edu>
4414 4419
4415 4420 * Version 0.1.11 released, 0.1.12 opened for further work.
4416 4421
4417 4422 * Removed dependency on Itpl. It was only needed in one place. It
4418 4423 would be nice if this became part of python, though. It makes life
4419 4424 *a lot* easier in some cases.
4420 4425
4421 4426 * Simplified the prefilter code a bit. Now all handlers are
4422 4427 expected to explicitly return a value (at least a blank string).
4423 4428
4424 4429 * Heavy edits in ipplib. Removed the help system altogether. Now
4425 4430 obj?/?? is used for inspecting objects, a magic @doc prints
4426 4431 docstrings, and full-blown Python help is accessed via the 'help'
4427 4432 keyword. This cleans up a lot of code (less to maintain) and does
4428 4433 the job. Since 'help' is now a standard Python component, might as
4429 4434 well use it and remove duplicate functionality.
4430 4435
4431 4436 Also removed the option to use ipplib as a standalone program. By
4432 4437 now it's too dependent on other parts of IPython to function alone.
4433 4438
4434 4439 * Fixed bug in genutils.pager. It would crash if the pager was
4435 4440 exited immediately after opening (broken pipe).
4436 4441
4437 4442 * Trimmed down the VerboseTB reporting a little. The header is
4438 4443 much shorter now and the repeated exception arguments at the end
4439 4444 have been removed. For interactive use the old header seemed a bit
4440 4445 excessive.
4441 4446
4442 4447 * Fixed small bug in output of @whos for variables with multi-word
4443 4448 types (only first word was displayed).
4444 4449
4445 4450 2001-11-17 Fernando Perez <fperez@colorado.edu>
4446 4451
4447 4452 * Version 0.1.10 released, 0.1.11 opened for further work.
4448 4453
4449 4454 * Modified dirs and friends. dirs now *returns* the stack (not
4450 4455 prints), so one can manipulate it as a variable. Convenient to
4451 4456 travel along many directories.
4452 4457
4453 4458 * Fixed bug in magic_pdef: would only work with functions with
4454 4459 arguments with default values.
4455 4460
4456 4461 2001-11-14 Fernando Perez <fperez@colorado.edu>
4457 4462
4458 4463 * Added the PhysicsInput stuff to dot_ipython so it ships as an
4459 4464 example with IPython. Various other minor fixes and cleanups.
4460 4465
4461 4466 * Version 0.1.9 released, 0.1.10 opened for further work.
4462 4467
4463 4468 * Added sys.path to the list of directories searched in the
4464 4469 execfile= option. It used to be the current directory and the
4465 4470 user's IPYTHONDIR only.
4466 4471
4467 4472 2001-11-13 Fernando Perez <fperez@colorado.edu>
4468 4473
4469 4474 * Reinstated the raw_input/prefilter separation that Janko had
4470 4475 initially. This gives a more convenient setup for extending the
4471 4476 pre-processor from the outside: raw_input always gets a string,
4472 4477 and prefilter has to process it. We can then redefine prefilter
4473 4478 from the outside and implement extensions for special
4474 4479 purposes.
4475 4480
4476 4481 Today I got one for inputting PhysicalQuantity objects
4477 4482 (from Scientific) without needing any function calls at
4478 4483 all. Extremely convenient, and it's all done as a user-level
4479 4484 extension (no IPython code was touched). Now instead of:
4480 4485 a = PhysicalQuantity(4.2,'m/s**2')
4481 4486 one can simply say
4482 4487 a = 4.2 m/s**2
4483 4488 or even
4484 4489 a = 4.2 m/s^2
4485 4490
4486 4491 I use this, but it's also a proof of concept: IPython really is
4487 4492 fully user-extensible, even at the level of the parsing of the
4488 4493 command line. It's not trivial, but it's perfectly doable.
4489 4494
4490 4495 * Added 'add_flip' method to inclusion conflict resolver. Fixes
4491 4496 the problem of modules being loaded in the inverse order in which
4492 4497 they were defined in
4493 4498
4494 4499 * Version 0.1.8 released, 0.1.9 opened for further work.
4495 4500
4496 4501 * Added magics pdef, source and file. They respectively show the
4497 4502 definition line ('prototype' in C), source code and full python
4498 4503 file for any callable object. The object inspector oinfo uses
4499 4504 these to show the same information.
4500 4505
4501 4506 * Version 0.1.7 released, 0.1.8 opened for further work.
4502 4507
4503 4508 * Separated all the magic functions into a class called Magic. The
4504 4509 InteractiveShell class was becoming too big for Xemacs to handle
4505 4510 (de-indenting a line would lock it up for 10 seconds while it
4506 4511 backtracked on the whole class!)
4507 4512
4508 4513 FIXME: didn't work. It can be done, but right now namespaces are
4509 4514 all messed up. Do it later (reverted it for now, so at least
4510 4515 everything works as before).
4511 4516
4512 4517 * Got the object introspection system (magic_oinfo) working! I
4513 4518 think this is pretty much ready for release to Janko, so he can
4514 4519 test it for a while and then announce it. Pretty much 100% of what
4515 4520 I wanted for the 'phase 1' release is ready. Happy, tired.
4516 4521
4517 4522 2001-11-12 Fernando Perez <fperez@colorado.edu>
4518 4523
4519 4524 * Version 0.1.6 released, 0.1.7 opened for further work.
4520 4525
4521 4526 * Fixed bug in printing: it used to test for truth before
4522 4527 printing, so 0 wouldn't print. Now checks for None.
4523 4528
4524 4529 * Fixed bug where auto-execs increase the prompt counter by 2 (b/c
4525 4530 they have to call len(str(sys.ps1)) ). But the fix is ugly, it
4526 4531 reaches by hand into the outputcache. Think of a better way to do
4527 4532 this later.
4528 4533
4529 4534 * Various small fixes thanks to Nathan's comments.
4530 4535
4531 4536 * Changed magic_pprint to magic_Pprint. This way it doesn't
4532 4537 collide with pprint() and the name is consistent with the command
4533 4538 line option.
4534 4539
4535 4540 * Changed prompt counter behavior to be fully like
4536 4541 Mathematica's. That is, even input that doesn't return a result
4537 4542 raises the prompt counter. The old behavior was kind of confusing
4538 4543 (getting the same prompt number several times if the operation
4539 4544 didn't return a result).
4540 4545
4541 4546 * Fixed Nathan's last name in a couple of places (Gray, not Graham).
4542 4547
4543 4548 * Fixed -Classic mode (wasn't working anymore).
4544 4549
4545 4550 * Added colored prompts using Nathan's new code. Colors are
4546 4551 currently hardwired, they can be user-configurable. For
4547 4552 developers, they can be chosen in file ipythonlib.py, at the
4548 4553 beginning of the CachedOutput class def.
4549 4554
4550 4555 2001-11-11 Fernando Perez <fperez@colorado.edu>
4551 4556
4552 4557 * Version 0.1.5 released, 0.1.6 opened for further work.
4553 4558
4554 4559 * Changed magic_env to *return* the environment as a dict (not to
4555 4560 print it). This way it prints, but it can also be processed.
4556 4561
4557 4562 * Added Verbose exception reporting to interactive
4558 4563 exceptions. Very nice, now even 1/0 at the prompt gives a verbose
4559 4564 traceback. Had to make some changes to the ultraTB file. This is
4560 4565 probably the last 'big' thing in my mental todo list. This ties
4561 4566 in with the next entry:
4562 4567
4563 4568 * Changed -Xi and -Xf to a single -xmode option. Now all the user
4564 4569 has to specify is Plain, Color or Verbose for all exception
4565 4570 handling.
4566 4571
4567 4572 * Removed ShellServices option. All this can really be done via
4568 4573 the magic system. It's easier to extend, cleaner and has automatic
4569 4574 namespace protection and documentation.
4570 4575
4571 4576 2001-11-09 Fernando Perez <fperez@colorado.edu>
4572 4577
4573 4578 * Fixed bug in output cache flushing (missing parameter to
4574 4579 __init__). Other small bugs fixed (found using pychecker).
4575 4580
4576 4581 * Version 0.1.4 opened for bugfixing.
4577 4582
4578 4583 2001-11-07 Fernando Perez <fperez@colorado.edu>
4579 4584
4580 4585 * Version 0.1.3 released, mainly because of the raw_input bug.
4581 4586
4582 4587 * Fixed NASTY bug in raw_input: input line wasn't properly parsed
4583 4588 and when testing for whether things were callable, a call could
4584 4589 actually be made to certain functions. They would get called again
4585 4590 once 'really' executed, with a resulting double call. A disaster
4586 4591 in many cases (list.reverse() would never work!).
4587 4592
4588 4593 * Removed prefilter() function, moved its code to raw_input (which
4589 4594 after all was just a near-empty caller for prefilter). This saves
4590 4595 a function call on every prompt, and simplifies the class a tiny bit.
4591 4596
4592 4597 * Fix _ip to __ip name in magic example file.
4593 4598
4594 4599 * Changed 'tar -x -f' to 'tar xvf' in auto-installer. This should
4595 4600 work with non-gnu versions of tar.
4596 4601
4597 4602 2001-11-06 Fernando Perez <fperez@colorado.edu>
4598 4603
4599 4604 * Version 0.1.2. Just to keep track of the recent changes.
4600 4605
4601 4606 * Fixed nasty bug in output prompt routine. It used to check 'if
4602 4607 arg != None...'. Problem is, this fails if arg implements a
4603 4608 special comparison (__cmp__) which disallows comparing to
4604 4609 None. Found it when trying to use the PhysicalQuantity module from
4605 4610 ScientificPython.
4606 4611
4607 4612 2001-11-05 Fernando Perez <fperez@colorado.edu>
4608 4613
4609 4614 * Also added dirs. Now the pushd/popd/dirs family functions
4610 4615 basically like the shell, with the added convenience of going home
4611 4616 when called with no args.
4612 4617
4613 4618 * pushd/popd slightly modified to mimic shell behavior more
4614 4619 closely.
4615 4620
4616 4621 * Added env,pushd,popd from ShellServices as magic functions. I
4617 4622 think the cleanest will be to port all desired functions from
4618 4623 ShellServices as magics and remove ShellServices altogether. This
4619 4624 will provide a single, clean way of adding functionality
4620 4625 (shell-type or otherwise) to IP.
4621 4626
4622 4627 2001-11-04 Fernando Perez <fperez@colorado.edu>
4623 4628
4624 4629 * Added .ipython/ directory to sys.path. This way users can keep
4625 4630 customizations there and access them via import.
4626 4631
4627 4632 2001-11-03 Fernando Perez <fperez@colorado.edu>
4628 4633
4629 4634 * Opened version 0.1.1 for new changes.
4630 4635
4631 4636 * Changed version number to 0.1.0: first 'public' release, sent to
4632 4637 Nathan and Janko.
4633 4638
4634 4639 * Lots of small fixes and tweaks.
4635 4640
4636 4641 * Minor changes to whos format. Now strings are shown, snipped if
4637 4642 too long.
4638 4643
4639 4644 * Changed ShellServices to work on __main__ so they show up in @who
4640 4645
4641 4646 * Help also works with ? at the end of a line:
4642 4647 ?sin and sin?
4643 4648 both produce the same effect. This is nice, as often I use the
4644 4649 tab-complete to find the name of a method, but I used to then have
4645 4650 to go to the beginning of the line to put a ? if I wanted more
4646 4651 info. Now I can just add the ? and hit return. Convenient.
4647 4652
4648 4653 2001-11-02 Fernando Perez <fperez@colorado.edu>
4649 4654
4650 4655 * Python version check (>=2.1) added.
4651 4656
4652 4657 * Added LazyPython documentation. At this point the docs are quite
4653 4658 a mess. A cleanup is in order.
4654 4659
4655 4660 * Auto-installer created. For some bizarre reason, the zipfiles
4656 4661 module isn't working on my system. So I made a tar version
4657 4662 (hopefully the command line options in various systems won't kill
4658 4663 me).
4659 4664
4660 4665 * Fixes to Struct in genutils. Now all dictionary-like methods are
4661 4666 protected (reasonably).
4662 4667
4663 4668 * Added pager function to genutils and changed ? to print usage
4664 4669 note through it (it was too long).
4665 4670
4666 4671 * Added the LazyPython functionality. Works great! I changed the
4667 4672 auto-quote escape to ';', it's on home row and next to '. But
4668 4673 both auto-quote and auto-paren (still /) escapes are command-line
4669 4674 parameters.
4670 4675
4671 4676
4672 4677 2001-11-01 Fernando Perez <fperez@colorado.edu>
4673 4678
4674 4679 * Version changed to 0.0.7. Fairly large change: configuration now
4675 4680 is all stored in a directory, by default .ipython. There, all
4676 4681 config files have normal looking names (not .names)
4677 4682
4678 4683 * Version 0.0.6 Released first to Lucas and Archie as a test
4679 4684 run. Since it's the first 'semi-public' release, change version to
4680 4685 > 0.0.6 for any changes now.
4681 4686
4682 4687 * Stuff I had put in the ipplib.py changelog:
4683 4688
4684 4689 Changes to InteractiveShell:
4685 4690
4686 4691 - Made the usage message a parameter.
4687 4692
4688 4693 - Require the name of the shell variable to be given. It's a bit
4689 4694 of a hack, but allows the name 'shell' not to be hardwire in the
4690 4695 magic (@) handler, which is problematic b/c it requires
4691 4696 polluting the global namespace with 'shell'. This in turn is
4692 4697 fragile: if a user redefines a variable called shell, things
4693 4698 break.
4694 4699
4695 4700 - magic @: all functions available through @ need to be defined
4696 4701 as magic_<name>, even though they can be called simply as
4697 4702 @<name>. This allows the special command @magic to gather
4698 4703 information automatically about all existing magic functions,
4699 4704 even if they are run-time user extensions, by parsing the shell
4700 4705 instance __dict__ looking for special magic_ names.
4701 4706
4702 4707 - mainloop: added *two* local namespace parameters. This allows
4703 4708 the class to differentiate between parameters which were there
4704 4709 before and after command line initialization was processed. This
4705 4710 way, later @who can show things loaded at startup by the
4706 4711 user. This trick was necessary to make session saving/reloading
4707 4712 really work: ideally after saving/exiting/reloading a session,
4708 4713 *everythin* should look the same, including the output of @who. I
4709 4714 was only able to make this work with this double namespace
4710 4715 trick.
4711 4716
4712 4717 - added a header to the logfile which allows (almost) full
4713 4718 session restoring.
4714 4719
4715 4720 - prepend lines beginning with @ or !, with a and log
4716 4721 them. Why? !lines: may be useful to know what you did @lines:
4717 4722 they may affect session state. So when restoring a session, at
4718 4723 least inform the user of their presence. I couldn't quite get
4719 4724 them to properly re-execute, but at least the user is warned.
4720 4725
4721 4726 * Started ChangeLog.
General Comments 0
You need to be logged in to leave comments. Login now