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