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