##// END OF EJS Templates
fix handling of aliases/system calls for multiline input
fperez -
Show More
@@ -1,76 +1,76 b''
1 # -*- coding: utf-8 -*-
1 # -*- coding: utf-8 -*-
2 """Release data for the IPython project.
2 """Release data for the IPython project.
3
3
4 $Id: Release.py 981 2005-12-30 15:43:43Z fperez $"""
4 $Id: Release.py 982 2005-12-30 23:57:07Z fperez $"""
5
5
6 #*****************************************************************************
6 #*****************************************************************************
7 # Copyright (C) 2001-2005 Fernando Perez <fperez@colorado.edu>
7 # Copyright (C) 2001-2005 Fernando Perez <fperez@colorado.edu>
8 #
8 #
9 # Copyright (c) 2001 Janko Hauser <jhauser@zscout.de> and Nathaniel Gray
9 # Copyright (c) 2001 Janko Hauser <jhauser@zscout.de> and Nathaniel Gray
10 # <n8gray@caltech.edu>
10 # <n8gray@caltech.edu>
11 #
11 #
12 # Distributed under the terms of the BSD License. The full license is in
12 # Distributed under the terms of the BSD License. The full license is in
13 # the file COPYING, distributed as part of this software.
13 # the file COPYING, distributed as part of this software.
14 #*****************************************************************************
14 #*****************************************************************************
15
15
16 # Name of the package for release purposes. This is the name which labels
16 # Name of the package for release purposes. This is the name which labels
17 # the tarballs and RPMs made by distutils, so it's best to lowercase it.
17 # the tarballs and RPMs made by distutils, so it's best to lowercase it.
18 name = 'ipython'
18 name = 'ipython'
19
19
20 # For versions with substrings (like 0.6.16.svn), use an extra . to separate
20 # For versions with substrings (like 0.6.16.svn), use an extra . to separate
21 # the new substring. We have to avoid using either dashes or underscores,
21 # the new substring. We have to avoid using either dashes or underscores,
22 # because bdist_rpm does not accept dashes (an RPM) convention, and
22 # because bdist_rpm does not accept dashes (an RPM) convention, and
23 # bdist_deb does not accept underscores (a Debian convention).
23 # bdist_deb does not accept underscores (a Debian convention).
24
24
25 version = '0.7.0.rc2'
25 version = '0.7.0.rc3'
26
26
27 revision = '$Revision: 981 $'
27 revision = '$Revision: 982 $'
28
28
29 description = "An enhanced interactive Python shell."
29 description = "An enhanced interactive Python shell."
30
30
31 long_description = \
31 long_description = \
32 """
32 """
33 IPython provides a replacement for the interactive Python interpreter with
33 IPython provides a replacement for the interactive Python interpreter with
34 extra functionality.
34 extra functionality.
35
35
36 Main features:
36 Main features:
37
37
38 * Comprehensive object introspection.
38 * Comprehensive object introspection.
39
39
40 * Input history, persistent across sessions.
40 * Input history, persistent across sessions.
41
41
42 * Caching of output results during a session with automatically generated
42 * Caching of output results during a session with automatically generated
43 references.
43 references.
44
44
45 * Readline based name completion.
45 * Readline based name completion.
46
46
47 * Extensible system of 'magic' commands for controlling the environment and
47 * Extensible system of 'magic' commands for controlling the environment and
48 performing many tasks related either to IPython or the operating system.
48 performing many tasks related either to IPython or the operating system.
49
49
50 * Configuration system with easy switching between different setups (simpler
50 * Configuration system with easy switching between different setups (simpler
51 than changing $PYTHONSTARTUP environment variables every time).
51 than changing $PYTHONSTARTUP environment variables every time).
52
52
53 * Session logging and reloading.
53 * Session logging and reloading.
54
54
55 * Extensible syntax processing for special purpose situations.
55 * Extensible syntax processing for special purpose situations.
56
56
57 * Access to the system shell with user-extensible alias system.
57 * Access to the system shell with user-extensible alias system.
58
58
59 * Easily embeddable in other Python programs.
59 * Easily embeddable in other Python programs.
60
60
61 * Integrated access to the pdb debugger and the Python profiler. """
61 * Integrated access to the pdb debugger and the Python profiler. """
62
62
63 license = 'BSD'
63 license = 'BSD'
64
64
65 authors = {'Fernando' : ('Fernando Perez','fperez@colorado.edu'),
65 authors = {'Fernando' : ('Fernando Perez','fperez@colorado.edu'),
66 'Janko' : ('Janko Hauser','jhauser@zscout.de'),
66 'Janko' : ('Janko Hauser','jhauser@zscout.de'),
67 'Nathan' : ('Nathaniel Gray','n8gray@caltech.edu')
67 'Nathan' : ('Nathaniel Gray','n8gray@caltech.edu')
68 }
68 }
69
69
70 url = 'http://ipython.scipy.org'
70 url = 'http://ipython.scipy.org'
71
71
72 download_url = 'http://ipython.scipy.org/dist'
72 download_url = 'http://ipython.scipy.org/dist'
73
73
74 platforms = ['Linux','Mac OSX','Windows XP/2000/NT','Windows 95/98/ME']
74 platforms = ['Linux','Mac OSX','Windows XP/2000/NT','Windows 95/98/ME']
75
75
76 keywords = ['Interactive','Interpreter','Shell']
76 keywords = ['Interactive','Interpreter','Shell']
@@ -1,2056 +1,2060 b''
1 # -*- coding: utf-8 -*-
1 # -*- coding: utf-8 -*-
2 """
2 """
3 IPython -- An enhanced Interactive Python
3 IPython -- An enhanced Interactive Python
4
4
5 Requires Python 2.1 or newer.
5 Requires Python 2.1 or newer.
6
6
7 This file contains all the classes and helper functions specific to IPython.
7 This file contains all the classes and helper functions specific to IPython.
8
8
9 $Id: iplib.py 978 2005-12-30 02:37:15Z fperez $
9 $Id: iplib.py 982 2005-12-30 23:57:07Z fperez $
10 """
10 """
11
11
12 #*****************************************************************************
12 #*****************************************************************************
13 # Copyright (C) 2001 Janko Hauser <jhauser@zscout.de> and
13 # Copyright (C) 2001 Janko Hauser <jhauser@zscout.de> and
14 # Copyright (C) 2001-2005 Fernando Perez. <fperez@colorado.edu>
14 # Copyright (C) 2001-2005 Fernando Perez. <fperez@colorado.edu>
15 #
15 #
16 # Distributed under the terms of the BSD License. The full license is in
16 # Distributed under the terms of the BSD License. The full license is in
17 # the file COPYING, distributed as part of this software.
17 # the file COPYING, distributed as part of this software.
18 #
18 #
19 # Note: this code originally subclassed code.InteractiveConsole from the
19 # Note: this code originally subclassed code.InteractiveConsole from the
20 # Python standard library. Over time, all of that class has been copied
20 # Python standard library. Over time, all of that class has been copied
21 # verbatim here for modifications which could not be accomplished by
21 # verbatim here for modifications which could not be accomplished by
22 # subclassing. At this point, there are no dependencies at all on the code
22 # subclassing. At this point, there are no dependencies at all on the code
23 # module anymore (it is not even imported). The Python License (sec. 2)
23 # module anymore (it is not even imported). The Python License (sec. 2)
24 # allows for this, but it's always nice to acknowledge credit where credit is
24 # allows for this, but it's always nice to acknowledge credit where credit is
25 # due.
25 # due.
26 #*****************************************************************************
26 #*****************************************************************************
27
27
28 #****************************************************************************
28 #****************************************************************************
29 # Modules and globals
29 # Modules and globals
30
30
31 from __future__ import generators # for 2.2 backwards-compatibility
31 from __future__ import generators # for 2.2 backwards-compatibility
32
32
33 from IPython import Release
33 from IPython import Release
34 __author__ = '%s <%s>\n%s <%s>' % \
34 __author__ = '%s <%s>\n%s <%s>' % \
35 ( Release.authors['Janko'] + Release.authors['Fernando'] )
35 ( Release.authors['Janko'] + Release.authors['Fernando'] )
36 __license__ = Release.license
36 __license__ = Release.license
37 __version__ = Release.version
37 __version__ = Release.version
38
38
39 # Python standard modules
39 # Python standard modules
40 import __main__
40 import __main__
41 import __builtin__
41 import __builtin__
42 import StringIO
42 import StringIO
43 import bdb
43 import bdb
44 import cPickle as pickle
44 import cPickle as pickle
45 import codeop
45 import codeop
46 import exceptions
46 import exceptions
47 import glob
47 import glob
48 import inspect
48 import inspect
49 import keyword
49 import keyword
50 import new
50 import new
51 import os
51 import os
52 import pdb
52 import pdb
53 import pydoc
53 import pydoc
54 import re
54 import re
55 import shutil
55 import shutil
56 import string
56 import string
57 import sys
57 import sys
58 import traceback
58 import traceback
59 import types
59 import types
60
60
61 from pprint import pprint, pformat
61 from pprint import pprint, pformat
62
62
63 # IPython's own modules
63 # IPython's own modules
64 import IPython
64 import IPython
65 from IPython import OInspect,PyColorize,ultraTB
65 from IPython import OInspect,PyColorize,ultraTB
66 from IPython.ColorANSI import ColorScheme,ColorSchemeTable # too long names
66 from IPython.ColorANSI import ColorScheme,ColorSchemeTable # too long names
67 from IPython.FakeModule import FakeModule
67 from IPython.FakeModule import FakeModule
68 from IPython.Itpl import Itpl,itpl,printpl,ItplNS,itplns
68 from IPython.Itpl import Itpl,itpl,printpl,ItplNS,itplns
69 from IPython.Logger import Logger
69 from IPython.Logger import Logger
70 from IPython.Magic import Magic
70 from IPython.Magic import Magic
71 from IPython.Prompts import CachedOutput
71 from IPython.Prompts import CachedOutput
72 from IPython.Struct import Struct
72 from IPython.Struct import Struct
73 from IPython.background_jobs import BackgroundJobManager
73 from IPython.background_jobs import BackgroundJobManager
74 from IPython.usage import cmd_line_usage,interactive_usage
74 from IPython.usage import cmd_line_usage,interactive_usage
75 from IPython.genutils import *
75 from IPython.genutils import *
76
76
77 # store the builtin raw_input globally, and use this always, in case user code
77 # store the builtin raw_input globally, and use this always, in case user code
78 # overwrites it (like wx.py.PyShell does)
78 # overwrites it (like wx.py.PyShell does)
79 raw_input_original = raw_input
79 raw_input_original = raw_input
80
80
81 # compiled regexps for autoindent management
81 # compiled regexps for autoindent management
82 ini_spaces_re = re.compile(r'^(\s+)')
82 ini_spaces_re = re.compile(r'^(\s+)')
83 dedent_re = re.compile(r'^\s+raise|^\s+return|^\s+pass')
83 dedent_re = re.compile(r'^\s+raise|^\s+return|^\s+pass')
84
84
85 #****************************************************************************
85 #****************************************************************************
86 # Some utility function definitions
86 # Some utility function definitions
87
87
88 def softspace(file, newvalue):
88 def softspace(file, newvalue):
89 """Copied from code.py, to remove the dependency"""
89 """Copied from code.py, to remove the dependency"""
90 oldvalue = 0
90 oldvalue = 0
91 try:
91 try:
92 oldvalue = file.softspace
92 oldvalue = file.softspace
93 except AttributeError:
93 except AttributeError:
94 pass
94 pass
95 try:
95 try:
96 file.softspace = newvalue
96 file.softspace = newvalue
97 except (AttributeError, TypeError):
97 except (AttributeError, TypeError):
98 # "attribute-less object" or "read-only attributes"
98 # "attribute-less object" or "read-only attributes"
99 pass
99 pass
100 return oldvalue
100 return oldvalue
101
101
102 #****************************************************************************
102 #****************************************************************************
103 # These special functions get installed in the builtin namespace, to provide
103 # These special functions get installed in the builtin namespace, to provide
104 # programmatic (pure python) access to magics, aliases and system calls. This
104 # programmatic (pure python) access to magics, aliases and system calls. This
105 # is important for logging, user scripting, and more.
105 # is important for logging, user scripting, and more.
106
106
107 # We are basically exposing, via normal python functions, the three mechanisms
107 # We are basically exposing, via normal python functions, the three mechanisms
108 # in which ipython offers special call modes (magics for internal control,
108 # in which ipython offers special call modes (magics for internal control,
109 # aliases for direct system access via pre-selected names, and !cmd for
109 # aliases for direct system access via pre-selected names, and !cmd for
110 # calling arbitrary system commands).
110 # calling arbitrary system commands).
111
111
112 def ipmagic(arg_s):
112 def ipmagic(arg_s):
113 """Call a magic function by name.
113 """Call a magic function by name.
114
114
115 Input: a string containing the name of the magic function to call and any
115 Input: a string containing the name of the magic function to call and any
116 additional arguments to be passed to the magic.
116 additional arguments to be passed to the magic.
117
117
118 ipmagic('name -opt foo bar') is equivalent to typing at the ipython
118 ipmagic('name -opt foo bar') is equivalent to typing at the ipython
119 prompt:
119 prompt:
120
120
121 In[1]: %name -opt foo bar
121 In[1]: %name -opt foo bar
122
122
123 To call a magic without arguments, simply use ipmagic('name').
123 To call a magic without arguments, simply use ipmagic('name').
124
124
125 This provides a proper Python function to call IPython's magics in any
125 This provides a proper Python function to call IPython's magics in any
126 valid Python code you can type at the interpreter, including loops and
126 valid Python code you can type at the interpreter, including loops and
127 compound statements. It is added by IPython to the Python builtin
127 compound statements. It is added by IPython to the Python builtin
128 namespace upon initialization."""
128 namespace upon initialization."""
129
129
130 args = arg_s.split(' ',1)
130 args = arg_s.split(' ',1)
131 magic_name = args[0]
131 magic_name = args[0]
132 if magic_name.startswith(__IPYTHON__.ESC_MAGIC):
132 if magic_name.startswith(__IPYTHON__.ESC_MAGIC):
133 magic_name = magic_name[1:]
133 magic_name = magic_name[1:]
134 try:
134 try:
135 magic_args = args[1]
135 magic_args = args[1]
136 except IndexError:
136 except IndexError:
137 magic_args = ''
137 magic_args = ''
138 fn = getattr(__IPYTHON__,'magic_'+magic_name,None)
138 fn = getattr(__IPYTHON__,'magic_'+magic_name,None)
139 if fn is None:
139 if fn is None:
140 error("Magic function `%s` not found." % magic_name)
140 error("Magic function `%s` not found." % magic_name)
141 else:
141 else:
142 magic_args = __IPYTHON__.var_expand(magic_args)
142 magic_args = __IPYTHON__.var_expand(magic_args)
143 return fn(magic_args)
143 return fn(magic_args)
144
144
145 def ipalias(arg_s):
145 def ipalias(arg_s):
146 """Call an alias by name.
146 """Call an alias by name.
147
147
148 Input: a string containing the name of the alias to call and any
148 Input: a string containing the name of the alias to call and any
149 additional arguments to be passed to the magic.
149 additional arguments to be passed to the magic.
150
150
151 ipalias('name -opt foo bar') is equivalent to typing at the ipython
151 ipalias('name -opt foo bar') is equivalent to typing at the ipython
152 prompt:
152 prompt:
153
153
154 In[1]: name -opt foo bar
154 In[1]: name -opt foo bar
155
155
156 To call an alias without arguments, simply use ipalias('name').
156 To call an alias without arguments, simply use ipalias('name').
157
157
158 This provides a proper Python function to call IPython's aliases in any
158 This provides a proper Python function to call IPython's aliases in any
159 valid Python code you can type at the interpreter, including loops and
159 valid Python code you can type at the interpreter, including loops and
160 compound statements. It is added by IPython to the Python builtin
160 compound statements. It is added by IPython to the Python builtin
161 namespace upon initialization."""
161 namespace upon initialization."""
162
162
163 args = arg_s.split(' ',1)
163 args = arg_s.split(' ',1)
164 alias_name = args[0]
164 alias_name = args[0]
165 try:
165 try:
166 alias_args = args[1]
166 alias_args = args[1]
167 except IndexError:
167 except IndexError:
168 alias_args = ''
168 alias_args = ''
169 if alias_name in __IPYTHON__.alias_table:
169 if alias_name in __IPYTHON__.alias_table:
170 __IPYTHON__.call_alias(alias_name,alias_args)
170 __IPYTHON__.call_alias(alias_name,alias_args)
171 else:
171 else:
172 error("Alias `%s` not found." % alias_name)
172 error("Alias `%s` not found." % alias_name)
173
173
174 def ipsystem(arg_s):
174 def ipsystem(arg_s):
175 """Make a system call, using IPython."""
175 """Make a system call, using IPython."""
176 __IPYTHON__.system(arg_s)
176 __IPYTHON__.system(arg_s)
177
177
178
178
179 #****************************************************************************
179 #****************************************************************************
180 # Local use exceptions
180 # Local use exceptions
181 class SpaceInInput(exceptions.Exception): pass
181 class SpaceInInput(exceptions.Exception): pass
182
182
183 #****************************************************************************
183 #****************************************************************************
184 # Local use classes
184 # Local use classes
185 class Bunch: pass
185 class Bunch: pass
186
186
187 class InputList(list):
187 class InputList(list):
188 """Class to store user input.
188 """Class to store user input.
189
189
190 It's basically a list, but slices return a string instead of a list, thus
190 It's basically a list, but slices return a string instead of a list, thus
191 allowing things like (assuming 'In' is an instance):
191 allowing things like (assuming 'In' is an instance):
192
192
193 exec In[4:7]
193 exec In[4:7]
194
194
195 or
195 or
196
196
197 exec In[5:9] + In[14] + In[21:25]"""
197 exec In[5:9] + In[14] + In[21:25]"""
198
198
199 def __getslice__(self,i,j):
199 def __getslice__(self,i,j):
200 return ''.join(list.__getslice__(self,i,j))
200 return ''.join(list.__getslice__(self,i,j))
201
201
202 class SyntaxTB(ultraTB.ListTB):
202 class SyntaxTB(ultraTB.ListTB):
203 """Extension which holds some state: the last exception value"""
203 """Extension which holds some state: the last exception value"""
204
204
205 def __init__(self,color_scheme = 'NoColor'):
205 def __init__(self,color_scheme = 'NoColor'):
206 ultraTB.ListTB.__init__(self,color_scheme)
206 ultraTB.ListTB.__init__(self,color_scheme)
207 self.last_syntax_error = None
207 self.last_syntax_error = None
208
208
209 def __call__(self, etype, value, elist):
209 def __call__(self, etype, value, elist):
210 self.last_syntax_error = value
210 self.last_syntax_error = value
211 ultraTB.ListTB.__call__(self,etype,value,elist)
211 ultraTB.ListTB.__call__(self,etype,value,elist)
212
212
213 def clear_err_state(self):
213 def clear_err_state(self):
214 """Return the current error state and clear it"""
214 """Return the current error state and clear it"""
215 e = self.last_syntax_error
215 e = self.last_syntax_error
216 self.last_syntax_error = None
216 self.last_syntax_error = None
217 return e
217 return e
218
218
219 #****************************************************************************
219 #****************************************************************************
220 # Main IPython class
220 # Main IPython class
221
221
222 # FIXME: the Magic class is a mixin for now, and will unfortunately remain so
222 # FIXME: the Magic class is a mixin for now, and will unfortunately remain so
223 # until a full rewrite is made. I've cleaned all cross-class uses of
223 # until a full rewrite is made. I've cleaned all cross-class uses of
224 # attributes and methods, but too much user code out there relies on the
224 # attributes and methods, but too much user code out there relies on the
225 # equlity %foo == __IP.magic_foo, so I can't actually remove the mixin usage.
225 # equlity %foo == __IP.magic_foo, so I can't actually remove the mixin usage.
226 #
226 #
227 # But at least now, all the pieces have been separated and we could, in
227 # But at least now, all the pieces have been separated and we could, in
228 # principle, stop using the mixin. This will ease the transition to the
228 # principle, stop using the mixin. This will ease the transition to the
229 # chainsaw branch.
229 # chainsaw branch.
230
230
231 # For reference, the following is the list of 'self.foo' uses in the Magic
231 # For reference, the following is the list of 'self.foo' uses in the Magic
232 # class as of 2005-12-28. These are names we CAN'T use in the main ipython
232 # class as of 2005-12-28. These are names we CAN'T use in the main ipython
233 # class, to prevent clashes.
233 # class, to prevent clashes.
234
234
235 # ['self.__class__', 'self.__dict__', 'self._inspect', 'self._ofind',
235 # ['self.__class__', 'self.__dict__', 'self._inspect', 'self._ofind',
236 # 'self.arg_err', 'self.extract_input', 'self.format_', 'self.lsmagic',
236 # 'self.arg_err', 'self.extract_input', 'self.format_', 'self.lsmagic',
237 # 'self.magic_', 'self.options_table', 'self.parse', 'self.shell',
237 # 'self.magic_', 'self.options_table', 'self.parse', 'self.shell',
238 # 'self.value']
238 # 'self.value']
239
239
240 class InteractiveShell(Magic):
240 class InteractiveShell(Magic):
241 """An enhanced console for Python."""
241 """An enhanced console for Python."""
242
242
243 # class attribute to indicate whether the class supports threads or not.
243 # class attribute to indicate whether the class supports threads or not.
244 # Subclasses with thread support should override this as needed.
244 # Subclasses with thread support should override this as needed.
245 isthreaded = False
245 isthreaded = False
246
246
247 def __init__(self,name,usage=None,rc=Struct(opts=None,args=None),
247 def __init__(self,name,usage=None,rc=Struct(opts=None,args=None),
248 user_ns = None,user_global_ns=None,banner2='',
248 user_ns = None,user_global_ns=None,banner2='',
249 custom_exceptions=((),None),embedded=False):
249 custom_exceptions=((),None),embedded=False):
250
250
251 # some minimal strict typechecks. For some core data structures, I
251 # some minimal strict typechecks. For some core data structures, I
252 # want actual basic python types, not just anything that looks like
252 # want actual basic python types, not just anything that looks like
253 # one. This is especially true for namespaces.
253 # one. This is especially true for namespaces.
254 for ns in (user_ns,user_global_ns):
254 for ns in (user_ns,user_global_ns):
255 if ns is not None and type(ns) != types.DictType:
255 if ns is not None and type(ns) != types.DictType:
256 raise TypeError,'namespace must be a dictionary'
256 raise TypeError,'namespace must be a dictionary'
257
257
258 # Put a reference to self in builtins so that any form of embedded or
258 # Put a reference to self in builtins so that any form of embedded or
259 # imported code can test for being inside IPython.
259 # imported code can test for being inside IPython.
260 __builtin__.__IPYTHON__ = self
260 __builtin__.__IPYTHON__ = self
261
261
262 # And load into builtins ipmagic/ipalias/ipsystem as well
262 # And load into builtins ipmagic/ipalias/ipsystem as well
263 __builtin__.ipmagic = ipmagic
263 __builtin__.ipmagic = ipmagic
264 __builtin__.ipalias = ipalias
264 __builtin__.ipalias = ipalias
265 __builtin__.ipsystem = ipsystem
265 __builtin__.ipsystem = ipsystem
266
266
267 # Add to __builtin__ other parts of IPython's public API
267 # Add to __builtin__ other parts of IPython's public API
268 __builtin__.ip_set_hook = self.set_hook
268 __builtin__.ip_set_hook = self.set_hook
269
269
270 # Keep in the builtins a flag for when IPython is active. We set it
270 # Keep in the builtins a flag for when IPython is active. We set it
271 # with setdefault so that multiple nested IPythons don't clobber one
271 # with setdefault so that multiple nested IPythons don't clobber one
272 # another. Each will increase its value by one upon being activated,
272 # another. Each will increase its value by one upon being activated,
273 # which also gives us a way to determine the nesting level.
273 # which also gives us a way to determine the nesting level.
274 __builtin__.__dict__.setdefault('__IPYTHON__active',0)
274 __builtin__.__dict__.setdefault('__IPYTHON__active',0)
275
275
276 # Do the intuitively correct thing for quit/exit: we remove the
276 # Do the intuitively correct thing for quit/exit: we remove the
277 # builtins if they exist, and our own prefilter routine will handle
277 # builtins if they exist, and our own prefilter routine will handle
278 # these special cases
278 # these special cases
279 try:
279 try:
280 del __builtin__.exit, __builtin__.quit
280 del __builtin__.exit, __builtin__.quit
281 except AttributeError:
281 except AttributeError:
282 pass
282 pass
283
283
284 # Store the actual shell's name
284 # Store the actual shell's name
285 self.name = name
285 self.name = name
286
286
287 # We need to know whether the instance is meant for embedding, since
287 # We need to know whether the instance is meant for embedding, since
288 # global/local namespaces need to be handled differently in that case
288 # global/local namespaces need to be handled differently in that case
289 self.embedded = embedded
289 self.embedded = embedded
290
290
291 # command compiler
291 # command compiler
292 self.compile = codeop.CommandCompiler()
292 self.compile = codeop.CommandCompiler()
293
293
294 # User input buffer
294 # User input buffer
295 self.buffer = []
295 self.buffer = []
296
296
297 # Default name given in compilation of code
297 # Default name given in compilation of code
298 self.filename = '<ipython console>'
298 self.filename = '<ipython console>'
299
299
300 # Create the namespace where the user will operate. user_ns is
300 # Create the namespace where the user will operate. user_ns is
301 # normally the only one used, and it is passed to the exec calls as
301 # normally the only one used, and it is passed to the exec calls as
302 # the locals argument. But we do carry a user_global_ns namespace
302 # the locals argument. But we do carry a user_global_ns namespace
303 # given as the exec 'globals' argument, This is useful in embedding
303 # given as the exec 'globals' argument, This is useful in embedding
304 # situations where the ipython shell opens in a context where the
304 # situations where the ipython shell opens in a context where the
305 # distinction between locals and globals is meaningful.
305 # distinction between locals and globals is meaningful.
306
306
307 # FIXME. For some strange reason, __builtins__ is showing up at user
307 # FIXME. For some strange reason, __builtins__ is showing up at user
308 # level as a dict instead of a module. This is a manual fix, but I
308 # level as a dict instead of a module. This is a manual fix, but I
309 # should really track down where the problem is coming from. Alex
309 # should really track down where the problem is coming from. Alex
310 # Schmolck reported this problem first.
310 # Schmolck reported this problem first.
311
311
312 # A useful post by Alex Martelli on this topic:
312 # A useful post by Alex Martelli on this topic:
313 # Re: inconsistent value from __builtins__
313 # Re: inconsistent value from __builtins__
314 # Von: Alex Martelli <aleaxit@yahoo.com>
314 # Von: Alex Martelli <aleaxit@yahoo.com>
315 # Datum: Freitag 01 Oktober 2004 04:45:34 nachmittags/abends
315 # Datum: Freitag 01 Oktober 2004 04:45:34 nachmittags/abends
316 # Gruppen: comp.lang.python
316 # Gruppen: comp.lang.python
317
317
318 # Michael Hohn <hohn@hooknose.lbl.gov> wrote:
318 # Michael Hohn <hohn@hooknose.lbl.gov> wrote:
319 # > >>> print type(builtin_check.get_global_binding('__builtins__'))
319 # > >>> print type(builtin_check.get_global_binding('__builtins__'))
320 # > <type 'dict'>
320 # > <type 'dict'>
321 # > >>> print type(__builtins__)
321 # > >>> print type(__builtins__)
322 # > <type 'module'>
322 # > <type 'module'>
323 # > Is this difference in return value intentional?
323 # > Is this difference in return value intentional?
324
324
325 # Well, it's documented that '__builtins__' can be either a dictionary
325 # Well, it's documented that '__builtins__' can be either a dictionary
326 # or a module, and it's been that way for a long time. Whether it's
326 # or a module, and it's been that way for a long time. Whether it's
327 # intentional (or sensible), I don't know. In any case, the idea is
327 # intentional (or sensible), I don't know. In any case, the idea is
328 # that if you need to access the built-in namespace directly, you
328 # that if you need to access the built-in namespace directly, you
329 # should start with "import __builtin__" (note, no 's') which will
329 # should start with "import __builtin__" (note, no 's') which will
330 # definitely give you a module. Yeah, it's somewhatΒ confusing:-(.
330 # definitely give you a module. Yeah, it's somewhatΒ confusing:-(.
331
331
332 if user_ns is None:
332 if user_ns is None:
333 # Set __name__ to __main__ to better match the behavior of the
333 # Set __name__ to __main__ to better match the behavior of the
334 # normal interpreter.
334 # normal interpreter.
335 user_ns = {'__name__' :'__main__',
335 user_ns = {'__name__' :'__main__',
336 '__builtins__' : __builtin__,
336 '__builtins__' : __builtin__,
337 }
337 }
338
338
339 if user_global_ns is None:
339 if user_global_ns is None:
340 user_global_ns = {}
340 user_global_ns = {}
341
341
342 # Assign namespaces
342 # Assign namespaces
343 # This is the namespace where all normal user variables live
343 # This is the namespace where all normal user variables live
344 self.user_ns = user_ns
344 self.user_ns = user_ns
345 # Embedded instances require a separate namespace for globals.
345 # Embedded instances require a separate namespace for globals.
346 # Normally this one is unused by non-embedded instances.
346 # Normally this one is unused by non-embedded instances.
347 self.user_global_ns = user_global_ns
347 self.user_global_ns = user_global_ns
348 # A namespace to keep track of internal data structures to prevent
348 # A namespace to keep track of internal data structures to prevent
349 # them from cluttering user-visible stuff. Will be updated later
349 # them from cluttering user-visible stuff. Will be updated later
350 self.internal_ns = {}
350 self.internal_ns = {}
351
351
352 # Namespace of system aliases. Each entry in the alias
352 # Namespace of system aliases. Each entry in the alias
353 # table must be a 2-tuple of the form (N,name), where N is the number
353 # table must be a 2-tuple of the form (N,name), where N is the number
354 # of positional arguments of the alias.
354 # of positional arguments of the alias.
355 self.alias_table = {}
355 self.alias_table = {}
356
356
357 # A table holding all the namespaces IPython deals with, so that
357 # A table holding all the namespaces IPython deals with, so that
358 # introspection facilities can search easily.
358 # introspection facilities can search easily.
359 self.ns_table = {'user':user_ns,
359 self.ns_table = {'user':user_ns,
360 'user_global':user_global_ns,
360 'user_global':user_global_ns,
361 'alias':self.alias_table,
361 'alias':self.alias_table,
362 'internal':self.internal_ns,
362 'internal':self.internal_ns,
363 'builtin':__builtin__.__dict__
363 'builtin':__builtin__.__dict__
364 }
364 }
365
365
366 # The user namespace MUST have a pointer to the shell itself.
366 # The user namespace MUST have a pointer to the shell itself.
367 self.user_ns[name] = self
367 self.user_ns[name] = self
368
368
369 # We need to insert into sys.modules something that looks like a
369 # We need to insert into sys.modules something that looks like a
370 # module but which accesses the IPython namespace, for shelve and
370 # module but which accesses the IPython namespace, for shelve and
371 # pickle to work interactively. Normally they rely on getting
371 # pickle to work interactively. Normally they rely on getting
372 # everything out of __main__, but for embedding purposes each IPython
372 # everything out of __main__, but for embedding purposes each IPython
373 # instance has its own private namespace, so we can't go shoving
373 # instance has its own private namespace, so we can't go shoving
374 # everything into __main__.
374 # everything into __main__.
375
375
376 # note, however, that we should only do this for non-embedded
376 # note, however, that we should only do this for non-embedded
377 # ipythons, which really mimic the __main__.__dict__ with their own
377 # ipythons, which really mimic the __main__.__dict__ with their own
378 # namespace. Embedded instances, on the other hand, should not do
378 # namespace. Embedded instances, on the other hand, should not do
379 # this because they need to manage the user local/global namespaces
379 # this because they need to manage the user local/global namespaces
380 # only, but they live within a 'normal' __main__ (meaning, they
380 # only, but they live within a 'normal' __main__ (meaning, they
381 # shouldn't overtake the execution environment of the script they're
381 # shouldn't overtake the execution environment of the script they're
382 # embedded in).
382 # embedded in).
383
383
384 if not embedded:
384 if not embedded:
385 try:
385 try:
386 main_name = self.user_ns['__name__']
386 main_name = self.user_ns['__name__']
387 except KeyError:
387 except KeyError:
388 raise KeyError,'user_ns dictionary MUST have a "__name__" key'
388 raise KeyError,'user_ns dictionary MUST have a "__name__" key'
389 else:
389 else:
390 #print "pickle hack in place" # dbg
390 #print "pickle hack in place" # dbg
391 sys.modules[main_name] = FakeModule(self.user_ns)
391 sys.modules[main_name] = FakeModule(self.user_ns)
392
392
393 # List of input with multi-line handling.
393 # List of input with multi-line handling.
394 # Fill its zero entry, user counter starts at 1
394 # Fill its zero entry, user counter starts at 1
395 self.input_hist = InputList(['\n'])
395 self.input_hist = InputList(['\n'])
396
396
397 # list of visited directories
397 # list of visited directories
398 try:
398 try:
399 self.dir_hist = [os.getcwd()]
399 self.dir_hist = [os.getcwd()]
400 except IOError, e:
400 except IOError, e:
401 self.dir_hist = []
401 self.dir_hist = []
402
402
403 # dict of output history
403 # dict of output history
404 self.output_hist = {}
404 self.output_hist = {}
405
405
406 # dict of things NOT to alias (keywords, builtins and some magics)
406 # dict of things NOT to alias (keywords, builtins and some magics)
407 no_alias = {}
407 no_alias = {}
408 no_alias_magics = ['cd','popd','pushd','dhist','alias','unalias']
408 no_alias_magics = ['cd','popd','pushd','dhist','alias','unalias']
409 for key in keyword.kwlist + no_alias_magics:
409 for key in keyword.kwlist + no_alias_magics:
410 no_alias[key] = 1
410 no_alias[key] = 1
411 no_alias.update(__builtin__.__dict__)
411 no_alias.update(__builtin__.__dict__)
412 self.no_alias = no_alias
412 self.no_alias = no_alias
413
413
414 # make global variables for user access to these
414 # make global variables for user access to these
415 self.user_ns['_ih'] = self.input_hist
415 self.user_ns['_ih'] = self.input_hist
416 self.user_ns['_oh'] = self.output_hist
416 self.user_ns['_oh'] = self.output_hist
417 self.user_ns['_dh'] = self.dir_hist
417 self.user_ns['_dh'] = self.dir_hist
418
418
419 # user aliases to input and output histories
419 # user aliases to input and output histories
420 self.user_ns['In'] = self.input_hist
420 self.user_ns['In'] = self.input_hist
421 self.user_ns['Out'] = self.output_hist
421 self.user_ns['Out'] = self.output_hist
422
422
423 # Object variable to store code object waiting execution. This is
423 # Object variable to store code object waiting execution. This is
424 # used mainly by the multithreaded shells, but it can come in handy in
424 # used mainly by the multithreaded shells, but it can come in handy in
425 # other situations. No need to use a Queue here, since it's a single
425 # other situations. No need to use a Queue here, since it's a single
426 # item which gets cleared once run.
426 # item which gets cleared once run.
427 self.code_to_run = None
427 self.code_to_run = None
428
428
429 # Job manager (for jobs run as background threads)
429 # Job manager (for jobs run as background threads)
430 self.jobs = BackgroundJobManager()
430 self.jobs = BackgroundJobManager()
431 # Put the job manager into builtins so it's always there.
431 # Put the job manager into builtins so it's always there.
432 __builtin__.jobs = self.jobs
432 __builtin__.jobs = self.jobs
433
433
434 # escapes for automatic behavior on the command line
434 # escapes for automatic behavior on the command line
435 self.ESC_SHELL = '!'
435 self.ESC_SHELL = '!'
436 self.ESC_HELP = '?'
436 self.ESC_HELP = '?'
437 self.ESC_MAGIC = '%'
437 self.ESC_MAGIC = '%'
438 self.ESC_QUOTE = ','
438 self.ESC_QUOTE = ','
439 self.ESC_QUOTE2 = ';'
439 self.ESC_QUOTE2 = ';'
440 self.ESC_PAREN = '/'
440 self.ESC_PAREN = '/'
441
441
442 # And their associated handlers
442 # And their associated handlers
443 self.esc_handlers = {self.ESC_PAREN : self.handle_auto,
443 self.esc_handlers = {self.ESC_PAREN : self.handle_auto,
444 self.ESC_QUOTE : self.handle_auto,
444 self.ESC_QUOTE : self.handle_auto,
445 self.ESC_QUOTE2 : self.handle_auto,
445 self.ESC_QUOTE2 : self.handle_auto,
446 self.ESC_MAGIC : self.handle_magic,
446 self.ESC_MAGIC : self.handle_magic,
447 self.ESC_HELP : self.handle_help,
447 self.ESC_HELP : self.handle_help,
448 self.ESC_SHELL : self.handle_shell_escape,
448 self.ESC_SHELL : self.handle_shell_escape,
449 }
449 }
450
450
451 # class initializations
451 # class initializations
452 Magic.__init__(self,self)
452 Magic.__init__(self,self)
453
453
454 # Python source parser/formatter for syntax highlighting
454 # Python source parser/formatter for syntax highlighting
455 pyformat = PyColorize.Parser().format
455 pyformat = PyColorize.Parser().format
456 self.pycolorize = lambda src: pyformat(src,'str',self.rc['colors'])
456 self.pycolorize = lambda src: pyformat(src,'str',self.rc['colors'])
457
457
458 # hooks holds pointers used for user-side customizations
458 # hooks holds pointers used for user-side customizations
459 self.hooks = Struct()
459 self.hooks = Struct()
460
460
461 # Set all default hooks, defined in the IPython.hooks module.
461 # Set all default hooks, defined in the IPython.hooks module.
462 hooks = IPython.hooks
462 hooks = IPython.hooks
463 for hook_name in hooks.__all__:
463 for hook_name in hooks.__all__:
464 self.set_hook(hook_name,getattr(hooks,hook_name))
464 self.set_hook(hook_name,getattr(hooks,hook_name))
465
465
466 # Flag to mark unconditional exit
466 # Flag to mark unconditional exit
467 self.exit_now = False
467 self.exit_now = False
468
468
469 self.usage_min = """\
469 self.usage_min = """\
470 An enhanced console for Python.
470 An enhanced console for Python.
471 Some of its features are:
471 Some of its features are:
472 - Readline support if the readline library is present.
472 - Readline support if the readline library is present.
473 - Tab completion in the local namespace.
473 - Tab completion in the local namespace.
474 - Logging of input, see command-line options.
474 - Logging of input, see command-line options.
475 - System shell escape via ! , eg !ls.
475 - System shell escape via ! , eg !ls.
476 - Magic commands, starting with a % (like %ls, %pwd, %cd, etc.)
476 - Magic commands, starting with a % (like %ls, %pwd, %cd, etc.)
477 - Keeps track of locally defined variables via %who, %whos.
477 - Keeps track of locally defined variables via %who, %whos.
478 - Show object information with a ? eg ?x or x? (use ?? for more info).
478 - Show object information with a ? eg ?x or x? (use ?? for more info).
479 """
479 """
480 if usage: self.usage = usage
480 if usage: self.usage = usage
481 else: self.usage = self.usage_min
481 else: self.usage = self.usage_min
482
482
483 # Storage
483 # Storage
484 self.rc = rc # This will hold all configuration information
484 self.rc = rc # This will hold all configuration information
485 self.pager = 'less'
485 self.pager = 'less'
486 # temporary files used for various purposes. Deleted at exit.
486 # temporary files used for various purposes. Deleted at exit.
487 self.tempfiles = []
487 self.tempfiles = []
488
488
489 # Keep track of readline usage (later set by init_readline)
489 # Keep track of readline usage (later set by init_readline)
490 self.has_readline = False
490 self.has_readline = False
491
491
492 # template for logfile headers. It gets resolved at runtime by the
492 # template for logfile headers. It gets resolved at runtime by the
493 # logstart method.
493 # logstart method.
494 self.loghead_tpl = \
494 self.loghead_tpl = \
495 """#log# Automatic Logger file. *** THIS MUST BE THE FIRST LINE ***
495 """#log# Automatic Logger file. *** THIS MUST BE THE FIRST LINE ***
496 #log# DO NOT CHANGE THIS LINE OR THE TWO BELOW
496 #log# DO NOT CHANGE THIS LINE OR THE TWO BELOW
497 #log# opts = %s
497 #log# opts = %s
498 #log# args = %s
498 #log# args = %s
499 #log# It is safe to make manual edits below here.
499 #log# It is safe to make manual edits below here.
500 #log#-----------------------------------------------------------------------
500 #log#-----------------------------------------------------------------------
501 """
501 """
502 # for pushd/popd management
502 # for pushd/popd management
503 try:
503 try:
504 self.home_dir = get_home_dir()
504 self.home_dir = get_home_dir()
505 except HomeDirError,msg:
505 except HomeDirError,msg:
506 fatal(msg)
506 fatal(msg)
507
507
508 self.dir_stack = [os.getcwd().replace(self.home_dir,'~')]
508 self.dir_stack = [os.getcwd().replace(self.home_dir,'~')]
509
509
510 # Functions to call the underlying shell.
510 # Functions to call the underlying shell.
511
511
512 # utility to expand user variables via Itpl
512 # utility to expand user variables via Itpl
513 self.var_expand = lambda cmd: str(ItplNS(cmd.replace('#','\#'),
513 self.var_expand = lambda cmd: str(ItplNS(cmd.replace('#','\#'),
514 self.user_ns))
514 self.user_ns))
515 # The first is similar to os.system, but it doesn't return a value,
515 # The first is similar to os.system, but it doesn't return a value,
516 # and it allows interpolation of variables in the user's namespace.
516 # and it allows interpolation of variables in the user's namespace.
517 self.system = lambda cmd: shell(self.var_expand(cmd),
517 self.system = lambda cmd: shell(self.var_expand(cmd),
518 header='IPython system call: ',
518 header='IPython system call: ',
519 verbose=self.rc.system_verbose)
519 verbose=self.rc.system_verbose)
520 # These are for getoutput and getoutputerror:
520 # These are for getoutput and getoutputerror:
521 self.getoutput = lambda cmd: \
521 self.getoutput = lambda cmd: \
522 getoutput(self.var_expand(cmd),
522 getoutput(self.var_expand(cmd),
523 header='IPython system call: ',
523 header='IPython system call: ',
524 verbose=self.rc.system_verbose)
524 verbose=self.rc.system_verbose)
525 self.getoutputerror = lambda cmd: \
525 self.getoutputerror = lambda cmd: \
526 getoutputerror(str(ItplNS(cmd.replace('#','\#'),
526 getoutputerror(str(ItplNS(cmd.replace('#','\#'),
527 self.user_ns)),
527 self.user_ns)),
528 header='IPython system call: ',
528 header='IPython system call: ',
529 verbose=self.rc.system_verbose)
529 verbose=self.rc.system_verbose)
530
530
531 # RegExp for splitting line contents into pre-char//first
531 # RegExp for splitting line contents into pre-char//first
532 # word-method//rest. For clarity, each group in on one line.
532 # word-method//rest. For clarity, each group in on one line.
533
533
534 # WARNING: update the regexp if the above escapes are changed, as they
534 # WARNING: update the regexp if the above escapes are changed, as they
535 # are hardwired in.
535 # are hardwired in.
536
536
537 # Don't get carried away with trying to make the autocalling catch too
537 # Don't get carried away with trying to make the autocalling catch too
538 # much: it's better to be conservative rather than to trigger hidden
538 # much: it's better to be conservative rather than to trigger hidden
539 # evals() somewhere and end up causing side effects.
539 # evals() somewhere and end up causing side effects.
540
540
541 self.line_split = re.compile(r'^([\s*,;/])'
541 self.line_split = re.compile(r'^([\s*,;/])'
542 r'([\?\w\.]+\w*\s*)'
542 r'([\?\w\.]+\w*\s*)'
543 r'(\(?.*$)')
543 r'(\(?.*$)')
544
544
545 # Original re, keep around for a while in case changes break something
545 # Original re, keep around for a while in case changes break something
546 #self.line_split = re.compile(r'(^[\s*!\?%,/]?)'
546 #self.line_split = re.compile(r'(^[\s*!\?%,/]?)'
547 # r'(\s*[\?\w\.]+\w*\s*)'
547 # r'(\s*[\?\w\.]+\w*\s*)'
548 # r'(\(?.*$)')
548 # r'(\(?.*$)')
549
549
550 # RegExp to identify potential function names
550 # RegExp to identify potential function names
551 self.re_fun_name = re.compile(r'[a-zA-Z_]([a-zA-Z0-9_.]*) *$')
551 self.re_fun_name = re.compile(r'[a-zA-Z_]([a-zA-Z0-9_.]*) *$')
552 # RegExp to exclude strings with this start from autocalling
552 # RegExp to exclude strings with this start from autocalling
553 self.re_exclude_auto = re.compile('^[!=()<>,\*/\+-]|^is ')
553 self.re_exclude_auto = re.compile('^[!=()<>,\*/\+-]|^is ')
554
554
555 # try to catch also methods for stuff in lists/tuples/dicts: off
555 # try to catch also methods for stuff in lists/tuples/dicts: off
556 # (experimental). For this to work, the line_split regexp would need
556 # (experimental). For this to work, the line_split regexp would need
557 # to be modified so it wouldn't break things at '['. That line is
557 # to be modified so it wouldn't break things at '['. That line is
558 # nasty enough that I shouldn't change it until I can test it _well_.
558 # nasty enough that I shouldn't change it until I can test it _well_.
559 #self.re_fun_name = re.compile (r'[a-zA-Z_]([a-zA-Z0-9_.\[\]]*) ?$')
559 #self.re_fun_name = re.compile (r'[a-zA-Z_]([a-zA-Z0-9_.\[\]]*) ?$')
560
560
561 # keep track of where we started running (mainly for crash post-mortem)
561 # keep track of where we started running (mainly for crash post-mortem)
562 self.starting_dir = os.getcwd()
562 self.starting_dir = os.getcwd()
563
563
564 # Various switches which can be set
564 # Various switches which can be set
565 self.CACHELENGTH = 5000 # this is cheap, it's just text
565 self.CACHELENGTH = 5000 # this is cheap, it's just text
566 self.BANNER = "Python %(version)s on %(platform)s\n" % sys.__dict__
566 self.BANNER = "Python %(version)s on %(platform)s\n" % sys.__dict__
567 self.banner2 = banner2
567 self.banner2 = banner2
568
568
569 # TraceBack handlers:
569 # TraceBack handlers:
570
570
571 # Syntax error handler.
571 # Syntax error handler.
572 self.SyntaxTB = SyntaxTB(color_scheme='NoColor')
572 self.SyntaxTB = SyntaxTB(color_scheme='NoColor')
573
573
574 # The interactive one is initialized with an offset, meaning we always
574 # The interactive one is initialized with an offset, meaning we always
575 # want to remove the topmost item in the traceback, which is our own
575 # want to remove the topmost item in the traceback, which is our own
576 # internal code. Valid modes: ['Plain','Context','Verbose']
576 # internal code. Valid modes: ['Plain','Context','Verbose']
577 self.InteractiveTB = ultraTB.AutoFormattedTB(mode = 'Plain',
577 self.InteractiveTB = ultraTB.AutoFormattedTB(mode = 'Plain',
578 color_scheme='NoColor',
578 color_scheme='NoColor',
579 tb_offset = 1)
579 tb_offset = 1)
580
580
581 # IPython itself shouldn't crash. This will produce a detailed
581 # IPython itself shouldn't crash. This will produce a detailed
582 # post-mortem if it does. But we only install the crash handler for
582 # post-mortem if it does. But we only install the crash handler for
583 # non-threaded shells, the threaded ones use a normal verbose reporter
583 # non-threaded shells, the threaded ones use a normal verbose reporter
584 # and lose the crash handler. This is because exceptions in the main
584 # and lose the crash handler. This is because exceptions in the main
585 # thread (such as in GUI code) propagate directly to sys.excepthook,
585 # thread (such as in GUI code) propagate directly to sys.excepthook,
586 # and there's no point in printing crash dumps for every user exception.
586 # and there's no point in printing crash dumps for every user exception.
587 if self.isthreaded:
587 if self.isthreaded:
588 sys.excepthook = ultraTB.FormattedTB()
588 sys.excepthook = ultraTB.FormattedTB()
589 else:
589 else:
590 from IPython import CrashHandler
590 from IPython import CrashHandler
591 sys.excepthook = CrashHandler.CrashHandler(self)
591 sys.excepthook = CrashHandler.CrashHandler(self)
592
592
593 # The instance will store a pointer to this, so that runtime code
593 # The instance will store a pointer to this, so that runtime code
594 # (such as magics) can access it. This is because during the
594 # (such as magics) can access it. This is because during the
595 # read-eval loop, it gets temporarily overwritten (to deal with GUI
595 # read-eval loop, it gets temporarily overwritten (to deal with GUI
596 # frameworks).
596 # frameworks).
597 self.sys_excepthook = sys.excepthook
597 self.sys_excepthook = sys.excepthook
598
598
599 # and add any custom exception handlers the user may have specified
599 # and add any custom exception handlers the user may have specified
600 self.set_custom_exc(*custom_exceptions)
600 self.set_custom_exc(*custom_exceptions)
601
601
602 # Object inspector
602 # Object inspector
603 self.inspector = OInspect.Inspector(OInspect.InspectColors,
603 self.inspector = OInspect.Inspector(OInspect.InspectColors,
604 PyColorize.ANSICodeColors,
604 PyColorize.ANSICodeColors,
605 'NoColor')
605 'NoColor')
606 # indentation management
606 # indentation management
607 self.autoindent = False
607 self.autoindent = False
608 self.indent_current_nsp = 0
608 self.indent_current_nsp = 0
609 self.indent_current = '' # actual indent string
609 self.indent_current = '' # actual indent string
610
610
611 # Make some aliases automatically
611 # Make some aliases automatically
612 # Prepare list of shell aliases to auto-define
612 # Prepare list of shell aliases to auto-define
613 if os.name == 'posix':
613 if os.name == 'posix':
614 auto_alias = ('mkdir mkdir', 'rmdir rmdir',
614 auto_alias = ('mkdir mkdir', 'rmdir rmdir',
615 'mv mv -i','rm rm -i','cp cp -i',
615 'mv mv -i','rm rm -i','cp cp -i',
616 'cat cat','less less','clear clear',
616 'cat cat','less less','clear clear',
617 # a better ls
617 # a better ls
618 'ls ls -F',
618 'ls ls -F',
619 # long ls
619 # long ls
620 'll ls -lF',
620 'll ls -lF',
621 # color ls
621 # color ls
622 'lc ls -F -o --color',
622 'lc ls -F -o --color',
623 # ls normal files only
623 # ls normal files only
624 'lf ls -F -o --color %l | grep ^-',
624 'lf ls -F -o --color %l | grep ^-',
625 # ls symbolic links
625 # ls symbolic links
626 'lk ls -F -o --color %l | grep ^l',
626 'lk ls -F -o --color %l | grep ^l',
627 # directories or links to directories,
627 # directories or links to directories,
628 'ldir ls -F -o --color %l | grep /$',
628 'ldir ls -F -o --color %l | grep /$',
629 # things which are executable
629 # things which are executable
630 'lx ls -F -o --color %l | grep ^-..x',
630 'lx ls -F -o --color %l | grep ^-..x',
631 )
631 )
632 elif os.name in ['nt','dos']:
632 elif os.name in ['nt','dos']:
633 auto_alias = ('dir dir /on', 'ls dir /on',
633 auto_alias = ('dir dir /on', 'ls dir /on',
634 'ddir dir /ad /on', 'ldir dir /ad /on',
634 'ddir dir /ad /on', 'ldir dir /ad /on',
635 'mkdir mkdir','rmdir rmdir','echo echo',
635 'mkdir mkdir','rmdir rmdir','echo echo',
636 'ren ren','cls cls','copy copy')
636 'ren ren','cls cls','copy copy')
637 else:
637 else:
638 auto_alias = ()
638 auto_alias = ()
639 self.auto_alias = map(lambda s:s.split(None,1),auto_alias)
639 self.auto_alias = map(lambda s:s.split(None,1),auto_alias)
640 # Call the actual (public) initializer
640 # Call the actual (public) initializer
641 self.init_auto_alias()
641 self.init_auto_alias()
642 # end __init__
642 # end __init__
643
643
644 def post_config_initialization(self):
644 def post_config_initialization(self):
645 """Post configuration init method
645 """Post configuration init method
646
646
647 This is called after the configuration files have been processed to
647 This is called after the configuration files have been processed to
648 'finalize' the initialization."""
648 'finalize' the initialization."""
649
649
650 rc = self.rc
650 rc = self.rc
651
651
652 # Load readline proper
652 # Load readline proper
653 if rc.readline:
653 if rc.readline:
654 self.init_readline()
654 self.init_readline()
655
655
656 # log system
656 # log system
657 self.logger = Logger(self,logfname='ipython_log.py',logmode='rotate')
657 self.logger = Logger(self,logfname='ipython_log.py',logmode='rotate')
658 # local shortcut, this is used a LOT
658 # local shortcut, this is used a LOT
659 self.log = self.logger.log
659 self.log = self.logger.log
660
660
661 # Initialize cache, set in/out prompts and printing system
661 # Initialize cache, set in/out prompts and printing system
662 self.outputcache = CachedOutput(self,
662 self.outputcache = CachedOutput(self,
663 rc.cache_size,
663 rc.cache_size,
664 rc.pprint,
664 rc.pprint,
665 input_sep = rc.separate_in,
665 input_sep = rc.separate_in,
666 output_sep = rc.separate_out,
666 output_sep = rc.separate_out,
667 output_sep2 = rc.separate_out2,
667 output_sep2 = rc.separate_out2,
668 ps1 = rc.prompt_in1,
668 ps1 = rc.prompt_in1,
669 ps2 = rc.prompt_in2,
669 ps2 = rc.prompt_in2,
670 ps_out = rc.prompt_out,
670 ps_out = rc.prompt_out,
671 pad_left = rc.prompts_pad_left)
671 pad_left = rc.prompts_pad_left)
672
672
673 # user may have over-ridden the default print hook:
673 # user may have over-ridden the default print hook:
674 try:
674 try:
675 self.outputcache.__class__.display = self.hooks.display
675 self.outputcache.__class__.display = self.hooks.display
676 except AttributeError:
676 except AttributeError:
677 pass
677 pass
678
678
679 # I don't like assigning globally to sys, because it means when embedding
679 # I don't like assigning globally to sys, because it means when embedding
680 # instances, each embedded instance overrides the previous choice. But
680 # instances, each embedded instance overrides the previous choice. But
681 # sys.displayhook seems to be called internally by exec, so I don't see a
681 # sys.displayhook seems to be called internally by exec, so I don't see a
682 # way around it.
682 # way around it.
683 sys.displayhook = self.outputcache
683 sys.displayhook = self.outputcache
684
684
685 # Set user colors (don't do it in the constructor above so that it
685 # Set user colors (don't do it in the constructor above so that it
686 # doesn't crash if colors option is invalid)
686 # doesn't crash if colors option is invalid)
687 self.magic_colors(rc.colors)
687 self.magic_colors(rc.colors)
688
688
689 # Set calling of pdb on exceptions
689 # Set calling of pdb on exceptions
690 self.call_pdb = rc.pdb
690 self.call_pdb = rc.pdb
691
691
692 # Load user aliases
692 # Load user aliases
693 for alias in rc.alias:
693 for alias in rc.alias:
694 self.magic_alias(alias)
694 self.magic_alias(alias)
695
695
696 # dynamic data that survives through sessions
696 # dynamic data that survives through sessions
697 # XXX make the filename a config option?
697 # XXX make the filename a config option?
698 persist_base = 'persist'
698 persist_base = 'persist'
699 if rc.profile:
699 if rc.profile:
700 persist_base += '_%s' % rc.profile
700 persist_base += '_%s' % rc.profile
701 self.persist_fname = os.path.join(rc.ipythondir,persist_base)
701 self.persist_fname = os.path.join(rc.ipythondir,persist_base)
702
702
703 try:
703 try:
704 self.persist = pickle.load(file(self.persist_fname))
704 self.persist = pickle.load(file(self.persist_fname))
705 except:
705 except:
706 self.persist = {}
706 self.persist = {}
707
707
708
708
709 for (key, value) in [(k[2:],v) for (k,v) in self.persist.items() if k.startswith('S:')]:
709 for (key, value) in [(k[2:],v) for (k,v) in self.persist.items() if k.startswith('S:')]:
710 try:
710 try:
711 obj = pickle.loads(value)
711 obj = pickle.loads(value)
712 except:
712 except:
713
713
714 print "Unable to restore variable '%s', ignoring (use %%store -d to forget!)" % key
714 print "Unable to restore variable '%s', ignoring (use %%store -d to forget!)" % key
715 print "The error was:",sys.exc_info()[0]
715 print "The error was:",sys.exc_info()[0]
716 continue
716 continue
717
717
718
718
719 self.user_ns[key] = obj
719 self.user_ns[key] = obj
720
720
721
721
722
722
723
723
724 def set_hook(self,name,hook):
724 def set_hook(self,name,hook):
725 """set_hook(name,hook) -> sets an internal IPython hook.
725 """set_hook(name,hook) -> sets an internal IPython hook.
726
726
727 IPython exposes some of its internal API as user-modifiable hooks. By
727 IPython exposes some of its internal API as user-modifiable hooks. By
728 resetting one of these hooks, you can modify IPython's behavior to
728 resetting one of these hooks, you can modify IPython's behavior to
729 call at runtime your own routines."""
729 call at runtime your own routines."""
730
730
731 # At some point in the future, this should validate the hook before it
731 # At some point in the future, this should validate the hook before it
732 # accepts it. Probably at least check that the hook takes the number
732 # accepts it. Probably at least check that the hook takes the number
733 # of args it's supposed to.
733 # of args it's supposed to.
734 setattr(self.hooks,name,new.instancemethod(hook,self,self.__class__))
734 setattr(self.hooks,name,new.instancemethod(hook,self,self.__class__))
735
735
736 def set_custom_exc(self,exc_tuple,handler):
736 def set_custom_exc(self,exc_tuple,handler):
737 """set_custom_exc(exc_tuple,handler)
737 """set_custom_exc(exc_tuple,handler)
738
738
739 Set a custom exception handler, which will be called if any of the
739 Set a custom exception handler, which will be called if any of the
740 exceptions in exc_tuple occur in the mainloop (specifically, in the
740 exceptions in exc_tuple occur in the mainloop (specifically, in the
741 runcode() method.
741 runcode() method.
742
742
743 Inputs:
743 Inputs:
744
744
745 - exc_tuple: a *tuple* of valid exceptions to call the defined
745 - exc_tuple: a *tuple* of valid exceptions to call the defined
746 handler for. It is very important that you use a tuple, and NOT A
746 handler for. It is very important that you use a tuple, and NOT A
747 LIST here, because of the way Python's except statement works. If
747 LIST here, because of the way Python's except statement works. If
748 you only want to trap a single exception, use a singleton tuple:
748 you only want to trap a single exception, use a singleton tuple:
749
749
750 exc_tuple == (MyCustomException,)
750 exc_tuple == (MyCustomException,)
751
751
752 - handler: this must be defined as a function with the following
752 - handler: this must be defined as a function with the following
753 basic interface: def my_handler(self,etype,value,tb).
753 basic interface: def my_handler(self,etype,value,tb).
754
754
755 This will be made into an instance method (via new.instancemethod)
755 This will be made into an instance method (via new.instancemethod)
756 of IPython itself, and it will be called if any of the exceptions
756 of IPython itself, and it will be called if any of the exceptions
757 listed in the exc_tuple are caught. If the handler is None, an
757 listed in the exc_tuple are caught. If the handler is None, an
758 internal basic one is used, which just prints basic info.
758 internal basic one is used, which just prints basic info.
759
759
760 WARNING: by putting in your own exception handler into IPython's main
760 WARNING: by putting in your own exception handler into IPython's main
761 execution loop, you run a very good chance of nasty crashes. This
761 execution loop, you run a very good chance of nasty crashes. This
762 facility should only be used if you really know what you are doing."""
762 facility should only be used if you really know what you are doing."""
763
763
764 assert type(exc_tuple)==type(()) , \
764 assert type(exc_tuple)==type(()) , \
765 "The custom exceptions must be given AS A TUPLE."
765 "The custom exceptions must be given AS A TUPLE."
766
766
767 def dummy_handler(self,etype,value,tb):
767 def dummy_handler(self,etype,value,tb):
768 print '*** Simple custom exception handler ***'
768 print '*** Simple custom exception handler ***'
769 print 'Exception type :',etype
769 print 'Exception type :',etype
770 print 'Exception value:',value
770 print 'Exception value:',value
771 print 'Traceback :',tb
771 print 'Traceback :',tb
772 print 'Source code :','\n'.join(self.buffer)
772 print 'Source code :','\n'.join(self.buffer)
773
773
774 if handler is None: handler = dummy_handler
774 if handler is None: handler = dummy_handler
775
775
776 self.CustomTB = new.instancemethod(handler,self,self.__class__)
776 self.CustomTB = new.instancemethod(handler,self,self.__class__)
777 self.custom_exceptions = exc_tuple
777 self.custom_exceptions = exc_tuple
778
778
779 def set_custom_completer(self,completer,pos=0):
779 def set_custom_completer(self,completer,pos=0):
780 """set_custom_completer(completer,pos=0)
780 """set_custom_completer(completer,pos=0)
781
781
782 Adds a new custom completer function.
782 Adds a new custom completer function.
783
783
784 The position argument (defaults to 0) is the index in the completers
784 The position argument (defaults to 0) is the index in the completers
785 list where you want the completer to be inserted."""
785 list where you want the completer to be inserted."""
786
786
787 newcomp = new.instancemethod(completer,self.Completer,
787 newcomp = new.instancemethod(completer,self.Completer,
788 self.Completer.__class__)
788 self.Completer.__class__)
789 self.Completer.matchers.insert(pos,newcomp)
789 self.Completer.matchers.insert(pos,newcomp)
790
790
791 def _get_call_pdb(self):
791 def _get_call_pdb(self):
792 return self._call_pdb
792 return self._call_pdb
793
793
794 def _set_call_pdb(self,val):
794 def _set_call_pdb(self,val):
795
795
796 if val not in (0,1,False,True):
796 if val not in (0,1,False,True):
797 raise ValueError,'new call_pdb value must be boolean'
797 raise ValueError,'new call_pdb value must be boolean'
798
798
799 # store value in instance
799 # store value in instance
800 self._call_pdb = val
800 self._call_pdb = val
801
801
802 # notify the actual exception handlers
802 # notify the actual exception handlers
803 self.InteractiveTB.call_pdb = val
803 self.InteractiveTB.call_pdb = val
804 if self.isthreaded:
804 if self.isthreaded:
805 try:
805 try:
806 self.sys_excepthook.call_pdb = val
806 self.sys_excepthook.call_pdb = val
807 except:
807 except:
808 warn('Failed to activate pdb for threaded exception handler')
808 warn('Failed to activate pdb for threaded exception handler')
809
809
810 call_pdb = property(_get_call_pdb,_set_call_pdb,None,
810 call_pdb = property(_get_call_pdb,_set_call_pdb,None,
811 'Control auto-activation of pdb at exceptions')
811 'Control auto-activation of pdb at exceptions')
812
812
813 def complete(self,text):
813 def complete(self,text):
814 """Return a sorted list of all possible completions on text.
814 """Return a sorted list of all possible completions on text.
815
815
816 Inputs:
816 Inputs:
817
817
818 - text: a string of text to be completed on.
818 - text: a string of text to be completed on.
819
819
820 This is a wrapper around the completion mechanism, similar to what
820 This is a wrapper around the completion mechanism, similar to what
821 readline does at the command line when the TAB key is hit. By
821 readline does at the command line when the TAB key is hit. By
822 exposing it as a method, it can be used by other non-readline
822 exposing it as a method, it can be used by other non-readline
823 environments (such as GUIs) for text completion.
823 environments (such as GUIs) for text completion.
824
824
825 Simple usage example:
825 Simple usage example:
826
826
827 In [1]: x = 'hello'
827 In [1]: x = 'hello'
828
828
829 In [2]: __IP.complete('x.l')
829 In [2]: __IP.complete('x.l')
830 Out[2]: ['x.ljust', 'x.lower', 'x.lstrip']"""
830 Out[2]: ['x.ljust', 'x.lower', 'x.lstrip']"""
831
831
832 complete = self.Completer.complete
832 complete = self.Completer.complete
833 state = 0
833 state = 0
834 # use a dict so we get unique keys, since ipyhton's multiple
834 # use a dict so we get unique keys, since ipyhton's multiple
835 # completers can return duplicates.
835 # completers can return duplicates.
836 comps = {}
836 comps = {}
837 while True:
837 while True:
838 newcomp = complete(text,state)
838 newcomp = complete(text,state)
839 if newcomp is None:
839 if newcomp is None:
840 break
840 break
841 comps[newcomp] = 1
841 comps[newcomp] = 1
842 state += 1
842 state += 1
843 outcomps = comps.keys()
843 outcomps = comps.keys()
844 outcomps.sort()
844 outcomps.sort()
845 return outcomps
845 return outcomps
846
846
847 def set_completer_frame(self, frame):
847 def set_completer_frame(self, frame):
848 if frame:
848 if frame:
849 self.Completer.namespace = frame.f_locals
849 self.Completer.namespace = frame.f_locals
850 self.Completer.global_namespace = frame.f_globals
850 self.Completer.global_namespace = frame.f_globals
851 else:
851 else:
852 self.Completer.namespace = self.user_ns
852 self.Completer.namespace = self.user_ns
853 self.Completer.global_namespace = self.user_global_ns
853 self.Completer.global_namespace = self.user_global_ns
854
854
855 def init_auto_alias(self):
855 def init_auto_alias(self):
856 """Define some aliases automatically.
856 """Define some aliases automatically.
857
857
858 These are ALL parameter-less aliases"""
858 These are ALL parameter-less aliases"""
859 for alias,cmd in self.auto_alias:
859 for alias,cmd in self.auto_alias:
860 self.alias_table[alias] = (0,cmd)
860 self.alias_table[alias] = (0,cmd)
861
861
862 def alias_table_validate(self,verbose=0):
862 def alias_table_validate(self,verbose=0):
863 """Update information about the alias table.
863 """Update information about the alias table.
864
864
865 In particular, make sure no Python keywords/builtins are in it."""
865 In particular, make sure no Python keywords/builtins are in it."""
866
866
867 no_alias = self.no_alias
867 no_alias = self.no_alias
868 for k in self.alias_table.keys():
868 for k in self.alias_table.keys():
869 if k in no_alias:
869 if k in no_alias:
870 del self.alias_table[k]
870 del self.alias_table[k]
871 if verbose:
871 if verbose:
872 print ("Deleting alias <%s>, it's a Python "
872 print ("Deleting alias <%s>, it's a Python "
873 "keyword or builtin." % k)
873 "keyword or builtin." % k)
874
874
875 def set_autoindent(self,value=None):
875 def set_autoindent(self,value=None):
876 """Set the autoindent flag, checking for readline support.
876 """Set the autoindent flag, checking for readline support.
877
877
878 If called with no arguments, it acts as a toggle."""
878 If called with no arguments, it acts as a toggle."""
879
879
880 if not self.has_readline:
880 if not self.has_readline:
881 if os.name == 'posix':
881 if os.name == 'posix':
882 warn("The auto-indent feature requires the readline library")
882 warn("The auto-indent feature requires the readline library")
883 self.autoindent = 0
883 self.autoindent = 0
884 return
884 return
885 if value is None:
885 if value is None:
886 self.autoindent = not self.autoindent
886 self.autoindent = not self.autoindent
887 else:
887 else:
888 self.autoindent = value
888 self.autoindent = value
889
889
890 def rc_set_toggle(self,rc_field,value=None):
890 def rc_set_toggle(self,rc_field,value=None):
891 """Set or toggle a field in IPython's rc config. structure.
891 """Set or toggle a field in IPython's rc config. structure.
892
892
893 If called with no arguments, it acts as a toggle.
893 If called with no arguments, it acts as a toggle.
894
894
895 If called with a non-existent field, the resulting AttributeError
895 If called with a non-existent field, the resulting AttributeError
896 exception will propagate out."""
896 exception will propagate out."""
897
897
898 rc_val = getattr(self.rc,rc_field)
898 rc_val = getattr(self.rc,rc_field)
899 if value is None:
899 if value is None:
900 value = not rc_val
900 value = not rc_val
901 setattr(self.rc,rc_field,value)
901 setattr(self.rc,rc_field,value)
902
902
903 def user_setup(self,ipythondir,rc_suffix,mode='install'):
903 def user_setup(self,ipythondir,rc_suffix,mode='install'):
904 """Install the user configuration directory.
904 """Install the user configuration directory.
905
905
906 Can be called when running for the first time or to upgrade the user's
906 Can be called when running for the first time or to upgrade the user's
907 .ipython/ directory with the mode parameter. Valid modes are 'install'
907 .ipython/ directory with the mode parameter. Valid modes are 'install'
908 and 'upgrade'."""
908 and 'upgrade'."""
909
909
910 def wait():
910 def wait():
911 try:
911 try:
912 raw_input("Please press <RETURN> to start IPython.")
912 raw_input("Please press <RETURN> to start IPython.")
913 except EOFError:
913 except EOFError:
914 print >> Term.cout
914 print >> Term.cout
915 print '*'*70
915 print '*'*70
916
916
917 cwd = os.getcwd() # remember where we started
917 cwd = os.getcwd() # remember where we started
918 glb = glob.glob
918 glb = glob.glob
919 print '*'*70
919 print '*'*70
920 if mode == 'install':
920 if mode == 'install':
921 print \
921 print \
922 """Welcome to IPython. I will try to create a personal configuration directory
922 """Welcome to IPython. I will try to create a personal configuration directory
923 where you can customize many aspects of IPython's functionality in:\n"""
923 where you can customize many aspects of IPython's functionality in:\n"""
924 else:
924 else:
925 print 'I am going to upgrade your configuration in:'
925 print 'I am going to upgrade your configuration in:'
926
926
927 print ipythondir
927 print ipythondir
928
928
929 rcdirend = os.path.join('IPython','UserConfig')
929 rcdirend = os.path.join('IPython','UserConfig')
930 cfg = lambda d: os.path.join(d,rcdirend)
930 cfg = lambda d: os.path.join(d,rcdirend)
931 try:
931 try:
932 rcdir = filter(os.path.isdir,map(cfg,sys.path))[0]
932 rcdir = filter(os.path.isdir,map(cfg,sys.path))[0]
933 except IOError:
933 except IOError:
934 warning = """
934 warning = """
935 Installation error. IPython's directory was not found.
935 Installation error. IPython's directory was not found.
936
936
937 Check the following:
937 Check the following:
938
938
939 The ipython/IPython directory should be in a directory belonging to your
939 The ipython/IPython directory should be in a directory belonging to your
940 PYTHONPATH environment variable (that is, it should be in a directory
940 PYTHONPATH environment variable (that is, it should be in a directory
941 belonging to sys.path). You can copy it explicitly there or just link to it.
941 belonging to sys.path). You can copy it explicitly there or just link to it.
942
942
943 IPython will proceed with builtin defaults.
943 IPython will proceed with builtin defaults.
944 """
944 """
945 warn(warning)
945 warn(warning)
946 wait()
946 wait()
947 return
947 return
948
948
949 if mode == 'install':
949 if mode == 'install':
950 try:
950 try:
951 shutil.copytree(rcdir,ipythondir)
951 shutil.copytree(rcdir,ipythondir)
952 os.chdir(ipythondir)
952 os.chdir(ipythondir)
953 rc_files = glb("ipythonrc*")
953 rc_files = glb("ipythonrc*")
954 for rc_file in rc_files:
954 for rc_file in rc_files:
955 os.rename(rc_file,rc_file+rc_suffix)
955 os.rename(rc_file,rc_file+rc_suffix)
956 except:
956 except:
957 warning = """
957 warning = """
958
958
959 There was a problem with the installation:
959 There was a problem with the installation:
960 %s
960 %s
961 Try to correct it or contact the developers if you think it's a bug.
961 Try to correct it or contact the developers if you think it's a bug.
962 IPython will proceed with builtin defaults.""" % sys.exc_info()[1]
962 IPython will proceed with builtin defaults.""" % sys.exc_info()[1]
963 warn(warning)
963 warn(warning)
964 wait()
964 wait()
965 return
965 return
966
966
967 elif mode == 'upgrade':
967 elif mode == 'upgrade':
968 try:
968 try:
969 os.chdir(ipythondir)
969 os.chdir(ipythondir)
970 except:
970 except:
971 print """
971 print """
972 Can not upgrade: changing to directory %s failed. Details:
972 Can not upgrade: changing to directory %s failed. Details:
973 %s
973 %s
974 """ % (ipythondir,sys.exc_info()[1])
974 """ % (ipythondir,sys.exc_info()[1])
975 wait()
975 wait()
976 return
976 return
977 else:
977 else:
978 sources = glb(os.path.join(rcdir,'[A-Za-z]*'))
978 sources = glb(os.path.join(rcdir,'[A-Za-z]*'))
979 for new_full_path in sources:
979 for new_full_path in sources:
980 new_filename = os.path.basename(new_full_path)
980 new_filename = os.path.basename(new_full_path)
981 if new_filename.startswith('ipythonrc'):
981 if new_filename.startswith('ipythonrc'):
982 new_filename = new_filename + rc_suffix
982 new_filename = new_filename + rc_suffix
983 # The config directory should only contain files, skip any
983 # The config directory should only contain files, skip any
984 # directories which may be there (like CVS)
984 # directories which may be there (like CVS)
985 if os.path.isdir(new_full_path):
985 if os.path.isdir(new_full_path):
986 continue
986 continue
987 if os.path.exists(new_filename):
987 if os.path.exists(new_filename):
988 old_file = new_filename+'.old'
988 old_file = new_filename+'.old'
989 if os.path.exists(old_file):
989 if os.path.exists(old_file):
990 os.remove(old_file)
990 os.remove(old_file)
991 os.rename(new_filename,old_file)
991 os.rename(new_filename,old_file)
992 shutil.copy(new_full_path,new_filename)
992 shutil.copy(new_full_path,new_filename)
993 else:
993 else:
994 raise ValueError,'unrecognized mode for install:',`mode`
994 raise ValueError,'unrecognized mode for install:',`mode`
995
995
996 # Fix line-endings to those native to each platform in the config
996 # Fix line-endings to those native to each platform in the config
997 # directory.
997 # directory.
998 try:
998 try:
999 os.chdir(ipythondir)
999 os.chdir(ipythondir)
1000 except:
1000 except:
1001 print """
1001 print """
1002 Problem: changing to directory %s failed.
1002 Problem: changing to directory %s failed.
1003 Details:
1003 Details:
1004 %s
1004 %s
1005
1005
1006 Some configuration files may have incorrect line endings. This should not
1006 Some configuration files may have incorrect line endings. This should not
1007 cause any problems during execution. """ % (ipythondir,sys.exc_info()[1])
1007 cause any problems during execution. """ % (ipythondir,sys.exc_info()[1])
1008 wait()
1008 wait()
1009 else:
1009 else:
1010 for fname in glb('ipythonrc*'):
1010 for fname in glb('ipythonrc*'):
1011 try:
1011 try:
1012 native_line_ends(fname,backup=0)
1012 native_line_ends(fname,backup=0)
1013 except IOError:
1013 except IOError:
1014 pass
1014 pass
1015
1015
1016 if mode == 'install':
1016 if mode == 'install':
1017 print """
1017 print """
1018 Successful installation!
1018 Successful installation!
1019
1019
1020 Please read the sections 'Initial Configuration' and 'Quick Tips' in the
1020 Please read the sections 'Initial Configuration' and 'Quick Tips' in the
1021 IPython manual (there are both HTML and PDF versions supplied with the
1021 IPython manual (there are both HTML and PDF versions supplied with the
1022 distribution) to make sure that your system environment is properly configured
1022 distribution) to make sure that your system environment is properly configured
1023 to take advantage of IPython's features."""
1023 to take advantage of IPython's features."""
1024 else:
1024 else:
1025 print """
1025 print """
1026 Successful upgrade!
1026 Successful upgrade!
1027
1027
1028 All files in your directory:
1028 All files in your directory:
1029 %(ipythondir)s
1029 %(ipythondir)s
1030 which would have been overwritten by the upgrade were backed up with a .old
1030 which would have been overwritten by the upgrade were backed up with a .old
1031 extension. If you had made particular customizations in those files you may
1031 extension. If you had made particular customizations in those files you may
1032 want to merge them back into the new files.""" % locals()
1032 want to merge them back into the new files.""" % locals()
1033 wait()
1033 wait()
1034 os.chdir(cwd)
1034 os.chdir(cwd)
1035 # end user_setup()
1035 # end user_setup()
1036
1036
1037 def atexit_operations(self):
1037 def atexit_operations(self):
1038 """This will be executed at the time of exit.
1038 """This will be executed at the time of exit.
1039
1039
1040 Saving of persistent data should be performed here. """
1040 Saving of persistent data should be performed here. """
1041
1041
1042 # input history
1042 # input history
1043 self.savehist()
1043 self.savehist()
1044
1044
1045 # Cleanup all tempfiles left around
1045 # Cleanup all tempfiles left around
1046 for tfile in self.tempfiles:
1046 for tfile in self.tempfiles:
1047 try:
1047 try:
1048 os.unlink(tfile)
1048 os.unlink(tfile)
1049 except OSError:
1049 except OSError:
1050 pass
1050 pass
1051
1051
1052 # save the "persistent data" catch-all dictionary
1052 # save the "persistent data" catch-all dictionary
1053 try:
1053 try:
1054 pickle.dump(self.persist, open(self.persist_fname,"w"))
1054 pickle.dump(self.persist, open(self.persist_fname,"w"))
1055 except:
1055 except:
1056 print "*** ERROR *** persistent data saving failed."
1056 print "*** ERROR *** persistent data saving failed."
1057
1057
1058 def savehist(self):
1058 def savehist(self):
1059 """Save input history to a file (via readline library)."""
1059 """Save input history to a file (via readline library)."""
1060 try:
1060 try:
1061 self.readline.write_history_file(self.histfile)
1061 self.readline.write_history_file(self.histfile)
1062 except:
1062 except:
1063 print 'Unable to save IPython command history to file: ' + \
1063 print 'Unable to save IPython command history to file: ' + \
1064 `self.histfile`
1064 `self.histfile`
1065
1065
1066 def pre_readline(self):
1066 def pre_readline(self):
1067 """readline hook to be used at the start of each line.
1067 """readline hook to be used at the start of each line.
1068
1068
1069 Currently it handles auto-indent only."""
1069 Currently it handles auto-indent only."""
1070
1070
1071 self.readline.insert_text(self.indent_current)
1071 self.readline.insert_text(self.indent_current)
1072
1072
1073 def init_readline(self):
1073 def init_readline(self):
1074 """Command history completion/saving/reloading."""
1074 """Command history completion/saving/reloading."""
1075 try:
1075 try:
1076 import readline
1076 import readline
1077 except ImportError:
1077 except ImportError:
1078 self.has_readline = 0
1078 self.has_readline = 0
1079 self.readline = None
1079 self.readline = None
1080 # no point in bugging windows users with this every time:
1080 # no point in bugging windows users with this every time:
1081 if os.name == 'posix':
1081 if os.name == 'posix':
1082 warn('Readline services not available on this platform.')
1082 warn('Readline services not available on this platform.')
1083 else:
1083 else:
1084 import atexit
1084 import atexit
1085 from IPython.completer import IPCompleter
1085 from IPython.completer import IPCompleter
1086 self.Completer = IPCompleter(self,
1086 self.Completer = IPCompleter(self,
1087 self.user_ns,
1087 self.user_ns,
1088 self.user_global_ns,
1088 self.user_global_ns,
1089 self.rc.readline_omit__names,
1089 self.rc.readline_omit__names,
1090 self.alias_table)
1090 self.alias_table)
1091
1091
1092 # Platform-specific configuration
1092 # Platform-specific configuration
1093 if os.name == 'nt':
1093 if os.name == 'nt':
1094 self.readline_startup_hook = readline.set_pre_input_hook
1094 self.readline_startup_hook = readline.set_pre_input_hook
1095 else:
1095 else:
1096 self.readline_startup_hook = readline.set_startup_hook
1096 self.readline_startup_hook = readline.set_startup_hook
1097
1097
1098 # Load user's initrc file (readline config)
1098 # Load user's initrc file (readline config)
1099 inputrc_name = os.environ.get('INPUTRC')
1099 inputrc_name = os.environ.get('INPUTRC')
1100 if inputrc_name is None:
1100 if inputrc_name is None:
1101 home_dir = get_home_dir()
1101 home_dir = get_home_dir()
1102 if home_dir is not None:
1102 if home_dir is not None:
1103 inputrc_name = os.path.join(home_dir,'.inputrc')
1103 inputrc_name = os.path.join(home_dir,'.inputrc')
1104 if os.path.isfile(inputrc_name):
1104 if os.path.isfile(inputrc_name):
1105 try:
1105 try:
1106 readline.read_init_file(inputrc_name)
1106 readline.read_init_file(inputrc_name)
1107 except:
1107 except:
1108 warn('Problems reading readline initialization file <%s>'
1108 warn('Problems reading readline initialization file <%s>'
1109 % inputrc_name)
1109 % inputrc_name)
1110
1110
1111 self.has_readline = 1
1111 self.has_readline = 1
1112 self.readline = readline
1112 self.readline = readline
1113 # save this in sys so embedded copies can restore it properly
1113 # save this in sys so embedded copies can restore it properly
1114 sys.ipcompleter = self.Completer.complete
1114 sys.ipcompleter = self.Completer.complete
1115 readline.set_completer(self.Completer.complete)
1115 readline.set_completer(self.Completer.complete)
1116
1116
1117 # Configure readline according to user's prefs
1117 # Configure readline according to user's prefs
1118 for rlcommand in self.rc.readline_parse_and_bind:
1118 for rlcommand in self.rc.readline_parse_and_bind:
1119 readline.parse_and_bind(rlcommand)
1119 readline.parse_and_bind(rlcommand)
1120
1120
1121 # remove some chars from the delimiters list
1121 # remove some chars from the delimiters list
1122 delims = readline.get_completer_delims()
1122 delims = readline.get_completer_delims()
1123 delims = delims.translate(string._idmap,
1123 delims = delims.translate(string._idmap,
1124 self.rc.readline_remove_delims)
1124 self.rc.readline_remove_delims)
1125 readline.set_completer_delims(delims)
1125 readline.set_completer_delims(delims)
1126 # otherwise we end up with a monster history after a while:
1126 # otherwise we end up with a monster history after a while:
1127 readline.set_history_length(1000)
1127 readline.set_history_length(1000)
1128 try:
1128 try:
1129 #print '*** Reading readline history' # dbg
1129 #print '*** Reading readline history' # dbg
1130 readline.read_history_file(self.histfile)
1130 readline.read_history_file(self.histfile)
1131 except IOError:
1131 except IOError:
1132 pass # It doesn't exist yet.
1132 pass # It doesn't exist yet.
1133
1133
1134 atexit.register(self.atexit_operations)
1134 atexit.register(self.atexit_operations)
1135 del atexit
1135 del atexit
1136
1136
1137 # Configure auto-indent for all platforms
1137 # Configure auto-indent for all platforms
1138 self.set_autoindent(self.rc.autoindent)
1138 self.set_autoindent(self.rc.autoindent)
1139
1139
1140 def _should_recompile(self,e):
1140 def _should_recompile(self,e):
1141 """Utility routine for edit_syntax_error"""
1141 """Utility routine for edit_syntax_error"""
1142
1142
1143 if e.filename in ('<ipython console>','<input>','<string>',
1143 if e.filename in ('<ipython console>','<input>','<string>',
1144 '<console>'):
1144 '<console>'):
1145 return False
1145 return False
1146 try:
1146 try:
1147 if not ask_yes_no('Return to editor to correct syntax error? '
1147 if not ask_yes_no('Return to editor to correct syntax error? '
1148 '[Y/n] ','y'):
1148 '[Y/n] ','y'):
1149 return False
1149 return False
1150 except EOFError:
1150 except EOFError:
1151 return False
1151 return False
1152 self.hooks.fix_error_editor(e.filename,e.lineno,e.offset,e.msg)
1152 self.hooks.fix_error_editor(e.filename,e.lineno,e.offset,e.msg)
1153 return True
1153 return True
1154
1154
1155 def edit_syntax_error(self):
1155 def edit_syntax_error(self):
1156 """The bottom half of the syntax error handler called in the main loop.
1156 """The bottom half of the syntax error handler called in the main loop.
1157
1157
1158 Loop until syntax error is fixed or user cancels.
1158 Loop until syntax error is fixed or user cancels.
1159 """
1159 """
1160
1160
1161 while self.SyntaxTB.last_syntax_error:
1161 while self.SyntaxTB.last_syntax_error:
1162 # copy and clear last_syntax_error
1162 # copy and clear last_syntax_error
1163 err = self.SyntaxTB.clear_err_state()
1163 err = self.SyntaxTB.clear_err_state()
1164 if not self._should_recompile(err):
1164 if not self._should_recompile(err):
1165 return
1165 return
1166 try:
1166 try:
1167 # may set last_syntax_error again if a SyntaxError is raised
1167 # may set last_syntax_error again if a SyntaxError is raised
1168 self.safe_execfile(err.filename,self.shell.user_ns)
1168 self.safe_execfile(err.filename,self.shell.user_ns)
1169 except:
1169 except:
1170 self.showtraceback()
1170 self.showtraceback()
1171 else:
1171 else:
1172 f = file(err.filename)
1172 f = file(err.filename)
1173 try:
1173 try:
1174 sys.displayhook(f.read())
1174 sys.displayhook(f.read())
1175 finally:
1175 finally:
1176 f.close()
1176 f.close()
1177
1177
1178 def showsyntaxerror(self, filename=None):
1178 def showsyntaxerror(self, filename=None):
1179 """Display the syntax error that just occurred.
1179 """Display the syntax error that just occurred.
1180
1180
1181 This doesn't display a stack trace because there isn't one.
1181 This doesn't display a stack trace because there isn't one.
1182
1182
1183 If a filename is given, it is stuffed in the exception instead
1183 If a filename is given, it is stuffed in the exception instead
1184 of what was there before (because Python's parser always uses
1184 of what was there before (because Python's parser always uses
1185 "<string>" when reading from a string).
1185 "<string>" when reading from a string).
1186 """
1186 """
1187 etype, value, last_traceback = sys.exc_info()
1187 etype, value, last_traceback = sys.exc_info()
1188 if filename and etype is SyntaxError:
1188 if filename and etype is SyntaxError:
1189 # Work hard to stuff the correct filename in the exception
1189 # Work hard to stuff the correct filename in the exception
1190 try:
1190 try:
1191 msg, (dummy_filename, lineno, offset, line) = value
1191 msg, (dummy_filename, lineno, offset, line) = value
1192 except:
1192 except:
1193 # Not the format we expect; leave it alone
1193 # Not the format we expect; leave it alone
1194 pass
1194 pass
1195 else:
1195 else:
1196 # Stuff in the right filename
1196 # Stuff in the right filename
1197 try:
1197 try:
1198 # Assume SyntaxError is a class exception
1198 # Assume SyntaxError is a class exception
1199 value = SyntaxError(msg, (filename, lineno, offset, line))
1199 value = SyntaxError(msg, (filename, lineno, offset, line))
1200 except:
1200 except:
1201 # If that failed, assume SyntaxError is a string
1201 # If that failed, assume SyntaxError is a string
1202 value = msg, (filename, lineno, offset, line)
1202 value = msg, (filename, lineno, offset, line)
1203 self.SyntaxTB(etype,value,[])
1203 self.SyntaxTB(etype,value,[])
1204
1204
1205 def debugger(self):
1205 def debugger(self):
1206 """Call the pdb debugger."""
1206 """Call the pdb debugger."""
1207
1207
1208 if not self.rc.pdb:
1208 if not self.rc.pdb:
1209 return
1209 return
1210 pdb.pm()
1210 pdb.pm()
1211
1211
1212 def showtraceback(self,exc_tuple = None,filename=None):
1212 def showtraceback(self,exc_tuple = None,filename=None):
1213 """Display the exception that just occurred."""
1213 """Display the exception that just occurred."""
1214
1214
1215 # Though this won't be called by syntax errors in the input line,
1215 # Though this won't be called by syntax errors in the input line,
1216 # there may be SyntaxError cases whith imported code.
1216 # there may be SyntaxError cases whith imported code.
1217 if exc_tuple is None:
1217 if exc_tuple is None:
1218 type, value, tb = sys.exc_info()
1218 type, value, tb = sys.exc_info()
1219 else:
1219 else:
1220 type, value, tb = exc_tuple
1220 type, value, tb = exc_tuple
1221 if type is SyntaxError:
1221 if type is SyntaxError:
1222 self.showsyntaxerror(filename)
1222 self.showsyntaxerror(filename)
1223 else:
1223 else:
1224 self.InteractiveTB()
1224 self.InteractiveTB()
1225 if self.InteractiveTB.call_pdb and self.has_readline:
1225 if self.InteractiveTB.call_pdb and self.has_readline:
1226 # pdb mucks up readline, fix it back
1226 # pdb mucks up readline, fix it back
1227 self.readline.set_completer(self.Completer.complete)
1227 self.readline.set_completer(self.Completer.complete)
1228
1228
1229 def mainloop(self,banner=None):
1229 def mainloop(self,banner=None):
1230 """Creates the local namespace and starts the mainloop.
1230 """Creates the local namespace and starts the mainloop.
1231
1231
1232 If an optional banner argument is given, it will override the
1232 If an optional banner argument is given, it will override the
1233 internally created default banner."""
1233 internally created default banner."""
1234
1234
1235 if self.rc.c: # Emulate Python's -c option
1235 if self.rc.c: # Emulate Python's -c option
1236 self.exec_init_cmd()
1236 self.exec_init_cmd()
1237 if banner is None:
1237 if banner is None:
1238 if self.rc.banner:
1238 if self.rc.banner:
1239 banner = self.BANNER+self.banner2
1239 banner = self.BANNER+self.banner2
1240 else:
1240 else:
1241 banner = ''
1241 banner = ''
1242 self.interact(banner)
1242 self.interact(banner)
1243
1243
1244 def exec_init_cmd(self):
1244 def exec_init_cmd(self):
1245 """Execute a command given at the command line.
1245 """Execute a command given at the command line.
1246
1246
1247 This emulates Python's -c option."""
1247 This emulates Python's -c option."""
1248
1248
1249 sys.argv = ['-c']
1249 sys.argv = ['-c']
1250 self.push(self.rc.c)
1250 self.push(self.rc.c)
1251
1251
1252 def embed_mainloop(self,header='',local_ns=None,global_ns=None,stack_depth=0):
1252 def embed_mainloop(self,header='',local_ns=None,global_ns=None,stack_depth=0):
1253 """Embeds IPython into a running python program.
1253 """Embeds IPython into a running python program.
1254
1254
1255 Input:
1255 Input:
1256
1256
1257 - header: An optional header message can be specified.
1257 - header: An optional header message can be specified.
1258
1258
1259 - local_ns, global_ns: working namespaces. If given as None, the
1259 - local_ns, global_ns: working namespaces. If given as None, the
1260 IPython-initialized one is updated with __main__.__dict__, so that
1260 IPython-initialized one is updated with __main__.__dict__, so that
1261 program variables become visible but user-specific configuration
1261 program variables become visible but user-specific configuration
1262 remains possible.
1262 remains possible.
1263
1263
1264 - stack_depth: specifies how many levels in the stack to go to
1264 - stack_depth: specifies how many levels in the stack to go to
1265 looking for namespaces (when local_ns and global_ns are None). This
1265 looking for namespaces (when local_ns and global_ns are None). This
1266 allows an intermediate caller to make sure that this function gets
1266 allows an intermediate caller to make sure that this function gets
1267 the namespace from the intended level in the stack. By default (0)
1267 the namespace from the intended level in the stack. By default (0)
1268 it will get its locals and globals from the immediate caller.
1268 it will get its locals and globals from the immediate caller.
1269
1269
1270 Warning: it's possible to use this in a program which is being run by
1270 Warning: it's possible to use this in a program which is being run by
1271 IPython itself (via %run), but some funny things will happen (a few
1271 IPython itself (via %run), but some funny things will happen (a few
1272 globals get overwritten). In the future this will be cleaned up, as
1272 globals get overwritten). In the future this will be cleaned up, as
1273 there is no fundamental reason why it can't work perfectly."""
1273 there is no fundamental reason why it can't work perfectly."""
1274
1274
1275 # Get locals and globals from caller
1275 # Get locals and globals from caller
1276 if local_ns is None or global_ns is None:
1276 if local_ns is None or global_ns is None:
1277 call_frame = sys._getframe(stack_depth).f_back
1277 call_frame = sys._getframe(stack_depth).f_back
1278
1278
1279 if local_ns is None:
1279 if local_ns is None:
1280 local_ns = call_frame.f_locals
1280 local_ns = call_frame.f_locals
1281 if global_ns is None:
1281 if global_ns is None:
1282 global_ns = call_frame.f_globals
1282 global_ns = call_frame.f_globals
1283
1283
1284 # Update namespaces and fire up interpreter
1284 # Update namespaces and fire up interpreter
1285 self.user_ns = local_ns
1285 self.user_ns = local_ns
1286 self.user_global_ns = global_ns
1286 self.user_global_ns = global_ns
1287
1287
1288 # Patch for global embedding to make sure that things don't overwrite
1288 # Patch for global embedding to make sure that things don't overwrite
1289 # user globals accidentally. Thanks to Richard <rxe@renre-europe.com>
1289 # user globals accidentally. Thanks to Richard <rxe@renre-europe.com>
1290 # FIXME. Test this a bit more carefully (the if.. is new)
1290 # FIXME. Test this a bit more carefully (the if.. is new)
1291 if local_ns is None and global_ns is None:
1291 if local_ns is None and global_ns is None:
1292 self.user_global_ns.update(__main__.__dict__)
1292 self.user_global_ns.update(__main__.__dict__)
1293
1293
1294 # make sure the tab-completer has the correct frame information, so it
1294 # make sure the tab-completer has the correct frame information, so it
1295 # actually completes using the frame's locals/globals
1295 # actually completes using the frame's locals/globals
1296 self.set_completer_frame(call_frame)
1296 self.set_completer_frame(call_frame)
1297
1297
1298 self.interact(header)
1298 self.interact(header)
1299
1299
1300 def interact(self, banner=None):
1300 def interact(self, banner=None):
1301 """Closely emulate the interactive Python console.
1301 """Closely emulate the interactive Python console.
1302
1302
1303 The optional banner argument specify the banner to print
1303 The optional banner argument specify the banner to print
1304 before the first interaction; by default it prints a banner
1304 before the first interaction; by default it prints a banner
1305 similar to the one printed by the real Python interpreter,
1305 similar to the one printed by the real Python interpreter,
1306 followed by the current class name in parentheses (so as not
1306 followed by the current class name in parentheses (so as not
1307 to confuse this with the real interpreter -- since it's so
1307 to confuse this with the real interpreter -- since it's so
1308 close!).
1308 close!).
1309
1309
1310 """
1310 """
1311 cprt = 'Type "copyright", "credits" or "license" for more information.'
1311 cprt = 'Type "copyright", "credits" or "license" for more information.'
1312 if banner is None:
1312 if banner is None:
1313 self.write("Python %s on %s\n%s\n(%s)\n" %
1313 self.write("Python %s on %s\n%s\n(%s)\n" %
1314 (sys.version, sys.platform, cprt,
1314 (sys.version, sys.platform, cprt,
1315 self.__class__.__name__))
1315 self.__class__.__name__))
1316 else:
1316 else:
1317 self.write(banner)
1317 self.write(banner)
1318
1318
1319 more = 0
1319 more = 0
1320
1320
1321 # Mark activity in the builtins
1321 # Mark activity in the builtins
1322 __builtin__.__dict__['__IPYTHON__active'] += 1
1322 __builtin__.__dict__['__IPYTHON__active'] += 1
1323
1323
1324 # exit_now is set by a call to %Exit or %Quit
1324 # exit_now is set by a call to %Exit or %Quit
1325 while not self.exit_now:
1325 while not self.exit_now:
1326 try:
1326 try:
1327 if more:
1327 if more:
1328 prompt = self.outputcache.prompt2
1328 prompt = self.outputcache.prompt2
1329 if self.autoindent:
1329 if self.autoindent:
1330 self.readline_startup_hook(self.pre_readline)
1330 self.readline_startup_hook(self.pre_readline)
1331 else:
1331 else:
1332 prompt = self.outputcache.prompt1
1332 prompt = self.outputcache.prompt1
1333 try:
1333 try:
1334 line = self.raw_input(prompt,more)
1334 line = self.raw_input(prompt,more)
1335 if self.autoindent:
1335 if self.autoindent:
1336 self.readline_startup_hook(None)
1336 self.readline_startup_hook(None)
1337 except EOFError:
1337 except EOFError:
1338 if self.autoindent:
1338 if self.autoindent:
1339 self.readline_startup_hook(None)
1339 self.readline_startup_hook(None)
1340 self.write("\n")
1340 self.write("\n")
1341 self.exit()
1341 self.exit()
1342 else:
1342 else:
1343 more = self.push(line)
1343 more = self.push(line)
1344
1344
1345 if (self.SyntaxTB.last_syntax_error and
1345 if (self.SyntaxTB.last_syntax_error and
1346 self.rc.autoedit_syntax):
1346 self.rc.autoedit_syntax):
1347 self.edit_syntax_error()
1347 self.edit_syntax_error()
1348
1348
1349 except KeyboardInterrupt:
1349 except KeyboardInterrupt:
1350 self.write("\nKeyboardInterrupt\n")
1350 self.write("\nKeyboardInterrupt\n")
1351 self.resetbuffer()
1351 self.resetbuffer()
1352 more = 0
1352 more = 0
1353 # keep cache in sync with the prompt counter:
1353 # keep cache in sync with the prompt counter:
1354 self.outputcache.prompt_count -= 1
1354 self.outputcache.prompt_count -= 1
1355
1355
1356 if self.autoindent:
1356 if self.autoindent:
1357 self.indent_current_nsp = 0
1357 self.indent_current_nsp = 0
1358 self.indent_current = ' '* self.indent_current_nsp
1358 self.indent_current = ' '* self.indent_current_nsp
1359
1359
1360 except bdb.BdbQuit:
1360 except bdb.BdbQuit:
1361 warn("The Python debugger has exited with a BdbQuit exception.\n"
1361 warn("The Python debugger has exited with a BdbQuit exception.\n"
1362 "Because of how pdb handles the stack, it is impossible\n"
1362 "Because of how pdb handles the stack, it is impossible\n"
1363 "for IPython to properly format this particular exception.\n"
1363 "for IPython to properly format this particular exception.\n"
1364 "IPython will resume normal operation.")
1364 "IPython will resume normal operation.")
1365
1365
1366 # We are off again...
1366 # We are off again...
1367 __builtin__.__dict__['__IPYTHON__active'] -= 1
1367 __builtin__.__dict__['__IPYTHON__active'] -= 1
1368
1368
1369 def excepthook(self, type, value, tb):
1369 def excepthook(self, type, value, tb):
1370 """One more defense for GUI apps that call sys.excepthook.
1370 """One more defense for GUI apps that call sys.excepthook.
1371
1371
1372 GUI frameworks like wxPython trap exceptions and call
1372 GUI frameworks like wxPython trap exceptions and call
1373 sys.excepthook themselves. I guess this is a feature that
1373 sys.excepthook themselves. I guess this is a feature that
1374 enables them to keep running after exceptions that would
1374 enables them to keep running after exceptions that would
1375 otherwise kill their mainloop. This is a bother for IPython
1375 otherwise kill their mainloop. This is a bother for IPython
1376 which excepts to catch all of the program exceptions with a try:
1376 which excepts to catch all of the program exceptions with a try:
1377 except: statement.
1377 except: statement.
1378
1378
1379 Normally, IPython sets sys.excepthook to a CrashHandler instance, so if
1379 Normally, IPython sets sys.excepthook to a CrashHandler instance, so if
1380 any app directly invokes sys.excepthook, it will look to the user like
1380 any app directly invokes sys.excepthook, it will look to the user like
1381 IPython crashed. In order to work around this, we can disable the
1381 IPython crashed. In order to work around this, we can disable the
1382 CrashHandler and replace it with this excepthook instead, which prints a
1382 CrashHandler and replace it with this excepthook instead, which prints a
1383 regular traceback using our InteractiveTB. In this fashion, apps which
1383 regular traceback using our InteractiveTB. In this fashion, apps which
1384 call sys.excepthook will generate a regular-looking exception from
1384 call sys.excepthook will generate a regular-looking exception from
1385 IPython, and the CrashHandler will only be triggered by real IPython
1385 IPython, and the CrashHandler will only be triggered by real IPython
1386 crashes.
1386 crashes.
1387
1387
1388 This hook should be used sparingly, only in places which are not likely
1388 This hook should be used sparingly, only in places which are not likely
1389 to be true IPython errors.
1389 to be true IPython errors.
1390 """
1390 """
1391
1391
1392 self.InteractiveTB(type, value, tb, tb_offset=0)
1392 self.InteractiveTB(type, value, tb, tb_offset=0)
1393 if self.InteractiveTB.call_pdb and self.has_readline:
1393 if self.InteractiveTB.call_pdb and self.has_readline:
1394 self.readline.set_completer(self.Completer.complete)
1394 self.readline.set_completer(self.Completer.complete)
1395
1395
1396 def call_alias(self,alias,rest=''):
1396 def call_alias(self,alias,rest=''):
1397 """Call an alias given its name and the rest of the line.
1397 """Call an alias given its name and the rest of the line.
1398
1398
1399 This function MUST be given a proper alias, because it doesn't make
1399 This function MUST be given a proper alias, because it doesn't make
1400 any checks when looking up into the alias table. The caller is
1400 any checks when looking up into the alias table. The caller is
1401 responsible for invoking it only with a valid alias."""
1401 responsible for invoking it only with a valid alias."""
1402
1402
1403 #print 'ALIAS: <%s>+<%s>' % (alias,rest) # dbg
1403 #print 'ALIAS: <%s>+<%s>' % (alias,rest) # dbg
1404 nargs,cmd = self.alias_table[alias]
1404 nargs,cmd = self.alias_table[alias]
1405 # Expand the %l special to be the user's input line
1405 # Expand the %l special to be the user's input line
1406 if cmd.find('%l') >= 0:
1406 if cmd.find('%l') >= 0:
1407 cmd = cmd.replace('%l',rest)
1407 cmd = cmd.replace('%l',rest)
1408 rest = ''
1408 rest = ''
1409 if nargs==0:
1409 if nargs==0:
1410 # Simple, argument-less aliases
1410 # Simple, argument-less aliases
1411 cmd = '%s %s' % (cmd,rest)
1411 cmd = '%s %s' % (cmd,rest)
1412 else:
1412 else:
1413 # Handle aliases with positional arguments
1413 # Handle aliases with positional arguments
1414 args = rest.split(None,nargs)
1414 args = rest.split(None,nargs)
1415 if len(args)< nargs:
1415 if len(args)< nargs:
1416 error('Alias <%s> requires %s arguments, %s given.' %
1416 error('Alias <%s> requires %s arguments, %s given.' %
1417 (alias,nargs,len(args)))
1417 (alias,nargs,len(args)))
1418 return
1418 return
1419 cmd = '%s %s' % (cmd % tuple(args[:nargs]),' '.join(args[nargs:]))
1419 cmd = '%s %s' % (cmd % tuple(args[:nargs]),' '.join(args[nargs:]))
1420 # Now call the macro, evaluating in the user's namespace
1420 # Now call the macro, evaluating in the user's namespace
1421 try:
1421 try:
1422 self.system(cmd)
1422 self.system(cmd)
1423 except:
1423 except:
1424 self.showtraceback()
1424 self.showtraceback()
1425
1425
1426 def autoindent_update(self,line):
1426 def autoindent_update(self,line):
1427 """Keep track of the indent level."""
1427 """Keep track of the indent level."""
1428 if self.autoindent:
1428 if self.autoindent:
1429 if line:
1429 if line:
1430 ini_spaces = ini_spaces_re.match(line)
1430 ini_spaces = ini_spaces_re.match(line)
1431 if ini_spaces:
1431 if ini_spaces:
1432 nspaces = ini_spaces.end()
1432 nspaces = ini_spaces.end()
1433 else:
1433 else:
1434 nspaces = 0
1434 nspaces = 0
1435 self.indent_current_nsp = nspaces
1435 self.indent_current_nsp = nspaces
1436
1436
1437 if line[-1] == ':':
1437 if line[-1] == ':':
1438 self.indent_current_nsp += 4
1438 self.indent_current_nsp += 4
1439 elif dedent_re.match(line):
1439 elif dedent_re.match(line):
1440 self.indent_current_nsp -= 4
1440 self.indent_current_nsp -= 4
1441 else:
1441 else:
1442 self.indent_current_nsp = 0
1442 self.indent_current_nsp = 0
1443
1443
1444 # indent_current is the actual string to be inserted
1444 # indent_current is the actual string to be inserted
1445 # by the readline hooks for indentation
1445 # by the readline hooks for indentation
1446 self.indent_current = ' '* self.indent_current_nsp
1446 self.indent_current = ' '* self.indent_current_nsp
1447
1447
1448 def runlines(self,lines):
1448 def runlines(self,lines):
1449 """Run a string of one or more lines of source.
1449 """Run a string of one or more lines of source.
1450
1450
1451 This method is capable of running a string containing multiple source
1451 This method is capable of running a string containing multiple source
1452 lines, as if they had been entered at the IPython prompt. Since it
1452 lines, as if they had been entered at the IPython prompt. Since it
1453 exposes IPython's processing machinery, the given strings can contain
1453 exposes IPython's processing machinery, the given strings can contain
1454 magic calls (%magic), special shell access (!cmd), etc."""
1454 magic calls (%magic), special shell access (!cmd), etc."""
1455
1455
1456 # We must start with a clean buffer, in case this is run from an
1456 # We must start with a clean buffer, in case this is run from an
1457 # interactive IPython session (via a magic, for example).
1457 # interactive IPython session (via a magic, for example).
1458 self.resetbuffer()
1458 self.resetbuffer()
1459 lines = lines.split('\n')
1459 lines = lines.split('\n')
1460 more = 0
1460 more = 0
1461 for line in lines:
1461 for line in lines:
1462 # skip blank lines so we don't mess up the prompt counter, but do
1462 # skip blank lines so we don't mess up the prompt counter, but do
1463 # NOT skip even a blank line if we are in a code block (more is
1463 # NOT skip even a blank line if we are in a code block (more is
1464 # true)
1464 # true)
1465 if line or more:
1465 if line or more:
1466 more = self.push(self.prefilter(line,more))
1466 more = self.push(self.prefilter(line,more))
1467 # IPython's runsource returns None if there was an error
1467 # IPython's runsource returns None if there was an error
1468 # compiling the code. This allows us to stop processing right
1468 # compiling the code. This allows us to stop processing right
1469 # away, so the user gets the error message at the right place.
1469 # away, so the user gets the error message at the right place.
1470 if more is None:
1470 if more is None:
1471 break
1471 break
1472 # final newline in case the input didn't have it, so that the code
1472 # final newline in case the input didn't have it, so that the code
1473 # actually does get executed
1473 # actually does get executed
1474 if more:
1474 if more:
1475 self.push('\n')
1475 self.push('\n')
1476
1476
1477 def runsource(self, source, filename='<input>', symbol='single'):
1477 def runsource(self, source, filename='<input>', symbol='single'):
1478 """Compile and run some source in the interpreter.
1478 """Compile and run some source in the interpreter.
1479
1479
1480 Arguments are as for compile_command().
1480 Arguments are as for compile_command().
1481
1481
1482 One several things can happen:
1482 One several things can happen:
1483
1483
1484 1) The input is incorrect; compile_command() raised an
1484 1) The input is incorrect; compile_command() raised an
1485 exception (SyntaxError or OverflowError). A syntax traceback
1485 exception (SyntaxError or OverflowError). A syntax traceback
1486 will be printed by calling the showsyntaxerror() method.
1486 will be printed by calling the showsyntaxerror() method.
1487
1487
1488 2) The input is incomplete, and more input is required;
1488 2) The input is incomplete, and more input is required;
1489 compile_command() returned None. Nothing happens.
1489 compile_command() returned None. Nothing happens.
1490
1490
1491 3) The input is complete; compile_command() returned a code
1491 3) The input is complete; compile_command() returned a code
1492 object. The code is executed by calling self.runcode() (which
1492 object. The code is executed by calling self.runcode() (which
1493 also handles run-time exceptions, except for SystemExit).
1493 also handles run-time exceptions, except for SystemExit).
1494
1494
1495 The return value is:
1495 The return value is:
1496
1496
1497 - True in case 2
1497 - True in case 2
1498
1498
1499 - False in the other cases, unless an exception is raised, where
1499 - False in the other cases, unless an exception is raised, where
1500 None is returned instead. This can be used by external callers to
1500 None is returned instead. This can be used by external callers to
1501 know whether to continue feeding input or not.
1501 know whether to continue feeding input or not.
1502
1502
1503 The return value can be used to decide whether to use sys.ps1 or
1503 The return value can be used to decide whether to use sys.ps1 or
1504 sys.ps2 to prompt the next line."""
1504 sys.ps2 to prompt the next line."""
1505
1505
1506 try:
1506 try:
1507 code = self.compile(source,filename,symbol)
1507 code = self.compile(source,filename,symbol)
1508 except (OverflowError, SyntaxError, ValueError):
1508 except (OverflowError, SyntaxError, ValueError):
1509 # Case 1
1509 # Case 1
1510 self.showsyntaxerror(filename)
1510 self.showsyntaxerror(filename)
1511 return None
1511 return None
1512
1512
1513 if code is None:
1513 if code is None:
1514 # Case 2
1514 # Case 2
1515 return True
1515 return True
1516
1516
1517 # Case 3
1517 # Case 3
1518 # We store the code object so that threaded shells and
1518 # We store the code object so that threaded shells and
1519 # custom exception handlers can access all this info if needed.
1519 # custom exception handlers can access all this info if needed.
1520 # The source corresponding to this can be obtained from the
1520 # The source corresponding to this can be obtained from the
1521 # buffer attribute as '\n'.join(self.buffer).
1521 # buffer attribute as '\n'.join(self.buffer).
1522 self.code_to_run = code
1522 self.code_to_run = code
1523 # now actually execute the code object
1523 # now actually execute the code object
1524 if self.runcode(code) == 0:
1524 if self.runcode(code) == 0:
1525 return False
1525 return False
1526 else:
1526 else:
1527 return None
1527 return None
1528
1528
1529 def runcode(self,code_obj):
1529 def runcode(self,code_obj):
1530 """Execute a code object.
1530 """Execute a code object.
1531
1531
1532 When an exception occurs, self.showtraceback() is called to display a
1532 When an exception occurs, self.showtraceback() is called to display a
1533 traceback.
1533 traceback.
1534
1534
1535 Return value: a flag indicating whether the code to be run completed
1535 Return value: a flag indicating whether the code to be run completed
1536 successfully:
1536 successfully:
1537
1537
1538 - 0: successful execution.
1538 - 0: successful execution.
1539 - 1: an error occurred.
1539 - 1: an error occurred.
1540 """
1540 """
1541
1541
1542 # Set our own excepthook in case the user code tries to call it
1542 # Set our own excepthook in case the user code tries to call it
1543 # directly, so that the IPython crash handler doesn't get triggered
1543 # directly, so that the IPython crash handler doesn't get triggered
1544 old_excepthook,sys.excepthook = sys.excepthook, self.excepthook
1544 old_excepthook,sys.excepthook = sys.excepthook, self.excepthook
1545
1545
1546 # we save the original sys.excepthook in the instance, in case config
1546 # we save the original sys.excepthook in the instance, in case config
1547 # code (such as magics) needs access to it.
1547 # code (such as magics) needs access to it.
1548 self.sys_excepthook = old_excepthook
1548 self.sys_excepthook = old_excepthook
1549 outflag = 1 # happens in more places, so it's easier as default
1549 outflag = 1 # happens in more places, so it's easier as default
1550 try:
1550 try:
1551 try:
1551 try:
1552 # Embedded instances require separate global/local namespaces
1552 # Embedded instances require separate global/local namespaces
1553 # so they can see both the surrounding (local) namespace and
1553 # so they can see both the surrounding (local) namespace and
1554 # the module-level globals when called inside another function.
1554 # the module-level globals when called inside another function.
1555 if self.embedded:
1555 if self.embedded:
1556 exec code_obj in self.user_global_ns, self.user_ns
1556 exec code_obj in self.user_global_ns, self.user_ns
1557 # Normal (non-embedded) instances should only have a single
1557 # Normal (non-embedded) instances should only have a single
1558 # namespace for user code execution, otherwise functions won't
1558 # namespace for user code execution, otherwise functions won't
1559 # see interactive top-level globals.
1559 # see interactive top-level globals.
1560 else:
1560 else:
1561 exec code_obj in self.user_ns
1561 exec code_obj in self.user_ns
1562 finally:
1562 finally:
1563 # Reset our crash handler in place
1563 # Reset our crash handler in place
1564 sys.excepthook = old_excepthook
1564 sys.excepthook = old_excepthook
1565 except SystemExit:
1565 except SystemExit:
1566 self.resetbuffer()
1566 self.resetbuffer()
1567 self.showtraceback()
1567 self.showtraceback()
1568 warn("Type exit or quit to exit IPython "
1568 warn("Type exit or quit to exit IPython "
1569 "(%Exit or %Quit do so unconditionally).",level=1)
1569 "(%Exit or %Quit do so unconditionally).",level=1)
1570 except self.custom_exceptions:
1570 except self.custom_exceptions:
1571 etype,value,tb = sys.exc_info()
1571 etype,value,tb = sys.exc_info()
1572 self.CustomTB(etype,value,tb)
1572 self.CustomTB(etype,value,tb)
1573 except:
1573 except:
1574 self.showtraceback()
1574 self.showtraceback()
1575 else:
1575 else:
1576 outflag = 0
1576 outflag = 0
1577 if softspace(sys.stdout, 0):
1577 if softspace(sys.stdout, 0):
1578 print
1578 print
1579 # Flush out code object which has been run (and source)
1579 # Flush out code object which has been run (and source)
1580 self.code_to_run = None
1580 self.code_to_run = None
1581 return outflag
1581 return outflag
1582
1582
1583 def push(self, line):
1583 def push(self, line):
1584 """Push a line to the interpreter.
1584 """Push a line to the interpreter.
1585
1585
1586 The line should not have a trailing newline; it may have
1586 The line should not have a trailing newline; it may have
1587 internal newlines. The line is appended to a buffer and the
1587 internal newlines. The line is appended to a buffer and the
1588 interpreter's runsource() method is called with the
1588 interpreter's runsource() method is called with the
1589 concatenated contents of the buffer as source. If this
1589 concatenated contents of the buffer as source. If this
1590 indicates that the command was executed or invalid, the buffer
1590 indicates that the command was executed or invalid, the buffer
1591 is reset; otherwise, the command is incomplete, and the buffer
1591 is reset; otherwise, the command is incomplete, and the buffer
1592 is left as it was after the line was appended. The return
1592 is left as it was after the line was appended. The return
1593 value is 1 if more input is required, 0 if the line was dealt
1593 value is 1 if more input is required, 0 if the line was dealt
1594 with in some way (this is the same as runsource()).
1594 with in some way (this is the same as runsource()).
1595 """
1595 """
1596
1596
1597 # autoindent management should be done here, and not in the
1597 # autoindent management should be done here, and not in the
1598 # interactive loop, since that one is only seen by keyboard input. We
1598 # interactive loop, since that one is only seen by keyboard input. We
1599 # need this done correctly even for code run via runlines (which uses
1599 # need this done correctly even for code run via runlines (which uses
1600 # push).
1600 # push).
1601
1602 print 'push line: <%s>' % line # dbg
1601 self.autoindent_update(line)
1603 self.autoindent_update(line)
1602
1604
1603 self.buffer.append(line)
1605 self.buffer.append(line)
1604 more = self.runsource('\n'.join(self.buffer), self.filename)
1606 more = self.runsource('\n'.join(self.buffer), self.filename)
1605 if not more:
1607 if not more:
1606 self.resetbuffer()
1608 self.resetbuffer()
1607 return more
1609 return more
1608
1610
1609 def resetbuffer(self):
1611 def resetbuffer(self):
1610 """Reset the input buffer."""
1612 """Reset the input buffer."""
1611 self.buffer[:] = []
1613 self.buffer[:] = []
1612
1614
1613 def raw_input(self,prompt='',continue_prompt=False):
1615 def raw_input(self,prompt='',continue_prompt=False):
1614 """Write a prompt and read a line.
1616 """Write a prompt and read a line.
1615
1617
1616 The returned line does not include the trailing newline.
1618 The returned line does not include the trailing newline.
1617 When the user enters the EOF key sequence, EOFError is raised.
1619 When the user enters the EOF key sequence, EOFError is raised.
1618
1620
1619 Optional inputs:
1621 Optional inputs:
1620
1622
1621 - prompt(''): a string to be printed to prompt the user.
1623 - prompt(''): a string to be printed to prompt the user.
1622
1624
1623 - continue_prompt(False): whether this line is the first one or a
1625 - continue_prompt(False): whether this line is the first one or a
1624 continuation in a sequence of inputs.
1626 continuation in a sequence of inputs.
1625 """
1627 """
1626
1628
1627 line = raw_input_original(prompt)
1629 line = raw_input_original(prompt)
1628 # Try to be reasonably smart about not re-indenting pasted input more
1630 # Try to be reasonably smart about not re-indenting pasted input more
1629 # than necessary. We do this by trimming out the auto-indent initial
1631 # than necessary. We do this by trimming out the auto-indent initial
1630 # spaces, if the user's actual input started itself with whitespace.
1632 # spaces, if the user's actual input started itself with whitespace.
1631 if self.autoindent:
1633 if self.autoindent:
1632 line2 = line[self.indent_current_nsp:]
1634 line2 = line[self.indent_current_nsp:]
1633 if line2[0:1] in (' ','\t'):
1635 if line2[0:1] in (' ','\t'):
1634 line = line2
1636 line = line2
1635 return self.prefilter(line,continue_prompt)
1637 return self.prefilter(line,continue_prompt)
1636
1638
1637 def split_user_input(self,line):
1639 def split_user_input(self,line):
1638 """Split user input into pre-char, function part and rest."""
1640 """Split user input into pre-char, function part and rest."""
1639
1641
1640 lsplit = self.line_split.match(line)
1642 lsplit = self.line_split.match(line)
1641 if lsplit is None: # no regexp match returns None
1643 if lsplit is None: # no regexp match returns None
1642 try:
1644 try:
1643 iFun,theRest = line.split(None,1)
1645 iFun,theRest = line.split(None,1)
1644 except ValueError:
1646 except ValueError:
1645 iFun,theRest = line,''
1647 iFun,theRest = line,''
1646 pre = re.match('^(\s*)(.*)',line).groups()[0]
1648 pre = re.match('^(\s*)(.*)',line).groups()[0]
1647 else:
1649 else:
1648 pre,iFun,theRest = lsplit.groups()
1650 pre,iFun,theRest = lsplit.groups()
1649
1651
1650 #print 'line:<%s>' % line # dbg
1652 #print 'line:<%s>' % line # dbg
1651 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun.strip(),theRest) # dbg
1653 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun.strip(),theRest) # dbg
1652 return pre,iFun.strip(),theRest
1654 return pre,iFun.strip(),theRest
1653
1655
1654 def _prefilter(self, line, continue_prompt):
1656 def _prefilter(self, line, continue_prompt):
1655 """Calls different preprocessors, depending on the form of line."""
1657 """Calls different preprocessors, depending on the form of line."""
1656
1658
1657 # All handlers *must* return a value, even if it's blank ('').
1659 # All handlers *must* return a value, even if it's blank ('').
1658
1660
1659 # Lines are NOT logged here. Handlers should process the line as
1661 # Lines are NOT logged here. Handlers should process the line as
1660 # needed, update the cache AND log it (so that the input cache array
1662 # needed, update the cache AND log it (so that the input cache array
1661 # stays synced).
1663 # stays synced).
1662
1664
1663 # This function is _very_ delicate, and since it's also the one which
1665 # This function is _very_ delicate, and since it's also the one which
1664 # determines IPython's response to user input, it must be as efficient
1666 # determines IPython's response to user input, it must be as efficient
1665 # as possible. For this reason it has _many_ returns in it, trying
1667 # as possible. For this reason it has _many_ returns in it, trying
1666 # always to exit as quickly as it can figure out what it needs to do.
1668 # always to exit as quickly as it can figure out what it needs to do.
1667
1669
1668 # This function is the main responsible for maintaining IPython's
1670 # This function is the main responsible for maintaining IPython's
1669 # behavior respectful of Python's semantics. So be _very_ careful if
1671 # behavior respectful of Python's semantics. So be _very_ careful if
1670 # making changes to anything here.
1672 # making changes to anything here.
1671
1673
1672 #.....................................................................
1674 #.....................................................................
1673 # Code begins
1675 # Code begins
1674
1676
1675 #if line.startswith('%crash'): raise RuntimeError,'Crash now!' # dbg
1677 #if line.startswith('%crash'): raise RuntimeError,'Crash now!' # dbg
1676
1678
1677 # save the line away in case we crash, so the post-mortem handler can
1679 # save the line away in case we crash, so the post-mortem handler can
1678 # record it
1680 # record it
1679 self._last_input_line = line
1681 self._last_input_line = line
1680
1682
1681 #print '***line: <%s>' % line # dbg
1683 #print '***line: <%s>' % line # dbg
1682
1684
1683 # the input history needs to track even empty lines
1685 # the input history needs to track even empty lines
1684 if not line.strip():
1686 if not line.strip():
1685 if not continue_prompt:
1687 if not continue_prompt:
1686 self.outputcache.prompt_count -= 1
1688 self.outputcache.prompt_count -= 1
1687 return self.handle_normal(line,continue_prompt)
1689 return self.handle_normal(line,continue_prompt)
1688 #return self.handle_normal('',continue_prompt)
1690 #return self.handle_normal('',continue_prompt)
1689
1691
1690 # print '***cont',continue_prompt # dbg
1692 # print '***cont',continue_prompt # dbg
1691 # special handlers are only allowed for single line statements
1693 # special handlers are only allowed for single line statements
1692 if continue_prompt and not self.rc.multi_line_specials:
1694 if continue_prompt and not self.rc.multi_line_specials:
1693 return self.handle_normal(line,continue_prompt)
1695 return self.handle_normal(line,continue_prompt)
1694
1696
1695 # For the rest, we need the structure of the input
1697 # For the rest, we need the structure of the input
1696 pre,iFun,theRest = self.split_user_input(line)
1698 pre,iFun,theRest = self.split_user_input(line)
1697 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
1699 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
1698
1700
1699 # First check for explicit escapes in the last/first character
1701 # First check for explicit escapes in the last/first character
1700 handler = None
1702 handler = None
1701 if line[-1] == self.ESC_HELP:
1703 if line[-1] == self.ESC_HELP:
1702 handler = self.esc_handlers.get(line[-1]) # the ? can be at the end
1704 handler = self.esc_handlers.get(line[-1]) # the ? can be at the end
1703 if handler is None:
1705 if handler is None:
1704 # look at the first character of iFun, NOT of line, so we skip
1706 # look at the first character of iFun, NOT of line, so we skip
1705 # leading whitespace in multiline input
1707 # leading whitespace in multiline input
1706 handler = self.esc_handlers.get(iFun[0:1])
1708 handler = self.esc_handlers.get(iFun[0:1])
1707 if handler is not None:
1709 if handler is not None:
1708 return handler(line,continue_prompt,pre,iFun,theRest)
1710 return handler(line,continue_prompt,pre,iFun,theRest)
1709 # Emacs ipython-mode tags certain input lines
1711 # Emacs ipython-mode tags certain input lines
1710 if line.endswith('# PYTHON-MODE'):
1712 if line.endswith('# PYTHON-MODE'):
1711 return self.handle_emacs(line,continue_prompt)
1713 return self.handle_emacs(line,continue_prompt)
1712
1714
1713 # Next, check if we can automatically execute this thing
1715 # Next, check if we can automatically execute this thing
1714
1716
1715 # Allow ! in multi-line statements if multi_line_specials is on:
1717 # Allow ! in multi-line statements if multi_line_specials is on:
1716 if continue_prompt and self.rc.multi_line_specials and \
1718 if continue_prompt and self.rc.multi_line_specials and \
1717 iFun.startswith(self.ESC_SHELL):
1719 iFun.startswith(self.ESC_SHELL):
1718 return self.handle_shell_escape(line,continue_prompt,
1720 return self.handle_shell_escape(line,continue_prompt,
1719 pre=pre,iFun=iFun,
1721 pre=pre,iFun=iFun,
1720 theRest=theRest)
1722 theRest=theRest)
1721
1723
1722 # Let's try to find if the input line is a magic fn
1724 # Let's try to find if the input line is a magic fn
1723 oinfo = None
1725 oinfo = None
1724 if hasattr(self,'magic_'+iFun):
1726 if hasattr(self,'magic_'+iFun):
1725 # WARNING: _ofind uses getattr(), so it can consume generators and
1727 # WARNING: _ofind uses getattr(), so it can consume generators and
1726 # cause other side effects.
1728 # cause other side effects.
1727 oinfo = self._ofind(iFun) # FIXME - _ofind is part of Magic
1729 oinfo = self._ofind(iFun) # FIXME - _ofind is part of Magic
1728 if oinfo['ismagic']:
1730 if oinfo['ismagic']:
1729 # Be careful not to call magics when a variable assignment is
1731 # Be careful not to call magics when a variable assignment is
1730 # being made (ls='hi', for example)
1732 # being made (ls='hi', for example)
1731 if self.rc.automagic and \
1733 if self.rc.automagic and \
1732 (len(theRest)==0 or theRest[0] not in '!=()<>,') and \
1734 (len(theRest)==0 or theRest[0] not in '!=()<>,') and \
1733 (self.rc.multi_line_specials or not continue_prompt):
1735 (self.rc.multi_line_specials or not continue_prompt):
1734 return self.handle_magic(line,continue_prompt,
1736 return self.handle_magic(line,continue_prompt,
1735 pre,iFun,theRest)
1737 pre,iFun,theRest)
1736 else:
1738 else:
1737 return self.handle_normal(line,continue_prompt)
1739 return self.handle_normal(line,continue_prompt)
1738
1740
1739 # If the rest of the line begins with an (in)equality, assginment or
1741 # If the rest of the line begins with an (in)equality, assginment or
1740 # function call, we should not call _ofind but simply execute it.
1742 # function call, we should not call _ofind but simply execute it.
1741 # This avoids spurious geattr() accesses on objects upon assignment.
1743 # This avoids spurious geattr() accesses on objects upon assignment.
1742 #
1744 #
1743 # It also allows users to assign to either alias or magic names true
1745 # It also allows users to assign to either alias or magic names true
1744 # python variables (the magic/alias systems always take second seat to
1746 # python variables (the magic/alias systems always take second seat to
1745 # true python code).
1747 # true python code).
1746 if theRest and theRest[0] in '!=()':
1748 if theRest and theRest[0] in '!=()':
1747 return self.handle_normal(line,continue_prompt)
1749 return self.handle_normal(line,continue_prompt)
1748
1750
1749 if oinfo is None:
1751 if oinfo is None:
1750 # let's try to ensure that _oinfo is ONLY called when autocall is
1752 # let's try to ensure that _oinfo is ONLY called when autocall is
1751 # on. Since it has inevitable potential side effects, at least
1753 # on. Since it has inevitable potential side effects, at least
1752 # having autocall off should be a guarantee to the user that no
1754 # having autocall off should be a guarantee to the user that no
1753 # weird things will happen.
1755 # weird things will happen.
1754
1756
1755 if self.rc.autocall:
1757 if self.rc.autocall:
1756 oinfo = self._ofind(iFun) # FIXME - _ofind is part of Magic
1758 oinfo = self._ofind(iFun) # FIXME - _ofind is part of Magic
1757 else:
1759 else:
1758 # in this case, all that's left is either an alias or
1760 # in this case, all that's left is either an alias or
1759 # processing the line normally.
1761 # processing the line normally.
1760 if iFun in self.alias_table:
1762 if iFun in self.alias_table:
1761 return self.handle_alias(line,continue_prompt,
1763 return self.handle_alias(line,continue_prompt,
1762 pre,iFun,theRest)
1764 pre,iFun,theRest)
1763 else:
1765 else:
1764 return self.handle_normal(line,continue_prompt)
1766 return self.handle_normal(line,continue_prompt)
1765
1767
1766 if not oinfo['found']:
1768 if not oinfo['found']:
1767 return self.handle_normal(line,continue_prompt)
1769 return self.handle_normal(line,continue_prompt)
1768 else:
1770 else:
1769 #print 'iFun <%s> rest <%s>' % (iFun,theRest) # dbg
1771 #print 'iFun <%s> rest <%s>' % (iFun,theRest) # dbg
1770 if oinfo['isalias']:
1772 if oinfo['isalias']:
1771 return self.handle_alias(line,continue_prompt,
1773 return self.handle_alias(line,continue_prompt,
1772 pre,iFun,theRest)
1774 pre,iFun,theRest)
1773
1775
1774 if self.rc.autocall and \
1776 if self.rc.autocall and \
1775 not self.re_exclude_auto.match(theRest) and \
1777 not self.re_exclude_auto.match(theRest) and \
1776 self.re_fun_name.match(iFun) and \
1778 self.re_fun_name.match(iFun) and \
1777 callable(oinfo['obj']) :
1779 callable(oinfo['obj']) :
1778 #print 'going auto' # dbg
1780 #print 'going auto' # dbg
1779 return self.handle_auto(line,continue_prompt,pre,iFun,theRest)
1781 return self.handle_auto(line,continue_prompt,pre,iFun,theRest)
1780 else:
1782 else:
1781 #print 'was callable?', callable(oinfo['obj']) # dbg
1783 #print 'was callable?', callable(oinfo['obj']) # dbg
1782 return self.handle_normal(line,continue_prompt)
1784 return self.handle_normal(line,continue_prompt)
1783
1785
1784 # If we get here, we have a normal Python line. Log and return.
1786 # If we get here, we have a normal Python line. Log and return.
1785 return self.handle_normal(line,continue_prompt)
1787 return self.handle_normal(line,continue_prompt)
1786
1788
1787 def _prefilter_dumb(self, line, continue_prompt):
1789 def _prefilter_dumb(self, line, continue_prompt):
1788 """simple prefilter function, for debugging"""
1790 """simple prefilter function, for debugging"""
1789 return self.handle_normal(line,continue_prompt)
1791 return self.handle_normal(line,continue_prompt)
1790
1792
1791 # Set the default prefilter() function (this can be user-overridden)
1793 # Set the default prefilter() function (this can be user-overridden)
1792 prefilter = _prefilter
1794 prefilter = _prefilter
1793
1795
1794 def handle_normal(self,line,continue_prompt=None,
1796 def handle_normal(self,line,continue_prompt=None,
1795 pre=None,iFun=None,theRest=None):
1797 pre=None,iFun=None,theRest=None):
1796 """Handle normal input lines. Use as a template for handlers."""
1798 """Handle normal input lines. Use as a template for handlers."""
1797
1799
1798 # With autoindent on, we need some way to exit the input loop, and I
1800 # With autoindent on, we need some way to exit the input loop, and I
1799 # don't want to force the user to have to backspace all the way to
1801 # don't want to force the user to have to backspace all the way to
1800 # clear the line. The rule will be in this case, that either two
1802 # clear the line. The rule will be in this case, that either two
1801 # lines of pure whitespace in a row, or a line of pure whitespace but
1803 # lines of pure whitespace in a row, or a line of pure whitespace but
1802 # of a size different to the indent level, will exit the input loop.
1804 # of a size different to the indent level, will exit the input loop.
1803
1805
1804 if (continue_prompt and self.autoindent and isspace(line) and
1806 if (continue_prompt and self.autoindent and isspace(line) and
1805 (line != self.indent_current or isspace(self.buffer[-1]))):
1807 (line != self.indent_current or isspace(self.buffer[-1]))):
1806 line = ''
1808 line = ''
1807
1809
1808 self.log(line,continue_prompt)
1810 self.log(line,continue_prompt)
1809 return line
1811 return line
1810
1812
1811 def handle_alias(self,line,continue_prompt=None,
1813 def handle_alias(self,line,continue_prompt=None,
1812 pre=None,iFun=None,theRest=None):
1814 pre=None,iFun=None,theRest=None):
1813 """Handle alias input lines. """
1815 """Handle alias input lines. """
1814
1816
1815 line_out = 'ipalias("%s %s")' % (iFun,esc_quotes(theRest))
1817 # pre is needed, because it carries the leading whitespace. Otherwise
1818 # aliases won't work in indented sections.
1819 line_out = '%sipalias("%s %s")' % (pre,iFun,esc_quotes(theRest))
1816 self.log(line_out,continue_prompt)
1820 self.log(line_out,continue_prompt)
1817 return line_out
1821 return line_out
1818
1822
1819 def handle_shell_escape(self, line, continue_prompt=None,
1823 def handle_shell_escape(self, line, continue_prompt=None,
1820 pre=None,iFun=None,theRest=None):
1824 pre=None,iFun=None,theRest=None):
1821 """Execute the line in a shell, empty return value"""
1825 """Execute the line in a shell, empty return value"""
1822
1826
1823 #print 'line in :', `line` # dbg
1827 #print 'line in :', `line` # dbg
1824 # Example of a special handler. Others follow a similar pattern.
1828 # Example of a special handler. Others follow a similar pattern.
1825 if continue_prompt: # multi-line statements
1829 if continue_prompt: # multi-line statements
1826 if iFun.startswith('!!'):
1830 if iFun.startswith('!!'):
1827 print 'SyntaxError: !! is not allowed in multiline statements'
1831 print 'SyntaxError: !! is not allowed in multiline statements'
1828 return pre
1832 return pre
1829 else:
1833 else:
1830 cmd = ("%s %s" % (iFun[1:],theRest))
1834 cmd = ("%s %s" % (iFun[1:],theRest))
1831 line_out = 'ipsystem(r"""%s"""[:-1])' % (cmd + "_")
1835 line_out = '%sipsystem(r"""%s"""[:-1])' % (pre,cmd + "_")
1832 else: # single-line input
1836 else: # single-line input
1833 if line.startswith('!!'):
1837 if line.startswith('!!'):
1834 # rewrite iFun/theRest to properly hold the call to %sx and
1838 # rewrite iFun/theRest to properly hold the call to %sx and
1835 # the actual command to be executed, so handle_magic can work
1839 # the actual command to be executed, so handle_magic can work
1836 # correctly
1840 # correctly
1837 theRest = '%s %s' % (iFun[2:],theRest)
1841 theRest = '%s %s' % (iFun[2:],theRest)
1838 iFun = 'sx'
1842 iFun = 'sx'
1839 return self.handle_magic('%ssx %s' % (self.ESC_MAGIC,line[2:]),
1843 return self.handle_magic('%ssx %s' % (self.ESC_MAGIC,line[2:]),
1840 continue_prompt,pre,iFun,theRest)
1844 continue_prompt,pre,iFun,theRest)
1841 else:
1845 else:
1842 cmd=line[1:]
1846 cmd=line[1:]
1843 line_out = 'ipsystem(r"""%s"""[:-1])' % (cmd +"_")
1847 line_out = '%sipsystem(r"""%s"""[:-1])' % (pre,cmd +"_")
1844 # update cache/log and return
1848 # update cache/log and return
1845 self.log(line_out,continue_prompt)
1849 self.log(line_out,continue_prompt)
1846 return line_out
1850 return line_out
1847
1851
1848 def handle_magic(self, line, continue_prompt=None,
1852 def handle_magic(self, line, continue_prompt=None,
1849 pre=None,iFun=None,theRest=None):
1853 pre=None,iFun=None,theRest=None):
1850 """Execute magic functions.
1854 """Execute magic functions.
1851
1855
1852 Also log them with a prepended # so the log is clean Python."""
1856 Also log them with a prepended # so the log is clean Python."""
1853
1857
1854 cmd = '%sipmagic("%s")' % (pre,esc_quotes('%s %s' % (iFun,theRest)))
1858 cmd = '%sipmagic("%s")' % (pre,esc_quotes('%s %s' % (iFun,theRest)))
1855 self.log(cmd,continue_prompt)
1859 self.log(cmd,continue_prompt)
1856 #print 'in handle_magic, cmd=<%s>' % cmd # dbg
1860 #print 'in handle_magic, cmd=<%s>' % cmd # dbg
1857 return cmd
1861 return cmd
1858
1862
1859 def handle_auto(self, line, continue_prompt=None,
1863 def handle_auto(self, line, continue_prompt=None,
1860 pre=None,iFun=None,theRest=None):
1864 pre=None,iFun=None,theRest=None):
1861 """Hande lines which can be auto-executed, quoting if requested."""
1865 """Hande lines which can be auto-executed, quoting if requested."""
1862
1866
1863 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
1867 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
1864
1868
1865 # This should only be active for single-line input!
1869 # This should only be active for single-line input!
1866 if continue_prompt:
1870 if continue_prompt:
1867 return line
1871 return line
1868
1872
1869 if pre == self.ESC_QUOTE:
1873 if pre == self.ESC_QUOTE:
1870 # Auto-quote splitting on whitespace
1874 # Auto-quote splitting on whitespace
1871 newcmd = '%s("%s")' % (iFun,'", "'.join(theRest.split()) )
1875 newcmd = '%s("%s")' % (iFun,'", "'.join(theRest.split()) )
1872 elif pre == self.ESC_QUOTE2:
1876 elif pre == self.ESC_QUOTE2:
1873 # Auto-quote whole string
1877 # Auto-quote whole string
1874 newcmd = '%s("%s")' % (iFun,theRest)
1878 newcmd = '%s("%s")' % (iFun,theRest)
1875 else:
1879 else:
1876 # Auto-paren
1880 # Auto-paren
1877 if theRest[0:1] in ('=','['):
1881 if theRest[0:1] in ('=','['):
1878 # Don't autocall in these cases. They can be either
1882 # Don't autocall in these cases. They can be either
1879 # rebindings of an existing callable's name, or item access
1883 # rebindings of an existing callable's name, or item access
1880 # for an object which is BOTH callable and implements
1884 # for an object which is BOTH callable and implements
1881 # __getitem__.
1885 # __getitem__.
1882 return '%s %s' % (iFun,theRest)
1886 return '%s %s' % (iFun,theRest)
1883 if theRest.endswith(';'):
1887 if theRest.endswith(';'):
1884 newcmd = '%s(%s);' % (iFun.rstrip(),theRest[:-1])
1888 newcmd = '%s(%s);' % (iFun.rstrip(),theRest[:-1])
1885 else:
1889 else:
1886 newcmd = '%s(%s)' % (iFun.rstrip(),theRest)
1890 newcmd = '%s(%s)' % (iFun.rstrip(),theRest)
1887
1891
1888 print >>Term.cout, self.outputcache.prompt1.auto_rewrite() + newcmd
1892 print >>Term.cout, self.outputcache.prompt1.auto_rewrite() + newcmd
1889 # log what is now valid Python, not the actual user input (without the
1893 # log what is now valid Python, not the actual user input (without the
1890 # final newline)
1894 # final newline)
1891 self.log(newcmd,continue_prompt)
1895 self.log(newcmd,continue_prompt)
1892 return newcmd
1896 return newcmd
1893
1897
1894 def handle_help(self, line, continue_prompt=None,
1898 def handle_help(self, line, continue_prompt=None,
1895 pre=None,iFun=None,theRest=None):
1899 pre=None,iFun=None,theRest=None):
1896 """Try to get some help for the object.
1900 """Try to get some help for the object.
1897
1901
1898 obj? or ?obj -> basic information.
1902 obj? or ?obj -> basic information.
1899 obj?? or ??obj -> more details.
1903 obj?? or ??obj -> more details.
1900 """
1904 """
1901
1905
1902 # We need to make sure that we don't process lines which would be
1906 # We need to make sure that we don't process lines which would be
1903 # otherwise valid python, such as "x=1 # what?"
1907 # otherwise valid python, such as "x=1 # what?"
1904 try:
1908 try:
1905 codeop.compile_command(line)
1909 codeop.compile_command(line)
1906 except SyntaxError:
1910 except SyntaxError:
1907 # We should only handle as help stuff which is NOT valid syntax
1911 # We should only handle as help stuff which is NOT valid syntax
1908 if line[0]==self.ESC_HELP:
1912 if line[0]==self.ESC_HELP:
1909 line = line[1:]
1913 line = line[1:]
1910 elif line[-1]==self.ESC_HELP:
1914 elif line[-1]==self.ESC_HELP:
1911 line = line[:-1]
1915 line = line[:-1]
1912 self.log('#?'+line)
1916 self.log('#?'+line)
1913 if line:
1917 if line:
1914 self.magic_pinfo(line)
1918 self.magic_pinfo(line)
1915 else:
1919 else:
1916 page(self.usage,screen_lines=self.rc.screen_length)
1920 page(self.usage,screen_lines=self.rc.screen_length)
1917 return '' # Empty string is needed here!
1921 return '' # Empty string is needed here!
1918 except:
1922 except:
1919 # Pass any other exceptions through to the normal handler
1923 # Pass any other exceptions through to the normal handler
1920 return self.handle_normal(line,continue_prompt)
1924 return self.handle_normal(line,continue_prompt)
1921 else:
1925 else:
1922 # If the code compiles ok, we should handle it normally
1926 # If the code compiles ok, we should handle it normally
1923 return self.handle_normal(line,continue_prompt)
1927 return self.handle_normal(line,continue_prompt)
1924
1928
1925 def handle_emacs(self,line,continue_prompt=None,
1929 def handle_emacs(self,line,continue_prompt=None,
1926 pre=None,iFun=None,theRest=None):
1930 pre=None,iFun=None,theRest=None):
1927 """Handle input lines marked by python-mode."""
1931 """Handle input lines marked by python-mode."""
1928
1932
1929 # Currently, nothing is done. Later more functionality can be added
1933 # Currently, nothing is done. Later more functionality can be added
1930 # here if needed.
1934 # here if needed.
1931
1935
1932 # The input cache shouldn't be updated
1936 # The input cache shouldn't be updated
1933
1937
1934 return line
1938 return line
1935
1939
1936 def write(self,data):
1940 def write(self,data):
1937 """Write a string to the default output"""
1941 """Write a string to the default output"""
1938 Term.cout.write(data)
1942 Term.cout.write(data)
1939
1943
1940 def write_err(self,data):
1944 def write_err(self,data):
1941 """Write a string to the default error output"""
1945 """Write a string to the default error output"""
1942 Term.cerr.write(data)
1946 Term.cerr.write(data)
1943
1947
1944 def exit(self):
1948 def exit(self):
1945 """Handle interactive exit.
1949 """Handle interactive exit.
1946
1950
1947 This method sets the exit_now attribute."""
1951 This method sets the exit_now attribute."""
1948
1952
1949 if self.rc.confirm_exit:
1953 if self.rc.confirm_exit:
1950 if ask_yes_no('Do you really want to exit ([y]/n)?','y'):
1954 if ask_yes_no('Do you really want to exit ([y]/n)?','y'):
1951 self.exit_now = True
1955 self.exit_now = True
1952 else:
1956 else:
1953 self.exit_now = True
1957 self.exit_now = True
1954 return self.exit_now
1958 return self.exit_now
1955
1959
1956 def safe_execfile(self,fname,*where,**kw):
1960 def safe_execfile(self,fname,*where,**kw):
1957 fname = os.path.expanduser(fname)
1961 fname = os.path.expanduser(fname)
1958
1962
1959 # find things also in current directory
1963 # find things also in current directory
1960 dname = os.path.dirname(fname)
1964 dname = os.path.dirname(fname)
1961 if not sys.path.count(dname):
1965 if not sys.path.count(dname):
1962 sys.path.append(dname)
1966 sys.path.append(dname)
1963
1967
1964 try:
1968 try:
1965 xfile = open(fname)
1969 xfile = open(fname)
1966 except:
1970 except:
1967 print >> Term.cerr, \
1971 print >> Term.cerr, \
1968 'Could not open file <%s> for safe execution.' % fname
1972 'Could not open file <%s> for safe execution.' % fname
1969 return None
1973 return None
1970
1974
1971 kw.setdefault('islog',0)
1975 kw.setdefault('islog',0)
1972 kw.setdefault('quiet',1)
1976 kw.setdefault('quiet',1)
1973 kw.setdefault('exit_ignore',0)
1977 kw.setdefault('exit_ignore',0)
1974 first = xfile.readline()
1978 first = xfile.readline()
1975 loghead = str(self.loghead_tpl).split('\n',1)[0].strip()
1979 loghead = str(self.loghead_tpl).split('\n',1)[0].strip()
1976 xfile.close()
1980 xfile.close()
1977 # line by line execution
1981 # line by line execution
1978 if first.startswith(loghead) or kw['islog']:
1982 if first.startswith(loghead) or kw['islog']:
1979 print 'Loading log file <%s> one line at a time...' % fname
1983 print 'Loading log file <%s> one line at a time...' % fname
1980 if kw['quiet']:
1984 if kw['quiet']:
1981 stdout_save = sys.stdout
1985 stdout_save = sys.stdout
1982 sys.stdout = StringIO.StringIO()
1986 sys.stdout = StringIO.StringIO()
1983 try:
1987 try:
1984 globs,locs = where[0:2]
1988 globs,locs = where[0:2]
1985 except:
1989 except:
1986 try:
1990 try:
1987 globs = locs = where[0]
1991 globs = locs = where[0]
1988 except:
1992 except:
1989 globs = locs = globals()
1993 globs = locs = globals()
1990 badblocks = []
1994 badblocks = []
1991
1995
1992 # we also need to identify indented blocks of code when replaying
1996 # we also need to identify indented blocks of code when replaying
1993 # logs and put them together before passing them to an exec
1997 # logs and put them together before passing them to an exec
1994 # statement. This takes a bit of regexp and look-ahead work in the
1998 # statement. This takes a bit of regexp and look-ahead work in the
1995 # file. It's easiest if we swallow the whole thing in memory
1999 # file. It's easiest if we swallow the whole thing in memory
1996 # first, and manually walk through the lines list moving the
2000 # first, and manually walk through the lines list moving the
1997 # counter ourselves.
2001 # counter ourselves.
1998 indent_re = re.compile('\s+\S')
2002 indent_re = re.compile('\s+\S')
1999 xfile = open(fname)
2003 xfile = open(fname)
2000 filelines = xfile.readlines()
2004 filelines = xfile.readlines()
2001 xfile.close()
2005 xfile.close()
2002 nlines = len(filelines)
2006 nlines = len(filelines)
2003 lnum = 0
2007 lnum = 0
2004 while lnum < nlines:
2008 while lnum < nlines:
2005 line = filelines[lnum]
2009 line = filelines[lnum]
2006 lnum += 1
2010 lnum += 1
2007 # don't re-insert logger status info into cache
2011 # don't re-insert logger status info into cache
2008 if line.startswith('#log#'):
2012 if line.startswith('#log#'):
2009 continue
2013 continue
2010 else:
2014 else:
2011 # build a block of code (maybe a single line) for execution
2015 # build a block of code (maybe a single line) for execution
2012 block = line
2016 block = line
2013 try:
2017 try:
2014 next = filelines[lnum] # lnum has already incremented
2018 next = filelines[lnum] # lnum has already incremented
2015 except:
2019 except:
2016 next = None
2020 next = None
2017 while next and indent_re.match(next):
2021 while next and indent_re.match(next):
2018 block += next
2022 block += next
2019 lnum += 1
2023 lnum += 1
2020 try:
2024 try:
2021 next = filelines[lnum]
2025 next = filelines[lnum]
2022 except:
2026 except:
2023 next = None
2027 next = None
2024 # now execute the block of one or more lines
2028 # now execute the block of one or more lines
2025 try:
2029 try:
2026 exec block in globs,locs
2030 exec block in globs,locs
2027 except SystemExit:
2031 except SystemExit:
2028 pass
2032 pass
2029 except:
2033 except:
2030 badblocks.append(block.rstrip())
2034 badblocks.append(block.rstrip())
2031 if kw['quiet']: # restore stdout
2035 if kw['quiet']: # restore stdout
2032 sys.stdout.close()
2036 sys.stdout.close()
2033 sys.stdout = stdout_save
2037 sys.stdout = stdout_save
2034 print 'Finished replaying log file <%s>' % fname
2038 print 'Finished replaying log file <%s>' % fname
2035 if badblocks:
2039 if badblocks:
2036 print >> sys.stderr, ('\nThe following lines/blocks in file '
2040 print >> sys.stderr, ('\nThe following lines/blocks in file '
2037 '<%s> reported errors:' % fname)
2041 '<%s> reported errors:' % fname)
2038
2042
2039 for badline in badblocks:
2043 for badline in badblocks:
2040 print >> sys.stderr, badline
2044 print >> sys.stderr, badline
2041 else: # regular file execution
2045 else: # regular file execution
2042 try:
2046 try:
2043 execfile(fname,*where)
2047 execfile(fname,*where)
2044 except SyntaxError:
2048 except SyntaxError:
2045 etype,evalue = sys.exc_info()[:2]
2049 etype,evalue = sys.exc_info()[:2]
2046 self.SyntaxTB(etype,evalue,[])
2050 self.SyntaxTB(etype,evalue,[])
2047 warn('Failure executing file: <%s>' % fname)
2051 warn('Failure executing file: <%s>' % fname)
2048 except SystemExit,status:
2052 except SystemExit,status:
2049 if not kw['exit_ignore']:
2053 if not kw['exit_ignore']:
2050 self.InteractiveTB()
2054 self.InteractiveTB()
2051 warn('Failure executing file: <%s>' % fname)
2055 warn('Failure executing file: <%s>' % fname)
2052 except:
2056 except:
2053 self.InteractiveTB()
2057 self.InteractiveTB()
2054 warn('Failure executing file: <%s>' % fname)
2058 warn('Failure executing file: <%s>' % fname)
2055
2059
2056 #************************* end of file <iplib.py> *****************************
2060 #************************* end of file <iplib.py> *****************************
@@ -1,4678 +1,4682 b''
1 2005-12-30 Fernando Perez <Fernando.Perez@colorado.edu>
1 2005-12-30 Fernando Perez <Fernando.Perez@colorado.edu>
2
2
3 * IPython/iplib.py (handle_shell_escape): fix bug where both
4 aliases and system accesses where broken for indented code (such
5 as loops).
6
3 * IPython/genutils.py (shell): fix small but critical bug for
7 * IPython/genutils.py (shell): fix small but critical bug for
4 win32 system access.
8 win32 system access.
5
9
6 2005-12-29 Fernando Perez <Fernando.Perez@colorado.edu>
10 2005-12-29 Fernando Perez <Fernando.Perez@colorado.edu>
7
11
8 * IPython/iplib.py (showtraceback): remove use of the
12 * IPython/iplib.py (showtraceback): remove use of the
9 sys.last_{type/value/traceback} structures, which are non
13 sys.last_{type/value/traceback} structures, which are non
10 thread-safe.
14 thread-safe.
11 (_prefilter): change control flow to ensure that we NEVER
15 (_prefilter): change control flow to ensure that we NEVER
12 introspect objects when autocall is off. This will guarantee that
16 introspect objects when autocall is off. This will guarantee that
13 having an input line of the form 'x.y', where access to attribute
17 having an input line of the form 'x.y', where access to attribute
14 'y' has side effects, doesn't trigger the side effect TWICE. It
18 'y' has side effects, doesn't trigger the side effect TWICE. It
15 is important to note that, with autocall on, these side effects
19 is important to note that, with autocall on, these side effects
16 can still happen.
20 can still happen.
17 (ipsystem): new builtin, to complete the ip{magic/alias/system}
21 (ipsystem): new builtin, to complete the ip{magic/alias/system}
18 trio. IPython offers these three kinds of special calls which are
22 trio. IPython offers these three kinds of special calls which are
19 not python code, and it's a good thing to have their call method
23 not python code, and it's a good thing to have their call method
20 be accessible as pure python functions (not just special syntax at
24 be accessible as pure python functions (not just special syntax at
21 the command line). It gives us a better internal implementation
25 the command line). It gives us a better internal implementation
22 structure, as well as exposing these for user scripting more
26 structure, as well as exposing these for user scripting more
23 cleanly.
27 cleanly.
24
28
25 * IPython/macro.py (Macro.__init__): moved macros to a standalone
29 * IPython/macro.py (Macro.__init__): moved macros to a standalone
26 file. Now that they'll be more likely to be used with the
30 file. Now that they'll be more likely to be used with the
27 persistance system (%store), I want to make sure their module path
31 persistance system (%store), I want to make sure their module path
28 doesn't change in the future, so that we don't break things for
32 doesn't change in the future, so that we don't break things for
29 users' persisted data.
33 users' persisted data.
30
34
31 * IPython/iplib.py (autoindent_update): move indentation
35 * IPython/iplib.py (autoindent_update): move indentation
32 management into the _text_ processing loop, not the keyboard
36 management into the _text_ processing loop, not the keyboard
33 interactive one. This is necessary to correctly process non-typed
37 interactive one. This is necessary to correctly process non-typed
34 multiline input (such as macros).
38 multiline input (such as macros).
35
39
36 * IPython/Magic.py (Magic.format_latex): patch by Stefan van der
40 * IPython/Magic.py (Magic.format_latex): patch by Stefan van der
37 Walt <stefan-AT-sun.ac.za> to fix latex formatting of docstrings,
41 Walt <stefan-AT-sun.ac.za> to fix latex formatting of docstrings,
38 which was producing problems in the resulting manual.
42 which was producing problems in the resulting manual.
39 (magic_whos): improve reporting of instances (show their class,
43 (magic_whos): improve reporting of instances (show their class,
40 instead of simply printing 'instance' which isn't terribly
44 instead of simply printing 'instance' which isn't terribly
41 informative).
45 informative).
42
46
43 * IPython/genutils.py (shell): commit Jorgen Stenarson's patch
47 * IPython/genutils.py (shell): commit Jorgen Stenarson's patch
44 (minor mods) to support network shares under win32.
48 (minor mods) to support network shares under win32.
45
49
46 * IPython/winconsole.py (get_console_size): add new winconsole
50 * IPython/winconsole.py (get_console_size): add new winconsole
47 module and fixes to page_dumb() to improve its behavior under
51 module and fixes to page_dumb() to improve its behavior under
48 win32. Contributed by Alexander Belchenko <bialix-AT-ukr.net>.
52 win32. Contributed by Alexander Belchenko <bialix-AT-ukr.net>.
49
53
50 * IPython/Magic.py (Macro): simplified Macro class to just
54 * IPython/Magic.py (Macro): simplified Macro class to just
51 subclass list. We've had only 2.2 compatibility for a very long
55 subclass list. We've had only 2.2 compatibility for a very long
52 time, yet I was still avoiding subclassing the builtin types. No
56 time, yet I was still avoiding subclassing the builtin types. No
53 more (I'm also starting to use properties, though I won't shift to
57 more (I'm also starting to use properties, though I won't shift to
54 2.3-specific features quite yet).
58 2.3-specific features quite yet).
55 (magic_store): added Ville's patch for lightweight variable
59 (magic_store): added Ville's patch for lightweight variable
56 persistence, after a request on the user list by Matt Wilkie
60 persistence, after a request on the user list by Matt Wilkie
57 <maphew-AT-gmail.com>. The new %store magic's docstring has full
61 <maphew-AT-gmail.com>. The new %store magic's docstring has full
58 details.
62 details.
59
63
60 * IPython/iplib.py (InteractiveShell.post_config_initialization):
64 * IPython/iplib.py (InteractiveShell.post_config_initialization):
61 changed the default logfile name from 'ipython.log' to
65 changed the default logfile name from 'ipython.log' to
62 'ipython_log.py'. These logs are real python files, and now that
66 'ipython_log.py'. These logs are real python files, and now that
63 we have much better multiline support, people are more likely to
67 we have much better multiline support, people are more likely to
64 want to use them as such. Might as well name them correctly.
68 want to use them as such. Might as well name them correctly.
65
69
66 * IPython/Magic.py: substantial cleanup. While we can't stop
70 * IPython/Magic.py: substantial cleanup. While we can't stop
67 using magics as mixins, due to the existing customizations 'out
71 using magics as mixins, due to the existing customizations 'out
68 there' which rely on the mixin naming conventions, at least I
72 there' which rely on the mixin naming conventions, at least I
69 cleaned out all cross-class name usage. So once we are OK with
73 cleaned out all cross-class name usage. So once we are OK with
70 breaking compatibility, the two systems can be separated.
74 breaking compatibility, the two systems can be separated.
71
75
72 * IPython/Logger.py: major cleanup. This one is NOT a mixin
76 * IPython/Logger.py: major cleanup. This one is NOT a mixin
73 anymore, and the class is a fair bit less hideous as well. New
77 anymore, and the class is a fair bit less hideous as well. New
74 features were also introduced: timestamping of input, and logging
78 features were also introduced: timestamping of input, and logging
75 of output results. These are user-visible with the -t and -o
79 of output results. These are user-visible with the -t and -o
76 options to %logstart. Closes
80 options to %logstart. Closes
77 http://www.scipy.net/roundup/ipython/issue11 and a request by
81 http://www.scipy.net/roundup/ipython/issue11 and a request by
78 William Stein (SAGE developer - http://modular.ucsd.edu/sage).
82 William Stein (SAGE developer - http://modular.ucsd.edu/sage).
79
83
80 2005-12-28 Fernando Perez <Fernando.Perez@colorado.edu>
84 2005-12-28 Fernando Perez <Fernando.Perez@colorado.edu>
81
85
82 * IPython/iplib.py (handle_shell_escape): add Ville's patch to
86 * IPython/iplib.py (handle_shell_escape): add Ville's patch to
83 better hadnle backslashes in paths. See the thread 'More Windows
87 better hadnle backslashes in paths. See the thread 'More Windows
84 questions part 2 - \/ characters revisited' on the iypthon user
88 questions part 2 - \/ characters revisited' on the iypthon user
85 list:
89 list:
86 http://scipy.net/pipermail/ipython-user/2005-June/000907.html
90 http://scipy.net/pipermail/ipython-user/2005-June/000907.html
87
91
88 (InteractiveShell.__init__): fix tab-completion bug in threaded shells.
92 (InteractiveShell.__init__): fix tab-completion bug in threaded shells.
89
93
90 (InteractiveShell.__init__): change threaded shells to not use the
94 (InteractiveShell.__init__): change threaded shells to not use the
91 ipython crash handler. This was causing more problems than not,
95 ipython crash handler. This was causing more problems than not,
92 as exceptions in the main thread (GUI code, typically) would
96 as exceptions in the main thread (GUI code, typically) would
93 always show up as a 'crash', when they really weren't.
97 always show up as a 'crash', when they really weren't.
94
98
95 The colors and exception mode commands (%colors/%xmode) have been
99 The colors and exception mode commands (%colors/%xmode) have been
96 synchronized to also take this into account, so users can get
100 synchronized to also take this into account, so users can get
97 verbose exceptions for their threaded code as well. I also added
101 verbose exceptions for their threaded code as well. I also added
98 support for activating pdb inside this exception handler as well,
102 support for activating pdb inside this exception handler as well,
99 so now GUI authors can use IPython's enhanced pdb at runtime.
103 so now GUI authors can use IPython's enhanced pdb at runtime.
100
104
101 * IPython/ipmaker.py (make_IPython): make the autoedit_syntax flag
105 * IPython/ipmaker.py (make_IPython): make the autoedit_syntax flag
102 true by default, and add it to the shipped ipythonrc file. Since
106 true by default, and add it to the shipped ipythonrc file. Since
103 this asks the user before proceeding, I think it's OK to make it
107 this asks the user before proceeding, I think it's OK to make it
104 true by default.
108 true by default.
105
109
106 * IPython/Magic.py (magic_exit): make new exit/quit magics instead
110 * IPython/Magic.py (magic_exit): make new exit/quit magics instead
107 of the previous special-casing of input in the eval loop. I think
111 of the previous special-casing of input in the eval loop. I think
108 this is cleaner, as they really are commands and shouldn't have
112 this is cleaner, as they really are commands and shouldn't have
109 a special role in the middle of the core code.
113 a special role in the middle of the core code.
110
114
111 2005-12-27 Fernando Perez <Fernando.Perez@colorado.edu>
115 2005-12-27 Fernando Perez <Fernando.Perez@colorado.edu>
112
116
113 * IPython/iplib.py (edit_syntax_error): added support for
117 * IPython/iplib.py (edit_syntax_error): added support for
114 automatically reopening the editor if the file had a syntax error
118 automatically reopening the editor if the file had a syntax error
115 in it. Thanks to scottt who provided the patch at:
119 in it. Thanks to scottt who provided the patch at:
116 http://www.scipy.net/roundup/ipython/issue36 (slightly modified
120 http://www.scipy.net/roundup/ipython/issue36 (slightly modified
117 version committed).
121 version committed).
118
122
119 * IPython/iplib.py (handle_normal): add suport for multi-line
123 * IPython/iplib.py (handle_normal): add suport for multi-line
120 input with emtpy lines. This fixes
124 input with emtpy lines. This fixes
121 http://www.scipy.net/roundup/ipython/issue43 and a similar
125 http://www.scipy.net/roundup/ipython/issue43 and a similar
122 discussion on the user list.
126 discussion on the user list.
123
127
124 WARNING: a behavior change is necessarily introduced to support
128 WARNING: a behavior change is necessarily introduced to support
125 blank lines: now a single blank line with whitespace does NOT
129 blank lines: now a single blank line with whitespace does NOT
126 break the input loop, which means that when autoindent is on, by
130 break the input loop, which means that when autoindent is on, by
127 default hitting return on the next (indented) line does NOT exit.
131 default hitting return on the next (indented) line does NOT exit.
128
132
129 Instead, to exit a multiline input you can either have:
133 Instead, to exit a multiline input you can either have:
130
134
131 - TWO whitespace lines (just hit return again), or
135 - TWO whitespace lines (just hit return again), or
132 - a single whitespace line of a different length than provided
136 - a single whitespace line of a different length than provided
133 by the autoindent (add or remove a space).
137 by the autoindent (add or remove a space).
134
138
135 * IPython/completer.py (MagicCompleter.__init__): new 'completer'
139 * IPython/completer.py (MagicCompleter.__init__): new 'completer'
136 module to better organize all readline-related functionality.
140 module to better organize all readline-related functionality.
137 I've deleted FlexCompleter and put all completion clases here.
141 I've deleted FlexCompleter and put all completion clases here.
138
142
139 * IPython/iplib.py (raw_input): improve indentation management.
143 * IPython/iplib.py (raw_input): improve indentation management.
140 It is now possible to paste indented code with autoindent on, and
144 It is now possible to paste indented code with autoindent on, and
141 the code is interpreted correctly (though it still looks bad on
145 the code is interpreted correctly (though it still looks bad on
142 screen, due to the line-oriented nature of ipython).
146 screen, due to the line-oriented nature of ipython).
143 (MagicCompleter.complete): change behavior so that a TAB key on an
147 (MagicCompleter.complete): change behavior so that a TAB key on an
144 otherwise empty line actually inserts a tab, instead of completing
148 otherwise empty line actually inserts a tab, instead of completing
145 on the entire global namespace. This makes it easier to use the
149 on the entire global namespace. This makes it easier to use the
146 TAB key for indentation. After a request by Hans Meine
150 TAB key for indentation. After a request by Hans Meine
147 <hans_meine-AT-gmx.net>
151 <hans_meine-AT-gmx.net>
148 (_prefilter): add support so that typing plain 'exit' or 'quit'
152 (_prefilter): add support so that typing plain 'exit' or 'quit'
149 does a sensible thing. Originally I tried to deviate as little as
153 does a sensible thing. Originally I tried to deviate as little as
150 possible from the default python behavior, but even that one may
154 possible from the default python behavior, but even that one may
151 change in this direction (thread on python-dev to that effect).
155 change in this direction (thread on python-dev to that effect).
152 Regardless, ipython should do the right thing even if CPython's
156 Regardless, ipython should do the right thing even if CPython's
153 '>>>' prompt doesn't.
157 '>>>' prompt doesn't.
154 (InteractiveShell): removed subclassing code.InteractiveConsole
158 (InteractiveShell): removed subclassing code.InteractiveConsole
155 class. By now we'd overridden just about all of its methods: I've
159 class. By now we'd overridden just about all of its methods: I've
156 copied the remaining two over, and now ipython is a standalone
160 copied the remaining two over, and now ipython is a standalone
157 class. This will provide a clearer picture for the chainsaw
161 class. This will provide a clearer picture for the chainsaw
158 branch refactoring.
162 branch refactoring.
159
163
160 2005-12-26 Fernando Perez <Fernando.Perez@colorado.edu>
164 2005-12-26 Fernando Perez <Fernando.Perez@colorado.edu>
161
165
162 * IPython/ultraTB.py (VerboseTB.text): harden reporting against
166 * IPython/ultraTB.py (VerboseTB.text): harden reporting against
163 failures for objects which break when dir() is called on them.
167 failures for objects which break when dir() is called on them.
164
168
165 * IPython/FlexCompleter.py (Completer.__init__): Added support for
169 * IPython/FlexCompleter.py (Completer.__init__): Added support for
166 distinct local and global namespaces in the completer API. This
170 distinct local and global namespaces in the completer API. This
167 change allows us top properly handle completion with distinct
171 change allows us top properly handle completion with distinct
168 scopes, including in embedded instances (this had never really
172 scopes, including in embedded instances (this had never really
169 worked correctly).
173 worked correctly).
170
174
171 Note: this introduces a change in the constructor for
175 Note: this introduces a change in the constructor for
172 MagicCompleter, as a new global_namespace parameter is now the
176 MagicCompleter, as a new global_namespace parameter is now the
173 second argument (the others were bumped one position).
177 second argument (the others were bumped one position).
174
178
175 2005-12-25 Fernando Perez <Fernando.Perez@colorado.edu>
179 2005-12-25 Fernando Perez <Fernando.Perez@colorado.edu>
176
180
177 * IPython/iplib.py (embed_mainloop): fix tab-completion in
181 * IPython/iplib.py (embed_mainloop): fix tab-completion in
178 embedded instances (which can be done now thanks to Vivian's
182 embedded instances (which can be done now thanks to Vivian's
179 frame-handling fixes for pdb).
183 frame-handling fixes for pdb).
180 (InteractiveShell.__init__): Fix namespace handling problem in
184 (InteractiveShell.__init__): Fix namespace handling problem in
181 embedded instances. We were overwriting __main__ unconditionally,
185 embedded instances. We were overwriting __main__ unconditionally,
182 and this should only be done for 'full' (non-embedded) IPython;
186 and this should only be done for 'full' (non-embedded) IPython;
183 embedded instances must respect the caller's __main__. Thanks to
187 embedded instances must respect the caller's __main__. Thanks to
184 a bug report by Yaroslav Bulatov <yaroslavvb-AT-gmail.com>
188 a bug report by Yaroslav Bulatov <yaroslavvb-AT-gmail.com>
185
189
186 2005-12-24 Fernando Perez <Fernando.Perez@colorado.edu>
190 2005-12-24 Fernando Perez <Fernando.Perez@colorado.edu>
187
191
188 * setup.py: added download_url to setup(). This registers the
192 * setup.py: added download_url to setup(). This registers the
189 download address at PyPI, which is not only useful to humans
193 download address at PyPI, which is not only useful to humans
190 browsing the site, but is also picked up by setuptools (the Eggs
194 browsing the site, but is also picked up by setuptools (the Eggs
191 machinery). Thanks to Ville and R. Kern for the info/discussion
195 machinery). Thanks to Ville and R. Kern for the info/discussion
192 on this.
196 on this.
193
197
194 2005-12-23 Fernando Perez <Fernando.Perez@colorado.edu>
198 2005-12-23 Fernando Perez <Fernando.Perez@colorado.edu>
195
199
196 * IPython/Debugger.py (Pdb.__init__): Major pdb mode enhancements.
200 * IPython/Debugger.py (Pdb.__init__): Major pdb mode enhancements.
197 This brings a lot of nice functionality to the pdb mode, which now
201 This brings a lot of nice functionality to the pdb mode, which now
198 has tab-completion, syntax highlighting, and better stack handling
202 has tab-completion, syntax highlighting, and better stack handling
199 than before. Many thanks to Vivian De Smedt
203 than before. Many thanks to Vivian De Smedt
200 <vivian-AT-vdesmedt.com> for the original patches.
204 <vivian-AT-vdesmedt.com> for the original patches.
201
205
202 2005-12-08 Fernando Perez <Fernando.Perez@colorado.edu>
206 2005-12-08 Fernando Perez <Fernando.Perez@colorado.edu>
203
207
204 * IPython/Shell.py (IPShellGTK.mainloop): fix mainloop() calling
208 * IPython/Shell.py (IPShellGTK.mainloop): fix mainloop() calling
205 sequence to consistently accept the banner argument. The
209 sequence to consistently accept the banner argument. The
206 inconsistency was tripping SAGE, thanks to Gary Zablackis
210 inconsistency was tripping SAGE, thanks to Gary Zablackis
207 <gzabl-AT-yahoo.com> for the report.
211 <gzabl-AT-yahoo.com> for the report.
208
212
209 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
213 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
210
214
211 * IPython/iplib.py (InteractiveShell.post_config_initialization):
215 * IPython/iplib.py (InteractiveShell.post_config_initialization):
212 Fix bug where a naked 'alias' call in the ipythonrc file would
216 Fix bug where a naked 'alias' call in the ipythonrc file would
213 cause a crash. Bug reported by Jorgen Stenarson.
217 cause a crash. Bug reported by Jorgen Stenarson.
214
218
215 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
219 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
216
220
217 * IPython/ipmaker.py (make_IPython): cleanups which should improve
221 * IPython/ipmaker.py (make_IPython): cleanups which should improve
218 startup time.
222 startup time.
219
223
220 * IPython/iplib.py (runcode): my globals 'fix' for embedded
224 * IPython/iplib.py (runcode): my globals 'fix' for embedded
221 instances had introduced a bug with globals in normal code. Now
225 instances had introduced a bug with globals in normal code. Now
222 it's working in all cases.
226 it's working in all cases.
223
227
224 * IPython/Magic.py (magic_psearch): Finish wildcard cleanup and
228 * IPython/Magic.py (magic_psearch): Finish wildcard cleanup and
225 API changes. A new ipytonrc option, 'wildcards_case_sensitive'
229 API changes. A new ipytonrc option, 'wildcards_case_sensitive'
226 has been introduced to set the default case sensitivity of the
230 has been introduced to set the default case sensitivity of the
227 searches. Users can still select either mode at runtime on a
231 searches. Users can still select either mode at runtime on a
228 per-search basis.
232 per-search basis.
229
233
230 2005-11-13 Fernando Perez <Fernando.Perez@colorado.edu>
234 2005-11-13 Fernando Perez <Fernando.Perez@colorado.edu>
231
235
232 * IPython/wildcard.py (NameSpace.__init__): fix resolution of
236 * IPython/wildcard.py (NameSpace.__init__): fix resolution of
233 attributes in wildcard searches for subclasses. Modified version
237 attributes in wildcard searches for subclasses. Modified version
234 of a patch by Jorgen.
238 of a patch by Jorgen.
235
239
236 2005-11-12 Fernando Perez <Fernando.Perez@colorado.edu>
240 2005-11-12 Fernando Perez <Fernando.Perez@colorado.edu>
237
241
238 * IPython/iplib.py (embed_mainloop): Fix handling of globals for
242 * IPython/iplib.py (embed_mainloop): Fix handling of globals for
239 embedded instances. I added a user_global_ns attribute to the
243 embedded instances. I added a user_global_ns attribute to the
240 InteractiveShell class to handle this.
244 InteractiveShell class to handle this.
241
245
242 2005-10-31 Fernando Perez <Fernando.Perez@colorado.edu>
246 2005-10-31 Fernando Perez <Fernando.Perez@colorado.edu>
243
247
244 * IPython/Shell.py (IPShellGTK.mainloop): Change timeout_add to
248 * IPython/Shell.py (IPShellGTK.mainloop): Change timeout_add to
245 idle_add, which fixes horrible keyboard lag problems under gtk 2.6
249 idle_add, which fixes horrible keyboard lag problems under gtk 2.6
246 (reported under win32, but may happen also in other platforms).
250 (reported under win32, but may happen also in other platforms).
247 Bug report and fix courtesy of Sean Moore <smm-AT-logic.bm>
251 Bug report and fix courtesy of Sean Moore <smm-AT-logic.bm>
248
252
249 2005-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
253 2005-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
250
254
251 * IPython/Magic.py (magic_psearch): new support for wildcard
255 * IPython/Magic.py (magic_psearch): new support for wildcard
252 patterns. Now, typing ?a*b will list all names which begin with a
256 patterns. Now, typing ?a*b will list all names which begin with a
253 and end in b, for example. The %psearch magic has full
257 and end in b, for example. The %psearch magic has full
254 docstrings. Many thanks to JΓΆrgen Stenarson
258 docstrings. Many thanks to JΓΆrgen Stenarson
255 <jorgen.stenarson-AT-bostream.nu>, author of the patches
259 <jorgen.stenarson-AT-bostream.nu>, author of the patches
256 implementing this functionality.
260 implementing this functionality.
257
261
258 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
262 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
259
263
260 * Manual: fixed long-standing annoyance of double-dashes (as in
264 * Manual: fixed long-standing annoyance of double-dashes (as in
261 --prefix=~, for example) being stripped in the HTML version. This
265 --prefix=~, for example) being stripped in the HTML version. This
262 is a latex2html bug, but a workaround was provided. Many thanks
266 is a latex2html bug, but a workaround was provided. Many thanks
263 to George K. Thiruvathukal <gthiruv-AT-luc.edu> for the detailed
267 to George K. Thiruvathukal <gthiruv-AT-luc.edu> for the detailed
264 help, and Michael Tobis <mtobis-AT-gmail.com> for getting the ball
268 help, and Michael Tobis <mtobis-AT-gmail.com> for getting the ball
265 rolling. This seemingly small issue had tripped a number of users
269 rolling. This seemingly small issue had tripped a number of users
266 when first installing, so I'm glad to see it gone.
270 when first installing, so I'm glad to see it gone.
267
271
268 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
272 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
269
273
270 * IPython/Extensions/numeric_formats.py: fix missing import,
274 * IPython/Extensions/numeric_formats.py: fix missing import,
271 reported by Stephen Walton.
275 reported by Stephen Walton.
272
276
273 2005-09-24 Fernando Perez <Fernando.Perez@colorado.edu>
277 2005-09-24 Fernando Perez <Fernando.Perez@colorado.edu>
274
278
275 * IPython/demo.py: finish demo module, fully documented now.
279 * IPython/demo.py: finish demo module, fully documented now.
276
280
277 * IPython/genutils.py (file_read): simple little utility to read a
281 * IPython/genutils.py (file_read): simple little utility to read a
278 file and ensure it's closed afterwards.
282 file and ensure it's closed afterwards.
279
283
280 2005-09-23 Fernando Perez <Fernando.Perez@colorado.edu>
284 2005-09-23 Fernando Perez <Fernando.Perez@colorado.edu>
281
285
282 * IPython/demo.py (Demo.__init__): added support for individually
286 * IPython/demo.py (Demo.__init__): added support for individually
283 tagging blocks for automatic execution.
287 tagging blocks for automatic execution.
284
288
285 * IPython/Magic.py (magic_pycat): new %pycat magic for showing
289 * IPython/Magic.py (magic_pycat): new %pycat magic for showing
286 syntax-highlighted python sources, requested by John.
290 syntax-highlighted python sources, requested by John.
287
291
288 2005-09-22 Fernando Perez <Fernando.Perez@colorado.edu>
292 2005-09-22 Fernando Perez <Fernando.Perez@colorado.edu>
289
293
290 * IPython/demo.py (Demo.again): fix bug where again() blocks after
294 * IPython/demo.py (Demo.again): fix bug where again() blocks after
291 finishing.
295 finishing.
292
296
293 * IPython/genutils.py (shlex_split): moved from Magic to here,
297 * IPython/genutils.py (shlex_split): moved from Magic to here,
294 where all 2.2 compatibility stuff lives. I needed it for demo.py.
298 where all 2.2 compatibility stuff lives. I needed it for demo.py.
295
299
296 * IPython/demo.py (Demo.__init__): added support for silent
300 * IPython/demo.py (Demo.__init__): added support for silent
297 blocks, improved marks as regexps, docstrings written.
301 blocks, improved marks as regexps, docstrings written.
298 (Demo.__init__): better docstring, added support for sys.argv.
302 (Demo.__init__): better docstring, added support for sys.argv.
299
303
300 * IPython/genutils.py (marquee): little utility used by the demo
304 * IPython/genutils.py (marquee): little utility used by the demo
301 code, handy in general.
305 code, handy in general.
302
306
303 * IPython/demo.py (Demo.__init__): new class for interactive
307 * IPython/demo.py (Demo.__init__): new class for interactive
304 demos. Not documented yet, I just wrote it in a hurry for
308 demos. Not documented yet, I just wrote it in a hurry for
305 scipy'05. Will docstring later.
309 scipy'05. Will docstring later.
306
310
307 2005-09-20 Fernando Perez <Fernando.Perez@colorado.edu>
311 2005-09-20 Fernando Perez <Fernando.Perez@colorado.edu>
308
312
309 * IPython/Shell.py (sigint_handler): Drastic simplification which
313 * IPython/Shell.py (sigint_handler): Drastic simplification which
310 also seems to make Ctrl-C work correctly across threads! This is
314 also seems to make Ctrl-C work correctly across threads! This is
311 so simple, that I can't beleive I'd missed it before. Needs more
315 so simple, that I can't beleive I'd missed it before. Needs more
312 testing, though.
316 testing, though.
313 (KBINT): Never mind, revert changes. I'm sure I'd tried something
317 (KBINT): Never mind, revert changes. I'm sure I'd tried something
314 like this before...
318 like this before...
315
319
316 * IPython/genutils.py (get_home_dir): add protection against
320 * IPython/genutils.py (get_home_dir): add protection against
317 non-dirs in win32 registry.
321 non-dirs in win32 registry.
318
322
319 * IPython/iplib.py (InteractiveShell.alias_table_validate): fix
323 * IPython/iplib.py (InteractiveShell.alias_table_validate): fix
320 bug where dict was mutated while iterating (pysh crash).
324 bug where dict was mutated while iterating (pysh crash).
321
325
322 2005-09-06 Fernando Perez <Fernando.Perez@colorado.edu>
326 2005-09-06 Fernando Perez <Fernando.Perez@colorado.edu>
323
327
324 * IPython/iplib.py (handle_auto): Fix inconsistency arising from
328 * IPython/iplib.py (handle_auto): Fix inconsistency arising from
325 spurious newlines added by this routine. After a report by
329 spurious newlines added by this routine. After a report by
326 F. Mantegazza.
330 F. Mantegazza.
327
331
328 2005-09-05 Fernando Perez <Fernando.Perez@colorado.edu>
332 2005-09-05 Fernando Perez <Fernando.Perez@colorado.edu>
329
333
330 * IPython/Shell.py (hijack_gtk): remove pygtk.require("2.0")
334 * IPython/Shell.py (hijack_gtk): remove pygtk.require("2.0")
331 calls. These were a leftover from the GTK 1.x days, and can cause
335 calls. These were a leftover from the GTK 1.x days, and can cause
332 problems in certain cases (after a report by John Hunter).
336 problems in certain cases (after a report by John Hunter).
333
337
334 * IPython/iplib.py (InteractiveShell.__init__): Trap exception if
338 * IPython/iplib.py (InteractiveShell.__init__): Trap exception if
335 os.getcwd() fails at init time. Thanks to patch from David Remahl
339 os.getcwd() fails at init time. Thanks to patch from David Remahl
336 <chmod007-AT-mac.com>.
340 <chmod007-AT-mac.com>.
337 (InteractiveShell.__init__): prevent certain special magics from
341 (InteractiveShell.__init__): prevent certain special magics from
338 being shadowed by aliases. Closes
342 being shadowed by aliases. Closes
339 http://www.scipy.net/roundup/ipython/issue41.
343 http://www.scipy.net/roundup/ipython/issue41.
340
344
341 2005-08-31 Fernando Perez <Fernando.Perez@colorado.edu>
345 2005-08-31 Fernando Perez <Fernando.Perez@colorado.edu>
342
346
343 * IPython/iplib.py (InteractiveShell.complete): Added new
347 * IPython/iplib.py (InteractiveShell.complete): Added new
344 top-level completion method to expose the completion mechanism
348 top-level completion method to expose the completion mechanism
345 beyond readline-based environments.
349 beyond readline-based environments.
346
350
347 2005-08-19 Fernando Perez <Fernando.Perez@colorado.edu>
351 2005-08-19 Fernando Perez <Fernando.Perez@colorado.edu>
348
352
349 * tools/ipsvnc (svnversion): fix svnversion capture.
353 * tools/ipsvnc (svnversion): fix svnversion capture.
350
354
351 * IPython/iplib.py (InteractiveShell.__init__): Add has_readline
355 * IPython/iplib.py (InteractiveShell.__init__): Add has_readline
352 attribute to self, which was missing. Before, it was set by a
356 attribute to self, which was missing. Before, it was set by a
353 routine which in certain cases wasn't being called, so the
357 routine which in certain cases wasn't being called, so the
354 instance could end up missing the attribute. This caused a crash.
358 instance could end up missing the attribute. This caused a crash.
355 Closes http://www.scipy.net/roundup/ipython/issue40.
359 Closes http://www.scipy.net/roundup/ipython/issue40.
356
360
357 2005-08-16 Fernando Perez <fperez@colorado.edu>
361 2005-08-16 Fernando Perez <fperez@colorado.edu>
358
362
359 * IPython/ultraTB.py (VerboseTB.text): don't crash if object
363 * IPython/ultraTB.py (VerboseTB.text): don't crash if object
360 contains non-string attribute. Closes
364 contains non-string attribute. Closes
361 http://www.scipy.net/roundup/ipython/issue38.
365 http://www.scipy.net/roundup/ipython/issue38.
362
366
363 2005-08-14 Fernando Perez <fperez@colorado.edu>
367 2005-08-14 Fernando Perez <fperez@colorado.edu>
364
368
365 * tools/ipsvnc: Minor improvements, to add changeset info.
369 * tools/ipsvnc: Minor improvements, to add changeset info.
366
370
367 2005-08-12 Fernando Perez <fperez@colorado.edu>
371 2005-08-12 Fernando Perez <fperez@colorado.edu>
368
372
369 * IPython/iplib.py (runsource): remove self.code_to_run_src
373 * IPython/iplib.py (runsource): remove self.code_to_run_src
370 attribute. I realized this is nothing more than
374 attribute. I realized this is nothing more than
371 '\n'.join(self.buffer), and having the same data in two different
375 '\n'.join(self.buffer), and having the same data in two different
372 places is just asking for synchronization bugs. This may impact
376 places is just asking for synchronization bugs. This may impact
373 people who have custom exception handlers, so I need to warn
377 people who have custom exception handlers, so I need to warn
374 ipython-dev about it (F. Mantegazza may use them).
378 ipython-dev about it (F. Mantegazza may use them).
375
379
376 2005-07-29 Fernando Perez <Fernando.Perez@colorado.edu>
380 2005-07-29 Fernando Perez <Fernando.Perez@colorado.edu>
377
381
378 * IPython/genutils.py: fix 2.2 compatibility (generators)
382 * IPython/genutils.py: fix 2.2 compatibility (generators)
379
383
380 2005-07-18 Fernando Perez <fperez@colorado.edu>
384 2005-07-18 Fernando Perez <fperez@colorado.edu>
381
385
382 * IPython/genutils.py (get_home_dir): fix to help users with
386 * IPython/genutils.py (get_home_dir): fix to help users with
383 invalid $HOME under win32.
387 invalid $HOME under win32.
384
388
385 2005-07-17 Fernando Perez <fperez@colorado.edu>
389 2005-07-17 Fernando Perez <fperez@colorado.edu>
386
390
387 * IPython/Prompts.py (str_safe): Make unicode-safe. Also remove
391 * IPython/Prompts.py (str_safe): Make unicode-safe. Also remove
388 some old hacks and clean up a bit other routines; code should be
392 some old hacks and clean up a bit other routines; code should be
389 simpler and a bit faster.
393 simpler and a bit faster.
390
394
391 * IPython/iplib.py (interact): removed some last-resort attempts
395 * IPython/iplib.py (interact): removed some last-resort attempts
392 to survive broken stdout/stderr. That code was only making it
396 to survive broken stdout/stderr. That code was only making it
393 harder to abstract out the i/o (necessary for gui integration),
397 harder to abstract out the i/o (necessary for gui integration),
394 and the crashes it could prevent were extremely rare in practice
398 and the crashes it could prevent were extremely rare in practice
395 (besides being fully user-induced in a pretty violent manner).
399 (besides being fully user-induced in a pretty violent manner).
396
400
397 * IPython/genutils.py (IOStream.__init__): Simplify the i/o stuff.
401 * IPython/genutils.py (IOStream.__init__): Simplify the i/o stuff.
398 Nothing major yet, but the code is simpler to read; this should
402 Nothing major yet, but the code is simpler to read; this should
399 make it easier to do more serious modifications in the future.
403 make it easier to do more serious modifications in the future.
400
404
401 * IPython/Extensions/InterpreterExec.py: Fix auto-quoting in pysh,
405 * IPython/Extensions/InterpreterExec.py: Fix auto-quoting in pysh,
402 which broke in .15 (thanks to a report by Ville).
406 which broke in .15 (thanks to a report by Ville).
403
407
404 * IPython/Itpl.py (Itpl.__init__): add unicode support (it may not
408 * IPython/Itpl.py (Itpl.__init__): add unicode support (it may not
405 be quite correct, I know next to nothing about unicode). This
409 be quite correct, I know next to nothing about unicode). This
406 will allow unicode strings to be used in prompts, amongst other
410 will allow unicode strings to be used in prompts, amongst other
407 cases. It also will prevent ipython from crashing when unicode
411 cases. It also will prevent ipython from crashing when unicode
408 shows up unexpectedly in many places. If ascii encoding fails, we
412 shows up unexpectedly in many places. If ascii encoding fails, we
409 assume utf_8. Currently the encoding is not a user-visible
413 assume utf_8. Currently the encoding is not a user-visible
410 setting, though it could be made so if there is demand for it.
414 setting, though it could be made so if there is demand for it.
411
415
412 * IPython/ipmaker.py (make_IPython): remove old 2.1-specific hack.
416 * IPython/ipmaker.py (make_IPython): remove old 2.1-specific hack.
413
417
414 * IPython/Struct.py (Struct.merge): switch keys() to iterator.
418 * IPython/Struct.py (Struct.merge): switch keys() to iterator.
415
419
416 * IPython/background_jobs.py: moved 2.2 compatibility to genutils.
420 * IPython/background_jobs.py: moved 2.2 compatibility to genutils.
417
421
418 * IPython/genutils.py: Add 2.2 compatibility here, so all other
422 * IPython/genutils.py: Add 2.2 compatibility here, so all other
419 code can work transparently for 2.2/2.3.
423 code can work transparently for 2.2/2.3.
420
424
421 2005-07-16 Fernando Perez <fperez@colorado.edu>
425 2005-07-16 Fernando Perez <fperez@colorado.edu>
422
426
423 * IPython/ultraTB.py (ExceptionColors): Make a global variable
427 * IPython/ultraTB.py (ExceptionColors): Make a global variable
424 out of the color scheme table used for coloring exception
428 out of the color scheme table used for coloring exception
425 tracebacks. This allows user code to add new schemes at runtime.
429 tracebacks. This allows user code to add new schemes at runtime.
426 This is a minimally modified version of the patch at
430 This is a minimally modified version of the patch at
427 http://www.scipy.net/roundup/ipython/issue35, many thanks to pabw
431 http://www.scipy.net/roundup/ipython/issue35, many thanks to pabw
428 for the contribution.
432 for the contribution.
429
433
430 * IPython/FlexCompleter.py (Completer.attr_matches): Add a
434 * IPython/FlexCompleter.py (Completer.attr_matches): Add a
431 slightly modified version of the patch in
435 slightly modified version of the patch in
432 http://www.scipy.net/roundup/ipython/issue34, which also allows me
436 http://www.scipy.net/roundup/ipython/issue34, which also allows me
433 to remove the previous try/except solution (which was costlier).
437 to remove the previous try/except solution (which was costlier).
434 Thanks to Gaetan Lehmann <gaetan.lehmann-AT-jouy.inra.fr> for the fix.
438 Thanks to Gaetan Lehmann <gaetan.lehmann-AT-jouy.inra.fr> for the fix.
435
439
436 2005-06-08 Fernando Perez <fperez@colorado.edu>
440 2005-06-08 Fernando Perez <fperez@colorado.edu>
437
441
438 * IPython/iplib.py (write/write_err): Add methods to abstract all
442 * IPython/iplib.py (write/write_err): Add methods to abstract all
439 I/O a bit more.
443 I/O a bit more.
440
444
441 * IPython/Shell.py (IPShellGTK.mainloop): Fix GTK deprecation
445 * IPython/Shell.py (IPShellGTK.mainloop): Fix GTK deprecation
442 warning, reported by Aric Hagberg, fix by JD Hunter.
446 warning, reported by Aric Hagberg, fix by JD Hunter.
443
447
444 2005-06-02 *** Released version 0.6.15
448 2005-06-02 *** Released version 0.6.15
445
449
446 2005-06-01 Fernando Perez <fperez@colorado.edu>
450 2005-06-01 Fernando Perez <fperez@colorado.edu>
447
451
448 * IPython/iplib.py (MagicCompleter.file_matches): Fix
452 * IPython/iplib.py (MagicCompleter.file_matches): Fix
449 tab-completion of filenames within open-quoted strings. Note that
453 tab-completion of filenames within open-quoted strings. Note that
450 this requires that in ~/.ipython/ipythonrc, users change the
454 this requires that in ~/.ipython/ipythonrc, users change the
451 readline delimiters configuration to read:
455 readline delimiters configuration to read:
452
456
453 readline_remove_delims -/~
457 readline_remove_delims -/~
454
458
455
459
456 2005-05-31 *** Released version 0.6.14
460 2005-05-31 *** Released version 0.6.14
457
461
458 2005-05-29 Fernando Perez <fperez@colorado.edu>
462 2005-05-29 Fernando Perez <fperez@colorado.edu>
459
463
460 * IPython/ultraTB.py (VerboseTB.text): Fix crash for tracebacks
464 * IPython/ultraTB.py (VerboseTB.text): Fix crash for tracebacks
461 with files not on the filesystem. Reported by Eliyahu Sandler
465 with files not on the filesystem. Reported by Eliyahu Sandler
462 <eli@gondolin.net>
466 <eli@gondolin.net>
463
467
464 2005-05-22 Fernando Perez <fperez@colorado.edu>
468 2005-05-22 Fernando Perez <fperez@colorado.edu>
465
469
466 * IPython/iplib.py: Fix a few crashes in the --upgrade option.
470 * IPython/iplib.py: Fix a few crashes in the --upgrade option.
467 After an initial report by LUK ShunTim <shuntim.luk@polyu.edu.hk>.
471 After an initial report by LUK ShunTim <shuntim.luk@polyu.edu.hk>.
468
472
469 2005-05-19 Fernando Perez <fperez@colorado.edu>
473 2005-05-19 Fernando Perez <fperez@colorado.edu>
470
474
471 * IPython/iplib.py (safe_execfile): close a file which could be
475 * IPython/iplib.py (safe_execfile): close a file which could be
472 left open (causing problems in win32, which locks open files).
476 left open (causing problems in win32, which locks open files).
473 Thanks to a bug report by D Brown <dbrown2@yahoo.com>.
477 Thanks to a bug report by D Brown <dbrown2@yahoo.com>.
474
478
475 2005-05-18 Fernando Perez <fperez@colorado.edu>
479 2005-05-18 Fernando Perez <fperez@colorado.edu>
476
480
477 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): pass all
481 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): pass all
478 keyword arguments correctly to safe_execfile().
482 keyword arguments correctly to safe_execfile().
479
483
480 2005-05-13 Fernando Perez <fperez@colorado.edu>
484 2005-05-13 Fernando Perez <fperez@colorado.edu>
481
485
482 * ipython.1: Added info about Qt to manpage, and threads warning
486 * ipython.1: Added info about Qt to manpage, and threads warning
483 to usage page (invoked with --help).
487 to usage page (invoked with --help).
484
488
485 * IPython/iplib.py (MagicCompleter.python_func_kw_matches): Added
489 * IPython/iplib.py (MagicCompleter.python_func_kw_matches): Added
486 new matcher (it goes at the end of the priority list) to do
490 new matcher (it goes at the end of the priority list) to do
487 tab-completion on named function arguments. Submitted by George
491 tab-completion on named function arguments. Submitted by George
488 Sakkis <gsakkis-AT-eden.rutgers.edu>. See the thread at
492 Sakkis <gsakkis-AT-eden.rutgers.edu>. See the thread at
489 http://www.scipy.net/pipermail/ipython-dev/2005-April/000436.html
493 http://www.scipy.net/pipermail/ipython-dev/2005-April/000436.html
490 for more details.
494 for more details.
491
495
492 * IPython/Magic.py (magic_run): Added new -e flag to ignore
496 * IPython/Magic.py (magic_run): Added new -e flag to ignore
493 SystemExit exceptions in the script being run. Thanks to a report
497 SystemExit exceptions in the script being run. Thanks to a report
494 by danny shevitz <danny_shevitz-AT-yahoo.com>, about this
498 by danny shevitz <danny_shevitz-AT-yahoo.com>, about this
495 producing very annoying behavior when running unit tests.
499 producing very annoying behavior when running unit tests.
496
500
497 2005-05-12 Fernando Perez <fperez@colorado.edu>
501 2005-05-12 Fernando Perez <fperez@colorado.edu>
498
502
499 * IPython/iplib.py (handle_auto): fixed auto-quoting and parens,
503 * IPython/iplib.py (handle_auto): fixed auto-quoting and parens,
500 which I'd broken (again) due to a changed regexp. In the process,
504 which I'd broken (again) due to a changed regexp. In the process,
501 added ';' as an escape to auto-quote the whole line without
505 added ';' as an escape to auto-quote the whole line without
502 splitting its arguments. Thanks to a report by Jerry McRae
506 splitting its arguments. Thanks to a report by Jerry McRae
503 <qrs0xyc02-AT-sneakemail.com>.
507 <qrs0xyc02-AT-sneakemail.com>.
504
508
505 * IPython/ultraTB.py (VerboseTB.text): protect against rare but
509 * IPython/ultraTB.py (VerboseTB.text): protect against rare but
506 possible crashes caused by a TokenError. Reported by Ed Schofield
510 possible crashes caused by a TokenError. Reported by Ed Schofield
507 <schofield-AT-ftw.at>.
511 <schofield-AT-ftw.at>.
508
512
509 2005-05-06 Fernando Perez <fperez@colorado.edu>
513 2005-05-06 Fernando Perez <fperez@colorado.edu>
510
514
511 * IPython/Shell.py (hijack_wx): Fix to work with WX v.2.6.
515 * IPython/Shell.py (hijack_wx): Fix to work with WX v.2.6.
512
516
513 2005-04-29 Fernando Perez <fperez@colorado.edu>
517 2005-04-29 Fernando Perez <fperez@colorado.edu>
514
518
515 * IPython/Shell.py (IPShellQt): Thanks to Denis Rivière
519 * IPython/Shell.py (IPShellQt): Thanks to Denis Rivière
516 <nudz-AT-free.fr>, Yann Cointepas <yann-AT-sapetnioc.org> and Benjamin
520 <nudz-AT-free.fr>, Yann Cointepas <yann-AT-sapetnioc.org> and Benjamin
517 Thyreau <Benji2-AT-decideur.info>, we now have a -qthread option
521 Thyreau <Benji2-AT-decideur.info>, we now have a -qthread option
518 which provides support for Qt interactive usage (similar to the
522 which provides support for Qt interactive usage (similar to the
519 existing one for WX and GTK). This had been often requested.
523 existing one for WX and GTK). This had been often requested.
520
524
521 2005-04-14 *** Released version 0.6.13
525 2005-04-14 *** Released version 0.6.13
522
526
523 2005-04-08 Fernando Perez <fperez@colorado.edu>
527 2005-04-08 Fernando Perez <fperez@colorado.edu>
524
528
525 * IPython/Magic.py (Magic._ofind): remove docstring evaluation
529 * IPython/Magic.py (Magic._ofind): remove docstring evaluation
526 from _ofind, which gets called on almost every input line. Now,
530 from _ofind, which gets called on almost every input line. Now,
527 we only try to get docstrings if they are actually going to be
531 we only try to get docstrings if they are actually going to be
528 used (the overhead of fetching unnecessary docstrings can be
532 used (the overhead of fetching unnecessary docstrings can be
529 noticeable for certain objects, such as Pyro proxies).
533 noticeable for certain objects, such as Pyro proxies).
530
534
531 * IPython/iplib.py (MagicCompleter.python_matches): Change the API
535 * IPython/iplib.py (MagicCompleter.python_matches): Change the API
532 for completers. For some reason I had been passing them the state
536 for completers. For some reason I had been passing them the state
533 variable, which completers never actually need, and was in
537 variable, which completers never actually need, and was in
534 conflict with the rlcompleter API. Custom completers ONLY need to
538 conflict with the rlcompleter API. Custom completers ONLY need to
535 take the text parameter.
539 take the text parameter.
536
540
537 * IPython/Extensions/InterpreterExec.py: Fix regexp so that magics
541 * IPython/Extensions/InterpreterExec.py: Fix regexp so that magics
538 work correctly in pysh. I've also moved all the logic which used
542 work correctly in pysh. I've also moved all the logic which used
539 to be in pysh.py here, which will prevent problems with future
543 to be in pysh.py here, which will prevent problems with future
540 upgrades. However, this time I must warn users to update their
544 upgrades. However, this time I must warn users to update their
541 pysh profile to include the line
545 pysh profile to include the line
542
546
543 import_all IPython.Extensions.InterpreterExec
547 import_all IPython.Extensions.InterpreterExec
544
548
545 because otherwise things won't work for them. They MUST also
549 because otherwise things won't work for them. They MUST also
546 delete pysh.py and the line
550 delete pysh.py and the line
547
551
548 execfile pysh.py
552 execfile pysh.py
549
553
550 from their ipythonrc-pysh.
554 from their ipythonrc-pysh.
551
555
552 * IPython/FlexCompleter.py (Completer.attr_matches): Make more
556 * IPython/FlexCompleter.py (Completer.attr_matches): Make more
553 robust in the face of objects whose dir() returns non-strings
557 robust in the face of objects whose dir() returns non-strings
554 (which it shouldn't, but some broken libs like ITK do). Thanks to
558 (which it shouldn't, but some broken libs like ITK do). Thanks to
555 a patch by John Hunter (implemented differently, though). Also
559 a patch by John Hunter (implemented differently, though). Also
556 minor improvements by using .extend instead of + on lists.
560 minor improvements by using .extend instead of + on lists.
557
561
558 * pysh.py:
562 * pysh.py:
559
563
560 2005-04-06 Fernando Perez <fperez@colorado.edu>
564 2005-04-06 Fernando Perez <fperez@colorado.edu>
561
565
562 * IPython/ipmaker.py (make_IPython): Make multi_line_specials on
566 * IPython/ipmaker.py (make_IPython): Make multi_line_specials on
563 by default, so that all users benefit from it. Those who don't
567 by default, so that all users benefit from it. Those who don't
564 want it can still turn it off.
568 want it can still turn it off.
565
569
566 * IPython/UserConfig/ipythonrc: Add multi_line_specials to the
570 * IPython/UserConfig/ipythonrc: Add multi_line_specials to the
567 config file, I'd forgotten about this, so users were getting it
571 config file, I'd forgotten about this, so users were getting it
568 off by default.
572 off by default.
569
573
570 * IPython/iplib.py (ipmagic): big overhaul of the magic system for
574 * IPython/iplib.py (ipmagic): big overhaul of the magic system for
571 consistency. Now magics can be called in multiline statements,
575 consistency. Now magics can be called in multiline statements,
572 and python variables can be expanded in magic calls via $var.
576 and python variables can be expanded in magic calls via $var.
573 This makes the magic system behave just like aliases or !system
577 This makes the magic system behave just like aliases or !system
574 calls.
578 calls.
575
579
576 2005-03-28 Fernando Perez <fperez@colorado.edu>
580 2005-03-28 Fernando Perez <fperez@colorado.edu>
577
581
578 * IPython/iplib.py (handle_auto): cleanup to use %s instead of
582 * IPython/iplib.py (handle_auto): cleanup to use %s instead of
579 expensive string additions for building command. Add support for
583 expensive string additions for building command. Add support for
580 trailing ';' when autocall is used.
584 trailing ';' when autocall is used.
581
585
582 2005-03-26 Fernando Perez <fperez@colorado.edu>
586 2005-03-26 Fernando Perez <fperez@colorado.edu>
583
587
584 * ipython.el: Fix http://www.scipy.net/roundup/ipython/issue31.
588 * ipython.el: Fix http://www.scipy.net/roundup/ipython/issue31.
585 Bugfix by A. Schmolck, the ipython.el maintainer. Also make
589 Bugfix by A. Schmolck, the ipython.el maintainer. Also make
586 ipython.el robust against prompts with any number of spaces
590 ipython.el robust against prompts with any number of spaces
587 (including 0) after the ':' character.
591 (including 0) after the ':' character.
588
592
589 * IPython/Prompts.py (Prompt2.set_p_str): Fix spurious space in
593 * IPython/Prompts.py (Prompt2.set_p_str): Fix spurious space in
590 continuation prompt, which misled users to think the line was
594 continuation prompt, which misled users to think the line was
591 already indented. Closes debian Bug#300847, reported to me by
595 already indented. Closes debian Bug#300847, reported to me by
592 Norbert Tretkowski <tretkowski-AT-inittab.de>.
596 Norbert Tretkowski <tretkowski-AT-inittab.de>.
593
597
594 2005-03-23 Fernando Perez <fperez@colorado.edu>
598 2005-03-23 Fernando Perez <fperez@colorado.edu>
595
599
596 * IPython/Prompts.py (Prompt1.__str__): Make sure that prompts are
600 * IPython/Prompts.py (Prompt1.__str__): Make sure that prompts are
597 properly aligned if they have embedded newlines.
601 properly aligned if they have embedded newlines.
598
602
599 * IPython/iplib.py (runlines): Add a public method to expose
603 * IPython/iplib.py (runlines): Add a public method to expose
600 IPython's code execution machinery, so that users can run strings
604 IPython's code execution machinery, so that users can run strings
601 as if they had been typed at the prompt interactively.
605 as if they had been typed at the prompt interactively.
602 (InteractiveShell.__init__): Added getoutput() to the __IPYTHON__
606 (InteractiveShell.__init__): Added getoutput() to the __IPYTHON__
603 methods which can call the system shell, but with python variable
607 methods which can call the system shell, but with python variable
604 expansion. The three such methods are: __IPYTHON__.system,
608 expansion. The three such methods are: __IPYTHON__.system,
605 .getoutput and .getoutputerror. These need to be documented in a
609 .getoutput and .getoutputerror. These need to be documented in a
606 'public API' section (to be written) of the manual.
610 'public API' section (to be written) of the manual.
607
611
608 2005-03-20 Fernando Perez <fperez@colorado.edu>
612 2005-03-20 Fernando Perez <fperez@colorado.edu>
609
613
610 * IPython/iplib.py (InteractiveShell.set_custom_exc): new system
614 * IPython/iplib.py (InteractiveShell.set_custom_exc): new system
611 for custom exception handling. This is quite powerful, and it
615 for custom exception handling. This is quite powerful, and it
612 allows for user-installable exception handlers which can trap
616 allows for user-installable exception handlers which can trap
613 custom exceptions at runtime and treat them separately from
617 custom exceptions at runtime and treat them separately from
614 IPython's default mechanisms. At the request of FrΓ©dΓ©ric
618 IPython's default mechanisms. At the request of FrΓ©dΓ©ric
615 Mantegazza <mantegazza-AT-ill.fr>.
619 Mantegazza <mantegazza-AT-ill.fr>.
616 (InteractiveShell.set_custom_completer): public API function to
620 (InteractiveShell.set_custom_completer): public API function to
617 add new completers at runtime.
621 add new completers at runtime.
618
622
619 2005-03-19 Fernando Perez <fperez@colorado.edu>
623 2005-03-19 Fernando Perez <fperez@colorado.edu>
620
624
621 * IPython/OInspect.py (getdoc): Add a call to obj.getdoc(), to
625 * IPython/OInspect.py (getdoc): Add a call to obj.getdoc(), to
622 allow objects which provide their docstrings via non-standard
626 allow objects which provide their docstrings via non-standard
623 mechanisms (like Pyro proxies) to still be inspected by ipython's
627 mechanisms (like Pyro proxies) to still be inspected by ipython's
624 ? system.
628 ? system.
625
629
626 * IPython/iplib.py (InteractiveShell.__init__): back off the _o/_e
630 * IPython/iplib.py (InteractiveShell.__init__): back off the _o/_e
627 automatic capture system. I tried quite hard to make it work
631 automatic capture system. I tried quite hard to make it work
628 reliably, and simply failed. I tried many combinations with the
632 reliably, and simply failed. I tried many combinations with the
629 subprocess module, but eventually nothing worked in all needed
633 subprocess module, but eventually nothing worked in all needed
630 cases (not blocking stdin for the child, duplicating stdout
634 cases (not blocking stdin for the child, duplicating stdout
631 without blocking, etc). The new %sc/%sx still do capture to these
635 without blocking, etc). The new %sc/%sx still do capture to these
632 magical list/string objects which make shell use much more
636 magical list/string objects which make shell use much more
633 conveninent, so not all is lost.
637 conveninent, so not all is lost.
634
638
635 XXX - FIX MANUAL for the change above!
639 XXX - FIX MANUAL for the change above!
636
640
637 (runsource): I copied code.py's runsource() into ipython to modify
641 (runsource): I copied code.py's runsource() into ipython to modify
638 it a bit. Now the code object and source to be executed are
642 it a bit. Now the code object and source to be executed are
639 stored in ipython. This makes this info accessible to third-party
643 stored in ipython. This makes this info accessible to third-party
640 tools, like custom exception handlers. After a request by FrΓ©dΓ©ric
644 tools, like custom exception handlers. After a request by FrΓ©dΓ©ric
641 Mantegazza <mantegazza-AT-ill.fr>.
645 Mantegazza <mantegazza-AT-ill.fr>.
642
646
643 * IPython/UserConfig/ipythonrc: Add up/down arrow keys to
647 * IPython/UserConfig/ipythonrc: Add up/down arrow keys to
644 history-search via readline (like C-p/C-n). I'd wanted this for a
648 history-search via readline (like C-p/C-n). I'd wanted this for a
645 long time, but only recently found out how to do it. For users
649 long time, but only recently found out how to do it. For users
646 who already have their ipythonrc files made and want this, just
650 who already have their ipythonrc files made and want this, just
647 add:
651 add:
648
652
649 readline_parse_and_bind "\e[A": history-search-backward
653 readline_parse_and_bind "\e[A": history-search-backward
650 readline_parse_and_bind "\e[B": history-search-forward
654 readline_parse_and_bind "\e[B": history-search-forward
651
655
652 2005-03-18 Fernando Perez <fperez@colorado.edu>
656 2005-03-18 Fernando Perez <fperez@colorado.edu>
653
657
654 * IPython/Magic.py (magic_sc): %sc and %sx now use the fancy
658 * IPython/Magic.py (magic_sc): %sc and %sx now use the fancy
655 LSString and SList classes which allow transparent conversions
659 LSString and SList classes which allow transparent conversions
656 between list mode and whitespace-separated string.
660 between list mode and whitespace-separated string.
657 (magic_r): Fix recursion problem in %r.
661 (magic_r): Fix recursion problem in %r.
658
662
659 * IPython/genutils.py (LSString): New class to be used for
663 * IPython/genutils.py (LSString): New class to be used for
660 automatic storage of the results of all alias/system calls in _o
664 automatic storage of the results of all alias/system calls in _o
661 and _e (stdout/err). These provide a .l/.list attribute which
665 and _e (stdout/err). These provide a .l/.list attribute which
662 does automatic splitting on newlines. This means that for most
666 does automatic splitting on newlines. This means that for most
663 uses, you'll never need to do capturing of output with %sc/%sx
667 uses, you'll never need to do capturing of output with %sc/%sx
664 anymore, since ipython keeps this always done for you. Note that
668 anymore, since ipython keeps this always done for you. Note that
665 only the LAST results are stored, the _o/e variables are
669 only the LAST results are stored, the _o/e variables are
666 overwritten on each call. If you need to save their contents
670 overwritten on each call. If you need to save their contents
667 further, simply bind them to any other name.
671 further, simply bind them to any other name.
668
672
669 2005-03-17 Fernando Perez <fperez@colorado.edu>
673 2005-03-17 Fernando Perez <fperez@colorado.edu>
670
674
671 * IPython/Prompts.py (BasePrompt.cwd_filt): a few more fixes for
675 * IPython/Prompts.py (BasePrompt.cwd_filt): a few more fixes for
672 prompt namespace handling.
676 prompt namespace handling.
673
677
674 2005-03-16 Fernando Perez <fperez@colorado.edu>
678 2005-03-16 Fernando Perez <fperez@colorado.edu>
675
679
676 * IPython/Prompts.py (CachedOutput.__init__): Fix default and
680 * IPython/Prompts.py (CachedOutput.__init__): Fix default and
677 classic prompts to be '>>> ' (final space was missing, and it
681 classic prompts to be '>>> ' (final space was missing, and it
678 trips the emacs python mode).
682 trips the emacs python mode).
679 (BasePrompt.__str__): Added safe support for dynamic prompt
683 (BasePrompt.__str__): Added safe support for dynamic prompt
680 strings. Now you can set your prompt string to be '$x', and the
684 strings. Now you can set your prompt string to be '$x', and the
681 value of x will be printed from your interactive namespace. The
685 value of x will be printed from your interactive namespace. The
682 interpolation syntax includes the full Itpl support, so
686 interpolation syntax includes the full Itpl support, so
683 ${foo()+x+bar()} is a valid prompt string now, and the function
687 ${foo()+x+bar()} is a valid prompt string now, and the function
684 calls will be made at runtime.
688 calls will be made at runtime.
685
689
686 2005-03-15 Fernando Perez <fperez@colorado.edu>
690 2005-03-15 Fernando Perez <fperez@colorado.edu>
687
691
688 * IPython/Magic.py (magic_history): renamed %hist to %history, to
692 * IPython/Magic.py (magic_history): renamed %hist to %history, to
689 avoid name clashes in pylab. %hist still works, it just forwards
693 avoid name clashes in pylab. %hist still works, it just forwards
690 the call to %history.
694 the call to %history.
691
695
692 2005-03-02 *** Released version 0.6.12
696 2005-03-02 *** Released version 0.6.12
693
697
694 2005-03-02 Fernando Perez <fperez@colorado.edu>
698 2005-03-02 Fernando Perez <fperez@colorado.edu>
695
699
696 * IPython/iplib.py (handle_magic): log magic calls properly as
700 * IPython/iplib.py (handle_magic): log magic calls properly as
697 ipmagic() function calls.
701 ipmagic() function calls.
698
702
699 * IPython/Magic.py (magic_time): Improved %time to support
703 * IPython/Magic.py (magic_time): Improved %time to support
700 statements and provide wall-clock as well as CPU time.
704 statements and provide wall-clock as well as CPU time.
701
705
702 2005-02-27 Fernando Perez <fperez@colorado.edu>
706 2005-02-27 Fernando Perez <fperez@colorado.edu>
703
707
704 * IPython/hooks.py: New hooks module, to expose user-modifiable
708 * IPython/hooks.py: New hooks module, to expose user-modifiable
705 IPython functionality in a clean manner. For now only the editor
709 IPython functionality in a clean manner. For now only the editor
706 hook is actually written, and other thigns which I intend to turn
710 hook is actually written, and other thigns which I intend to turn
707 into proper hooks aren't yet there. The display and prefilter
711 into proper hooks aren't yet there. The display and prefilter
708 stuff, for example, should be hooks. But at least now the
712 stuff, for example, should be hooks. But at least now the
709 framework is in place, and the rest can be moved here with more
713 framework is in place, and the rest can be moved here with more
710 time later. IPython had had a .hooks variable for a long time for
714 time later. IPython had had a .hooks variable for a long time for
711 this purpose, but I'd never actually used it for anything.
715 this purpose, but I'd never actually used it for anything.
712
716
713 2005-02-26 Fernando Perez <fperez@colorado.edu>
717 2005-02-26 Fernando Perez <fperez@colorado.edu>
714
718
715 * IPython/ipmaker.py (make_IPython): make the default ipython
719 * IPython/ipmaker.py (make_IPython): make the default ipython
716 directory be called _ipython under win32, to follow more the
720 directory be called _ipython under win32, to follow more the
717 naming peculiarities of that platform (where buggy software like
721 naming peculiarities of that platform (where buggy software like
718 Visual Sourcesafe breaks with .named directories). Reported by
722 Visual Sourcesafe breaks with .named directories). Reported by
719 Ville Vainio.
723 Ville Vainio.
720
724
721 2005-02-23 Fernando Perez <fperez@colorado.edu>
725 2005-02-23 Fernando Perez <fperez@colorado.edu>
722
726
723 * IPython/iplib.py (InteractiveShell.__init__): removed a few
727 * IPython/iplib.py (InteractiveShell.__init__): removed a few
724 auto_aliases for win32 which were causing problems. Users can
728 auto_aliases for win32 which were causing problems. Users can
725 define the ones they personally like.
729 define the ones they personally like.
726
730
727 2005-02-21 Fernando Perez <fperez@colorado.edu>
731 2005-02-21 Fernando Perez <fperez@colorado.edu>
728
732
729 * IPython/Magic.py (magic_time): new magic to time execution of
733 * IPython/Magic.py (magic_time): new magic to time execution of
730 expressions. After a request by Charles Moad <cmoad-AT-indiana.edu>.
734 expressions. After a request by Charles Moad <cmoad-AT-indiana.edu>.
731
735
732 2005-02-19 Fernando Perez <fperez@colorado.edu>
736 2005-02-19 Fernando Perez <fperez@colorado.edu>
733
737
734 * IPython/ConfigLoader.py (ConfigLoader.load): Allow empty strings
738 * IPython/ConfigLoader.py (ConfigLoader.load): Allow empty strings
735 into keys (for prompts, for example).
739 into keys (for prompts, for example).
736
740
737 * IPython/Prompts.py (BasePrompt.set_p_str): Fix to allow empty
741 * IPython/Prompts.py (BasePrompt.set_p_str): Fix to allow empty
738 prompts in case users want them. This introduces a small behavior
742 prompts in case users want them. This introduces a small behavior
739 change: ipython does not automatically add a space to all prompts
743 change: ipython does not automatically add a space to all prompts
740 anymore. To get the old prompts with a space, users should add it
744 anymore. To get the old prompts with a space, users should add it
741 manually to their ipythonrc file, so for example prompt_in1 should
745 manually to their ipythonrc file, so for example prompt_in1 should
742 now read 'In [\#]: ' instead of 'In [\#]:'.
746 now read 'In [\#]: ' instead of 'In [\#]:'.
743 (BasePrompt.__init__): New option prompts_pad_left (only in rc
747 (BasePrompt.__init__): New option prompts_pad_left (only in rc
744 file) to control left-padding of secondary prompts.
748 file) to control left-padding of secondary prompts.
745
749
746 * IPython/Magic.py (Magic.profile_missing_notice): Don't crash if
750 * IPython/Magic.py (Magic.profile_missing_notice): Don't crash if
747 the profiler can't be imported. Fix for Debian, which removed
751 the profiler can't be imported. Fix for Debian, which removed
748 profile.py because of License issues. I applied a slightly
752 profile.py because of License issues. I applied a slightly
749 modified version of the original Debian patch at
753 modified version of the original Debian patch at
750 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=294500.
754 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=294500.
751
755
752 2005-02-17 Fernando Perez <fperez@colorado.edu>
756 2005-02-17 Fernando Perez <fperez@colorado.edu>
753
757
754 * IPython/genutils.py (native_line_ends): Fix bug which would
758 * IPython/genutils.py (native_line_ends): Fix bug which would
755 cause improper line-ends under win32 b/c I was not opening files
759 cause improper line-ends under win32 b/c I was not opening files
756 in binary mode. Bug report and fix thanks to Ville.
760 in binary mode. Bug report and fix thanks to Ville.
757
761
758 * IPython/iplib.py (handle_auto): Fix bug which I introduced when
762 * IPython/iplib.py (handle_auto): Fix bug which I introduced when
759 trying to catch spurious foo[1] autocalls. My fix actually broke
763 trying to catch spurious foo[1] autocalls. My fix actually broke
760 ',/' autoquote/call with explicit escape (bad regexp).
764 ',/' autoquote/call with explicit escape (bad regexp).
761
765
762 2005-02-15 *** Released version 0.6.11
766 2005-02-15 *** Released version 0.6.11
763
767
764 2005-02-14 Fernando Perez <fperez@colorado.edu>
768 2005-02-14 Fernando Perez <fperez@colorado.edu>
765
769
766 * IPython/background_jobs.py: New background job management
770 * IPython/background_jobs.py: New background job management
767 subsystem. This is implemented via a new set of classes, and
771 subsystem. This is implemented via a new set of classes, and
768 IPython now provides a builtin 'jobs' object for background job
772 IPython now provides a builtin 'jobs' object for background job
769 execution. A convenience %bg magic serves as a lightweight
773 execution. A convenience %bg magic serves as a lightweight
770 frontend for starting the more common type of calls. This was
774 frontend for starting the more common type of calls. This was
771 inspired by discussions with B. Granger and the BackgroundCommand
775 inspired by discussions with B. Granger and the BackgroundCommand
772 class described in the book Python Scripting for Computational
776 class described in the book Python Scripting for Computational
773 Science, by H. P. Langtangen: http://folk.uio.no/hpl/scripting
777 Science, by H. P. Langtangen: http://folk.uio.no/hpl/scripting
774 (although ultimately no code from this text was used, as IPython's
778 (although ultimately no code from this text was used, as IPython's
775 system is a separate implementation).
779 system is a separate implementation).
776
780
777 * IPython/iplib.py (MagicCompleter.python_matches): add new option
781 * IPython/iplib.py (MagicCompleter.python_matches): add new option
778 to control the completion of single/double underscore names
782 to control the completion of single/double underscore names
779 separately. As documented in the example ipytonrc file, the
783 separately. As documented in the example ipytonrc file, the
780 readline_omit__names variable can now be set to 2, to omit even
784 readline_omit__names variable can now be set to 2, to omit even
781 single underscore names. Thanks to a patch by Brian Wong
785 single underscore names. Thanks to a patch by Brian Wong
782 <BrianWong-AT-AirgoNetworks.Com>.
786 <BrianWong-AT-AirgoNetworks.Com>.
783 (InteractiveShell.__init__): Fix bug which would cause foo[1] to
787 (InteractiveShell.__init__): Fix bug which would cause foo[1] to
784 be autocalled as foo([1]) if foo were callable. A problem for
788 be autocalled as foo([1]) if foo were callable. A problem for
785 things which are both callable and implement __getitem__.
789 things which are both callable and implement __getitem__.
786 (init_readline): Fix autoindentation for win32. Thanks to a patch
790 (init_readline): Fix autoindentation for win32. Thanks to a patch
787 by Vivian De Smedt <vivian-AT-vdesmedt.com>.
791 by Vivian De Smedt <vivian-AT-vdesmedt.com>.
788
792
789 2005-02-12 Fernando Perez <fperez@colorado.edu>
793 2005-02-12 Fernando Perez <fperez@colorado.edu>
790
794
791 * IPython/ipmaker.py (make_IPython): Disabled the stout traps
795 * IPython/ipmaker.py (make_IPython): Disabled the stout traps
792 which I had written long ago to sort out user error messages which
796 which I had written long ago to sort out user error messages which
793 may occur during startup. This seemed like a good idea initially,
797 may occur during startup. This seemed like a good idea initially,
794 but it has proven a disaster in retrospect. I don't want to
798 but it has proven a disaster in retrospect. I don't want to
795 change much code for now, so my fix is to set the internal 'debug'
799 change much code for now, so my fix is to set the internal 'debug'
796 flag to true everywhere, whose only job was precisely to control
800 flag to true everywhere, whose only job was precisely to control
797 this subsystem. This closes issue 28 (as well as avoiding all
801 this subsystem. This closes issue 28 (as well as avoiding all
798 sorts of strange hangups which occur from time to time).
802 sorts of strange hangups which occur from time to time).
799
803
800 2005-02-07 Fernando Perez <fperez@colorado.edu>
804 2005-02-07 Fernando Perez <fperez@colorado.edu>
801
805
802 * IPython/Magic.py (magic_edit): Fix 'ed -p' not working when the
806 * IPython/Magic.py (magic_edit): Fix 'ed -p' not working when the
803 previous call produced a syntax error.
807 previous call produced a syntax error.
804
808
805 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
809 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
806 classes without constructor.
810 classes without constructor.
807
811
808 2005-02-06 Fernando Perez <fperez@colorado.edu>
812 2005-02-06 Fernando Perez <fperez@colorado.edu>
809
813
810 * IPython/iplib.py (MagicCompleter.complete): Extend the list of
814 * IPython/iplib.py (MagicCompleter.complete): Extend the list of
811 completions with the results of each matcher, so we return results
815 completions with the results of each matcher, so we return results
812 to the user from all namespaces. This breaks with ipython
816 to the user from all namespaces. This breaks with ipython
813 tradition, but I think it's a nicer behavior. Now you get all
817 tradition, but I think it's a nicer behavior. Now you get all
814 possible completions listed, from all possible namespaces (python,
818 possible completions listed, from all possible namespaces (python,
815 filesystem, magics...) After a request by John Hunter
819 filesystem, magics...) After a request by John Hunter
816 <jdhunter-AT-nitace.bsd.uchicago.edu>.
820 <jdhunter-AT-nitace.bsd.uchicago.edu>.
817
821
818 2005-02-05 Fernando Perez <fperez@colorado.edu>
822 2005-02-05 Fernando Perez <fperez@colorado.edu>
819
823
820 * IPython/Magic.py (magic_prun): Fix bug where prun would fail if
824 * IPython/Magic.py (magic_prun): Fix bug where prun would fail if
821 the call had quote characters in it (the quotes were stripped).
825 the call had quote characters in it (the quotes were stripped).
822
826
823 2005-01-31 Fernando Perez <fperez@colorado.edu>
827 2005-01-31 Fernando Perez <fperez@colorado.edu>
824
828
825 * IPython/iplib.py (InteractiveShell.__init__): reduce reliance on
829 * IPython/iplib.py (InteractiveShell.__init__): reduce reliance on
826 Itpl.itpl() to make the code more robust against psyco
830 Itpl.itpl() to make the code more robust against psyco
827 optimizations.
831 optimizations.
828
832
829 * IPython/Itpl.py (Itpl.__str__): Use a _getframe() call instead
833 * IPython/Itpl.py (Itpl.__str__): Use a _getframe() call instead
830 of causing an exception. Quicker, cleaner.
834 of causing an exception. Quicker, cleaner.
831
835
832 2005-01-28 Fernando Perez <fperez@colorado.edu>
836 2005-01-28 Fernando Perez <fperez@colorado.edu>
833
837
834 * scripts/ipython_win_post_install.py (install): hardcode
838 * scripts/ipython_win_post_install.py (install): hardcode
835 sys.prefix+'python.exe' as the executable path. It turns out that
839 sys.prefix+'python.exe' as the executable path. It turns out that
836 during the post-installation run, sys.executable resolves to the
840 during the post-installation run, sys.executable resolves to the
837 name of the binary installer! I should report this as a distutils
841 name of the binary installer! I should report this as a distutils
838 bug, I think. I updated the .10 release with this tiny fix, to
842 bug, I think. I updated the .10 release with this tiny fix, to
839 avoid annoying the lists further.
843 avoid annoying the lists further.
840
844
841 2005-01-27 *** Released version 0.6.10
845 2005-01-27 *** Released version 0.6.10
842
846
843 2005-01-27 Fernando Perez <fperez@colorado.edu>
847 2005-01-27 Fernando Perez <fperez@colorado.edu>
844
848
845 * IPython/numutils.py (norm): Added 'inf' as optional name for
849 * IPython/numutils.py (norm): Added 'inf' as optional name for
846 L-infinity norm, included references to mathworld.com for vector
850 L-infinity norm, included references to mathworld.com for vector
847 norm definitions.
851 norm definitions.
848 (amin/amax): added amin/amax for array min/max. Similar to what
852 (amin/amax): added amin/amax for array min/max. Similar to what
849 pylab ships with after the recent reorganization of names.
853 pylab ships with after the recent reorganization of names.
850 (spike/spike_odd): removed deprecated spike/spike_odd functions.
854 (spike/spike_odd): removed deprecated spike/spike_odd functions.
851
855
852 * ipython.el: committed Alex's recent fixes and improvements.
856 * ipython.el: committed Alex's recent fixes and improvements.
853 Tested with python-mode from CVS, and it looks excellent. Since
857 Tested with python-mode from CVS, and it looks excellent. Since
854 python-mode hasn't released anything in a while, I'm temporarily
858 python-mode hasn't released anything in a while, I'm temporarily
855 putting a copy of today's CVS (v 4.70) of python-mode in:
859 putting a copy of today's CVS (v 4.70) of python-mode in:
856 http://ipython.scipy.org/tmp/python-mode.el
860 http://ipython.scipy.org/tmp/python-mode.el
857
861
858 * scripts/ipython_win_post_install.py (install): Win32 fix to use
862 * scripts/ipython_win_post_install.py (install): Win32 fix to use
859 sys.executable for the executable name, instead of assuming it's
863 sys.executable for the executable name, instead of assuming it's
860 called 'python.exe' (the post-installer would have produced broken
864 called 'python.exe' (the post-installer would have produced broken
861 setups on systems with a differently named python binary).
865 setups on systems with a differently named python binary).
862
866
863 * IPython/PyColorize.py (Parser.__call__): change explicit '\n'
867 * IPython/PyColorize.py (Parser.__call__): change explicit '\n'
864 references to os.linesep, to make the code more
868 references to os.linesep, to make the code more
865 platform-independent. This is also part of the win32 coloring
869 platform-independent. This is also part of the win32 coloring
866 fixes.
870 fixes.
867
871
868 * IPython/genutils.py (page_dumb): Remove attempts to chop long
872 * IPython/genutils.py (page_dumb): Remove attempts to chop long
869 lines, which actually cause coloring bugs because the length of
873 lines, which actually cause coloring bugs because the length of
870 the line is very difficult to correctly compute with embedded
874 the line is very difficult to correctly compute with embedded
871 escapes. This was the source of all the coloring problems under
875 escapes. This was the source of all the coloring problems under
872 Win32. I think that _finally_, Win32 users have a properly
876 Win32. I think that _finally_, Win32 users have a properly
873 working ipython in all respects. This would never have happened
877 working ipython in all respects. This would never have happened
874 if not for Gary Bishop and Viktor Ransmayr's great help and work.
878 if not for Gary Bishop and Viktor Ransmayr's great help and work.
875
879
876 2005-01-26 *** Released version 0.6.9
880 2005-01-26 *** Released version 0.6.9
877
881
878 2005-01-25 Fernando Perez <fperez@colorado.edu>
882 2005-01-25 Fernando Perez <fperez@colorado.edu>
879
883
880 * setup.py: finally, we have a true Windows installer, thanks to
884 * setup.py: finally, we have a true Windows installer, thanks to
881 the excellent work of Viktor Ransmayr
885 the excellent work of Viktor Ransmayr
882 <viktor.ransmayr-AT-t-online.de>. The docs have been updated for
886 <viktor.ransmayr-AT-t-online.de>. The docs have been updated for
883 Windows users. The setup routine is quite a bit cleaner thanks to
887 Windows users. The setup routine is quite a bit cleaner thanks to
884 this, and the post-install script uses the proper functions to
888 this, and the post-install script uses the proper functions to
885 allow a clean de-installation using the standard Windows Control
889 allow a clean de-installation using the standard Windows Control
886 Panel.
890 Panel.
887
891
888 * IPython/genutils.py (get_home_dir): changed to use the $HOME
892 * IPython/genutils.py (get_home_dir): changed to use the $HOME
889 environment variable under all OSes (including win32) if
893 environment variable under all OSes (including win32) if
890 available. This will give consistency to win32 users who have set
894 available. This will give consistency to win32 users who have set
891 this variable for any reason. If os.environ['HOME'] fails, the
895 this variable for any reason. If os.environ['HOME'] fails, the
892 previous policy of using HOMEDRIVE\HOMEPATH kicks in.
896 previous policy of using HOMEDRIVE\HOMEPATH kicks in.
893
897
894 2005-01-24 Fernando Perez <fperez@colorado.edu>
898 2005-01-24 Fernando Perez <fperez@colorado.edu>
895
899
896 * IPython/numutils.py (empty_like): add empty_like(), similar to
900 * IPython/numutils.py (empty_like): add empty_like(), similar to
897 zeros_like() but taking advantage of the new empty() Numeric routine.
901 zeros_like() but taking advantage of the new empty() Numeric routine.
898
902
899 2005-01-23 *** Released version 0.6.8
903 2005-01-23 *** Released version 0.6.8
900
904
901 2005-01-22 Fernando Perez <fperez@colorado.edu>
905 2005-01-22 Fernando Perez <fperez@colorado.edu>
902
906
903 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): I removed the
907 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): I removed the
904 automatic show() calls. After discussing things with JDH, it
908 automatic show() calls. After discussing things with JDH, it
905 turns out there are too many corner cases where this can go wrong.
909 turns out there are too many corner cases where this can go wrong.
906 It's best not to try to be 'too smart', and simply have ipython
910 It's best not to try to be 'too smart', and simply have ipython
907 reproduce as much as possible the default behavior of a normal
911 reproduce as much as possible the default behavior of a normal
908 python shell.
912 python shell.
909
913
910 * IPython/iplib.py (InteractiveShell.__init__): Modified the
914 * IPython/iplib.py (InteractiveShell.__init__): Modified the
911 line-splitting regexp and _prefilter() to avoid calling getattr()
915 line-splitting regexp and _prefilter() to avoid calling getattr()
912 on assignments. This closes
916 on assignments. This closes
913 http://www.scipy.net/roundup/ipython/issue24. Note that Python's
917 http://www.scipy.net/roundup/ipython/issue24. Note that Python's
914 readline uses getattr(), so a simple <TAB> keypress is still
918 readline uses getattr(), so a simple <TAB> keypress is still
915 enough to trigger getattr() calls on an object.
919 enough to trigger getattr() calls on an object.
916
920
917 2005-01-21 Fernando Perez <fperez@colorado.edu>
921 2005-01-21 Fernando Perez <fperez@colorado.edu>
918
922
919 * IPython/Shell.py (MatplotlibShellBase.magic_run): Fix the %run
923 * IPython/Shell.py (MatplotlibShellBase.magic_run): Fix the %run
920 docstring under pylab so it doesn't mask the original.
924 docstring under pylab so it doesn't mask the original.
921
925
922 2005-01-21 *** Released version 0.6.7
926 2005-01-21 *** Released version 0.6.7
923
927
924 2005-01-21 Fernando Perez <fperez@colorado.edu>
928 2005-01-21 Fernando Perez <fperez@colorado.edu>
925
929
926 * IPython/Shell.py (MTInteractiveShell.runcode): Trap a crash with
930 * IPython/Shell.py (MTInteractiveShell.runcode): Trap a crash with
927 signal handling for win32 users in multithreaded mode.
931 signal handling for win32 users in multithreaded mode.
928
932
929 2005-01-17 Fernando Perez <fperez@colorado.edu>
933 2005-01-17 Fernando Perez <fperez@colorado.edu>
930
934
931 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
935 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
932 instances with no __init__. After a crash report by Norbert Nemec
936 instances with no __init__. After a crash report by Norbert Nemec
933 <Norbert-AT-nemec-online.de>.
937 <Norbert-AT-nemec-online.de>.
934
938
935 2005-01-14 Fernando Perez <fperez@colorado.edu>
939 2005-01-14 Fernando Perez <fperez@colorado.edu>
936
940
937 * IPython/ultraTB.py (VerboseTB.text): Fix bug in reporting of
941 * IPython/ultraTB.py (VerboseTB.text): Fix bug in reporting of
938 names for verbose exceptions, when multiple dotted names and the
942 names for verbose exceptions, when multiple dotted names and the
939 'parent' object were present on the same line.
943 'parent' object were present on the same line.
940
944
941 2005-01-11 Fernando Perez <fperez@colorado.edu>
945 2005-01-11 Fernando Perez <fperez@colorado.edu>
942
946
943 * IPython/genutils.py (flag_calls): new utility to trap and flag
947 * IPython/genutils.py (flag_calls): new utility to trap and flag
944 calls in functions. I need it to clean up matplotlib support.
948 calls in functions. I need it to clean up matplotlib support.
945 Also removed some deprecated code in genutils.
949 Also removed some deprecated code in genutils.
946
950
947 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): small fix so
951 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): small fix so
948 that matplotlib scripts called with %run, which don't call show()
952 that matplotlib scripts called with %run, which don't call show()
949 themselves, still have their plotting windows open.
953 themselves, still have their plotting windows open.
950
954
951 2005-01-05 Fernando Perez <fperez@colorado.edu>
955 2005-01-05 Fernando Perez <fperez@colorado.edu>
952
956
953 * IPython/Shell.py (IPShellGTK.__init__): Patch by Andrew Straw
957 * IPython/Shell.py (IPShellGTK.__init__): Patch by Andrew Straw
954 <astraw-AT-caltech.edu>, to fix gtk deprecation warnings.
958 <astraw-AT-caltech.edu>, to fix gtk deprecation warnings.
955
959
956 2004-12-19 Fernando Perez <fperez@colorado.edu>
960 2004-12-19 Fernando Perez <fperez@colorado.edu>
957
961
958 * IPython/Shell.py (MTInteractiveShell.runcode): Get rid of
962 * IPython/Shell.py (MTInteractiveShell.runcode): Get rid of
959 parent_runcode, which was an eyesore. The same result can be
963 parent_runcode, which was an eyesore. The same result can be
960 obtained with Python's regular superclass mechanisms.
964 obtained with Python's regular superclass mechanisms.
961
965
962 2004-12-17 Fernando Perez <fperez@colorado.edu>
966 2004-12-17 Fernando Perez <fperez@colorado.edu>
963
967
964 * IPython/Magic.py (Magic.magic_sc): Fix quote stripping problem
968 * IPython/Magic.py (Magic.magic_sc): Fix quote stripping problem
965 reported by Prabhu.
969 reported by Prabhu.
966 (Magic.magic_sx): direct all errors to Term.cerr (defaults to
970 (Magic.magic_sx): direct all errors to Term.cerr (defaults to
967 sys.stderr) instead of explicitly calling sys.stderr. This helps
971 sys.stderr) instead of explicitly calling sys.stderr. This helps
968 maintain our I/O abstractions clean, for future GUI embeddings.
972 maintain our I/O abstractions clean, for future GUI embeddings.
969
973
970 * IPython/genutils.py (info): added new utility for sys.stderr
974 * IPython/genutils.py (info): added new utility for sys.stderr
971 unified info message handling (thin wrapper around warn()).
975 unified info message handling (thin wrapper around warn()).
972
976
973 * IPython/ultraTB.py (VerboseTB.text): Fix misreported global
977 * IPython/ultraTB.py (VerboseTB.text): Fix misreported global
974 composite (dotted) names on verbose exceptions.
978 composite (dotted) names on verbose exceptions.
975 (VerboseTB.nullrepr): harden against another kind of errors which
979 (VerboseTB.nullrepr): harden against another kind of errors which
976 Python's inspect module can trigger, and which were crashing
980 Python's inspect module can trigger, and which were crashing
977 IPython. Thanks to a report by Marco Lombardi
981 IPython. Thanks to a report by Marco Lombardi
978 <mlombard-AT-ma010192.hq.eso.org>.
982 <mlombard-AT-ma010192.hq.eso.org>.
979
983
980 2004-12-13 *** Released version 0.6.6
984 2004-12-13 *** Released version 0.6.6
981
985
982 2004-12-12 Fernando Perez <fperez@colorado.edu>
986 2004-12-12 Fernando Perez <fperez@colorado.edu>
983
987
984 * IPython/Shell.py (IPShellGTK.mainloop): catch RuntimeErrors
988 * IPython/Shell.py (IPShellGTK.mainloop): catch RuntimeErrors
985 generated by pygtk upon initialization if it was built without
989 generated by pygtk upon initialization if it was built without
986 threads (for matplotlib users). After a crash reported by
990 threads (for matplotlib users). After a crash reported by
987 Leguijt, Jaap J SIEP-EPT-RES <Jaap.Leguijt-AT-shell.com>.
991 Leguijt, Jaap J SIEP-EPT-RES <Jaap.Leguijt-AT-shell.com>.
988
992
989 * IPython/ipmaker.py (make_IPython): fix small bug in the
993 * IPython/ipmaker.py (make_IPython): fix small bug in the
990 import_some parameter for multiple imports.
994 import_some parameter for multiple imports.
991
995
992 * IPython/iplib.py (ipmagic): simplified the interface of
996 * IPython/iplib.py (ipmagic): simplified the interface of
993 ipmagic() to take a single string argument, just as it would be
997 ipmagic() to take a single string argument, just as it would be
994 typed at the IPython cmd line.
998 typed at the IPython cmd line.
995 (ipalias): Added new ipalias() with an interface identical to
999 (ipalias): Added new ipalias() with an interface identical to
996 ipmagic(). This completes exposing a pure python interface to the
1000 ipmagic(). This completes exposing a pure python interface to the
997 alias and magic system, which can be used in loops or more complex
1001 alias and magic system, which can be used in loops or more complex
998 code where IPython's automatic line mangling is not active.
1002 code where IPython's automatic line mangling is not active.
999
1003
1000 * IPython/genutils.py (timing): changed interface of timing to
1004 * IPython/genutils.py (timing): changed interface of timing to
1001 simply run code once, which is the most common case. timings()
1005 simply run code once, which is the most common case. timings()
1002 remains unchanged, for the cases where you want multiple runs.
1006 remains unchanged, for the cases where you want multiple runs.
1003
1007
1004 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix a
1008 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix a
1005 bug where Python2.2 crashes with exec'ing code which does not end
1009 bug where Python2.2 crashes with exec'ing code which does not end
1006 in a single newline. Python 2.3 is OK, so I hadn't noticed this
1010 in a single newline. Python 2.3 is OK, so I hadn't noticed this
1007 before.
1011 before.
1008
1012
1009 2004-12-10 Fernando Perez <fperez@colorado.edu>
1013 2004-12-10 Fernando Perez <fperez@colorado.edu>
1010
1014
1011 * IPython/Magic.py (Magic.magic_prun): changed name of option from
1015 * IPython/Magic.py (Magic.magic_prun): changed name of option from
1012 -t to -T, to accomodate the new -t flag in %run (the %run and
1016 -t to -T, to accomodate the new -t flag in %run (the %run and
1013 %prun options are kind of intermixed, and it's not easy to change
1017 %prun options are kind of intermixed, and it's not easy to change
1014 this with the limitations of python's getopt).
1018 this with the limitations of python's getopt).
1015
1019
1016 * IPython/Magic.py (Magic.magic_run): Added new -t option to time
1020 * IPython/Magic.py (Magic.magic_run): Added new -t option to time
1017 the execution of scripts. It's not as fine-tuned as timeit.py,
1021 the execution of scripts. It's not as fine-tuned as timeit.py,
1018 but it works from inside ipython (and under 2.2, which lacks
1022 but it works from inside ipython (and under 2.2, which lacks
1019 timeit.py). Optionally a number of runs > 1 can be given for
1023 timeit.py). Optionally a number of runs > 1 can be given for
1020 timing very short-running code.
1024 timing very short-running code.
1021
1025
1022 * IPython/genutils.py (uniq_stable): new routine which returns a
1026 * IPython/genutils.py (uniq_stable): new routine which returns a
1023 list of unique elements in any iterable, but in stable order of
1027 list of unique elements in any iterable, but in stable order of
1024 appearance. I needed this for the ultraTB fixes, and it's a handy
1028 appearance. I needed this for the ultraTB fixes, and it's a handy
1025 utility.
1029 utility.
1026
1030
1027 * IPython/ultraTB.py (VerboseTB.text): Fix proper reporting of
1031 * IPython/ultraTB.py (VerboseTB.text): Fix proper reporting of
1028 dotted names in Verbose exceptions. This had been broken since
1032 dotted names in Verbose exceptions. This had been broken since
1029 the very start, now x.y will properly be printed in a Verbose
1033 the very start, now x.y will properly be printed in a Verbose
1030 traceback, instead of x being shown and y appearing always as an
1034 traceback, instead of x being shown and y appearing always as an
1031 'undefined global'. Getting this to work was a bit tricky,
1035 'undefined global'. Getting this to work was a bit tricky,
1032 because by default python tokenizers are stateless. Saved by
1036 because by default python tokenizers are stateless. Saved by
1033 python's ability to easily add a bit of state to an arbitrary
1037 python's ability to easily add a bit of state to an arbitrary
1034 function (without needing to build a full-blown callable object).
1038 function (without needing to build a full-blown callable object).
1035
1039
1036 Also big cleanup of this code, which had horrendous runtime
1040 Also big cleanup of this code, which had horrendous runtime
1037 lookups of zillions of attributes for colorization. Moved all
1041 lookups of zillions of attributes for colorization. Moved all
1038 this code into a few templates, which make it cleaner and quicker.
1042 this code into a few templates, which make it cleaner and quicker.
1039
1043
1040 Printout quality was also improved for Verbose exceptions: one
1044 Printout quality was also improved for Verbose exceptions: one
1041 variable per line, and memory addresses are printed (this can be
1045 variable per line, and memory addresses are printed (this can be
1042 quite handy in nasty debugging situations, which is what Verbose
1046 quite handy in nasty debugging situations, which is what Verbose
1043 is for).
1047 is for).
1044
1048
1045 * IPython/ipmaker.py (make_IPython): Do NOT execute files named in
1049 * IPython/ipmaker.py (make_IPython): Do NOT execute files named in
1046 the command line as scripts to be loaded by embedded instances.
1050 the command line as scripts to be loaded by embedded instances.
1047 Doing so has the potential for an infinite recursion if there are
1051 Doing so has the potential for an infinite recursion if there are
1048 exceptions thrown in the process. This fixes a strange crash
1052 exceptions thrown in the process. This fixes a strange crash
1049 reported by Philippe MULLER <muller-AT-irit.fr>.
1053 reported by Philippe MULLER <muller-AT-irit.fr>.
1050
1054
1051 2004-12-09 Fernando Perez <fperez@colorado.edu>
1055 2004-12-09 Fernando Perez <fperez@colorado.edu>
1052
1056
1053 * IPython/Shell.py (MatplotlibShellBase.use): Change pylab support
1057 * IPython/Shell.py (MatplotlibShellBase.use): Change pylab support
1054 to reflect new names in matplotlib, which now expose the
1058 to reflect new names in matplotlib, which now expose the
1055 matlab-compatible interface via a pylab module instead of the
1059 matlab-compatible interface via a pylab module instead of the
1056 'matlab' name. The new code is backwards compatible, so users of
1060 'matlab' name. The new code is backwards compatible, so users of
1057 all matplotlib versions are OK. Patch by J. Hunter.
1061 all matplotlib versions are OK. Patch by J. Hunter.
1058
1062
1059 * IPython/OInspect.py (Inspector.pinfo): Add to object? printing
1063 * IPython/OInspect.py (Inspector.pinfo): Add to object? printing
1060 of __init__ docstrings for instances (class docstrings are already
1064 of __init__ docstrings for instances (class docstrings are already
1061 automatically printed). Instances with customized docstrings
1065 automatically printed). Instances with customized docstrings
1062 (indep. of the class) are also recognized and all 3 separate
1066 (indep. of the class) are also recognized and all 3 separate
1063 docstrings are printed (instance, class, constructor). After some
1067 docstrings are printed (instance, class, constructor). After some
1064 comments/suggestions by J. Hunter.
1068 comments/suggestions by J. Hunter.
1065
1069
1066 2004-12-05 Fernando Perez <fperez@colorado.edu>
1070 2004-12-05 Fernando Perez <fperez@colorado.edu>
1067
1071
1068 * IPython/iplib.py (MagicCompleter.complete): Remove annoying
1072 * IPython/iplib.py (MagicCompleter.complete): Remove annoying
1069 warnings when tab-completion fails and triggers an exception.
1073 warnings when tab-completion fails and triggers an exception.
1070
1074
1071 2004-12-03 Fernando Perez <fperez@colorado.edu>
1075 2004-12-03 Fernando Perez <fperez@colorado.edu>
1072
1076
1073 * IPython/Magic.py (magic_prun): Fix bug where an exception would
1077 * IPython/Magic.py (magic_prun): Fix bug where an exception would
1074 be triggered when using 'run -p'. An incorrect option flag was
1078 be triggered when using 'run -p'. An incorrect option flag was
1075 being set ('d' instead of 'D').
1079 being set ('d' instead of 'D').
1076 (manpage): fix missing escaped \- sign.
1080 (manpage): fix missing escaped \- sign.
1077
1081
1078 2004-11-30 *** Released version 0.6.5
1082 2004-11-30 *** Released version 0.6.5
1079
1083
1080 2004-11-30 Fernando Perez <fperez@colorado.edu>
1084 2004-11-30 Fernando Perez <fperez@colorado.edu>
1081
1085
1082 * IPython/Magic.py (Magic.magic_run): Fix bug in breakpoint
1086 * IPython/Magic.py (Magic.magic_run): Fix bug in breakpoint
1083 setting with -d option.
1087 setting with -d option.
1084
1088
1085 * setup.py (docfiles): Fix problem where the doc glob I was using
1089 * setup.py (docfiles): Fix problem where the doc glob I was using
1086 was COMPLETELY BROKEN. It was giving the right files by pure
1090 was COMPLETELY BROKEN. It was giving the right files by pure
1087 accident, but failed once I tried to include ipython.el. Note:
1091 accident, but failed once I tried to include ipython.el. Note:
1088 glob() does NOT allow you to do exclusion on multiple endings!
1092 glob() does NOT allow you to do exclusion on multiple endings!
1089
1093
1090 2004-11-29 Fernando Perez <fperez@colorado.edu>
1094 2004-11-29 Fernando Perez <fperez@colorado.edu>
1091
1095
1092 * IPython/usage.py (__doc__): cleaned up usage docstring, by using
1096 * IPython/usage.py (__doc__): cleaned up usage docstring, by using
1093 the manpage as the source. Better formatting & consistency.
1097 the manpage as the source. Better formatting & consistency.
1094
1098
1095 * IPython/Magic.py (magic_run): Added new -d option, to run
1099 * IPython/Magic.py (magic_run): Added new -d option, to run
1096 scripts under the control of the python pdb debugger. Note that
1100 scripts under the control of the python pdb debugger. Note that
1097 this required changing the %prun option -d to -D, to avoid a clash
1101 this required changing the %prun option -d to -D, to avoid a clash
1098 (since %run must pass options to %prun, and getopt is too dumb to
1102 (since %run must pass options to %prun, and getopt is too dumb to
1099 handle options with string values with embedded spaces). Thanks
1103 handle options with string values with embedded spaces). Thanks
1100 to a suggestion by Matthew Arnison <maffew-AT-cat.org.au>.
1104 to a suggestion by Matthew Arnison <maffew-AT-cat.org.au>.
1101 (magic_who_ls): added type matching to %who and %whos, so that one
1105 (magic_who_ls): added type matching to %who and %whos, so that one
1102 can filter their output to only include variables of certain
1106 can filter their output to only include variables of certain
1103 types. Another suggestion by Matthew.
1107 types. Another suggestion by Matthew.
1104 (magic_whos): Added memory summaries in kb and Mb for arrays.
1108 (magic_whos): Added memory summaries in kb and Mb for arrays.
1105 (magic_who): Improve formatting (break lines every 9 vars).
1109 (magic_who): Improve formatting (break lines every 9 vars).
1106
1110
1107 2004-11-28 Fernando Perez <fperez@colorado.edu>
1111 2004-11-28 Fernando Perez <fperez@colorado.edu>
1108
1112
1109 * IPython/Logger.py (Logger.log): Fix bug in syncing the input
1113 * IPython/Logger.py (Logger.log): Fix bug in syncing the input
1110 cache when empty lines were present.
1114 cache when empty lines were present.
1111
1115
1112 2004-11-24 Fernando Perez <fperez@colorado.edu>
1116 2004-11-24 Fernando Perez <fperez@colorado.edu>
1113
1117
1114 * IPython/usage.py (__doc__): document the re-activated threading
1118 * IPython/usage.py (__doc__): document the re-activated threading
1115 options for WX and GTK.
1119 options for WX and GTK.
1116
1120
1117 2004-11-23 Fernando Perez <fperez@colorado.edu>
1121 2004-11-23 Fernando Perez <fperez@colorado.edu>
1118
1122
1119 * IPython/Shell.py (start): Added Prabhu's big patch to reactivate
1123 * IPython/Shell.py (start): Added Prabhu's big patch to reactivate
1120 the -wthread and -gthread options, along with a new -tk one to try
1124 the -wthread and -gthread options, along with a new -tk one to try
1121 and coordinate Tk threading with wx/gtk. The tk support is very
1125 and coordinate Tk threading with wx/gtk. The tk support is very
1122 platform dependent, since it seems to require Tcl and Tk to be
1126 platform dependent, since it seems to require Tcl and Tk to be
1123 built with threads (Fedora1/2 appears NOT to have it, but in
1127 built with threads (Fedora1/2 appears NOT to have it, but in
1124 Prabhu's Debian boxes it works OK). But even with some Tk
1128 Prabhu's Debian boxes it works OK). But even with some Tk
1125 limitations, this is a great improvement.
1129 limitations, this is a great improvement.
1126
1130
1127 * IPython/Prompts.py (prompt_specials_color): Added \t for time
1131 * IPython/Prompts.py (prompt_specials_color): Added \t for time
1128 info in user prompts. Patch by Prabhu.
1132 info in user prompts. Patch by Prabhu.
1129
1133
1130 2004-11-18 Fernando Perez <fperez@colorado.edu>
1134 2004-11-18 Fernando Perez <fperez@colorado.edu>
1131
1135
1132 * IPython/genutils.py (ask_yes_no): Add check for a max of 20
1136 * IPython/genutils.py (ask_yes_no): Add check for a max of 20
1133 EOFErrors and bail, to avoid infinite loops if a non-terminating
1137 EOFErrors and bail, to avoid infinite loops if a non-terminating
1134 file is fed into ipython. Patch submitted in issue 19 by user,
1138 file is fed into ipython. Patch submitted in issue 19 by user,
1135 many thanks.
1139 many thanks.
1136
1140
1137 * IPython/iplib.py (InteractiveShell.handle_auto): do NOT trigger
1141 * IPython/iplib.py (InteractiveShell.handle_auto): do NOT trigger
1138 autoquote/parens in continuation prompts, which can cause lots of
1142 autoquote/parens in continuation prompts, which can cause lots of
1139 problems. Closes roundup issue 20.
1143 problems. Closes roundup issue 20.
1140
1144
1141 2004-11-17 Fernando Perez <fperez@colorado.edu>
1145 2004-11-17 Fernando Perez <fperez@colorado.edu>
1142
1146
1143 * debian/control (Build-Depends-Indep): Fix dpatch dependency,
1147 * debian/control (Build-Depends-Indep): Fix dpatch dependency,
1144 reported as debian bug #280505. I'm not sure my local changelog
1148 reported as debian bug #280505. I'm not sure my local changelog
1145 entry has the proper debian format (Jack?).
1149 entry has the proper debian format (Jack?).
1146
1150
1147 2004-11-08 *** Released version 0.6.4
1151 2004-11-08 *** Released version 0.6.4
1148
1152
1149 2004-11-08 Fernando Perez <fperez@colorado.edu>
1153 2004-11-08 Fernando Perez <fperez@colorado.edu>
1150
1154
1151 * IPython/iplib.py (init_readline): Fix exit message for Windows
1155 * IPython/iplib.py (init_readline): Fix exit message for Windows
1152 when readline is active. Thanks to a report by Eric Jones
1156 when readline is active. Thanks to a report by Eric Jones
1153 <eric-AT-enthought.com>.
1157 <eric-AT-enthought.com>.
1154
1158
1155 2004-11-07 Fernando Perez <fperez@colorado.edu>
1159 2004-11-07 Fernando Perez <fperez@colorado.edu>
1156
1160
1157 * IPython/genutils.py (page): Add a trap for OSError exceptions,
1161 * IPython/genutils.py (page): Add a trap for OSError exceptions,
1158 sometimes seen by win2k/cygwin users.
1162 sometimes seen by win2k/cygwin users.
1159
1163
1160 2004-11-06 Fernando Perez <fperez@colorado.edu>
1164 2004-11-06 Fernando Perez <fperez@colorado.edu>
1161
1165
1162 * IPython/iplib.py (interact): Change the handling of %Exit from
1166 * IPython/iplib.py (interact): Change the handling of %Exit from
1163 trying to propagate a SystemExit to an internal ipython flag.
1167 trying to propagate a SystemExit to an internal ipython flag.
1164 This is less elegant than using Python's exception mechanism, but
1168 This is less elegant than using Python's exception mechanism, but
1165 I can't get that to work reliably with threads, so under -pylab
1169 I can't get that to work reliably with threads, so under -pylab
1166 %Exit was hanging IPython. Cross-thread exception handling is
1170 %Exit was hanging IPython. Cross-thread exception handling is
1167 really a bitch. Thaks to a bug report by Stephen Walton
1171 really a bitch. Thaks to a bug report by Stephen Walton
1168 <stephen.walton-AT-csun.edu>.
1172 <stephen.walton-AT-csun.edu>.
1169
1173
1170 2004-11-04 Fernando Perez <fperez@colorado.edu>
1174 2004-11-04 Fernando Perez <fperez@colorado.edu>
1171
1175
1172 * IPython/iplib.py (raw_input_original): store a pointer to the
1176 * IPython/iplib.py (raw_input_original): store a pointer to the
1173 true raw_input to harden against code which can modify it
1177 true raw_input to harden against code which can modify it
1174 (wx.py.PyShell does this and would otherwise crash ipython).
1178 (wx.py.PyShell does this and would otherwise crash ipython).
1175 Thanks to a bug report by Jim Flowers <james.flowers-AT-lgx.com>.
1179 Thanks to a bug report by Jim Flowers <james.flowers-AT-lgx.com>.
1176
1180
1177 * IPython/Shell.py (MTInteractiveShell.runsource): Cleaner fix for
1181 * IPython/Shell.py (MTInteractiveShell.runsource): Cleaner fix for
1178 Ctrl-C problem, which does not mess up the input line.
1182 Ctrl-C problem, which does not mess up the input line.
1179
1183
1180 2004-11-03 Fernando Perez <fperez@colorado.edu>
1184 2004-11-03 Fernando Perez <fperez@colorado.edu>
1181
1185
1182 * IPython/Release.py: Changed licensing to BSD, in all files.
1186 * IPython/Release.py: Changed licensing to BSD, in all files.
1183 (name): lowercase name for tarball/RPM release.
1187 (name): lowercase name for tarball/RPM release.
1184
1188
1185 * IPython/OInspect.py (getdoc): wrap inspect.getdoc() safely for
1189 * IPython/OInspect.py (getdoc): wrap inspect.getdoc() safely for
1186 use throughout ipython.
1190 use throughout ipython.
1187
1191
1188 * IPython/Magic.py (Magic._ofind): Switch to using the new
1192 * IPython/Magic.py (Magic._ofind): Switch to using the new
1189 OInspect.getdoc() function.
1193 OInspect.getdoc() function.
1190
1194
1191 * IPython/Shell.py (sigint_handler): Hack to ignore the execution
1195 * IPython/Shell.py (sigint_handler): Hack to ignore the execution
1192 of the line currently being canceled via Ctrl-C. It's extremely
1196 of the line currently being canceled via Ctrl-C. It's extremely
1193 ugly, but I don't know how to do it better (the problem is one of
1197 ugly, but I don't know how to do it better (the problem is one of
1194 handling cross-thread exceptions).
1198 handling cross-thread exceptions).
1195
1199
1196 2004-10-28 Fernando Perez <fperez@colorado.edu>
1200 2004-10-28 Fernando Perez <fperez@colorado.edu>
1197
1201
1198 * IPython/Shell.py (signal_handler): add signal handlers to trap
1202 * IPython/Shell.py (signal_handler): add signal handlers to trap
1199 SIGINT and SIGSEGV in threaded code properly. Thanks to a bug
1203 SIGINT and SIGSEGV in threaded code properly. Thanks to a bug
1200 report by Francesc Alted.
1204 report by Francesc Alted.
1201
1205
1202 2004-10-21 Fernando Perez <fperez@colorado.edu>
1206 2004-10-21 Fernando Perez <fperez@colorado.edu>
1203
1207
1204 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Fix @
1208 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Fix @
1205 to % for pysh syntax extensions.
1209 to % for pysh syntax extensions.
1206
1210
1207 2004-10-09 Fernando Perez <fperez@colorado.edu>
1211 2004-10-09 Fernando Perez <fperez@colorado.edu>
1208
1212
1209 * IPython/Magic.py (Magic.magic_whos): modify output of Numeric
1213 * IPython/Magic.py (Magic.magic_whos): modify output of Numeric
1210 arrays to print a more useful summary, without calling str(arr).
1214 arrays to print a more useful summary, without calling str(arr).
1211 This avoids the problem of extremely lengthy computations which
1215 This avoids the problem of extremely lengthy computations which
1212 occur if arr is large, and appear to the user as a system lockup
1216 occur if arr is large, and appear to the user as a system lockup
1213 with 100% cpu activity. After a suggestion by Kristian Sandberg
1217 with 100% cpu activity. After a suggestion by Kristian Sandberg
1214 <Kristian.Sandberg@colorado.edu>.
1218 <Kristian.Sandberg@colorado.edu>.
1215 (Magic.__init__): fix bug in global magic escapes not being
1219 (Magic.__init__): fix bug in global magic escapes not being
1216 correctly set.
1220 correctly set.
1217
1221
1218 2004-10-08 Fernando Perez <fperez@colorado.edu>
1222 2004-10-08 Fernando Perez <fperez@colorado.edu>
1219
1223
1220 * IPython/Magic.py (__license__): change to absolute imports of
1224 * IPython/Magic.py (__license__): change to absolute imports of
1221 ipython's own internal packages, to start adapting to the absolute
1225 ipython's own internal packages, to start adapting to the absolute
1222 import requirement of PEP-328.
1226 import requirement of PEP-328.
1223
1227
1224 * IPython/genutils.py (__author__): Fix coding to utf-8 on all
1228 * IPython/genutils.py (__author__): Fix coding to utf-8 on all
1225 files, and standardize author/license marks through the Release
1229 files, and standardize author/license marks through the Release
1226 module instead of having per/file stuff (except for files with
1230 module instead of having per/file stuff (except for files with
1227 particular licenses, like the MIT/PSF-licensed codes).
1231 particular licenses, like the MIT/PSF-licensed codes).
1228
1232
1229 * IPython/Debugger.py: remove dead code for python 2.1
1233 * IPython/Debugger.py: remove dead code for python 2.1
1230
1234
1231 2004-10-04 Fernando Perez <fperez@colorado.edu>
1235 2004-10-04 Fernando Perez <fperez@colorado.edu>
1232
1236
1233 * IPython/iplib.py (ipmagic): New function for accessing magics
1237 * IPython/iplib.py (ipmagic): New function for accessing magics
1234 via a normal python function call.
1238 via a normal python function call.
1235
1239
1236 * IPython/Magic.py (Magic.magic_magic): Change the magic escape
1240 * IPython/Magic.py (Magic.magic_magic): Change the magic escape
1237 from '@' to '%', to accomodate the new @decorator syntax of python
1241 from '@' to '%', to accomodate the new @decorator syntax of python
1238 2.4.
1242 2.4.
1239
1243
1240 2004-09-29 Fernando Perez <fperez@colorado.edu>
1244 2004-09-29 Fernando Perez <fperez@colorado.edu>
1241
1245
1242 * IPython/Shell.py (MatplotlibShellBase.use): Added a wrapper to
1246 * IPython/Shell.py (MatplotlibShellBase.use): Added a wrapper to
1243 matplotlib.use to prevent running scripts which try to switch
1247 matplotlib.use to prevent running scripts which try to switch
1244 interactive backends from within ipython. This will just crash
1248 interactive backends from within ipython. This will just crash
1245 the python interpreter, so we can't allow it (but a detailed error
1249 the python interpreter, so we can't allow it (but a detailed error
1246 is given to the user).
1250 is given to the user).
1247
1251
1248 2004-09-28 Fernando Perez <fperez@colorado.edu>
1252 2004-09-28 Fernando Perez <fperez@colorado.edu>
1249
1253
1250 * IPython/Shell.py (MatplotlibShellBase.mplot_exec):
1254 * IPython/Shell.py (MatplotlibShellBase.mplot_exec):
1251 matplotlib-related fixes so that using @run with non-matplotlib
1255 matplotlib-related fixes so that using @run with non-matplotlib
1252 scripts doesn't pop up spurious plot windows. This requires
1256 scripts doesn't pop up spurious plot windows. This requires
1253 matplotlib >= 0.63, where I had to make some changes as well.
1257 matplotlib >= 0.63, where I had to make some changes as well.
1254
1258
1255 * IPython/ipmaker.py (make_IPython): update version requirement to
1259 * IPython/ipmaker.py (make_IPython): update version requirement to
1256 python 2.2.
1260 python 2.2.
1257
1261
1258 * IPython/iplib.py (InteractiveShell.mainloop): Add an optional
1262 * IPython/iplib.py (InteractiveShell.mainloop): Add an optional
1259 banner arg for embedded customization.
1263 banner arg for embedded customization.
1260
1264
1261 * IPython/Magic.py (Magic.__init__): big cleanup to remove all
1265 * IPython/Magic.py (Magic.__init__): big cleanup to remove all
1262 explicit uses of __IP as the IPython's instance name. Now things
1266 explicit uses of __IP as the IPython's instance name. Now things
1263 are properly handled via the shell.name value. The actual code
1267 are properly handled via the shell.name value. The actual code
1264 is a bit ugly b/c I'm doing it via a global in Magic.py, but this
1268 is a bit ugly b/c I'm doing it via a global in Magic.py, but this
1265 is much better than before. I'll clean things completely when the
1269 is much better than before. I'll clean things completely when the
1266 magic stuff gets a real overhaul.
1270 magic stuff gets a real overhaul.
1267
1271
1268 * ipython.1: small fixes, sent in by Jack Moffit. He also sent in
1272 * ipython.1: small fixes, sent in by Jack Moffit. He also sent in
1269 minor changes to debian dir.
1273 minor changes to debian dir.
1270
1274
1271 * IPython/iplib.py (InteractiveShell.__init__): Fix adding a
1275 * IPython/iplib.py (InteractiveShell.__init__): Fix adding a
1272 pointer to the shell itself in the interactive namespace even when
1276 pointer to the shell itself in the interactive namespace even when
1273 a user-supplied dict is provided. This is needed for embedding
1277 a user-supplied dict is provided. This is needed for embedding
1274 purposes (found by tests with Michel Sanner).
1278 purposes (found by tests with Michel Sanner).
1275
1279
1276 2004-09-27 Fernando Perez <fperez@colorado.edu>
1280 2004-09-27 Fernando Perez <fperez@colorado.edu>
1277
1281
1278 * IPython/UserConfig/ipythonrc: remove []{} from
1282 * IPython/UserConfig/ipythonrc: remove []{} from
1279 readline_remove_delims, so that things like [modname.<TAB> do
1283 readline_remove_delims, so that things like [modname.<TAB> do
1280 proper completion. This disables [].TAB, but that's a less common
1284 proper completion. This disables [].TAB, but that's a less common
1281 case than module names in list comprehensions, for example.
1285 case than module names in list comprehensions, for example.
1282 Thanks to a report by Andrea Riciputi.
1286 Thanks to a report by Andrea Riciputi.
1283
1287
1284 2004-09-09 Fernando Perez <fperez@colorado.edu>
1288 2004-09-09 Fernando Perez <fperez@colorado.edu>
1285
1289
1286 * IPython/Shell.py (IPShellGTK.mainloop): reorder to avoid
1290 * IPython/Shell.py (IPShellGTK.mainloop): reorder to avoid
1287 blocking problems in win32 and osx. Fix by John.
1291 blocking problems in win32 and osx. Fix by John.
1288
1292
1289 2004-09-08 Fernando Perez <fperez@colorado.edu>
1293 2004-09-08 Fernando Perez <fperez@colorado.edu>
1290
1294
1291 * IPython/Shell.py (IPShellWX.OnInit): Fix output redirection bug
1295 * IPython/Shell.py (IPShellWX.OnInit): Fix output redirection bug
1292 for Win32 and OSX. Fix by John Hunter.
1296 for Win32 and OSX. Fix by John Hunter.
1293
1297
1294 2004-08-30 *** Released version 0.6.3
1298 2004-08-30 *** Released version 0.6.3
1295
1299
1296 2004-08-30 Fernando Perez <fperez@colorado.edu>
1300 2004-08-30 Fernando Perez <fperez@colorado.edu>
1297
1301
1298 * setup.py (isfile): Add manpages to list of dependent files to be
1302 * setup.py (isfile): Add manpages to list of dependent files to be
1299 updated.
1303 updated.
1300
1304
1301 2004-08-27 Fernando Perez <fperez@colorado.edu>
1305 2004-08-27 Fernando Perez <fperez@colorado.edu>
1302
1306
1303 * IPython/Shell.py (start): I've disabled -wthread and -gthread
1307 * IPython/Shell.py (start): I've disabled -wthread and -gthread
1304 for now. They don't really work with standalone WX/GTK code
1308 for now. They don't really work with standalone WX/GTK code
1305 (though matplotlib IS working fine with both of those backends).
1309 (though matplotlib IS working fine with both of those backends).
1306 This will neeed much more testing. I disabled most things with
1310 This will neeed much more testing. I disabled most things with
1307 comments, so turning it back on later should be pretty easy.
1311 comments, so turning it back on later should be pretty easy.
1308
1312
1309 * IPython/iplib.py (InteractiveShell.__init__): Fix accidental
1313 * IPython/iplib.py (InteractiveShell.__init__): Fix accidental
1310 autocalling of expressions like r'foo', by modifying the line
1314 autocalling of expressions like r'foo', by modifying the line
1311 split regexp. Closes
1315 split regexp. Closes
1312 http://www.scipy.net/roundup/ipython/issue18, reported by Nicholas
1316 http://www.scipy.net/roundup/ipython/issue18, reported by Nicholas
1313 Riley <ipythonbugs-AT-sabi.net>.
1317 Riley <ipythonbugs-AT-sabi.net>.
1314 (InteractiveShell.mainloop): honor --nobanner with banner
1318 (InteractiveShell.mainloop): honor --nobanner with banner
1315 extensions.
1319 extensions.
1316
1320
1317 * IPython/Shell.py: Significant refactoring of all classes, so
1321 * IPython/Shell.py: Significant refactoring of all classes, so
1318 that we can really support ALL matplotlib backends and threading
1322 that we can really support ALL matplotlib backends and threading
1319 models (John spotted a bug with Tk which required this). Now we
1323 models (John spotted a bug with Tk which required this). Now we
1320 should support single-threaded, WX-threads and GTK-threads, both
1324 should support single-threaded, WX-threads and GTK-threads, both
1321 for generic code and for matplotlib.
1325 for generic code and for matplotlib.
1322
1326
1323 * IPython/ipmaker.py (__call__): Changed -mpthread option to
1327 * IPython/ipmaker.py (__call__): Changed -mpthread option to
1324 -pylab, to simplify things for users. Will also remove the pylab
1328 -pylab, to simplify things for users. Will also remove the pylab
1325 profile, since now all of matplotlib configuration is directly
1329 profile, since now all of matplotlib configuration is directly
1326 handled here. This also reduces startup time.
1330 handled here. This also reduces startup time.
1327
1331
1328 * IPython/Shell.py (IPShellGTK.run): Fixed bug where mainloop() of
1332 * IPython/Shell.py (IPShellGTK.run): Fixed bug where mainloop() of
1329 shell wasn't being correctly called. Also in IPShellWX.
1333 shell wasn't being correctly called. Also in IPShellWX.
1330
1334
1331 * IPython/iplib.py (InteractiveShell.__init__): Added option to
1335 * IPython/iplib.py (InteractiveShell.__init__): Added option to
1332 fine-tune banner.
1336 fine-tune banner.
1333
1337
1334 * IPython/numutils.py (spike): Deprecate these spike functions,
1338 * IPython/numutils.py (spike): Deprecate these spike functions,
1335 delete (long deprecated) gnuplot_exec handler.
1339 delete (long deprecated) gnuplot_exec handler.
1336
1340
1337 2004-08-26 Fernando Perez <fperez@colorado.edu>
1341 2004-08-26 Fernando Perez <fperez@colorado.edu>
1338
1342
1339 * ipython.1: Update for threading options, plus some others which
1343 * ipython.1: Update for threading options, plus some others which
1340 were missing.
1344 were missing.
1341
1345
1342 * IPython/ipmaker.py (__call__): Added -wthread option for
1346 * IPython/ipmaker.py (__call__): Added -wthread option for
1343 wxpython thread handling. Make sure threading options are only
1347 wxpython thread handling. Make sure threading options are only
1344 valid at the command line.
1348 valid at the command line.
1345
1349
1346 * scripts/ipython: moved shell selection into a factory function
1350 * scripts/ipython: moved shell selection into a factory function
1347 in Shell.py, to keep the starter script to a minimum.
1351 in Shell.py, to keep the starter script to a minimum.
1348
1352
1349 2004-08-25 Fernando Perez <fperez@colorado.edu>
1353 2004-08-25 Fernando Perez <fperez@colorado.edu>
1350
1354
1351 * IPython/Shell.py (IPShellWX.wxexit): fixes to WX threading, by
1355 * IPython/Shell.py (IPShellWX.wxexit): fixes to WX threading, by
1352 John. Along with some recent changes he made to matplotlib, the
1356 John. Along with some recent changes he made to matplotlib, the
1353 next versions of both systems should work very well together.
1357 next versions of both systems should work very well together.
1354
1358
1355 2004-08-24 Fernando Perez <fperez@colorado.edu>
1359 2004-08-24 Fernando Perez <fperez@colorado.edu>
1356
1360
1357 * IPython/Magic.py (Magic.magic_prun): cleanup some dead code. I
1361 * IPython/Magic.py (Magic.magic_prun): cleanup some dead code. I
1358 tried to switch the profiling to using hotshot, but I'm getting
1362 tried to switch the profiling to using hotshot, but I'm getting
1359 strange errors from prof.runctx() there. I may be misreading the
1363 strange errors from prof.runctx() there. I may be misreading the
1360 docs, but it looks weird. For now the profiling code will
1364 docs, but it looks weird. For now the profiling code will
1361 continue to use the standard profiler.
1365 continue to use the standard profiler.
1362
1366
1363 2004-08-23 Fernando Perez <fperez@colorado.edu>
1367 2004-08-23 Fernando Perez <fperez@colorado.edu>
1364
1368
1365 * IPython/Shell.py (IPShellWX.__init__): Improvements to the WX
1369 * IPython/Shell.py (IPShellWX.__init__): Improvements to the WX
1366 threaded shell, by John Hunter. It's not quite ready yet, but
1370 threaded shell, by John Hunter. It's not quite ready yet, but
1367 close.
1371 close.
1368
1372
1369 2004-08-22 Fernando Perez <fperez@colorado.edu>
1373 2004-08-22 Fernando Perez <fperez@colorado.edu>
1370
1374
1371 * IPython/iplib.py (InteractiveShell.interact): tab cleanups, also
1375 * IPython/iplib.py (InteractiveShell.interact): tab cleanups, also
1372 in Magic and ultraTB.
1376 in Magic and ultraTB.
1373
1377
1374 * ipython.1: document threading options in manpage.
1378 * ipython.1: document threading options in manpage.
1375
1379
1376 * scripts/ipython: Changed name of -thread option to -gthread,
1380 * scripts/ipython: Changed name of -thread option to -gthread,
1377 since this is GTK specific. I want to leave the door open for a
1381 since this is GTK specific. I want to leave the door open for a
1378 -wthread option for WX, which will most likely be necessary. This
1382 -wthread option for WX, which will most likely be necessary. This
1379 change affects usage and ipmaker as well.
1383 change affects usage and ipmaker as well.
1380
1384
1381 * IPython/Shell.py (matplotlib_shell): Add a factory function to
1385 * IPython/Shell.py (matplotlib_shell): Add a factory function to
1382 handle the matplotlib shell issues. Code by John Hunter
1386 handle the matplotlib shell issues. Code by John Hunter
1383 <jdhunter-AT-nitace.bsd.uchicago.edu>.
1387 <jdhunter-AT-nitace.bsd.uchicago.edu>.
1384 (IPShellMatplotlibWX.__init__): Rudimentary WX support. It's
1388 (IPShellMatplotlibWX.__init__): Rudimentary WX support. It's
1385 broken (and disabled for end users) for now, but it puts the
1389 broken (and disabled for end users) for now, but it puts the
1386 infrastructure in place.
1390 infrastructure in place.
1387
1391
1388 2004-08-21 Fernando Perez <fperez@colorado.edu>
1392 2004-08-21 Fernando Perez <fperez@colorado.edu>
1389
1393
1390 * ipythonrc-pylab: Add matplotlib support.
1394 * ipythonrc-pylab: Add matplotlib support.
1391
1395
1392 * matplotlib_config.py: new files for matplotlib support, part of
1396 * matplotlib_config.py: new files for matplotlib support, part of
1393 the pylab profile.
1397 the pylab profile.
1394
1398
1395 * IPython/usage.py (__doc__): documented the threading options.
1399 * IPython/usage.py (__doc__): documented the threading options.
1396
1400
1397 2004-08-20 Fernando Perez <fperez@colorado.edu>
1401 2004-08-20 Fernando Perez <fperez@colorado.edu>
1398
1402
1399 * ipython: Modified the main calling routine to handle the -thread
1403 * ipython: Modified the main calling routine to handle the -thread
1400 and -mpthread options. This needs to be done as a top-level hack,
1404 and -mpthread options. This needs to be done as a top-level hack,
1401 because it determines which class to instantiate for IPython
1405 because it determines which class to instantiate for IPython
1402 itself.
1406 itself.
1403
1407
1404 * IPython/Shell.py (MTInteractiveShell.__init__): New set of
1408 * IPython/Shell.py (MTInteractiveShell.__init__): New set of
1405 classes to support multithreaded GTK operation without blocking,
1409 classes to support multithreaded GTK operation without blocking,
1406 and matplotlib with all backends. This is a lot of still very
1410 and matplotlib with all backends. This is a lot of still very
1407 experimental code, and threads are tricky. So it may still have a
1411 experimental code, and threads are tricky. So it may still have a
1408 few rough edges... This code owes a lot to
1412 few rough edges... This code owes a lot to
1409 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65109, by
1413 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65109, by
1410 Brian # McErlean and John Finlay, to Antoon Pardon for fixes, and
1414 Brian # McErlean and John Finlay, to Antoon Pardon for fixes, and
1411 to John Hunter for all the matplotlib work.
1415 to John Hunter for all the matplotlib work.
1412
1416
1413 * IPython/ipmaker.py (__call__): Added -thread and -mpthread
1417 * IPython/ipmaker.py (__call__): Added -thread and -mpthread
1414 options for gtk thread and matplotlib support.
1418 options for gtk thread and matplotlib support.
1415
1419
1416 2004-08-16 Fernando Perez <fperez@colorado.edu>
1420 2004-08-16 Fernando Perez <fperez@colorado.edu>
1417
1421
1418 * IPython/iplib.py (InteractiveShell.__init__): don't trigger
1422 * IPython/iplib.py (InteractiveShell.__init__): don't trigger
1419 autocall for things like p*q,p/q,p+q,p-q, when p is callable. Bug
1423 autocall for things like p*q,p/q,p+q,p-q, when p is callable. Bug
1420 reported by Stephen Walton <stephen.walton-AT-csun.edu>.
1424 reported by Stephen Walton <stephen.walton-AT-csun.edu>.
1421
1425
1422 2004-08-11 Fernando Perez <fperez@colorado.edu>
1426 2004-08-11 Fernando Perez <fperez@colorado.edu>
1423
1427
1424 * setup.py (isfile): Fix build so documentation gets updated for
1428 * setup.py (isfile): Fix build so documentation gets updated for
1425 rpms (it was only done for .tgz builds).
1429 rpms (it was only done for .tgz builds).
1426
1430
1427 2004-08-10 Fernando Perez <fperez@colorado.edu>
1431 2004-08-10 Fernando Perez <fperez@colorado.edu>
1428
1432
1429 * genutils.py (Term): Fix misspell of stdin stream (sin->cin).
1433 * genutils.py (Term): Fix misspell of stdin stream (sin->cin).
1430
1434
1431 * iplib.py : Silence syntax error exceptions in tab-completion.
1435 * iplib.py : Silence syntax error exceptions in tab-completion.
1432
1436
1433 2004-08-05 Fernando Perez <fperez@colorado.edu>
1437 2004-08-05 Fernando Perez <fperez@colorado.edu>
1434
1438
1435 * IPython/Prompts.py (Prompt2.set_colors): Fix incorrectly set
1439 * IPython/Prompts.py (Prompt2.set_colors): Fix incorrectly set
1436 'color off' mark for continuation prompts. This was causing long
1440 'color off' mark for continuation prompts. This was causing long
1437 continuation lines to mis-wrap.
1441 continuation lines to mis-wrap.
1438
1442
1439 2004-08-01 Fernando Perez <fperez@colorado.edu>
1443 2004-08-01 Fernando Perez <fperez@colorado.edu>
1440
1444
1441 * IPython/ipmaker.py (make_IPython): Allow the shell class used
1445 * IPython/ipmaker.py (make_IPython): Allow the shell class used
1442 for building ipython to be a parameter. All this is necessary
1446 for building ipython to be a parameter. All this is necessary
1443 right now to have a multithreaded version, but this insane
1447 right now to have a multithreaded version, but this insane
1444 non-design will be cleaned up soon. For now, it's a hack that
1448 non-design will be cleaned up soon. For now, it's a hack that
1445 works.
1449 works.
1446
1450
1447 * IPython/Shell.py (IPShell.__init__): Stop using mutable default
1451 * IPython/Shell.py (IPShell.__init__): Stop using mutable default
1448 args in various places. No bugs so far, but it's a dangerous
1452 args in various places. No bugs so far, but it's a dangerous
1449 practice.
1453 practice.
1450
1454
1451 2004-07-31 Fernando Perez <fperez@colorado.edu>
1455 2004-07-31 Fernando Perez <fperez@colorado.edu>
1452
1456
1453 * IPython/iplib.py (complete): ignore SyntaxError exceptions to
1457 * IPython/iplib.py (complete): ignore SyntaxError exceptions to
1454 fix completion of files with dots in their names under most
1458 fix completion of files with dots in their names under most
1455 profiles (pysh was OK because the completion order is different).
1459 profiles (pysh was OK because the completion order is different).
1456
1460
1457 2004-07-27 Fernando Perez <fperez@colorado.edu>
1461 2004-07-27 Fernando Perez <fperez@colorado.edu>
1458
1462
1459 * IPython/iplib.py (InteractiveShell.__init__): build dict of
1463 * IPython/iplib.py (InteractiveShell.__init__): build dict of
1460 keywords manually, b/c the one in keyword.py was removed in python
1464 keywords manually, b/c the one in keyword.py was removed in python
1461 2.4. Patch by Anakim Border <aborder-AT-users.sourceforge.net>.
1465 2.4. Patch by Anakim Border <aborder-AT-users.sourceforge.net>.
1462 This is NOT a bug under python 2.3 and earlier.
1466 This is NOT a bug under python 2.3 and earlier.
1463
1467
1464 2004-07-26 Fernando Perez <fperez@colorado.edu>
1468 2004-07-26 Fernando Perez <fperez@colorado.edu>
1465
1469
1466 * IPython/ultraTB.py (VerboseTB.text): Add another
1470 * IPython/ultraTB.py (VerboseTB.text): Add another
1467 linecache.checkcache() call to try to prevent inspect.py from
1471 linecache.checkcache() call to try to prevent inspect.py from
1468 crashing under python 2.3. I think this fixes
1472 crashing under python 2.3. I think this fixes
1469 http://www.scipy.net/roundup/ipython/issue17.
1473 http://www.scipy.net/roundup/ipython/issue17.
1470
1474
1471 2004-07-26 *** Released version 0.6.2
1475 2004-07-26 *** Released version 0.6.2
1472
1476
1473 2004-07-26 Fernando Perez <fperez@colorado.edu>
1477 2004-07-26 Fernando Perez <fperez@colorado.edu>
1474
1478
1475 * IPython/Magic.py (Magic.magic_cd): Fix bug where 'cd -N' would
1479 * IPython/Magic.py (Magic.magic_cd): Fix bug where 'cd -N' would
1476 fail for any number.
1480 fail for any number.
1477 (Magic.magic_bookmark): Fix bug where 'bookmark -l' would fail for
1481 (Magic.magic_bookmark): Fix bug where 'bookmark -l' would fail for
1478 empty bookmarks.
1482 empty bookmarks.
1479
1483
1480 2004-07-26 *** Released version 0.6.1
1484 2004-07-26 *** Released version 0.6.1
1481
1485
1482 2004-07-26 Fernando Perez <fperez@colorado.edu>
1486 2004-07-26 Fernando Perez <fperez@colorado.edu>
1483
1487
1484 * ipython_win_post_install.py (run): Added pysh shortcut for Windows.
1488 * ipython_win_post_install.py (run): Added pysh shortcut for Windows.
1485
1489
1486 * IPython/iplib.py (protect_filename): Applied Ville's patch for
1490 * IPython/iplib.py (protect_filename): Applied Ville's patch for
1487 escaping '()[]{}' in filenames.
1491 escaping '()[]{}' in filenames.
1488
1492
1489 * IPython/Magic.py (shlex_split): Fix handling of '*' and '?' for
1493 * IPython/Magic.py (shlex_split): Fix handling of '*' and '?' for
1490 Python 2.2 users who lack a proper shlex.split.
1494 Python 2.2 users who lack a proper shlex.split.
1491
1495
1492 2004-07-19 Fernando Perez <fperez@colorado.edu>
1496 2004-07-19 Fernando Perez <fperez@colorado.edu>
1493
1497
1494 * IPython/iplib.py (InteractiveShell.init_readline): Add support
1498 * IPython/iplib.py (InteractiveShell.init_readline): Add support
1495 for reading readline's init file. I follow the normal chain:
1499 for reading readline's init file. I follow the normal chain:
1496 $INPUTRC is honored, otherwise ~/.inputrc is used. Thanks to a
1500 $INPUTRC is honored, otherwise ~/.inputrc is used. Thanks to a
1497 report by Mike Heeter. This closes
1501 report by Mike Heeter. This closes
1498 http://www.scipy.net/roundup/ipython/issue16.
1502 http://www.scipy.net/roundup/ipython/issue16.
1499
1503
1500 2004-07-18 Fernando Perez <fperez@colorado.edu>
1504 2004-07-18 Fernando Perez <fperez@colorado.edu>
1501
1505
1502 * IPython/iplib.py (__init__): Add better handling of '\' under
1506 * IPython/iplib.py (__init__): Add better handling of '\' under
1503 Win32 for filenames. After a patch by Ville.
1507 Win32 for filenames. After a patch by Ville.
1504
1508
1505 2004-07-17 Fernando Perez <fperez@colorado.edu>
1509 2004-07-17 Fernando Perez <fperez@colorado.edu>
1506
1510
1507 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
1511 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
1508 autocalling would be triggered for 'foo is bar' if foo is
1512 autocalling would be triggered for 'foo is bar' if foo is
1509 callable. I also cleaned up the autocall detection code to use a
1513 callable. I also cleaned up the autocall detection code to use a
1510 regexp, which is faster. Bug reported by Alexander Schmolck.
1514 regexp, which is faster. Bug reported by Alexander Schmolck.
1511
1515
1512 * IPython/Magic.py (Magic.magic_pinfo): Fix bug where strings with
1516 * IPython/Magic.py (Magic.magic_pinfo): Fix bug where strings with
1513 '?' in them would confuse the help system. Reported by Alex
1517 '?' in them would confuse the help system. Reported by Alex
1514 Schmolck.
1518 Schmolck.
1515
1519
1516 2004-07-16 Fernando Perez <fperez@colorado.edu>
1520 2004-07-16 Fernando Perez <fperez@colorado.edu>
1517
1521
1518 * IPython/GnuplotInteractive.py (__all__): added plot2.
1522 * IPython/GnuplotInteractive.py (__all__): added plot2.
1519
1523
1520 * IPython/Gnuplot2.py (Gnuplot.plot2): added new function for
1524 * IPython/Gnuplot2.py (Gnuplot.plot2): added new function for
1521 plotting dictionaries, lists or tuples of 1d arrays.
1525 plotting dictionaries, lists or tuples of 1d arrays.
1522
1526
1523 * IPython/Magic.py (Magic.magic_hist): small clenaups and
1527 * IPython/Magic.py (Magic.magic_hist): small clenaups and
1524 optimizations.
1528 optimizations.
1525
1529
1526 * IPython/iplib.py:Remove old Changelog info for cleanup. This is
1530 * IPython/iplib.py:Remove old Changelog info for cleanup. This is
1527 the information which was there from Janko's original IPP code:
1531 the information which was there from Janko's original IPP code:
1528
1532
1529 03.05.99 20:53 porto.ifm.uni-kiel.de
1533 03.05.99 20:53 porto.ifm.uni-kiel.de
1530 --Started changelog.
1534 --Started changelog.
1531 --make clear do what it say it does
1535 --make clear do what it say it does
1532 --added pretty output of lines from inputcache
1536 --added pretty output of lines from inputcache
1533 --Made Logger a mixin class, simplifies handling of switches
1537 --Made Logger a mixin class, simplifies handling of switches
1534 --Added own completer class. .string<TAB> expands to last history
1538 --Added own completer class. .string<TAB> expands to last history
1535 line which starts with string. The new expansion is also present
1539 line which starts with string. The new expansion is also present
1536 with Ctrl-r from the readline library. But this shows, who this
1540 with Ctrl-r from the readline library. But this shows, who this
1537 can be done for other cases.
1541 can be done for other cases.
1538 --Added convention that all shell functions should accept a
1542 --Added convention that all shell functions should accept a
1539 parameter_string This opens the door for different behaviour for
1543 parameter_string This opens the door for different behaviour for
1540 each function. @cd is a good example of this.
1544 each function. @cd is a good example of this.
1541
1545
1542 04.05.99 12:12 porto.ifm.uni-kiel.de
1546 04.05.99 12:12 porto.ifm.uni-kiel.de
1543 --added logfile rotation
1547 --added logfile rotation
1544 --added new mainloop method which freezes first the namespace
1548 --added new mainloop method which freezes first the namespace
1545
1549
1546 07.05.99 21:24 porto.ifm.uni-kiel.de
1550 07.05.99 21:24 porto.ifm.uni-kiel.de
1547 --added the docreader classes. Now there is a help system.
1551 --added the docreader classes. Now there is a help system.
1548 -This is only a first try. Currently it's not easy to put new
1552 -This is only a first try. Currently it's not easy to put new
1549 stuff in the indices. But this is the way to go. Info would be
1553 stuff in the indices. But this is the way to go. Info would be
1550 better, but HTML is every where and not everybody has an info
1554 better, but HTML is every where and not everybody has an info
1551 system installed and it's not so easy to change html-docs to info.
1555 system installed and it's not so easy to change html-docs to info.
1552 --added global logfile option
1556 --added global logfile option
1553 --there is now a hook for object inspection method pinfo needs to
1557 --there is now a hook for object inspection method pinfo needs to
1554 be provided for this. Can be reached by two '??'.
1558 be provided for this. Can be reached by two '??'.
1555
1559
1556 08.05.99 20:51 porto.ifm.uni-kiel.de
1560 08.05.99 20:51 porto.ifm.uni-kiel.de
1557 --added a README
1561 --added a README
1558 --bug in rc file. Something has changed so functions in the rc
1562 --bug in rc file. Something has changed so functions in the rc
1559 file need to reference the shell and not self. Not clear if it's a
1563 file need to reference the shell and not self. Not clear if it's a
1560 bug or feature.
1564 bug or feature.
1561 --changed rc file for new behavior
1565 --changed rc file for new behavior
1562
1566
1563 2004-07-15 Fernando Perez <fperez@colorado.edu>
1567 2004-07-15 Fernando Perez <fperez@colorado.edu>
1564
1568
1565 * IPython/Logger.py (Logger.log): fixed recent bug where the input
1569 * IPython/Logger.py (Logger.log): fixed recent bug where the input
1566 cache was falling out of sync in bizarre manners when multi-line
1570 cache was falling out of sync in bizarre manners when multi-line
1567 input was present. Minor optimizations and cleanup.
1571 input was present. Minor optimizations and cleanup.
1568
1572
1569 (Logger): Remove old Changelog info for cleanup. This is the
1573 (Logger): Remove old Changelog info for cleanup. This is the
1570 information which was there from Janko's original code:
1574 information which was there from Janko's original code:
1571
1575
1572 Changes to Logger: - made the default log filename a parameter
1576 Changes to Logger: - made the default log filename a parameter
1573
1577
1574 - put a check for lines beginning with !@? in log(). Needed
1578 - put a check for lines beginning with !@? in log(). Needed
1575 (even if the handlers properly log their lines) for mid-session
1579 (even if the handlers properly log their lines) for mid-session
1576 logging activation to work properly. Without this, lines logged
1580 logging activation to work properly. Without this, lines logged
1577 in mid session, which get read from the cache, would end up
1581 in mid session, which get read from the cache, would end up
1578 'bare' (with !@? in the open) in the log. Now they are caught
1582 'bare' (with !@? in the open) in the log. Now they are caught
1579 and prepended with a #.
1583 and prepended with a #.
1580
1584
1581 * IPython/iplib.py (InteractiveShell.init_readline): added check
1585 * IPython/iplib.py (InteractiveShell.init_readline): added check
1582 in case MagicCompleter fails to be defined, so we don't crash.
1586 in case MagicCompleter fails to be defined, so we don't crash.
1583
1587
1584 2004-07-13 Fernando Perez <fperez@colorado.edu>
1588 2004-07-13 Fernando Perez <fperez@colorado.edu>
1585
1589
1586 * IPython/Gnuplot2.py (Gnuplot.hardcopy): add automatic generation
1590 * IPython/Gnuplot2.py (Gnuplot.hardcopy): add automatic generation
1587 of EPS if the requested filename ends in '.eps'.
1591 of EPS if the requested filename ends in '.eps'.
1588
1592
1589 2004-07-04 Fernando Perez <fperez@colorado.edu>
1593 2004-07-04 Fernando Perez <fperez@colorado.edu>
1590
1594
1591 * IPython/iplib.py (InteractiveShell.handle_shell_escape): Fix
1595 * IPython/iplib.py (InteractiveShell.handle_shell_escape): Fix
1592 escaping of quotes when calling the shell.
1596 escaping of quotes when calling the shell.
1593
1597
1594 2004-07-02 Fernando Perez <fperez@colorado.edu>
1598 2004-07-02 Fernando Perez <fperez@colorado.edu>
1595
1599
1596 * IPython/Prompts.py (CachedOutput.update): Fix problem with
1600 * IPython/Prompts.py (CachedOutput.update): Fix problem with
1597 gettext not working because we were clobbering '_'. Fixes
1601 gettext not working because we were clobbering '_'. Fixes
1598 http://www.scipy.net/roundup/ipython/issue6.
1602 http://www.scipy.net/roundup/ipython/issue6.
1599
1603
1600 2004-07-01 Fernando Perez <fperez@colorado.edu>
1604 2004-07-01 Fernando Perez <fperez@colorado.edu>
1601
1605
1602 * IPython/Magic.py (Magic.magic_cd): integrated bookmark handling
1606 * IPython/Magic.py (Magic.magic_cd): integrated bookmark handling
1603 into @cd. Patch by Ville.
1607 into @cd. Patch by Ville.
1604
1608
1605 * IPython/iplib.py (InteractiveShell.post_config_initialization):
1609 * IPython/iplib.py (InteractiveShell.post_config_initialization):
1606 new function to store things after ipmaker runs. Patch by Ville.
1610 new function to store things after ipmaker runs. Patch by Ville.
1607 Eventually this will go away once ipmaker is removed and the class
1611 Eventually this will go away once ipmaker is removed and the class
1608 gets cleaned up, but for now it's ok. Key functionality here is
1612 gets cleaned up, but for now it's ok. Key functionality here is
1609 the addition of the persistent storage mechanism, a dict for
1613 the addition of the persistent storage mechanism, a dict for
1610 keeping data across sessions (for now just bookmarks, but more can
1614 keeping data across sessions (for now just bookmarks, but more can
1611 be implemented later).
1615 be implemented later).
1612
1616
1613 * IPython/Magic.py (Magic.magic_bookmark): New bookmark system,
1617 * IPython/Magic.py (Magic.magic_bookmark): New bookmark system,
1614 persistent across sections. Patch by Ville, I modified it
1618 persistent across sections. Patch by Ville, I modified it
1615 soemwhat to allow bookmarking arbitrary dirs other than CWD. Also
1619 soemwhat to allow bookmarking arbitrary dirs other than CWD. Also
1616 added a '-l' option to list all bookmarks.
1620 added a '-l' option to list all bookmarks.
1617
1621
1618 * IPython/iplib.py (InteractiveShell.atexit_operations): new
1622 * IPython/iplib.py (InteractiveShell.atexit_operations): new
1619 center for cleanup. Registered with atexit.register(). I moved
1623 center for cleanup. Registered with atexit.register(). I moved
1620 here the old exit_cleanup(). After a patch by Ville.
1624 here the old exit_cleanup(). After a patch by Ville.
1621
1625
1622 * IPython/Magic.py (get_py_filename): added '~' to the accepted
1626 * IPython/Magic.py (get_py_filename): added '~' to the accepted
1623 characters in the hacked shlex_split for python 2.2.
1627 characters in the hacked shlex_split for python 2.2.
1624
1628
1625 * IPython/iplib.py (file_matches): more fixes to filenames with
1629 * IPython/iplib.py (file_matches): more fixes to filenames with
1626 whitespace in them. It's not perfect, but limitations in python's
1630 whitespace in them. It's not perfect, but limitations in python's
1627 readline make it impossible to go further.
1631 readline make it impossible to go further.
1628
1632
1629 2004-06-29 Fernando Perez <fperez@colorado.edu>
1633 2004-06-29 Fernando Perez <fperez@colorado.edu>
1630
1634
1631 * IPython/iplib.py (file_matches): escape whitespace correctly in
1635 * IPython/iplib.py (file_matches): escape whitespace correctly in
1632 filename completions. Bug reported by Ville.
1636 filename completions. Bug reported by Ville.
1633
1637
1634 2004-06-28 Fernando Perez <fperez@colorado.edu>
1638 2004-06-28 Fernando Perez <fperez@colorado.edu>
1635
1639
1636 * IPython/ipmaker.py (__call__): Added per-profile histories. Now
1640 * IPython/ipmaker.py (__call__): Added per-profile histories. Now
1637 the history file will be called 'history-PROFNAME' (or just
1641 the history file will be called 'history-PROFNAME' (or just
1638 'history' if no profile is loaded). I was getting annoyed at
1642 'history' if no profile is loaded). I was getting annoyed at
1639 getting my Numerical work history clobbered by pysh sessions.
1643 getting my Numerical work history clobbered by pysh sessions.
1640
1644
1641 * IPython/iplib.py (InteractiveShell.__init__): Internal
1645 * IPython/iplib.py (InteractiveShell.__init__): Internal
1642 getoutputerror() function so that we can honor the system_verbose
1646 getoutputerror() function so that we can honor the system_verbose
1643 flag for _all_ system calls. I also added escaping of #
1647 flag for _all_ system calls. I also added escaping of #
1644 characters here to avoid confusing Itpl.
1648 characters here to avoid confusing Itpl.
1645
1649
1646 * IPython/Magic.py (shlex_split): removed call to shell in
1650 * IPython/Magic.py (shlex_split): removed call to shell in
1647 parse_options and replaced it with shlex.split(). The annoying
1651 parse_options and replaced it with shlex.split(). The annoying
1648 part was that in Python 2.2, shlex.split() doesn't exist, so I had
1652 part was that in Python 2.2, shlex.split() doesn't exist, so I had
1649 to backport it from 2.3, with several frail hacks (the shlex
1653 to backport it from 2.3, with several frail hacks (the shlex
1650 module is rather limited in 2.2). Thanks to a suggestion by Ville
1654 module is rather limited in 2.2). Thanks to a suggestion by Ville
1651 Vainio <vivainio@kolumbus.fi>. For Python 2.3 there should be no
1655 Vainio <vivainio@kolumbus.fi>. For Python 2.3 there should be no
1652 problem.
1656 problem.
1653
1657
1654 (Magic.magic_system_verbose): new toggle to print the actual
1658 (Magic.magic_system_verbose): new toggle to print the actual
1655 system calls made by ipython. Mainly for debugging purposes.
1659 system calls made by ipython. Mainly for debugging purposes.
1656
1660
1657 * IPython/GnuplotRuntime.py (gnu_out): fix bug for cygwin, which
1661 * IPython/GnuplotRuntime.py (gnu_out): fix bug for cygwin, which
1658 doesn't support persistence. Reported (and fix suggested) by
1662 doesn't support persistence. Reported (and fix suggested) by
1659 Travis Caldwell <travis_caldwell2000@yahoo.com>.
1663 Travis Caldwell <travis_caldwell2000@yahoo.com>.
1660
1664
1661 2004-06-26 Fernando Perez <fperez@colorado.edu>
1665 2004-06-26 Fernando Perez <fperez@colorado.edu>
1662
1666
1663 * IPython/Logger.py (Logger.log): fix to handle correctly empty
1667 * IPython/Logger.py (Logger.log): fix to handle correctly empty
1664 continue prompts.
1668 continue prompts.
1665
1669
1666 * IPython/Extensions/InterpreterExec.py (pysh): moved the pysh()
1670 * IPython/Extensions/InterpreterExec.py (pysh): moved the pysh()
1667 function (basically a big docstring) and a few more things here to
1671 function (basically a big docstring) and a few more things here to
1668 speedup startup. pysh.py is now very lightweight. We want because
1672 speedup startup. pysh.py is now very lightweight. We want because
1669 it gets execfile'd, while InterpreterExec gets imported, so
1673 it gets execfile'd, while InterpreterExec gets imported, so
1670 byte-compilation saves time.
1674 byte-compilation saves time.
1671
1675
1672 2004-06-25 Fernando Perez <fperez@colorado.edu>
1676 2004-06-25 Fernando Perez <fperez@colorado.edu>
1673
1677
1674 * IPython/Magic.py (Magic.magic_cd): Fixed to restore usage of 'cd
1678 * IPython/Magic.py (Magic.magic_cd): Fixed to restore usage of 'cd
1675 -NUM', which was recently broken.
1679 -NUM', which was recently broken.
1676
1680
1677 * IPython/iplib.py (InteractiveShell.handle_shell_escape): allow !
1681 * IPython/iplib.py (InteractiveShell.handle_shell_escape): allow !
1678 in multi-line input (but not !!, which doesn't make sense there).
1682 in multi-line input (but not !!, which doesn't make sense there).
1679
1683
1680 * IPython/UserConfig/ipythonrc: made autoindent on by default.
1684 * IPython/UserConfig/ipythonrc: made autoindent on by default.
1681 It's just too useful, and people can turn it off in the less
1685 It's just too useful, and people can turn it off in the less
1682 common cases where it's a problem.
1686 common cases where it's a problem.
1683
1687
1684 2004-06-24 Fernando Perez <fperez@colorado.edu>
1688 2004-06-24 Fernando Perez <fperez@colorado.edu>
1685
1689
1686 * IPython/iplib.py (InteractiveShell._prefilter): big change -
1690 * IPython/iplib.py (InteractiveShell._prefilter): big change -
1687 special syntaxes (like alias calling) is now allied in multi-line
1691 special syntaxes (like alias calling) is now allied in multi-line
1688 input. This is still _very_ experimental, but it's necessary for
1692 input. This is still _very_ experimental, but it's necessary for
1689 efficient shell usage combining python looping syntax with system
1693 efficient shell usage combining python looping syntax with system
1690 calls. For now it's restricted to aliases, I don't think it
1694 calls. For now it's restricted to aliases, I don't think it
1691 really even makes sense to have this for magics.
1695 really even makes sense to have this for magics.
1692
1696
1693 2004-06-23 Fernando Perez <fperez@colorado.edu>
1697 2004-06-23 Fernando Perez <fperez@colorado.edu>
1694
1698
1695 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Added
1699 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Added
1696 $var=cmd <=> @sc var=cmd and $$var=cmd <=> @sc -l var=cmd.
1700 $var=cmd <=> @sc var=cmd and $$var=cmd <=> @sc -l var=cmd.
1697
1701
1698 * IPython/Magic.py (Magic.magic_rehashx): modified to handle
1702 * IPython/Magic.py (Magic.magic_rehashx): modified to handle
1699 extensions under Windows (after code sent by Gary Bishop). The
1703 extensions under Windows (after code sent by Gary Bishop). The
1700 extensions considered 'executable' are stored in IPython's rc
1704 extensions considered 'executable' are stored in IPython's rc
1701 structure as win_exec_ext.
1705 structure as win_exec_ext.
1702
1706
1703 * IPython/genutils.py (shell): new function, like system() but
1707 * IPython/genutils.py (shell): new function, like system() but
1704 without return value. Very useful for interactive shell work.
1708 without return value. Very useful for interactive shell work.
1705
1709
1706 * IPython/Magic.py (Magic.magic_unalias): New @unalias function to
1710 * IPython/Magic.py (Magic.magic_unalias): New @unalias function to
1707 delete aliases.
1711 delete aliases.
1708
1712
1709 * IPython/iplib.py (InteractiveShell.alias_table_update): make
1713 * IPython/iplib.py (InteractiveShell.alias_table_update): make
1710 sure that the alias table doesn't contain python keywords.
1714 sure that the alias table doesn't contain python keywords.
1711
1715
1712 2004-06-21 Fernando Perez <fperez@colorado.edu>
1716 2004-06-21 Fernando Perez <fperez@colorado.edu>
1713
1717
1714 * IPython/Magic.py (Magic.magic_rehash): Fix crash when
1718 * IPython/Magic.py (Magic.magic_rehash): Fix crash when
1715 non-existent items are found in $PATH. Reported by Thorsten.
1719 non-existent items are found in $PATH. Reported by Thorsten.
1716
1720
1717 2004-06-20 Fernando Perez <fperez@colorado.edu>
1721 2004-06-20 Fernando Perez <fperez@colorado.edu>
1718
1722
1719 * IPython/iplib.py (complete): modified the completer so that the
1723 * IPython/iplib.py (complete): modified the completer so that the
1720 order of priorities can be easily changed at runtime.
1724 order of priorities can be easily changed at runtime.
1721
1725
1722 * IPython/Extensions/InterpreterExec.py (prefilter_shell):
1726 * IPython/Extensions/InterpreterExec.py (prefilter_shell):
1723 Modified to auto-execute all lines beginning with '~', '/' or '.'.
1727 Modified to auto-execute all lines beginning with '~', '/' or '.'.
1724
1728
1725 * IPython/Magic.py (Magic.magic_sx): modified @sc and @sx to
1729 * IPython/Magic.py (Magic.magic_sx): modified @sc and @sx to
1726 expand Python variables prepended with $ in all system calls. The
1730 expand Python variables prepended with $ in all system calls. The
1727 same was done to InteractiveShell.handle_shell_escape. Now all
1731 same was done to InteractiveShell.handle_shell_escape. Now all
1728 system access mechanisms (!, !!, @sc, @sx and aliases) allow the
1732 system access mechanisms (!, !!, @sc, @sx and aliases) allow the
1729 expansion of python variables and expressions according to the
1733 expansion of python variables and expressions according to the
1730 syntax of PEP-215 - http://www.python.org/peps/pep-0215.html.
1734 syntax of PEP-215 - http://www.python.org/peps/pep-0215.html.
1731
1735
1732 Though PEP-215 has been rejected, a similar (but simpler) one
1736 Though PEP-215 has been rejected, a similar (but simpler) one
1733 seems like it will go into Python 2.4, PEP-292 -
1737 seems like it will go into Python 2.4, PEP-292 -
1734 http://www.python.org/peps/pep-0292.html.
1738 http://www.python.org/peps/pep-0292.html.
1735
1739
1736 I'll keep the full syntax of PEP-215, since IPython has since the
1740 I'll keep the full syntax of PEP-215, since IPython has since the
1737 start used Ka-Ping Yee's reference implementation discussed there
1741 start used Ka-Ping Yee's reference implementation discussed there
1738 (Itpl), and I actually like the powerful semantics it offers.
1742 (Itpl), and I actually like the powerful semantics it offers.
1739
1743
1740 In order to access normal shell variables, the $ has to be escaped
1744 In order to access normal shell variables, the $ has to be escaped
1741 via an extra $. For example:
1745 via an extra $. For example:
1742
1746
1743 In [7]: PATH='a python variable'
1747 In [7]: PATH='a python variable'
1744
1748
1745 In [8]: !echo $PATH
1749 In [8]: !echo $PATH
1746 a python variable
1750 a python variable
1747
1751
1748 In [9]: !echo $$PATH
1752 In [9]: !echo $$PATH
1749 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
1753 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
1750
1754
1751 (Magic.parse_options): escape $ so the shell doesn't evaluate
1755 (Magic.parse_options): escape $ so the shell doesn't evaluate
1752 things prematurely.
1756 things prematurely.
1753
1757
1754 * IPython/iplib.py (InteractiveShell.call_alias): added the
1758 * IPython/iplib.py (InteractiveShell.call_alias): added the
1755 ability for aliases to expand python variables via $.
1759 ability for aliases to expand python variables via $.
1756
1760
1757 * IPython/Magic.py (Magic.magic_rehash): based on the new alias
1761 * IPython/Magic.py (Magic.magic_rehash): based on the new alias
1758 system, now there's a @rehash/@rehashx pair of magics. These work
1762 system, now there's a @rehash/@rehashx pair of magics. These work
1759 like the csh rehash command, and can be invoked at any time. They
1763 like the csh rehash command, and can be invoked at any time. They
1760 build a table of aliases to everything in the user's $PATH
1764 build a table of aliases to everything in the user's $PATH
1761 (@rehash uses everything, @rehashx is slower but only adds
1765 (@rehash uses everything, @rehashx is slower but only adds
1762 executable files). With this, the pysh.py-based shell profile can
1766 executable files). With this, the pysh.py-based shell profile can
1763 now simply call rehash upon startup, and full access to all
1767 now simply call rehash upon startup, and full access to all
1764 programs in the user's path is obtained.
1768 programs in the user's path is obtained.
1765
1769
1766 * IPython/iplib.py (InteractiveShell.call_alias): The new alias
1770 * IPython/iplib.py (InteractiveShell.call_alias): The new alias
1767 functionality is now fully in place. I removed the old dynamic
1771 functionality is now fully in place. I removed the old dynamic
1768 code generation based approach, in favor of a much lighter one
1772 code generation based approach, in favor of a much lighter one
1769 based on a simple dict. The advantage is that this allows me to
1773 based on a simple dict. The advantage is that this allows me to
1770 now have thousands of aliases with negligible cost (unthinkable
1774 now have thousands of aliases with negligible cost (unthinkable
1771 with the old system).
1775 with the old system).
1772
1776
1773 2004-06-19 Fernando Perez <fperez@colorado.edu>
1777 2004-06-19 Fernando Perez <fperez@colorado.edu>
1774
1778
1775 * IPython/iplib.py (__init__): extended MagicCompleter class to
1779 * IPython/iplib.py (__init__): extended MagicCompleter class to
1776 also complete (last in priority) on user aliases.
1780 also complete (last in priority) on user aliases.
1777
1781
1778 * IPython/Itpl.py (Itpl.__str__): fixed order of globals/locals in
1782 * IPython/Itpl.py (Itpl.__str__): fixed order of globals/locals in
1779 call to eval.
1783 call to eval.
1780 (ItplNS.__init__): Added a new class which functions like Itpl,
1784 (ItplNS.__init__): Added a new class which functions like Itpl,
1781 but allows configuring the namespace for the evaluation to occur
1785 but allows configuring the namespace for the evaluation to occur
1782 in.
1786 in.
1783
1787
1784 2004-06-18 Fernando Perez <fperez@colorado.edu>
1788 2004-06-18 Fernando Perez <fperez@colorado.edu>
1785
1789
1786 * IPython/iplib.py (InteractiveShell.runcode): modify to print a
1790 * IPython/iplib.py (InteractiveShell.runcode): modify to print a
1787 better message when 'exit' or 'quit' are typed (a common newbie
1791 better message when 'exit' or 'quit' are typed (a common newbie
1788 confusion).
1792 confusion).
1789
1793
1790 * IPython/Magic.py (Magic.magic_colors): Added the runtime color
1794 * IPython/Magic.py (Magic.magic_colors): Added the runtime color
1791 check for Windows users.
1795 check for Windows users.
1792
1796
1793 * IPython/iplib.py (InteractiveShell.user_setup): removed
1797 * IPython/iplib.py (InteractiveShell.user_setup): removed
1794 disabling of colors for Windows. I'll test at runtime and issue a
1798 disabling of colors for Windows. I'll test at runtime and issue a
1795 warning if Gary's readline isn't found, as to nudge users to
1799 warning if Gary's readline isn't found, as to nudge users to
1796 download it.
1800 download it.
1797
1801
1798 2004-06-16 Fernando Perez <fperez@colorado.edu>
1802 2004-06-16 Fernando Perez <fperez@colorado.edu>
1799
1803
1800 * IPython/genutils.py (Stream.__init__): changed to print errors
1804 * IPython/genutils.py (Stream.__init__): changed to print errors
1801 to sys.stderr. I had a circular dependency here. Now it's
1805 to sys.stderr. I had a circular dependency here. Now it's
1802 possible to run ipython as IDLE's shell (consider this pre-alpha,
1806 possible to run ipython as IDLE's shell (consider this pre-alpha,
1803 since true stdout things end up in the starting terminal instead
1807 since true stdout things end up in the starting terminal instead
1804 of IDLE's out).
1808 of IDLE's out).
1805
1809
1806 * IPython/Prompts.py (Prompt2.set_colors): prevent crashes for
1810 * IPython/Prompts.py (Prompt2.set_colors): prevent crashes for
1807 users who haven't # updated their prompt_in2 definitions. Remove
1811 users who haven't # updated their prompt_in2 definitions. Remove
1808 eventually.
1812 eventually.
1809 (multiple_replace): added credit to original ASPN recipe.
1813 (multiple_replace): added credit to original ASPN recipe.
1810
1814
1811 2004-06-15 Fernando Perez <fperez@colorado.edu>
1815 2004-06-15 Fernando Perez <fperez@colorado.edu>
1812
1816
1813 * IPython/iplib.py (InteractiveShell.__init__): add 'cp' to the
1817 * IPython/iplib.py (InteractiveShell.__init__): add 'cp' to the
1814 list of auto-defined aliases.
1818 list of auto-defined aliases.
1815
1819
1816 2004-06-13 Fernando Perez <fperez@colorado.edu>
1820 2004-06-13 Fernando Perez <fperez@colorado.edu>
1817
1821
1818 * setup.py (scriptfiles): Don't trigger win_post_install unless an
1822 * setup.py (scriptfiles): Don't trigger win_post_install unless an
1819 install was really requested (so setup.py can be used for other
1823 install was really requested (so setup.py can be used for other
1820 things under Windows).
1824 things under Windows).
1821
1825
1822 2004-06-10 Fernando Perez <fperez@colorado.edu>
1826 2004-06-10 Fernando Perez <fperez@colorado.edu>
1823
1827
1824 * IPython/Logger.py (Logger.create_log): Manually remove any old
1828 * IPython/Logger.py (Logger.create_log): Manually remove any old
1825 backup, since os.remove may fail under Windows. Fixes bug
1829 backup, since os.remove may fail under Windows. Fixes bug
1826 reported by Thorsten.
1830 reported by Thorsten.
1827
1831
1828 2004-06-09 Fernando Perez <fperez@colorado.edu>
1832 2004-06-09 Fernando Perez <fperez@colorado.edu>
1829
1833
1830 * examples/example-embed.py: fixed all references to %n (replaced
1834 * examples/example-embed.py: fixed all references to %n (replaced
1831 with \\# for ps1/out prompts and with \\D for ps2 prompts). Done
1835 with \\# for ps1/out prompts and with \\D for ps2 prompts). Done
1832 for all examples and the manual as well.
1836 for all examples and the manual as well.
1833
1837
1834 2004-06-08 Fernando Perez <fperez@colorado.edu>
1838 2004-06-08 Fernando Perez <fperez@colorado.edu>
1835
1839
1836 * IPython/Prompts.py (Prompt2.set_p_str): fixed all prompt
1840 * IPython/Prompts.py (Prompt2.set_p_str): fixed all prompt
1837 alignment and color management. All 3 prompt subsystems now
1841 alignment and color management. All 3 prompt subsystems now
1838 inherit from BasePrompt.
1842 inherit from BasePrompt.
1839
1843
1840 * tools/release: updates for windows installer build and tag rpms
1844 * tools/release: updates for windows installer build and tag rpms
1841 with python version (since paths are fixed).
1845 with python version (since paths are fixed).
1842
1846
1843 * IPython/UserConfig/ipythonrc: modified to use \# instead of %n,
1847 * IPython/UserConfig/ipythonrc: modified to use \# instead of %n,
1844 which will become eventually obsolete. Also fixed the default
1848 which will become eventually obsolete. Also fixed the default
1845 prompt_in2 to use \D, so at least new users start with the correct
1849 prompt_in2 to use \D, so at least new users start with the correct
1846 defaults.
1850 defaults.
1847 WARNING: Users with existing ipythonrc files will need to apply
1851 WARNING: Users with existing ipythonrc files will need to apply
1848 this fix manually!
1852 this fix manually!
1849
1853
1850 * setup.py: make windows installer (.exe). This is finally the
1854 * setup.py: make windows installer (.exe). This is finally the
1851 integration of an old patch by Cory Dodt <dodt-AT-fcoe.k12.ca.us>,
1855 integration of an old patch by Cory Dodt <dodt-AT-fcoe.k12.ca.us>,
1852 which I hadn't included because it required Python 2.3 (or recent
1856 which I hadn't included because it required Python 2.3 (or recent
1853 distutils).
1857 distutils).
1854
1858
1855 * IPython/usage.py (__doc__): update docs (and manpage) to reflect
1859 * IPython/usage.py (__doc__): update docs (and manpage) to reflect
1856 usage of new '\D' escape.
1860 usage of new '\D' escape.
1857
1861
1858 * IPython/Prompts.py (ROOT_SYMBOL): Small fix for Windows (which
1862 * IPython/Prompts.py (ROOT_SYMBOL): Small fix for Windows (which
1859 lacks os.getuid())
1863 lacks os.getuid())
1860 (CachedOutput.set_colors): Added the ability to turn coloring
1864 (CachedOutput.set_colors): Added the ability to turn coloring
1861 on/off with @colors even for manually defined prompt colors. It
1865 on/off with @colors even for manually defined prompt colors. It
1862 uses a nasty global, but it works safely and via the generic color
1866 uses a nasty global, but it works safely and via the generic color
1863 handling mechanism.
1867 handling mechanism.
1864 (Prompt2.__init__): Introduced new escape '\D' for continuation
1868 (Prompt2.__init__): Introduced new escape '\D' for continuation
1865 prompts. It represents the counter ('\#') as dots.
1869 prompts. It represents the counter ('\#') as dots.
1866 *** NOTE *** THIS IS A BACKWARDS-INCOMPATIBLE CHANGE. Users will
1870 *** NOTE *** THIS IS A BACKWARDS-INCOMPATIBLE CHANGE. Users will
1867 need to update their ipythonrc files and replace '%n' with '\D' in
1871 need to update their ipythonrc files and replace '%n' with '\D' in
1868 their prompt_in2 settings everywhere. Sorry, but there's
1872 their prompt_in2 settings everywhere. Sorry, but there's
1869 otherwise no clean way to get all prompts to properly align. The
1873 otherwise no clean way to get all prompts to properly align. The
1870 ipythonrc shipped with IPython has been updated.
1874 ipythonrc shipped with IPython has been updated.
1871
1875
1872 2004-06-07 Fernando Perez <fperez@colorado.edu>
1876 2004-06-07 Fernando Perez <fperez@colorado.edu>
1873
1877
1874 * setup.py (isfile): Pass local_icons option to latex2html, so the
1878 * setup.py (isfile): Pass local_icons option to latex2html, so the
1875 resulting HTML file is self-contained. Thanks to
1879 resulting HTML file is self-contained. Thanks to
1876 dryice-AT-liu.com.cn for the tip.
1880 dryice-AT-liu.com.cn for the tip.
1877
1881
1878 * pysh.py: I created a new profile 'shell', which implements a
1882 * pysh.py: I created a new profile 'shell', which implements a
1879 _rudimentary_ IPython-based shell. This is in NO WAY a realy
1883 _rudimentary_ IPython-based shell. This is in NO WAY a realy
1880 system shell, nor will it become one anytime soon. It's mainly
1884 system shell, nor will it become one anytime soon. It's mainly
1881 meant to illustrate the use of the new flexible bash-like prompts.
1885 meant to illustrate the use of the new flexible bash-like prompts.
1882 I guess it could be used by hardy souls for true shell management,
1886 I guess it could be used by hardy souls for true shell management,
1883 but it's no tcsh/bash... pysh.py is loaded by the 'shell'
1887 but it's no tcsh/bash... pysh.py is loaded by the 'shell'
1884 profile. This uses the InterpreterExec extension provided by
1888 profile. This uses the InterpreterExec extension provided by
1885 W.J. van der Laan <gnufnork-AT-hetdigitalegat.nl>
1889 W.J. van der Laan <gnufnork-AT-hetdigitalegat.nl>
1886
1890
1887 * IPython/Prompts.py (PromptOut.__str__): now it will correctly
1891 * IPython/Prompts.py (PromptOut.__str__): now it will correctly
1888 auto-align itself with the length of the previous input prompt
1892 auto-align itself with the length of the previous input prompt
1889 (taking into account the invisible color escapes).
1893 (taking into account the invisible color escapes).
1890 (CachedOutput.__init__): Large restructuring of this class. Now
1894 (CachedOutput.__init__): Large restructuring of this class. Now
1891 all three prompts (primary1, primary2, output) are proper objects,
1895 all three prompts (primary1, primary2, output) are proper objects,
1892 managed by the 'parent' CachedOutput class. The code is still a
1896 managed by the 'parent' CachedOutput class. The code is still a
1893 bit hackish (all prompts share state via a pointer to the cache),
1897 bit hackish (all prompts share state via a pointer to the cache),
1894 but it's overall far cleaner than before.
1898 but it's overall far cleaner than before.
1895
1899
1896 * IPython/genutils.py (getoutputerror): modified to add verbose,
1900 * IPython/genutils.py (getoutputerror): modified to add verbose,
1897 debug and header options. This makes the interface of all getout*
1901 debug and header options. This makes the interface of all getout*
1898 functions uniform.
1902 functions uniform.
1899 (SystemExec.getoutputerror): added getoutputerror to SystemExec.
1903 (SystemExec.getoutputerror): added getoutputerror to SystemExec.
1900
1904
1901 * IPython/Magic.py (Magic.default_option): added a function to
1905 * IPython/Magic.py (Magic.default_option): added a function to
1902 allow registering default options for any magic command. This
1906 allow registering default options for any magic command. This
1903 makes it easy to have profiles which customize the magics globally
1907 makes it easy to have profiles which customize the magics globally
1904 for a certain use. The values set through this function are
1908 for a certain use. The values set through this function are
1905 picked up by the parse_options() method, which all magics should
1909 picked up by the parse_options() method, which all magics should
1906 use to parse their options.
1910 use to parse their options.
1907
1911
1908 * IPython/genutils.py (warn): modified the warnings framework to
1912 * IPython/genutils.py (warn): modified the warnings framework to
1909 use the Term I/O class. I'm trying to slowly unify all of
1913 use the Term I/O class. I'm trying to slowly unify all of
1910 IPython's I/O operations to pass through Term.
1914 IPython's I/O operations to pass through Term.
1911
1915
1912 * IPython/Prompts.py (Prompt2._str_other): Added functionality in
1916 * IPython/Prompts.py (Prompt2._str_other): Added functionality in
1913 the secondary prompt to correctly match the length of the primary
1917 the secondary prompt to correctly match the length of the primary
1914 one for any prompt. Now multi-line code will properly line up
1918 one for any prompt. Now multi-line code will properly line up
1915 even for path dependent prompts, such as the new ones available
1919 even for path dependent prompts, such as the new ones available
1916 via the prompt_specials.
1920 via the prompt_specials.
1917
1921
1918 2004-06-06 Fernando Perez <fperez@colorado.edu>
1922 2004-06-06 Fernando Perez <fperez@colorado.edu>
1919
1923
1920 * IPython/Prompts.py (prompt_specials): Added the ability to have
1924 * IPython/Prompts.py (prompt_specials): Added the ability to have
1921 bash-like special sequences in the prompts, which get
1925 bash-like special sequences in the prompts, which get
1922 automatically expanded. Things like hostname, current working
1926 automatically expanded. Things like hostname, current working
1923 directory and username are implemented already, but it's easy to
1927 directory and username are implemented already, but it's easy to
1924 add more in the future. Thanks to a patch by W.J. van der Laan
1928 add more in the future. Thanks to a patch by W.J. van der Laan
1925 <gnufnork-AT-hetdigitalegat.nl>
1929 <gnufnork-AT-hetdigitalegat.nl>
1926 (prompt_specials): Added color support for prompt strings, so
1930 (prompt_specials): Added color support for prompt strings, so
1927 users can define arbitrary color setups for their prompts.
1931 users can define arbitrary color setups for their prompts.
1928
1932
1929 2004-06-05 Fernando Perez <fperez@colorado.edu>
1933 2004-06-05 Fernando Perez <fperez@colorado.edu>
1930
1934
1931 * IPython/genutils.py (Term.reopen_all): Added Windows-specific
1935 * IPython/genutils.py (Term.reopen_all): Added Windows-specific
1932 code to load Gary Bishop's readline and configure it
1936 code to load Gary Bishop's readline and configure it
1933 automatically. Thanks to Gary for help on this.
1937 automatically. Thanks to Gary for help on this.
1934
1938
1935 2004-06-01 Fernando Perez <fperez@colorado.edu>
1939 2004-06-01 Fernando Perez <fperez@colorado.edu>
1936
1940
1937 * IPython/Logger.py (Logger.create_log): fix bug for logging
1941 * IPython/Logger.py (Logger.create_log): fix bug for logging
1938 with no filename (previous fix was incomplete).
1942 with no filename (previous fix was incomplete).
1939
1943
1940 2004-05-25 Fernando Perez <fperez@colorado.edu>
1944 2004-05-25 Fernando Perez <fperez@colorado.edu>
1941
1945
1942 * IPython/Magic.py (Magic.parse_options): fix bug where naked
1946 * IPython/Magic.py (Magic.parse_options): fix bug where naked
1943 parens would get passed to the shell.
1947 parens would get passed to the shell.
1944
1948
1945 2004-05-20 Fernando Perez <fperez@colorado.edu>
1949 2004-05-20 Fernando Perez <fperez@colorado.edu>
1946
1950
1947 * IPython/Magic.py (Magic.magic_prun): changed default profile
1951 * IPython/Magic.py (Magic.magic_prun): changed default profile
1948 sort order to 'time' (the more common profiling need).
1952 sort order to 'time' (the more common profiling need).
1949
1953
1950 * IPython/OInspect.py (Inspector.pinfo): flush the inspect cache
1954 * IPython/OInspect.py (Inspector.pinfo): flush the inspect cache
1951 so that source code shown is guaranteed in sync with the file on
1955 so that source code shown is guaranteed in sync with the file on
1952 disk (also changed in psource). Similar fix to the one for
1956 disk (also changed in psource). Similar fix to the one for
1953 ultraTB on 2004-05-06. Thanks to a bug report by Yann Le Du
1957 ultraTB on 2004-05-06. Thanks to a bug report by Yann Le Du
1954 <yann.ledu-AT-noos.fr>.
1958 <yann.ledu-AT-noos.fr>.
1955
1959
1956 * IPython/Magic.py (Magic.parse_options): Fixed bug where commands
1960 * IPython/Magic.py (Magic.parse_options): Fixed bug where commands
1957 with a single option would not be correctly parsed. Closes
1961 with a single option would not be correctly parsed. Closes
1958 http://www.scipy.net/roundup/ipython/issue14. This bug had been
1962 http://www.scipy.net/roundup/ipython/issue14. This bug had been
1959 introduced in 0.6.0 (on 2004-05-06).
1963 introduced in 0.6.0 (on 2004-05-06).
1960
1964
1961 2004-05-13 *** Released version 0.6.0
1965 2004-05-13 *** Released version 0.6.0
1962
1966
1963 2004-05-13 Fernando Perez <fperez@colorado.edu>
1967 2004-05-13 Fernando Perez <fperez@colorado.edu>
1964
1968
1965 * debian/: Added debian/ directory to CVS, so that debian support
1969 * debian/: Added debian/ directory to CVS, so that debian support
1966 is publicly accessible. The debian package is maintained by Jack
1970 is publicly accessible. The debian package is maintained by Jack
1967 Moffit <jack-AT-xiph.org>.
1971 Moffit <jack-AT-xiph.org>.
1968
1972
1969 * Documentation: included the notes about an ipython-based system
1973 * Documentation: included the notes about an ipython-based system
1970 shell (the hypothetical 'pysh') into the new_design.pdf document,
1974 shell (the hypothetical 'pysh') into the new_design.pdf document,
1971 so that these ideas get distributed to users along with the
1975 so that these ideas get distributed to users along with the
1972 official documentation.
1976 official documentation.
1973
1977
1974 2004-05-10 Fernando Perez <fperez@colorado.edu>
1978 2004-05-10 Fernando Perez <fperez@colorado.edu>
1975
1979
1976 * IPython/Logger.py (Logger.create_log): fix recently introduced
1980 * IPython/Logger.py (Logger.create_log): fix recently introduced
1977 bug (misindented line) where logstart would fail when not given an
1981 bug (misindented line) where logstart would fail when not given an
1978 explicit filename.
1982 explicit filename.
1979
1983
1980 2004-05-09 Fernando Perez <fperez@colorado.edu>
1984 2004-05-09 Fernando Perez <fperez@colorado.edu>
1981
1985
1982 * IPython/Magic.py (Magic.parse_options): skip system call when
1986 * IPython/Magic.py (Magic.parse_options): skip system call when
1983 there are no options to look for. Faster, cleaner for the common
1987 there are no options to look for. Faster, cleaner for the common
1984 case.
1988 case.
1985
1989
1986 * Documentation: many updates to the manual: describing Windows
1990 * Documentation: many updates to the manual: describing Windows
1987 support better, Gnuplot updates, credits, misc small stuff. Also
1991 support better, Gnuplot updates, credits, misc small stuff. Also
1988 updated the new_design doc a bit.
1992 updated the new_design doc a bit.
1989
1993
1990 2004-05-06 *** Released version 0.6.0.rc1
1994 2004-05-06 *** Released version 0.6.0.rc1
1991
1995
1992 2004-05-06 Fernando Perez <fperez@colorado.edu>
1996 2004-05-06 Fernando Perez <fperez@colorado.edu>
1993
1997
1994 * IPython/ultraTB.py (ListTB.text): modified a ton of string +=
1998 * IPython/ultraTB.py (ListTB.text): modified a ton of string +=
1995 operations to use the vastly more efficient list/''.join() method.
1999 operations to use the vastly more efficient list/''.join() method.
1996 (FormattedTB.text): Fix
2000 (FormattedTB.text): Fix
1997 http://www.scipy.net/roundup/ipython/issue12 - exception source
2001 http://www.scipy.net/roundup/ipython/issue12 - exception source
1998 extract not updated after reload. Thanks to Mike Salib
2002 extract not updated after reload. Thanks to Mike Salib
1999 <msalib-AT-mit.edu> for pinning the source of the problem.
2003 <msalib-AT-mit.edu> for pinning the source of the problem.
2000 Fortunately, the solution works inside ipython and doesn't require
2004 Fortunately, the solution works inside ipython and doesn't require
2001 any changes to python proper.
2005 any changes to python proper.
2002
2006
2003 * IPython/Magic.py (Magic.parse_options): Improved to process the
2007 * IPython/Magic.py (Magic.parse_options): Improved to process the
2004 argument list as a true shell would (by actually using the
2008 argument list as a true shell would (by actually using the
2005 underlying system shell). This way, all @magics automatically get
2009 underlying system shell). This way, all @magics automatically get
2006 shell expansion for variables. Thanks to a comment by Alex
2010 shell expansion for variables. Thanks to a comment by Alex
2007 Schmolck.
2011 Schmolck.
2008
2012
2009 2004-04-04 Fernando Perez <fperez@colorado.edu>
2013 2004-04-04 Fernando Perez <fperez@colorado.edu>
2010
2014
2011 * IPython/iplib.py (InteractiveShell.interact): Added a special
2015 * IPython/iplib.py (InteractiveShell.interact): Added a special
2012 trap for a debugger quit exception, which is basically impossible
2016 trap for a debugger quit exception, which is basically impossible
2013 to handle by normal mechanisms, given what pdb does to the stack.
2017 to handle by normal mechanisms, given what pdb does to the stack.
2014 This fixes a crash reported by <fgibbons-AT-llama.med.harvard.edu>.
2018 This fixes a crash reported by <fgibbons-AT-llama.med.harvard.edu>.
2015
2019
2016 2004-04-03 Fernando Perez <fperez@colorado.edu>
2020 2004-04-03 Fernando Perez <fperez@colorado.edu>
2017
2021
2018 * IPython/genutils.py (Term): Standardized the names of the Term
2022 * IPython/genutils.py (Term): Standardized the names of the Term
2019 class streams to cin/cout/cerr, following C++ naming conventions
2023 class streams to cin/cout/cerr, following C++ naming conventions
2020 (I can't use in/out/err because 'in' is not a valid attribute
2024 (I can't use in/out/err because 'in' is not a valid attribute
2021 name).
2025 name).
2022
2026
2023 * IPython/iplib.py (InteractiveShell.interact): don't increment
2027 * IPython/iplib.py (InteractiveShell.interact): don't increment
2024 the prompt if there's no user input. By Daniel 'Dang' Griffith
2028 the prompt if there's no user input. By Daniel 'Dang' Griffith
2025 <pythondev-dang-AT-lazytwinacres.net>, after a suggestion from
2029 <pythondev-dang-AT-lazytwinacres.net>, after a suggestion from
2026 Francois Pinard.
2030 Francois Pinard.
2027
2031
2028 2004-04-02 Fernando Perez <fperez@colorado.edu>
2032 2004-04-02 Fernando Perez <fperez@colorado.edu>
2029
2033
2030 * IPython/genutils.py (Stream.__init__): Modified to survive at
2034 * IPython/genutils.py (Stream.__init__): Modified to survive at
2031 least importing in contexts where stdin/out/err aren't true file
2035 least importing in contexts where stdin/out/err aren't true file
2032 objects, such as PyCrust (they lack fileno() and mode). However,
2036 objects, such as PyCrust (they lack fileno() and mode). However,
2033 the recovery facilities which rely on these things existing will
2037 the recovery facilities which rely on these things existing will
2034 not work.
2038 not work.
2035
2039
2036 2004-04-01 Fernando Perez <fperez@colorado.edu>
2040 2004-04-01 Fernando Perez <fperez@colorado.edu>
2037
2041
2038 * IPython/Magic.py (Magic.magic_sx): modified (as well as @sc) to
2042 * IPython/Magic.py (Magic.magic_sx): modified (as well as @sc) to
2039 use the new getoutputerror() function, so it properly
2043 use the new getoutputerror() function, so it properly
2040 distinguishes stdout/err.
2044 distinguishes stdout/err.
2041
2045
2042 * IPython/genutils.py (getoutputerror): added a function to
2046 * IPython/genutils.py (getoutputerror): added a function to
2043 capture separately the standard output and error of a command.
2047 capture separately the standard output and error of a command.
2044 After a comment from dang on the mailing lists. This code is
2048 After a comment from dang on the mailing lists. This code is
2045 basically a modified version of commands.getstatusoutput(), from
2049 basically a modified version of commands.getstatusoutput(), from
2046 the standard library.
2050 the standard library.
2047
2051
2048 * IPython/iplib.py (InteractiveShell.handle_shell_escape): added
2052 * IPython/iplib.py (InteractiveShell.handle_shell_escape): added
2049 '!!' as a special syntax (shorthand) to access @sx.
2053 '!!' as a special syntax (shorthand) to access @sx.
2050
2054
2051 * IPython/Magic.py (Magic.magic_sx): new magic, to execute a shell
2055 * IPython/Magic.py (Magic.magic_sx): new magic, to execute a shell
2052 command and return its output as a list split on '\n'.
2056 command and return its output as a list split on '\n'.
2053
2057
2054 2004-03-31 Fernando Perez <fperez@colorado.edu>
2058 2004-03-31 Fernando Perez <fperez@colorado.edu>
2055
2059
2056 * IPython/FakeModule.py (FakeModule.__init__): added __nonzero__
2060 * IPython/FakeModule.py (FakeModule.__init__): added __nonzero__
2057 method to dictionaries used as FakeModule instances if they lack
2061 method to dictionaries used as FakeModule instances if they lack
2058 it. At least pydoc in python2.3 breaks for runtime-defined
2062 it. At least pydoc in python2.3 breaks for runtime-defined
2059 functions without this hack. At some point I need to _really_
2063 functions without this hack. At some point I need to _really_
2060 understand what FakeModule is doing, because it's a gross hack.
2064 understand what FakeModule is doing, because it's a gross hack.
2061 But it solves Arnd's problem for now...
2065 But it solves Arnd's problem for now...
2062
2066
2063 2004-02-27 Fernando Perez <fperez@colorado.edu>
2067 2004-02-27 Fernando Perez <fperez@colorado.edu>
2064
2068
2065 * IPython/Logger.py (Logger.create_log): Fix bug where 'rotate'
2069 * IPython/Logger.py (Logger.create_log): Fix bug where 'rotate'
2066 mode would behave erratically. Also increased the number of
2070 mode would behave erratically. Also increased the number of
2067 possible logs in rotate mod to 999. Thanks to Rod Holland
2071 possible logs in rotate mod to 999. Thanks to Rod Holland
2068 <rhh@StructureLABS.com> for the report and fixes.
2072 <rhh@StructureLABS.com> for the report and fixes.
2069
2073
2070 2004-02-26 Fernando Perez <fperez@colorado.edu>
2074 2004-02-26 Fernando Perez <fperez@colorado.edu>
2071
2075
2072 * IPython/genutils.py (page): Check that the curses module really
2076 * IPython/genutils.py (page): Check that the curses module really
2073 has the initscr attribute before trying to use it. For some
2077 has the initscr attribute before trying to use it. For some
2074 reason, the Solaris curses module is missing this. I think this
2078 reason, the Solaris curses module is missing this. I think this
2075 should be considered a Solaris python bug, but I'm not sure.
2079 should be considered a Solaris python bug, but I'm not sure.
2076
2080
2077 2004-01-17 Fernando Perez <fperez@colorado.edu>
2081 2004-01-17 Fernando Perez <fperez@colorado.edu>
2078
2082
2079 * IPython/genutils.py (Stream.__init__): Changes to try to make
2083 * IPython/genutils.py (Stream.__init__): Changes to try to make
2080 ipython robust against stdin/out/err being closed by the user.
2084 ipython robust against stdin/out/err being closed by the user.
2081 This is 'user error' (and blocks a normal python session, at least
2085 This is 'user error' (and blocks a normal python session, at least
2082 the stdout case). However, Ipython should be able to survive such
2086 the stdout case). However, Ipython should be able to survive such
2083 instances of abuse as gracefully as possible. To simplify the
2087 instances of abuse as gracefully as possible. To simplify the
2084 coding and maintain compatibility with Gary Bishop's Term
2088 coding and maintain compatibility with Gary Bishop's Term
2085 contributions, I've made use of classmethods for this. I think
2089 contributions, I've made use of classmethods for this. I think
2086 this introduces a dependency on python 2.2.
2090 this introduces a dependency on python 2.2.
2087
2091
2088 2004-01-13 Fernando Perez <fperez@colorado.edu>
2092 2004-01-13 Fernando Perez <fperez@colorado.edu>
2089
2093
2090 * IPython/numutils.py (exp_safe): simplified the code a bit and
2094 * IPython/numutils.py (exp_safe): simplified the code a bit and
2091 removed the need for importing the kinds module altogether.
2095 removed the need for importing the kinds module altogether.
2092
2096
2093 2004-01-06 Fernando Perez <fperez@colorado.edu>
2097 2004-01-06 Fernando Perez <fperez@colorado.edu>
2094
2098
2095 * IPython/Magic.py (Magic.magic_sc): Made the shell capture system
2099 * IPython/Magic.py (Magic.magic_sc): Made the shell capture system
2096 a magic function instead, after some community feedback. No
2100 a magic function instead, after some community feedback. No
2097 special syntax will exist for it, but its name is deliberately
2101 special syntax will exist for it, but its name is deliberately
2098 very short.
2102 very short.
2099
2103
2100 2003-12-20 Fernando Perez <fperez@colorado.edu>
2104 2003-12-20 Fernando Perez <fperez@colorado.edu>
2101
2105
2102 * IPython/iplib.py (InteractiveShell.handle_shell_assign): Added
2106 * IPython/iplib.py (InteractiveShell.handle_shell_assign): Added
2103 new functionality, to automagically assign the result of a shell
2107 new functionality, to automagically assign the result of a shell
2104 command to a variable. I'll solicit some community feedback on
2108 command to a variable. I'll solicit some community feedback on
2105 this before making it permanent.
2109 this before making it permanent.
2106
2110
2107 * IPython/OInspect.py (Inspector.pinfo): Fix crash when info was
2111 * IPython/OInspect.py (Inspector.pinfo): Fix crash when info was
2108 requested about callables for which inspect couldn't obtain a
2112 requested about callables for which inspect couldn't obtain a
2109 proper argspec. Thanks to a crash report sent by Etienne
2113 proper argspec. Thanks to a crash report sent by Etienne
2110 Posthumus <etienne-AT-apple01.cs.vu.nl>.
2114 Posthumus <etienne-AT-apple01.cs.vu.nl>.
2111
2115
2112 2003-12-09 Fernando Perez <fperez@colorado.edu>
2116 2003-12-09 Fernando Perez <fperez@colorado.edu>
2113
2117
2114 * IPython/genutils.py (page): patch for the pager to work across
2118 * IPython/genutils.py (page): patch for the pager to work across
2115 various versions of Windows. By Gary Bishop.
2119 various versions of Windows. By Gary Bishop.
2116
2120
2117 2003-12-04 Fernando Perez <fperez@colorado.edu>
2121 2003-12-04 Fernando Perez <fperez@colorado.edu>
2118
2122
2119 * IPython/Gnuplot2.py (PlotItems): Fixes for working with
2123 * IPython/Gnuplot2.py (PlotItems): Fixes for working with
2120 Gnuplot.py version 1.7, whose internal names changed quite a bit.
2124 Gnuplot.py version 1.7, whose internal names changed quite a bit.
2121 While I tested this and it looks ok, there may still be corner
2125 While I tested this and it looks ok, there may still be corner
2122 cases I've missed.
2126 cases I've missed.
2123
2127
2124 2003-12-01 Fernando Perez <fperez@colorado.edu>
2128 2003-12-01 Fernando Perez <fperez@colorado.edu>
2125
2129
2126 * IPython/iplib.py (InteractiveShell._prefilter): Fixed a bug
2130 * IPython/iplib.py (InteractiveShell._prefilter): Fixed a bug
2127 where a line like 'p,q=1,2' would fail because the automagic
2131 where a line like 'p,q=1,2' would fail because the automagic
2128 system would be triggered for @p.
2132 system would be triggered for @p.
2129
2133
2130 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): Tab-related
2134 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): Tab-related
2131 cleanups, code unmodified.
2135 cleanups, code unmodified.
2132
2136
2133 * IPython/genutils.py (Term): added a class for IPython to handle
2137 * IPython/genutils.py (Term): added a class for IPython to handle
2134 output. In most cases it will just be a proxy for stdout/err, but
2138 output. In most cases it will just be a proxy for stdout/err, but
2135 having this allows modifications to be made for some platforms,
2139 having this allows modifications to be made for some platforms,
2136 such as handling color escapes under Windows. All of this code
2140 such as handling color escapes under Windows. All of this code
2137 was contributed by Gary Bishop, with minor modifications by me.
2141 was contributed by Gary Bishop, with minor modifications by me.
2138 The actual changes affect many files.
2142 The actual changes affect many files.
2139
2143
2140 2003-11-30 Fernando Perez <fperez@colorado.edu>
2144 2003-11-30 Fernando Perez <fperez@colorado.edu>
2141
2145
2142 * IPython/iplib.py (file_matches): new completion code, courtesy
2146 * IPython/iplib.py (file_matches): new completion code, courtesy
2143 of Jeff Collins. This enables filename completion again under
2147 of Jeff Collins. This enables filename completion again under
2144 python 2.3, which disabled it at the C level.
2148 python 2.3, which disabled it at the C level.
2145
2149
2146 2003-11-11 Fernando Perez <fperez@colorado.edu>
2150 2003-11-11 Fernando Perez <fperez@colorado.edu>
2147
2151
2148 * IPython/numutils.py (amap): Added amap() fn. Simple shorthand
2152 * IPython/numutils.py (amap): Added amap() fn. Simple shorthand
2149 for Numeric.array(map(...)), but often convenient.
2153 for Numeric.array(map(...)), but often convenient.
2150
2154
2151 2003-11-05 Fernando Perez <fperez@colorado.edu>
2155 2003-11-05 Fernando Perez <fperez@colorado.edu>
2152
2156
2153 * IPython/numutils.py (frange): Changed a call from int() to
2157 * IPython/numutils.py (frange): Changed a call from int() to
2154 int(round()) to prevent a problem reported with arange() in the
2158 int(round()) to prevent a problem reported with arange() in the
2155 numpy list.
2159 numpy list.
2156
2160
2157 2003-10-06 Fernando Perez <fperez@colorado.edu>
2161 2003-10-06 Fernando Perez <fperez@colorado.edu>
2158
2162
2159 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): changed to
2163 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): changed to
2160 prevent crashes if sys lacks an argv attribute (it happens with
2164 prevent crashes if sys lacks an argv attribute (it happens with
2161 embedded interpreters which build a bare-bones sys module).
2165 embedded interpreters which build a bare-bones sys module).
2162 Thanks to a report/bugfix by Adam Hupp <hupp-AT-cs.wisc.edu>.
2166 Thanks to a report/bugfix by Adam Hupp <hupp-AT-cs.wisc.edu>.
2163
2167
2164 2003-09-24 Fernando Perez <fperez@colorado.edu>
2168 2003-09-24 Fernando Perez <fperez@colorado.edu>
2165
2169
2166 * IPython/Magic.py (Magic._ofind): blanket except around getattr()
2170 * IPython/Magic.py (Magic._ofind): blanket except around getattr()
2167 to protect against poorly written user objects where __getattr__
2171 to protect against poorly written user objects where __getattr__
2168 raises exceptions other than AttributeError. Thanks to a bug
2172 raises exceptions other than AttributeError. Thanks to a bug
2169 report by Oliver Sander <osander-AT-gmx.de>.
2173 report by Oliver Sander <osander-AT-gmx.de>.
2170
2174
2171 * IPython/FakeModule.py (FakeModule.__repr__): this method was
2175 * IPython/FakeModule.py (FakeModule.__repr__): this method was
2172 missing. Thanks to bug report by Ralf Schmitt <ralf-AT-brainbot.com>.
2176 missing. Thanks to bug report by Ralf Schmitt <ralf-AT-brainbot.com>.
2173
2177
2174 2003-09-09 Fernando Perez <fperez@colorado.edu>
2178 2003-09-09 Fernando Perez <fperez@colorado.edu>
2175
2179
2176 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
2180 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
2177 unpacking a list whith a callable as first element would
2181 unpacking a list whith a callable as first element would
2178 mistakenly trigger autocalling. Thanks to a bug report by Jeffery
2182 mistakenly trigger autocalling. Thanks to a bug report by Jeffery
2179 Collins.
2183 Collins.
2180
2184
2181 2003-08-25 *** Released version 0.5.0
2185 2003-08-25 *** Released version 0.5.0
2182
2186
2183 2003-08-22 Fernando Perez <fperez@colorado.edu>
2187 2003-08-22 Fernando Perez <fperez@colorado.edu>
2184
2188
2185 * IPython/ultraTB.py (VerboseTB.linereader): Improved handling of
2189 * IPython/ultraTB.py (VerboseTB.linereader): Improved handling of
2186 improperly defined user exceptions. Thanks to feedback from Mark
2190 improperly defined user exceptions. Thanks to feedback from Mark
2187 Russell <mrussell-AT-verio.net>.
2191 Russell <mrussell-AT-verio.net>.
2188
2192
2189 2003-08-20 Fernando Perez <fperez@colorado.edu>
2193 2003-08-20 Fernando Perez <fperez@colorado.edu>
2190
2194
2191 * IPython/OInspect.py (Inspector.pinfo): changed String Form
2195 * IPython/OInspect.py (Inspector.pinfo): changed String Form
2192 printing so that it would print multi-line string forms starting
2196 printing so that it would print multi-line string forms starting
2193 with a new line. This way the formatting is better respected for
2197 with a new line. This way the formatting is better respected for
2194 objects which work hard to make nice string forms.
2198 objects which work hard to make nice string forms.
2195
2199
2196 * IPython/iplib.py (InteractiveShell.handle_auto): Fix bug where
2200 * IPython/iplib.py (InteractiveShell.handle_auto): Fix bug where
2197 autocall would overtake data access for objects with both
2201 autocall would overtake data access for objects with both
2198 __getitem__ and __call__.
2202 __getitem__ and __call__.
2199
2203
2200 2003-08-19 *** Released version 0.5.0-rc1
2204 2003-08-19 *** Released version 0.5.0-rc1
2201
2205
2202 2003-08-19 Fernando Perez <fperez@colorado.edu>
2206 2003-08-19 Fernando Perez <fperez@colorado.edu>
2203
2207
2204 * IPython/deep_reload.py (load_tail): single tiny change here
2208 * IPython/deep_reload.py (load_tail): single tiny change here
2205 seems to fix the long-standing bug of dreload() failing to work
2209 seems to fix the long-standing bug of dreload() failing to work
2206 for dotted names. But this module is pretty tricky, so I may have
2210 for dotted names. But this module is pretty tricky, so I may have
2207 missed some subtlety. Needs more testing!.
2211 missed some subtlety. Needs more testing!.
2208
2212
2209 * IPython/ultraTB.py (VerboseTB.linereader): harden against user
2213 * IPython/ultraTB.py (VerboseTB.linereader): harden against user
2210 exceptions which have badly implemented __str__ methods.
2214 exceptions which have badly implemented __str__ methods.
2211 (VerboseTB.text): harden against inspect.getinnerframes crashing,
2215 (VerboseTB.text): harden against inspect.getinnerframes crashing,
2212 which I've been getting reports about from Python 2.3 users. I
2216 which I've been getting reports about from Python 2.3 users. I
2213 wish I had a simple test case to reproduce the problem, so I could
2217 wish I had a simple test case to reproduce the problem, so I could
2214 either write a cleaner workaround or file a bug report if
2218 either write a cleaner workaround or file a bug report if
2215 necessary.
2219 necessary.
2216
2220
2217 * IPython/Magic.py (Magic.magic_edit): fixed bug where after
2221 * IPython/Magic.py (Magic.magic_edit): fixed bug where after
2218 making a class 'foo', file 'foo.py' couldn't be edited. Thanks to
2222 making a class 'foo', file 'foo.py' couldn't be edited. Thanks to
2219 a bug report by Tjabo Kloppenburg.
2223 a bug report by Tjabo Kloppenburg.
2220
2224
2221 * IPython/ultraTB.py (VerboseTB.debugger): hardened against pdb
2225 * IPython/ultraTB.py (VerboseTB.debugger): hardened against pdb
2222 crashes. Wrapped the pdb call in a blanket try/except, since pdb
2226 crashes. Wrapped the pdb call in a blanket try/except, since pdb
2223 seems rather unstable. Thanks to a bug report by Tjabo
2227 seems rather unstable. Thanks to a bug report by Tjabo
2224 Kloppenburg <tjabo.kloppenburg-AT-unix-ag.uni-siegen.de>.
2228 Kloppenburg <tjabo.kloppenburg-AT-unix-ag.uni-siegen.de>.
2225
2229
2226 * IPython/Release.py (version): release 0.5.0-rc1. I want to put
2230 * IPython/Release.py (version): release 0.5.0-rc1. I want to put
2227 this out soon because of the critical fixes in the inner loop for
2231 this out soon because of the critical fixes in the inner loop for
2228 generators.
2232 generators.
2229
2233
2230 * IPython/Magic.py (Magic.getargspec): removed. This (and
2234 * IPython/Magic.py (Magic.getargspec): removed. This (and
2231 _get_def) have been obsoleted by OInspect for a long time, I
2235 _get_def) have been obsoleted by OInspect for a long time, I
2232 hadn't noticed that they were dead code.
2236 hadn't noticed that they were dead code.
2233 (Magic._ofind): restored _ofind functionality for a few literals
2237 (Magic._ofind): restored _ofind functionality for a few literals
2234 (those in ["''",'""','[]','{}','()']). But it won't work anymore
2238 (those in ["''",'""','[]','{}','()']). But it won't work anymore
2235 for things like "hello".capitalize?, since that would require a
2239 for things like "hello".capitalize?, since that would require a
2236 potentially dangerous eval() again.
2240 potentially dangerous eval() again.
2237
2241
2238 * IPython/iplib.py (InteractiveShell._prefilter): reorganized the
2242 * IPython/iplib.py (InteractiveShell._prefilter): reorganized the
2239 logic a bit more to clean up the escapes handling and minimize the
2243 logic a bit more to clean up the escapes handling and minimize the
2240 use of _ofind to only necessary cases. The interactive 'feel' of
2244 use of _ofind to only necessary cases. The interactive 'feel' of
2241 IPython should have improved quite a bit with the changes in
2245 IPython should have improved quite a bit with the changes in
2242 _prefilter and _ofind (besides being far safer than before).
2246 _prefilter and _ofind (besides being far safer than before).
2243
2247
2244 * IPython/Magic.py (Magic.magic_edit): Fixed old bug (but rather
2248 * IPython/Magic.py (Magic.magic_edit): Fixed old bug (but rather
2245 obscure, never reported). Edit would fail to find the object to
2249 obscure, never reported). Edit would fail to find the object to
2246 edit under some circumstances.
2250 edit under some circumstances.
2247 (Magic._ofind): CRITICAL FIX. Finally removed the eval() calls
2251 (Magic._ofind): CRITICAL FIX. Finally removed the eval() calls
2248 which were causing double-calling of generators. Those eval calls
2252 which were causing double-calling of generators. Those eval calls
2249 were _very_ dangerous, since code with side effects could be
2253 were _very_ dangerous, since code with side effects could be
2250 triggered. As they say, 'eval is evil'... These were the
2254 triggered. As they say, 'eval is evil'... These were the
2251 nastiest evals in IPython. Besides, _ofind is now far simpler,
2255 nastiest evals in IPython. Besides, _ofind is now far simpler,
2252 and it should also be quite a bit faster. Its use of inspect is
2256 and it should also be quite a bit faster. Its use of inspect is
2253 also safer, so perhaps some of the inspect-related crashes I've
2257 also safer, so perhaps some of the inspect-related crashes I've
2254 seen lately with Python 2.3 might be taken care of. That will
2258 seen lately with Python 2.3 might be taken care of. That will
2255 need more testing.
2259 need more testing.
2256
2260
2257 2003-08-17 Fernando Perez <fperez@colorado.edu>
2261 2003-08-17 Fernando Perez <fperez@colorado.edu>
2258
2262
2259 * IPython/iplib.py (InteractiveShell._prefilter): significant
2263 * IPython/iplib.py (InteractiveShell._prefilter): significant
2260 simplifications to the logic for handling user escapes. Faster
2264 simplifications to the logic for handling user escapes. Faster
2261 and simpler code.
2265 and simpler code.
2262
2266
2263 2003-08-14 Fernando Perez <fperez@colorado.edu>
2267 2003-08-14 Fernando Perez <fperez@colorado.edu>
2264
2268
2265 * IPython/numutils.py (sum_flat): rewrote to be non-recursive.
2269 * IPython/numutils.py (sum_flat): rewrote to be non-recursive.
2266 Now it requires O(N) storage (N=size(a)) for non-contiguous input,
2270 Now it requires O(N) storage (N=size(a)) for non-contiguous input,
2267 but it should be quite a bit faster. And the recursive version
2271 but it should be quite a bit faster. And the recursive version
2268 generated O(log N) intermediate storage for all rank>1 arrays,
2272 generated O(log N) intermediate storage for all rank>1 arrays,
2269 even if they were contiguous.
2273 even if they were contiguous.
2270 (l1norm): Added this function.
2274 (l1norm): Added this function.
2271 (norm): Added this function for arbitrary norms (including
2275 (norm): Added this function for arbitrary norms (including
2272 l-infinity). l1 and l2 are still special cases for convenience
2276 l-infinity). l1 and l2 are still special cases for convenience
2273 and speed.
2277 and speed.
2274
2278
2275 2003-08-03 Fernando Perez <fperez@colorado.edu>
2279 2003-08-03 Fernando Perez <fperez@colorado.edu>
2276
2280
2277 * IPython/Magic.py (Magic.magic_edit): Removed all remaining string
2281 * IPython/Magic.py (Magic.magic_edit): Removed all remaining string
2278 exceptions, which now raise PendingDeprecationWarnings in Python
2282 exceptions, which now raise PendingDeprecationWarnings in Python
2279 2.3. There were some in Magic and some in Gnuplot2.
2283 2.3. There were some in Magic and some in Gnuplot2.
2280
2284
2281 2003-06-30 Fernando Perez <fperez@colorado.edu>
2285 2003-06-30 Fernando Perez <fperez@colorado.edu>
2282
2286
2283 * IPython/genutils.py (page): modified to call curses only for
2287 * IPython/genutils.py (page): modified to call curses only for
2284 terminals where TERM=='xterm'. After problems under many other
2288 terminals where TERM=='xterm'. After problems under many other
2285 terminals were reported by Keith Beattie <KSBeattie-AT-lbl.gov>.
2289 terminals were reported by Keith Beattie <KSBeattie-AT-lbl.gov>.
2286
2290
2287 * IPython/iplib.py (complete): removed spurious 'print "IE"' which
2291 * IPython/iplib.py (complete): removed spurious 'print "IE"' which
2288 would be triggered when readline was absent. This was just an old
2292 would be triggered when readline was absent. This was just an old
2289 debugging statement I'd forgotten to take out.
2293 debugging statement I'd forgotten to take out.
2290
2294
2291 2003-06-20 Fernando Perez <fperez@colorado.edu>
2295 2003-06-20 Fernando Perez <fperez@colorado.edu>
2292
2296
2293 * IPython/genutils.py (clock): modified to return only user time
2297 * IPython/genutils.py (clock): modified to return only user time
2294 (not counting system time), after a discussion on scipy. While
2298 (not counting system time), after a discussion on scipy. While
2295 system time may be a useful quantity occasionally, it may much
2299 system time may be a useful quantity occasionally, it may much
2296 more easily be skewed by occasional swapping or other similar
2300 more easily be skewed by occasional swapping or other similar
2297 activity.
2301 activity.
2298
2302
2299 2003-06-05 Fernando Perez <fperez@colorado.edu>
2303 2003-06-05 Fernando Perez <fperez@colorado.edu>
2300
2304
2301 * IPython/numutils.py (identity): new function, for building
2305 * IPython/numutils.py (identity): new function, for building
2302 arbitrary rank Kronecker deltas (mostly backwards compatible with
2306 arbitrary rank Kronecker deltas (mostly backwards compatible with
2303 Numeric.identity)
2307 Numeric.identity)
2304
2308
2305 2003-06-03 Fernando Perez <fperez@colorado.edu>
2309 2003-06-03 Fernando Perez <fperez@colorado.edu>
2306
2310
2307 * IPython/iplib.py (InteractiveShell.handle_magic): protect
2311 * IPython/iplib.py (InteractiveShell.handle_magic): protect
2308 arguments passed to magics with spaces, to allow trailing '\' to
2312 arguments passed to magics with spaces, to allow trailing '\' to
2309 work normally (mainly for Windows users).
2313 work normally (mainly for Windows users).
2310
2314
2311 2003-05-29 Fernando Perez <fperez@colorado.edu>
2315 2003-05-29 Fernando Perez <fperez@colorado.edu>
2312
2316
2313 * IPython/ipmaker.py (make_IPython): Load site._Helper() as help
2317 * IPython/ipmaker.py (make_IPython): Load site._Helper() as help
2314 instead of pydoc.help. This fixes a bizarre behavior where
2318 instead of pydoc.help. This fixes a bizarre behavior where
2315 printing '%s' % locals() would trigger the help system. Now
2319 printing '%s' % locals() would trigger the help system. Now
2316 ipython behaves like normal python does.
2320 ipython behaves like normal python does.
2317
2321
2318 Note that if one does 'from pydoc import help', the bizarre
2322 Note that if one does 'from pydoc import help', the bizarre
2319 behavior returns, but this will also happen in normal python, so
2323 behavior returns, but this will also happen in normal python, so
2320 it's not an ipython bug anymore (it has to do with how pydoc.help
2324 it's not an ipython bug anymore (it has to do with how pydoc.help
2321 is implemented).
2325 is implemented).
2322
2326
2323 2003-05-22 Fernando Perez <fperez@colorado.edu>
2327 2003-05-22 Fernando Perez <fperez@colorado.edu>
2324
2328
2325 * IPython/FlexCompleter.py (Completer.attr_matches): fixed to
2329 * IPython/FlexCompleter.py (Completer.attr_matches): fixed to
2326 return [] instead of None when nothing matches, also match to end
2330 return [] instead of None when nothing matches, also match to end
2327 of line. Patch by Gary Bishop.
2331 of line. Patch by Gary Bishop.
2328
2332
2329 * IPython/ipmaker.py (make_IPython): Added same sys.excepthook
2333 * IPython/ipmaker.py (make_IPython): Added same sys.excepthook
2330 protection as before, for files passed on the command line. This
2334 protection as before, for files passed on the command line. This
2331 prevents the CrashHandler from kicking in if user files call into
2335 prevents the CrashHandler from kicking in if user files call into
2332 sys.excepthook (such as PyQt and WxWindows have a nasty habit of
2336 sys.excepthook (such as PyQt and WxWindows have a nasty habit of
2333 doing). After a report by Kasper Souren <Kasper.Souren-AT-ircam.fr>
2337 doing). After a report by Kasper Souren <Kasper.Souren-AT-ircam.fr>
2334
2338
2335 2003-05-20 *** Released version 0.4.0
2339 2003-05-20 *** Released version 0.4.0
2336
2340
2337 2003-05-20 Fernando Perez <fperez@colorado.edu>
2341 2003-05-20 Fernando Perez <fperez@colorado.edu>
2338
2342
2339 * setup.py: added support for manpages. It's a bit hackish b/c of
2343 * setup.py: added support for manpages. It's a bit hackish b/c of
2340 a bug in the way the bdist_rpm distutils target handles gzipped
2344 a bug in the way the bdist_rpm distutils target handles gzipped
2341 manpages, but it works. After a patch by Jack.
2345 manpages, but it works. After a patch by Jack.
2342
2346
2343 2003-05-19 Fernando Perez <fperez@colorado.edu>
2347 2003-05-19 Fernando Perez <fperez@colorado.edu>
2344
2348
2345 * IPython/numutils.py: added a mockup of the kinds module, since
2349 * IPython/numutils.py: added a mockup of the kinds module, since
2346 it was recently removed from Numeric. This way, numutils will
2350 it was recently removed from Numeric. This way, numutils will
2347 work for all users even if they are missing kinds.
2351 work for all users even if they are missing kinds.
2348
2352
2349 * IPython/Magic.py (Magic._ofind): Harden against an inspect
2353 * IPython/Magic.py (Magic._ofind): Harden against an inspect
2350 failure, which can occur with SWIG-wrapped extensions. After a
2354 failure, which can occur with SWIG-wrapped extensions. After a
2351 crash report from Prabhu.
2355 crash report from Prabhu.
2352
2356
2353 2003-05-16 Fernando Perez <fperez@colorado.edu>
2357 2003-05-16 Fernando Perez <fperez@colorado.edu>
2354
2358
2355 * IPython/iplib.py (InteractiveShell.excepthook): New method to
2359 * IPython/iplib.py (InteractiveShell.excepthook): New method to
2356 protect ipython from user code which may call directly
2360 protect ipython from user code which may call directly
2357 sys.excepthook (this looks like an ipython crash to the user, even
2361 sys.excepthook (this looks like an ipython crash to the user, even
2358 when it isn't). After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
2362 when it isn't). After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
2359 This is especially important to help users of WxWindows, but may
2363 This is especially important to help users of WxWindows, but may
2360 also be useful in other cases.
2364 also be useful in other cases.
2361
2365
2362 * IPython/ultraTB.py (AutoFormattedTB.__call__): Changed to allow
2366 * IPython/ultraTB.py (AutoFormattedTB.__call__): Changed to allow
2363 an optional tb_offset to be specified, and to preserve exception
2367 an optional tb_offset to be specified, and to preserve exception
2364 info if given. After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
2368 info if given. After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
2365
2369
2366 * ipython.1 (Default): Thanks to Jack's work, we now have manpages!
2370 * ipython.1 (Default): Thanks to Jack's work, we now have manpages!
2367
2371
2368 2003-05-15 Fernando Perez <fperez@colorado.edu>
2372 2003-05-15 Fernando Perez <fperez@colorado.edu>
2369
2373
2370 * IPython/iplib.py (InteractiveShell.user_setup): Fix crash when
2374 * IPython/iplib.py (InteractiveShell.user_setup): Fix crash when
2371 installing for a new user under Windows.
2375 installing for a new user under Windows.
2372
2376
2373 2003-05-12 Fernando Perez <fperez@colorado.edu>
2377 2003-05-12 Fernando Perez <fperez@colorado.edu>
2374
2378
2375 * IPython/iplib.py (InteractiveShell.handle_emacs): New line
2379 * IPython/iplib.py (InteractiveShell.handle_emacs): New line
2376 handler for Emacs comint-based lines. Currently it doesn't do
2380 handler for Emacs comint-based lines. Currently it doesn't do
2377 much (but importantly, it doesn't update the history cache). In
2381 much (but importantly, it doesn't update the history cache). In
2378 the future it may be expanded if Alex needs more functionality
2382 the future it may be expanded if Alex needs more functionality
2379 there.
2383 there.
2380
2384
2381 * IPython/CrashHandler.py (CrashHandler.__call__): Added platform
2385 * IPython/CrashHandler.py (CrashHandler.__call__): Added platform
2382 info to crash reports.
2386 info to crash reports.
2383
2387
2384 * IPython/iplib.py (InteractiveShell.mainloop): Added -c option,
2388 * IPython/iplib.py (InteractiveShell.mainloop): Added -c option,
2385 just like Python's -c. Also fixed crash with invalid -color
2389 just like Python's -c. Also fixed crash with invalid -color
2386 option value at startup. Thanks to Will French
2390 option value at startup. Thanks to Will French
2387 <wfrench-AT-bestweb.net> for the bug report.
2391 <wfrench-AT-bestweb.net> for the bug report.
2388
2392
2389 2003-05-09 Fernando Perez <fperez@colorado.edu>
2393 2003-05-09 Fernando Perez <fperez@colorado.edu>
2390
2394
2391 * IPython/genutils.py (EvalDict.__getitem__): Renamed EvalString
2395 * IPython/genutils.py (EvalDict.__getitem__): Renamed EvalString
2392 to EvalDict (it's a mapping, after all) and simplified its code
2396 to EvalDict (it's a mapping, after all) and simplified its code
2393 quite a bit, after a nice discussion on c.l.py where Gustavo
2397 quite a bit, after a nice discussion on c.l.py where Gustavo
2394 CΓ³rdova <gcordova-AT-sismex.com> suggested the new version.
2398 CΓ³rdova <gcordova-AT-sismex.com> suggested the new version.
2395
2399
2396 2003-04-30 Fernando Perez <fperez@colorado.edu>
2400 2003-04-30 Fernando Perez <fperez@colorado.edu>
2397
2401
2398 * IPython/genutils.py (timings_out): modified it to reduce its
2402 * IPython/genutils.py (timings_out): modified it to reduce its
2399 overhead in the common reps==1 case.
2403 overhead in the common reps==1 case.
2400
2404
2401 2003-04-29 Fernando Perez <fperez@colorado.edu>
2405 2003-04-29 Fernando Perez <fperez@colorado.edu>
2402
2406
2403 * IPython/genutils.py (timings_out): Modified to use the resource
2407 * IPython/genutils.py (timings_out): Modified to use the resource
2404 module, which avoids the wraparound problems of time.clock().
2408 module, which avoids the wraparound problems of time.clock().
2405
2409
2406 2003-04-17 *** Released version 0.2.15pre4
2410 2003-04-17 *** Released version 0.2.15pre4
2407
2411
2408 2003-04-17 Fernando Perez <fperez@colorado.edu>
2412 2003-04-17 Fernando Perez <fperez@colorado.edu>
2409
2413
2410 * setup.py (scriptfiles): Split windows-specific stuff over to a
2414 * setup.py (scriptfiles): Split windows-specific stuff over to a
2411 separate file, in an attempt to have a Windows GUI installer.
2415 separate file, in an attempt to have a Windows GUI installer.
2412 That didn't work, but part of the groundwork is done.
2416 That didn't work, but part of the groundwork is done.
2413
2417
2414 * IPython/UserConfig/ipythonrc: Added M-i, M-o and M-I for
2418 * IPython/UserConfig/ipythonrc: Added M-i, M-o and M-I for
2415 indent/unindent with 4 spaces. Particularly useful in combination
2419 indent/unindent with 4 spaces. Particularly useful in combination
2416 with the new auto-indent option.
2420 with the new auto-indent option.
2417
2421
2418 2003-04-16 Fernando Perez <fperez@colorado.edu>
2422 2003-04-16 Fernando Perez <fperez@colorado.edu>
2419
2423
2420 * IPython/Magic.py: various replacements of self.rc for
2424 * IPython/Magic.py: various replacements of self.rc for
2421 self.shell.rc. A lot more remains to be done to fully disentangle
2425 self.shell.rc. A lot more remains to be done to fully disentangle
2422 this class from the main Shell class.
2426 this class from the main Shell class.
2423
2427
2424 * IPython/GnuplotRuntime.py: added checks for mouse support so
2428 * IPython/GnuplotRuntime.py: added checks for mouse support so
2425 that we don't try to enable it if the current gnuplot doesn't
2429 that we don't try to enable it if the current gnuplot doesn't
2426 really support it. Also added checks so that we don't try to
2430 really support it. Also added checks so that we don't try to
2427 enable persist under Windows (where Gnuplot doesn't recognize the
2431 enable persist under Windows (where Gnuplot doesn't recognize the
2428 option).
2432 option).
2429
2433
2430 * IPython/iplib.py (InteractiveShell.interact): Added optional
2434 * IPython/iplib.py (InteractiveShell.interact): Added optional
2431 auto-indenting code, after a patch by King C. Shu
2435 auto-indenting code, after a patch by King C. Shu
2432 <kingshu-AT-myrealbox.com>. It's off by default because it doesn't
2436 <kingshu-AT-myrealbox.com>. It's off by default because it doesn't
2433 get along well with pasting indented code. If I ever figure out
2437 get along well with pasting indented code. If I ever figure out
2434 how to make that part go well, it will become on by default.
2438 how to make that part go well, it will become on by default.
2435
2439
2436 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixed bug which would
2440 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixed bug which would
2437 crash ipython if there was an unmatched '%' in the user's prompt
2441 crash ipython if there was an unmatched '%' in the user's prompt
2438 string. Reported by Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
2442 string. Reported by Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
2439
2443
2440 * IPython/iplib.py (InteractiveShell.interact): removed the
2444 * IPython/iplib.py (InteractiveShell.interact): removed the
2441 ability to ask the user whether he wants to crash or not at the
2445 ability to ask the user whether he wants to crash or not at the
2442 'last line' exception handler. Calling functions at that point
2446 'last line' exception handler. Calling functions at that point
2443 changes the stack, and the error reports would have incorrect
2447 changes the stack, and the error reports would have incorrect
2444 tracebacks.
2448 tracebacks.
2445
2449
2446 * IPython/Magic.py (Magic.magic_page): Added new @page magic, to
2450 * IPython/Magic.py (Magic.magic_page): Added new @page magic, to
2447 pass through a peger a pretty-printed form of any object. After a
2451 pass through a peger a pretty-printed form of any object. After a
2448 contribution by Olivier Aubert <oaubert-AT-bat710.univ-lyon1.fr>
2452 contribution by Olivier Aubert <oaubert-AT-bat710.univ-lyon1.fr>
2449
2453
2450 2003-04-14 Fernando Perez <fperez@colorado.edu>
2454 2003-04-14 Fernando Perez <fperez@colorado.edu>
2451
2455
2452 * IPython/iplib.py (InteractiveShell.user_setup): Fixed bug where
2456 * IPython/iplib.py (InteractiveShell.user_setup): Fixed bug where
2453 all files in ~ would be modified at first install (instead of
2457 all files in ~ would be modified at first install (instead of
2454 ~/.ipython). This could be potentially disastrous, as the
2458 ~/.ipython). This could be potentially disastrous, as the
2455 modification (make line-endings native) could damage binary files.
2459 modification (make line-endings native) could damage binary files.
2456
2460
2457 2003-04-10 Fernando Perez <fperez@colorado.edu>
2461 2003-04-10 Fernando Perez <fperez@colorado.edu>
2458
2462
2459 * IPython/iplib.py (InteractiveShell.handle_help): Modified to
2463 * IPython/iplib.py (InteractiveShell.handle_help): Modified to
2460 handle only lines which are invalid python. This now means that
2464 handle only lines which are invalid python. This now means that
2461 lines like 'x=1 #?' execute properly. Thanks to Jeffery Collins
2465 lines like 'x=1 #?' execute properly. Thanks to Jeffery Collins
2462 for the bug report.
2466 for the bug report.
2463
2467
2464 2003-04-01 Fernando Perez <fperez@colorado.edu>
2468 2003-04-01 Fernando Perez <fperez@colorado.edu>
2465
2469
2466 * IPython/iplib.py (InteractiveShell.showtraceback): Fixed bug
2470 * IPython/iplib.py (InteractiveShell.showtraceback): Fixed bug
2467 where failing to set sys.last_traceback would crash pdb.pm().
2471 where failing to set sys.last_traceback would crash pdb.pm().
2468 Thanks to Jeffery D. Collins <Jeff.Collins-AT-vexcel.com> for the bug
2472 Thanks to Jeffery D. Collins <Jeff.Collins-AT-vexcel.com> for the bug
2469 report.
2473 report.
2470
2474
2471 2003-03-25 Fernando Perez <fperez@colorado.edu>
2475 2003-03-25 Fernando Perez <fperez@colorado.edu>
2472
2476
2473 * IPython/Magic.py (Magic.magic_prun): rstrip() output of profiler
2477 * IPython/Magic.py (Magic.magic_prun): rstrip() output of profiler
2474 before printing it (it had a lot of spurious blank lines at the
2478 before printing it (it had a lot of spurious blank lines at the
2475 end).
2479 end).
2476
2480
2477 * IPython/Gnuplot2.py (Gnuplot.hardcopy): fixed bug where lpr
2481 * IPython/Gnuplot2.py (Gnuplot.hardcopy): fixed bug where lpr
2478 output would be sent 21 times! Obviously people don't use this
2482 output would be sent 21 times! Obviously people don't use this
2479 too often, or I would have heard about it.
2483 too often, or I would have heard about it.
2480
2484
2481 2003-03-24 Fernando Perez <fperez@colorado.edu>
2485 2003-03-24 Fernando Perez <fperez@colorado.edu>
2482
2486
2483 * setup.py (scriptfiles): renamed the data_files parameter from
2487 * setup.py (scriptfiles): renamed the data_files parameter from
2484 'base' to 'data' to fix rpm build issues. Thanks to Ralf Ahlbrink
2488 'base' to 'data' to fix rpm build issues. Thanks to Ralf Ahlbrink
2485 for the patch.
2489 for the patch.
2486
2490
2487 2003-03-20 Fernando Perez <fperez@colorado.edu>
2491 2003-03-20 Fernando Perez <fperez@colorado.edu>
2488
2492
2489 * IPython/genutils.py (error): added error() and fatal()
2493 * IPython/genutils.py (error): added error() and fatal()
2490 functions.
2494 functions.
2491
2495
2492 2003-03-18 *** Released version 0.2.15pre3
2496 2003-03-18 *** Released version 0.2.15pre3
2493
2497
2494 2003-03-18 Fernando Perez <fperez@colorado.edu>
2498 2003-03-18 Fernando Perez <fperez@colorado.edu>
2495
2499
2496 * setupext/install_data_ext.py
2500 * setupext/install_data_ext.py
2497 (install_data_ext.initialize_options): Class contributed by Jack
2501 (install_data_ext.initialize_options): Class contributed by Jack
2498 Moffit for fixing the old distutils hack. He is sending this to
2502 Moffit for fixing the old distutils hack. He is sending this to
2499 the distutils folks so in the future we may not need it as a
2503 the distutils folks so in the future we may not need it as a
2500 private fix.
2504 private fix.
2501
2505
2502 * MANIFEST.in: Extensive reorganization, based on Jack Moffit's
2506 * MANIFEST.in: Extensive reorganization, based on Jack Moffit's
2503 changes for Debian packaging. See his patch for full details.
2507 changes for Debian packaging. See his patch for full details.
2504 The old distutils hack of making the ipythonrc* files carry a
2508 The old distutils hack of making the ipythonrc* files carry a
2505 bogus .py extension is gone, at last. Examples were moved to a
2509 bogus .py extension is gone, at last. Examples were moved to a
2506 separate subdir under doc/, and the separate executable scripts
2510 separate subdir under doc/, and the separate executable scripts
2507 now live in their own directory. Overall a great cleanup. The
2511 now live in their own directory. Overall a great cleanup. The
2508 manual was updated to use the new files, and setup.py has been
2512 manual was updated to use the new files, and setup.py has been
2509 fixed for this setup.
2513 fixed for this setup.
2510
2514
2511 * IPython/PyColorize.py (Parser.usage): made non-executable and
2515 * IPython/PyColorize.py (Parser.usage): made non-executable and
2512 created a pycolor wrapper around it to be included as a script.
2516 created a pycolor wrapper around it to be included as a script.
2513
2517
2514 2003-03-12 *** Released version 0.2.15pre2
2518 2003-03-12 *** Released version 0.2.15pre2
2515
2519
2516 2003-03-12 Fernando Perez <fperez@colorado.edu>
2520 2003-03-12 Fernando Perez <fperez@colorado.edu>
2517
2521
2518 * IPython/ColorANSI.py (make_color_table): Finally fixed the
2522 * IPython/ColorANSI.py (make_color_table): Finally fixed the
2519 long-standing problem with garbage characters in some terminals.
2523 long-standing problem with garbage characters in some terminals.
2520 The issue was really that the \001 and \002 escapes must _only_ be
2524 The issue was really that the \001 and \002 escapes must _only_ be
2521 passed to input prompts (which call readline), but _never_ to
2525 passed to input prompts (which call readline), but _never_ to
2522 normal text to be printed on screen. I changed ColorANSI to have
2526 normal text to be printed on screen. I changed ColorANSI to have
2523 two classes: TermColors and InputTermColors, each with the
2527 two classes: TermColors and InputTermColors, each with the
2524 appropriate escapes for input prompts or normal text. The code in
2528 appropriate escapes for input prompts or normal text. The code in
2525 Prompts.py got slightly more complicated, but this very old and
2529 Prompts.py got slightly more complicated, but this very old and
2526 annoying bug is finally fixed.
2530 annoying bug is finally fixed.
2527
2531
2528 All the credit for nailing down the real origin of this problem
2532 All the credit for nailing down the real origin of this problem
2529 and the correct solution goes to Jack Moffit <jack-AT-xiph.org>.
2533 and the correct solution goes to Jack Moffit <jack-AT-xiph.org>.
2530 *Many* thanks to him for spending quite a bit of effort on this.
2534 *Many* thanks to him for spending quite a bit of effort on this.
2531
2535
2532 2003-03-05 *** Released version 0.2.15pre1
2536 2003-03-05 *** Released version 0.2.15pre1
2533
2537
2534 2003-03-03 Fernando Perez <fperez@colorado.edu>
2538 2003-03-03 Fernando Perez <fperez@colorado.edu>
2535
2539
2536 * IPython/FakeModule.py: Moved the former _FakeModule to a
2540 * IPython/FakeModule.py: Moved the former _FakeModule to a
2537 separate file, because it's also needed by Magic (to fix a similar
2541 separate file, because it's also needed by Magic (to fix a similar
2538 pickle-related issue in @run).
2542 pickle-related issue in @run).
2539
2543
2540 2003-03-02 Fernando Perez <fperez@colorado.edu>
2544 2003-03-02 Fernando Perez <fperez@colorado.edu>
2541
2545
2542 * IPython/Magic.py (Magic.magic_autocall): new magic to control
2546 * IPython/Magic.py (Magic.magic_autocall): new magic to control
2543 the autocall option at runtime.
2547 the autocall option at runtime.
2544 (Magic.magic_dhist): changed self.user_ns to self.shell.user_ns
2548 (Magic.magic_dhist): changed self.user_ns to self.shell.user_ns
2545 across Magic.py to start separating Magic from InteractiveShell.
2549 across Magic.py to start separating Magic from InteractiveShell.
2546 (Magic._ofind): Fixed to return proper namespace for dotted
2550 (Magic._ofind): Fixed to return proper namespace for dotted
2547 names. Before, a dotted name would always return 'not currently
2551 names. Before, a dotted name would always return 'not currently
2548 defined', because it would find the 'parent'. s.x would be found,
2552 defined', because it would find the 'parent'. s.x would be found,
2549 but since 'x' isn't defined by itself, it would get confused.
2553 but since 'x' isn't defined by itself, it would get confused.
2550 (Magic.magic_run): Fixed pickling problems reported by Ralf
2554 (Magic.magic_run): Fixed pickling problems reported by Ralf
2551 Ahlbrink <RAhlbrink-AT-RosenInspection.net>. The fix was similar to
2555 Ahlbrink <RAhlbrink-AT-RosenInspection.net>. The fix was similar to
2552 that I'd used when Mike Heeter reported similar issues at the
2556 that I'd used when Mike Heeter reported similar issues at the
2553 top-level, but now for @run. It boils down to injecting the
2557 top-level, but now for @run. It boils down to injecting the
2554 namespace where code is being executed with something that looks
2558 namespace where code is being executed with something that looks
2555 enough like a module to fool pickle.dump(). Since a pickle stores
2559 enough like a module to fool pickle.dump(). Since a pickle stores
2556 a named reference to the importing module, we need this for
2560 a named reference to the importing module, we need this for
2557 pickles to save something sensible.
2561 pickles to save something sensible.
2558
2562
2559 * IPython/ipmaker.py (make_IPython): added an autocall option.
2563 * IPython/ipmaker.py (make_IPython): added an autocall option.
2560
2564
2561 * IPython/iplib.py (InteractiveShell._prefilter): reordered all of
2565 * IPython/iplib.py (InteractiveShell._prefilter): reordered all of
2562 the auto-eval code. Now autocalling is an option, and the code is
2566 the auto-eval code. Now autocalling is an option, and the code is
2563 also vastly safer. There is no more eval() involved at all.
2567 also vastly safer. There is no more eval() involved at all.
2564
2568
2565 2003-03-01 Fernando Perez <fperez@colorado.edu>
2569 2003-03-01 Fernando Perez <fperez@colorado.edu>
2566
2570
2567 * IPython/Magic.py (Magic._ofind): Changed interface to return a
2571 * IPython/Magic.py (Magic._ofind): Changed interface to return a
2568 dict with named keys instead of a tuple.
2572 dict with named keys instead of a tuple.
2569
2573
2570 * IPython: Started using CVS for IPython as of 0.2.15pre1.
2574 * IPython: Started using CVS for IPython as of 0.2.15pre1.
2571
2575
2572 * setup.py (make_shortcut): Fixed message about directories
2576 * setup.py (make_shortcut): Fixed message about directories
2573 created during Windows installation (the directories were ok, just
2577 created during Windows installation (the directories were ok, just
2574 the printed message was misleading). Thanks to Chris Liechti
2578 the printed message was misleading). Thanks to Chris Liechti
2575 <cliechti-AT-gmx.net> for the heads up.
2579 <cliechti-AT-gmx.net> for the heads up.
2576
2580
2577 2003-02-21 Fernando Perez <fperez@colorado.edu>
2581 2003-02-21 Fernando Perez <fperez@colorado.edu>
2578
2582
2579 * IPython/iplib.py (InteractiveShell._prefilter): Fixed catching
2583 * IPython/iplib.py (InteractiveShell._prefilter): Fixed catching
2580 of ValueError exception when checking for auto-execution. This
2584 of ValueError exception when checking for auto-execution. This
2581 one is raised by things like Numeric arrays arr.flat when the
2585 one is raised by things like Numeric arrays arr.flat when the
2582 array is non-contiguous.
2586 array is non-contiguous.
2583
2587
2584 2003-01-31 Fernando Perez <fperez@colorado.edu>
2588 2003-01-31 Fernando Perez <fperez@colorado.edu>
2585
2589
2586 * IPython/genutils.py (SystemExec.bq): Fixed bug where bq would
2590 * IPython/genutils.py (SystemExec.bq): Fixed bug where bq would
2587 not return any value at all (even though the command would get
2591 not return any value at all (even though the command would get
2588 executed).
2592 executed).
2589 (xsys): Flush stdout right after printing the command to ensure
2593 (xsys): Flush stdout right after printing the command to ensure
2590 proper ordering of commands and command output in the total
2594 proper ordering of commands and command output in the total
2591 output.
2595 output.
2592 (SystemExec/xsys/bq): Switched the names of xsys/bq and
2596 (SystemExec/xsys/bq): Switched the names of xsys/bq and
2593 system/getoutput as defaults. The old ones are kept for
2597 system/getoutput as defaults. The old ones are kept for
2594 compatibility reasons, so no code which uses this library needs
2598 compatibility reasons, so no code which uses this library needs
2595 changing.
2599 changing.
2596
2600
2597 2003-01-27 *** Released version 0.2.14
2601 2003-01-27 *** Released version 0.2.14
2598
2602
2599 2003-01-25 Fernando Perez <fperez@colorado.edu>
2603 2003-01-25 Fernando Perez <fperez@colorado.edu>
2600
2604
2601 * IPython/Magic.py (Magic.magic_edit): Fixed problem where
2605 * IPython/Magic.py (Magic.magic_edit): Fixed problem where
2602 functions defined in previous edit sessions could not be re-edited
2606 functions defined in previous edit sessions could not be re-edited
2603 (because the temp files were immediately removed). Now temp files
2607 (because the temp files were immediately removed). Now temp files
2604 are removed only at IPython's exit.
2608 are removed only at IPython's exit.
2605 (Magic.magic_run): Improved @run to perform shell-like expansions
2609 (Magic.magic_run): Improved @run to perform shell-like expansions
2606 on its arguments (~users and $VARS). With this, @run becomes more
2610 on its arguments (~users and $VARS). With this, @run becomes more
2607 like a normal command-line.
2611 like a normal command-line.
2608
2612
2609 * IPython/Shell.py (IPShellEmbed.__call__): Fixed a bunch of small
2613 * IPython/Shell.py (IPShellEmbed.__call__): Fixed a bunch of small
2610 bugs related to embedding and cleaned up that code. A fairly
2614 bugs related to embedding and cleaned up that code. A fairly
2611 important one was the impossibility to access the global namespace
2615 important one was the impossibility to access the global namespace
2612 through the embedded IPython (only local variables were visible).
2616 through the embedded IPython (only local variables were visible).
2613
2617
2614 2003-01-14 Fernando Perez <fperez@colorado.edu>
2618 2003-01-14 Fernando Perez <fperez@colorado.edu>
2615
2619
2616 * IPython/iplib.py (InteractiveShell._prefilter): Fixed
2620 * IPython/iplib.py (InteractiveShell._prefilter): Fixed
2617 auto-calling to be a bit more conservative. Now it doesn't get
2621 auto-calling to be a bit more conservative. Now it doesn't get
2618 triggered if any of '!=()<>' are in the rest of the input line, to
2622 triggered if any of '!=()<>' are in the rest of the input line, to
2619 allow comparing callables. Thanks to Alex for the heads up.
2623 allow comparing callables. Thanks to Alex for the heads up.
2620
2624
2621 2003-01-07 Fernando Perez <fperez@colorado.edu>
2625 2003-01-07 Fernando Perez <fperez@colorado.edu>
2622
2626
2623 * IPython/genutils.py (page): fixed estimation of the number of
2627 * IPython/genutils.py (page): fixed estimation of the number of
2624 lines in a string to be paged to simply count newlines. This
2628 lines in a string to be paged to simply count newlines. This
2625 prevents over-guessing due to embedded escape sequences. A better
2629 prevents over-guessing due to embedded escape sequences. A better
2626 long-term solution would involve stripping out the control chars
2630 long-term solution would involve stripping out the control chars
2627 for the count, but it's potentially so expensive I just don't
2631 for the count, but it's potentially so expensive I just don't
2628 think it's worth doing.
2632 think it's worth doing.
2629
2633
2630 2002-12-19 *** Released version 0.2.14pre50
2634 2002-12-19 *** Released version 0.2.14pre50
2631
2635
2632 2002-12-19 Fernando Perez <fperez@colorado.edu>
2636 2002-12-19 Fernando Perez <fperez@colorado.edu>
2633
2637
2634 * tools/release (version): Changed release scripts to inform
2638 * tools/release (version): Changed release scripts to inform
2635 Andrea and build a NEWS file with a list of recent changes.
2639 Andrea and build a NEWS file with a list of recent changes.
2636
2640
2637 * IPython/ColorANSI.py (__all__): changed terminal detection
2641 * IPython/ColorANSI.py (__all__): changed terminal detection
2638 code. Seems to work better for xterms without breaking
2642 code. Seems to work better for xterms without breaking
2639 konsole. Will need more testing to determine if WinXP and Mac OSX
2643 konsole. Will need more testing to determine if WinXP and Mac OSX
2640 also work ok.
2644 also work ok.
2641
2645
2642 2002-12-18 *** Released version 0.2.14pre49
2646 2002-12-18 *** Released version 0.2.14pre49
2643
2647
2644 2002-12-18 Fernando Perez <fperez@colorado.edu>
2648 2002-12-18 Fernando Perez <fperez@colorado.edu>
2645
2649
2646 * Docs: added new info about Mac OSX, from Andrea.
2650 * Docs: added new info about Mac OSX, from Andrea.
2647
2651
2648 * IPython/Gnuplot2.py (String): Added a String PlotItem class to
2652 * IPython/Gnuplot2.py (String): Added a String PlotItem class to
2649 allow direct plotting of python strings whose format is the same
2653 allow direct plotting of python strings whose format is the same
2650 of gnuplot data files.
2654 of gnuplot data files.
2651
2655
2652 2002-12-16 Fernando Perez <fperez@colorado.edu>
2656 2002-12-16 Fernando Perez <fperez@colorado.edu>
2653
2657
2654 * IPython/iplib.py (InteractiveShell.interact): fixed default (y)
2658 * IPython/iplib.py (InteractiveShell.interact): fixed default (y)
2655 value of exit question to be acknowledged.
2659 value of exit question to be acknowledged.
2656
2660
2657 2002-12-03 Fernando Perez <fperez@colorado.edu>
2661 2002-12-03 Fernando Perez <fperez@colorado.edu>
2658
2662
2659 * IPython/ipmaker.py: removed generators, which had been added
2663 * IPython/ipmaker.py: removed generators, which had been added
2660 by mistake in an earlier debugging run. This was causing trouble
2664 by mistake in an earlier debugging run. This was causing trouble
2661 to users of python 2.1.x. Thanks to Abel Daniel <abli-AT-freemail.hu>
2665 to users of python 2.1.x. Thanks to Abel Daniel <abli-AT-freemail.hu>
2662 for pointing this out.
2666 for pointing this out.
2663
2667
2664 2002-11-17 Fernando Perez <fperez@colorado.edu>
2668 2002-11-17 Fernando Perez <fperez@colorado.edu>
2665
2669
2666 * Manual: updated the Gnuplot section.
2670 * Manual: updated the Gnuplot section.
2667
2671
2668 * IPython/GnuplotRuntime.py: refactored a lot all this code, with
2672 * IPython/GnuplotRuntime.py: refactored a lot all this code, with
2669 a much better split of what goes in Runtime and what goes in
2673 a much better split of what goes in Runtime and what goes in
2670 Interactive.
2674 Interactive.
2671
2675
2672 * IPython/ipmaker.py: fixed bug where import_fail_info wasn't
2676 * IPython/ipmaker.py: fixed bug where import_fail_info wasn't
2673 being imported from iplib.
2677 being imported from iplib.
2674
2678
2675 * IPython/GnuplotInteractive.py (magic_gpc): renamed @gp to @gpc
2679 * IPython/GnuplotInteractive.py (magic_gpc): renamed @gp to @gpc
2676 for command-passing. Now the global Gnuplot instance is called
2680 for command-passing. Now the global Gnuplot instance is called
2677 'gp' instead of 'g', which was really a far too fragile and
2681 'gp' instead of 'g', which was really a far too fragile and
2678 common name.
2682 common name.
2679
2683
2680 * IPython/Gnuplot2.py (eps_fix_bbox): added this to fix broken
2684 * IPython/Gnuplot2.py (eps_fix_bbox): added this to fix broken
2681 bounding boxes generated by Gnuplot for square plots.
2685 bounding boxes generated by Gnuplot for square plots.
2682
2686
2683 * IPython/genutils.py (popkey): new function added. I should
2687 * IPython/genutils.py (popkey): new function added. I should
2684 suggest this on c.l.py as a dict method, it seems useful.
2688 suggest this on c.l.py as a dict method, it seems useful.
2685
2689
2686 * IPython/Gnuplot2.py (Gnuplot.plot): Overhauled plot and replot
2690 * IPython/Gnuplot2.py (Gnuplot.plot): Overhauled plot and replot
2687 to transparently handle PostScript generation. MUCH better than
2691 to transparently handle PostScript generation. MUCH better than
2688 the previous plot_eps/replot_eps (which I removed now). The code
2692 the previous plot_eps/replot_eps (which I removed now). The code
2689 is also fairly clean and well documented now (including
2693 is also fairly clean and well documented now (including
2690 docstrings).
2694 docstrings).
2691
2695
2692 2002-11-13 Fernando Perez <fperez@colorado.edu>
2696 2002-11-13 Fernando Perez <fperez@colorado.edu>
2693
2697
2694 * IPython/Magic.py (Magic.magic_edit): fixed docstring
2698 * IPython/Magic.py (Magic.magic_edit): fixed docstring
2695 (inconsistent with options).
2699 (inconsistent with options).
2696
2700
2697 * IPython/Gnuplot2.py (Gnuplot.hardcopy): hardcopy had been
2701 * IPython/Gnuplot2.py (Gnuplot.hardcopy): hardcopy had been
2698 manually disabled, I don't know why. Fixed it.
2702 manually disabled, I don't know why. Fixed it.
2699 (Gnuplot._plot_eps): added new plot_eps/replot_eps to get directly
2703 (Gnuplot._plot_eps): added new plot_eps/replot_eps to get directly
2700 eps output.
2704 eps output.
2701
2705
2702 2002-11-12 Fernando Perez <fperez@colorado.edu>
2706 2002-11-12 Fernando Perez <fperez@colorado.edu>
2703
2707
2704 * IPython/genutils.py (ask_yes_no): trap EOF and ^C so that they
2708 * IPython/genutils.py (ask_yes_no): trap EOF and ^C so that they
2705 don't propagate up to caller. Fixes crash reported by François
2709 don't propagate up to caller. Fixes crash reported by François
2706 Pinard.
2710 Pinard.
2707
2711
2708 2002-11-09 Fernando Perez <fperez@colorado.edu>
2712 2002-11-09 Fernando Perez <fperez@colorado.edu>
2709
2713
2710 * IPython/ipmaker.py (make_IPython): fixed problem with writing
2714 * IPython/ipmaker.py (make_IPython): fixed problem with writing
2711 history file for new users.
2715 history file for new users.
2712 (make_IPython): fixed bug where initial install would leave the
2716 (make_IPython): fixed bug where initial install would leave the
2713 user running in the .ipython dir.
2717 user running in the .ipython dir.
2714 (make_IPython): fixed bug where config dir .ipython would be
2718 (make_IPython): fixed bug where config dir .ipython would be
2715 created regardless of the given -ipythondir option. Thanks to Cory
2719 created regardless of the given -ipythondir option. Thanks to Cory
2716 Dodt <cdodt-AT-fcoe.k12.ca.us> for the bug report.
2720 Dodt <cdodt-AT-fcoe.k12.ca.us> for the bug report.
2717
2721
2718 * IPython/genutils.py (ask_yes_no): new function for asking yes/no
2722 * IPython/genutils.py (ask_yes_no): new function for asking yes/no
2719 type confirmations. Will need to use it in all of IPython's code
2723 type confirmations. Will need to use it in all of IPython's code
2720 consistently.
2724 consistently.
2721
2725
2722 * IPython/CrashHandler.py (CrashHandler.__call__): changed the
2726 * IPython/CrashHandler.py (CrashHandler.__call__): changed the
2723 context to print 31 lines instead of the default 5. This will make
2727 context to print 31 lines instead of the default 5. This will make
2724 the crash reports extremely detailed in case the problem is in
2728 the crash reports extremely detailed in case the problem is in
2725 libraries I don't have access to.
2729 libraries I don't have access to.
2726
2730
2727 * IPython/iplib.py (InteractiveShell.interact): changed the 'last
2731 * IPython/iplib.py (InteractiveShell.interact): changed the 'last
2728 line of defense' code to still crash, but giving users fair
2732 line of defense' code to still crash, but giving users fair
2729 warning. I don't want internal errors to go unreported: if there's
2733 warning. I don't want internal errors to go unreported: if there's
2730 an internal problem, IPython should crash and generate a full
2734 an internal problem, IPython should crash and generate a full
2731 report.
2735 report.
2732
2736
2733 2002-11-08 Fernando Perez <fperez@colorado.edu>
2737 2002-11-08 Fernando Perez <fperez@colorado.edu>
2734
2738
2735 * IPython/iplib.py (InteractiveShell.interact): added code to trap
2739 * IPython/iplib.py (InteractiveShell.interact): added code to trap
2736 otherwise uncaught exceptions which can appear if people set
2740 otherwise uncaught exceptions which can appear if people set
2737 sys.stdout to something badly broken. Thanks to a crash report
2741 sys.stdout to something badly broken. Thanks to a crash report
2738 from henni-AT-mail.brainbot.com.
2742 from henni-AT-mail.brainbot.com.
2739
2743
2740 2002-11-04 Fernando Perez <fperez@colorado.edu>
2744 2002-11-04 Fernando Perez <fperez@colorado.edu>
2741
2745
2742 * IPython/iplib.py (InteractiveShell.interact): added
2746 * IPython/iplib.py (InteractiveShell.interact): added
2743 __IPYTHON__active to the builtins. It's a flag which goes on when
2747 __IPYTHON__active to the builtins. It's a flag which goes on when
2744 the interaction starts and goes off again when it stops. This
2748 the interaction starts and goes off again when it stops. This
2745 allows embedding code to detect being inside IPython. Before this
2749 allows embedding code to detect being inside IPython. Before this
2746 was done via __IPYTHON__, but that only shows that an IPython
2750 was done via __IPYTHON__, but that only shows that an IPython
2747 instance has been created.
2751 instance has been created.
2748
2752
2749 * IPython/Magic.py (Magic.magic_env): I realized that in a
2753 * IPython/Magic.py (Magic.magic_env): I realized that in a
2750 UserDict, instance.data holds the data as a normal dict. So I
2754 UserDict, instance.data holds the data as a normal dict. So I
2751 modified @env to return os.environ.data instead of rebuilding a
2755 modified @env to return os.environ.data instead of rebuilding a
2752 dict by hand.
2756 dict by hand.
2753
2757
2754 2002-11-02 Fernando Perez <fperez@colorado.edu>
2758 2002-11-02 Fernando Perez <fperez@colorado.edu>
2755
2759
2756 * IPython/genutils.py (warn): changed so that level 1 prints no
2760 * IPython/genutils.py (warn): changed so that level 1 prints no
2757 header. Level 2 is now the default (with 'WARNING' header, as
2761 header. Level 2 is now the default (with 'WARNING' header, as
2758 before). I think I tracked all places where changes were needed in
2762 before). I think I tracked all places where changes were needed in
2759 IPython, but outside code using the old level numbering may have
2763 IPython, but outside code using the old level numbering may have
2760 broken.
2764 broken.
2761
2765
2762 * IPython/iplib.py (InteractiveShell.runcode): added this to
2766 * IPython/iplib.py (InteractiveShell.runcode): added this to
2763 handle the tracebacks in SystemExit traps correctly. The previous
2767 handle the tracebacks in SystemExit traps correctly. The previous
2764 code (through interact) was printing more of the stack than
2768 code (through interact) was printing more of the stack than
2765 necessary, showing IPython internal code to the user.
2769 necessary, showing IPython internal code to the user.
2766
2770
2767 * IPython/UserConfig/ipythonrc.py: Made confirm_exit 1 by
2771 * IPython/UserConfig/ipythonrc.py: Made confirm_exit 1 by
2768 default. Now that the default at the confirmation prompt is yes,
2772 default. Now that the default at the confirmation prompt is yes,
2769 it's not so intrusive. François' argument that ipython sessions
2773 it's not so intrusive. François' argument that ipython sessions
2770 tend to be complex enough not to lose them from an accidental C-d,
2774 tend to be complex enough not to lose them from an accidental C-d,
2771 is a valid one.
2775 is a valid one.
2772
2776
2773 * IPython/iplib.py (InteractiveShell.interact): added a
2777 * IPython/iplib.py (InteractiveShell.interact): added a
2774 showtraceback() call to the SystemExit trap, and modified the exit
2778 showtraceback() call to the SystemExit trap, and modified the exit
2775 confirmation to have yes as the default.
2779 confirmation to have yes as the default.
2776
2780
2777 * IPython/UserConfig/ipythonrc.py: removed 'session' option from
2781 * IPython/UserConfig/ipythonrc.py: removed 'session' option from
2778 this file. It's been gone from the code for a long time, this was
2782 this file. It's been gone from the code for a long time, this was
2779 simply leftover junk.
2783 simply leftover junk.
2780
2784
2781 2002-11-01 Fernando Perez <fperez@colorado.edu>
2785 2002-11-01 Fernando Perez <fperez@colorado.edu>
2782
2786
2783 * IPython/UserConfig/ipythonrc.py: new confirm_exit option
2787 * IPython/UserConfig/ipythonrc.py: new confirm_exit option
2784 added. If set, IPython now traps EOF and asks for
2788 added. If set, IPython now traps EOF and asks for
2785 confirmation. After a request by François Pinard.
2789 confirmation. After a request by François Pinard.
2786
2790
2787 * IPython/Magic.py (Magic.magic_Exit): New @Exit and @Quit instead
2791 * IPython/Magic.py (Magic.magic_Exit): New @Exit and @Quit instead
2788 of @abort, and with a new (better) mechanism for handling the
2792 of @abort, and with a new (better) mechanism for handling the
2789 exceptions.
2793 exceptions.
2790
2794
2791 2002-10-27 Fernando Perez <fperez@colorado.edu>
2795 2002-10-27 Fernando Perez <fperez@colorado.edu>
2792
2796
2793 * IPython/usage.py (__doc__): updated the --help information and
2797 * IPython/usage.py (__doc__): updated the --help information and
2794 the ipythonrc file to indicate that -log generates
2798 the ipythonrc file to indicate that -log generates
2795 ./ipython.log. Also fixed the corresponding info in @logstart.
2799 ./ipython.log. Also fixed the corresponding info in @logstart.
2796 This and several other fixes in the manuals thanks to reports by
2800 This and several other fixes in the manuals thanks to reports by
2797 François Pinard <pinard-AT-iro.umontreal.ca>.
2801 François Pinard <pinard-AT-iro.umontreal.ca>.
2798
2802
2799 * IPython/Logger.py (Logger.switch_log): Fixed error message to
2803 * IPython/Logger.py (Logger.switch_log): Fixed error message to
2800 refer to @logstart (instead of @log, which doesn't exist).
2804 refer to @logstart (instead of @log, which doesn't exist).
2801
2805
2802 * IPython/iplib.py (InteractiveShell._prefilter): fixed
2806 * IPython/iplib.py (InteractiveShell._prefilter): fixed
2803 AttributeError crash. Thanks to Christopher Armstrong
2807 AttributeError crash. Thanks to Christopher Armstrong
2804 <radix-AT-twistedmatrix.com> for the report/fix. This bug had been
2808 <radix-AT-twistedmatrix.com> for the report/fix. This bug had been
2805 introduced recently (in 0.2.14pre37) with the fix to the eval
2809 introduced recently (in 0.2.14pre37) with the fix to the eval
2806 problem mentioned below.
2810 problem mentioned below.
2807
2811
2808 2002-10-17 Fernando Perez <fperez@colorado.edu>
2812 2002-10-17 Fernando Perez <fperez@colorado.edu>
2809
2813
2810 * IPython/ConfigLoader.py (ConfigLoader.load): Fixes for Windows
2814 * IPython/ConfigLoader.py (ConfigLoader.load): Fixes for Windows
2811 installation. Thanks to Leonardo Santagada <retype-AT-terra.com.br>.
2815 installation. Thanks to Leonardo Santagada <retype-AT-terra.com.br>.
2812
2816
2813 * IPython/iplib.py (InteractiveShell._prefilter): Many changes to
2817 * IPython/iplib.py (InteractiveShell._prefilter): Many changes to
2814 this function to fix a problem reported by Alex Schmolck. He saw
2818 this function to fix a problem reported by Alex Schmolck. He saw
2815 it with list comprehensions and generators, which were getting
2819 it with list comprehensions and generators, which were getting
2816 called twice. The real problem was an 'eval' call in testing for
2820 called twice. The real problem was an 'eval' call in testing for
2817 automagic which was evaluating the input line silently.
2821 automagic which was evaluating the input line silently.
2818
2822
2819 This is a potentially very nasty bug, if the input has side
2823 This is a potentially very nasty bug, if the input has side
2820 effects which must not be repeated. The code is much cleaner now,
2824 effects which must not be repeated. The code is much cleaner now,
2821 without any blanket 'except' left and with a regexp test for
2825 without any blanket 'except' left and with a regexp test for
2822 actual function names.
2826 actual function names.
2823
2827
2824 But an eval remains, which I'm not fully comfortable with. I just
2828 But an eval remains, which I'm not fully comfortable with. I just
2825 don't know how to find out if an expression could be a callable in
2829 don't know how to find out if an expression could be a callable in
2826 the user's namespace without doing an eval on the string. However
2830 the user's namespace without doing an eval on the string. However
2827 that string is now much more strictly checked so that no code
2831 that string is now much more strictly checked so that no code
2828 slips by, so the eval should only happen for things that can
2832 slips by, so the eval should only happen for things that can
2829 really be only function/method names.
2833 really be only function/method names.
2830
2834
2831 2002-10-15 Fernando Perez <fperez@colorado.edu>
2835 2002-10-15 Fernando Perez <fperez@colorado.edu>
2832
2836
2833 * Updated LyX to 1.2.1 so I can work on the docs again. Added Mac
2837 * Updated LyX to 1.2.1 so I can work on the docs again. Added Mac
2834 OSX information to main manual, removed README_Mac_OSX file from
2838 OSX information to main manual, removed README_Mac_OSX file from
2835 distribution. Also updated credits for recent additions.
2839 distribution. Also updated credits for recent additions.
2836
2840
2837 2002-10-10 Fernando Perez <fperez@colorado.edu>
2841 2002-10-10 Fernando Perez <fperez@colorado.edu>
2838
2842
2839 * README_Mac_OSX: Added a README for Mac OSX users for fixing
2843 * README_Mac_OSX: Added a README for Mac OSX users for fixing
2840 terminal-related issues. Many thanks to Andrea Riciputi
2844 terminal-related issues. Many thanks to Andrea Riciputi
2841 <andrea.riciputi-AT-libero.it> for writing it.
2845 <andrea.riciputi-AT-libero.it> for writing it.
2842
2846
2843 * IPython/UserConfig/ipythonrc.py: Fixes to various small issues,
2847 * IPython/UserConfig/ipythonrc.py: Fixes to various small issues,
2844 thanks to Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
2848 thanks to Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
2845
2849
2846 * setup.py (make_shortcut): Fixes for Windows installation. Thanks
2850 * setup.py (make_shortcut): Fixes for Windows installation. Thanks
2847 to Fredrik Kant <fredrik.kant-AT-front.com> and Syver Enstad
2851 to Fredrik Kant <fredrik.kant-AT-front.com> and Syver Enstad
2848 <syver-en-AT-online.no> who both submitted patches for this problem.
2852 <syver-en-AT-online.no> who both submitted patches for this problem.
2849
2853
2850 * IPython/iplib.py (InteractiveShell.embed_mainloop): Patch for
2854 * IPython/iplib.py (InteractiveShell.embed_mainloop): Patch for
2851 global embedding to make sure that things don't overwrite user
2855 global embedding to make sure that things don't overwrite user
2852 globals accidentally. Thanks to Richard <rxe-AT-renre-europe.com>
2856 globals accidentally. Thanks to Richard <rxe-AT-renre-europe.com>
2853
2857
2854 * IPython/Gnuplot2.py (gp): Patch for Gnuplot.py 1.6
2858 * IPython/Gnuplot2.py (gp): Patch for Gnuplot.py 1.6
2855 compatibility. Thanks to Hayden Callow
2859 compatibility. Thanks to Hayden Callow
2856 <h.callow-AT-elec.canterbury.ac.nz>
2860 <h.callow-AT-elec.canterbury.ac.nz>
2857
2861
2858 2002-10-04 Fernando Perez <fperez@colorado.edu>
2862 2002-10-04 Fernando Perez <fperez@colorado.edu>
2859
2863
2860 * IPython/Gnuplot2.py (PlotItem): Added 'index' option for
2864 * IPython/Gnuplot2.py (PlotItem): Added 'index' option for
2861 Gnuplot.File objects.
2865 Gnuplot.File objects.
2862
2866
2863 2002-07-23 Fernando Perez <fperez@colorado.edu>
2867 2002-07-23 Fernando Perez <fperez@colorado.edu>
2864
2868
2865 * IPython/genutils.py (timing): Added timings() and timing() for
2869 * IPython/genutils.py (timing): Added timings() and timing() for
2866 quick access to the most commonly needed data, the execution
2870 quick access to the most commonly needed data, the execution
2867 times. Old timing() renamed to timings_out().
2871 times. Old timing() renamed to timings_out().
2868
2872
2869 2002-07-18 Fernando Perez <fperez@colorado.edu>
2873 2002-07-18 Fernando Perez <fperez@colorado.edu>
2870
2874
2871 * IPython/Shell.py (IPShellEmbed.restore_system_completer): fixed
2875 * IPython/Shell.py (IPShellEmbed.restore_system_completer): fixed
2872 bug with nested instances disrupting the parent's tab completion.
2876 bug with nested instances disrupting the parent's tab completion.
2873
2877
2874 * IPython/iplib.py (all_completions): Added Alex Schmolck's
2878 * IPython/iplib.py (all_completions): Added Alex Schmolck's
2875 all_completions code to begin the emacs integration.
2879 all_completions code to begin the emacs integration.
2876
2880
2877 * IPython/Gnuplot2.py (zip_items): Added optional 'titles'
2881 * IPython/Gnuplot2.py (zip_items): Added optional 'titles'
2878 argument to allow titling individual arrays when plotting.
2882 argument to allow titling individual arrays when plotting.
2879
2883
2880 2002-07-15 Fernando Perez <fperez@colorado.edu>
2884 2002-07-15 Fernando Perez <fperez@colorado.edu>
2881
2885
2882 * setup.py (make_shortcut): changed to retrieve the value of
2886 * setup.py (make_shortcut): changed to retrieve the value of
2883 'Program Files' directory from the registry (this value changes in
2887 'Program Files' directory from the registry (this value changes in
2884 non-english versions of Windows). Thanks to Thomas Fanslau
2888 non-english versions of Windows). Thanks to Thomas Fanslau
2885 <tfanslau-AT-gmx.de> for the report.
2889 <tfanslau-AT-gmx.de> for the report.
2886
2890
2887 2002-07-10 Fernando Perez <fperez@colorado.edu>
2891 2002-07-10 Fernando Perez <fperez@colorado.edu>
2888
2892
2889 * IPython/ultraTB.py (VerboseTB.debugger): enabled workaround for
2893 * IPython/ultraTB.py (VerboseTB.debugger): enabled workaround for
2890 a bug in pdb, which crashes if a line with only whitespace is
2894 a bug in pdb, which crashes if a line with only whitespace is
2891 entered. Bug report submitted to sourceforge.
2895 entered. Bug report submitted to sourceforge.
2892
2896
2893 2002-07-09 Fernando Perez <fperez@colorado.edu>
2897 2002-07-09 Fernando Perez <fperez@colorado.edu>
2894
2898
2895 * IPython/ultraTB.py (VerboseTB.nullrepr): fixed rare crash when
2899 * IPython/ultraTB.py (VerboseTB.nullrepr): fixed rare crash when
2896 reporting exceptions (it's a bug in inspect.py, I just set a
2900 reporting exceptions (it's a bug in inspect.py, I just set a
2897 workaround).
2901 workaround).
2898
2902
2899 2002-07-08 Fernando Perez <fperez@colorado.edu>
2903 2002-07-08 Fernando Perez <fperez@colorado.edu>
2900
2904
2901 * IPython/iplib.py (InteractiveShell.__init__): fixed reference to
2905 * IPython/iplib.py (InteractiveShell.__init__): fixed reference to
2902 __IPYTHON__ in __builtins__ to show up in user_ns.
2906 __IPYTHON__ in __builtins__ to show up in user_ns.
2903
2907
2904 2002-07-03 Fernando Perez <fperez@colorado.edu>
2908 2002-07-03 Fernando Perez <fperez@colorado.edu>
2905
2909
2906 * IPython/GnuplotInteractive.py (magic_gp_set_default): changed
2910 * IPython/GnuplotInteractive.py (magic_gp_set_default): changed
2907 name from @gp_set_instance to @gp_set_default.
2911 name from @gp_set_instance to @gp_set_default.
2908
2912
2909 * IPython/ipmaker.py (make_IPython): default editor value set to
2913 * IPython/ipmaker.py (make_IPython): default editor value set to
2910 '0' (a string), to match the rc file. Otherwise will crash when
2914 '0' (a string), to match the rc file. Otherwise will crash when
2911 .strip() is called on it.
2915 .strip() is called on it.
2912
2916
2913
2917
2914 2002-06-28 Fernando Perez <fperez@colorado.edu>
2918 2002-06-28 Fernando Perez <fperez@colorado.edu>
2915
2919
2916 * IPython/iplib.py (InteractiveShell.safe_execfile): fix importing
2920 * IPython/iplib.py (InteractiveShell.safe_execfile): fix importing
2917 of files in current directory when a file is executed via
2921 of files in current directory when a file is executed via
2918 @run. Patch also by RA <ralf_ahlbrink-AT-web.de>.
2922 @run. Patch also by RA <ralf_ahlbrink-AT-web.de>.
2919
2923
2920 * setup.py (manfiles): fix for rpm builds, submitted by RA
2924 * setup.py (manfiles): fix for rpm builds, submitted by RA
2921 <ralf_ahlbrink-AT-web.de>. Now we have RPMs!
2925 <ralf_ahlbrink-AT-web.de>. Now we have RPMs!
2922
2926
2923 * IPython/ipmaker.py (make_IPython): fixed lookup of default
2927 * IPython/ipmaker.py (make_IPython): fixed lookup of default
2924 editor when set to '0'. Problem was, '0' evaluates to True (it's a
2928 editor when set to '0'. Problem was, '0' evaluates to True (it's a
2925 string!). A. Schmolck caught this one.
2929 string!). A. Schmolck caught this one.
2926
2930
2927 2002-06-27 Fernando Perez <fperez@colorado.edu>
2931 2002-06-27 Fernando Perez <fperez@colorado.edu>
2928
2932
2929 * IPython/ipmaker.py (make_IPython): fixed bug when running user
2933 * IPython/ipmaker.py (make_IPython): fixed bug when running user
2930 defined files at the cmd line. __name__ wasn't being set to
2934 defined files at the cmd line. __name__ wasn't being set to
2931 __main__.
2935 __main__.
2932
2936
2933 * IPython/Gnuplot2.py (zip_items): improved it so it can plot also
2937 * IPython/Gnuplot2.py (zip_items): improved it so it can plot also
2934 regular lists and tuples besides Numeric arrays.
2938 regular lists and tuples besides Numeric arrays.
2935
2939
2936 * IPython/Prompts.py (CachedOutput.__call__): Added output
2940 * IPython/Prompts.py (CachedOutput.__call__): Added output
2937 supression for input ending with ';'. Similar to Mathematica and
2941 supression for input ending with ';'. Similar to Mathematica and
2938 Matlab. The _* vars and Out[] list are still updated, just like
2942 Matlab. The _* vars and Out[] list are still updated, just like
2939 Mathematica behaves.
2943 Mathematica behaves.
2940
2944
2941 2002-06-25 Fernando Perez <fperez@colorado.edu>
2945 2002-06-25 Fernando Perez <fperez@colorado.edu>
2942
2946
2943 * IPython/ConfigLoader.py (ConfigLoader.load): fixed checking of
2947 * IPython/ConfigLoader.py (ConfigLoader.load): fixed checking of
2944 .ini extensions for profiels under Windows.
2948 .ini extensions for profiels under Windows.
2945
2949
2946 * IPython/OInspect.py (Inspector.pinfo): improved alignment of
2950 * IPython/OInspect.py (Inspector.pinfo): improved alignment of
2947 string form. Fix contributed by Alexander Schmolck
2951 string form. Fix contributed by Alexander Schmolck
2948 <a.schmolck-AT-gmx.net>
2952 <a.schmolck-AT-gmx.net>
2949
2953
2950 * IPython/GnuplotRuntime.py (gp_new): new function. Returns a
2954 * IPython/GnuplotRuntime.py (gp_new): new function. Returns a
2951 pre-configured Gnuplot instance.
2955 pre-configured Gnuplot instance.
2952
2956
2953 2002-06-21 Fernando Perez <fperez@colorado.edu>
2957 2002-06-21 Fernando Perez <fperez@colorado.edu>
2954
2958
2955 * IPython/numutils.py (exp_safe): new function, works around the
2959 * IPython/numutils.py (exp_safe): new function, works around the
2956 underflow problems in Numeric.
2960 underflow problems in Numeric.
2957 (log2): New fn. Safe log in base 2: returns exact integer answer
2961 (log2): New fn. Safe log in base 2: returns exact integer answer
2958 for exact integer powers of 2.
2962 for exact integer powers of 2.
2959
2963
2960 * IPython/Magic.py (get_py_filename): fixed it not expanding '~'
2964 * IPython/Magic.py (get_py_filename): fixed it not expanding '~'
2961 properly.
2965 properly.
2962
2966
2963 2002-06-20 Fernando Perez <fperez@colorado.edu>
2967 2002-06-20 Fernando Perez <fperez@colorado.edu>
2964
2968
2965 * IPython/genutils.py (timing): new function like
2969 * IPython/genutils.py (timing): new function like
2966 Mathematica's. Similar to time_test, but returns more info.
2970 Mathematica's. Similar to time_test, but returns more info.
2967
2971
2968 2002-06-18 Fernando Perez <fperez@colorado.edu>
2972 2002-06-18 Fernando Perez <fperez@colorado.edu>
2969
2973
2970 * IPython/Magic.py (Magic.magic_save): modified @save and @r
2974 * IPython/Magic.py (Magic.magic_save): modified @save and @r
2971 according to Mike Heeter's suggestions.
2975 according to Mike Heeter's suggestions.
2972
2976
2973 2002-06-16 Fernando Perez <fperez@colorado.edu>
2977 2002-06-16 Fernando Perez <fperez@colorado.edu>
2974
2978
2975 * IPython/GnuplotRuntime.py: Massive overhaul to the Gnuplot
2979 * IPython/GnuplotRuntime.py: Massive overhaul to the Gnuplot
2976 system. GnuplotMagic is gone as a user-directory option. New files
2980 system. GnuplotMagic is gone as a user-directory option. New files
2977 make it easier to use all the gnuplot stuff both from external
2981 make it easier to use all the gnuplot stuff both from external
2978 programs as well as from IPython. Had to rewrite part of
2982 programs as well as from IPython. Had to rewrite part of
2979 hardcopy() b/c of a strange bug: often the ps files simply don't
2983 hardcopy() b/c of a strange bug: often the ps files simply don't
2980 get created, and require a repeat of the command (often several
2984 get created, and require a repeat of the command (often several
2981 times).
2985 times).
2982
2986
2983 * IPython/ultraTB.py (AutoFormattedTB.__call__): changed to
2987 * IPython/ultraTB.py (AutoFormattedTB.__call__): changed to
2984 resolve output channel at call time, so that if sys.stderr has
2988 resolve output channel at call time, so that if sys.stderr has
2985 been redirected by user this gets honored.
2989 been redirected by user this gets honored.
2986
2990
2987 2002-06-13 Fernando Perez <fperez@colorado.edu>
2991 2002-06-13 Fernando Perez <fperez@colorado.edu>
2988
2992
2989 * IPython/Shell.py (IPShell.__init__): Changed IPythonShell to
2993 * IPython/Shell.py (IPShell.__init__): Changed IPythonShell to
2990 IPShell. Kept a copy with the old names to avoid breaking people's
2994 IPShell. Kept a copy with the old names to avoid breaking people's
2991 embedded code.
2995 embedded code.
2992
2996
2993 * IPython/ipython: simplified it to the bare minimum after
2997 * IPython/ipython: simplified it to the bare minimum after
2994 Holger's suggestions. Added info about how to use it in
2998 Holger's suggestions. Added info about how to use it in
2995 PYTHONSTARTUP.
2999 PYTHONSTARTUP.
2996
3000
2997 * IPython/Shell.py (IPythonShell): changed the options passing
3001 * IPython/Shell.py (IPythonShell): changed the options passing
2998 from a string with funky %s replacements to a straight list. Maybe
3002 from a string with funky %s replacements to a straight list. Maybe
2999 a bit more typing, but it follows sys.argv conventions, so there's
3003 a bit more typing, but it follows sys.argv conventions, so there's
3000 less special-casing to remember.
3004 less special-casing to remember.
3001
3005
3002 2002-06-12 Fernando Perez <fperez@colorado.edu>
3006 2002-06-12 Fernando Perez <fperez@colorado.edu>
3003
3007
3004 * IPython/Magic.py (Magic.magic_r): new magic auto-repeat
3008 * IPython/Magic.py (Magic.magic_r): new magic auto-repeat
3005 command. Thanks to a suggestion by Mike Heeter.
3009 command. Thanks to a suggestion by Mike Heeter.
3006 (Magic.magic_pfile): added behavior to look at filenames if given
3010 (Magic.magic_pfile): added behavior to look at filenames if given
3007 arg is not a defined object.
3011 arg is not a defined object.
3008 (Magic.magic_save): New @save function to save code snippets. Also
3012 (Magic.magic_save): New @save function to save code snippets. Also
3009 a Mike Heeter idea.
3013 a Mike Heeter idea.
3010
3014
3011 * IPython/UserConfig/GnuplotMagic.py (plot): Improvements to
3015 * IPython/UserConfig/GnuplotMagic.py (plot): Improvements to
3012 plot() and replot(). Much more convenient now, especially for
3016 plot() and replot(). Much more convenient now, especially for
3013 interactive use.
3017 interactive use.
3014
3018
3015 * IPython/Magic.py (Magic.magic_run): Added .py automatically to
3019 * IPython/Magic.py (Magic.magic_run): Added .py automatically to
3016 filenames.
3020 filenames.
3017
3021
3018 2002-06-02 Fernando Perez <fperez@colorado.edu>
3022 2002-06-02 Fernando Perez <fperez@colorado.edu>
3019
3023
3020 * IPython/Struct.py (Struct.__init__): modified to admit
3024 * IPython/Struct.py (Struct.__init__): modified to admit
3021 initialization via another struct.
3025 initialization via another struct.
3022
3026
3023 * IPython/genutils.py (SystemExec.__init__): New stateful
3027 * IPython/genutils.py (SystemExec.__init__): New stateful
3024 interface to xsys and bq. Useful for writing system scripts.
3028 interface to xsys and bq. Useful for writing system scripts.
3025
3029
3026 2002-05-30 Fernando Perez <fperez@colorado.edu>
3030 2002-05-30 Fernando Perez <fperez@colorado.edu>
3027
3031
3028 * MANIFEST.in: Changed docfile selection to exclude all the lyx
3032 * MANIFEST.in: Changed docfile selection to exclude all the lyx
3029 documents. This will make the user download smaller (it's getting
3033 documents. This will make the user download smaller (it's getting
3030 too big).
3034 too big).
3031
3035
3032 2002-05-29 Fernando Perez <fperez@colorado.edu>
3036 2002-05-29 Fernando Perez <fperez@colorado.edu>
3033
3037
3034 * IPython/iplib.py (_FakeModule.__init__): New class introduced to
3038 * IPython/iplib.py (_FakeModule.__init__): New class introduced to
3035 fix problems with shelve and pickle. Seems to work, but I don't
3039 fix problems with shelve and pickle. Seems to work, but I don't
3036 know if corner cases break it. Thanks to Mike Heeter
3040 know if corner cases break it. Thanks to Mike Heeter
3037 <korora-AT-SDF.LONESTAR.ORG> for the bug reports and test cases.
3041 <korora-AT-SDF.LONESTAR.ORG> for the bug reports and test cases.
3038
3042
3039 2002-05-24 Fernando Perez <fperez@colorado.edu>
3043 2002-05-24 Fernando Perez <fperez@colorado.edu>
3040
3044
3041 * IPython/Magic.py (Macro.__init__): fixed magics embedded in
3045 * IPython/Magic.py (Macro.__init__): fixed magics embedded in
3042 macros having broken.
3046 macros having broken.
3043
3047
3044 2002-05-21 Fernando Perez <fperez@colorado.edu>
3048 2002-05-21 Fernando Perez <fperez@colorado.edu>
3045
3049
3046 * IPython/Magic.py (Magic.magic_logstart): fixed recently
3050 * IPython/Magic.py (Magic.magic_logstart): fixed recently
3047 introduced logging bug: all history before logging started was
3051 introduced logging bug: all history before logging started was
3048 being written one character per line! This came from the redesign
3052 being written one character per line! This came from the redesign
3049 of the input history as a special list which slices to strings,
3053 of the input history as a special list which slices to strings,
3050 not to lists.
3054 not to lists.
3051
3055
3052 2002-05-20 Fernando Perez <fperez@colorado.edu>
3056 2002-05-20 Fernando Perez <fperez@colorado.edu>
3053
3057
3054 * IPython/Prompts.py (CachedOutput.__init__): made the color table
3058 * IPython/Prompts.py (CachedOutput.__init__): made the color table
3055 be an attribute of all classes in this module. The design of these
3059 be an attribute of all classes in this module. The design of these
3056 classes needs some serious overhauling.
3060 classes needs some serious overhauling.
3057
3061
3058 * IPython/DPyGetOpt.py (DPyGetOpt.setPosixCompliance): fixed bug
3062 * IPython/DPyGetOpt.py (DPyGetOpt.setPosixCompliance): fixed bug
3059 which was ignoring '_' in option names.
3063 which was ignoring '_' in option names.
3060
3064
3061 * IPython/ultraTB.py (FormattedTB.__init__): Changed
3065 * IPython/ultraTB.py (FormattedTB.__init__): Changed
3062 'Verbose_novars' to 'Context' and made it the new default. It's a
3066 'Verbose_novars' to 'Context' and made it the new default. It's a
3063 bit more readable and also safer than verbose.
3067 bit more readable and also safer than verbose.
3064
3068
3065 * IPython/PyColorize.py (Parser.__call__): Fixed coloring of
3069 * IPython/PyColorize.py (Parser.__call__): Fixed coloring of
3066 triple-quoted strings.
3070 triple-quoted strings.
3067
3071
3068 * IPython/OInspect.py (__all__): new module exposing the object
3072 * IPython/OInspect.py (__all__): new module exposing the object
3069 introspection facilities. Now the corresponding magics are dummy
3073 introspection facilities. Now the corresponding magics are dummy
3070 wrappers around this. Having this module will make it much easier
3074 wrappers around this. Having this module will make it much easier
3071 to put these functions into our modified pdb.
3075 to put these functions into our modified pdb.
3072 This new object inspector system uses the new colorizing module,
3076 This new object inspector system uses the new colorizing module,
3073 so source code and other things are nicely syntax highlighted.
3077 so source code and other things are nicely syntax highlighted.
3074
3078
3075 2002-05-18 Fernando Perez <fperez@colorado.edu>
3079 2002-05-18 Fernando Perez <fperez@colorado.edu>
3076
3080
3077 * IPython/ColorANSI.py: Split the coloring tools into a separate
3081 * IPython/ColorANSI.py: Split the coloring tools into a separate
3078 module so I can use them in other code easier (they were part of
3082 module so I can use them in other code easier (they were part of
3079 ultraTB).
3083 ultraTB).
3080
3084
3081 2002-05-17 Fernando Perez <fperez@colorado.edu>
3085 2002-05-17 Fernando Perez <fperez@colorado.edu>
3082
3086
3083 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
3087 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
3084 fixed it to set the global 'g' also to the called instance, as
3088 fixed it to set the global 'g' also to the called instance, as
3085 long as 'g' was still a gnuplot instance (so it doesn't overwrite
3089 long as 'g' was still a gnuplot instance (so it doesn't overwrite
3086 user's 'g' variables).
3090 user's 'g' variables).
3087
3091
3088 * IPython/iplib.py (InteractiveShell.__init__): Added In/Out
3092 * IPython/iplib.py (InteractiveShell.__init__): Added In/Out
3089 global variables (aliases to _ih,_oh) so that users which expect
3093 global variables (aliases to _ih,_oh) so that users which expect
3090 In[5] or Out[7] to work aren't unpleasantly surprised.
3094 In[5] or Out[7] to work aren't unpleasantly surprised.
3091 (InputList.__getslice__): new class to allow executing slices of
3095 (InputList.__getslice__): new class to allow executing slices of
3092 input history directly. Very simple class, complements the use of
3096 input history directly. Very simple class, complements the use of
3093 macros.
3097 macros.
3094
3098
3095 2002-05-16 Fernando Perez <fperez@colorado.edu>
3099 2002-05-16 Fernando Perez <fperez@colorado.edu>
3096
3100
3097 * setup.py (docdirbase): make doc directory be just doc/IPython
3101 * setup.py (docdirbase): make doc directory be just doc/IPython
3098 without version numbers, it will reduce clutter for users.
3102 without version numbers, it will reduce clutter for users.
3099
3103
3100 * IPython/Magic.py (Magic.magic_run): Add explicit local dict to
3104 * IPython/Magic.py (Magic.magic_run): Add explicit local dict to
3101 execfile call to prevent possible memory leak. See for details:
3105 execfile call to prevent possible memory leak. See for details:
3102 http://mail.python.org/pipermail/python-list/2002-February/088476.html
3106 http://mail.python.org/pipermail/python-list/2002-February/088476.html
3103
3107
3104 2002-05-15 Fernando Perez <fperez@colorado.edu>
3108 2002-05-15 Fernando Perez <fperez@colorado.edu>
3105
3109
3106 * IPython/Magic.py (Magic.magic_psource): made the object
3110 * IPython/Magic.py (Magic.magic_psource): made the object
3107 introspection names be more standard: pdoc, pdef, pfile and
3111 introspection names be more standard: pdoc, pdef, pfile and
3108 psource. They all print/page their output, and it makes
3112 psource. They all print/page their output, and it makes
3109 remembering them easier. Kept old names for compatibility as
3113 remembering them easier. Kept old names for compatibility as
3110 aliases.
3114 aliases.
3111
3115
3112 2002-05-14 Fernando Perez <fperez@colorado.edu>
3116 2002-05-14 Fernando Perez <fperez@colorado.edu>
3113
3117
3114 * IPython/UserConfig/GnuplotMagic.py: I think I finally understood
3118 * IPython/UserConfig/GnuplotMagic.py: I think I finally understood
3115 what the mouse problem was. The trick is to use gnuplot with temp
3119 what the mouse problem was. The trick is to use gnuplot with temp
3116 files and NOT with pipes (for data communication), because having
3120 files and NOT with pipes (for data communication), because having
3117 both pipes and the mouse on is bad news.
3121 both pipes and the mouse on is bad news.
3118
3122
3119 2002-05-13 Fernando Perez <fperez@colorado.edu>
3123 2002-05-13 Fernando Perez <fperez@colorado.edu>
3120
3124
3121 * IPython/Magic.py (Magic._ofind): fixed namespace order search
3125 * IPython/Magic.py (Magic._ofind): fixed namespace order search
3122 bug. Information would be reported about builtins even when
3126 bug. Information would be reported about builtins even when
3123 user-defined functions overrode them.
3127 user-defined functions overrode them.
3124
3128
3125 2002-05-11 Fernando Perez <fperez@colorado.edu>
3129 2002-05-11 Fernando Perez <fperez@colorado.edu>
3126
3130
3127 * IPython/__init__.py (__all__): removed FlexCompleter from
3131 * IPython/__init__.py (__all__): removed FlexCompleter from
3128 __all__ so that things don't fail in platforms without readline.
3132 __all__ so that things don't fail in platforms without readline.
3129
3133
3130 2002-05-10 Fernando Perez <fperez@colorado.edu>
3134 2002-05-10 Fernando Perez <fperez@colorado.edu>
3131
3135
3132 * IPython/__init__.py (__all__): removed numutils from __all__ b/c
3136 * IPython/__init__.py (__all__): removed numutils from __all__ b/c
3133 it requires Numeric, effectively making Numeric a dependency for
3137 it requires Numeric, effectively making Numeric a dependency for
3134 IPython.
3138 IPython.
3135
3139
3136 * Released 0.2.13
3140 * Released 0.2.13
3137
3141
3138 * IPython/Magic.py (Magic.magic_prun): big overhaul to the
3142 * IPython/Magic.py (Magic.magic_prun): big overhaul to the
3139 profiler interface. Now all the major options from the profiler
3143 profiler interface. Now all the major options from the profiler
3140 module are directly supported in IPython, both for single
3144 module are directly supported in IPython, both for single
3141 expressions (@prun) and for full programs (@run -p).
3145 expressions (@prun) and for full programs (@run -p).
3142
3146
3143 2002-05-09 Fernando Perez <fperez@colorado.edu>
3147 2002-05-09 Fernando Perez <fperez@colorado.edu>
3144
3148
3145 * IPython/Magic.py (Magic.magic_doc): fixed to show docstrings of
3149 * IPython/Magic.py (Magic.magic_doc): fixed to show docstrings of
3146 magic properly formatted for screen.
3150 magic properly formatted for screen.
3147
3151
3148 * setup.py (make_shortcut): Changed things to put pdf version in
3152 * setup.py (make_shortcut): Changed things to put pdf version in
3149 doc/ instead of doc/manual (had to change lyxport a bit).
3153 doc/ instead of doc/manual (had to change lyxport a bit).
3150
3154
3151 * IPython/Magic.py (Profile.string_stats): made profile runs go
3155 * IPython/Magic.py (Profile.string_stats): made profile runs go
3152 through pager (they are long and a pager allows searching, saving,
3156 through pager (they are long and a pager allows searching, saving,
3153 etc.)
3157 etc.)
3154
3158
3155 2002-05-08 Fernando Perez <fperez@colorado.edu>
3159 2002-05-08 Fernando Perez <fperez@colorado.edu>
3156
3160
3157 * Released 0.2.12
3161 * Released 0.2.12
3158
3162
3159 2002-05-06 Fernando Perez <fperez@colorado.edu>
3163 2002-05-06 Fernando Perez <fperez@colorado.edu>
3160
3164
3161 * IPython/Magic.py (Magic.magic_hist): small bug fixed (recently
3165 * IPython/Magic.py (Magic.magic_hist): small bug fixed (recently
3162 introduced); 'hist n1 n2' was broken.
3166 introduced); 'hist n1 n2' was broken.
3163 (Magic.magic_pdb): added optional on/off arguments to @pdb
3167 (Magic.magic_pdb): added optional on/off arguments to @pdb
3164 (Magic.magic_run): added option -i to @run, which executes code in
3168 (Magic.magic_run): added option -i to @run, which executes code in
3165 the IPython namespace instead of a clean one. Also added @irun as
3169 the IPython namespace instead of a clean one. Also added @irun as
3166 an alias to @run -i.
3170 an alias to @run -i.
3167
3171
3168 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
3172 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
3169 fixed (it didn't really do anything, the namespaces were wrong).
3173 fixed (it didn't really do anything, the namespaces were wrong).
3170
3174
3171 * IPython/Debugger.py (__init__): Added workaround for python 2.1
3175 * IPython/Debugger.py (__init__): Added workaround for python 2.1
3172
3176
3173 * IPython/__init__.py (__all__): Fixed package namespace, now
3177 * IPython/__init__.py (__all__): Fixed package namespace, now
3174 'import IPython' does give access to IPython.<all> as
3178 'import IPython' does give access to IPython.<all> as
3175 expected. Also renamed __release__ to Release.
3179 expected. Also renamed __release__ to Release.
3176
3180
3177 * IPython/Debugger.py (__license__): created new Pdb class which
3181 * IPython/Debugger.py (__license__): created new Pdb class which
3178 functions like a drop-in for the normal pdb.Pdb but does NOT
3182 functions like a drop-in for the normal pdb.Pdb but does NOT
3179 import readline by default. This way it doesn't muck up IPython's
3183 import readline by default. This way it doesn't muck up IPython's
3180 readline handling, and now tab-completion finally works in the
3184 readline handling, and now tab-completion finally works in the
3181 debugger -- sort of. It completes things globally visible, but the
3185 debugger -- sort of. It completes things globally visible, but the
3182 completer doesn't track the stack as pdb walks it. That's a bit
3186 completer doesn't track the stack as pdb walks it. That's a bit
3183 tricky, and I'll have to implement it later.
3187 tricky, and I'll have to implement it later.
3184
3188
3185 2002-05-05 Fernando Perez <fperez@colorado.edu>
3189 2002-05-05 Fernando Perez <fperez@colorado.edu>
3186
3190
3187 * IPython/Magic.py (Magic.magic_oinfo): fixed formatting bug for
3191 * IPython/Magic.py (Magic.magic_oinfo): fixed formatting bug for
3188 magic docstrings when printed via ? (explicit \'s were being
3192 magic docstrings when printed via ? (explicit \'s were being
3189 printed).
3193 printed).
3190
3194
3191 * IPython/ipmaker.py (make_IPython): fixed namespace
3195 * IPython/ipmaker.py (make_IPython): fixed namespace
3192 identification bug. Now variables loaded via logs or command-line
3196 identification bug. Now variables loaded via logs or command-line
3193 files are recognized in the interactive namespace by @who.
3197 files are recognized in the interactive namespace by @who.
3194
3198
3195 * IPython/iplib.py (InteractiveShell.safe_execfile): Fixed bug in
3199 * IPython/iplib.py (InteractiveShell.safe_execfile): Fixed bug in
3196 log replay system stemming from the string form of Structs.
3200 log replay system stemming from the string form of Structs.
3197
3201
3198 * IPython/Magic.py (Macro.__init__): improved macros to properly
3202 * IPython/Magic.py (Macro.__init__): improved macros to properly
3199 handle magic commands in them.
3203 handle magic commands in them.
3200 (Magic.magic_logstart): usernames are now expanded so 'logstart
3204 (Magic.magic_logstart): usernames are now expanded so 'logstart
3201 ~/mylog' now works.
3205 ~/mylog' now works.
3202
3206
3203 * IPython/iplib.py (complete): fixed bug where paths starting with
3207 * IPython/iplib.py (complete): fixed bug where paths starting with
3204 '/' would be completed as magic names.
3208 '/' would be completed as magic names.
3205
3209
3206 2002-05-04 Fernando Perez <fperez@colorado.edu>
3210 2002-05-04 Fernando Perez <fperez@colorado.edu>
3207
3211
3208 * IPython/Magic.py (Magic.magic_run): added options -p and -f to
3212 * IPython/Magic.py (Magic.magic_run): added options -p and -f to
3209 allow running full programs under the profiler's control.
3213 allow running full programs under the profiler's control.
3210
3214
3211 * IPython/ultraTB.py (FormattedTB.__init__): Added Verbose_novars
3215 * IPython/ultraTB.py (FormattedTB.__init__): Added Verbose_novars
3212 mode to report exceptions verbosely but without formatting
3216 mode to report exceptions verbosely but without formatting
3213 variables. This addresses the issue of ipython 'freezing' (it's
3217 variables. This addresses the issue of ipython 'freezing' (it's
3214 not frozen, but caught in an expensive formatting loop) when huge
3218 not frozen, but caught in an expensive formatting loop) when huge
3215 variables are in the context of an exception.
3219 variables are in the context of an exception.
3216 (VerboseTB.text): Added '--->' markers at line where exception was
3220 (VerboseTB.text): Added '--->' markers at line where exception was
3217 triggered. Much clearer to read, especially in NoColor modes.
3221 triggered. Much clearer to read, especially in NoColor modes.
3218
3222
3219 * IPython/Magic.py (Magic.magic_run): bugfix: -n option had been
3223 * IPython/Magic.py (Magic.magic_run): bugfix: -n option had been
3220 implemented in reverse when changing to the new parse_options().
3224 implemented in reverse when changing to the new parse_options().
3221
3225
3222 2002-05-03 Fernando Perez <fperez@colorado.edu>
3226 2002-05-03 Fernando Perez <fperez@colorado.edu>
3223
3227
3224 * IPython/Magic.py (Magic.parse_options): new function so that
3228 * IPython/Magic.py (Magic.parse_options): new function so that
3225 magics can parse options easier.
3229 magics can parse options easier.
3226 (Magic.magic_prun): new function similar to profile.run(),
3230 (Magic.magic_prun): new function similar to profile.run(),
3227 suggested by Chris Hart.
3231 suggested by Chris Hart.
3228 (Magic.magic_cd): fixed behavior so that it only changes if
3232 (Magic.magic_cd): fixed behavior so that it only changes if
3229 directory actually is in history.
3233 directory actually is in history.
3230
3234
3231 * IPython/usage.py (__doc__): added information about potential
3235 * IPython/usage.py (__doc__): added information about potential
3232 slowness of Verbose exception mode when there are huge data
3236 slowness of Verbose exception mode when there are huge data
3233 structures to be formatted (thanks to Archie Paulson).
3237 structures to be formatted (thanks to Archie Paulson).
3234
3238
3235 * IPython/ipmaker.py (make_IPython): Changed default logging
3239 * IPython/ipmaker.py (make_IPython): Changed default logging
3236 (when simply called with -log) to use curr_dir/ipython.log in
3240 (when simply called with -log) to use curr_dir/ipython.log in
3237 rotate mode. Fixed crash which was occuring with -log before
3241 rotate mode. Fixed crash which was occuring with -log before
3238 (thanks to Jim Boyle).
3242 (thanks to Jim Boyle).
3239
3243
3240 2002-05-01 Fernando Perez <fperez@colorado.edu>
3244 2002-05-01 Fernando Perez <fperez@colorado.edu>
3241
3245
3242 * Released 0.2.11 for these fixes (mainly the ultraTB one which
3246 * Released 0.2.11 for these fixes (mainly the ultraTB one which
3243 was nasty -- though somewhat of a corner case).
3247 was nasty -- though somewhat of a corner case).
3244
3248
3245 * IPython/ultraTB.py (AutoFormattedTB.text): renamed __text to
3249 * IPython/ultraTB.py (AutoFormattedTB.text): renamed __text to
3246 text (was a bug).
3250 text (was a bug).
3247
3251
3248 2002-04-30 Fernando Perez <fperez@colorado.edu>
3252 2002-04-30 Fernando Perez <fperez@colorado.edu>
3249
3253
3250 * IPython/UserConfig/GnuplotMagic.py (magic_gp): Minor fix to add
3254 * IPython/UserConfig/GnuplotMagic.py (magic_gp): Minor fix to add
3251 a print after ^D or ^C from the user so that the In[] prompt
3255 a print after ^D or ^C from the user so that the In[] prompt
3252 doesn't over-run the gnuplot one.
3256 doesn't over-run the gnuplot one.
3253
3257
3254 2002-04-29 Fernando Perez <fperez@colorado.edu>
3258 2002-04-29 Fernando Perez <fperez@colorado.edu>
3255
3259
3256 * Released 0.2.10
3260 * Released 0.2.10
3257
3261
3258 * IPython/__release__.py (version): get date dynamically.
3262 * IPython/__release__.py (version): get date dynamically.
3259
3263
3260 * Misc. documentation updates thanks to Arnd's comments. Also ran
3264 * Misc. documentation updates thanks to Arnd's comments. Also ran
3261 a full spellcheck on the manual (hadn't been done in a while).
3265 a full spellcheck on the manual (hadn't been done in a while).
3262
3266
3263 2002-04-27 Fernando Perez <fperez@colorado.edu>
3267 2002-04-27 Fernando Perez <fperez@colorado.edu>
3264
3268
3265 * IPython/Magic.py (Magic.magic_logstart): Fixed bug where
3269 * IPython/Magic.py (Magic.magic_logstart): Fixed bug where
3266 starting a log in mid-session would reset the input history list.
3270 starting a log in mid-session would reset the input history list.
3267
3271
3268 2002-04-26 Fernando Perez <fperez@colorado.edu>
3272 2002-04-26 Fernando Perez <fperez@colorado.edu>
3269
3273
3270 * IPython/iplib.py (InteractiveShell.wait): Fixed bug where not
3274 * IPython/iplib.py (InteractiveShell.wait): Fixed bug where not
3271 all files were being included in an update. Now anything in
3275 all files were being included in an update. Now anything in
3272 UserConfig that matches [A-Za-z]*.py will go (this excludes
3276 UserConfig that matches [A-Za-z]*.py will go (this excludes
3273 __init__.py)
3277 __init__.py)
3274
3278
3275 2002-04-25 Fernando Perez <fperez@colorado.edu>
3279 2002-04-25 Fernando Perez <fperez@colorado.edu>
3276
3280
3277 * IPython/iplib.py (InteractiveShell.__init__): Added __IPYTHON__
3281 * IPython/iplib.py (InteractiveShell.__init__): Added __IPYTHON__
3278 to __builtins__ so that any form of embedded or imported code can
3282 to __builtins__ so that any form of embedded or imported code can
3279 test for being inside IPython.
3283 test for being inside IPython.
3280
3284
3281 * IPython/UserConfig/GnuplotMagic.py: (magic_gp_set_instance):
3285 * IPython/UserConfig/GnuplotMagic.py: (magic_gp_set_instance):
3282 changed to GnuplotMagic because it's now an importable module,
3286 changed to GnuplotMagic because it's now an importable module,
3283 this makes the name follow that of the standard Gnuplot module.
3287 this makes the name follow that of the standard Gnuplot module.
3284 GnuplotMagic can now be loaded at any time in mid-session.
3288 GnuplotMagic can now be loaded at any time in mid-session.
3285
3289
3286 2002-04-24 Fernando Perez <fperez@colorado.edu>
3290 2002-04-24 Fernando Perez <fperez@colorado.edu>
3287
3291
3288 * IPython/numutils.py: removed SIUnits. It doesn't properly set
3292 * IPython/numutils.py: removed SIUnits. It doesn't properly set
3289 the globals (IPython has its own namespace) and the
3293 the globals (IPython has its own namespace) and the
3290 PhysicalQuantity stuff is much better anyway.
3294 PhysicalQuantity stuff is much better anyway.
3291
3295
3292 * IPython/UserConfig/example-gnuplot.py (g2): Added gnuplot
3296 * IPython/UserConfig/example-gnuplot.py (g2): Added gnuplot
3293 embedding example to standard user directory for
3297 embedding example to standard user directory for
3294 distribution. Also put it in the manual.
3298 distribution. Also put it in the manual.
3295
3299
3296 * IPython/numutils.py (gnuplot_exec): Changed to take a gnuplot
3300 * IPython/numutils.py (gnuplot_exec): Changed to take a gnuplot
3297 instance as first argument (so it doesn't rely on some obscure
3301 instance as first argument (so it doesn't rely on some obscure
3298 hidden global).
3302 hidden global).
3299
3303
3300 * IPython/UserConfig/ipythonrc.py: put () back in accepted
3304 * IPython/UserConfig/ipythonrc.py: put () back in accepted
3301 delimiters. While it prevents ().TAB from working, it allows
3305 delimiters. While it prevents ().TAB from working, it allows
3302 completions in open (... expressions. This is by far a more common
3306 completions in open (... expressions. This is by far a more common
3303 case.
3307 case.
3304
3308
3305 2002-04-23 Fernando Perez <fperez@colorado.edu>
3309 2002-04-23 Fernando Perez <fperez@colorado.edu>
3306
3310
3307 * IPython/Extensions/InterpreterPasteInput.py: new
3311 * IPython/Extensions/InterpreterPasteInput.py: new
3308 syntax-processing module for pasting lines with >>> or ... at the
3312 syntax-processing module for pasting lines with >>> or ... at the
3309 start.
3313 start.
3310
3314
3311 * IPython/Extensions/PhysicalQ_Interactive.py
3315 * IPython/Extensions/PhysicalQ_Interactive.py
3312 (PhysicalQuantityInteractive.__int__): fixed to work with either
3316 (PhysicalQuantityInteractive.__int__): fixed to work with either
3313 Numeric or math.
3317 Numeric or math.
3314
3318
3315 * IPython/UserConfig/ipythonrc-numeric.py: reorganized the
3319 * IPython/UserConfig/ipythonrc-numeric.py: reorganized the
3316 provided profiles. Now we have:
3320 provided profiles. Now we have:
3317 -math -> math module as * and cmath with its own namespace.
3321 -math -> math module as * and cmath with its own namespace.
3318 -numeric -> Numeric as *, plus gnuplot & grace
3322 -numeric -> Numeric as *, plus gnuplot & grace
3319 -physics -> same as before
3323 -physics -> same as before
3320
3324
3321 * IPython/Magic.py (Magic.magic_magic): Fixed bug where
3325 * IPython/Magic.py (Magic.magic_magic): Fixed bug where
3322 user-defined magics wouldn't be found by @magic if they were
3326 user-defined magics wouldn't be found by @magic if they were
3323 defined as class methods. Also cleaned up the namespace search
3327 defined as class methods. Also cleaned up the namespace search
3324 logic and the string building (to use %s instead of many repeated
3328 logic and the string building (to use %s instead of many repeated
3325 string adds).
3329 string adds).
3326
3330
3327 * IPython/UserConfig/example-magic.py (magic_foo): updated example
3331 * IPython/UserConfig/example-magic.py (magic_foo): updated example
3328 of user-defined magics to operate with class methods (cleaner, in
3332 of user-defined magics to operate with class methods (cleaner, in
3329 line with the gnuplot code).
3333 line with the gnuplot code).
3330
3334
3331 2002-04-22 Fernando Perez <fperez@colorado.edu>
3335 2002-04-22 Fernando Perez <fperez@colorado.edu>
3332
3336
3333 * setup.py: updated dependency list so that manual is updated when
3337 * setup.py: updated dependency list so that manual is updated when
3334 all included files change.
3338 all included files change.
3335
3339
3336 * IPython/ipmaker.py (make_IPython): Fixed bug which was ignoring
3340 * IPython/ipmaker.py (make_IPython): Fixed bug which was ignoring
3337 the delimiter removal option (the fix is ugly right now).
3341 the delimiter removal option (the fix is ugly right now).
3338
3342
3339 * IPython/UserConfig/ipythonrc-physics.py: simplified not to load
3343 * IPython/UserConfig/ipythonrc-physics.py: simplified not to load
3340 all of the math profile (quicker loading, no conflict between
3344 all of the math profile (quicker loading, no conflict between
3341 g-9.8 and g-gnuplot).
3345 g-9.8 and g-gnuplot).
3342
3346
3343 * IPython/CrashHandler.py (CrashHandler.__call__): changed default
3347 * IPython/CrashHandler.py (CrashHandler.__call__): changed default
3344 name of post-mortem files to IPython_crash_report.txt.
3348 name of post-mortem files to IPython_crash_report.txt.
3345
3349
3346 * Cleanup/update of the docs. Added all the new readline info and
3350 * Cleanup/update of the docs. Added all the new readline info and
3347 formatted all lists as 'real lists'.
3351 formatted all lists as 'real lists'.
3348
3352
3349 * IPython/ipmaker.py (make_IPython): removed now-obsolete
3353 * IPython/ipmaker.py (make_IPython): removed now-obsolete
3350 tab-completion options, since the full readline parse_and_bind is
3354 tab-completion options, since the full readline parse_and_bind is
3351 now accessible.
3355 now accessible.
3352
3356
3353 * IPython/iplib.py (InteractiveShell.init_readline): Changed
3357 * IPython/iplib.py (InteractiveShell.init_readline): Changed
3354 handling of readline options. Now users can specify any string to
3358 handling of readline options. Now users can specify any string to
3355 be passed to parse_and_bind(), as well as the delimiters to be
3359 be passed to parse_and_bind(), as well as the delimiters to be
3356 removed.
3360 removed.
3357 (InteractiveShell.__init__): Added __name__ to the global
3361 (InteractiveShell.__init__): Added __name__ to the global
3358 namespace so that things like Itpl which rely on its existence
3362 namespace so that things like Itpl which rely on its existence
3359 don't crash.
3363 don't crash.
3360 (InteractiveShell._prefilter): Defined the default with a _ so
3364 (InteractiveShell._prefilter): Defined the default with a _ so
3361 that prefilter() is easier to override, while the default one
3365 that prefilter() is easier to override, while the default one
3362 remains available.
3366 remains available.
3363
3367
3364 2002-04-18 Fernando Perez <fperez@colorado.edu>
3368 2002-04-18 Fernando Perez <fperez@colorado.edu>
3365
3369
3366 * Added information about pdb in the docs.
3370 * Added information about pdb in the docs.
3367
3371
3368 2002-04-17 Fernando Perez <fperez@colorado.edu>
3372 2002-04-17 Fernando Perez <fperez@colorado.edu>
3369
3373
3370 * IPython/ipmaker.py (make_IPython): added rc_override option to
3374 * IPython/ipmaker.py (make_IPython): added rc_override option to
3371 allow passing config options at creation time which may override
3375 allow passing config options at creation time which may override
3372 anything set in the config files or command line. This is
3376 anything set in the config files or command line. This is
3373 particularly useful for configuring embedded instances.
3377 particularly useful for configuring embedded instances.
3374
3378
3375 2002-04-15 Fernando Perez <fperez@colorado.edu>
3379 2002-04-15 Fernando Perez <fperez@colorado.edu>
3376
3380
3377 * IPython/Logger.py (Logger.log): Fixed a nasty bug which could
3381 * IPython/Logger.py (Logger.log): Fixed a nasty bug which could
3378 crash embedded instances because of the input cache falling out of
3382 crash embedded instances because of the input cache falling out of
3379 sync with the output counter.
3383 sync with the output counter.
3380
3384
3381 * IPython/Shell.py (IPythonShellEmbed.__init__): added a debug
3385 * IPython/Shell.py (IPythonShellEmbed.__init__): added a debug
3382 mode which calls pdb after an uncaught exception in IPython itself.
3386 mode which calls pdb after an uncaught exception in IPython itself.
3383
3387
3384 2002-04-14 Fernando Perez <fperez@colorado.edu>
3388 2002-04-14 Fernando Perez <fperez@colorado.edu>
3385
3389
3386 * IPython/iplib.py (InteractiveShell.showtraceback): pdb mucks up
3390 * IPython/iplib.py (InteractiveShell.showtraceback): pdb mucks up
3387 readline, fix it back after each call.
3391 readline, fix it back after each call.
3388
3392
3389 * IPython/ultraTB.py (AutoFormattedTB.__text): made text a private
3393 * IPython/ultraTB.py (AutoFormattedTB.__text): made text a private
3390 method to force all access via __call__(), which guarantees that
3394 method to force all access via __call__(), which guarantees that
3391 traceback references are properly deleted.
3395 traceback references are properly deleted.
3392
3396
3393 * IPython/Prompts.py (CachedOutput._display): minor fixes to
3397 * IPython/Prompts.py (CachedOutput._display): minor fixes to
3394 improve printing when pprint is in use.
3398 improve printing when pprint is in use.
3395
3399
3396 2002-04-13 Fernando Perez <fperez@colorado.edu>
3400 2002-04-13 Fernando Perez <fperez@colorado.edu>
3397
3401
3398 * IPython/Shell.py (IPythonShellEmbed.__call__): SystemExit
3402 * IPython/Shell.py (IPythonShellEmbed.__call__): SystemExit
3399 exceptions aren't caught anymore. If the user triggers one, he
3403 exceptions aren't caught anymore. If the user triggers one, he
3400 should know why he's doing it and it should go all the way up,
3404 should know why he's doing it and it should go all the way up,
3401 just like any other exception. So now @abort will fully kill the
3405 just like any other exception. So now @abort will fully kill the
3402 embedded interpreter and the embedding code (unless that happens
3406 embedded interpreter and the embedding code (unless that happens
3403 to catch SystemExit).
3407 to catch SystemExit).
3404
3408
3405 * IPython/ultraTB.py (VerboseTB.__init__): added a call_pdb flag
3409 * IPython/ultraTB.py (VerboseTB.__init__): added a call_pdb flag
3406 and a debugger() method to invoke the interactive pdb debugger
3410 and a debugger() method to invoke the interactive pdb debugger
3407 after printing exception information. Also added the corresponding
3411 after printing exception information. Also added the corresponding
3408 -pdb option and @pdb magic to control this feature, and updated
3412 -pdb option and @pdb magic to control this feature, and updated
3409 the docs. After a suggestion from Christopher Hart
3413 the docs. After a suggestion from Christopher Hart
3410 (hart-AT-caltech.edu).
3414 (hart-AT-caltech.edu).
3411
3415
3412 2002-04-12 Fernando Perez <fperez@colorado.edu>
3416 2002-04-12 Fernando Perez <fperez@colorado.edu>
3413
3417
3414 * IPython/Shell.py (IPythonShellEmbed.__init__): modified to use
3418 * IPython/Shell.py (IPythonShellEmbed.__init__): modified to use
3415 the exception handlers defined by the user (not the CrashHandler)
3419 the exception handlers defined by the user (not the CrashHandler)
3416 so that user exceptions don't trigger an ipython bug report.
3420 so that user exceptions don't trigger an ipython bug report.
3417
3421
3418 * IPython/ultraTB.py (ColorTB.__init__): made the color scheme
3422 * IPython/ultraTB.py (ColorTB.__init__): made the color scheme
3419 configurable (it should have always been so).
3423 configurable (it should have always been so).
3420
3424
3421 2002-03-26 Fernando Perez <fperez@colorado.edu>
3425 2002-03-26 Fernando Perez <fperez@colorado.edu>
3422
3426
3423 * IPython/Shell.py (IPythonShellEmbed.__call__): many changes here
3427 * IPython/Shell.py (IPythonShellEmbed.__call__): many changes here
3424 and there to fix embedding namespace issues. This should all be
3428 and there to fix embedding namespace issues. This should all be
3425 done in a more elegant way.
3429 done in a more elegant way.
3426
3430
3427 2002-03-25 Fernando Perez <fperez@colorado.edu>
3431 2002-03-25 Fernando Perez <fperez@colorado.edu>
3428
3432
3429 * IPython/genutils.py (get_home_dir): Try to make it work under
3433 * IPython/genutils.py (get_home_dir): Try to make it work under
3430 win9x also.
3434 win9x also.
3431
3435
3432 2002-03-20 Fernando Perez <fperez@colorado.edu>
3436 2002-03-20 Fernando Perez <fperez@colorado.edu>
3433
3437
3434 * IPython/Shell.py (IPythonShellEmbed.__init__): leave
3438 * IPython/Shell.py (IPythonShellEmbed.__init__): leave
3435 sys.displayhook untouched upon __init__.
3439 sys.displayhook untouched upon __init__.
3436
3440
3437 2002-03-19 Fernando Perez <fperez@colorado.edu>
3441 2002-03-19 Fernando Perez <fperez@colorado.edu>
3438
3442
3439 * Released 0.2.9 (for embedding bug, basically).
3443 * Released 0.2.9 (for embedding bug, basically).
3440
3444
3441 * IPython/Shell.py (IPythonShellEmbed.__call__): Trap SystemExit
3445 * IPython/Shell.py (IPythonShellEmbed.__call__): Trap SystemExit
3442 exceptions so that enclosing shell's state can be restored.
3446 exceptions so that enclosing shell's state can be restored.
3443
3447
3444 * Changed magic_gnuplot.py to magic-gnuplot.py to standardize
3448 * Changed magic_gnuplot.py to magic-gnuplot.py to standardize
3445 naming conventions in the .ipython/ dir.
3449 naming conventions in the .ipython/ dir.
3446
3450
3447 * IPython/iplib.py (InteractiveShell.init_readline): removed '-'
3451 * IPython/iplib.py (InteractiveShell.init_readline): removed '-'
3448 from delimiters list so filenames with - in them get expanded.
3452 from delimiters list so filenames with - in them get expanded.
3449
3453
3450 * IPython/Shell.py (IPythonShellEmbed.__call__): fixed bug with
3454 * IPython/Shell.py (IPythonShellEmbed.__call__): fixed bug with
3451 sys.displayhook not being properly restored after an embedded call.
3455 sys.displayhook not being properly restored after an embedded call.
3452
3456
3453 2002-03-18 Fernando Perez <fperez@colorado.edu>
3457 2002-03-18 Fernando Perez <fperez@colorado.edu>
3454
3458
3455 * Released 0.2.8
3459 * Released 0.2.8
3456
3460
3457 * IPython/iplib.py (InteractiveShell.user_setup): fixed bug where
3461 * IPython/iplib.py (InteractiveShell.user_setup): fixed bug where
3458 some files weren't being included in a -upgrade.
3462 some files weren't being included in a -upgrade.
3459 (InteractiveShell.init_readline): Added 'set show-all-if-ambiguous
3463 (InteractiveShell.init_readline): Added 'set show-all-if-ambiguous
3460 on' so that the first tab completes.
3464 on' so that the first tab completes.
3461 (InteractiveShell.handle_magic): fixed bug with spaces around
3465 (InteractiveShell.handle_magic): fixed bug with spaces around
3462 quotes breaking many magic commands.
3466 quotes breaking many magic commands.
3463
3467
3464 * setup.py: added note about ignoring the syntax error messages at
3468 * setup.py: added note about ignoring the syntax error messages at
3465 installation.
3469 installation.
3466
3470
3467 * IPython/UserConfig/magic_gnuplot.py (magic_gp): finished
3471 * IPython/UserConfig/magic_gnuplot.py (magic_gp): finished
3468 streamlining the gnuplot interface, now there's only one magic @gp.
3472 streamlining the gnuplot interface, now there's only one magic @gp.
3469
3473
3470 2002-03-17 Fernando Perez <fperez@colorado.edu>
3474 2002-03-17 Fernando Perez <fperez@colorado.edu>
3471
3475
3472 * IPython/UserConfig/magic_gnuplot.py: new name for the
3476 * IPython/UserConfig/magic_gnuplot.py: new name for the
3473 example-magic_pm.py file. Much enhanced system, now with a shell
3477 example-magic_pm.py file. Much enhanced system, now with a shell
3474 for communicating directly with gnuplot, one command at a time.
3478 for communicating directly with gnuplot, one command at a time.
3475
3479
3476 * IPython/Magic.py (Magic.magic_run): added option -n to prevent
3480 * IPython/Magic.py (Magic.magic_run): added option -n to prevent
3477 setting __name__=='__main__'.
3481 setting __name__=='__main__'.
3478
3482
3479 * IPython/UserConfig/example-magic_pm.py (magic_pm): Added
3483 * IPython/UserConfig/example-magic_pm.py (magic_pm): Added
3480 mini-shell for accessing gnuplot from inside ipython. Should
3484 mini-shell for accessing gnuplot from inside ipython. Should
3481 extend it later for grace access too. Inspired by Arnd's
3485 extend it later for grace access too. Inspired by Arnd's
3482 suggestion.
3486 suggestion.
3483
3487
3484 * IPython/iplib.py (InteractiveShell.handle_magic): fixed bug when
3488 * IPython/iplib.py (InteractiveShell.handle_magic): fixed bug when
3485 calling magic functions with () in their arguments. Thanks to Arnd
3489 calling magic functions with () in their arguments. Thanks to Arnd
3486 Baecker for pointing this to me.
3490 Baecker for pointing this to me.
3487
3491
3488 * IPython/numutils.py (sum_flat): fixed bug. Would recurse
3492 * IPython/numutils.py (sum_flat): fixed bug. Would recurse
3489 infinitely for integer or complex arrays (only worked with floats).
3493 infinitely for integer or complex arrays (only worked with floats).
3490
3494
3491 2002-03-16 Fernando Perez <fperez@colorado.edu>
3495 2002-03-16 Fernando Perez <fperez@colorado.edu>
3492
3496
3493 * setup.py: Merged setup and setup_windows into a single script
3497 * setup.py: Merged setup and setup_windows into a single script
3494 which properly handles things for windows users.
3498 which properly handles things for windows users.
3495
3499
3496 2002-03-15 Fernando Perez <fperez@colorado.edu>
3500 2002-03-15 Fernando Perez <fperez@colorado.edu>
3497
3501
3498 * Big change to the manual: now the magics are all automatically
3502 * Big change to the manual: now the magics are all automatically
3499 documented. This information is generated from their docstrings
3503 documented. This information is generated from their docstrings
3500 and put in a latex file included by the manual lyx file. This way
3504 and put in a latex file included by the manual lyx file. This way
3501 we get always up to date information for the magics. The manual
3505 we get always up to date information for the magics. The manual
3502 now also has proper version information, also auto-synced.
3506 now also has proper version information, also auto-synced.
3503
3507
3504 For this to work, an undocumented --magic_docstrings option was added.
3508 For this to work, an undocumented --magic_docstrings option was added.
3505
3509
3506 2002-03-13 Fernando Perez <fperez@colorado.edu>
3510 2002-03-13 Fernando Perez <fperez@colorado.edu>
3507
3511
3508 * IPython/ultraTB.py (TermColors): fixed problem with dark colors
3512 * IPython/ultraTB.py (TermColors): fixed problem with dark colors
3509 under CDE terminals. An explicit ;2 color reset is needed in the escapes.
3513 under CDE terminals. An explicit ;2 color reset is needed in the escapes.
3510
3514
3511 2002-03-12 Fernando Perez <fperez@colorado.edu>
3515 2002-03-12 Fernando Perez <fperez@colorado.edu>
3512
3516
3513 * IPython/ultraTB.py (TermColors): changed color escapes again to
3517 * IPython/ultraTB.py (TermColors): changed color escapes again to
3514 fix the (old, reintroduced) line-wrapping bug. Basically, if
3518 fix the (old, reintroduced) line-wrapping bug. Basically, if
3515 \001..\002 aren't given in the color escapes, lines get wrapped
3519 \001..\002 aren't given in the color escapes, lines get wrapped
3516 weirdly. But giving those screws up old xterms and emacs terms. So
3520 weirdly. But giving those screws up old xterms and emacs terms. So
3517 I added some logic for emacs terms to be ok, but I can't identify old
3521 I added some logic for emacs terms to be ok, but I can't identify old
3518 xterms separately ($TERM=='xterm' for many terminals, like konsole).
3522 xterms separately ($TERM=='xterm' for many terminals, like konsole).
3519
3523
3520 2002-03-10 Fernando Perez <fperez@colorado.edu>
3524 2002-03-10 Fernando Perez <fperez@colorado.edu>
3521
3525
3522 * IPython/usage.py (__doc__): Various documentation cleanups and
3526 * IPython/usage.py (__doc__): Various documentation cleanups and
3523 updates, both in usage docstrings and in the manual.
3527 updates, both in usage docstrings and in the manual.
3524
3528
3525 * IPython/Prompts.py (CachedOutput.set_colors): cleanups for
3529 * IPython/Prompts.py (CachedOutput.set_colors): cleanups for
3526 handling of caching. Set minimum acceptabe value for having a
3530 handling of caching. Set minimum acceptabe value for having a
3527 cache at 20 values.
3531 cache at 20 values.
3528
3532
3529 * IPython/iplib.py (InteractiveShell.user_setup): moved the
3533 * IPython/iplib.py (InteractiveShell.user_setup): moved the
3530 install_first_time function to a method, renamed it and added an
3534 install_first_time function to a method, renamed it and added an
3531 'upgrade' mode. Now people can update their config directory with
3535 'upgrade' mode. Now people can update their config directory with
3532 a simple command line switch (-upgrade, also new).
3536 a simple command line switch (-upgrade, also new).
3533
3537
3534 * IPython/Magic.py (Magic.magic_pfile): Made @pfile an alias to
3538 * IPython/Magic.py (Magic.magic_pfile): Made @pfile an alias to
3535 @file (convenient for automagic users under Python >= 2.2).
3539 @file (convenient for automagic users under Python >= 2.2).
3536 Removed @files (it seemed more like a plural than an abbrev. of
3540 Removed @files (it seemed more like a plural than an abbrev. of
3537 'file show').
3541 'file show').
3538
3542
3539 * IPython/iplib.py (install_first_time): Fixed crash if there were
3543 * IPython/iplib.py (install_first_time): Fixed crash if there were
3540 backup files ('~') in .ipython/ install directory.
3544 backup files ('~') in .ipython/ install directory.
3541
3545
3542 * IPython/ipmaker.py (make_IPython): fixes for new prompt
3546 * IPython/ipmaker.py (make_IPython): fixes for new prompt
3543 system. Things look fine, but these changes are fairly
3547 system. Things look fine, but these changes are fairly
3544 intrusive. Test them for a few days.
3548 intrusive. Test them for a few days.
3545
3549
3546 * IPython/Prompts.py (CachedOutput.__init__): Massive rewrite of
3550 * IPython/Prompts.py (CachedOutput.__init__): Massive rewrite of
3547 the prompts system. Now all in/out prompt strings are user
3551 the prompts system. Now all in/out prompt strings are user
3548 controllable. This is particularly useful for embedding, as one
3552 controllable. This is particularly useful for embedding, as one
3549 can tag embedded instances with particular prompts.
3553 can tag embedded instances with particular prompts.
3550
3554
3551 Also removed global use of sys.ps1/2, which now allows nested
3555 Also removed global use of sys.ps1/2, which now allows nested
3552 embeddings without any problems. Added command-line options for
3556 embeddings without any problems. Added command-line options for
3553 the prompt strings.
3557 the prompt strings.
3554
3558
3555 2002-03-08 Fernando Perez <fperez@colorado.edu>
3559 2002-03-08 Fernando Perez <fperez@colorado.edu>
3556
3560
3557 * IPython/UserConfig/example-embed-short.py (ipshell): added
3561 * IPython/UserConfig/example-embed-short.py (ipshell): added
3558 example file with the bare minimum code for embedding.
3562 example file with the bare minimum code for embedding.
3559
3563
3560 * IPython/Shell.py (IPythonShellEmbed.set_dummy_mode): added
3564 * IPython/Shell.py (IPythonShellEmbed.set_dummy_mode): added
3561 functionality for the embeddable shell to be activated/deactivated
3565 functionality for the embeddable shell to be activated/deactivated
3562 either globally or at each call.
3566 either globally or at each call.
3563
3567
3564 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixes the problem of
3568 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixes the problem of
3565 rewriting the prompt with '--->' for auto-inputs with proper
3569 rewriting the prompt with '--->' for auto-inputs with proper
3566 coloring. Now the previous UGLY hack in handle_auto() is gone, and
3570 coloring. Now the previous UGLY hack in handle_auto() is gone, and
3567 this is handled by the prompts class itself, as it should.
3571 this is handled by the prompts class itself, as it should.
3568
3572
3569 2002-03-05 Fernando Perez <fperez@colorado.edu>
3573 2002-03-05 Fernando Perez <fperez@colorado.edu>
3570
3574
3571 * IPython/Magic.py (Magic.magic_logstart): Changed @log to
3575 * IPython/Magic.py (Magic.magic_logstart): Changed @log to
3572 @logstart to avoid name clashes with the math log function.
3576 @logstart to avoid name clashes with the math log function.
3573
3577
3574 * Big updates to X/Emacs section of the manual.
3578 * Big updates to X/Emacs section of the manual.
3575
3579
3576 * Removed ipython_emacs. Milan explained to me how to pass
3580 * Removed ipython_emacs. Milan explained to me how to pass
3577 arguments to ipython through Emacs. Some day I'm going to end up
3581 arguments to ipython through Emacs. Some day I'm going to end up
3578 learning some lisp...
3582 learning some lisp...
3579
3583
3580 2002-03-04 Fernando Perez <fperez@colorado.edu>
3584 2002-03-04 Fernando Perez <fperez@colorado.edu>
3581
3585
3582 * IPython/ipython_emacs: Created script to be used as the
3586 * IPython/ipython_emacs: Created script to be used as the
3583 py-python-command Emacs variable so we can pass IPython
3587 py-python-command Emacs variable so we can pass IPython
3584 parameters. I can't figure out how to tell Emacs directly to pass
3588 parameters. I can't figure out how to tell Emacs directly to pass
3585 parameters to IPython, so a dummy shell script will do it.
3589 parameters to IPython, so a dummy shell script will do it.
3586
3590
3587 Other enhancements made for things to work better under Emacs'
3591 Other enhancements made for things to work better under Emacs'
3588 various types of terminals. Many thanks to Milan Zamazal
3592 various types of terminals. Many thanks to Milan Zamazal
3589 <pdm-AT-zamazal.org> for all the suggestions and pointers.
3593 <pdm-AT-zamazal.org> for all the suggestions and pointers.
3590
3594
3591 2002-03-01 Fernando Perez <fperez@colorado.edu>
3595 2002-03-01 Fernando Perez <fperez@colorado.edu>
3592
3596
3593 * IPython/ipmaker.py (make_IPython): added a --readline! option so
3597 * IPython/ipmaker.py (make_IPython): added a --readline! option so
3594 that loading of readline is now optional. This gives better
3598 that loading of readline is now optional. This gives better
3595 control to emacs users.
3599 control to emacs users.
3596
3600
3597 * IPython/ultraTB.py (__date__): Modified color escape sequences
3601 * IPython/ultraTB.py (__date__): Modified color escape sequences
3598 and now things work fine under xterm and in Emacs' term buffers
3602 and now things work fine under xterm and in Emacs' term buffers
3599 (though not shell ones). Well, in emacs you get colors, but all
3603 (though not shell ones). Well, in emacs you get colors, but all
3600 seem to be 'light' colors (no difference between dark and light
3604 seem to be 'light' colors (no difference between dark and light
3601 ones). But the garbage chars are gone, and also in xterms. It
3605 ones). But the garbage chars are gone, and also in xterms. It
3602 seems that now I'm using 'cleaner' ansi sequences.
3606 seems that now I'm using 'cleaner' ansi sequences.
3603
3607
3604 2002-02-21 Fernando Perez <fperez@colorado.edu>
3608 2002-02-21 Fernando Perez <fperez@colorado.edu>
3605
3609
3606 * Released 0.2.7 (mainly to publish the scoping fix).
3610 * Released 0.2.7 (mainly to publish the scoping fix).
3607
3611
3608 * IPython/Logger.py (Logger.logstate): added. A corresponding
3612 * IPython/Logger.py (Logger.logstate): added. A corresponding
3609 @logstate magic was created.
3613 @logstate magic was created.
3610
3614
3611 * IPython/Magic.py: fixed nested scoping problem under Python
3615 * IPython/Magic.py: fixed nested scoping problem under Python
3612 2.1.x (automagic wasn't working).
3616 2.1.x (automagic wasn't working).
3613
3617
3614 2002-02-20 Fernando Perez <fperez@colorado.edu>
3618 2002-02-20 Fernando Perez <fperez@colorado.edu>
3615
3619
3616 * Released 0.2.6.
3620 * Released 0.2.6.
3617
3621
3618 * IPython/OutputTrap.py (OutputTrap.__init__): added a 'quiet'
3622 * IPython/OutputTrap.py (OutputTrap.__init__): added a 'quiet'
3619 option so that logs can come out without any headers at all.
3623 option so that logs can come out without any headers at all.
3620
3624
3621 * IPython/UserConfig/ipythonrc-scipy.py: created a profile for
3625 * IPython/UserConfig/ipythonrc-scipy.py: created a profile for
3622 SciPy.
3626 SciPy.
3623
3627
3624 * IPython/iplib.py (InteractiveShell.embed_mainloop): Changed so
3628 * IPython/iplib.py (InteractiveShell.embed_mainloop): Changed so
3625 that embedded IPython calls don't require vars() to be explicitly
3629 that embedded IPython calls don't require vars() to be explicitly
3626 passed. Now they are extracted from the caller's frame (code
3630 passed. Now they are extracted from the caller's frame (code
3627 snatched from Eric Jones' weave). Added better documentation to
3631 snatched from Eric Jones' weave). Added better documentation to
3628 the section on embedding and the example file.
3632 the section on embedding and the example file.
3629
3633
3630 * IPython/genutils.py (page): Changed so that under emacs, it just
3634 * IPython/genutils.py (page): Changed so that under emacs, it just
3631 prints the string. You can then page up and down in the emacs
3635 prints the string. You can then page up and down in the emacs
3632 buffer itself. This is how the builtin help() works.
3636 buffer itself. This is how the builtin help() works.
3633
3637
3634 * IPython/Prompts.py (CachedOutput.__call__): Fixed issue with
3638 * IPython/Prompts.py (CachedOutput.__call__): Fixed issue with
3635 macro scoping: macros need to be executed in the user's namespace
3639 macro scoping: macros need to be executed in the user's namespace
3636 to work as if they had been typed by the user.
3640 to work as if they had been typed by the user.
3637
3641
3638 * IPython/Magic.py (Magic.magic_macro): Changed macros so they
3642 * IPython/Magic.py (Magic.magic_macro): Changed macros so they
3639 execute automatically (no need to type 'exec...'). They then
3643 execute automatically (no need to type 'exec...'). They then
3640 behave like 'true macros'. The printing system was also modified
3644 behave like 'true macros'. The printing system was also modified
3641 for this to work.
3645 for this to work.
3642
3646
3643 2002-02-19 Fernando Perez <fperez@colorado.edu>
3647 2002-02-19 Fernando Perez <fperez@colorado.edu>
3644
3648
3645 * IPython/genutils.py (page_file): new function for paging files
3649 * IPython/genutils.py (page_file): new function for paging files
3646 in an OS-independent way. Also necessary for file viewing to work
3650 in an OS-independent way. Also necessary for file viewing to work
3647 well inside Emacs buffers.
3651 well inside Emacs buffers.
3648 (page): Added checks for being in an emacs buffer.
3652 (page): Added checks for being in an emacs buffer.
3649 (page): fixed bug for Windows ($TERM isn't set in Windows). Fixed
3653 (page): fixed bug for Windows ($TERM isn't set in Windows). Fixed
3650 same bug in iplib.
3654 same bug in iplib.
3651
3655
3652 2002-02-18 Fernando Perez <fperez@colorado.edu>
3656 2002-02-18 Fernando Perez <fperez@colorado.edu>
3653
3657
3654 * IPython/iplib.py (InteractiveShell.init_readline): modified use
3658 * IPython/iplib.py (InteractiveShell.init_readline): modified use
3655 of readline so that IPython can work inside an Emacs buffer.
3659 of readline so that IPython can work inside an Emacs buffer.
3656
3660
3657 * IPython/ultraTB.py (AutoFormattedTB.__call__): some fixes to
3661 * IPython/ultraTB.py (AutoFormattedTB.__call__): some fixes to
3658 method signatures (they weren't really bugs, but it looks cleaner
3662 method signatures (they weren't really bugs, but it looks cleaner
3659 and keeps PyChecker happy).
3663 and keeps PyChecker happy).
3660
3664
3661 * IPython/ipmaker.py (make_IPython): added hooks Struct to __IP
3665 * IPython/ipmaker.py (make_IPython): added hooks Struct to __IP
3662 for implementing various user-defined hooks. Currently only
3666 for implementing various user-defined hooks. Currently only
3663 display is done.
3667 display is done.
3664
3668
3665 * IPython/Prompts.py (CachedOutput._display): changed display
3669 * IPython/Prompts.py (CachedOutput._display): changed display
3666 functions so that they can be dynamically changed by users easily.
3670 functions so that they can be dynamically changed by users easily.
3667
3671
3668 * IPython/Extensions/numeric_formats.py (num_display): added an
3672 * IPython/Extensions/numeric_formats.py (num_display): added an
3669 extension for printing NumPy arrays in flexible manners. It
3673 extension for printing NumPy arrays in flexible manners. It
3670 doesn't do anything yet, but all the structure is in
3674 doesn't do anything yet, but all the structure is in
3671 place. Ultimately the plan is to implement output format control
3675 place. Ultimately the plan is to implement output format control
3672 like in Octave.
3676 like in Octave.
3673
3677
3674 * IPython/Magic.py (Magic.lsmagic): changed so that bound magic
3678 * IPython/Magic.py (Magic.lsmagic): changed so that bound magic
3675 methods are found at run-time by all the automatic machinery.
3679 methods are found at run-time by all the automatic machinery.
3676
3680
3677 2002-02-17 Fernando Perez <fperez@colorado.edu>
3681 2002-02-17 Fernando Perez <fperez@colorado.edu>
3678
3682
3679 * setup_Windows.py (make_shortcut): documented. Cleaned up the
3683 * setup_Windows.py (make_shortcut): documented. Cleaned up the
3680 whole file a little.
3684 whole file a little.
3681
3685
3682 * ToDo: closed this document. Now there's a new_design.lyx
3686 * ToDo: closed this document. Now there's a new_design.lyx
3683 document for all new ideas. Added making a pdf of it for the
3687 document for all new ideas. Added making a pdf of it for the
3684 end-user distro.
3688 end-user distro.
3685
3689
3686 * IPython/Logger.py (Logger.switch_log): Created this to replace
3690 * IPython/Logger.py (Logger.switch_log): Created this to replace
3687 logon() and logoff(). It also fixes a nasty crash reported by
3691 logon() and logoff(). It also fixes a nasty crash reported by
3688 Philip Hisley <compsys-AT-starpower.net>. Many thanks to him.
3692 Philip Hisley <compsys-AT-starpower.net>. Many thanks to him.
3689
3693
3690 * IPython/iplib.py (complete): got auto-completion to work with
3694 * IPython/iplib.py (complete): got auto-completion to work with
3691 automagic (I had wanted this for a long time).
3695 automagic (I had wanted this for a long time).
3692
3696
3693 * IPython/Magic.py (Magic.magic_files): Added @files as an alias
3697 * IPython/Magic.py (Magic.magic_files): Added @files as an alias
3694 to @file, since file() is now a builtin and clashes with automagic
3698 to @file, since file() is now a builtin and clashes with automagic
3695 for @file.
3699 for @file.
3696
3700
3697 * Made some new files: Prompts, CrashHandler, Magic, Logger. All
3701 * Made some new files: Prompts, CrashHandler, Magic, Logger. All
3698 of this was previously in iplib, which had grown to more than 2000
3702 of this was previously in iplib, which had grown to more than 2000
3699 lines, way too long. No new functionality, but it makes managing
3703 lines, way too long. No new functionality, but it makes managing
3700 the code a bit easier.
3704 the code a bit easier.
3701
3705
3702 * IPython/iplib.py (IPythonCrashHandler.__call__): Added version
3706 * IPython/iplib.py (IPythonCrashHandler.__call__): Added version
3703 information to crash reports.
3707 information to crash reports.
3704
3708
3705 2002-02-12 Fernando Perez <fperez@colorado.edu>
3709 2002-02-12 Fernando Perez <fperez@colorado.edu>
3706
3710
3707 * Released 0.2.5.
3711 * Released 0.2.5.
3708
3712
3709 2002-02-11 Fernando Perez <fperez@colorado.edu>
3713 2002-02-11 Fernando Perez <fperez@colorado.edu>
3710
3714
3711 * Wrote a relatively complete Windows installer. It puts
3715 * Wrote a relatively complete Windows installer. It puts
3712 everything in place, creates Start Menu entries and fixes the
3716 everything in place, creates Start Menu entries and fixes the
3713 color issues. Nothing fancy, but it works.
3717 color issues. Nothing fancy, but it works.
3714
3718
3715 2002-02-10 Fernando Perez <fperez@colorado.edu>
3719 2002-02-10 Fernando Perez <fperez@colorado.edu>
3716
3720
3717 * IPython/iplib.py (InteractiveShell.safe_execfile): added an
3721 * IPython/iplib.py (InteractiveShell.safe_execfile): added an
3718 os.path.expanduser() call so that we can type @run ~/myfile.py and
3722 os.path.expanduser() call so that we can type @run ~/myfile.py and
3719 have thigs work as expected.
3723 have thigs work as expected.
3720
3724
3721 * IPython/genutils.py (page): fixed exception handling so things
3725 * IPython/genutils.py (page): fixed exception handling so things
3722 work both in Unix and Windows correctly. Quitting a pager triggers
3726 work both in Unix and Windows correctly. Quitting a pager triggers
3723 an IOError/broken pipe in Unix, and in windows not finding a pager
3727 an IOError/broken pipe in Unix, and in windows not finding a pager
3724 is also an IOError, so I had to actually look at the return value
3728 is also an IOError, so I had to actually look at the return value
3725 of the exception, not just the exception itself. Should be ok now.
3729 of the exception, not just the exception itself. Should be ok now.
3726
3730
3727 * IPython/ultraTB.py (ColorSchemeTable.set_active_scheme):
3731 * IPython/ultraTB.py (ColorSchemeTable.set_active_scheme):
3728 modified to allow case-insensitive color scheme changes.
3732 modified to allow case-insensitive color scheme changes.
3729
3733
3730 2002-02-09 Fernando Perez <fperez@colorado.edu>
3734 2002-02-09 Fernando Perez <fperez@colorado.edu>
3731
3735
3732 * IPython/genutils.py (native_line_ends): new function to leave
3736 * IPython/genutils.py (native_line_ends): new function to leave
3733 user config files with os-native line-endings.
3737 user config files with os-native line-endings.
3734
3738
3735 * README and manual updates.
3739 * README and manual updates.
3736
3740
3737 * IPython/genutils.py: fixed unicode bug: use types.StringTypes
3741 * IPython/genutils.py: fixed unicode bug: use types.StringTypes
3738 instead of StringType to catch Unicode strings.
3742 instead of StringType to catch Unicode strings.
3739
3743
3740 * IPython/genutils.py (filefind): fixed bug for paths with
3744 * IPython/genutils.py (filefind): fixed bug for paths with
3741 embedded spaces (very common in Windows).
3745 embedded spaces (very common in Windows).
3742
3746
3743 * IPython/ipmaker.py (make_IPython): added a '.ini' to the rc
3747 * IPython/ipmaker.py (make_IPython): added a '.ini' to the rc
3744 files under Windows, so that they get automatically associated
3748 files under Windows, so that they get automatically associated
3745 with a text editor. Windows makes it a pain to handle
3749 with a text editor. Windows makes it a pain to handle
3746 extension-less files.
3750 extension-less files.
3747
3751
3748 * IPython/iplib.py (InteractiveShell.init_readline): Made the
3752 * IPython/iplib.py (InteractiveShell.init_readline): Made the
3749 warning about readline only occur for Posix. In Windows there's no
3753 warning about readline only occur for Posix. In Windows there's no
3750 way to get readline, so why bother with the warning.
3754 way to get readline, so why bother with the warning.
3751
3755
3752 * IPython/Struct.py (Struct.__str__): fixed to use self.__dict__
3756 * IPython/Struct.py (Struct.__str__): fixed to use self.__dict__
3753 for __str__ instead of dir(self), since dir() changed in 2.2.
3757 for __str__ instead of dir(self), since dir() changed in 2.2.
3754
3758
3755 * Ported to Windows! Tested on XP, I suspect it should work fine
3759 * Ported to Windows! Tested on XP, I suspect it should work fine
3756 on NT/2000, but I don't think it will work on 98 et al. That
3760 on NT/2000, but I don't think it will work on 98 et al. That
3757 series of Windows is such a piece of junk anyway that I won't try
3761 series of Windows is such a piece of junk anyway that I won't try
3758 porting it there. The XP port was straightforward, showed a few
3762 porting it there. The XP port was straightforward, showed a few
3759 bugs here and there (fixed all), in particular some string
3763 bugs here and there (fixed all), in particular some string
3760 handling stuff which required considering Unicode strings (which
3764 handling stuff which required considering Unicode strings (which
3761 Windows uses). This is good, but hasn't been too tested :) No
3765 Windows uses). This is good, but hasn't been too tested :) No
3762 fancy installer yet, I'll put a note in the manual so people at
3766 fancy installer yet, I'll put a note in the manual so people at
3763 least make manually a shortcut.
3767 least make manually a shortcut.
3764
3768
3765 * IPython/iplib.py (Magic.magic_colors): Unified the color options
3769 * IPython/iplib.py (Magic.magic_colors): Unified the color options
3766 into a single one, "colors". This now controls both prompt and
3770 into a single one, "colors". This now controls both prompt and
3767 exception color schemes, and can be changed both at startup
3771 exception color schemes, and can be changed both at startup
3768 (either via command-line switches or via ipythonrc files) and at
3772 (either via command-line switches or via ipythonrc files) and at
3769 runtime, with @colors.
3773 runtime, with @colors.
3770 (Magic.magic_run): renamed @prun to @run and removed the old
3774 (Magic.magic_run): renamed @prun to @run and removed the old
3771 @run. The two were too similar to warrant keeping both.
3775 @run. The two were too similar to warrant keeping both.
3772
3776
3773 2002-02-03 Fernando Perez <fperez@colorado.edu>
3777 2002-02-03 Fernando Perez <fperez@colorado.edu>
3774
3778
3775 * IPython/iplib.py (install_first_time): Added comment on how to
3779 * IPython/iplib.py (install_first_time): Added comment on how to
3776 configure the color options for first-time users. Put a <return>
3780 configure the color options for first-time users. Put a <return>
3777 request at the end so that small-terminal users get a chance to
3781 request at the end so that small-terminal users get a chance to
3778 read the startup info.
3782 read the startup info.
3779
3783
3780 2002-01-23 Fernando Perez <fperez@colorado.edu>
3784 2002-01-23 Fernando Perez <fperez@colorado.edu>
3781
3785
3782 * IPython/iplib.py (CachedOutput.update): Changed output memory
3786 * IPython/iplib.py (CachedOutput.update): Changed output memory
3783 variable names from _o,_oo,_ooo,_o<n> to simply _,__,___,_<n>. For
3787 variable names from _o,_oo,_ooo,_o<n> to simply _,__,___,_<n>. For
3784 input history we still use _i. Did this b/c these variable are
3788 input history we still use _i. Did this b/c these variable are
3785 very commonly used in interactive work, so the less we need to
3789 very commonly used in interactive work, so the less we need to
3786 type the better off we are.
3790 type the better off we are.
3787 (Magic.magic_prun): updated @prun to better handle the namespaces
3791 (Magic.magic_prun): updated @prun to better handle the namespaces
3788 the file will run in, including a fix for __name__ not being set
3792 the file will run in, including a fix for __name__ not being set
3789 before.
3793 before.
3790
3794
3791 2002-01-20 Fernando Perez <fperez@colorado.edu>
3795 2002-01-20 Fernando Perez <fperez@colorado.edu>
3792
3796
3793 * IPython/ultraTB.py (VerboseTB.linereader): Fixed printing of
3797 * IPython/ultraTB.py (VerboseTB.linereader): Fixed printing of
3794 extra garbage for Python 2.2. Need to look more carefully into
3798 extra garbage for Python 2.2. Need to look more carefully into
3795 this later.
3799 this later.
3796
3800
3797 2002-01-19 Fernando Perez <fperez@colorado.edu>
3801 2002-01-19 Fernando Perez <fperez@colorado.edu>
3798
3802
3799 * IPython/iplib.py (InteractiveShell.showtraceback): fixed to
3803 * IPython/iplib.py (InteractiveShell.showtraceback): fixed to
3800 display SyntaxError exceptions properly formatted when they occur
3804 display SyntaxError exceptions properly formatted when they occur
3801 (they can be triggered by imported code).
3805 (they can be triggered by imported code).
3802
3806
3803 2002-01-18 Fernando Perez <fperez@colorado.edu>
3807 2002-01-18 Fernando Perez <fperez@colorado.edu>
3804
3808
3805 * IPython/iplib.py (InteractiveShell.safe_execfile): now
3809 * IPython/iplib.py (InteractiveShell.safe_execfile): now
3806 SyntaxError exceptions are reported nicely formatted, instead of
3810 SyntaxError exceptions are reported nicely formatted, instead of
3807 spitting out only offset information as before.
3811 spitting out only offset information as before.
3808 (Magic.magic_prun): Added the @prun function for executing
3812 (Magic.magic_prun): Added the @prun function for executing
3809 programs with command line args inside IPython.
3813 programs with command line args inside IPython.
3810
3814
3811 2002-01-16 Fernando Perez <fperez@colorado.edu>
3815 2002-01-16 Fernando Perez <fperez@colorado.edu>
3812
3816
3813 * IPython/iplib.py (Magic.magic_hist): Changed @hist and @dhist
3817 * IPython/iplib.py (Magic.magic_hist): Changed @hist and @dhist
3814 to *not* include the last item given in a range. This brings their
3818 to *not* include the last item given in a range. This brings their
3815 behavior in line with Python's slicing:
3819 behavior in line with Python's slicing:
3816 a[n1:n2] -> a[n1]...a[n2-1]
3820 a[n1:n2] -> a[n1]...a[n2-1]
3817 It may be a bit less convenient, but I prefer to stick to Python's
3821 It may be a bit less convenient, but I prefer to stick to Python's
3818 conventions *everywhere*, so users never have to wonder.
3822 conventions *everywhere*, so users never have to wonder.
3819 (Magic.magic_macro): Added @macro function to ease the creation of
3823 (Magic.magic_macro): Added @macro function to ease the creation of
3820 macros.
3824 macros.
3821
3825
3822 2002-01-05 Fernando Perez <fperez@colorado.edu>
3826 2002-01-05 Fernando Perez <fperez@colorado.edu>
3823
3827
3824 * Released 0.2.4.
3828 * Released 0.2.4.
3825
3829
3826 * IPython/iplib.py (Magic.magic_pdef):
3830 * IPython/iplib.py (Magic.magic_pdef):
3827 (InteractiveShell.safe_execfile): report magic lines and error
3831 (InteractiveShell.safe_execfile): report magic lines and error
3828 lines without line numbers so one can easily copy/paste them for
3832 lines without line numbers so one can easily copy/paste them for
3829 re-execution.
3833 re-execution.
3830
3834
3831 * Updated manual with recent changes.
3835 * Updated manual with recent changes.
3832
3836
3833 * IPython/iplib.py (Magic.magic_oinfo): added constructor
3837 * IPython/iplib.py (Magic.magic_oinfo): added constructor
3834 docstring printing when class? is called. Very handy for knowing
3838 docstring printing when class? is called. Very handy for knowing
3835 how to create class instances (as long as __init__ is well
3839 how to create class instances (as long as __init__ is well
3836 documented, of course :)
3840 documented, of course :)
3837 (Magic.magic_doc): print both class and constructor docstrings.
3841 (Magic.magic_doc): print both class and constructor docstrings.
3838 (Magic.magic_pdef): give constructor info if passed a class and
3842 (Magic.magic_pdef): give constructor info if passed a class and
3839 __call__ info for callable object instances.
3843 __call__ info for callable object instances.
3840
3844
3841 2002-01-04 Fernando Perez <fperez@colorado.edu>
3845 2002-01-04 Fernando Perez <fperez@colorado.edu>
3842
3846
3843 * Made deep_reload() off by default. It doesn't always work
3847 * Made deep_reload() off by default. It doesn't always work
3844 exactly as intended, so it's probably safer to have it off. It's
3848 exactly as intended, so it's probably safer to have it off. It's
3845 still available as dreload() anyway, so nothing is lost.
3849 still available as dreload() anyway, so nothing is lost.
3846
3850
3847 2002-01-02 Fernando Perez <fperez@colorado.edu>
3851 2002-01-02 Fernando Perez <fperez@colorado.edu>
3848
3852
3849 * Released 0.2.3 (contacted R.Singh at CU about biopython course,
3853 * Released 0.2.3 (contacted R.Singh at CU about biopython course,
3850 so I wanted an updated release).
3854 so I wanted an updated release).
3851
3855
3852 2001-12-27 Fernando Perez <fperez@colorado.edu>
3856 2001-12-27 Fernando Perez <fperez@colorado.edu>
3853
3857
3854 * IPython/iplib.py (InteractiveShell.interact): Added the original
3858 * IPython/iplib.py (InteractiveShell.interact): Added the original
3855 code from 'code.py' for this module in order to change the
3859 code from 'code.py' for this module in order to change the
3856 handling of a KeyboardInterrupt. This was necessary b/c otherwise
3860 handling of a KeyboardInterrupt. This was necessary b/c otherwise
3857 the history cache would break when the user hit Ctrl-C, and
3861 the history cache would break when the user hit Ctrl-C, and
3858 interact() offers no way to add any hooks to it.
3862 interact() offers no way to add any hooks to it.
3859
3863
3860 2001-12-23 Fernando Perez <fperez@colorado.edu>
3864 2001-12-23 Fernando Perez <fperez@colorado.edu>
3861
3865
3862 * setup.py: added check for 'MANIFEST' before trying to remove
3866 * setup.py: added check for 'MANIFEST' before trying to remove
3863 it. Thanks to Sean Reifschneider.
3867 it. Thanks to Sean Reifschneider.
3864
3868
3865 2001-12-22 Fernando Perez <fperez@colorado.edu>
3869 2001-12-22 Fernando Perez <fperez@colorado.edu>
3866
3870
3867 * Released 0.2.2.
3871 * Released 0.2.2.
3868
3872
3869 * Finished (reasonably) writing the manual. Later will add the
3873 * Finished (reasonably) writing the manual. Later will add the
3870 python-standard navigation stylesheets, but for the time being
3874 python-standard navigation stylesheets, but for the time being
3871 it's fairly complete. Distribution will include html and pdf
3875 it's fairly complete. Distribution will include html and pdf
3872 versions.
3876 versions.
3873
3877
3874 * Bugfix: '.' wasn't being added to sys.path. Thanks to Prabhu
3878 * Bugfix: '.' wasn't being added to sys.path. Thanks to Prabhu
3875 (MayaVi author).
3879 (MayaVi author).
3876
3880
3877 2001-12-21 Fernando Perez <fperez@colorado.edu>
3881 2001-12-21 Fernando Perez <fperez@colorado.edu>
3878
3882
3879 * Released 0.2.1. Barring any nasty bugs, this is it as far as a
3883 * Released 0.2.1. Barring any nasty bugs, this is it as far as a
3880 good public release, I think (with the manual and the distutils
3884 good public release, I think (with the manual and the distutils
3881 installer). The manual can use some work, but that can go
3885 installer). The manual can use some work, but that can go
3882 slowly. Otherwise I think it's quite nice for end users. Next
3886 slowly. Otherwise I think it's quite nice for end users. Next
3883 summer, rewrite the guts of it...
3887 summer, rewrite the guts of it...
3884
3888
3885 * Changed format of ipythonrc files to use whitespace as the
3889 * Changed format of ipythonrc files to use whitespace as the
3886 separator instead of an explicit '='. Cleaner.
3890 separator instead of an explicit '='. Cleaner.
3887
3891
3888 2001-12-20 Fernando Perez <fperez@colorado.edu>
3892 2001-12-20 Fernando Perez <fperez@colorado.edu>
3889
3893
3890 * Started a manual in LyX. For now it's just a quick merge of the
3894 * Started a manual in LyX. For now it's just a quick merge of the
3891 various internal docstrings and READMEs. Later it may grow into a
3895 various internal docstrings and READMEs. Later it may grow into a
3892 nice, full-blown manual.
3896 nice, full-blown manual.
3893
3897
3894 * Set up a distutils based installer. Installation should now be
3898 * Set up a distutils based installer. Installation should now be
3895 trivially simple for end-users.
3899 trivially simple for end-users.
3896
3900
3897 2001-12-11 Fernando Perez <fperez@colorado.edu>
3901 2001-12-11 Fernando Perez <fperez@colorado.edu>
3898
3902
3899 * Released 0.2.0. First public release, announced it at
3903 * Released 0.2.0. First public release, announced it at
3900 comp.lang.python. From now on, just bugfixes...
3904 comp.lang.python. From now on, just bugfixes...
3901
3905
3902 * Went through all the files, set copyright/license notices and
3906 * Went through all the files, set copyright/license notices and
3903 cleaned up things. Ready for release.
3907 cleaned up things. Ready for release.
3904
3908
3905 2001-12-10 Fernando Perez <fperez@colorado.edu>
3909 2001-12-10 Fernando Perez <fperez@colorado.edu>
3906
3910
3907 * Changed the first-time installer not to use tarfiles. It's more
3911 * Changed the first-time installer not to use tarfiles. It's more
3908 robust now and less unix-dependent. Also makes it easier for
3912 robust now and less unix-dependent. Also makes it easier for
3909 people to later upgrade versions.
3913 people to later upgrade versions.
3910
3914
3911 * Changed @exit to @abort to reflect the fact that it's pretty
3915 * Changed @exit to @abort to reflect the fact that it's pretty
3912 brutal (a sys.exit()). The difference between @abort and Ctrl-D
3916 brutal (a sys.exit()). The difference between @abort and Ctrl-D
3913 becomes significant only when IPyhton is embedded: in that case,
3917 becomes significant only when IPyhton is embedded: in that case,
3914 C-D closes IPython only, but @abort kills the enclosing program
3918 C-D closes IPython only, but @abort kills the enclosing program
3915 too (unless it had called IPython inside a try catching
3919 too (unless it had called IPython inside a try catching
3916 SystemExit).
3920 SystemExit).
3917
3921
3918 * Created Shell module which exposes the actuall IPython Shell
3922 * Created Shell module which exposes the actuall IPython Shell
3919 classes, currently the normal and the embeddable one. This at
3923 classes, currently the normal and the embeddable one. This at
3920 least offers a stable interface we won't need to change when
3924 least offers a stable interface we won't need to change when
3921 (later) the internals are rewritten. That rewrite will be confined
3925 (later) the internals are rewritten. That rewrite will be confined
3922 to iplib and ipmaker, but the Shell interface should remain as is.
3926 to iplib and ipmaker, but the Shell interface should remain as is.
3923
3927
3924 * Added embed module which offers an embeddable IPShell object,
3928 * Added embed module which offers an embeddable IPShell object,
3925 useful to fire up IPython *inside* a running program. Great for
3929 useful to fire up IPython *inside* a running program. Great for
3926 debugging or dynamical data analysis.
3930 debugging or dynamical data analysis.
3927
3931
3928 2001-12-08 Fernando Perez <fperez@colorado.edu>
3932 2001-12-08 Fernando Perez <fperez@colorado.edu>
3929
3933
3930 * Fixed small bug preventing seeing info from methods of defined
3934 * Fixed small bug preventing seeing info from methods of defined
3931 objects (incorrect namespace in _ofind()).
3935 objects (incorrect namespace in _ofind()).
3932
3936
3933 * Documentation cleanup. Moved the main usage docstrings to a
3937 * Documentation cleanup. Moved the main usage docstrings to a
3934 separate file, usage.py (cleaner to maintain, and hopefully in the
3938 separate file, usage.py (cleaner to maintain, and hopefully in the
3935 future some perlpod-like way of producing interactive, man and
3939 future some perlpod-like way of producing interactive, man and
3936 html docs out of it will be found).
3940 html docs out of it will be found).
3937
3941
3938 * Added @profile to see your profile at any time.
3942 * Added @profile to see your profile at any time.
3939
3943
3940 * Added @p as an alias for 'print'. It's especially convenient if
3944 * Added @p as an alias for 'print'. It's especially convenient if
3941 using automagic ('p x' prints x).
3945 using automagic ('p x' prints x).
3942
3946
3943 * Small cleanups and fixes after a pychecker run.
3947 * Small cleanups and fixes after a pychecker run.
3944
3948
3945 * Changed the @cd command to handle @cd - and @cd -<n> for
3949 * Changed the @cd command to handle @cd - and @cd -<n> for
3946 visiting any directory in _dh.
3950 visiting any directory in _dh.
3947
3951
3948 * Introduced _dh, a history of visited directories. @dhist prints
3952 * Introduced _dh, a history of visited directories. @dhist prints
3949 it out with numbers.
3953 it out with numbers.
3950
3954
3951 2001-12-07 Fernando Perez <fperez@colorado.edu>
3955 2001-12-07 Fernando Perez <fperez@colorado.edu>
3952
3956
3953 * Released 0.1.22
3957 * Released 0.1.22
3954
3958
3955 * Made initialization a bit more robust against invalid color
3959 * Made initialization a bit more robust against invalid color
3956 options in user input (exit, not traceback-crash).
3960 options in user input (exit, not traceback-crash).
3957
3961
3958 * Changed the bug crash reporter to write the report only in the
3962 * Changed the bug crash reporter to write the report only in the
3959 user's .ipython directory. That way IPython won't litter people's
3963 user's .ipython directory. That way IPython won't litter people's
3960 hard disks with crash files all over the place. Also print on
3964 hard disks with crash files all over the place. Also print on
3961 screen the necessary mail command.
3965 screen the necessary mail command.
3962
3966
3963 * With the new ultraTB, implemented LightBG color scheme for light
3967 * With the new ultraTB, implemented LightBG color scheme for light
3964 background terminals. A lot of people like white backgrounds, so I
3968 background terminals. A lot of people like white backgrounds, so I
3965 guess we should at least give them something readable.
3969 guess we should at least give them something readable.
3966
3970
3967 2001-12-06 Fernando Perez <fperez@colorado.edu>
3971 2001-12-06 Fernando Perez <fperez@colorado.edu>
3968
3972
3969 * Modified the structure of ultraTB. Now there's a proper class
3973 * Modified the structure of ultraTB. Now there's a proper class
3970 for tables of color schemes which allow adding schemes easily and
3974 for tables of color schemes which allow adding schemes easily and
3971 switching the active scheme without creating a new instance every
3975 switching the active scheme without creating a new instance every
3972 time (which was ridiculous). The syntax for creating new schemes
3976 time (which was ridiculous). The syntax for creating new schemes
3973 is also cleaner. I think ultraTB is finally done, with a clean
3977 is also cleaner. I think ultraTB is finally done, with a clean
3974 class structure. Names are also much cleaner (now there's proper
3978 class structure. Names are also much cleaner (now there's proper
3975 color tables, no need for every variable to also have 'color' in
3979 color tables, no need for every variable to also have 'color' in
3976 its name).
3980 its name).
3977
3981
3978 * Broke down genutils into separate files. Now genutils only
3982 * Broke down genutils into separate files. Now genutils only
3979 contains utility functions, and classes have been moved to their
3983 contains utility functions, and classes have been moved to their
3980 own files (they had enough independent functionality to warrant
3984 own files (they had enough independent functionality to warrant
3981 it): ConfigLoader, OutputTrap, Struct.
3985 it): ConfigLoader, OutputTrap, Struct.
3982
3986
3983 2001-12-05 Fernando Perez <fperez@colorado.edu>
3987 2001-12-05 Fernando Perez <fperez@colorado.edu>
3984
3988
3985 * IPython turns 21! Released version 0.1.21, as a candidate for
3989 * IPython turns 21! Released version 0.1.21, as a candidate for
3986 public consumption. If all goes well, release in a few days.
3990 public consumption. If all goes well, release in a few days.
3987
3991
3988 * Fixed path bug (files in Extensions/ directory wouldn't be found
3992 * Fixed path bug (files in Extensions/ directory wouldn't be found
3989 unless IPython/ was explicitly in sys.path).
3993 unless IPython/ was explicitly in sys.path).
3990
3994
3991 * Extended the FlexCompleter class as MagicCompleter to allow
3995 * Extended the FlexCompleter class as MagicCompleter to allow
3992 completion of @-starting lines.
3996 completion of @-starting lines.
3993
3997
3994 * Created __release__.py file as a central repository for release
3998 * Created __release__.py file as a central repository for release
3995 info that other files can read from.
3999 info that other files can read from.
3996
4000
3997 * Fixed small bug in logging: when logging was turned on in
4001 * Fixed small bug in logging: when logging was turned on in
3998 mid-session, old lines with special meanings (!@?) were being
4002 mid-session, old lines with special meanings (!@?) were being
3999 logged without the prepended comment, which is necessary since
4003 logged without the prepended comment, which is necessary since
4000 they are not truly valid python syntax. This should make session
4004 they are not truly valid python syntax. This should make session
4001 restores produce less errors.
4005 restores produce less errors.
4002
4006
4003 * The namespace cleanup forced me to make a FlexCompleter class
4007 * The namespace cleanup forced me to make a FlexCompleter class
4004 which is nothing but a ripoff of rlcompleter, but with selectable
4008 which is nothing but a ripoff of rlcompleter, but with selectable
4005 namespace (rlcompleter only works in __main__.__dict__). I'll try
4009 namespace (rlcompleter only works in __main__.__dict__). I'll try
4006 to submit a note to the authors to see if this change can be
4010 to submit a note to the authors to see if this change can be
4007 incorporated in future rlcompleter releases (Dec.6: done)
4011 incorporated in future rlcompleter releases (Dec.6: done)
4008
4012
4009 * More fixes to namespace handling. It was a mess! Now all
4013 * More fixes to namespace handling. It was a mess! Now all
4010 explicit references to __main__.__dict__ are gone (except when
4014 explicit references to __main__.__dict__ are gone (except when
4011 really needed) and everything is handled through the namespace
4015 really needed) and everything is handled through the namespace
4012 dicts in the IPython instance. We seem to be getting somewhere
4016 dicts in the IPython instance. We seem to be getting somewhere
4013 with this, finally...
4017 with this, finally...
4014
4018
4015 * Small documentation updates.
4019 * Small documentation updates.
4016
4020
4017 * Created the Extensions directory under IPython (with an
4021 * Created the Extensions directory under IPython (with an
4018 __init__.py). Put the PhysicalQ stuff there. This directory should
4022 __init__.py). Put the PhysicalQ stuff there. This directory should
4019 be used for all special-purpose extensions.
4023 be used for all special-purpose extensions.
4020
4024
4021 * File renaming:
4025 * File renaming:
4022 ipythonlib --> ipmaker
4026 ipythonlib --> ipmaker
4023 ipplib --> iplib
4027 ipplib --> iplib
4024 This makes a bit more sense in terms of what these files actually do.
4028 This makes a bit more sense in terms of what these files actually do.
4025
4029
4026 * Moved all the classes and functions in ipythonlib to ipplib, so
4030 * Moved all the classes and functions in ipythonlib to ipplib, so
4027 now ipythonlib only has make_IPython(). This will ease up its
4031 now ipythonlib only has make_IPython(). This will ease up its
4028 splitting in smaller functional chunks later.
4032 splitting in smaller functional chunks later.
4029
4033
4030 * Cleaned up (done, I think) output of @whos. Better column
4034 * Cleaned up (done, I think) output of @whos. Better column
4031 formatting, and now shows str(var) for as much as it can, which is
4035 formatting, and now shows str(var) for as much as it can, which is
4032 typically what one gets with a 'print var'.
4036 typically what one gets with a 'print var'.
4033
4037
4034 2001-12-04 Fernando Perez <fperez@colorado.edu>
4038 2001-12-04 Fernando Perez <fperez@colorado.edu>
4035
4039
4036 * Fixed namespace problems. Now builtin/IPyhton/user names get
4040 * Fixed namespace problems. Now builtin/IPyhton/user names get
4037 properly reported in their namespace. Internal namespace handling
4041 properly reported in their namespace. Internal namespace handling
4038 is finally getting decent (not perfect yet, but much better than
4042 is finally getting decent (not perfect yet, but much better than
4039 the ad-hoc mess we had).
4043 the ad-hoc mess we had).
4040
4044
4041 * Removed -exit option. If people just want to run a python
4045 * Removed -exit option. If people just want to run a python
4042 script, that's what the normal interpreter is for. Less
4046 script, that's what the normal interpreter is for. Less
4043 unnecessary options, less chances for bugs.
4047 unnecessary options, less chances for bugs.
4044
4048
4045 * Added a crash handler which generates a complete post-mortem if
4049 * Added a crash handler which generates a complete post-mortem if
4046 IPython crashes. This will help a lot in tracking bugs down the
4050 IPython crashes. This will help a lot in tracking bugs down the
4047 road.
4051 road.
4048
4052
4049 * Fixed nasty bug in auto-evaluation part of prefilter(). Names
4053 * Fixed nasty bug in auto-evaluation part of prefilter(). Names
4050 which were boud to functions being reassigned would bypass the
4054 which were boud to functions being reassigned would bypass the
4051 logger, breaking the sync of _il with the prompt counter. This
4055 logger, breaking the sync of _il with the prompt counter. This
4052 would then crash IPython later when a new line was logged.
4056 would then crash IPython later when a new line was logged.
4053
4057
4054 2001-12-02 Fernando Perez <fperez@colorado.edu>
4058 2001-12-02 Fernando Perez <fperez@colorado.edu>
4055
4059
4056 * Made IPython a package. This means people don't have to clutter
4060 * Made IPython a package. This means people don't have to clutter
4057 their sys.path with yet another directory. Changed the INSTALL
4061 their sys.path with yet another directory. Changed the INSTALL
4058 file accordingly.
4062 file accordingly.
4059
4063
4060 * Cleaned up the output of @who_ls, @who and @whos. @who_ls now
4064 * Cleaned up the output of @who_ls, @who and @whos. @who_ls now
4061 sorts its output (so @who shows it sorted) and @whos formats the
4065 sorts its output (so @who shows it sorted) and @whos formats the
4062 table according to the width of the first column. Nicer, easier to
4066 table according to the width of the first column. Nicer, easier to
4063 read. Todo: write a generic table_format() which takes a list of
4067 read. Todo: write a generic table_format() which takes a list of
4064 lists and prints it nicely formatted, with optional row/column
4068 lists and prints it nicely formatted, with optional row/column
4065 separators and proper padding and justification.
4069 separators and proper padding and justification.
4066
4070
4067 * Released 0.1.20
4071 * Released 0.1.20
4068
4072
4069 * Fixed bug in @log which would reverse the inputcache list (a
4073 * Fixed bug in @log which would reverse the inputcache list (a
4070 copy operation was missing).
4074 copy operation was missing).
4071
4075
4072 * Code cleanup. @config was changed to use page(). Better, since
4076 * Code cleanup. @config was changed to use page(). Better, since
4073 its output is always quite long.
4077 its output is always quite long.
4074
4078
4075 * Itpl is back as a dependency. I was having too many problems
4079 * Itpl is back as a dependency. I was having too many problems
4076 getting the parametric aliases to work reliably, and it's just
4080 getting the parametric aliases to work reliably, and it's just
4077 easier to code weird string operations with it than playing %()s
4081 easier to code weird string operations with it than playing %()s
4078 games. It's only ~6k, so I don't think it's too big a deal.
4082 games. It's only ~6k, so I don't think it's too big a deal.
4079
4083
4080 * Found (and fixed) a very nasty bug with history. !lines weren't
4084 * Found (and fixed) a very nasty bug with history. !lines weren't
4081 getting cached, and the out of sync caches would crash
4085 getting cached, and the out of sync caches would crash
4082 IPython. Fixed it by reorganizing the prefilter/handlers/logger
4086 IPython. Fixed it by reorganizing the prefilter/handlers/logger
4083 division of labor a bit better. Bug fixed, cleaner structure.
4087 division of labor a bit better. Bug fixed, cleaner structure.
4084
4088
4085 2001-12-01 Fernando Perez <fperez@colorado.edu>
4089 2001-12-01 Fernando Perez <fperez@colorado.edu>
4086
4090
4087 * Released 0.1.19
4091 * Released 0.1.19
4088
4092
4089 * Added option -n to @hist to prevent line number printing. Much
4093 * Added option -n to @hist to prevent line number printing. Much
4090 easier to copy/paste code this way.
4094 easier to copy/paste code this way.
4091
4095
4092 * Created global _il to hold the input list. Allows easy
4096 * Created global _il to hold the input list. Allows easy
4093 re-execution of blocks of code by slicing it (inspired by Janko's
4097 re-execution of blocks of code by slicing it (inspired by Janko's
4094 comment on 'macros').
4098 comment on 'macros').
4095
4099
4096 * Small fixes and doc updates.
4100 * Small fixes and doc updates.
4097
4101
4098 * Rewrote @history function (was @h). Renamed it to @hist, @h is
4102 * Rewrote @history function (was @h). Renamed it to @hist, @h is
4099 much too fragile with automagic. Handles properly multi-line
4103 much too fragile with automagic. Handles properly multi-line
4100 statements and takes parameters.
4104 statements and takes parameters.
4101
4105
4102 2001-11-30 Fernando Perez <fperez@colorado.edu>
4106 2001-11-30 Fernando Perez <fperez@colorado.edu>
4103
4107
4104 * Version 0.1.18 released.
4108 * Version 0.1.18 released.
4105
4109
4106 * Fixed nasty namespace bug in initial module imports.
4110 * Fixed nasty namespace bug in initial module imports.
4107
4111
4108 * Added copyright/license notes to all code files (except
4112 * Added copyright/license notes to all code files (except
4109 DPyGetOpt). For the time being, LGPL. That could change.
4113 DPyGetOpt). For the time being, LGPL. That could change.
4110
4114
4111 * Rewrote a much nicer README, updated INSTALL, cleaned up
4115 * Rewrote a much nicer README, updated INSTALL, cleaned up
4112 ipythonrc-* samples.
4116 ipythonrc-* samples.
4113
4117
4114 * Overall code/documentation cleanup. Basically ready for
4118 * Overall code/documentation cleanup. Basically ready for
4115 release. Only remaining thing: licence decision (LGPL?).
4119 release. Only remaining thing: licence decision (LGPL?).
4116
4120
4117 * Converted load_config to a class, ConfigLoader. Now recursion
4121 * Converted load_config to a class, ConfigLoader. Now recursion
4118 control is better organized. Doesn't include the same file twice.
4122 control is better organized. Doesn't include the same file twice.
4119
4123
4120 2001-11-29 Fernando Perez <fperez@colorado.edu>
4124 2001-11-29 Fernando Perez <fperez@colorado.edu>
4121
4125
4122 * Got input history working. Changed output history variables from
4126 * Got input history working. Changed output history variables from
4123 _p to _o so that _i is for input and _o for output. Just cleaner
4127 _p to _o so that _i is for input and _o for output. Just cleaner
4124 convention.
4128 convention.
4125
4129
4126 * Implemented parametric aliases. This pretty much allows the
4130 * Implemented parametric aliases. This pretty much allows the
4127 alias system to offer full-blown shell convenience, I think.
4131 alias system to offer full-blown shell convenience, I think.
4128
4132
4129 * Version 0.1.17 released, 0.1.18 opened.
4133 * Version 0.1.17 released, 0.1.18 opened.
4130
4134
4131 * dot_ipython/ipythonrc (alias): added documentation.
4135 * dot_ipython/ipythonrc (alias): added documentation.
4132 (xcolor): Fixed small bug (xcolors -> xcolor)
4136 (xcolor): Fixed small bug (xcolors -> xcolor)
4133
4137
4134 * Changed the alias system. Now alias is a magic command to define
4138 * Changed the alias system. Now alias is a magic command to define
4135 aliases just like the shell. Rationale: the builtin magics should
4139 aliases just like the shell. Rationale: the builtin magics should
4136 be there for things deeply connected to IPython's
4140 be there for things deeply connected to IPython's
4137 architecture. And this is a much lighter system for what I think
4141 architecture. And this is a much lighter system for what I think
4138 is the really important feature: allowing users to define quickly
4142 is the really important feature: allowing users to define quickly
4139 magics that will do shell things for them, so they can customize
4143 magics that will do shell things for them, so they can customize
4140 IPython easily to match their work habits. If someone is really
4144 IPython easily to match their work habits. If someone is really
4141 desperate to have another name for a builtin alias, they can
4145 desperate to have another name for a builtin alias, they can
4142 always use __IP.magic_newname = __IP.magic_oldname. Hackish but
4146 always use __IP.magic_newname = __IP.magic_oldname. Hackish but
4143 works.
4147 works.
4144
4148
4145 2001-11-28 Fernando Perez <fperez@colorado.edu>
4149 2001-11-28 Fernando Perez <fperez@colorado.edu>
4146
4150
4147 * Changed @file so that it opens the source file at the proper
4151 * Changed @file so that it opens the source file at the proper
4148 line. Since it uses less, if your EDITOR environment is
4152 line. Since it uses less, if your EDITOR environment is
4149 configured, typing v will immediately open your editor of choice
4153 configured, typing v will immediately open your editor of choice
4150 right at the line where the object is defined. Not as quick as
4154 right at the line where the object is defined. Not as quick as
4151 having a direct @edit command, but for all intents and purposes it
4155 having a direct @edit command, but for all intents and purposes it
4152 works. And I don't have to worry about writing @edit to deal with
4156 works. And I don't have to worry about writing @edit to deal with
4153 all the editors, less does that.
4157 all the editors, less does that.
4154
4158
4155 * Version 0.1.16 released, 0.1.17 opened.
4159 * Version 0.1.16 released, 0.1.17 opened.
4156
4160
4157 * Fixed some nasty bugs in the page/page_dumb combo that could
4161 * Fixed some nasty bugs in the page/page_dumb combo that could
4158 crash IPython.
4162 crash IPython.
4159
4163
4160 2001-11-27 Fernando Perez <fperez@colorado.edu>
4164 2001-11-27 Fernando Perez <fperez@colorado.edu>
4161
4165
4162 * Version 0.1.15 released, 0.1.16 opened.
4166 * Version 0.1.15 released, 0.1.16 opened.
4163
4167
4164 * Finally got ? and ?? to work for undefined things: now it's
4168 * Finally got ? and ?? to work for undefined things: now it's
4165 possible to type {}.get? and get information about the get method
4169 possible to type {}.get? and get information about the get method
4166 of dicts, or os.path? even if only os is defined (so technically
4170 of dicts, or os.path? even if only os is defined (so technically
4167 os.path isn't). Works at any level. For example, after import os,
4171 os.path isn't). Works at any level. For example, after import os,
4168 os?, os.path?, os.path.abspath? all work. This is great, took some
4172 os?, os.path?, os.path.abspath? all work. This is great, took some
4169 work in _ofind.
4173 work in _ofind.
4170
4174
4171 * Fixed more bugs with logging. The sanest way to do it was to add
4175 * Fixed more bugs with logging. The sanest way to do it was to add
4172 to @log a 'mode' parameter. Killed two in one shot (this mode
4176 to @log a 'mode' parameter. Killed two in one shot (this mode
4173 option was a request of Janko's). I think it's finally clean
4177 option was a request of Janko's). I think it's finally clean
4174 (famous last words).
4178 (famous last words).
4175
4179
4176 * Added a page_dumb() pager which does a decent job of paging on
4180 * Added a page_dumb() pager which does a decent job of paging on
4177 screen, if better things (like less) aren't available. One less
4181 screen, if better things (like less) aren't available. One less
4178 unix dependency (someday maybe somebody will port this to
4182 unix dependency (someday maybe somebody will port this to
4179 windows).
4183 windows).
4180
4184
4181 * Fixed problem in magic_log: would lock of logging out if log
4185 * Fixed problem in magic_log: would lock of logging out if log
4182 creation failed (because it would still think it had succeeded).
4186 creation failed (because it would still think it had succeeded).
4183
4187
4184 * Improved the page() function using curses to auto-detect screen
4188 * Improved the page() function using curses to auto-detect screen
4185 size. Now it can make a much better decision on whether to print
4189 size. Now it can make a much better decision on whether to print
4186 or page a string. Option screen_length was modified: a value 0
4190 or page a string. Option screen_length was modified: a value 0
4187 means auto-detect, and that's the default now.
4191 means auto-detect, and that's the default now.
4188
4192
4189 * Version 0.1.14 released, 0.1.15 opened. I think this is ready to
4193 * Version 0.1.14 released, 0.1.15 opened. I think this is ready to
4190 go out. I'll test it for a few days, then talk to Janko about
4194 go out. I'll test it for a few days, then talk to Janko about
4191 licences and announce it.
4195 licences and announce it.
4192
4196
4193 * Fixed the length of the auto-generated ---> prompt which appears
4197 * Fixed the length of the auto-generated ---> prompt which appears
4194 for auto-parens and auto-quotes. Getting this right isn't trivial,
4198 for auto-parens and auto-quotes. Getting this right isn't trivial,
4195 with all the color escapes, different prompt types and optional
4199 with all the color escapes, different prompt types and optional
4196 separators. But it seems to be working in all the combinations.
4200 separators. But it seems to be working in all the combinations.
4197
4201
4198 2001-11-26 Fernando Perez <fperez@colorado.edu>
4202 2001-11-26 Fernando Perez <fperez@colorado.edu>
4199
4203
4200 * Wrote a regexp filter to get option types from the option names
4204 * Wrote a regexp filter to get option types from the option names
4201 string. This eliminates the need to manually keep two duplicate
4205 string. This eliminates the need to manually keep two duplicate
4202 lists.
4206 lists.
4203
4207
4204 * Removed the unneeded check_option_names. Now options are handled
4208 * Removed the unneeded check_option_names. Now options are handled
4205 in a much saner manner and it's easy to visually check that things
4209 in a much saner manner and it's easy to visually check that things
4206 are ok.
4210 are ok.
4207
4211
4208 * Updated version numbers on all files I modified to carry a
4212 * Updated version numbers on all files I modified to carry a
4209 notice so Janko and Nathan have clear version markers.
4213 notice so Janko and Nathan have clear version markers.
4210
4214
4211 * Updated docstring for ultraTB with my changes. I should send
4215 * Updated docstring for ultraTB with my changes. I should send
4212 this to Nathan.
4216 this to Nathan.
4213
4217
4214 * Lots of small fixes. Ran everything through pychecker again.
4218 * Lots of small fixes. Ran everything through pychecker again.
4215
4219
4216 * Made loading of deep_reload an cmd line option. If it's not too
4220 * Made loading of deep_reload an cmd line option. If it's not too
4217 kosher, now people can just disable it. With -nodeep_reload it's
4221 kosher, now people can just disable it. With -nodeep_reload it's
4218 still available as dreload(), it just won't overwrite reload().
4222 still available as dreload(), it just won't overwrite reload().
4219
4223
4220 * Moved many options to the no| form (-opt and -noopt
4224 * Moved many options to the no| form (-opt and -noopt
4221 accepted). Cleaner.
4225 accepted). Cleaner.
4222
4226
4223 * Changed magic_log so that if called with no parameters, it uses
4227 * Changed magic_log so that if called with no parameters, it uses
4224 'rotate' mode. That way auto-generated logs aren't automatically
4228 'rotate' mode. That way auto-generated logs aren't automatically
4225 over-written. For normal logs, now a backup is made if it exists
4229 over-written. For normal logs, now a backup is made if it exists
4226 (only 1 level of backups). A new 'backup' mode was added to the
4230 (only 1 level of backups). A new 'backup' mode was added to the
4227 Logger class to support this. This was a request by Janko.
4231 Logger class to support this. This was a request by Janko.
4228
4232
4229 * Added @logoff/@logon to stop/restart an active log.
4233 * Added @logoff/@logon to stop/restart an active log.
4230
4234
4231 * Fixed a lot of bugs in log saving/replay. It was pretty
4235 * Fixed a lot of bugs in log saving/replay. It was pretty
4232 broken. Now special lines (!@,/) appear properly in the command
4236 broken. Now special lines (!@,/) appear properly in the command
4233 history after a log replay.
4237 history after a log replay.
4234
4238
4235 * Tried and failed to implement full session saving via pickle. My
4239 * Tried and failed to implement full session saving via pickle. My
4236 idea was to pickle __main__.__dict__, but modules can't be
4240 idea was to pickle __main__.__dict__, but modules can't be
4237 pickled. This would be a better alternative to replaying logs, but
4241 pickled. This would be a better alternative to replaying logs, but
4238 seems quite tricky to get to work. Changed -session to be called
4242 seems quite tricky to get to work. Changed -session to be called
4239 -logplay, which more accurately reflects what it does. And if we
4243 -logplay, which more accurately reflects what it does. And if we
4240 ever get real session saving working, -session is now available.
4244 ever get real session saving working, -session is now available.
4241
4245
4242 * Implemented color schemes for prompts also. As for tracebacks,
4246 * Implemented color schemes for prompts also. As for tracebacks,
4243 currently only NoColor and Linux are supported. But now the
4247 currently only NoColor and Linux are supported. But now the
4244 infrastructure is in place, based on a generic ColorScheme
4248 infrastructure is in place, based on a generic ColorScheme
4245 class. So writing and activating new schemes both for the prompts
4249 class. So writing and activating new schemes both for the prompts
4246 and the tracebacks should be straightforward.
4250 and the tracebacks should be straightforward.
4247
4251
4248 * Version 0.1.13 released, 0.1.14 opened.
4252 * Version 0.1.13 released, 0.1.14 opened.
4249
4253
4250 * Changed handling of options for output cache. Now counter is
4254 * Changed handling of options for output cache. Now counter is
4251 hardwired starting at 1 and one specifies the maximum number of
4255 hardwired starting at 1 and one specifies the maximum number of
4252 entries *in the outcache* (not the max prompt counter). This is
4256 entries *in the outcache* (not the max prompt counter). This is
4253 much better, since many statements won't increase the cache
4257 much better, since many statements won't increase the cache
4254 count. It also eliminated some confusing options, now there's only
4258 count. It also eliminated some confusing options, now there's only
4255 one: cache_size.
4259 one: cache_size.
4256
4260
4257 * Added 'alias' magic function and magic_alias option in the
4261 * Added 'alias' magic function and magic_alias option in the
4258 ipythonrc file. Now the user can easily define whatever names he
4262 ipythonrc file. Now the user can easily define whatever names he
4259 wants for the magic functions without having to play weird
4263 wants for the magic functions without having to play weird
4260 namespace games. This gives IPython a real shell-like feel.
4264 namespace games. This gives IPython a real shell-like feel.
4261
4265
4262 * Fixed doc/?/?? for magics. Now all work, in all forms (explicit
4266 * Fixed doc/?/?? for magics. Now all work, in all forms (explicit
4263 @ or not).
4267 @ or not).
4264
4268
4265 This was one of the last remaining 'visible' bugs (that I know
4269 This was one of the last remaining 'visible' bugs (that I know
4266 of). I think if I can clean up the session loading so it works
4270 of). I think if I can clean up the session loading so it works
4267 100% I'll release a 0.2.0 version on c.p.l (talk to Janko first
4271 100% I'll release a 0.2.0 version on c.p.l (talk to Janko first
4268 about licensing).
4272 about licensing).
4269
4273
4270 2001-11-25 Fernando Perez <fperez@colorado.edu>
4274 2001-11-25 Fernando Perez <fperez@colorado.edu>
4271
4275
4272 * Rewrote somewhat oinfo (?/??). Nicer, now uses page() and
4276 * Rewrote somewhat oinfo (?/??). Nicer, now uses page() and
4273 there's a cleaner distinction between what ? and ?? show.
4277 there's a cleaner distinction between what ? and ?? show.
4274
4278
4275 * Added screen_length option. Now the user can define his own
4279 * Added screen_length option. Now the user can define his own
4276 screen size for page() operations.
4280 screen size for page() operations.
4277
4281
4278 * Implemented magic shell-like functions with automatic code
4282 * Implemented magic shell-like functions with automatic code
4279 generation. Now adding another function is just a matter of adding
4283 generation. Now adding another function is just a matter of adding
4280 an entry to a dict, and the function is dynamically generated at
4284 an entry to a dict, and the function is dynamically generated at
4281 run-time. Python has some really cool features!
4285 run-time. Python has some really cool features!
4282
4286
4283 * Renamed many options to cleanup conventions a little. Now all
4287 * Renamed many options to cleanup conventions a little. Now all
4284 are lowercase, and only underscores where needed. Also in the code
4288 are lowercase, and only underscores where needed. Also in the code
4285 option name tables are clearer.
4289 option name tables are clearer.
4286
4290
4287 * Changed prompts a little. Now input is 'In [n]:' instead of
4291 * Changed prompts a little. Now input is 'In [n]:' instead of
4288 'In[n]:='. This allows it the numbers to be aligned with the
4292 'In[n]:='. This allows it the numbers to be aligned with the
4289 Out[n] numbers, and removes usage of ':=' which doesn't exist in
4293 Out[n] numbers, and removes usage of ':=' which doesn't exist in
4290 Python (it was a Mathematica thing). The '...' continuation prompt
4294 Python (it was a Mathematica thing). The '...' continuation prompt
4291 was also changed a little to align better.
4295 was also changed a little to align better.
4292
4296
4293 * Fixed bug when flushing output cache. Not all _p<n> variables
4297 * Fixed bug when flushing output cache. Not all _p<n> variables
4294 exist, so their deletion needs to be wrapped in a try:
4298 exist, so their deletion needs to be wrapped in a try:
4295
4299
4296 * Figured out how to properly use inspect.formatargspec() (it
4300 * Figured out how to properly use inspect.formatargspec() (it
4297 requires the args preceded by *). So I removed all the code from
4301 requires the args preceded by *). So I removed all the code from
4298 _get_pdef in Magic, which was just replicating that.
4302 _get_pdef in Magic, which was just replicating that.
4299
4303
4300 * Added test to prefilter to allow redefining magic function names
4304 * Added test to prefilter to allow redefining magic function names
4301 as variables. This is ok, since the @ form is always available,
4305 as variables. This is ok, since the @ form is always available,
4302 but whe should allow the user to define a variable called 'ls' if
4306 but whe should allow the user to define a variable called 'ls' if
4303 he needs it.
4307 he needs it.
4304
4308
4305 * Moved the ToDo information from README into a separate ToDo.
4309 * Moved the ToDo information from README into a separate ToDo.
4306
4310
4307 * General code cleanup and small bugfixes. I think it's close to a
4311 * General code cleanup and small bugfixes. I think it's close to a
4308 state where it can be released, obviously with a big 'beta'
4312 state where it can be released, obviously with a big 'beta'
4309 warning on it.
4313 warning on it.
4310
4314
4311 * Got the magic function split to work. Now all magics are defined
4315 * Got the magic function split to work. Now all magics are defined
4312 in a separate class. It just organizes things a bit, and now
4316 in a separate class. It just organizes things a bit, and now
4313 Xemacs behaves nicer (it was choking on InteractiveShell b/c it
4317 Xemacs behaves nicer (it was choking on InteractiveShell b/c it
4314 was too long).
4318 was too long).
4315
4319
4316 * Changed @clear to @reset to avoid potential confusions with
4320 * Changed @clear to @reset to avoid potential confusions with
4317 the shell command clear. Also renamed @cl to @clear, which does
4321 the shell command clear. Also renamed @cl to @clear, which does
4318 exactly what people expect it to from their shell experience.
4322 exactly what people expect it to from their shell experience.
4319
4323
4320 Added a check to the @reset command (since it's so
4324 Added a check to the @reset command (since it's so
4321 destructive, it's probably a good idea to ask for confirmation).
4325 destructive, it's probably a good idea to ask for confirmation).
4322 But now reset only works for full namespace resetting. Since the
4326 But now reset only works for full namespace resetting. Since the
4323 del keyword is already there for deleting a few specific
4327 del keyword is already there for deleting a few specific
4324 variables, I don't see the point of having a redundant magic
4328 variables, I don't see the point of having a redundant magic
4325 function for the same task.
4329 function for the same task.
4326
4330
4327 2001-11-24 Fernando Perez <fperez@colorado.edu>
4331 2001-11-24 Fernando Perez <fperez@colorado.edu>
4328
4332
4329 * Updated the builtin docs (esp. the ? ones).
4333 * Updated the builtin docs (esp. the ? ones).
4330
4334
4331 * Ran all the code through pychecker. Not terribly impressed with
4335 * Ran all the code through pychecker. Not terribly impressed with
4332 it: lots of spurious warnings and didn't really find anything of
4336 it: lots of spurious warnings and didn't really find anything of
4333 substance (just a few modules being imported and not used).
4337 substance (just a few modules being imported and not used).
4334
4338
4335 * Implemented the new ultraTB functionality into IPython. New
4339 * Implemented the new ultraTB functionality into IPython. New
4336 option: xcolors. This chooses color scheme. xmode now only selects
4340 option: xcolors. This chooses color scheme. xmode now only selects
4337 between Plain and Verbose. Better orthogonality.
4341 between Plain and Verbose. Better orthogonality.
4338
4342
4339 * Large rewrite of ultraTB. Much cleaner now, with a separation of
4343 * Large rewrite of ultraTB. Much cleaner now, with a separation of
4340 mode and color scheme for the exception handlers. Now it's
4344 mode and color scheme for the exception handlers. Now it's
4341 possible to have the verbose traceback with no coloring.
4345 possible to have the verbose traceback with no coloring.
4342
4346
4343 2001-11-23 Fernando Perez <fperez@colorado.edu>
4347 2001-11-23 Fernando Perez <fperez@colorado.edu>
4344
4348
4345 * Version 0.1.12 released, 0.1.13 opened.
4349 * Version 0.1.12 released, 0.1.13 opened.
4346
4350
4347 * Removed option to set auto-quote and auto-paren escapes by
4351 * Removed option to set auto-quote and auto-paren escapes by
4348 user. The chances of breaking valid syntax are just too high. If
4352 user. The chances of breaking valid syntax are just too high. If
4349 someone *really* wants, they can always dig into the code.
4353 someone *really* wants, they can always dig into the code.
4350
4354
4351 * Made prompt separators configurable.
4355 * Made prompt separators configurable.
4352
4356
4353 2001-11-22 Fernando Perez <fperez@colorado.edu>
4357 2001-11-22 Fernando Perez <fperez@colorado.edu>
4354
4358
4355 * Small bugfixes in many places.
4359 * Small bugfixes in many places.
4356
4360
4357 * Removed the MyCompleter class from ipplib. It seemed redundant
4361 * Removed the MyCompleter class from ipplib. It seemed redundant
4358 with the C-p,C-n history search functionality. Less code to
4362 with the C-p,C-n history search functionality. Less code to
4359 maintain.
4363 maintain.
4360
4364
4361 * Moved all the original ipython.py code into ipythonlib.py. Right
4365 * Moved all the original ipython.py code into ipythonlib.py. Right
4362 now it's just one big dump into a function called make_IPython, so
4366 now it's just one big dump into a function called make_IPython, so
4363 no real modularity has been gained. But at least it makes the
4367 no real modularity has been gained. But at least it makes the
4364 wrapper script tiny, and since ipythonlib is a module, it gets
4368 wrapper script tiny, and since ipythonlib is a module, it gets
4365 compiled and startup is much faster.
4369 compiled and startup is much faster.
4366
4370
4367 This is a reasobably 'deep' change, so we should test it for a
4371 This is a reasobably 'deep' change, so we should test it for a
4368 while without messing too much more with the code.
4372 while without messing too much more with the code.
4369
4373
4370 2001-11-21 Fernando Perez <fperez@colorado.edu>
4374 2001-11-21 Fernando Perez <fperez@colorado.edu>
4371
4375
4372 * Version 0.1.11 released, 0.1.12 opened for further work.
4376 * Version 0.1.11 released, 0.1.12 opened for further work.
4373
4377
4374 * Removed dependency on Itpl. It was only needed in one place. It
4378 * Removed dependency on Itpl. It was only needed in one place. It
4375 would be nice if this became part of python, though. It makes life
4379 would be nice if this became part of python, though. It makes life
4376 *a lot* easier in some cases.
4380 *a lot* easier in some cases.
4377
4381
4378 * Simplified the prefilter code a bit. Now all handlers are
4382 * Simplified the prefilter code a bit. Now all handlers are
4379 expected to explicitly return a value (at least a blank string).
4383 expected to explicitly return a value (at least a blank string).
4380
4384
4381 * Heavy edits in ipplib. Removed the help system altogether. Now
4385 * Heavy edits in ipplib. Removed the help system altogether. Now
4382 obj?/?? is used for inspecting objects, a magic @doc prints
4386 obj?/?? is used for inspecting objects, a magic @doc prints
4383 docstrings, and full-blown Python help is accessed via the 'help'
4387 docstrings, and full-blown Python help is accessed via the 'help'
4384 keyword. This cleans up a lot of code (less to maintain) and does
4388 keyword. This cleans up a lot of code (less to maintain) and does
4385 the job. Since 'help' is now a standard Python component, might as
4389 the job. Since 'help' is now a standard Python component, might as
4386 well use it and remove duplicate functionality.
4390 well use it and remove duplicate functionality.
4387
4391
4388 Also removed the option to use ipplib as a standalone program. By
4392 Also removed the option to use ipplib as a standalone program. By
4389 now it's too dependent on other parts of IPython to function alone.
4393 now it's too dependent on other parts of IPython to function alone.
4390
4394
4391 * Fixed bug in genutils.pager. It would crash if the pager was
4395 * Fixed bug in genutils.pager. It would crash if the pager was
4392 exited immediately after opening (broken pipe).
4396 exited immediately after opening (broken pipe).
4393
4397
4394 * Trimmed down the VerboseTB reporting a little. The header is
4398 * Trimmed down the VerboseTB reporting a little. The header is
4395 much shorter now and the repeated exception arguments at the end
4399 much shorter now and the repeated exception arguments at the end
4396 have been removed. For interactive use the old header seemed a bit
4400 have been removed. For interactive use the old header seemed a bit
4397 excessive.
4401 excessive.
4398
4402
4399 * Fixed small bug in output of @whos for variables with multi-word
4403 * Fixed small bug in output of @whos for variables with multi-word
4400 types (only first word was displayed).
4404 types (only first word was displayed).
4401
4405
4402 2001-11-17 Fernando Perez <fperez@colorado.edu>
4406 2001-11-17 Fernando Perez <fperez@colorado.edu>
4403
4407
4404 * Version 0.1.10 released, 0.1.11 opened for further work.
4408 * Version 0.1.10 released, 0.1.11 opened for further work.
4405
4409
4406 * Modified dirs and friends. dirs now *returns* the stack (not
4410 * Modified dirs and friends. dirs now *returns* the stack (not
4407 prints), so one can manipulate it as a variable. Convenient to
4411 prints), so one can manipulate it as a variable. Convenient to
4408 travel along many directories.
4412 travel along many directories.
4409
4413
4410 * Fixed bug in magic_pdef: would only work with functions with
4414 * Fixed bug in magic_pdef: would only work with functions with
4411 arguments with default values.
4415 arguments with default values.
4412
4416
4413 2001-11-14 Fernando Perez <fperez@colorado.edu>
4417 2001-11-14 Fernando Perez <fperez@colorado.edu>
4414
4418
4415 * Added the PhysicsInput stuff to dot_ipython so it ships as an
4419 * Added the PhysicsInput stuff to dot_ipython so it ships as an
4416 example with IPython. Various other minor fixes and cleanups.
4420 example with IPython. Various other minor fixes and cleanups.
4417
4421
4418 * Version 0.1.9 released, 0.1.10 opened for further work.
4422 * Version 0.1.9 released, 0.1.10 opened for further work.
4419
4423
4420 * Added sys.path to the list of directories searched in the
4424 * Added sys.path to the list of directories searched in the
4421 execfile= option. It used to be the current directory and the
4425 execfile= option. It used to be the current directory and the
4422 user's IPYTHONDIR only.
4426 user's IPYTHONDIR only.
4423
4427
4424 2001-11-13 Fernando Perez <fperez@colorado.edu>
4428 2001-11-13 Fernando Perez <fperez@colorado.edu>
4425
4429
4426 * Reinstated the raw_input/prefilter separation that Janko had
4430 * Reinstated the raw_input/prefilter separation that Janko had
4427 initially. This gives a more convenient setup for extending the
4431 initially. This gives a more convenient setup for extending the
4428 pre-processor from the outside: raw_input always gets a string,
4432 pre-processor from the outside: raw_input always gets a string,
4429 and prefilter has to process it. We can then redefine prefilter
4433 and prefilter has to process it. We can then redefine prefilter
4430 from the outside and implement extensions for special
4434 from the outside and implement extensions for special
4431 purposes.
4435 purposes.
4432
4436
4433 Today I got one for inputting PhysicalQuantity objects
4437 Today I got one for inputting PhysicalQuantity objects
4434 (from Scientific) without needing any function calls at
4438 (from Scientific) without needing any function calls at
4435 all. Extremely convenient, and it's all done as a user-level
4439 all. Extremely convenient, and it's all done as a user-level
4436 extension (no IPython code was touched). Now instead of:
4440 extension (no IPython code was touched). Now instead of:
4437 a = PhysicalQuantity(4.2,'m/s**2')
4441 a = PhysicalQuantity(4.2,'m/s**2')
4438 one can simply say
4442 one can simply say
4439 a = 4.2 m/s**2
4443 a = 4.2 m/s**2
4440 or even
4444 or even
4441 a = 4.2 m/s^2
4445 a = 4.2 m/s^2
4442
4446
4443 I use this, but it's also a proof of concept: IPython really is
4447 I use this, but it's also a proof of concept: IPython really is
4444 fully user-extensible, even at the level of the parsing of the
4448 fully user-extensible, even at the level of the parsing of the
4445 command line. It's not trivial, but it's perfectly doable.
4449 command line. It's not trivial, but it's perfectly doable.
4446
4450
4447 * Added 'add_flip' method to inclusion conflict resolver. Fixes
4451 * Added 'add_flip' method to inclusion conflict resolver. Fixes
4448 the problem of modules being loaded in the inverse order in which
4452 the problem of modules being loaded in the inverse order in which
4449 they were defined in
4453 they were defined in
4450
4454
4451 * Version 0.1.8 released, 0.1.9 opened for further work.
4455 * Version 0.1.8 released, 0.1.9 opened for further work.
4452
4456
4453 * Added magics pdef, source and file. They respectively show the
4457 * Added magics pdef, source and file. They respectively show the
4454 definition line ('prototype' in C), source code and full python
4458 definition line ('prototype' in C), source code and full python
4455 file for any callable object. The object inspector oinfo uses
4459 file for any callable object. The object inspector oinfo uses
4456 these to show the same information.
4460 these to show the same information.
4457
4461
4458 * Version 0.1.7 released, 0.1.8 opened for further work.
4462 * Version 0.1.7 released, 0.1.8 opened for further work.
4459
4463
4460 * Separated all the magic functions into a class called Magic. The
4464 * Separated all the magic functions into a class called Magic. The
4461 InteractiveShell class was becoming too big for Xemacs to handle
4465 InteractiveShell class was becoming too big for Xemacs to handle
4462 (de-indenting a line would lock it up for 10 seconds while it
4466 (de-indenting a line would lock it up for 10 seconds while it
4463 backtracked on the whole class!)
4467 backtracked on the whole class!)
4464
4468
4465 FIXME: didn't work. It can be done, but right now namespaces are
4469 FIXME: didn't work. It can be done, but right now namespaces are
4466 all messed up. Do it later (reverted it for now, so at least
4470 all messed up. Do it later (reverted it for now, so at least
4467 everything works as before).
4471 everything works as before).
4468
4472
4469 * Got the object introspection system (magic_oinfo) working! I
4473 * Got the object introspection system (magic_oinfo) working! I
4470 think this is pretty much ready for release to Janko, so he can
4474 think this is pretty much ready for release to Janko, so he can
4471 test it for a while and then announce it. Pretty much 100% of what
4475 test it for a while and then announce it. Pretty much 100% of what
4472 I wanted for the 'phase 1' release is ready. Happy, tired.
4476 I wanted for the 'phase 1' release is ready. Happy, tired.
4473
4477
4474 2001-11-12 Fernando Perez <fperez@colorado.edu>
4478 2001-11-12 Fernando Perez <fperez@colorado.edu>
4475
4479
4476 * Version 0.1.6 released, 0.1.7 opened for further work.
4480 * Version 0.1.6 released, 0.1.7 opened for further work.
4477
4481
4478 * Fixed bug in printing: it used to test for truth before
4482 * Fixed bug in printing: it used to test for truth before
4479 printing, so 0 wouldn't print. Now checks for None.
4483 printing, so 0 wouldn't print. Now checks for None.
4480
4484
4481 * Fixed bug where auto-execs increase the prompt counter by 2 (b/c
4485 * Fixed bug where auto-execs increase the prompt counter by 2 (b/c
4482 they have to call len(str(sys.ps1)) ). But the fix is ugly, it
4486 they have to call len(str(sys.ps1)) ). But the fix is ugly, it
4483 reaches by hand into the outputcache. Think of a better way to do
4487 reaches by hand into the outputcache. Think of a better way to do
4484 this later.
4488 this later.
4485
4489
4486 * Various small fixes thanks to Nathan's comments.
4490 * Various small fixes thanks to Nathan's comments.
4487
4491
4488 * Changed magic_pprint to magic_Pprint. This way it doesn't
4492 * Changed magic_pprint to magic_Pprint. This way it doesn't
4489 collide with pprint() and the name is consistent with the command
4493 collide with pprint() and the name is consistent with the command
4490 line option.
4494 line option.
4491
4495
4492 * Changed prompt counter behavior to be fully like
4496 * Changed prompt counter behavior to be fully like
4493 Mathematica's. That is, even input that doesn't return a result
4497 Mathematica's. That is, even input that doesn't return a result
4494 raises the prompt counter. The old behavior was kind of confusing
4498 raises the prompt counter. The old behavior was kind of confusing
4495 (getting the same prompt number several times if the operation
4499 (getting the same prompt number several times if the operation
4496 didn't return a result).
4500 didn't return a result).
4497
4501
4498 * Fixed Nathan's last name in a couple of places (Gray, not Graham).
4502 * Fixed Nathan's last name in a couple of places (Gray, not Graham).
4499
4503
4500 * Fixed -Classic mode (wasn't working anymore).
4504 * Fixed -Classic mode (wasn't working anymore).
4501
4505
4502 * Added colored prompts using Nathan's new code. Colors are
4506 * Added colored prompts using Nathan's new code. Colors are
4503 currently hardwired, they can be user-configurable. For
4507 currently hardwired, they can be user-configurable. For
4504 developers, they can be chosen in file ipythonlib.py, at the
4508 developers, they can be chosen in file ipythonlib.py, at the
4505 beginning of the CachedOutput class def.
4509 beginning of the CachedOutput class def.
4506
4510
4507 2001-11-11 Fernando Perez <fperez@colorado.edu>
4511 2001-11-11 Fernando Perez <fperez@colorado.edu>
4508
4512
4509 * Version 0.1.5 released, 0.1.6 opened for further work.
4513 * Version 0.1.5 released, 0.1.6 opened for further work.
4510
4514
4511 * Changed magic_env to *return* the environment as a dict (not to
4515 * Changed magic_env to *return* the environment as a dict (not to
4512 print it). This way it prints, but it can also be processed.
4516 print it). This way it prints, but it can also be processed.
4513
4517
4514 * Added Verbose exception reporting to interactive
4518 * Added Verbose exception reporting to interactive
4515 exceptions. Very nice, now even 1/0 at the prompt gives a verbose
4519 exceptions. Very nice, now even 1/0 at the prompt gives a verbose
4516 traceback. Had to make some changes to the ultraTB file. This is
4520 traceback. Had to make some changes to the ultraTB file. This is
4517 probably the last 'big' thing in my mental todo list. This ties
4521 probably the last 'big' thing in my mental todo list. This ties
4518 in with the next entry:
4522 in with the next entry:
4519
4523
4520 * Changed -Xi and -Xf to a single -xmode option. Now all the user
4524 * Changed -Xi and -Xf to a single -xmode option. Now all the user
4521 has to specify is Plain, Color or Verbose for all exception
4525 has to specify is Plain, Color or Verbose for all exception
4522 handling.
4526 handling.
4523
4527
4524 * Removed ShellServices option. All this can really be done via
4528 * Removed ShellServices option. All this can really be done via
4525 the magic system. It's easier to extend, cleaner and has automatic
4529 the magic system. It's easier to extend, cleaner and has automatic
4526 namespace protection and documentation.
4530 namespace protection and documentation.
4527
4531
4528 2001-11-09 Fernando Perez <fperez@colorado.edu>
4532 2001-11-09 Fernando Perez <fperez@colorado.edu>
4529
4533
4530 * Fixed bug in output cache flushing (missing parameter to
4534 * Fixed bug in output cache flushing (missing parameter to
4531 __init__). Other small bugs fixed (found using pychecker).
4535 __init__). Other small bugs fixed (found using pychecker).
4532
4536
4533 * Version 0.1.4 opened for bugfixing.
4537 * Version 0.1.4 opened for bugfixing.
4534
4538
4535 2001-11-07 Fernando Perez <fperez@colorado.edu>
4539 2001-11-07 Fernando Perez <fperez@colorado.edu>
4536
4540
4537 * Version 0.1.3 released, mainly because of the raw_input bug.
4541 * Version 0.1.3 released, mainly because of the raw_input bug.
4538
4542
4539 * Fixed NASTY bug in raw_input: input line wasn't properly parsed
4543 * Fixed NASTY bug in raw_input: input line wasn't properly parsed
4540 and when testing for whether things were callable, a call could
4544 and when testing for whether things were callable, a call could
4541 actually be made to certain functions. They would get called again
4545 actually be made to certain functions. They would get called again
4542 once 'really' executed, with a resulting double call. A disaster
4546 once 'really' executed, with a resulting double call. A disaster
4543 in many cases (list.reverse() would never work!).
4547 in many cases (list.reverse() would never work!).
4544
4548
4545 * Removed prefilter() function, moved its code to raw_input (which
4549 * Removed prefilter() function, moved its code to raw_input (which
4546 after all was just a near-empty caller for prefilter). This saves
4550 after all was just a near-empty caller for prefilter). This saves
4547 a function call on every prompt, and simplifies the class a tiny bit.
4551 a function call on every prompt, and simplifies the class a tiny bit.
4548
4552
4549 * Fix _ip to __ip name in magic example file.
4553 * Fix _ip to __ip name in magic example file.
4550
4554
4551 * Changed 'tar -x -f' to 'tar xvf' in auto-installer. This should
4555 * Changed 'tar -x -f' to 'tar xvf' in auto-installer. This should
4552 work with non-gnu versions of tar.
4556 work with non-gnu versions of tar.
4553
4557
4554 2001-11-06 Fernando Perez <fperez@colorado.edu>
4558 2001-11-06 Fernando Perez <fperez@colorado.edu>
4555
4559
4556 * Version 0.1.2. Just to keep track of the recent changes.
4560 * Version 0.1.2. Just to keep track of the recent changes.
4557
4561
4558 * Fixed nasty bug in output prompt routine. It used to check 'if
4562 * Fixed nasty bug in output prompt routine. It used to check 'if
4559 arg != None...'. Problem is, this fails if arg implements a
4563 arg != None...'. Problem is, this fails if arg implements a
4560 special comparison (__cmp__) which disallows comparing to
4564 special comparison (__cmp__) which disallows comparing to
4561 None. Found it when trying to use the PhysicalQuantity module from
4565 None. Found it when trying to use the PhysicalQuantity module from
4562 ScientificPython.
4566 ScientificPython.
4563
4567
4564 2001-11-05 Fernando Perez <fperez@colorado.edu>
4568 2001-11-05 Fernando Perez <fperez@colorado.edu>
4565
4569
4566 * Also added dirs. Now the pushd/popd/dirs family functions
4570 * Also added dirs. Now the pushd/popd/dirs family functions
4567 basically like the shell, with the added convenience of going home
4571 basically like the shell, with the added convenience of going home
4568 when called with no args.
4572 when called with no args.
4569
4573
4570 * pushd/popd slightly modified to mimic shell behavior more
4574 * pushd/popd slightly modified to mimic shell behavior more
4571 closely.
4575 closely.
4572
4576
4573 * Added env,pushd,popd from ShellServices as magic functions. I
4577 * Added env,pushd,popd from ShellServices as magic functions. I
4574 think the cleanest will be to port all desired functions from
4578 think the cleanest will be to port all desired functions from
4575 ShellServices as magics and remove ShellServices altogether. This
4579 ShellServices as magics and remove ShellServices altogether. This
4576 will provide a single, clean way of adding functionality
4580 will provide a single, clean way of adding functionality
4577 (shell-type or otherwise) to IP.
4581 (shell-type or otherwise) to IP.
4578
4582
4579 2001-11-04 Fernando Perez <fperez@colorado.edu>
4583 2001-11-04 Fernando Perez <fperez@colorado.edu>
4580
4584
4581 * Added .ipython/ directory to sys.path. This way users can keep
4585 * Added .ipython/ directory to sys.path. This way users can keep
4582 customizations there and access them via import.
4586 customizations there and access them via import.
4583
4587
4584 2001-11-03 Fernando Perez <fperez@colorado.edu>
4588 2001-11-03 Fernando Perez <fperez@colorado.edu>
4585
4589
4586 * Opened version 0.1.1 for new changes.
4590 * Opened version 0.1.1 for new changes.
4587
4591
4588 * Changed version number to 0.1.0: first 'public' release, sent to
4592 * Changed version number to 0.1.0: first 'public' release, sent to
4589 Nathan and Janko.
4593 Nathan and Janko.
4590
4594
4591 * Lots of small fixes and tweaks.
4595 * Lots of small fixes and tweaks.
4592
4596
4593 * Minor changes to whos format. Now strings are shown, snipped if
4597 * Minor changes to whos format. Now strings are shown, snipped if
4594 too long.
4598 too long.
4595
4599
4596 * Changed ShellServices to work on __main__ so they show up in @who
4600 * Changed ShellServices to work on __main__ so they show up in @who
4597
4601
4598 * Help also works with ? at the end of a line:
4602 * Help also works with ? at the end of a line:
4599 ?sin and sin?
4603 ?sin and sin?
4600 both produce the same effect. This is nice, as often I use the
4604 both produce the same effect. This is nice, as often I use the
4601 tab-complete to find the name of a method, but I used to then have
4605 tab-complete to find the name of a method, but I used to then have
4602 to go to the beginning of the line to put a ? if I wanted more
4606 to go to the beginning of the line to put a ? if I wanted more
4603 info. Now I can just add the ? and hit return. Convenient.
4607 info. Now I can just add the ? and hit return. Convenient.
4604
4608
4605 2001-11-02 Fernando Perez <fperez@colorado.edu>
4609 2001-11-02 Fernando Perez <fperez@colorado.edu>
4606
4610
4607 * Python version check (>=2.1) added.
4611 * Python version check (>=2.1) added.
4608
4612
4609 * Added LazyPython documentation. At this point the docs are quite
4613 * Added LazyPython documentation. At this point the docs are quite
4610 a mess. A cleanup is in order.
4614 a mess. A cleanup is in order.
4611
4615
4612 * Auto-installer created. For some bizarre reason, the zipfiles
4616 * Auto-installer created. For some bizarre reason, the zipfiles
4613 module isn't working on my system. So I made a tar version
4617 module isn't working on my system. So I made a tar version
4614 (hopefully the command line options in various systems won't kill
4618 (hopefully the command line options in various systems won't kill
4615 me).
4619 me).
4616
4620
4617 * Fixes to Struct in genutils. Now all dictionary-like methods are
4621 * Fixes to Struct in genutils. Now all dictionary-like methods are
4618 protected (reasonably).
4622 protected (reasonably).
4619
4623
4620 * Added pager function to genutils and changed ? to print usage
4624 * Added pager function to genutils and changed ? to print usage
4621 note through it (it was too long).
4625 note through it (it was too long).
4622
4626
4623 * Added the LazyPython functionality. Works great! I changed the
4627 * Added the LazyPython functionality. Works great! I changed the
4624 auto-quote escape to ';', it's on home row and next to '. But
4628 auto-quote escape to ';', it's on home row and next to '. But
4625 both auto-quote and auto-paren (still /) escapes are command-line
4629 both auto-quote and auto-paren (still /) escapes are command-line
4626 parameters.
4630 parameters.
4627
4631
4628
4632
4629 2001-11-01 Fernando Perez <fperez@colorado.edu>
4633 2001-11-01 Fernando Perez <fperez@colorado.edu>
4630
4634
4631 * Version changed to 0.0.7. Fairly large change: configuration now
4635 * Version changed to 0.0.7. Fairly large change: configuration now
4632 is all stored in a directory, by default .ipython. There, all
4636 is all stored in a directory, by default .ipython. There, all
4633 config files have normal looking names (not .names)
4637 config files have normal looking names (not .names)
4634
4638
4635 * Version 0.0.6 Released first to Lucas and Archie as a test
4639 * Version 0.0.6 Released first to Lucas and Archie as a test
4636 run. Since it's the first 'semi-public' release, change version to
4640 run. Since it's the first 'semi-public' release, change version to
4637 > 0.0.6 for any changes now.
4641 > 0.0.6 for any changes now.
4638
4642
4639 * Stuff I had put in the ipplib.py changelog:
4643 * Stuff I had put in the ipplib.py changelog:
4640
4644
4641 Changes to InteractiveShell:
4645 Changes to InteractiveShell:
4642
4646
4643 - Made the usage message a parameter.
4647 - Made the usage message a parameter.
4644
4648
4645 - Require the name of the shell variable to be given. It's a bit
4649 - Require the name of the shell variable to be given. It's a bit
4646 of a hack, but allows the name 'shell' not to be hardwire in the
4650 of a hack, but allows the name 'shell' not to be hardwire in the
4647 magic (@) handler, which is problematic b/c it requires
4651 magic (@) handler, which is problematic b/c it requires
4648 polluting the global namespace with 'shell'. This in turn is
4652 polluting the global namespace with 'shell'. This in turn is
4649 fragile: if a user redefines a variable called shell, things
4653 fragile: if a user redefines a variable called shell, things
4650 break.
4654 break.
4651
4655
4652 - magic @: all functions available through @ need to be defined
4656 - magic @: all functions available through @ need to be defined
4653 as magic_<name>, even though they can be called simply as
4657 as magic_<name>, even though they can be called simply as
4654 @<name>. This allows the special command @magic to gather
4658 @<name>. This allows the special command @magic to gather
4655 information automatically about all existing magic functions,
4659 information automatically about all existing magic functions,
4656 even if they are run-time user extensions, by parsing the shell
4660 even if they are run-time user extensions, by parsing the shell
4657 instance __dict__ looking for special magic_ names.
4661 instance __dict__ looking for special magic_ names.
4658
4662
4659 - mainloop: added *two* local namespace parameters. This allows
4663 - mainloop: added *two* local namespace parameters. This allows
4660 the class to differentiate between parameters which were there
4664 the class to differentiate between parameters which were there
4661 before and after command line initialization was processed. This
4665 before and after command line initialization was processed. This
4662 way, later @who can show things loaded at startup by the
4666 way, later @who can show things loaded at startup by the
4663 user. This trick was necessary to make session saving/reloading
4667 user. This trick was necessary to make session saving/reloading
4664 really work: ideally after saving/exiting/reloading a session,
4668 really work: ideally after saving/exiting/reloading a session,
4665 *everythin* should look the same, including the output of @who. I
4669 *everythin* should look the same, including the output of @who. I
4666 was only able to make this work with this double namespace
4670 was only able to make this work with this double namespace
4667 trick.
4671 trick.
4668
4672
4669 - added a header to the logfile which allows (almost) full
4673 - added a header to the logfile which allows (almost) full
4670 session restoring.
4674 session restoring.
4671
4675
4672 - prepend lines beginning with @ or !, with a and log
4676 - prepend lines beginning with @ or !, with a and log
4673 them. Why? !lines: may be useful to know what you did @lines:
4677 them. Why? !lines: may be useful to know what you did @lines:
4674 they may affect session state. So when restoring a session, at
4678 they may affect session state. So when restoring a session, at
4675 least inform the user of their presence. I couldn't quite get
4679 least inform the user of their presence. I couldn't quite get
4676 them to properly re-execute, but at least the user is warned.
4680 them to properly re-execute, but at least the user is warned.
4677
4681
4678 * Started ChangeLog.
4682 * Started ChangeLog.
@@ -1,1345 +1,1358 b''
1 #LyX 1.3 created this file. For more info see http://www.lyx.org/
1 #LyX 1.3 created this file. For more info see http://www.lyx.org/
2 \lyxformat 221
2 \lyxformat 221
3 \textclass article
3 \textclass article
4 \begin_preamble
4 \begin_preamble
5 \usepackage{ae,aecompl}
5 \usepackage{ae,aecompl}
6 \usepackage{hyperref}
6 \usepackage{hyperref}
7 \usepackage{html}
7 \usepackage{html}
8 \end_preamble
8 \end_preamble
9 \language english
9 \language english
10 \inputencoding auto
10 \inputencoding auto
11 \fontscheme default
11 \fontscheme default
12 \graphics default
12 \graphics default
13 \paperfontsize default
13 \paperfontsize default
14 \spacing single
14 \spacing single
15 \papersize Default
15 \papersize Default
16 \paperpackage a4
16 \paperpackage a4
17 \use_geometry 1
17 \use_geometry 1
18 \use_amsmath 0
18 \use_amsmath 0
19 \use_natbib 0
19 \use_natbib 0
20 \use_numerical_citations 0
20 \use_numerical_citations 0
21 \paperorientation portrait
21 \paperorientation portrait
22 \leftmargin 1.25in
22 \leftmargin 1.25in
23 \topmargin 1in
23 \topmargin 1in
24 \rightmargin 1.25in
24 \rightmargin 1.25in
25 \bottommargin 1in
25 \bottommargin 1in
26 \secnumdepth 3
26 \secnumdepth 3
27 \tocdepth 3
27 \tocdepth 3
28 \paragraph_separation skip
28 \paragraph_separation skip
29 \defskip medskip
29 \defskip medskip
30 \quotes_language english
30 \quotes_language english
31 \quotes_times 2
31 \quotes_times 2
32 \papercolumns 1
32 \papercolumns 1
33 \papersides 1
33 \papersides 1
34 \paperpagestyle default
34 \paperpagestyle default
35
35
36 \layout Title
36 \layout Title
37
37
38 IPython
38 IPython
39 \newline
39 \newline
40
40
41 \size larger
41 \size larger
42 New design notes
42 New design notes
43 \layout Author
43 \layout Author
44
44
45 Fernando PοΏ½rez
45 Fernando PοΏ½rez
46 \layout Section
46 \layout Section
47
47
48 Introduction
48 Introduction
49 \layout Standard
49 \layout Standard
50
50
51 This is a draft document with notes and ideas for the IPython rewrite.
51 This is a draft document with notes and ideas for the IPython rewrite.
52 The section order and structure of this document roughly reflects in which
52 The section order and structure of this document roughly reflects in which
53 order things should be done and what the dependencies are.
53 order things should be done and what the dependencies are.
54 This document is mainly a draft for developers, a pdf version is provided
54 This document is mainly a draft for developers, a pdf version is provided
55 with the standard distribution in case regular users are interested and
55 with the standard distribution in case regular users are interested and
56 wish to contribute ideas.
56 wish to contribute ideas.
57 \layout Standard
57 \layout Standard
58
58
59 A tentative plan for the future:
59 A tentative plan for the future:
60 \layout Itemize
60 \layout Itemize
61
61
62 0.6.x series: in practice, enough people are using IPython for real work that
62 0.6.x series: in practice, enough people are using IPython for real work that
63 I think it warrants a higher number.
63 I think it warrants a higher number.
64 This series will continue to evolve with bugfixes and incremental improvements.
64 This series will continue to evolve with bugfixes and incremental improvements.
65 \layout Itemize
65 \layout Itemize
66
66
67 0.7.x series: (maybe) If resources allow, there may be a branch for 'unstable'
67 0.7.x series: (maybe) If resources allow, there may be a branch for 'unstable'
68 development, where the architectural rewrite may take place.
68 development, where the architectural rewrite may take place.
69 \layout Standard
69 \layout Standard
70
70
71 However, I am starting to doubt it is feasible to keep two separate branches.
71 However, I am starting to doubt it is feasible to keep two separate branches.
72 I am leaning more towards a
72 I am leaning more towards a
73 \begin_inset ERT
73 \begin_inset ERT
74 status Collapsed
74 status Collapsed
75
75
76 \layout Standard
76 \layout Standard
77
77
78 \backslash
78 \backslash
79 LyX
79 LyX
80 \end_inset
80 \end_inset
81
81
82 -like approach, where the main branch slowly transforms and evolves.
82 -like approach, where the main branch slowly transforms and evolves.
83 Having CVS support now makes this a reasonable alternative, as I don't
83 Having CVS support now makes this a reasonable alternative, as I don't
84 have to make pre-releases as often.
84 have to make pre-releases as often.
85 The active branch can remain the mainline of development, and users interested
85 The active branch can remain the mainline of development, and users interested
86 in the bleeding-edge stuff can always grab the CVS code.
86 in the bleeding-edge stuff can always grab the CVS code.
87 \layout Standard
87 \layout Standard
88
88
89 Ideally, IPython should have a clean class setup that would allow further
89 Ideally, IPython should have a clean class setup that would allow further
90 extensions for special-purpose systems.
90 extensions for special-purpose systems.
91 I view IPython as a base system that provides a great interactive environment
91 I view IPython as a base system that provides a great interactive environment
92 with full access to the Python language, and which could be used in many
92 with full access to the Python language, and which could be used in many
93 different contexts.
93 different contexts.
94 The basic hooks are there: the magic extension syntax and the flexible
94 The basic hooks are there: the magic extension syntax and the flexible
95 system of recursive configuration files and profiles.
95 system of recursive configuration files and profiles.
96 But with a code as messy as the current one, nobody is going to touch it.
96 But with a code as messy as the current one, nobody is going to touch it.
97 \layout Section
97 \layout Section
98
98
99 Immediate TODO and bug list
99 Immediate TODO and bug list
100 \layout Standard
100 \layout Standard
101
101
102 Things that should be done for the current series, before starting major
102 Things that should be done for the current series, before starting major
103 changes.
103 changes.
104 \layout Itemize
104 \layout Itemize
105
105
106 Fix any bugs reported at the online bug tracker.
106 Fix any bugs reported at the online bug tracker.
107 \layout Itemize
107 \layout Itemize
108
108
109 History bug: I often see that, under certain circumstances, the input history
110 is incorrect.
111 The problem is that so far, I've failed to find a simple way to reproduce
112 it consistently, so I can't easily track it down.
113 It seems to me that it happens when output is generated multiple times
114 for the same input (for i in range(10): i will do it).
115 But even this isn't reliable...
116 Ultimately the right solution for this is to cleanly separate the dataflow
117 for input/output history management; right now that happens all over the
118 place, which makes the code impossible to debug, and almost guaranteed
119 to be buggy in the first place.
120 \layout Itemize
121
109
122
110 \series bold
123 \series bold
111 Redesign the output traps.
124 Redesign the output traps.
112
125
113 \series default
126 \series default
114 They cause problems when users try to execute code which relies on sys.stdout
127 They cause problems when users try to execute code which relies on sys.stdout
115 being the 'true' sys.stdout.
128 being the 'true' sys.stdout.
116 They also prevent scripts which use raw_input() to work as command-line
129 They also prevent scripts which use raw_input() to work as command-line
117 arguments.
130 arguments.
118 \newline
131 \newline
119 The best solution is probably to print the banner first, and then just execute
132 The best solution is probably to print the banner first, and then just execute
120 all the user code straight with no output traps at all.
133 all the user code straight with no output traps at all.
121 Whatever comes out comes out.
134 Whatever comes out comes out.
122 This makes the ipython code actually simpler, and eliminates the problem
135 This makes the ipython code actually simpler, and eliminates the problem
123 altogether.
136 altogether.
124 \newline
137 \newline
125 These things need to be ripped out, they cause no end of problems.
138 These things need to be ripped out, they cause no end of problems.
126 For example, if user code requires acces to stdin during startup, the process
139 For example, if user code requires acces to stdin during startup, the process
127 just hangs indefinitely.
140 just hangs indefinitely.
128 For now I've just disabled them, and I'll live with the ugly error messages.
141 For now I've just disabled them, and I'll live with the ugly error messages.
129 \layout Itemize
142 \layout Itemize
130
143
131 The prompt specials dictionary should be turned into a class which does
144 The prompt specials dictionary should be turned into a class which does
132 proper namespace management, since the prompt specials need to be evaluated
145 proper namespace management, since the prompt specials need to be evaluated
133 in a certain namespace.
146 in a certain namespace.
134 Currently it's just globals, which need to be managed manually by code
147 Currently it's just globals, which need to be managed manually by code
135 below.
148 below.
136
149
137 \layout Itemize
150 \layout Itemize
138
151
139 Fix coloring of prompts: the pysh color strings don't have any effect on
152 Fix coloring of prompts: the pysh color strings don't have any effect on
140 prompt numbers, b/c these are controlled by the global scheme.
153 prompt numbers, b/c these are controlled by the global scheme.
141 Make the prompts fully user-definable, colors and all.
154 Make the prompts fully user-definable, colors and all.
142 This is what I said to a user:
155 This is what I said to a user:
143 \newline
156 \newline
144 As far as the green
157 As far as the green
145 \backslash
158 \backslash
146 #, this is a minor bug of the coloring code due to the vagaries of history.
159 #, this is a minor bug of the coloring code due to the vagaries of history.
147 While the color strings allow you to control the coloring of most elements,
160 While the color strings allow you to control the coloring of most elements,
148 there are a few which are still controlled by the old ipython internal
161 there are a few which are still controlled by the old ipython internal
149 coloring code, which only accepts a global 'color scheme' choice.
162 coloring code, which only accepts a global 'color scheme' choice.
150 So basically the input/output numbers are hardwired to the choice in the
163 So basically the input/output numbers are hardwired to the choice in the
151 color scheme, and there are only 'Linux', 'LightBG' and 'NoColor' schemes
164 color scheme, and there are only 'Linux', 'LightBG' and 'NoColor' schemes
152 to choose from.
165 to choose from.
153
166
154 \layout Itemize
167 \layout Itemize
155
168
156 Clean up FakeModule issues.
169 Clean up FakeModule issues.
157 Currently, unittesting with embedded ipython breaks because a FakeModule
170 Currently, unittesting with embedded ipython breaks because a FakeModule
158 instance overwrites __main__.
171 instance overwrites __main__.
159 Maybe ipython should revert back to using __main__ directly as the user
172 Maybe ipython should revert back to using __main__ directly as the user
160 namespace? Handling a separate namespace is proving
173 namespace? Handling a separate namespace is proving
161 \emph on
174 \emph on
162 very
175 very
163 \emph default
176 \emph default
164 tricky in all corner cases.
177 tricky in all corner cases.
165 \layout Itemize
178 \layout Itemize
166
179
167 Make the output cache depth independent of the input one.
180 Make the output cache depth independent of the input one.
168 This way one can have say only the last 10 results stored and still have
181 This way one can have say only the last 10 results stored and still have
169 a long input history/cache.
182 a long input history/cache.
170 \layout Itemize
183 \layout Itemize
171
184
172 Fix the fact that importing a shell for embedding screws up the command-line
185 Fix the fact that importing a shell for embedding screws up the command-line
173 history.
186 history.
174 This can be done by not importing the history file when the shell is already
187 This can be done by not importing the history file when the shell is already
175 inside ipython.
188 inside ipython.
176 \layout Itemize
189 \layout Itemize
177
190
178 Lay out the class structure so that embedding into a gtk/wx/qt app is trivial,
191 Lay out the class structure so that embedding into a gtk/wx/qt app is trivial,
179 much like the multithreaded gui shells now provide command-line coexistence
192 much like the multithreaded gui shells now provide command-line coexistence
180 with the gui toolkits.
193 with the gui toolkits.
181 See
194 See
182 \begin_inset LatexCommand \url{http://www.livejournal.com/users/glyf/32396.html}
195 \begin_inset LatexCommand \url{http://www.livejournal.com/users/glyf/32396.html}
183
196
184 \end_inset
197 \end_inset
185
198
186
199
187 \layout Itemize
200 \layout Itemize
188
201
189 Get Holger's completer in, once he adds filename completion.
202 Get Holger's completer in, once he adds filename completion.
190 \layout Standard
203 \layout Standard
191
204
192 Lower priority stuff:
205 Lower priority stuff:
193 \layout Itemize
206 \layout Itemize
194
207
195 Add @showopt/@setopt (decide name) for viewing/setting all options.
208 Add @showopt/@setopt (decide name) for viewing/setting all options.
196 The existing option-setting magics should become aliases for setopt calls.
209 The existing option-setting magics should become aliases for setopt calls.
197 \layout Itemize
210 \layout Itemize
198
211
199 It would be nice to be able to continue with python stuff after an @ command.
212 It would be nice to be able to continue with python stuff after an @ command.
200 For instance "@run something; test_stuff()" in order to test stuff even
213 For instance "@run something; test_stuff()" in order to test stuff even
201 faster.
214 faster.
202 Suggestion by Kasper Souren <Kasper.Souren@ircam.fr>
215 Suggestion by Kasper Souren <Kasper.Souren@ircam.fr>
203 \layout Itemize
216 \layout Itemize
204
217
205 Run a 'first time wizard' which configures a few things for the user, such
218 Run a 'first time wizard' which configures a few things for the user, such
206 as color_info, editor and the like.
219 as color_info, editor and the like.
207 \layout Itemize
220 \layout Itemize
208
221
209 Logging: @logstart and -log should start logfiles in ~.ipython, but with
222 Logging: @logstart and -log should start logfiles in ~.ipython, but with
210 unique names in case of collisions.
223 unique names in case of collisions.
211 This would prevent ipython.log files all over while also allowing multiple
224 This would prevent ipython.log files all over while also allowing multiple
212 sessions.
225 sessions.
213 Also the -log option should take an optional filename, instead of having
226 Also the -log option should take an optional filename, instead of having
214 a separate -logfile option.
227 a separate -logfile option.
215 \newline
228 \newline
216 In general the logging system needs a serious cleanup.
229 In general the logging system needs a serious cleanup.
217 Many functions now in Magic should be moved to Logger, and the magic @s
230 Many functions now in Magic should be moved to Logger, and the magic @s
218 should be very simple wrappers to the Logger methods.
231 should be very simple wrappers to the Logger methods.
219 \layout Section
232 \layout Section
220
233
221 Lighten the code
234 Lighten the code
222 \layout Standard
235 \layout Standard
223
236
224 If we decide to base future versions of IPython on Python 2.3, which has
237 If we decide to base future versions of IPython on Python 2.3, which has
225 the new Optik module (called optparse), it should be possible to drop DPyGetOpt.
238 the new Optik module (called optparse), it should be possible to drop DPyGetOpt.
226 We should also remove the need for Itpl.
239 We should also remove the need for Itpl.
227 Another area for trimming is the Gnuplot stuff: much of that could be merged
240 Another area for trimming is the Gnuplot stuff: much of that could be merged
228 into the mainline project.
241 into the mainline project.
229 \layout Standard
242 \layout Standard
230
243
231 Double check whether we really need FlexCompleter.
244 Double check whether we really need FlexCompleter.
232 This was written as an enhanced rlcompleter, but my patches went in for
245 This was written as an enhanced rlcompleter, but my patches went in for
233 python 2.2 (or 2.3, can't remember).
246 python 2.2 (or 2.3, can't remember).
234 \layout Standard
247 \layout Standard
235
248
236 With these changes we could shed a fair bit of code from the main trunk.
249 With these changes we could shed a fair bit of code from the main trunk.
237 \layout Section
250 \layout Section
238
251
239 Unit testing
252 Unit testing
240 \layout Standard
253 \layout Standard
241
254
242 All new code should use a testing framework.
255 All new code should use a testing framework.
243 Python seems to have very good testing facilities, I just need to learn
256 Python seems to have very good testing facilities, I just need to learn
244 how to use them.
257 how to use them.
245 I should also check out QMTest at
258 I should also check out QMTest at
246 \begin_inset LatexCommand \htmlurl{http://www.codesourcery.com/qm/qmtest}
259 \begin_inset LatexCommand \htmlurl{http://www.codesourcery.com/qm/qmtest}
247
260
248 \end_inset
261 \end_inset
249
262
250 , it sounds interesting (it's Python-based too).
263 , it sounds interesting (it's Python-based too).
251 \layout Section
264 \layout Section
252
265
253 Configuration system
266 Configuration system
254 \layout Standard
267 \layout Standard
255
268
256 Move away from the current ipythonrc format to using standard python files
269 Move away from the current ipythonrc format to using standard python files
257 for configuration.
270 for configuration.
258 This will require users to be slightly more careful in their syntax, but
271 This will require users to be slightly more careful in their syntax, but
259 reduces code in IPython, is more in line with Python's normal form (using
272 reduces code in IPython, is more in line with Python's normal form (using
260 the $PYTHONSTARTUP file) and allows much more flexibility.
273 the $PYTHONSTARTUP file) and allows much more flexibility.
261 I also think it's more 'pythonic', in using a single language for everything.
274 I also think it's more 'pythonic', in using a single language for everything.
262 \layout Standard
275 \layout Standard
263
276
264 Options can be set up with a function call which takes keywords and updates
277 Options can be set up with a function call which takes keywords and updates
265 the options Struct.
278 the options Struct.
266 \layout Standard
279 \layout Standard
267
280
268 In order to maintain the recursive inclusion system, write an 'include'
281 In order to maintain the recursive inclusion system, write an 'include'
269 function which is basically a wrapper around safe_execfile().
282 function which is basically a wrapper around safe_execfile().
270 Also for alias definitions an alias() function will do.
283 Also for alias definitions an alias() function will do.
271 All functionality which we want to have at startup time for the users can
284 All functionality which we want to have at startup time for the users can
272 be wrapped in a small module so that config files look like:
285 be wrapped in a small module so that config files look like:
273 \layout Standard
286 \layout Standard
274
287
275
288
276 \family typewriter
289 \family typewriter
277 from IPython.Startup import *
290 from IPython.Startup import *
278 \newline
291 \newline
279 ...
292 ...
280 \newline
293 \newline
281 set_options(automagic=1,colors='NoColor',...)
294 set_options(automagic=1,colors='NoColor',...)
282 \newline
295 \newline
283 ...
296 ...
284 \newline
297 \newline
285 include('mysetup.py')
298 include('mysetup.py')
286 \newline
299 \newline
287 ...
300 ...
288 \newline
301 \newline
289 alias('ls ls --color -l')
302 alias('ls ls --color -l')
290 \newline
303 \newline
291 ...
304 ...
292 etc.
305 etc.
293 \layout Standard
306 \layout Standard
294
307
295 Also, put
308 Also, put
296 \series bold
309 \series bold
297 all
310 all
298 \series default
311 \series default
299 aliases in here, out of the core code.
312 aliases in here, out of the core code.
300 \layout Standard
313 \layout Standard
301
314
302 The new system should allow for more seamless upgrading, so that:
315 The new system should allow for more seamless upgrading, so that:
303 \layout Itemize
316 \layout Itemize
304
317
305 It automatically recognizes when the config files need updating and does
318 It automatically recognizes when the config files need updating and does
306 the upgrade.
319 the upgrade.
307 \layout Itemize
320 \layout Itemize
308
321
309 It simply adds the new options to the user's config file without overwriting
322 It simply adds the new options to the user's config file without overwriting
310 it.
323 it.
311 The current system is annoying since users need to manually re-sync their
324 The current system is annoying since users need to manually re-sync their
312 configuration after every update.
325 configuration after every update.
313 \layout Itemize
326 \layout Itemize
314
327
315 It detects obsolete options and informs the user to remove them from his
328 It detects obsolete options and informs the user to remove them from his
316 config file.
329 config file.
317 \layout Standard
330 \layout Standard
318
331
319 Here's a copy of Arnd Baecker suggestions on the matter:
332 Here's a copy of Arnd Baecker suggestions on the matter:
320 \layout Standard
333 \layout Standard
321
334
322 1.) upgrade: it might be nice to have an "auto" upgrade procedure: i.e.
335 1.) upgrade: it might be nice to have an "auto" upgrade procedure: i.e.
323 imagine that IPython is installed system-wide and gets upgraded, how does
336 imagine that IPython is installed system-wide and gets upgraded, how does
324 a user know, that an upgrade of the stuff in ~/.ipython is necessary ? So
337 a user know, that an upgrade of the stuff in ~/.ipython is necessary ? So
325 maybe one has to a keep a version number in ~/.ipython and if there is a
338 maybe one has to a keep a version number in ~/.ipython and if there is a
326 mismatch with the started ipython, then invoke the upgrade procedure.
339 mismatch with the started ipython, then invoke the upgrade procedure.
327 \layout Standard
340 \layout Standard
328
341
329 2.) upgrade: I find that replacing the old files in ~/.ipython (after copying
342 2.) upgrade: I find that replacing the old files in ~/.ipython (after copying
330 them to .old not optimal (for example, after every update, I have to change
343 them to .old not optimal (for example, after every update, I have to change
331 my color settings (and some others) in ~/.ipython/ipthonrc).
344 my color settings (and some others) in ~/.ipython/ipthonrc).
332 So somehow keeping the old files and merging the new features would be
345 So somehow keeping the old files and merging the new features would be
333 nice.
346 nice.
334 (but how to distinguish changes from version to version with changes made
347 (but how to distinguish changes from version to version with changes made
335 by the user ?) For, example, I would have to change in GnuplotMagic.py gnuplot_m
348 by the user ?) For, example, I would have to change in GnuplotMagic.py gnuplot_m
336 ouse to 1 after every upgrade ...
349 ouse to 1 after every upgrade ...
337 \layout Standard
350 \layout Standard
338
351
339 This is surely a minor point - also things will change during the "BIG"
352 This is surely a minor point - also things will change during the "BIG"
340 rewrite, but maybe this is a point to keep in mind for this ?
353 rewrite, but maybe this is a point to keep in mind for this ?
341 \layout Standard
354 \layout Standard
342
355
343 3.) upgrade: old, sometimes obsolete files stay in the ~/.ipython subdirectory.
356 3.) upgrade: old, sometimes obsolete files stay in the ~/.ipython subdirectory.
344 (hmm, maybe one could move all these into some subdirectory, but which
357 (hmm, maybe one could move all these into some subdirectory, but which
345 name for that (via version-number ?) ?)
358 name for that (via version-number ?) ?)
346 \layout Subsection
359 \layout Subsection
347
360
348 Command line options
361 Command line options
349 \layout Standard
362 \layout Standard
350
363
351 It would be great to design the command-line processing system so that it
364 It would be great to design the command-line processing system so that it
352 can be dynamically modified in some easy way.
365 can be dynamically modified in some easy way.
353 This would allow systems based on IPython to include their own command-line
366 This would allow systems based on IPython to include their own command-line
354 processing to either extend or fully replace IPython's.
367 processing to either extend or fully replace IPython's.
355 Probably moving to the new optparse library (also known as optik) will
368 Probably moving to the new optparse library (also known as optik) will
356 make this a lot easier.
369 make this a lot easier.
357 \layout Section
370 \layout Section
358
371
359 OS-dependent code
372 OS-dependent code
360 \layout Standard
373 \layout Standard
361
374
362 Options which are OS-dependent (such as colors and aliases) should be loaded
375 Options which are OS-dependent (such as colors and aliases) should be loaded
363 via include files.
376 via include files.
364 That is, the general file will have:
377 That is, the general file will have:
365 \layout Standard
378 \layout Standard
366
379
367
380
368 \family typewriter
381 \family typewriter
369 if os.name == 'posix':
382 if os.name == 'posix':
370 \newline
383 \newline
371 include('ipythonrc-posix.py')
384 include('ipythonrc-posix.py')
372 \newline
385 \newline
373 elif os.name == 'nt':
386 elif os.name == 'nt':
374 \newline
387 \newline
375 include('ipythonrc-nt.py')...
388 include('ipythonrc-nt.py')...
376 \layout Standard
389 \layout Standard
377
390
378 In the
391 In the
379 \family typewriter
392 \family typewriter
380 -posix
393 -posix
381 \family default
394 \family default
382 ,
395 ,
383 \family typewriter
396 \family typewriter
384 -nt
397 -nt
385 \family default
398 \family default
386 , etc.
399 , etc.
387 files we'll set all os-specific options.
400 files we'll set all os-specific options.
388 \layout Section
401 \layout Section
389
402
390 Merging with other shell systems
403 Merging with other shell systems
391 \layout Standard
404 \layout Standard
392
405
393 This is listed before the big design issues, as it is something which should
406 This is listed before the big design issues, as it is something which should
394 be kept in mind when that design is made.
407 be kept in mind when that design is made.
395 \layout Standard
408 \layout Standard
396
409
397 The following shell systems are out there and I think the whole design of
410 The following shell systems are out there and I think the whole design of
398 IPython should try to be modular enough to make it possible to integrate
411 IPython should try to be modular enough to make it possible to integrate
399 its features into these.
412 its features into these.
400 In all cases IPython should exist as a stand-alone, terminal based program.
413 In all cases IPython should exist as a stand-alone, terminal based program.
401 But it would be great if users of these other shells (some of them which
414 But it would be great if users of these other shells (some of them which
402 have very nice features of their own, especially the graphical ones) could
415 have very nice features of their own, especially the graphical ones) could
403 keep their environment but gain IPython's features.
416 keep their environment but gain IPython's features.
404 \layout List
417 \layout List
405 \labelwidthstring 00.00.0000
418 \labelwidthstring 00.00.0000
406
419
407 IDLE This is the standard, distributed as part of Python.
420 IDLE This is the standard, distributed as part of Python.
408
421
409 \layout List
422 \layout List
410 \labelwidthstring 00.00.0000
423 \labelwidthstring 00.00.0000
411
424
412 pyrepl
425 pyrepl
413 \begin_inset LatexCommand \htmlurl{http://starship.python.net/crew/mwh/hacks/pyrepl.html}
426 \begin_inset LatexCommand \htmlurl{http://starship.python.net/crew/mwh/hacks/pyrepl.html}
414
427
415 \end_inset
428 \end_inset
416
429
417 .
430 .
418 This is a text (curses-based) shell-like replacement which doesn't have
431 This is a text (curses-based) shell-like replacement which doesn't have
419 some of IPython's features, but has a crucially useful (and hard to implement)
432 some of IPython's features, but has a crucially useful (and hard to implement)
420 one: full multi-line editing.
433 one: full multi-line editing.
421 This turns the interactive interpreter into a true code testing and development
434 This turns the interactive interpreter into a true code testing and development
422 environment.
435 environment.
423
436
424 \layout List
437 \layout List
425 \labelwidthstring 00.00.0000
438 \labelwidthstring 00.00.0000
426
439
427 PyCrust
440 PyCrust
428 \begin_inset LatexCommand \htmlurl{http://sourceforge.net/projects/pycrust}
441 \begin_inset LatexCommand \htmlurl{http://sourceforge.net/projects/pycrust}
429
442
430 \end_inset
443 \end_inset
431
444
432 .
445 .
433 Very nice, wxWindows based system.
446 Very nice, wxWindows based system.
434 \layout List
447 \layout List
435 \labelwidthstring 00.00.0000
448 \labelwidthstring 00.00.0000
436
449
437 PythonWin
450 PythonWin
438 \begin_inset LatexCommand \htmlurl{http://starship.python.net/crew/mhammond}
451 \begin_inset LatexCommand \htmlurl{http://starship.python.net/crew/mhammond}
439
452
440 \end_inset
453 \end_inset
441
454
442 .
455 .
443 Similar to PyCrust in some respects, a very good and free Python development
456 Similar to PyCrust in some respects, a very good and free Python development
444 environment for Windows systems.
457 environment for Windows systems.
445 \layout Section
458 \layout Section
446
459
447 Class design
460 Class design
448 \layout Standard
461 \layout Standard
449
462
450 This is the big one.
463 This is the big one.
451 Currently classes use each other in a very messy way, poking inside one
464 Currently classes use each other in a very messy way, poking inside one
452 another for data and methods.
465 another for data and methods.
453 ipmaker() adds tons of stuff to the main __IP instance by hand, and the
466 ipmaker() adds tons of stuff to the main __IP instance by hand, and the
454 mix-ins used (Logger, Magic, etc) mean the final __IP instance has a million
467 mix-ins used (Logger, Magic, etc) mean the final __IP instance has a million
455 things in it.
468 things in it.
456 All that needs to be cleanly broken down with well defined interfaces amongst
469 All that needs to be cleanly broken down with well defined interfaces amongst
457 the different classes, and probably no mix-ins.
470 the different classes, and probably no mix-ins.
458 \layout Standard
471 \layout Standard
459
472
460 The best approach is probably to have all the sub-systems which are currently
473 The best approach is probably to have all the sub-systems which are currently
461 mixins be fully independent classes which talk back only to the main instance
474 mixins be fully independent classes which talk back only to the main instance
462 (and
475 (and
463 \series bold
476 \series bold
464 not
477 not
465 \series default
478 \series default
466 to each other).
479 to each other).
467 In the main instance there should be an object whose job is to handle communica
480 In the main instance there should be an object whose job is to handle communica
468 tion with the sub-systems.
481 tion with the sub-systems.
469 \layout Standard
482 \layout Standard
470
483
471 I should probably learn a little UML and diagram this whole thing before
484 I should probably learn a little UML and diagram this whole thing before
472 I start coding.
485 I start coding.
473 \layout Subsection
486 \layout Subsection
474
487
475 Magic
488 Magic
476 \layout Standard
489 \layout Standard
477
490
478 Now all methods which will become publicly available are called Magic.magic_name,
491 Now all methods which will become publicly available are called Magic.magic_name,
479 the magic_ should go away.
492 the magic_ should go away.
480 Then, Magic instead of being a mix-in should simply be an attribute of
493 Then, Magic instead of being a mix-in should simply be an attribute of
481 __IP:
494 __IP:
482 \layout Standard
495 \layout Standard
483
496
484 __IP.Magic = Magic()
497 __IP.Magic = Magic()
485 \layout Standard
498 \layout Standard
486
499
487 This will then give all the magic functions as __IP.Magic.name(), which is
500 This will then give all the magic functions as __IP.Magic.name(), which is
488 much cleaner.
501 much cleaner.
489 This will also force a better separation so that Magic doesn't poke inside
502 This will also force a better separation so that Magic doesn't poke inside
490 __IP so much.
503 __IP so much.
491 In the constructor, Magic should get whatever information it needs to know
504 In the constructor, Magic should get whatever information it needs to know
492 about __IP (even if it means a pointer to __IP itself, but at least we'll
505 about __IP (even if it means a pointer to __IP itself, but at least we'll
493 know where it is.
506 know where it is.
494 Right now since it's a mix-in, there's no way to know which variables belong
507 Right now since it's a mix-in, there's no way to know which variables belong
495 to whom).
508 to whom).
496 \layout Standard
509 \layout Standard
497
510
498 Build a class MagicFunction so that adding new functions is a matter of:
511 Build a class MagicFunction so that adding new functions is a matter of:
499 \layout Standard
512 \layout Standard
500
513
501
514
502 \family typewriter
515 \family typewriter
503 my_magic = MagicFunction(category = 'System utilities')
516 my_magic = MagicFunction(category = 'System utilities')
504 \newline
517 \newline
505 my_magic.__call__ = ...
518 my_magic.__call__ = ...
506 \layout Standard
519 \layout Standard
507
520
508 Features:
521 Features:
509 \layout Itemize
522 \layout Itemize
510
523
511 The class constructor should automatically register the functions and keep
524 The class constructor should automatically register the functions and keep
512 a table with category sections for easy sorting/viewing.
525 a table with category sections for easy sorting/viewing.
513 \layout Itemize
526 \layout Itemize
514
527
515 The object interface must allow automatic building of a GUI for them.
528 The object interface must allow automatic building of a GUI for them.
516 This requires registering the options the command takes, the number of
529 This requires registering the options the command takes, the number of
517 arguments, etc, in a formal way.
530 arguments, etc, in a formal way.
518 The advantage of this approach is that it allows not only to add GUIs to
531 The advantage of this approach is that it allows not only to add GUIs to
519 the magics, but also for a much more intelligent building of docstrings,
532 the magics, but also for a much more intelligent building of docstrings,
520 and better parsing of options and arguments.
533 and better parsing of options and arguments.
521 \layout Standard
534 \layout Standard
522
535
523 Also think through better an alias system for magics.
536 Also think through better an alias system for magics.
524 Since the magic system is like a command shell inside ipython, the relation
537 Since the magic system is like a command shell inside ipython, the relation
525 between these aliases and system aliases should be cleanly thought out.
538 between these aliases and system aliases should be cleanly thought out.
526 \layout Subsection
539 \layout Subsection
527
540
528 Color schemes
541 Color schemes
529 \layout Standard
542 \layout Standard
530
543
531 These should be loaded from some kind of resource file so they are easier
544 These should be loaded from some kind of resource file so they are easier
532 to modify by the user.
545 to modify by the user.
533 \layout Section
546 \layout Section
534
547
535 Hooks
548 Hooks
536 \layout Standard
549 \layout Standard
537
550
538 IPython should have a modular system where functions can register themselves
551 IPython should have a modular system where functions can register themselves
539 for certain tasks.
552 for certain tasks.
540 Currently changing functionality requires overriding certain specific methods,
553 Currently changing functionality requires overriding certain specific methods,
541 there should be a clean API for this to be done.
554 there should be a clean API for this to be done.
542 \layout Subsection
555 \layout Subsection
543
556
544 whos hook
557 whos hook
545 \layout Standard
558 \layout Standard
546
559
547 This was a very nice suggestion from Alexander Schmolck <a.schmolck@gmx.net>:
560 This was a very nice suggestion from Alexander Schmolck <a.schmolck@gmx.net>:
548 \layout Standard
561 \layout Standard
549
562
550 2.
563 2.
551 I think it would also be very helpful if there where some sort of hook
564 I think it would also be very helpful if there where some sort of hook
552 for ``whos`` that let one customize display formaters depending on the
565 for ``whos`` that let one customize display formaters depending on the
553 object type.
566 object type.
554 \layout Standard
567 \layout Standard
555
568
556 For example I'd rather have a whos that formats an array like:
569 For example I'd rather have a whos that formats an array like:
557 \layout Standard
570 \layout Standard
558
571
559
572
560 \family typewriter
573 \family typewriter
561 Variable Type Data/Length
574 Variable Type Data/Length
562 \newline
575 \newline
563 ------------------------------
576 ------------------------------
564 \newline
577 \newline
565 a array size: 4x3 type: 'Float'
578 a array size: 4x3 type: 'Float'
566 \layout Standard
579 \layout Standard
567
580
568 than
581 than
569 \layout Standard
582 \layout Standard
570
583
571
584
572 \family typewriter
585 \family typewriter
573 Variable Type Data/Length
586 Variable Type Data/Length
574 \newline
587 \newline
575 ------------------------------
588 ------------------------------
576 \newline
589 \newline
577 a array [[ 0.
590 a array [[ 0.
578 1.
591 1.
579 2.
592 2.
580 3<...> 8.
593 3<...> 8.
581 9.
594 9.
582 10.
595 10.
583 11.]]
596 11.]]
584 \layout Section
597 \layout Section
585
598
586 Parallel support
599 Parallel support
587 \layout Standard
600 \layout Standard
588
601
589 For integration with graphical shells and other systems, it will be best
602 For integration with graphical shells and other systems, it will be best
590 if ipython is split into a kernel/client model, much like Mathematica works.
603 if ipython is split into a kernel/client model, much like Mathematica works.
591 This simultaneously opens the door for support of interactive parallel
604 This simultaneously opens the door for support of interactive parallel
592 computing.
605 computing.
593 Currenlty %bg provides a threads-based proof of concept, and Brian Granger's
606 Currenlty %bg provides a threads-based proof of concept, and Brian Granger's
594 XGrid project is a much more realistic such system.
607 XGrid project is a much more realistic such system.
595 The new design should integrates ideas as core elements.
608 The new design should integrates ideas as core elements.
596 Some notes from Brian on this topic:
609 Some notes from Brian on this topic:
597 \layout Standard
610 \layout Standard
598
611
599 1.
612 1.
600 How should the remote python server/kernel be designed? Multithreaded?
613 How should the remote python server/kernel be designed? Multithreaded?
601 Blocking? Connected/disconnected modes? Load balancing?
614 Blocking? Connected/disconnected modes? Load balancing?
602 \layout Standard
615 \layout Standard
603
616
604 2.
617 2.
605 What APi/protocol should the server/kernel expose to clients?
618 What APi/protocol should the server/kernel expose to clients?
606 \layout Standard
619 \layout Standard
607
620
608 3.
621 3.
609 How should the client classes (which the user uses to interact with the
622 How should the client classes (which the user uses to interact with the
610 cluster) be designed?
623 cluster) be designed?
611 \layout Standard
624 \layout Standard
612
625
613 4.
626 4.
614 What API should the client classes expose?
627 What API should the client classes expose?
615 \layout Standard
628 \layout Standard
616
629
617 5.
630 5.
618 How should the client API be wrapped in a few simple magic functions?
631 How should the client API be wrapped in a few simple magic functions?
619 \layout Standard
632 \layout Standard
620
633
621 6.
634 6.
622 How should security be handled?
635 How should security be handled?
623 \layout Standard
636 \layout Standard
624
637
625 7.
638 7.
626 How to work around the issues of the GIL and threads?
639 How to work around the issues of the GIL and threads?
627 \layout Standard
640 \layout Standard
628
641
629 I think the most important things to work out are the client API (#4) the
642 I think the most important things to work out are the client API (#4) the
630 server/kernel API/protocol (#2) and the magic function API (#5).
643 server/kernel API/protocol (#2) and the magic function API (#5).
631 We should let these determine the design and architecture of the components.
644 We should let these determine the design and architecture of the components.
632 \layout Standard
645 \layout Standard
633
646
634 One other thing.
647 One other thing.
635 What is your impression of twisted? I have been looking at it and it looks
648 What is your impression of twisted? I have been looking at it and it looks
636 like a _very_ powerful set of tools for this type of stuff.
649 like a _very_ powerful set of tools for this type of stuff.
637 I am wondering if it might make sense to think about using twisted for
650 I am wondering if it might make sense to think about using twisted for
638 this project.
651 this project.
639 \layout Section
652 \layout Section
640
653
641 Manuals
654 Manuals
642 \layout Standard
655 \layout Standard
643
656
644 The documentation should be generated from docstrings for the command line
657 The documentation should be generated from docstrings for the command line
645 args and all the magic commands.
658 args and all the magic commands.
646 Look into one of the simple text markup systems to see if we can get latex
659 Look into one of the simple text markup systems to see if we can get latex
647 (for reLyXing later) out of this.
660 (for reLyXing later) out of this.
648 Part of the build command would then be to make an update of the docs based
661 Part of the build command would then be to make an update of the docs based
649 on this, thus giving more complete manual (and guaranteed to be in sync
662 on this, thus giving more complete manual (and guaranteed to be in sync
650 with the code docstrings).
663 with the code docstrings).
651 \layout Standard
664 \layout Standard
652
665
653 [PARTLY DONE] At least now all magics are auto-documented, works farily
666 [PARTLY DONE] At least now all magics are auto-documented, works farily
654 well.
667 well.
655 Limited Latex formatting yet.
668 Limited Latex formatting yet.
656 \layout Subsection
669 \layout Subsection
657
670
658 Integration with pydoc-help
671 Integration with pydoc-help
659 \layout Standard
672 \layout Standard
660
673
661 It should be possible to have access to the manual via the pydoc help system
674 It should be possible to have access to the manual via the pydoc help system
662 somehow.
675 somehow.
663 This might require subclassing the pydoc help, or figuring out how to add
676 This might require subclassing the pydoc help, or figuring out how to add
664 the IPython docs in the right form so that help() finds them.
677 the IPython docs in the right form so that help() finds them.
665 \layout Standard
678 \layout Standard
666
679
667 Some comments from Arnd and my reply on this topic:
680 Some comments from Arnd and my reply on this topic:
668 \layout Standard
681 \layout Standard
669
682
670 > ((Generally I would like to have the nice documentation > more easily
683 > ((Generally I would like to have the nice documentation > more easily
671 accessable from within ipython ...
684 accessable from within ipython ...
672 > Many people just don't read documentation, even if it is > as good as
685 > Many people just don't read documentation, even if it is > as good as
673 the one of IPython ))
686 the one of IPython ))
674 \layout Standard
687 \layout Standard
675
688
676 That's an excellent point.
689 That's an excellent point.
677 I've added a note to this effect in new_design.
690 I've added a note to this effect in new_design.
678 Basically I'd like help() to naturally access the IPython docs.
691 Basically I'd like help() to naturally access the IPython docs.
679 Since they are already there in html for the user, it's probably a matter
692 Since they are already there in html for the user, it's probably a matter
680 of playing a bit with pydoc to tell it where to find them.
693 of playing a bit with pydoc to tell it where to find them.
681 It would definitely make for a much cleaner system.
694 It would definitely make for a much cleaner system.
682 Right now the information on IPython is:
695 Right now the information on IPython is:
683 \layout Standard
696 \layout Standard
684
697
685 -ipython --help at the command line: info on command line switches
698 -ipython --help at the command line: info on command line switches
686 \layout Standard
699 \layout Standard
687
700
688 -? at the ipython prompt: overview of IPython
701 -? at the ipython prompt: overview of IPython
689 \layout Standard
702 \layout Standard
690
703
691 -magic at the ipython prompt: overview of the magic system
704 -magic at the ipython prompt: overview of the magic system
692 \layout Standard
705 \layout Standard
693
706
694 -external docs (html/pdf)
707 -external docs (html/pdf)
695 \layout Standard
708 \layout Standard
696
709
697 All that should be better integrated seamlessly in the help() system, so
710 All that should be better integrated seamlessly in the help() system, so
698 that you can simply say:
711 that you can simply say:
699 \layout Standard
712 \layout Standard
700
713
701 help ipython -> full documentation access
714 help ipython -> full documentation access
702 \layout Standard
715 \layout Standard
703
716
704 help magic -> magic overview
717 help magic -> magic overview
705 \layout Standard
718 \layout Standard
706
719
707 help profile -> help on current profile
720 help profile -> help on current profile
708 \layout Standard
721 \layout Standard
709
722
710 help -> normal python help access.
723 help -> normal python help access.
711 \layout Section
724 \layout Section
712
725
713 Graphical object browsers
726 Graphical object browsers
714 \layout Standard
727 \layout Standard
715
728
716 I'd like a system for graphically browsing through objects.
729 I'd like a system for graphically browsing through objects.
717
730
718 \family typewriter
731 \family typewriter
719 @obrowse
732 @obrowse
720 \family default
733 \family default
721 should open a widged with all the things which
734 should open a widged with all the things which
722 \family typewriter
735 \family typewriter
723 @who
736 @who
724 \family default
737 \family default
725 lists, but cliking on each object would open a dedicated object viewer
738 lists, but cliking on each object would open a dedicated object viewer
726 (also accessible as
739 (also accessible as
727 \family typewriter
740 \family typewriter
728 @oview <object>
741 @oview <object>
729 \family default
742 \family default
730 ).
743 ).
731 This object viewer could show a summary of what
744 This object viewer could show a summary of what
732 \family typewriter
745 \family typewriter
733 <object>?
746 <object>?
734 \family default
747 \family default
735 currently shows, but also colorize source code and show it via an html
748 currently shows, but also colorize source code and show it via an html
736 browser, show all attributes and methods of a given object (themselves
749 browser, show all attributes and methods of a given object (themselves
737 openable in their own viewers, since in Python everything is an object),
750 openable in their own viewers, since in Python everything is an object),
738 links to the parent classes, etc.
751 links to the parent classes, etc.
739 \layout Standard
752 \layout Standard
740
753
741 The object viewer widget should be extensible, so that one can add methods
754 The object viewer widget should be extensible, so that one can add methods
742 to view certain types of objects in a special way (for example, plotting
755 to view certain types of objects in a special way (for example, plotting
743 Numeric arrays via grace or gnuplot).
756 Numeric arrays via grace or gnuplot).
744 This would be very useful when using IPython as part of an interactive
757 This would be very useful when using IPython as part of an interactive
745 complex system for working with certain types of data.
758 complex system for working with certain types of data.
746 \layout Standard
759 \layout Standard
747
760
748 I should look at what PyCrust has to offer along these lines, at least as
761 I should look at what PyCrust has to offer along these lines, at least as
749 a starting point.
762 a starting point.
750 \layout Section
763 \layout Section
751
764
752 Miscellaneous small things
765 Miscellaneous small things
753 \layout Itemize
766 \layout Itemize
754
767
755 Collect whatever variables matter from the environment in some globals for
768 Collect whatever variables matter from the environment in some globals for
756 __IP, so we're not testing for them constantly (like $HOME, $TERM, etc.)
769 __IP, so we're not testing for them constantly (like $HOME, $TERM, etc.)
757 \layout Section
770 \layout Section
758
771
759 Session restoring
772 Session restoring
760 \layout Standard
773 \layout Standard
761
774
762 I've convinced myself that session restore by log replay is too fragile
775 I've convinced myself that session restore by log replay is too fragile
763 and tricky to ever work reliably.
776 and tricky to ever work reliably.
764 Plus it can be dog slow.
777 Plus it can be dog slow.
765 I'd rather have a way of saving/restoring the *current* memory state of
778 I'd rather have a way of saving/restoring the *current* memory state of
766 IPython.
779 IPython.
767 I tried with pickle but failed (can't pickle modules).
780 I tried with pickle but failed (can't pickle modules).
768 This seems the right way to do it to me, but it will have to wait until
781 This seems the right way to do it to me, but it will have to wait until
769 someone tells me of a robust way of dumping/reloading *all* of the user
782 someone tells me of a robust way of dumping/reloading *all* of the user
770 namespace in a file.
783 namespace in a file.
771 \layout Standard
784 \layout Standard
772
785
773 Probably the best approach will be to pickle as much as possible and record
786 Probably the best approach will be to pickle as much as possible and record
774 what can not be pickled for manual reload (such as modules).
787 what can not be pickled for manual reload (such as modules).
775 This is not trivial to get to work reliably, so it's best left for after
788 This is not trivial to get to work reliably, so it's best left for after
776 the code restructuring.
789 the code restructuring.
777 \layout Standard
790 \layout Standard
778
791
779 The following issues exist (old notes, see above paragraph for my current
792 The following issues exist (old notes, see above paragraph for my current
780 take on the issue):
793 take on the issue):
781 \layout Itemize
794 \layout Itemize
782
795
783 magic lines aren't properly re-executed when a log file is reloaded (and
796 magic lines aren't properly re-executed when a log file is reloaded (and
784 some of them, like clear or run, may change the environment).
797 some of them, like clear or run, may change the environment).
785 So session restore isn't 100% perfect.
798 So session restore isn't 100% perfect.
786 \layout Itemize
799 \layout Itemize
787
800
788 auto-quote/parens lines aren't replayed either.
801 auto-quote/parens lines aren't replayed either.
789 All this could be done, but it needs some work.
802 All this could be done, but it needs some work.
790 Basically it requires re-running the log through IPython itself, not through
803 Basically it requires re-running the log through IPython itself, not through
791 python.
804 python.
792 \layout Itemize
805 \layout Itemize
793
806
794 _p variables aren't restored with a session.
807 _p variables aren't restored with a session.
795 Fix: same as above.
808 Fix: same as above.
796 \layout Section
809 \layout Section
797
810
798 Tips system
811 Tips system
799 \layout Standard
812 \layout Standard
800
813
801 It would be nice to have a tip() function which gives tips to users in some
814 It would be nice to have a tip() function which gives tips to users in some
802 situations, but keeps track of already-given tips so they aren't given
815 situations, but keeps track of already-given tips so they aren't given
803 every time.
816 every time.
804 This could be done by pickling a dict of given tips to IPYTHONDIR.
817 This could be done by pickling a dict of given tips to IPYTHONDIR.
805 \layout Section
818 \layout Section
806
819
807 TAB completer
820 TAB completer
808 \layout Standard
821 \layout Standard
809
822
810 Some suggestions from Arnd Baecker:
823 Some suggestions from Arnd Baecker:
811 \layout Standard
824 \layout Standard
812
825
813 a) For file related commands (ls, cat, ...) it would be nice to be able to
826 a) For file related commands (ls, cat, ...) it would be nice to be able to
814 TAB complete the files in the current directory.
827 TAB complete the files in the current directory.
815 (once you started typing something which is uniquely a file, this leads
828 (once you started typing something which is uniquely a file, this leads
816 to this effect, apart from going through the list of possible completions
829 to this effect, apart from going through the list of possible completions
817 ...).
830 ...).
818 (I know that this point is in your documentation.)
831 (I know that this point is in your documentation.)
819 \layout Standard
832 \layout Standard
820
833
821 More general, this might lead to something like command specific completion
834 More general, this might lead to something like command specific completion
822 ?
835 ?
823 \layout Standard
836 \layout Standard
824
837
825 Here's John Hunter's suggestion:
838 Here's John Hunter's suggestion:
826 \layout Standard
839 \layout Standard
827
840
828 The *right way to do it* would be to make intelligent or customizable choices
841 The *right way to do it* would be to make intelligent or customizable choices
829 about which namespace to add to the completion list depending on the string
842 about which namespace to add to the completion list depending on the string
830 match up to the prompt, eg programmed completions.
843 match up to the prompt, eg programmed completions.
831 In the simplest implementation, one would only complete on files and directorie
844 In the simplest implementation, one would only complete on files and directorie
832 s if the line preceding the tab press matched 'cd ' or 'run ' (eg you don't
845 s if the line preceding the tab press matched 'cd ' or 'run ' (eg you don't
833 want callable showing up in 'cd ca<TAB>')
846 want callable showing up in 'cd ca<TAB>')
834 \layout Standard
847 \layout Standard
835
848
836 In a more advanced scenario, you might imaging that functions supplied the
849 In a more advanced scenario, you might imaging that functions supplied the
837 TAB namespace, and the user could configure a dictionary that mapped regular
850 TAB namespace, and the user could configure a dictionary that mapped regular
838 expressions to namespace providing functions (with sensible defaults).
851 expressions to namespace providing functions (with sensible defaults).
839 Something like
852 Something like
840 \layout Standard
853 \layout Standard
841
854
842 completed = {
855 completed = {
843 \newline
856 \newline
844 '^cd
857 '^cd
845 \backslash
858 \backslash
846 s+(.*)' : complete_files_and_dirs,
859 s+(.*)' : complete_files_and_dirs,
847 \newline
860 \newline
848 '^run
861 '^run
849 \backslash
862 \backslash
850 s+(.*)' : complete_files_and_dirs,
863 s+(.*)' : complete_files_and_dirs,
851 \newline
864 \newline
852 '^run
865 '^run
853 \backslash
866 \backslash
854 s+(-.*)' : complete_run_options,
867 s+(-.*)' : complete_run_options,
855 \newline
868 \newline
856 }
869 }
857 \layout Standard
870 \layout Standard
858
871
859 I don't know if this is feasible, but I really like programmed completions,
872 I don't know if this is feasible, but I really like programmed completions,
860 which I use extensively in tcsh.
873 which I use extensively in tcsh.
861 My feeling is that something like this is eminently doable in ipython.
874 My feeling is that something like this is eminently doable in ipython.
862 \layout Standard
875 \layout Standard
863
876
864 /JDH
877 /JDH
865 \layout Standard
878 \layout Standard
866
879
867 For something like this to work cleanly, the magic command system needs
880 For something like this to work cleanly, the magic command system needs
868 also a clean options framework, so all valid options for a given magic
881 also a clean options framework, so all valid options for a given magic
869 can be extracted programatically.
882 can be extracted programatically.
870 \layout Section
883 \layout Section
871
884
872 Debugger
885 Debugger
873 \layout Standard
886 \layout Standard
874
887
875 Current system uses a minimally tweaked pdb.
888 Current system uses a minimally tweaked pdb.
876 Fine-tune it a bit, to provide at least:
889 Fine-tune it a bit, to provide at least:
877 \layout Itemize
890 \layout Itemize
878
891
879 Tab-completion in each stack frame.
892 Tab-completion in each stack frame.
880 See email to Chris Hart for details.
893 See email to Chris Hart for details.
881 \layout Itemize
894 \layout Itemize
882
895
883 Object information via ? at least.
896 Object information via ? at least.
884 Break up magic_oinfo a bit so that pdb can call it without loading all
897 Break up magic_oinfo a bit so that pdb can call it without loading all
885 of IPython.
898 of IPython.
886 If possible, also have the other magics for object study: doc, source,
899 If possible, also have the other magics for object study: doc, source,
887 pdef and pfile.
900 pdef and pfile.
888 \layout Itemize
901 \layout Itemize
889
902
890 Shell access via !
903 Shell access via !
891 \layout Itemize
904 \layout Itemize
892
905
893 Syntax highlighting in listings.
906 Syntax highlighting in listings.
894 Use py2html code, implement color schemes.
907 Use py2html code, implement color schemes.
895 \layout Section
908 \layout Section
896
909
897 A Python-based system shell - pysh?
910 A Python-based system shell - pysh?
898 \layout Standard
911 \layout Standard
899
912
900 Note: as of IPython 0.6.1, most of this functionality has actually been implemente
913 Note: as of IPython 0.6.1, most of this functionality has actually been implemente
901 d.
914 d.
902 \layout Standard
915 \layout Standard
903
916
904 This section is meant as a working draft for discussions on the possibility
917 This section is meant as a working draft for discussions on the possibility
905 of having a python-based system shell.
918 of having a python-based system shell.
906 It is the result of my own thinking about these issues as much of discussions
919 It is the result of my own thinking about these issues as much of discussions
907 on the ipython lists.
920 on the ipython lists.
908 I apologize in advance for not giving individual credit to the various
921 I apologize in advance for not giving individual credit to the various
909 contributions, but right now I don't have the time to track down each message
922 contributions, but right now I don't have the time to track down each message
910 from the archives.
923 from the archives.
911 So please consider this as the result of a collective effort by the ipython
924 So please consider this as the result of a collective effort by the ipython
912 user community.
925 user community.
913 \layout Standard
926 \layout Standard
914
927
915 While IPyhton is (and will remain) a python shell first, it does offer a
928 While IPyhton is (and will remain) a python shell first, it does offer a
916 fair amount of system access functionality:
929 fair amount of system access functionality:
917 \layout Standard
930 \layout Standard
918
931
919 - ! and !! for direct system access,
932 - ! and !! for direct system access,
920 \layout Standard
933 \layout Standard
921
934
922 - magic commands which wrap various system commands,
935 - magic commands which wrap various system commands,
923 \layout Standard
936 \layout Standard
924
937
925 - @sc and @sx, for shell output capture into python variables,
938 - @sc and @sx, for shell output capture into python variables,
926 \layout Standard
939 \layout Standard
927
940
928 - @alias, for aliasing system commands.
941 - @alias, for aliasing system commands.
929 \layout Standard
942 \layout Standard
930
943
931 This has prompted many users, over time, to ask for a way of extending ipython
944 This has prompted many users, over time, to ask for a way of extending ipython
932 to the point where it could be used as a full-time replacement over typical
945 to the point where it could be used as a full-time replacement over typical
933 user shells like bash, csh or tcsh.
946 user shells like bash, csh or tcsh.
934 While my interest in ipython is such that I'll concentrate my personal
947 While my interest in ipython is such that I'll concentrate my personal
935 efforts on other fronts (debugging, architecture, improvements for scientific
948 efforts on other fronts (debugging, architecture, improvements for scientific
936 use, gui access), I will be happy to do anything which could make such
949 use, gui access), I will be happy to do anything which could make such
937 a development possible.
950 a development possible.
938 It would be the responsibility of someone else to maintain the code, but
951 It would be the responsibility of someone else to maintain the code, but
939 I would do all necessary architectural changes to ipython for such an extension
952 I would do all necessary architectural changes to ipython for such an extension
940 to be feasible.
953 to be feasible.
941 \layout Standard
954 \layout Standard
942
955
943 I'll try to outline here what I see as the key issues which need to be taken
956 I'll try to outline here what I see as the key issues which need to be taken
944 into account.
957 into account.
945 This document should be considered an evolving draft.
958 This document should be considered an evolving draft.
946 Feel free to submit comments/improvements, even in the form of patches.
959 Feel free to submit comments/improvements, even in the form of patches.
947 \layout Standard
960 \layout Standard
948
961
949 In what follows, I'll represent the hypothetical python-based shell ('pysh'
962 In what follows, I'll represent the hypothetical python-based shell ('pysh'
950 for now) prompt with '>>'.
963 for now) prompt with '>>'.
951 \layout Subsection
964 \layout Subsection
952
965
953 Basic design principles
966 Basic design principles
954 \layout Standard
967 \layout Standard
955
968
956 I think the basic design guideline should be the following: a hypothetical
969 I think the basic design guideline should be the following: a hypothetical
957 python system shell should behave, as much as possible, like a normal shell
970 python system shell should behave, as much as possible, like a normal shell
958 that users are familiar with (bash, tcsh, etc).
971 that users are familiar with (bash, tcsh, etc).
959 This means:
972 This means:
960 \layout Standard
973 \layout Standard
961
974
962 1.
975 1.
963 System commands can be issued directly at the prompt with no special syntax:
976 System commands can be issued directly at the prompt with no special syntax:
964 \layout Standard
977 \layout Standard
965
978
966 >> ls
979 >> ls
967 \layout Standard
980 \layout Standard
968
981
969 >> xemacs
982 >> xemacs
970 \layout Standard
983 \layout Standard
971
984
972 should just work like a user expects.
985 should just work like a user expects.
973 \layout Standard
986 \layout Standard
974
987
975 2.
988 2.
976 The facilities of the python language should always be available, like
989 The facilities of the python language should always be available, like
977 they are in ipython:
990 they are in ipython:
978 \layout Standard
991 \layout Standard
979
992
980 >> 3+4
993 >> 3+4
981 \newline
994 \newline
982 7
995 7
983 \layout Standard
996 \layout Standard
984
997
985 3.
998 3.
986 It should be possible to easily capture shell output into a variable.
999 It should be possible to easily capture shell output into a variable.
987 bash and friends use backquotes, I think using a command (@sc) like ipython
1000 bash and friends use backquotes, I think using a command (@sc) like ipython
988 currently does is an acceptable compromise.
1001 currently does is an acceptable compromise.
989 \layout Standard
1002 \layout Standard
990
1003
991 4.
1004 4.
992 It should also be possible to expand python variables/commands in the middle
1005 It should also be possible to expand python variables/commands in the middle
993 of system commands.
1006 of system commands.
994 I thihk this will make it necessary to use $var for name expansions:
1007 I thihk this will make it necessary to use $var for name expansions:
995 \layout Standard
1008 \layout Standard
996
1009
997 >> var='hello' # var is a Python variable
1010 >> var='hello' # var is a Python variable
998 \newline
1011 \newline
999 >> print var hello # This is the result of a Python print command
1012 >> print var hello # This is the result of a Python print command
1000 \newline
1013 \newline
1001 >> echo $var hello # This calls the echo command, expanding 'var'.
1014 >> echo $var hello # This calls the echo command, expanding 'var'.
1002 \layout Standard
1015 \layout Standard
1003
1016
1004 5.
1017 5.
1005 The above capabilities should remain possible for multi-line commands.
1018 The above capabilities should remain possible for multi-line commands.
1006 One of the most annoying things I find about tcsh, is that I never quite
1019 One of the most annoying things I find about tcsh, is that I never quite
1007 remember the syntactic details of looping.
1020 remember the syntactic details of looping.
1008 I often want to do something at the shell which involves a simple loop,
1021 I often want to do something at the shell which involves a simple loop,
1009 but I can never remember how to do it in tcsh.
1022 but I can never remember how to do it in tcsh.
1010 This often means I just write a quick throwaway python script to do it
1023 This often means I just write a quick throwaway python script to do it
1011 (Perl is great for this kind of quick things, but I've forgotten most its
1024 (Perl is great for this kind of quick things, but I've forgotten most its
1012 syntax as well).
1025 syntax as well).
1013 \layout Standard
1026 \layout Standard
1014
1027
1015 It should be possible to write code like:
1028 It should be possible to write code like:
1016 \layout Standard
1029 \layout Standard
1017
1030
1018 >> for ext in ['.jpg','.gif']:
1031 >> for ext in ['.jpg','.gif']:
1019 \newline
1032 \newline
1020 ..
1033 ..
1021 ls file$ext
1034 ls file$ext
1022 \layout Standard
1035 \layout Standard
1023
1036
1024 And have it work as 'ls file.jpg;ls file.gif'.
1037 And have it work as 'ls file.jpg;ls file.gif'.
1025 \layout Subsection
1038 \layout Subsection
1026
1039
1027 Smaller details
1040 Smaller details
1028 \layout Standard
1041 \layout Standard
1029
1042
1030 If the above are considered as valid guiding principles for how such a python
1043 If the above are considered as valid guiding principles for how such a python
1031 system shell should behave, then some smaller considerations and comments
1044 system shell should behave, then some smaller considerations and comments
1032 to keep in mind are listed below.
1045 to keep in mind are listed below.
1033 \layout Standard
1046 \layout Standard
1034
1047
1035 - it's ok for shell builtins (in this case this includes the python language)
1048 - it's ok for shell builtins (in this case this includes the python language)
1036 to override system commands on the path.
1049 to override system commands on the path.
1037 See tcsh's 'time' vs '/usr/bin/time'.
1050 See tcsh's 'time' vs '/usr/bin/time'.
1038 This settles the 'print' issue and related.
1051 This settles the 'print' issue and related.
1039 \layout Standard
1052 \layout Standard
1040
1053
1041 - pysh should take
1054 - pysh should take
1042 \layout Standard
1055 \layout Standard
1043
1056
1044 foo args
1057 foo args
1045 \layout Standard
1058 \layout Standard
1046
1059
1047 as a command if (foo args is NOT valid python) and (foo is in $PATH).
1060 as a command if (foo args is NOT valid python) and (foo is in $PATH).
1048 \layout Standard
1061 \layout Standard
1049
1062
1050 If the user types
1063 If the user types
1051 \layout Standard
1064 \layout Standard
1052
1065
1053 >> ./foo args
1066 >> ./foo args
1054 \layout Standard
1067 \layout Standard
1055
1068
1056 it should be considered a system command always.
1069 it should be considered a system command always.
1057 \layout Standard
1070 \layout Standard
1058
1071
1059 - _, __ and ___ should automatically remember the previous 3 outputs captured
1072 - _, __ and ___ should automatically remember the previous 3 outputs captured
1060 from stdout.
1073 from stdout.
1061 In parallel, there should be _e, __e and ___e for stderr.
1074 In parallel, there should be _e, __e and ___e for stderr.
1062 Whether capture is done as a single string or in list mode should be a
1075 Whether capture is done as a single string or in list mode should be a
1063 user preference.
1076 user preference.
1064 If users have numbered prompts, ipython's full In/Out cache system should
1077 If users have numbered prompts, ipython's full In/Out cache system should
1065 be available.
1078 be available.
1066 \layout Standard
1079 \layout Standard
1067
1080
1068 But regardless of how variables are captured, the printout should be like
1081 But regardless of how variables are captured, the printout should be like
1069 that of a plain shell (without quotes or braces to indicate strings/lists).
1082 that of a plain shell (without quotes or braces to indicate strings/lists).
1070 The everyday 'feel' of pysh should be more that of bash/tcsh than that
1083 The everyday 'feel' of pysh should be more that of bash/tcsh than that
1071 of ipython.
1084 of ipython.
1072 \layout Standard
1085 \layout Standard
1073
1086
1074 - filename completion first.
1087 - filename completion first.
1075 Tab completion could work like in ipython, but with the order of priorities
1088 Tab completion could work like in ipython, but with the order of priorities
1076 reversed: first files, then python names.
1089 reversed: first files, then python names.
1077 \layout Standard
1090 \layout Standard
1078
1091
1079 - configuration via standard python files.
1092 - configuration via standard python files.
1080 Instead of 'setenv' you'd simply write into the os.environ[] dictionary.
1093 Instead of 'setenv' you'd simply write into the os.environ[] dictionary.
1081 This assumes that IPython itself has been fixed to be configured via normal
1094 This assumes that IPython itself has been fixed to be configured via normal
1082 python files, instead of the current clunky ipythonrc format.
1095 python files, instead of the current clunky ipythonrc format.
1083 \layout Standard
1096 \layout Standard
1084
1097
1085 - IPython can already configure the prompt in fairly generic ways.
1098 - IPython can already configure the prompt in fairly generic ways.
1086 It should be able to generate almost any kind of prompt which bash/tcsh
1099 It should be able to generate almost any kind of prompt which bash/tcsh
1087 can (within reason).
1100 can (within reason).
1088 \layout Standard
1101 \layout Standard
1089
1102
1090 - Keep the Magics system.
1103 - Keep the Magics system.
1091 They provide a lightweight syntax for configuring and modifying the state
1104 They provide a lightweight syntax for configuring and modifying the state
1092 of the user's session itself.
1105 of the user's session itself.
1093 Plus, they are an extensible system so why not give the users one more
1106 Plus, they are an extensible system so why not give the users one more
1094 tool which is fairly flexible by nature? Finally, having the @magic optional
1107 tool which is fairly flexible by nature? Finally, having the @magic optional
1095 syntax allows a user to always be able to access the shell's control system,
1108 syntax allows a user to always be able to access the shell's control system,
1096 regardless of name collisions with defined variables or system commands.
1109 regardless of name collisions with defined variables or system commands.
1097 \layout Standard
1110 \layout Standard
1098
1111
1099 But we need to move all magic functionality into a protected namespace,
1112 But we need to move all magic functionality into a protected namespace,
1100 instead of the current messy name-mangling tricks (which don't scale well).
1113 instead of the current messy name-mangling tricks (which don't scale well).
1101
1114
1102 \layout Section
1115 \layout Section
1103
1116
1104 Future improvements
1117 Future improvements
1105 \layout Itemize
1118 \layout Itemize
1106
1119
1107 When from <mod> import * is used, first check the existing namespace and
1120 When from <mod> import * is used, first check the existing namespace and
1108 at least issue a warning on screen if names are overwritten.
1121 at least issue a warning on screen if names are overwritten.
1109 \layout Itemize
1122 \layout Itemize
1110
1123
1111 Auto indent? Done, for users with readline support.
1124 Auto indent? Done, for users with readline support.
1112 \layout Subsection
1125 \layout Subsection
1113
1126
1114 Better completion a la zsh
1127 Better completion a la zsh
1115 \layout Standard
1128 \layout Standard
1116
1129
1117 This was suggested by Arnd:
1130 This was suggested by Arnd:
1118 \layout Standard
1131 \layout Standard
1119
1132
1120 > >\SpecialChar ~
1133 > >\SpecialChar ~
1121 \SpecialChar ~
1134 \SpecialChar ~
1122 \SpecialChar ~
1135 \SpecialChar ~
1123 More general, this might lead to something like
1136 More general, this might lead to something like
1124 \layout Standard
1137 \layout Standard
1125
1138
1126 > >\SpecialChar ~
1139 > >\SpecialChar ~
1127 \SpecialChar ~
1140 \SpecialChar ~
1128 \SpecialChar ~
1141 \SpecialChar ~
1129 command specific completion ?
1142 command specific completion ?
1130 \layout Standard
1143 \layout Standard
1131
1144
1132 >
1145 >
1133 \layout Standard
1146 \layout Standard
1134
1147
1135 > I'm not sure what you mean here.
1148 > I'm not sure what you mean here.
1136 \layout Standard
1149 \layout Standard
1137
1150
1138 \SpecialChar ~
1151 \SpecialChar ~
1139
1152
1140 \layout Standard
1153 \layout Standard
1141
1154
1142 Sorry, that was not understandable, indeed ...
1155 Sorry, that was not understandable, indeed ...
1143 \layout Standard
1156 \layout Standard
1144
1157
1145 I thought of something like
1158 I thought of something like
1146 \layout Standard
1159 \layout Standard
1147
1160
1148 \SpecialChar ~
1161 \SpecialChar ~
1149 - cd and then use TAB to go through the list of directories
1162 - cd and then use TAB to go through the list of directories
1150 \layout Standard
1163 \layout Standard
1151
1164
1152 \SpecialChar ~
1165 \SpecialChar ~
1153 - ls and then TAB to consider all files and directories
1166 - ls and then TAB to consider all files and directories
1154 \layout Standard
1167 \layout Standard
1155
1168
1156 \SpecialChar ~
1169 \SpecialChar ~
1157 - cat and TAB: only files (no directories ...)
1170 - cat and TAB: only files (no directories ...)
1158 \layout Standard
1171 \layout Standard
1159
1172
1160 \SpecialChar ~
1173 \SpecialChar ~
1161
1174
1162 \layout Standard
1175 \layout Standard
1163
1176
1164 For zsh things like this are established by defining in .zshrc
1177 For zsh things like this are established by defining in .zshrc
1165 \layout Standard
1178 \layout Standard
1166
1179
1167 \SpecialChar ~
1180 \SpecialChar ~
1168
1181
1169 \layout Standard
1182 \layout Standard
1170
1183
1171 compctl -g '*.dvi' xdvi
1184 compctl -g '*.dvi' xdvi
1172 \layout Standard
1185 \layout Standard
1173
1186
1174 compctl -g '*.dvi' dvips
1187 compctl -g '*.dvi' dvips
1175 \layout Standard
1188 \layout Standard
1176
1189
1177 compctl -g '*.tex' latex
1190 compctl -g '*.tex' latex
1178 \layout Standard
1191 \layout Standard
1179
1192
1180 compctl -g '*.tex' tex
1193 compctl -g '*.tex' tex
1181 \layout Standard
1194 \layout Standard
1182
1195
1183 ...
1196 ...
1184 \layout Section
1197 \layout Section
1185
1198
1186 Outline of steps
1199 Outline of steps
1187 \layout Standard
1200 \layout Standard
1188
1201
1189 Here's a rough outline of the order in which to start implementing the various
1202 Here's a rough outline of the order in which to start implementing the various
1190 parts of the redesign.
1203 parts of the redesign.
1191 The first 'test of success' should be a clean pychecker run (not the mess
1204 The first 'test of success' should be a clean pychecker run (not the mess
1192 we get right now).
1205 we get right now).
1193 \layout Itemize
1206 \layout Itemize
1194
1207
1195 Make Logger and Magic not be mixins but attributes of the main class.
1208 Make Logger and Magic not be mixins but attributes of the main class.
1196
1209
1197 \begin_deeper
1210 \begin_deeper
1198 \layout Itemize
1211 \layout Itemize
1199
1212
1200 Magic should have a pointer back to the main instance (even if this creates
1213 Magic should have a pointer back to the main instance (even if this creates
1201 a recursive structure) so it can control it with minimal message-passing
1214 a recursive structure) so it can control it with minimal message-passing
1202 machinery.
1215 machinery.
1203
1216
1204 \layout Itemize
1217 \layout Itemize
1205
1218
1206 Logger can be a standalone object, simply with a nice, clean interface.
1219 Logger can be a standalone object, simply with a nice, clean interface.
1207 \layout Itemize
1220 \layout Itemize
1208
1221
1209 Logger currently handles part of the prompt caching, but other parts of
1222 Logger currently handles part of the prompt caching, but other parts of
1210 that are in the prompts class itself.
1223 that are in the prompts class itself.
1211 Clean up.
1224 Clean up.
1212 \end_deeper
1225 \end_deeper
1213 \layout Itemize
1226 \layout Itemize
1214
1227
1215 Change to python-based config system.
1228 Change to python-based config system.
1216 \layout Itemize
1229 \layout Itemize
1217
1230
1218 Move make_IPython() into the main shell class, as part of the constructor.
1231 Move make_IPython() into the main shell class, as part of the constructor.
1219 Do this
1232 Do this
1220 \emph on
1233 \emph on
1221 after
1234 after
1222 \emph default
1235 \emph default
1223 the config system has been changed, debugging will be a lot easier then.
1236 the config system has been changed, debugging will be a lot easier then.
1224 \layout Itemize
1237 \layout Itemize
1225
1238
1226 Merge the embeddable class and the normal one into one.
1239 Merge the embeddable class and the normal one into one.
1227 After all, the standard ipython script
1240 After all, the standard ipython script
1228 \emph on
1241 \emph on
1229 is
1242 is
1230 \emph default
1243 \emph default
1231 a python program with IPython embedded in it.
1244 a python program with IPython embedded in it.
1232 There's no need for two separate classes (
1245 There's no need for two separate classes (
1233 \emph on
1246 \emph on
1234 maybe
1247 maybe
1235 \emph default
1248 \emph default
1236 keep the old one around for the sake of backwards compatibility).
1249 keep the old one around for the sake of backwards compatibility).
1237 \layout Section
1250 \layout Section
1238
1251
1239 Ville Vainio's suggestions
1252 Ville Vainio's suggestions
1240 \layout Standard
1253 \layout Standard
1241
1254
1242 Some notes sent in by Ville Vainio
1255 Some notes sent in by Ville Vainio
1243 \family typewriter
1256 \family typewriter
1244 <vivainio@kolumbus.fi>
1257 <vivainio@kolumbus.fi>
1245 \family default
1258 \family default
1246 on Tue, 29 Jun 2004.
1259 on Tue, 29 Jun 2004.
1247 Keep here for reference, some of it replicates things already said above.
1260 Keep here for reference, some of it replicates things already said above.
1248 \layout Standard
1261 \layout Standard
1249
1262
1250 Current ipython seems to "special case" lots of stuff - aliases, magics
1263 Current ipython seems to "special case" lots of stuff - aliases, magics
1251 etc.
1264 etc.
1252 It would seem to yield itself to a simpler and more extensible architecture,
1265 It would seem to yield itself to a simpler and more extensible architecture,
1253 consisting of multple dictionaries, where just the order of search is determine
1266 consisting of multple dictionaries, where just the order of search is determine
1254 d by profile/prefix.
1267 d by profile/prefix.
1255 All the functionality would just be "pushed" to ipython core, i.e.
1268 All the functionality would just be "pushed" to ipython core, i.e.
1256 the objects that represent the functionality are instantiated on "plugins"
1269 the objects that represent the functionality are instantiated on "plugins"
1257 and they are registered with ipython core.
1270 and they are registered with ipython core.
1258 i.e.
1271 i.e.
1259 \layout Standard
1272 \layout Standard
1260
1273
1261 def magic_f(options, args): pass
1274 def magic_f(options, args): pass
1262 \layout Standard
1275 \layout Standard
1263
1276
1264 m = MyMagic(magic_f) m.arghandler = stockhandlers.OptParseArgHandler m.options
1277 m = MyMagic(magic_f) m.arghandler = stockhandlers.OptParseArgHandler m.options
1265 = ....
1278 = ....
1266 # optparse options, for easy passing to magic_f and help display
1279 # optparse options, for easy passing to magic_f and help display
1267 \layout Standard
1280 \layout Standard
1268
1281
1269 # note that arghandler takes a peek at the instance, sees options, and proceeds
1282 # note that arghandler takes a peek at the instance, sees options, and proceeds
1270 # accordingly.
1283 # accordingly.
1271 Various arg handlers can ask for arbitrary options.
1284 Various arg handlers can ask for arbitrary options.
1272 # some handler might optionally glob the filenames, search data folders
1285 # some handler might optionally glob the filenames, search data folders
1273 for filenames etc.
1286 for filenames etc.
1274 \layout Standard
1287 \layout Standard
1275
1288
1276 ipythonregistry.register(category = "magic", name = "mymagic", obj = m)
1289 ipythonregistry.register(category = "magic", name = "mymagic", obj = m)
1277 \layout Standard
1290 \layout Standard
1278
1291
1279 I bet most of the current functionality could easily be added to such a
1292 I bet most of the current functionality could easily be added to such a
1280 registry by just instantiating e.g.
1293 registry by just instantiating e.g.
1281 "Magic" class and registering all the functions with some sensible default
1294 "Magic" class and registering all the functions with some sensible default
1282 args.
1295 args.
1283 Supporting legacy stuff in general would be easy - just implement new handlers
1296 Supporting legacy stuff in general would be easy - just implement new handlers
1284 (arg and otherwise) for new stuff, and have the old handlers around forever
1297 (arg and otherwise) for new stuff, and have the old handlers around forever
1285 / as long as is deemed appropriate.
1298 / as long as is deemed appropriate.
1286 The 'python' namespace (locals() + globals()) should be special, of course.
1299 The 'python' namespace (locals() + globals()) should be special, of course.
1287 \layout Standard
1300 \layout Standard
1288
1301
1289 It should be easy to have arbitrary number of "categories" (like 'magic',
1302 It should be easy to have arbitrary number of "categories" (like 'magic',
1290 'shellcommand','projectspecific_myproject', 'projectspecific_otherproject').
1303 'shellcommand','projectspecific_myproject', 'projectspecific_otherproject').
1291 It would only influence the order in which the completions are suggested,
1304 It would only influence the order in which the completions are suggested,
1292 and in case of name collision which one is selected.
1305 and in case of name collision which one is selected.
1293 Also, I think all completions should be shown, even the ones in "later"
1306 Also, I think all completions should be shown, even the ones in "later"
1294 categories in the case of a match in an "earlier" category.
1307 categories in the case of a match in an "earlier" category.
1295 \layout Standard
1308 \layout Standard
1296
1309
1297 The "functionality object" might also have a callable object 'expandarg',
1310 The "functionality object" might also have a callable object 'expandarg',
1298 and ipython would run it (with the arg index) when tab completion is attempted
1311 and ipython would run it (with the arg index) when tab completion is attempted
1299 after typing the function name.
1312 after typing the function name.
1300 It would return the possible completions for that particular command...
1313 It would return the possible completions for that particular command...
1301 or None to "revert to default file completions".
1314 or None to "revert to default file completions".
1302 Such functionality could be useful in making ipython an "operating console"
1315 Such functionality could be useful in making ipython an "operating console"
1303 of a sort.
1316 of a sort.
1304 I'm talking about:
1317 I'm talking about:
1305 \layout Standard
1318 \layout Standard
1306
1319
1307 >> lscat reactor # list commands in category - reactor is "project specific"
1320 >> lscat reactor # list commands in category - reactor is "project specific"
1308 category
1321 category
1309 \layout Standard
1322 \layout Standard
1310
1323
1311 r_operate
1324 r_operate
1312 \layout Standard
1325 \layout Standard
1313
1326
1314 >> r_operate <tab> start shutdown notify_meltdown evacuate
1327 >> r_operate <tab> start shutdown notify_meltdown evacuate
1315 \layout Standard
1328 \layout Standard
1316
1329
1317 >> r_operate shutdown <tab>
1330 >> r_operate shutdown <tab>
1318 \layout Standard
1331 \layout Standard
1319
1332
1320 1 2 5 6 # note that 3 and 4 are already shut down
1333 1 2 5 6 # note that 3 and 4 are already shut down
1321 \layout Standard
1334 \layout Standard
1322
1335
1323 >> r_operate shutdown 2
1336 >> r_operate shutdown 2
1324 \layout Standard
1337 \layout Standard
1325
1338
1326 Shutting down..
1339 Shutting down..
1327 ok.
1340 ok.
1328 \layout Standard
1341 \layout Standard
1329
1342
1330 >> r_operate start <tab>
1343 >> r_operate start <tab>
1331 \layout Standard
1344 \layout Standard
1332
1345
1333 2 3 4 # 2 was shut down, can be started now
1346 2 3 4 # 2 was shut down, can be started now
1334 \layout Standard
1347 \layout Standard
1335
1348
1336 >> r_operate start 2
1349 >> r_operate start 2
1337 \layout Standard
1350 \layout Standard
1338
1351
1339 Starting....
1352 Starting....
1340 ok.
1353 ok.
1341 \layout Standard
1354 \layout Standard
1342
1355
1343 I'm talking about having a super-configurable man-machine language here!
1356 I'm talking about having a super-configurable man-machine language here!
1344 Like cmd.Cmd on steroids, as a free addition to ipython!
1357 Like cmd.Cmd on steroids, as a free addition to ipython!
1345 \the_end
1358 \the_end
General Comments 0
You need to be logged in to leave comments. Login now