##// END OF EJS Templates
- Fixes for doctest support. Need more testing, esp. to be sure they don't...
fperez -
Show More
@@ -1,252 +1,62 b''
1 """ Legacy stuff
1 """ Legacy stuff
2
2
3 Various stuff that are there for historical / familiarity reasons.
3 Various stuff that are there for historical / familiarity reasons.
4
4
5 This is automatically imported by default profile, though not other profiles
5 This is automatically imported by default profile, though not other profiles
6 (e.g. 'sh' profile).
6 (e.g. 'sh' profile).
7
7
8 Stuff that is considered obsolete / redundant is gradually moved here.
8 Stuff that is considered obsolete / redundant is gradually moved here.
9
9
10 """
10 """
11
11
12 import IPython.ipapi
12 import IPython.ipapi
13 ip = IPython.ipapi.get()
13 ip = IPython.ipapi.get()
14
14
15 import os,sys
15 import os,sys
16
16
17 from IPython.genutils import *
17 from IPython.genutils import *
18
18
19 # use ?
20 def magic_pdef(self, parameter_s='', namespaces=None):
21 """Print the definition header for any callable object.
22
23 If the object is a class, print the constructor information."""
24 self._inspect('pdef',parameter_s, namespaces)
25
26 ip.expose_magic("pdef", magic_pdef)
27
28 # use ?
29 def magic_pdoc(self, parameter_s='', namespaces=None):
30 """Print the docstring for an object.
31
32 If the given object is a class, it will print both the class and the
33 constructor docstrings."""
34 self._inspect('pdoc',parameter_s, namespaces)
35
36 ip.expose_magic("pdoc", magic_pdoc)
37
38 # use ??
39 def magic_psource(self, parameter_s='', namespaces=None):
40 """Print (or run through pager) the source code for an object."""
41 self._inspect('psource',parameter_s, namespaces)
42
43 ip.expose_magic("pdoc", magic_psource)
44
45 # use ?
46 def magic_pfile(self, parameter_s=''):
47 """Print (or run through pager) the file where an object is defined.
48
49 The file opens at the line where the object definition begins. IPython
50 will honor the environment variable PAGER if set, and otherwise will
51 do its best to print the file in a convenient form.
52
53 If the given argument is not an object currently defined, IPython will
54 try to interpret it as a filename (automatically adding a .py extension
55 if needed). You can thus use %pfile as a syntax highlighting code
56 viewer."""
57
58 # first interpret argument as an object name
59 out = self._inspect('pfile',parameter_s)
60 # if not, try the input as a filename
61 if out == 'not found':
62 try:
63 filename = get_py_filename(parameter_s)
64 except IOError,msg:
65 print msg
66 return
67 page(self.shell.inspector.format(file(filename).read()))
68
69 ip.expose_magic("pfile", magic_pfile)
70
71 # use rehashx
19 # use rehashx
72
20
73 def magic_rehash(self, parameter_s = ''):
21 def magic_rehash(self, parameter_s = ''):
74 """Update the alias table with all entries in $PATH.
22 """Update the alias table with all entries in $PATH.
75
23
76 This version does no checks on execute permissions or whether the
24 This version does no checks on execute permissions or whether the
77 contents of $PATH are truly files (instead of directories or something
25 contents of $PATH are truly files (instead of directories or something
78 else). For such a safer (but slower) version, use %rehashx."""
26 else). For such a safer (but slower) version, use %rehashx."""
79
27
80 # This function (and rehashx) manipulate the alias_table directly
28 # This function (and rehashx) manipulate the alias_table directly
81 # rather than calling magic_alias, for speed reasons. A rehash on a
29 # rather than calling magic_alias, for speed reasons. A rehash on a
82 # typical Linux box involves several thousand entries, so efficiency
30 # typical Linux box involves several thousand entries, so efficiency
83 # here is a top concern.
31 # here is a top concern.
84
32
85 path = filter(os.path.isdir,os.environ.get('PATH','').split(os.pathsep))
33 path = filter(os.path.isdir,os.environ.get('PATH','').split(os.pathsep))
86 alias_table = self.shell.alias_table
34 alias_table = self.shell.alias_table
87 for pdir in path:
35 for pdir in path:
88 for ff in os.listdir(pdir):
36 for ff in os.listdir(pdir):
89 # each entry in the alias table must be (N,name), where
37 # each entry in the alias table must be (N,name), where
90 # N is the number of positional arguments of the alias.
38 # N is the number of positional arguments of the alias.
91 alias_table[ff] = (0,ff)
39 alias_table[ff] = (0,ff)
92 # Make sure the alias table doesn't contain keywords or builtins
40 # Make sure the alias table doesn't contain keywords or builtins
93 self.shell.alias_table_validate()
41 self.shell.alias_table_validate()
94 # Call again init_auto_alias() so we get 'rm -i' and other modified
42 # Call again init_auto_alias() so we get 'rm -i' and other modified
95 # aliases since %rehash will probably clobber them
43 # aliases since %rehash will probably clobber them
96 self.shell.init_auto_alias()
44 self.shell.init_auto_alias()
97
45
98 ip.expose_magic("rehash", magic_rehash)
46 ip.expose_magic("rehash", magic_rehash)
99
47
100 #use cd -<tab>
101 def magic_dhist(self, parameter_s=''):
102 """Print your history of visited directories.
103
104 %dhist -> print full history\\
105 %dhist n -> print last n entries only\\
106 %dhist n1 n2 -> print entries between n1 and n2 (n1 not included)\\
107
108 This history is automatically maintained by the %cd command, and
109 always available as the global list variable _dh. You can use %cd -<n>
110 to go to directory number <n>."""
111
112 dh = self.shell.user_ns['_dh']
113 if parameter_s:
114 try:
115 args = map(int,parameter_s.split())
116 except:
117 self.arg_err(Magic.magic_dhist)
118 return
119 if len(args) == 1:
120 ini,fin = max(len(dh)-(args[0]),0),len(dh)
121 elif len(args) == 2:
122 ini,fin = args
123 else:
124 self.arg_err(Magic.magic_dhist)
125 return
126 else:
127 ini,fin = 0,len(dh)
128 nlprint(dh,
129 header = 'Directory history (kept in _dh)',
130 start=ini,stop=fin)
131
132 ip.expose_magic("dhist", magic_dhist)
133
134 # Exit
48 # Exit
135 def magic_Quit(self, parameter_s=''):
49 def magic_Quit(self, parameter_s=''):
136 """Exit IPython without confirmation (like %Exit)."""
50 """Exit IPython without confirmation (like %Exit)."""
137
51
138 self.shell.exit_now = True
52 self.shell.exit_now = True
139
53
140 ip.expose_magic("Quit", magic_Quit)
54 ip.expose_magic("Quit", magic_Quit)
141
55
142
56
143 # make it autocallable fn if you really need it
57 # make it autocallable fn if you really need it
144 def magic_p(self, parameter_s=''):
58 def magic_p(self, parameter_s=''):
145 """Just a short alias for Python's 'print'."""
59 """Just a short alias for Python's 'print'."""
146 exec 'print ' + parameter_s in self.shell.user_ns
60 exec 'print ' + parameter_s in self.shell.user_ns
147
61
148 ip.expose_magic("p", magic_p)
62 ip.expose_magic("p", magic_p)
149
150 # up + enter. One char magic.
151 def magic_r(self, parameter_s=''):
152 """Repeat previous input.
153
154 If given an argument, repeats the previous command which starts with
155 the same string, otherwise it just repeats the previous input.
156
157 Shell escaped commands (with ! as first character) are not recognized
158 by this system, only pure python code and magic commands.
159 """
160
161 start = parameter_s.strip()
162 esc_magic = self.shell.ESC_MAGIC
163 # Identify magic commands even if automagic is on (which means
164 # the in-memory version is different from that typed by the user).
165 if self.shell.rc.automagic:
166 start_magic = esc_magic+start
167 else:
168 start_magic = start
169 # Look through the input history in reverse
170 for n in range(len(self.shell.input_hist)-2,0,-1):
171 input = self.shell.input_hist[n]
172 # skip plain 'r' lines so we don't recurse to infinity
173 if input != '_ip.magic("r")\n' and \
174 (input.startswith(start) or input.startswith(start_magic)):
175 #print 'match',`input` # dbg
176 print 'Executing:',input,
177 self.shell.runlines(input)
178 return
179 print 'No previous input matching `%s` found.' % start
180
181 ip.expose_magic("r", magic_r)
182
183
184 # use _ip.option.automagic
185
186 def magic_automagic(self, parameter_s = ''):
187 """Make magic functions callable without having to type the initial %.
188
189 Without argumentsl toggles on/off (when off, you must call it as
190 %automagic, of course). With arguments it sets the value, and you can
191 use any of (case insensitive):
192
193 - on,1,True: to activate
194
195 - off,0,False: to deactivate.
196
197 Note that magic functions have lowest priority, so if there's a
198 variable whose name collides with that of a magic fn, automagic won't
199 work for that function (you get the variable instead). However, if you
200 delete the variable (del var), the previously shadowed magic function
201 becomes visible to automagic again."""
202
203 rc = self.shell.rc
204 arg = parameter_s.lower()
205 if parameter_s in ('on','1','true'):
206 rc.automagic = True
207 elif parameter_s in ('off','0','false'):
208 rc.automagic = False
209 else:
210 rc.automagic = not rc.automagic
211 print '\n' + Magic.auto_status[rc.automagic]
212
213 ip.expose_magic("automagic", magic_automagic)
214
215 # use _ip.options.autocall
216 def magic_autocall(self, parameter_s = ''):
217 """Make functions callable without having to type parentheses.
218
219 Usage:
220
221 %autocall [mode]
222
223 The mode can be one of: 0->Off, 1->Smart, 2->Full. If not given, the
224 value is toggled on and off (remembering the previous state)."""
225
226 rc = self.shell.rc
227
228 if parameter_s:
229 arg = int(parameter_s)
230 else:
231 arg = 'toggle'
232
233 if not arg in (0,1,2,'toggle'):
234 error('Valid modes: (0->Off, 1->Smart, 2->Full')
235 return
236
237 if arg in (0,1,2):
238 rc.autocall = arg
239 else: # toggle
240 if rc.autocall:
241 self._magic_state.autocall_save = rc.autocall
242 rc.autocall = 0
243 else:
244 try:
245 rc.autocall = self._magic_state.autocall_save
246 except AttributeError:
247 rc.autocall = self._magic_state.autocall_save = 1
248
249 print "Automatic calling is:",['OFF','Smart','Full'][rc.autocall]
250
251 ip.expose_magic("autocall", magic_autocall)
252
@@ -1,51 +1,52 b''
1 # -*- coding: utf-8 -*-
1 # -*- coding: utf-8 -*-
2 """
2 """
3 Class which mimics a module.
3 Class which mimics a module.
4
4
5 Needed to allow pickle to correctly resolve namespaces during IPython
5 Needed to allow pickle to correctly resolve namespaces during IPython
6 sessions.
6 sessions.
7
7
8 $Id: FakeModule.py 2169 2007-03-23 06:09:43Z fperez $"""
8 $Id: FakeModule.py 2723 2007-09-07 07:44:16Z fperez $"""
9
9
10 #*****************************************************************************
10 #*****************************************************************************
11 # Copyright (C) 2002-2004 Fernando Perez. <fperez@colorado.edu>
11 # Copyright (C) 2002-2004 Fernando Perez. <fperez@colorado.edu>
12 #
12 #
13 # Distributed under the terms of the BSD License. The full license is in
13 # Distributed under the terms of the BSD License. The full license is in
14 # the file COPYING, distributed as part of this software.
14 # the file COPYING, distributed as part of this software.
15 #*****************************************************************************
15 #*****************************************************************************
16
16
17 class FakeModule:
17 import types
18
19 class FakeModule(types.ModuleType):
18 """Simple class with attribute access to fake a module.
20 """Simple class with attribute access to fake a module.
19
21
20 This is not meant to replace a module, but to allow inserting a fake
22 This is not meant to replace a module, but to allow inserting a fake
21 module in sys.modules so that systems which rely on run-time module
23 module in sys.modules so that systems which rely on run-time module
22 importing (like shelve and pickle) work correctly in interactive IPython
24 importing (like shelve and pickle) work correctly in interactive IPython
23 sessions.
25 sessions.
24
26
25 Do NOT use this code for anything other than this IPython private hack."""
27 Do NOT use this code for anything other than this IPython private hack."""
26
27 def __init__(self,adict):
28 def __init__(self,adict):
28
29
29 # It seems pydoc (and perhaps others) needs any module instance to
30 # It seems pydoc (and perhaps others) needs any module instance to
30 # implement a __nonzero__ method, so we add it if missing:
31 # implement a __nonzero__ method, so we add it if missing:
31 if '__nonzero__' not in adict:
32 if '__nonzero__' not in adict:
32 def __nonzero__():
33 def __nonzero__():
33 return 1
34 return 1
34 adict['__nonzero__'] = __nonzero__
35 adict['__nonzero__'] = __nonzero__
35
36
36 self.__dict__ = adict
37 self._dict_ = adict
37
38
38 # modules should have a __file__ attribute
39 # modules should have a __file__ attribute
39 adict.setdefault('__file__',__file__)
40 adict.setdefault('__file__',__file__)
40
41
41 def __getattr__(self,key):
42 def __getattr__(self,key):
42 try:
43 try:
43 return self.__dict__[key]
44 return self._dict_[key]
44 except KeyError, e:
45 except KeyError, e:
45 raise AttributeError("FakeModule object has no attribute %s" % e)
46 raise AttributeError("FakeModule object has no attribute %s" % e)
46
47
47 def __str__(self):
48 def __str__(self):
48 return "<IPython.FakeModule instance>"
49 return "<IPython.FakeModule instance>"
49
50
50 def __repr__(self):
51 def __repr__(self):
51 return str(self)
52 return str(self)
@@ -1,3016 +1,3212 b''
1 # -*- coding: utf-8 -*-
1 # -*- coding: utf-8 -*-
2 """Magic functions for InteractiveShell.
2 """Magic functions for InteractiveShell.
3
3
4 $Id: Magic.py 2705 2007-09-04 15:10:37Z vivainio $"""
4 $Id: Magic.py 2723 2007-09-07 07:44:16Z fperez $"""
5
5
6 #*****************************************************************************
6 #*****************************************************************************
7 # Copyright (C) 2001 Janko Hauser <jhauser@zscout.de> and
7 # Copyright (C) 2001 Janko Hauser <jhauser@zscout.de> and
8 # Copyright (C) 2001-2006 Fernando Perez <fperez@colorado.edu>
8 # Copyright (C) 2001-2006 Fernando Perez <fperez@colorado.edu>
9 #
9 #
10 # Distributed under the terms of the BSD License. The full license is in
10 # Distributed under the terms of the BSD License. The full license is in
11 # the file COPYING, distributed as part of this software.
11 # the file COPYING, distributed as part of this software.
12 #*****************************************************************************
12 #*****************************************************************************
13
13
14 #****************************************************************************
14 #****************************************************************************
15 # Modules and globals
15 # Modules and globals
16
16
17 from IPython import Release
17 from IPython import Release
18 __author__ = '%s <%s>\n%s <%s>' % \
18 __author__ = '%s <%s>\n%s <%s>' % \
19 ( Release.authors['Janko'] + Release.authors['Fernando'] )
19 ( Release.authors['Janko'] + Release.authors['Fernando'] )
20 __license__ = Release.license
20 __license__ = Release.license
21
21
22 # Python standard modules
22 # Python standard modules
23 import __builtin__
23 import __builtin__
24 import bdb
24 import bdb
25 import inspect
25 import inspect
26 import os
26 import os
27 import pdb
27 import pdb
28 import pydoc
28 import pydoc
29 import sys
29 import sys
30 import re
30 import re
31 import tempfile
31 import tempfile
32 import time
32 import time
33 import cPickle as pickle
33 import cPickle as pickle
34 import textwrap
34 import textwrap
35 from cStringIO import StringIO
35 from cStringIO import StringIO
36 from getopt import getopt,GetoptError
36 from getopt import getopt,GetoptError
37 from pprint import pprint, pformat
37 from pprint import pprint, pformat
38 from sets import Set
38 from sets import Set
39
39
40 # cProfile was added in Python2.5
40 # cProfile was added in Python2.5
41 try:
41 try:
42 import cProfile as profile
42 import cProfile as profile
43 import pstats
43 import pstats
44 except ImportError:
44 except ImportError:
45 # profile isn't bundled by default in Debian for license reasons
45 # profile isn't bundled by default in Debian for license reasons
46 try:
46 try:
47 import profile,pstats
47 import profile,pstats
48 except ImportError:
48 except ImportError:
49 profile = pstats = None
49 profile = pstats = None
50
50
51 # Homebrewed
51 # Homebrewed
52 import IPython
52 import IPython
53 from IPython import Debugger, OInspect, wildcard
53 from IPython import Debugger, OInspect, wildcard
54 from IPython.FakeModule import FakeModule
54 from IPython.FakeModule import FakeModule
55 from IPython.Itpl import Itpl, itpl, printpl,itplns
55 from IPython.Itpl import Itpl, itpl, printpl,itplns
56 from IPython.PyColorize import Parser
56 from IPython.PyColorize import Parser
57 from IPython.ipstruct import Struct
57 from IPython.ipstruct import Struct
58 from IPython.macro import Macro
58 from IPython.macro import Macro
59 from IPython.genutils import *
59 from IPython.genutils import *
60 from IPython import platutils
60 from IPython import platutils
61 import IPython.generics
61 import IPython.generics
62 import IPython.ipapi
62 import IPython.ipapi
63
63
64 #***************************************************************************
64 #***************************************************************************
65 # Utility functions
65 # Utility functions
66 def on_off(tag):
66 def on_off(tag):
67 """Return an ON/OFF string for a 1/0 input. Simple utility function."""
67 """Return an ON/OFF string for a 1/0 input. Simple utility function."""
68 return ['OFF','ON'][tag]
68 return ['OFF','ON'][tag]
69
69
70 class Bunch: pass
70 class Bunch: pass
71
71
72 def compress_dhist(dh):
72 def compress_dhist(dh):
73 head, tail = dh[:-10], dh[-10:]
73 head, tail = dh[:-10], dh[-10:]
74
74
75 newhead = []
75 newhead = []
76 done = Set()
76 done = Set()
77 for h in head:
77 for h in head:
78 if h in done:
78 if h in done:
79 continue
79 continue
80 newhead.append(h)
80 newhead.append(h)
81 done.add(h)
81 done.add(h)
82
82
83 return newhead + tail
83 return newhead + tail
84
84
85
85
86 #***************************************************************************
86 #***************************************************************************
87 # Main class implementing Magic functionality
87 # Main class implementing Magic functionality
88 class Magic:
88 class Magic:
89 """Magic functions for InteractiveShell.
89 """Magic functions for InteractiveShell.
90
90
91 Shell functions which can be reached as %function_name. All magic
91 Shell functions which can be reached as %function_name. All magic
92 functions should accept a string, which they can parse for their own
92 functions should accept a string, which they can parse for their own
93 needs. This can make some functions easier to type, eg `%cd ../`
93 needs. This can make some functions easier to type, eg `%cd ../`
94 vs. `%cd("../")`
94 vs. `%cd("../")`
95
95
96 ALL definitions MUST begin with the prefix magic_. The user won't need it
96 ALL definitions MUST begin with the prefix magic_. The user won't need it
97 at the command line, but it is is needed in the definition. """
97 at the command line, but it is is needed in the definition. """
98
98
99 # class globals
99 # class globals
100 auto_status = ['Automagic is OFF, % prefix IS needed for magic functions.',
100 auto_status = ['Automagic is OFF, % prefix IS needed for magic functions.',
101 'Automagic is ON, % prefix NOT needed for magic functions.']
101 'Automagic is ON, % prefix NOT needed for magic functions.']
102
102
103 #......................................................................
103 #......................................................................
104 # some utility functions
104 # some utility functions
105
105
106 def __init__(self,shell):
106 def __init__(self,shell):
107
107
108 self.options_table = {}
108 self.options_table = {}
109 if profile is None:
109 if profile is None:
110 self.magic_prun = self.profile_missing_notice
110 self.magic_prun = self.profile_missing_notice
111 self.shell = shell
111 self.shell = shell
112
112
113 # namespace for holding state we may need
113 # namespace for holding state we may need
114 self._magic_state = Bunch()
114 self._magic_state = Bunch()
115
115
116 def profile_missing_notice(self, *args, **kwargs):
116 def profile_missing_notice(self, *args, **kwargs):
117 error("""\
117 error("""\
118 The profile module could not be found. If you are a Debian user,
118 The profile module could not be found. If you are a Debian user,
119 it has been removed from the standard Debian package because of its non-free
119 it has been removed from the standard Debian package because of its non-free
120 license. To use profiling, please install"python2.3-profiler" from non-free.""")
120 license. To use profiling, please install"python2.3-profiler" from non-free.""")
121
121
122 def default_option(self,fn,optstr):
122 def default_option(self,fn,optstr):
123 """Make an entry in the options_table for fn, with value optstr"""
123 """Make an entry in the options_table for fn, with value optstr"""
124
124
125 if fn not in self.lsmagic():
125 if fn not in self.lsmagic():
126 error("%s is not a magic function" % fn)
126 error("%s is not a magic function" % fn)
127 self.options_table[fn] = optstr
127 self.options_table[fn] = optstr
128
128
129 def lsmagic(self):
129 def lsmagic(self):
130 """Return a list of currently available magic functions.
130 """Return a list of currently available magic functions.
131
131
132 Gives a list of the bare names after mangling (['ls','cd', ...], not
132 Gives a list of the bare names after mangling (['ls','cd', ...], not
133 ['magic_ls','magic_cd',...]"""
133 ['magic_ls','magic_cd',...]"""
134
134
135 # FIXME. This needs a cleanup, in the way the magics list is built.
135 # FIXME. This needs a cleanup, in the way the magics list is built.
136
136
137 # magics in class definition
137 # magics in class definition
138 class_magic = lambda fn: fn.startswith('magic_') and \
138 class_magic = lambda fn: fn.startswith('magic_') and \
139 callable(Magic.__dict__[fn])
139 callable(Magic.__dict__[fn])
140 # in instance namespace (run-time user additions)
140 # in instance namespace (run-time user additions)
141 inst_magic = lambda fn: fn.startswith('magic_') and \
141 inst_magic = lambda fn: fn.startswith('magic_') and \
142 callable(self.__dict__[fn])
142 callable(self.__dict__[fn])
143 # and bound magics by user (so they can access self):
143 # and bound magics by user (so they can access self):
144 inst_bound_magic = lambda fn: fn.startswith('magic_') and \
144 inst_bound_magic = lambda fn: fn.startswith('magic_') and \
145 callable(self.__class__.__dict__[fn])
145 callable(self.__class__.__dict__[fn])
146 magics = filter(class_magic,Magic.__dict__.keys()) + \
146 magics = filter(class_magic,Magic.__dict__.keys()) + \
147 filter(inst_magic,self.__dict__.keys()) + \
147 filter(inst_magic,self.__dict__.keys()) + \
148 filter(inst_bound_magic,self.__class__.__dict__.keys())
148 filter(inst_bound_magic,self.__class__.__dict__.keys())
149 out = []
149 out = []
150 for fn in magics:
150 for fn in magics:
151 out.append(fn.replace('magic_','',1))
151 out.append(fn.replace('magic_','',1))
152 out.sort()
152 out.sort()
153 return out
153 return out
154
154
155 def extract_input_slices(self,slices,raw=False):
155 def extract_input_slices(self,slices,raw=False):
156 """Return as a string a set of input history slices.
156 """Return as a string a set of input history slices.
157
157
158 Inputs:
158 Inputs:
159
159
160 - slices: the set of slices is given as a list of strings (like
160 - slices: the set of slices is given as a list of strings (like
161 ['1','4:8','9'], since this function is for use by magic functions
161 ['1','4:8','9'], since this function is for use by magic functions
162 which get their arguments as strings.
162 which get their arguments as strings.
163
163
164 Optional inputs:
164 Optional inputs:
165
165
166 - raw(False): by default, the processed input is used. If this is
166 - raw(False): by default, the processed input is used. If this is
167 true, the raw input history is used instead.
167 true, the raw input history is used instead.
168
168
169 Note that slices can be called with two notations:
169 Note that slices can be called with two notations:
170
170
171 N:M -> standard python form, means including items N...(M-1).
171 N:M -> standard python form, means including items N...(M-1).
172
172
173 N-M -> include items N..M (closed endpoint)."""
173 N-M -> include items N..M (closed endpoint)."""
174
174
175 if raw:
175 if raw:
176 hist = self.shell.input_hist_raw
176 hist = self.shell.input_hist_raw
177 else:
177 else:
178 hist = self.shell.input_hist
178 hist = self.shell.input_hist
179
179
180 cmds = []
180 cmds = []
181 for chunk in slices:
181 for chunk in slices:
182 if ':' in chunk:
182 if ':' in chunk:
183 ini,fin = map(int,chunk.split(':'))
183 ini,fin = map(int,chunk.split(':'))
184 elif '-' in chunk:
184 elif '-' in chunk:
185 ini,fin = map(int,chunk.split('-'))
185 ini,fin = map(int,chunk.split('-'))
186 fin += 1
186 fin += 1
187 else:
187 else:
188 ini = int(chunk)
188 ini = int(chunk)
189 fin = ini+1
189 fin = ini+1
190 cmds.append(hist[ini:fin])
190 cmds.append(hist[ini:fin])
191 return cmds
191 return cmds
192
192
193 def _ofind(self, oname, namespaces=None):
193 def _ofind(self, oname, namespaces=None):
194 """Find an object in the available namespaces.
194 """Find an object in the available namespaces.
195
195
196 self._ofind(oname) -> dict with keys: found,obj,ospace,ismagic
196 self._ofind(oname) -> dict with keys: found,obj,ospace,ismagic
197
197
198 Has special code to detect magic functions.
198 Has special code to detect magic functions.
199 """
199 """
200
200
201 oname = oname.strip()
201 oname = oname.strip()
202
202
203 alias_ns = None
203 alias_ns = None
204 if namespaces is None:
204 if namespaces is None:
205 # Namespaces to search in:
205 # Namespaces to search in:
206 # Put them in a list. The order is important so that we
206 # Put them in a list. The order is important so that we
207 # find things in the same order that Python finds them.
207 # find things in the same order that Python finds them.
208 namespaces = [ ('Interactive', self.shell.user_ns),
208 namespaces = [ ('Interactive', self.shell.user_ns),
209 ('IPython internal', self.shell.internal_ns),
209 ('IPython internal', self.shell.internal_ns),
210 ('Python builtin', __builtin__.__dict__),
210 ('Python builtin', __builtin__.__dict__),
211 ('Alias', self.shell.alias_table),
211 ('Alias', self.shell.alias_table),
212 ]
212 ]
213 alias_ns = self.shell.alias_table
213 alias_ns = self.shell.alias_table
214
214
215 # initialize results to 'null'
215 # initialize results to 'null'
216 found = 0; obj = None; ospace = None; ds = None;
216 found = 0; obj = None; ospace = None; ds = None;
217 ismagic = 0; isalias = 0; parent = None
217 ismagic = 0; isalias = 0; parent = None
218
218
219 # Look for the given name by splitting it in parts. If the head is
219 # Look for the given name by splitting it in parts. If the head is
220 # found, then we look for all the remaining parts as members, and only
220 # found, then we look for all the remaining parts as members, and only
221 # declare success if we can find them all.
221 # declare success if we can find them all.
222 oname_parts = oname.split('.')
222 oname_parts = oname.split('.')
223 oname_head, oname_rest = oname_parts[0],oname_parts[1:]
223 oname_head, oname_rest = oname_parts[0],oname_parts[1:]
224 for nsname,ns in namespaces:
224 for nsname,ns in namespaces:
225 try:
225 try:
226 obj = ns[oname_head]
226 obj = ns[oname_head]
227 except KeyError:
227 except KeyError:
228 continue
228 continue
229 else:
229 else:
230 #print 'oname_rest:', oname_rest # dbg
230 #print 'oname_rest:', oname_rest # dbg
231 for part in oname_rest:
231 for part in oname_rest:
232 try:
232 try:
233 parent = obj
233 parent = obj
234 obj = getattr(obj,part)
234 obj = getattr(obj,part)
235 except:
235 except:
236 # Blanket except b/c some badly implemented objects
236 # Blanket except b/c some badly implemented objects
237 # allow __getattr__ to raise exceptions other than
237 # allow __getattr__ to raise exceptions other than
238 # AttributeError, which then crashes IPython.
238 # AttributeError, which then crashes IPython.
239 break
239 break
240 else:
240 else:
241 # If we finish the for loop (no break), we got all members
241 # If we finish the for loop (no break), we got all members
242 found = 1
242 found = 1
243 ospace = nsname
243 ospace = nsname
244 if ns == alias_ns:
244 if ns == alias_ns:
245 isalias = 1
245 isalias = 1
246 break # namespace loop
246 break # namespace loop
247
247
248 # Try to see if it's magic
248 # Try to see if it's magic
249 if not found:
249 if not found:
250 if oname.startswith(self.shell.ESC_MAGIC):
250 if oname.startswith(self.shell.ESC_MAGIC):
251 oname = oname[1:]
251 oname = oname[1:]
252 obj = getattr(self,'magic_'+oname,None)
252 obj = getattr(self,'magic_'+oname,None)
253 if obj is not None:
253 if obj is not None:
254 found = 1
254 found = 1
255 ospace = 'IPython internal'
255 ospace = 'IPython internal'
256 ismagic = 1
256 ismagic = 1
257
257
258 # Last try: special-case some literals like '', [], {}, etc:
258 # Last try: special-case some literals like '', [], {}, etc:
259 if not found and oname_head in ["''",'""','[]','{}','()']:
259 if not found and oname_head in ["''",'""','[]','{}','()']:
260 obj = eval(oname_head)
260 obj = eval(oname_head)
261 found = 1
261 found = 1
262 ospace = 'Interactive'
262 ospace = 'Interactive'
263
263
264 return {'found':found, 'obj':obj, 'namespace':ospace,
264 return {'found':found, 'obj':obj, 'namespace':ospace,
265 'ismagic':ismagic, 'isalias':isalias, 'parent':parent}
265 'ismagic':ismagic, 'isalias':isalias, 'parent':parent}
266
266
267 def arg_err(self,func):
267 def arg_err(self,func):
268 """Print docstring if incorrect arguments were passed"""
268 """Print docstring if incorrect arguments were passed"""
269 print 'Error in arguments:'
269 print 'Error in arguments:'
270 print OInspect.getdoc(func)
270 print OInspect.getdoc(func)
271
271
272 def format_latex(self,strng):
272 def format_latex(self,strng):
273 """Format a string for latex inclusion."""
273 """Format a string for latex inclusion."""
274
274
275 # Characters that need to be escaped for latex:
275 # Characters that need to be escaped for latex:
276 escape_re = re.compile(r'(%|_|\$|#|&)',re.MULTILINE)
276 escape_re = re.compile(r'(%|_|\$|#|&)',re.MULTILINE)
277 # Magic command names as headers:
277 # Magic command names as headers:
278 cmd_name_re = re.compile(r'^(%s.*?):' % self.shell.ESC_MAGIC,
278 cmd_name_re = re.compile(r'^(%s.*?):' % self.shell.ESC_MAGIC,
279 re.MULTILINE)
279 re.MULTILINE)
280 # Magic commands
280 # Magic commands
281 cmd_re = re.compile(r'(?P<cmd>%s.+?\b)(?!\}\}:)' % self.shell.ESC_MAGIC,
281 cmd_re = re.compile(r'(?P<cmd>%s.+?\b)(?!\}\}:)' % self.shell.ESC_MAGIC,
282 re.MULTILINE)
282 re.MULTILINE)
283 # Paragraph continue
283 # Paragraph continue
284 par_re = re.compile(r'\\$',re.MULTILINE)
284 par_re = re.compile(r'\\$',re.MULTILINE)
285
285
286 # The "\n" symbol
286 # The "\n" symbol
287 newline_re = re.compile(r'\\n')
287 newline_re = re.compile(r'\\n')
288
288
289 # Now build the string for output:
289 # Now build the string for output:
290 #strng = cmd_name_re.sub(r'\n\\texttt{\\textsl{\\large \1}}:',strng)
290 #strng = cmd_name_re.sub(r'\n\\texttt{\\textsl{\\large \1}}:',strng)
291 strng = cmd_name_re.sub(r'\n\\bigskip\n\\texttt{\\textbf{ \1}}:',
291 strng = cmd_name_re.sub(r'\n\\bigskip\n\\texttt{\\textbf{ \1}}:',
292 strng)
292 strng)
293 strng = cmd_re.sub(r'\\texttt{\g<cmd>}',strng)
293 strng = cmd_re.sub(r'\\texttt{\g<cmd>}',strng)
294 strng = par_re.sub(r'\\\\',strng)
294 strng = par_re.sub(r'\\\\',strng)
295 strng = escape_re.sub(r'\\\1',strng)
295 strng = escape_re.sub(r'\\\1',strng)
296 strng = newline_re.sub(r'\\textbackslash{}n',strng)
296 strng = newline_re.sub(r'\\textbackslash{}n',strng)
297 return strng
297 return strng
298
298
299 def format_screen(self,strng):
299 def format_screen(self,strng):
300 """Format a string for screen printing.
300 """Format a string for screen printing.
301
301
302 This removes some latex-type format codes."""
302 This removes some latex-type format codes."""
303 # Paragraph continue
303 # Paragraph continue
304 par_re = re.compile(r'\\$',re.MULTILINE)
304 par_re = re.compile(r'\\$',re.MULTILINE)
305 strng = par_re.sub('',strng)
305 strng = par_re.sub('',strng)
306 return strng
306 return strng
307
307
308 def parse_options(self,arg_str,opt_str,*long_opts,**kw):
308 def parse_options(self,arg_str,opt_str,*long_opts,**kw):
309 """Parse options passed to an argument string.
309 """Parse options passed to an argument string.
310
310
311 The interface is similar to that of getopt(), but it returns back a
311 The interface is similar to that of getopt(), but it returns back a
312 Struct with the options as keys and the stripped argument string still
312 Struct with the options as keys and the stripped argument string still
313 as a string.
313 as a string.
314
314
315 arg_str is quoted as a true sys.argv vector by using shlex.split.
315 arg_str is quoted as a true sys.argv vector by using shlex.split.
316 This allows us to easily expand variables, glob files, quote
316 This allows us to easily expand variables, glob files, quote
317 arguments, etc.
317 arguments, etc.
318
318
319 Options:
319 Options:
320 -mode: default 'string'. If given as 'list', the argument string is
320 -mode: default 'string'. If given as 'list', the argument string is
321 returned as a list (split on whitespace) instead of a string.
321 returned as a list (split on whitespace) instead of a string.
322
322
323 -list_all: put all option values in lists. Normally only options
323 -list_all: put all option values in lists. Normally only options
324 appearing more than once are put in a list.
324 appearing more than once are put in a list.
325
325
326 -posix (True): whether to split the input line in POSIX mode or not,
326 -posix (True): whether to split the input line in POSIX mode or not,
327 as per the conventions outlined in the shlex module from the
327 as per the conventions outlined in the shlex module from the
328 standard library."""
328 standard library."""
329
329
330 # inject default options at the beginning of the input line
330 # inject default options at the beginning of the input line
331 caller = sys._getframe(1).f_code.co_name.replace('magic_','')
331 caller = sys._getframe(1).f_code.co_name.replace('magic_','')
332 arg_str = '%s %s' % (self.options_table.get(caller,''),arg_str)
332 arg_str = '%s %s' % (self.options_table.get(caller,''),arg_str)
333
333
334 mode = kw.get('mode','string')
334 mode = kw.get('mode','string')
335 if mode not in ['string','list']:
335 if mode not in ['string','list']:
336 raise ValueError,'incorrect mode given: %s' % mode
336 raise ValueError,'incorrect mode given: %s' % mode
337 # Get options
337 # Get options
338 list_all = kw.get('list_all',0)
338 list_all = kw.get('list_all',0)
339 posix = kw.get('posix',True)
339 posix = kw.get('posix',True)
340
340
341 # Check if we have more than one argument to warrant extra processing:
341 # Check if we have more than one argument to warrant extra processing:
342 odict = {} # Dictionary with options
342 odict = {} # Dictionary with options
343 args = arg_str.split()
343 args = arg_str.split()
344 if len(args) >= 1:
344 if len(args) >= 1:
345 # If the list of inputs only has 0 or 1 thing in it, there's no
345 # If the list of inputs only has 0 or 1 thing in it, there's no
346 # need to look for options
346 # need to look for options
347 argv = arg_split(arg_str,posix)
347 argv = arg_split(arg_str,posix)
348 # Do regular option processing
348 # Do regular option processing
349 try:
349 try:
350 opts,args = getopt(argv,opt_str,*long_opts)
350 opts,args = getopt(argv,opt_str,*long_opts)
351 except GetoptError,e:
351 except GetoptError,e:
352 raise GetoptError('%s ( allowed: "%s" %s)' % (e.msg,opt_str,
352 raise GetoptError('%s ( allowed: "%s" %s)' % (e.msg,opt_str,
353 " ".join(long_opts)))
353 " ".join(long_opts)))
354 for o,a in opts:
354 for o,a in opts:
355 if o.startswith('--'):
355 if o.startswith('--'):
356 o = o[2:]
356 o = o[2:]
357 else:
357 else:
358 o = o[1:]
358 o = o[1:]
359 try:
359 try:
360 odict[o].append(a)
360 odict[o].append(a)
361 except AttributeError:
361 except AttributeError:
362 odict[o] = [odict[o],a]
362 odict[o] = [odict[o],a]
363 except KeyError:
363 except KeyError:
364 if list_all:
364 if list_all:
365 odict[o] = [a]
365 odict[o] = [a]
366 else:
366 else:
367 odict[o] = a
367 odict[o] = a
368
368
369 # Prepare opts,args for return
369 # Prepare opts,args for return
370 opts = Struct(odict)
370 opts = Struct(odict)
371 if mode == 'string':
371 if mode == 'string':
372 args = ' '.join(args)
372 args = ' '.join(args)
373
373
374 return opts,args
374 return opts,args
375
375
376 #......................................................................
376 #......................................................................
377 # And now the actual magic functions
377 # And now the actual magic functions
378
378
379 # Functions for IPython shell work (vars,funcs, config, etc)
379 # Functions for IPython shell work (vars,funcs, config, etc)
380 def magic_lsmagic(self, parameter_s = ''):
380 def magic_lsmagic(self, parameter_s = ''):
381 """List currently available magic functions."""
381 """List currently available magic functions."""
382 mesc = self.shell.ESC_MAGIC
382 mesc = self.shell.ESC_MAGIC
383 print 'Available magic functions:\n'+mesc+\
383 print 'Available magic functions:\n'+mesc+\
384 (' '+mesc).join(self.lsmagic())
384 (' '+mesc).join(self.lsmagic())
385 print '\n' + Magic.auto_status[self.shell.rc.automagic]
385 print '\n' + Magic.auto_status[self.shell.rc.automagic]
386 return None
386 return None
387
387
388 def magic_magic(self, parameter_s = ''):
388 def magic_magic(self, parameter_s = ''):
389 """Print information about the magic function system."""
389 """Print information about the magic function system."""
390
390
391 mode = ''
391 mode = ''
392 try:
392 try:
393 if parameter_s.split()[0] == '-latex':
393 if parameter_s.split()[0] == '-latex':
394 mode = 'latex'
394 mode = 'latex'
395 if parameter_s.split()[0] == '-brief':
395 if parameter_s.split()[0] == '-brief':
396 mode = 'brief'
396 mode = 'brief'
397 except:
397 except:
398 pass
398 pass
399
399
400 magic_docs = []
400 magic_docs = []
401 for fname in self.lsmagic():
401 for fname in self.lsmagic():
402 mname = 'magic_' + fname
402 mname = 'magic_' + fname
403 for space in (Magic,self,self.__class__):
403 for space in (Magic,self,self.__class__):
404 try:
404 try:
405 fn = space.__dict__[mname]
405 fn = space.__dict__[mname]
406 except KeyError:
406 except KeyError:
407 pass
407 pass
408 else:
408 else:
409 break
409 break
410 if mode == 'brief':
410 if mode == 'brief':
411 # only first line
411 # only first line
412 fndoc = fn.__doc__.split('\n',1)[0]
412 fndoc = fn.__doc__.split('\n',1)[0]
413 else:
413 else:
414 fndoc = fn.__doc__
414 fndoc = fn.__doc__
415
415
416 magic_docs.append('%s%s:\n\t%s\n' %(self.shell.ESC_MAGIC,
416 magic_docs.append('%s%s:\n\t%s\n' %(self.shell.ESC_MAGIC,
417 fname,fndoc))
417 fname,fndoc))
418 magic_docs = ''.join(magic_docs)
418 magic_docs = ''.join(magic_docs)
419
419
420 if mode == 'latex':
420 if mode == 'latex':
421 print self.format_latex(magic_docs)
421 print self.format_latex(magic_docs)
422 return
422 return
423 else:
423 else:
424 magic_docs = self.format_screen(magic_docs)
424 magic_docs = self.format_screen(magic_docs)
425 if mode == 'brief':
425 if mode == 'brief':
426 return magic_docs
426 return magic_docs
427
427
428 outmsg = """
428 outmsg = """
429 IPython's 'magic' functions
429 IPython's 'magic' functions
430 ===========================
430 ===========================
431
431
432 The magic function system provides a series of functions which allow you to
432 The magic function system provides a series of functions which allow you to
433 control the behavior of IPython itself, plus a lot of system-type
433 control the behavior of IPython itself, plus a lot of system-type
434 features. All these functions are prefixed with a % character, but parameters
434 features. All these functions are prefixed with a % character, but parameters
435 are given without parentheses or quotes.
435 are given without parentheses or quotes.
436
436
437 NOTE: If you have 'automagic' enabled (via the command line option or with the
437 NOTE: If you have 'automagic' enabled (via the command line option or with the
438 %automagic function), you don't need to type in the % explicitly. By default,
438 %automagic function), you don't need to type in the % explicitly. By default,
439 IPython ships with automagic on, so you should only rarely need the % escape.
439 IPython ships with automagic on, so you should only rarely need the % escape.
440
440
441 Example: typing '%cd mydir' (without the quotes) changes you working directory
441 Example: typing '%cd mydir' (without the quotes) changes you working directory
442 to 'mydir', if it exists.
442 to 'mydir', if it exists.
443
443
444 You can define your own magic functions to extend the system. See the supplied
444 You can define your own magic functions to extend the system. See the supplied
445 ipythonrc and example-magic.py files for details (in your ipython
445 ipythonrc and example-magic.py files for details (in your ipython
446 configuration directory, typically $HOME/.ipython/).
446 configuration directory, typically $HOME/.ipython/).
447
447
448 You can also define your own aliased names for magic functions. In your
448 You can also define your own aliased names for magic functions. In your
449 ipythonrc file, placing a line like:
449 ipythonrc file, placing a line like:
450
450
451 execute __IPYTHON__.magic_pf = __IPYTHON__.magic_profile
451 execute __IPYTHON__.magic_pf = __IPYTHON__.magic_profile
452
452
453 will define %pf as a new name for %profile.
453 will define %pf as a new name for %profile.
454
454
455 You can also call magics in code using the ipmagic() function, which IPython
455 You can also call magics in code using the ipmagic() function, which IPython
456 automatically adds to the builtin namespace. Type 'ipmagic?' for details.
456 automatically adds to the builtin namespace. Type 'ipmagic?' for details.
457
457
458 For a list of the available magic functions, use %lsmagic. For a description
458 For a list of the available magic functions, use %lsmagic. For a description
459 of any of them, type %magic_name?, e.g. '%cd?'.
459 of any of them, type %magic_name?, e.g. '%cd?'.
460
460
461 Currently the magic system has the following functions:\n"""
461 Currently the magic system has the following functions:\n"""
462
462
463 mesc = self.shell.ESC_MAGIC
463 mesc = self.shell.ESC_MAGIC
464 outmsg = ("%s\n%s\n\nSummary of magic functions (from %slsmagic):"
464 outmsg = ("%s\n%s\n\nSummary of magic functions (from %slsmagic):"
465 "\n\n%s%s\n\n%s" % (outmsg,
465 "\n\n%s%s\n\n%s" % (outmsg,
466 magic_docs,mesc,mesc,
466 magic_docs,mesc,mesc,
467 (' '+mesc).join(self.lsmagic()),
467 (' '+mesc).join(self.lsmagic()),
468 Magic.auto_status[self.shell.rc.automagic] ) )
468 Magic.auto_status[self.shell.rc.automagic] ) )
469
469
470 page(outmsg,screen_lines=self.shell.rc.screen_length)
470 page(outmsg,screen_lines=self.shell.rc.screen_length)
471
471
472
472
473 def magic_autoindent(self, parameter_s = ''):
473 def magic_autoindent(self, parameter_s = ''):
474 """Toggle autoindent on/off (if available)."""
474 """Toggle autoindent on/off (if available)."""
475
475
476 self.shell.set_autoindent()
476 self.shell.set_autoindent()
477 print "Automatic indentation is:",['OFF','ON'][self.shell.autoindent]
477 print "Automatic indentation is:",['OFF','ON'][self.shell.autoindent]
478
478
479
480 def magic_automagic(self, parameter_s = ''):
481 """Make magic functions callable without having to type the initial %.
482
483 Without argumentsl toggles on/off (when off, you must call it as
484 %automagic, of course). With arguments it sets the value, and you can
485 use any of (case insensitive):
486
487 - on,1,True: to activate
488
489 - off,0,False: to deactivate.
490
491 Note that magic functions have lowest priority, so if there's a
492 variable whose name collides with that of a magic fn, automagic won't
493 work for that function (you get the variable instead). However, if you
494 delete the variable (del var), the previously shadowed magic function
495 becomes visible to automagic again."""
496
497 rc = self.shell.rc
498 arg = parameter_s.lower()
499 if parameter_s in ('on','1','true'):
500 rc.automagic = True
501 elif parameter_s in ('off','0','false'):
502 rc.automagic = False
503 else:
504 rc.automagic = not rc.automagic
505 print '\n' + Magic.auto_status[rc.automagic]
506
507
508 def magic_autocall(self, parameter_s = ''):
509 """Make functions callable without having to type parentheses.
510
511 Usage:
512
513 %autocall [mode]
514
515 The mode can be one of: 0->Off, 1->Smart, 2->Full. If not given, the
516 value is toggled on and off (remembering the previous state).
517
518 In more detail, these values mean:
519
520 0 -> fully disabled
521
522 1 -> active, but do not apply if there are no arguments on the line.
523
524 In this mode, you get:
525
526 In [1]: callable
527 Out[1]: <built-in function callable>
528
529 In [2]: callable 'hello'
530 ------> callable('hello')
531 Out[2]: False
532
533 2 -> Active always. Even if no arguments are present, the callable
534 object is called:
535
536 In [4]: callable
537 ------> callable()
538
539 Note that even with autocall off, you can still use '/' at the start of
540 a line to treat the first argument on the command line as a function
541 and add parentheses to it:
542
543 In [8]: /str 43
544 ------> str(43)
545 Out[8]: '43'
546 """
547
548 rc = self.shell.rc
549
550 if parameter_s:
551 arg = int(parameter_s)
552 else:
553 arg = 'toggle'
554
555 if not arg in (0,1,2,'toggle'):
556 error('Valid modes: (0->Off, 1->Smart, 2->Full')
557 return
558
559 if arg in (0,1,2):
560 rc.autocall = arg
561 else: # toggle
562 if rc.autocall:
563 self._magic_state.autocall_save = rc.autocall
564 rc.autocall = 0
565 else:
566 try:
567 rc.autocall = self._magic_state.autocall_save
568 except AttributeError:
569 rc.autocall = self._magic_state.autocall_save = 1
570
571 print "Automatic calling is:",['OFF','Smart','Full'][rc.autocall]
572
479 def magic_system_verbose(self, parameter_s = ''):
573 def magic_system_verbose(self, parameter_s = ''):
480 """Set verbose printing of system calls.
574 """Set verbose printing of system calls.
481
575
482 If called without an argument, act as a toggle"""
576 If called without an argument, act as a toggle"""
483
577
484 if parameter_s:
578 if parameter_s:
485 val = bool(eval(parameter_s))
579 val = bool(eval(parameter_s))
486 else:
580 else:
487 val = None
581 val = None
488
582
489 self.shell.rc_set_toggle('system_verbose',val)
583 self.shell.rc_set_toggle('system_verbose',val)
490 print "System verbose printing is:",\
584 print "System verbose printing is:",\
491 ['OFF','ON'][self.shell.rc.system_verbose]
585 ['OFF','ON'][self.shell.rc.system_verbose]
492
586
493
587
494 def magic_page(self, parameter_s=''):
588 def magic_page(self, parameter_s=''):
495 """Pretty print the object and display it through a pager.
589 """Pretty print the object and display it through a pager.
496
590
497 %page [options] OBJECT
591 %page [options] OBJECT
498
592
499 If no object is given, use _ (last output).
593 If no object is given, use _ (last output).
500
594
501 Options:
595 Options:
502
596
503 -r: page str(object), don't pretty-print it."""
597 -r: page str(object), don't pretty-print it."""
504
598
505 # After a function contributed by Olivier Aubert, slightly modified.
599 # After a function contributed by Olivier Aubert, slightly modified.
506
600
507 # Process options/args
601 # Process options/args
508 opts,args = self.parse_options(parameter_s,'r')
602 opts,args = self.parse_options(parameter_s,'r')
509 raw = 'r' in opts
603 raw = 'r' in opts
510
604
511 oname = args and args or '_'
605 oname = args and args or '_'
512 info = self._ofind(oname)
606 info = self._ofind(oname)
513 if info['found']:
607 if info['found']:
514 txt = (raw and str or pformat)( info['obj'] )
608 txt = (raw and str or pformat)( info['obj'] )
515 page(txt)
609 page(txt)
516 else:
610 else:
517 print 'Object `%s` not found' % oname
611 print 'Object `%s` not found' % oname
518
612
519 def magic_profile(self, parameter_s=''):
613 def magic_profile(self, parameter_s=''):
520 """Print your currently active IPyhton profile."""
614 """Print your currently active IPyhton profile."""
521 if self.shell.rc.profile:
615 if self.shell.rc.profile:
522 printpl('Current IPython profile: $self.shell.rc.profile.')
616 printpl('Current IPython profile: $self.shell.rc.profile.')
523 else:
617 else:
524 print 'No profile active.'
618 print 'No profile active.'
525
619
526 def magic_pinfo(self, parameter_s='', namespaces=None):
620 def magic_pinfo(self, parameter_s='', namespaces=None):
527 """Provide detailed information about an object.
621 """Provide detailed information about an object.
528
622
529 '%pinfo object' is just a synonym for object? or ?object."""
623 '%pinfo object' is just a synonym for object? or ?object."""
530
624
531 #print 'pinfo par: <%s>' % parameter_s # dbg
625 #print 'pinfo par: <%s>' % parameter_s # dbg
532
626
533
627
534 # detail_level: 0 -> obj? , 1 -> obj??
628 # detail_level: 0 -> obj? , 1 -> obj??
535 detail_level = 0
629 detail_level = 0
536 # We need to detect if we got called as 'pinfo pinfo foo', which can
630 # We need to detect if we got called as 'pinfo pinfo foo', which can
537 # happen if the user types 'pinfo foo?' at the cmd line.
631 # happen if the user types 'pinfo foo?' at the cmd line.
538 pinfo,qmark1,oname,qmark2 = \
632 pinfo,qmark1,oname,qmark2 = \
539 re.match('(pinfo )?(\?*)(.*?)(\??$)',parameter_s).groups()
633 re.match('(pinfo )?(\?*)(.*?)(\??$)',parameter_s).groups()
540 if pinfo or qmark1 or qmark2:
634 if pinfo or qmark1 or qmark2:
541 detail_level = 1
635 detail_level = 1
542 if "*" in oname:
636 if "*" in oname:
543 self.magic_psearch(oname)
637 self.magic_psearch(oname)
544 else:
638 else:
545 self._inspect('pinfo', oname, detail_level=detail_level,
639 self._inspect('pinfo', oname, detail_level=detail_level,
546 namespaces=namespaces)
640 namespaces=namespaces)
547
641
642 def magic_pdef(self, parameter_s='', namespaces=None):
643 """Print the definition header for any callable object.
644
645 If the object is a class, print the constructor information."""
646 self._inspect('pdef',parameter_s, namespaces)
647
648 def magic_pdoc(self, parameter_s='', namespaces=None):
649 """Print the docstring for an object.
650
651 If the given object is a class, it will print both the class and the
652 constructor docstrings."""
653 self._inspect('pdoc',parameter_s, namespaces)
654
655 def magic_psource(self, parameter_s='', namespaces=None):
656 """Print (or run through pager) the source code for an object."""
657 self._inspect('psource',parameter_s, namespaces)
658
659 def magic_pfile(self, parameter_s=''):
660 """Print (or run through pager) the file where an object is defined.
661
662 The file opens at the line where the object definition begins. IPython
663 will honor the environment variable PAGER if set, and otherwise will
664 do its best to print the file in a convenient form.
665
666 If the given argument is not an object currently defined, IPython will
667 try to interpret it as a filename (automatically adding a .py extension
668 if needed). You can thus use %pfile as a syntax highlighting code
669 viewer."""
670
671 # first interpret argument as an object name
672 out = self._inspect('pfile',parameter_s)
673 # if not, try the input as a filename
674 if out == 'not found':
675 try:
676 filename = get_py_filename(parameter_s)
677 except IOError,msg:
678 print msg
679 return
680 page(self.shell.inspector.format(file(filename).read()))
681
548 def _inspect(self,meth,oname,namespaces=None,**kw):
682 def _inspect(self,meth,oname,namespaces=None,**kw):
549 """Generic interface to the inspector system.
683 """Generic interface to the inspector system.
550
684
551 This function is meant to be called by pdef, pdoc & friends."""
685 This function is meant to be called by pdef, pdoc & friends."""
552
686
553 #oname = oname.strip()
687 #oname = oname.strip()
554 #print '1- oname: <%r>' % oname # dbg
688 #print '1- oname: <%r>' % oname # dbg
555 try:
689 try:
556 oname = oname.strip().encode('ascii')
690 oname = oname.strip().encode('ascii')
557 #print '2- oname: <%r>' % oname # dbg
691 #print '2- oname: <%r>' % oname # dbg
558 except UnicodeEncodeError:
692 except UnicodeEncodeError:
559 print 'Python identifiers can only contain ascii characters.'
693 print 'Python identifiers can only contain ascii characters.'
560 return 'not found'
694 return 'not found'
561
695
562 info = Struct(self._ofind(oname, namespaces))
696 info = Struct(self._ofind(oname, namespaces))
563
697
564 if info.found:
698 if info.found:
565 try:
699 try:
566 IPython.generics.inspect_object(info.obj)
700 IPython.generics.inspect_object(info.obj)
567 return
701 return
568 except IPython.ipapi.TryNext:
702 except IPython.ipapi.TryNext:
569 pass
703 pass
570 # Get the docstring of the class property if it exists.
704 # Get the docstring of the class property if it exists.
571 path = oname.split('.')
705 path = oname.split('.')
572 root = '.'.join(path[:-1])
706 root = '.'.join(path[:-1])
573 if info.parent is not None:
707 if info.parent is not None:
574 try:
708 try:
575 target = getattr(info.parent, '__class__')
709 target = getattr(info.parent, '__class__')
576 # The object belongs to a class instance.
710 # The object belongs to a class instance.
577 try:
711 try:
578 target = getattr(target, path[-1])
712 target = getattr(target, path[-1])
579 # The class defines the object.
713 # The class defines the object.
580 if isinstance(target, property):
714 if isinstance(target, property):
581 oname = root + '.__class__.' + path[-1]
715 oname = root + '.__class__.' + path[-1]
582 info = Struct(self._ofind(oname))
716 info = Struct(self._ofind(oname))
583 except AttributeError: pass
717 except AttributeError: pass
584 except AttributeError: pass
718 except AttributeError: pass
585
719
586 pmethod = getattr(self.shell.inspector,meth)
720 pmethod = getattr(self.shell.inspector,meth)
587 formatter = info.ismagic and self.format_screen or None
721 formatter = info.ismagic and self.format_screen or None
588 if meth == 'pdoc':
722 if meth == 'pdoc':
589 pmethod(info.obj,oname,formatter)
723 pmethod(info.obj,oname,formatter)
590 elif meth == 'pinfo':
724 elif meth == 'pinfo':
591 pmethod(info.obj,oname,formatter,info,**kw)
725 pmethod(info.obj,oname,formatter,info,**kw)
592 else:
726 else:
593 pmethod(info.obj,oname)
727 pmethod(info.obj,oname)
594 else:
728 else:
595 print 'Object `%s` not found.' % oname
729 print 'Object `%s` not found.' % oname
596 return 'not found' # so callers can take other action
730 return 'not found' # so callers can take other action
597
731
598 def magic_psearch(self, parameter_s=''):
732 def magic_psearch(self, parameter_s=''):
599 """Search for object in namespaces by wildcard.
733 """Search for object in namespaces by wildcard.
600
734
601 %psearch [options] PATTERN [OBJECT TYPE]
735 %psearch [options] PATTERN [OBJECT TYPE]
602
736
603 Note: ? can be used as a synonym for %psearch, at the beginning or at
737 Note: ? can be used as a synonym for %psearch, at the beginning or at
604 the end: both a*? and ?a* are equivalent to '%psearch a*'. Still, the
738 the end: both a*? and ?a* are equivalent to '%psearch a*'. Still, the
605 rest of the command line must be unchanged (options come first), so
739 rest of the command line must be unchanged (options come first), so
606 for example the following forms are equivalent
740 for example the following forms are equivalent
607
741
608 %psearch -i a* function
742 %psearch -i a* function
609 -i a* function?
743 -i a* function?
610 ?-i a* function
744 ?-i a* function
611
745
612 Arguments:
746 Arguments:
613
747
614 PATTERN
748 PATTERN
615
749
616 where PATTERN is a string containing * as a wildcard similar to its
750 where PATTERN is a string containing * as a wildcard similar to its
617 use in a shell. The pattern is matched in all namespaces on the
751 use in a shell. The pattern is matched in all namespaces on the
618 search path. By default objects starting with a single _ are not
752 search path. By default objects starting with a single _ are not
619 matched, many IPython generated objects have a single
753 matched, many IPython generated objects have a single
620 underscore. The default is case insensitive matching. Matching is
754 underscore. The default is case insensitive matching. Matching is
621 also done on the attributes of objects and not only on the objects
755 also done on the attributes of objects and not only on the objects
622 in a module.
756 in a module.
623
757
624 [OBJECT TYPE]
758 [OBJECT TYPE]
625
759
626 Is the name of a python type from the types module. The name is
760 Is the name of a python type from the types module. The name is
627 given in lowercase without the ending type, ex. StringType is
761 given in lowercase without the ending type, ex. StringType is
628 written string. By adding a type here only objects matching the
762 written string. By adding a type here only objects matching the
629 given type are matched. Using all here makes the pattern match all
763 given type are matched. Using all here makes the pattern match all
630 types (this is the default).
764 types (this is the default).
631
765
632 Options:
766 Options:
633
767
634 -a: makes the pattern match even objects whose names start with a
768 -a: makes the pattern match even objects whose names start with a
635 single underscore. These names are normally ommitted from the
769 single underscore. These names are normally ommitted from the
636 search.
770 search.
637
771
638 -i/-c: make the pattern case insensitive/sensitive. If neither of
772 -i/-c: make the pattern case insensitive/sensitive. If neither of
639 these options is given, the default is read from your ipythonrc
773 these options is given, the default is read from your ipythonrc
640 file. The option name which sets this value is
774 file. The option name which sets this value is
641 'wildcards_case_sensitive'. If this option is not specified in your
775 'wildcards_case_sensitive'. If this option is not specified in your
642 ipythonrc file, IPython's internal default is to do a case sensitive
776 ipythonrc file, IPython's internal default is to do a case sensitive
643 search.
777 search.
644
778
645 -e/-s NAMESPACE: exclude/search a given namespace. The pattern you
779 -e/-s NAMESPACE: exclude/search a given namespace. The pattern you
646 specifiy can be searched in any of the following namespaces:
780 specifiy can be searched in any of the following namespaces:
647 'builtin', 'user', 'user_global','internal', 'alias', where
781 'builtin', 'user', 'user_global','internal', 'alias', where
648 'builtin' and 'user' are the search defaults. Note that you should
782 'builtin' and 'user' are the search defaults. Note that you should
649 not use quotes when specifying namespaces.
783 not use quotes when specifying namespaces.
650
784
651 'Builtin' contains the python module builtin, 'user' contains all
785 'Builtin' contains the python module builtin, 'user' contains all
652 user data, 'alias' only contain the shell aliases and no python
786 user data, 'alias' only contain the shell aliases and no python
653 objects, 'internal' contains objects used by IPython. The
787 objects, 'internal' contains objects used by IPython. The
654 'user_global' namespace is only used by embedded IPython instances,
788 'user_global' namespace is only used by embedded IPython instances,
655 and it contains module-level globals. You can add namespaces to the
789 and it contains module-level globals. You can add namespaces to the
656 search with -s or exclude them with -e (these options can be given
790 search with -s or exclude them with -e (these options can be given
657 more than once).
791 more than once).
658
792
659 Examples:
793 Examples:
660
794
661 %psearch a* -> objects beginning with an a
795 %psearch a* -> objects beginning with an a
662 %psearch -e builtin a* -> objects NOT in the builtin space starting in a
796 %psearch -e builtin a* -> objects NOT in the builtin space starting in a
663 %psearch a* function -> all functions beginning with an a
797 %psearch a* function -> all functions beginning with an a
664 %psearch re.e* -> objects beginning with an e in module re
798 %psearch re.e* -> objects beginning with an e in module re
665 %psearch r*.e* -> objects that start with e in modules starting in r
799 %psearch r*.e* -> objects that start with e in modules starting in r
666 %psearch r*.* string -> all strings in modules beginning with r
800 %psearch r*.* string -> all strings in modules beginning with r
667
801
668 Case sensitve search:
802 Case sensitve search:
669
803
670 %psearch -c a* list all object beginning with lower case a
804 %psearch -c a* list all object beginning with lower case a
671
805
672 Show objects beginning with a single _:
806 Show objects beginning with a single _:
673
807
674 %psearch -a _* list objects beginning with a single underscore"""
808 %psearch -a _* list objects beginning with a single underscore"""
675 try:
809 try:
676 parameter_s = parameter_s.encode('ascii')
810 parameter_s = parameter_s.encode('ascii')
677 except UnicodeEncodeError:
811 except UnicodeEncodeError:
678 print 'Python identifiers can only contain ascii characters.'
812 print 'Python identifiers can only contain ascii characters.'
679 return
813 return
680
814
681 # default namespaces to be searched
815 # default namespaces to be searched
682 def_search = ['user','builtin']
816 def_search = ['user','builtin']
683
817
684 # Process options/args
818 # Process options/args
685 opts,args = self.parse_options(parameter_s,'cias:e:',list_all=True)
819 opts,args = self.parse_options(parameter_s,'cias:e:',list_all=True)
686 opt = opts.get
820 opt = opts.get
687 shell = self.shell
821 shell = self.shell
688 psearch = shell.inspector.psearch
822 psearch = shell.inspector.psearch
689
823
690 # select case options
824 # select case options
691 if opts.has_key('i'):
825 if opts.has_key('i'):
692 ignore_case = True
826 ignore_case = True
693 elif opts.has_key('c'):
827 elif opts.has_key('c'):
694 ignore_case = False
828 ignore_case = False
695 else:
829 else:
696 ignore_case = not shell.rc.wildcards_case_sensitive
830 ignore_case = not shell.rc.wildcards_case_sensitive
697
831
698 # Build list of namespaces to search from user options
832 # Build list of namespaces to search from user options
699 def_search.extend(opt('s',[]))
833 def_search.extend(opt('s',[]))
700 ns_exclude = ns_exclude=opt('e',[])
834 ns_exclude = ns_exclude=opt('e',[])
701 ns_search = [nm for nm in def_search if nm not in ns_exclude]
835 ns_search = [nm for nm in def_search if nm not in ns_exclude]
702
836
703 # Call the actual search
837 # Call the actual search
704 try:
838 try:
705 psearch(args,shell.ns_table,ns_search,
839 psearch(args,shell.ns_table,ns_search,
706 show_all=opt('a'),ignore_case=ignore_case)
840 show_all=opt('a'),ignore_case=ignore_case)
707 except:
841 except:
708 shell.showtraceback()
842 shell.showtraceback()
709
843
710 def magic_who_ls(self, parameter_s=''):
844 def magic_who_ls(self, parameter_s=''):
711 """Return a sorted list of all interactive variables.
845 """Return a sorted list of all interactive variables.
712
846
713 If arguments are given, only variables of types matching these
847 If arguments are given, only variables of types matching these
714 arguments are returned."""
848 arguments are returned."""
715
849
716 user_ns = self.shell.user_ns
850 user_ns = self.shell.user_ns
717 internal_ns = self.shell.internal_ns
851 internal_ns = self.shell.internal_ns
718 user_config_ns = self.shell.user_config_ns
852 user_config_ns = self.shell.user_config_ns
719 out = []
853 out = []
720 typelist = parameter_s.split()
854 typelist = parameter_s.split()
721
855
722 for i in user_ns:
856 for i in user_ns:
723 if not (i.startswith('_') or i.startswith('_i')) \
857 if not (i.startswith('_') or i.startswith('_i')) \
724 and not (i in internal_ns or i in user_config_ns):
858 and not (i in internal_ns or i in user_config_ns):
725 if typelist:
859 if typelist:
726 if type(user_ns[i]).__name__ in typelist:
860 if type(user_ns[i]).__name__ in typelist:
727 out.append(i)
861 out.append(i)
728 else:
862 else:
729 out.append(i)
863 out.append(i)
730 out.sort()
864 out.sort()
731 return out
865 return out
732
866
733 def magic_who(self, parameter_s=''):
867 def magic_who(self, parameter_s=''):
734 """Print all interactive variables, with some minimal formatting.
868 """Print all interactive variables, with some minimal formatting.
735
869
736 If any arguments are given, only variables whose type matches one of
870 If any arguments are given, only variables whose type matches one of
737 these are printed. For example:
871 these are printed. For example:
738
872
739 %who function str
873 %who function str
740
874
741 will only list functions and strings, excluding all other types of
875 will only list functions and strings, excluding all other types of
742 variables. To find the proper type names, simply use type(var) at a
876 variables. To find the proper type names, simply use type(var) at a
743 command line to see how python prints type names. For example:
877 command line to see how python prints type names. For example:
744
878
745 In [1]: type('hello')\\
879 In [1]: type('hello')\\
746 Out[1]: <type 'str'>
880 Out[1]: <type 'str'>
747
881
748 indicates that the type name for strings is 'str'.
882 indicates that the type name for strings is 'str'.
749
883
750 %who always excludes executed names loaded through your configuration
884 %who always excludes executed names loaded through your configuration
751 file and things which are internal to IPython.
885 file and things which are internal to IPython.
752
886
753 This is deliberate, as typically you may load many modules and the
887 This is deliberate, as typically you may load many modules and the
754 purpose of %who is to show you only what you've manually defined."""
888 purpose of %who is to show you only what you've manually defined."""
755
889
756 varlist = self.magic_who_ls(parameter_s)
890 varlist = self.magic_who_ls(parameter_s)
757 if not varlist:
891 if not varlist:
758 if parameter_s:
892 if parameter_s:
759 print 'No variables match your requested type.'
893 print 'No variables match your requested type.'
760 else:
894 else:
761 print 'Interactive namespace is empty.'
895 print 'Interactive namespace is empty.'
762 return
896 return
763
897
764 # if we have variables, move on...
898 # if we have variables, move on...
765 count = 0
899 count = 0
766 for i in varlist:
900 for i in varlist:
767 print i+'\t',
901 print i+'\t',
768 count += 1
902 count += 1
769 if count > 8:
903 if count > 8:
770 count = 0
904 count = 0
771 print
905 print
772 print
906 print
773
907
774 def magic_whos(self, parameter_s=''):
908 def magic_whos(self, parameter_s=''):
775 """Like %who, but gives some extra information about each variable.
909 """Like %who, but gives some extra information about each variable.
776
910
777 The same type filtering of %who can be applied here.
911 The same type filtering of %who can be applied here.
778
912
779 For all variables, the type is printed. Additionally it prints:
913 For all variables, the type is printed. Additionally it prints:
780
914
781 - For {},[],(): their length.
915 - For {},[],(): their length.
782
916
783 - For numpy and Numeric arrays, a summary with shape, number of
917 - For numpy and Numeric arrays, a summary with shape, number of
784 elements, typecode and size in memory.
918 elements, typecode and size in memory.
785
919
786 - Everything else: a string representation, snipping their middle if
920 - Everything else: a string representation, snipping their middle if
787 too long."""
921 too long."""
788
922
789 varnames = self.magic_who_ls(parameter_s)
923 varnames = self.magic_who_ls(parameter_s)
790 if not varnames:
924 if not varnames:
791 if parameter_s:
925 if parameter_s:
792 print 'No variables match your requested type.'
926 print 'No variables match your requested type.'
793 else:
927 else:
794 print 'Interactive namespace is empty.'
928 print 'Interactive namespace is empty.'
795 return
929 return
796
930
797 # if we have variables, move on...
931 # if we have variables, move on...
798
932
799 # for these types, show len() instead of data:
933 # for these types, show len() instead of data:
800 seq_types = [types.DictType,types.ListType,types.TupleType]
934 seq_types = [types.DictType,types.ListType,types.TupleType]
801
935
802 # for numpy/Numeric arrays, display summary info
936 # for numpy/Numeric arrays, display summary info
803 try:
937 try:
804 import numpy
938 import numpy
805 except ImportError:
939 except ImportError:
806 ndarray_type = None
940 ndarray_type = None
807 else:
941 else:
808 ndarray_type = numpy.ndarray.__name__
942 ndarray_type = numpy.ndarray.__name__
809 try:
943 try:
810 import Numeric
944 import Numeric
811 except ImportError:
945 except ImportError:
812 array_type = None
946 array_type = None
813 else:
947 else:
814 array_type = Numeric.ArrayType.__name__
948 array_type = Numeric.ArrayType.__name__
815
949
816 # Find all variable names and types so we can figure out column sizes
950 # Find all variable names and types so we can figure out column sizes
817 def get_vars(i):
951 def get_vars(i):
818 return self.shell.user_ns[i]
952 return self.shell.user_ns[i]
819
953
820 # some types are well known and can be shorter
954 # some types are well known and can be shorter
821 abbrevs = {'IPython.macro.Macro' : 'Macro'}
955 abbrevs = {'IPython.macro.Macro' : 'Macro'}
822 def type_name(v):
956 def type_name(v):
823 tn = type(v).__name__
957 tn = type(v).__name__
824 return abbrevs.get(tn,tn)
958 return abbrevs.get(tn,tn)
825
959
826 varlist = map(get_vars,varnames)
960 varlist = map(get_vars,varnames)
827
961
828 typelist = []
962 typelist = []
829 for vv in varlist:
963 for vv in varlist:
830 tt = type_name(vv)
964 tt = type_name(vv)
831
965
832 if tt=='instance':
966 if tt=='instance':
833 typelist.append( abbrevs.get(str(vv.__class__),
967 typelist.append( abbrevs.get(str(vv.__class__),
834 str(vv.__class__)))
968 str(vv.__class__)))
835 else:
969 else:
836 typelist.append(tt)
970 typelist.append(tt)
837
971
838 # column labels and # of spaces as separator
972 # column labels and # of spaces as separator
839 varlabel = 'Variable'
973 varlabel = 'Variable'
840 typelabel = 'Type'
974 typelabel = 'Type'
841 datalabel = 'Data/Info'
975 datalabel = 'Data/Info'
842 colsep = 3
976 colsep = 3
843 # variable format strings
977 # variable format strings
844 vformat = "$vname.ljust(varwidth)$vtype.ljust(typewidth)"
978 vformat = "$vname.ljust(varwidth)$vtype.ljust(typewidth)"
845 vfmt_short = '$vstr[:25]<...>$vstr[-25:]'
979 vfmt_short = '$vstr[:25]<...>$vstr[-25:]'
846 aformat = "%s: %s elems, type `%s`, %s bytes"
980 aformat = "%s: %s elems, type `%s`, %s bytes"
847 # find the size of the columns to format the output nicely
981 # find the size of the columns to format the output nicely
848 varwidth = max(max(map(len,varnames)), len(varlabel)) + colsep
982 varwidth = max(max(map(len,varnames)), len(varlabel)) + colsep
849 typewidth = max(max(map(len,typelist)), len(typelabel)) + colsep
983 typewidth = max(max(map(len,typelist)), len(typelabel)) + colsep
850 # table header
984 # table header
851 print varlabel.ljust(varwidth) + typelabel.ljust(typewidth) + \
985 print varlabel.ljust(varwidth) + typelabel.ljust(typewidth) + \
852 ' '+datalabel+'\n' + '-'*(varwidth+typewidth+len(datalabel)+1)
986 ' '+datalabel+'\n' + '-'*(varwidth+typewidth+len(datalabel)+1)
853 # and the table itself
987 # and the table itself
854 kb = 1024
988 kb = 1024
855 Mb = 1048576 # kb**2
989 Mb = 1048576 # kb**2
856 for vname,var,vtype in zip(varnames,varlist,typelist):
990 for vname,var,vtype in zip(varnames,varlist,typelist):
857 print itpl(vformat),
991 print itpl(vformat),
858 if vtype in seq_types:
992 if vtype in seq_types:
859 print len(var)
993 print len(var)
860 elif vtype in [array_type,ndarray_type]:
994 elif vtype in [array_type,ndarray_type]:
861 vshape = str(var.shape).replace(',','').replace(' ','x')[1:-1]
995 vshape = str(var.shape).replace(',','').replace(' ','x')[1:-1]
862 if vtype==ndarray_type:
996 if vtype==ndarray_type:
863 # numpy
997 # numpy
864 vsize = var.size
998 vsize = var.size
865 vbytes = vsize*var.itemsize
999 vbytes = vsize*var.itemsize
866 vdtype = var.dtype
1000 vdtype = var.dtype
867 else:
1001 else:
868 # Numeric
1002 # Numeric
869 vsize = Numeric.size(var)
1003 vsize = Numeric.size(var)
870 vbytes = vsize*var.itemsize()
1004 vbytes = vsize*var.itemsize()
871 vdtype = var.typecode()
1005 vdtype = var.typecode()
872
1006
873 if vbytes < 100000:
1007 if vbytes < 100000:
874 print aformat % (vshape,vsize,vdtype,vbytes)
1008 print aformat % (vshape,vsize,vdtype,vbytes)
875 else:
1009 else:
876 print aformat % (vshape,vsize,vdtype,vbytes),
1010 print aformat % (vshape,vsize,vdtype,vbytes),
877 if vbytes < Mb:
1011 if vbytes < Mb:
878 print '(%s kb)' % (vbytes/kb,)
1012 print '(%s kb)' % (vbytes/kb,)
879 else:
1013 else:
880 print '(%s Mb)' % (vbytes/Mb,)
1014 print '(%s Mb)' % (vbytes/Mb,)
881 else:
1015 else:
882 try:
1016 try:
883 vstr = str(var)
1017 vstr = str(var)
884 except UnicodeEncodeError:
1018 except UnicodeEncodeError:
885 vstr = unicode(var).encode(sys.getdefaultencoding(),
1019 vstr = unicode(var).encode(sys.getdefaultencoding(),
886 'backslashreplace')
1020 'backslashreplace')
887 vstr = vstr.replace('\n','\\n')
1021 vstr = vstr.replace('\n','\\n')
888 if len(vstr) < 50:
1022 if len(vstr) < 50:
889 print vstr
1023 print vstr
890 else:
1024 else:
891 printpl(vfmt_short)
1025 printpl(vfmt_short)
892
1026
893 def magic_reset(self, parameter_s=''):
1027 def magic_reset(self, parameter_s=''):
894 """Resets the namespace by removing all names defined by the user.
1028 """Resets the namespace by removing all names defined by the user.
895
1029
896 Input/Output history are left around in case you need them."""
1030 Input/Output history are left around in case you need them."""
897
1031
898 ans = self.shell.ask_yes_no(
1032 ans = self.shell.ask_yes_no(
899 "Once deleted, variables cannot be recovered. Proceed (y/[n])? ")
1033 "Once deleted, variables cannot be recovered. Proceed (y/[n])? ")
900 if not ans:
1034 if not ans:
901 print 'Nothing done.'
1035 print 'Nothing done.'
902 return
1036 return
903 user_ns = self.shell.user_ns
1037 user_ns = self.shell.user_ns
904 for i in self.magic_who_ls():
1038 for i in self.magic_who_ls():
905 del(user_ns[i])
1039 del(user_ns[i])
906
1040
907 def magic_logstart(self,parameter_s=''):
1041 def magic_logstart(self,parameter_s=''):
908 """Start logging anywhere in a session.
1042 """Start logging anywhere in a session.
909
1043
910 %logstart [-o|-r|-t] [log_name [log_mode]]
1044 %logstart [-o|-r|-t] [log_name [log_mode]]
911
1045
912 If no name is given, it defaults to a file named 'ipython_log.py' in your
1046 If no name is given, it defaults to a file named 'ipython_log.py' in your
913 current directory, in 'rotate' mode (see below).
1047 current directory, in 'rotate' mode (see below).
914
1048
915 '%logstart name' saves to file 'name' in 'backup' mode. It saves your
1049 '%logstart name' saves to file 'name' in 'backup' mode. It saves your
916 history up to that point and then continues logging.
1050 history up to that point and then continues logging.
917
1051
918 %logstart takes a second optional parameter: logging mode. This can be one
1052 %logstart takes a second optional parameter: logging mode. This can be one
919 of (note that the modes are given unquoted):\\
1053 of (note that the modes are given unquoted):\\
920 append: well, that says it.\\
1054 append: well, that says it.\\
921 backup: rename (if exists) to name~ and start name.\\
1055 backup: rename (if exists) to name~ and start name.\\
922 global: single logfile in your home dir, appended to.\\
1056 global: single logfile in your home dir, appended to.\\
923 over : overwrite existing log.\\
1057 over : overwrite existing log.\\
924 rotate: create rotating logs name.1~, name.2~, etc.
1058 rotate: create rotating logs name.1~, name.2~, etc.
925
1059
926 Options:
1060 Options:
927
1061
928 -o: log also IPython's output. In this mode, all commands which
1062 -o: log also IPython's output. In this mode, all commands which
929 generate an Out[NN] prompt are recorded to the logfile, right after
1063 generate an Out[NN] prompt are recorded to the logfile, right after
930 their corresponding input line. The output lines are always
1064 their corresponding input line. The output lines are always
931 prepended with a '#[Out]# ' marker, so that the log remains valid
1065 prepended with a '#[Out]# ' marker, so that the log remains valid
932 Python code.
1066 Python code.
933
1067
934 Since this marker is always the same, filtering only the output from
1068 Since this marker is always the same, filtering only the output from
935 a log is very easy, using for example a simple awk call:
1069 a log is very easy, using for example a simple awk call:
936
1070
937 awk -F'#\\[Out\\]# ' '{if($2) {print $2}}' ipython_log.py
1071 awk -F'#\\[Out\\]# ' '{if($2) {print $2}}' ipython_log.py
938
1072
939 -r: log 'raw' input. Normally, IPython's logs contain the processed
1073 -r: log 'raw' input. Normally, IPython's logs contain the processed
940 input, so that user lines are logged in their final form, converted
1074 input, so that user lines are logged in their final form, converted
941 into valid Python. For example, %Exit is logged as
1075 into valid Python. For example, %Exit is logged as
942 '_ip.magic("Exit"). If the -r flag is given, all input is logged
1076 '_ip.magic("Exit"). If the -r flag is given, all input is logged
943 exactly as typed, with no transformations applied.
1077 exactly as typed, with no transformations applied.
944
1078
945 -t: put timestamps before each input line logged (these are put in
1079 -t: put timestamps before each input line logged (these are put in
946 comments)."""
1080 comments)."""
947
1081
948 opts,par = self.parse_options(parameter_s,'ort')
1082 opts,par = self.parse_options(parameter_s,'ort')
949 log_output = 'o' in opts
1083 log_output = 'o' in opts
950 log_raw_input = 'r' in opts
1084 log_raw_input = 'r' in opts
951 timestamp = 't' in opts
1085 timestamp = 't' in opts
952
1086
953 rc = self.shell.rc
1087 rc = self.shell.rc
954 logger = self.shell.logger
1088 logger = self.shell.logger
955
1089
956 # if no args are given, the defaults set in the logger constructor by
1090 # if no args are given, the defaults set in the logger constructor by
957 # ipytohn remain valid
1091 # ipytohn remain valid
958 if par:
1092 if par:
959 try:
1093 try:
960 logfname,logmode = par.split()
1094 logfname,logmode = par.split()
961 except:
1095 except:
962 logfname = par
1096 logfname = par
963 logmode = 'backup'
1097 logmode = 'backup'
964 else:
1098 else:
965 logfname = logger.logfname
1099 logfname = logger.logfname
966 logmode = logger.logmode
1100 logmode = logger.logmode
967 # put logfname into rc struct as if it had been called on the command
1101 # put logfname into rc struct as if it had been called on the command
968 # line, so it ends up saved in the log header Save it in case we need
1102 # line, so it ends up saved in the log header Save it in case we need
969 # to restore it...
1103 # to restore it...
970 old_logfile = rc.opts.get('logfile','')
1104 old_logfile = rc.opts.get('logfile','')
971 if logfname:
1105 if logfname:
972 logfname = os.path.expanduser(logfname)
1106 logfname = os.path.expanduser(logfname)
973 rc.opts.logfile = logfname
1107 rc.opts.logfile = logfname
974 loghead = self.shell.loghead_tpl % (rc.opts,rc.args)
1108 loghead = self.shell.loghead_tpl % (rc.opts,rc.args)
975 try:
1109 try:
976 started = logger.logstart(logfname,loghead,logmode,
1110 started = logger.logstart(logfname,loghead,logmode,
977 log_output,timestamp,log_raw_input)
1111 log_output,timestamp,log_raw_input)
978 except:
1112 except:
979 rc.opts.logfile = old_logfile
1113 rc.opts.logfile = old_logfile
980 warn("Couldn't start log: %s" % sys.exc_info()[1])
1114 warn("Couldn't start log: %s" % sys.exc_info()[1])
981 else:
1115 else:
982 # log input history up to this point, optionally interleaving
1116 # log input history up to this point, optionally interleaving
983 # output if requested
1117 # output if requested
984
1118
985 if timestamp:
1119 if timestamp:
986 # disable timestamping for the previous history, since we've
1120 # disable timestamping for the previous history, since we've
987 # lost those already (no time machine here).
1121 # lost those already (no time machine here).
988 logger.timestamp = False
1122 logger.timestamp = False
989
1123
990 if log_raw_input:
1124 if log_raw_input:
991 input_hist = self.shell.input_hist_raw
1125 input_hist = self.shell.input_hist_raw
992 else:
1126 else:
993 input_hist = self.shell.input_hist
1127 input_hist = self.shell.input_hist
994
1128
995 if log_output:
1129 if log_output:
996 log_write = logger.log_write
1130 log_write = logger.log_write
997 output_hist = self.shell.output_hist
1131 output_hist = self.shell.output_hist
998 for n in range(1,len(input_hist)-1):
1132 for n in range(1,len(input_hist)-1):
999 log_write(input_hist[n].rstrip())
1133 log_write(input_hist[n].rstrip())
1000 if n in output_hist:
1134 if n in output_hist:
1001 log_write(repr(output_hist[n]),'output')
1135 log_write(repr(output_hist[n]),'output')
1002 else:
1136 else:
1003 logger.log_write(input_hist[1:])
1137 logger.log_write(input_hist[1:])
1004 if timestamp:
1138 if timestamp:
1005 # re-enable timestamping
1139 # re-enable timestamping
1006 logger.timestamp = True
1140 logger.timestamp = True
1007
1141
1008 print ('Activating auto-logging. '
1142 print ('Activating auto-logging. '
1009 'Current session state plus future input saved.')
1143 'Current session state plus future input saved.')
1010 logger.logstate()
1144 logger.logstate()
1011
1145
1012 def magic_logoff(self,parameter_s=''):
1146 def magic_logoff(self,parameter_s=''):
1013 """Temporarily stop logging.
1147 """Temporarily stop logging.
1014
1148
1015 You must have previously started logging."""
1149 You must have previously started logging."""
1016 self.shell.logger.switch_log(0)
1150 self.shell.logger.switch_log(0)
1017
1151
1018 def magic_logon(self,parameter_s=''):
1152 def magic_logon(self,parameter_s=''):
1019 """Restart logging.
1153 """Restart logging.
1020
1154
1021 This function is for restarting logging which you've temporarily
1155 This function is for restarting logging which you've temporarily
1022 stopped with %logoff. For starting logging for the first time, you
1156 stopped with %logoff. For starting logging for the first time, you
1023 must use the %logstart function, which allows you to specify an
1157 must use the %logstart function, which allows you to specify an
1024 optional log filename."""
1158 optional log filename."""
1025
1159
1026 self.shell.logger.switch_log(1)
1160 self.shell.logger.switch_log(1)
1027
1161
1028 def magic_logstate(self,parameter_s=''):
1162 def magic_logstate(self,parameter_s=''):
1029 """Print the status of the logging system."""
1163 """Print the status of the logging system."""
1030
1164
1031 self.shell.logger.logstate()
1165 self.shell.logger.logstate()
1032
1166
1033 def magic_pdb(self, parameter_s=''):
1167 def magic_pdb(self, parameter_s=''):
1034 """Control the automatic calling of the pdb interactive debugger.
1168 """Control the automatic calling of the pdb interactive debugger.
1035
1169
1036 Call as '%pdb on', '%pdb 1', '%pdb off' or '%pdb 0'. If called without
1170 Call as '%pdb on', '%pdb 1', '%pdb off' or '%pdb 0'. If called without
1037 argument it works as a toggle.
1171 argument it works as a toggle.
1038
1172
1039 When an exception is triggered, IPython can optionally call the
1173 When an exception is triggered, IPython can optionally call the
1040 interactive pdb debugger after the traceback printout. %pdb toggles
1174 interactive pdb debugger after the traceback printout. %pdb toggles
1041 this feature on and off.
1175 this feature on and off.
1042
1176
1043 The initial state of this feature is set in your ipythonrc
1177 The initial state of this feature is set in your ipythonrc
1044 configuration file (the variable is called 'pdb').
1178 configuration file (the variable is called 'pdb').
1045
1179
1046 If you want to just activate the debugger AFTER an exception has fired,
1180 If you want to just activate the debugger AFTER an exception has fired,
1047 without having to type '%pdb on' and rerunning your code, you can use
1181 without having to type '%pdb on' and rerunning your code, you can use
1048 the %debug magic."""
1182 the %debug magic."""
1049
1183
1050 par = parameter_s.strip().lower()
1184 par = parameter_s.strip().lower()
1051
1185
1052 if par:
1186 if par:
1053 try:
1187 try:
1054 new_pdb = {'off':0,'0':0,'on':1,'1':1}[par]
1188 new_pdb = {'off':0,'0':0,'on':1,'1':1}[par]
1055 except KeyError:
1189 except KeyError:
1056 print ('Incorrect argument. Use on/1, off/0, '
1190 print ('Incorrect argument. Use on/1, off/0, '
1057 'or nothing for a toggle.')
1191 'or nothing for a toggle.')
1058 return
1192 return
1059 else:
1193 else:
1060 # toggle
1194 # toggle
1061 new_pdb = not self.shell.call_pdb
1195 new_pdb = not self.shell.call_pdb
1062
1196
1063 # set on the shell
1197 # set on the shell
1064 self.shell.call_pdb = new_pdb
1198 self.shell.call_pdb = new_pdb
1065 print 'Automatic pdb calling has been turned',on_off(new_pdb)
1199 print 'Automatic pdb calling has been turned',on_off(new_pdb)
1066
1200
1067 def magic_debug(self, parameter_s=''):
1201 def magic_debug(self, parameter_s=''):
1068 """Activate the interactive debugger in post-mortem mode.
1202 """Activate the interactive debugger in post-mortem mode.
1069
1203
1070 If an exception has just occurred, this lets you inspect its stack
1204 If an exception has just occurred, this lets you inspect its stack
1071 frames interactively. Note that this will always work only on the last
1205 frames interactively. Note that this will always work only on the last
1072 traceback that occurred, so you must call this quickly after an
1206 traceback that occurred, so you must call this quickly after an
1073 exception that you wish to inspect has fired, because if another one
1207 exception that you wish to inspect has fired, because if another one
1074 occurs, it clobbers the previous one.
1208 occurs, it clobbers the previous one.
1075
1209
1076 If you want IPython to automatically do this on every exception, see
1210 If you want IPython to automatically do this on every exception, see
1077 the %pdb magic for more details.
1211 the %pdb magic for more details.
1078 """
1212 """
1079
1213
1080 self.shell.debugger(force=True)
1214 self.shell.debugger(force=True)
1081
1215
1082 def magic_prun(self, parameter_s ='',user_mode=1,
1216 def magic_prun(self, parameter_s ='',user_mode=1,
1083 opts=None,arg_lst=None,prog_ns=None):
1217 opts=None,arg_lst=None,prog_ns=None):
1084
1218
1085 """Run a statement through the python code profiler.
1219 """Run a statement through the python code profiler.
1086
1220
1087 Usage:\\
1221 Usage:\\
1088 %prun [options] statement
1222 %prun [options] statement
1089
1223
1090 The given statement (which doesn't require quote marks) is run via the
1224 The given statement (which doesn't require quote marks) is run via the
1091 python profiler in a manner similar to the profile.run() function.
1225 python profiler in a manner similar to the profile.run() function.
1092 Namespaces are internally managed to work correctly; profile.run
1226 Namespaces are internally managed to work correctly; profile.run
1093 cannot be used in IPython because it makes certain assumptions about
1227 cannot be used in IPython because it makes certain assumptions about
1094 namespaces which do not hold under IPython.
1228 namespaces which do not hold under IPython.
1095
1229
1096 Options:
1230 Options:
1097
1231
1098 -l <limit>: you can place restrictions on what or how much of the
1232 -l <limit>: you can place restrictions on what or how much of the
1099 profile gets printed. The limit value can be:
1233 profile gets printed. The limit value can be:
1100
1234
1101 * A string: only information for function names containing this string
1235 * A string: only information for function names containing this string
1102 is printed.
1236 is printed.
1103
1237
1104 * An integer: only these many lines are printed.
1238 * An integer: only these many lines are printed.
1105
1239
1106 * A float (between 0 and 1): this fraction of the report is printed
1240 * A float (between 0 and 1): this fraction of the report is printed
1107 (for example, use a limit of 0.4 to see the topmost 40% only).
1241 (for example, use a limit of 0.4 to see the topmost 40% only).
1108
1242
1109 You can combine several limits with repeated use of the option. For
1243 You can combine several limits with repeated use of the option. For
1110 example, '-l __init__ -l 5' will print only the topmost 5 lines of
1244 example, '-l __init__ -l 5' will print only the topmost 5 lines of
1111 information about class constructors.
1245 information about class constructors.
1112
1246
1113 -r: return the pstats.Stats object generated by the profiling. This
1247 -r: return the pstats.Stats object generated by the profiling. This
1114 object has all the information about the profile in it, and you can
1248 object has all the information about the profile in it, and you can
1115 later use it for further analysis or in other functions.
1249 later use it for further analysis or in other functions.
1116
1250
1117 -s <key>: sort profile by given key. You can provide more than one key
1251 -s <key>: sort profile by given key. You can provide more than one key
1118 by using the option several times: '-s key1 -s key2 -s key3...'. The
1252 by using the option several times: '-s key1 -s key2 -s key3...'. The
1119 default sorting key is 'time'.
1253 default sorting key is 'time'.
1120
1254
1121 The following is copied verbatim from the profile documentation
1255 The following is copied verbatim from the profile documentation
1122 referenced below:
1256 referenced below:
1123
1257
1124 When more than one key is provided, additional keys are used as
1258 When more than one key is provided, additional keys are used as
1125 secondary criteria when the there is equality in all keys selected
1259 secondary criteria when the there is equality in all keys selected
1126 before them.
1260 before them.
1127
1261
1128 Abbreviations can be used for any key names, as long as the
1262 Abbreviations can be used for any key names, as long as the
1129 abbreviation is unambiguous. The following are the keys currently
1263 abbreviation is unambiguous. The following are the keys currently
1130 defined:
1264 defined:
1131
1265
1132 Valid Arg Meaning\\
1266 Valid Arg Meaning\\
1133 "calls" call count\\
1267 "calls" call count\\
1134 "cumulative" cumulative time\\
1268 "cumulative" cumulative time\\
1135 "file" file name\\
1269 "file" file name\\
1136 "module" file name\\
1270 "module" file name\\
1137 "pcalls" primitive call count\\
1271 "pcalls" primitive call count\\
1138 "line" line number\\
1272 "line" line number\\
1139 "name" function name\\
1273 "name" function name\\
1140 "nfl" name/file/line\\
1274 "nfl" name/file/line\\
1141 "stdname" standard name\\
1275 "stdname" standard name\\
1142 "time" internal time
1276 "time" internal time
1143
1277
1144 Note that all sorts on statistics are in descending order (placing
1278 Note that all sorts on statistics are in descending order (placing
1145 most time consuming items first), where as name, file, and line number
1279 most time consuming items first), where as name, file, and line number
1146 searches are in ascending order (i.e., alphabetical). The subtle
1280 searches are in ascending order (i.e., alphabetical). The subtle
1147 distinction between "nfl" and "stdname" is that the standard name is a
1281 distinction between "nfl" and "stdname" is that the standard name is a
1148 sort of the name as printed, which means that the embedded line
1282 sort of the name as printed, which means that the embedded line
1149 numbers get compared in an odd way. For example, lines 3, 20, and 40
1283 numbers get compared in an odd way. For example, lines 3, 20, and 40
1150 would (if the file names were the same) appear in the string order
1284 would (if the file names were the same) appear in the string order
1151 "20" "3" and "40". In contrast, "nfl" does a numeric compare of the
1285 "20" "3" and "40". In contrast, "nfl" does a numeric compare of the
1152 line numbers. In fact, sort_stats("nfl") is the same as
1286 line numbers. In fact, sort_stats("nfl") is the same as
1153 sort_stats("name", "file", "line").
1287 sort_stats("name", "file", "line").
1154
1288
1155 -T <filename>: save profile results as shown on screen to a text
1289 -T <filename>: save profile results as shown on screen to a text
1156 file. The profile is still shown on screen.
1290 file. The profile is still shown on screen.
1157
1291
1158 -D <filename>: save (via dump_stats) profile statistics to given
1292 -D <filename>: save (via dump_stats) profile statistics to given
1159 filename. This data is in a format understod by the pstats module, and
1293 filename. This data is in a format understod by the pstats module, and
1160 is generated by a call to the dump_stats() method of profile
1294 is generated by a call to the dump_stats() method of profile
1161 objects. The profile is still shown on screen.
1295 objects. The profile is still shown on screen.
1162
1296
1163 If you want to run complete programs under the profiler's control, use
1297 If you want to run complete programs under the profiler's control, use
1164 '%run -p [prof_opts] filename.py [args to program]' where prof_opts
1298 '%run -p [prof_opts] filename.py [args to program]' where prof_opts
1165 contains profiler specific options as described here.
1299 contains profiler specific options as described here.
1166
1300
1167 You can read the complete documentation for the profile module with:\\
1301 You can read the complete documentation for the profile module with:\\
1168 In [1]: import profile; profile.help() """
1302 In [1]: import profile; profile.help() """
1169
1303
1170 opts_def = Struct(D=[''],l=[],s=['time'],T=[''])
1304 opts_def = Struct(D=[''],l=[],s=['time'],T=[''])
1171 # protect user quote marks
1305 # protect user quote marks
1172 parameter_s = parameter_s.replace('"',r'\"').replace("'",r"\'")
1306 parameter_s = parameter_s.replace('"',r'\"').replace("'",r"\'")
1173
1307
1174 if user_mode: # regular user call
1308 if user_mode: # regular user call
1175 opts,arg_str = self.parse_options(parameter_s,'D:l:rs:T:',
1309 opts,arg_str = self.parse_options(parameter_s,'D:l:rs:T:',
1176 list_all=1)
1310 list_all=1)
1177 namespace = self.shell.user_ns
1311 namespace = self.shell.user_ns
1178 else: # called to run a program by %run -p
1312 else: # called to run a program by %run -p
1179 try:
1313 try:
1180 filename = get_py_filename(arg_lst[0])
1314 filename = get_py_filename(arg_lst[0])
1181 except IOError,msg:
1315 except IOError,msg:
1182 error(msg)
1316 error(msg)
1183 return
1317 return
1184
1318
1185 arg_str = 'execfile(filename,prog_ns)'
1319 arg_str = 'execfile(filename,prog_ns)'
1186 namespace = locals()
1320 namespace = locals()
1187
1321
1188 opts.merge(opts_def)
1322 opts.merge(opts_def)
1189
1323
1190 prof = profile.Profile()
1324 prof = profile.Profile()
1191 try:
1325 try:
1192 prof = prof.runctx(arg_str,namespace,namespace)
1326 prof = prof.runctx(arg_str,namespace,namespace)
1193 sys_exit = ''
1327 sys_exit = ''
1194 except SystemExit:
1328 except SystemExit:
1195 sys_exit = """*** SystemExit exception caught in code being profiled."""
1329 sys_exit = """*** SystemExit exception caught in code being profiled."""
1196
1330
1197 stats = pstats.Stats(prof).strip_dirs().sort_stats(*opts.s)
1331 stats = pstats.Stats(prof).strip_dirs().sort_stats(*opts.s)
1198
1332
1199 lims = opts.l
1333 lims = opts.l
1200 if lims:
1334 if lims:
1201 lims = [] # rebuild lims with ints/floats/strings
1335 lims = [] # rebuild lims with ints/floats/strings
1202 for lim in opts.l:
1336 for lim in opts.l:
1203 try:
1337 try:
1204 lims.append(int(lim))
1338 lims.append(int(lim))
1205 except ValueError:
1339 except ValueError:
1206 try:
1340 try:
1207 lims.append(float(lim))
1341 lims.append(float(lim))
1208 except ValueError:
1342 except ValueError:
1209 lims.append(lim)
1343 lims.append(lim)
1210
1344
1211 # Trap output.
1345 # Trap output.
1212 stdout_trap = StringIO()
1346 stdout_trap = StringIO()
1213
1347
1214 if hasattr(stats,'stream'):
1348 if hasattr(stats,'stream'):
1215 # In newer versions of python, the stats object has a 'stream'
1349 # In newer versions of python, the stats object has a 'stream'
1216 # attribute to write into.
1350 # attribute to write into.
1217 stats.stream = stdout_trap
1351 stats.stream = stdout_trap
1218 stats.print_stats(*lims)
1352 stats.print_stats(*lims)
1219 else:
1353 else:
1220 # For older versions, we manually redirect stdout during printing
1354 # For older versions, we manually redirect stdout during printing
1221 sys_stdout = sys.stdout
1355 sys_stdout = sys.stdout
1222 try:
1356 try:
1223 sys.stdout = stdout_trap
1357 sys.stdout = stdout_trap
1224 stats.print_stats(*lims)
1358 stats.print_stats(*lims)
1225 finally:
1359 finally:
1226 sys.stdout = sys_stdout
1360 sys.stdout = sys_stdout
1227
1361
1228 output = stdout_trap.getvalue()
1362 output = stdout_trap.getvalue()
1229 output = output.rstrip()
1363 output = output.rstrip()
1230
1364
1231 page(output,screen_lines=self.shell.rc.screen_length)
1365 page(output,screen_lines=self.shell.rc.screen_length)
1232 print sys_exit,
1366 print sys_exit,
1233
1367
1234 dump_file = opts.D[0]
1368 dump_file = opts.D[0]
1235 text_file = opts.T[0]
1369 text_file = opts.T[0]
1236 if dump_file:
1370 if dump_file:
1237 prof.dump_stats(dump_file)
1371 prof.dump_stats(dump_file)
1238 print '\n*** Profile stats marshalled to file',\
1372 print '\n*** Profile stats marshalled to file',\
1239 `dump_file`+'.',sys_exit
1373 `dump_file`+'.',sys_exit
1240 if text_file:
1374 if text_file:
1241 pfile = file(text_file,'w')
1375 pfile = file(text_file,'w')
1242 pfile.write(output)
1376 pfile.write(output)
1243 pfile.close()
1377 pfile.close()
1244 print '\n*** Profile printout saved to text file',\
1378 print '\n*** Profile printout saved to text file',\
1245 `text_file`+'.',sys_exit
1379 `text_file`+'.',sys_exit
1246
1380
1247 if opts.has_key('r'):
1381 if opts.has_key('r'):
1248 return stats
1382 return stats
1249 else:
1383 else:
1250 return None
1384 return None
1251
1385
1252 def magic_run(self, parameter_s ='',runner=None):
1386 def magic_run(self, parameter_s ='',runner=None):
1253 """Run the named file inside IPython as a program.
1387 """Run the named file inside IPython as a program.
1254
1388
1255 Usage:\\
1389 Usage:\\
1256 %run [-n -i -t [-N<N>] -d [-b<N>] -p [profile options]] file [args]
1390 %run [-n -i -t [-N<N>] -d [-b<N>] -p [profile options]] file [args]
1257
1391
1258 Parameters after the filename are passed as command-line arguments to
1392 Parameters after the filename are passed as command-line arguments to
1259 the program (put in sys.argv). Then, control returns to IPython's
1393 the program (put in sys.argv). Then, control returns to IPython's
1260 prompt.
1394 prompt.
1261
1395
1262 This is similar to running at a system prompt:\\
1396 This is similar to running at a system prompt:\\
1263 $ python file args\\
1397 $ python file args\\
1264 but with the advantage of giving you IPython's tracebacks, and of
1398 but with the advantage of giving you IPython's tracebacks, and of
1265 loading all variables into your interactive namespace for further use
1399 loading all variables into your interactive namespace for further use
1266 (unless -p is used, see below).
1400 (unless -p is used, see below).
1267
1401
1268 The file is executed in a namespace initially consisting only of
1402 The file is executed in a namespace initially consisting only of
1269 __name__=='__main__' and sys.argv constructed as indicated. It thus
1403 __name__=='__main__' and sys.argv constructed as indicated. It thus
1270 sees its environment as if it were being run as a stand-alone
1404 sees its environment as if it were being run as a stand-alone
1271 program. But after execution, the IPython interactive namespace gets
1405 program. But after execution, the IPython interactive namespace gets
1272 updated with all variables defined in the program (except for __name__
1406 updated with all variables defined in the program (except for __name__
1273 and sys.argv). This allows for very convenient loading of code for
1407 and sys.argv). This allows for very convenient loading of code for
1274 interactive work, while giving each program a 'clean sheet' to run in.
1408 interactive work, while giving each program a 'clean sheet' to run in.
1275
1409
1276 Options:
1410 Options:
1277
1411
1278 -n: __name__ is NOT set to '__main__', but to the running file's name
1412 -n: __name__ is NOT set to '__main__', but to the running file's name
1279 without extension (as python does under import). This allows running
1413 without extension (as python does under import). This allows running
1280 scripts and reloading the definitions in them without calling code
1414 scripts and reloading the definitions in them without calling code
1281 protected by an ' if __name__ == "__main__" ' clause.
1415 protected by an ' if __name__ == "__main__" ' clause.
1282
1416
1283 -i: run the file in IPython's namespace instead of an empty one. This
1417 -i: run the file in IPython's namespace instead of an empty one. This
1284 is useful if you are experimenting with code written in a text editor
1418 is useful if you are experimenting with code written in a text editor
1285 which depends on variables defined interactively.
1419 which depends on variables defined interactively.
1286
1420
1287 -e: ignore sys.exit() calls or SystemExit exceptions in the script
1421 -e: ignore sys.exit() calls or SystemExit exceptions in the script
1288 being run. This is particularly useful if IPython is being used to
1422 being run. This is particularly useful if IPython is being used to
1289 run unittests, which always exit with a sys.exit() call. In such
1423 run unittests, which always exit with a sys.exit() call. In such
1290 cases you are interested in the output of the test results, not in
1424 cases you are interested in the output of the test results, not in
1291 seeing a traceback of the unittest module.
1425 seeing a traceback of the unittest module.
1292
1426
1293 -t: print timing information at the end of the run. IPython will give
1427 -t: print timing information at the end of the run. IPython will give
1294 you an estimated CPU time consumption for your script, which under
1428 you an estimated CPU time consumption for your script, which under
1295 Unix uses the resource module to avoid the wraparound problems of
1429 Unix uses the resource module to avoid the wraparound problems of
1296 time.clock(). Under Unix, an estimate of time spent on system tasks
1430 time.clock(). Under Unix, an estimate of time spent on system tasks
1297 is also given (for Windows platforms this is reported as 0.0).
1431 is also given (for Windows platforms this is reported as 0.0).
1298
1432
1299 If -t is given, an additional -N<N> option can be given, where <N>
1433 If -t is given, an additional -N<N> option can be given, where <N>
1300 must be an integer indicating how many times you want the script to
1434 must be an integer indicating how many times you want the script to
1301 run. The final timing report will include total and per run results.
1435 run. The final timing report will include total and per run results.
1302
1436
1303 For example (testing the script uniq_stable.py):
1437 For example (testing the script uniq_stable.py):
1304
1438
1305 In [1]: run -t uniq_stable
1439 In [1]: run -t uniq_stable
1306
1440
1307 IPython CPU timings (estimated):\\
1441 IPython CPU timings (estimated):\\
1308 User : 0.19597 s.\\
1442 User : 0.19597 s.\\
1309 System: 0.0 s.\\
1443 System: 0.0 s.\\
1310
1444
1311 In [2]: run -t -N5 uniq_stable
1445 In [2]: run -t -N5 uniq_stable
1312
1446
1313 IPython CPU timings (estimated):\\
1447 IPython CPU timings (estimated):\\
1314 Total runs performed: 5\\
1448 Total runs performed: 5\\
1315 Times : Total Per run\\
1449 Times : Total Per run\\
1316 User : 0.910862 s, 0.1821724 s.\\
1450 User : 0.910862 s, 0.1821724 s.\\
1317 System: 0.0 s, 0.0 s.
1451 System: 0.0 s, 0.0 s.
1318
1452
1319 -d: run your program under the control of pdb, the Python debugger.
1453 -d: run your program under the control of pdb, the Python debugger.
1320 This allows you to execute your program step by step, watch variables,
1454 This allows you to execute your program step by step, watch variables,
1321 etc. Internally, what IPython does is similar to calling:
1455 etc. Internally, what IPython does is similar to calling:
1322
1456
1323 pdb.run('execfile("YOURFILENAME")')
1457 pdb.run('execfile("YOURFILENAME")')
1324
1458
1325 with a breakpoint set on line 1 of your file. You can change the line
1459 with a breakpoint set on line 1 of your file. You can change the line
1326 number for this automatic breakpoint to be <N> by using the -bN option
1460 number for this automatic breakpoint to be <N> by using the -bN option
1327 (where N must be an integer). For example:
1461 (where N must be an integer). For example:
1328
1462
1329 %run -d -b40 myscript
1463 %run -d -b40 myscript
1330
1464
1331 will set the first breakpoint at line 40 in myscript.py. Note that
1465 will set the first breakpoint at line 40 in myscript.py. Note that
1332 the first breakpoint must be set on a line which actually does
1466 the first breakpoint must be set on a line which actually does
1333 something (not a comment or docstring) for it to stop execution.
1467 something (not a comment or docstring) for it to stop execution.
1334
1468
1335 When the pdb debugger starts, you will see a (Pdb) prompt. You must
1469 When the pdb debugger starts, you will see a (Pdb) prompt. You must
1336 first enter 'c' (without qoutes) to start execution up to the first
1470 first enter 'c' (without qoutes) to start execution up to the first
1337 breakpoint.
1471 breakpoint.
1338
1472
1339 Entering 'help' gives information about the use of the debugger. You
1473 Entering 'help' gives information about the use of the debugger. You
1340 can easily see pdb's full documentation with "import pdb;pdb.help()"
1474 can easily see pdb's full documentation with "import pdb;pdb.help()"
1341 at a prompt.
1475 at a prompt.
1342
1476
1343 -p: run program under the control of the Python profiler module (which
1477 -p: run program under the control of the Python profiler module (which
1344 prints a detailed report of execution times, function calls, etc).
1478 prints a detailed report of execution times, function calls, etc).
1345
1479
1346 You can pass other options after -p which affect the behavior of the
1480 You can pass other options after -p which affect the behavior of the
1347 profiler itself. See the docs for %prun for details.
1481 profiler itself. See the docs for %prun for details.
1348
1482
1349 In this mode, the program's variables do NOT propagate back to the
1483 In this mode, the program's variables do NOT propagate back to the
1350 IPython interactive namespace (because they remain in the namespace
1484 IPython interactive namespace (because they remain in the namespace
1351 where the profiler executes them).
1485 where the profiler executes them).
1352
1486
1353 Internally this triggers a call to %prun, see its documentation for
1487 Internally this triggers a call to %prun, see its documentation for
1354 details on the options available specifically for profiling.
1488 details on the options available specifically for profiling.
1355
1489
1356 There is one special usage for which the text above doesn't apply:
1490 There is one special usage for which the text above doesn't apply:
1357 if the filename ends with .ipy, the file is run as ipython script,
1491 if the filename ends with .ipy, the file is run as ipython script,
1358 just as if the commands were written on IPython prompt.
1492 just as if the commands were written on IPython prompt.
1359 """
1493 """
1360
1494
1361 # get arguments and set sys.argv for program to be run.
1495 # get arguments and set sys.argv for program to be run.
1362 opts,arg_lst = self.parse_options(parameter_s,'nidtN:b:pD:l:rs:T:e',
1496 opts,arg_lst = self.parse_options(parameter_s,'nidtN:b:pD:l:rs:T:e',
1363 mode='list',list_all=1)
1497 mode='list',list_all=1)
1364
1498
1365 try:
1499 try:
1366 filename = get_py_filename(arg_lst[0])
1500 filename = get_py_filename(arg_lst[0])
1367 except IndexError:
1501 except IndexError:
1368 warn('you must provide at least a filename.')
1502 warn('you must provide at least a filename.')
1369 print '\n%run:\n',OInspect.getdoc(self.magic_run)
1503 print '\n%run:\n',OInspect.getdoc(self.magic_run)
1370 return
1504 return
1371 except IOError,msg:
1505 except IOError,msg:
1372 error(msg)
1506 error(msg)
1373 return
1507 return
1374
1508
1375 if filename.lower().endswith('.ipy'):
1509 if filename.lower().endswith('.ipy'):
1376 self.api.runlines(open(filename).read())
1510 self.api.runlines(open(filename).read())
1377 return
1511 return
1378
1512
1379 # Control the response to exit() calls made by the script being run
1513 # Control the response to exit() calls made by the script being run
1380 exit_ignore = opts.has_key('e')
1514 exit_ignore = opts.has_key('e')
1381
1515
1382 # Make sure that the running script gets a proper sys.argv as if it
1516 # Make sure that the running script gets a proper sys.argv as if it
1383 # were run from a system shell.
1517 # were run from a system shell.
1384 save_argv = sys.argv # save it for later restoring
1518 save_argv = sys.argv # save it for later restoring
1385 sys.argv = [filename]+ arg_lst[1:] # put in the proper filename
1519 sys.argv = [filename]+ arg_lst[1:] # put in the proper filename
1386
1520
1387 if opts.has_key('i'):
1521 if opts.has_key('i'):
1388 prog_ns = self.shell.user_ns
1522 prog_ns = self.shell.user_ns
1389 __name__save = self.shell.user_ns['__name__']
1523 __name__save = self.shell.user_ns['__name__']
1390 prog_ns['__name__'] = '__main__'
1524 prog_ns['__name__'] = '__main__'
1391 else:
1525 else:
1392 if opts.has_key('n'):
1526 if opts.has_key('n'):
1393 name = os.path.splitext(os.path.basename(filename))[0]
1527 name = os.path.splitext(os.path.basename(filename))[0]
1394 else:
1528 else:
1395 name = '__main__'
1529 name = '__main__'
1396 prog_ns = {'__name__':name}
1530 prog_ns = {'__name__':name}
1397
1531
1398 # Since '%run foo' emulates 'python foo.py' at the cmd line, we must
1532 # Since '%run foo' emulates 'python foo.py' at the cmd line, we must
1399 # set the __file__ global in the script's namespace
1533 # set the __file__ global in the script's namespace
1400 prog_ns['__file__'] = filename
1534 prog_ns['__file__'] = filename
1401
1535
1402 # pickle fix. See iplib for an explanation. But we need to make sure
1536 # pickle fix. See iplib for an explanation. But we need to make sure
1403 # that, if we overwrite __main__, we replace it at the end
1537 # that, if we overwrite __main__, we replace it at the end
1404 if prog_ns['__name__'] == '__main__':
1538 if prog_ns['__name__'] == '__main__':
1405 restore_main = sys.modules['__main__']
1539 restore_main = sys.modules['__main__']
1406 else:
1540 else:
1407 restore_main = False
1541 restore_main = False
1408
1542
1409 sys.modules[prog_ns['__name__']] = FakeModule(prog_ns)
1543 sys.modules[prog_ns['__name__']] = FakeModule(prog_ns)
1410
1544
1411 stats = None
1545 stats = None
1412 try:
1546 try:
1413 if self.shell.has_readline:
1547 if self.shell.has_readline:
1414 self.shell.savehist()
1548 self.shell.savehist()
1415
1549
1416 if opts.has_key('p'):
1550 if opts.has_key('p'):
1417 stats = self.magic_prun('',0,opts,arg_lst,prog_ns)
1551 stats = self.magic_prun('',0,opts,arg_lst,prog_ns)
1418 else:
1552 else:
1419 if opts.has_key('d'):
1553 if opts.has_key('d'):
1420 deb = Debugger.Pdb(self.shell.rc.colors)
1554 deb = Debugger.Pdb(self.shell.rc.colors)
1421 # reset Breakpoint state, which is moronically kept
1555 # reset Breakpoint state, which is moronically kept
1422 # in a class
1556 # in a class
1423 bdb.Breakpoint.next = 1
1557 bdb.Breakpoint.next = 1
1424 bdb.Breakpoint.bplist = {}
1558 bdb.Breakpoint.bplist = {}
1425 bdb.Breakpoint.bpbynumber = [None]
1559 bdb.Breakpoint.bpbynumber = [None]
1426 # Set an initial breakpoint to stop execution
1560 # Set an initial breakpoint to stop execution
1427 maxtries = 10
1561 maxtries = 10
1428 bp = int(opts.get('b',[1])[0])
1562 bp = int(opts.get('b',[1])[0])
1429 checkline = deb.checkline(filename,bp)
1563 checkline = deb.checkline(filename,bp)
1430 if not checkline:
1564 if not checkline:
1431 for bp in range(bp+1,bp+maxtries+1):
1565 for bp in range(bp+1,bp+maxtries+1):
1432 if deb.checkline(filename,bp):
1566 if deb.checkline(filename,bp):
1433 break
1567 break
1434 else:
1568 else:
1435 msg = ("\nI failed to find a valid line to set "
1569 msg = ("\nI failed to find a valid line to set "
1436 "a breakpoint\n"
1570 "a breakpoint\n"
1437 "after trying up to line: %s.\n"
1571 "after trying up to line: %s.\n"
1438 "Please set a valid breakpoint manually "
1572 "Please set a valid breakpoint manually "
1439 "with the -b option." % bp)
1573 "with the -b option." % bp)
1440 error(msg)
1574 error(msg)
1441 return
1575 return
1442 # if we find a good linenumber, set the breakpoint
1576 # if we find a good linenumber, set the breakpoint
1443 deb.do_break('%s:%s' % (filename,bp))
1577 deb.do_break('%s:%s' % (filename,bp))
1444 # Start file run
1578 # Start file run
1445 print "NOTE: Enter 'c' at the",
1579 print "NOTE: Enter 'c' at the",
1446 print "%s prompt to start your script." % deb.prompt
1580 print "%s prompt to start your script." % deb.prompt
1447 try:
1581 try:
1448 deb.run('execfile("%s")' % filename,prog_ns)
1582 deb.run('execfile("%s")' % filename,prog_ns)
1449
1583
1450 except:
1584 except:
1451 etype, value, tb = sys.exc_info()
1585 etype, value, tb = sys.exc_info()
1452 # Skip three frames in the traceback: the %run one,
1586 # Skip three frames in the traceback: the %run one,
1453 # one inside bdb.py, and the command-line typed by the
1587 # one inside bdb.py, and the command-line typed by the
1454 # user (run by exec in pdb itself).
1588 # user (run by exec in pdb itself).
1455 self.shell.InteractiveTB(etype,value,tb,tb_offset=3)
1589 self.shell.InteractiveTB(etype,value,tb,tb_offset=3)
1456 else:
1590 else:
1457 if runner is None:
1591 if runner is None:
1458 runner = self.shell.safe_execfile
1592 runner = self.shell.safe_execfile
1459 if opts.has_key('t'):
1593 if opts.has_key('t'):
1460 try:
1594 try:
1461 nruns = int(opts['N'][0])
1595 nruns = int(opts['N'][0])
1462 if nruns < 1:
1596 if nruns < 1:
1463 error('Number of runs must be >=1')
1597 error('Number of runs must be >=1')
1464 return
1598 return
1465 except (KeyError):
1599 except (KeyError):
1466 nruns = 1
1600 nruns = 1
1467 if nruns == 1:
1601 if nruns == 1:
1468 t0 = clock2()
1602 t0 = clock2()
1469 runner(filename,prog_ns,prog_ns,
1603 runner(filename,prog_ns,prog_ns,
1470 exit_ignore=exit_ignore)
1604 exit_ignore=exit_ignore)
1471 t1 = clock2()
1605 t1 = clock2()
1472 t_usr = t1[0]-t0[0]
1606 t_usr = t1[0]-t0[0]
1473 t_sys = t1[1]-t1[1]
1607 t_sys = t1[1]-t1[1]
1474 print "\nIPython CPU timings (estimated):"
1608 print "\nIPython CPU timings (estimated):"
1475 print " User : %10s s." % t_usr
1609 print " User : %10s s." % t_usr
1476 print " System: %10s s." % t_sys
1610 print " System: %10s s." % t_sys
1477 else:
1611 else:
1478 runs = range(nruns)
1612 runs = range(nruns)
1479 t0 = clock2()
1613 t0 = clock2()
1480 for nr in runs:
1614 for nr in runs:
1481 runner(filename,prog_ns,prog_ns,
1615 runner(filename,prog_ns,prog_ns,
1482 exit_ignore=exit_ignore)
1616 exit_ignore=exit_ignore)
1483 t1 = clock2()
1617 t1 = clock2()
1484 t_usr = t1[0]-t0[0]
1618 t_usr = t1[0]-t0[0]
1485 t_sys = t1[1]-t1[1]
1619 t_sys = t1[1]-t1[1]
1486 print "\nIPython CPU timings (estimated):"
1620 print "\nIPython CPU timings (estimated):"
1487 print "Total runs performed:",nruns
1621 print "Total runs performed:",nruns
1488 print " Times : %10s %10s" % ('Total','Per run')
1622 print " Times : %10s %10s" % ('Total','Per run')
1489 print " User : %10s s, %10s s." % (t_usr,t_usr/nruns)
1623 print " User : %10s s, %10s s." % (t_usr,t_usr/nruns)
1490 print " System: %10s s, %10s s." % (t_sys,t_sys/nruns)
1624 print " System: %10s s, %10s s." % (t_sys,t_sys/nruns)
1491
1625
1492 else:
1626 else:
1493 runner(filename,prog_ns,prog_ns,exit_ignore=exit_ignore)
1627 runner(filename,prog_ns,prog_ns,exit_ignore=exit_ignore)
1494 if opts.has_key('i'):
1628 if opts.has_key('i'):
1495 self.shell.user_ns['__name__'] = __name__save
1629 self.shell.user_ns['__name__'] = __name__save
1496 else:
1630 else:
1497 # update IPython interactive namespace
1631 # update IPython interactive namespace
1498 del prog_ns['__name__']
1632 del prog_ns['__name__']
1499 self.shell.user_ns.update(prog_ns)
1633 self.shell.user_ns.update(prog_ns)
1500 finally:
1634 finally:
1501 sys.argv = save_argv
1635 sys.argv = save_argv
1502 if restore_main:
1636 if restore_main:
1503 sys.modules['__main__'] = restore_main
1637 sys.modules['__main__'] = restore_main
1504 self.shell.reloadhist()
1638 self.shell.reloadhist()
1505
1639
1506 return stats
1640 return stats
1507
1641
1508 def magic_runlog(self, parameter_s =''):
1642 def magic_runlog(self, parameter_s =''):
1509 """Run files as logs.
1643 """Run files as logs.
1510
1644
1511 Usage:\\
1645 Usage:\\
1512 %runlog file1 file2 ...
1646 %runlog file1 file2 ...
1513
1647
1514 Run the named files (treating them as log files) in sequence inside
1648 Run the named files (treating them as log files) in sequence inside
1515 the interpreter, and return to the prompt. This is much slower than
1649 the interpreter, and return to the prompt. This is much slower than
1516 %run because each line is executed in a try/except block, but it
1650 %run because each line is executed in a try/except block, but it
1517 allows running files with syntax errors in them.
1651 allows running files with syntax errors in them.
1518
1652
1519 Normally IPython will guess when a file is one of its own logfiles, so
1653 Normally IPython will guess when a file is one of its own logfiles, so
1520 you can typically use %run even for logs. This shorthand allows you to
1654 you can typically use %run even for logs. This shorthand allows you to
1521 force any file to be treated as a log file."""
1655 force any file to be treated as a log file."""
1522
1656
1523 for f in parameter_s.split():
1657 for f in parameter_s.split():
1524 self.shell.safe_execfile(f,self.shell.user_ns,
1658 self.shell.safe_execfile(f,self.shell.user_ns,
1525 self.shell.user_ns,islog=1)
1659 self.shell.user_ns,islog=1)
1526
1660
1527 def magic_timeit(self, parameter_s =''):
1661 def magic_timeit(self, parameter_s =''):
1528 """Time execution of a Python statement or expression
1662 """Time execution of a Python statement or expression
1529
1663
1530 Usage:\\
1664 Usage:\\
1531 %timeit [-n<N> -r<R> [-t|-c]] statement
1665 %timeit [-n<N> -r<R> [-t|-c]] statement
1532
1666
1533 Time execution of a Python statement or expression using the timeit
1667 Time execution of a Python statement or expression using the timeit
1534 module.
1668 module.
1535
1669
1536 Options:
1670 Options:
1537 -n<N>: execute the given statement <N> times in a loop. If this value
1671 -n<N>: execute the given statement <N> times in a loop. If this value
1538 is not given, a fitting value is chosen.
1672 is not given, a fitting value is chosen.
1539
1673
1540 -r<R>: repeat the loop iteration <R> times and take the best result.
1674 -r<R>: repeat the loop iteration <R> times and take the best result.
1541 Default: 3
1675 Default: 3
1542
1676
1543 -t: use time.time to measure the time, which is the default on Unix.
1677 -t: use time.time to measure the time, which is the default on Unix.
1544 This function measures wall time.
1678 This function measures wall time.
1545
1679
1546 -c: use time.clock to measure the time, which is the default on
1680 -c: use time.clock to measure the time, which is the default on
1547 Windows and measures wall time. On Unix, resource.getrusage is used
1681 Windows and measures wall time. On Unix, resource.getrusage is used
1548 instead and returns the CPU user time.
1682 instead and returns the CPU user time.
1549
1683
1550 -p<P>: use a precision of <P> digits to display the timing result.
1684 -p<P>: use a precision of <P> digits to display the timing result.
1551 Default: 3
1685 Default: 3
1552
1686
1553
1687
1554 Examples:\\
1688 Examples:\\
1555 In [1]: %timeit pass
1689 In [1]: %timeit pass
1556 10000000 loops, best of 3: 53.3 ns per loop
1690 10000000 loops, best of 3: 53.3 ns per loop
1557
1691
1558 In [2]: u = None
1692 In [2]: u = None
1559
1693
1560 In [3]: %timeit u is None
1694 In [3]: %timeit u is None
1561 10000000 loops, best of 3: 184 ns per loop
1695 10000000 loops, best of 3: 184 ns per loop
1562
1696
1563 In [4]: %timeit -r 4 u == None
1697 In [4]: %timeit -r 4 u == None
1564 1000000 loops, best of 4: 242 ns per loop
1698 1000000 loops, best of 4: 242 ns per loop
1565
1699
1566 In [5]: import time
1700 In [5]: import time
1567
1701
1568 In [6]: %timeit -n1 time.sleep(2)
1702 In [6]: %timeit -n1 time.sleep(2)
1569 1 loops, best of 3: 2 s per loop
1703 1 loops, best of 3: 2 s per loop
1570
1704
1571
1705
1572 The times reported by %timeit will be slightly higher than those
1706 The times reported by %timeit will be slightly higher than those
1573 reported by the timeit.py script when variables are accessed. This is
1707 reported by the timeit.py script when variables are accessed. This is
1574 due to the fact that %timeit executes the statement in the namespace
1708 due to the fact that %timeit executes the statement in the namespace
1575 of the shell, compared with timeit.py, which uses a single setup
1709 of the shell, compared with timeit.py, which uses a single setup
1576 statement to import function or create variables. Generally, the bias
1710 statement to import function or create variables. Generally, the bias
1577 does not matter as long as results from timeit.py are not mixed with
1711 does not matter as long as results from timeit.py are not mixed with
1578 those from %timeit."""
1712 those from %timeit."""
1579
1713
1580 import timeit
1714 import timeit
1581 import math
1715 import math
1582
1716
1583 units = ["s", "ms", "\xc2\xb5s", "ns"]
1717 units = ["s", "ms", "\xc2\xb5s", "ns"]
1584 scaling = [1, 1e3, 1e6, 1e9]
1718 scaling = [1, 1e3, 1e6, 1e9]
1585
1719
1586 opts, stmt = self.parse_options(parameter_s,'n:r:tcp:',
1720 opts, stmt = self.parse_options(parameter_s,'n:r:tcp:',
1587 posix=False)
1721 posix=False)
1588 if stmt == "":
1722 if stmt == "":
1589 return
1723 return
1590 timefunc = timeit.default_timer
1724 timefunc = timeit.default_timer
1591 number = int(getattr(opts, "n", 0))
1725 number = int(getattr(opts, "n", 0))
1592 repeat = int(getattr(opts, "r", timeit.default_repeat))
1726 repeat = int(getattr(opts, "r", timeit.default_repeat))
1593 precision = int(getattr(opts, "p", 3))
1727 precision = int(getattr(opts, "p", 3))
1594 if hasattr(opts, "t"):
1728 if hasattr(opts, "t"):
1595 timefunc = time.time
1729 timefunc = time.time
1596 if hasattr(opts, "c"):
1730 if hasattr(opts, "c"):
1597 timefunc = clock
1731 timefunc = clock
1598
1732
1599 timer = timeit.Timer(timer=timefunc)
1733 timer = timeit.Timer(timer=timefunc)
1600 # this code has tight coupling to the inner workings of timeit.Timer,
1734 # this code has tight coupling to the inner workings of timeit.Timer,
1601 # but is there a better way to achieve that the code stmt has access
1735 # but is there a better way to achieve that the code stmt has access
1602 # to the shell namespace?
1736 # to the shell namespace?
1603
1737
1604 src = timeit.template % {'stmt': timeit.reindent(stmt, 8),
1738 src = timeit.template % {'stmt': timeit.reindent(stmt, 8),
1605 'setup': "pass"}
1739 'setup': "pass"}
1606 code = compile(src, "<magic-timeit>", "exec")
1740 code = compile(src, "<magic-timeit>", "exec")
1607 ns = {}
1741 ns = {}
1608 exec code in self.shell.user_ns, ns
1742 exec code in self.shell.user_ns, ns
1609 timer.inner = ns["inner"]
1743 timer.inner = ns["inner"]
1610
1744
1611 if number == 0:
1745 if number == 0:
1612 # determine number so that 0.2 <= total time < 2.0
1746 # determine number so that 0.2 <= total time < 2.0
1613 number = 1
1747 number = 1
1614 for i in range(1, 10):
1748 for i in range(1, 10):
1615 number *= 10
1749 number *= 10
1616 if timer.timeit(number) >= 0.2:
1750 if timer.timeit(number) >= 0.2:
1617 break
1751 break
1618
1752
1619 best = min(timer.repeat(repeat, number)) / number
1753 best = min(timer.repeat(repeat, number)) / number
1620
1754
1621 if best > 0.0:
1755 if best > 0.0:
1622 order = min(-int(math.floor(math.log10(best)) // 3), 3)
1756 order = min(-int(math.floor(math.log10(best)) // 3), 3)
1623 else:
1757 else:
1624 order = 3
1758 order = 3
1625 print "%d loops, best of %d: %.*g %s per loop" % (number, repeat,
1759 print "%d loops, best of %d: %.*g %s per loop" % (number, repeat,
1626 precision,
1760 precision,
1627 best * scaling[order],
1761 best * scaling[order],
1628 units[order])
1762 units[order])
1629
1763
1630 def magic_time(self,parameter_s = ''):
1764 def magic_time(self,parameter_s = ''):
1631 """Time execution of a Python statement or expression.
1765 """Time execution of a Python statement or expression.
1632
1766
1633 The CPU and wall clock times are printed, and the value of the
1767 The CPU and wall clock times are printed, and the value of the
1634 expression (if any) is returned. Note that under Win32, system time
1768 expression (if any) is returned. Note that under Win32, system time
1635 is always reported as 0, since it can not be measured.
1769 is always reported as 0, since it can not be measured.
1636
1770
1637 This function provides very basic timing functionality. In Python
1771 This function provides very basic timing functionality. In Python
1638 2.3, the timeit module offers more control and sophistication, so this
1772 2.3, the timeit module offers more control and sophistication, so this
1639 could be rewritten to use it (patches welcome).
1773 could be rewritten to use it (patches welcome).
1640
1774
1641 Some examples:
1775 Some examples:
1642
1776
1643 In [1]: time 2**128
1777 In [1]: time 2**128
1644 CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s
1778 CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s
1645 Wall time: 0.00
1779 Wall time: 0.00
1646 Out[1]: 340282366920938463463374607431768211456L
1780 Out[1]: 340282366920938463463374607431768211456L
1647
1781
1648 In [2]: n = 1000000
1782 In [2]: n = 1000000
1649
1783
1650 In [3]: time sum(range(n))
1784 In [3]: time sum(range(n))
1651 CPU times: user 1.20 s, sys: 0.05 s, total: 1.25 s
1785 CPU times: user 1.20 s, sys: 0.05 s, total: 1.25 s
1652 Wall time: 1.37
1786 Wall time: 1.37
1653 Out[3]: 499999500000L
1787 Out[3]: 499999500000L
1654
1788
1655 In [4]: time print 'hello world'
1789 In [4]: time print 'hello world'
1656 hello world
1790 hello world
1657 CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s
1791 CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s
1658 Wall time: 0.00
1792 Wall time: 0.00
1659 """
1793 """
1660
1794
1661 # fail immediately if the given expression can't be compiled
1795 # fail immediately if the given expression can't be compiled
1662
1796
1663 expr = self.shell.prefilter(parameter_s,False)
1797 expr = self.shell.prefilter(parameter_s,False)
1664
1798
1665 try:
1799 try:
1666 mode = 'eval'
1800 mode = 'eval'
1667 code = compile(expr,'<timed eval>',mode)
1801 code = compile(expr,'<timed eval>',mode)
1668 except SyntaxError:
1802 except SyntaxError:
1669 mode = 'exec'
1803 mode = 'exec'
1670 code = compile(expr,'<timed exec>',mode)
1804 code = compile(expr,'<timed exec>',mode)
1671 # skew measurement as little as possible
1805 # skew measurement as little as possible
1672 glob = self.shell.user_ns
1806 glob = self.shell.user_ns
1673 clk = clock2
1807 clk = clock2
1674 wtime = time.time
1808 wtime = time.time
1675 # time execution
1809 # time execution
1676 wall_st = wtime()
1810 wall_st = wtime()
1677 if mode=='eval':
1811 if mode=='eval':
1678 st = clk()
1812 st = clk()
1679 out = eval(code,glob)
1813 out = eval(code,glob)
1680 end = clk()
1814 end = clk()
1681 else:
1815 else:
1682 st = clk()
1816 st = clk()
1683 exec code in glob
1817 exec code in glob
1684 end = clk()
1818 end = clk()
1685 out = None
1819 out = None
1686 wall_end = wtime()
1820 wall_end = wtime()
1687 # Compute actual times and report
1821 # Compute actual times and report
1688 wall_time = wall_end-wall_st
1822 wall_time = wall_end-wall_st
1689 cpu_user = end[0]-st[0]
1823 cpu_user = end[0]-st[0]
1690 cpu_sys = end[1]-st[1]
1824 cpu_sys = end[1]-st[1]
1691 cpu_tot = cpu_user+cpu_sys
1825 cpu_tot = cpu_user+cpu_sys
1692 print "CPU times: user %.2f s, sys: %.2f s, total: %.2f s" % \
1826 print "CPU times: user %.2f s, sys: %.2f s, total: %.2f s" % \
1693 (cpu_user,cpu_sys,cpu_tot)
1827 (cpu_user,cpu_sys,cpu_tot)
1694 print "Wall time: %.2f" % wall_time
1828 print "Wall time: %.2f" % wall_time
1695 return out
1829 return out
1696
1830
1697 def magic_macro(self,parameter_s = ''):
1831 def magic_macro(self,parameter_s = ''):
1698 """Define a set of input lines as a macro for future re-execution.
1832 """Define a set of input lines as a macro for future re-execution.
1699
1833
1700 Usage:\\
1834 Usage:\\
1701 %macro [options] name n1-n2 n3-n4 ... n5 .. n6 ...
1835 %macro [options] name n1-n2 n3-n4 ... n5 .. n6 ...
1702
1836
1703 Options:
1837 Options:
1704
1838
1705 -r: use 'raw' input. By default, the 'processed' history is used,
1839 -r: use 'raw' input. By default, the 'processed' history is used,
1706 so that magics are loaded in their transformed version to valid
1840 so that magics are loaded in their transformed version to valid
1707 Python. If this option is given, the raw input as typed as the
1841 Python. If this option is given, the raw input as typed as the
1708 command line is used instead.
1842 command line is used instead.
1709
1843
1710 This will define a global variable called `name` which is a string
1844 This will define a global variable called `name` which is a string
1711 made of joining the slices and lines you specify (n1,n2,... numbers
1845 made of joining the slices and lines you specify (n1,n2,... numbers
1712 above) from your input history into a single string. This variable
1846 above) from your input history into a single string. This variable
1713 acts like an automatic function which re-executes those lines as if
1847 acts like an automatic function which re-executes those lines as if
1714 you had typed them. You just type 'name' at the prompt and the code
1848 you had typed them. You just type 'name' at the prompt and the code
1715 executes.
1849 executes.
1716
1850
1717 The notation for indicating number ranges is: n1-n2 means 'use line
1851 The notation for indicating number ranges is: n1-n2 means 'use line
1718 numbers n1,...n2' (the endpoint is included). That is, '5-7' means
1852 numbers n1,...n2' (the endpoint is included). That is, '5-7' means
1719 using the lines numbered 5,6 and 7.
1853 using the lines numbered 5,6 and 7.
1720
1854
1721 Note: as a 'hidden' feature, you can also use traditional python slice
1855 Note: as a 'hidden' feature, you can also use traditional python slice
1722 notation, where N:M means numbers N through M-1.
1856 notation, where N:M means numbers N through M-1.
1723
1857
1724 For example, if your history contains (%hist prints it):
1858 For example, if your history contains (%hist prints it):
1725
1859
1726 44: x=1\\
1860 44: x=1\\
1727 45: y=3\\
1861 45: y=3\\
1728 46: z=x+y\\
1862 46: z=x+y\\
1729 47: print x\\
1863 47: print x\\
1730 48: a=5\\
1864 48: a=5\\
1731 49: print 'x',x,'y',y\\
1865 49: print 'x',x,'y',y\\
1732
1866
1733 you can create a macro with lines 44 through 47 (included) and line 49
1867 you can create a macro with lines 44 through 47 (included) and line 49
1734 called my_macro with:
1868 called my_macro with:
1735
1869
1736 In [51]: %macro my_macro 44-47 49
1870 In [51]: %macro my_macro 44-47 49
1737
1871
1738 Now, typing `my_macro` (without quotes) will re-execute all this code
1872 Now, typing `my_macro` (without quotes) will re-execute all this code
1739 in one pass.
1873 in one pass.
1740
1874
1741 You don't need to give the line-numbers in order, and any given line
1875 You don't need to give the line-numbers in order, and any given line
1742 number can appear multiple times. You can assemble macros with any
1876 number can appear multiple times. You can assemble macros with any
1743 lines from your input history in any order.
1877 lines from your input history in any order.
1744
1878
1745 The macro is a simple object which holds its value in an attribute,
1879 The macro is a simple object which holds its value in an attribute,
1746 but IPython's display system checks for macros and executes them as
1880 but IPython's display system checks for macros and executes them as
1747 code instead of printing them when you type their name.
1881 code instead of printing them when you type their name.
1748
1882
1749 You can view a macro's contents by explicitly printing it with:
1883 You can view a macro's contents by explicitly printing it with:
1750
1884
1751 'print macro_name'.
1885 'print macro_name'.
1752
1886
1753 For one-off cases which DON'T contain magic function calls in them you
1887 For one-off cases which DON'T contain magic function calls in them you
1754 can obtain similar results by explicitly executing slices from your
1888 can obtain similar results by explicitly executing slices from your
1755 input history with:
1889 input history with:
1756
1890
1757 In [60]: exec In[44:48]+In[49]"""
1891 In [60]: exec In[44:48]+In[49]"""
1758
1892
1759 opts,args = self.parse_options(parameter_s,'r',mode='list')
1893 opts,args = self.parse_options(parameter_s,'r',mode='list')
1760 if not args:
1894 if not args:
1761 macs = [k for k,v in self.shell.user_ns.items() if isinstance(v, Macro)]
1895 macs = [k for k,v in self.shell.user_ns.items() if isinstance(v, Macro)]
1762 macs.sort()
1896 macs.sort()
1763 return macs
1897 return macs
1764 name,ranges = args[0], args[1:]
1898 name,ranges = args[0], args[1:]
1765 #print 'rng',ranges # dbg
1899 #print 'rng',ranges # dbg
1766 lines = self.extract_input_slices(ranges,opts.has_key('r'))
1900 lines = self.extract_input_slices(ranges,opts.has_key('r'))
1767 macro = Macro(lines)
1901 macro = Macro(lines)
1768 self.shell.user_ns.update({name:macro})
1902 self.shell.user_ns.update({name:macro})
1769 print 'Macro `%s` created. To execute, type its name (without quotes).' % name
1903 print 'Macro `%s` created. To execute, type its name (without quotes).' % name
1770 print 'Macro contents:'
1904 print 'Macro contents:'
1771 print macro,
1905 print macro,
1772
1906
1773 def magic_save(self,parameter_s = ''):
1907 def magic_save(self,parameter_s = ''):
1774 """Save a set of lines to a given filename.
1908 """Save a set of lines to a given filename.
1775
1909
1776 Usage:\\
1910 Usage:\\
1777 %save [options] filename n1-n2 n3-n4 ... n5 .. n6 ...
1911 %save [options] filename n1-n2 n3-n4 ... n5 .. n6 ...
1778
1912
1779 Options:
1913 Options:
1780
1914
1781 -r: use 'raw' input. By default, the 'processed' history is used,
1915 -r: use 'raw' input. By default, the 'processed' history is used,
1782 so that magics are loaded in their transformed version to valid
1916 so that magics are loaded in their transformed version to valid
1783 Python. If this option is given, the raw input as typed as the
1917 Python. If this option is given, the raw input as typed as the
1784 command line is used instead.
1918 command line is used instead.
1785
1919
1786 This function uses the same syntax as %macro for line extraction, but
1920 This function uses the same syntax as %macro for line extraction, but
1787 instead of creating a macro it saves the resulting string to the
1921 instead of creating a macro it saves the resulting string to the
1788 filename you specify.
1922 filename you specify.
1789
1923
1790 It adds a '.py' extension to the file if you don't do so yourself, and
1924 It adds a '.py' extension to the file if you don't do so yourself, and
1791 it asks for confirmation before overwriting existing files."""
1925 it asks for confirmation before overwriting existing files."""
1792
1926
1793 opts,args = self.parse_options(parameter_s,'r',mode='list')
1927 opts,args = self.parse_options(parameter_s,'r',mode='list')
1794 fname,ranges = args[0], args[1:]
1928 fname,ranges = args[0], args[1:]
1795 if not fname.endswith('.py'):
1929 if not fname.endswith('.py'):
1796 fname += '.py'
1930 fname += '.py'
1797 if os.path.isfile(fname):
1931 if os.path.isfile(fname):
1798 ans = raw_input('File `%s` exists. Overwrite (y/[N])? ' % fname)
1932 ans = raw_input('File `%s` exists. Overwrite (y/[N])? ' % fname)
1799 if ans.lower() not in ['y','yes']:
1933 if ans.lower() not in ['y','yes']:
1800 print 'Operation cancelled.'
1934 print 'Operation cancelled.'
1801 return
1935 return
1802 cmds = ''.join(self.extract_input_slices(ranges,opts.has_key('r')))
1936 cmds = ''.join(self.extract_input_slices(ranges,opts.has_key('r')))
1803 f = file(fname,'w')
1937 f = file(fname,'w')
1804 f.write(cmds)
1938 f.write(cmds)
1805 f.close()
1939 f.close()
1806 print 'The following commands were written to file `%s`:' % fname
1940 print 'The following commands were written to file `%s`:' % fname
1807 print cmds
1941 print cmds
1808
1942
1809 def _edit_macro(self,mname,macro):
1943 def _edit_macro(self,mname,macro):
1810 """open an editor with the macro data in a file"""
1944 """open an editor with the macro data in a file"""
1811 filename = self.shell.mktempfile(macro.value)
1945 filename = self.shell.mktempfile(macro.value)
1812 self.shell.hooks.editor(filename)
1946 self.shell.hooks.editor(filename)
1813
1947
1814 # and make a new macro object, to replace the old one
1948 # and make a new macro object, to replace the old one
1815 mfile = open(filename)
1949 mfile = open(filename)
1816 mvalue = mfile.read()
1950 mvalue = mfile.read()
1817 mfile.close()
1951 mfile.close()
1818 self.shell.user_ns[mname] = Macro(mvalue)
1952 self.shell.user_ns[mname] = Macro(mvalue)
1819
1953
1820 def magic_ed(self,parameter_s=''):
1954 def magic_ed(self,parameter_s=''):
1821 """Alias to %edit."""
1955 """Alias to %edit."""
1822 return self.magic_edit(parameter_s)
1956 return self.magic_edit(parameter_s)
1823
1957
1824 def magic_edit(self,parameter_s='',last_call=['','']):
1958 def magic_edit(self,parameter_s='',last_call=['','']):
1825 """Bring up an editor and execute the resulting code.
1959 """Bring up an editor and execute the resulting code.
1826
1960
1827 Usage:
1961 Usage:
1828 %edit [options] [args]
1962 %edit [options] [args]
1829
1963
1830 %edit runs IPython's editor hook. The default version of this hook is
1964 %edit runs IPython's editor hook. The default version of this hook is
1831 set to call the __IPYTHON__.rc.editor command. This is read from your
1965 set to call the __IPYTHON__.rc.editor command. This is read from your
1832 environment variable $EDITOR. If this isn't found, it will default to
1966 environment variable $EDITOR. If this isn't found, it will default to
1833 vi under Linux/Unix and to notepad under Windows. See the end of this
1967 vi under Linux/Unix and to notepad under Windows. See the end of this
1834 docstring for how to change the editor hook.
1968 docstring for how to change the editor hook.
1835
1969
1836 You can also set the value of this editor via the command line option
1970 You can also set the value of this editor via the command line option
1837 '-editor' or in your ipythonrc file. This is useful if you wish to use
1971 '-editor' or in your ipythonrc file. This is useful if you wish to use
1838 specifically for IPython an editor different from your typical default
1972 specifically for IPython an editor different from your typical default
1839 (and for Windows users who typically don't set environment variables).
1973 (and for Windows users who typically don't set environment variables).
1840
1974
1841 This command allows you to conveniently edit multi-line code right in
1975 This command allows you to conveniently edit multi-line code right in
1842 your IPython session.
1976 your IPython session.
1843
1977
1844 If called without arguments, %edit opens up an empty editor with a
1978 If called without arguments, %edit opens up an empty editor with a
1845 temporary file and will execute the contents of this file when you
1979 temporary file and will execute the contents of this file when you
1846 close it (don't forget to save it!).
1980 close it (don't forget to save it!).
1847
1981
1848
1982
1849 Options:
1983 Options:
1850
1984
1851 -n <number>: open the editor at a specified line number. By default,
1985 -n <number>: open the editor at a specified line number. By default,
1852 the IPython editor hook uses the unix syntax 'editor +N filename', but
1986 the IPython editor hook uses the unix syntax 'editor +N filename', but
1853 you can configure this by providing your own modified hook if your
1987 you can configure this by providing your own modified hook if your
1854 favorite editor supports line-number specifications with a different
1988 favorite editor supports line-number specifications with a different
1855 syntax.
1989 syntax.
1856
1990
1857 -p: this will call the editor with the same data as the previous time
1991 -p: this will call the editor with the same data as the previous time
1858 it was used, regardless of how long ago (in your current session) it
1992 it was used, regardless of how long ago (in your current session) it
1859 was.
1993 was.
1860
1994
1861 -r: use 'raw' input. This option only applies to input taken from the
1995 -r: use 'raw' input. This option only applies to input taken from the
1862 user's history. By default, the 'processed' history is used, so that
1996 user's history. By default, the 'processed' history is used, so that
1863 magics are loaded in their transformed version to valid Python. If
1997 magics are loaded in their transformed version to valid Python. If
1864 this option is given, the raw input as typed as the command line is
1998 this option is given, the raw input as typed as the command line is
1865 used instead. When you exit the editor, it will be executed by
1999 used instead. When you exit the editor, it will be executed by
1866 IPython's own processor.
2000 IPython's own processor.
1867
2001
1868 -x: do not execute the edited code immediately upon exit. This is
2002 -x: do not execute the edited code immediately upon exit. This is
1869 mainly useful if you are editing programs which need to be called with
2003 mainly useful if you are editing programs which need to be called with
1870 command line arguments, which you can then do using %run.
2004 command line arguments, which you can then do using %run.
1871
2005
1872
2006
1873 Arguments:
2007 Arguments:
1874
2008
1875 If arguments are given, the following possibilites exist:
2009 If arguments are given, the following possibilites exist:
1876
2010
1877 - The arguments are numbers or pairs of colon-separated numbers (like
2011 - The arguments are numbers or pairs of colon-separated numbers (like
1878 1 4:8 9). These are interpreted as lines of previous input to be
2012 1 4:8 9). These are interpreted as lines of previous input to be
1879 loaded into the editor. The syntax is the same of the %macro command.
2013 loaded into the editor. The syntax is the same of the %macro command.
1880
2014
1881 - If the argument doesn't start with a number, it is evaluated as a
2015 - If the argument doesn't start with a number, it is evaluated as a
1882 variable and its contents loaded into the editor. You can thus edit
2016 variable and its contents loaded into the editor. You can thus edit
1883 any string which contains python code (including the result of
2017 any string which contains python code (including the result of
1884 previous edits).
2018 previous edits).
1885
2019
1886 - If the argument is the name of an object (other than a string),
2020 - If the argument is the name of an object (other than a string),
1887 IPython will try to locate the file where it was defined and open the
2021 IPython will try to locate the file where it was defined and open the
1888 editor at the point where it is defined. You can use `%edit function`
2022 editor at the point where it is defined. You can use `%edit function`
1889 to load an editor exactly at the point where 'function' is defined,
2023 to load an editor exactly at the point where 'function' is defined,
1890 edit it and have the file be executed automatically.
2024 edit it and have the file be executed automatically.
1891
2025
1892 If the object is a macro (see %macro for details), this opens up your
2026 If the object is a macro (see %macro for details), this opens up your
1893 specified editor with a temporary file containing the macro's data.
2027 specified editor with a temporary file containing the macro's data.
1894 Upon exit, the macro is reloaded with the contents of the file.
2028 Upon exit, the macro is reloaded with the contents of the file.
1895
2029
1896 Note: opening at an exact line is only supported under Unix, and some
2030 Note: opening at an exact line is only supported under Unix, and some
1897 editors (like kedit and gedit up to Gnome 2.8) do not understand the
2031 editors (like kedit and gedit up to Gnome 2.8) do not understand the
1898 '+NUMBER' parameter necessary for this feature. Good editors like
2032 '+NUMBER' parameter necessary for this feature. Good editors like
1899 (X)Emacs, vi, jed, pico and joe all do.
2033 (X)Emacs, vi, jed, pico and joe all do.
1900
2034
1901 - If the argument is not found as a variable, IPython will look for a
2035 - If the argument is not found as a variable, IPython will look for a
1902 file with that name (adding .py if necessary) and load it into the
2036 file with that name (adding .py if necessary) and load it into the
1903 editor. It will execute its contents with execfile() when you exit,
2037 editor. It will execute its contents with execfile() when you exit,
1904 loading any code in the file into your interactive namespace.
2038 loading any code in the file into your interactive namespace.
1905
2039
1906 After executing your code, %edit will return as output the code you
2040 After executing your code, %edit will return as output the code you
1907 typed in the editor (except when it was an existing file). This way
2041 typed in the editor (except when it was an existing file). This way
1908 you can reload the code in further invocations of %edit as a variable,
2042 you can reload the code in further invocations of %edit as a variable,
1909 via _<NUMBER> or Out[<NUMBER>], where <NUMBER> is the prompt number of
2043 via _<NUMBER> or Out[<NUMBER>], where <NUMBER> is the prompt number of
1910 the output.
2044 the output.
1911
2045
1912 Note that %edit is also available through the alias %ed.
2046 Note that %edit is also available through the alias %ed.
1913
2047
1914 This is an example of creating a simple function inside the editor and
2048 This is an example of creating a simple function inside the editor and
1915 then modifying it. First, start up the editor:
2049 then modifying it. First, start up the editor:
1916
2050
1917 In [1]: ed\\
2051 In [1]: ed\\
1918 Editing... done. Executing edited code...\\
2052 Editing... done. Executing edited code...\\
1919 Out[1]: 'def foo():\\n print "foo() was defined in an editing session"\\n'
2053 Out[1]: 'def foo():\\n print "foo() was defined in an editing session"\\n'
1920
2054
1921 We can then call the function foo():
2055 We can then call the function foo():
1922
2056
1923 In [2]: foo()\\
2057 In [2]: foo()\\
1924 foo() was defined in an editing session
2058 foo() was defined in an editing session
1925
2059
1926 Now we edit foo. IPython automatically loads the editor with the
2060 Now we edit foo. IPython automatically loads the editor with the
1927 (temporary) file where foo() was previously defined:
2061 (temporary) file where foo() was previously defined:
1928
2062
1929 In [3]: ed foo\\
2063 In [3]: ed foo\\
1930 Editing... done. Executing edited code...
2064 Editing... done. Executing edited code...
1931
2065
1932 And if we call foo() again we get the modified version:
2066 And if we call foo() again we get the modified version:
1933
2067
1934 In [4]: foo()\\
2068 In [4]: foo()\\
1935 foo() has now been changed!
2069 foo() has now been changed!
1936
2070
1937 Here is an example of how to edit a code snippet successive
2071 Here is an example of how to edit a code snippet successive
1938 times. First we call the editor:
2072 times. First we call the editor:
1939
2073
1940 In [8]: ed\\
2074 In [8]: ed\\
1941 Editing... done. Executing edited code...\\
2075 Editing... done. Executing edited code...\\
1942 hello\\
2076 hello\\
1943 Out[8]: "print 'hello'\\n"
2077 Out[8]: "print 'hello'\\n"
1944
2078
1945 Now we call it again with the previous output (stored in _):
2079 Now we call it again with the previous output (stored in _):
1946
2080
1947 In [9]: ed _\\
2081 In [9]: ed _\\
1948 Editing... done. Executing edited code...\\
2082 Editing... done. Executing edited code...\\
1949 hello world\\
2083 hello world\\
1950 Out[9]: "print 'hello world'\\n"
2084 Out[9]: "print 'hello world'\\n"
1951
2085
1952 Now we call it with the output #8 (stored in _8, also as Out[8]):
2086 Now we call it with the output #8 (stored in _8, also as Out[8]):
1953
2087
1954 In [10]: ed _8\\
2088 In [10]: ed _8\\
1955 Editing... done. Executing edited code...\\
2089 Editing... done. Executing edited code...\\
1956 hello again\\
2090 hello again\\
1957 Out[10]: "print 'hello again'\\n"
2091 Out[10]: "print 'hello again'\\n"
1958
2092
1959
2093
1960 Changing the default editor hook:
2094 Changing the default editor hook:
1961
2095
1962 If you wish to write your own editor hook, you can put it in a
2096 If you wish to write your own editor hook, you can put it in a
1963 configuration file which you load at startup time. The default hook
2097 configuration file which you load at startup time. The default hook
1964 is defined in the IPython.hooks module, and you can use that as a
2098 is defined in the IPython.hooks module, and you can use that as a
1965 starting example for further modifications. That file also has
2099 starting example for further modifications. That file also has
1966 general instructions on how to set a new hook for use once you've
2100 general instructions on how to set a new hook for use once you've
1967 defined it."""
2101 defined it."""
1968
2102
1969 # FIXME: This function has become a convoluted mess. It needs a
2103 # FIXME: This function has become a convoluted mess. It needs a
1970 # ground-up rewrite with clean, simple logic.
2104 # ground-up rewrite with clean, simple logic.
1971
2105
1972 def make_filename(arg):
2106 def make_filename(arg):
1973 "Make a filename from the given args"
2107 "Make a filename from the given args"
1974 try:
2108 try:
1975 filename = get_py_filename(arg)
2109 filename = get_py_filename(arg)
1976 except IOError:
2110 except IOError:
1977 if args.endswith('.py'):
2111 if args.endswith('.py'):
1978 filename = arg
2112 filename = arg
1979 else:
2113 else:
1980 filename = None
2114 filename = None
1981 return filename
2115 return filename
1982
2116
1983 # custom exceptions
2117 # custom exceptions
1984 class DataIsObject(Exception): pass
2118 class DataIsObject(Exception): pass
1985
2119
1986 opts,args = self.parse_options(parameter_s,'prxn:')
2120 opts,args = self.parse_options(parameter_s,'prxn:')
1987 # Set a few locals from the options for convenience:
2121 # Set a few locals from the options for convenience:
1988 opts_p = opts.has_key('p')
2122 opts_p = opts.has_key('p')
1989 opts_r = opts.has_key('r')
2123 opts_r = opts.has_key('r')
1990
2124
1991 # Default line number value
2125 # Default line number value
1992 lineno = opts.get('n',None)
2126 lineno = opts.get('n',None)
1993
2127
1994 if opts_p:
2128 if opts_p:
1995 args = '_%s' % last_call[0]
2129 args = '_%s' % last_call[0]
1996 if not self.shell.user_ns.has_key(args):
2130 if not self.shell.user_ns.has_key(args):
1997 args = last_call[1]
2131 args = last_call[1]
1998
2132
1999 # use last_call to remember the state of the previous call, but don't
2133 # use last_call to remember the state of the previous call, but don't
2000 # let it be clobbered by successive '-p' calls.
2134 # let it be clobbered by successive '-p' calls.
2001 try:
2135 try:
2002 last_call[0] = self.shell.outputcache.prompt_count
2136 last_call[0] = self.shell.outputcache.prompt_count
2003 if not opts_p:
2137 if not opts_p:
2004 last_call[1] = parameter_s
2138 last_call[1] = parameter_s
2005 except:
2139 except:
2006 pass
2140 pass
2007
2141
2008 # by default this is done with temp files, except when the given
2142 # by default this is done with temp files, except when the given
2009 # arg is a filename
2143 # arg is a filename
2010 use_temp = 1
2144 use_temp = 1
2011
2145
2012 if re.match(r'\d',args):
2146 if re.match(r'\d',args):
2013 # Mode where user specifies ranges of lines, like in %macro.
2147 # Mode where user specifies ranges of lines, like in %macro.
2014 # This means that you can't edit files whose names begin with
2148 # This means that you can't edit files whose names begin with
2015 # numbers this way. Tough.
2149 # numbers this way. Tough.
2016 ranges = args.split()
2150 ranges = args.split()
2017 data = ''.join(self.extract_input_slices(ranges,opts_r))
2151 data = ''.join(self.extract_input_slices(ranges,opts_r))
2018 elif args.endswith('.py'):
2152 elif args.endswith('.py'):
2019 filename = make_filename(args)
2153 filename = make_filename(args)
2020 data = ''
2154 data = ''
2021 use_temp = 0
2155 use_temp = 0
2022 elif args:
2156 elif args:
2023 try:
2157 try:
2024 # Load the parameter given as a variable. If not a string,
2158 # Load the parameter given as a variable. If not a string,
2025 # process it as an object instead (below)
2159 # process it as an object instead (below)
2026
2160
2027 #print '*** args',args,'type',type(args) # dbg
2161 #print '*** args',args,'type',type(args) # dbg
2028 data = eval(args,self.shell.user_ns)
2162 data = eval(args,self.shell.user_ns)
2029 if not type(data) in StringTypes:
2163 if not type(data) in StringTypes:
2030 raise DataIsObject
2164 raise DataIsObject
2031
2165
2032 except (NameError,SyntaxError):
2166 except (NameError,SyntaxError):
2033 # given argument is not a variable, try as a filename
2167 # given argument is not a variable, try as a filename
2034 filename = make_filename(args)
2168 filename = make_filename(args)
2035 if filename is None:
2169 if filename is None:
2036 warn("Argument given (%s) can't be found as a variable "
2170 warn("Argument given (%s) can't be found as a variable "
2037 "or as a filename." % args)
2171 "or as a filename." % args)
2038 return
2172 return
2039
2173
2040 data = ''
2174 data = ''
2041 use_temp = 0
2175 use_temp = 0
2042 except DataIsObject:
2176 except DataIsObject:
2043
2177
2044 # macros have a special edit function
2178 # macros have a special edit function
2045 if isinstance(data,Macro):
2179 if isinstance(data,Macro):
2046 self._edit_macro(args,data)
2180 self._edit_macro(args,data)
2047 return
2181 return
2048
2182
2049 # For objects, try to edit the file where they are defined
2183 # For objects, try to edit the file where they are defined
2050 try:
2184 try:
2051 filename = inspect.getabsfile(data)
2185 filename = inspect.getabsfile(data)
2052 datafile = 1
2186 datafile = 1
2053 except TypeError:
2187 except TypeError:
2054 filename = make_filename(args)
2188 filename = make_filename(args)
2055 datafile = 1
2189 datafile = 1
2056 warn('Could not find file where `%s` is defined.\n'
2190 warn('Could not find file where `%s` is defined.\n'
2057 'Opening a file named `%s`' % (args,filename))
2191 'Opening a file named `%s`' % (args,filename))
2058 # Now, make sure we can actually read the source (if it was in
2192 # Now, make sure we can actually read the source (if it was in
2059 # a temp file it's gone by now).
2193 # a temp file it's gone by now).
2060 if datafile:
2194 if datafile:
2061 try:
2195 try:
2062 if lineno is None:
2196 if lineno is None:
2063 lineno = inspect.getsourcelines(data)[1]
2197 lineno = inspect.getsourcelines(data)[1]
2064 except IOError:
2198 except IOError:
2065 filename = make_filename(args)
2199 filename = make_filename(args)
2066 if filename is None:
2200 if filename is None:
2067 warn('The file `%s` where `%s` was defined cannot '
2201 warn('The file `%s` where `%s` was defined cannot '
2068 'be read.' % (filename,data))
2202 'be read.' % (filename,data))
2069 return
2203 return
2070 use_temp = 0
2204 use_temp = 0
2071 else:
2205 else:
2072 data = ''
2206 data = ''
2073
2207
2074 if use_temp:
2208 if use_temp:
2075 filename = self.shell.mktempfile(data)
2209 filename = self.shell.mktempfile(data)
2076 print 'IPython will make a temporary file named:',filename
2210 print 'IPython will make a temporary file named:',filename
2077
2211
2078 # do actual editing here
2212 # do actual editing here
2079 print 'Editing...',
2213 print 'Editing...',
2080 sys.stdout.flush()
2214 sys.stdout.flush()
2081 self.shell.hooks.editor(filename,lineno)
2215 self.shell.hooks.editor(filename,lineno)
2082 if opts.has_key('x'): # -x prevents actual execution
2216 if opts.has_key('x'): # -x prevents actual execution
2083 print
2217 print
2084 else:
2218 else:
2085 print 'done. Executing edited code...'
2219 print 'done. Executing edited code...'
2086 if opts_r:
2220 if opts_r:
2087 self.shell.runlines(file_read(filename))
2221 self.shell.runlines(file_read(filename))
2088 else:
2222 else:
2089 self.shell.safe_execfile(filename,self.shell.user_ns,
2223 self.shell.safe_execfile(filename,self.shell.user_ns,
2090 self.shell.user_ns)
2224 self.shell.user_ns)
2091 if use_temp:
2225 if use_temp:
2092 try:
2226 try:
2093 return open(filename).read()
2227 return open(filename).read()
2094 except IOError,msg:
2228 except IOError,msg:
2095 if msg.filename == filename:
2229 if msg.filename == filename:
2096 warn('File not found. Did you forget to save?')
2230 warn('File not found. Did you forget to save?')
2097 return
2231 return
2098 else:
2232 else:
2099 self.shell.showtraceback()
2233 self.shell.showtraceback()
2100
2234
2101 def magic_xmode(self,parameter_s = ''):
2235 def magic_xmode(self,parameter_s = ''):
2102 """Switch modes for the exception handlers.
2236 """Switch modes for the exception handlers.
2103
2237
2104 Valid modes: Plain, Context and Verbose.
2238 Valid modes: Plain, Context and Verbose.
2105
2239
2106 If called without arguments, acts as a toggle."""
2240 If called without arguments, acts as a toggle."""
2107
2241
2108 def xmode_switch_err(name):
2242 def xmode_switch_err(name):
2109 warn('Error changing %s exception modes.\n%s' %
2243 warn('Error changing %s exception modes.\n%s' %
2110 (name,sys.exc_info()[1]))
2244 (name,sys.exc_info()[1]))
2111
2245
2112 shell = self.shell
2246 shell = self.shell
2113 new_mode = parameter_s.strip().capitalize()
2247 new_mode = parameter_s.strip().capitalize()
2114 try:
2248 try:
2115 shell.InteractiveTB.set_mode(mode=new_mode)
2249 shell.InteractiveTB.set_mode(mode=new_mode)
2116 print 'Exception reporting mode:',shell.InteractiveTB.mode
2250 print 'Exception reporting mode:',shell.InteractiveTB.mode
2117 except:
2251 except:
2118 xmode_switch_err('user')
2252 xmode_switch_err('user')
2119
2253
2120 # threaded shells use a special handler in sys.excepthook
2254 # threaded shells use a special handler in sys.excepthook
2121 if shell.isthreaded:
2255 if shell.isthreaded:
2122 try:
2256 try:
2123 shell.sys_excepthook.set_mode(mode=new_mode)
2257 shell.sys_excepthook.set_mode(mode=new_mode)
2124 except:
2258 except:
2125 xmode_switch_err('threaded')
2259 xmode_switch_err('threaded')
2126
2260
2127 def magic_colors(self,parameter_s = ''):
2261 def magic_colors(self,parameter_s = ''):
2128 """Switch color scheme for prompts, info system and exception handlers.
2262 """Switch color scheme for prompts, info system and exception handlers.
2129
2263
2130 Currently implemented schemes: NoColor, Linux, LightBG.
2264 Currently implemented schemes: NoColor, Linux, LightBG.
2131
2265
2132 Color scheme names are not case-sensitive."""
2266 Color scheme names are not case-sensitive."""
2133
2267
2134 def color_switch_err(name):
2268 def color_switch_err(name):
2135 warn('Error changing %s color schemes.\n%s' %
2269 warn('Error changing %s color schemes.\n%s' %
2136 (name,sys.exc_info()[1]))
2270 (name,sys.exc_info()[1]))
2137
2271
2138
2272
2139 new_scheme = parameter_s.strip()
2273 new_scheme = parameter_s.strip()
2140 if not new_scheme:
2274 if not new_scheme:
2141 print 'You must specify a color scheme.'
2275 print 'You must specify a color scheme.'
2142 return
2276 return
2143 # local shortcut
2277 # local shortcut
2144 shell = self.shell
2278 shell = self.shell
2145
2279
2146 import IPython.rlineimpl as readline
2280 import IPython.rlineimpl as readline
2147
2281
2148 if not readline.have_readline and sys.platform == "win32":
2282 if not readline.have_readline and sys.platform == "win32":
2149 msg = """\
2283 msg = """\
2150 Proper color support under MS Windows requires the pyreadline library.
2284 Proper color support under MS Windows requires the pyreadline library.
2151 You can find it at:
2285 You can find it at:
2152 http://ipython.scipy.org/moin/PyReadline/Intro
2286 http://ipython.scipy.org/moin/PyReadline/Intro
2153 Gary's readline needs the ctypes module, from:
2287 Gary's readline needs the ctypes module, from:
2154 http://starship.python.net/crew/theller/ctypes
2288 http://starship.python.net/crew/theller/ctypes
2155 (Note that ctypes is already part of Python versions 2.5 and newer).
2289 (Note that ctypes is already part of Python versions 2.5 and newer).
2156
2290
2157 Defaulting color scheme to 'NoColor'"""
2291 Defaulting color scheme to 'NoColor'"""
2158 new_scheme = 'NoColor'
2292 new_scheme = 'NoColor'
2159 warn(msg)
2293 warn(msg)
2160
2294
2161 # readline option is 0
2295 # readline option is 0
2162 if not shell.has_readline:
2296 if not shell.has_readline:
2163 new_scheme = 'NoColor'
2297 new_scheme = 'NoColor'
2164
2298
2165 # Set prompt colors
2299 # Set prompt colors
2166 try:
2300 try:
2167 shell.outputcache.set_colors(new_scheme)
2301 shell.outputcache.set_colors(new_scheme)
2168 except:
2302 except:
2169 color_switch_err('prompt')
2303 color_switch_err('prompt')
2170 else:
2304 else:
2171 shell.rc.colors = \
2305 shell.rc.colors = \
2172 shell.outputcache.color_table.active_scheme_name
2306 shell.outputcache.color_table.active_scheme_name
2173 # Set exception colors
2307 # Set exception colors
2174 try:
2308 try:
2175 shell.InteractiveTB.set_colors(scheme = new_scheme)
2309 shell.InteractiveTB.set_colors(scheme = new_scheme)
2176 shell.SyntaxTB.set_colors(scheme = new_scheme)
2310 shell.SyntaxTB.set_colors(scheme = new_scheme)
2177 except:
2311 except:
2178 color_switch_err('exception')
2312 color_switch_err('exception')
2179
2313
2180 # threaded shells use a verbose traceback in sys.excepthook
2314 # threaded shells use a verbose traceback in sys.excepthook
2181 if shell.isthreaded:
2315 if shell.isthreaded:
2182 try:
2316 try:
2183 shell.sys_excepthook.set_colors(scheme=new_scheme)
2317 shell.sys_excepthook.set_colors(scheme=new_scheme)
2184 except:
2318 except:
2185 color_switch_err('system exception handler')
2319 color_switch_err('system exception handler')
2186
2320
2187 # Set info (for 'object?') colors
2321 # Set info (for 'object?') colors
2188 if shell.rc.color_info:
2322 if shell.rc.color_info:
2189 try:
2323 try:
2190 shell.inspector.set_active_scheme(new_scheme)
2324 shell.inspector.set_active_scheme(new_scheme)
2191 except:
2325 except:
2192 color_switch_err('object inspector')
2326 color_switch_err('object inspector')
2193 else:
2327 else:
2194 shell.inspector.set_active_scheme('NoColor')
2328 shell.inspector.set_active_scheme('NoColor')
2195
2329
2196 def magic_color_info(self,parameter_s = ''):
2330 def magic_color_info(self,parameter_s = ''):
2197 """Toggle color_info.
2331 """Toggle color_info.
2198
2332
2199 The color_info configuration parameter controls whether colors are
2333 The color_info configuration parameter controls whether colors are
2200 used for displaying object details (by things like %psource, %pfile or
2334 used for displaying object details (by things like %psource, %pfile or
2201 the '?' system). This function toggles this value with each call.
2335 the '?' system). This function toggles this value with each call.
2202
2336
2203 Note that unless you have a fairly recent pager (less works better
2337 Note that unless you have a fairly recent pager (less works better
2204 than more) in your system, using colored object information displays
2338 than more) in your system, using colored object information displays
2205 will not work properly. Test it and see."""
2339 will not work properly. Test it and see."""
2206
2340
2207 self.shell.rc.color_info = 1 - self.shell.rc.color_info
2341 self.shell.rc.color_info = 1 - self.shell.rc.color_info
2208 self.magic_colors(self.shell.rc.colors)
2342 self.magic_colors(self.shell.rc.colors)
2209 print 'Object introspection functions have now coloring:',
2343 print 'Object introspection functions have now coloring:',
2210 print ['OFF','ON'][self.shell.rc.color_info]
2344 print ['OFF','ON'][self.shell.rc.color_info]
2211
2345
2212 def magic_Pprint(self, parameter_s=''):
2346 def magic_Pprint(self, parameter_s=''):
2213 """Toggle pretty printing on/off."""
2347 """Toggle pretty printing on/off."""
2214
2348
2215 self.shell.rc.pprint = 1 - self.shell.rc.pprint
2349 self.shell.rc.pprint = 1 - self.shell.rc.pprint
2216 print 'Pretty printing has been turned', \
2350 print 'Pretty printing has been turned', \
2217 ['OFF','ON'][self.shell.rc.pprint]
2351 ['OFF','ON'][self.shell.rc.pprint]
2218
2352
2219 def magic_exit(self, parameter_s=''):
2353 def magic_exit(self, parameter_s=''):
2220 """Exit IPython, confirming if configured to do so.
2354 """Exit IPython, confirming if configured to do so.
2221
2355
2222 You can configure whether IPython asks for confirmation upon exit by
2356 You can configure whether IPython asks for confirmation upon exit by
2223 setting the confirm_exit flag in the ipythonrc file."""
2357 setting the confirm_exit flag in the ipythonrc file."""
2224
2358
2225 self.shell.exit()
2359 self.shell.exit()
2226
2360
2227 def magic_quit(self, parameter_s=''):
2361 def magic_quit(self, parameter_s=''):
2228 """Exit IPython, confirming if configured to do so (like %exit)"""
2362 """Exit IPython, confirming if configured to do so (like %exit)"""
2229
2363
2230 self.shell.exit()
2364 self.shell.exit()
2231
2365
2232 def magic_Exit(self, parameter_s=''):
2366 def magic_Exit(self, parameter_s=''):
2233 """Exit IPython without confirmation."""
2367 """Exit IPython without confirmation."""
2234
2368
2235 self.shell.exit_now = True
2369 self.shell.exit_now = True
2236
2370
2237 #......................................................................
2371 #......................................................................
2238 # Functions to implement unix shell-type things
2372 # Functions to implement unix shell-type things
2239
2373
2240 def magic_alias(self, parameter_s = ''):
2374 def magic_alias(self, parameter_s = ''):
2241 """Define an alias for a system command.
2375 """Define an alias for a system command.
2242
2376
2243 '%alias alias_name cmd' defines 'alias_name' as an alias for 'cmd'
2377 '%alias alias_name cmd' defines 'alias_name' as an alias for 'cmd'
2244
2378
2245 Then, typing 'alias_name params' will execute the system command 'cmd
2379 Then, typing 'alias_name params' will execute the system command 'cmd
2246 params' (from your underlying operating system).
2380 params' (from your underlying operating system).
2247
2381
2248 Aliases have lower precedence than magic functions and Python normal
2382 Aliases have lower precedence than magic functions and Python normal
2249 variables, so if 'foo' is both a Python variable and an alias, the
2383 variables, so if 'foo' is both a Python variable and an alias, the
2250 alias can not be executed until 'del foo' removes the Python variable.
2384 alias can not be executed until 'del foo' removes the Python variable.
2251
2385
2252 You can use the %l specifier in an alias definition to represent the
2386 You can use the %l specifier in an alias definition to represent the
2253 whole line when the alias is called. For example:
2387 whole line when the alias is called. For example:
2254
2388
2255 In [2]: alias all echo "Input in brackets: <%l>"\\
2389 In [2]: alias all echo "Input in brackets: <%l>"\\
2256 In [3]: all hello world\\
2390 In [3]: all hello world\\
2257 Input in brackets: <hello world>
2391 Input in brackets: <hello world>
2258
2392
2259 You can also define aliases with parameters using %s specifiers (one
2393 You can also define aliases with parameters using %s specifiers (one
2260 per parameter):
2394 per parameter):
2261
2395
2262 In [1]: alias parts echo first %s second %s\\
2396 In [1]: alias parts echo first %s second %s\\
2263 In [2]: %parts A B\\
2397 In [2]: %parts A B\\
2264 first A second B\\
2398 first A second B\\
2265 In [3]: %parts A\\
2399 In [3]: %parts A\\
2266 Incorrect number of arguments: 2 expected.\\
2400 Incorrect number of arguments: 2 expected.\\
2267 parts is an alias to: 'echo first %s second %s'
2401 parts is an alias to: 'echo first %s second %s'
2268
2402
2269 Note that %l and %s are mutually exclusive. You can only use one or
2403 Note that %l and %s are mutually exclusive. You can only use one or
2270 the other in your aliases.
2404 the other in your aliases.
2271
2405
2272 Aliases expand Python variables just like system calls using ! or !!
2406 Aliases expand Python variables just like system calls using ! or !!
2273 do: all expressions prefixed with '$' get expanded. For details of
2407 do: all expressions prefixed with '$' get expanded. For details of
2274 the semantic rules, see PEP-215:
2408 the semantic rules, see PEP-215:
2275 http://www.python.org/peps/pep-0215.html. This is the library used by
2409 http://www.python.org/peps/pep-0215.html. This is the library used by
2276 IPython for variable expansion. If you want to access a true shell
2410 IPython for variable expansion. If you want to access a true shell
2277 variable, an extra $ is necessary to prevent its expansion by IPython:
2411 variable, an extra $ is necessary to prevent its expansion by IPython:
2278
2412
2279 In [6]: alias show echo\\
2413 In [6]: alias show echo\\
2280 In [7]: PATH='A Python string'\\
2414 In [7]: PATH='A Python string'\\
2281 In [8]: show $PATH\\
2415 In [8]: show $PATH\\
2282 A Python string\\
2416 A Python string\\
2283 In [9]: show $$PATH\\
2417 In [9]: show $$PATH\\
2284 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
2418 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
2285
2419
2286 You can use the alias facility to acess all of $PATH. See the %rehash
2420 You can use the alias facility to acess all of $PATH. See the %rehash
2287 and %rehashx functions, which automatically create aliases for the
2421 and %rehashx functions, which automatically create aliases for the
2288 contents of your $PATH.
2422 contents of your $PATH.
2289
2423
2290 If called with no parameters, %alias prints the current alias table."""
2424 If called with no parameters, %alias prints the current alias table."""
2291
2425
2292 par = parameter_s.strip()
2426 par = parameter_s.strip()
2293 if not par:
2427 if not par:
2294 stored = self.db.get('stored_aliases', {} )
2428 stored = self.db.get('stored_aliases', {} )
2295 atab = self.shell.alias_table
2429 atab = self.shell.alias_table
2296 aliases = atab.keys()
2430 aliases = atab.keys()
2297 aliases.sort()
2431 aliases.sort()
2298 res = []
2432 res = []
2299 showlast = []
2433 showlast = []
2300 for alias in aliases:
2434 for alias in aliases:
2301 special = False
2435 special = False
2302 try:
2436 try:
2303 tgt = atab[alias][1]
2437 tgt = atab[alias][1]
2304 except (TypeError, AttributeError):
2438 except (TypeError, AttributeError):
2305 # unsubscriptable? probably a callable
2439 # unsubscriptable? probably a callable
2306 tgt = atab[alias]
2440 tgt = atab[alias]
2307 special = True
2441 special = True
2308 # 'interesting' aliases
2442 # 'interesting' aliases
2309 if (alias in stored or
2443 if (alias in stored or
2310 special or
2444 special or
2311 alias.lower() != os.path.splitext(tgt)[0].lower() or
2445 alias.lower() != os.path.splitext(tgt)[0].lower() or
2312 ' ' in tgt):
2446 ' ' in tgt):
2313 showlast.append((alias, tgt))
2447 showlast.append((alias, tgt))
2314 else:
2448 else:
2315 res.append((alias, tgt ))
2449 res.append((alias, tgt ))
2316
2450
2317 # show most interesting aliases last
2451 # show most interesting aliases last
2318 res.extend(showlast)
2452 res.extend(showlast)
2319 print "Total number of aliases:",len(aliases)
2453 print "Total number of aliases:",len(aliases)
2320 return res
2454 return res
2321 try:
2455 try:
2322 alias,cmd = par.split(None,1)
2456 alias,cmd = par.split(None,1)
2323 except:
2457 except:
2324 print OInspect.getdoc(self.magic_alias)
2458 print OInspect.getdoc(self.magic_alias)
2325 else:
2459 else:
2326 nargs = cmd.count('%s')
2460 nargs = cmd.count('%s')
2327 if nargs>0 and cmd.find('%l')>=0:
2461 if nargs>0 and cmd.find('%l')>=0:
2328 error('The %s and %l specifiers are mutually exclusive '
2462 error('The %s and %l specifiers are mutually exclusive '
2329 'in alias definitions.')
2463 'in alias definitions.')
2330 else: # all looks OK
2464 else: # all looks OK
2331 self.shell.alias_table[alias] = (nargs,cmd)
2465 self.shell.alias_table[alias] = (nargs,cmd)
2332 self.shell.alias_table_validate(verbose=0)
2466 self.shell.alias_table_validate(verbose=0)
2333 # end magic_alias
2467 # end magic_alias
2334
2468
2335 def magic_unalias(self, parameter_s = ''):
2469 def magic_unalias(self, parameter_s = ''):
2336 """Remove an alias"""
2470 """Remove an alias"""
2337
2471
2338 aname = parameter_s.strip()
2472 aname = parameter_s.strip()
2339 if aname in self.shell.alias_table:
2473 if aname in self.shell.alias_table:
2340 del self.shell.alias_table[aname]
2474 del self.shell.alias_table[aname]
2341 stored = self.db.get('stored_aliases', {} )
2475 stored = self.db.get('stored_aliases', {} )
2342 if aname in stored:
2476 if aname in stored:
2343 print "Removing %stored alias",aname
2477 print "Removing %stored alias",aname
2344 del stored[aname]
2478 del stored[aname]
2345 self.db['stored_aliases'] = stored
2479 self.db['stored_aliases'] = stored
2346
2480
2347
2481
2348 def magic_rehashx(self, parameter_s = ''):
2482 def magic_rehashx(self, parameter_s = ''):
2349 """Update the alias table with all executable files in $PATH.
2483 """Update the alias table with all executable files in $PATH.
2350
2484
2351 This version explicitly checks that every entry in $PATH is a file
2485 This version explicitly checks that every entry in $PATH is a file
2352 with execute access (os.X_OK), so it is much slower than %rehash.
2486 with execute access (os.X_OK), so it is much slower than %rehash.
2353
2487
2354 Under Windows, it checks executability as a match agains a
2488 Under Windows, it checks executability as a match agains a
2355 '|'-separated string of extensions, stored in the IPython config
2489 '|'-separated string of extensions, stored in the IPython config
2356 variable win_exec_ext. This defaults to 'exe|com|bat'.
2490 variable win_exec_ext. This defaults to 'exe|com|bat'.
2357
2491
2358 This function also resets the root module cache of module completer,
2492 This function also resets the root module cache of module completer,
2359 used on slow filesystems.
2493 used on slow filesystems.
2360 """
2494 """
2361
2495
2362
2496
2363 ip = self.api
2497 ip = self.api
2364
2498
2365 # for the benefit of module completer in ipy_completers.py
2499 # for the benefit of module completer in ipy_completers.py
2366 del ip.db['rootmodules']
2500 del ip.db['rootmodules']
2367
2501
2368 path = [os.path.abspath(os.path.expanduser(p)) for p in
2502 path = [os.path.abspath(os.path.expanduser(p)) for p in
2369 os.environ.get('PATH','').split(os.pathsep)]
2503 os.environ.get('PATH','').split(os.pathsep)]
2370 path = filter(os.path.isdir,path)
2504 path = filter(os.path.isdir,path)
2371
2505
2372 alias_table = self.shell.alias_table
2506 alias_table = self.shell.alias_table
2373 syscmdlist = []
2507 syscmdlist = []
2374 if os.name == 'posix':
2508 if os.name == 'posix':
2375 isexec = lambda fname:os.path.isfile(fname) and \
2509 isexec = lambda fname:os.path.isfile(fname) and \
2376 os.access(fname,os.X_OK)
2510 os.access(fname,os.X_OK)
2377 else:
2511 else:
2378
2512
2379 try:
2513 try:
2380 winext = os.environ['pathext'].replace(';','|').replace('.','')
2514 winext = os.environ['pathext'].replace(';','|').replace('.','')
2381 except KeyError:
2515 except KeyError:
2382 winext = 'exe|com|bat|py'
2516 winext = 'exe|com|bat|py'
2383 if 'py' not in winext:
2517 if 'py' not in winext:
2384 winext += '|py'
2518 winext += '|py'
2385 execre = re.compile(r'(.*)\.(%s)$' % winext,re.IGNORECASE)
2519 execre = re.compile(r'(.*)\.(%s)$' % winext,re.IGNORECASE)
2386 isexec = lambda fname:os.path.isfile(fname) and execre.match(fname)
2520 isexec = lambda fname:os.path.isfile(fname) and execre.match(fname)
2387 savedir = os.getcwd()
2521 savedir = os.getcwd()
2388 try:
2522 try:
2389 # write the whole loop for posix/Windows so we don't have an if in
2523 # write the whole loop for posix/Windows so we don't have an if in
2390 # the innermost part
2524 # the innermost part
2391 if os.name == 'posix':
2525 if os.name == 'posix':
2392 for pdir in path:
2526 for pdir in path:
2393 os.chdir(pdir)
2527 os.chdir(pdir)
2394 for ff in os.listdir(pdir):
2528 for ff in os.listdir(pdir):
2395 if isexec(ff) and ff not in self.shell.no_alias:
2529 if isexec(ff) and ff not in self.shell.no_alias:
2396 # each entry in the alias table must be (N,name),
2530 # each entry in the alias table must be (N,name),
2397 # where N is the number of positional arguments of the
2531 # where N is the number of positional arguments of the
2398 # alias.
2532 # alias.
2399 alias_table[ff] = (0,ff)
2533 alias_table[ff] = (0,ff)
2400 syscmdlist.append(ff)
2534 syscmdlist.append(ff)
2401 else:
2535 else:
2402 for pdir in path:
2536 for pdir in path:
2403 os.chdir(pdir)
2537 os.chdir(pdir)
2404 for ff in os.listdir(pdir):
2538 for ff in os.listdir(pdir):
2405 base, ext = os.path.splitext(ff)
2539 base, ext = os.path.splitext(ff)
2406 if isexec(ff) and base not in self.shell.no_alias:
2540 if isexec(ff) and base not in self.shell.no_alias:
2407 if ext.lower() == '.exe':
2541 if ext.lower() == '.exe':
2408 ff = base
2542 ff = base
2409 alias_table[base.lower()] = (0,ff)
2543 alias_table[base.lower()] = (0,ff)
2410 syscmdlist.append(ff)
2544 syscmdlist.append(ff)
2411 # Make sure the alias table doesn't contain keywords or builtins
2545 # Make sure the alias table doesn't contain keywords or builtins
2412 self.shell.alias_table_validate()
2546 self.shell.alias_table_validate()
2413 # Call again init_auto_alias() so we get 'rm -i' and other
2547 # Call again init_auto_alias() so we get 'rm -i' and other
2414 # modified aliases since %rehashx will probably clobber them
2548 # modified aliases since %rehashx will probably clobber them
2415
2549
2416 # no, we don't want them. if %rehashx clobbers them, good,
2550 # no, we don't want them. if %rehashx clobbers them, good,
2417 # we'll probably get better versions
2551 # we'll probably get better versions
2418 # self.shell.init_auto_alias()
2552 # self.shell.init_auto_alias()
2419 db = ip.db
2553 db = ip.db
2420 db['syscmdlist'] = syscmdlist
2554 db['syscmdlist'] = syscmdlist
2421 finally:
2555 finally:
2422 os.chdir(savedir)
2556 os.chdir(savedir)
2423
2557
2424 def magic_pwd(self, parameter_s = ''):
2558 def magic_pwd(self, parameter_s = ''):
2425 """Return the current working directory path."""
2559 """Return the current working directory path."""
2426 return os.getcwd()
2560 return os.getcwd()
2427
2561
2428 def magic_cd(self, parameter_s=''):
2562 def magic_cd(self, parameter_s=''):
2429 """Change the current working directory.
2563 """Change the current working directory.
2430
2564
2431 This command automatically maintains an internal list of directories
2565 This command automatically maintains an internal list of directories
2432 you visit during your IPython session, in the variable _dh. The
2566 you visit during your IPython session, in the variable _dh. The
2433 command %dhist shows this history nicely formatted. You can also
2567 command %dhist shows this history nicely formatted. You can also
2434 do 'cd -<tab>' to see directory history conveniently.
2568 do 'cd -<tab>' to see directory history conveniently.
2435
2569
2436 Usage:
2570 Usage:
2437
2571
2438 cd 'dir': changes to directory 'dir'.
2572 cd 'dir': changes to directory 'dir'.
2439
2573
2440 cd -: changes to the last visited directory.
2574 cd -: changes to the last visited directory.
2441
2575
2442 cd -<n>: changes to the n-th directory in the directory history.
2576 cd -<n>: changes to the n-th directory in the directory history.
2443
2577
2444 cd -b <bookmark_name>: jump to a bookmark set by %bookmark
2578 cd -b <bookmark_name>: jump to a bookmark set by %bookmark
2445 (note: cd <bookmark_name> is enough if there is no
2579 (note: cd <bookmark_name> is enough if there is no
2446 directory <bookmark_name>, but a bookmark with the name exists.)
2580 directory <bookmark_name>, but a bookmark with the name exists.)
2447 'cd -b <tab>' allows you to tab-complete bookmark names.
2581 'cd -b <tab>' allows you to tab-complete bookmark names.
2448
2582
2449 Options:
2583 Options:
2450
2584
2451 -q: quiet. Do not print the working directory after the cd command is
2585 -q: quiet. Do not print the working directory after the cd command is
2452 executed. By default IPython's cd command does print this directory,
2586 executed. By default IPython's cd command does print this directory,
2453 since the default prompts do not display path information.
2587 since the default prompts do not display path information.
2454
2588
2455 Note that !cd doesn't work for this purpose because the shell where
2589 Note that !cd doesn't work for this purpose because the shell where
2456 !command runs is immediately discarded after executing 'command'."""
2590 !command runs is immediately discarded after executing 'command'."""
2457
2591
2458 parameter_s = parameter_s.strip()
2592 parameter_s = parameter_s.strip()
2459 #bkms = self.shell.persist.get("bookmarks",{})
2593 #bkms = self.shell.persist.get("bookmarks",{})
2460
2594
2461 numcd = re.match(r'(-)(\d+)$',parameter_s)
2595 numcd = re.match(r'(-)(\d+)$',parameter_s)
2462 # jump in directory history by number
2596 # jump in directory history by number
2463 if numcd:
2597 if numcd:
2464 nn = int(numcd.group(2))
2598 nn = int(numcd.group(2))
2465 try:
2599 try:
2466 ps = self.shell.user_ns['_dh'][nn]
2600 ps = self.shell.user_ns['_dh'][nn]
2467 except IndexError:
2601 except IndexError:
2468 print 'The requested directory does not exist in history.'
2602 print 'The requested directory does not exist in history.'
2469 return
2603 return
2470 else:
2604 else:
2471 opts = {}
2605 opts = {}
2472 else:
2606 else:
2473 #turn all non-space-escaping backslashes to slashes,
2607 #turn all non-space-escaping backslashes to slashes,
2474 # for c:\windows\directory\names\
2608 # for c:\windows\directory\names\
2475 parameter_s = re.sub(r'\\(?! )','/', parameter_s)
2609 parameter_s = re.sub(r'\\(?! )','/', parameter_s)
2476 opts,ps = self.parse_options(parameter_s,'qb',mode='string')
2610 opts,ps = self.parse_options(parameter_s,'qb',mode='string')
2477 # jump to previous
2611 # jump to previous
2478 if ps == '-':
2612 if ps == '-':
2479 try:
2613 try:
2480 ps = self.shell.user_ns['_dh'][-2]
2614 ps = self.shell.user_ns['_dh'][-2]
2481 except IndexError:
2615 except IndexError:
2482 print 'No previous directory to change to.'
2616 print 'No previous directory to change to.'
2483 return
2617 return
2484 # jump to bookmark if needed
2618 # jump to bookmark if needed
2485 else:
2619 else:
2486 if not os.path.isdir(ps) or opts.has_key('b'):
2620 if not os.path.isdir(ps) or opts.has_key('b'):
2487 bkms = self.db.get('bookmarks', {})
2621 bkms = self.db.get('bookmarks', {})
2488
2622
2489 if bkms.has_key(ps):
2623 if bkms.has_key(ps):
2490 target = bkms[ps]
2624 target = bkms[ps]
2491 print '(bookmark:%s) -> %s' % (ps,target)
2625 print '(bookmark:%s) -> %s' % (ps,target)
2492 ps = target
2626 ps = target
2493 else:
2627 else:
2494 if opts.has_key('b'):
2628 if opts.has_key('b'):
2495 error("Bookmark '%s' not found. "
2629 error("Bookmark '%s' not found. "
2496 "Use '%%bookmark -l' to see your bookmarks." % ps)
2630 "Use '%%bookmark -l' to see your bookmarks." % ps)
2497 return
2631 return
2498
2632
2499 # at this point ps should point to the target dir
2633 # at this point ps should point to the target dir
2500 if ps:
2634 if ps:
2501 try:
2635 try:
2502 os.chdir(os.path.expanduser(ps))
2636 os.chdir(os.path.expanduser(ps))
2503 if self.shell.rc.term_title:
2637 if self.shell.rc.term_title:
2504 #print 'set term title:',self.shell.rc.term_title # dbg
2638 #print 'set term title:',self.shell.rc.term_title # dbg
2505 ttitle = 'IPy ' + abbrev_cwd()
2639 ttitle = 'IPy ' + abbrev_cwd()
2506 platutils.set_term_title(ttitle)
2640 platutils.set_term_title(ttitle)
2507 except OSError:
2641 except OSError:
2508 print sys.exc_info()[1]
2642 print sys.exc_info()[1]
2509 else:
2643 else:
2510 cwd = os.getcwd()
2644 cwd = os.getcwd()
2511 dhist = self.shell.user_ns['_dh']
2645 dhist = self.shell.user_ns['_dh']
2512 dhist.append(cwd)
2646 dhist.append(cwd)
2513 self.db['dhist'] = compress_dhist(dhist)[-100:]
2647 self.db['dhist'] = compress_dhist(dhist)[-100:]
2514
2648
2515 else:
2649 else:
2516 os.chdir(self.shell.home_dir)
2650 os.chdir(self.shell.home_dir)
2517 if self.shell.rc.term_title:
2651 if self.shell.rc.term_title:
2518 platutils.set_term_title("IPy ~")
2652 platutils.set_term_title("IPy ~")
2519 cwd = os.getcwd()
2653 cwd = os.getcwd()
2520 dhist = self.shell.user_ns['_dh']
2654 dhist = self.shell.user_ns['_dh']
2521 dhist.append(cwd)
2655 dhist.append(cwd)
2522 self.db['dhist'] = compress_dhist(dhist)[-100:]
2656 self.db['dhist'] = compress_dhist(dhist)[-100:]
2523 if not 'q' in opts and self.shell.user_ns['_dh']:
2657 if not 'q' in opts and self.shell.user_ns['_dh']:
2524 print self.shell.user_ns['_dh'][-1]
2658 print self.shell.user_ns['_dh'][-1]
2525
2659
2526
2660
2527 def magic_env(self, parameter_s=''):
2661 def magic_env(self, parameter_s=''):
2528 """List environment variables."""
2662 """List environment variables."""
2529
2663
2530 return os.environ.data
2664 return os.environ.data
2531
2665
2532 def magic_pushd(self, parameter_s=''):
2666 def magic_pushd(self, parameter_s=''):
2533 """Place the current dir on stack and change directory.
2667 """Place the current dir on stack and change directory.
2534
2668
2535 Usage:\\
2669 Usage:\\
2536 %pushd ['dirname']
2670 %pushd ['dirname']
2537
2671
2538 %pushd with no arguments does a %pushd to your home directory.
2672 %pushd with no arguments does a %pushd to your home directory.
2539 """
2673 """
2540 if parameter_s == '': parameter_s = '~'
2674 if parameter_s == '': parameter_s = '~'
2541 dir_s = self.shell.dir_stack
2675 dir_s = self.shell.dir_stack
2542 if len(dir_s)>0 and os.path.expanduser(parameter_s) != \
2676 if len(dir_s)>0 and os.path.expanduser(parameter_s) != \
2543 os.path.expanduser(self.shell.dir_stack[0]):
2677 os.path.expanduser(self.shell.dir_stack[0]):
2544 try:
2678 try:
2545 self.magic_cd(parameter_s)
2679 self.magic_cd(parameter_s)
2546 dir_s.insert(0,os.getcwd().replace(self.home_dir,'~'))
2680 dir_s.insert(0,os.getcwd().replace(self.home_dir,'~'))
2547 self.magic_dirs()
2681 self.magic_dirs()
2548 except:
2682 except:
2549 print 'Invalid directory'
2683 print 'Invalid directory'
2550 else:
2684 else:
2551 print 'You are already there!'
2685 print 'You are already there!'
2552
2686
2553 def magic_popd(self, parameter_s=''):
2687 def magic_popd(self, parameter_s=''):
2554 """Change to directory popped off the top of the stack.
2688 """Change to directory popped off the top of the stack.
2555 """
2689 """
2556 if len (self.shell.dir_stack) > 1:
2690 if len (self.shell.dir_stack) > 1:
2557 self.shell.dir_stack.pop(0)
2691 self.shell.dir_stack.pop(0)
2558 self.magic_cd(self.shell.dir_stack[0])
2692 self.magic_cd(self.shell.dir_stack[0])
2559 print self.shell.dir_stack[0]
2693 print self.shell.dir_stack[0]
2560 else:
2694 else:
2561 print "You can't remove the starting directory from the stack:",\
2695 print "You can't remove the starting directory from the stack:",\
2562 self.shell.dir_stack
2696 self.shell.dir_stack
2563
2697
2564 def magic_dirs(self, parameter_s=''):
2698 def magic_dirs(self, parameter_s=''):
2565 """Return the current directory stack."""
2699 """Return the current directory stack."""
2566
2700
2567 return self.shell.dir_stack[:]
2701 return self.shell.dir_stack[:]
2568
2702
2703 def magic_dhist(self, parameter_s=''):
2704 """Print your history of visited directories.
2705
2706 %dhist -> print full history\\
2707 %dhist n -> print last n entries only\\
2708 %dhist n1 n2 -> print entries between n1 and n2 (n1 not included)\\
2709
2710 This history is automatically maintained by the %cd command, and
2711 always available as the global list variable _dh. You can use %cd -<n>
2712 to go to directory number <n>."""
2713
2714 dh = self.shell.user_ns['_dh']
2715 if parameter_s:
2716 try:
2717 args = map(int,parameter_s.split())
2718 except:
2719 self.arg_err(Magic.magic_dhist)
2720 return
2721 if len(args) == 1:
2722 ini,fin = max(len(dh)-(args[0]),0),len(dh)
2723 elif len(args) == 2:
2724 ini,fin = args
2725 else:
2726 self.arg_err(Magic.magic_dhist)
2727 return
2728 else:
2729 ini,fin = 0,len(dh)
2730 nlprint(dh,
2731 header = 'Directory history (kept in _dh)',
2732 start=ini,stop=fin)
2733
2734
2569 def magic_sc(self, parameter_s=''):
2735 def magic_sc(self, parameter_s=''):
2570 """Shell capture - execute a shell command and capture its output.
2736 """Shell capture - execute a shell command and capture its output.
2571
2737
2572 DEPRECATED. Suboptimal, retained for backwards compatibility.
2738 DEPRECATED. Suboptimal, retained for backwards compatibility.
2573
2739
2574 You should use the form 'var = !command' instead. Example:
2740 You should use the form 'var = !command' instead. Example:
2575
2741
2576 "%sc -l myfiles = ls ~" should now be written as
2742 "%sc -l myfiles = ls ~" should now be written as
2577
2743
2578 "myfiles = !ls ~"
2744 "myfiles = !ls ~"
2579
2745
2580 myfiles.s, myfiles.l and myfiles.n still apply as documented
2746 myfiles.s, myfiles.l and myfiles.n still apply as documented
2581 below.
2747 below.
2582
2748
2583 --
2749 --
2584 %sc [options] varname=command
2750 %sc [options] varname=command
2585
2751
2586 IPython will run the given command using commands.getoutput(), and
2752 IPython will run the given command using commands.getoutput(), and
2587 will then update the user's interactive namespace with a variable
2753 will then update the user's interactive namespace with a variable
2588 called varname, containing the value of the call. Your command can
2754 called varname, containing the value of the call. Your command can
2589 contain shell wildcards, pipes, etc.
2755 contain shell wildcards, pipes, etc.
2590
2756
2591 The '=' sign in the syntax is mandatory, and the variable name you
2757 The '=' sign in the syntax is mandatory, and the variable name you
2592 supply must follow Python's standard conventions for valid names.
2758 supply must follow Python's standard conventions for valid names.
2593
2759
2594 (A special format without variable name exists for internal use)
2760 (A special format without variable name exists for internal use)
2595
2761
2596 Options:
2762 Options:
2597
2763
2598 -l: list output. Split the output on newlines into a list before
2764 -l: list output. Split the output on newlines into a list before
2599 assigning it to the given variable. By default the output is stored
2765 assigning it to the given variable. By default the output is stored
2600 as a single string.
2766 as a single string.
2601
2767
2602 -v: verbose. Print the contents of the variable.
2768 -v: verbose. Print the contents of the variable.
2603
2769
2604 In most cases you should not need to split as a list, because the
2770 In most cases you should not need to split as a list, because the
2605 returned value is a special type of string which can automatically
2771 returned value is a special type of string which can automatically
2606 provide its contents either as a list (split on newlines) or as a
2772 provide its contents either as a list (split on newlines) or as a
2607 space-separated string. These are convenient, respectively, either
2773 space-separated string. These are convenient, respectively, either
2608 for sequential processing or to be passed to a shell command.
2774 for sequential processing or to be passed to a shell command.
2609
2775
2610 For example:
2776 For example:
2611
2777
2612 # Capture into variable a
2778 # Capture into variable a
2613 In [9]: sc a=ls *py
2779 In [9]: sc a=ls *py
2614
2780
2615 # a is a string with embedded newlines
2781 # a is a string with embedded newlines
2616 In [10]: a
2782 In [10]: a
2617 Out[10]: 'setup.py\nwin32_manual_post_install.py'
2783 Out[10]: 'setup.py\nwin32_manual_post_install.py'
2618
2784
2619 # which can be seen as a list:
2785 # which can be seen as a list:
2620 In [11]: a.l
2786 In [11]: a.l
2621 Out[11]: ['setup.py', 'win32_manual_post_install.py']
2787 Out[11]: ['setup.py', 'win32_manual_post_install.py']
2622
2788
2623 # or as a whitespace-separated string:
2789 # or as a whitespace-separated string:
2624 In [12]: a.s
2790 In [12]: a.s
2625 Out[12]: 'setup.py win32_manual_post_install.py'
2791 Out[12]: 'setup.py win32_manual_post_install.py'
2626
2792
2627 # a.s is useful to pass as a single command line:
2793 # a.s is useful to pass as a single command line:
2628 In [13]: !wc -l $a.s
2794 In [13]: !wc -l $a.s
2629 146 setup.py
2795 146 setup.py
2630 130 win32_manual_post_install.py
2796 130 win32_manual_post_install.py
2631 276 total
2797 276 total
2632
2798
2633 # while the list form is useful to loop over:
2799 # while the list form is useful to loop over:
2634 In [14]: for f in a.l:
2800 In [14]: for f in a.l:
2635 ....: !wc -l $f
2801 ....: !wc -l $f
2636 ....:
2802 ....:
2637 146 setup.py
2803 146 setup.py
2638 130 win32_manual_post_install.py
2804 130 win32_manual_post_install.py
2639
2805
2640 Similiarly, the lists returned by the -l option are also special, in
2806 Similiarly, the lists returned by the -l option are also special, in
2641 the sense that you can equally invoke the .s attribute on them to
2807 the sense that you can equally invoke the .s attribute on them to
2642 automatically get a whitespace-separated string from their contents:
2808 automatically get a whitespace-separated string from their contents:
2643
2809
2644 In [1]: sc -l b=ls *py
2810 In [1]: sc -l b=ls *py
2645
2811
2646 In [2]: b
2812 In [2]: b
2647 Out[2]: ['setup.py', 'win32_manual_post_install.py']
2813 Out[2]: ['setup.py', 'win32_manual_post_install.py']
2648
2814
2649 In [3]: b.s
2815 In [3]: b.s
2650 Out[3]: 'setup.py win32_manual_post_install.py'
2816 Out[3]: 'setup.py win32_manual_post_install.py'
2651
2817
2652 In summary, both the lists and strings used for ouptut capture have
2818 In summary, both the lists and strings used for ouptut capture have
2653 the following special attributes:
2819 the following special attributes:
2654
2820
2655 .l (or .list) : value as list.
2821 .l (or .list) : value as list.
2656 .n (or .nlstr): value as newline-separated string.
2822 .n (or .nlstr): value as newline-separated string.
2657 .s (or .spstr): value as space-separated string.
2823 .s (or .spstr): value as space-separated string.
2658 """
2824 """
2659
2825
2660 opts,args = self.parse_options(parameter_s,'lv')
2826 opts,args = self.parse_options(parameter_s,'lv')
2661 # Try to get a variable name and command to run
2827 # Try to get a variable name and command to run
2662 try:
2828 try:
2663 # the variable name must be obtained from the parse_options
2829 # the variable name must be obtained from the parse_options
2664 # output, which uses shlex.split to strip options out.
2830 # output, which uses shlex.split to strip options out.
2665 var,_ = args.split('=',1)
2831 var,_ = args.split('=',1)
2666 var = var.strip()
2832 var = var.strip()
2667 # But the the command has to be extracted from the original input
2833 # But the the command has to be extracted from the original input
2668 # parameter_s, not on what parse_options returns, to avoid the
2834 # parameter_s, not on what parse_options returns, to avoid the
2669 # quote stripping which shlex.split performs on it.
2835 # quote stripping which shlex.split performs on it.
2670 _,cmd = parameter_s.split('=',1)
2836 _,cmd = parameter_s.split('=',1)
2671 except ValueError:
2837 except ValueError:
2672 var,cmd = '',''
2838 var,cmd = '',''
2673 # If all looks ok, proceed
2839 # If all looks ok, proceed
2674 out,err = self.shell.getoutputerror(cmd)
2840 out,err = self.shell.getoutputerror(cmd)
2675 if err:
2841 if err:
2676 print >> Term.cerr,err
2842 print >> Term.cerr,err
2677 if opts.has_key('l'):
2843 if opts.has_key('l'):
2678 out = SList(out.split('\n'))
2844 out = SList(out.split('\n'))
2679 else:
2845 else:
2680 out = LSString(out)
2846 out = LSString(out)
2681 if opts.has_key('v'):
2847 if opts.has_key('v'):
2682 print '%s ==\n%s' % (var,pformat(out))
2848 print '%s ==\n%s' % (var,pformat(out))
2683 if var:
2849 if var:
2684 self.shell.user_ns.update({var:out})
2850 self.shell.user_ns.update({var:out})
2685 else:
2851 else:
2686 return out
2852 return out
2687
2853
2688 def magic_sx(self, parameter_s=''):
2854 def magic_sx(self, parameter_s=''):
2689 """Shell execute - run a shell command and capture its output.
2855 """Shell execute - run a shell command and capture its output.
2690
2856
2691 %sx command
2857 %sx command
2692
2858
2693 IPython will run the given command using commands.getoutput(), and
2859 IPython will run the given command using commands.getoutput(), and
2694 return the result formatted as a list (split on '\\n'). Since the
2860 return the result formatted as a list (split on '\\n'). Since the
2695 output is _returned_, it will be stored in ipython's regular output
2861 output is _returned_, it will be stored in ipython's regular output
2696 cache Out[N] and in the '_N' automatic variables.
2862 cache Out[N] and in the '_N' automatic variables.
2697
2863
2698 Notes:
2864 Notes:
2699
2865
2700 1) If an input line begins with '!!', then %sx is automatically
2866 1) If an input line begins with '!!', then %sx is automatically
2701 invoked. That is, while:
2867 invoked. That is, while:
2702 !ls
2868 !ls
2703 causes ipython to simply issue system('ls'), typing
2869 causes ipython to simply issue system('ls'), typing
2704 !!ls
2870 !!ls
2705 is a shorthand equivalent to:
2871 is a shorthand equivalent to:
2706 %sx ls
2872 %sx ls
2707
2873
2708 2) %sx differs from %sc in that %sx automatically splits into a list,
2874 2) %sx differs from %sc in that %sx automatically splits into a list,
2709 like '%sc -l'. The reason for this is to make it as easy as possible
2875 like '%sc -l'. The reason for this is to make it as easy as possible
2710 to process line-oriented shell output via further python commands.
2876 to process line-oriented shell output via further python commands.
2711 %sc is meant to provide much finer control, but requires more
2877 %sc is meant to provide much finer control, but requires more
2712 typing.
2878 typing.
2713
2879
2714 3) Just like %sc -l, this is a list with special attributes:
2880 3) Just like %sc -l, this is a list with special attributes:
2715
2881
2716 .l (or .list) : value as list.
2882 .l (or .list) : value as list.
2717 .n (or .nlstr): value as newline-separated string.
2883 .n (or .nlstr): value as newline-separated string.
2718 .s (or .spstr): value as whitespace-separated string.
2884 .s (or .spstr): value as whitespace-separated string.
2719
2885
2720 This is very useful when trying to use such lists as arguments to
2886 This is very useful when trying to use such lists as arguments to
2721 system commands."""
2887 system commands."""
2722
2888
2723 if parameter_s:
2889 if parameter_s:
2724 out,err = self.shell.getoutputerror(parameter_s)
2890 out,err = self.shell.getoutputerror(parameter_s)
2725 if err:
2891 if err:
2726 print >> Term.cerr,err
2892 print >> Term.cerr,err
2727 return SList(out.split('\n'))
2893 return SList(out.split('\n'))
2728
2894
2729 def magic_bg(self, parameter_s=''):
2895 def magic_bg(self, parameter_s=''):
2730 """Run a job in the background, in a separate thread.
2896 """Run a job in the background, in a separate thread.
2731
2897
2732 For example,
2898 For example,
2733
2899
2734 %bg myfunc(x,y,z=1)
2900 %bg myfunc(x,y,z=1)
2735
2901
2736 will execute 'myfunc(x,y,z=1)' in a background thread. As soon as the
2902 will execute 'myfunc(x,y,z=1)' in a background thread. As soon as the
2737 execution starts, a message will be printed indicating the job
2903 execution starts, a message will be printed indicating the job
2738 number. If your job number is 5, you can use
2904 number. If your job number is 5, you can use
2739
2905
2740 myvar = jobs.result(5) or myvar = jobs[5].result
2906 myvar = jobs.result(5) or myvar = jobs[5].result
2741
2907
2742 to assign this result to variable 'myvar'.
2908 to assign this result to variable 'myvar'.
2743
2909
2744 IPython has a job manager, accessible via the 'jobs' object. You can
2910 IPython has a job manager, accessible via the 'jobs' object. You can
2745 type jobs? to get more information about it, and use jobs.<TAB> to see
2911 type jobs? to get more information about it, and use jobs.<TAB> to see
2746 its attributes. All attributes not starting with an underscore are
2912 its attributes. All attributes not starting with an underscore are
2747 meant for public use.
2913 meant for public use.
2748
2914
2749 In particular, look at the jobs.new() method, which is used to create
2915 In particular, look at the jobs.new() method, which is used to create
2750 new jobs. This magic %bg function is just a convenience wrapper
2916 new jobs. This magic %bg function is just a convenience wrapper
2751 around jobs.new(), for expression-based jobs. If you want to create a
2917 around jobs.new(), for expression-based jobs. If you want to create a
2752 new job with an explicit function object and arguments, you must call
2918 new job with an explicit function object and arguments, you must call
2753 jobs.new() directly.
2919 jobs.new() directly.
2754
2920
2755 The jobs.new docstring also describes in detail several important
2921 The jobs.new docstring also describes in detail several important
2756 caveats associated with a thread-based model for background job
2922 caveats associated with a thread-based model for background job
2757 execution. Type jobs.new? for details.
2923 execution. Type jobs.new? for details.
2758
2924
2759 You can check the status of all jobs with jobs.status().
2925 You can check the status of all jobs with jobs.status().
2760
2926
2761 The jobs variable is set by IPython into the Python builtin namespace.
2927 The jobs variable is set by IPython into the Python builtin namespace.
2762 If you ever declare a variable named 'jobs', you will shadow this
2928 If you ever declare a variable named 'jobs', you will shadow this
2763 name. You can either delete your global jobs variable to regain
2929 name. You can either delete your global jobs variable to regain
2764 access to the job manager, or make a new name and assign it manually
2930 access to the job manager, or make a new name and assign it manually
2765 to the manager (stored in IPython's namespace). For example, to
2931 to the manager (stored in IPython's namespace). For example, to
2766 assign the job manager to the Jobs name, use:
2932 assign the job manager to the Jobs name, use:
2767
2933
2768 Jobs = __builtins__.jobs"""
2934 Jobs = __builtins__.jobs"""
2769
2935
2770 self.shell.jobs.new(parameter_s,self.shell.user_ns)
2936 self.shell.jobs.new(parameter_s,self.shell.user_ns)
2771
2937
2938 def magic_r(self, parameter_s=''):
2939 """Repeat previous input.
2940
2941 If given an argument, repeats the previous command which starts with
2942 the same string, otherwise it just repeats the previous input.
2943
2944 Shell escaped commands (with ! as first character) are not recognized
2945 by this system, only pure python code and magic commands.
2946 """
2947
2948 start = parameter_s.strip()
2949 esc_magic = self.shell.ESC_MAGIC
2950 # Identify magic commands even if automagic is on (which means
2951 # the in-memory version is different from that typed by the user).
2952 if self.shell.rc.automagic:
2953 start_magic = esc_magic+start
2954 else:
2955 start_magic = start
2956 # Look through the input history in reverse
2957 for n in range(len(self.shell.input_hist)-2,0,-1):
2958 input = self.shell.input_hist[n]
2959 # skip plain 'r' lines so we don't recurse to infinity
2960 if input != '_ip.magic("r")\n' and \
2961 (input.startswith(start) or input.startswith(start_magic)):
2962 #print 'match',`input` # dbg
2963 print 'Executing:',input,
2964 self.shell.runlines(input)
2965 return
2966 print 'No previous input matching `%s` found.' % start
2967
2772
2968
2773 def magic_bookmark(self, parameter_s=''):
2969 def magic_bookmark(self, parameter_s=''):
2774 """Manage IPython's bookmark system.
2970 """Manage IPython's bookmark system.
2775
2971
2776 %bookmark <name> - set bookmark to current dir
2972 %bookmark <name> - set bookmark to current dir
2777 %bookmark <name> <dir> - set bookmark to <dir>
2973 %bookmark <name> <dir> - set bookmark to <dir>
2778 %bookmark -l - list all bookmarks
2974 %bookmark -l - list all bookmarks
2779 %bookmark -d <name> - remove bookmark
2975 %bookmark -d <name> - remove bookmark
2780 %bookmark -r - remove all bookmarks
2976 %bookmark -r - remove all bookmarks
2781
2977
2782 You can later on access a bookmarked folder with:
2978 You can later on access a bookmarked folder with:
2783 %cd -b <name>
2979 %cd -b <name>
2784 or simply '%cd <name>' if there is no directory called <name> AND
2980 or simply '%cd <name>' if there is no directory called <name> AND
2785 there is such a bookmark defined.
2981 there is such a bookmark defined.
2786
2982
2787 Your bookmarks persist through IPython sessions, but they are
2983 Your bookmarks persist through IPython sessions, but they are
2788 associated with each profile."""
2984 associated with each profile."""
2789
2985
2790 opts,args = self.parse_options(parameter_s,'drl',mode='list')
2986 opts,args = self.parse_options(parameter_s,'drl',mode='list')
2791 if len(args) > 2:
2987 if len(args) > 2:
2792 error('You can only give at most two arguments')
2988 error('You can only give at most two arguments')
2793 return
2989 return
2794
2990
2795 bkms = self.db.get('bookmarks',{})
2991 bkms = self.db.get('bookmarks',{})
2796
2992
2797 if opts.has_key('d'):
2993 if opts.has_key('d'):
2798 try:
2994 try:
2799 todel = args[0]
2995 todel = args[0]
2800 except IndexError:
2996 except IndexError:
2801 error('You must provide a bookmark to delete')
2997 error('You must provide a bookmark to delete')
2802 else:
2998 else:
2803 try:
2999 try:
2804 del bkms[todel]
3000 del bkms[todel]
2805 except:
3001 except:
2806 error("Can't delete bookmark '%s'" % todel)
3002 error("Can't delete bookmark '%s'" % todel)
2807 elif opts.has_key('r'):
3003 elif opts.has_key('r'):
2808 bkms = {}
3004 bkms = {}
2809 elif opts.has_key('l'):
3005 elif opts.has_key('l'):
2810 bks = bkms.keys()
3006 bks = bkms.keys()
2811 bks.sort()
3007 bks.sort()
2812 if bks:
3008 if bks:
2813 size = max(map(len,bks))
3009 size = max(map(len,bks))
2814 else:
3010 else:
2815 size = 0
3011 size = 0
2816 fmt = '%-'+str(size)+'s -> %s'
3012 fmt = '%-'+str(size)+'s -> %s'
2817 print 'Current bookmarks:'
3013 print 'Current bookmarks:'
2818 for bk in bks:
3014 for bk in bks:
2819 print fmt % (bk,bkms[bk])
3015 print fmt % (bk,bkms[bk])
2820 else:
3016 else:
2821 if not args:
3017 if not args:
2822 error("You must specify the bookmark name")
3018 error("You must specify the bookmark name")
2823 elif len(args)==1:
3019 elif len(args)==1:
2824 bkms[args[0]] = os.getcwd()
3020 bkms[args[0]] = os.getcwd()
2825 elif len(args)==2:
3021 elif len(args)==2:
2826 bkms[args[0]] = args[1]
3022 bkms[args[0]] = args[1]
2827 self.db['bookmarks'] = bkms
3023 self.db['bookmarks'] = bkms
2828
3024
2829 def magic_pycat(self, parameter_s=''):
3025 def magic_pycat(self, parameter_s=''):
2830 """Show a syntax-highlighted file through a pager.
3026 """Show a syntax-highlighted file through a pager.
2831
3027
2832 This magic is similar to the cat utility, but it will assume the file
3028 This magic is similar to the cat utility, but it will assume the file
2833 to be Python source and will show it with syntax highlighting. """
3029 to be Python source and will show it with syntax highlighting. """
2834
3030
2835 try:
3031 try:
2836 filename = get_py_filename(parameter_s)
3032 filename = get_py_filename(parameter_s)
2837 cont = file_read(filename)
3033 cont = file_read(filename)
2838 except IOError:
3034 except IOError:
2839 try:
3035 try:
2840 cont = eval(parameter_s,self.user_ns)
3036 cont = eval(parameter_s,self.user_ns)
2841 except NameError:
3037 except NameError:
2842 cont = None
3038 cont = None
2843 if cont is None:
3039 if cont is None:
2844 print "Error: no such file or variable"
3040 print "Error: no such file or variable"
2845 return
3041 return
2846
3042
2847 page(self.shell.pycolorize(cont),
3043 page(self.shell.pycolorize(cont),
2848 screen_lines=self.shell.rc.screen_length)
3044 screen_lines=self.shell.rc.screen_length)
2849
3045
2850 def magic_cpaste(self, parameter_s=''):
3046 def magic_cpaste(self, parameter_s=''):
2851 """Allows you to paste & execute a pre-formatted code block from clipboard
3047 """Allows you to paste & execute a pre-formatted code block from clipboard
2852
3048
2853 You must terminate the block with '--' (two minus-signs) alone on the
3049 You must terminate the block with '--' (two minus-signs) alone on the
2854 line. You can also provide your own sentinel with '%paste -s %%' ('%%'
3050 line. You can also provide your own sentinel with '%paste -s %%' ('%%'
2855 is the new sentinel for this operation)
3051 is the new sentinel for this operation)
2856
3052
2857 The block is dedented prior to execution to enable execution of method
3053 The block is dedented prior to execution to enable execution of method
2858 definitions. '>' and '+' characters at the beginning of a line are
3054 definitions. '>' and '+' characters at the beginning of a line are
2859 ignored, to allow pasting directly from e-mails or diff files. The
3055 ignored, to allow pasting directly from e-mails or diff files. The
2860 executed block is also assigned to variable named 'pasted_block' for
3056 executed block is also assigned to variable named 'pasted_block' for
2861 later editing with '%edit pasted_block'.
3057 later editing with '%edit pasted_block'.
2862
3058
2863 You can also pass a variable name as an argument, e.g. '%cpaste foo'.
3059 You can also pass a variable name as an argument, e.g. '%cpaste foo'.
2864 This assigns the pasted block to variable 'foo' as string, without
3060 This assigns the pasted block to variable 'foo' as string, without
2865 dedenting or executing it.
3061 dedenting or executing it.
2866
3062
2867 Do not be alarmed by garbled output on Windows (it's a readline bug).
3063 Do not be alarmed by garbled output on Windows (it's a readline bug).
2868 Just press enter and type -- (and press enter again) and the block
3064 Just press enter and type -- (and press enter again) and the block
2869 will be what was just pasted.
3065 will be what was just pasted.
2870
3066
2871 IPython statements (magics, shell escapes) are not supported (yet).
3067 IPython statements (magics, shell escapes) are not supported (yet).
2872 """
3068 """
2873 opts,args = self.parse_options(parameter_s,'s:',mode='string')
3069 opts,args = self.parse_options(parameter_s,'s:',mode='string')
2874 par = args.strip()
3070 par = args.strip()
2875 sentinel = opts.get('s','--')
3071 sentinel = opts.get('s','--')
2876
3072
2877 from IPython import iplib
3073 from IPython import iplib
2878 lines = []
3074 lines = []
2879 print "Pasting code; enter '%s' alone on the line to stop." % sentinel
3075 print "Pasting code; enter '%s' alone on the line to stop." % sentinel
2880 while 1:
3076 while 1:
2881 l = iplib.raw_input_original(':')
3077 l = iplib.raw_input_original(':')
2882 if l ==sentinel:
3078 if l ==sentinel:
2883 break
3079 break
2884 lines.append(l.lstrip('>').lstrip('+'))
3080 lines.append(l.lstrip('>').lstrip('+'))
2885 block = "\n".join(lines) + '\n'
3081 block = "\n".join(lines) + '\n'
2886 #print "block:\n",block
3082 #print "block:\n",block
2887 if not par:
3083 if not par:
2888 b = textwrap.dedent(block)
3084 b = textwrap.dedent(block)
2889 exec b in self.user_ns
3085 exec b in self.user_ns
2890 self.user_ns['pasted_block'] = b
3086 self.user_ns['pasted_block'] = b
2891 else:
3087 else:
2892 self.user_ns[par] = block
3088 self.user_ns[par] = block
2893 print "Block assigned to '%s'" % par
3089 print "Block assigned to '%s'" % par
2894
3090
2895 def magic_quickref(self,arg):
3091 def magic_quickref(self,arg):
2896 """ Show a quick reference sheet """
3092 """ Show a quick reference sheet """
2897 import IPython.usage
3093 import IPython.usage
2898 qr = IPython.usage.quick_reference + self.magic_magic('-brief')
3094 qr = IPython.usage.quick_reference + self.magic_magic('-brief')
2899
3095
2900 page(qr)
3096 page(qr)
2901
3097
2902 def magic_upgrade(self,arg):
3098 def magic_upgrade(self,arg):
2903 """ Upgrade your IPython installation
3099 """ Upgrade your IPython installation
2904
3100
2905 This will copy the config files that don't yet exist in your
3101 This will copy the config files that don't yet exist in your
2906 ipython dir from the system config dir. Use this after upgrading
3102 ipython dir from the system config dir. Use this after upgrading
2907 IPython if you don't wish to delete your .ipython dir.
3103 IPython if you don't wish to delete your .ipython dir.
2908
3104
2909 Call with -nolegacy to get rid of ipythonrc* files (recommended for
3105 Call with -nolegacy to get rid of ipythonrc* files (recommended for
2910 new users)
3106 new users)
2911
3107
2912 """
3108 """
2913 ip = self.getapi()
3109 ip = self.getapi()
2914 ipinstallation = path(IPython.__file__).dirname()
3110 ipinstallation = path(IPython.__file__).dirname()
2915 upgrade_script = '%s "%s"' % (sys.executable,ipinstallation / 'upgrade_dir.py')
3111 upgrade_script = '%s "%s"' % (sys.executable,ipinstallation / 'upgrade_dir.py')
2916 src_config = ipinstallation / 'UserConfig'
3112 src_config = ipinstallation / 'UserConfig'
2917 userdir = path(ip.options.ipythondir)
3113 userdir = path(ip.options.ipythondir)
2918 cmd = '%s "%s" "%s"' % (upgrade_script, src_config, userdir)
3114 cmd = '%s "%s" "%s"' % (upgrade_script, src_config, userdir)
2919 print ">",cmd
3115 print ">",cmd
2920 shell(cmd)
3116 shell(cmd)
2921 if arg == '-nolegacy':
3117 if arg == '-nolegacy':
2922 legacy = userdir.files('ipythonrc*')
3118 legacy = userdir.files('ipythonrc*')
2923 print "Nuking legacy files:",legacy
3119 print "Nuking legacy files:",legacy
2924
3120
2925 [p.remove() for p in legacy]
3121 [p.remove() for p in legacy]
2926 suffix = (sys.platform == 'win32' and '.ini' or '')
3122 suffix = (sys.platform == 'win32' and '.ini' or '')
2927 (userdir / ('ipythonrc' + suffix)).write_text('# Empty, see ipy_user_conf.py\n')
3123 (userdir / ('ipythonrc' + suffix)).write_text('# Empty, see ipy_user_conf.py\n')
2928
3124
2929
3125
2930 def magic_doctest_mode(self,parameter_s=''):
3126 def magic_doctest_mode(self,parameter_s=''):
2931 """Toggle doctest mode on and off.
3127 """Toggle doctest mode on and off.
2932
3128
2933 This mode allows you to toggle the prompt behavior between normal
3129 This mode allows you to toggle the prompt behavior between normal
2934 IPython prompts and ones that are as similar to the default IPython
3130 IPython prompts and ones that are as similar to the default IPython
2935 interpreter as possible.
3131 interpreter as possible.
2936
3132
2937 It also supports the pasting of code snippets that have leading '>>>'
3133 It also supports the pasting of code snippets that have leading '>>>'
2938 and '...' prompts in them. This means that you can paste doctests from
3134 and '...' prompts in them. This means that you can paste doctests from
2939 files or docstrings (even if they have leading whitespace), and the
3135 files or docstrings (even if they have leading whitespace), and the
2940 code will execute correctly. You can then use '%history -tn' to see
3136 code will execute correctly. You can then use '%history -tn' to see
2941 the translated history without line numbers; this will give you the
3137 the translated history without line numbers; this will give you the
2942 input after removal of all the leading prompts and whitespace, which
3138 input after removal of all the leading prompts and whitespace, which
2943 can be pasted back into an editor.
3139 can be pasted back into an editor.
2944
3140
2945 With these features, you can switch into this mode easily whenever you
3141 With these features, you can switch into this mode easily whenever you
2946 need to do testing and changes to doctests, without having to leave
3142 need to do testing and changes to doctests, without having to leave
2947 your existing IPython session.
3143 your existing IPython session.
2948 """
3144 """
2949
3145
2950 # XXX - Fix this to have cleaner activate/deactivate calls.
3146 # XXX - Fix this to have cleaner activate/deactivate calls.
2951 from IPython.Extensions import InterpreterPasteInput as ipaste
3147 from IPython.Extensions import InterpreterPasteInput as ipaste
2952 from IPython.ipstruct import Struct
3148 from IPython.ipstruct import Struct
2953
3149
2954 # Shorthands
3150 # Shorthands
2955 shell = self.shell
3151 shell = self.shell
2956 oc = shell.outputcache
3152 oc = shell.outputcache
2957 rc = shell.rc
3153 rc = shell.rc
2958 meta = shell.meta
3154 meta = shell.meta
2959 # dstore is a data store kept in the instance metadata bag to track any
3155 # dstore is a data store kept in the instance metadata bag to track any
2960 # changes we make, so we can undo them later.
3156 # changes we make, so we can undo them later.
2961 dstore = meta.setdefault('doctest_mode',Struct())
3157 dstore = meta.setdefault('doctest_mode',Struct())
2962 save_dstore = dstore.setdefault
3158 save_dstore = dstore.setdefault
2963
3159
2964 # save a few values we'll need to recover later
3160 # save a few values we'll need to recover later
2965 mode = save_dstore('mode',False)
3161 mode = save_dstore('mode',False)
2966 save_dstore('rc_pprint',rc.pprint)
3162 save_dstore('rc_pprint',rc.pprint)
2967 save_dstore('xmode',shell.InteractiveTB.mode)
3163 save_dstore('xmode',shell.InteractiveTB.mode)
2968 save_dstore('rc_separate_in',rc.separate_in)
3164 save_dstore('rc_separate_in',rc.separate_in)
2969 save_dstore('rc_separate_out',rc.separate_out)
3165 save_dstore('rc_separate_out',rc.separate_out)
2970 save_dstore('rc_separate_out2',rc.separate_out2)
3166 save_dstore('rc_separate_out2',rc.separate_out2)
2971 save_dstore('rc_prompts_pad_left',rc.prompts_pad_left)
3167 save_dstore('rc_prompts_pad_left',rc.prompts_pad_left)
2972
3168
2973 if mode == False:
3169 if mode == False:
2974 # turn on
3170 # turn on
2975 ipaste.activate_prefilter()
3171 ipaste.activate_prefilter()
2976
3172
2977 oc.prompt1.p_template = '>>> '
3173 oc.prompt1.p_template = '>>> '
2978 oc.prompt2.p_template = '... '
3174 oc.prompt2.p_template = '... '
2979 oc.prompt_out.p_template = ''
3175 oc.prompt_out.p_template = ''
2980
3176
2981 oc.prompt1.sep = '\n'
3177 oc.prompt1.sep = '\n'
2982 oc.output_sep = ''
3178 oc.output_sep = ''
2983 oc.output_sep2 = ''
3179 oc.output_sep2 = ''
2984
3180
2985 oc.prompt1.pad_left = oc.prompt2.pad_left = \
3181 oc.prompt1.pad_left = oc.prompt2.pad_left = \
2986 oc.prompt_out.pad_left = False
3182 oc.prompt_out.pad_left = False
2987
3183
2988 rc.pprint = False
3184 rc.pprint = False
2989
3185
2990 shell.magic_xmode('Plain')
3186 shell.magic_xmode('Plain')
2991
3187
2992 else:
3188 else:
2993 # turn off
3189 # turn off
2994 ipaste.deactivate_prefilter()
3190 ipaste.deactivate_prefilter()
2995
3191
2996 oc.prompt1.p_template = rc.prompt_in1
3192 oc.prompt1.p_template = rc.prompt_in1
2997 oc.prompt2.p_template = rc.prompt_in2
3193 oc.prompt2.p_template = rc.prompt_in2
2998 oc.prompt_out.p_template = rc.prompt_out
3194 oc.prompt_out.p_template = rc.prompt_out
2999
3195
3000 oc.prompt1.sep = dstore.rc_separate_in
3196 oc.prompt1.sep = dstore.rc_separate_in
3001 oc.output_sep = dstore.rc_separate_out
3197 oc.output_sep = dstore.rc_separate_out
3002 oc.output_sep2 = dstore.rc_separate_out2
3198 oc.output_sep2 = dstore.rc_separate_out2
3003
3199
3004 oc.prompt1.pad_left = oc.prompt2.pad_left = \
3200 oc.prompt1.pad_left = oc.prompt2.pad_left = \
3005 oc.prompt_out.pad_left = dstore.rc_prompts_pad_left
3201 oc.prompt_out.pad_left = dstore.rc_prompts_pad_left
3006
3202
3007 rc.pprint = dstore.rc_pprint
3203 rc.pprint = dstore.rc_pprint
3008
3204
3009 shell.magic_xmode(dstore.xmode)
3205 shell.magic_xmode(dstore.xmode)
3010
3206
3011 # Store new mode and inform
3207 # Store new mode and inform
3012 dstore.mode = bool(1-int(mode))
3208 dstore.mode = bool(1-int(mode))
3013 print 'Doctest mode is:',
3209 print 'Doctest mode is:',
3014 print ['OFF','ON'][dstore.mode]
3210 print ['OFF','ON'][dstore.mode]
3015
3211
3016 # end Magic
3212 # end Magic
@@ -1,579 +1,577 b''
1 # -*- coding: utf-8 -*-
1 # -*- coding: utf-8 -*-
2 """Tools for inspecting Python objects.
2 """Tools for inspecting Python objects.
3
3
4 Uses syntax highlighting for presenting the various information elements.
4 Uses syntax highlighting for presenting the various information elements.
5
5
6 Similar in spirit to the inspect module, but all calls take a name argument to
6 Similar in spirit to the inspect module, but all calls take a name argument to
7 reference the name under which an object is being read.
7 reference the name under which an object is being read.
8
8
9 $Id: OInspect.py 2717 2007-09-05 19:49:42Z vivainio $
9 $Id: OInspect.py 2723 2007-09-07 07:44:16Z fperez $
10 """
10 """
11
11
12 #*****************************************************************************
12 #*****************************************************************************
13 # Copyright (C) 2001-2004 Fernando Perez <fperez@colorado.edu>
13 # Copyright (C) 2001-2004 Fernando Perez <fperez@colorado.edu>
14 #
14 #
15 # Distributed under the terms of the BSD License. The full license is in
15 # Distributed under the terms of the BSD License. The full license is in
16 # the file COPYING, distributed as part of this software.
16 # the file COPYING, distributed as part of this software.
17 #*****************************************************************************
17 #*****************************************************************************
18
18
19 from IPython import Release
19 from IPython import Release
20 __author__ = '%s <%s>' % Release.authors['Fernando']
20 __author__ = '%s <%s>' % Release.authors['Fernando']
21 __license__ = Release.license
21 __license__ = Release.license
22
22
23 __all__ = ['Inspector','InspectColors']
23 __all__ = ['Inspector','InspectColors']
24
24
25 # stdlib modules
25 # stdlib modules
26 import __builtin__
26 import __builtin__
27 import inspect
27 import inspect
28 import linecache
28 import linecache
29 import string
29 import string
30 import StringIO
30 import StringIO
31 import types
31 import types
32 import os
32 import os
33 import sys
33 import sys
34 # IPython's own
34 # IPython's own
35 from IPython import PyColorize
35 from IPython import PyColorize
36 from IPython.genutils import page,indent,Term,mkdict
36 from IPython.genutils import page,indent,Term,mkdict
37 from IPython.Itpl import itpl
37 from IPython.Itpl import itpl
38 from IPython.wildcard import list_namespace
38 from IPython.wildcard import list_namespace
39 from IPython.ColorANSI import *
39 from IPython.ColorANSI import *
40
40
41 #****************************************************************************
41 #****************************************************************************
42 # HACK!!! This is a crude fix for bugs in python 2.3's inspect module. We
42 # HACK!!! This is a crude fix for bugs in python 2.3's inspect module. We
43 # simply monkeypatch inspect with code copied from python 2.4.
43 # simply monkeypatch inspect with code copied from python 2.4.
44 if sys.version_info[:2] == (2,3):
44 if sys.version_info[:2] == (2,3):
45 from inspect import ismodule, getabsfile, modulesbyfile
45 from inspect import ismodule, getabsfile, modulesbyfile
46 def getmodule(object):
46 def getmodule(object):
47 """Return the module an object was defined in, or None if not found."""
47 """Return the module an object was defined in, or None if not found."""
48 if ismodule(object):
48 if ismodule(object):
49 return object
49 return object
50 if hasattr(object, '__module__'):
50 if hasattr(object, '__module__'):
51 return sys.modules.get(object.__module__)
51 return sys.modules.get(object.__module__)
52 try:
52 try:
53 file = getabsfile(object)
53 file = getabsfile(object)
54 except TypeError:
54 except TypeError:
55 return None
55 return None
56 if file in modulesbyfile:
56 if file in modulesbyfile:
57 return sys.modules.get(modulesbyfile[file])
57 return sys.modules.get(modulesbyfile[file])
58 for module in sys.modules.values():
58 for module in sys.modules.values():
59 if hasattr(module, '__file__'):
59 if hasattr(module, '__file__'):
60 modulesbyfile[
60 modulesbyfile[
61 os.path.realpath(
61 os.path.realpath(
62 getabsfile(module))] = module.__name__
62 getabsfile(module))] = module.__name__
63 if file in modulesbyfile:
63 if file in modulesbyfile:
64 return sys.modules.get(modulesbyfile[file])
64 return sys.modules.get(modulesbyfile[file])
65 main = sys.modules['__main__']
65 main = sys.modules['__main__']
66 if not hasattr(object, '__name__'):
66 if not hasattr(object, '__name__'):
67 return None
67 return None
68 if hasattr(main, object.__name__):
68 if hasattr(main, object.__name__):
69 mainobject = getattr(main, object.__name__)
69 mainobject = getattr(main, object.__name__)
70 if mainobject is object:
70 if mainobject is object:
71 return main
71 return main
72 builtin = sys.modules['__builtin__']
72 builtin = sys.modules['__builtin__']
73 if hasattr(builtin, object.__name__):
73 if hasattr(builtin, object.__name__):
74 builtinobject = getattr(builtin, object.__name__)
74 builtinobject = getattr(builtin, object.__name__)
75 if builtinobject is object:
75 if builtinobject is object:
76 return builtin
76 return builtin
77
77
78 inspect.getmodule = getmodule
78 inspect.getmodule = getmodule
79
79
80 #****************************************************************************
80 #****************************************************************************
81 # Builtin color schemes
81 # Builtin color schemes
82
82
83 Colors = TermColors # just a shorthand
83 Colors = TermColors # just a shorthand
84
84
85 # Build a few color schemes
85 # Build a few color schemes
86 NoColor = ColorScheme(
86 NoColor = ColorScheme(
87 'NoColor',{
87 'NoColor',{
88 'header' : Colors.NoColor,
88 'header' : Colors.NoColor,
89 'normal' : Colors.NoColor # color off (usu. Colors.Normal)
89 'normal' : Colors.NoColor # color off (usu. Colors.Normal)
90 } )
90 } )
91
91
92 LinuxColors = ColorScheme(
92 LinuxColors = ColorScheme(
93 'Linux',{
93 'Linux',{
94 'header' : Colors.LightRed,
94 'header' : Colors.LightRed,
95 'normal' : Colors.Normal # color off (usu. Colors.Normal)
95 'normal' : Colors.Normal # color off (usu. Colors.Normal)
96 } )
96 } )
97
97
98 LightBGColors = ColorScheme(
98 LightBGColors = ColorScheme(
99 'LightBG',{
99 'LightBG',{
100 'header' : Colors.Red,
100 'header' : Colors.Red,
101 'normal' : Colors.Normal # color off (usu. Colors.Normal)
101 'normal' : Colors.Normal # color off (usu. Colors.Normal)
102 } )
102 } )
103
103
104 # Build table of color schemes (needed by the parser)
104 # Build table of color schemes (needed by the parser)
105 InspectColors = ColorSchemeTable([NoColor,LinuxColors,LightBGColors],
105 InspectColors = ColorSchemeTable([NoColor,LinuxColors,LightBGColors],
106 'Linux')
106 'Linux')
107
107
108 #****************************************************************************
108 #****************************************************************************
109 # Auxiliary functions
109 # Auxiliary functions
110 def getdoc(obj):
110 def getdoc(obj):
111 """Stable wrapper around inspect.getdoc.
111 """Stable wrapper around inspect.getdoc.
112
112
113 This can't crash because of attribute problems.
113 This can't crash because of attribute problems.
114
114
115 It also attempts to call a getdoc() method on the given object. This
115 It also attempts to call a getdoc() method on the given object. This
116 allows objects which provide their docstrings via non-standard mechanisms
116 allows objects which provide their docstrings via non-standard mechanisms
117 (like Pyro proxies) to still be inspected by ipython's ? system."""
117 (like Pyro proxies) to still be inspected by ipython's ? system."""
118
118
119 ds = None # default return value
119 ds = None # default return value
120 try:
120 try:
121 ds = inspect.getdoc(obj)
121 ds = inspect.getdoc(obj)
122 except:
122 except:
123 # Harden against an inspect failure, which can occur with
123 # Harden against an inspect failure, which can occur with
124 # SWIG-wrapped extensions.
124 # SWIG-wrapped extensions.
125 pass
125 pass
126 # Allow objects to offer customized documentation via a getdoc method:
126 # Allow objects to offer customized documentation via a getdoc method:
127 try:
127 try:
128 ds2 = obj.getdoc()
128 ds2 = obj.getdoc()
129 except:
129 except:
130 pass
130 pass
131 else:
131 else:
132 # if we get extra info, we add it to the normal docstring.
132 # if we get extra info, we add it to the normal docstring.
133 if ds is None:
133 if ds is None:
134 ds = ds2
134 ds = ds2
135 else:
135 else:
136 ds = '%s\n%s' % (ds,ds2)
136 ds = '%s\n%s' % (ds,ds2)
137 return ds
137 return ds
138
138
139 def getsource(obj,is_binary=False):
139 def getsource(obj,is_binary=False):
140 """Wrapper around inspect.getsource.
140 """Wrapper around inspect.getsource.
141
141
142 This can be modified by other projects to provide customized source
142 This can be modified by other projects to provide customized source
143 extraction.
143 extraction.
144
144
145 Inputs:
145 Inputs:
146
146
147 - obj: an object whose source code we will attempt to extract.
147 - obj: an object whose source code we will attempt to extract.
148
148
149 Optional inputs:
149 Optional inputs:
150
150
151 - is_binary: whether the object is known to come from a binary source.
151 - is_binary: whether the object is known to come from a binary source.
152 This implementation will skip returning any output for binary objects, but
152 This implementation will skip returning any output for binary objects, but
153 custom extractors may know how to meaningfully process them."""
153 custom extractors may know how to meaningfully process them."""
154
154
155 if is_binary:
155 if is_binary:
156 return None
156 return None
157 else:
157 else:
158 return inspect.getsource(obj)
158 return inspect.getsource(obj)
159
159
160 #****************************************************************************
160 #****************************************************************************
161 # Class definitions
161 # Class definitions
162
162
163 class myStringIO(StringIO.StringIO):
163 class myStringIO(StringIO.StringIO):
164 """Adds a writeln method to normal StringIO."""
164 """Adds a writeln method to normal StringIO."""
165 def writeln(self,*arg,**kw):
165 def writeln(self,*arg,**kw):
166 """Does a write() and then a write('\n')"""
166 """Does a write() and then a write('\n')"""
167 self.write(*arg,**kw)
167 self.write(*arg,**kw)
168 self.write('\n')
168 self.write('\n')
169
169
170 class Inspector:
170 class Inspector:
171 def __init__(self,color_table,code_color_table,scheme,
171 def __init__(self,color_table,code_color_table,scheme,
172 str_detail_level=0):
172 str_detail_level=0):
173 self.color_table = color_table
173 self.color_table = color_table
174 self.parser = PyColorize.Parser(code_color_table,out='str')
174 self.parser = PyColorize.Parser(code_color_table,out='str')
175 self.format = self.parser.format
175 self.format = self.parser.format
176 self.str_detail_level = str_detail_level
176 self.str_detail_level = str_detail_level
177 self.set_active_scheme(scheme)
177 self.set_active_scheme(scheme)
178
178
179 def __getargspec(self,obj):
179 def __getargspec(self,obj):
180 """Get the names and default values of a function's arguments.
180 """Get the names and default values of a function's arguments.
181
181
182 A tuple of four things is returned: (args, varargs, varkw, defaults).
182 A tuple of four things is returned: (args, varargs, varkw, defaults).
183 'args' is a list of the argument names (it may contain nested lists).
183 'args' is a list of the argument names (it may contain nested lists).
184 'varargs' and 'varkw' are the names of the * and ** arguments or None.
184 'varargs' and 'varkw' are the names of the * and ** arguments or None.
185 'defaults' is an n-tuple of the default values of the last n arguments.
185 'defaults' is an n-tuple of the default values of the last n arguments.
186
186
187 Modified version of inspect.getargspec from the Python Standard
187 Modified version of inspect.getargspec from the Python Standard
188 Library."""
188 Library."""
189
189
190 if inspect.isfunction(obj):
190 if inspect.isfunction(obj):
191 func_obj = obj
191 func_obj = obj
192 elif inspect.ismethod(obj):
192 elif inspect.ismethod(obj):
193 func_obj = obj.im_func
193 func_obj = obj.im_func
194 else:
194 else:
195 raise TypeError, 'arg is not a Python function'
195 raise TypeError, 'arg is not a Python function'
196 args, varargs, varkw = inspect.getargs(func_obj.func_code)
196 args, varargs, varkw = inspect.getargs(func_obj.func_code)
197 return args, varargs, varkw, func_obj.func_defaults
197 return args, varargs, varkw, func_obj.func_defaults
198
198
199 def __getdef(self,obj,oname=''):
199 def __getdef(self,obj,oname=''):
200 """Return the definition header for any callable object.
200 """Return the definition header for any callable object.
201
201
202 If any exception is generated, None is returned instead and the
202 If any exception is generated, None is returned instead and the
203 exception is suppressed."""
203 exception is suppressed."""
204
204
205 try:
205 try:
206 return oname + inspect.formatargspec(*self.__getargspec(obj))
206 return oname + inspect.formatargspec(*self.__getargspec(obj))
207 except:
207 except:
208 return None
208 return None
209
209
210 def __head(self,h):
210 def __head(self,h):
211 """Return a header string with proper colors."""
211 """Return a header string with proper colors."""
212 return '%s%s%s' % (self.color_table.active_colors.header,h,
212 return '%s%s%s' % (self.color_table.active_colors.header,h,
213 self.color_table.active_colors.normal)
213 self.color_table.active_colors.normal)
214
214
215 def set_active_scheme(self,scheme):
215 def set_active_scheme(self,scheme):
216 self.color_table.set_active_scheme(scheme)
216 self.color_table.set_active_scheme(scheme)
217 self.parser.color_table.set_active_scheme(scheme)
217 self.parser.color_table.set_active_scheme(scheme)
218
218
219 def noinfo(self,msg,oname):
219 def noinfo(self,msg,oname):
220 """Generic message when no information is found."""
220 """Generic message when no information is found."""
221 print 'No %s found' % msg,
221 print 'No %s found' % msg,
222 if oname:
222 if oname:
223 print 'for %s' % oname
223 print 'for %s' % oname
224 else:
224 else:
225 print
225 print
226
226
227 def pdef(self,obj,oname=''):
227 def pdef(self,obj,oname=''):
228 """Print the definition header for any callable object.
228 """Print the definition header for any callable object.
229
229
230 If the object is a class, print the constructor information."""
230 If the object is a class, print the constructor information."""
231
231
232 if not callable(obj):
232 if not callable(obj):
233 print 'Object is not callable.'
233 print 'Object is not callable.'
234 return
234 return
235
235
236 header = ''
236 header = ''
237
237
238 if inspect.isclass(obj):
238 if inspect.isclass(obj):
239 header = self.__head('Class constructor information:\n')
239 header = self.__head('Class constructor information:\n')
240 obj = obj.__init__
240 obj = obj.__init__
241 elif type(obj) is types.InstanceType or \
241 elif type(obj) is types.InstanceType:
242 isinstance(obj,object):
243 obj = obj.__call__
242 obj = obj.__call__
244
243
245 output = self.__getdef(obj,oname)
244 output = self.__getdef(obj,oname)
246 if output is None:
245 if output is None:
247 self.noinfo('definition header',oname)
246 self.noinfo('definition header',oname)
248 else:
247 else:
249 print >>Term.cout, header,self.format(output),
248 print >>Term.cout, header,self.format(output),
250
249
251 def pdoc(self,obj,oname='',formatter = None):
250 def pdoc(self,obj,oname='',formatter = None):
252 """Print the docstring for any object.
251 """Print the docstring for any object.
253
252
254 Optional:
253 Optional:
255 -formatter: a function to run the docstring through for specially
254 -formatter: a function to run the docstring through for specially
256 formatted docstrings."""
255 formatted docstrings."""
257
256
258 head = self.__head # so that itpl can find it even if private
257 head = self.__head # so that itpl can find it even if private
259 ds = getdoc(obj)
258 ds = getdoc(obj)
260 if formatter:
259 if formatter:
261 ds = formatter(ds)
260 ds = formatter(ds)
262 if inspect.isclass(obj):
261 if inspect.isclass(obj):
263 init_ds = getdoc(obj.__init__)
262 init_ds = getdoc(obj.__init__)
264 output = itpl('$head("Class Docstring:")\n'
263 output = itpl('$head("Class Docstring:")\n'
265 '$indent(ds)\n'
264 '$indent(ds)\n'
266 '$head("Constructor Docstring"):\n'
265 '$head("Constructor Docstring"):\n'
267 '$indent(init_ds)')
266 '$indent(init_ds)')
268 elif (type(obj) is types.InstanceType or isinstance(obj,object)) \
267 elif (type(obj) is types.InstanceType or isinstance(obj,object)) \
269 and hasattr(obj,'__call__'):
268 and hasattr(obj,'__call__'):
270 call_ds = getdoc(obj.__call__)
269 call_ds = getdoc(obj.__call__)
271 if call_ds:
270 if call_ds:
272 output = itpl('$head("Class Docstring:")\n$indent(ds)\n'
271 output = itpl('$head("Class Docstring:")\n$indent(ds)\n'
273 '$head("Calling Docstring:")\n$indent(call_ds)')
272 '$head("Calling Docstring:")\n$indent(call_ds)')
274 else:
273 else:
275 output = ds
274 output = ds
276 else:
275 else:
277 output = ds
276 output = ds
278 if output is None:
277 if output is None:
279 self.noinfo('documentation',oname)
278 self.noinfo('documentation',oname)
280 return
279 return
281 page(output)
280 page(output)
282
281
283 def psource(self,obj,oname=''):
282 def psource(self,obj,oname=''):
284 """Print the source code for an object."""
283 """Print the source code for an object."""
285
284
286 # Flush the source cache because inspect can return out-of-date source
285 # Flush the source cache because inspect can return out-of-date source
287 linecache.checkcache()
286 linecache.checkcache()
288 try:
287 try:
289 src = getsource(obj)
288 src = getsource(obj)
290 except:
289 except:
291 self.noinfo('source',oname)
290 self.noinfo('source',oname)
292 else:
291 else:
293 page(self.format(src))
292 page(self.format(src))
294
293
295 def pfile(self,obj,oname=''):
294 def pfile(self,obj,oname=''):
296 """Show the whole file where an object was defined."""
295 """Show the whole file where an object was defined."""
297 try:
296 try:
298 sourcelines,lineno = inspect.getsourcelines(obj)
297 sourcelines,lineno = inspect.getsourcelines(obj)
299 except:
298 except:
300 self.noinfo('file',oname)
299 self.noinfo('file',oname)
301 else:
300 else:
302 # run contents of file through pager starting at line
301 # run contents of file through pager starting at line
303 # where the object is defined
302 # where the object is defined
304 ofile = inspect.getabsfile(obj)
303 ofile = inspect.getabsfile(obj)
305
304
306 if (ofile.endswith('.so') or ofile.endswith('.dll')):
305 if (ofile.endswith('.so') or ofile.endswith('.dll')):
307 print 'File %r is binary, not printing.' % ofile
306 print 'File %r is binary, not printing.' % ofile
308 elif not os.path.isfile(ofile):
307 elif not os.path.isfile(ofile):
309 print 'File %r does not exist, not printing.' % ofile
308 print 'File %r does not exist, not printing.' % ofile
310 else:
309 else:
311 # Print only text files, not extension binaries.
310 # Print only text files, not extension binaries.
312 page(self.format(open(ofile).read()),lineno)
311 page(self.format(open(ofile).read()),lineno)
313 #page(self.format(open(inspect.getabsfile(obj)).read()),lineno)
312 #page(self.format(open(inspect.getabsfile(obj)).read()),lineno)
314
313
315 def pinfo(self,obj,oname='',formatter=None,info=None,detail_level=0):
314 def pinfo(self,obj,oname='',formatter=None,info=None,detail_level=0):
316 """Show detailed information about an object.
315 """Show detailed information about an object.
317
316
318 Optional arguments:
317 Optional arguments:
319
318
320 - oname: name of the variable pointing to the object.
319 - oname: name of the variable pointing to the object.
321
320
322 - formatter: special formatter for docstrings (see pdoc)
321 - formatter: special formatter for docstrings (see pdoc)
323
322
324 - info: a structure with some information fields which may have been
323 - info: a structure with some information fields which may have been
325 precomputed already.
324 precomputed already.
326
325
327 - detail_level: if set to 1, more information is given.
326 - detail_level: if set to 1, more information is given.
328 """
327 """
329
328
330 obj_type = type(obj)
329 obj_type = type(obj)
331
330
332 header = self.__head
331 header = self.__head
333 if info is None:
332 if info is None:
334 ismagic = 0
333 ismagic = 0
335 isalias = 0
334 isalias = 0
336 ospace = ''
335 ospace = ''
337 else:
336 else:
338 ismagic = info.ismagic
337 ismagic = info.ismagic
339 isalias = info.isalias
338 isalias = info.isalias
340 ospace = info.namespace
339 ospace = info.namespace
341 # Get docstring, special-casing aliases:
340 # Get docstring, special-casing aliases:
342 if isalias:
341 if isalias:
343 if not callable(obj):
342 if not callable(obj):
344 try:
343 try:
345 ds = "Alias to the system command:\n %s" % obj[1]
344 ds = "Alias to the system command:\n %s" % obj[1]
346 except:
345 except:
347 ds = "Alias: " + str(obj)
346 ds = "Alias: " + str(obj)
348 else:
347 else:
349 ds = "Alias to " + str(obj)
348 ds = "Alias to " + str(obj)
350 if obj.__doc__:
349 if obj.__doc__:
351 ds += "\nDocstring:\n" + obj.__doc__
350 ds += "\nDocstring:\n" + obj.__doc__
352 else:
351 else:
353 ds = getdoc(obj)
352 ds = getdoc(obj)
354 if ds is None:
353 if ds is None:
355 ds = '<no docstring>'
354 ds = '<no docstring>'
356 if formatter is not None:
355 if formatter is not None:
357 ds = formatter(ds)
356 ds = formatter(ds)
358
357
359 # store output in a list which gets joined with \n at the end.
358 # store output in a list which gets joined with \n at the end.
360 out = myStringIO()
359 out = myStringIO()
361
360
362 string_max = 200 # max size of strings to show (snipped if longer)
361 string_max = 200 # max size of strings to show (snipped if longer)
363 shalf = int((string_max -5)/2)
362 shalf = int((string_max -5)/2)
364
363
365 if ismagic:
364 if ismagic:
366 obj_type_name = 'Magic function'
365 obj_type_name = 'Magic function'
367 elif isalias:
366 elif isalias:
368 obj_type_name = 'System alias'
367 obj_type_name = 'System alias'
369 else:
368 else:
370 obj_type_name = obj_type.__name__
369 obj_type_name = obj_type.__name__
371 out.writeln(header('Type:\t\t')+obj_type_name)
370 out.writeln(header('Type:\t\t')+obj_type_name)
372
371
373 try:
372 try:
374 bclass = obj.__class__
373 bclass = obj.__class__
375 out.writeln(header('Base Class:\t')+str(bclass))
374 out.writeln(header('Base Class:\t')+str(bclass))
376 except: pass
375 except: pass
377
376
378 # String form, but snip if too long in ? form (full in ??)
377 # String form, but snip if too long in ? form (full in ??)
379 if detail_level >= self.str_detail_level:
378 if detail_level >= self.str_detail_level:
380 try:
379 try:
381 ostr = str(obj)
380 ostr = str(obj)
382 str_head = 'String Form:'
381 str_head = 'String Form:'
383 if not detail_level and len(ostr)>string_max:
382 if not detail_level and len(ostr)>string_max:
384 ostr = ostr[:shalf] + ' <...> ' + ostr[-shalf:]
383 ostr = ostr[:shalf] + ' <...> ' + ostr[-shalf:]
385 ostr = ("\n" + " " * len(str_head.expandtabs())).\
384 ostr = ("\n" + " " * len(str_head.expandtabs())).\
386 join(map(string.strip,ostr.split("\n")))
385 join(map(string.strip,ostr.split("\n")))
387 if ostr.find('\n') > -1:
386 if ostr.find('\n') > -1:
388 # Print multi-line strings starting at the next line.
387 # Print multi-line strings starting at the next line.
389 str_sep = '\n'
388 str_sep = '\n'
390 else:
389 else:
391 str_sep = '\t'
390 str_sep = '\t'
392 out.writeln("%s%s%s" % (header(str_head),str_sep,ostr))
391 out.writeln("%s%s%s" % (header(str_head),str_sep,ostr))
393 except:
392 except:
394 pass
393 pass
395
394
396 if ospace:
395 if ospace:
397 out.writeln(header('Namespace:\t')+ospace)
396 out.writeln(header('Namespace:\t')+ospace)
398
397
399 # Length (for strings and lists)
398 # Length (for strings and lists)
400 try:
399 try:
401 length = str(len(obj))
400 length = str(len(obj))
402 out.writeln(header('Length:\t\t')+length)
401 out.writeln(header('Length:\t\t')+length)
403 except: pass
402 except: pass
404
403
405 # Filename where object was defined
404 # Filename where object was defined
406 binary_file = False
405 binary_file = False
407 try:
406 try:
408 fname = inspect.getabsfile(obj)
407 fname = inspect.getabsfile(obj)
409 if fname.endswith('<string>'):
408 if fname.endswith('<string>'):
410 fname = 'Dynamically generated function. No source code available.'
409 fname = 'Dynamically generated function. No source code available.'
411 if (fname.endswith('.so') or fname.endswith('.dll') or
410 if (fname.endswith('.so') or fname.endswith('.dll')):
412 not os.path.isfile(fname)):
413 binary_file = True
411 binary_file = True
414 out.writeln(header('File:\t\t')+fname)
412 out.writeln(header('File:\t\t')+fname)
415 except:
413 except:
416 # if anything goes wrong, we don't want to show source, so it's as
414 # if anything goes wrong, we don't want to show source, so it's as
417 # if the file was binary
415 # if the file was binary
418 binary_file = True
416 binary_file = True
419
417
420 # reconstruct the function definition and print it:
418 # reconstruct the function definition and print it:
421 defln = self.__getdef(obj,oname)
419 defln = self.__getdef(obj,oname)
422 if defln:
420 if defln:
423 out.write(header('Definition:\t')+self.format(defln))
421 out.write(header('Definition:\t')+self.format(defln))
424
422
425 # Docstrings only in detail 0 mode, since source contains them (we
423 # Docstrings only in detail 0 mode, since source contains them (we
426 # avoid repetitions). If source fails, we add them back, see below.
424 # avoid repetitions). If source fails, we add them back, see below.
427 if ds and detail_level == 0:
425 if ds and detail_level == 0:
428 out.writeln(header('Docstring:\n') + indent(ds))
426 out.writeln(header('Docstring:\n') + indent(ds))
429
430
427
431 # Original source code for any callable
428 # Original source code for any callable
432 if detail_level:
429 if detail_level:
433 # Flush the source cache because inspect can return out-of-date source
430 # Flush the source cache because inspect can return out-of-date
431 # source
434 linecache.checkcache()
432 linecache.checkcache()
435 source_success = False
433 source_success = False
436 try:
434 try:
437 source = self.format(getsource(obj,binary_file))
435 source = self.format(getsource(obj,binary_file))
438 if source:
436 if source:
439 out.write(header('Source:\n')+source.rstrip())
437 out.write(header('Source:\n')+source.rstrip())
440 source_success = True
438 source_success = True
441 except Exception, msg:
439 except Exception, msg:
442 pass
440 pass
443
441
444 if ds and not source_success:
442 if ds and not source_success:
445 out.writeln(header('Docstring [source file open failed]:\n')
443 out.writeln(header('Docstring [source file open failed]:\n')
446 + indent(ds))
444 + indent(ds))
447
445
448 # Constructor docstring for classes
446 # Constructor docstring for classes
449 if inspect.isclass(obj):
447 if inspect.isclass(obj):
450 # reconstruct the function definition and print it:
448 # reconstruct the function definition and print it:
451 try:
449 try:
452 obj_init = obj.__init__
450 obj_init = obj.__init__
453 except AttributeError:
451 except AttributeError:
454 init_def = init_ds = None
452 init_def = init_ds = None
455 else:
453 else:
456 init_def = self.__getdef(obj_init,oname)
454 init_def = self.__getdef(obj_init,oname)
457 init_ds = getdoc(obj_init)
455 init_ds = getdoc(obj_init)
458 # Skip Python's auto-generated docstrings
456 # Skip Python's auto-generated docstrings
459 if init_ds and \
457 if init_ds and \
460 init_ds.startswith('x.__init__(...) initializes'):
458 init_ds.startswith('x.__init__(...) initializes'):
461 init_ds = None
459 init_ds = None
462
460
463 if init_def or init_ds:
461 if init_def or init_ds:
464 out.writeln(header('\nConstructor information:'))
462 out.writeln(header('\nConstructor information:'))
465 if init_def:
463 if init_def:
466 out.write(header('Definition:\t')+ self.format(init_def))
464 out.write(header('Definition:\t')+ self.format(init_def))
467 if init_ds:
465 if init_ds:
468 out.writeln(header('Docstring:\n') + indent(init_ds))
466 out.writeln(header('Docstring:\n') + indent(init_ds))
469 # and class docstring for instances:
467 # and class docstring for instances:
470 elif obj_type is types.InstanceType or \
468 elif obj_type is types.InstanceType or \
471 isinstance(obj,object):
469 isinstance(obj,object):
472
470
473 # First, check whether the instance docstring is identical to the
471 # First, check whether the instance docstring is identical to the
474 # class one, and print it separately if they don't coincide. In
472 # class one, and print it separately if they don't coincide. In
475 # most cases they will, but it's nice to print all the info for
473 # most cases they will, but it's nice to print all the info for
476 # objects which use instance-customized docstrings.
474 # objects which use instance-customized docstrings.
477 if ds:
475 if ds:
478 class_ds = getdoc(obj.__class__)
476 class_ds = getdoc(obj.__class__)
479 # Skip Python's auto-generated docstrings
477 # Skip Python's auto-generated docstrings
480 if class_ds and \
478 if class_ds and \
481 (class_ds.startswith('function(code, globals[,') or \
479 (class_ds.startswith('function(code, globals[,') or \
482 class_ds.startswith('instancemethod(function, instance,') or \
480 class_ds.startswith('instancemethod(function, instance,') or \
483 class_ds.startswith('module(name[,') ):
481 class_ds.startswith('module(name[,') ):
484 class_ds = None
482 class_ds = None
485 if class_ds and ds != class_ds:
483 if class_ds and ds != class_ds:
486 out.writeln(header('Class Docstring:\n') +
484 out.writeln(header('Class Docstring:\n') +
487 indent(class_ds))
485 indent(class_ds))
488
486
489 # Next, try to show constructor docstrings
487 # Next, try to show constructor docstrings
490 try:
488 try:
491 init_ds = getdoc(obj.__init__)
489 init_ds = getdoc(obj.__init__)
492 # Skip Python's auto-generated docstrings
490 # Skip Python's auto-generated docstrings
493 if init_ds and \
491 if init_ds and \
494 init_ds.startswith('x.__init__(...) initializes'):
492 init_ds.startswith('x.__init__(...) initializes'):
495 init_ds = None
493 init_ds = None
496 except AttributeError:
494 except AttributeError:
497 init_ds = None
495 init_ds = None
498 if init_ds:
496 if init_ds:
499 out.writeln(header('Constructor Docstring:\n') +
497 out.writeln(header('Constructor Docstring:\n') +
500 indent(init_ds))
498 indent(init_ds))
501
499
502 # Call form docstring for callable instances
500 # Call form docstring for callable instances
503 if hasattr(obj,'__call__'):
501 if hasattr(obj,'__call__'):
504 #out.writeln(header('Callable:\t')+'Yes')
502 #out.writeln(header('Callable:\t')+'Yes')
505 call_def = self.__getdef(obj.__call__,oname)
503 call_def = self.__getdef(obj.__call__,oname)
506 #if call_def is None:
504 #if call_def is None:
507 # out.writeln(header('Call def:\t')+
505 # out.writeln(header('Call def:\t')+
508 # 'Calling definition not available.')
506 # 'Calling definition not available.')
509 if call_def is not None:
507 if call_def is not None:
510 out.writeln(header('Call def:\t')+self.format(call_def))
508 out.writeln(header('Call def:\t')+self.format(call_def))
511 call_ds = getdoc(obj.__call__)
509 call_ds = getdoc(obj.__call__)
512 # Skip Python's auto-generated docstrings
510 # Skip Python's auto-generated docstrings
513 if call_ds and call_ds.startswith('x.__call__(...) <==> x(...)'):
511 if call_ds and call_ds.startswith('x.__call__(...) <==> x(...)'):
514 call_ds = None
512 call_ds = None
515 if call_ds:
513 if call_ds:
516 out.writeln(header('Call docstring:\n') + indent(call_ds))
514 out.writeln(header('Call docstring:\n') + indent(call_ds))
517
515
518 # Finally send to printer/pager
516 # Finally send to printer/pager
519 output = out.getvalue()
517 output = out.getvalue()
520 if output:
518 if output:
521 page(output)
519 page(output)
522 # end pinfo
520 # end pinfo
523
521
524 def psearch(self,pattern,ns_table,ns_search=[],
522 def psearch(self,pattern,ns_table,ns_search=[],
525 ignore_case=False,show_all=False):
523 ignore_case=False,show_all=False):
526 """Search namespaces with wildcards for objects.
524 """Search namespaces with wildcards for objects.
527
525
528 Arguments:
526 Arguments:
529
527
530 - pattern: string containing shell-like wildcards to use in namespace
528 - pattern: string containing shell-like wildcards to use in namespace
531 searches and optionally a type specification to narrow the search to
529 searches and optionally a type specification to narrow the search to
532 objects of that type.
530 objects of that type.
533
531
534 - ns_table: dict of name->namespaces for search.
532 - ns_table: dict of name->namespaces for search.
535
533
536 Optional arguments:
534 Optional arguments:
537
535
538 - ns_search: list of namespace names to include in search.
536 - ns_search: list of namespace names to include in search.
539
537
540 - ignore_case(False): make the search case-insensitive.
538 - ignore_case(False): make the search case-insensitive.
541
539
542 - show_all(False): show all names, including those starting with
540 - show_all(False): show all names, including those starting with
543 underscores.
541 underscores.
544 """
542 """
545 #print 'ps pattern:<%r>' % pattern # dbg
543 #print 'ps pattern:<%r>' % pattern # dbg
546
544
547 # defaults
545 # defaults
548 type_pattern = 'all'
546 type_pattern = 'all'
549 filter = ''
547 filter = ''
550
548
551 cmds = pattern.split()
549 cmds = pattern.split()
552 len_cmds = len(cmds)
550 len_cmds = len(cmds)
553 if len_cmds == 1:
551 if len_cmds == 1:
554 # Only filter pattern given
552 # Only filter pattern given
555 filter = cmds[0]
553 filter = cmds[0]
556 elif len_cmds == 2:
554 elif len_cmds == 2:
557 # Both filter and type specified
555 # Both filter and type specified
558 filter,type_pattern = cmds
556 filter,type_pattern = cmds
559 else:
557 else:
560 raise ValueError('invalid argument string for psearch: <%s>' %
558 raise ValueError('invalid argument string for psearch: <%s>' %
561 pattern)
559 pattern)
562
560
563 # filter search namespaces
561 # filter search namespaces
564 for name in ns_search:
562 for name in ns_search:
565 if name not in ns_table:
563 if name not in ns_table:
566 raise ValueError('invalid namespace <%s>. Valid names: %s' %
564 raise ValueError('invalid namespace <%s>. Valid names: %s' %
567 (name,ns_table.keys()))
565 (name,ns_table.keys()))
568
566
569 #print 'type_pattern:',type_pattern # dbg
567 #print 'type_pattern:',type_pattern # dbg
570 search_result = []
568 search_result = []
571 for ns_name in ns_search:
569 for ns_name in ns_search:
572 ns = ns_table[ns_name]
570 ns = ns_table[ns_name]
573 tmp_res = list(list_namespace(ns,type_pattern,filter,
571 tmp_res = list(list_namespace(ns,type_pattern,filter,
574 ignore_case=ignore_case,
572 ignore_case=ignore_case,
575 show_all=show_all))
573 show_all=show_all))
576 search_result.extend(tmp_res)
574 search_result.extend(tmp_res)
577 search_result.sort()
575 search_result.sort()
578
576
579 page('\n'.join(search_result))
577 page('\n'.join(search_result))
@@ -1,763 +1,763 b''
1 # -*- coding: utf-8 -*-
1 # -*- coding: utf-8 -*-
2 """
2 """
3 IPython -- An enhanced Interactive Python
3 IPython -- An enhanced Interactive Python
4
4
5 Requires Python 2.1 or better.
5 Requires Python 2.1 or better.
6
6
7 This file contains the main make_IPython() starter function.
7 This file contains the main make_IPython() starter function.
8
8
9 $Id: ipmaker.py 2710 2007-09-04 21:10:10Z vivainio $"""
9 $Id: ipmaker.py 2723 2007-09-07 07:44:16Z fperez $"""
10
10
11 #*****************************************************************************
11 #*****************************************************************************
12 # Copyright (C) 2001-2006 Fernando Perez. <fperez@colorado.edu>
12 # Copyright (C) 2001-2006 Fernando Perez. <fperez@colorado.edu>
13 #
13 #
14 # Distributed under the terms of the BSD License. The full license is in
14 # Distributed under the terms of the BSD License. The full license is in
15 # the file COPYING, distributed as part of this software.
15 # the file COPYING, distributed as part of this software.
16 #*****************************************************************************
16 #*****************************************************************************
17
17
18 from IPython import Release
18 from IPython import Release
19 __author__ = '%s <%s>' % Release.authors['Fernando']
19 __author__ = '%s <%s>' % Release.authors['Fernando']
20 __license__ = Release.license
20 __license__ = Release.license
21 __version__ = Release.version
21 __version__ = Release.version
22
22
23 try:
23 try:
24 credits._Printer__data = """
24 credits._Printer__data = """
25 Python: %s
25 Python: %s
26
26
27 IPython: Fernando Perez, Janko Hauser, Nathan Gray, and many users.
27 IPython: Fernando Perez, Janko Hauser, Nathan Gray, and many users.
28 See http://ipython.scipy.org for more information.""" \
28 See http://ipython.scipy.org for more information.""" \
29 % credits._Printer__data
29 % credits._Printer__data
30
30
31 copyright._Printer__data += """
31 copyright._Printer__data += """
32
32
33 Copyright (c) 2001-2004 Fernando Perez, Janko Hauser, Nathan Gray.
33 Copyright (c) 2001-2004 Fernando Perez, Janko Hauser, Nathan Gray.
34 All Rights Reserved."""
34 All Rights Reserved."""
35 except NameError:
35 except NameError:
36 # Can happen if ipython was started with 'python -S', so that site.py is
36 # Can happen if ipython was started with 'python -S', so that site.py is
37 # not loaded
37 # not loaded
38 pass
38 pass
39
39
40 #****************************************************************************
40 #****************************************************************************
41 # Required modules
41 # Required modules
42
42
43 # From the standard library
43 # From the standard library
44 import __main__
44 import __main__
45 import __builtin__
45 import __builtin__
46 import os
46 import os
47 import re
47 import re
48 import sys
48 import sys
49 import types
49 import types
50 from pprint import pprint,pformat
50 from pprint import pprint,pformat
51
51
52 # Our own
52 # Our own
53 from IPython import DPyGetOpt
53 from IPython import DPyGetOpt
54 from IPython.ipstruct import Struct
54 from IPython.ipstruct import Struct
55 from IPython.OutputTrap import OutputTrap
55 from IPython.OutputTrap import OutputTrap
56 from IPython.ConfigLoader import ConfigLoader
56 from IPython.ConfigLoader import ConfigLoader
57 from IPython.iplib import InteractiveShell
57 from IPython.iplib import InteractiveShell
58 from IPython.usage import cmd_line_usage,interactive_usage
58 from IPython.usage import cmd_line_usage,interactive_usage
59 from IPython.genutils import *
59 from IPython.genutils import *
60
60
61 #-----------------------------------------------------------------------------
61 #-----------------------------------------------------------------------------
62 def make_IPython(argv=None,user_ns=None,user_global_ns=None,debug=1,
62 def make_IPython(argv=None,user_ns=None,user_global_ns=None,debug=1,
63 rc_override=None,shell_class=InteractiveShell,
63 rc_override=None,shell_class=InteractiveShell,
64 embedded=False,**kw):
64 embedded=False,**kw):
65 """This is a dump of IPython into a single function.
65 """This is a dump of IPython into a single function.
66
66
67 Later it will have to be broken up in a sensible manner.
67 Later it will have to be broken up in a sensible manner.
68
68
69 Arguments:
69 Arguments:
70
70
71 - argv: a list similar to sys.argv[1:]. It should NOT contain the desired
71 - argv: a list similar to sys.argv[1:]. It should NOT contain the desired
72 script name, b/c DPyGetOpt strips the first argument only for the real
72 script name, b/c DPyGetOpt strips the first argument only for the real
73 sys.argv.
73 sys.argv.
74
74
75 - user_ns: a dict to be used as the user's namespace."""
75 - user_ns: a dict to be used as the user's namespace."""
76
76
77 #----------------------------------------------------------------------
77 #----------------------------------------------------------------------
78 # Defaults and initialization
78 # Defaults and initialization
79
79
80 # For developer debugging, deactivates crash handler and uses pdb.
80 # For developer debugging, deactivates crash handler and uses pdb.
81 DEVDEBUG = False
81 DEVDEBUG = False
82
82
83 if argv is None:
83 if argv is None:
84 argv = sys.argv
84 argv = sys.argv
85
85
86 # __IP is the main global that lives throughout and represents the whole
86 # __IP is the main global that lives throughout and represents the whole
87 # application. If the user redefines it, all bets are off as to what
87 # application. If the user redefines it, all bets are off as to what
88 # happens.
88 # happens.
89
89
90 # __IP is the name of he global which the caller will have accessible as
90 # __IP is the name of he global which the caller will have accessible as
91 # __IP.name. We set its name via the first parameter passed to
91 # __IP.name. We set its name via the first parameter passed to
92 # InteractiveShell:
92 # InteractiveShell:
93
93
94 IP = shell_class('__IP',user_ns=user_ns,user_global_ns=user_global_ns,
94 IP = shell_class('__IP',user_ns=user_ns,user_global_ns=user_global_ns,
95 embedded=embedded,**kw)
95 embedded=embedded,**kw)
96
96
97 # Put 'help' in the user namespace
97 # Put 'help' in the user namespace
98 from site import _Helper
98 from site import _Helper
99 IP.user_config_ns = {}
99 IP.user_config_ns = {}
100 IP.user_ns['help'] = _Helper()
100 IP.user_ns['help'] = _Helper()
101
101
102
102
103 if DEVDEBUG:
103 if DEVDEBUG:
104 # For developer debugging only (global flag)
104 # For developer debugging only (global flag)
105 from IPython import ultraTB
105 from IPython import ultraTB
106 sys.excepthook = ultraTB.VerboseTB(call_pdb=1)
106 sys.excepthook = ultraTB.VerboseTB(call_pdb=1)
107
107
108 IP.BANNER_PARTS = ['Python %s\n'
108 IP.BANNER_PARTS = ['Python %s\n'
109 'Type "copyright", "credits" or "license" '
109 'Type "copyright", "credits" or "license" '
110 'for more information.\n'
110 'for more information.\n'
111 % (sys.version.split('\n')[0],),
111 % (sys.version.split('\n')[0],),
112 "IPython %s -- An enhanced Interactive Python."
112 "IPython %s -- An enhanced Interactive Python."
113 % (__version__,),
113 % (__version__,),
114 """\
114 """\
115 ? -> Introduction to IPython's features
115 ? -> Introduction and overview of IPython's features.
116 %quickref -> Quick reference.
116 %quickref -> Quick reference.
117 help -> Python's own help system.
117 help -> Python's own help system.
118 object? -> Details about 'object'. ?object also works, ?? prints more.
118 object? -> Details about 'object'. ?object also works, ?? prints more.
119 """ ]
119 """ ]
120
120
121 IP.usage = interactive_usage
121 IP.usage = interactive_usage
122
122
123 # Platform-dependent suffix and directory names. We use _ipython instead
123 # Platform-dependent suffix and directory names. We use _ipython instead
124 # of .ipython under win32 b/c there's software that breaks with .named
124 # of .ipython under win32 b/c there's software that breaks with .named
125 # directories on that platform.
125 # directories on that platform.
126 if os.name == 'posix':
126 if os.name == 'posix':
127 rc_suffix = ''
127 rc_suffix = ''
128 ipdir_def = '.ipython'
128 ipdir_def = '.ipython'
129 else:
129 else:
130 rc_suffix = '.ini'
130 rc_suffix = '.ini'
131 ipdir_def = '_ipython'
131 ipdir_def = '_ipython'
132
132
133 # default directory for configuration
133 # default directory for configuration
134 ipythondir_def = os.path.abspath(os.environ.get('IPYTHONDIR',
134 ipythondir_def = os.path.abspath(os.environ.get('IPYTHONDIR',
135 os.path.join(IP.home_dir,ipdir_def)))
135 os.path.join(IP.home_dir,ipdir_def)))
136
136
137 sys.path.insert(0, '') # add . to sys.path. Fix from Prabhu Ramachandran
137 sys.path.insert(0, '') # add . to sys.path. Fix from Prabhu Ramachandran
138
138
139 # we need the directory where IPython itself is installed
139 # we need the directory where IPython itself is installed
140 import IPython
140 import IPython
141 IPython_dir = os.path.dirname(IPython.__file__)
141 IPython_dir = os.path.dirname(IPython.__file__)
142 del IPython
142 del IPython
143
143
144 #-------------------------------------------------------------------------
144 #-------------------------------------------------------------------------
145 # Command line handling
145 # Command line handling
146
146
147 # Valid command line options (uses DPyGetOpt syntax, like Perl's
147 # Valid command line options (uses DPyGetOpt syntax, like Perl's
148 # GetOpt::Long)
148 # GetOpt::Long)
149
149
150 # Any key not listed here gets deleted even if in the file (like session
150 # Any key not listed here gets deleted even if in the file (like session
151 # or profile). That's deliberate, to maintain the rc namespace clean.
151 # or profile). That's deliberate, to maintain the rc namespace clean.
152
152
153 # Each set of options appears twice: under _conv only the names are
153 # Each set of options appears twice: under _conv only the names are
154 # listed, indicating which type they must be converted to when reading the
154 # listed, indicating which type they must be converted to when reading the
155 # ipythonrc file. And under DPyGetOpt they are listed with the regular
155 # ipythonrc file. And under DPyGetOpt they are listed with the regular
156 # DPyGetOpt syntax (=s,=i,:f,etc).
156 # DPyGetOpt syntax (=s,=i,:f,etc).
157
157
158 # Make sure there's a space before each end of line (they get auto-joined!)
158 # Make sure there's a space before each end of line (they get auto-joined!)
159 cmdline_opts = ('autocall=i autoindent! automagic! banner! cache_size|cs=i '
159 cmdline_opts = ('autocall=i autoindent! automagic! banner! cache_size|cs=i '
160 'c=s classic|cl color_info! colors=s confirm_exit! '
160 'c=s classic|cl color_info! colors=s confirm_exit! '
161 'debug! deep_reload! editor=s log|l messages! nosep '
161 'debug! deep_reload! editor=s log|l messages! nosep '
162 'object_info_string_level=i pdb! '
162 'object_info_string_level=i pdb! '
163 'pprint! prompt_in1|pi1=s prompt_in2|pi2=s prompt_out|po=s '
163 'pprint! prompt_in1|pi1=s prompt_in2|pi2=s prompt_out|po=s '
164 'pylab_import_all! '
164 'pylab_import_all! '
165 'quick screen_length|sl=i prompts_pad_left=i '
165 'quick screen_length|sl=i prompts_pad_left=i '
166 'logfile|lf=s logplay|lp=s profile|p=s '
166 'logfile|lf=s logplay|lp=s profile|p=s '
167 'readline! readline_merge_completions! '
167 'readline! readline_merge_completions! '
168 'readline_omit__names! '
168 'readline_omit__names! '
169 'rcfile=s separate_in|si=s separate_out|so=s '
169 'rcfile=s separate_in|si=s separate_out|so=s '
170 'separate_out2|so2=s xmode=s wildcards_case_sensitive! '
170 'separate_out2|so2=s xmode=s wildcards_case_sensitive! '
171 'magic_docstrings system_verbose! '
171 'magic_docstrings system_verbose! '
172 'multi_line_specials! '
172 'multi_line_specials! '
173 'term_title! wxversion=s '
173 'term_title! wxversion=s '
174 'autoedit_syntax!')
174 'autoedit_syntax!')
175
175
176 # Options that can *only* appear at the cmd line (not in rcfiles).
176 # Options that can *only* appear at the cmd line (not in rcfiles).
177
177
178 # The "ignore" option is a kludge so that Emacs buffers don't crash, since
178 # The "ignore" option is a kludge so that Emacs buffers don't crash, since
179 # the 'C-c !' command in emacs automatically appends a -i option at the end.
179 # the 'C-c !' command in emacs automatically appends a -i option at the end.
180 cmdline_only = ('help interact|i ipythondir=s Version upgrade '
180 cmdline_only = ('help interact|i ipythondir=s Version upgrade '
181 'gthread! qthread! q4thread! wthread! pylab! tk!')
181 'gthread! qthread! q4thread! wthread! pylab! tk!')
182
182
183 # Build the actual name list to be used by DPyGetOpt
183 # Build the actual name list to be used by DPyGetOpt
184 opts_names = qw(cmdline_opts) + qw(cmdline_only)
184 opts_names = qw(cmdline_opts) + qw(cmdline_only)
185
185
186 # Set sensible command line defaults.
186 # Set sensible command line defaults.
187 # This should have everything from cmdline_opts and cmdline_only
187 # This should have everything from cmdline_opts and cmdline_only
188 opts_def = Struct(autocall = 1,
188 opts_def = Struct(autocall = 1,
189 autoedit_syntax = 0,
189 autoedit_syntax = 0,
190 autoindent = 0,
190 autoindent = 0,
191 automagic = 1,
191 automagic = 1,
192 banner = 1,
192 banner = 1,
193 cache_size = 1000,
193 cache_size = 1000,
194 c = '',
194 c = '',
195 classic = 0,
195 classic = 0,
196 colors = 'NoColor',
196 colors = 'NoColor',
197 color_info = 0,
197 color_info = 0,
198 confirm_exit = 1,
198 confirm_exit = 1,
199 debug = 0,
199 debug = 0,
200 deep_reload = 0,
200 deep_reload = 0,
201 editor = '0',
201 editor = '0',
202 help = 0,
202 help = 0,
203 interact = 0,
203 interact = 0,
204 ipythondir = ipythondir_def,
204 ipythondir = ipythondir_def,
205 log = 0,
205 log = 0,
206 logfile = '',
206 logfile = '',
207 logplay = '',
207 logplay = '',
208 multi_line_specials = 1,
208 multi_line_specials = 1,
209 messages = 1,
209 messages = 1,
210 object_info_string_level = 0,
210 object_info_string_level = 0,
211 nosep = 0,
211 nosep = 0,
212 pdb = 0,
212 pdb = 0,
213 pprint = 0,
213 pprint = 0,
214 profile = '',
214 profile = '',
215 prompt_in1 = 'In [\\#]: ',
215 prompt_in1 = 'In [\\#]: ',
216 prompt_in2 = ' .\\D.: ',
216 prompt_in2 = ' .\\D.: ',
217 prompt_out = 'Out[\\#]: ',
217 prompt_out = 'Out[\\#]: ',
218 prompts_pad_left = 1,
218 prompts_pad_left = 1,
219 pylab_import_all = 1,
219 pylab_import_all = 1,
220 quiet = 0,
220 quiet = 0,
221 quick = 0,
221 quick = 0,
222 readline = 1,
222 readline = 1,
223 readline_merge_completions = 1,
223 readline_merge_completions = 1,
224 readline_omit__names = 0,
224 readline_omit__names = 0,
225 rcfile = 'ipythonrc' + rc_suffix,
225 rcfile = 'ipythonrc' + rc_suffix,
226 screen_length = 0,
226 screen_length = 0,
227 separate_in = '\n',
227 separate_in = '\n',
228 separate_out = '\n',
228 separate_out = '\n',
229 separate_out2 = '',
229 separate_out2 = '',
230 system_header = 'IPython system call: ',
230 system_header = 'IPython system call: ',
231 system_verbose = 0,
231 system_verbose = 0,
232 gthread = 0,
232 gthread = 0,
233 qthread = 0,
233 qthread = 0,
234 q4thread = 0,
234 q4thread = 0,
235 wthread = 0,
235 wthread = 0,
236 pylab = 0,
236 pylab = 0,
237 term_title = 1,
237 term_title = 1,
238 tk = 0,
238 tk = 0,
239 upgrade = 0,
239 upgrade = 0,
240 Version = 0,
240 Version = 0,
241 xmode = 'Verbose',
241 xmode = 'Verbose',
242 wildcards_case_sensitive = 1,
242 wildcards_case_sensitive = 1,
243 wxversion = '0',
243 wxversion = '0',
244 magic_docstrings = 0, # undocumented, for doc generation
244 magic_docstrings = 0, # undocumented, for doc generation
245 )
245 )
246
246
247 # Things that will *only* appear in rcfiles (not at the command line).
247 # Things that will *only* appear in rcfiles (not at the command line).
248 # Make sure there's a space before each end of line (they get auto-joined!)
248 # Make sure there's a space before each end of line (they get auto-joined!)
249 rcfile_opts = { qwflat: 'include import_mod import_all execfile ',
249 rcfile_opts = { qwflat: 'include import_mod import_all execfile ',
250 qw_lol: 'import_some ',
250 qw_lol: 'import_some ',
251 # for things with embedded whitespace:
251 # for things with embedded whitespace:
252 list_strings:'execute alias readline_parse_and_bind ',
252 list_strings:'execute alias readline_parse_and_bind ',
253 # Regular strings need no conversion:
253 # Regular strings need no conversion:
254 None:'readline_remove_delims ',
254 None:'readline_remove_delims ',
255 }
255 }
256 # Default values for these
256 # Default values for these
257 rc_def = Struct(include = [],
257 rc_def = Struct(include = [],
258 import_mod = [],
258 import_mod = [],
259 import_all = [],
259 import_all = [],
260 import_some = [[]],
260 import_some = [[]],
261 execute = [],
261 execute = [],
262 execfile = [],
262 execfile = [],
263 alias = [],
263 alias = [],
264 readline_parse_and_bind = [],
264 readline_parse_and_bind = [],
265 readline_remove_delims = '',
265 readline_remove_delims = '',
266 )
266 )
267
267
268 # Build the type conversion dictionary from the above tables:
268 # Build the type conversion dictionary from the above tables:
269 typeconv = rcfile_opts.copy()
269 typeconv = rcfile_opts.copy()
270 typeconv.update(optstr2types(cmdline_opts))
270 typeconv.update(optstr2types(cmdline_opts))
271
271
272 # FIXME: the None key appears in both, put that back together by hand. Ugly!
272 # FIXME: the None key appears in both, put that back together by hand. Ugly!
273 typeconv[None] += ' ' + rcfile_opts[None]
273 typeconv[None] += ' ' + rcfile_opts[None]
274
274
275 # Remove quotes at ends of all strings (used to protect spaces)
275 # Remove quotes at ends of all strings (used to protect spaces)
276 typeconv[unquote_ends] = typeconv[None]
276 typeconv[unquote_ends] = typeconv[None]
277 del typeconv[None]
277 del typeconv[None]
278
278
279 # Build the list we'll use to make all config decisions with defaults:
279 # Build the list we'll use to make all config decisions with defaults:
280 opts_all = opts_def.copy()
280 opts_all = opts_def.copy()
281 opts_all.update(rc_def)
281 opts_all.update(rc_def)
282
282
283 # Build conflict resolver for recursive loading of config files:
283 # Build conflict resolver for recursive loading of config files:
284 # - preserve means the outermost file maintains the value, it is not
284 # - preserve means the outermost file maintains the value, it is not
285 # overwritten if an included file has the same key.
285 # overwritten if an included file has the same key.
286 # - add_flip applies + to the two values, so it better make sense to add
286 # - add_flip applies + to the two values, so it better make sense to add
287 # those types of keys. But it flips them first so that things loaded
287 # those types of keys. But it flips them first so that things loaded
288 # deeper in the inclusion chain have lower precedence.
288 # deeper in the inclusion chain have lower precedence.
289 conflict = {'preserve': ' '.join([ typeconv[int],
289 conflict = {'preserve': ' '.join([ typeconv[int],
290 typeconv[unquote_ends] ]),
290 typeconv[unquote_ends] ]),
291 'add_flip': ' '.join([ typeconv[qwflat],
291 'add_flip': ' '.join([ typeconv[qwflat],
292 typeconv[qw_lol],
292 typeconv[qw_lol],
293 typeconv[list_strings] ])
293 typeconv[list_strings] ])
294 }
294 }
295
295
296 # Now actually process the command line
296 # Now actually process the command line
297 getopt = DPyGetOpt.DPyGetOpt()
297 getopt = DPyGetOpt.DPyGetOpt()
298 getopt.setIgnoreCase(0)
298 getopt.setIgnoreCase(0)
299
299
300 getopt.parseConfiguration(opts_names)
300 getopt.parseConfiguration(opts_names)
301
301
302 try:
302 try:
303 getopt.processArguments(argv)
303 getopt.processArguments(argv)
304 except:
304 except:
305 print cmd_line_usage
305 print cmd_line_usage
306 warn('\nError in Arguments: ' + `sys.exc_value`)
306 warn('\nError in Arguments: ' + `sys.exc_value`)
307 sys.exit(1)
307 sys.exit(1)
308
308
309 # convert the options dict to a struct for much lighter syntax later
309 # convert the options dict to a struct for much lighter syntax later
310 opts = Struct(getopt.optionValues)
310 opts = Struct(getopt.optionValues)
311 args = getopt.freeValues
311 args = getopt.freeValues
312
312
313 # this is the struct (which has default values at this point) with which
313 # this is the struct (which has default values at this point) with which
314 # we make all decisions:
314 # we make all decisions:
315 opts_all.update(opts)
315 opts_all.update(opts)
316
316
317 # Options that force an immediate exit
317 # Options that force an immediate exit
318 if opts_all.help:
318 if opts_all.help:
319 page(cmd_line_usage)
319 page(cmd_line_usage)
320 sys.exit()
320 sys.exit()
321
321
322 if opts_all.Version:
322 if opts_all.Version:
323 print __version__
323 print __version__
324 sys.exit()
324 sys.exit()
325
325
326 if opts_all.magic_docstrings:
326 if opts_all.magic_docstrings:
327 IP.magic_magic('-latex')
327 IP.magic_magic('-latex')
328 sys.exit()
328 sys.exit()
329
329
330 # add personal ipythondir to sys.path so that users can put things in
330 # add personal ipythondir to sys.path so that users can put things in
331 # there for customization
331 # there for customization
332 sys.path.append(os.path.abspath(opts_all.ipythondir))
332 sys.path.append(os.path.abspath(opts_all.ipythondir))
333
333
334 # Create user config directory if it doesn't exist. This must be done
334 # Create user config directory if it doesn't exist. This must be done
335 # *after* getting the cmd line options.
335 # *after* getting the cmd line options.
336 if not os.path.isdir(opts_all.ipythondir):
336 if not os.path.isdir(opts_all.ipythondir):
337 IP.user_setup(opts_all.ipythondir,rc_suffix,'install')
337 IP.user_setup(opts_all.ipythondir,rc_suffix,'install')
338
338
339 # upgrade user config files while preserving a copy of the originals
339 # upgrade user config files while preserving a copy of the originals
340 if opts_all.upgrade:
340 if opts_all.upgrade:
341 IP.user_setup(opts_all.ipythondir,rc_suffix,'upgrade')
341 IP.user_setup(opts_all.ipythondir,rc_suffix,'upgrade')
342
342
343 # check mutually exclusive options in the *original* command line
343 # check mutually exclusive options in the *original* command line
344 mutex_opts(opts,[qw('log logfile'),qw('rcfile profile'),
344 mutex_opts(opts,[qw('log logfile'),qw('rcfile profile'),
345 qw('classic profile'),qw('classic rcfile')])
345 qw('classic profile'),qw('classic rcfile')])
346
346
347 #---------------------------------------------------------------------------
347 #---------------------------------------------------------------------------
348 # Log replay
348 # Log replay
349
349
350 # if -logplay, we need to 'become' the other session. That basically means
350 # if -logplay, we need to 'become' the other session. That basically means
351 # replacing the current command line environment with that of the old
351 # replacing the current command line environment with that of the old
352 # session and moving on.
352 # session and moving on.
353
353
354 # this is needed so that later we know we're in session reload mode, as
354 # this is needed so that later we know we're in session reload mode, as
355 # opts_all will get overwritten:
355 # opts_all will get overwritten:
356 load_logplay = 0
356 load_logplay = 0
357
357
358 if opts_all.logplay:
358 if opts_all.logplay:
359 load_logplay = opts_all.logplay
359 load_logplay = opts_all.logplay
360 opts_debug_save = opts_all.debug
360 opts_debug_save = opts_all.debug
361 try:
361 try:
362 logplay = open(opts_all.logplay)
362 logplay = open(opts_all.logplay)
363 except IOError:
363 except IOError:
364 if opts_all.debug: IP.InteractiveTB()
364 if opts_all.debug: IP.InteractiveTB()
365 warn('Could not open logplay file '+`opts_all.logplay`)
365 warn('Could not open logplay file '+`opts_all.logplay`)
366 # restore state as if nothing had happened and move on, but make
366 # restore state as if nothing had happened and move on, but make
367 # sure that later we don't try to actually load the session file
367 # sure that later we don't try to actually load the session file
368 logplay = None
368 logplay = None
369 load_logplay = 0
369 load_logplay = 0
370 del opts_all.logplay
370 del opts_all.logplay
371 else:
371 else:
372 try:
372 try:
373 logplay.readline()
373 logplay.readline()
374 logplay.readline();
374 logplay.readline();
375 # this reloads that session's command line
375 # this reloads that session's command line
376 cmd = logplay.readline()[6:]
376 cmd = logplay.readline()[6:]
377 exec cmd
377 exec cmd
378 # restore the true debug flag given so that the process of
378 # restore the true debug flag given so that the process of
379 # session loading itself can be monitored.
379 # session loading itself can be monitored.
380 opts.debug = opts_debug_save
380 opts.debug = opts_debug_save
381 # save the logplay flag so later we don't overwrite the log
381 # save the logplay flag so later we don't overwrite the log
382 opts.logplay = load_logplay
382 opts.logplay = load_logplay
383 # now we must update our own structure with defaults
383 # now we must update our own structure with defaults
384 opts_all.update(opts)
384 opts_all.update(opts)
385 # now load args
385 # now load args
386 cmd = logplay.readline()[6:]
386 cmd = logplay.readline()[6:]
387 exec cmd
387 exec cmd
388 logplay.close()
388 logplay.close()
389 except:
389 except:
390 logplay.close()
390 logplay.close()
391 if opts_all.debug: IP.InteractiveTB()
391 if opts_all.debug: IP.InteractiveTB()
392 warn("Logplay file lacking full configuration information.\n"
392 warn("Logplay file lacking full configuration information.\n"
393 "I'll try to read it, but some things may not work.")
393 "I'll try to read it, but some things may not work.")
394
394
395 #-------------------------------------------------------------------------
395 #-------------------------------------------------------------------------
396 # set up output traps: catch all output from files, being run, modules
396 # set up output traps: catch all output from files, being run, modules
397 # loaded, etc. Then give it to the user in a clean form at the end.
397 # loaded, etc. Then give it to the user in a clean form at the end.
398
398
399 msg_out = 'Output messages. '
399 msg_out = 'Output messages. '
400 msg_err = 'Error messages. '
400 msg_err = 'Error messages. '
401 msg_sep = '\n'
401 msg_sep = '\n'
402 msg = Struct(config = OutputTrap('Configuration Loader',msg_out,
402 msg = Struct(config = OutputTrap('Configuration Loader',msg_out,
403 msg_err,msg_sep,debug,
403 msg_err,msg_sep,debug,
404 quiet_out=1),
404 quiet_out=1),
405 user_exec = OutputTrap('User File Execution',msg_out,
405 user_exec = OutputTrap('User File Execution',msg_out,
406 msg_err,msg_sep,debug),
406 msg_err,msg_sep,debug),
407 logplay = OutputTrap('Log Loader',msg_out,
407 logplay = OutputTrap('Log Loader',msg_out,
408 msg_err,msg_sep,debug),
408 msg_err,msg_sep,debug),
409 summary = ''
409 summary = ''
410 )
410 )
411
411
412 #-------------------------------------------------------------------------
412 #-------------------------------------------------------------------------
413 # Process user ipythonrc-type configuration files
413 # Process user ipythonrc-type configuration files
414
414
415 # turn on output trapping and log to msg.config
415 # turn on output trapping and log to msg.config
416 # remember that with debug on, trapping is actually disabled
416 # remember that with debug on, trapping is actually disabled
417 msg.config.trap_all()
417 msg.config.trap_all()
418
418
419 # look for rcfile in current or default directory
419 # look for rcfile in current or default directory
420 try:
420 try:
421 opts_all.rcfile = filefind(opts_all.rcfile,opts_all.ipythondir)
421 opts_all.rcfile = filefind(opts_all.rcfile,opts_all.ipythondir)
422 except IOError:
422 except IOError:
423 if opts_all.debug: IP.InteractiveTB()
423 if opts_all.debug: IP.InteractiveTB()
424 warn('Configuration file %s not found. Ignoring request.'
424 warn('Configuration file %s not found. Ignoring request.'
425 % (opts_all.rcfile) )
425 % (opts_all.rcfile) )
426
426
427 # 'profiles' are a shorthand notation for config filenames
427 # 'profiles' are a shorthand notation for config filenames
428 profile_handled_by_legacy = False
428 profile_handled_by_legacy = False
429 if opts_all.profile:
429 if opts_all.profile:
430
430
431 try:
431 try:
432 opts_all.rcfile = filefind('ipythonrc-' + opts_all.profile
432 opts_all.rcfile = filefind('ipythonrc-' + opts_all.profile
433 + rc_suffix,
433 + rc_suffix,
434 opts_all.ipythondir)
434 opts_all.ipythondir)
435 profile_handled_by_legacy = True
435 profile_handled_by_legacy = True
436 except IOError:
436 except IOError:
437 if opts_all.debug: IP.InteractiveTB()
437 if opts_all.debug: IP.InteractiveTB()
438 opts.profile = '' # remove profile from options if invalid
438 opts.profile = '' # remove profile from options if invalid
439 # We won't warn anymore, primary method is ipy_profile_PROFNAME
439 # We won't warn anymore, primary method is ipy_profile_PROFNAME
440 # which does trigger a warning.
440 # which does trigger a warning.
441
441
442 # load the config file
442 # load the config file
443 rcfiledata = None
443 rcfiledata = None
444 if opts_all.quick:
444 if opts_all.quick:
445 print 'Launching IPython in quick mode. No config file read.'
445 print 'Launching IPython in quick mode. No config file read.'
446 elif opts_all.rcfile:
446 elif opts_all.rcfile:
447 try:
447 try:
448 cfg_loader = ConfigLoader(conflict)
448 cfg_loader = ConfigLoader(conflict)
449 rcfiledata = cfg_loader.load(opts_all.rcfile,typeconv,
449 rcfiledata = cfg_loader.load(opts_all.rcfile,typeconv,
450 'include',opts_all.ipythondir,
450 'include',opts_all.ipythondir,
451 purge = 1,
451 purge = 1,
452 unique = conflict['preserve'])
452 unique = conflict['preserve'])
453 except:
453 except:
454 IP.InteractiveTB()
454 IP.InteractiveTB()
455 warn('Problems loading configuration file '+
455 warn('Problems loading configuration file '+
456 `opts_all.rcfile`+
456 `opts_all.rcfile`+
457 '\nStarting with default -bare bones- configuration.')
457 '\nStarting with default -bare bones- configuration.')
458 else:
458 else:
459 warn('No valid configuration file found in either currrent directory\n'+
459 warn('No valid configuration file found in either currrent directory\n'+
460 'or in the IPython config. directory: '+`opts_all.ipythondir`+
460 'or in the IPython config. directory: '+`opts_all.ipythondir`+
461 '\nProceeding with internal defaults.')
461 '\nProceeding with internal defaults.')
462
462
463 #------------------------------------------------------------------------
463 #------------------------------------------------------------------------
464 # Set exception handlers in mode requested by user.
464 # Set exception handlers in mode requested by user.
465 otrap = OutputTrap(trap_out=1) # trap messages from magic_xmode
465 otrap = OutputTrap(trap_out=1) # trap messages from magic_xmode
466 IP.magic_xmode(opts_all.xmode)
466 IP.magic_xmode(opts_all.xmode)
467 otrap.release_out()
467 otrap.release_out()
468
468
469 #------------------------------------------------------------------------
469 #------------------------------------------------------------------------
470 # Execute user config
470 # Execute user config
471
471
472 # Create a valid config structure with the right precedence order:
472 # Create a valid config structure with the right precedence order:
473 # defaults < rcfile < command line. This needs to be in the instance, so
473 # defaults < rcfile < command line. This needs to be in the instance, so
474 # that method calls below that rely on it find it.
474 # that method calls below that rely on it find it.
475 IP.rc = rc_def.copy()
475 IP.rc = rc_def.copy()
476
476
477 # Work with a local alias inside this routine to avoid unnecessary
477 # Work with a local alias inside this routine to avoid unnecessary
478 # attribute lookups.
478 # attribute lookups.
479 IP_rc = IP.rc
479 IP_rc = IP.rc
480
480
481 IP_rc.update(opts_def)
481 IP_rc.update(opts_def)
482 if rcfiledata:
482 if rcfiledata:
483 # now we can update
483 # now we can update
484 IP_rc.update(rcfiledata)
484 IP_rc.update(rcfiledata)
485 IP_rc.update(opts)
485 IP_rc.update(opts)
486 IP_rc.update(rc_override)
486 IP_rc.update(rc_override)
487
487
488 # Store the original cmd line for reference:
488 # Store the original cmd line for reference:
489 IP_rc.opts = opts
489 IP_rc.opts = opts
490 IP_rc.args = args
490 IP_rc.args = args
491
491
492 # create a *runtime* Struct like rc for holding parameters which may be
492 # create a *runtime* Struct like rc for holding parameters which may be
493 # created and/or modified by runtime user extensions.
493 # created and/or modified by runtime user extensions.
494 IP.runtime_rc = Struct()
494 IP.runtime_rc = Struct()
495
495
496 # from this point on, all config should be handled through IP_rc,
496 # from this point on, all config should be handled through IP_rc,
497 # opts* shouldn't be used anymore.
497 # opts* shouldn't be used anymore.
498
498
499
499
500 # update IP_rc with some special things that need manual
500 # update IP_rc with some special things that need manual
501 # tweaks. Basically options which affect other options. I guess this
501 # tweaks. Basically options which affect other options. I guess this
502 # should just be written so that options are fully orthogonal and we
502 # should just be written so that options are fully orthogonal and we
503 # wouldn't worry about this stuff!
503 # wouldn't worry about this stuff!
504
504
505 if IP_rc.classic:
505 if IP_rc.classic:
506 IP_rc.quick = 1
506 IP_rc.quick = 1
507 IP_rc.cache_size = 0
507 IP_rc.cache_size = 0
508 IP_rc.pprint = 0
508 IP_rc.pprint = 0
509 IP_rc.prompt_in1 = '>>> '
509 IP_rc.prompt_in1 = '>>> '
510 IP_rc.prompt_in2 = '... '
510 IP_rc.prompt_in2 = '... '
511 IP_rc.prompt_out = ''
511 IP_rc.prompt_out = ''
512 IP_rc.separate_in = IP_rc.separate_out = IP_rc.separate_out2 = '0'
512 IP_rc.separate_in = IP_rc.separate_out = IP_rc.separate_out2 = '0'
513 IP_rc.colors = 'NoColor'
513 IP_rc.colors = 'NoColor'
514 IP_rc.xmode = 'Plain'
514 IP_rc.xmode = 'Plain'
515
515
516 IP.pre_config_initialization()
516 IP.pre_config_initialization()
517 # configure readline
517 # configure readline
518 # Define the history file for saving commands in between sessions
518 # Define the history file for saving commands in between sessions
519 if IP_rc.profile:
519 if IP_rc.profile:
520 histfname = 'history-%s' % IP_rc.profile
520 histfname = 'history-%s' % IP_rc.profile
521 else:
521 else:
522 histfname = 'history'
522 histfname = 'history'
523 IP.histfile = os.path.join(opts_all.ipythondir,histfname)
523 IP.histfile = os.path.join(opts_all.ipythondir,histfname)
524
524
525 # update exception handlers with rc file status
525 # update exception handlers with rc file status
526 otrap.trap_out() # I don't want these messages ever.
526 otrap.trap_out() # I don't want these messages ever.
527 IP.magic_xmode(IP_rc.xmode)
527 IP.magic_xmode(IP_rc.xmode)
528 otrap.release_out()
528 otrap.release_out()
529
529
530 # activate logging if requested and not reloading a log
530 # activate logging if requested and not reloading a log
531 if IP_rc.logplay:
531 if IP_rc.logplay:
532 IP.magic_logstart(IP_rc.logplay + ' append')
532 IP.magic_logstart(IP_rc.logplay + ' append')
533 elif IP_rc.logfile:
533 elif IP_rc.logfile:
534 IP.magic_logstart(IP_rc.logfile)
534 IP.magic_logstart(IP_rc.logfile)
535 elif IP_rc.log:
535 elif IP_rc.log:
536 IP.magic_logstart()
536 IP.magic_logstart()
537
537
538 # find user editor so that it we don't have to look it up constantly
538 # find user editor so that it we don't have to look it up constantly
539 if IP_rc.editor.strip()=='0':
539 if IP_rc.editor.strip()=='0':
540 try:
540 try:
541 ed = os.environ['EDITOR']
541 ed = os.environ['EDITOR']
542 except KeyError:
542 except KeyError:
543 if os.name == 'posix':
543 if os.name == 'posix':
544 ed = 'vi' # the only one guaranteed to be there!
544 ed = 'vi' # the only one guaranteed to be there!
545 else:
545 else:
546 ed = 'notepad' # same in Windows!
546 ed = 'notepad' # same in Windows!
547 IP_rc.editor = ed
547 IP_rc.editor = ed
548
548
549 # Keep track of whether this is an embedded instance or not (useful for
549 # Keep track of whether this is an embedded instance or not (useful for
550 # post-mortems).
550 # post-mortems).
551 IP_rc.embedded = IP.embedded
551 IP_rc.embedded = IP.embedded
552
552
553 # Recursive reload
553 # Recursive reload
554 try:
554 try:
555 from IPython import deep_reload
555 from IPython import deep_reload
556 if IP_rc.deep_reload:
556 if IP_rc.deep_reload:
557 __builtin__.reload = deep_reload.reload
557 __builtin__.reload = deep_reload.reload
558 else:
558 else:
559 __builtin__.dreload = deep_reload.reload
559 __builtin__.dreload = deep_reload.reload
560 del deep_reload
560 del deep_reload
561 except ImportError:
561 except ImportError:
562 pass
562 pass
563
563
564 # Save the current state of our namespace so that the interactive shell
564 # Save the current state of our namespace so that the interactive shell
565 # can later know which variables have been created by us from config files
565 # can later know which variables have been created by us from config files
566 # and loading. This way, loading a file (in any way) is treated just like
566 # and loading. This way, loading a file (in any way) is treated just like
567 # defining things on the command line, and %who works as expected.
567 # defining things on the command line, and %who works as expected.
568
568
569 # DON'T do anything that affects the namespace beyond this point!
569 # DON'T do anything that affects the namespace beyond this point!
570 IP.internal_ns.update(__main__.__dict__)
570 IP.internal_ns.update(__main__.__dict__)
571
571
572 #IP.internal_ns.update(locals()) # so our stuff doesn't show up in %who
572 #IP.internal_ns.update(locals()) # so our stuff doesn't show up in %who
573
573
574 # Now run through the different sections of the users's config
574 # Now run through the different sections of the users's config
575 if IP_rc.debug:
575 if IP_rc.debug:
576 print 'Trying to execute the following configuration structure:'
576 print 'Trying to execute the following configuration structure:'
577 print '(Things listed first are deeper in the inclusion tree and get'
577 print '(Things listed first are deeper in the inclusion tree and get'
578 print 'loaded first).\n'
578 print 'loaded first).\n'
579 pprint(IP_rc.__dict__)
579 pprint(IP_rc.__dict__)
580
580
581 for mod in IP_rc.import_mod:
581 for mod in IP_rc.import_mod:
582 try:
582 try:
583 exec 'import '+mod in IP.user_ns
583 exec 'import '+mod in IP.user_ns
584 except :
584 except :
585 IP.InteractiveTB()
585 IP.InteractiveTB()
586 import_fail_info(mod)
586 import_fail_info(mod)
587
587
588 for mod_fn in IP_rc.import_some:
588 for mod_fn in IP_rc.import_some:
589 if not mod_fn == []:
589 if not mod_fn == []:
590 mod,fn = mod_fn[0],','.join(mod_fn[1:])
590 mod,fn = mod_fn[0],','.join(mod_fn[1:])
591 try:
591 try:
592 exec 'from '+mod+' import '+fn in IP.user_ns
592 exec 'from '+mod+' import '+fn in IP.user_ns
593 except :
593 except :
594 IP.InteractiveTB()
594 IP.InteractiveTB()
595 import_fail_info(mod,fn)
595 import_fail_info(mod,fn)
596
596
597 for mod in IP_rc.import_all:
597 for mod in IP_rc.import_all:
598 try:
598 try:
599 exec 'from '+mod+' import *' in IP.user_ns
599 exec 'from '+mod+' import *' in IP.user_ns
600 except :
600 except :
601 IP.InteractiveTB()
601 IP.InteractiveTB()
602 import_fail_info(mod)
602 import_fail_info(mod)
603
603
604 for code in IP_rc.execute:
604 for code in IP_rc.execute:
605 try:
605 try:
606 exec code in IP.user_ns
606 exec code in IP.user_ns
607 except:
607 except:
608 IP.InteractiveTB()
608 IP.InteractiveTB()
609 warn('Failure executing code: ' + `code`)
609 warn('Failure executing code: ' + `code`)
610
610
611 # Execute the files the user wants in ipythonrc
611 # Execute the files the user wants in ipythonrc
612 for file in IP_rc.execfile:
612 for file in IP_rc.execfile:
613 try:
613 try:
614 file = filefind(file,sys.path+[IPython_dir])
614 file = filefind(file,sys.path+[IPython_dir])
615 except IOError:
615 except IOError:
616 warn(itpl('File $file not found. Skipping it.'))
616 warn(itpl('File $file not found. Skipping it.'))
617 else:
617 else:
618 IP.safe_execfile(os.path.expanduser(file),IP.user_ns)
618 IP.safe_execfile(os.path.expanduser(file),IP.user_ns)
619
619
620 # finally, try importing ipy_*_conf for final configuration
620 # finally, try importing ipy_*_conf for final configuration
621 try:
621 try:
622 import ipy_system_conf
622 import ipy_system_conf
623 except ImportError:
623 except ImportError:
624 if opts_all.debug: IP.InteractiveTB()
624 if opts_all.debug: IP.InteractiveTB()
625 warn("Could not import 'ipy_system_conf'")
625 warn("Could not import 'ipy_system_conf'")
626 except:
626 except:
627 IP.InteractiveTB()
627 IP.InteractiveTB()
628 import_fail_info('ipy_system_conf')
628 import_fail_info('ipy_system_conf')
629
629
630 # only import prof module if ipythonrc-PROF was not found
630 # only import prof module if ipythonrc-PROF was not found
631 if opts_all.profile and not profile_handled_by_legacy:
631 if opts_all.profile and not profile_handled_by_legacy:
632 profmodname = 'ipy_profile_' + opts_all.profile
632 profmodname = 'ipy_profile_' + opts_all.profile
633 try:
633 try:
634 __import__(profmodname)
634 __import__(profmodname)
635 except:
635 except:
636 IP.InteractiveTB()
636 IP.InteractiveTB()
637 print "Error importing",profmodname,"- perhaps you should run %upgrade?"
637 print "Error importing",profmodname,"- perhaps you should run %upgrade?"
638 import_fail_info(profmodname)
638 import_fail_info(profmodname)
639 else:
639 else:
640 import ipy_profile_none
640 import ipy_profile_none
641 try:
641 try:
642 import ipy_user_conf
642 import ipy_user_conf
643
643
644 except:
644 except:
645 conf = opts_all.ipythondir + "/ipy_user_conf.py"
645 conf = opts_all.ipythondir + "/ipy_user_conf.py"
646 IP.InteractiveTB()
646 IP.InteractiveTB()
647 if not os.path.isfile(conf):
647 if not os.path.isfile(conf):
648 warn(conf + ' does not exist, please run %upgrade!')
648 warn(conf + ' does not exist, please run %upgrade!')
649
649
650 import_fail_info("ipy_user_conf")
650 import_fail_info("ipy_user_conf")
651
651
652 # finally, push the argv to options again to ensure highest priority
652 # finally, push the argv to options again to ensure highest priority
653 IP_rc.update(opts)
653 IP_rc.update(opts)
654
654
655 # release stdout and stderr and save config log into a global summary
655 # release stdout and stderr and save config log into a global summary
656 msg.config.release_all()
656 msg.config.release_all()
657 if IP_rc.messages:
657 if IP_rc.messages:
658 msg.summary += msg.config.summary_all()
658 msg.summary += msg.config.summary_all()
659
659
660 #------------------------------------------------------------------------
660 #------------------------------------------------------------------------
661 # Setup interactive session
661 # Setup interactive session
662
662
663 # Now we should be fully configured. We can then execute files or load
663 # Now we should be fully configured. We can then execute files or load
664 # things only needed for interactive use. Then we'll open the shell.
664 # things only needed for interactive use. Then we'll open the shell.
665
665
666 # Take a snapshot of the user namespace before opening the shell. That way
666 # Take a snapshot of the user namespace before opening the shell. That way
667 # we'll be able to identify which things were interactively defined and
667 # we'll be able to identify which things were interactively defined and
668 # which were defined through config files.
668 # which were defined through config files.
669 IP.user_config_ns.update(IP.user_ns)
669 IP.user_config_ns.update(IP.user_ns)
670
670
671 # Force reading a file as if it were a session log. Slower but safer.
671 # Force reading a file as if it were a session log. Slower but safer.
672 if load_logplay:
672 if load_logplay:
673 print 'Replaying log...'
673 print 'Replaying log...'
674 try:
674 try:
675 if IP_rc.debug:
675 if IP_rc.debug:
676 logplay_quiet = 0
676 logplay_quiet = 0
677 else:
677 else:
678 logplay_quiet = 1
678 logplay_quiet = 1
679
679
680 msg.logplay.trap_all()
680 msg.logplay.trap_all()
681 IP.safe_execfile(load_logplay,IP.user_ns,
681 IP.safe_execfile(load_logplay,IP.user_ns,
682 islog = 1, quiet = logplay_quiet)
682 islog = 1, quiet = logplay_quiet)
683 msg.logplay.release_all()
683 msg.logplay.release_all()
684 if IP_rc.messages:
684 if IP_rc.messages:
685 msg.summary += msg.logplay.summary_all()
685 msg.summary += msg.logplay.summary_all()
686 except:
686 except:
687 warn('Problems replaying logfile %s.' % load_logplay)
687 warn('Problems replaying logfile %s.' % load_logplay)
688 IP.InteractiveTB()
688 IP.InteractiveTB()
689
689
690 # Load remaining files in command line
690 # Load remaining files in command line
691 msg.user_exec.trap_all()
691 msg.user_exec.trap_all()
692
692
693 # Do NOT execute files named in the command line as scripts to be loaded
693 # Do NOT execute files named in the command line as scripts to be loaded
694 # by embedded instances. Doing so has the potential for an infinite
694 # by embedded instances. Doing so has the potential for an infinite
695 # recursion if there are exceptions thrown in the process.
695 # recursion if there are exceptions thrown in the process.
696
696
697 # XXX FIXME: the execution of user files should be moved out to after
697 # XXX FIXME: the execution of user files should be moved out to after
698 # ipython is fully initialized, just as if they were run via %run at the
698 # ipython is fully initialized, just as if they were run via %run at the
699 # ipython prompt. This would also give them the benefit of ipython's
699 # ipython prompt. This would also give them the benefit of ipython's
700 # nice tracebacks.
700 # nice tracebacks.
701
701
702 if (not embedded and IP_rc.args and
702 if (not embedded and IP_rc.args and
703 not IP_rc.args[0].lower().endswith('.ipy')):
703 not IP_rc.args[0].lower().endswith('.ipy')):
704 name_save = IP.user_ns['__name__']
704 name_save = IP.user_ns['__name__']
705 IP.user_ns['__name__'] = '__main__'
705 IP.user_ns['__name__'] = '__main__'
706 # Set our own excepthook in case the user code tries to call it
706 # Set our own excepthook in case the user code tries to call it
707 # directly. This prevents triggering the IPython crash handler.
707 # directly. This prevents triggering the IPython crash handler.
708 old_excepthook,sys.excepthook = sys.excepthook, IP.excepthook
708 old_excepthook,sys.excepthook = sys.excepthook, IP.excepthook
709
709
710 save_argv = sys.argv[1:] # save it for later restoring
710 save_argv = sys.argv[1:] # save it for later restoring
711
711
712 sys.argv = args
712 sys.argv = args
713
713
714 try:
714 try:
715 IP.safe_execfile(args[0], IP.user_ns)
715 IP.safe_execfile(args[0], IP.user_ns)
716 finally:
716 finally:
717 # Reset our crash handler in place
717 # Reset our crash handler in place
718 sys.excepthook = old_excepthook
718 sys.excepthook = old_excepthook
719 sys.argv[:] = save_argv
719 sys.argv[:] = save_argv
720 IP.user_ns['__name__'] = name_save
720 IP.user_ns['__name__'] = name_save
721
721
722 msg.user_exec.release_all()
722 msg.user_exec.release_all()
723
723
724 if IP_rc.messages:
724 if IP_rc.messages:
725 msg.summary += msg.user_exec.summary_all()
725 msg.summary += msg.user_exec.summary_all()
726
726
727 # since we can't specify a null string on the cmd line, 0 is the equivalent:
727 # since we can't specify a null string on the cmd line, 0 is the equivalent:
728 if IP_rc.nosep:
728 if IP_rc.nosep:
729 IP_rc.separate_in = IP_rc.separate_out = IP_rc.separate_out2 = '0'
729 IP_rc.separate_in = IP_rc.separate_out = IP_rc.separate_out2 = '0'
730 if IP_rc.separate_in == '0': IP_rc.separate_in = ''
730 if IP_rc.separate_in == '0': IP_rc.separate_in = ''
731 if IP_rc.separate_out == '0': IP_rc.separate_out = ''
731 if IP_rc.separate_out == '0': IP_rc.separate_out = ''
732 if IP_rc.separate_out2 == '0': IP_rc.separate_out2 = ''
732 if IP_rc.separate_out2 == '0': IP_rc.separate_out2 = ''
733 IP_rc.separate_in = IP_rc.separate_in.replace('\\n','\n')
733 IP_rc.separate_in = IP_rc.separate_in.replace('\\n','\n')
734 IP_rc.separate_out = IP_rc.separate_out.replace('\\n','\n')
734 IP_rc.separate_out = IP_rc.separate_out.replace('\\n','\n')
735 IP_rc.separate_out2 = IP_rc.separate_out2.replace('\\n','\n')
735 IP_rc.separate_out2 = IP_rc.separate_out2.replace('\\n','\n')
736
736
737 # Determine how many lines at the bottom of the screen are needed for
737 # Determine how many lines at the bottom of the screen are needed for
738 # showing prompts, so we can know wheter long strings are to be printed or
738 # showing prompts, so we can know wheter long strings are to be printed or
739 # paged:
739 # paged:
740 num_lines_bot = IP_rc.separate_in.count('\n')+1
740 num_lines_bot = IP_rc.separate_in.count('\n')+1
741 IP_rc.screen_length = IP_rc.screen_length - num_lines_bot
741 IP_rc.screen_length = IP_rc.screen_length - num_lines_bot
742
742
743 # configure startup banner
743 # configure startup banner
744 if IP_rc.c: # regular python doesn't print the banner with -c
744 if IP_rc.c: # regular python doesn't print the banner with -c
745 IP_rc.banner = 0
745 IP_rc.banner = 0
746 if IP_rc.banner:
746 if IP_rc.banner:
747 BANN_P = IP.BANNER_PARTS
747 BANN_P = IP.BANNER_PARTS
748 else:
748 else:
749 BANN_P = []
749 BANN_P = []
750
750
751 if IP_rc.profile: BANN_P.append('IPython profile: %s\n' % IP_rc.profile)
751 if IP_rc.profile: BANN_P.append('IPython profile: %s\n' % IP_rc.profile)
752
752
753 # add message log (possibly empty)
753 # add message log (possibly empty)
754 if msg.summary: BANN_P.append(msg.summary)
754 if msg.summary: BANN_P.append(msg.summary)
755 # Final banner is a string
755 # Final banner is a string
756 IP.BANNER = '\n'.join(BANN_P)
756 IP.BANNER = '\n'.join(BANN_P)
757
757
758 # Finalize the IPython instance. This assumes the rc structure is fully
758 # Finalize the IPython instance. This assumes the rc structure is fully
759 # in place.
759 # in place.
760 IP.post_config_initialization()
760 IP.post_config_initialization()
761
761
762 return IP
762 return IP
763 #************************ end of file <ipmaker.py> **************************
763 #************************ end of file <ipmaker.py> **************************
@@ -1,652 +1,654 b''
1 # -*- coding: utf-8 -*-
1 # -*- coding: utf-8 -*-
2 #*****************************************************************************
2 #*****************************************************************************
3 # Copyright (C) 2001-2004 Fernando Perez. <fperez@colorado.edu>
3 # Copyright (C) 2001-2004 Fernando Perez. <fperez@colorado.edu>
4 #
4 #
5 # Distributed under the terms of the BSD License. The full license is in
5 # Distributed under the terms of the BSD License. The full license is in
6 # the file COPYING, distributed as part of this software.
6 # the file COPYING, distributed as part of this software.
7 #*****************************************************************************
7 #*****************************************************************************
8
8
9 # $Id: usage.py 2710 2007-09-04 21:10:10Z vivainio $
9 # $Id: usage.py 2723 2007-09-07 07:44:16Z fperez $
10
10
11 from IPython import Release
11 from IPython import Release
12 __author__ = '%s <%s>' % Release.authors['Fernando']
12 __author__ = '%s <%s>' % Release.authors['Fernando']
13 __license__ = Release.license
13 __license__ = Release.license
14 __version__ = Release.version
14 __version__ = Release.version
15
15
16 __doc__ = """
16 __doc__ = """
17 IPython -- An enhanced Interactive Python
17 IPython -- An enhanced Interactive Python
18 =========================================
18 =========================================
19
19
20 A Python shell with automatic history (input and output), dynamic object
20 A Python shell with automatic history (input and output), dynamic object
21 introspection, easier configuration, command completion, access to the system
21 introspection, easier configuration, command completion, access to the system
22 shell and more.
22 shell and more.
23
23
24 IPython can also be embedded in running programs. See EMBEDDING below.
24 IPython can also be embedded in running programs. See EMBEDDING below.
25
25
26
26
27 USAGE
27 USAGE
28 ipython [options] files
28 ipython [options] files
29
29
30 If invoked with no options, it executes all the files listed in
30 If invoked with no options, it executes all the files listed in
31 sequence and drops you into the interpreter while still acknowledging
31 sequence and drops you into the interpreter while still acknowledging
32 any options you may have set in your ipythonrc file. This behavior is
32 any options you may have set in your ipythonrc file. This behavior is
33 different from standard Python, which when called as python -i will
33 different from standard Python, which when called as python -i will
34 only execute one file and will ignore your configuration setup.
34 only execute one file and will ignore your configuration setup.
35
35
36 Please note that some of the configuration options are not available at
36 Please note that some of the configuration options are not available at
37 the command line, simply because they are not practical here. Look into
37 the command line, simply because they are not practical here. Look into
38 your ipythonrc configuration file for details on those. This file
38 your ipythonrc configuration file for details on those. This file
39 typically installed in the $HOME/.ipython directory.
39 typically installed in the $HOME/.ipython directory.
40
40
41 For Windows users, $HOME resolves to C:\\Documents and
41 For Windows users, $HOME resolves to C:\\Documents and
42 Settings\\YourUserName in most instances, and _ipython is used instead
42 Settings\\YourUserName in most instances, and _ipython is used instead
43 of .ipython, since some Win32 programs have problems with dotted names
43 of .ipython, since some Win32 programs have problems with dotted names
44 in directories.
44 in directories.
45
45
46 In the rest of this text, we will refer to this directory as
46 In the rest of this text, we will refer to this directory as
47 IPYTHONDIR.
47 IPYTHONDIR.
48
48
49
49
50 SPECIAL THREADING OPTIONS
50 SPECIAL THREADING OPTIONS
51 The following special options are ONLY valid at the beginning of the
51 The following special options are ONLY valid at the beginning of the
52 command line, and not later. This is because they control the initial-
52 command line, and not later. This is because they control the initial-
53 ization of ipython itself, before the normal option-handling mechanism
53 ization of ipython itself, before the normal option-handling mechanism
54 is active.
54 is active.
55
55
56 -gthread, -qthread, -q4thread, -wthread, -pylab
56 -gthread, -qthread, -q4thread, -wthread, -pylab
57
57
58 Only ONE of these can be given, and it can only be given as the
58 Only ONE of these can be given, and it can only be given as the
59 first option passed to IPython (it will have no effect in any
59 first option passed to IPython (it will have no effect in any
60 other position). They provide threading support for the GTK, QT
60 other position). They provide threading support for the GTK, QT
61 and WXWidgets toolkits, and for the matplotlib library.
61 and WXWidgets toolkits, and for the matplotlib library.
62
62
63 With any of the first four options, IPython starts running a
63 With any of the first four options, IPython starts running a
64 separate thread for the graphical toolkit's operation, so that
64 separate thread for the graphical toolkit's operation, so that
65 you can open and control graphical elements from within an
65 you can open and control graphical elements from within an
66 IPython command line, without blocking. All four provide
66 IPython command line, without blocking. All four provide
67 essentially the same functionality, respectively for GTK, QT3,
67 essentially the same functionality, respectively for GTK, QT3,
68 QT4 and WXWidgets (via their Python interfaces).
68 QT4 and WXWidgets (via their Python interfaces).
69
69
70 Note that with -wthread, you can additionally use the -wxversion
70 Note that with -wthread, you can additionally use the -wxversion
71 option to request a specific version of wx to be used. This
71 option to request a specific version of wx to be used. This
72 requires that you have the 'wxversion' Python module installed,
72 requires that you have the 'wxversion' Python module installed,
73 which is part of recent wxPython distributions.
73 which is part of recent wxPython distributions.
74
74
75 If -pylab is given, IPython loads special support for the mat-
75 If -pylab is given, IPython loads special support for the mat-
76 plotlib library (http://matplotlib.sourceforge.net), allowing
76 plotlib library (http://matplotlib.sourceforge.net), allowing
77 interactive usage of any of its backends as defined in the
77 interactive usage of any of its backends as defined in the
78 user's .matplotlibrc file. It automatically activates GTK, QT
78 user's .matplotlibrc file. It automatically activates GTK, QT
79 or WX threading for IPyhton if the choice of matplotlib backend
79 or WX threading for IPyhton if the choice of matplotlib backend
80 requires it. It also modifies the %run command to correctly
80 requires it. It also modifies the %run command to correctly
81 execute (without blocking) any matplotlib-based script which
81 execute (without blocking) any matplotlib-based script which
82 calls show() at the end.
82 calls show() at the end.
83
83
84 -tk The -g/q/q4/wthread options, and -pylab (if matplotlib is
84 -tk The -g/q/q4/wthread options, and -pylab (if matplotlib is
85 configured to use GTK, QT or WX), will normally block Tk
85 configured to use GTK, QT or WX), will normally block Tk
86 graphical interfaces. This means that when GTK, QT or WX
86 graphical interfaces. This means that when GTK, QT or WX
87 threading is active, any attempt to open a Tk GUI will result in
87 threading is active, any attempt to open a Tk GUI will result in
88 a dead window, and possibly cause the Python interpreter to
88 a dead window, and possibly cause the Python interpreter to
89 crash. An extra option, -tk, is available to address this
89 crash. An extra option, -tk, is available to address this
90 issue. It can ONLY be given as a SECOND option after any of the
90 issue. It can ONLY be given as a SECOND option after any of the
91 above (-gthread, -qthread, q4thread, -wthread or -pylab).
91 above (-gthread, -qthread, q4thread, -wthread or -pylab).
92
92
93 If -tk is given, IPython will try to coordinate Tk threading
93 If -tk is given, IPython will try to coordinate Tk threading
94 with GTK, QT or WX. This is however potentially unreliable, and
94 with GTK, QT or WX. This is however potentially unreliable, and
95 you will have to test on your platform and Python configuration
95 you will have to test on your platform and Python configuration
96 to determine whether it works for you. Debian users have
96 to determine whether it works for you. Debian users have
97 reported success, apparently due to the fact that Debian builds
97 reported success, apparently due to the fact that Debian builds
98 all of Tcl, Tk, Tkinter and Python with pthreads support. Under
98 all of Tcl, Tk, Tkinter and Python with pthreads support. Under
99 other Linux environments (such as Fedora Core 2/3), this option
99 other Linux environments (such as Fedora Core 2/3), this option
100 has caused random crashes and lockups of the Python interpreter.
100 has caused random crashes and lockups of the Python interpreter.
101 Under other operating systems (Mac OSX and Windows), you'll need
101 Under other operating systems (Mac OSX and Windows), you'll need
102 to try it to find out, since currently no user reports are
102 to try it to find out, since currently no user reports are
103 available.
103 available.
104
104
105 There is unfortunately no way for IPython to determine at run-
105 There is unfortunately no way for IPython to determine at run-
106 time whether -tk will work reliably or not, so you will need to
106 time whether -tk will work reliably or not, so you will need to
107 do some experiments before relying on it for regular work.
107 do some experiments before relying on it for regular work.
108
108
109 A WARNING ABOUT SIGNALS AND THREADS
109 A WARNING ABOUT SIGNALS AND THREADS
110
110
111 When any of the thread systems (GTK, QT or WX) are active, either
111 When any of the thread systems (GTK, QT or WX) are active, either
112 directly or via -pylab with a threaded backend, it is impossible to
112 directly or via -pylab with a threaded backend, it is impossible to
113 interrupt long-running Python code via Ctrl-C. IPython can not pass
113 interrupt long-running Python code via Ctrl-C. IPython can not pass
114 the KeyboardInterrupt exception (or the underlying SIGINT) across
114 the KeyboardInterrupt exception (or the underlying SIGINT) across
115 threads, so any long-running process started from IPython will run to
115 threads, so any long-running process started from IPython will run to
116 completion, or will have to be killed via an external (OS-based)
116 completion, or will have to be killed via an external (OS-based)
117 mechanism.
117 mechanism.
118
118
119 To the best of my knowledge, this limitation is imposed by the Python
119 To the best of my knowledge, this limitation is imposed by the Python
120 interpreter itself, and it comes from the difficulty of writing
120 interpreter itself, and it comes from the difficulty of writing
121 portable signal/threaded code. If any user is an expert on this topic
121 portable signal/threaded code. If any user is an expert on this topic
122 and can suggest a better solution, I would love to hear about it. In
122 and can suggest a better solution, I would love to hear about it. In
123 the IPython sources, look at the Shell.py module, and in particular at
123 the IPython sources, look at the Shell.py module, and in particular at
124 the runcode() method.
124 the runcode() method.
125
125
126 REGULAR OPTIONS
126 REGULAR OPTIONS
127 After the above threading options have been given, regular options can
127 After the above threading options have been given, regular options can
128 follow in any order. All options can be abbreviated to their shortest
128 follow in any order. All options can be abbreviated to their shortest
129 non-ambiguous form and are case-sensitive. One or two dashes can be
129 non-ambiguous form and are case-sensitive. One or two dashes can be
130 used. Some options have an alternate short form, indicated after a |.
130 used. Some options have an alternate short form, indicated after a |.
131
131
132 Most options can also be set from your ipythonrc configuration file.
132 Most options can also be set from your ipythonrc configuration file.
133 See the provided examples for assistance. Options given on the comman-
133 See the provided examples for assistance. Options given on the comman-
134 dline override the values set in the ipythonrc file.
134 dline override the values set in the ipythonrc file.
135
135
136 All options with a [no] prepended can be specified in negated form
136 All options with a [no] prepended can be specified in negated form
137 (using -nooption instead of -option) to turn the feature off.
137 (using -nooption instead of -option) to turn the feature off.
138
138
139 -h, --help
139 -h, --help
140 Show summary of options.
140 Show summary of options.
141
141
142 -pylab This can only be given as the first option passed to IPython (it
142 -pylab This can only be given as the first option passed to IPython (it
143 will have no effect in any other position). It adds special sup-
143 will have no effect in any other position). It adds special sup-
144 port for the matplotlib library (http://matplotlib.source-
144 port for the matplotlib library (http://matplotlib.source-
145 forge.net), allowing interactive usage of any of its backends as
145 forge.net), allowing interactive usage of any of its backends as
146 defined in the user's .matplotlibrc file. It automatically
146 defined in the user's .matplotlibrc file. It automatically
147 activates GTK or WX threading for IPyhton if the choice of mat-
147 activates GTK or WX threading for IPyhton if the choice of mat-
148 plotlib backend requires it. It also modifies the @run command
148 plotlib backend requires it. It also modifies the @run command
149 to correctly execute (without blocking) any matplotlib-based
149 to correctly execute (without blocking) any matplotlib-based
150 script which calls show() at the end.
150 script which calls show() at the end.
151
151
152 -autocall <val>
152 -autocall <val>
153 Make IPython automatically call any callable object even if you
153 Make IPython automatically call any callable object even if you
154 didn't type explicit parentheses. For example, 'str 43' becomes
154 didn't type explicit parentheses. For example, 'str 43' becomes
155 'str(43)' automatically. The value can be '0' to disable the
155 'str(43)' automatically. The value can be '0' to disable the
156 feature, '1' for 'smart' autocall, where it is not applied if
156 feature, '1' for 'smart' autocall, where it is not applied if
157 there are no more arguments on the line, and '2' for 'full'
157 there are no more arguments on the line, and '2' for 'full'
158 autocall, where all callable objects are automatically called
158 autocall, where all callable objects are automatically called
159 (even if no arguments are present). The default is '1'.
159 (even if no arguments are present). The default is '1'.
160
160
161 -[no]autoindent
161 -[no]autoindent
162 Turn automatic indentation on/off.
162 Turn automatic indentation on/off.
163
163
164 -[no]automagic
164 -[no]automagic
165 Make magic commands automatic (without needing their first char-
165 Make magic commands automatic (without needing their first char-
166 acter to be %). Type %magic at the IPython prompt for more
166 acter to be %). Type %magic at the IPython prompt for more
167 information.
167 information.
168
168
169 -[no]autoedit_syntax
169 -[no]autoedit_syntax
170 When a syntax error occurs after editing a file, automatically
170 When a syntax error occurs after editing a file, automatically
171 open the file to the trouble causing line for convenient fixing.
171 open the file to the trouble causing line for convenient fixing.
172
172
173 -[no]banner
173 -[no]banner
174 Print the intial information banner (default on).
174 Print the intial information banner (default on).
175
175
176 -c <command>
176 -c <command>
177 Execute the given command string, and set sys.argv to ['c'].
177 Execute the given command string, and set sys.argv to ['c'].
178 This is similar to the -c option in the normal Python inter-
178 This is similar to the -c option in the normal Python inter-
179 preter.
179 preter.
180
180
181 -cache_size|cs <n>
181 -cache_size|cs <n>
182 Size of the output cache (maximum number of entries to hold in
182 Size of the output cache (maximum number of entries to hold in
183 memory). The default is 1000, you can change it permanently in
183 memory). The default is 1000, you can change it permanently in
184 your config file. Setting it to 0 completely disables the
184 your config file. Setting it to 0 completely disables the
185 caching system, and the minimum value accepted is 20 (if you
185 caching system, and the minimum value accepted is 20 (if you
186 provide a value less than 20, it is reset to 0 and a warning is
186 provide a value less than 20, it is reset to 0 and a warning is
187 issued). This limit is defined because otherwise you'll spend
187 issued). This limit is defined because otherwise you'll spend
188 more time re-flushing a too small cache than working.
188 more time re-flushing a too small cache than working.
189
189
190 -classic|cl
190 -classic|cl
191 Gives IPython a similar feel to the classic Python prompt.
191 Gives IPython a similar feel to the classic Python prompt.
192
192
193 -colors <scheme>
193 -colors <scheme>
194 Color scheme for prompts and exception reporting. Currently
194 Color scheme for prompts and exception reporting. Currently
195 implemented: NoColor, Linux, and LightBG.
195 implemented: NoColor, Linux, and LightBG.
196
196
197 -[no]color_info
197 -[no]color_info
198 IPython can display information about objects via a set of func-
198 IPython can display information about objects via a set of func-
199 tions, and optionally can use colors for this, syntax highlight-
199 tions, and optionally can use colors for this, syntax highlight-
200 ing source code and various other elements. However, because
200 ing source code and various other elements. However, because
201 this information is passed through a pager (like 'less') and
201 this information is passed through a pager (like 'less') and
202 many pagers get confused with color codes, this option is off by
202 many pagers get confused with color codes, this option is off by
203 default. You can test it and turn it on permanently in your
203 default. You can test it and turn it on permanently in your
204 ipythonrc file if it works for you. As a reference, the 'less'
204 ipythonrc file if it works for you. As a reference, the 'less'
205 pager supplied with Mandrake 8.2 works ok, but that in RedHat
205 pager supplied with Mandrake 8.2 works ok, but that in RedHat
206 7.2 doesn't.
206 7.2 doesn't.
207
207
208 Test it and turn it on permanently if it works with your system.
208 Test it and turn it on permanently if it works with your system.
209 The magic function @color_info allows you to toggle this inter-
209 The magic function @color_info allows you to toggle this inter-
210 actively for testing.
210 actively for testing.
211
211
212 -[no]confirm_exit
212 -[no]confirm_exit
213 Set to confirm when you try to exit IPython with an EOF (Con-
213 Set to confirm when you try to exit IPython with an EOF (Con-
214 trol-D in Unix, Control-Z/Enter in Windows). Note that using the
214 trol-D in Unix, Control-Z/Enter in Windows). Note that using the
215 magic functions @Exit or @Quit you can force a direct exit,
215 magic functions @Exit or @Quit you can force a direct exit,
216 bypassing any confirmation.
216 bypassing any confirmation.
217
217
218 -[no]debug
218 -[no]debug
219 Show information about the loading process. Very useful to pin
219 Show information about the loading process. Very useful to pin
220 down problems with your configuration files or to get details
220 down problems with your configuration files or to get details
221 about session restores.
221 about session restores.
222
222
223 -[no]deep_reload
223 -[no]deep_reload
224 IPython can use the deep_reload module which reloads changes in
224 IPython can use the deep_reload module which reloads changes in
225 modules recursively (it replaces the reload() function, so you
225 modules recursively (it replaces the reload() function, so you
226 don't need to change anything to use it). deep_reload() forces a
226 don't need to change anything to use it). deep_reload() forces a
227 full reload of modules whose code may have changed, which the
227 full reload of modules whose code may have changed, which the
228 default reload() function does not.
228 default reload() function does not.
229
229
230 When deep_reload is off, IPython will use the normal reload(),
230 When deep_reload is off, IPython will use the normal reload(),
231 but deep_reload will still be available as dreload(). This fea-
231 but deep_reload will still be available as dreload(). This fea-
232 ture is off by default [which means that you have both normal
232 ture is off by default [which means that you have both normal
233 reload() and dreload()].
233 reload() and dreload()].
234
234
235 -editor <name>
235 -editor <name>
236 Which editor to use with the @edit command. By default, IPython
236 Which editor to use with the @edit command. By default, IPython
237 will honor your EDITOR environment variable (if not set, vi is
237 will honor your EDITOR environment variable (if not set, vi is
238 the Unix default and notepad the Windows one). Since this editor
238 the Unix default and notepad the Windows one). Since this editor
239 is invoked on the fly by IPython and is meant for editing small
239 is invoked on the fly by IPython and is meant for editing small
240 code snippets, you may want to use a small, lightweight editor
240 code snippets, you may want to use a small, lightweight editor
241 here (in case your default EDITOR is something like Emacs).
241 here (in case your default EDITOR is something like Emacs).
242
242
243 -ipythondir <name>
243 -ipythondir <name>
244 The name of your IPython configuration directory IPYTHONDIR.
244 The name of your IPython configuration directory IPYTHONDIR.
245 This can also be specified through the environment variable
245 This can also be specified through the environment variable
246 IPYTHONDIR.
246 IPYTHONDIR.
247
247
248 -log|l Generate a log file of all input. The file is named
248 -log|l Generate a log file of all input. The file is named
249 ipython_log.py in your current directory (which prevents logs
249 ipython_log.py in your current directory (which prevents logs
250 from multiple IPython sessions from trampling each other). You
250 from multiple IPython sessions from trampling each other). You
251 can use this to later restore a session by loading your logfile
251 can use this to later restore a session by loading your logfile
252 as a file to be executed with option -logplay (see below).
252 as a file to be executed with option -logplay (see below).
253
253
254 -logfile|lf
254 -logfile|lf
255 Specify the name of your logfile.
255 Specify the name of your logfile.
256
256
257 -logplay|lp
257 -logplay|lp
258 Replay a previous log. For restoring a session as close as pos-
258 Replay a previous log. For restoring a session as close as pos-
259 sible to the state you left it in, use this option (don't just
259 sible to the state you left it in, use this option (don't just
260 run the logfile). With -logplay, IPython will try to reconstruct
260 run the logfile). With -logplay, IPython will try to reconstruct
261 the previous working environment in full, not just execute the
261 the previous working environment in full, not just execute the
262 commands in the logfile.
262 commands in the logfile.
263 When a session is restored, logging is automatically turned on
263 When a session is restored, logging is automatically turned on
264 again with the name of the logfile it was invoked with (it is
264 again with the name of the logfile it was invoked with (it is
265 read from the log header). So once you've turned logging on for
265 read from the log header). So once you've turned logging on for
266 a session, you can quit IPython and reload it as many times as
266 a session, you can quit IPython and reload it as many times as
267 you want and it will continue to log its history and restore
267 you want and it will continue to log its history and restore
268 from the beginning every time.
268 from the beginning every time.
269
269
270 Caveats: there are limitations in this option. The history vari-
270 Caveats: there are limitations in this option. The history vari-
271 ables _i*,_* and _dh don't get restored properly. In the future
271 ables _i*,_* and _dh don't get restored properly. In the future
272 we will try to implement full session saving by writing and
272 we will try to implement full session saving by writing and
273 retrieving a failed because of inherent limitations of Python's
273 retrieving a failed because of inherent limitations of Python's
274 Pickle module, so this may have to wait.
274 Pickle module, so this may have to wait.
275
275
276 -[no]messages
276 -[no]messages
277 Print messages which IPython collects about its startup process
277 Print messages which IPython collects about its startup process
278 (default on).
278 (default on).
279
279
280 -[no]pdb
280 -[no]pdb
281 Automatically call the pdb debugger after every uncaught excep-
281 Automatically call the pdb debugger after every uncaught excep-
282 tion. If you are used to debugging using pdb, this puts you
282 tion. If you are used to debugging using pdb, this puts you
283 automatically inside of it after any call (either in IPython or
283 automatically inside of it after any call (either in IPython or
284 in code called by it) which triggers an exception which goes
284 in code called by it) which triggers an exception which goes
285 uncaught.
285 uncaught.
286
286
287 -[no]pprint
287 -[no]pprint
288 IPython can optionally use the pprint (pretty printer) module
288 IPython can optionally use the pprint (pretty printer) module
289 for displaying results. pprint tends to give a nicer display of
289 for displaying results. pprint tends to give a nicer display of
290 nested data structures. If you like it, you can turn it on per-
290 nested data structures. If you like it, you can turn it on per-
291 manently in your config file (default off).
291 manently in your config file (default off).
292
292
293 -profile|p <name>
293 -profile|p <name>
294 Assume that your config file is ipythonrc-<name> (looks in cur-
294 Assume that your config file is ipythonrc-<name> (looks in cur-
295 rent dir first, then in IPYTHONDIR). This is a quick way to keep
295 rent dir first, then in IPYTHONDIR). This is a quick way to keep
296 and load multiple config files for different tasks, especially
296 and load multiple config files for different tasks, especially
297 if you use the include option of config files. You can keep a
297 if you use the include option of config files. You can keep a
298 basic IPYTHONDIR/ipythonrc file and then have other 'profiles'
298 basic IPYTHONDIR/ipythonrc file and then have other 'profiles'
299 which include this one and load extra things for particular
299 which include this one and load extra things for particular
300 tasks. For example:
300 tasks. For example:
301
301
302 1) $HOME/.ipython/ipythonrc : load basic things you always want.
302 1) $HOME/.ipython/ipythonrc : load basic things you always want.
303 2) $HOME/.ipython/ipythonrc-math : load (1) and basic math-
303 2) $HOME/.ipython/ipythonrc-math : load (1) and basic math-
304 related modules.
304 related modules.
305 3) $HOME/.ipython/ipythonrc-numeric : load (1) and Numeric and
305 3) $HOME/.ipython/ipythonrc-numeric : load (1) and Numeric and
306 plotting modules.
306 plotting modules.
307
307
308 Since it is possible to create an endless loop by having circu-
308 Since it is possible to create an endless loop by having circu-
309 lar file inclusions, IPython will stop if it reaches 15 recur-
309 lar file inclusions, IPython will stop if it reaches 15 recur-
310 sive inclusions.
310 sive inclusions.
311
311
312 -prompt_in1|pi1 <string>
312 -prompt_in1|pi1 <string>
313 Specify the string used for input prompts. Note that if you are
313 Specify the string used for input prompts. Note that if you are
314 using numbered prompts, the number is represented with a '\#' in
314 using numbered prompts, the number is represented with a '\#' in
315 the string. Don't forget to quote strings with spaces embedded
315 the string. Don't forget to quote strings with spaces embedded
316 in them. Default: 'In [\#]: '.
316 in them. Default: 'In [\#]: '.
317
317
318 Most bash-like escapes can be used to customize IPython's
318 Most bash-like escapes can be used to customize IPython's
319 prompts, as well as a few additional ones which are IPython-spe-
319 prompts, as well as a few additional ones which are IPython-spe-
320 cific. All valid prompt escapes are described in detail in the
320 cific. All valid prompt escapes are described in detail in the
321 Customization section of the IPython HTML/PDF manual.
321 Customization section of the IPython HTML/PDF manual.
322
322
323 -prompt_in2|pi2 <string>
323 -prompt_in2|pi2 <string>
324 Similar to the previous option, but used for the continuation
324 Similar to the previous option, but used for the continuation
325 prompts. The special sequence '\D' is similar to '\#', but with
325 prompts. The special sequence '\D' is similar to '\#', but with
326 all digits replaced dots (so you can have your continuation
326 all digits replaced dots (so you can have your continuation
327 prompt aligned with your input prompt). Default: ' .\D.: '
327 prompt aligned with your input prompt). Default: ' .\D.: '
328 (note three spaces at the start for alignment with 'In [\#]').
328 (note three spaces at the start for alignment with 'In [\#]').
329
329
330 -prompt_out|po <string>
330 -prompt_out|po <string>
331 String used for output prompts, also uses numbers like
331 String used for output prompts, also uses numbers like
332 prompt_in1. Default: 'Out[\#]:'.
332 prompt_in1. Default: 'Out[\#]:'.
333
333
334 -quick Start in bare bones mode (no config file loaded).
334 -quick Start in bare bones mode (no config file loaded).
335
335
336 -rcfile <name>
336 -rcfile <name>
337 Name of your IPython resource configuration file. normally
337 Name of your IPython resource configuration file. normally
338 IPython loads ipythonrc (from current directory) or
338 IPython loads ipythonrc (from current directory) or
339 IPYTHONDIR/ipythonrc. If the loading of your config file fails,
339 IPYTHONDIR/ipythonrc. If the loading of your config file fails,
340 IPython starts with a bare bones configuration (no modules
340 IPython starts with a bare bones configuration (no modules
341 loaded at all).
341 loaded at all).
342
342
343 -[no]readline
343 -[no]readline
344 Use the readline library, which is needed to support name com-
344 Use the readline library, which is needed to support name com-
345 pletion and command history, among other things. It is enabled
345 pletion and command history, among other things. It is enabled
346 by default, but may cause problems for users of X/Emacs in
346 by default, but may cause problems for users of X/Emacs in
347 Python comint or shell buffers.
347 Python comint or shell buffers.
348
348
349 Note that emacs 'eterm' buffers (opened with M-x term) support
349 Note that emacs 'eterm' buffers (opened with M-x term) support
350 IPython's readline and syntax coloring fine, only 'emacs' (M-x
350 IPython's readline and syntax coloring fine, only 'emacs' (M-x
351 shell and C-c !) buffers do not.
351 shell and C-c !) buffers do not.
352
352
353 -screen_length|sl <n>
353 -screen_length|sl <n>
354 Number of lines of your screen. This is used to control print-
354 Number of lines of your screen. This is used to control print-
355 ing of very long strings. Strings longer than this number of
355 ing of very long strings. Strings longer than this number of
356 lines will be sent through a pager instead of directly printed.
356 lines will be sent through a pager instead of directly printed.
357
357
358 The default value for this is 0, which means IPython will auto-
358 The default value for this is 0, which means IPython will auto-
359 detect your screen size every time it needs to print certain
359 detect your screen size every time it needs to print certain
360 potentially long strings (this doesn't change the behavior of
360 potentially long strings (this doesn't change the behavior of
361 the 'print' keyword, it's only triggered internally). If for
361 the 'print' keyword, it's only triggered internally). If for
362 some reason this isn't working well (it needs curses support),
362 some reason this isn't working well (it needs curses support),
363 specify it yourself. Otherwise don't change the default.
363 specify it yourself. Otherwise don't change the default.
364
364
365 -separate_in|si <string>
365 -separate_in|si <string>
366 Separator before input prompts. Default '0.
366 Separator before input prompts. Default '0.
367
367
368 -separate_out|so <string>
368 -separate_out|so <string>
369 Separator before output prompts. Default: 0 (nothing).
369 Separator before output prompts. Default: 0 (nothing).
370
370
371 -separate_out2|so2 <string>
371 -separate_out2|so2 <string>
372 Separator after output prompts. Default: 0 (nothing).
372 Separator after output prompts. Default: 0 (nothing).
373
373
374 -nosep Shorthand for '-separate_in 0 -separate_out 0 -separate_out2 0'.
374 -nosep Shorthand for '-separate_in 0 -separate_out 0 -separate_out2 0'.
375 Simply removes all input/output separators.
375 Simply removes all input/output separators.
376
376
377 -upgrade
377 -upgrade
378 Allows you to upgrade your IPYTHONDIR configuration when you
378 Allows you to upgrade your IPYTHONDIR configuration when you
379 install a new version of IPython. Since new versions may
379 install a new version of IPython. Since new versions may
380 include new command lines options or example files, this copies
380 include new command lines options or example files, this copies
381 updated ipythonrc-type files. However, it backs up (with a .old
381 updated ipythonrc-type files. However, it backs up (with a .old
382 extension) all files which it overwrites so that you can merge
382 extension) all files which it overwrites so that you can merge
383 back any custimizations you might have in your personal files.
383 back any custimizations you might have in your personal files.
384
384
385 -Version
385 -Version
386 Print version information and exit.
386 Print version information and exit.
387
387
388 -wxversion <string>
388 -wxversion <string>
389 Select a specific version of wxPython (used in conjunction with
389 Select a specific version of wxPython (used in conjunction with
390 -wthread). Requires the wxversion module, part of recent
390 -wthread). Requires the wxversion module, part of recent
391 wxPython distributions.
391 wxPython distributions.
392
392
393 -xmode <modename>
393 -xmode <modename>
394 Mode for exception reporting. The valid modes are Plain, Con-
394 Mode for exception reporting. The valid modes are Plain, Con-
395 text, and Verbose.
395 text, and Verbose.
396
396
397 - Plain: similar to python's normal traceback printing.
397 - Plain: similar to python's normal traceback printing.
398
398
399 - Context: prints 5 lines of context source code around each
399 - Context: prints 5 lines of context source code around each
400 line in the traceback.
400 line in the traceback.
401
401
402 - Verbose: similar to Context, but additionally prints the vari-
402 - Verbose: similar to Context, but additionally prints the vari-
403 ables currently visible where the exception happened (shortening
403 ables currently visible where the exception happened (shortening
404 their strings if too long). This can potentially be very slow,
404 their strings if too long). This can potentially be very slow,
405 if you happen to have a huge data structure whose string repre-
405 if you happen to have a huge data structure whose string repre-
406 sentation is complex to compute. Your computer may appear to
406 sentation is complex to compute. Your computer may appear to
407 freeze for a while with cpu usage at 100%. If this occurs, you
407 freeze for a while with cpu usage at 100%. If this occurs, you
408 can cancel the traceback with Ctrl-C (maybe hitting it more than
408 can cancel the traceback with Ctrl-C (maybe hitting it more than
409 once).
409 once).
410
410
411
411
412 EMBEDDING
412 EMBEDDING
413 It is possible to start an IPython instance inside your own Python pro-
413 It is possible to start an IPython instance inside your own Python pro-
414 grams. In the documentation example files there are some illustrations
414 grams. In the documentation example files there are some illustrations
415 on how to do this.
415 on how to do this.
416
416
417 This feature allows you to evalutate dynamically the state of your
417 This feature allows you to evalutate dynamically the state of your
418 code, operate with your variables, analyze them, etc. Note however
418 code, operate with your variables, analyze them, etc. Note however
419 that any changes you make to values while in the shell do NOT propagate
419 that any changes you make to values while in the shell do NOT propagate
420 back to the running code, so it is safe to modify your values because
420 back to the running code, so it is safe to modify your values because
421 you won't break your code in bizarre ways by doing so.
421 you won't break your code in bizarre ways by doing so.
422 """
422 """
423
423
424 cmd_line_usage = __doc__
424 cmd_line_usage = __doc__
425
425
426 #---------------------------------------------------------------------------
426 #---------------------------------------------------------------------------
427 interactive_usage = """
427 interactive_usage = """
428 IPython -- An enhanced Interactive Python
428 IPython -- An enhanced Interactive Python
429 =========================================
429 =========================================
430
430
431 IPython offers a combination of convenient shell features, special commands
431 IPython offers a combination of convenient shell features, special commands
432 and a history mechanism for both input (command history) and output (results
432 and a history mechanism for both input (command history) and output (results
433 caching, similar to Mathematica). It is intended to be a fully compatible
433 caching, similar to Mathematica). It is intended to be a fully compatible
434 replacement for the standard Python interpreter, while offering vastly
434 replacement for the standard Python interpreter, while offering vastly
435 improved functionality and flexibility.
435 improved functionality and flexibility.
436
436
437 At your system command line, type 'ipython -help' to see the command line
437 At your system command line, type 'ipython -help' to see the command line
438 options available. This document only describes interactive features.
438 options available. This document only describes interactive features.
439
439
440 Warning: IPython relies on the existence of a global variable called __IP which
440 Warning: IPython relies on the existence of a global variable called __IP which
441 controls the shell itself. If you redefine __IP to anything, bizarre behavior
441 controls the shell itself. If you redefine __IP to anything, bizarre behavior
442 will quickly occur.
442 will quickly occur.
443
443
444 MAIN FEATURES
444 MAIN FEATURES
445
445
446 * Access to the standard Python help. As of Python 2.1, a help system is
446 * Access to the standard Python help. As of Python 2.1, a help system is
447 available with access to object docstrings and the Python manuals. Simply
447 available with access to object docstrings and the Python manuals. Simply
448 type 'help' (no quotes) to access it.
448 type 'help' (no quotes) to access it.
449
449
450 * Magic commands: type %magic for information on the magic subsystem.
450 * Magic commands: type %magic for information on the magic subsystem.
451
451
452 * System command aliases, via the %alias command or the ipythonrc config file.
452 * System command aliases, via the %alias command or the ipythonrc config file.
453
453
454 * Dynamic object information:
454 * Dynamic object information:
455
455
456 Typing ?word or word? prints detailed information about an object. If
456 Typing ?word or word? prints detailed information about an object. If
457 certain strings in the object are too long (docstrings, code, etc.) they get
457 certain strings in the object are too long (docstrings, code, etc.) they get
458 snipped in the center for brevity.
458 snipped in the center for brevity.
459
459
460 Typing ??word or word?? gives access to the full information without
460 Typing ??word or word?? gives access to the full information without
461 snipping long strings. Long strings are sent to the screen through the less
461 snipping long strings. Long strings are sent to the screen through the less
462 pager if longer than the screen, printed otherwise.
462 pager if longer than the screen, printed otherwise.
463
463
464 The ?/?? system gives access to the full source code for any object (if
464 The ?/?? system gives access to the full source code for any object (if
465 available), shows function prototypes and other useful information.
465 available), shows function prototypes and other useful information.
466
466
467 If you just want to see an object's docstring, type '%pdoc object' (without
467 If you just want to see an object's docstring, type '%pdoc object' (without
468 quotes, and without % if you have automagic on).
468 quotes, and without % if you have automagic on).
469
469
470 Both %pdoc and ?/?? give you access to documentation even on things which are
470 Both %pdoc and ?/?? give you access to documentation even on things which are
471 not explicitely defined. Try for example typing {}.get? or after import os,
471 not explicitely defined. Try for example typing {}.get? or after import os,
472 type os.path.abspath??. The magic functions %pdef, %source and %file operate
472 type os.path.abspath??. The magic functions %pdef, %source and %file operate
473 similarly.
473 similarly.
474
474
475 * Completion in the local namespace, by typing TAB at the prompt.
475 * Completion in the local namespace, by typing TAB at the prompt.
476
476
477 At any time, hitting tab will complete any available python commands or
477 At any time, hitting tab will complete any available python commands or
478 variable names, and show you a list of the possible completions if there's
478 variable names, and show you a list of the possible completions if there's
479 no unambiguous one. It will also complete filenames in the current directory.
479 no unambiguous one. It will also complete filenames in the current directory.
480
480
481 This feature requires the readline and rlcomplete modules, so it won't work
481 This feature requires the readline and rlcomplete modules, so it won't work
482 if your Python lacks readline support (such as under Windows).
482 if your Python lacks readline support (such as under Windows).
483
483
484 * Search previous command history in two ways (also requires readline):
484 * Search previous command history in two ways (also requires readline):
485
485
486 - Start typing, and then use Ctrl-p (previous,up) and Ctrl-n (next,down) to
486 - Start typing, and then use Ctrl-p (previous,up) and Ctrl-n (next,down) to
487 search through only the history items that match what you've typed so
487 search through only the history items that match what you've typed so
488 far. If you use Ctrl-p/Ctrl-n at a blank prompt, they just behave like
488 far. If you use Ctrl-p/Ctrl-n at a blank prompt, they just behave like
489 normal arrow keys.
489 normal arrow keys.
490
490
491 - Hit Ctrl-r: opens a search prompt. Begin typing and the system searches
491 - Hit Ctrl-r: opens a search prompt. Begin typing and the system searches
492 your history for lines that match what you've typed so far, completing as
492 your history for lines that match what you've typed so far, completing as
493 much as it can.
493 much as it can.
494
494
495 * Persistent command history across sessions (readline required).
495 * Persistent command history across sessions (readline required).
496
496
497 * Logging of input with the ability to save and restore a working session.
497 * Logging of input with the ability to save and restore a working session.
498
498
499 * System escape with !. Typing !ls will run 'ls' in the current directory.
499 * System escape with !. Typing !ls will run 'ls' in the current directory.
500
500
501 * The reload command does a 'deep' reload of a module: changes made to the
501 * The reload command does a 'deep' reload of a module: changes made to the
502 module since you imported will actually be available without having to exit.
502 module since you imported will actually be available without having to exit.
503
503
504 * Verbose and colored exception traceback printouts. See the magic xmode and
504 * Verbose and colored exception traceback printouts. See the magic xmode and
505 xcolor functions for details (just type %magic).
505 xcolor functions for details (just type %magic).
506
506
507 * Input caching system:
507 * Input caching system:
508
508
509 IPython offers numbered prompts (In/Out) with input and output caching. All
509 IPython offers numbered prompts (In/Out) with input and output caching. All
510 input is saved and can be retrieved as variables (besides the usual arrow
510 input is saved and can be retrieved as variables (besides the usual arrow
511 key recall).
511 key recall).
512
512
513 The following GLOBAL variables always exist (so don't overwrite them!):
513 The following GLOBAL variables always exist (so don't overwrite them!):
514 _i: stores previous input.
514 _i: stores previous input.
515 _ii: next previous.
515 _ii: next previous.
516 _iii: next-next previous.
516 _iii: next-next previous.
517 _ih : a list of all input _ih[n] is the input from line n.
517 _ih : a list of all input _ih[n] is the input from line n.
518
518
519 Additionally, global variables named _i<n> are dynamically created (<n>
519 Additionally, global variables named _i<n> are dynamically created (<n>
520 being the prompt counter), such that _i<n> == _ih[<n>]
520 being the prompt counter), such that _i<n> == _ih[<n>]
521
521
522 For example, what you typed at prompt 14 is available as _i14 and _ih[14].
522 For example, what you typed at prompt 14 is available as _i14 and _ih[14].
523
523
524 You can create macros which contain multiple input lines from this history,
524 You can create macros which contain multiple input lines from this history,
525 for later re-execution, with the %macro function.
525 for later re-execution, with the %macro function.
526
526
527 The history function %hist allows you to see any part of your input history
527 The history function %hist allows you to see any part of your input history
528 by printing a range of the _i variables. Note that inputs which contain
528 by printing a range of the _i variables. Note that inputs which contain
529 magic functions (%) appear in the history with a prepended comment. This is
529 magic functions (%) appear in the history with a prepended comment. This is
530 because they aren't really valid Python code, so you can't exec them.
530 because they aren't really valid Python code, so you can't exec them.
531
531
532 * Output caching system:
532 * Output caching system:
533
533
534 For output that is returned from actions, a system similar to the input
534 For output that is returned from actions, a system similar to the input
535 cache exists but using _ instead of _i. Only actions that produce a result
535 cache exists but using _ instead of _i. Only actions that produce a result
536 (NOT assignments, for example) are cached. If you are familiar with
536 (NOT assignments, for example) are cached. If you are familiar with
537 Mathematica, IPython's _ variables behave exactly like Mathematica's %
537 Mathematica, IPython's _ variables behave exactly like Mathematica's %
538 variables.
538 variables.
539
539
540 The following GLOBAL variables always exist (so don't overwrite them!):
540 The following GLOBAL variables always exist (so don't overwrite them!):
541 _ (one underscore): previous output.
541 _ (one underscore): previous output.
542 __ (two underscores): next previous.
542 __ (two underscores): next previous.
543 ___ (three underscores): next-next previous.
543 ___ (three underscores): next-next previous.
544
544
545 Global variables named _<n> are dynamically created (<n> being the prompt
545 Global variables named _<n> are dynamically created (<n> being the prompt
546 counter), such that the result of output <n> is always available as _<n>.
546 counter), such that the result of output <n> is always available as _<n>.
547
547
548 Finally, a global dictionary named _oh exists with entries for all lines
548 Finally, a global dictionary named _oh exists with entries for all lines
549 which generated output.
549 which generated output.
550
550
551 * Directory history:
551 * Directory history:
552
552
553 Your history of visited directories is kept in the global list _dh, and the
553 Your history of visited directories is kept in the global list _dh, and the
554 magic %cd command can be used to go to any entry in that list.
554 magic %cd command can be used to go to any entry in that list.
555
555
556 * Auto-parentheses and auto-quotes (adapted from Nathan Gray's LazyPython)
556 * Auto-parentheses and auto-quotes (adapted from Nathan Gray's LazyPython)
557
557
558 1. Auto-parentheses
558 1. Auto-parentheses
559 Callable objects (i.e. functions, methods, etc) can be invoked like
559 Callable objects (i.e. functions, methods, etc) can be invoked like
560 this (notice the commas between the arguments):
560 this (notice the commas between the arguments):
561 >>> callable_ob arg1, arg2, arg3
561 >>> callable_ob arg1, arg2, arg3
562 and the input will be translated to this:
562 and the input will be translated to this:
563 --> callable_ob(arg1, arg2, arg3)
563 --> callable_ob(arg1, arg2, arg3)
564 You can force auto-parentheses by using '/' as the first character
564 You can force auto-parentheses by using '/' as the first character
565 of a line. For example:
565 of a line. For example:
566 >>> /globals # becomes 'globals()'
566 >>> /globals # becomes 'globals()'
567 Note that the '/' MUST be the first character on the line! This
567 Note that the '/' MUST be the first character on the line! This
568 won't work:
568 won't work:
569 >>> print /globals # syntax error
569 >>> print /globals # syntax error
570
570
571 In most cases the automatic algorithm should work, so you should
571 In most cases the automatic algorithm should work, so you should
572 rarely need to explicitly invoke /. One notable exception is if you
572 rarely need to explicitly invoke /. One notable exception is if you
573 are trying to call a function with a list of tuples as arguments (the
573 are trying to call a function with a list of tuples as arguments (the
574 parenthesis will confuse IPython):
574 parenthesis will confuse IPython):
575 In [1]: zip (1,2,3),(4,5,6) # won't work
575 In [1]: zip (1,2,3),(4,5,6) # won't work
576 but this will work:
576 but this will work:
577 In [2]: /zip (1,2,3),(4,5,6)
577 In [2]: /zip (1,2,3),(4,5,6)
578 ------> zip ((1,2,3),(4,5,6))
578 ------> zip ((1,2,3),(4,5,6))
579 Out[2]= [(1, 4), (2, 5), (3, 6)]
579 Out[2]= [(1, 4), (2, 5), (3, 6)]
580
580
581 IPython tells you that it has altered your command line by
581 IPython tells you that it has altered your command line by
582 displaying the new command line preceded by -->. e.g.:
582 displaying the new command line preceded by -->. e.g.:
583 In [18]: callable list
583 In [18]: callable list
584 -------> callable (list)
584 -------> callable (list)
585
585
586 2. Auto-Quoting
586 2. Auto-Quoting
587 You can force auto-quoting of a function's arguments by using ',' as
587 You can force auto-quoting of a function's arguments by using ',' as
588 the first character of a line. For example:
588 the first character of a line. For example:
589 >>> ,my_function /home/me # becomes my_function("/home/me")
589 >>> ,my_function /home/me # becomes my_function("/home/me")
590
590
591 If you use ';' instead, the whole argument is quoted as a single
591 If you use ';' instead, the whole argument is quoted as a single
592 string (while ',' splits on whitespace):
592 string (while ',' splits on whitespace):
593 >>> ,my_function a b c # becomes my_function("a","b","c")
593 >>> ,my_function a b c # becomes my_function("a","b","c")
594 >>> ;my_function a b c # becomes my_function("a b c")
594 >>> ;my_function a b c # becomes my_function("a b c")
595
595
596 Note that the ',' MUST be the first character on the line! This
596 Note that the ',' MUST be the first character on the line! This
597 won't work:
597 won't work:
598 >>> x = ,my_function /home/me # syntax error
598 >>> x = ,my_function /home/me # syntax error
599 """
599 """
600
600
601 quick_reference = r"""
601 quick_reference = r"""
602 IPython -- An enhanced Interactive Python - Quick Reference Card
602 IPython -- An enhanced Interactive Python - Quick Reference Card
603 ================================================================
603 ================================================================
604
604
605 obj?, obj??, ?obj,??obj : Get help, or more help for object
605 obj?, obj?? : Get help, or more help for object (also works as
606 ?os.p* : List names in os starting with p
606 ?obj, ??obj).
607 ?foo.*abc* : List names in 'foo' containing 'abc' in them.
608 %magic : Information about IPython's 'magic' % functions.
607
609
608 Magic functions are prefixed by %, and typically take their arguments without
610 Magic functions are prefixed by %, and typically take their arguments without
609 parentheses, quotes or even commas for convenience.
611 parentheses, quotes or even commas for convenience.
610
612
611 Example magic function calls:
613 Example magic function calls:
612
614
613 %alias d ls -F : 'd' is now an alias for 'ls -F'
615 %alias d ls -F : 'd' is now an alias for 'ls -F'
614 alias d ls -F : Works if 'alias' not a python name
616 alias d ls -F : Works if 'alias' not a python name
615 alist = %alias : Get list of aliases to 'alist'
617 alist = %alias : Get list of aliases to 'alist'
616 cd /usr/share : Obvious. cd -<tab> to choose from visited dirs.
618 cd /usr/share : Obvious. cd -<tab> to choose from visited dirs.
617 %cd?? : See help AND source for magic %cd
619 %cd?? : See help AND source for magic %cd
618
620
619 System commands:
621 System commands:
620
622
621 !cp a.txt b/ : System command escape, calls os.system()
623 !cp a.txt b/ : System command escape, calls os.system()
622 cp a.txt b/ : after %rehashx, most system commands work without !
624 cp a.txt b/ : after %rehashx, most system commands work without !
623 cp ${f}.txt $bar : Variable expansion in magics and system commands
625 cp ${f}.txt $bar : Variable expansion in magics and system commands
624 files = !ls /usr : Capture sytem command output
626 files = !ls /usr : Capture sytem command output
625 files.s, files.l, files.n: "a b c", ['a','b','c'], 'a\nb\nc'
627 files.s, files.l, files.n: "a b c", ['a','b','c'], 'a\nb\nc'
626
628
627 History:
629 History:
628
630
629 _i, _ii, _iii : Previous, next previous, next next previous input
631 _i, _ii, _iii : Previous, next previous, next next previous input
630 _i4, _ih[2:5] : Input history line 4, lines 2-4
632 _i4, _ih[2:5] : Input history line 4, lines 2-4
631 exec _i81 : Execute input history line #81 again
633 exec _i81 : Execute input history line #81 again
632 %rep 81 : Edit input history line #81
634 %rep 81 : Edit input history line #81
633 _, __, ___ : previous, next previous, next next previous output
635 _, __, ___ : previous, next previous, next next previous output
634 _dh : Directory history
636 _dh : Directory history
635 _oh : Output history
637 _oh : Output history
636 %hist : Command history. '%hist -g foo' search history for 'foo'
638 %hist : Command history. '%hist -g foo' search history for 'foo'
637
639
638 Autocall:
640 Autocall:
639
641
640 f 1,2 : f(1,2)
642 f 1,2 : f(1,2)
641 /f 1,2 : f(1,2) (forced autoparen)
643 /f 1,2 : f(1,2) (forced autoparen)
642 ,f 1 2 : f("1","2")
644 ,f 1 2 : f("1","2")
643 ;f 1 2 : f("1 2")
645 ;f 1 2 : f("1 2")
644
646
645 Remember: TAB completion works in many contexts, not just file names
647 Remember: TAB completion works in many contexts, not just file names
646 or python names.
648 or python names.
647
649
648 The following magic functions are currently available:
650 The following magic functions are currently available:
649
651
650 """
652 """
651
653
652
654
@@ -1,7107 +1,7139 b''
1 2007-09-07 Fernando Perez <Fernando.Perez@colorado.edu>
2
3 * IPython/OInspect.py (Inspector.pinfo): fixed bug that was
4 preventing source display in certain cases. In reality I think
5 the problem is with Ubuntu's Python build, but this change works
6 around the issue in some cases (not in all, unfortunately). I'd
7 filed a Python bug on this with more details, but in the change of
8 bug trackers it seems to have been lost.
9
10 * IPython/Magic.py (magic_dhist): restore %dhist. No, cd -TAB is
11 not the same, it's not self-documenting, doesn't allow range
12 selection, and sorts alphabetically instead of numerically.
13 (magic_r): restore %r. No, "up + enter. One char magic" is not
14 the same thing, since %r takes parameters to allow fast retrieval
15 of old commands. I've received emails from users who use this a
16 LOT, so it stays.
17 (magic_automagic): restore %automagic. "use _ip.option.automagic"
18 is not a valid replacement b/c it doesn't provide an complete
19 explanation (which the automagic docstring does).
20 (magic_autocall): restore %autocall, with improved docstring.
21 Same argument as for others, "use _ip.options.autocall" is not a
22 valid replacement.
23 (magic_pdef): restore %pdef & friends. Used widely, mentioned in
24 tutorials and online docs.
25
26 2007-09-06 Fernando Perez <Fernando.Perez@colorado.edu>
27
28 * IPython/usage.py (quick_reference): mention magics in quickref,
29 modified main banner to mention %quickref.
30
31 * IPython/FakeModule.py (FakeModule): fixes for doctest compatibility.
32
1 2007-09-06 Ville Vainio <vivainio@gmail.com>
33 2007-09-06 Ville Vainio <vivainio@gmail.com>
2
34
3 * ipy_rehashdir.py, ipy_workdir.py, ipy_fsops.py, iplib.py:
35 * ipy_rehashdir.py, ipy_workdir.py, ipy_fsops.py, iplib.py:
4 Callable aliases now pass the _ip as first arg. This breaks
36 Callable aliases now pass the _ip as first arg. This breaks
5 compatibility with earlier 0.8.2.svn series! (though they should
37 compatibility with earlier 0.8.2.svn series! (though they should
6 not have been in use yet outside these few extensions)
38 not have been in use yet outside these few extensions)
7
39
8 2007-09-05 Ville Vainio <vivainio@gmail.com>
40 2007-09-05 Ville Vainio <vivainio@gmail.com>
9
41
10 * external/mglob.py: expand('dirname') => ['dirname'], instead
42 * external/mglob.py: expand('dirname') => ['dirname'], instead
11 of ['dirname/foo','dirname/bar', ...].
43 of ['dirname/foo','dirname/bar', ...].
12
44
13 * Extensions/ipy_fsops.py: added, has usefull shell utils for plain
45 * Extensions/ipy_fsops.py: added, has usefull shell utils for plain
14 win32 installations: icp, imv, imkdir, igrep, irm, collect (collect
46 win32 installations: icp, imv, imkdir, igrep, irm, collect (collect
15 is useful for others as well).
47 is useful for others as well).
16
48
17 * iplib.py: on callable aliases (as opposed to old style aliases),
49 * iplib.py: on callable aliases (as opposed to old style aliases),
18 do var_expand() immediately, and use make_quoted_expr instead
50 do var_expand() immediately, and use make_quoted_expr instead
19 of hardcoded r"""
51 of hardcoded r"""
20
52
21 * Extensions/ipy_profile_sh.py: Try to detect cygwin on win32,
53 * Extensions/ipy_profile_sh.py: Try to detect cygwin on win32,
22 if not available load ipy_fsops.py for cp, mv, etc. replacements
54 if not available load ipy_fsops.py for cp, mv, etc. replacements
23
55
24 * OInspect.py, ipy_which.py: improve %which and obj? for callable
56 * OInspect.py, ipy_which.py: improve %which and obj? for callable
25 aliases
57 aliases
26
58
27 2007-09-04 Ville Vainio <vivainio@gmail.com>
59 2007-09-04 Ville Vainio <vivainio@gmail.com>
28
60
29 * ipy_profile_zope.py: add zope profile, by Stefan Eletzhofer.
61 * ipy_profile_zope.py: add zope profile, by Stefan Eletzhofer.
30 Relicensed under BSD with the authors approval.
62 Relicensed under BSD with the authors approval.
31
63
32 * ipmaker.py, usage.py: Remove %magic from default banner, improve
64 * ipmaker.py, usage.py: Remove %magic from default banner, improve
33 %quickref
65 %quickref
34
66
35 2007-09-03 Ville Vainio <vivainio@gmail.com>
67 2007-09-03 Ville Vainio <vivainio@gmail.com>
36
68
37 * Magic.py: %time now passes expression through prefilter,
69 * Magic.py: %time now passes expression through prefilter,
38 allowing IPython syntax.
70 allowing IPython syntax.
39
71
40 2007-09-01 Ville Vainio <vivainio@gmail.com>
72 2007-09-01 Ville Vainio <vivainio@gmail.com>
41
73
42 * ipmaker.py: Always show full traceback when newstyle config fails
74 * ipmaker.py: Always show full traceback when newstyle config fails
43
75
44 2007-08-27 Ville Vainio <vivainio@gmail.com>
76 2007-08-27 Ville Vainio <vivainio@gmail.com>
45
77
46 * Magic.py: fix %cd for nonexistent dir when dhist is empty, close #180
78 * Magic.py: fix %cd for nonexistent dir when dhist is empty, close #180
47
79
48 2007-08-26 Ville Vainio <vivainio@gmail.com>
80 2007-08-26 Ville Vainio <vivainio@gmail.com>
49
81
50 * ipmaker.py: Command line args have the highest priority again
82 * ipmaker.py: Command line args have the highest priority again
51
83
52 * iplib.py, ipmaker.py: -i command line argument now behaves as in
84 * iplib.py, ipmaker.py: -i command line argument now behaves as in
53 normal python, i.e. leaves the IPython session running after -c
85 normal python, i.e. leaves the IPython session running after -c
54 command or running a batch file from command line.
86 command or running a batch file from command line.
55
87
56 2007-08-22 Ville Vainio <vivainio@gmail.com>
88 2007-08-22 Ville Vainio <vivainio@gmail.com>
57
89
58 * iplib.py: no extra empty (last) line in raw hist w/ multiline
90 * iplib.py: no extra empty (last) line in raw hist w/ multiline
59 statements
91 statements
60
92
61 * logger.py: Fix bug where blank lines in history were not
93 * logger.py: Fix bug where blank lines in history were not
62 added until AFTER adding the current line; translated and raw
94 added until AFTER adding the current line; translated and raw
63 history should finally be in sync with prompt now.
95 history should finally be in sync with prompt now.
64
96
65 * ipy_completers.py: quick_completer now makes it easy to create
97 * ipy_completers.py: quick_completer now makes it easy to create
66 trivial custom completers
98 trivial custom completers
67
99
68 * clearcmd.py: shadow history compression & erasing, fixed input hist
100 * clearcmd.py: shadow history compression & erasing, fixed input hist
69 clearing.
101 clearing.
70
102
71 * envpersist.py, history.py: %env (sh profile only), %hist completers
103 * envpersist.py, history.py: %env (sh profile only), %hist completers
72
104
73 * genutils.py, Prompts.py, Magic.py: win32 - prompt (with \yDEPTH) and
105 * genutils.py, Prompts.py, Magic.py: win32 - prompt (with \yDEPTH) and
74 term title now include the drive letter, and always use / instead of
106 term title now include the drive letter, and always use / instead of
75 os.sep (as per recommended approach for win32 ipython in general).
107 os.sep (as per recommended approach for win32 ipython in general).
76
108
77 * ipykit.py, ipy_kitcfg.py: special launcher for ipykit. Allows running
109 * ipykit.py, ipy_kitcfg.py: special launcher for ipykit. Allows running
78 plain python scripts from ipykit command line by running
110 plain python scripts from ipykit command line by running
79 "py myscript.py", even w/o installed python.
111 "py myscript.py", even w/o installed python.
80
112
81 2007-08-21 Ville Vainio <vivainio@gmail.com>
113 2007-08-21 Ville Vainio <vivainio@gmail.com>
82
114
83 * ipmaker.py: finding ipythonrc-PROF now skips ipy_profile_PROF.
115 * ipmaker.py: finding ipythonrc-PROF now skips ipy_profile_PROF.
84 (for backwards compatibility)
116 (for backwards compatibility)
85
117
86 * history.py: switch back to %hist -t from %hist -r as default.
118 * history.py: switch back to %hist -t from %hist -r as default.
87 At least until raw history is fixed for good.
119 At least until raw history is fixed for good.
88
120
89 2007-08-20 Ville Vainio <vivainio@gmail.com>
121 2007-08-20 Ville Vainio <vivainio@gmail.com>
90
122
91 * ipapi.py, iplib.py: DebugTools accessible via _ip.dbg, to catch &
123 * ipapi.py, iplib.py: DebugTools accessible via _ip.dbg, to catch &
92 locate alias redeclarations etc. Also, avoid handling
124 locate alias redeclarations etc. Also, avoid handling
93 _ip.IP.alias_table directly, prefer using _ip.defalias.
125 _ip.IP.alias_table directly, prefer using _ip.defalias.
94
126
95
127
96 2007-08-15 Ville Vainio <vivainio@gmail.com>
128 2007-08-15 Ville Vainio <vivainio@gmail.com>
97
129
98 * prefilter.py: ! is now always served first
130 * prefilter.py: ! is now always served first
99
131
100 2007-08-15 Fernando Perez <Fernando.Perez@colorado.edu>
132 2007-08-15 Fernando Perez <Fernando.Perez@colorado.edu>
101
133
102 * IPython/iplib.py (safe_execfile): fix the SystemExit
134 * IPython/iplib.py (safe_execfile): fix the SystemExit
103 auto-suppression code to work in Python2.4 (the internal structure
135 auto-suppression code to work in Python2.4 (the internal structure
104 of that exception changed and I'd only tested the code with 2.5).
136 of that exception changed and I'd only tested the code with 2.5).
105 Bug reported by a SciPy attendee.
137 Bug reported by a SciPy attendee.
106
138
107 2007-08-13 Ville Vainio <vivainio@gmail.com>
139 2007-08-13 Ville Vainio <vivainio@gmail.com>
108
140
109 * prefilter.py: reverted !c:/bin/foo fix, made % in
141 * prefilter.py: reverted !c:/bin/foo fix, made % in
110 multiline specials work again
142 multiline specials work again
111
143
112 2007-08-13 Ville Vainio <vivainio@gmail.com>
144 2007-08-13 Ville Vainio <vivainio@gmail.com>
113
145
114 * prefilter.py: Take more care to special-case !, so that
146 * prefilter.py: Take more care to special-case !, so that
115 !c:/bin/foo.exe works.
147 !c:/bin/foo.exe works.
116
148
117 * setup.py: if we are building eggs, strip all docs and
149 * setup.py: if we are building eggs, strip all docs and
118 examples (it doesn't make sense to bytecompile examples,
150 examples (it doesn't make sense to bytecompile examples,
119 and docs would be in an awkward place anyway).
151 and docs would be in an awkward place anyway).
120
152
121 * Ryan Krauss' patch fixes start menu shortcuts when IPython
153 * Ryan Krauss' patch fixes start menu shortcuts when IPython
122 is installed into a directory that has spaces in the name.
154 is installed into a directory that has spaces in the name.
123
155
124 2007-08-13 Fernando Perez <Fernando.Perez@colorado.edu>
156 2007-08-13 Fernando Perez <Fernando.Perez@colorado.edu>
125
157
126 * IPython/Magic.py (magic_doctest_mode): fix prompt separators in
158 * IPython/Magic.py (magic_doctest_mode): fix prompt separators in
127 doctest profile and %doctest_mode, so they actually generate the
159 doctest profile and %doctest_mode, so they actually generate the
128 blank lines needed by doctest to separate individual tests.
160 blank lines needed by doctest to separate individual tests.
129
161
130 * IPython/iplib.py (safe_execfile): modify so that running code
162 * IPython/iplib.py (safe_execfile): modify so that running code
131 which calls sys.exit(0) (or equivalently, raise SystemExit(0))
163 which calls sys.exit(0) (or equivalently, raise SystemExit(0))
132 doesn't get a printed traceback. Any other value in sys.exit(),
164 doesn't get a printed traceback. Any other value in sys.exit(),
133 including the empty call, still generates a traceback. This
165 including the empty call, still generates a traceback. This
134 enables use of %run without having to pass '-e' for codes that
166 enables use of %run without having to pass '-e' for codes that
135 correctly set the exit status flag.
167 correctly set the exit status flag.
136
168
137 2007-08-12 Fernando Perez <Fernando.Perez@colorado.edu>
169 2007-08-12 Fernando Perez <Fernando.Perez@colorado.edu>
138
170
139 * IPython/iplib.py (InteractiveShell.post_config_initialization):
171 * IPython/iplib.py (InteractiveShell.post_config_initialization):
140 fix problems with doctests failing when run inside IPython due to
172 fix problems with doctests failing when run inside IPython due to
141 IPython's modifications of sys.displayhook.
173 IPython's modifications of sys.displayhook.
142
174
143 2007-8-9 Fernando Perez <fperez@planck.colorado.edu>
175 2007-8-9 Fernando Perez <fperez@planck.colorado.edu>
144
176
145 * IPython/ipapi.py (to_user_ns): update to accept a dict as well as
177 * IPython/ipapi.py (to_user_ns): update to accept a dict as well as
146 a string with names.
178 a string with names.
147
179
148 2007-08-09 Fernando Perez <Fernando.Perez@colorado.edu>
180 2007-08-09 Fernando Perez <Fernando.Perez@colorado.edu>
149
181
150 * IPython/Magic.py (magic_doctest_mode): added new %doctest_mode
182 * IPython/Magic.py (magic_doctest_mode): added new %doctest_mode
151 magic to toggle on/off the doctest pasting support without having
183 magic to toggle on/off the doctest pasting support without having
152 to leave a session to switch to a separate profile.
184 to leave a session to switch to a separate profile.
153
185
154 2007-08-08 Fernando Perez <Fernando.Perez@colorado.edu>
186 2007-08-08 Fernando Perez <Fernando.Perez@colorado.edu>
155
187
156 * IPython/Extensions/ipy_profile_doctest.py (main): fix prompt to
188 * IPython/Extensions/ipy_profile_doctest.py (main): fix prompt to
157 introduce a blank line between inputs, to conform to doctest
189 introduce a blank line between inputs, to conform to doctest
158 requirements.
190 requirements.
159
191
160 * IPython/OInspect.py (Inspector.pinfo): fix another part where
192 * IPython/OInspect.py (Inspector.pinfo): fix another part where
161 auto-generated docstrings for new-style classes were showing up.
193 auto-generated docstrings for new-style classes were showing up.
162
194
163 2007-08-07 Fernando Perez <Fernando.Perez@colorado.edu>
195 2007-08-07 Fernando Perez <Fernando.Perez@colorado.edu>
164
196
165 * api_changes: Add new file to track backward-incompatible
197 * api_changes: Add new file to track backward-incompatible
166 user-visible changes.
198 user-visible changes.
167
199
168 2007-08-06 Ville Vainio <vivainio@gmail.com>
200 2007-08-06 Ville Vainio <vivainio@gmail.com>
169
201
170 * ipmaker.py: fix bug where user_config_ns didn't exist at all
202 * ipmaker.py: fix bug where user_config_ns didn't exist at all
171 before all the config files were handled.
203 before all the config files were handled.
172
204
173 2007-08-04 Fernando Perez <Fernando.Perez@colorado.edu>
205 2007-08-04 Fernando Perez <Fernando.Perez@colorado.edu>
174
206
175 * IPython/irunner.py (RunnerFactory): Add new factory class for
207 * IPython/irunner.py (RunnerFactory): Add new factory class for
176 creating reusable runners based on filenames.
208 creating reusable runners based on filenames.
177
209
178 * IPython/Extensions/ipy_profile_doctest.py: New profile for
210 * IPython/Extensions/ipy_profile_doctest.py: New profile for
179 doctest support. It sets prompts/exceptions as similar to
211 doctest support. It sets prompts/exceptions as similar to
180 standard Python as possible, so that ipython sessions in this
212 standard Python as possible, so that ipython sessions in this
181 profile can be easily pasted as doctests with minimal
213 profile can be easily pasted as doctests with minimal
182 modifications. It also enables pasting of doctests from external
214 modifications. It also enables pasting of doctests from external
183 sources (even if they have leading whitespace), so that you can
215 sources (even if they have leading whitespace), so that you can
184 rerun doctests from existing sources.
216 rerun doctests from existing sources.
185
217
186 * IPython/iplib.py (_prefilter): fix a buglet where after entering
218 * IPython/iplib.py (_prefilter): fix a buglet where after entering
187 some whitespace, the prompt would become a continuation prompt
219 some whitespace, the prompt would become a continuation prompt
188 with no way of exiting it other than Ctrl-C. This fix brings us
220 with no way of exiting it other than Ctrl-C. This fix brings us
189 into conformity with how the default python prompt works.
221 into conformity with how the default python prompt works.
190
222
191 * IPython/Extensions/InterpreterPasteInput.py (prefilter_paste):
223 * IPython/Extensions/InterpreterPasteInput.py (prefilter_paste):
192 Add support for pasting not only lines that start with '>>>', but
224 Add support for pasting not only lines that start with '>>>', but
193 also with ' >>>'. That is, arbitrary whitespace can now precede
225 also with ' >>>'. That is, arbitrary whitespace can now precede
194 the prompts. This makes the system useful for pasting doctests
226 the prompts. This makes the system useful for pasting doctests
195 from docstrings back into a normal session.
227 from docstrings back into a normal session.
196
228
197 2007-08-02 Fernando Perez <Fernando.Perez@colorado.edu>
229 2007-08-02 Fernando Perez <Fernando.Perez@colorado.edu>
198
230
199 * IPython/Shell.py (IPShellEmbed.__call__): fix bug introduced in
231 * IPython/Shell.py (IPShellEmbed.__call__): fix bug introduced in
200 r1357, which had killed multiple invocations of an embedded
232 r1357, which had killed multiple invocations of an embedded
201 ipython (this means that example-embed has been broken for over 1
233 ipython (this means that example-embed has been broken for over 1
202 year!!!). Rather than possibly breaking the batch stuff for which
234 year!!!). Rather than possibly breaking the batch stuff for which
203 the code in iplib.py/interact was introduced, I worked around the
235 the code in iplib.py/interact was introduced, I worked around the
204 problem in the embedding class in Shell.py. We really need a
236 problem in the embedding class in Shell.py. We really need a
205 bloody test suite for this code, I'm sick of finding stuff that
237 bloody test suite for this code, I'm sick of finding stuff that
206 used to work breaking left and right every time I use an old
238 used to work breaking left and right every time I use an old
207 feature I hadn't touched in a few months.
239 feature I hadn't touched in a few months.
208 (kill_embedded): Add a new magic that only shows up in embedded
240 (kill_embedded): Add a new magic that only shows up in embedded
209 mode, to allow users to permanently deactivate an embedded instance.
241 mode, to allow users to permanently deactivate an embedded instance.
210
242
211 2007-08-01 Ville Vainio <vivainio@gmail.com>
243 2007-08-01 Ville Vainio <vivainio@gmail.com>
212
244
213 * iplib.py, ipy_profile_sh.py (runlines): Fix the bug where raw
245 * iplib.py, ipy_profile_sh.py (runlines): Fix the bug where raw
214 history gets out of sync on runlines (e.g. when running macros).
246 history gets out of sync on runlines (e.g. when running macros).
215
247
216 2007-07-31 Fernando Perez <Fernando.Perez@colorado.edu>
248 2007-07-31 Fernando Perez <Fernando.Perez@colorado.edu>
217
249
218 * IPython/Magic.py (magic_colors): fix win32-related error message
250 * IPython/Magic.py (magic_colors): fix win32-related error message
219 that could appear under *nix when readline was missing. Patch by
251 that could appear under *nix when readline was missing. Patch by
220 Scott Jackson, closes #175.
252 Scott Jackson, closes #175.
221
253
222 2007-07-29 Fernando Perez <Fernando.Perez@colorado.edu>
254 2007-07-29 Fernando Perez <Fernando.Perez@colorado.edu>
223
255
224 * IPython/Extensions/ipy_traits_completer.py: Add a new custom
256 * IPython/Extensions/ipy_traits_completer.py: Add a new custom
225 completer that it traits-aware, so that traits objects don't show
257 completer that it traits-aware, so that traits objects don't show
226 all of their internal attributes all the time.
258 all of their internal attributes all the time.
227
259
228 * IPython/genutils.py (dir2): moved this code from inside
260 * IPython/genutils.py (dir2): moved this code from inside
229 completer.py to expose it publicly, so I could use it in the
261 completer.py to expose it publicly, so I could use it in the
230 wildcards bugfix.
262 wildcards bugfix.
231
263
232 * IPython/wildcard.py (NameSpace.__init__): fix a bug reported by
264 * IPython/wildcard.py (NameSpace.__init__): fix a bug reported by
233 Stefan with Traits.
265 Stefan with Traits.
234
266
235 * IPython/completer.py (Completer.attr_matches): change internal
267 * IPython/completer.py (Completer.attr_matches): change internal
236 var name from 'object' to 'obj', since 'object' is now a builtin
268 var name from 'object' to 'obj', since 'object' is now a builtin
237 and this can lead to weird bugs if reusing this code elsewhere.
269 and this can lead to weird bugs if reusing this code elsewhere.
238
270
239 2007-07-25 Fernando Perez <Fernando.Perez@colorado.edu>
271 2007-07-25 Fernando Perez <Fernando.Perez@colorado.edu>
240
272
241 * IPython/OInspect.py (Inspector.pinfo): fix small glitches in
273 * IPython/OInspect.py (Inspector.pinfo): fix small glitches in
242 'foo?' and update the code to prevent printing of default
274 'foo?' and update the code to prevent printing of default
243 docstrings that started appearing after I added support for
275 docstrings that started appearing after I added support for
244 new-style classes. The approach I'm using isn't ideal (I just
276 new-style classes. The approach I'm using isn't ideal (I just
245 special-case those strings) but I'm not sure how to more robustly
277 special-case those strings) but I'm not sure how to more robustly
246 differentiate between truly user-written strings and Python's
278 differentiate between truly user-written strings and Python's
247 automatic ones.
279 automatic ones.
248
280
249 2007-07-09 Ville Vainio <vivainio@gmail.com>
281 2007-07-09 Ville Vainio <vivainio@gmail.com>
250
282
251 * completer.py: Applied Matthew Neeley's patch:
283 * completer.py: Applied Matthew Neeley's patch:
252 Dynamic attributes from trait_names and _getAttributeNames are added
284 Dynamic attributes from trait_names and _getAttributeNames are added
253 to the list of tab completions, but when this happens, the attribute
285 to the list of tab completions, but when this happens, the attribute
254 list is turned into a set, so the attributes are unordered when
286 list is turned into a set, so the attributes are unordered when
255 printed, which makes it hard to find the right completion. This patch
287 printed, which makes it hard to find the right completion. This patch
256 turns this set back into a list and sort it.
288 turns this set back into a list and sort it.
257
289
258 2007-07-06 Fernando Perez <Fernando.Perez@colorado.edu>
290 2007-07-06 Fernando Perez <Fernando.Perez@colorado.edu>
259
291
260 * IPython/OInspect.py (Inspector.pinfo): Add support for new-style
292 * IPython/OInspect.py (Inspector.pinfo): Add support for new-style
261 classes in various inspector functions.
293 classes in various inspector functions.
262
294
263 2007-06-28 Ville Vainio <vivainio@gmail.com>
295 2007-06-28 Ville Vainio <vivainio@gmail.com>
264
296
265 * shadowns.py, iplib.py, ipapi.py, OInspect.py:
297 * shadowns.py, iplib.py, ipapi.py, OInspect.py:
266 Implement "shadow" namespace, and callable aliases that reside there.
298 Implement "shadow" namespace, and callable aliases that reside there.
267 Use them by:
299 Use them by:
268
300
269 _ip.defalias('foo',myfunc) # creates _sh.foo that points to myfunc
301 _ip.defalias('foo',myfunc) # creates _sh.foo that points to myfunc
270
302
271 foo hello world
303 foo hello world
272 (gets translated to:)
304 (gets translated to:)
273 _sh.foo(r"""hello world""")
305 _sh.foo(r"""hello world""")
274
306
275 In practice, this kind of alias can take the role of a magic function
307 In practice, this kind of alias can take the role of a magic function
276
308
277 * New generic inspect_object, called on obj? and obj??
309 * New generic inspect_object, called on obj? and obj??
278
310
279 2007-06-15 Fernando Perez <Fernando.Perez@colorado.edu>
311 2007-06-15 Fernando Perez <Fernando.Perez@colorado.edu>
280
312
281 * IPython/ultraTB.py (findsource): fix a problem with
313 * IPython/ultraTB.py (findsource): fix a problem with
282 inspect.getfile that can cause crashes during traceback construction.
314 inspect.getfile that can cause crashes during traceback construction.
283
315
284 2007-06-14 Ville Vainio <vivainio@gmail.com>
316 2007-06-14 Ville Vainio <vivainio@gmail.com>
285
317
286 * iplib.py (handle_auto): Try to use ascii for printing "--->"
318 * iplib.py (handle_auto): Try to use ascii for printing "--->"
287 autocall rewrite indication, becausesometimes unicode fails to print
319 autocall rewrite indication, becausesometimes unicode fails to print
288 properly (and you get ' - - - '). Use plain uncoloured ---> for
320 properly (and you get ' - - - '). Use plain uncoloured ---> for
289 unicode.
321 unicode.
290
322
291 * shadow history. Usable through "%hist -g <pat>" and "%rep 0123".
323 * shadow history. Usable through "%hist -g <pat>" and "%rep 0123".
292
324
293 . pickleshare 'hash' commands (hget, hset, hcompress,
325 . pickleshare 'hash' commands (hget, hset, hcompress,
294 hdict) for efficient shadow history storage.
326 hdict) for efficient shadow history storage.
295
327
296 2007-06-13 Ville Vainio <vivainio@gmail.com>
328 2007-06-13 Ville Vainio <vivainio@gmail.com>
297
329
298 * ipapi.py: _ip.to_user_ns(vars, interactive = True).
330 * ipapi.py: _ip.to_user_ns(vars, interactive = True).
299 Added kw arg 'interactive', tell whether vars should be visible
331 Added kw arg 'interactive', tell whether vars should be visible
300 with %whos.
332 with %whos.
301
333
302 2007-06-11 Ville Vainio <vivainio@gmail.com>
334 2007-06-11 Ville Vainio <vivainio@gmail.com>
303
335
304 * pspersistence.py, Magic.py, iplib.py: directory history now saved
336 * pspersistence.py, Magic.py, iplib.py: directory history now saved
305 to db
337 to db
306
338
307 * iplib.py: "ipython -c <cmd>" now passes the command through prefilter.
339 * iplib.py: "ipython -c <cmd>" now passes the command through prefilter.
308 Also, it exits IPython immediately after evaluating the command (just like
340 Also, it exits IPython immediately after evaluating the command (just like
309 std python)
341 std python)
310
342
311 2007-06-05 Walter Doerwald <walter@livinglogic.de>
343 2007-06-05 Walter Doerwald <walter@livinglogic.de>
312
344
313 * IPython/Extensions/ipipe.py: Added a new table icap, which executes a
345 * IPython/Extensions/ipipe.py: Added a new table icap, which executes a
314 Python string and captures the output. (Idea and original patch by
346 Python string and captures the output. (Idea and original patch by
315 Stefan van der Walt)
347 Stefan van der Walt)
316
348
317 2007-06-01 Fernando Perez <Fernando.Perez@colorado.edu>
349 2007-06-01 Fernando Perez <Fernando.Perez@colorado.edu>
318
350
319 * IPython/ultraTB.py (VerboseTB.text): update printing of
351 * IPython/ultraTB.py (VerboseTB.text): update printing of
320 exception types for Python 2.5 (now all exceptions in the stdlib
352 exception types for Python 2.5 (now all exceptions in the stdlib
321 are new-style classes).
353 are new-style classes).
322
354
323 2007-05-31 Walter Doerwald <walter@livinglogic.de>
355 2007-05-31 Walter Doerwald <walter@livinglogic.de>
324
356
325 * IPython/Extensions/igrid.py: Add new commands refresh and
357 * IPython/Extensions/igrid.py: Add new commands refresh and
326 refresh_timer (mapped to "R"/"F5" and to the menu) which restarts
358 refresh_timer (mapped to "R"/"F5" and to the menu) which restarts
327 the iterator once (refresh) or after every x seconds (refresh_timer).
359 the iterator once (refresh) or after every x seconds (refresh_timer).
328 Add a working implementation of "searchexpression", where the text
360 Add a working implementation of "searchexpression", where the text
329 entered is not the text to search for, but an expression that must
361 entered is not the text to search for, but an expression that must
330 be true. Added display of shortcuts to the menu. Added commands "pickinput"
362 be true. Added display of shortcuts to the menu. Added commands "pickinput"
331 and "pickinputattr" that put the object or attribute under the cursor
363 and "pickinputattr" that put the object or attribute under the cursor
332 in the input line. Split the statusbar to be able to display the currently
364 in the input line. Split the statusbar to be able to display the currently
333 active refresh interval. (Patch by Nik Tautenhahn)
365 active refresh interval. (Patch by Nik Tautenhahn)
334
366
335 2007-05-29 Jorgen Stenarson <jorgen.stenarson@bostream.nu>
367 2007-05-29 Jorgen Stenarson <jorgen.stenarson@bostream.nu>
336
368
337 * fixing set_term_title to use ctypes as default
369 * fixing set_term_title to use ctypes as default
338
370
339 * fixing set_term_title fallback to work when curent dir
371 * fixing set_term_title fallback to work when curent dir
340 is on a windows network share
372 is on a windows network share
341
373
342 2007-05-28 Ville Vainio <vivainio@gmail.com>
374 2007-05-28 Ville Vainio <vivainio@gmail.com>
343
375
344 * %cpaste: strip + with > from left (diffs).
376 * %cpaste: strip + with > from left (diffs).
345
377
346 * iplib.py: Fix crash when readline not installed
378 * iplib.py: Fix crash when readline not installed
347
379
348 2007-05-26 Ville Vainio <vivainio@gmail.com>
380 2007-05-26 Ville Vainio <vivainio@gmail.com>
349
381
350 * generics.py: intruduce easy to extend result_display generic
382 * generics.py: intruduce easy to extend result_display generic
351 function (using simplegeneric.py).
383 function (using simplegeneric.py).
352
384
353 * Fixed the append functionality of %set.
385 * Fixed the append functionality of %set.
354
386
355 2007-05-25 Ville Vainio <vivainio@gmail.com>
387 2007-05-25 Ville Vainio <vivainio@gmail.com>
356
388
357 * New magic: %rep (fetch / run old commands from history)
389 * New magic: %rep (fetch / run old commands from history)
358
390
359 * New extension: mglob (%mglob magic), for powerful glob / find /filter
391 * New extension: mglob (%mglob magic), for powerful glob / find /filter
360 like functionality
392 like functionality
361
393
362 % maghistory.py: %hist -g PATTERM greps the history for pattern
394 % maghistory.py: %hist -g PATTERM greps the history for pattern
363
395
364 2007-05-24 Walter Doerwald <walter@livinglogic.de>
396 2007-05-24 Walter Doerwald <walter@livinglogic.de>
365
397
366 * IPython/Extensions/ipipe.py: Added a Table ihist that can be used to
398 * IPython/Extensions/ipipe.py: Added a Table ihist that can be used to
367 browse the IPython input history
399 browse the IPython input history
368
400
369 * IPython/Extensions/ibrowse.py: Added two command to ibrowse: pickinput
401 * IPython/Extensions/ibrowse.py: Added two command to ibrowse: pickinput
370 (mapped to "i") can be used to put the object under the curser in the input
402 (mapped to "i") can be used to put the object under the curser in the input
371 line. pickinputattr (mapped to "I") does the same for the attribute under
403 line. pickinputattr (mapped to "I") does the same for the attribute under
372 the cursor.
404 the cursor.
373
405
374 2007-05-24 Ville Vainio <vivainio@gmail.com>
406 2007-05-24 Ville Vainio <vivainio@gmail.com>
375
407
376 * Grand magic cleansing (changeset [2380]):
408 * Grand magic cleansing (changeset [2380]):
377
409
378 * Introduce ipy_legacy.py where the following magics were
410 * Introduce ipy_legacy.py where the following magics were
379 moved:
411 moved:
380
412
381 pdef pdoc psource pfile rehash dhist Quit p r automagic autocall
413 pdef pdoc psource pfile rehash dhist Quit p r automagic autocall
382
414
383 If you need them, either use default profile or "import ipy_legacy"
415 If you need them, either use default profile or "import ipy_legacy"
384 in your ipy_user_conf.py
416 in your ipy_user_conf.py
385
417
386 * Move sh and scipy profile to Extensions from UserConfig. this implies
418 * Move sh and scipy profile to Extensions from UserConfig. this implies
387 you should not edit them, but you don't need to run %upgrade when
419 you should not edit them, but you don't need to run %upgrade when
388 upgrading IPython anymore.
420 upgrading IPython anymore.
389
421
390 * %hist/%history now operates in "raw" mode by default. To get the old
422 * %hist/%history now operates in "raw" mode by default. To get the old
391 behaviour, run '%hist -n' (native mode).
423 behaviour, run '%hist -n' (native mode).
392
424
393 * split ipy_stock_completers.py to ipy_stock_completers.py and
425 * split ipy_stock_completers.py to ipy_stock_completers.py and
394 ipy_app_completers.py. Stock completers (%cd, import, %run) are now
426 ipy_app_completers.py. Stock completers (%cd, import, %run) are now
395 installed as default.
427 installed as default.
396
428
397 * sh profile now installs ipy_signals.py, for (hopefully) better ctrl+c
429 * sh profile now installs ipy_signals.py, for (hopefully) better ctrl+c
398 handling.
430 handling.
399
431
400 * iplib.py, ipapi.py: _ip.set_next_input(s) sets the next ("default")
432 * iplib.py, ipapi.py: _ip.set_next_input(s) sets the next ("default")
401 input if readline is available.
433 input if readline is available.
402
434
403 2007-05-23 Ville Vainio <vivainio@gmail.com>
435 2007-05-23 Ville Vainio <vivainio@gmail.com>
404
436
405 * macro.py: %store uses __getstate__ properly
437 * macro.py: %store uses __getstate__ properly
406
438
407 * exesetup.py: added new setup script for creating
439 * exesetup.py: added new setup script for creating
408 standalone IPython executables with py2exe (i.e.
440 standalone IPython executables with py2exe (i.e.
409 no python installation required).
441 no python installation required).
410
442
411 * Removed ipythonrc-scipy, ipy_profile_scipy.py takes
443 * Removed ipythonrc-scipy, ipy_profile_scipy.py takes
412 its place.
444 its place.
413
445
414 * rlineimpl.py, genutils.py (get_home_dir): py2exe support
446 * rlineimpl.py, genutils.py (get_home_dir): py2exe support
415
447
416 2007-05-21 Ville Vainio <vivainio@gmail.com>
448 2007-05-21 Ville Vainio <vivainio@gmail.com>
417
449
418 * platutil_win32.py (set_term_title): handle
450 * platutil_win32.py (set_term_title): handle
419 failure of 'title' system call properly.
451 failure of 'title' system call properly.
420
452
421 2007-05-17 Walter Doerwald <walter@livinglogic.de>
453 2007-05-17 Walter Doerwald <walter@livinglogic.de>
422
454
423 * IPython/Extensions/ipipe.py: Fix xrepr for ifiles.
455 * IPython/Extensions/ipipe.py: Fix xrepr for ifiles.
424 (Bug detected by Paul Mueller).
456 (Bug detected by Paul Mueller).
425
457
426 2007-05-16 Ville Vainio <vivainio@gmail.com>
458 2007-05-16 Ville Vainio <vivainio@gmail.com>
427
459
428 * ipy_profile_sci.py, ipython_win_post_install.py: Create
460 * ipy_profile_sci.py, ipython_win_post_install.py: Create
429 new "sci" profile, effectively a modern version of the old
461 new "sci" profile, effectively a modern version of the old
430 "scipy" profile (which is now slated for deprecation).
462 "scipy" profile (which is now slated for deprecation).
431
463
432 2007-05-15 Ville Vainio <vivainio@gmail.com>
464 2007-05-15 Ville Vainio <vivainio@gmail.com>
433
465
434 * pycolorize.py, pycolor.1: Paul Mueller's patches that
466 * pycolorize.py, pycolor.1: Paul Mueller's patches that
435 make pycolorize read input from stdin when run without arguments.
467 make pycolorize read input from stdin when run without arguments.
436
468
437 * Magic.py: do not require 'PATH' in %rehash/%rehashx. Closes #155
469 * Magic.py: do not require 'PATH' in %rehash/%rehashx. Closes #155
438
470
439 * ipy_rehashdir.py: rename ext_rehashdir to ipy_rehashdir, import
471 * ipy_rehashdir.py: rename ext_rehashdir to ipy_rehashdir, import
440 it in sh profile (instead of ipy_system_conf.py).
472 it in sh profile (instead of ipy_system_conf.py).
441
473
442 * Magic.py, ipy_rehashdir.py, ipy_profile_sh.py: System command
474 * Magic.py, ipy_rehashdir.py, ipy_profile_sh.py: System command
443 aliases are now lower case on windows (MyCommand.exe => mycommand).
475 aliases are now lower case on windows (MyCommand.exe => mycommand).
444
476
445 * macro.py, ipapi.py, iplib.py, Prompts.py: Macro system rehaul.
477 * macro.py, ipapi.py, iplib.py, Prompts.py: Macro system rehaul.
446 Macros are now callable objects that inherit from ipapi.IPyAutocall,
478 Macros are now callable objects that inherit from ipapi.IPyAutocall,
447 i.e. get autocalled regardless of system autocall setting.
479 i.e. get autocalled regardless of system autocall setting.
448
480
449 2007-05-10 Fernando Perez <Fernando.Perez@colorado.edu>
481 2007-05-10 Fernando Perez <Fernando.Perez@colorado.edu>
450
482
451 * IPython/rlineimpl.py: check for clear_history in readline and
483 * IPython/rlineimpl.py: check for clear_history in readline and
452 make it a dummy no-op if not available. This function isn't
484 make it a dummy no-op if not available. This function isn't
453 guaranteed to be in the API and appeared in Python 2.4, so we need
485 guaranteed to be in the API and appeared in Python 2.4, so we need
454 to check it ourselves. Also, clean up this file quite a bit.
486 to check it ourselves. Also, clean up this file quite a bit.
455
487
456 * ipython.1: update man page and full manual with information
488 * ipython.1: update man page and full manual with information
457 about threads (remove outdated warning). Closes #151.
489 about threads (remove outdated warning). Closes #151.
458
490
459 2007-05-09 Fernando Perez <Fernando.Perez@colorado.edu>
491 2007-05-09 Fernando Perez <Fernando.Perez@colorado.edu>
460
492
461 * IPython/Extensions/ipy_constants.py: Add Gael's constants module
493 * IPython/Extensions/ipy_constants.py: Add Gael's constants module
462 in trunk (note that this made it into the 0.8.1 release already,
494 in trunk (note that this made it into the 0.8.1 release already,
463 but the changelogs didn't get coordinated). Many thanks to Gael
495 but the changelogs didn't get coordinated). Many thanks to Gael
464 Varoquaux <gael.varoquaux-AT-normalesup.org>
496 Varoquaux <gael.varoquaux-AT-normalesup.org>
465
497
466 2007-05-09 *** Released version 0.8.1
498 2007-05-09 *** Released version 0.8.1
467
499
468 2007-05-10 Walter Doerwald <walter@livinglogic.de>
500 2007-05-10 Walter Doerwald <walter@livinglogic.de>
469
501
470 * IPython/Extensions/igrid.py: Incorporate html help into
502 * IPython/Extensions/igrid.py: Incorporate html help into
471 the module, so we don't have to search for the file.
503 the module, so we don't have to search for the file.
472
504
473 2007-05-02 Fernando Perez <Fernando.Perez@colorado.edu>
505 2007-05-02 Fernando Perez <Fernando.Perez@colorado.edu>
474
506
475 * test/test_irunner.py (RunnerTestCase._test_runner): Close #147.
507 * test/test_irunner.py (RunnerTestCase._test_runner): Close #147.
476
508
477 2007-04-30 Ville Vainio <vivainio@gmail.com>
509 2007-04-30 Ville Vainio <vivainio@gmail.com>
478
510
479 * iplib.py: (pre_config_initialization) Catch UnicodeDecodeError if the
511 * iplib.py: (pre_config_initialization) Catch UnicodeDecodeError if the
480 user has illegal (non-ascii) home directory name
512 user has illegal (non-ascii) home directory name
481
513
482 2007-04-27 Ville Vainio <vivainio@gmail.com>
514 2007-04-27 Ville Vainio <vivainio@gmail.com>
483
515
484 * platutils_win32.py: implement set_term_title for windows
516 * platutils_win32.py: implement set_term_title for windows
485
517
486 * Update version number
518 * Update version number
487
519
488 * ipy_profile_sh.py: more informative prompt (2 dir levels)
520 * ipy_profile_sh.py: more informative prompt (2 dir levels)
489
521
490 2007-04-26 Walter Doerwald <walter@livinglogic.de>
522 2007-04-26 Walter Doerwald <walter@livinglogic.de>
491
523
492 * IPython/Extensions/igrid.py: (igrid) Fix bug that surfaced
524 * IPython/Extensions/igrid.py: (igrid) Fix bug that surfaced
493 when the igrid input raised an exception. (Patch by Nik Tautenhahn,
525 when the igrid input raised an exception. (Patch by Nik Tautenhahn,
494 bug discovered by Ville).
526 bug discovered by Ville).
495
527
496 2007-04-26 Ville Vainio <vivainio@gmail.com>
528 2007-04-26 Ville Vainio <vivainio@gmail.com>
497
529
498 * Extensions/ipy_completers.py: Olivier's module completer now
530 * Extensions/ipy_completers.py: Olivier's module completer now
499 saves the list of root modules if it takes > 4 secs on the first run.
531 saves the list of root modules if it takes > 4 secs on the first run.
500
532
501 * Magic.py (%rehashx): %rehashx now clears the completer cache
533 * Magic.py (%rehashx): %rehashx now clears the completer cache
502
534
503
535
504 2007-04-26 Fernando Perez <Fernando.Perez@colorado.edu>
536 2007-04-26 Fernando Perez <Fernando.Perez@colorado.edu>
505
537
506 * ipython.el: fix incorrect color scheme, reported by Stefan.
538 * ipython.el: fix incorrect color scheme, reported by Stefan.
507 Closes #149.
539 Closes #149.
508
540
509 * IPython/PyColorize.py (Parser.format2): fix state-handling
541 * IPython/PyColorize.py (Parser.format2): fix state-handling
510 logic. I still don't like how that code handles state, but at
542 logic. I still don't like how that code handles state, but at
511 least now it should be correct, if inelegant. Closes #146.
543 least now it should be correct, if inelegant. Closes #146.
512
544
513 2007-04-25 Ville Vainio <vivainio@gmail.com>
545 2007-04-25 Ville Vainio <vivainio@gmail.com>
514
546
515 * Extensions/ipy_which.py: added extension for %which magic, works
547 * Extensions/ipy_which.py: added extension for %which magic, works
516 a lot like unix 'which' but also finds and expands aliases, and
548 a lot like unix 'which' but also finds and expands aliases, and
517 allows wildcards.
549 allows wildcards.
518
550
519 * ipapi.py (expand_alias): Now actually *return* the expanded alias,
551 * ipapi.py (expand_alias): Now actually *return* the expanded alias,
520 as opposed to returning nothing.
552 as opposed to returning nothing.
521
553
522 * UserConfig/ipy_user_conf.py, ipy_profile_sh.py: do not import
554 * UserConfig/ipy_user_conf.py, ipy_profile_sh.py: do not import
523 ipy_stock_completers on default profile, do import on sh profile.
555 ipy_stock_completers on default profile, do import on sh profile.
524
556
525 2007-04-22 Jorgen Stenarson <jorgen.stenarson@bostream.nu>
557 2007-04-22 Jorgen Stenarson <jorgen.stenarson@bostream.nu>
526
558
527 * Fix bug in iplib.py/safe_execfile when launching ipython with a script
559 * Fix bug in iplib.py/safe_execfile when launching ipython with a script
528 like ipython.py foo.py which raised a IndexError.
560 like ipython.py foo.py which raised a IndexError.
529
561
530 2007-04-21 Ville Vainio <vivainio@gmail.com>
562 2007-04-21 Ville Vainio <vivainio@gmail.com>
531
563
532 * Extensions/ipy_extutil.py: added extension to manage other ipython
564 * Extensions/ipy_extutil.py: added extension to manage other ipython
533 extensions. Now only supports 'ls' == list extensions.
565 extensions. Now only supports 'ls' == list extensions.
534
566
535 2007-04-20 Fernando Perez <Fernando.Perez@colorado.edu>
567 2007-04-20 Fernando Perez <Fernando.Perez@colorado.edu>
536
568
537 * IPython/Debugger.py (BdbQuit_excepthook): fix small bug that
569 * IPython/Debugger.py (BdbQuit_excepthook): fix small bug that
538 would prevent use of the exception system outside of a running
570 would prevent use of the exception system outside of a running
539 IPython instance.
571 IPython instance.
540
572
541 2007-04-20 Ville Vainio <vivainio@gmail.com>
573 2007-04-20 Ville Vainio <vivainio@gmail.com>
542
574
543 * Extensions/ipy_render.py: added extension for easy
575 * Extensions/ipy_render.py: added extension for easy
544 interactive text template rendering (to clipboard). Uses Ka-Ping Yee's
576 interactive text template rendering (to clipboard). Uses Ka-Ping Yee's
545 'Iptl' template notation,
577 'Iptl' template notation,
546
578
547 * Extensions/ipy_completers.py: introduced Olivier Lauzanne's
579 * Extensions/ipy_completers.py: introduced Olivier Lauzanne's
548 safer & faster 'import' completer.
580 safer & faster 'import' completer.
549
581
550 * ipapi.py: Introduced new ipapi methods, _ip.defmacro(name, value)
582 * ipapi.py: Introduced new ipapi methods, _ip.defmacro(name, value)
551 and _ip.defalias(name, command).
583 and _ip.defalias(name, command).
552
584
553 * Extensions/ipy_exportdb.py: New extension for exporting all the
585 * Extensions/ipy_exportdb.py: New extension for exporting all the
554 %store'd data in a portable format (normal ipapi calls like
586 %store'd data in a portable format (normal ipapi calls like
555 defmacro() etc.)
587 defmacro() etc.)
556
588
557 2007-04-19 Ville Vainio <vivainio@gmail.com>
589 2007-04-19 Ville Vainio <vivainio@gmail.com>
558
590
559 * upgrade_dir.py: skip junk files like *.pyc
591 * upgrade_dir.py: skip junk files like *.pyc
560
592
561 * Release.py: version number to 0.8.1
593 * Release.py: version number to 0.8.1
562
594
563 2007-04-18 Ville Vainio <vivainio@gmail.com>
595 2007-04-18 Ville Vainio <vivainio@gmail.com>
564
596
565 * iplib.py (safe_execfile): make "ipython foo.py" work with 2.5.1c1
597 * iplib.py (safe_execfile): make "ipython foo.py" work with 2.5.1c1
566 and later on win32.
598 and later on win32.
567
599
568 2007-04-16 Ville Vainio <vivainio@gmail.com>
600 2007-04-16 Ville Vainio <vivainio@gmail.com>
569
601
570 * iplib.py (showtraceback): Do not crash when running w/o readline.
602 * iplib.py (showtraceback): Do not crash when running w/o readline.
571
603
572 2007-04-12 Walter Doerwald <walter@livinglogic.de>
604 2007-04-12 Walter Doerwald <walter@livinglogic.de>
573
605
574 * IPython/Extensions/ipipe.py: (ils) Directoy listings are now
606 * IPython/Extensions/ipipe.py: (ils) Directoy listings are now
575 sorted (case sensitive with files and dirs mixed).
607 sorted (case sensitive with files and dirs mixed).
576
608
577 2007-04-10 Fernando Perez <Fernando.Perez@colorado.edu>
609 2007-04-10 Fernando Perez <Fernando.Perez@colorado.edu>
578
610
579 * IPython/Release.py (version): Open trunk for 0.8.1 development.
611 * IPython/Release.py (version): Open trunk for 0.8.1 development.
580
612
581 2007-04-10 *** Released version 0.8.0
613 2007-04-10 *** Released version 0.8.0
582
614
583 2007-04-07 Fernando Perez <Fernando.Perez@colorado.edu>
615 2007-04-07 Fernando Perez <Fernando.Perez@colorado.edu>
584
616
585 * Tag 0.8.0 for release.
617 * Tag 0.8.0 for release.
586
618
587 * IPython/iplib.py (reloadhist): add API function to cleanly
619 * IPython/iplib.py (reloadhist): add API function to cleanly
588 reload the readline history, which was growing inappropriately on
620 reload the readline history, which was growing inappropriately on
589 every %run call.
621 every %run call.
590
622
591 * win32_manual_post_install.py (run): apply last part of Nicolas
623 * win32_manual_post_install.py (run): apply last part of Nicolas
592 Pernetty's patch (I'd accidentally applied it in a different
624 Pernetty's patch (I'd accidentally applied it in a different
593 directory and this particular file didn't get patched).
625 directory and this particular file didn't get patched).
594
626
595 2007-04-05 Fernando Perez <Fernando.Perez@colorado.edu>
627 2007-04-05 Fernando Perez <Fernando.Perez@colorado.edu>
596
628
597 * IPython/Shell.py (MAIN_THREAD_ID): get rid of my stupid hack to
629 * IPython/Shell.py (MAIN_THREAD_ID): get rid of my stupid hack to
598 find the main thread id and use the proper API call. Thanks to
630 find the main thread id and use the proper API call. Thanks to
599 Stefan for the fix.
631 Stefan for the fix.
600
632
601 * test/test_prefilter.py (esc_handler_tests): udpate one of Dan's
633 * test/test_prefilter.py (esc_handler_tests): udpate one of Dan's
602 unit tests to reflect fixed ticket #52, and add more tests sent by
634 unit tests to reflect fixed ticket #52, and add more tests sent by
603 him.
635 him.
604
636
605 * IPython/iplib.py (raw_input): restore the readline completer
637 * IPython/iplib.py (raw_input): restore the readline completer
606 state on every input, in case third-party code messed it up.
638 state on every input, in case third-party code messed it up.
607 (_prefilter): revert recent addition of early-escape checks which
639 (_prefilter): revert recent addition of early-escape checks which
608 prevent many valid alias calls from working.
640 prevent many valid alias calls from working.
609
641
610 * IPython/Shell.py (MTInteractiveShell.runcode): add a tracking
642 * IPython/Shell.py (MTInteractiveShell.runcode): add a tracking
611 flag for sigint handler so we don't run a full signal() call on
643 flag for sigint handler so we don't run a full signal() call on
612 each runcode access.
644 each runcode access.
613
645
614 * IPython/Magic.py (magic_whos): small improvement to diagnostic
646 * IPython/Magic.py (magic_whos): small improvement to diagnostic
615 message.
647 message.
616
648
617 2007-04-04 Fernando Perez <Fernando.Perez@colorado.edu>
649 2007-04-04 Fernando Perez <Fernando.Perez@colorado.edu>
618
650
619 * IPython/Shell.py (sigint_handler): I *THINK* I finally got
651 * IPython/Shell.py (sigint_handler): I *THINK* I finally got
620 asynchronous exceptions working, i.e., Ctrl-C can actually
652 asynchronous exceptions working, i.e., Ctrl-C can actually
621 interrupt long-running code in the multithreaded shells.
653 interrupt long-running code in the multithreaded shells.
622
654
623 This is using Tomer Filiba's great ctypes-based trick:
655 This is using Tomer Filiba's great ctypes-based trick:
624 http://sebulba.wikispaces.com/recipe+thread2. I'd already tried
656 http://sebulba.wikispaces.com/recipe+thread2. I'd already tried
625 this in the past, but hadn't been able to make it work before. So
657 this in the past, but hadn't been able to make it work before. So
626 far it looks like it's actually running, but this needs more
658 far it looks like it's actually running, but this needs more
627 testing. If it really works, I'll be *very* happy, and we'll owe
659 testing. If it really works, I'll be *very* happy, and we'll owe
628 a huge thank you to Tomer. My current implementation is ugly,
660 a huge thank you to Tomer. My current implementation is ugly,
629 hackish and uses nasty globals, but I don't want to try and clean
661 hackish and uses nasty globals, but I don't want to try and clean
630 anything up until we know if it actually works.
662 anything up until we know if it actually works.
631
663
632 NOTE: this feature needs ctypes to work. ctypes is included in
664 NOTE: this feature needs ctypes to work. ctypes is included in
633 Python2.5, but 2.4 users will need to manually install it. This
665 Python2.5, but 2.4 users will need to manually install it. This
634 feature makes multi-threaded shells so much more usable that it's
666 feature makes multi-threaded shells so much more usable that it's
635 a minor price to pay (ctypes is very easy to install, already a
667 a minor price to pay (ctypes is very easy to install, already a
636 requirement for win32 and available in major linux distros).
668 requirement for win32 and available in major linux distros).
637
669
638 2007-04-04 Ville Vainio <vivainio@gmail.com>
670 2007-04-04 Ville Vainio <vivainio@gmail.com>
639
671
640 * Extensions/ipy_completers.py, ipy_stock_completers.py:
672 * Extensions/ipy_completers.py, ipy_stock_completers.py:
641 Moved implementations of 'bundled' completers to ipy_completers.py,
673 Moved implementations of 'bundled' completers to ipy_completers.py,
642 they are only enabled in ipy_stock_completers.py.
674 they are only enabled in ipy_stock_completers.py.
643
675
644 2007-04-04 Fernando Perez <Fernando.Perez@colorado.edu>
676 2007-04-04 Fernando Perez <Fernando.Perez@colorado.edu>
645
677
646 * IPython/PyColorize.py (Parser.format2): Fix identation of
678 * IPython/PyColorize.py (Parser.format2): Fix identation of
647 colorzied output and return early if color scheme is NoColor, to
679 colorzied output and return early if color scheme is NoColor, to
648 avoid unnecessary and expensive tokenization. Closes #131.
680 avoid unnecessary and expensive tokenization. Closes #131.
649
681
650 2007-04-03 Fernando Perez <Fernando.Perez@colorado.edu>
682 2007-04-03 Fernando Perez <Fernando.Perez@colorado.edu>
651
683
652 * IPython/Debugger.py: disable the use of pydb version 1.17. It
684 * IPython/Debugger.py: disable the use of pydb version 1.17. It
653 has a critical bug (a missing import that makes post-mortem not
685 has a critical bug (a missing import that makes post-mortem not
654 work at all). Unfortunately as of this time, this is the version
686 work at all). Unfortunately as of this time, this is the version
655 shipped with Ubuntu Edgy, so quite a few people have this one. I
687 shipped with Ubuntu Edgy, so quite a few people have this one. I
656 hope Edgy will update to a more recent package.
688 hope Edgy will update to a more recent package.
657
689
658 2007-04-02 Fernando Perez <Fernando.Perez@colorado.edu>
690 2007-04-02 Fernando Perez <Fernando.Perez@colorado.edu>
659
691
660 * IPython/iplib.py (_prefilter): close #52, second part of a patch
692 * IPython/iplib.py (_prefilter): close #52, second part of a patch
661 set by Stefan (only the first part had been applied before).
693 set by Stefan (only the first part had been applied before).
662
694
663 * IPython/Extensions/ipy_stock_completers.py (module_completer):
695 * IPython/Extensions/ipy_stock_completers.py (module_completer):
664 remove usage of the dangerous pkgutil.walk_packages(). See
696 remove usage of the dangerous pkgutil.walk_packages(). See
665 details in comments left in the code.
697 details in comments left in the code.
666
698
667 * IPython/Magic.py (magic_whos): add support for numpy arrays
699 * IPython/Magic.py (magic_whos): add support for numpy arrays
668 similar to what we had for Numeric.
700 similar to what we had for Numeric.
669
701
670 * IPython/completer.py (IPCompleter.complete): extend the
702 * IPython/completer.py (IPCompleter.complete): extend the
671 complete() call API to support completions by other mechanisms
703 complete() call API to support completions by other mechanisms
672 than readline. Closes #109.
704 than readline. Closes #109.
673
705
674 * IPython/iplib.py (safe_execfile): add a safeguard under Win32 to
706 * IPython/iplib.py (safe_execfile): add a safeguard under Win32 to
675 protect against a bug in Python's execfile(). Closes #123.
707 protect against a bug in Python's execfile(). Closes #123.
676
708
677 2007-04-01 Fernando Perez <Fernando.Perez@colorado.edu>
709 2007-04-01 Fernando Perez <Fernando.Perez@colorado.edu>
678
710
679 * IPython/iplib.py (split_user_input): ensure that when splitting
711 * IPython/iplib.py (split_user_input): ensure that when splitting
680 user input, the part that can be treated as a python name is pure
712 user input, the part that can be treated as a python name is pure
681 ascii (Python identifiers MUST be pure ascii). Part of the
713 ascii (Python identifiers MUST be pure ascii). Part of the
682 ongoing Unicode support work.
714 ongoing Unicode support work.
683
715
684 * IPython/Prompts.py (prompt_specials_color): Add \N for the
716 * IPython/Prompts.py (prompt_specials_color): Add \N for the
685 actual prompt number, without any coloring. This allows users to
717 actual prompt number, without any coloring. This allows users to
686 produce numbered prompts with their own colors. Added after a
718 produce numbered prompts with their own colors. Added after a
687 report/request by Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
719 report/request by Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
688
720
689 2007-03-31 Walter Doerwald <walter@livinglogic.de>
721 2007-03-31 Walter Doerwald <walter@livinglogic.de>
690
722
691 * IPython/Extensions/igrid.py: Map the return key
723 * IPython/Extensions/igrid.py: Map the return key
692 to enter() and shift-return to enterattr().
724 to enter() and shift-return to enterattr().
693
725
694 2007-03-30 Fernando Perez <Fernando.Perez@colorado.edu>
726 2007-03-30 Fernando Perez <Fernando.Perez@colorado.edu>
695
727
696 * IPython/Magic.py (magic_psearch): add unicode support by
728 * IPython/Magic.py (magic_psearch): add unicode support by
697 encoding to ascii the input, since this routine also only deals
729 encoding to ascii the input, since this routine also only deals
698 with valid Python names. Fixes a bug reported by Stefan.
730 with valid Python names. Fixes a bug reported by Stefan.
699
731
700 2007-03-29 Fernando Perez <Fernando.Perez@colorado.edu>
732 2007-03-29 Fernando Perez <Fernando.Perez@colorado.edu>
701
733
702 * IPython/Magic.py (_inspect): convert unicode input into ascii
734 * IPython/Magic.py (_inspect): convert unicode input into ascii
703 before trying to evaluate it as a Python identifier. This fixes a
735 before trying to evaluate it as a Python identifier. This fixes a
704 problem that the new unicode support had introduced when analyzing
736 problem that the new unicode support had introduced when analyzing
705 long definition lines for functions.
737 long definition lines for functions.
706
738
707 2007-03-24 Walter Doerwald <walter@livinglogic.de>
739 2007-03-24 Walter Doerwald <walter@livinglogic.de>
708
740
709 * IPython/Extensions/igrid.py: Fix picking. Using
741 * IPython/Extensions/igrid.py: Fix picking. Using
710 igrid with wxPython 2.6 and -wthread should work now.
742 igrid with wxPython 2.6 and -wthread should work now.
711 igrid.display() simply tries to create a frame without
743 igrid.display() simply tries to create a frame without
712 an application. Only if this fails an application is created.
744 an application. Only if this fails an application is created.
713
745
714 2007-03-23 Walter Doerwald <walter@livinglogic.de>
746 2007-03-23 Walter Doerwald <walter@livinglogic.de>
715
747
716 * IPython/Extensions/path.py: Updated to version 2.2.
748 * IPython/Extensions/path.py: Updated to version 2.2.
717
749
718 2007-03-23 Ville Vainio <vivainio@gmail.com>
750 2007-03-23 Ville Vainio <vivainio@gmail.com>
719
751
720 * iplib.py: recursive alias expansion now works better, so that
752 * iplib.py: recursive alias expansion now works better, so that
721 cases like 'top' -> 'd:/cygwin/top' -> 'ls :/cygwin/top'
753 cases like 'top' -> 'd:/cygwin/top' -> 'ls :/cygwin/top'
722 doesn't trip up the process, if 'd' has been aliased to 'ls'.
754 doesn't trip up the process, if 'd' has been aliased to 'ls'.
723
755
724 * Extensions/ipy_gnuglobal.py added, provides %global magic
756 * Extensions/ipy_gnuglobal.py added, provides %global magic
725 for users of http://www.gnu.org/software/global
757 for users of http://www.gnu.org/software/global
726
758
727 * iplib.py: '!command /?' now doesn't invoke IPython's help system.
759 * iplib.py: '!command /?' now doesn't invoke IPython's help system.
728 Closes #52. Patch by Stefan van der Walt.
760 Closes #52. Patch by Stefan van der Walt.
729
761
730 2007-03-23 Fernando Perez <Fernando.Perez@colorado.edu>
762 2007-03-23 Fernando Perez <Fernando.Perez@colorado.edu>
731
763
732 * IPython/FakeModule.py (FakeModule.__init__): Small fix to
764 * IPython/FakeModule.py (FakeModule.__init__): Small fix to
733 respect the __file__ attribute when using %run. Thanks to a bug
765 respect the __file__ attribute when using %run. Thanks to a bug
734 report by Sebastian Rooks <sebastian.rooks-AT-free.fr>.
766 report by Sebastian Rooks <sebastian.rooks-AT-free.fr>.
735
767
736 2007-03-22 Fernando Perez <Fernando.Perez@colorado.edu>
768 2007-03-22 Fernando Perez <Fernando.Perez@colorado.edu>
737
769
738 * IPython/iplib.py (raw_input): Fix mishandling of unicode at
770 * IPython/iplib.py (raw_input): Fix mishandling of unicode at
739 input. Patch sent by Stefan.
771 input. Patch sent by Stefan.
740
772
741 2007-03-20 Jorgen Stenarson <jorgen.stenarson@bostream.nu>
773 2007-03-20 Jorgen Stenarson <jorgen.stenarson@bostream.nu>
742 * IPython/Extensions/ipy_stock_completer.py
774 * IPython/Extensions/ipy_stock_completer.py
743 shlex_split, fix bug in shlex_split. len function
775 shlex_split, fix bug in shlex_split. len function
744 call was missing an if statement. Caused shlex_split to
776 call was missing an if statement. Caused shlex_split to
745 sometimes return "" as last element.
777 sometimes return "" as last element.
746
778
747 2007-03-18 Fernando Perez <Fernando.Perez@colorado.edu>
779 2007-03-18 Fernando Perez <Fernando.Perez@colorado.edu>
748
780
749 * IPython/completer.py
781 * IPython/completer.py
750 (IPCompleter.file_matches.single_dir_expand): fix a problem
782 (IPCompleter.file_matches.single_dir_expand): fix a problem
751 reported by Stefan, where directories containign a single subdir
783 reported by Stefan, where directories containign a single subdir
752 would be completed too early.
784 would be completed too early.
753
785
754 * IPython/Shell.py (_load_pylab): Make the execution of 'from
786 * IPython/Shell.py (_load_pylab): Make the execution of 'from
755 pylab import *' when -pylab is given be optional. A new flag,
787 pylab import *' when -pylab is given be optional. A new flag,
756 pylab_import_all controls this behavior, the default is True for
788 pylab_import_all controls this behavior, the default is True for
757 backwards compatibility.
789 backwards compatibility.
758
790
759 * IPython/ultraTB.py (_formatTracebackLines): Added (slightly
791 * IPython/ultraTB.py (_formatTracebackLines): Added (slightly
760 modified) R. Bernstein's patch for fully syntax highlighted
792 modified) R. Bernstein's patch for fully syntax highlighted
761 tracebacks. The functionality is also available under ultraTB for
793 tracebacks. The functionality is also available under ultraTB for
762 non-ipython users (someone using ultraTB but outside an ipython
794 non-ipython users (someone using ultraTB but outside an ipython
763 session). They can select the color scheme by setting the
795 session). They can select the color scheme by setting the
764 module-level global DEFAULT_SCHEME. The highlight functionality
796 module-level global DEFAULT_SCHEME. The highlight functionality
765 also works when debugging.
797 also works when debugging.
766
798
767 * IPython/genutils.py (IOStream.close): small patch by
799 * IPython/genutils.py (IOStream.close): small patch by
768 R. Bernstein for improved pydb support.
800 R. Bernstein for improved pydb support.
769
801
770 * IPython/Debugger.py (Pdb.format_stack_entry): Added patch by
802 * IPython/Debugger.py (Pdb.format_stack_entry): Added patch by
771 DaveS <davls@telus.net> to improve support of debugging under
803 DaveS <davls@telus.net> to improve support of debugging under
772 NTEmacs, including improved pydb behavior.
804 NTEmacs, including improved pydb behavior.
773
805
774 * IPython/Magic.py (magic_prun): Fix saving of profile info for
806 * IPython/Magic.py (magic_prun): Fix saving of profile info for
775 Python 2.5, where the stats object API changed a little. Thanks
807 Python 2.5, where the stats object API changed a little. Thanks
776 to a bug report by Paul Smith <paul.smith-AT-catugmt.com>.
808 to a bug report by Paul Smith <paul.smith-AT-catugmt.com>.
777
809
778 * IPython/ColorANSI.py (InputTermColors.Normal): applied Nicolas
810 * IPython/ColorANSI.py (InputTermColors.Normal): applied Nicolas
779 Pernetty's patch to improve support for (X)Emacs under Win32.
811 Pernetty's patch to improve support for (X)Emacs under Win32.
780
812
781 2007-03-17 Fernando Perez <Fernando.Perez@colorado.edu>
813 2007-03-17 Fernando Perez <Fernando.Perez@colorado.edu>
782
814
783 * IPython/Shell.py (hijack_wx): ipmort WX with current semantics
815 * IPython/Shell.py (hijack_wx): ipmort WX with current semantics
784 to quiet a deprecation warning that fires with Wx 2.8. Thanks to
816 to quiet a deprecation warning that fires with Wx 2.8. Thanks to
785 a report by Nik Tautenhahn.
817 a report by Nik Tautenhahn.
786
818
787 2007-03-16 Walter Doerwald <walter@livinglogic.de>
819 2007-03-16 Walter Doerwald <walter@livinglogic.de>
788
820
789 * setup.py: Add the igrid help files to the list of data files
821 * setup.py: Add the igrid help files to the list of data files
790 to be installed alongside igrid.
822 to be installed alongside igrid.
791 * IPython/Extensions/igrid.py: (Patch by Nik Tautenhahn)
823 * IPython/Extensions/igrid.py: (Patch by Nik Tautenhahn)
792 Show the input object of the igrid browser as the window tile.
824 Show the input object of the igrid browser as the window tile.
793 Show the object the cursor is on in the statusbar.
825 Show the object the cursor is on in the statusbar.
794
826
795 2007-03-15 Ville Vainio <vivainio@gmail.com>
827 2007-03-15 Ville Vainio <vivainio@gmail.com>
796
828
797 * Extensions/ipy_stock_completers.py: Fixed exception
829 * Extensions/ipy_stock_completers.py: Fixed exception
798 on mismatching quotes in %run completer. Patch by
830 on mismatching quotes in %run completer. Patch by
799 Jorgen Stenarson. Closes #127.
831 Jorgen Stenarson. Closes #127.
800
832
801 2007-03-14 Ville Vainio <vivainio@gmail.com>
833 2007-03-14 Ville Vainio <vivainio@gmail.com>
802
834
803 * Extensions/ext_rehashdir.py: Do not do auto_alias
835 * Extensions/ext_rehashdir.py: Do not do auto_alias
804 in %rehashdir, it clobbers %store'd aliases.
836 in %rehashdir, it clobbers %store'd aliases.
805
837
806 * UserConfig/ipy_profile_sh.py: envpersist.py extension
838 * UserConfig/ipy_profile_sh.py: envpersist.py extension
807 (beefed up %env) imported for sh profile.
839 (beefed up %env) imported for sh profile.
808
840
809 2007-03-10 Walter Doerwald <walter@livinglogic.de>
841 2007-03-10 Walter Doerwald <walter@livinglogic.de>
810
842
811 * IPython/Extensions/ipipe.py: Prefer ibrowse over igrid
843 * IPython/Extensions/ipipe.py: Prefer ibrowse over igrid
812 as the default browser.
844 as the default browser.
813 * IPython/Extensions/igrid.py: Make a few igrid attributes private.
845 * IPython/Extensions/igrid.py: Make a few igrid attributes private.
814 As igrid displays all attributes it ever encounters, fetch() (which has
846 As igrid displays all attributes it ever encounters, fetch() (which has
815 been renamed to _fetch()) doesn't have to recalculate the display attributes
847 been renamed to _fetch()) doesn't have to recalculate the display attributes
816 every time a new item is fetched. This should speed up scrolling.
848 every time a new item is fetched. This should speed up scrolling.
817
849
818 2007-03-10 Fernando Perez <Fernando.Perez@colorado.edu>
850 2007-03-10 Fernando Perez <Fernando.Perez@colorado.edu>
819
851
820 * IPython/iplib.py (InteractiveShell.__init__): fix for Alex
852 * IPython/iplib.py (InteractiveShell.__init__): fix for Alex
821 Schmolck's recently reported tab-completion bug (my previous one
853 Schmolck's recently reported tab-completion bug (my previous one
822 had a problem). Patch by Dan Milstein <danmil-AT-comcast.net>.
854 had a problem). Patch by Dan Milstein <danmil-AT-comcast.net>.
823
855
824 2007-03-09 Walter Doerwald <walter@livinglogic.de>
856 2007-03-09 Walter Doerwald <walter@livinglogic.de>
825
857
826 * IPython/Extensions/igrid.py: Patch by Nik Tautenhahn:
858 * IPython/Extensions/igrid.py: Patch by Nik Tautenhahn:
827 Close help window if exiting igrid.
859 Close help window if exiting igrid.
828
860
829 2007-03-02 Jorgen Stenarson <jorgen.stenarson@bostream.nu>
861 2007-03-02 Jorgen Stenarson <jorgen.stenarson@bostream.nu>
830
862
831 * IPython/Extensions/ipy_defaults.py: Check if readline is available
863 * IPython/Extensions/ipy_defaults.py: Check if readline is available
832 before calling functions from readline.
864 before calling functions from readline.
833
865
834 2007-03-02 Walter Doerwald <walter@livinglogic.de>
866 2007-03-02 Walter Doerwald <walter@livinglogic.de>
835
867
836 * IPython/Extensions/igrid.py: Add Nik Tautenhahns igrid extension.
868 * IPython/Extensions/igrid.py: Add Nik Tautenhahns igrid extension.
837 igrid is a wxPython-based display object for ipipe. If your system has
869 igrid is a wxPython-based display object for ipipe. If your system has
838 wx installed igrid will be the default display. Without wx ipipe falls
870 wx installed igrid will be the default display. Without wx ipipe falls
839 back to ibrowse (which needs curses). If no curses is installed ipipe
871 back to ibrowse (which needs curses). If no curses is installed ipipe
840 falls back to idump.
872 falls back to idump.
841
873
842 2007-03-01 Fernando Perez <Fernando.Perez@colorado.edu>
874 2007-03-01 Fernando Perez <Fernando.Perez@colorado.edu>
843
875
844 * IPython/iplib.py (split_user_inputBROKEN): temporarily disable
876 * IPython/iplib.py (split_user_inputBROKEN): temporarily disable
845 my changes from yesterday, they introduced bugs. Will reactivate
877 my changes from yesterday, they introduced bugs. Will reactivate
846 once I get a correct solution, which will be much easier thanks to
878 once I get a correct solution, which will be much easier thanks to
847 Dan Milstein's new prefilter test suite.
879 Dan Milstein's new prefilter test suite.
848
880
849 2007-02-28 Fernando Perez <Fernando.Perez@colorado.edu>
881 2007-02-28 Fernando Perez <Fernando.Perez@colorado.edu>
850
882
851 * IPython/iplib.py (split_user_input): fix input splitting so we
883 * IPython/iplib.py (split_user_input): fix input splitting so we
852 don't attempt attribute accesses on things that can't possibly be
884 don't attempt attribute accesses on things that can't possibly be
853 valid Python attributes. After a bug report by Alex Schmolck.
885 valid Python attributes. After a bug report by Alex Schmolck.
854 (InteractiveShell.__init__): brown-paper bag fix; regexp broke
886 (InteractiveShell.__init__): brown-paper bag fix; regexp broke
855 %magic with explicit % prefix.
887 %magic with explicit % prefix.
856
888
857 2007-02-27 Fernando Perez <Fernando.Perez@colorado.edu>
889 2007-02-27 Fernando Perez <Fernando.Perez@colorado.edu>
858
890
859 * IPython/Shell.py (IPShellGTK.mainloop): update threads calls to
891 * IPython/Shell.py (IPShellGTK.mainloop): update threads calls to
860 avoid a DeprecationWarning from GTK.
892 avoid a DeprecationWarning from GTK.
861
893
862 2007-02-22 Fernando Perez <Fernando.Perez@colorado.edu>
894 2007-02-22 Fernando Perez <Fernando.Perez@colorado.edu>
863
895
864 * IPython/genutils.py (clock): I modified clock() to return total
896 * IPython/genutils.py (clock): I modified clock() to return total
865 time, user+system. This is a more commonly needed metric. I also
897 time, user+system. This is a more commonly needed metric. I also
866 introduced the new clocku/clocks to get only user/system time if
898 introduced the new clocku/clocks to get only user/system time if
867 one wants those instead.
899 one wants those instead.
868
900
869 ***WARNING: API CHANGE*** clock() used to return only user time,
901 ***WARNING: API CHANGE*** clock() used to return only user time,
870 so if you want exactly the same results as before, use clocku
902 so if you want exactly the same results as before, use clocku
871 instead.
903 instead.
872
904
873 2007-02-22 Ville Vainio <vivainio@gmail.com>
905 2007-02-22 Ville Vainio <vivainio@gmail.com>
874
906
875 * IPython/Extensions/ipy_p4.py: Extension for improved
907 * IPython/Extensions/ipy_p4.py: Extension for improved
876 p4 (perforce version control system) experience.
908 p4 (perforce version control system) experience.
877 Adds %p4 magic with p4 command completion and
909 Adds %p4 magic with p4 command completion and
878 automatic -G argument (marshall output as python dict)
910 automatic -G argument (marshall output as python dict)
879
911
880 2007-02-19 Fernando Perez <Fernando.Perez@colorado.edu>
912 2007-02-19 Fernando Perez <Fernando.Perez@colorado.edu>
881
913
882 * IPython/demo.py (Demo.re_stop): make dashes optional in demo
914 * IPython/demo.py (Demo.re_stop): make dashes optional in demo
883 stop marks.
915 stop marks.
884 (ClearingMixin): a simple mixin to easily make a Demo class clear
916 (ClearingMixin): a simple mixin to easily make a Demo class clear
885 the screen in between blocks and have empty marquees. The
917 the screen in between blocks and have empty marquees. The
886 ClearDemo and ClearIPDemo classes that use it are included.
918 ClearDemo and ClearIPDemo classes that use it are included.
887
919
888 2007-02-18 Fernando Perez <Fernando.Perez@colorado.edu>
920 2007-02-18 Fernando Perez <Fernando.Perez@colorado.edu>
889
921
890 * IPython/irunner.py (pexpect_monkeypatch): patch pexpect to
922 * IPython/irunner.py (pexpect_monkeypatch): patch pexpect to
891 protect against exceptions at Python shutdown time. Patch
923 protect against exceptions at Python shutdown time. Patch
892 sumbmitted to upstream.
924 sumbmitted to upstream.
893
925
894 2007-02-14 Walter Doerwald <walter@livinglogic.de>
926 2007-02-14 Walter Doerwald <walter@livinglogic.de>
895
927
896 * IPython/Extensions/ibrowse.py: If entering the first object level
928 * IPython/Extensions/ibrowse.py: If entering the first object level
897 (i.e. the object for which the browser has been started) fails,
929 (i.e. the object for which the browser has been started) fails,
898 now the error is raised directly (aborting the browser) instead of
930 now the error is raised directly (aborting the browser) instead of
899 running into an empty levels list later.
931 running into an empty levels list later.
900
932
901 2007-02-03 Walter Doerwald <walter@livinglogic.de>
933 2007-02-03 Walter Doerwald <walter@livinglogic.de>
902
934
903 * IPython/Extensions/ipipe.py: Add an xrepr implementation
935 * IPython/Extensions/ipipe.py: Add an xrepr implementation
904 for the noitem object.
936 for the noitem object.
905
937
906 2007-01-31 Fernando Perez <Fernando.Perez@colorado.edu>
938 2007-01-31 Fernando Perez <Fernando.Perez@colorado.edu>
907
939
908 * IPython/completer.py (Completer.attr_matches): Fix small
940 * IPython/completer.py (Completer.attr_matches): Fix small
909 tab-completion bug with Enthought Traits objects with units.
941 tab-completion bug with Enthought Traits objects with units.
910 Thanks to a bug report by Tom Denniston
942 Thanks to a bug report by Tom Denniston
911 <tom.denniston-AT-alum.dartmouth.org>.
943 <tom.denniston-AT-alum.dartmouth.org>.
912
944
913 2007-01-27 Fernando Perez <Fernando.Perez@colorado.edu>
945 2007-01-27 Fernando Perez <Fernando.Perez@colorado.edu>
914
946
915 * IPython/Extensions/ipy_stock_completers.py (runlistpy): fix a
947 * IPython/Extensions/ipy_stock_completers.py (runlistpy): fix a
916 bug where only .ipy or .py would be completed. Once the first
948 bug where only .ipy or .py would be completed. Once the first
917 argument to %run has been given, all completions are valid because
949 argument to %run has been given, all completions are valid because
918 they are the arguments to the script, which may well be non-python
950 they are the arguments to the script, which may well be non-python
919 filenames.
951 filenames.
920
952
921 * IPython/irunner.py (InteractiveRunner.run_source): major updates
953 * IPython/irunner.py (InteractiveRunner.run_source): major updates
922 to irunner to allow it to correctly support real doctesting of
954 to irunner to allow it to correctly support real doctesting of
923 out-of-process ipython code.
955 out-of-process ipython code.
924
956
925 * IPython/Magic.py (magic_cd): Make the setting of the terminal
957 * IPython/Magic.py (magic_cd): Make the setting of the terminal
926 title an option (-noterm_title) because it completely breaks
958 title an option (-noterm_title) because it completely breaks
927 doctesting.
959 doctesting.
928
960
929 * IPython/demo.py: fix IPythonDemo class that was not actually working.
961 * IPython/demo.py: fix IPythonDemo class that was not actually working.
930
962
931 2007-01-24 Fernando Perez <Fernando.Perez@colorado.edu>
963 2007-01-24 Fernando Perez <Fernando.Perez@colorado.edu>
932
964
933 * IPython/irunner.py (main): fix small bug where extensions were
965 * IPython/irunner.py (main): fix small bug where extensions were
934 not being correctly recognized.
966 not being correctly recognized.
935
967
936 2007-01-23 Walter Doerwald <walter@livinglogic.de>
968 2007-01-23 Walter Doerwald <walter@livinglogic.de>
937
969
938 * IPython/Extensions/ipipe.py (xiter): Make sure that iterating
970 * IPython/Extensions/ipipe.py (xiter): Make sure that iterating
939 a string containing a single line yields the string itself as the
971 a string containing a single line yields the string itself as the
940 only item.
972 only item.
941
973
942 * IPython/Extensions/ibrowse.py (ibrowse): Avoid entering an
974 * IPython/Extensions/ibrowse.py (ibrowse): Avoid entering an
943 object if it's the same as the one on the last level (This avoids
975 object if it's the same as the one on the last level (This avoids
944 infinite recursion for one line strings).
976 infinite recursion for one line strings).
945
977
946 2007-01-17 Fernando Perez <Fernando.Perez@colorado.edu>
978 2007-01-17 Fernando Perez <Fernando.Perez@colorado.edu>
947
979
948 * IPython/ultraTB.py (AutoFormattedTB.__call__): properly flush
980 * IPython/ultraTB.py (AutoFormattedTB.__call__): properly flush
949 all output streams before printing tracebacks. This ensures that
981 all output streams before printing tracebacks. This ensures that
950 user output doesn't end up interleaved with traceback output.
982 user output doesn't end up interleaved with traceback output.
951
983
952 2007-01-10 Ville Vainio <vivainio@gmail.com>
984 2007-01-10 Ville Vainio <vivainio@gmail.com>
953
985
954 * Extensions/envpersist.py: Turbocharged %env that remembers
986 * Extensions/envpersist.py: Turbocharged %env that remembers
955 env vars across sessions; e.g. "%env PATH+=;/opt/scripts" or
987 env vars across sessions; e.g. "%env PATH+=;/opt/scripts" or
956 "%env VISUAL=jed".
988 "%env VISUAL=jed".
957
989
958 2007-01-05 Fernando Perez <Fernando.Perez@colorado.edu>
990 2007-01-05 Fernando Perez <Fernando.Perez@colorado.edu>
959
991
960 * IPython/iplib.py (showtraceback): ensure that we correctly call
992 * IPython/iplib.py (showtraceback): ensure that we correctly call
961 custom handlers in all cases (some with pdb were slipping through,
993 custom handlers in all cases (some with pdb were slipping through,
962 but I'm not exactly sure why).
994 but I'm not exactly sure why).
963
995
964 * IPython/Debugger.py (Tracer.__init__): added new class to
996 * IPython/Debugger.py (Tracer.__init__): added new class to
965 support set_trace-like usage of IPython's enhanced debugger.
997 support set_trace-like usage of IPython's enhanced debugger.
966
998
967 2006-12-24 Ville Vainio <vivainio@gmail.com>
999 2006-12-24 Ville Vainio <vivainio@gmail.com>
968
1000
969 * ipmaker.py: more informative message when ipy_user_conf
1001 * ipmaker.py: more informative message when ipy_user_conf
970 import fails (suggest running %upgrade).
1002 import fails (suggest running %upgrade).
971
1003
972 * tools/run_ipy_in_profiler.py: Utility to see where
1004 * tools/run_ipy_in_profiler.py: Utility to see where
973 the time during IPython startup is spent.
1005 the time during IPython startup is spent.
974
1006
975 2006-12-20 Ville Vainio <vivainio@gmail.com>
1007 2006-12-20 Ville Vainio <vivainio@gmail.com>
976
1008
977 * 0.7.3 is out - merge all from 0.7.3 branch to trunk
1009 * 0.7.3 is out - merge all from 0.7.3 branch to trunk
978
1010
979 * ipapi.py: Add new ipapi method, expand_alias.
1011 * ipapi.py: Add new ipapi method, expand_alias.
980
1012
981 * Release.py: Bump up version to 0.7.4.svn
1013 * Release.py: Bump up version to 0.7.4.svn
982
1014
983 2006-12-17 Ville Vainio <vivainio@gmail.com>
1015 2006-12-17 Ville Vainio <vivainio@gmail.com>
984
1016
985 * Extensions/jobctrl.py: Fixed &cmd arg arg...
1017 * Extensions/jobctrl.py: Fixed &cmd arg arg...
986 to work properly on posix too
1018 to work properly on posix too
987
1019
988 * Release.py: Update revnum (version is still just 0.7.3).
1020 * Release.py: Update revnum (version is still just 0.7.3).
989
1021
990 2006-12-15 Ville Vainio <vivainio@gmail.com>
1022 2006-12-15 Ville Vainio <vivainio@gmail.com>
991
1023
992 * scripts/ipython_win_post_install: create ipython.py in
1024 * scripts/ipython_win_post_install: create ipython.py in
993 prefix + "/scripts".
1025 prefix + "/scripts".
994
1026
995 * Release.py: Update version to 0.7.3.
1027 * Release.py: Update version to 0.7.3.
996
1028
997 2006-12-14 Ville Vainio <vivainio@gmail.com>
1029 2006-12-14 Ville Vainio <vivainio@gmail.com>
998
1030
999 * scripts/ipython_win_post_install: Overwrite old shortcuts
1031 * scripts/ipython_win_post_install: Overwrite old shortcuts
1000 if they already exist
1032 if they already exist
1001
1033
1002 * Release.py: release 0.7.3rc2
1034 * Release.py: release 0.7.3rc2
1003
1035
1004 2006-12-13 Ville Vainio <vivainio@gmail.com>
1036 2006-12-13 Ville Vainio <vivainio@gmail.com>
1005
1037
1006 * Branch and update Release.py for 0.7.3rc1
1038 * Branch and update Release.py for 0.7.3rc1
1007
1039
1008 2006-12-13 Fernando Perez <Fernando.Perez@colorado.edu>
1040 2006-12-13 Fernando Perez <Fernando.Perez@colorado.edu>
1009
1041
1010 * IPython/Shell.py (IPShellWX): update for current WX naming
1042 * IPython/Shell.py (IPShellWX): update for current WX naming
1011 conventions, to avoid a deprecation warning with current WX
1043 conventions, to avoid a deprecation warning with current WX
1012 versions. Thanks to a report by Danny Shevitz.
1044 versions. Thanks to a report by Danny Shevitz.
1013
1045
1014 2006-12-12 Ville Vainio <vivainio@gmail.com>
1046 2006-12-12 Ville Vainio <vivainio@gmail.com>
1015
1047
1016 * ipmaker.py: apply david cournapeau's patch to make
1048 * ipmaker.py: apply david cournapeau's patch to make
1017 import_some work properly even when ipythonrc does
1049 import_some work properly even when ipythonrc does
1018 import_some on empty list (it was an old bug!).
1050 import_some on empty list (it was an old bug!).
1019
1051
1020 * UserConfig/ipy_user_conf.py, UserConfig/ipythonrc:
1052 * UserConfig/ipy_user_conf.py, UserConfig/ipythonrc:
1021 Add deprecation note to ipythonrc and a url to wiki
1053 Add deprecation note to ipythonrc and a url to wiki
1022 in ipy_user_conf.py
1054 in ipy_user_conf.py
1023
1055
1024
1056
1025 * Magic.py (%run): %run myscript.ipy now runs myscript.ipy
1057 * Magic.py (%run): %run myscript.ipy now runs myscript.ipy
1026 as if it was typed on IPython command prompt, i.e.
1058 as if it was typed on IPython command prompt, i.e.
1027 as IPython script.
1059 as IPython script.
1028
1060
1029 * example-magic.py, magic_grepl.py: remove outdated examples
1061 * example-magic.py, magic_grepl.py: remove outdated examples
1030
1062
1031 2006-12-11 Fernando Perez <Fernando.Perez@colorado.edu>
1063 2006-12-11 Fernando Perez <Fernando.Perez@colorado.edu>
1032
1064
1033 * IPython/iplib.py (debugger): prevent a nasty traceback if %debug
1065 * IPython/iplib.py (debugger): prevent a nasty traceback if %debug
1034 is called before any exception has occurred.
1066 is called before any exception has occurred.
1035
1067
1036 2006-12-08 Ville Vainio <vivainio@gmail.com>
1068 2006-12-08 Ville Vainio <vivainio@gmail.com>
1037
1069
1038 * Extensions/ipy_stock_completers.py: fix cd completer
1070 * Extensions/ipy_stock_completers.py: fix cd completer
1039 to translate /'s to \'s again.
1071 to translate /'s to \'s again.
1040
1072
1041 * completer.py: prevent traceback on file completions w/
1073 * completer.py: prevent traceback on file completions w/
1042 backslash.
1074 backslash.
1043
1075
1044 * Release.py: Update release number to 0.7.3b3 for release
1076 * Release.py: Update release number to 0.7.3b3 for release
1045
1077
1046 2006-12-07 Ville Vainio <vivainio@gmail.com>
1078 2006-12-07 Ville Vainio <vivainio@gmail.com>
1047
1079
1048 * Extensions/ipy_signals.py: Ignore ctrl+C in IPython process
1080 * Extensions/ipy_signals.py: Ignore ctrl+C in IPython process
1049 while executing external code. Provides more shell-like behaviour
1081 while executing external code. Provides more shell-like behaviour
1050 and overall better response to ctrl + C / ctrl + break.
1082 and overall better response to ctrl + C / ctrl + break.
1051
1083
1052 * tools/make_tarball.py: new script to create tarball straight from svn
1084 * tools/make_tarball.py: new script to create tarball straight from svn
1053 (setup.py sdist doesn't work on win32).
1085 (setup.py sdist doesn't work on win32).
1054
1086
1055 * Extensions/ipy_stock_completers.py: fix cd completer to give up
1087 * Extensions/ipy_stock_completers.py: fix cd completer to give up
1056 on dirnames with spaces and use the default completer instead.
1088 on dirnames with spaces and use the default completer instead.
1057
1089
1058 * Revision.py: Change version to 0.7.3b2 for release.
1090 * Revision.py: Change version to 0.7.3b2 for release.
1059
1091
1060 2006-12-05 Ville Vainio <vivainio@gmail.com>
1092 2006-12-05 Ville Vainio <vivainio@gmail.com>
1061
1093
1062 * Magic.py, iplib.py, completer.py: Apply R. Bernstein's
1094 * Magic.py, iplib.py, completer.py: Apply R. Bernstein's
1063 pydb patch 4 (rm debug printing, py 2.5 checking)
1095 pydb patch 4 (rm debug printing, py 2.5 checking)
1064
1096
1065 2006-11-30 Walter Doerwald <walter@livinglogic.de>
1097 2006-11-30 Walter Doerwald <walter@livinglogic.de>
1066 * IPython/Extensions/ibrowse.py: Add two new commands to ibrowse:
1098 * IPython/Extensions/ibrowse.py: Add two new commands to ibrowse:
1067 "refresh" (mapped to "r") refreshes the screen by restarting the iterator.
1099 "refresh" (mapped to "r") refreshes the screen by restarting the iterator.
1068 "refreshfind" (mapped to "R") does the same but tries to go back to the same
1100 "refreshfind" (mapped to "R") does the same but tries to go back to the same
1069 object the cursor was on before the refresh. The command "markrange" is
1101 object the cursor was on before the refresh. The command "markrange" is
1070 mapped to "%" now.
1102 mapped to "%" now.
1071 * IPython/Extensions/ibrowse.py: Make igrpentry and ipwdentry comparable.
1103 * IPython/Extensions/ibrowse.py: Make igrpentry and ipwdentry comparable.
1072
1104
1073 2006-11-29 Fernando Perez <Fernando.Perez@colorado.edu>
1105 2006-11-29 Fernando Perez <Fernando.Perez@colorado.edu>
1074
1106
1075 * IPython/Magic.py (magic_debug): new %debug magic to activate the
1107 * IPython/Magic.py (magic_debug): new %debug magic to activate the
1076 interactive debugger on the last traceback, without having to call
1108 interactive debugger on the last traceback, without having to call
1077 %pdb and rerun your code. Made minor changes in various modules,
1109 %pdb and rerun your code. Made minor changes in various modules,
1078 should automatically recognize pydb if available.
1110 should automatically recognize pydb if available.
1079
1111
1080 2006-11-28 Ville Vainio <vivainio@gmail.com>
1112 2006-11-28 Ville Vainio <vivainio@gmail.com>
1081
1113
1082 * completer.py: If the text start with !, show file completions
1114 * completer.py: If the text start with !, show file completions
1083 properly. This helps when trying to complete command name
1115 properly. This helps when trying to complete command name
1084 for shell escapes.
1116 for shell escapes.
1085
1117
1086 2006-11-27 Ville Vainio <vivainio@gmail.com>
1118 2006-11-27 Ville Vainio <vivainio@gmail.com>
1087
1119
1088 * ipy_stock_completers.py: bzr completer submitted by Stefan van
1120 * ipy_stock_completers.py: bzr completer submitted by Stefan van
1089 der Walt. Clean up svn and hg completers by using a common
1121 der Walt. Clean up svn and hg completers by using a common
1090 vcs_completer.
1122 vcs_completer.
1091
1123
1092 2006-11-26 Ville Vainio <vivainio@gmail.com>
1124 2006-11-26 Ville Vainio <vivainio@gmail.com>
1093
1125
1094 * Remove ipconfig and %config; you should use _ip.options structure
1126 * Remove ipconfig and %config; you should use _ip.options structure
1095 directly instead!
1127 directly instead!
1096
1128
1097 * genutils.py: add wrap_deprecated function for deprecating callables
1129 * genutils.py: add wrap_deprecated function for deprecating callables
1098
1130
1099 * iplib.py: deprecate ipmagic, ipsystem, ipalias. Use _ip.magic and
1131 * iplib.py: deprecate ipmagic, ipsystem, ipalias. Use _ip.magic and
1100 _ip.system instead. ipalias is redundant.
1132 _ip.system instead. ipalias is redundant.
1101
1133
1102 * Magic.py: %rehashdir no longer aliases 'cmdname' to 'cmdname.exe' on
1134 * Magic.py: %rehashdir no longer aliases 'cmdname' to 'cmdname.exe' on
1103 win32, but just 'cmdname'. Other extensions (non-'exe') are still made
1135 win32, but just 'cmdname'. Other extensions (non-'exe') are still made
1104 explicit.
1136 explicit.
1105
1137
1106 * ipy_stock_completers.py: 'hg' (mercurial VCS) now has a custom
1138 * ipy_stock_completers.py: 'hg' (mercurial VCS) now has a custom
1107 completer. Try it by entering 'hg ' and pressing tab.
1139 completer. Try it by entering 'hg ' and pressing tab.
1108
1140
1109 * macro.py: Give Macro a useful __repr__ method
1141 * macro.py: Give Macro a useful __repr__ method
1110
1142
1111 * Magic.py: %whos abbreviates the typename of Macro for brevity.
1143 * Magic.py: %whos abbreviates the typename of Macro for brevity.
1112
1144
1113 2006-11-24 Walter Doerwald <walter@livinglogic.de>
1145 2006-11-24 Walter Doerwald <walter@livinglogic.de>
1114 * IPython/Extensions/astyle.py: Do a relative import of ipipe, so that
1146 * IPython/Extensions/astyle.py: Do a relative import of ipipe, so that
1115 we don't get a duplicate ipipe module, where registration of the xrepr
1147 we don't get a duplicate ipipe module, where registration of the xrepr
1116 implementation for Text is useless.
1148 implementation for Text is useless.
1117
1149
1118 * IPython/Extensions/ipipe.py: Fix __xrepr__() implementation for ils.
1150 * IPython/Extensions/ipipe.py: Fix __xrepr__() implementation for ils.
1119
1151
1120 * IPython/Extensions/ibrowse.py: Fix keymapping for the enter command.
1152 * IPython/Extensions/ibrowse.py: Fix keymapping for the enter command.
1121
1153
1122 2006-11-24 Ville Vainio <vivainio@gmail.com>
1154 2006-11-24 Ville Vainio <vivainio@gmail.com>
1123
1155
1124 * Magic.py, manual_base.lyx: Kirill Smelkov patch:
1156 * Magic.py, manual_base.lyx: Kirill Smelkov patch:
1125 try to use "cProfile" instead of the slower pure python
1157 try to use "cProfile" instead of the slower pure python
1126 "profile"
1158 "profile"
1127
1159
1128 2006-11-23 Ville Vainio <vivainio@gmail.com>
1160 2006-11-23 Ville Vainio <vivainio@gmail.com>
1129
1161
1130 * manual_base.lyx: Kirill Smelkov patch: Fix wrong
1162 * manual_base.lyx: Kirill Smelkov patch: Fix wrong
1131 Qt+IPython+Designer link in documentation.
1163 Qt+IPython+Designer link in documentation.
1132
1164
1133 * Extensions/ipy_pydb.py: R. Bernstein's patch for passing
1165 * Extensions/ipy_pydb.py: R. Bernstein's patch for passing
1134 correct Pdb object to %pydb.
1166 correct Pdb object to %pydb.
1135
1167
1136
1168
1137 2006-11-22 Walter Doerwald <walter@livinglogic.de>
1169 2006-11-22 Walter Doerwald <walter@livinglogic.de>
1138 * IPython/Extensions/astyle.py: Text needs it's own implemenation of the
1170 * IPython/Extensions/astyle.py: Text needs it's own implemenation of the
1139 generic xrepr(), otherwise the list implementation would kick in.
1171 generic xrepr(), otherwise the list implementation would kick in.
1140
1172
1141 2006-11-21 Ville Vainio <vivainio@gmail.com>
1173 2006-11-21 Ville Vainio <vivainio@gmail.com>
1142
1174
1143 * upgrade_dir.py: Now actually overwrites a nonmodified user file
1175 * upgrade_dir.py: Now actually overwrites a nonmodified user file
1144 with one from UserConfig.
1176 with one from UserConfig.
1145
1177
1146 * ipy_profile_sh.py: Add dummy "depth" to var_expand lambda,
1178 * ipy_profile_sh.py: Add dummy "depth" to var_expand lambda,
1147 it was missing which broke the sh profile.
1179 it was missing which broke the sh profile.
1148
1180
1149 * completer.py: file completer now uses explicit '/' instead
1181 * completer.py: file completer now uses explicit '/' instead
1150 of os.path.join, expansion of 'foo' was broken on win32
1182 of os.path.join, expansion of 'foo' was broken on win32
1151 if there was one directory with name 'foobar'.
1183 if there was one directory with name 'foobar'.
1152
1184
1153 * A bunch of patches from Kirill Smelkov:
1185 * A bunch of patches from Kirill Smelkov:
1154
1186
1155 * [patch 9/9] doc: point bug-tracker URL to IPythons trac-tickets.
1187 * [patch 9/9] doc: point bug-tracker URL to IPythons trac-tickets.
1156
1188
1157 * [patch 7/9] Implement %page -r (page in raw mode) -
1189 * [patch 7/9] Implement %page -r (page in raw mode) -
1158
1190
1159 * [patch 5/9] ScientificPython webpage has moved
1191 * [patch 5/9] ScientificPython webpage has moved
1160
1192
1161 * [patch 4/9] The manual mentions %ds, should be %dhist
1193 * [patch 4/9] The manual mentions %ds, should be %dhist
1162
1194
1163 * [patch 3/9] Kill old bits from %prun doc.
1195 * [patch 3/9] Kill old bits from %prun doc.
1164
1196
1165 * [patch 1/9] Fix typos here and there.
1197 * [patch 1/9] Fix typos here and there.
1166
1198
1167 2006-11-08 Ville Vainio <vivainio@gmail.com>
1199 2006-11-08 Ville Vainio <vivainio@gmail.com>
1168
1200
1169 * completer.py (attr_matches): catch all exceptions raised
1201 * completer.py (attr_matches): catch all exceptions raised
1170 by eval of expr with dots.
1202 by eval of expr with dots.
1171
1203
1172 2006-11-07 Fernando Perez <Fernando.Perez@colorado.edu>
1204 2006-11-07 Fernando Perez <Fernando.Perez@colorado.edu>
1173
1205
1174 * IPython/iplib.py (runsource): Prepend an 'if 1:' to the user
1206 * IPython/iplib.py (runsource): Prepend an 'if 1:' to the user
1175 input if it starts with whitespace. This allows you to paste
1207 input if it starts with whitespace. This allows you to paste
1176 indented input from any editor without manually having to type in
1208 indented input from any editor without manually having to type in
1177 the 'if 1:', which is convenient when working interactively.
1209 the 'if 1:', which is convenient when working interactively.
1178 Slightly modifed version of a patch by Bo Peng
1210 Slightly modifed version of a patch by Bo Peng
1179 <bpeng-AT-rice.edu>.
1211 <bpeng-AT-rice.edu>.
1180
1212
1181 2006-11-03 Fernando Perez <Fernando.Perez@colorado.edu>
1213 2006-11-03 Fernando Perez <Fernando.Perez@colorado.edu>
1182
1214
1183 * IPython/irunner.py (main): modified irunner so it automatically
1215 * IPython/irunner.py (main): modified irunner so it automatically
1184 recognizes the right runner to use based on the extension (.py for
1216 recognizes the right runner to use based on the extension (.py for
1185 python, .ipy for ipython and .sage for sage).
1217 python, .ipy for ipython and .sage for sage).
1186
1218
1187 * IPython/iplib.py (InteractiveShell.ipconfig): new builtin, also
1219 * IPython/iplib.py (InteractiveShell.ipconfig): new builtin, also
1188 visible in ipapi as ip.config(), to programatically control the
1220 visible in ipapi as ip.config(), to programatically control the
1189 internal rc object. There's an accompanying %config magic for
1221 internal rc object. There's an accompanying %config magic for
1190 interactive use, which has been enhanced to match the
1222 interactive use, which has been enhanced to match the
1191 funtionality in ipconfig.
1223 funtionality in ipconfig.
1192
1224
1193 * IPython/Magic.py (magic_system_verbose): Change %system_verbose
1225 * IPython/Magic.py (magic_system_verbose): Change %system_verbose
1194 so it's not just a toggle, it now takes an argument. Add support
1226 so it's not just a toggle, it now takes an argument. Add support
1195 for a customizable header when making system calls, as the new
1227 for a customizable header when making system calls, as the new
1196 system_header variable in the ipythonrc file.
1228 system_header variable in the ipythonrc file.
1197
1229
1198 2006-11-03 Walter Doerwald <walter@livinglogic.de>
1230 2006-11-03 Walter Doerwald <walter@livinglogic.de>
1199
1231
1200 * IPython/Extensions/ipipe.py: xrepr(), xiter() and xattrs() are now
1232 * IPython/Extensions/ipipe.py: xrepr(), xiter() and xattrs() are now
1201 generic functions (using Philip J. Eby's simplegeneric package).
1233 generic functions (using Philip J. Eby's simplegeneric package).
1202 This makes it possible to customize the display of third-party classes
1234 This makes it possible to customize the display of third-party classes
1203 without having to monkeypatch them. xiter() no longer supports a mode
1235 without having to monkeypatch them. xiter() no longer supports a mode
1204 argument and the XMode class has been removed. The same functionality can
1236 argument and the XMode class has been removed. The same functionality can
1205 be implemented via IterAttributeDescriptor and IterMethodDescriptor.
1237 be implemented via IterAttributeDescriptor and IterMethodDescriptor.
1206 One consequence of the switch to generic functions is that xrepr() and
1238 One consequence of the switch to generic functions is that xrepr() and
1207 xattrs() implementation must define the default value for the mode
1239 xattrs() implementation must define the default value for the mode
1208 argument themselves and xattrs() implementations must return real
1240 argument themselves and xattrs() implementations must return real
1209 descriptors.
1241 descriptors.
1210
1242
1211 * IPython/external: This new subpackage will contain all third-party
1243 * IPython/external: This new subpackage will contain all third-party
1212 packages that are bundled with IPython. (The first one is simplegeneric).
1244 packages that are bundled with IPython. (The first one is simplegeneric).
1213
1245
1214 * IPython/Extensions/ipipe.py (ifile/ils): Readd output of the parent
1246 * IPython/Extensions/ipipe.py (ifile/ils): Readd output of the parent
1215 directory which as been dropped in r1703.
1247 directory which as been dropped in r1703.
1216
1248
1217 * IPython/Extensions/ipipe.py (iless): Fixed.
1249 * IPython/Extensions/ipipe.py (iless): Fixed.
1218
1250
1219 * IPython/Extensions/ibrowse: Fixed sorting under Python 2.3.
1251 * IPython/Extensions/ibrowse: Fixed sorting under Python 2.3.
1220
1252
1221 2006-11-03 Fernando Perez <Fernando.Perez@colorado.edu>
1253 2006-11-03 Fernando Perez <Fernando.Perez@colorado.edu>
1222
1254
1223 * IPython/iplib.py (InteractiveShell.var_expand): fix stack
1255 * IPython/iplib.py (InteractiveShell.var_expand): fix stack
1224 handling in variable expansion so that shells and magics recognize
1256 handling in variable expansion so that shells and magics recognize
1225 function local scopes correctly. Bug reported by Brian.
1257 function local scopes correctly. Bug reported by Brian.
1226
1258
1227 * scripts/ipython: remove the very first entry in sys.path which
1259 * scripts/ipython: remove the very first entry in sys.path which
1228 Python auto-inserts for scripts, so that sys.path under IPython is
1260 Python auto-inserts for scripts, so that sys.path under IPython is
1229 as similar as possible to that under plain Python.
1261 as similar as possible to that under plain Python.
1230
1262
1231 * IPython/completer.py (IPCompleter.file_matches): Fix
1263 * IPython/completer.py (IPCompleter.file_matches): Fix
1232 tab-completion so that quotes are not closed unless the completion
1264 tab-completion so that quotes are not closed unless the completion
1233 is unambiguous. After a request by Stefan. Minor cleanups in
1265 is unambiguous. After a request by Stefan. Minor cleanups in
1234 ipy_stock_completers.
1266 ipy_stock_completers.
1235
1267
1236 2006-11-02 Ville Vainio <vivainio@gmail.com>
1268 2006-11-02 Ville Vainio <vivainio@gmail.com>
1237
1269
1238 * ipy_stock_completers.py: Add %run and %cd completers.
1270 * ipy_stock_completers.py: Add %run and %cd completers.
1239
1271
1240 * completer.py: Try running custom completer for both
1272 * completer.py: Try running custom completer for both
1241 "foo" and "%foo" if the command is just "foo". Ignore case
1273 "foo" and "%foo" if the command is just "foo". Ignore case
1242 when filtering possible completions.
1274 when filtering possible completions.
1243
1275
1244 * UserConfig/ipy_user_conf.py: install stock completers as default
1276 * UserConfig/ipy_user_conf.py: install stock completers as default
1245
1277
1246 * iplib.py (history_saving_wrapper), debugger(), ipy_pydb.py:
1278 * iplib.py (history_saving_wrapper), debugger(), ipy_pydb.py:
1247 simplified readline history save / restore through a wrapper
1279 simplified readline history save / restore through a wrapper
1248 function
1280 function
1249
1281
1250
1282
1251 2006-10-31 Ville Vainio <vivainio@gmail.com>
1283 2006-10-31 Ville Vainio <vivainio@gmail.com>
1252
1284
1253 * strdispatch.py, completer.py, ipy_stock_completers.py:
1285 * strdispatch.py, completer.py, ipy_stock_completers.py:
1254 Allow str_key ("command") in completer hooks. Implement
1286 Allow str_key ("command") in completer hooks. Implement
1255 trivial completer for 'import' (stdlib modules only). Rename
1287 trivial completer for 'import' (stdlib modules only). Rename
1256 ipy_linux_package_managers.py to ipy_stock_completers.py.
1288 ipy_linux_package_managers.py to ipy_stock_completers.py.
1257 SVN completer.
1289 SVN completer.
1258
1290
1259 * Extensions/ledit.py: %magic line editor for easily and
1291 * Extensions/ledit.py: %magic line editor for easily and
1260 incrementally manipulating lists of strings. The magic command
1292 incrementally manipulating lists of strings. The magic command
1261 name is %led.
1293 name is %led.
1262
1294
1263 2006-10-30 Ville Vainio <vivainio@gmail.com>
1295 2006-10-30 Ville Vainio <vivainio@gmail.com>
1264
1296
1265 * Debugger.py, iplib.py (debugger()): Add last set of Rocky
1297 * Debugger.py, iplib.py (debugger()): Add last set of Rocky
1266 Bernsteins's patches for pydb integration.
1298 Bernsteins's patches for pydb integration.
1267 http://bashdb.sourceforge.net/pydb/
1299 http://bashdb.sourceforge.net/pydb/
1268
1300
1269 * strdispatch.py, iplib.py, completer.py, IPython/__init__.py,
1301 * strdispatch.py, iplib.py, completer.py, IPython/__init__.py,
1270 Extensions/ipy_linux_package_managers.py, hooks.py: Implement
1302 Extensions/ipy_linux_package_managers.py, hooks.py: Implement
1271 custom completer hook to allow the users to implement their own
1303 custom completer hook to allow the users to implement their own
1272 completers. See ipy_linux_package_managers.py for example. The
1304 completers. See ipy_linux_package_managers.py for example. The
1273 hook name is 'complete_command'.
1305 hook name is 'complete_command'.
1274
1306
1275 2006-10-28 Fernando Perez <Fernando.Perez@colorado.edu>
1307 2006-10-28 Fernando Perez <Fernando.Perez@colorado.edu>
1276
1308
1277 * IPython/UserConfig/ipythonrc-scipy: minor cleanups to remove old
1309 * IPython/UserConfig/ipythonrc-scipy: minor cleanups to remove old
1278 Numeric leftovers.
1310 Numeric leftovers.
1279
1311
1280 * ipython.el (py-execute-region): apply Stefan's patch to fix
1312 * ipython.el (py-execute-region): apply Stefan's patch to fix
1281 garbled results if the python shell hasn't been previously started.
1313 garbled results if the python shell hasn't been previously started.
1282
1314
1283 * IPython/genutils.py (arg_split): moved to genutils, since it's a
1315 * IPython/genutils.py (arg_split): moved to genutils, since it's a
1284 pretty generic function and useful for other things.
1316 pretty generic function and useful for other things.
1285
1317
1286 * IPython/OInspect.py (getsource): Add customizable source
1318 * IPython/OInspect.py (getsource): Add customizable source
1287 extractor. After a request/patch form W. Stein (SAGE).
1319 extractor. After a request/patch form W. Stein (SAGE).
1288
1320
1289 * IPython/irunner.py (InteractiveRunner.run_source): reset tty
1321 * IPython/irunner.py (InteractiveRunner.run_source): reset tty
1290 window size to a more reasonable value from what pexpect does,
1322 window size to a more reasonable value from what pexpect does,
1291 since their choice causes wrapping bugs with long input lines.
1323 since their choice causes wrapping bugs with long input lines.
1292
1324
1293 2006-10-28 Ville Vainio <vivainio@gmail.com>
1325 2006-10-28 Ville Vainio <vivainio@gmail.com>
1294
1326
1295 * Magic.py (%run): Save and restore the readline history from
1327 * Magic.py (%run): Save and restore the readline history from
1296 file around %run commands to prevent side effects from
1328 file around %run commands to prevent side effects from
1297 %runned programs that might use readline (e.g. pydb).
1329 %runned programs that might use readline (e.g. pydb).
1298
1330
1299 * extensions/ipy_pydb.py: Adds %pydb magic when imported, for
1331 * extensions/ipy_pydb.py: Adds %pydb magic when imported, for
1300 invoking the pydb enhanced debugger.
1332 invoking the pydb enhanced debugger.
1301
1333
1302 2006-10-23 Walter Doerwald <walter@livinglogic.de>
1334 2006-10-23 Walter Doerwald <walter@livinglogic.de>
1303
1335
1304 * IPython/Extensions/ipipe.py (ifile): Remove all methods that
1336 * IPython/Extensions/ipipe.py (ifile): Remove all methods that
1305 call the base class method and propagate the return value to
1337 call the base class method and propagate the return value to
1306 ifile. This is now done by path itself.
1338 ifile. This is now done by path itself.
1307
1339
1308 2006-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
1340 2006-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
1309
1341
1310 * IPython/ipapi.py (IPApi.__init__): Added new entry to public
1342 * IPython/ipapi.py (IPApi.__init__): Added new entry to public
1311 api: set_crash_handler(), to expose the ability to change the
1343 api: set_crash_handler(), to expose the ability to change the
1312 internal crash handler.
1344 internal crash handler.
1313
1345
1314 * IPython/CrashHandler.py (CrashHandler.__init__): abstract out
1346 * IPython/CrashHandler.py (CrashHandler.__init__): abstract out
1315 the various parameters of the crash handler so that apps using
1347 the various parameters of the crash handler so that apps using
1316 IPython as their engine can customize crash handling. Ipmlemented
1348 IPython as their engine can customize crash handling. Ipmlemented
1317 at the request of SAGE.
1349 at the request of SAGE.
1318
1350
1319 2006-10-14 Ville Vainio <vivainio@gmail.com>
1351 2006-10-14 Ville Vainio <vivainio@gmail.com>
1320
1352
1321 * Magic.py, ipython.el: applied first "safe" part of Rocky
1353 * Magic.py, ipython.el: applied first "safe" part of Rocky
1322 Bernstein's patch set for pydb integration.
1354 Bernstein's patch set for pydb integration.
1323
1355
1324 * Magic.py (%unalias, %alias): %store'd aliases can now be
1356 * Magic.py (%unalias, %alias): %store'd aliases can now be
1325 removed with '%unalias'. %alias w/o args now shows most
1357 removed with '%unalias'. %alias w/o args now shows most
1326 interesting (stored / manually defined) aliases last
1358 interesting (stored / manually defined) aliases last
1327 where they catch the eye w/o scrolling.
1359 where they catch the eye w/o scrolling.
1328
1360
1329 * Magic.py (%rehashx), ext_rehashdir.py: files with
1361 * Magic.py (%rehashx), ext_rehashdir.py: files with
1330 'py' extension are always considered executable, even
1362 'py' extension are always considered executable, even
1331 when not in PATHEXT environment variable.
1363 when not in PATHEXT environment variable.
1332
1364
1333 2006-10-12 Ville Vainio <vivainio@gmail.com>
1365 2006-10-12 Ville Vainio <vivainio@gmail.com>
1334
1366
1335 * jobctrl.py: Add new "jobctrl" extension for spawning background
1367 * jobctrl.py: Add new "jobctrl" extension for spawning background
1336 processes with "&find /". 'import jobctrl' to try it out. Requires
1368 processes with "&find /". 'import jobctrl' to try it out. Requires
1337 'subprocess' module, standard in python 2.4+.
1369 'subprocess' module, standard in python 2.4+.
1338
1370
1339 * iplib.py (expand_aliases, handle_alias): Aliases expand transitively,
1371 * iplib.py (expand_aliases, handle_alias): Aliases expand transitively,
1340 so if foo -> bar and bar -> baz, then foo -> baz.
1372 so if foo -> bar and bar -> baz, then foo -> baz.
1341
1373
1342 2006-10-09 Fernando Perez <Fernando.Perez@colorado.edu>
1374 2006-10-09 Fernando Perez <Fernando.Perez@colorado.edu>
1343
1375
1344 * IPython/Magic.py (Magic.parse_options): add a new posix option
1376 * IPython/Magic.py (Magic.parse_options): add a new posix option
1345 to allow parsing of input args in magics that doesn't strip quotes
1377 to allow parsing of input args in magics that doesn't strip quotes
1346 (if posix=False). This also closes %timeit bug reported by
1378 (if posix=False). This also closes %timeit bug reported by
1347 Stefan.
1379 Stefan.
1348
1380
1349 2006-10-03 Ville Vainio <vivainio@gmail.com>
1381 2006-10-03 Ville Vainio <vivainio@gmail.com>
1350
1382
1351 * iplib.py (raw_input, interact): Return ValueError catching for
1383 * iplib.py (raw_input, interact): Return ValueError catching for
1352 raw_input. Fixes infinite loop for sys.stdin.close() or
1384 raw_input. Fixes infinite loop for sys.stdin.close() or
1353 sys.stdout.close().
1385 sys.stdout.close().
1354
1386
1355 2006-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
1387 2006-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
1356
1388
1357 * IPython/irunner.py (InteractiveRunner.run_source): small fixes
1389 * IPython/irunner.py (InteractiveRunner.run_source): small fixes
1358 to help in handling doctests. irunner is now pretty useful for
1390 to help in handling doctests. irunner is now pretty useful for
1359 running standalone scripts and simulate a full interactive session
1391 running standalone scripts and simulate a full interactive session
1360 in a format that can be then pasted as a doctest.
1392 in a format that can be then pasted as a doctest.
1361
1393
1362 * IPython/iplib.py (InteractiveShell.__init__): Install exit/quit
1394 * IPython/iplib.py (InteractiveShell.__init__): Install exit/quit
1363 on top of the default (useless) ones. This also fixes the nasty
1395 on top of the default (useless) ones. This also fixes the nasty
1364 way in which 2.5's Quitter() exits (reverted [1785]).
1396 way in which 2.5's Quitter() exits (reverted [1785]).
1365
1397
1366 * IPython/Debugger.py (Pdb.__init__): Fix ipdb to work with python
1398 * IPython/Debugger.py (Pdb.__init__): Fix ipdb to work with python
1367 2.5.
1399 2.5.
1368
1400
1369 * IPython/ultraTB.py (TBTools.set_colors): Make sure that ipdb
1401 * IPython/ultraTB.py (TBTools.set_colors): Make sure that ipdb
1370 color scheme is updated as well when color scheme is changed
1402 color scheme is updated as well when color scheme is changed
1371 interactively.
1403 interactively.
1372
1404
1373 2006-09-27 Ville Vainio <vivainio@gmail.com>
1405 2006-09-27 Ville Vainio <vivainio@gmail.com>
1374
1406
1375 * iplib.py (raw_input): python 2.5 closes stdin on quit -> avoid
1407 * iplib.py (raw_input): python 2.5 closes stdin on quit -> avoid
1376 infinite loop and just exit. It's a hack, but will do for a while.
1408 infinite loop and just exit. It's a hack, but will do for a while.
1377
1409
1378 2006-08-25 Walter Doerwald <walter@livinglogic.de>
1410 2006-08-25 Walter Doerwald <walter@livinglogic.de>
1379
1411
1380 * IPython/Extensions/ipipe.py (ils): Add arguments dirs and files to
1412 * IPython/Extensions/ipipe.py (ils): Add arguments dirs and files to
1381 the constructor, this makes it possible to get a list of only directories
1413 the constructor, this makes it possible to get a list of only directories
1382 or only files.
1414 or only files.
1383
1415
1384 2006-08-12 Ville Vainio <vivainio@gmail.com>
1416 2006-08-12 Ville Vainio <vivainio@gmail.com>
1385
1417
1386 * Fakemodule.py, OInspect.py: Reverted 2006-08-11 mods,
1418 * Fakemodule.py, OInspect.py: Reverted 2006-08-11 mods,
1387 they broke unittest
1419 they broke unittest
1388
1420
1389 2006-08-11 Ville Vainio <vivainio@gmail.com>
1421 2006-08-11 Ville Vainio <vivainio@gmail.com>
1390
1422
1391 * Fakemodule.py, OInspect.py: remove 2006-08-09 monkepatch
1423 * Fakemodule.py, OInspect.py: remove 2006-08-09 monkepatch
1392 by resolving issue properly, i.e. by inheriting FakeModule
1424 by resolving issue properly, i.e. by inheriting FakeModule
1393 from types.ModuleType. Pickling ipython interactive data
1425 from types.ModuleType. Pickling ipython interactive data
1394 should still work as usual (testing appreciated).
1426 should still work as usual (testing appreciated).
1395
1427
1396 2006-08-09 Fernando Perez <Fernando.Perez@colorado.edu>
1428 2006-08-09 Fernando Perez <Fernando.Perez@colorado.edu>
1397
1429
1398 * IPython/OInspect.py: monkeypatch inspect from the stdlib if
1430 * IPython/OInspect.py: monkeypatch inspect from the stdlib if
1399 running under python 2.3 with code from 2.4 to fix a bug with
1431 running under python 2.3 with code from 2.4 to fix a bug with
1400 help(). Reported by the Debian maintainers, Norbert Tretkowski
1432 help(). Reported by the Debian maintainers, Norbert Tretkowski
1401 <norbert-AT-tretkowski.de> and Alexandre Fayolle
1433 <norbert-AT-tretkowski.de> and Alexandre Fayolle
1402 <afayolle-AT-debian.org>.
1434 <afayolle-AT-debian.org>.
1403
1435
1404 2006-08-04 Walter Doerwald <walter@livinglogic.de>
1436 2006-08-04 Walter Doerwald <walter@livinglogic.de>
1405
1437
1406 * IPython/Extensions/ibrowse.py: Fixed the help message in the footer
1438 * IPython/Extensions/ibrowse.py: Fixed the help message in the footer
1407 (which was displaying "quit" twice).
1439 (which was displaying "quit" twice).
1408
1440
1409 2006-07-28 Walter Doerwald <walter@livinglogic.de>
1441 2006-07-28 Walter Doerwald <walter@livinglogic.de>
1410
1442
1411 * IPython/Extensions/ipipe.py: Fix isort.__iter__() (was still using
1443 * IPython/Extensions/ipipe.py: Fix isort.__iter__() (was still using
1412 the mode argument).
1444 the mode argument).
1413
1445
1414 2006-07-27 Walter Doerwald <walter@livinglogic.de>
1446 2006-07-27 Walter Doerwald <walter@livinglogic.de>
1415
1447
1416 * IPython/Extensions/ipipe.py: Fix getglobals() if we're
1448 * IPython/Extensions/ipipe.py: Fix getglobals() if we're
1417 not running under IPython.
1449 not running under IPython.
1418
1450
1419 * IPython/Extensions/ipipe.py: Rename XAttr to AttributeDetail
1451 * IPython/Extensions/ipipe.py: Rename XAttr to AttributeDetail
1420 and make it iterable (iterating over the attribute itself). Add two new
1452 and make it iterable (iterating over the attribute itself). Add two new
1421 magic strings for __xattrs__(): If the string starts with "-", the attribute
1453 magic strings for __xattrs__(): If the string starts with "-", the attribute
1422 will not be displayed in ibrowse's detail view (but it can still be
1454 will not be displayed in ibrowse's detail view (but it can still be
1423 iterated over). This makes it possible to add attributes that are large
1455 iterated over). This makes it possible to add attributes that are large
1424 lists or generator methods to the detail view. Replace magic attribute names
1456 lists or generator methods to the detail view. Replace magic attribute names
1425 and _attrname() and _getattr() with "descriptors": For each type of magic
1457 and _attrname() and _getattr() with "descriptors": For each type of magic
1426 attribute name there's a subclass of Descriptor: None -> SelfDescriptor();
1458 attribute name there's a subclass of Descriptor: None -> SelfDescriptor();
1427 "foo" -> AttributeDescriptor("foo"); "foo()" -> MethodDescriptor("foo");
1459 "foo" -> AttributeDescriptor("foo"); "foo()" -> MethodDescriptor("foo");
1428 "-foo" -> IterAttributeDescriptor("foo"); "-foo()" -> IterMethodDescriptor("foo");
1460 "-foo" -> IterAttributeDescriptor("foo"); "-foo()" -> IterMethodDescriptor("foo");
1429 foo() -> FunctionDescriptor(foo). Magic strings returned from __xattrs__()
1461 foo() -> FunctionDescriptor(foo). Magic strings returned from __xattrs__()
1430 are still supported.
1462 are still supported.
1431
1463
1432 * IPython/Extensions/ibrowse.py: If fetching the next row from the input
1464 * IPython/Extensions/ibrowse.py: If fetching the next row from the input
1433 fails in ibrowse.fetch(), the exception object is added as the last item
1465 fails in ibrowse.fetch(), the exception object is added as the last item
1434 and item fetching is canceled. This prevents ibrowse from aborting if e.g.
1466 and item fetching is canceled. This prevents ibrowse from aborting if e.g.
1435 a generator throws an exception midway through execution.
1467 a generator throws an exception midway through execution.
1436
1468
1437 * IPython/Extensions/ipipe.py: Turn ifile's properties mimetype and
1469 * IPython/Extensions/ipipe.py: Turn ifile's properties mimetype and
1438 encoding into methods.
1470 encoding into methods.
1439
1471
1440 2006-07-26 Ville Vainio <vivainio@gmail.com>
1472 2006-07-26 Ville Vainio <vivainio@gmail.com>
1441
1473
1442 * iplib.py: history now stores multiline input as single
1474 * iplib.py: history now stores multiline input as single
1443 history entries. Patch by Jorgen Cederlof.
1475 history entries. Patch by Jorgen Cederlof.
1444
1476
1445 2006-07-18 Walter Doerwald <walter@livinglogic.de>
1477 2006-07-18 Walter Doerwald <walter@livinglogic.de>
1446
1478
1447 * IPython/Extensions/ibrowse.py: Make cursor visible over
1479 * IPython/Extensions/ibrowse.py: Make cursor visible over
1448 non existing attributes.
1480 non existing attributes.
1449
1481
1450 2006-07-14 Walter Doerwald <walter@livinglogic.de>
1482 2006-07-14 Walter Doerwald <walter@livinglogic.de>
1451
1483
1452 * IPython/Extensions/ipipe.py (ix): Use os.popen4() so that the
1484 * IPython/Extensions/ipipe.py (ix): Use os.popen4() so that the
1453 error output of the running command doesn't mess up the screen.
1485 error output of the running command doesn't mess up the screen.
1454
1486
1455 2006-07-13 Walter Doerwald <walter@livinglogic.de>
1487 2006-07-13 Walter Doerwald <walter@livinglogic.de>
1456
1488
1457 * IPython/Extensions/ipipe.py (isort): Make isort usable without
1489 * IPython/Extensions/ipipe.py (isort): Make isort usable without
1458 argument. This sorts the items themselves.
1490 argument. This sorts the items themselves.
1459
1491
1460 2006-07-12 Walter Doerwald <walter@livinglogic.de>
1492 2006-07-12 Walter Doerwald <walter@livinglogic.de>
1461
1493
1462 * IPython/Extensions/ipipe.py (eval, ifilter, isort, ieval):
1494 * IPython/Extensions/ipipe.py (eval, ifilter, isort, ieval):
1463 Compile expression strings into code objects. This should speed
1495 Compile expression strings into code objects. This should speed
1464 up ifilter and friends somewhat.
1496 up ifilter and friends somewhat.
1465
1497
1466 2006-07-08 Ville Vainio <vivainio@gmail.com>
1498 2006-07-08 Ville Vainio <vivainio@gmail.com>
1467
1499
1468 * Magic.py: %cpaste now strips > from the beginning of lines
1500 * Magic.py: %cpaste now strips > from the beginning of lines
1469 to ease pasting quoted code from emails. Contributed by
1501 to ease pasting quoted code from emails. Contributed by
1470 Stefan van der Walt.
1502 Stefan van der Walt.
1471
1503
1472 2006-06-29 Ville Vainio <vivainio@gmail.com>
1504 2006-06-29 Ville Vainio <vivainio@gmail.com>
1473
1505
1474 * ipmaker.py, Shell.py: qt4agg matplotlib backend support for pylab
1506 * ipmaker.py, Shell.py: qt4agg matplotlib backend support for pylab
1475 mode, patch contributed by Darren Dale. NEEDS TESTING!
1507 mode, patch contributed by Darren Dale. NEEDS TESTING!
1476
1508
1477 2006-06-28 Walter Doerwald <walter@livinglogic.de>
1509 2006-06-28 Walter Doerwald <walter@livinglogic.de>
1478
1510
1479 * IPython/Extensions/ibrowse.py: Give the ibrowse cursor row
1511 * IPython/Extensions/ibrowse.py: Give the ibrowse cursor row
1480 a blue background. Fix fetching new display rows when the browser
1512 a blue background. Fix fetching new display rows when the browser
1481 scrolls more than a screenful (e.g. by using the goto command).
1513 scrolls more than a screenful (e.g. by using the goto command).
1482
1514
1483 2006-06-27 Ville Vainio <vivainio@gmail.com>
1515 2006-06-27 Ville Vainio <vivainio@gmail.com>
1484
1516
1485 * Magic.py (_inspect, _ofind) Apply David Huard's
1517 * Magic.py (_inspect, _ofind) Apply David Huard's
1486 patch for displaying the correct docstring for 'property'
1518 patch for displaying the correct docstring for 'property'
1487 attributes.
1519 attributes.
1488
1520
1489 2006-06-23 Walter Doerwald <walter@livinglogic.de>
1521 2006-06-23 Walter Doerwald <walter@livinglogic.de>
1490
1522
1491 * IPython/Extensions/ibrowse.py: Put the documentation of the keyboard
1523 * IPython/Extensions/ibrowse.py: Put the documentation of the keyboard
1492 commands into the methods implementing them.
1524 commands into the methods implementing them.
1493
1525
1494 2006-06-22 Fernando Perez <Fernando.Perez@colorado.edu>
1526 2006-06-22 Fernando Perez <Fernando.Perez@colorado.edu>
1495
1527
1496 * ipython.el (ipython-indentation-hook): cleanup patch, submitted
1528 * ipython.el (ipython-indentation-hook): cleanup patch, submitted
1497 by Kov Chai <tchaikov-AT-gmail.com>. He notes that the original
1529 by Kov Chai <tchaikov-AT-gmail.com>. He notes that the original
1498 autoindent support was authored by Jin Liu.
1530 autoindent support was authored by Jin Liu.
1499
1531
1500 2006-06-22 Walter Doerwald <walter@livinglogic.de>
1532 2006-06-22 Walter Doerwald <walter@livinglogic.de>
1501
1533
1502 * IPython/Extensions/ibrowse.py: Replace the plain dictionaries used
1534 * IPython/Extensions/ibrowse.py: Replace the plain dictionaries used
1503 for keymaps with a custom class that simplifies handling.
1535 for keymaps with a custom class that simplifies handling.
1504
1536
1505 2006-06-19 Walter Doerwald <walter@livinglogic.de>
1537 2006-06-19 Walter Doerwald <walter@livinglogic.de>
1506
1538
1507 * IPython/Extensions/ibrowse.py: ibrowse now properly handles terminal
1539 * IPython/Extensions/ibrowse.py: ibrowse now properly handles terminal
1508 resizing. This requires Python 2.5 to work.
1540 resizing. This requires Python 2.5 to work.
1509
1541
1510 2006-06-16 Walter Doerwald <walter@livinglogic.de>
1542 2006-06-16 Walter Doerwald <walter@livinglogic.de>
1511
1543
1512 * IPython/Extensions/ibrowse.py: Add two new commands to
1544 * IPython/Extensions/ibrowse.py: Add two new commands to
1513 ibrowse: "hideattr" (mapped to "h") hides the attribute under
1545 ibrowse: "hideattr" (mapped to "h") hides the attribute under
1514 the cursor. "unhiderattrs" (mapped to "H") reveals all hidden
1546 the cursor. "unhiderattrs" (mapped to "H") reveals all hidden
1515 attributes again. Remapped the help command to "?". Display
1547 attributes again. Remapped the help command to "?". Display
1516 keycodes in the range 0x01-0x1F as CTRL-xx. Add CTRL-a and CTRL-e
1548 keycodes in the range 0x01-0x1F as CTRL-xx. Add CTRL-a and CTRL-e
1517 as keys for the "home" and "end" commands. Add three new commands
1549 as keys for the "home" and "end" commands. Add three new commands
1518 to the input mode for "find" and friends: "delend" (CTRL-K)
1550 to the input mode for "find" and friends: "delend" (CTRL-K)
1519 deletes to the end of line. "incsearchup" searches upwards in the
1551 deletes to the end of line. "incsearchup" searches upwards in the
1520 command history for an input that starts with the text before the cursor.
1552 command history for an input that starts with the text before the cursor.
1521 "incsearchdown" does the same downwards. Removed a bogus mapping of
1553 "incsearchdown" does the same downwards. Removed a bogus mapping of
1522 the x key to "delete".
1554 the x key to "delete".
1523
1555
1524 2006-06-15 Ville Vainio <vivainio@gmail.com>
1556 2006-06-15 Ville Vainio <vivainio@gmail.com>
1525
1557
1526 * iplib.py, hooks.py: Added new generate_prompt hook that can be
1558 * iplib.py, hooks.py: Added new generate_prompt hook that can be
1527 used to create prompts dynamically, instead of the "old" way of
1559 used to create prompts dynamically, instead of the "old" way of
1528 assigning "magic" strings to prompt_in1 and prompt_in2. The old
1560 assigning "magic" strings to prompt_in1 and prompt_in2. The old
1529 way still works (it's invoked by the default hook), of course.
1561 way still works (it's invoked by the default hook), of course.
1530
1562
1531 * Prompts.py: added generate_output_prompt hook for altering output
1563 * Prompts.py: added generate_output_prompt hook for altering output
1532 prompt
1564 prompt
1533
1565
1534 * Release.py: Changed version string to 0.7.3.svn.
1566 * Release.py: Changed version string to 0.7.3.svn.
1535
1567
1536 2006-06-15 Walter Doerwald <walter@livinglogic.de>
1568 2006-06-15 Walter Doerwald <walter@livinglogic.de>
1537
1569
1538 * IPython/Extensions/ibrowse.py: Change _BrowserLevel.moveto() so that
1570 * IPython/Extensions/ibrowse.py: Change _BrowserLevel.moveto() so that
1539 the call to fetch() always tries to fetch enough data for at least one
1571 the call to fetch() always tries to fetch enough data for at least one
1540 full screen. This makes it possible to simply call moveto(0,0,True) in
1572 full screen. This makes it possible to simply call moveto(0,0,True) in
1541 the constructor. Fix typos and removed the obsolete goto attribute.
1573 the constructor. Fix typos and removed the obsolete goto attribute.
1542
1574
1543 2006-06-12 Ville Vainio <vivainio@gmail.com>
1575 2006-06-12 Ville Vainio <vivainio@gmail.com>
1544
1576
1545 * ipy_profile_sh.py: applied Krisha Mohan Gundu's patch for
1577 * ipy_profile_sh.py: applied Krisha Mohan Gundu's patch for
1546 allowing $variable interpolation within multiline statements,
1578 allowing $variable interpolation within multiline statements,
1547 though so far only with "sh" profile for a testing period.
1579 though so far only with "sh" profile for a testing period.
1548 The patch also enables splitting long commands with \ but it
1580 The patch also enables splitting long commands with \ but it
1549 doesn't work properly yet.
1581 doesn't work properly yet.
1550
1582
1551 2006-06-12 Walter Doerwald <walter@livinglogic.de>
1583 2006-06-12 Walter Doerwald <walter@livinglogic.de>
1552
1584
1553 * IPython/Extensions/ibrowse.py (_dodisplay): Display the length of the
1585 * IPython/Extensions/ibrowse.py (_dodisplay): Display the length of the
1554 input history and the position of the cursor in the input history for
1586 input history and the position of the cursor in the input history for
1555 the find, findbackwards and goto command.
1587 the find, findbackwards and goto command.
1556
1588
1557 2006-06-10 Walter Doerwald <walter@livinglogic.de>
1589 2006-06-10 Walter Doerwald <walter@livinglogic.de>
1558
1590
1559 * IPython/Extensions/ibrowse.py: Add a class _CommandInput that
1591 * IPython/Extensions/ibrowse.py: Add a class _CommandInput that
1560 implements the basic functionality of browser commands that require
1592 implements the basic functionality of browser commands that require
1561 input. Reimplement the goto, find and findbackwards commands as
1593 input. Reimplement the goto, find and findbackwards commands as
1562 subclasses of _CommandInput. Add an input history and keymaps to those
1594 subclasses of _CommandInput. Add an input history and keymaps to those
1563 commands. Add "\r" as a keyboard shortcut for the enterdefault and
1595 commands. Add "\r" as a keyboard shortcut for the enterdefault and
1564 execute commands.
1596 execute commands.
1565
1597
1566 2006-06-07 Ville Vainio <vivainio@gmail.com>
1598 2006-06-07 Ville Vainio <vivainio@gmail.com>
1567
1599
1568 * iplib.py: ipython mybatch.ipy exits ipython immediately after
1600 * iplib.py: ipython mybatch.ipy exits ipython immediately after
1569 running the batch files instead of leaving the session open.
1601 running the batch files instead of leaving the session open.
1570
1602
1571 2006-06-07 Fernando Perez <Fernando.Perez@colorado.edu>
1603 2006-06-07 Fernando Perez <Fernando.Perez@colorado.edu>
1572
1604
1573 * IPython/iplib.py (InteractiveShell.__init__): update BSD fix, as
1605 * IPython/iplib.py (InteractiveShell.__init__): update BSD fix, as
1574 the original fix was incomplete. Patch submitted by W. Maier.
1606 the original fix was incomplete. Patch submitted by W. Maier.
1575
1607
1576 2006-06-07 Ville Vainio <vivainio@gmail.com>
1608 2006-06-07 Ville Vainio <vivainio@gmail.com>
1577
1609
1578 * iplib.py,Magic.py, ipmaker.py (magic_rehashx):
1610 * iplib.py,Magic.py, ipmaker.py (magic_rehashx):
1579 Confirmation prompts can be supressed by 'quiet' option.
1611 Confirmation prompts can be supressed by 'quiet' option.
1580 _ip.options.quiet = 1 means "assume yes for all yes/no queries".
1612 _ip.options.quiet = 1 means "assume yes for all yes/no queries".
1581
1613
1582 2006-06-06 *** Released version 0.7.2
1614 2006-06-06 *** Released version 0.7.2
1583
1615
1584 2006-06-06 Fernando Perez <Fernando.Perez@colorado.edu>
1616 2006-06-06 Fernando Perez <Fernando.Perez@colorado.edu>
1585
1617
1586 * IPython/Release.py (version): Made 0.7.2 final for release.
1618 * IPython/Release.py (version): Made 0.7.2 final for release.
1587 Repo tagged and release cut.
1619 Repo tagged and release cut.
1588
1620
1589 2006-06-05 Ville Vainio <vivainio@gmail.com>
1621 2006-06-05 Ville Vainio <vivainio@gmail.com>
1590
1622
1591 * Magic.py (magic_rehashx): Honor no_alias list earlier in
1623 * Magic.py (magic_rehashx): Honor no_alias list earlier in
1592 %rehashx, to avoid clobbering builtins in ipy_profile_sh.py
1624 %rehashx, to avoid clobbering builtins in ipy_profile_sh.py
1593
1625
1594 * upgrade_dir.py: try import 'path' module a bit harder
1626 * upgrade_dir.py: try import 'path' module a bit harder
1595 (for %upgrade)
1627 (for %upgrade)
1596
1628
1597 2006-06-03 Fernando Perez <Fernando.Perez@colorado.edu>
1629 2006-06-03 Fernando Perez <Fernando.Perez@colorado.edu>
1598
1630
1599 * IPython/genutils.py (ask_yes_no): treat EOF as a default answer
1631 * IPython/genutils.py (ask_yes_no): treat EOF as a default answer
1600 instead of looping 20 times.
1632 instead of looping 20 times.
1601
1633
1602 * IPython/ipmaker.py (make_IPython): honor -ipythondir flag
1634 * IPython/ipmaker.py (make_IPython): honor -ipythondir flag
1603 correctly at initialization time. Bug reported by Krishna Mohan
1635 correctly at initialization time. Bug reported by Krishna Mohan
1604 Gundu <gkmohan-AT-gmail.com> on the user list.
1636 Gundu <gkmohan-AT-gmail.com> on the user list.
1605
1637
1606 * IPython/Release.py (version): Mark 0.7.2 version to start
1638 * IPython/Release.py (version): Mark 0.7.2 version to start
1607 testing for release on 06/06.
1639 testing for release on 06/06.
1608
1640
1609 2006-05-31 Fernando Perez <Fernando.Perez@colorado.edu>
1641 2006-05-31 Fernando Perez <Fernando.Perez@colorado.edu>
1610
1642
1611 * scripts/irunner: thin script interface so users don't have to
1643 * scripts/irunner: thin script interface so users don't have to
1612 find the module and call it as an executable, since modules rarely
1644 find the module and call it as an executable, since modules rarely
1613 live in people's PATH.
1645 live in people's PATH.
1614
1646
1615 * IPython/irunner.py (InteractiveRunner.__init__): added
1647 * IPython/irunner.py (InteractiveRunner.__init__): added
1616 delaybeforesend attribute to control delays with newer versions of
1648 delaybeforesend attribute to control delays with newer versions of
1617 pexpect. Thanks to detailed help from pexpect's author, Noah
1649 pexpect. Thanks to detailed help from pexpect's author, Noah
1618 Spurrier <noah-AT-noah.org>. Noted how to use the SAGE runner
1650 Spurrier <noah-AT-noah.org>. Noted how to use the SAGE runner
1619 correctly (it works in NoColor mode).
1651 correctly (it works in NoColor mode).
1620
1652
1621 * IPython/iplib.py (handle_normal): fix nasty crash reported on
1653 * IPython/iplib.py (handle_normal): fix nasty crash reported on
1622 SAGE list, from improper log() calls.
1654 SAGE list, from improper log() calls.
1623
1655
1624 2006-05-31 Ville Vainio <vivainio@gmail.com>
1656 2006-05-31 Ville Vainio <vivainio@gmail.com>
1625
1657
1626 * upgrade_dir.py, Magic.py (magic_upgrade): call upgrade_dir
1658 * upgrade_dir.py, Magic.py (magic_upgrade): call upgrade_dir
1627 with args in parens to work correctly with dirs that have spaces.
1659 with args in parens to work correctly with dirs that have spaces.
1628
1660
1629 2006-05-30 Fernando Perez <Fernando.Perez@colorado.edu>
1661 2006-05-30 Fernando Perez <Fernando.Perez@colorado.edu>
1630
1662
1631 * IPython/Logger.py (Logger.logstart): add option to log raw input
1663 * IPython/Logger.py (Logger.logstart): add option to log raw input
1632 instead of the processed one. A -r flag was added to the
1664 instead of the processed one. A -r flag was added to the
1633 %logstart magic used for controlling logging.
1665 %logstart magic used for controlling logging.
1634
1666
1635 2006-05-29 Fernando Perez <Fernando.Perez@colorado.edu>
1667 2006-05-29 Fernando Perez <Fernando.Perez@colorado.edu>
1636
1668
1637 * IPython/iplib.py (InteractiveShell.__init__): add check for the
1669 * IPython/iplib.py (InteractiveShell.__init__): add check for the
1638 *BSDs to omit --color from all 'ls' aliases, since *BSD ls doesn't
1670 *BSDs to omit --color from all 'ls' aliases, since *BSD ls doesn't
1639 recognize the option. After a bug report by Will Maier. This
1671 recognize the option. After a bug report by Will Maier. This
1640 closes #64 (will do it after confirmation from W. Maier).
1672 closes #64 (will do it after confirmation from W. Maier).
1641
1673
1642 * IPython/irunner.py: New module to run scripts as if manually
1674 * IPython/irunner.py: New module to run scripts as if manually
1643 typed into an interactive environment, based on pexpect. After a
1675 typed into an interactive environment, based on pexpect. After a
1644 submission by Ken Schutte <kschutte-AT-csail.mit.edu> on the
1676 submission by Ken Schutte <kschutte-AT-csail.mit.edu> on the
1645 ipython-user list. Simple unittests in the tests/ directory.
1677 ipython-user list. Simple unittests in the tests/ directory.
1646
1678
1647 * tools/release: add Will Maier, OpenBSD port maintainer, to
1679 * tools/release: add Will Maier, OpenBSD port maintainer, to
1648 recepients list. We are now officially part of the OpenBSD ports:
1680 recepients list. We are now officially part of the OpenBSD ports:
1649 http://www.openbsd.org/ports.html ! Many thanks to Will for the
1681 http://www.openbsd.org/ports.html ! Many thanks to Will for the
1650 work.
1682 work.
1651
1683
1652 2006-05-26 Fernando Perez <Fernando.Perez@colorado.edu>
1684 2006-05-26 Fernando Perez <Fernando.Perez@colorado.edu>
1653
1685
1654 * IPython/ipmaker.py (make_IPython): modify sys.argv fix (below)
1686 * IPython/ipmaker.py (make_IPython): modify sys.argv fix (below)
1655 so that it doesn't break tkinter apps.
1687 so that it doesn't break tkinter apps.
1656
1688
1657 * IPython/iplib.py (_prefilter): fix bug where aliases would
1689 * IPython/iplib.py (_prefilter): fix bug where aliases would
1658 shadow variables when autocall was fully off. Reported by SAGE
1690 shadow variables when autocall was fully off. Reported by SAGE
1659 author William Stein.
1691 author William Stein.
1660
1692
1661 * IPython/OInspect.py (Inspector.__init__): add a flag to control
1693 * IPython/OInspect.py (Inspector.__init__): add a flag to control
1662 at what detail level strings are computed when foo? is requested.
1694 at what detail level strings are computed when foo? is requested.
1663 This allows users to ask for example that the string form of an
1695 This allows users to ask for example that the string form of an
1664 object is only computed when foo?? is called, or even never, by
1696 object is only computed when foo?? is called, or even never, by
1665 setting the object_info_string_level >= 2 in the configuration
1697 setting the object_info_string_level >= 2 in the configuration
1666 file. This new option has been added and documented. After a
1698 file. This new option has been added and documented. After a
1667 request by SAGE to be able to control the printing of very large
1699 request by SAGE to be able to control the printing of very large
1668 objects more easily.
1700 objects more easily.
1669
1701
1670 2006-05-25 Fernando Perez <Fernando.Perez@colorado.edu>
1702 2006-05-25 Fernando Perez <Fernando.Perez@colorado.edu>
1671
1703
1672 * IPython/ipmaker.py (make_IPython): remove the ipython call path
1704 * IPython/ipmaker.py (make_IPython): remove the ipython call path
1673 from sys.argv, to be 100% consistent with how Python itself works
1705 from sys.argv, to be 100% consistent with how Python itself works
1674 (as seen for example with python -i file.py). After a bug report
1706 (as seen for example with python -i file.py). After a bug report
1675 by Jeffrey Collins.
1707 by Jeffrey Collins.
1676
1708
1677 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix
1709 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix
1678 nasty bug which was preventing custom namespaces with -pylab,
1710 nasty bug which was preventing custom namespaces with -pylab,
1679 reported by M. Foord. Minor cleanup, remove old matplotlib.matlab
1711 reported by M. Foord. Minor cleanup, remove old matplotlib.matlab
1680 compatibility (long gone from mpl).
1712 compatibility (long gone from mpl).
1681
1713
1682 * IPython/ipapi.py (make_session): name change: create->make. We
1714 * IPython/ipapi.py (make_session): name change: create->make. We
1683 use make in other places (ipmaker,...), it's shorter and easier to
1715 use make in other places (ipmaker,...), it's shorter and easier to
1684 type and say, etc. I'm trying to clean things before 0.7.2 so
1716 type and say, etc. I'm trying to clean things before 0.7.2 so
1685 that I can keep things stable wrt to ipapi in the chainsaw branch.
1717 that I can keep things stable wrt to ipapi in the chainsaw branch.
1686
1718
1687 * ipython.el: fix the py-pdbtrack-input-prompt variable so that
1719 * ipython.el: fix the py-pdbtrack-input-prompt variable so that
1688 python-mode recognizes our debugger mode. Add support for
1720 python-mode recognizes our debugger mode. Add support for
1689 autoindent inside (X)emacs. After a patch sent in by Jin Liu
1721 autoindent inside (X)emacs. After a patch sent in by Jin Liu
1690 <m.liu.jin-AT-gmail.com> originally written by
1722 <m.liu.jin-AT-gmail.com> originally written by
1691 doxgen-AT-newsmth.net (with minor modifications for xemacs
1723 doxgen-AT-newsmth.net (with minor modifications for xemacs
1692 compatibility)
1724 compatibility)
1693
1725
1694 * IPython/Debugger.py (Pdb.format_stack_entry): fix formatting of
1726 * IPython/Debugger.py (Pdb.format_stack_entry): fix formatting of
1695 tracebacks when walking the stack so that the stack tracking system
1727 tracebacks when walking the stack so that the stack tracking system
1696 in emacs' python-mode can identify the frames correctly.
1728 in emacs' python-mode can identify the frames correctly.
1697
1729
1698 * IPython/ipmaker.py (make_IPython): make the internal (and
1730 * IPython/ipmaker.py (make_IPython): make the internal (and
1699 default config) autoedit_syntax value false by default. Too many
1731 default config) autoedit_syntax value false by default. Too many
1700 users have complained to me (both on and off-list) about problems
1732 users have complained to me (both on and off-list) about problems
1701 with this option being on by default, so I'm making it default to
1733 with this option being on by default, so I'm making it default to
1702 off. It can still be enabled by anyone via the usual mechanisms.
1734 off. It can still be enabled by anyone via the usual mechanisms.
1703
1735
1704 * IPython/completer.py (Completer.attr_matches): add support for
1736 * IPython/completer.py (Completer.attr_matches): add support for
1705 PyCrust-style _getAttributeNames magic method. Patch contributed
1737 PyCrust-style _getAttributeNames magic method. Patch contributed
1706 by <mscott-AT-goldenspud.com>. Closes #50.
1738 by <mscott-AT-goldenspud.com>. Closes #50.
1707
1739
1708 * IPython/iplib.py (InteractiveShell.__init__): remove the
1740 * IPython/iplib.py (InteractiveShell.__init__): remove the
1709 deletion of exit/quit from __builtin__, which can break
1741 deletion of exit/quit from __builtin__, which can break
1710 third-party tools like the Zope debugging console. The
1742 third-party tools like the Zope debugging console. The
1711 %exit/%quit magics remain. In general, it's probably a good idea
1743 %exit/%quit magics remain. In general, it's probably a good idea
1712 not to delete anything from __builtin__, since we never know what
1744 not to delete anything from __builtin__, since we never know what
1713 that will break. In any case, python now (for 2.5) will support
1745 that will break. In any case, python now (for 2.5) will support
1714 'real' exit/quit, so this issue is moot. Closes #55.
1746 'real' exit/quit, so this issue is moot. Closes #55.
1715
1747
1716 * IPython/genutils.py (with_obj): rename the 'with' function to
1748 * IPython/genutils.py (with_obj): rename the 'with' function to
1717 'withobj' to avoid incompatibilities with Python 2.5, where 'with'
1749 'withobj' to avoid incompatibilities with Python 2.5, where 'with'
1718 becomes a language keyword. Closes #53.
1750 becomes a language keyword. Closes #53.
1719
1751
1720 * IPython/FakeModule.py (FakeModule.__init__): add a proper
1752 * IPython/FakeModule.py (FakeModule.__init__): add a proper
1721 __file__ attribute to this so it fools more things into thinking
1753 __file__ attribute to this so it fools more things into thinking
1722 it is a real module. Closes #59.
1754 it is a real module. Closes #59.
1723
1755
1724 * IPython/Magic.py (magic_edit): add -n option to open the editor
1756 * IPython/Magic.py (magic_edit): add -n option to open the editor
1725 at a specific line number. After a patch by Stefan van der Walt.
1757 at a specific line number. After a patch by Stefan van der Walt.
1726
1758
1727 2006-05-23 Fernando Perez <Fernando.Perez@colorado.edu>
1759 2006-05-23 Fernando Perez <Fernando.Perez@colorado.edu>
1728
1760
1729 * IPython/iplib.py (edit_syntax_error): fix crash when for some
1761 * IPython/iplib.py (edit_syntax_error): fix crash when for some
1730 reason the file could not be opened. After automatic crash
1762 reason the file could not be opened. After automatic crash
1731 reports sent by James Graham <jgraham-AT-ast.cam.ac.uk> and
1763 reports sent by James Graham <jgraham-AT-ast.cam.ac.uk> and
1732 Charles Dolan <charlespatrickdolan-AT-yahoo.com>.
1764 Charles Dolan <charlespatrickdolan-AT-yahoo.com>.
1733 (_should_recompile): Don't fire editor if using %bg, since there
1765 (_should_recompile): Don't fire editor if using %bg, since there
1734 is no file in the first place. From the same report as above.
1766 is no file in the first place. From the same report as above.
1735 (raw_input): protect against faulty third-party prefilters. After
1767 (raw_input): protect against faulty third-party prefilters. After
1736 an automatic crash report sent by Dirk Laurie <dirk-AT-sun.ac.za>
1768 an automatic crash report sent by Dirk Laurie <dirk-AT-sun.ac.za>
1737 while running under SAGE.
1769 while running under SAGE.
1738
1770
1739 2006-05-23 Ville Vainio <vivainio@gmail.com>
1771 2006-05-23 Ville Vainio <vivainio@gmail.com>
1740
1772
1741 * ipapi.py: Stripped down ip.to_user_ns() to work only as
1773 * ipapi.py: Stripped down ip.to_user_ns() to work only as
1742 ip.to_user_ns("x1 y1"), which exposes vars x1 and y1. ipapi.get()
1774 ip.to_user_ns("x1 y1"), which exposes vars x1 and y1. ipapi.get()
1743 now returns None (again), unless dummy is specifically allowed by
1775 now returns None (again), unless dummy is specifically allowed by
1744 ipapi.get(allow_dummy=True).
1776 ipapi.get(allow_dummy=True).
1745
1777
1746 2006-05-18 Fernando Perez <Fernando.Perez@colorado.edu>
1778 2006-05-18 Fernando Perez <Fernando.Perez@colorado.edu>
1747
1779
1748 * IPython: remove all 2.2-compatibility objects and hacks from
1780 * IPython: remove all 2.2-compatibility objects and hacks from
1749 everywhere, since we only support 2.3 at this point. Docs
1781 everywhere, since we only support 2.3 at this point. Docs
1750 updated.
1782 updated.
1751
1783
1752 * IPython/ipapi.py (IPApi.__init__): Cleanup of all getters.
1784 * IPython/ipapi.py (IPApi.__init__): Cleanup of all getters.
1753 Anything requiring extra validation can be turned into a Python
1785 Anything requiring extra validation can be turned into a Python
1754 property in the future. I used a property for the db one b/c
1786 property in the future. I used a property for the db one b/c
1755 there was a nasty circularity problem with the initialization
1787 there was a nasty circularity problem with the initialization
1756 order, which right now I don't have time to clean up.
1788 order, which right now I don't have time to clean up.
1757
1789
1758 * IPython/Shell.py (MTInteractiveShell.runcode): Fix, I think,
1790 * IPython/Shell.py (MTInteractiveShell.runcode): Fix, I think,
1759 another locking bug reported by Jorgen. I'm not 100% sure though,
1791 another locking bug reported by Jorgen. I'm not 100% sure though,
1760 so more testing is needed...
1792 so more testing is needed...
1761
1793
1762 2006-05-17 Fernando Perez <Fernando.Perez@colorado.edu>
1794 2006-05-17 Fernando Perez <Fernando.Perez@colorado.edu>
1763
1795
1764 * IPython/ipapi.py (IPApi.to_user_ns): New function to inject
1796 * IPython/ipapi.py (IPApi.to_user_ns): New function to inject
1765 local variables from any routine in user code (typically executed
1797 local variables from any routine in user code (typically executed
1766 with %run) directly into the interactive namespace. Very useful
1798 with %run) directly into the interactive namespace. Very useful
1767 when doing complex debugging.
1799 when doing complex debugging.
1768 (IPythonNotRunning): Changed the default None object to a dummy
1800 (IPythonNotRunning): Changed the default None object to a dummy
1769 whose attributes can be queried as well as called without
1801 whose attributes can be queried as well as called without
1770 exploding, to ease writing code which works transparently both in
1802 exploding, to ease writing code which works transparently both in
1771 and out of ipython and uses some of this API.
1803 and out of ipython and uses some of this API.
1772
1804
1773 2006-05-16 Fernando Perez <Fernando.Perez@colorado.edu>
1805 2006-05-16 Fernando Perez <Fernando.Perez@colorado.edu>
1774
1806
1775 * IPython/hooks.py (result_display): Fix the fact that our display
1807 * IPython/hooks.py (result_display): Fix the fact that our display
1776 hook was using str() instead of repr(), as the default python
1808 hook was using str() instead of repr(), as the default python
1777 console does. This had gone unnoticed b/c it only happened if
1809 console does. This had gone unnoticed b/c it only happened if
1778 %Pprint was off, but the inconsistency was there.
1810 %Pprint was off, but the inconsistency was there.
1779
1811
1780 2006-05-15 Ville Vainio <vivainio@gmail.com>
1812 2006-05-15 Ville Vainio <vivainio@gmail.com>
1781
1813
1782 * Oinspect.py: Only show docstring for nonexisting/binary files
1814 * Oinspect.py: Only show docstring for nonexisting/binary files
1783 when doing object??, closing ticket #62
1815 when doing object??, closing ticket #62
1784
1816
1785 2006-05-13 Fernando Perez <Fernando.Perez@colorado.edu>
1817 2006-05-13 Fernando Perez <Fernando.Perez@colorado.edu>
1786
1818
1787 * IPython/Shell.py (MTInteractiveShell.runsource): Fix threading
1819 * IPython/Shell.py (MTInteractiveShell.runsource): Fix threading
1788 bug, closes http://www.scipy.net/roundup/ipython/issue55. A lock
1820 bug, closes http://www.scipy.net/roundup/ipython/issue55. A lock
1789 was being released in a routine which hadn't checked if it had
1821 was being released in a routine which hadn't checked if it had
1790 been the one to acquire it.
1822 been the one to acquire it.
1791
1823
1792 2006-05-07 Fernando Perez <Fernando.Perez@colorado.edu>
1824 2006-05-07 Fernando Perez <Fernando.Perez@colorado.edu>
1793
1825
1794 * IPython/Release.py (version): put out 0.7.2.rc1 for testing.
1826 * IPython/Release.py (version): put out 0.7.2.rc1 for testing.
1795
1827
1796 2006-04-11 Ville Vainio <vivainio@gmail.com>
1828 2006-04-11 Ville Vainio <vivainio@gmail.com>
1797
1829
1798 * iplib.py, ipmaker.py: .ipy extension now means "ipython batch file"
1830 * iplib.py, ipmaker.py: .ipy extension now means "ipython batch file"
1799 in command line. E.g. "ipython test.ipy" runs test.ipy with ipython
1831 in command line. E.g. "ipython test.ipy" runs test.ipy with ipython
1800 prefilters, allowing stuff like magics and aliases in the file.
1832 prefilters, allowing stuff like magics and aliases in the file.
1801
1833
1802 * Prompts.py, Extensions/clearcmd.py, ipy_system_conf.py: %clear magic
1834 * Prompts.py, Extensions/clearcmd.py, ipy_system_conf.py: %clear magic
1803 added. Supported now are "%clear in" and "%clear out" (clear input and
1835 added. Supported now are "%clear in" and "%clear out" (clear input and
1804 output history, respectively). Also fixed CachedOutput.flush to
1836 output history, respectively). Also fixed CachedOutput.flush to
1805 properly flush the output cache.
1837 properly flush the output cache.
1806
1838
1807 * Extensions/pspersistence.py: Fix %store to avoid "%store obj.attr"
1839 * Extensions/pspersistence.py: Fix %store to avoid "%store obj.attr"
1808 half-success (and fail explicitly).
1840 half-success (and fail explicitly).
1809
1841
1810 2006-03-28 Ville Vainio <vivainio@gmail.com>
1842 2006-03-28 Ville Vainio <vivainio@gmail.com>
1811
1843
1812 * iplib.py: Fix quoting of aliases so that only argless ones
1844 * iplib.py: Fix quoting of aliases so that only argless ones
1813 are quoted
1845 are quoted
1814
1846
1815 2006-03-28 Ville Vainio <vivainio@gmail.com>
1847 2006-03-28 Ville Vainio <vivainio@gmail.com>
1816
1848
1817 * iplib.py: Quote aliases with spaces in the name.
1849 * iplib.py: Quote aliases with spaces in the name.
1818 "c:\program files\blah\bin" is now legal alias target.
1850 "c:\program files\blah\bin" is now legal alias target.
1819
1851
1820 * ext_rehashdir.py: Space no longer allowed as arg
1852 * ext_rehashdir.py: Space no longer allowed as arg
1821 separator, since space is legal in path names.
1853 separator, since space is legal in path names.
1822
1854
1823 2006-03-16 Ville Vainio <vivainio@gmail.com>
1855 2006-03-16 Ville Vainio <vivainio@gmail.com>
1824
1856
1825 * upgrade_dir.py: Take path.py from Extensions, correcting
1857 * upgrade_dir.py: Take path.py from Extensions, correcting
1826 %upgrade magic
1858 %upgrade magic
1827
1859
1828 * ipmaker.py: Suggest using %upgrade if ipy_user_conf.py isn't found.
1860 * ipmaker.py: Suggest using %upgrade if ipy_user_conf.py isn't found.
1829
1861
1830 * hooks.py: Only enclose editor binary in quotes if legal and
1862 * hooks.py: Only enclose editor binary in quotes if legal and
1831 necessary (space in the name, and is an existing file). Fixes a bug
1863 necessary (space in the name, and is an existing file). Fixes a bug
1832 reported by Zachary Pincus.
1864 reported by Zachary Pincus.
1833
1865
1834 2006-03-13 Fernando Perez <Fernando.Perez@colorado.edu>
1866 2006-03-13 Fernando Perez <Fernando.Perez@colorado.edu>
1835
1867
1836 * Manual: thanks to a tip on proper color handling for Emacs, by
1868 * Manual: thanks to a tip on proper color handling for Emacs, by
1837 Eric J Haywiser <ejh1-AT-MIT.EDU>.
1869 Eric J Haywiser <ejh1-AT-MIT.EDU>.
1838
1870
1839 * ipython.el: close http://www.scipy.net/roundup/ipython/issue57
1871 * ipython.el: close http://www.scipy.net/roundup/ipython/issue57
1840 by applying the provided patch. Thanks to Liu Jin
1872 by applying the provided patch. Thanks to Liu Jin
1841 <m.liu.jin-AT-gmail.com> for the contribution. No problems under
1873 <m.liu.jin-AT-gmail.com> for the contribution. No problems under
1842 XEmacs/Linux, I'm trusting the submitter that it actually helps
1874 XEmacs/Linux, I'm trusting the submitter that it actually helps
1843 under win32/GNU Emacs. Will revisit if any problems are reported.
1875 under win32/GNU Emacs. Will revisit if any problems are reported.
1844
1876
1845 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
1877 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
1846
1878
1847 * IPython/Gnuplot2.py (_FileClass): update for current Gnuplot.py
1879 * IPython/Gnuplot2.py (_FileClass): update for current Gnuplot.py
1848 from SVN, thanks to a patch by Ryan Woodard <rywo@bas.ac.uk>.
1880 from SVN, thanks to a patch by Ryan Woodard <rywo@bas.ac.uk>.
1849
1881
1850 2006-03-12 Ville Vainio <vivainio@gmail.com>
1882 2006-03-12 Ville Vainio <vivainio@gmail.com>
1851
1883
1852 * Magic.py (magic_timeit): Added %timeit magic, contributed by
1884 * Magic.py (magic_timeit): Added %timeit magic, contributed by
1853 Torsten Marek.
1885 Torsten Marek.
1854
1886
1855 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
1887 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
1856
1888
1857 * IPython/Magic.py (magic_macro): fix so that the n1-n2 syntax for
1889 * IPython/Magic.py (magic_macro): fix so that the n1-n2 syntax for
1858 line ranges works again.
1890 line ranges works again.
1859
1891
1860 2006-03-11 Fernando Perez <Fernando.Perez@colorado.edu>
1892 2006-03-11 Fernando Perez <Fernando.Perez@colorado.edu>
1861
1893
1862 * IPython/iplib.py (showtraceback): add back sys.last_traceback
1894 * IPython/iplib.py (showtraceback): add back sys.last_traceback
1863 and friends, after a discussion with Zach Pincus on ipython-user.
1895 and friends, after a discussion with Zach Pincus on ipython-user.
1864 I'm not 100% sure, but after thinking about it quite a bit, it may
1896 I'm not 100% sure, but after thinking about it quite a bit, it may
1865 be OK. Testing with the multithreaded shells didn't reveal any
1897 be OK. Testing with the multithreaded shells didn't reveal any
1866 problems, but let's keep an eye out.
1898 problems, but let's keep an eye out.
1867
1899
1868 In the process, I fixed a few things which were calling
1900 In the process, I fixed a few things which were calling
1869 self.InteractiveTB() directly (like safe_execfile), which is a
1901 self.InteractiveTB() directly (like safe_execfile), which is a
1870 mistake: ALL exception reporting should be done by calling
1902 mistake: ALL exception reporting should be done by calling
1871 self.showtraceback(), which handles state and tab-completion and
1903 self.showtraceback(), which handles state and tab-completion and
1872 more.
1904 more.
1873
1905
1874 2006-03-01 Ville Vainio <vivainio@gmail.com>
1906 2006-03-01 Ville Vainio <vivainio@gmail.com>
1875
1907
1876 * Extensions/ipipe.py: Added Walter Doerwald's "ipipe" module.
1908 * Extensions/ipipe.py: Added Walter Doerwald's "ipipe" module.
1877 To use, do "from ipipe import *".
1909 To use, do "from ipipe import *".
1878
1910
1879 2006-02-24 Ville Vainio <vivainio@gmail.com>
1911 2006-02-24 Ville Vainio <vivainio@gmail.com>
1880
1912
1881 * Magic.py, upgrade_dir.py: %upgrade magic added. Does things more
1913 * Magic.py, upgrade_dir.py: %upgrade magic added. Does things more
1882 "cleanly" and safely than the older upgrade mechanism.
1914 "cleanly" and safely than the older upgrade mechanism.
1883
1915
1884 2006-02-21 Ville Vainio <vivainio@gmail.com>
1916 2006-02-21 Ville Vainio <vivainio@gmail.com>
1885
1917
1886 * Magic.py: %save works again.
1918 * Magic.py: %save works again.
1887
1919
1888 2006-02-15 Ville Vainio <vivainio@gmail.com>
1920 2006-02-15 Ville Vainio <vivainio@gmail.com>
1889
1921
1890 * Magic.py: %Pprint works again
1922 * Magic.py: %Pprint works again
1891
1923
1892 * Extensions/ipy_sane_defaults.py: Provide everything provided
1924 * Extensions/ipy_sane_defaults.py: Provide everything provided
1893 in default ipythonrc, to make it possible to have a completely empty
1925 in default ipythonrc, to make it possible to have a completely empty
1894 ipythonrc (and thus completely rc-file free configuration)
1926 ipythonrc (and thus completely rc-file free configuration)
1895
1927
1896 2006-02-11 Fernando Perez <Fernando.Perez@colorado.edu>
1928 2006-02-11 Fernando Perez <Fernando.Perez@colorado.edu>
1897
1929
1898 * IPython/hooks.py (editor): quote the call to the editor command,
1930 * IPython/hooks.py (editor): quote the call to the editor command,
1899 to allow commands with spaces in them. Problem noted by watching
1931 to allow commands with spaces in them. Problem noted by watching
1900 Ian Oswald's video about textpad under win32 at
1932 Ian Oswald's video about textpad under win32 at
1901 http://showmedo.com/videoListPage?listKey=PythonIPythonSeries
1933 http://showmedo.com/videoListPage?listKey=PythonIPythonSeries
1902
1934
1903 * IPython/UserConfig/ipythonrc: Replace @ signs with % when
1935 * IPython/UserConfig/ipythonrc: Replace @ signs with % when
1904 describing magics (we haven't used @ for a loong time).
1936 describing magics (we haven't used @ for a loong time).
1905
1937
1906 * IPython/ultraTB.py (VerboseTB.text.text_repr): Added patch
1938 * IPython/ultraTB.py (VerboseTB.text.text_repr): Added patch
1907 contributed by marienz to close
1939 contributed by marienz to close
1908 http://www.scipy.net/roundup/ipython/issue53.
1940 http://www.scipy.net/roundup/ipython/issue53.
1909
1941
1910 2006-02-10 Ville Vainio <vivainio@gmail.com>
1942 2006-02-10 Ville Vainio <vivainio@gmail.com>
1911
1943
1912 * genutils.py: getoutput now works in win32 too
1944 * genutils.py: getoutput now works in win32 too
1913
1945
1914 * completer.py: alias and magic completion only invoked
1946 * completer.py: alias and magic completion only invoked
1915 at the first "item" in the line, to avoid "cd %store"
1947 at the first "item" in the line, to avoid "cd %store"
1916 nonsense.
1948 nonsense.
1917
1949
1918 2006-02-09 Ville Vainio <vivainio@gmail.com>
1950 2006-02-09 Ville Vainio <vivainio@gmail.com>
1919
1951
1920 * test/*: Added a unit testing framework (finally).
1952 * test/*: Added a unit testing framework (finally).
1921 '%run runtests.py' to run test_*.
1953 '%run runtests.py' to run test_*.
1922
1954
1923 * ipapi.py: Exposed runlines and set_custom_exc
1955 * ipapi.py: Exposed runlines and set_custom_exc
1924
1956
1925 2006-02-07 Ville Vainio <vivainio@gmail.com>
1957 2006-02-07 Ville Vainio <vivainio@gmail.com>
1926
1958
1927 * iplib.py: don't split "f 1 2" to "f(1,2)" in autocall,
1959 * iplib.py: don't split "f 1 2" to "f(1,2)" in autocall,
1928 instead use "f(1 2)" as before.
1960 instead use "f(1 2)" as before.
1929
1961
1930 2006-02-05 Fernando Perez <Fernando.Perez@colorado.edu>
1962 2006-02-05 Fernando Perez <Fernando.Perez@colorado.edu>
1931
1963
1932 * IPython/demo.py (IPythonDemo): Add new classes to the demo
1964 * IPython/demo.py (IPythonDemo): Add new classes to the demo
1933 facilities, for demos processed by the IPython input filter
1965 facilities, for demos processed by the IPython input filter
1934 (IPythonDemo), and for running a script one-line-at-a-time as a
1966 (IPythonDemo), and for running a script one-line-at-a-time as a
1935 demo, both for pure Python (LineDemo) and for IPython-processed
1967 demo, both for pure Python (LineDemo) and for IPython-processed
1936 input (IPythonLineDemo). After a request by Dave Kohel, from the
1968 input (IPythonLineDemo). After a request by Dave Kohel, from the
1937 SAGE team.
1969 SAGE team.
1938 (Demo.edit): added an edit() method to the demo objects, to edit
1970 (Demo.edit): added an edit() method to the demo objects, to edit
1939 the in-memory copy of the last executed block.
1971 the in-memory copy of the last executed block.
1940
1972
1941 * IPython/Magic.py (magic_edit): add '-r' option for 'raw'
1973 * IPython/Magic.py (magic_edit): add '-r' option for 'raw'
1942 processing to %edit, %macro and %save. These commands can now be
1974 processing to %edit, %macro and %save. These commands can now be
1943 invoked on the unprocessed input as it was typed by the user
1975 invoked on the unprocessed input as it was typed by the user
1944 (without any prefilters applied). After requests by the SAGE team
1976 (without any prefilters applied). After requests by the SAGE team
1945 at SAGE days 2006: http://modular.ucsd.edu/sage/days1/schedule.html.
1977 at SAGE days 2006: http://modular.ucsd.edu/sage/days1/schedule.html.
1946
1978
1947 2006-02-01 Ville Vainio <vivainio@gmail.com>
1979 2006-02-01 Ville Vainio <vivainio@gmail.com>
1948
1980
1949 * setup.py, eggsetup.py: easy_install ipython==dev works
1981 * setup.py, eggsetup.py: easy_install ipython==dev works
1950 correctly now (on Linux)
1982 correctly now (on Linux)
1951
1983
1952 * ipy_user_conf,ipmaker: user config changes, removed spurious
1984 * ipy_user_conf,ipmaker: user config changes, removed spurious
1953 warnings
1985 warnings
1954
1986
1955 * iplib: if rc.banner is string, use it as is.
1987 * iplib: if rc.banner is string, use it as is.
1956
1988
1957 * Magic: %pycat accepts a string argument and pages it's contents.
1989 * Magic: %pycat accepts a string argument and pages it's contents.
1958
1990
1959
1991
1960 2006-01-30 Ville Vainio <vivainio@gmail.com>
1992 2006-01-30 Ville Vainio <vivainio@gmail.com>
1961
1993
1962 * pickleshare,pspersistence,ipapi,Magic: persistence overhaul.
1994 * pickleshare,pspersistence,ipapi,Magic: persistence overhaul.
1963 Now %store and bookmarks work through PickleShare, meaning that
1995 Now %store and bookmarks work through PickleShare, meaning that
1964 concurrent access is possible and all ipython sessions see the
1996 concurrent access is possible and all ipython sessions see the
1965 same database situation all the time, instead of snapshot of
1997 same database situation all the time, instead of snapshot of
1966 the situation when the session was started. Hence, %bookmark
1998 the situation when the session was started. Hence, %bookmark
1967 results are immediately accessible from othes sessions. The database
1999 results are immediately accessible from othes sessions. The database
1968 is also available for use by user extensions. See:
2000 is also available for use by user extensions. See:
1969 http://www.python.org/pypi/pickleshare
2001 http://www.python.org/pypi/pickleshare
1970
2002
1971 * hooks.py: Two new hooks, 'shutdown_hook' and 'late_startup_hook'.
2003 * hooks.py: Two new hooks, 'shutdown_hook' and 'late_startup_hook'.
1972
2004
1973 * aliases can now be %store'd
2005 * aliases can now be %store'd
1974
2006
1975 * path.py moved to Extensions so that pickleshare does not need
2007 * path.py moved to Extensions so that pickleshare does not need
1976 IPython-specific import. Extensions added to pythonpath right
2008 IPython-specific import. Extensions added to pythonpath right
1977 at __init__.
2009 at __init__.
1978
2010
1979 * iplib.py: ipalias deprecated/redundant; aliases are converted and
2011 * iplib.py: ipalias deprecated/redundant; aliases are converted and
1980 called with _ip.system and the pre-transformed command string.
2012 called with _ip.system and the pre-transformed command string.
1981
2013
1982 2006-01-29 Fernando Perez <Fernando.Perez@colorado.edu>
2014 2006-01-29 Fernando Perez <Fernando.Perez@colorado.edu>
1983
2015
1984 * IPython/iplib.py (interact): Fix that we were not catching
2016 * IPython/iplib.py (interact): Fix that we were not catching
1985 KeyboardInterrupt exceptions properly. I'm not quite sure why the
2017 KeyboardInterrupt exceptions properly. I'm not quite sure why the
1986 logic here had to change, but it's fixed now.
2018 logic here had to change, but it's fixed now.
1987
2019
1988 2006-01-29 Ville Vainio <vivainio@gmail.com>
2020 2006-01-29 Ville Vainio <vivainio@gmail.com>
1989
2021
1990 * iplib.py: Try to import pyreadline on Windows.
2022 * iplib.py: Try to import pyreadline on Windows.
1991
2023
1992 2006-01-27 Ville Vainio <vivainio@gmail.com>
2024 2006-01-27 Ville Vainio <vivainio@gmail.com>
1993
2025
1994 * iplib.py: Expose ipapi as _ip in builtin namespace.
2026 * iplib.py: Expose ipapi as _ip in builtin namespace.
1995 Makes ipmagic (-> _ip.magic), ipsystem (-> _ip.system)
2027 Makes ipmagic (-> _ip.magic), ipsystem (-> _ip.system)
1996 and ip_set_hook (-> _ip.set_hook) redundant. % and !
2028 and ip_set_hook (-> _ip.set_hook) redundant. % and !
1997 syntax now produce _ip.* variant of the commands.
2029 syntax now produce _ip.* variant of the commands.
1998
2030
1999 * "_ip.options().autoedit_syntax = 2" automatically throws
2031 * "_ip.options().autoedit_syntax = 2" automatically throws
2000 user to editor for syntax error correction without prompting.
2032 user to editor for syntax error correction without prompting.
2001
2033
2002 2006-01-27 Ville Vainio <vivainio@gmail.com>
2034 2006-01-27 Ville Vainio <vivainio@gmail.com>
2003
2035
2004 * ipmaker.py: Give "realistic" sys.argv for scripts (without
2036 * ipmaker.py: Give "realistic" sys.argv for scripts (without
2005 'ipython' at argv[0]) executed through command line.
2037 'ipython' at argv[0]) executed through command line.
2006 NOTE: this DEPRECATES calling ipython with multiple scripts
2038 NOTE: this DEPRECATES calling ipython with multiple scripts
2007 ("ipython a.py b.py c.py")
2039 ("ipython a.py b.py c.py")
2008
2040
2009 * iplib.py, hooks.py: Added configurable input prefilter,
2041 * iplib.py, hooks.py: Added configurable input prefilter,
2010 named 'input_prefilter'. See ext_rescapture.py for example
2042 named 'input_prefilter'. See ext_rescapture.py for example
2011 usage.
2043 usage.
2012
2044
2013 * ext_rescapture.py, Magic.py: Better system command output capture
2045 * ext_rescapture.py, Magic.py: Better system command output capture
2014 through 'var = !ls' (deprecates user-visible %sc). Same notation
2046 through 'var = !ls' (deprecates user-visible %sc). Same notation
2015 applies for magics, 'var = %alias' assigns alias list to var.
2047 applies for magics, 'var = %alias' assigns alias list to var.
2016
2048
2017 * ipapi.py: added meta() for accessing extension-usable data store.
2049 * ipapi.py: added meta() for accessing extension-usable data store.
2018
2050
2019 * iplib.py: added InteractiveShell.getapi(). New magics should be
2051 * iplib.py: added InteractiveShell.getapi(). New magics should be
2020 written doing self.getapi() instead of using the shell directly.
2052 written doing self.getapi() instead of using the shell directly.
2021
2053
2022 * Magic.py: %store now allows doing %store foo > ~/myfoo.txt and
2054 * Magic.py: %store now allows doing %store foo > ~/myfoo.txt and
2023 %store foo >> ~/myfoo.txt to store variables to files (in clean
2055 %store foo >> ~/myfoo.txt to store variables to files (in clean
2024 textual form, not a restorable pickle).
2056 textual form, not a restorable pickle).
2025
2057
2026 * ipmaker.py: now import ipy_profile_PROFILENAME automatically
2058 * ipmaker.py: now import ipy_profile_PROFILENAME automatically
2027
2059
2028 * usage.py, Magic.py: added %quickref
2060 * usage.py, Magic.py: added %quickref
2029
2061
2030 * iplib.py: ESC_PAREN fixes: /f 1 2 -> f(1,2), not f(1 2).
2062 * iplib.py: ESC_PAREN fixes: /f 1 2 -> f(1,2), not f(1 2).
2031
2063
2032 * GetoptErrors when invoking magics etc. with wrong args
2064 * GetoptErrors when invoking magics etc. with wrong args
2033 are now more helpful:
2065 are now more helpful:
2034 GetoptError: option -l not recognized (allowed: "qb" )
2066 GetoptError: option -l not recognized (allowed: "qb" )
2035
2067
2036 2006-01-25 Fernando Perez <Fernando.Perez@colorado.edu>
2068 2006-01-25 Fernando Perez <Fernando.Perez@colorado.edu>
2037
2069
2038 * IPython/demo.py (Demo.show): Flush stdout after each block, so
2070 * IPython/demo.py (Demo.show): Flush stdout after each block, so
2039 computationally intensive blocks don't appear to stall the demo.
2071 computationally intensive blocks don't appear to stall the demo.
2040
2072
2041 2006-01-24 Ville Vainio <vivainio@gmail.com>
2073 2006-01-24 Ville Vainio <vivainio@gmail.com>
2042
2074
2043 * iplib.py, hooks.py: 'result_display' hook can return a non-None
2075 * iplib.py, hooks.py: 'result_display' hook can return a non-None
2044 value to manipulate resulting history entry.
2076 value to manipulate resulting history entry.
2045
2077
2046 * ipapi.py: Moved TryNext here from hooks.py. Moved functions
2078 * ipapi.py: Moved TryNext here from hooks.py. Moved functions
2047 to instance methods of IPApi class, to make extending an embedded
2079 to instance methods of IPApi class, to make extending an embedded
2048 IPython feasible. See ext_rehashdir.py for example usage.
2080 IPython feasible. See ext_rehashdir.py for example usage.
2049
2081
2050 * Merged 1071-1076 from branches/0.7.1
2082 * Merged 1071-1076 from branches/0.7.1
2051
2083
2052
2084
2053 2006-01-23 Fernando Perez <Fernando.Perez@colorado.edu>
2085 2006-01-23 Fernando Perez <Fernando.Perez@colorado.edu>
2054
2086
2055 * tools/release (daystamp): Fix build tools to use the new
2087 * tools/release (daystamp): Fix build tools to use the new
2056 eggsetup.py script to build lightweight eggs.
2088 eggsetup.py script to build lightweight eggs.
2057
2089
2058 * Applied changesets 1062 and 1064 before 0.7.1 release.
2090 * Applied changesets 1062 and 1064 before 0.7.1 release.
2059
2091
2060 * IPython/Magic.py (magic_history): Add '-r' option to %hist, to
2092 * IPython/Magic.py (magic_history): Add '-r' option to %hist, to
2061 see the raw input history (without conversions like %ls ->
2093 see the raw input history (without conversions like %ls ->
2062 ipmagic("ls")). After a request from W. Stein, SAGE
2094 ipmagic("ls")). After a request from W. Stein, SAGE
2063 (http://modular.ucsd.edu/sage) developer. This information is
2095 (http://modular.ucsd.edu/sage) developer. This information is
2064 stored in the input_hist_raw attribute of the IPython instance, so
2096 stored in the input_hist_raw attribute of the IPython instance, so
2065 developers can access it if needed (it's an InputList instance).
2097 developers can access it if needed (it's an InputList instance).
2066
2098
2067 * Versionstring = 0.7.2.svn
2099 * Versionstring = 0.7.2.svn
2068
2100
2069 * eggsetup.py: A separate script for constructing eggs, creates
2101 * eggsetup.py: A separate script for constructing eggs, creates
2070 proper launch scripts even on Windows (an .exe file in
2102 proper launch scripts even on Windows (an .exe file in
2071 \python24\scripts).
2103 \python24\scripts).
2072
2104
2073 * ipapi.py: launch_new_instance, launch entry point needed for the
2105 * ipapi.py: launch_new_instance, launch entry point needed for the
2074 egg.
2106 egg.
2075
2107
2076 2006-01-23 Ville Vainio <vivainio@gmail.com>
2108 2006-01-23 Ville Vainio <vivainio@gmail.com>
2077
2109
2078 * Added %cpaste magic for pasting python code
2110 * Added %cpaste magic for pasting python code
2079
2111
2080 2006-01-22 Ville Vainio <vivainio@gmail.com>
2112 2006-01-22 Ville Vainio <vivainio@gmail.com>
2081
2113
2082 * Merge from branches/0.7.1 into trunk, revs 1052-1057
2114 * Merge from branches/0.7.1 into trunk, revs 1052-1057
2083
2115
2084 * Versionstring = 0.7.2.svn
2116 * Versionstring = 0.7.2.svn
2085
2117
2086 * eggsetup.py: A separate script for constructing eggs, creates
2118 * eggsetup.py: A separate script for constructing eggs, creates
2087 proper launch scripts even on Windows (an .exe file in
2119 proper launch scripts even on Windows (an .exe file in
2088 \python24\scripts).
2120 \python24\scripts).
2089
2121
2090 * ipapi.py: launch_new_instance, launch entry point needed for the
2122 * ipapi.py: launch_new_instance, launch entry point needed for the
2091 egg.
2123 egg.
2092
2124
2093 2006-01-22 Fernando Perez <Fernando.Perez@colorado.edu>
2125 2006-01-22 Fernando Perez <Fernando.Perez@colorado.edu>
2094
2126
2095 * IPython/OInspect.py (Inspector.pinfo): fix bug where foo?? or
2127 * IPython/OInspect.py (Inspector.pinfo): fix bug where foo?? or
2096 %pfile foo would print the file for foo even if it was a binary.
2128 %pfile foo would print the file for foo even if it was a binary.
2097 Now, extensions '.so' and '.dll' are skipped.
2129 Now, extensions '.so' and '.dll' are skipped.
2098
2130
2099 * IPython/Shell.py (MTInteractiveShell.__init__): Fix threading
2131 * IPython/Shell.py (MTInteractiveShell.__init__): Fix threading
2100 bug, where macros would fail in all threaded modes. I'm not 100%
2132 bug, where macros would fail in all threaded modes. I'm not 100%
2101 sure, so I'm going to put out an rc instead of making a release
2133 sure, so I'm going to put out an rc instead of making a release
2102 today, and wait for feedback for at least a few days.
2134 today, and wait for feedback for at least a few days.
2103
2135
2104 * IPython/iplib.py (handle_normal): fix (finally? somehow I doubt
2136 * IPython/iplib.py (handle_normal): fix (finally? somehow I doubt
2105 it...) the handling of pasting external code with autoindent on.
2137 it...) the handling of pasting external code with autoindent on.
2106 To get out of a multiline input, the rule will appear for most
2138 To get out of a multiline input, the rule will appear for most
2107 users unchanged: two blank lines or change the indent level
2139 users unchanged: two blank lines or change the indent level
2108 proposed by IPython. But there is a twist now: you can
2140 proposed by IPython. But there is a twist now: you can
2109 add/subtract only *one or two spaces*. If you add/subtract three
2141 add/subtract only *one or two spaces*. If you add/subtract three
2110 or more (unless you completely delete the line), IPython will
2142 or more (unless you completely delete the line), IPython will
2111 accept that line, and you'll need to enter a second one of pure
2143 accept that line, and you'll need to enter a second one of pure
2112 whitespace. I know it sounds complicated, but I can't find a
2144 whitespace. I know it sounds complicated, but I can't find a
2113 different solution that covers all the cases, with the right
2145 different solution that covers all the cases, with the right
2114 heuristics. Hopefully in actual use, nobody will really notice
2146 heuristics. Hopefully in actual use, nobody will really notice
2115 all these strange rules and things will 'just work'.
2147 all these strange rules and things will 'just work'.
2116
2148
2117 2006-01-21 Fernando Perez <Fernando.Perez@colorado.edu>
2149 2006-01-21 Fernando Perez <Fernando.Perez@colorado.edu>
2118
2150
2119 * IPython/iplib.py (interact): catch exceptions which can be
2151 * IPython/iplib.py (interact): catch exceptions which can be
2120 triggered asynchronously by signal handlers. Thanks to an
2152 triggered asynchronously by signal handlers. Thanks to an
2121 automatic crash report, submitted by Colin Kingsley
2153 automatic crash report, submitted by Colin Kingsley
2122 <tercel-AT-gentoo.org>.
2154 <tercel-AT-gentoo.org>.
2123
2155
2124 2006-01-20 Ville Vainio <vivainio@gmail.com>
2156 2006-01-20 Ville Vainio <vivainio@gmail.com>
2125
2157
2126 * Ipython/Extensions/ext_rehashdir.py: Created a usable example
2158 * Ipython/Extensions/ext_rehashdir.py: Created a usable example
2127 (%rehashdir, very useful, try it out) of how to extend ipython
2159 (%rehashdir, very useful, try it out) of how to extend ipython
2128 with new magics. Also added Extensions dir to pythonpath to make
2160 with new magics. Also added Extensions dir to pythonpath to make
2129 importing extensions easy.
2161 importing extensions easy.
2130
2162
2131 * %store now complains when trying to store interactively declared
2163 * %store now complains when trying to store interactively declared
2132 classes / instances of those classes.
2164 classes / instances of those classes.
2133
2165
2134 * Extensions/ipy_system_conf.py, UserConfig/ipy_user_conf.py,
2166 * Extensions/ipy_system_conf.py, UserConfig/ipy_user_conf.py,
2135 ipmaker.py: Config rehaul. Now ipy_..._conf.py are always imported
2167 ipmaker.py: Config rehaul. Now ipy_..._conf.py are always imported
2136 if they exist, and ipy_user_conf.py with some defaults is created for
2168 if they exist, and ipy_user_conf.py with some defaults is created for
2137 the user.
2169 the user.
2138
2170
2139 * Startup rehashing done by the config file, not InterpreterExec.
2171 * Startup rehashing done by the config file, not InterpreterExec.
2140 This means system commands are available even without selecting the
2172 This means system commands are available even without selecting the
2141 pysh profile. It's the sensible default after all.
2173 pysh profile. It's the sensible default after all.
2142
2174
2143 2006-01-20 Fernando Perez <Fernando.Perez@colorado.edu>
2175 2006-01-20 Fernando Perez <Fernando.Perez@colorado.edu>
2144
2176
2145 * IPython/iplib.py (raw_input): I _think_ I got the pasting of
2177 * IPython/iplib.py (raw_input): I _think_ I got the pasting of
2146 multiline code with autoindent on working. But I am really not
2178 multiline code with autoindent on working. But I am really not
2147 sure, so this needs more testing. Will commit a debug-enabled
2179 sure, so this needs more testing. Will commit a debug-enabled
2148 version for now, while I test it some more, so that Ville and
2180 version for now, while I test it some more, so that Ville and
2149 others may also catch any problems. Also made
2181 others may also catch any problems. Also made
2150 self.indent_current_str() a method, to ensure that there's no
2182 self.indent_current_str() a method, to ensure that there's no
2151 chance of the indent space count and the corresponding string
2183 chance of the indent space count and the corresponding string
2152 falling out of sync. All code needing the string should just call
2184 falling out of sync. All code needing the string should just call
2153 the method.
2185 the method.
2154
2186
2155 2006-01-18 Fernando Perez <Fernando.Perez@colorado.edu>
2187 2006-01-18 Fernando Perez <Fernando.Perez@colorado.edu>
2156
2188
2157 * IPython/Magic.py (magic_edit): fix check for when users don't
2189 * IPython/Magic.py (magic_edit): fix check for when users don't
2158 save their output files, the try/except was in the wrong section.
2190 save their output files, the try/except was in the wrong section.
2159
2191
2160 2006-01-17 Fernando Perez <Fernando.Perez@colorado.edu>
2192 2006-01-17 Fernando Perez <Fernando.Perez@colorado.edu>
2161
2193
2162 * IPython/Magic.py (magic_run): fix __file__ global missing from
2194 * IPython/Magic.py (magic_run): fix __file__ global missing from
2163 script's namespace when executed via %run. After a report by
2195 script's namespace when executed via %run. After a report by
2164 Vivian.
2196 Vivian.
2165
2197
2166 * IPython/Debugger.py (Pdb.__init__): Fix breakage with '%run -d'
2198 * IPython/Debugger.py (Pdb.__init__): Fix breakage with '%run -d'
2167 when using python 2.4. The parent constructor changed in 2.4, and
2199 when using python 2.4. The parent constructor changed in 2.4, and
2168 we need to track it directly (we can't call it, as it messes up
2200 we need to track it directly (we can't call it, as it messes up
2169 readline and tab-completion inside our pdb would stop working).
2201 readline and tab-completion inside our pdb would stop working).
2170 After a bug report by R. Bernstein <rocky-AT-panix.com>.
2202 After a bug report by R. Bernstein <rocky-AT-panix.com>.
2171
2203
2172 2006-01-16 Ville Vainio <vivainio@gmail.com>
2204 2006-01-16 Ville Vainio <vivainio@gmail.com>
2173
2205
2174 * Ipython/magic.py: Reverted back to old %edit functionality
2206 * Ipython/magic.py: Reverted back to old %edit functionality
2175 that returns file contents on exit.
2207 that returns file contents on exit.
2176
2208
2177 * IPython/path.py: Added Jason Orendorff's "path" module to
2209 * IPython/path.py: Added Jason Orendorff's "path" module to
2178 IPython tree, http://www.jorendorff.com/articles/python/path/.
2210 IPython tree, http://www.jorendorff.com/articles/python/path/.
2179 You can get path objects conveniently through %sc, and !!, e.g.:
2211 You can get path objects conveniently through %sc, and !!, e.g.:
2180 sc files=ls
2212 sc files=ls
2181 for p in files.paths: # or files.p
2213 for p in files.paths: # or files.p
2182 print p,p.mtime
2214 print p,p.mtime
2183
2215
2184 * Ipython/iplib.py:"," and ";" autoquoting-upon-autocall
2216 * Ipython/iplib.py:"," and ";" autoquoting-upon-autocall
2185 now work again without considering the exclusion regexp -
2217 now work again without considering the exclusion regexp -
2186 hence, things like ',foo my/path' turn to 'foo("my/path")'
2218 hence, things like ',foo my/path' turn to 'foo("my/path")'
2187 instead of syntax error.
2219 instead of syntax error.
2188
2220
2189
2221
2190 2006-01-14 Ville Vainio <vivainio@gmail.com>
2222 2006-01-14 Ville Vainio <vivainio@gmail.com>
2191
2223
2192 * IPython/ipapi.py (ashook, asmagic, options): Added convenience
2224 * IPython/ipapi.py (ashook, asmagic, options): Added convenience
2193 ipapi decorators for python 2.4 users, options() provides access to rc
2225 ipapi decorators for python 2.4 users, options() provides access to rc
2194 data.
2226 data.
2195
2227
2196 * IPython/Magic.py (magic_cd): %cd now accepts backslashes
2228 * IPython/Magic.py (magic_cd): %cd now accepts backslashes
2197 as path separators (even on Linux ;-). Space character after
2229 as path separators (even on Linux ;-). Space character after
2198 backslash (as yielded by tab completer) is still space;
2230 backslash (as yielded by tab completer) is still space;
2199 "%cd long\ name" works as expected.
2231 "%cd long\ name" works as expected.
2200
2232
2201 * IPython/ipapi.py,hooks.py,iplib.py: Hooks now implemented
2233 * IPython/ipapi.py,hooks.py,iplib.py: Hooks now implemented
2202 as "chain of command", with priority. API stays the same,
2234 as "chain of command", with priority. API stays the same,
2203 TryNext exception raised by a hook function signals that
2235 TryNext exception raised by a hook function signals that
2204 current hook failed and next hook should try handling it, as
2236 current hook failed and next hook should try handling it, as
2205 suggested by Walter DΓΆrwald <walter@livinglogic.de>. Walter also
2237 suggested by Walter DΓΆrwald <walter@livinglogic.de>. Walter also
2206 requested configurable display hook, which is now implemented.
2238 requested configurable display hook, which is now implemented.
2207
2239
2208 2006-01-13 Ville Vainio <vivainio@gmail.com>
2240 2006-01-13 Ville Vainio <vivainio@gmail.com>
2209
2241
2210 * IPython/platutils*.py: platform specific utility functions,
2242 * IPython/platutils*.py: platform specific utility functions,
2211 so far only set_term_title is implemented (change terminal
2243 so far only set_term_title is implemented (change terminal
2212 label in windowing systems). %cd now changes the title to
2244 label in windowing systems). %cd now changes the title to
2213 current dir.
2245 current dir.
2214
2246
2215 * IPython/Release.py: Added myself to "authors" list,
2247 * IPython/Release.py: Added myself to "authors" list,
2216 had to create new files.
2248 had to create new files.
2217
2249
2218 * IPython/iplib.py (handle_shell_escape): fixed logical flaw in
2250 * IPython/iplib.py (handle_shell_escape): fixed logical flaw in
2219 shell escape; not a known bug but had potential to be one in the
2251 shell escape; not a known bug but had potential to be one in the
2220 future.
2252 future.
2221
2253
2222 * IPython/ipapi.py (added),OInspect.py,iplib.py: "Public"
2254 * IPython/ipapi.py (added),OInspect.py,iplib.py: "Public"
2223 extension API for IPython! See the module for usage example. Fix
2255 extension API for IPython! See the module for usage example. Fix
2224 OInspect for docstring-less magic functions.
2256 OInspect for docstring-less magic functions.
2225
2257
2226
2258
2227 2006-01-13 Fernando Perez <Fernando.Perez@colorado.edu>
2259 2006-01-13 Fernando Perez <Fernando.Perez@colorado.edu>
2228
2260
2229 * IPython/iplib.py (raw_input): temporarily deactivate all
2261 * IPython/iplib.py (raw_input): temporarily deactivate all
2230 attempts at allowing pasting of code with autoindent on. It
2262 attempts at allowing pasting of code with autoindent on. It
2231 introduced bugs (reported by Prabhu) and I can't seem to find a
2263 introduced bugs (reported by Prabhu) and I can't seem to find a
2232 robust combination which works in all cases. Will have to revisit
2264 robust combination which works in all cases. Will have to revisit
2233 later.
2265 later.
2234
2266
2235 * IPython/genutils.py: remove isspace() function. We've dropped
2267 * IPython/genutils.py: remove isspace() function. We've dropped
2236 2.2 compatibility, so it's OK to use the string method.
2268 2.2 compatibility, so it's OK to use the string method.
2237
2269
2238 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
2270 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
2239
2271
2240 * IPython/iplib.py (InteractiveShell.__init__): fix regexp
2272 * IPython/iplib.py (InteractiveShell.__init__): fix regexp
2241 matching what NOT to autocall on, to include all python binary
2273 matching what NOT to autocall on, to include all python binary
2242 operators (including things like 'and', 'or', 'is' and 'in').
2274 operators (including things like 'and', 'or', 'is' and 'in').
2243 Prompted by a bug report on 'foo & bar', but I realized we had
2275 Prompted by a bug report on 'foo & bar', but I realized we had
2244 many more potential bug cases with other operators. The regexp is
2276 many more potential bug cases with other operators. The regexp is
2245 self.re_exclude_auto, it's fairly commented.
2277 self.re_exclude_auto, it's fairly commented.
2246
2278
2247 2006-01-12 Ville Vainio <vivainio@gmail.com>
2279 2006-01-12 Ville Vainio <vivainio@gmail.com>
2248
2280
2249 * IPython/iplib.py (make_quoted_expr,handle_shell_escape):
2281 * IPython/iplib.py (make_quoted_expr,handle_shell_escape):
2250 Prettified and hardened string/backslash quoting with ipsystem(),
2282 Prettified and hardened string/backslash quoting with ipsystem(),
2251 ipalias() and ipmagic(). Now even \ characters are passed to
2283 ipalias() and ipmagic(). Now even \ characters are passed to
2252 %magics, !shell escapes and aliases exactly as they are in the
2284 %magics, !shell escapes and aliases exactly as they are in the
2253 ipython command line. Should improve backslash experience,
2285 ipython command line. Should improve backslash experience,
2254 particularly in Windows (path delimiter for some commands that
2286 particularly in Windows (path delimiter for some commands that
2255 won't understand '/'), but Unix benefits as well (regexps). %cd
2287 won't understand '/'), but Unix benefits as well (regexps). %cd
2256 magic still doesn't support backslash path delimiters, though. Also
2288 magic still doesn't support backslash path delimiters, though. Also
2257 deleted all pretense of supporting multiline command strings in
2289 deleted all pretense of supporting multiline command strings in
2258 !system or %magic commands. Thanks to Jerry McRae for suggestions.
2290 !system or %magic commands. Thanks to Jerry McRae for suggestions.
2259
2291
2260 * doc/build_doc_instructions.txt added. Documentation on how to
2292 * doc/build_doc_instructions.txt added. Documentation on how to
2261 use doc/update_manual.py, added yesterday. Both files contributed
2293 use doc/update_manual.py, added yesterday. Both files contributed
2262 by JΓΆrgen Stenarson <jorgen.stenarson-AT-bostream.nu>. This slates
2294 by JΓΆrgen Stenarson <jorgen.stenarson-AT-bostream.nu>. This slates
2263 doc/*.sh for deprecation at a later date.
2295 doc/*.sh for deprecation at a later date.
2264
2296
2265 * /ipython.py Added ipython.py to root directory for
2297 * /ipython.py Added ipython.py to root directory for
2266 zero-installation (tar xzvf ipython.tgz; cd ipython; python
2298 zero-installation (tar xzvf ipython.tgz; cd ipython; python
2267 ipython.py) and development convenience (no need to keep doing
2299 ipython.py) and development convenience (no need to keep doing
2268 "setup.py install" between changes).
2300 "setup.py install" between changes).
2269
2301
2270 * Made ! and !! shell escapes work (again) in multiline expressions:
2302 * Made ! and !! shell escapes work (again) in multiline expressions:
2271 if 1:
2303 if 1:
2272 !ls
2304 !ls
2273 !!ls
2305 !!ls
2274
2306
2275 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
2307 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
2276
2308
2277 * IPython/ipstruct.py (Struct): Rename IPython.Struct to
2309 * IPython/ipstruct.py (Struct): Rename IPython.Struct to
2278 IPython.ipstruct, to avoid local shadowing of the stdlib 'struct'
2310 IPython.ipstruct, to avoid local shadowing of the stdlib 'struct'
2279 module in case-insensitive installation. Was causing crashes
2311 module in case-insensitive installation. Was causing crashes
2280 under win32. Closes http://www.scipy.net/roundup/ipython/issue49.
2312 under win32. Closes http://www.scipy.net/roundup/ipython/issue49.
2281
2313
2282 * IPython/Magic.py (magic_pycat): Fix pycat, patch by Marien Zwart
2314 * IPython/Magic.py (magic_pycat): Fix pycat, patch by Marien Zwart
2283 <marienz-AT-gentoo.org>, closes
2315 <marienz-AT-gentoo.org>, closes
2284 http://www.scipy.net/roundup/ipython/issue51.
2316 http://www.scipy.net/roundup/ipython/issue51.
2285
2317
2286 2006-01-11 Fernando Perez <Fernando.Perez@colorado.edu>
2318 2006-01-11 Fernando Perez <Fernando.Perez@colorado.edu>
2287
2319
2288 * IPython/Shell.py (IPShellGTK.on_timer): Finally fix the
2320 * IPython/Shell.py (IPShellGTK.on_timer): Finally fix the
2289 problem of excessive CPU usage under *nix and keyboard lag under
2321 problem of excessive CPU usage under *nix and keyboard lag under
2290 win32.
2322 win32.
2291
2323
2292 2006-01-10 *** Released version 0.7.0
2324 2006-01-10 *** Released version 0.7.0
2293
2325
2294 2006-01-10 Fernando Perez <Fernando.Perez@colorado.edu>
2326 2006-01-10 Fernando Perez <Fernando.Perez@colorado.edu>
2295
2327
2296 * IPython/Release.py (revision): tag version number to 0.7.0,
2328 * IPython/Release.py (revision): tag version number to 0.7.0,
2297 ready for release.
2329 ready for release.
2298
2330
2299 * IPython/Magic.py (magic_edit): Add print statement to %edit so
2331 * IPython/Magic.py (magic_edit): Add print statement to %edit so
2300 it informs the user of the name of the temp. file used. This can
2332 it informs the user of the name of the temp. file used. This can
2301 help if you decide later to reuse that same file, so you know
2333 help if you decide later to reuse that same file, so you know
2302 where to copy the info from.
2334 where to copy the info from.
2303
2335
2304 2006-01-09 Fernando Perez <Fernando.Perez@colorado.edu>
2336 2006-01-09 Fernando Perez <Fernando.Perez@colorado.edu>
2305
2337
2306 * setup_bdist_egg.py: little script to build an egg. Added
2338 * setup_bdist_egg.py: little script to build an egg. Added
2307 support in the release tools as well.
2339 support in the release tools as well.
2308
2340
2309 2006-01-08 Fernando Perez <Fernando.Perez@colorado.edu>
2341 2006-01-08 Fernando Perez <Fernando.Perez@colorado.edu>
2310
2342
2311 * IPython/Shell.py (IPShellWX.__init__): add support for WXPython
2343 * IPython/Shell.py (IPShellWX.__init__): add support for WXPython
2312 version selection (new -wxversion command line and ipythonrc
2344 version selection (new -wxversion command line and ipythonrc
2313 parameter). Patch contributed by Arnd Baecker
2345 parameter). Patch contributed by Arnd Baecker
2314 <arnd.baecker-AT-web.de>.
2346 <arnd.baecker-AT-web.de>.
2315
2347
2316 * IPython/iplib.py (embed_mainloop): fix tab-completion in
2348 * IPython/iplib.py (embed_mainloop): fix tab-completion in
2317 embedded instances, for variables defined at the interactive
2349 embedded instances, for variables defined at the interactive
2318 prompt of the embedded ipython. Reported by Arnd.
2350 prompt of the embedded ipython. Reported by Arnd.
2319
2351
2320 * IPython/Magic.py (magic_autocall): Fix %autocall magic. Now
2352 * IPython/Magic.py (magic_autocall): Fix %autocall magic. Now
2321 it can be used as a (stateful) toggle, or with a direct parameter.
2353 it can be used as a (stateful) toggle, or with a direct parameter.
2322
2354
2323 * IPython/ultraTB.py (_fixed_getinnerframes): remove debug assert which
2355 * IPython/ultraTB.py (_fixed_getinnerframes): remove debug assert which
2324 could be triggered in certain cases and cause the traceback
2356 could be triggered in certain cases and cause the traceback
2325 printer not to work.
2357 printer not to work.
2326
2358
2327 2006-01-07 Fernando Perez <Fernando.Perez@colorado.edu>
2359 2006-01-07 Fernando Perez <Fernando.Perez@colorado.edu>
2328
2360
2329 * IPython/iplib.py (_should_recompile): Small fix, closes
2361 * IPython/iplib.py (_should_recompile): Small fix, closes
2330 http://www.scipy.net/roundup/ipython/issue48. Patch by Scott.
2362 http://www.scipy.net/roundup/ipython/issue48. Patch by Scott.
2331
2363
2332 2006-01-04 Fernando Perez <Fernando.Perez@colorado.edu>
2364 2006-01-04 Fernando Perez <Fernando.Perez@colorado.edu>
2333
2365
2334 * IPython/Shell.py (IPShellGTK.mainloop): fix bug in the GTK
2366 * IPython/Shell.py (IPShellGTK.mainloop): fix bug in the GTK
2335 backend for matplotlib (100% cpu utiliziation). Thanks to Charlie
2367 backend for matplotlib (100% cpu utiliziation). Thanks to Charlie
2336 Moad for help with tracking it down.
2368 Moad for help with tracking it down.
2337
2369
2338 * IPython/iplib.py (handle_auto): fix autocall handling for
2370 * IPython/iplib.py (handle_auto): fix autocall handling for
2339 objects which support BOTH __getitem__ and __call__ (so that f [x]
2371 objects which support BOTH __getitem__ and __call__ (so that f [x]
2340 is left alone, instead of becoming f([x]) automatically).
2372 is left alone, instead of becoming f([x]) automatically).
2341
2373
2342 * IPython/Magic.py (magic_cd): fix crash when cd -b was used.
2374 * IPython/Magic.py (magic_cd): fix crash when cd -b was used.
2343 Ville's patch.
2375 Ville's patch.
2344
2376
2345 2006-01-03 Fernando Perez <Fernando.Perez@colorado.edu>
2377 2006-01-03 Fernando Perez <Fernando.Perez@colorado.edu>
2346
2378
2347 * IPython/iplib.py (handle_auto): changed autocall semantics to
2379 * IPython/iplib.py (handle_auto): changed autocall semantics to
2348 include 'smart' mode, where the autocall transformation is NOT
2380 include 'smart' mode, where the autocall transformation is NOT
2349 applied if there are no arguments on the line. This allows you to
2381 applied if there are no arguments on the line. This allows you to
2350 just type 'foo' if foo is a callable to see its internal form,
2382 just type 'foo' if foo is a callable to see its internal form,
2351 instead of having it called with no arguments (typically a
2383 instead of having it called with no arguments (typically a
2352 mistake). The old 'full' autocall still exists: for that, you
2384 mistake). The old 'full' autocall still exists: for that, you
2353 need to set the 'autocall' parameter to 2 in your ipythonrc file.
2385 need to set the 'autocall' parameter to 2 in your ipythonrc file.
2354
2386
2355 * IPython/completer.py (Completer.attr_matches): add
2387 * IPython/completer.py (Completer.attr_matches): add
2356 tab-completion support for Enthoughts' traits. After a report by
2388 tab-completion support for Enthoughts' traits. After a report by
2357 Arnd and a patch by Prabhu.
2389 Arnd and a patch by Prabhu.
2358
2390
2359 2006-01-02 Fernando Perez <Fernando.Perez@colorado.edu>
2391 2006-01-02 Fernando Perez <Fernando.Perez@colorado.edu>
2360
2392
2361 * IPython/ultraTB.py (_fixed_getinnerframes): added Alex
2393 * IPython/ultraTB.py (_fixed_getinnerframes): added Alex
2362 Schmolck's patch to fix inspect.getinnerframes().
2394 Schmolck's patch to fix inspect.getinnerframes().
2363
2395
2364 * IPython/iplib.py (InteractiveShell.__init__): significant fixes
2396 * IPython/iplib.py (InteractiveShell.__init__): significant fixes
2365 for embedded instances, regarding handling of namespaces and items
2397 for embedded instances, regarding handling of namespaces and items
2366 added to the __builtin__ one. Multiple embedded instances and
2398 added to the __builtin__ one. Multiple embedded instances and
2367 recursive embeddings should work better now (though I'm not sure
2399 recursive embeddings should work better now (though I'm not sure
2368 I've got all the corner cases fixed, that code is a bit of a brain
2400 I've got all the corner cases fixed, that code is a bit of a brain
2369 twister).
2401 twister).
2370
2402
2371 * IPython/Magic.py (magic_edit): added support to edit in-memory
2403 * IPython/Magic.py (magic_edit): added support to edit in-memory
2372 macros (automatically creates the necessary temp files). %edit
2404 macros (automatically creates the necessary temp files). %edit
2373 also doesn't return the file contents anymore, it's just noise.
2405 also doesn't return the file contents anymore, it's just noise.
2374
2406
2375 * IPython/completer.py (Completer.attr_matches): revert change to
2407 * IPython/completer.py (Completer.attr_matches): revert change to
2376 complete only on attributes listed in __all__. I realized it
2408 complete only on attributes listed in __all__. I realized it
2377 cripples the tab-completion system as a tool for exploring the
2409 cripples the tab-completion system as a tool for exploring the
2378 internals of unknown libraries (it renders any non-__all__
2410 internals of unknown libraries (it renders any non-__all__
2379 attribute off-limits). I got bit by this when trying to see
2411 attribute off-limits). I got bit by this when trying to see
2380 something inside the dis module.
2412 something inside the dis module.
2381
2413
2382 2005-12-31 Fernando Perez <Fernando.Perez@colorado.edu>
2414 2005-12-31 Fernando Perez <Fernando.Perez@colorado.edu>
2383
2415
2384 * IPython/iplib.py (InteractiveShell.__init__): add .meta
2416 * IPython/iplib.py (InteractiveShell.__init__): add .meta
2385 namespace for users and extension writers to hold data in. This
2417 namespace for users and extension writers to hold data in. This
2386 follows the discussion in
2418 follows the discussion in
2387 http://projects.scipy.org/ipython/ipython/wiki/RefactoringIPython.
2419 http://projects.scipy.org/ipython/ipython/wiki/RefactoringIPython.
2388
2420
2389 * IPython/completer.py (IPCompleter.complete): small patch to help
2421 * IPython/completer.py (IPCompleter.complete): small patch to help
2390 tab-completion under Emacs, after a suggestion by John Barnard
2422 tab-completion under Emacs, after a suggestion by John Barnard
2391 <barnarj-AT-ccf.org>.
2423 <barnarj-AT-ccf.org>.
2392
2424
2393 * IPython/Magic.py (Magic.extract_input_slices): added support for
2425 * IPython/Magic.py (Magic.extract_input_slices): added support for
2394 the slice notation in magics to use N-M to represent numbers N...M
2426 the slice notation in magics to use N-M to represent numbers N...M
2395 (closed endpoints). This is used by %macro and %save.
2427 (closed endpoints). This is used by %macro and %save.
2396
2428
2397 * IPython/completer.py (Completer.attr_matches): for modules which
2429 * IPython/completer.py (Completer.attr_matches): for modules which
2398 define __all__, complete only on those. After a patch by Jeffrey
2430 define __all__, complete only on those. After a patch by Jeffrey
2399 Collins <jcollins_boulder-AT-earthlink.net>. Also, clean up and
2431 Collins <jcollins_boulder-AT-earthlink.net>. Also, clean up and
2400 speed up this routine.
2432 speed up this routine.
2401
2433
2402 * IPython/Logger.py (Logger.log): fix a history handling bug. I
2434 * IPython/Logger.py (Logger.log): fix a history handling bug. I
2403 don't know if this is the end of it, but the behavior now is
2435 don't know if this is the end of it, but the behavior now is
2404 certainly much more correct. Note that coupled with macros,
2436 certainly much more correct. Note that coupled with macros,
2405 slightly surprising (at first) behavior may occur: a macro will in
2437 slightly surprising (at first) behavior may occur: a macro will in
2406 general expand to multiple lines of input, so upon exiting, the
2438 general expand to multiple lines of input, so upon exiting, the
2407 in/out counters will both be bumped by the corresponding amount
2439 in/out counters will both be bumped by the corresponding amount
2408 (as if the macro's contents had been typed interactively). Typing
2440 (as if the macro's contents had been typed interactively). Typing
2409 %hist will reveal the intermediate (silently processed) lines.
2441 %hist will reveal the intermediate (silently processed) lines.
2410
2442
2411 * IPython/Magic.py (magic_run): fix a subtle bug which could cause
2443 * IPython/Magic.py (magic_run): fix a subtle bug which could cause
2412 pickle to fail (%run was overwriting __main__ and not restoring
2444 pickle to fail (%run was overwriting __main__ and not restoring
2413 it, but pickle relies on __main__ to operate).
2445 it, but pickle relies on __main__ to operate).
2414
2446
2415 * IPython/iplib.py (InteractiveShell): fix pdb calling: I'm now
2447 * IPython/iplib.py (InteractiveShell): fix pdb calling: I'm now
2416 using properties, but forgot to make the main InteractiveShell
2448 using properties, but forgot to make the main InteractiveShell
2417 class a new-style class. Properties fail silently, and
2449 class a new-style class. Properties fail silently, and
2418 mysteriously, with old-style class (getters work, but
2450 mysteriously, with old-style class (getters work, but
2419 setters don't do anything).
2451 setters don't do anything).
2420
2452
2421 2005-12-30 Fernando Perez <Fernando.Perez@colorado.edu>
2453 2005-12-30 Fernando Perez <Fernando.Perez@colorado.edu>
2422
2454
2423 * IPython/Magic.py (magic_history): fix history reporting bug (I
2455 * IPython/Magic.py (magic_history): fix history reporting bug (I
2424 know some nasties are still there, I just can't seem to find a
2456 know some nasties are still there, I just can't seem to find a
2425 reproducible test case to track them down; the input history is
2457 reproducible test case to track them down; the input history is
2426 falling out of sync...)
2458 falling out of sync...)
2427
2459
2428 * IPython/iplib.py (handle_shell_escape): fix bug where both
2460 * IPython/iplib.py (handle_shell_escape): fix bug where both
2429 aliases and system accesses where broken for indented code (such
2461 aliases and system accesses where broken for indented code (such
2430 as loops).
2462 as loops).
2431
2463
2432 * IPython/genutils.py (shell): fix small but critical bug for
2464 * IPython/genutils.py (shell): fix small but critical bug for
2433 win32 system access.
2465 win32 system access.
2434
2466
2435 2005-12-29 Fernando Perez <Fernando.Perez@colorado.edu>
2467 2005-12-29 Fernando Perez <Fernando.Perez@colorado.edu>
2436
2468
2437 * IPython/iplib.py (showtraceback): remove use of the
2469 * IPython/iplib.py (showtraceback): remove use of the
2438 sys.last_{type/value/traceback} structures, which are non
2470 sys.last_{type/value/traceback} structures, which are non
2439 thread-safe.
2471 thread-safe.
2440 (_prefilter): change control flow to ensure that we NEVER
2472 (_prefilter): change control flow to ensure that we NEVER
2441 introspect objects when autocall is off. This will guarantee that
2473 introspect objects when autocall is off. This will guarantee that
2442 having an input line of the form 'x.y', where access to attribute
2474 having an input line of the form 'x.y', where access to attribute
2443 'y' has side effects, doesn't trigger the side effect TWICE. It
2475 'y' has side effects, doesn't trigger the side effect TWICE. It
2444 is important to note that, with autocall on, these side effects
2476 is important to note that, with autocall on, these side effects
2445 can still happen.
2477 can still happen.
2446 (ipsystem): new builtin, to complete the ip{magic/alias/system}
2478 (ipsystem): new builtin, to complete the ip{magic/alias/system}
2447 trio. IPython offers these three kinds of special calls which are
2479 trio. IPython offers these three kinds of special calls which are
2448 not python code, and it's a good thing to have their call method
2480 not python code, and it's a good thing to have their call method
2449 be accessible as pure python functions (not just special syntax at
2481 be accessible as pure python functions (not just special syntax at
2450 the command line). It gives us a better internal implementation
2482 the command line). It gives us a better internal implementation
2451 structure, as well as exposing these for user scripting more
2483 structure, as well as exposing these for user scripting more
2452 cleanly.
2484 cleanly.
2453
2485
2454 * IPython/macro.py (Macro.__init__): moved macros to a standalone
2486 * IPython/macro.py (Macro.__init__): moved macros to a standalone
2455 file. Now that they'll be more likely to be used with the
2487 file. Now that they'll be more likely to be used with the
2456 persistance system (%store), I want to make sure their module path
2488 persistance system (%store), I want to make sure their module path
2457 doesn't change in the future, so that we don't break things for
2489 doesn't change in the future, so that we don't break things for
2458 users' persisted data.
2490 users' persisted data.
2459
2491
2460 * IPython/iplib.py (autoindent_update): move indentation
2492 * IPython/iplib.py (autoindent_update): move indentation
2461 management into the _text_ processing loop, not the keyboard
2493 management into the _text_ processing loop, not the keyboard
2462 interactive one. This is necessary to correctly process non-typed
2494 interactive one. This is necessary to correctly process non-typed
2463 multiline input (such as macros).
2495 multiline input (such as macros).
2464
2496
2465 * IPython/Magic.py (Magic.format_latex): patch by Stefan van der
2497 * IPython/Magic.py (Magic.format_latex): patch by Stefan van der
2466 Walt <stefan-AT-sun.ac.za> to fix latex formatting of docstrings,
2498 Walt <stefan-AT-sun.ac.za> to fix latex formatting of docstrings,
2467 which was producing problems in the resulting manual.
2499 which was producing problems in the resulting manual.
2468 (magic_whos): improve reporting of instances (show their class,
2500 (magic_whos): improve reporting of instances (show their class,
2469 instead of simply printing 'instance' which isn't terribly
2501 instead of simply printing 'instance' which isn't terribly
2470 informative).
2502 informative).
2471
2503
2472 * IPython/genutils.py (shell): commit Jorgen Stenarson's patch
2504 * IPython/genutils.py (shell): commit Jorgen Stenarson's patch
2473 (minor mods) to support network shares under win32.
2505 (minor mods) to support network shares under win32.
2474
2506
2475 * IPython/winconsole.py (get_console_size): add new winconsole
2507 * IPython/winconsole.py (get_console_size): add new winconsole
2476 module and fixes to page_dumb() to improve its behavior under
2508 module and fixes to page_dumb() to improve its behavior under
2477 win32. Contributed by Alexander Belchenko <bialix-AT-ukr.net>.
2509 win32. Contributed by Alexander Belchenko <bialix-AT-ukr.net>.
2478
2510
2479 * IPython/Magic.py (Macro): simplified Macro class to just
2511 * IPython/Magic.py (Macro): simplified Macro class to just
2480 subclass list. We've had only 2.2 compatibility for a very long
2512 subclass list. We've had only 2.2 compatibility for a very long
2481 time, yet I was still avoiding subclassing the builtin types. No
2513 time, yet I was still avoiding subclassing the builtin types. No
2482 more (I'm also starting to use properties, though I won't shift to
2514 more (I'm also starting to use properties, though I won't shift to
2483 2.3-specific features quite yet).
2515 2.3-specific features quite yet).
2484 (magic_store): added Ville's patch for lightweight variable
2516 (magic_store): added Ville's patch for lightweight variable
2485 persistence, after a request on the user list by Matt Wilkie
2517 persistence, after a request on the user list by Matt Wilkie
2486 <maphew-AT-gmail.com>. The new %store magic's docstring has full
2518 <maphew-AT-gmail.com>. The new %store magic's docstring has full
2487 details.
2519 details.
2488
2520
2489 * IPython/iplib.py (InteractiveShell.post_config_initialization):
2521 * IPython/iplib.py (InteractiveShell.post_config_initialization):
2490 changed the default logfile name from 'ipython.log' to
2522 changed the default logfile name from 'ipython.log' to
2491 'ipython_log.py'. These logs are real python files, and now that
2523 'ipython_log.py'. These logs are real python files, and now that
2492 we have much better multiline support, people are more likely to
2524 we have much better multiline support, people are more likely to
2493 want to use them as such. Might as well name them correctly.
2525 want to use them as such. Might as well name them correctly.
2494
2526
2495 * IPython/Magic.py: substantial cleanup. While we can't stop
2527 * IPython/Magic.py: substantial cleanup. While we can't stop
2496 using magics as mixins, due to the existing customizations 'out
2528 using magics as mixins, due to the existing customizations 'out
2497 there' which rely on the mixin naming conventions, at least I
2529 there' which rely on the mixin naming conventions, at least I
2498 cleaned out all cross-class name usage. So once we are OK with
2530 cleaned out all cross-class name usage. So once we are OK with
2499 breaking compatibility, the two systems can be separated.
2531 breaking compatibility, the two systems can be separated.
2500
2532
2501 * IPython/Logger.py: major cleanup. This one is NOT a mixin
2533 * IPython/Logger.py: major cleanup. This one is NOT a mixin
2502 anymore, and the class is a fair bit less hideous as well. New
2534 anymore, and the class is a fair bit less hideous as well. New
2503 features were also introduced: timestamping of input, and logging
2535 features were also introduced: timestamping of input, and logging
2504 of output results. These are user-visible with the -t and -o
2536 of output results. These are user-visible with the -t and -o
2505 options to %logstart. Closes
2537 options to %logstart. Closes
2506 http://www.scipy.net/roundup/ipython/issue11 and a request by
2538 http://www.scipy.net/roundup/ipython/issue11 and a request by
2507 William Stein (SAGE developer - http://modular.ucsd.edu/sage).
2539 William Stein (SAGE developer - http://modular.ucsd.edu/sage).
2508
2540
2509 2005-12-28 Fernando Perez <Fernando.Perez@colorado.edu>
2541 2005-12-28 Fernando Perez <Fernando.Perez@colorado.edu>
2510
2542
2511 * IPython/iplib.py (handle_shell_escape): add Ville's patch to
2543 * IPython/iplib.py (handle_shell_escape): add Ville's patch to
2512 better handle backslashes in paths. See the thread 'More Windows
2544 better handle backslashes in paths. See the thread 'More Windows
2513 questions part 2 - \/ characters revisited' on the iypthon user
2545 questions part 2 - \/ characters revisited' on the iypthon user
2514 list:
2546 list:
2515 http://scipy.net/pipermail/ipython-user/2005-June/000907.html
2547 http://scipy.net/pipermail/ipython-user/2005-June/000907.html
2516
2548
2517 (InteractiveShell.__init__): fix tab-completion bug in threaded shells.
2549 (InteractiveShell.__init__): fix tab-completion bug in threaded shells.
2518
2550
2519 (InteractiveShell.__init__): change threaded shells to not use the
2551 (InteractiveShell.__init__): change threaded shells to not use the
2520 ipython crash handler. This was causing more problems than not,
2552 ipython crash handler. This was causing more problems than not,
2521 as exceptions in the main thread (GUI code, typically) would
2553 as exceptions in the main thread (GUI code, typically) would
2522 always show up as a 'crash', when they really weren't.
2554 always show up as a 'crash', when they really weren't.
2523
2555
2524 The colors and exception mode commands (%colors/%xmode) have been
2556 The colors and exception mode commands (%colors/%xmode) have been
2525 synchronized to also take this into account, so users can get
2557 synchronized to also take this into account, so users can get
2526 verbose exceptions for their threaded code as well. I also added
2558 verbose exceptions for their threaded code as well. I also added
2527 support for activating pdb inside this exception handler as well,
2559 support for activating pdb inside this exception handler as well,
2528 so now GUI authors can use IPython's enhanced pdb at runtime.
2560 so now GUI authors can use IPython's enhanced pdb at runtime.
2529
2561
2530 * IPython/ipmaker.py (make_IPython): make the autoedit_syntax flag
2562 * IPython/ipmaker.py (make_IPython): make the autoedit_syntax flag
2531 true by default, and add it to the shipped ipythonrc file. Since
2563 true by default, and add it to the shipped ipythonrc file. Since
2532 this asks the user before proceeding, I think it's OK to make it
2564 this asks the user before proceeding, I think it's OK to make it
2533 true by default.
2565 true by default.
2534
2566
2535 * IPython/Magic.py (magic_exit): make new exit/quit magics instead
2567 * IPython/Magic.py (magic_exit): make new exit/quit magics instead
2536 of the previous special-casing of input in the eval loop. I think
2568 of the previous special-casing of input in the eval loop. I think
2537 this is cleaner, as they really are commands and shouldn't have
2569 this is cleaner, as they really are commands and shouldn't have
2538 a special role in the middle of the core code.
2570 a special role in the middle of the core code.
2539
2571
2540 2005-12-27 Fernando Perez <Fernando.Perez@colorado.edu>
2572 2005-12-27 Fernando Perez <Fernando.Perez@colorado.edu>
2541
2573
2542 * IPython/iplib.py (edit_syntax_error): added support for
2574 * IPython/iplib.py (edit_syntax_error): added support for
2543 automatically reopening the editor if the file had a syntax error
2575 automatically reopening the editor if the file had a syntax error
2544 in it. Thanks to scottt who provided the patch at:
2576 in it. Thanks to scottt who provided the patch at:
2545 http://www.scipy.net/roundup/ipython/issue36 (slightly modified
2577 http://www.scipy.net/roundup/ipython/issue36 (slightly modified
2546 version committed).
2578 version committed).
2547
2579
2548 * IPython/iplib.py (handle_normal): add suport for multi-line
2580 * IPython/iplib.py (handle_normal): add suport for multi-line
2549 input with emtpy lines. This fixes
2581 input with emtpy lines. This fixes
2550 http://www.scipy.net/roundup/ipython/issue43 and a similar
2582 http://www.scipy.net/roundup/ipython/issue43 and a similar
2551 discussion on the user list.
2583 discussion on the user list.
2552
2584
2553 WARNING: a behavior change is necessarily introduced to support
2585 WARNING: a behavior change is necessarily introduced to support
2554 blank lines: now a single blank line with whitespace does NOT
2586 blank lines: now a single blank line with whitespace does NOT
2555 break the input loop, which means that when autoindent is on, by
2587 break the input loop, which means that when autoindent is on, by
2556 default hitting return on the next (indented) line does NOT exit.
2588 default hitting return on the next (indented) line does NOT exit.
2557
2589
2558 Instead, to exit a multiline input you can either have:
2590 Instead, to exit a multiline input you can either have:
2559
2591
2560 - TWO whitespace lines (just hit return again), or
2592 - TWO whitespace lines (just hit return again), or
2561 - a single whitespace line of a different length than provided
2593 - a single whitespace line of a different length than provided
2562 by the autoindent (add or remove a space).
2594 by the autoindent (add or remove a space).
2563
2595
2564 * IPython/completer.py (MagicCompleter.__init__): new 'completer'
2596 * IPython/completer.py (MagicCompleter.__init__): new 'completer'
2565 module to better organize all readline-related functionality.
2597 module to better organize all readline-related functionality.
2566 I've deleted FlexCompleter and put all completion clases here.
2598 I've deleted FlexCompleter and put all completion clases here.
2567
2599
2568 * IPython/iplib.py (raw_input): improve indentation management.
2600 * IPython/iplib.py (raw_input): improve indentation management.
2569 It is now possible to paste indented code with autoindent on, and
2601 It is now possible to paste indented code with autoindent on, and
2570 the code is interpreted correctly (though it still looks bad on
2602 the code is interpreted correctly (though it still looks bad on
2571 screen, due to the line-oriented nature of ipython).
2603 screen, due to the line-oriented nature of ipython).
2572 (MagicCompleter.complete): change behavior so that a TAB key on an
2604 (MagicCompleter.complete): change behavior so that a TAB key on an
2573 otherwise empty line actually inserts a tab, instead of completing
2605 otherwise empty line actually inserts a tab, instead of completing
2574 on the entire global namespace. This makes it easier to use the
2606 on the entire global namespace. This makes it easier to use the
2575 TAB key for indentation. After a request by Hans Meine
2607 TAB key for indentation. After a request by Hans Meine
2576 <hans_meine-AT-gmx.net>
2608 <hans_meine-AT-gmx.net>
2577 (_prefilter): add support so that typing plain 'exit' or 'quit'
2609 (_prefilter): add support so that typing plain 'exit' or 'quit'
2578 does a sensible thing. Originally I tried to deviate as little as
2610 does a sensible thing. Originally I tried to deviate as little as
2579 possible from the default python behavior, but even that one may
2611 possible from the default python behavior, but even that one may
2580 change in this direction (thread on python-dev to that effect).
2612 change in this direction (thread on python-dev to that effect).
2581 Regardless, ipython should do the right thing even if CPython's
2613 Regardless, ipython should do the right thing even if CPython's
2582 '>>>' prompt doesn't.
2614 '>>>' prompt doesn't.
2583 (InteractiveShell): removed subclassing code.InteractiveConsole
2615 (InteractiveShell): removed subclassing code.InteractiveConsole
2584 class. By now we'd overridden just about all of its methods: I've
2616 class. By now we'd overridden just about all of its methods: I've
2585 copied the remaining two over, and now ipython is a standalone
2617 copied the remaining two over, and now ipython is a standalone
2586 class. This will provide a clearer picture for the chainsaw
2618 class. This will provide a clearer picture for the chainsaw
2587 branch refactoring.
2619 branch refactoring.
2588
2620
2589 2005-12-26 Fernando Perez <Fernando.Perez@colorado.edu>
2621 2005-12-26 Fernando Perez <Fernando.Perez@colorado.edu>
2590
2622
2591 * IPython/ultraTB.py (VerboseTB.text): harden reporting against
2623 * IPython/ultraTB.py (VerboseTB.text): harden reporting against
2592 failures for objects which break when dir() is called on them.
2624 failures for objects which break when dir() is called on them.
2593
2625
2594 * IPython/FlexCompleter.py (Completer.__init__): Added support for
2626 * IPython/FlexCompleter.py (Completer.__init__): Added support for
2595 distinct local and global namespaces in the completer API. This
2627 distinct local and global namespaces in the completer API. This
2596 change allows us to properly handle completion with distinct
2628 change allows us to properly handle completion with distinct
2597 scopes, including in embedded instances (this had never really
2629 scopes, including in embedded instances (this had never really
2598 worked correctly).
2630 worked correctly).
2599
2631
2600 Note: this introduces a change in the constructor for
2632 Note: this introduces a change in the constructor for
2601 MagicCompleter, as a new global_namespace parameter is now the
2633 MagicCompleter, as a new global_namespace parameter is now the
2602 second argument (the others were bumped one position).
2634 second argument (the others were bumped one position).
2603
2635
2604 2005-12-25 Fernando Perez <Fernando.Perez@colorado.edu>
2636 2005-12-25 Fernando Perez <Fernando.Perez@colorado.edu>
2605
2637
2606 * IPython/iplib.py (embed_mainloop): fix tab-completion in
2638 * IPython/iplib.py (embed_mainloop): fix tab-completion in
2607 embedded instances (which can be done now thanks to Vivian's
2639 embedded instances (which can be done now thanks to Vivian's
2608 frame-handling fixes for pdb).
2640 frame-handling fixes for pdb).
2609 (InteractiveShell.__init__): Fix namespace handling problem in
2641 (InteractiveShell.__init__): Fix namespace handling problem in
2610 embedded instances. We were overwriting __main__ unconditionally,
2642 embedded instances. We were overwriting __main__ unconditionally,
2611 and this should only be done for 'full' (non-embedded) IPython;
2643 and this should only be done for 'full' (non-embedded) IPython;
2612 embedded instances must respect the caller's __main__. Thanks to
2644 embedded instances must respect the caller's __main__. Thanks to
2613 a bug report by Yaroslav Bulatov <yaroslavvb-AT-gmail.com>
2645 a bug report by Yaroslav Bulatov <yaroslavvb-AT-gmail.com>
2614
2646
2615 2005-12-24 Fernando Perez <Fernando.Perez@colorado.edu>
2647 2005-12-24 Fernando Perez <Fernando.Perez@colorado.edu>
2616
2648
2617 * setup.py: added download_url to setup(). This registers the
2649 * setup.py: added download_url to setup(). This registers the
2618 download address at PyPI, which is not only useful to humans
2650 download address at PyPI, which is not only useful to humans
2619 browsing the site, but is also picked up by setuptools (the Eggs
2651 browsing the site, but is also picked up by setuptools (the Eggs
2620 machinery). Thanks to Ville and R. Kern for the info/discussion
2652 machinery). Thanks to Ville and R. Kern for the info/discussion
2621 on this.
2653 on this.
2622
2654
2623 2005-12-23 Fernando Perez <Fernando.Perez@colorado.edu>
2655 2005-12-23 Fernando Perez <Fernando.Perez@colorado.edu>
2624
2656
2625 * IPython/Debugger.py (Pdb.__init__): Major pdb mode enhancements.
2657 * IPython/Debugger.py (Pdb.__init__): Major pdb mode enhancements.
2626 This brings a lot of nice functionality to the pdb mode, which now
2658 This brings a lot of nice functionality to the pdb mode, which now
2627 has tab-completion, syntax highlighting, and better stack handling
2659 has tab-completion, syntax highlighting, and better stack handling
2628 than before. Many thanks to Vivian De Smedt
2660 than before. Many thanks to Vivian De Smedt
2629 <vivian-AT-vdesmedt.com> for the original patches.
2661 <vivian-AT-vdesmedt.com> for the original patches.
2630
2662
2631 2005-12-08 Fernando Perez <Fernando.Perez@colorado.edu>
2663 2005-12-08 Fernando Perez <Fernando.Perez@colorado.edu>
2632
2664
2633 * IPython/Shell.py (IPShellGTK.mainloop): fix mainloop() calling
2665 * IPython/Shell.py (IPShellGTK.mainloop): fix mainloop() calling
2634 sequence to consistently accept the banner argument. The
2666 sequence to consistently accept the banner argument. The
2635 inconsistency was tripping SAGE, thanks to Gary Zablackis
2667 inconsistency was tripping SAGE, thanks to Gary Zablackis
2636 <gzabl-AT-yahoo.com> for the report.
2668 <gzabl-AT-yahoo.com> for the report.
2637
2669
2638 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
2670 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
2639
2671
2640 * IPython/iplib.py (InteractiveShell.post_config_initialization):
2672 * IPython/iplib.py (InteractiveShell.post_config_initialization):
2641 Fix bug where a naked 'alias' call in the ipythonrc file would
2673 Fix bug where a naked 'alias' call in the ipythonrc file would
2642 cause a crash. Bug reported by Jorgen Stenarson.
2674 cause a crash. Bug reported by Jorgen Stenarson.
2643
2675
2644 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
2676 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
2645
2677
2646 * IPython/ipmaker.py (make_IPython): cleanups which should improve
2678 * IPython/ipmaker.py (make_IPython): cleanups which should improve
2647 startup time.
2679 startup time.
2648
2680
2649 * IPython/iplib.py (runcode): my globals 'fix' for embedded
2681 * IPython/iplib.py (runcode): my globals 'fix' for embedded
2650 instances had introduced a bug with globals in normal code. Now
2682 instances had introduced a bug with globals in normal code. Now
2651 it's working in all cases.
2683 it's working in all cases.
2652
2684
2653 * IPython/Magic.py (magic_psearch): Finish wildcard cleanup and
2685 * IPython/Magic.py (magic_psearch): Finish wildcard cleanup and
2654 API changes. A new ipytonrc option, 'wildcards_case_sensitive'
2686 API changes. A new ipytonrc option, 'wildcards_case_sensitive'
2655 has been introduced to set the default case sensitivity of the
2687 has been introduced to set the default case sensitivity of the
2656 searches. Users can still select either mode at runtime on a
2688 searches. Users can still select either mode at runtime on a
2657 per-search basis.
2689 per-search basis.
2658
2690
2659 2005-11-13 Fernando Perez <Fernando.Perez@colorado.edu>
2691 2005-11-13 Fernando Perez <Fernando.Perez@colorado.edu>
2660
2692
2661 * IPython/wildcard.py (NameSpace.__init__): fix resolution of
2693 * IPython/wildcard.py (NameSpace.__init__): fix resolution of
2662 attributes in wildcard searches for subclasses. Modified version
2694 attributes in wildcard searches for subclasses. Modified version
2663 of a patch by Jorgen.
2695 of a patch by Jorgen.
2664
2696
2665 2005-11-12 Fernando Perez <Fernando.Perez@colorado.edu>
2697 2005-11-12 Fernando Perez <Fernando.Perez@colorado.edu>
2666
2698
2667 * IPython/iplib.py (embed_mainloop): Fix handling of globals for
2699 * IPython/iplib.py (embed_mainloop): Fix handling of globals for
2668 embedded instances. I added a user_global_ns attribute to the
2700 embedded instances. I added a user_global_ns attribute to the
2669 InteractiveShell class to handle this.
2701 InteractiveShell class to handle this.
2670
2702
2671 2005-10-31 Fernando Perez <Fernando.Perez@colorado.edu>
2703 2005-10-31 Fernando Perez <Fernando.Perez@colorado.edu>
2672
2704
2673 * IPython/Shell.py (IPShellGTK.mainloop): Change timeout_add to
2705 * IPython/Shell.py (IPShellGTK.mainloop): Change timeout_add to
2674 idle_add, which fixes horrible keyboard lag problems under gtk 2.6
2706 idle_add, which fixes horrible keyboard lag problems under gtk 2.6
2675 (reported under win32, but may happen also in other platforms).
2707 (reported under win32, but may happen also in other platforms).
2676 Bug report and fix courtesy of Sean Moore <smm-AT-logic.bm>
2708 Bug report and fix courtesy of Sean Moore <smm-AT-logic.bm>
2677
2709
2678 2005-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
2710 2005-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
2679
2711
2680 * IPython/Magic.py (magic_psearch): new support for wildcard
2712 * IPython/Magic.py (magic_psearch): new support for wildcard
2681 patterns. Now, typing ?a*b will list all names which begin with a
2713 patterns. Now, typing ?a*b will list all names which begin with a
2682 and end in b, for example. The %psearch magic has full
2714 and end in b, for example. The %psearch magic has full
2683 docstrings. Many thanks to JΓΆrgen Stenarson
2715 docstrings. Many thanks to JΓΆrgen Stenarson
2684 <jorgen.stenarson-AT-bostream.nu>, author of the patches
2716 <jorgen.stenarson-AT-bostream.nu>, author of the patches
2685 implementing this functionality.
2717 implementing this functionality.
2686
2718
2687 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
2719 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
2688
2720
2689 * Manual: fixed long-standing annoyance of double-dashes (as in
2721 * Manual: fixed long-standing annoyance of double-dashes (as in
2690 --prefix=~, for example) being stripped in the HTML version. This
2722 --prefix=~, for example) being stripped in the HTML version. This
2691 is a latex2html bug, but a workaround was provided. Many thanks
2723 is a latex2html bug, but a workaround was provided. Many thanks
2692 to George K. Thiruvathukal <gthiruv-AT-luc.edu> for the detailed
2724 to George K. Thiruvathukal <gthiruv-AT-luc.edu> for the detailed
2693 help, and Michael Tobis <mtobis-AT-gmail.com> for getting the ball
2725 help, and Michael Tobis <mtobis-AT-gmail.com> for getting the ball
2694 rolling. This seemingly small issue had tripped a number of users
2726 rolling. This seemingly small issue had tripped a number of users
2695 when first installing, so I'm glad to see it gone.
2727 when first installing, so I'm glad to see it gone.
2696
2728
2697 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
2729 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
2698
2730
2699 * IPython/Extensions/numeric_formats.py: fix missing import,
2731 * IPython/Extensions/numeric_formats.py: fix missing import,
2700 reported by Stephen Walton.
2732 reported by Stephen Walton.
2701
2733
2702 2005-09-24 Fernando Perez <Fernando.Perez@colorado.edu>
2734 2005-09-24 Fernando Perez <Fernando.Perez@colorado.edu>
2703
2735
2704 * IPython/demo.py: finish demo module, fully documented now.
2736 * IPython/demo.py: finish demo module, fully documented now.
2705
2737
2706 * IPython/genutils.py (file_read): simple little utility to read a
2738 * IPython/genutils.py (file_read): simple little utility to read a
2707 file and ensure it's closed afterwards.
2739 file and ensure it's closed afterwards.
2708
2740
2709 2005-09-23 Fernando Perez <Fernando.Perez@colorado.edu>
2741 2005-09-23 Fernando Perez <Fernando.Perez@colorado.edu>
2710
2742
2711 * IPython/demo.py (Demo.__init__): added support for individually
2743 * IPython/demo.py (Demo.__init__): added support for individually
2712 tagging blocks for automatic execution.
2744 tagging blocks for automatic execution.
2713
2745
2714 * IPython/Magic.py (magic_pycat): new %pycat magic for showing
2746 * IPython/Magic.py (magic_pycat): new %pycat magic for showing
2715 syntax-highlighted python sources, requested by John.
2747 syntax-highlighted python sources, requested by John.
2716
2748
2717 2005-09-22 Fernando Perez <Fernando.Perez@colorado.edu>
2749 2005-09-22 Fernando Perez <Fernando.Perez@colorado.edu>
2718
2750
2719 * IPython/demo.py (Demo.again): fix bug where again() blocks after
2751 * IPython/demo.py (Demo.again): fix bug where again() blocks after
2720 finishing.
2752 finishing.
2721
2753
2722 * IPython/genutils.py (shlex_split): moved from Magic to here,
2754 * IPython/genutils.py (shlex_split): moved from Magic to here,
2723 where all 2.2 compatibility stuff lives. I needed it for demo.py.
2755 where all 2.2 compatibility stuff lives. I needed it for demo.py.
2724
2756
2725 * IPython/demo.py (Demo.__init__): added support for silent
2757 * IPython/demo.py (Demo.__init__): added support for silent
2726 blocks, improved marks as regexps, docstrings written.
2758 blocks, improved marks as regexps, docstrings written.
2727 (Demo.__init__): better docstring, added support for sys.argv.
2759 (Demo.__init__): better docstring, added support for sys.argv.
2728
2760
2729 * IPython/genutils.py (marquee): little utility used by the demo
2761 * IPython/genutils.py (marquee): little utility used by the demo
2730 code, handy in general.
2762 code, handy in general.
2731
2763
2732 * IPython/demo.py (Demo.__init__): new class for interactive
2764 * IPython/demo.py (Demo.__init__): new class for interactive
2733 demos. Not documented yet, I just wrote it in a hurry for
2765 demos. Not documented yet, I just wrote it in a hurry for
2734 scipy'05. Will docstring later.
2766 scipy'05. Will docstring later.
2735
2767
2736 2005-09-20 Fernando Perez <Fernando.Perez@colorado.edu>
2768 2005-09-20 Fernando Perez <Fernando.Perez@colorado.edu>
2737
2769
2738 * IPython/Shell.py (sigint_handler): Drastic simplification which
2770 * IPython/Shell.py (sigint_handler): Drastic simplification which
2739 also seems to make Ctrl-C work correctly across threads! This is
2771 also seems to make Ctrl-C work correctly across threads! This is
2740 so simple, that I can't beleive I'd missed it before. Needs more
2772 so simple, that I can't beleive I'd missed it before. Needs more
2741 testing, though.
2773 testing, though.
2742 (KBINT): Never mind, revert changes. I'm sure I'd tried something
2774 (KBINT): Never mind, revert changes. I'm sure I'd tried something
2743 like this before...
2775 like this before...
2744
2776
2745 * IPython/genutils.py (get_home_dir): add protection against
2777 * IPython/genutils.py (get_home_dir): add protection against
2746 non-dirs in win32 registry.
2778 non-dirs in win32 registry.
2747
2779
2748 * IPython/iplib.py (InteractiveShell.alias_table_validate): fix
2780 * IPython/iplib.py (InteractiveShell.alias_table_validate): fix
2749 bug where dict was mutated while iterating (pysh crash).
2781 bug where dict was mutated while iterating (pysh crash).
2750
2782
2751 2005-09-06 Fernando Perez <Fernando.Perez@colorado.edu>
2783 2005-09-06 Fernando Perez <Fernando.Perez@colorado.edu>
2752
2784
2753 * IPython/iplib.py (handle_auto): Fix inconsistency arising from
2785 * IPython/iplib.py (handle_auto): Fix inconsistency arising from
2754 spurious newlines added by this routine. After a report by
2786 spurious newlines added by this routine. After a report by
2755 F. Mantegazza.
2787 F. Mantegazza.
2756
2788
2757 2005-09-05 Fernando Perez <Fernando.Perez@colorado.edu>
2789 2005-09-05 Fernando Perez <Fernando.Perez@colorado.edu>
2758
2790
2759 * IPython/Shell.py (hijack_gtk): remove pygtk.require("2.0")
2791 * IPython/Shell.py (hijack_gtk): remove pygtk.require("2.0")
2760 calls. These were a leftover from the GTK 1.x days, and can cause
2792 calls. These were a leftover from the GTK 1.x days, and can cause
2761 problems in certain cases (after a report by John Hunter).
2793 problems in certain cases (after a report by John Hunter).
2762
2794
2763 * IPython/iplib.py (InteractiveShell.__init__): Trap exception if
2795 * IPython/iplib.py (InteractiveShell.__init__): Trap exception if
2764 os.getcwd() fails at init time. Thanks to patch from David Remahl
2796 os.getcwd() fails at init time. Thanks to patch from David Remahl
2765 <chmod007-AT-mac.com>.
2797 <chmod007-AT-mac.com>.
2766 (InteractiveShell.__init__): prevent certain special magics from
2798 (InteractiveShell.__init__): prevent certain special magics from
2767 being shadowed by aliases. Closes
2799 being shadowed by aliases. Closes
2768 http://www.scipy.net/roundup/ipython/issue41.
2800 http://www.scipy.net/roundup/ipython/issue41.
2769
2801
2770 2005-08-31 Fernando Perez <Fernando.Perez@colorado.edu>
2802 2005-08-31 Fernando Perez <Fernando.Perez@colorado.edu>
2771
2803
2772 * IPython/iplib.py (InteractiveShell.complete): Added new
2804 * IPython/iplib.py (InteractiveShell.complete): Added new
2773 top-level completion method to expose the completion mechanism
2805 top-level completion method to expose the completion mechanism
2774 beyond readline-based environments.
2806 beyond readline-based environments.
2775
2807
2776 2005-08-19 Fernando Perez <Fernando.Perez@colorado.edu>
2808 2005-08-19 Fernando Perez <Fernando.Perez@colorado.edu>
2777
2809
2778 * tools/ipsvnc (svnversion): fix svnversion capture.
2810 * tools/ipsvnc (svnversion): fix svnversion capture.
2779
2811
2780 * IPython/iplib.py (InteractiveShell.__init__): Add has_readline
2812 * IPython/iplib.py (InteractiveShell.__init__): Add has_readline
2781 attribute to self, which was missing. Before, it was set by a
2813 attribute to self, which was missing. Before, it was set by a
2782 routine which in certain cases wasn't being called, so the
2814 routine which in certain cases wasn't being called, so the
2783 instance could end up missing the attribute. This caused a crash.
2815 instance could end up missing the attribute. This caused a crash.
2784 Closes http://www.scipy.net/roundup/ipython/issue40.
2816 Closes http://www.scipy.net/roundup/ipython/issue40.
2785
2817
2786 2005-08-16 Fernando Perez <fperez@colorado.edu>
2818 2005-08-16 Fernando Perez <fperez@colorado.edu>
2787
2819
2788 * IPython/ultraTB.py (VerboseTB.text): don't crash if object
2820 * IPython/ultraTB.py (VerboseTB.text): don't crash if object
2789 contains non-string attribute. Closes
2821 contains non-string attribute. Closes
2790 http://www.scipy.net/roundup/ipython/issue38.
2822 http://www.scipy.net/roundup/ipython/issue38.
2791
2823
2792 2005-08-14 Fernando Perez <fperez@colorado.edu>
2824 2005-08-14 Fernando Perez <fperez@colorado.edu>
2793
2825
2794 * tools/ipsvnc: Minor improvements, to add changeset info.
2826 * tools/ipsvnc: Minor improvements, to add changeset info.
2795
2827
2796 2005-08-12 Fernando Perez <fperez@colorado.edu>
2828 2005-08-12 Fernando Perez <fperez@colorado.edu>
2797
2829
2798 * IPython/iplib.py (runsource): remove self.code_to_run_src
2830 * IPython/iplib.py (runsource): remove self.code_to_run_src
2799 attribute. I realized this is nothing more than
2831 attribute. I realized this is nothing more than
2800 '\n'.join(self.buffer), and having the same data in two different
2832 '\n'.join(self.buffer), and having the same data in two different
2801 places is just asking for synchronization bugs. This may impact
2833 places is just asking for synchronization bugs. This may impact
2802 people who have custom exception handlers, so I need to warn
2834 people who have custom exception handlers, so I need to warn
2803 ipython-dev about it (F. Mantegazza may use them).
2835 ipython-dev about it (F. Mantegazza may use them).
2804
2836
2805 2005-07-29 Fernando Perez <Fernando.Perez@colorado.edu>
2837 2005-07-29 Fernando Perez <Fernando.Perez@colorado.edu>
2806
2838
2807 * IPython/genutils.py: fix 2.2 compatibility (generators)
2839 * IPython/genutils.py: fix 2.2 compatibility (generators)
2808
2840
2809 2005-07-18 Fernando Perez <fperez@colorado.edu>
2841 2005-07-18 Fernando Perez <fperez@colorado.edu>
2810
2842
2811 * IPython/genutils.py (get_home_dir): fix to help users with
2843 * IPython/genutils.py (get_home_dir): fix to help users with
2812 invalid $HOME under win32.
2844 invalid $HOME under win32.
2813
2845
2814 2005-07-17 Fernando Perez <fperez@colorado.edu>
2846 2005-07-17 Fernando Perez <fperez@colorado.edu>
2815
2847
2816 * IPython/Prompts.py (str_safe): Make unicode-safe. Also remove
2848 * IPython/Prompts.py (str_safe): Make unicode-safe. Also remove
2817 some old hacks and clean up a bit other routines; code should be
2849 some old hacks and clean up a bit other routines; code should be
2818 simpler and a bit faster.
2850 simpler and a bit faster.
2819
2851
2820 * IPython/iplib.py (interact): removed some last-resort attempts
2852 * IPython/iplib.py (interact): removed some last-resort attempts
2821 to survive broken stdout/stderr. That code was only making it
2853 to survive broken stdout/stderr. That code was only making it
2822 harder to abstract out the i/o (necessary for gui integration),
2854 harder to abstract out the i/o (necessary for gui integration),
2823 and the crashes it could prevent were extremely rare in practice
2855 and the crashes it could prevent were extremely rare in practice
2824 (besides being fully user-induced in a pretty violent manner).
2856 (besides being fully user-induced in a pretty violent manner).
2825
2857
2826 * IPython/genutils.py (IOStream.__init__): Simplify the i/o stuff.
2858 * IPython/genutils.py (IOStream.__init__): Simplify the i/o stuff.
2827 Nothing major yet, but the code is simpler to read; this should
2859 Nothing major yet, but the code is simpler to read; this should
2828 make it easier to do more serious modifications in the future.
2860 make it easier to do more serious modifications in the future.
2829
2861
2830 * IPython/Extensions/InterpreterExec.py: Fix auto-quoting in pysh,
2862 * IPython/Extensions/InterpreterExec.py: Fix auto-quoting in pysh,
2831 which broke in .15 (thanks to a report by Ville).
2863 which broke in .15 (thanks to a report by Ville).
2832
2864
2833 * IPython/Itpl.py (Itpl.__init__): add unicode support (it may not
2865 * IPython/Itpl.py (Itpl.__init__): add unicode support (it may not
2834 be quite correct, I know next to nothing about unicode). This
2866 be quite correct, I know next to nothing about unicode). This
2835 will allow unicode strings to be used in prompts, amongst other
2867 will allow unicode strings to be used in prompts, amongst other
2836 cases. It also will prevent ipython from crashing when unicode
2868 cases. It also will prevent ipython from crashing when unicode
2837 shows up unexpectedly in many places. If ascii encoding fails, we
2869 shows up unexpectedly in many places. If ascii encoding fails, we
2838 assume utf_8. Currently the encoding is not a user-visible
2870 assume utf_8. Currently the encoding is not a user-visible
2839 setting, though it could be made so if there is demand for it.
2871 setting, though it could be made so if there is demand for it.
2840
2872
2841 * IPython/ipmaker.py (make_IPython): remove old 2.1-specific hack.
2873 * IPython/ipmaker.py (make_IPython): remove old 2.1-specific hack.
2842
2874
2843 * IPython/Struct.py (Struct.merge): switch keys() to iterator.
2875 * IPython/Struct.py (Struct.merge): switch keys() to iterator.
2844
2876
2845 * IPython/background_jobs.py: moved 2.2 compatibility to genutils.
2877 * IPython/background_jobs.py: moved 2.2 compatibility to genutils.
2846
2878
2847 * IPython/genutils.py: Add 2.2 compatibility here, so all other
2879 * IPython/genutils.py: Add 2.2 compatibility here, so all other
2848 code can work transparently for 2.2/2.3.
2880 code can work transparently for 2.2/2.3.
2849
2881
2850 2005-07-16 Fernando Perez <fperez@colorado.edu>
2882 2005-07-16 Fernando Perez <fperez@colorado.edu>
2851
2883
2852 * IPython/ultraTB.py (ExceptionColors): Make a global variable
2884 * IPython/ultraTB.py (ExceptionColors): Make a global variable
2853 out of the color scheme table used for coloring exception
2885 out of the color scheme table used for coloring exception
2854 tracebacks. This allows user code to add new schemes at runtime.
2886 tracebacks. This allows user code to add new schemes at runtime.
2855 This is a minimally modified version of the patch at
2887 This is a minimally modified version of the patch at
2856 http://www.scipy.net/roundup/ipython/issue35, many thanks to pabw
2888 http://www.scipy.net/roundup/ipython/issue35, many thanks to pabw
2857 for the contribution.
2889 for the contribution.
2858
2890
2859 * IPython/FlexCompleter.py (Completer.attr_matches): Add a
2891 * IPython/FlexCompleter.py (Completer.attr_matches): Add a
2860 slightly modified version of the patch in
2892 slightly modified version of the patch in
2861 http://www.scipy.net/roundup/ipython/issue34, which also allows me
2893 http://www.scipy.net/roundup/ipython/issue34, which also allows me
2862 to remove the previous try/except solution (which was costlier).
2894 to remove the previous try/except solution (which was costlier).
2863 Thanks to Gaetan Lehmann <gaetan.lehmann-AT-jouy.inra.fr> for the fix.
2895 Thanks to Gaetan Lehmann <gaetan.lehmann-AT-jouy.inra.fr> for the fix.
2864
2896
2865 2005-06-08 Fernando Perez <fperez@colorado.edu>
2897 2005-06-08 Fernando Perez <fperez@colorado.edu>
2866
2898
2867 * IPython/iplib.py (write/write_err): Add methods to abstract all
2899 * IPython/iplib.py (write/write_err): Add methods to abstract all
2868 I/O a bit more.
2900 I/O a bit more.
2869
2901
2870 * IPython/Shell.py (IPShellGTK.mainloop): Fix GTK deprecation
2902 * IPython/Shell.py (IPShellGTK.mainloop): Fix GTK deprecation
2871 warning, reported by Aric Hagberg, fix by JD Hunter.
2903 warning, reported by Aric Hagberg, fix by JD Hunter.
2872
2904
2873 2005-06-02 *** Released version 0.6.15
2905 2005-06-02 *** Released version 0.6.15
2874
2906
2875 2005-06-01 Fernando Perez <fperez@colorado.edu>
2907 2005-06-01 Fernando Perez <fperez@colorado.edu>
2876
2908
2877 * IPython/iplib.py (MagicCompleter.file_matches): Fix
2909 * IPython/iplib.py (MagicCompleter.file_matches): Fix
2878 tab-completion of filenames within open-quoted strings. Note that
2910 tab-completion of filenames within open-quoted strings. Note that
2879 this requires that in ~/.ipython/ipythonrc, users change the
2911 this requires that in ~/.ipython/ipythonrc, users change the
2880 readline delimiters configuration to read:
2912 readline delimiters configuration to read:
2881
2913
2882 readline_remove_delims -/~
2914 readline_remove_delims -/~
2883
2915
2884
2916
2885 2005-05-31 *** Released version 0.6.14
2917 2005-05-31 *** Released version 0.6.14
2886
2918
2887 2005-05-29 Fernando Perez <fperez@colorado.edu>
2919 2005-05-29 Fernando Perez <fperez@colorado.edu>
2888
2920
2889 * IPython/ultraTB.py (VerboseTB.text): Fix crash for tracebacks
2921 * IPython/ultraTB.py (VerboseTB.text): Fix crash for tracebacks
2890 with files not on the filesystem. Reported by Eliyahu Sandler
2922 with files not on the filesystem. Reported by Eliyahu Sandler
2891 <eli@gondolin.net>
2923 <eli@gondolin.net>
2892
2924
2893 2005-05-22 Fernando Perez <fperez@colorado.edu>
2925 2005-05-22 Fernando Perez <fperez@colorado.edu>
2894
2926
2895 * IPython/iplib.py: Fix a few crashes in the --upgrade option.
2927 * IPython/iplib.py: Fix a few crashes in the --upgrade option.
2896 After an initial report by LUK ShunTim <shuntim.luk@polyu.edu.hk>.
2928 After an initial report by LUK ShunTim <shuntim.luk@polyu.edu.hk>.
2897
2929
2898 2005-05-19 Fernando Perez <fperez@colorado.edu>
2930 2005-05-19 Fernando Perez <fperez@colorado.edu>
2899
2931
2900 * IPython/iplib.py (safe_execfile): close a file which could be
2932 * IPython/iplib.py (safe_execfile): close a file which could be
2901 left open (causing problems in win32, which locks open files).
2933 left open (causing problems in win32, which locks open files).
2902 Thanks to a bug report by D Brown <dbrown2@yahoo.com>.
2934 Thanks to a bug report by D Brown <dbrown2@yahoo.com>.
2903
2935
2904 2005-05-18 Fernando Perez <fperez@colorado.edu>
2936 2005-05-18 Fernando Perez <fperez@colorado.edu>
2905
2937
2906 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): pass all
2938 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): pass all
2907 keyword arguments correctly to safe_execfile().
2939 keyword arguments correctly to safe_execfile().
2908
2940
2909 2005-05-13 Fernando Perez <fperez@colorado.edu>
2941 2005-05-13 Fernando Perez <fperez@colorado.edu>
2910
2942
2911 * ipython.1: Added info about Qt to manpage, and threads warning
2943 * ipython.1: Added info about Qt to manpage, and threads warning
2912 to usage page (invoked with --help).
2944 to usage page (invoked with --help).
2913
2945
2914 * IPython/iplib.py (MagicCompleter.python_func_kw_matches): Added
2946 * IPython/iplib.py (MagicCompleter.python_func_kw_matches): Added
2915 new matcher (it goes at the end of the priority list) to do
2947 new matcher (it goes at the end of the priority list) to do
2916 tab-completion on named function arguments. Submitted by George
2948 tab-completion on named function arguments. Submitted by George
2917 Sakkis <gsakkis-AT-eden.rutgers.edu>. See the thread at
2949 Sakkis <gsakkis-AT-eden.rutgers.edu>. See the thread at
2918 http://www.scipy.net/pipermail/ipython-dev/2005-April/000436.html
2950 http://www.scipy.net/pipermail/ipython-dev/2005-April/000436.html
2919 for more details.
2951 for more details.
2920
2952
2921 * IPython/Magic.py (magic_run): Added new -e flag to ignore
2953 * IPython/Magic.py (magic_run): Added new -e flag to ignore
2922 SystemExit exceptions in the script being run. Thanks to a report
2954 SystemExit exceptions in the script being run. Thanks to a report
2923 by danny shevitz <danny_shevitz-AT-yahoo.com>, about this
2955 by danny shevitz <danny_shevitz-AT-yahoo.com>, about this
2924 producing very annoying behavior when running unit tests.
2956 producing very annoying behavior when running unit tests.
2925
2957
2926 2005-05-12 Fernando Perez <fperez@colorado.edu>
2958 2005-05-12 Fernando Perez <fperez@colorado.edu>
2927
2959
2928 * IPython/iplib.py (handle_auto): fixed auto-quoting and parens,
2960 * IPython/iplib.py (handle_auto): fixed auto-quoting and parens,
2929 which I'd broken (again) due to a changed regexp. In the process,
2961 which I'd broken (again) due to a changed regexp. In the process,
2930 added ';' as an escape to auto-quote the whole line without
2962 added ';' as an escape to auto-quote the whole line without
2931 splitting its arguments. Thanks to a report by Jerry McRae
2963 splitting its arguments. Thanks to a report by Jerry McRae
2932 <qrs0xyc02-AT-sneakemail.com>.
2964 <qrs0xyc02-AT-sneakemail.com>.
2933
2965
2934 * IPython/ultraTB.py (VerboseTB.text): protect against rare but
2966 * IPython/ultraTB.py (VerboseTB.text): protect against rare but
2935 possible crashes caused by a TokenError. Reported by Ed Schofield
2967 possible crashes caused by a TokenError. Reported by Ed Schofield
2936 <schofield-AT-ftw.at>.
2968 <schofield-AT-ftw.at>.
2937
2969
2938 2005-05-06 Fernando Perez <fperez@colorado.edu>
2970 2005-05-06 Fernando Perez <fperez@colorado.edu>
2939
2971
2940 * IPython/Shell.py (hijack_wx): Fix to work with WX v.2.6.
2972 * IPython/Shell.py (hijack_wx): Fix to work with WX v.2.6.
2941
2973
2942 2005-04-29 Fernando Perez <fperez@colorado.edu>
2974 2005-04-29 Fernando Perez <fperez@colorado.edu>
2943
2975
2944 * IPython/Shell.py (IPShellQt): Thanks to Denis Rivière
2976 * IPython/Shell.py (IPShellQt): Thanks to Denis Rivière
2945 <nudz-AT-free.fr>, Yann Cointepas <yann-AT-sapetnioc.org> and Benjamin
2977 <nudz-AT-free.fr>, Yann Cointepas <yann-AT-sapetnioc.org> and Benjamin
2946 Thyreau <Benji2-AT-decideur.info>, we now have a -qthread option
2978 Thyreau <Benji2-AT-decideur.info>, we now have a -qthread option
2947 which provides support for Qt interactive usage (similar to the
2979 which provides support for Qt interactive usage (similar to the
2948 existing one for WX and GTK). This had been often requested.
2980 existing one for WX and GTK). This had been often requested.
2949
2981
2950 2005-04-14 *** Released version 0.6.13
2982 2005-04-14 *** Released version 0.6.13
2951
2983
2952 2005-04-08 Fernando Perez <fperez@colorado.edu>
2984 2005-04-08 Fernando Perez <fperez@colorado.edu>
2953
2985
2954 * IPython/Magic.py (Magic._ofind): remove docstring evaluation
2986 * IPython/Magic.py (Magic._ofind): remove docstring evaluation
2955 from _ofind, which gets called on almost every input line. Now,
2987 from _ofind, which gets called on almost every input line. Now,
2956 we only try to get docstrings if they are actually going to be
2988 we only try to get docstrings if they are actually going to be
2957 used (the overhead of fetching unnecessary docstrings can be
2989 used (the overhead of fetching unnecessary docstrings can be
2958 noticeable for certain objects, such as Pyro proxies).
2990 noticeable for certain objects, such as Pyro proxies).
2959
2991
2960 * IPython/iplib.py (MagicCompleter.python_matches): Change the API
2992 * IPython/iplib.py (MagicCompleter.python_matches): Change the API
2961 for completers. For some reason I had been passing them the state
2993 for completers. For some reason I had been passing them the state
2962 variable, which completers never actually need, and was in
2994 variable, which completers never actually need, and was in
2963 conflict with the rlcompleter API. Custom completers ONLY need to
2995 conflict with the rlcompleter API. Custom completers ONLY need to
2964 take the text parameter.
2996 take the text parameter.
2965
2997
2966 * IPython/Extensions/InterpreterExec.py: Fix regexp so that magics
2998 * IPython/Extensions/InterpreterExec.py: Fix regexp so that magics
2967 work correctly in pysh. I've also moved all the logic which used
2999 work correctly in pysh. I've also moved all the logic which used
2968 to be in pysh.py here, which will prevent problems with future
3000 to be in pysh.py here, which will prevent problems with future
2969 upgrades. However, this time I must warn users to update their
3001 upgrades. However, this time I must warn users to update their
2970 pysh profile to include the line
3002 pysh profile to include the line
2971
3003
2972 import_all IPython.Extensions.InterpreterExec
3004 import_all IPython.Extensions.InterpreterExec
2973
3005
2974 because otherwise things won't work for them. They MUST also
3006 because otherwise things won't work for them. They MUST also
2975 delete pysh.py and the line
3007 delete pysh.py and the line
2976
3008
2977 execfile pysh.py
3009 execfile pysh.py
2978
3010
2979 from their ipythonrc-pysh.
3011 from their ipythonrc-pysh.
2980
3012
2981 * IPython/FlexCompleter.py (Completer.attr_matches): Make more
3013 * IPython/FlexCompleter.py (Completer.attr_matches): Make more
2982 robust in the face of objects whose dir() returns non-strings
3014 robust in the face of objects whose dir() returns non-strings
2983 (which it shouldn't, but some broken libs like ITK do). Thanks to
3015 (which it shouldn't, but some broken libs like ITK do). Thanks to
2984 a patch by John Hunter (implemented differently, though). Also
3016 a patch by John Hunter (implemented differently, though). Also
2985 minor improvements by using .extend instead of + on lists.
3017 minor improvements by using .extend instead of + on lists.
2986
3018
2987 * pysh.py:
3019 * pysh.py:
2988
3020
2989 2005-04-06 Fernando Perez <fperez@colorado.edu>
3021 2005-04-06 Fernando Perez <fperez@colorado.edu>
2990
3022
2991 * IPython/ipmaker.py (make_IPython): Make multi_line_specials on
3023 * IPython/ipmaker.py (make_IPython): Make multi_line_specials on
2992 by default, so that all users benefit from it. Those who don't
3024 by default, so that all users benefit from it. Those who don't
2993 want it can still turn it off.
3025 want it can still turn it off.
2994
3026
2995 * IPython/UserConfig/ipythonrc: Add multi_line_specials to the
3027 * IPython/UserConfig/ipythonrc: Add multi_line_specials to the
2996 config file, I'd forgotten about this, so users were getting it
3028 config file, I'd forgotten about this, so users were getting it
2997 off by default.
3029 off by default.
2998
3030
2999 * IPython/iplib.py (ipmagic): big overhaul of the magic system for
3031 * IPython/iplib.py (ipmagic): big overhaul of the magic system for
3000 consistency. Now magics can be called in multiline statements,
3032 consistency. Now magics can be called in multiline statements,
3001 and python variables can be expanded in magic calls via $var.
3033 and python variables can be expanded in magic calls via $var.
3002 This makes the magic system behave just like aliases or !system
3034 This makes the magic system behave just like aliases or !system
3003 calls.
3035 calls.
3004
3036
3005 2005-03-28 Fernando Perez <fperez@colorado.edu>
3037 2005-03-28 Fernando Perez <fperez@colorado.edu>
3006
3038
3007 * IPython/iplib.py (handle_auto): cleanup to use %s instead of
3039 * IPython/iplib.py (handle_auto): cleanup to use %s instead of
3008 expensive string additions for building command. Add support for
3040 expensive string additions for building command. Add support for
3009 trailing ';' when autocall is used.
3041 trailing ';' when autocall is used.
3010
3042
3011 2005-03-26 Fernando Perez <fperez@colorado.edu>
3043 2005-03-26 Fernando Perez <fperez@colorado.edu>
3012
3044
3013 * ipython.el: Fix http://www.scipy.net/roundup/ipython/issue31.
3045 * ipython.el: Fix http://www.scipy.net/roundup/ipython/issue31.
3014 Bugfix by A. Schmolck, the ipython.el maintainer. Also make
3046 Bugfix by A. Schmolck, the ipython.el maintainer. Also make
3015 ipython.el robust against prompts with any number of spaces
3047 ipython.el robust against prompts with any number of spaces
3016 (including 0) after the ':' character.
3048 (including 0) after the ':' character.
3017
3049
3018 * IPython/Prompts.py (Prompt2.set_p_str): Fix spurious space in
3050 * IPython/Prompts.py (Prompt2.set_p_str): Fix spurious space in
3019 continuation prompt, which misled users to think the line was
3051 continuation prompt, which misled users to think the line was
3020 already indented. Closes debian Bug#300847, reported to me by
3052 already indented. Closes debian Bug#300847, reported to me by
3021 Norbert Tretkowski <tretkowski-AT-inittab.de>.
3053 Norbert Tretkowski <tretkowski-AT-inittab.de>.
3022
3054
3023 2005-03-23 Fernando Perez <fperez@colorado.edu>
3055 2005-03-23 Fernando Perez <fperez@colorado.edu>
3024
3056
3025 * IPython/Prompts.py (Prompt1.__str__): Make sure that prompts are
3057 * IPython/Prompts.py (Prompt1.__str__): Make sure that prompts are
3026 properly aligned if they have embedded newlines.
3058 properly aligned if they have embedded newlines.
3027
3059
3028 * IPython/iplib.py (runlines): Add a public method to expose
3060 * IPython/iplib.py (runlines): Add a public method to expose
3029 IPython's code execution machinery, so that users can run strings
3061 IPython's code execution machinery, so that users can run strings
3030 as if they had been typed at the prompt interactively.
3062 as if they had been typed at the prompt interactively.
3031 (InteractiveShell.__init__): Added getoutput() to the __IPYTHON__
3063 (InteractiveShell.__init__): Added getoutput() to the __IPYTHON__
3032 methods which can call the system shell, but with python variable
3064 methods which can call the system shell, but with python variable
3033 expansion. The three such methods are: __IPYTHON__.system,
3065 expansion. The three such methods are: __IPYTHON__.system,
3034 .getoutput and .getoutputerror. These need to be documented in a
3066 .getoutput and .getoutputerror. These need to be documented in a
3035 'public API' section (to be written) of the manual.
3067 'public API' section (to be written) of the manual.
3036
3068
3037 2005-03-20 Fernando Perez <fperez@colorado.edu>
3069 2005-03-20 Fernando Perez <fperez@colorado.edu>
3038
3070
3039 * IPython/iplib.py (InteractiveShell.set_custom_exc): new system
3071 * IPython/iplib.py (InteractiveShell.set_custom_exc): new system
3040 for custom exception handling. This is quite powerful, and it
3072 for custom exception handling. This is quite powerful, and it
3041 allows for user-installable exception handlers which can trap
3073 allows for user-installable exception handlers which can trap
3042 custom exceptions at runtime and treat them separately from
3074 custom exceptions at runtime and treat them separately from
3043 IPython's default mechanisms. At the request of FrΓ©dΓ©ric
3075 IPython's default mechanisms. At the request of FrΓ©dΓ©ric
3044 Mantegazza <mantegazza-AT-ill.fr>.
3076 Mantegazza <mantegazza-AT-ill.fr>.
3045 (InteractiveShell.set_custom_completer): public API function to
3077 (InteractiveShell.set_custom_completer): public API function to
3046 add new completers at runtime.
3078 add new completers at runtime.
3047
3079
3048 2005-03-19 Fernando Perez <fperez@colorado.edu>
3080 2005-03-19 Fernando Perez <fperez@colorado.edu>
3049
3081
3050 * IPython/OInspect.py (getdoc): Add a call to obj.getdoc(), to
3082 * IPython/OInspect.py (getdoc): Add a call to obj.getdoc(), to
3051 allow objects which provide their docstrings via non-standard
3083 allow objects which provide their docstrings via non-standard
3052 mechanisms (like Pyro proxies) to still be inspected by ipython's
3084 mechanisms (like Pyro proxies) to still be inspected by ipython's
3053 ? system.
3085 ? system.
3054
3086
3055 * IPython/iplib.py (InteractiveShell.__init__): back off the _o/_e
3087 * IPython/iplib.py (InteractiveShell.__init__): back off the _o/_e
3056 automatic capture system. I tried quite hard to make it work
3088 automatic capture system. I tried quite hard to make it work
3057 reliably, and simply failed. I tried many combinations with the
3089 reliably, and simply failed. I tried many combinations with the
3058 subprocess module, but eventually nothing worked in all needed
3090 subprocess module, but eventually nothing worked in all needed
3059 cases (not blocking stdin for the child, duplicating stdout
3091 cases (not blocking stdin for the child, duplicating stdout
3060 without blocking, etc). The new %sc/%sx still do capture to these
3092 without blocking, etc). The new %sc/%sx still do capture to these
3061 magical list/string objects which make shell use much more
3093 magical list/string objects which make shell use much more
3062 conveninent, so not all is lost.
3094 conveninent, so not all is lost.
3063
3095
3064 XXX - FIX MANUAL for the change above!
3096 XXX - FIX MANUAL for the change above!
3065
3097
3066 (runsource): I copied code.py's runsource() into ipython to modify
3098 (runsource): I copied code.py's runsource() into ipython to modify
3067 it a bit. Now the code object and source to be executed are
3099 it a bit. Now the code object and source to be executed are
3068 stored in ipython. This makes this info accessible to third-party
3100 stored in ipython. This makes this info accessible to third-party
3069 tools, like custom exception handlers. After a request by FrΓ©dΓ©ric
3101 tools, like custom exception handlers. After a request by FrΓ©dΓ©ric
3070 Mantegazza <mantegazza-AT-ill.fr>.
3102 Mantegazza <mantegazza-AT-ill.fr>.
3071
3103
3072 * IPython/UserConfig/ipythonrc: Add up/down arrow keys to
3104 * IPython/UserConfig/ipythonrc: Add up/down arrow keys to
3073 history-search via readline (like C-p/C-n). I'd wanted this for a
3105 history-search via readline (like C-p/C-n). I'd wanted this for a
3074 long time, but only recently found out how to do it. For users
3106 long time, but only recently found out how to do it. For users
3075 who already have their ipythonrc files made and want this, just
3107 who already have their ipythonrc files made and want this, just
3076 add:
3108 add:
3077
3109
3078 readline_parse_and_bind "\e[A": history-search-backward
3110 readline_parse_and_bind "\e[A": history-search-backward
3079 readline_parse_and_bind "\e[B": history-search-forward
3111 readline_parse_and_bind "\e[B": history-search-forward
3080
3112
3081 2005-03-18 Fernando Perez <fperez@colorado.edu>
3113 2005-03-18 Fernando Perez <fperez@colorado.edu>
3082
3114
3083 * IPython/Magic.py (magic_sc): %sc and %sx now use the fancy
3115 * IPython/Magic.py (magic_sc): %sc and %sx now use the fancy
3084 LSString and SList classes which allow transparent conversions
3116 LSString and SList classes which allow transparent conversions
3085 between list mode and whitespace-separated string.
3117 between list mode and whitespace-separated string.
3086 (magic_r): Fix recursion problem in %r.
3118 (magic_r): Fix recursion problem in %r.
3087
3119
3088 * IPython/genutils.py (LSString): New class to be used for
3120 * IPython/genutils.py (LSString): New class to be used for
3089 automatic storage of the results of all alias/system calls in _o
3121 automatic storage of the results of all alias/system calls in _o
3090 and _e (stdout/err). These provide a .l/.list attribute which
3122 and _e (stdout/err). These provide a .l/.list attribute which
3091 does automatic splitting on newlines. This means that for most
3123 does automatic splitting on newlines. This means that for most
3092 uses, you'll never need to do capturing of output with %sc/%sx
3124 uses, you'll never need to do capturing of output with %sc/%sx
3093 anymore, since ipython keeps this always done for you. Note that
3125 anymore, since ipython keeps this always done for you. Note that
3094 only the LAST results are stored, the _o/e variables are
3126 only the LAST results are stored, the _o/e variables are
3095 overwritten on each call. If you need to save their contents
3127 overwritten on each call. If you need to save their contents
3096 further, simply bind them to any other name.
3128 further, simply bind them to any other name.
3097
3129
3098 2005-03-17 Fernando Perez <fperez@colorado.edu>
3130 2005-03-17 Fernando Perez <fperez@colorado.edu>
3099
3131
3100 * IPython/Prompts.py (BasePrompt.cwd_filt): a few more fixes for
3132 * IPython/Prompts.py (BasePrompt.cwd_filt): a few more fixes for
3101 prompt namespace handling.
3133 prompt namespace handling.
3102
3134
3103 2005-03-16 Fernando Perez <fperez@colorado.edu>
3135 2005-03-16 Fernando Perez <fperez@colorado.edu>
3104
3136
3105 * IPython/Prompts.py (CachedOutput.__init__): Fix default and
3137 * IPython/Prompts.py (CachedOutput.__init__): Fix default and
3106 classic prompts to be '>>> ' (final space was missing, and it
3138 classic prompts to be '>>> ' (final space was missing, and it
3107 trips the emacs python mode).
3139 trips the emacs python mode).
3108 (BasePrompt.__str__): Added safe support for dynamic prompt
3140 (BasePrompt.__str__): Added safe support for dynamic prompt
3109 strings. Now you can set your prompt string to be '$x', and the
3141 strings. Now you can set your prompt string to be '$x', and the
3110 value of x will be printed from your interactive namespace. The
3142 value of x will be printed from your interactive namespace. The
3111 interpolation syntax includes the full Itpl support, so
3143 interpolation syntax includes the full Itpl support, so
3112 ${foo()+x+bar()} is a valid prompt string now, and the function
3144 ${foo()+x+bar()} is a valid prompt string now, and the function
3113 calls will be made at runtime.
3145 calls will be made at runtime.
3114
3146
3115 2005-03-15 Fernando Perez <fperez@colorado.edu>
3147 2005-03-15 Fernando Perez <fperez@colorado.edu>
3116
3148
3117 * IPython/Magic.py (magic_history): renamed %hist to %history, to
3149 * IPython/Magic.py (magic_history): renamed %hist to %history, to
3118 avoid name clashes in pylab. %hist still works, it just forwards
3150 avoid name clashes in pylab. %hist still works, it just forwards
3119 the call to %history.
3151 the call to %history.
3120
3152
3121 2005-03-02 *** Released version 0.6.12
3153 2005-03-02 *** Released version 0.6.12
3122
3154
3123 2005-03-02 Fernando Perez <fperez@colorado.edu>
3155 2005-03-02 Fernando Perez <fperez@colorado.edu>
3124
3156
3125 * IPython/iplib.py (handle_magic): log magic calls properly as
3157 * IPython/iplib.py (handle_magic): log magic calls properly as
3126 ipmagic() function calls.
3158 ipmagic() function calls.
3127
3159
3128 * IPython/Magic.py (magic_time): Improved %time to support
3160 * IPython/Magic.py (magic_time): Improved %time to support
3129 statements and provide wall-clock as well as CPU time.
3161 statements and provide wall-clock as well as CPU time.
3130
3162
3131 2005-02-27 Fernando Perez <fperez@colorado.edu>
3163 2005-02-27 Fernando Perez <fperez@colorado.edu>
3132
3164
3133 * IPython/hooks.py: New hooks module, to expose user-modifiable
3165 * IPython/hooks.py: New hooks module, to expose user-modifiable
3134 IPython functionality in a clean manner. For now only the editor
3166 IPython functionality in a clean manner. For now only the editor
3135 hook is actually written, and other thigns which I intend to turn
3167 hook is actually written, and other thigns which I intend to turn
3136 into proper hooks aren't yet there. The display and prefilter
3168 into proper hooks aren't yet there. The display and prefilter
3137 stuff, for example, should be hooks. But at least now the
3169 stuff, for example, should be hooks. But at least now the
3138 framework is in place, and the rest can be moved here with more
3170 framework is in place, and the rest can be moved here with more
3139 time later. IPython had had a .hooks variable for a long time for
3171 time later. IPython had had a .hooks variable for a long time for
3140 this purpose, but I'd never actually used it for anything.
3172 this purpose, but I'd never actually used it for anything.
3141
3173
3142 2005-02-26 Fernando Perez <fperez@colorado.edu>
3174 2005-02-26 Fernando Perez <fperez@colorado.edu>
3143
3175
3144 * IPython/ipmaker.py (make_IPython): make the default ipython
3176 * IPython/ipmaker.py (make_IPython): make the default ipython
3145 directory be called _ipython under win32, to follow more the
3177 directory be called _ipython under win32, to follow more the
3146 naming peculiarities of that platform (where buggy software like
3178 naming peculiarities of that platform (where buggy software like
3147 Visual Sourcesafe breaks with .named directories). Reported by
3179 Visual Sourcesafe breaks with .named directories). Reported by
3148 Ville Vainio.
3180 Ville Vainio.
3149
3181
3150 2005-02-23 Fernando Perez <fperez@colorado.edu>
3182 2005-02-23 Fernando Perez <fperez@colorado.edu>
3151
3183
3152 * IPython/iplib.py (InteractiveShell.__init__): removed a few
3184 * IPython/iplib.py (InteractiveShell.__init__): removed a few
3153 auto_aliases for win32 which were causing problems. Users can
3185 auto_aliases for win32 which were causing problems. Users can
3154 define the ones they personally like.
3186 define the ones they personally like.
3155
3187
3156 2005-02-21 Fernando Perez <fperez@colorado.edu>
3188 2005-02-21 Fernando Perez <fperez@colorado.edu>
3157
3189
3158 * IPython/Magic.py (magic_time): new magic to time execution of
3190 * IPython/Magic.py (magic_time): new magic to time execution of
3159 expressions. After a request by Charles Moad <cmoad-AT-indiana.edu>.
3191 expressions. After a request by Charles Moad <cmoad-AT-indiana.edu>.
3160
3192
3161 2005-02-19 Fernando Perez <fperez@colorado.edu>
3193 2005-02-19 Fernando Perez <fperez@colorado.edu>
3162
3194
3163 * IPython/ConfigLoader.py (ConfigLoader.load): Allow empty strings
3195 * IPython/ConfigLoader.py (ConfigLoader.load): Allow empty strings
3164 into keys (for prompts, for example).
3196 into keys (for prompts, for example).
3165
3197
3166 * IPython/Prompts.py (BasePrompt.set_p_str): Fix to allow empty
3198 * IPython/Prompts.py (BasePrompt.set_p_str): Fix to allow empty
3167 prompts in case users want them. This introduces a small behavior
3199 prompts in case users want them. This introduces a small behavior
3168 change: ipython does not automatically add a space to all prompts
3200 change: ipython does not automatically add a space to all prompts
3169 anymore. To get the old prompts with a space, users should add it
3201 anymore. To get the old prompts with a space, users should add it
3170 manually to their ipythonrc file, so for example prompt_in1 should
3202 manually to their ipythonrc file, so for example prompt_in1 should
3171 now read 'In [\#]: ' instead of 'In [\#]:'.
3203 now read 'In [\#]: ' instead of 'In [\#]:'.
3172 (BasePrompt.__init__): New option prompts_pad_left (only in rc
3204 (BasePrompt.__init__): New option prompts_pad_left (only in rc
3173 file) to control left-padding of secondary prompts.
3205 file) to control left-padding of secondary prompts.
3174
3206
3175 * IPython/Magic.py (Magic.profile_missing_notice): Don't crash if
3207 * IPython/Magic.py (Magic.profile_missing_notice): Don't crash if
3176 the profiler can't be imported. Fix for Debian, which removed
3208 the profiler can't be imported. Fix for Debian, which removed
3177 profile.py because of License issues. I applied a slightly
3209 profile.py because of License issues. I applied a slightly
3178 modified version of the original Debian patch at
3210 modified version of the original Debian patch at
3179 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=294500.
3211 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=294500.
3180
3212
3181 2005-02-17 Fernando Perez <fperez@colorado.edu>
3213 2005-02-17 Fernando Perez <fperez@colorado.edu>
3182
3214
3183 * IPython/genutils.py (native_line_ends): Fix bug which would
3215 * IPython/genutils.py (native_line_ends): Fix bug which would
3184 cause improper line-ends under win32 b/c I was not opening files
3216 cause improper line-ends under win32 b/c I was not opening files
3185 in binary mode. Bug report and fix thanks to Ville.
3217 in binary mode. Bug report and fix thanks to Ville.
3186
3218
3187 * IPython/iplib.py (handle_auto): Fix bug which I introduced when
3219 * IPython/iplib.py (handle_auto): Fix bug which I introduced when
3188 trying to catch spurious foo[1] autocalls. My fix actually broke
3220 trying to catch spurious foo[1] autocalls. My fix actually broke
3189 ',/' autoquote/call with explicit escape (bad regexp).
3221 ',/' autoquote/call with explicit escape (bad regexp).
3190
3222
3191 2005-02-15 *** Released version 0.6.11
3223 2005-02-15 *** Released version 0.6.11
3192
3224
3193 2005-02-14 Fernando Perez <fperez@colorado.edu>
3225 2005-02-14 Fernando Perez <fperez@colorado.edu>
3194
3226
3195 * IPython/background_jobs.py: New background job management
3227 * IPython/background_jobs.py: New background job management
3196 subsystem. This is implemented via a new set of classes, and
3228 subsystem. This is implemented via a new set of classes, and
3197 IPython now provides a builtin 'jobs' object for background job
3229 IPython now provides a builtin 'jobs' object for background job
3198 execution. A convenience %bg magic serves as a lightweight
3230 execution. A convenience %bg magic serves as a lightweight
3199 frontend for starting the more common type of calls. This was
3231 frontend for starting the more common type of calls. This was
3200 inspired by discussions with B. Granger and the BackgroundCommand
3232 inspired by discussions with B. Granger and the BackgroundCommand
3201 class described in the book Python Scripting for Computational
3233 class described in the book Python Scripting for Computational
3202 Science, by H. P. Langtangen: http://folk.uio.no/hpl/scripting
3234 Science, by H. P. Langtangen: http://folk.uio.no/hpl/scripting
3203 (although ultimately no code from this text was used, as IPython's
3235 (although ultimately no code from this text was used, as IPython's
3204 system is a separate implementation).
3236 system is a separate implementation).
3205
3237
3206 * IPython/iplib.py (MagicCompleter.python_matches): add new option
3238 * IPython/iplib.py (MagicCompleter.python_matches): add new option
3207 to control the completion of single/double underscore names
3239 to control the completion of single/double underscore names
3208 separately. As documented in the example ipytonrc file, the
3240 separately. As documented in the example ipytonrc file, the
3209 readline_omit__names variable can now be set to 2, to omit even
3241 readline_omit__names variable can now be set to 2, to omit even
3210 single underscore names. Thanks to a patch by Brian Wong
3242 single underscore names. Thanks to a patch by Brian Wong
3211 <BrianWong-AT-AirgoNetworks.Com>.
3243 <BrianWong-AT-AirgoNetworks.Com>.
3212 (InteractiveShell.__init__): Fix bug which would cause foo[1] to
3244 (InteractiveShell.__init__): Fix bug which would cause foo[1] to
3213 be autocalled as foo([1]) if foo were callable. A problem for
3245 be autocalled as foo([1]) if foo were callable. A problem for
3214 things which are both callable and implement __getitem__.
3246 things which are both callable and implement __getitem__.
3215 (init_readline): Fix autoindentation for win32. Thanks to a patch
3247 (init_readline): Fix autoindentation for win32. Thanks to a patch
3216 by Vivian De Smedt <vivian-AT-vdesmedt.com>.
3248 by Vivian De Smedt <vivian-AT-vdesmedt.com>.
3217
3249
3218 2005-02-12 Fernando Perez <fperez@colorado.edu>
3250 2005-02-12 Fernando Perez <fperez@colorado.edu>
3219
3251
3220 * IPython/ipmaker.py (make_IPython): Disabled the stout traps
3252 * IPython/ipmaker.py (make_IPython): Disabled the stout traps
3221 which I had written long ago to sort out user error messages which
3253 which I had written long ago to sort out user error messages which
3222 may occur during startup. This seemed like a good idea initially,
3254 may occur during startup. This seemed like a good idea initially,
3223 but it has proven a disaster in retrospect. I don't want to
3255 but it has proven a disaster in retrospect. I don't want to
3224 change much code for now, so my fix is to set the internal 'debug'
3256 change much code for now, so my fix is to set the internal 'debug'
3225 flag to true everywhere, whose only job was precisely to control
3257 flag to true everywhere, whose only job was precisely to control
3226 this subsystem. This closes issue 28 (as well as avoiding all
3258 this subsystem. This closes issue 28 (as well as avoiding all
3227 sorts of strange hangups which occur from time to time).
3259 sorts of strange hangups which occur from time to time).
3228
3260
3229 2005-02-07 Fernando Perez <fperez@colorado.edu>
3261 2005-02-07 Fernando Perez <fperez@colorado.edu>
3230
3262
3231 * IPython/Magic.py (magic_edit): Fix 'ed -p' not working when the
3263 * IPython/Magic.py (magic_edit): Fix 'ed -p' not working when the
3232 previous call produced a syntax error.
3264 previous call produced a syntax error.
3233
3265
3234 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
3266 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
3235 classes without constructor.
3267 classes without constructor.
3236
3268
3237 2005-02-06 Fernando Perez <fperez@colorado.edu>
3269 2005-02-06 Fernando Perez <fperez@colorado.edu>
3238
3270
3239 * IPython/iplib.py (MagicCompleter.complete): Extend the list of
3271 * IPython/iplib.py (MagicCompleter.complete): Extend the list of
3240 completions with the results of each matcher, so we return results
3272 completions with the results of each matcher, so we return results
3241 to the user from all namespaces. This breaks with ipython
3273 to the user from all namespaces. This breaks with ipython
3242 tradition, but I think it's a nicer behavior. Now you get all
3274 tradition, but I think it's a nicer behavior. Now you get all
3243 possible completions listed, from all possible namespaces (python,
3275 possible completions listed, from all possible namespaces (python,
3244 filesystem, magics...) After a request by John Hunter
3276 filesystem, magics...) After a request by John Hunter
3245 <jdhunter-AT-nitace.bsd.uchicago.edu>.
3277 <jdhunter-AT-nitace.bsd.uchicago.edu>.
3246
3278
3247 2005-02-05 Fernando Perez <fperez@colorado.edu>
3279 2005-02-05 Fernando Perez <fperez@colorado.edu>
3248
3280
3249 * IPython/Magic.py (magic_prun): Fix bug where prun would fail if
3281 * IPython/Magic.py (magic_prun): Fix bug where prun would fail if
3250 the call had quote characters in it (the quotes were stripped).
3282 the call had quote characters in it (the quotes were stripped).
3251
3283
3252 2005-01-31 Fernando Perez <fperez@colorado.edu>
3284 2005-01-31 Fernando Perez <fperez@colorado.edu>
3253
3285
3254 * IPython/iplib.py (InteractiveShell.__init__): reduce reliance on
3286 * IPython/iplib.py (InteractiveShell.__init__): reduce reliance on
3255 Itpl.itpl() to make the code more robust against psyco
3287 Itpl.itpl() to make the code more robust against psyco
3256 optimizations.
3288 optimizations.
3257
3289
3258 * IPython/Itpl.py (Itpl.__str__): Use a _getframe() call instead
3290 * IPython/Itpl.py (Itpl.__str__): Use a _getframe() call instead
3259 of causing an exception. Quicker, cleaner.
3291 of causing an exception. Quicker, cleaner.
3260
3292
3261 2005-01-28 Fernando Perez <fperez@colorado.edu>
3293 2005-01-28 Fernando Perez <fperez@colorado.edu>
3262
3294
3263 * scripts/ipython_win_post_install.py (install): hardcode
3295 * scripts/ipython_win_post_install.py (install): hardcode
3264 sys.prefix+'python.exe' as the executable path. It turns out that
3296 sys.prefix+'python.exe' as the executable path. It turns out that
3265 during the post-installation run, sys.executable resolves to the
3297 during the post-installation run, sys.executable resolves to the
3266 name of the binary installer! I should report this as a distutils
3298 name of the binary installer! I should report this as a distutils
3267 bug, I think. I updated the .10 release with this tiny fix, to
3299 bug, I think. I updated the .10 release with this tiny fix, to
3268 avoid annoying the lists further.
3300 avoid annoying the lists further.
3269
3301
3270 2005-01-27 *** Released version 0.6.10
3302 2005-01-27 *** Released version 0.6.10
3271
3303
3272 2005-01-27 Fernando Perez <fperez@colorado.edu>
3304 2005-01-27 Fernando Perez <fperez@colorado.edu>
3273
3305
3274 * IPython/numutils.py (norm): Added 'inf' as optional name for
3306 * IPython/numutils.py (norm): Added 'inf' as optional name for
3275 L-infinity norm, included references to mathworld.com for vector
3307 L-infinity norm, included references to mathworld.com for vector
3276 norm definitions.
3308 norm definitions.
3277 (amin/amax): added amin/amax for array min/max. Similar to what
3309 (amin/amax): added amin/amax for array min/max. Similar to what
3278 pylab ships with after the recent reorganization of names.
3310 pylab ships with after the recent reorganization of names.
3279 (spike/spike_odd): removed deprecated spike/spike_odd functions.
3311 (spike/spike_odd): removed deprecated spike/spike_odd functions.
3280
3312
3281 * ipython.el: committed Alex's recent fixes and improvements.
3313 * ipython.el: committed Alex's recent fixes and improvements.
3282 Tested with python-mode from CVS, and it looks excellent. Since
3314 Tested with python-mode from CVS, and it looks excellent. Since
3283 python-mode hasn't released anything in a while, I'm temporarily
3315 python-mode hasn't released anything in a while, I'm temporarily
3284 putting a copy of today's CVS (v 4.70) of python-mode in:
3316 putting a copy of today's CVS (v 4.70) of python-mode in:
3285 http://ipython.scipy.org/tmp/python-mode.el
3317 http://ipython.scipy.org/tmp/python-mode.el
3286
3318
3287 * scripts/ipython_win_post_install.py (install): Win32 fix to use
3319 * scripts/ipython_win_post_install.py (install): Win32 fix to use
3288 sys.executable for the executable name, instead of assuming it's
3320 sys.executable for the executable name, instead of assuming it's
3289 called 'python.exe' (the post-installer would have produced broken
3321 called 'python.exe' (the post-installer would have produced broken
3290 setups on systems with a differently named python binary).
3322 setups on systems with a differently named python binary).
3291
3323
3292 * IPython/PyColorize.py (Parser.__call__): change explicit '\n'
3324 * IPython/PyColorize.py (Parser.__call__): change explicit '\n'
3293 references to os.linesep, to make the code more
3325 references to os.linesep, to make the code more
3294 platform-independent. This is also part of the win32 coloring
3326 platform-independent. This is also part of the win32 coloring
3295 fixes.
3327 fixes.
3296
3328
3297 * IPython/genutils.py (page_dumb): Remove attempts to chop long
3329 * IPython/genutils.py (page_dumb): Remove attempts to chop long
3298 lines, which actually cause coloring bugs because the length of
3330 lines, which actually cause coloring bugs because the length of
3299 the line is very difficult to correctly compute with embedded
3331 the line is very difficult to correctly compute with embedded
3300 escapes. This was the source of all the coloring problems under
3332 escapes. This was the source of all the coloring problems under
3301 Win32. I think that _finally_, Win32 users have a properly
3333 Win32. I think that _finally_, Win32 users have a properly
3302 working ipython in all respects. This would never have happened
3334 working ipython in all respects. This would never have happened
3303 if not for Gary Bishop and Viktor Ransmayr's great help and work.
3335 if not for Gary Bishop and Viktor Ransmayr's great help and work.
3304
3336
3305 2005-01-26 *** Released version 0.6.9
3337 2005-01-26 *** Released version 0.6.9
3306
3338
3307 2005-01-25 Fernando Perez <fperez@colorado.edu>
3339 2005-01-25 Fernando Perez <fperez@colorado.edu>
3308
3340
3309 * setup.py: finally, we have a true Windows installer, thanks to
3341 * setup.py: finally, we have a true Windows installer, thanks to
3310 the excellent work of Viktor Ransmayr
3342 the excellent work of Viktor Ransmayr
3311 <viktor.ransmayr-AT-t-online.de>. The docs have been updated for
3343 <viktor.ransmayr-AT-t-online.de>. The docs have been updated for
3312 Windows users. The setup routine is quite a bit cleaner thanks to
3344 Windows users. The setup routine is quite a bit cleaner thanks to
3313 this, and the post-install script uses the proper functions to
3345 this, and the post-install script uses the proper functions to
3314 allow a clean de-installation using the standard Windows Control
3346 allow a clean de-installation using the standard Windows Control
3315 Panel.
3347 Panel.
3316
3348
3317 * IPython/genutils.py (get_home_dir): changed to use the $HOME
3349 * IPython/genutils.py (get_home_dir): changed to use the $HOME
3318 environment variable under all OSes (including win32) if
3350 environment variable under all OSes (including win32) if
3319 available. This will give consistency to win32 users who have set
3351 available. This will give consistency to win32 users who have set
3320 this variable for any reason. If os.environ['HOME'] fails, the
3352 this variable for any reason. If os.environ['HOME'] fails, the
3321 previous policy of using HOMEDRIVE\HOMEPATH kicks in.
3353 previous policy of using HOMEDRIVE\HOMEPATH kicks in.
3322
3354
3323 2005-01-24 Fernando Perez <fperez@colorado.edu>
3355 2005-01-24 Fernando Perez <fperez@colorado.edu>
3324
3356
3325 * IPython/numutils.py (empty_like): add empty_like(), similar to
3357 * IPython/numutils.py (empty_like): add empty_like(), similar to
3326 zeros_like() but taking advantage of the new empty() Numeric routine.
3358 zeros_like() but taking advantage of the new empty() Numeric routine.
3327
3359
3328 2005-01-23 *** Released version 0.6.8
3360 2005-01-23 *** Released version 0.6.8
3329
3361
3330 2005-01-22 Fernando Perez <fperez@colorado.edu>
3362 2005-01-22 Fernando Perez <fperez@colorado.edu>
3331
3363
3332 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): I removed the
3364 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): I removed the
3333 automatic show() calls. After discussing things with JDH, it
3365 automatic show() calls. After discussing things with JDH, it
3334 turns out there are too many corner cases where this can go wrong.
3366 turns out there are too many corner cases where this can go wrong.
3335 It's best not to try to be 'too smart', and simply have ipython
3367 It's best not to try to be 'too smart', and simply have ipython
3336 reproduce as much as possible the default behavior of a normal
3368 reproduce as much as possible the default behavior of a normal
3337 python shell.
3369 python shell.
3338
3370
3339 * IPython/iplib.py (InteractiveShell.__init__): Modified the
3371 * IPython/iplib.py (InteractiveShell.__init__): Modified the
3340 line-splitting regexp and _prefilter() to avoid calling getattr()
3372 line-splitting regexp and _prefilter() to avoid calling getattr()
3341 on assignments. This closes
3373 on assignments. This closes
3342 http://www.scipy.net/roundup/ipython/issue24. Note that Python's
3374 http://www.scipy.net/roundup/ipython/issue24. Note that Python's
3343 readline uses getattr(), so a simple <TAB> keypress is still
3375 readline uses getattr(), so a simple <TAB> keypress is still
3344 enough to trigger getattr() calls on an object.
3376 enough to trigger getattr() calls on an object.
3345
3377
3346 2005-01-21 Fernando Perez <fperez@colorado.edu>
3378 2005-01-21 Fernando Perez <fperez@colorado.edu>
3347
3379
3348 * IPython/Shell.py (MatplotlibShellBase.magic_run): Fix the %run
3380 * IPython/Shell.py (MatplotlibShellBase.magic_run): Fix the %run
3349 docstring under pylab so it doesn't mask the original.
3381 docstring under pylab so it doesn't mask the original.
3350
3382
3351 2005-01-21 *** Released version 0.6.7
3383 2005-01-21 *** Released version 0.6.7
3352
3384
3353 2005-01-21 Fernando Perez <fperez@colorado.edu>
3385 2005-01-21 Fernando Perez <fperez@colorado.edu>
3354
3386
3355 * IPython/Shell.py (MTInteractiveShell.runcode): Trap a crash with
3387 * IPython/Shell.py (MTInteractiveShell.runcode): Trap a crash with
3356 signal handling for win32 users in multithreaded mode.
3388 signal handling for win32 users in multithreaded mode.
3357
3389
3358 2005-01-17 Fernando Perez <fperez@colorado.edu>
3390 2005-01-17 Fernando Perez <fperez@colorado.edu>
3359
3391
3360 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
3392 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
3361 instances with no __init__. After a crash report by Norbert Nemec
3393 instances with no __init__. After a crash report by Norbert Nemec
3362 <Norbert-AT-nemec-online.de>.
3394 <Norbert-AT-nemec-online.de>.
3363
3395
3364 2005-01-14 Fernando Perez <fperez@colorado.edu>
3396 2005-01-14 Fernando Perez <fperez@colorado.edu>
3365
3397
3366 * IPython/ultraTB.py (VerboseTB.text): Fix bug in reporting of
3398 * IPython/ultraTB.py (VerboseTB.text): Fix bug in reporting of
3367 names for verbose exceptions, when multiple dotted names and the
3399 names for verbose exceptions, when multiple dotted names and the
3368 'parent' object were present on the same line.
3400 'parent' object were present on the same line.
3369
3401
3370 2005-01-11 Fernando Perez <fperez@colorado.edu>
3402 2005-01-11 Fernando Perez <fperez@colorado.edu>
3371
3403
3372 * IPython/genutils.py (flag_calls): new utility to trap and flag
3404 * IPython/genutils.py (flag_calls): new utility to trap and flag
3373 calls in functions. I need it to clean up matplotlib support.
3405 calls in functions. I need it to clean up matplotlib support.
3374 Also removed some deprecated code in genutils.
3406 Also removed some deprecated code in genutils.
3375
3407
3376 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): small fix so
3408 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): small fix so
3377 that matplotlib scripts called with %run, which don't call show()
3409 that matplotlib scripts called with %run, which don't call show()
3378 themselves, still have their plotting windows open.
3410 themselves, still have their plotting windows open.
3379
3411
3380 2005-01-05 Fernando Perez <fperez@colorado.edu>
3412 2005-01-05 Fernando Perez <fperez@colorado.edu>
3381
3413
3382 * IPython/Shell.py (IPShellGTK.__init__): Patch by Andrew Straw
3414 * IPython/Shell.py (IPShellGTK.__init__): Patch by Andrew Straw
3383 <astraw-AT-caltech.edu>, to fix gtk deprecation warnings.
3415 <astraw-AT-caltech.edu>, to fix gtk deprecation warnings.
3384
3416
3385 2004-12-19 Fernando Perez <fperez@colorado.edu>
3417 2004-12-19 Fernando Perez <fperez@colorado.edu>
3386
3418
3387 * IPython/Shell.py (MTInteractiveShell.runcode): Get rid of
3419 * IPython/Shell.py (MTInteractiveShell.runcode): Get rid of
3388 parent_runcode, which was an eyesore. The same result can be
3420 parent_runcode, which was an eyesore. The same result can be
3389 obtained with Python's regular superclass mechanisms.
3421 obtained with Python's regular superclass mechanisms.
3390
3422
3391 2004-12-17 Fernando Perez <fperez@colorado.edu>
3423 2004-12-17 Fernando Perez <fperez@colorado.edu>
3392
3424
3393 * IPython/Magic.py (Magic.magic_sc): Fix quote stripping problem
3425 * IPython/Magic.py (Magic.magic_sc): Fix quote stripping problem
3394 reported by Prabhu.
3426 reported by Prabhu.
3395 (Magic.magic_sx): direct all errors to Term.cerr (defaults to
3427 (Magic.magic_sx): direct all errors to Term.cerr (defaults to
3396 sys.stderr) instead of explicitly calling sys.stderr. This helps
3428 sys.stderr) instead of explicitly calling sys.stderr. This helps
3397 maintain our I/O abstractions clean, for future GUI embeddings.
3429 maintain our I/O abstractions clean, for future GUI embeddings.
3398
3430
3399 * IPython/genutils.py (info): added new utility for sys.stderr
3431 * IPython/genutils.py (info): added new utility for sys.stderr
3400 unified info message handling (thin wrapper around warn()).
3432 unified info message handling (thin wrapper around warn()).
3401
3433
3402 * IPython/ultraTB.py (VerboseTB.text): Fix misreported global
3434 * IPython/ultraTB.py (VerboseTB.text): Fix misreported global
3403 composite (dotted) names on verbose exceptions.
3435 composite (dotted) names on verbose exceptions.
3404 (VerboseTB.nullrepr): harden against another kind of errors which
3436 (VerboseTB.nullrepr): harden against another kind of errors which
3405 Python's inspect module can trigger, and which were crashing
3437 Python's inspect module can trigger, and which were crashing
3406 IPython. Thanks to a report by Marco Lombardi
3438 IPython. Thanks to a report by Marco Lombardi
3407 <mlombard-AT-ma010192.hq.eso.org>.
3439 <mlombard-AT-ma010192.hq.eso.org>.
3408
3440
3409 2004-12-13 *** Released version 0.6.6
3441 2004-12-13 *** Released version 0.6.6
3410
3442
3411 2004-12-12 Fernando Perez <fperez@colorado.edu>
3443 2004-12-12 Fernando Perez <fperez@colorado.edu>
3412
3444
3413 * IPython/Shell.py (IPShellGTK.mainloop): catch RuntimeErrors
3445 * IPython/Shell.py (IPShellGTK.mainloop): catch RuntimeErrors
3414 generated by pygtk upon initialization if it was built without
3446 generated by pygtk upon initialization if it was built without
3415 threads (for matplotlib users). After a crash reported by
3447 threads (for matplotlib users). After a crash reported by
3416 Leguijt, Jaap J SIEP-EPT-RES <Jaap.Leguijt-AT-shell.com>.
3448 Leguijt, Jaap J SIEP-EPT-RES <Jaap.Leguijt-AT-shell.com>.
3417
3449
3418 * IPython/ipmaker.py (make_IPython): fix small bug in the
3450 * IPython/ipmaker.py (make_IPython): fix small bug in the
3419 import_some parameter for multiple imports.
3451 import_some parameter for multiple imports.
3420
3452
3421 * IPython/iplib.py (ipmagic): simplified the interface of
3453 * IPython/iplib.py (ipmagic): simplified the interface of
3422 ipmagic() to take a single string argument, just as it would be
3454 ipmagic() to take a single string argument, just as it would be
3423 typed at the IPython cmd line.
3455 typed at the IPython cmd line.
3424 (ipalias): Added new ipalias() with an interface identical to
3456 (ipalias): Added new ipalias() with an interface identical to
3425 ipmagic(). This completes exposing a pure python interface to the
3457 ipmagic(). This completes exposing a pure python interface to the
3426 alias and magic system, which can be used in loops or more complex
3458 alias and magic system, which can be used in loops or more complex
3427 code where IPython's automatic line mangling is not active.
3459 code where IPython's automatic line mangling is not active.
3428
3460
3429 * IPython/genutils.py (timing): changed interface of timing to
3461 * IPython/genutils.py (timing): changed interface of timing to
3430 simply run code once, which is the most common case. timings()
3462 simply run code once, which is the most common case. timings()
3431 remains unchanged, for the cases where you want multiple runs.
3463 remains unchanged, for the cases where you want multiple runs.
3432
3464
3433 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix a
3465 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix a
3434 bug where Python2.2 crashes with exec'ing code which does not end
3466 bug where Python2.2 crashes with exec'ing code which does not end
3435 in a single newline. Python 2.3 is OK, so I hadn't noticed this
3467 in a single newline. Python 2.3 is OK, so I hadn't noticed this
3436 before.
3468 before.
3437
3469
3438 2004-12-10 Fernando Perez <fperez@colorado.edu>
3470 2004-12-10 Fernando Perez <fperez@colorado.edu>
3439
3471
3440 * IPython/Magic.py (Magic.magic_prun): changed name of option from
3472 * IPython/Magic.py (Magic.magic_prun): changed name of option from
3441 -t to -T, to accomodate the new -t flag in %run (the %run and
3473 -t to -T, to accomodate the new -t flag in %run (the %run and
3442 %prun options are kind of intermixed, and it's not easy to change
3474 %prun options are kind of intermixed, and it's not easy to change
3443 this with the limitations of python's getopt).
3475 this with the limitations of python's getopt).
3444
3476
3445 * IPython/Magic.py (Magic.magic_run): Added new -t option to time
3477 * IPython/Magic.py (Magic.magic_run): Added new -t option to time
3446 the execution of scripts. It's not as fine-tuned as timeit.py,
3478 the execution of scripts. It's not as fine-tuned as timeit.py,
3447 but it works from inside ipython (and under 2.2, which lacks
3479 but it works from inside ipython (and under 2.2, which lacks
3448 timeit.py). Optionally a number of runs > 1 can be given for
3480 timeit.py). Optionally a number of runs > 1 can be given for
3449 timing very short-running code.
3481 timing very short-running code.
3450
3482
3451 * IPython/genutils.py (uniq_stable): new routine which returns a
3483 * IPython/genutils.py (uniq_stable): new routine which returns a
3452 list of unique elements in any iterable, but in stable order of
3484 list of unique elements in any iterable, but in stable order of
3453 appearance. I needed this for the ultraTB fixes, and it's a handy
3485 appearance. I needed this for the ultraTB fixes, and it's a handy
3454 utility.
3486 utility.
3455
3487
3456 * IPython/ultraTB.py (VerboseTB.text): Fix proper reporting of
3488 * IPython/ultraTB.py (VerboseTB.text): Fix proper reporting of
3457 dotted names in Verbose exceptions. This had been broken since
3489 dotted names in Verbose exceptions. This had been broken since
3458 the very start, now x.y will properly be printed in a Verbose
3490 the very start, now x.y will properly be printed in a Verbose
3459 traceback, instead of x being shown and y appearing always as an
3491 traceback, instead of x being shown and y appearing always as an
3460 'undefined global'. Getting this to work was a bit tricky,
3492 'undefined global'. Getting this to work was a bit tricky,
3461 because by default python tokenizers are stateless. Saved by
3493 because by default python tokenizers are stateless. Saved by
3462 python's ability to easily add a bit of state to an arbitrary
3494 python's ability to easily add a bit of state to an arbitrary
3463 function (without needing to build a full-blown callable object).
3495 function (without needing to build a full-blown callable object).
3464
3496
3465 Also big cleanup of this code, which had horrendous runtime
3497 Also big cleanup of this code, which had horrendous runtime
3466 lookups of zillions of attributes for colorization. Moved all
3498 lookups of zillions of attributes for colorization. Moved all
3467 this code into a few templates, which make it cleaner and quicker.
3499 this code into a few templates, which make it cleaner and quicker.
3468
3500
3469 Printout quality was also improved for Verbose exceptions: one
3501 Printout quality was also improved for Verbose exceptions: one
3470 variable per line, and memory addresses are printed (this can be
3502 variable per line, and memory addresses are printed (this can be
3471 quite handy in nasty debugging situations, which is what Verbose
3503 quite handy in nasty debugging situations, which is what Verbose
3472 is for).
3504 is for).
3473
3505
3474 * IPython/ipmaker.py (make_IPython): Do NOT execute files named in
3506 * IPython/ipmaker.py (make_IPython): Do NOT execute files named in
3475 the command line as scripts to be loaded by embedded instances.
3507 the command line as scripts to be loaded by embedded instances.
3476 Doing so has the potential for an infinite recursion if there are
3508 Doing so has the potential for an infinite recursion if there are
3477 exceptions thrown in the process. This fixes a strange crash
3509 exceptions thrown in the process. This fixes a strange crash
3478 reported by Philippe MULLER <muller-AT-irit.fr>.
3510 reported by Philippe MULLER <muller-AT-irit.fr>.
3479
3511
3480 2004-12-09 Fernando Perez <fperez@colorado.edu>
3512 2004-12-09 Fernando Perez <fperez@colorado.edu>
3481
3513
3482 * IPython/Shell.py (MatplotlibShellBase.use): Change pylab support
3514 * IPython/Shell.py (MatplotlibShellBase.use): Change pylab support
3483 to reflect new names in matplotlib, which now expose the
3515 to reflect new names in matplotlib, which now expose the
3484 matlab-compatible interface via a pylab module instead of the
3516 matlab-compatible interface via a pylab module instead of the
3485 'matlab' name. The new code is backwards compatible, so users of
3517 'matlab' name. The new code is backwards compatible, so users of
3486 all matplotlib versions are OK. Patch by J. Hunter.
3518 all matplotlib versions are OK. Patch by J. Hunter.
3487
3519
3488 * IPython/OInspect.py (Inspector.pinfo): Add to object? printing
3520 * IPython/OInspect.py (Inspector.pinfo): Add to object? printing
3489 of __init__ docstrings for instances (class docstrings are already
3521 of __init__ docstrings for instances (class docstrings are already
3490 automatically printed). Instances with customized docstrings
3522 automatically printed). Instances with customized docstrings
3491 (indep. of the class) are also recognized and all 3 separate
3523 (indep. of the class) are also recognized and all 3 separate
3492 docstrings are printed (instance, class, constructor). After some
3524 docstrings are printed (instance, class, constructor). After some
3493 comments/suggestions by J. Hunter.
3525 comments/suggestions by J. Hunter.
3494
3526
3495 2004-12-05 Fernando Perez <fperez@colorado.edu>
3527 2004-12-05 Fernando Perez <fperez@colorado.edu>
3496
3528
3497 * IPython/iplib.py (MagicCompleter.complete): Remove annoying
3529 * IPython/iplib.py (MagicCompleter.complete): Remove annoying
3498 warnings when tab-completion fails and triggers an exception.
3530 warnings when tab-completion fails and triggers an exception.
3499
3531
3500 2004-12-03 Fernando Perez <fperez@colorado.edu>
3532 2004-12-03 Fernando Perez <fperez@colorado.edu>
3501
3533
3502 * IPython/Magic.py (magic_prun): Fix bug where an exception would
3534 * IPython/Magic.py (magic_prun): Fix bug where an exception would
3503 be triggered when using 'run -p'. An incorrect option flag was
3535 be triggered when using 'run -p'. An incorrect option flag was
3504 being set ('d' instead of 'D').
3536 being set ('d' instead of 'D').
3505 (manpage): fix missing escaped \- sign.
3537 (manpage): fix missing escaped \- sign.
3506
3538
3507 2004-11-30 *** Released version 0.6.5
3539 2004-11-30 *** Released version 0.6.5
3508
3540
3509 2004-11-30 Fernando Perez <fperez@colorado.edu>
3541 2004-11-30 Fernando Perez <fperez@colorado.edu>
3510
3542
3511 * IPython/Magic.py (Magic.magic_run): Fix bug in breakpoint
3543 * IPython/Magic.py (Magic.magic_run): Fix bug in breakpoint
3512 setting with -d option.
3544 setting with -d option.
3513
3545
3514 * setup.py (docfiles): Fix problem where the doc glob I was using
3546 * setup.py (docfiles): Fix problem where the doc glob I was using
3515 was COMPLETELY BROKEN. It was giving the right files by pure
3547 was COMPLETELY BROKEN. It was giving the right files by pure
3516 accident, but failed once I tried to include ipython.el. Note:
3548 accident, but failed once I tried to include ipython.el. Note:
3517 glob() does NOT allow you to do exclusion on multiple endings!
3549 glob() does NOT allow you to do exclusion on multiple endings!
3518
3550
3519 2004-11-29 Fernando Perez <fperez@colorado.edu>
3551 2004-11-29 Fernando Perez <fperez@colorado.edu>
3520
3552
3521 * IPython/usage.py (__doc__): cleaned up usage docstring, by using
3553 * IPython/usage.py (__doc__): cleaned up usage docstring, by using
3522 the manpage as the source. Better formatting & consistency.
3554 the manpage as the source. Better formatting & consistency.
3523
3555
3524 * IPython/Magic.py (magic_run): Added new -d option, to run
3556 * IPython/Magic.py (magic_run): Added new -d option, to run
3525 scripts under the control of the python pdb debugger. Note that
3557 scripts under the control of the python pdb debugger. Note that
3526 this required changing the %prun option -d to -D, to avoid a clash
3558 this required changing the %prun option -d to -D, to avoid a clash
3527 (since %run must pass options to %prun, and getopt is too dumb to
3559 (since %run must pass options to %prun, and getopt is too dumb to
3528 handle options with string values with embedded spaces). Thanks
3560 handle options with string values with embedded spaces). Thanks
3529 to a suggestion by Matthew Arnison <maffew-AT-cat.org.au>.
3561 to a suggestion by Matthew Arnison <maffew-AT-cat.org.au>.
3530 (magic_who_ls): added type matching to %who and %whos, so that one
3562 (magic_who_ls): added type matching to %who and %whos, so that one
3531 can filter their output to only include variables of certain
3563 can filter their output to only include variables of certain
3532 types. Another suggestion by Matthew.
3564 types. Another suggestion by Matthew.
3533 (magic_whos): Added memory summaries in kb and Mb for arrays.
3565 (magic_whos): Added memory summaries in kb and Mb for arrays.
3534 (magic_who): Improve formatting (break lines every 9 vars).
3566 (magic_who): Improve formatting (break lines every 9 vars).
3535
3567
3536 2004-11-28 Fernando Perez <fperez@colorado.edu>
3568 2004-11-28 Fernando Perez <fperez@colorado.edu>
3537
3569
3538 * IPython/Logger.py (Logger.log): Fix bug in syncing the input
3570 * IPython/Logger.py (Logger.log): Fix bug in syncing the input
3539 cache when empty lines were present.
3571 cache when empty lines were present.
3540
3572
3541 2004-11-24 Fernando Perez <fperez@colorado.edu>
3573 2004-11-24 Fernando Perez <fperez@colorado.edu>
3542
3574
3543 * IPython/usage.py (__doc__): document the re-activated threading
3575 * IPython/usage.py (__doc__): document the re-activated threading
3544 options for WX and GTK.
3576 options for WX and GTK.
3545
3577
3546 2004-11-23 Fernando Perez <fperez@colorado.edu>
3578 2004-11-23 Fernando Perez <fperez@colorado.edu>
3547
3579
3548 * IPython/Shell.py (start): Added Prabhu's big patch to reactivate
3580 * IPython/Shell.py (start): Added Prabhu's big patch to reactivate
3549 the -wthread and -gthread options, along with a new -tk one to try
3581 the -wthread and -gthread options, along with a new -tk one to try
3550 and coordinate Tk threading with wx/gtk. The tk support is very
3582 and coordinate Tk threading with wx/gtk. The tk support is very
3551 platform dependent, since it seems to require Tcl and Tk to be
3583 platform dependent, since it seems to require Tcl and Tk to be
3552 built with threads (Fedora1/2 appears NOT to have it, but in
3584 built with threads (Fedora1/2 appears NOT to have it, but in
3553 Prabhu's Debian boxes it works OK). But even with some Tk
3585 Prabhu's Debian boxes it works OK). But even with some Tk
3554 limitations, this is a great improvement.
3586 limitations, this is a great improvement.
3555
3587
3556 * IPython/Prompts.py (prompt_specials_color): Added \t for time
3588 * IPython/Prompts.py (prompt_specials_color): Added \t for time
3557 info in user prompts. Patch by Prabhu.
3589 info in user prompts. Patch by Prabhu.
3558
3590
3559 2004-11-18 Fernando Perez <fperez@colorado.edu>
3591 2004-11-18 Fernando Perez <fperez@colorado.edu>
3560
3592
3561 * IPython/genutils.py (ask_yes_no): Add check for a max of 20
3593 * IPython/genutils.py (ask_yes_no): Add check for a max of 20
3562 EOFErrors and bail, to avoid infinite loops if a non-terminating
3594 EOFErrors and bail, to avoid infinite loops if a non-terminating
3563 file is fed into ipython. Patch submitted in issue 19 by user,
3595 file is fed into ipython. Patch submitted in issue 19 by user,
3564 many thanks.
3596 many thanks.
3565
3597
3566 * IPython/iplib.py (InteractiveShell.handle_auto): do NOT trigger
3598 * IPython/iplib.py (InteractiveShell.handle_auto): do NOT trigger
3567 autoquote/parens in continuation prompts, which can cause lots of
3599 autoquote/parens in continuation prompts, which can cause lots of
3568 problems. Closes roundup issue 20.
3600 problems. Closes roundup issue 20.
3569
3601
3570 2004-11-17 Fernando Perez <fperez@colorado.edu>
3602 2004-11-17 Fernando Perez <fperez@colorado.edu>
3571
3603
3572 * debian/control (Build-Depends-Indep): Fix dpatch dependency,
3604 * debian/control (Build-Depends-Indep): Fix dpatch dependency,
3573 reported as debian bug #280505. I'm not sure my local changelog
3605 reported as debian bug #280505. I'm not sure my local changelog
3574 entry has the proper debian format (Jack?).
3606 entry has the proper debian format (Jack?).
3575
3607
3576 2004-11-08 *** Released version 0.6.4
3608 2004-11-08 *** Released version 0.6.4
3577
3609
3578 2004-11-08 Fernando Perez <fperez@colorado.edu>
3610 2004-11-08 Fernando Perez <fperez@colorado.edu>
3579
3611
3580 * IPython/iplib.py (init_readline): Fix exit message for Windows
3612 * IPython/iplib.py (init_readline): Fix exit message for Windows
3581 when readline is active. Thanks to a report by Eric Jones
3613 when readline is active. Thanks to a report by Eric Jones
3582 <eric-AT-enthought.com>.
3614 <eric-AT-enthought.com>.
3583
3615
3584 2004-11-07 Fernando Perez <fperez@colorado.edu>
3616 2004-11-07 Fernando Perez <fperez@colorado.edu>
3585
3617
3586 * IPython/genutils.py (page): Add a trap for OSError exceptions,
3618 * IPython/genutils.py (page): Add a trap for OSError exceptions,
3587 sometimes seen by win2k/cygwin users.
3619 sometimes seen by win2k/cygwin users.
3588
3620
3589 2004-11-06 Fernando Perez <fperez@colorado.edu>
3621 2004-11-06 Fernando Perez <fperez@colorado.edu>
3590
3622
3591 * IPython/iplib.py (interact): Change the handling of %Exit from
3623 * IPython/iplib.py (interact): Change the handling of %Exit from
3592 trying to propagate a SystemExit to an internal ipython flag.
3624 trying to propagate a SystemExit to an internal ipython flag.
3593 This is less elegant than using Python's exception mechanism, but
3625 This is less elegant than using Python's exception mechanism, but
3594 I can't get that to work reliably with threads, so under -pylab
3626 I can't get that to work reliably with threads, so under -pylab
3595 %Exit was hanging IPython. Cross-thread exception handling is
3627 %Exit was hanging IPython. Cross-thread exception handling is
3596 really a bitch. Thaks to a bug report by Stephen Walton
3628 really a bitch. Thaks to a bug report by Stephen Walton
3597 <stephen.walton-AT-csun.edu>.
3629 <stephen.walton-AT-csun.edu>.
3598
3630
3599 2004-11-04 Fernando Perez <fperez@colorado.edu>
3631 2004-11-04 Fernando Perez <fperez@colorado.edu>
3600
3632
3601 * IPython/iplib.py (raw_input_original): store a pointer to the
3633 * IPython/iplib.py (raw_input_original): store a pointer to the
3602 true raw_input to harden against code which can modify it
3634 true raw_input to harden against code which can modify it
3603 (wx.py.PyShell does this and would otherwise crash ipython).
3635 (wx.py.PyShell does this and would otherwise crash ipython).
3604 Thanks to a bug report by Jim Flowers <james.flowers-AT-lgx.com>.
3636 Thanks to a bug report by Jim Flowers <james.flowers-AT-lgx.com>.
3605
3637
3606 * IPython/Shell.py (MTInteractiveShell.runsource): Cleaner fix for
3638 * IPython/Shell.py (MTInteractiveShell.runsource): Cleaner fix for
3607 Ctrl-C problem, which does not mess up the input line.
3639 Ctrl-C problem, which does not mess up the input line.
3608
3640
3609 2004-11-03 Fernando Perez <fperez@colorado.edu>
3641 2004-11-03 Fernando Perez <fperez@colorado.edu>
3610
3642
3611 * IPython/Release.py: Changed licensing to BSD, in all files.
3643 * IPython/Release.py: Changed licensing to BSD, in all files.
3612 (name): lowercase name for tarball/RPM release.
3644 (name): lowercase name for tarball/RPM release.
3613
3645
3614 * IPython/OInspect.py (getdoc): wrap inspect.getdoc() safely for
3646 * IPython/OInspect.py (getdoc): wrap inspect.getdoc() safely for
3615 use throughout ipython.
3647 use throughout ipython.
3616
3648
3617 * IPython/Magic.py (Magic._ofind): Switch to using the new
3649 * IPython/Magic.py (Magic._ofind): Switch to using the new
3618 OInspect.getdoc() function.
3650 OInspect.getdoc() function.
3619
3651
3620 * IPython/Shell.py (sigint_handler): Hack to ignore the execution
3652 * IPython/Shell.py (sigint_handler): Hack to ignore the execution
3621 of the line currently being canceled via Ctrl-C. It's extremely
3653 of the line currently being canceled via Ctrl-C. It's extremely
3622 ugly, but I don't know how to do it better (the problem is one of
3654 ugly, but I don't know how to do it better (the problem is one of
3623 handling cross-thread exceptions).
3655 handling cross-thread exceptions).
3624
3656
3625 2004-10-28 Fernando Perez <fperez@colorado.edu>
3657 2004-10-28 Fernando Perez <fperez@colorado.edu>
3626
3658
3627 * IPython/Shell.py (signal_handler): add signal handlers to trap
3659 * IPython/Shell.py (signal_handler): add signal handlers to trap
3628 SIGINT and SIGSEGV in threaded code properly. Thanks to a bug
3660 SIGINT and SIGSEGV in threaded code properly. Thanks to a bug
3629 report by Francesc Alted.
3661 report by Francesc Alted.
3630
3662
3631 2004-10-21 Fernando Perez <fperez@colorado.edu>
3663 2004-10-21 Fernando Perez <fperez@colorado.edu>
3632
3664
3633 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Fix @
3665 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Fix @
3634 to % for pysh syntax extensions.
3666 to % for pysh syntax extensions.
3635
3667
3636 2004-10-09 Fernando Perez <fperez@colorado.edu>
3668 2004-10-09 Fernando Perez <fperez@colorado.edu>
3637
3669
3638 * IPython/Magic.py (Magic.magic_whos): modify output of Numeric
3670 * IPython/Magic.py (Magic.magic_whos): modify output of Numeric
3639 arrays to print a more useful summary, without calling str(arr).
3671 arrays to print a more useful summary, without calling str(arr).
3640 This avoids the problem of extremely lengthy computations which
3672 This avoids the problem of extremely lengthy computations which
3641 occur if arr is large, and appear to the user as a system lockup
3673 occur if arr is large, and appear to the user as a system lockup
3642 with 100% cpu activity. After a suggestion by Kristian Sandberg
3674 with 100% cpu activity. After a suggestion by Kristian Sandberg
3643 <Kristian.Sandberg@colorado.edu>.
3675 <Kristian.Sandberg@colorado.edu>.
3644 (Magic.__init__): fix bug in global magic escapes not being
3676 (Magic.__init__): fix bug in global magic escapes not being
3645 correctly set.
3677 correctly set.
3646
3678
3647 2004-10-08 Fernando Perez <fperez@colorado.edu>
3679 2004-10-08 Fernando Perez <fperez@colorado.edu>
3648
3680
3649 * IPython/Magic.py (__license__): change to absolute imports of
3681 * IPython/Magic.py (__license__): change to absolute imports of
3650 ipython's own internal packages, to start adapting to the absolute
3682 ipython's own internal packages, to start adapting to the absolute
3651 import requirement of PEP-328.
3683 import requirement of PEP-328.
3652
3684
3653 * IPython/genutils.py (__author__): Fix coding to utf-8 on all
3685 * IPython/genutils.py (__author__): Fix coding to utf-8 on all
3654 files, and standardize author/license marks through the Release
3686 files, and standardize author/license marks through the Release
3655 module instead of having per/file stuff (except for files with
3687 module instead of having per/file stuff (except for files with
3656 particular licenses, like the MIT/PSF-licensed codes).
3688 particular licenses, like the MIT/PSF-licensed codes).
3657
3689
3658 * IPython/Debugger.py: remove dead code for python 2.1
3690 * IPython/Debugger.py: remove dead code for python 2.1
3659
3691
3660 2004-10-04 Fernando Perez <fperez@colorado.edu>
3692 2004-10-04 Fernando Perez <fperez@colorado.edu>
3661
3693
3662 * IPython/iplib.py (ipmagic): New function for accessing magics
3694 * IPython/iplib.py (ipmagic): New function for accessing magics
3663 via a normal python function call.
3695 via a normal python function call.
3664
3696
3665 * IPython/Magic.py (Magic.magic_magic): Change the magic escape
3697 * IPython/Magic.py (Magic.magic_magic): Change the magic escape
3666 from '@' to '%', to accomodate the new @decorator syntax of python
3698 from '@' to '%', to accomodate the new @decorator syntax of python
3667 2.4.
3699 2.4.
3668
3700
3669 2004-09-29 Fernando Perez <fperez@colorado.edu>
3701 2004-09-29 Fernando Perez <fperez@colorado.edu>
3670
3702
3671 * IPython/Shell.py (MatplotlibShellBase.use): Added a wrapper to
3703 * IPython/Shell.py (MatplotlibShellBase.use): Added a wrapper to
3672 matplotlib.use to prevent running scripts which try to switch
3704 matplotlib.use to prevent running scripts which try to switch
3673 interactive backends from within ipython. This will just crash
3705 interactive backends from within ipython. This will just crash
3674 the python interpreter, so we can't allow it (but a detailed error
3706 the python interpreter, so we can't allow it (but a detailed error
3675 is given to the user).
3707 is given to the user).
3676
3708
3677 2004-09-28 Fernando Perez <fperez@colorado.edu>
3709 2004-09-28 Fernando Perez <fperez@colorado.edu>
3678
3710
3679 * IPython/Shell.py (MatplotlibShellBase.mplot_exec):
3711 * IPython/Shell.py (MatplotlibShellBase.mplot_exec):
3680 matplotlib-related fixes so that using @run with non-matplotlib
3712 matplotlib-related fixes so that using @run with non-matplotlib
3681 scripts doesn't pop up spurious plot windows. This requires
3713 scripts doesn't pop up spurious plot windows. This requires
3682 matplotlib >= 0.63, where I had to make some changes as well.
3714 matplotlib >= 0.63, where I had to make some changes as well.
3683
3715
3684 * IPython/ipmaker.py (make_IPython): update version requirement to
3716 * IPython/ipmaker.py (make_IPython): update version requirement to
3685 python 2.2.
3717 python 2.2.
3686
3718
3687 * IPython/iplib.py (InteractiveShell.mainloop): Add an optional
3719 * IPython/iplib.py (InteractiveShell.mainloop): Add an optional
3688 banner arg for embedded customization.
3720 banner arg for embedded customization.
3689
3721
3690 * IPython/Magic.py (Magic.__init__): big cleanup to remove all
3722 * IPython/Magic.py (Magic.__init__): big cleanup to remove all
3691 explicit uses of __IP as the IPython's instance name. Now things
3723 explicit uses of __IP as the IPython's instance name. Now things
3692 are properly handled via the shell.name value. The actual code
3724 are properly handled via the shell.name value. The actual code
3693 is a bit ugly b/c I'm doing it via a global in Magic.py, but this
3725 is a bit ugly b/c I'm doing it via a global in Magic.py, but this
3694 is much better than before. I'll clean things completely when the
3726 is much better than before. I'll clean things completely when the
3695 magic stuff gets a real overhaul.
3727 magic stuff gets a real overhaul.
3696
3728
3697 * ipython.1: small fixes, sent in by Jack Moffit. He also sent in
3729 * ipython.1: small fixes, sent in by Jack Moffit. He also sent in
3698 minor changes to debian dir.
3730 minor changes to debian dir.
3699
3731
3700 * IPython/iplib.py (InteractiveShell.__init__): Fix adding a
3732 * IPython/iplib.py (InteractiveShell.__init__): Fix adding a
3701 pointer to the shell itself in the interactive namespace even when
3733 pointer to the shell itself in the interactive namespace even when
3702 a user-supplied dict is provided. This is needed for embedding
3734 a user-supplied dict is provided. This is needed for embedding
3703 purposes (found by tests with Michel Sanner).
3735 purposes (found by tests with Michel Sanner).
3704
3736
3705 2004-09-27 Fernando Perez <fperez@colorado.edu>
3737 2004-09-27 Fernando Perez <fperez@colorado.edu>
3706
3738
3707 * IPython/UserConfig/ipythonrc: remove []{} from
3739 * IPython/UserConfig/ipythonrc: remove []{} from
3708 readline_remove_delims, so that things like [modname.<TAB> do
3740 readline_remove_delims, so that things like [modname.<TAB> do
3709 proper completion. This disables [].TAB, but that's a less common
3741 proper completion. This disables [].TAB, but that's a less common
3710 case than module names in list comprehensions, for example.
3742 case than module names in list comprehensions, for example.
3711 Thanks to a report by Andrea Riciputi.
3743 Thanks to a report by Andrea Riciputi.
3712
3744
3713 2004-09-09 Fernando Perez <fperez@colorado.edu>
3745 2004-09-09 Fernando Perez <fperez@colorado.edu>
3714
3746
3715 * IPython/Shell.py (IPShellGTK.mainloop): reorder to avoid
3747 * IPython/Shell.py (IPShellGTK.mainloop): reorder to avoid
3716 blocking problems in win32 and osx. Fix by John.
3748 blocking problems in win32 and osx. Fix by John.
3717
3749
3718 2004-09-08 Fernando Perez <fperez@colorado.edu>
3750 2004-09-08 Fernando Perez <fperez@colorado.edu>
3719
3751
3720 * IPython/Shell.py (IPShellWX.OnInit): Fix output redirection bug
3752 * IPython/Shell.py (IPShellWX.OnInit): Fix output redirection bug
3721 for Win32 and OSX. Fix by John Hunter.
3753 for Win32 and OSX. Fix by John Hunter.
3722
3754
3723 2004-08-30 *** Released version 0.6.3
3755 2004-08-30 *** Released version 0.6.3
3724
3756
3725 2004-08-30 Fernando Perez <fperez@colorado.edu>
3757 2004-08-30 Fernando Perez <fperez@colorado.edu>
3726
3758
3727 * setup.py (isfile): Add manpages to list of dependent files to be
3759 * setup.py (isfile): Add manpages to list of dependent files to be
3728 updated.
3760 updated.
3729
3761
3730 2004-08-27 Fernando Perez <fperez@colorado.edu>
3762 2004-08-27 Fernando Perez <fperez@colorado.edu>
3731
3763
3732 * IPython/Shell.py (start): I've disabled -wthread and -gthread
3764 * IPython/Shell.py (start): I've disabled -wthread and -gthread
3733 for now. They don't really work with standalone WX/GTK code
3765 for now. They don't really work with standalone WX/GTK code
3734 (though matplotlib IS working fine with both of those backends).
3766 (though matplotlib IS working fine with both of those backends).
3735 This will neeed much more testing. I disabled most things with
3767 This will neeed much more testing. I disabled most things with
3736 comments, so turning it back on later should be pretty easy.
3768 comments, so turning it back on later should be pretty easy.
3737
3769
3738 * IPython/iplib.py (InteractiveShell.__init__): Fix accidental
3770 * IPython/iplib.py (InteractiveShell.__init__): Fix accidental
3739 autocalling of expressions like r'foo', by modifying the line
3771 autocalling of expressions like r'foo', by modifying the line
3740 split regexp. Closes
3772 split regexp. Closes
3741 http://www.scipy.net/roundup/ipython/issue18, reported by Nicholas
3773 http://www.scipy.net/roundup/ipython/issue18, reported by Nicholas
3742 Riley <ipythonbugs-AT-sabi.net>.
3774 Riley <ipythonbugs-AT-sabi.net>.
3743 (InteractiveShell.mainloop): honor --nobanner with banner
3775 (InteractiveShell.mainloop): honor --nobanner with banner
3744 extensions.
3776 extensions.
3745
3777
3746 * IPython/Shell.py: Significant refactoring of all classes, so
3778 * IPython/Shell.py: Significant refactoring of all classes, so
3747 that we can really support ALL matplotlib backends and threading
3779 that we can really support ALL matplotlib backends and threading
3748 models (John spotted a bug with Tk which required this). Now we
3780 models (John spotted a bug with Tk which required this). Now we
3749 should support single-threaded, WX-threads and GTK-threads, both
3781 should support single-threaded, WX-threads and GTK-threads, both
3750 for generic code and for matplotlib.
3782 for generic code and for matplotlib.
3751
3783
3752 * IPython/ipmaker.py (__call__): Changed -mpthread option to
3784 * IPython/ipmaker.py (__call__): Changed -mpthread option to
3753 -pylab, to simplify things for users. Will also remove the pylab
3785 -pylab, to simplify things for users. Will also remove the pylab
3754 profile, since now all of matplotlib configuration is directly
3786 profile, since now all of matplotlib configuration is directly
3755 handled here. This also reduces startup time.
3787 handled here. This also reduces startup time.
3756
3788
3757 * IPython/Shell.py (IPShellGTK.run): Fixed bug where mainloop() of
3789 * IPython/Shell.py (IPShellGTK.run): Fixed bug where mainloop() of
3758 shell wasn't being correctly called. Also in IPShellWX.
3790 shell wasn't being correctly called. Also in IPShellWX.
3759
3791
3760 * IPython/iplib.py (InteractiveShell.__init__): Added option to
3792 * IPython/iplib.py (InteractiveShell.__init__): Added option to
3761 fine-tune banner.
3793 fine-tune banner.
3762
3794
3763 * IPython/numutils.py (spike): Deprecate these spike functions,
3795 * IPython/numutils.py (spike): Deprecate these spike functions,
3764 delete (long deprecated) gnuplot_exec handler.
3796 delete (long deprecated) gnuplot_exec handler.
3765
3797
3766 2004-08-26 Fernando Perez <fperez@colorado.edu>
3798 2004-08-26 Fernando Perez <fperez@colorado.edu>
3767
3799
3768 * ipython.1: Update for threading options, plus some others which
3800 * ipython.1: Update for threading options, plus some others which
3769 were missing.
3801 were missing.
3770
3802
3771 * IPython/ipmaker.py (__call__): Added -wthread option for
3803 * IPython/ipmaker.py (__call__): Added -wthread option for
3772 wxpython thread handling. Make sure threading options are only
3804 wxpython thread handling. Make sure threading options are only
3773 valid at the command line.
3805 valid at the command line.
3774
3806
3775 * scripts/ipython: moved shell selection into a factory function
3807 * scripts/ipython: moved shell selection into a factory function
3776 in Shell.py, to keep the starter script to a minimum.
3808 in Shell.py, to keep the starter script to a minimum.
3777
3809
3778 2004-08-25 Fernando Perez <fperez@colorado.edu>
3810 2004-08-25 Fernando Perez <fperez@colorado.edu>
3779
3811
3780 * IPython/Shell.py (IPShellWX.wxexit): fixes to WX threading, by
3812 * IPython/Shell.py (IPShellWX.wxexit): fixes to WX threading, by
3781 John. Along with some recent changes he made to matplotlib, the
3813 John. Along with some recent changes he made to matplotlib, the
3782 next versions of both systems should work very well together.
3814 next versions of both systems should work very well together.
3783
3815
3784 2004-08-24 Fernando Perez <fperez@colorado.edu>
3816 2004-08-24 Fernando Perez <fperez@colorado.edu>
3785
3817
3786 * IPython/Magic.py (Magic.magic_prun): cleanup some dead code. I
3818 * IPython/Magic.py (Magic.magic_prun): cleanup some dead code. I
3787 tried to switch the profiling to using hotshot, but I'm getting
3819 tried to switch the profiling to using hotshot, but I'm getting
3788 strange errors from prof.runctx() there. I may be misreading the
3820 strange errors from prof.runctx() there. I may be misreading the
3789 docs, but it looks weird. For now the profiling code will
3821 docs, but it looks weird. For now the profiling code will
3790 continue to use the standard profiler.
3822 continue to use the standard profiler.
3791
3823
3792 2004-08-23 Fernando Perez <fperez@colorado.edu>
3824 2004-08-23 Fernando Perez <fperez@colorado.edu>
3793
3825
3794 * IPython/Shell.py (IPShellWX.__init__): Improvements to the WX
3826 * IPython/Shell.py (IPShellWX.__init__): Improvements to the WX
3795 threaded shell, by John Hunter. It's not quite ready yet, but
3827 threaded shell, by John Hunter. It's not quite ready yet, but
3796 close.
3828 close.
3797
3829
3798 2004-08-22 Fernando Perez <fperez@colorado.edu>
3830 2004-08-22 Fernando Perez <fperez@colorado.edu>
3799
3831
3800 * IPython/iplib.py (InteractiveShell.interact): tab cleanups, also
3832 * IPython/iplib.py (InteractiveShell.interact): tab cleanups, also
3801 in Magic and ultraTB.
3833 in Magic and ultraTB.
3802
3834
3803 * ipython.1: document threading options in manpage.
3835 * ipython.1: document threading options in manpage.
3804
3836
3805 * scripts/ipython: Changed name of -thread option to -gthread,
3837 * scripts/ipython: Changed name of -thread option to -gthread,
3806 since this is GTK specific. I want to leave the door open for a
3838 since this is GTK specific. I want to leave the door open for a
3807 -wthread option for WX, which will most likely be necessary. This
3839 -wthread option for WX, which will most likely be necessary. This
3808 change affects usage and ipmaker as well.
3840 change affects usage and ipmaker as well.
3809
3841
3810 * IPython/Shell.py (matplotlib_shell): Add a factory function to
3842 * IPython/Shell.py (matplotlib_shell): Add a factory function to
3811 handle the matplotlib shell issues. Code by John Hunter
3843 handle the matplotlib shell issues. Code by John Hunter
3812 <jdhunter-AT-nitace.bsd.uchicago.edu>.
3844 <jdhunter-AT-nitace.bsd.uchicago.edu>.
3813 (IPShellMatplotlibWX.__init__): Rudimentary WX support. It's
3845 (IPShellMatplotlibWX.__init__): Rudimentary WX support. It's
3814 broken (and disabled for end users) for now, but it puts the
3846 broken (and disabled for end users) for now, but it puts the
3815 infrastructure in place.
3847 infrastructure in place.
3816
3848
3817 2004-08-21 Fernando Perez <fperez@colorado.edu>
3849 2004-08-21 Fernando Perez <fperez@colorado.edu>
3818
3850
3819 * ipythonrc-pylab: Add matplotlib support.
3851 * ipythonrc-pylab: Add matplotlib support.
3820
3852
3821 * matplotlib_config.py: new files for matplotlib support, part of
3853 * matplotlib_config.py: new files for matplotlib support, part of
3822 the pylab profile.
3854 the pylab profile.
3823
3855
3824 * IPython/usage.py (__doc__): documented the threading options.
3856 * IPython/usage.py (__doc__): documented the threading options.
3825
3857
3826 2004-08-20 Fernando Perez <fperez@colorado.edu>
3858 2004-08-20 Fernando Perez <fperez@colorado.edu>
3827
3859
3828 * ipython: Modified the main calling routine to handle the -thread
3860 * ipython: Modified the main calling routine to handle the -thread
3829 and -mpthread options. This needs to be done as a top-level hack,
3861 and -mpthread options. This needs to be done as a top-level hack,
3830 because it determines which class to instantiate for IPython
3862 because it determines which class to instantiate for IPython
3831 itself.
3863 itself.
3832
3864
3833 * IPython/Shell.py (MTInteractiveShell.__init__): New set of
3865 * IPython/Shell.py (MTInteractiveShell.__init__): New set of
3834 classes to support multithreaded GTK operation without blocking,
3866 classes to support multithreaded GTK operation without blocking,
3835 and matplotlib with all backends. This is a lot of still very
3867 and matplotlib with all backends. This is a lot of still very
3836 experimental code, and threads are tricky. So it may still have a
3868 experimental code, and threads are tricky. So it may still have a
3837 few rough edges... This code owes a lot to
3869 few rough edges... This code owes a lot to
3838 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65109, by
3870 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65109, by
3839 Brian # McErlean and John Finlay, to Antoon Pardon for fixes, and
3871 Brian # McErlean and John Finlay, to Antoon Pardon for fixes, and
3840 to John Hunter for all the matplotlib work.
3872 to John Hunter for all the matplotlib work.
3841
3873
3842 * IPython/ipmaker.py (__call__): Added -thread and -mpthread
3874 * IPython/ipmaker.py (__call__): Added -thread and -mpthread
3843 options for gtk thread and matplotlib support.
3875 options for gtk thread and matplotlib support.
3844
3876
3845 2004-08-16 Fernando Perez <fperez@colorado.edu>
3877 2004-08-16 Fernando Perez <fperez@colorado.edu>
3846
3878
3847 * IPython/iplib.py (InteractiveShell.__init__): don't trigger
3879 * IPython/iplib.py (InteractiveShell.__init__): don't trigger
3848 autocall for things like p*q,p/q,p+q,p-q, when p is callable. Bug
3880 autocall for things like p*q,p/q,p+q,p-q, when p is callable. Bug
3849 reported by Stephen Walton <stephen.walton-AT-csun.edu>.
3881 reported by Stephen Walton <stephen.walton-AT-csun.edu>.
3850
3882
3851 2004-08-11 Fernando Perez <fperez@colorado.edu>
3883 2004-08-11 Fernando Perez <fperez@colorado.edu>
3852
3884
3853 * setup.py (isfile): Fix build so documentation gets updated for
3885 * setup.py (isfile): Fix build so documentation gets updated for
3854 rpms (it was only done for .tgz builds).
3886 rpms (it was only done for .tgz builds).
3855
3887
3856 2004-08-10 Fernando Perez <fperez@colorado.edu>
3888 2004-08-10 Fernando Perez <fperez@colorado.edu>
3857
3889
3858 * genutils.py (Term): Fix misspell of stdin stream (sin->cin).
3890 * genutils.py (Term): Fix misspell of stdin stream (sin->cin).
3859
3891
3860 * iplib.py : Silence syntax error exceptions in tab-completion.
3892 * iplib.py : Silence syntax error exceptions in tab-completion.
3861
3893
3862 2004-08-05 Fernando Perez <fperez@colorado.edu>
3894 2004-08-05 Fernando Perez <fperez@colorado.edu>
3863
3895
3864 * IPython/Prompts.py (Prompt2.set_colors): Fix incorrectly set
3896 * IPython/Prompts.py (Prompt2.set_colors): Fix incorrectly set
3865 'color off' mark for continuation prompts. This was causing long
3897 'color off' mark for continuation prompts. This was causing long
3866 continuation lines to mis-wrap.
3898 continuation lines to mis-wrap.
3867
3899
3868 2004-08-01 Fernando Perez <fperez@colorado.edu>
3900 2004-08-01 Fernando Perez <fperez@colorado.edu>
3869
3901
3870 * IPython/ipmaker.py (make_IPython): Allow the shell class used
3902 * IPython/ipmaker.py (make_IPython): Allow the shell class used
3871 for building ipython to be a parameter. All this is necessary
3903 for building ipython to be a parameter. All this is necessary
3872 right now to have a multithreaded version, but this insane
3904 right now to have a multithreaded version, but this insane
3873 non-design will be cleaned up soon. For now, it's a hack that
3905 non-design will be cleaned up soon. For now, it's a hack that
3874 works.
3906 works.
3875
3907
3876 * IPython/Shell.py (IPShell.__init__): Stop using mutable default
3908 * IPython/Shell.py (IPShell.__init__): Stop using mutable default
3877 args in various places. No bugs so far, but it's a dangerous
3909 args in various places. No bugs so far, but it's a dangerous
3878 practice.
3910 practice.
3879
3911
3880 2004-07-31 Fernando Perez <fperez@colorado.edu>
3912 2004-07-31 Fernando Perez <fperez@colorado.edu>
3881
3913
3882 * IPython/iplib.py (complete): ignore SyntaxError exceptions to
3914 * IPython/iplib.py (complete): ignore SyntaxError exceptions to
3883 fix completion of files with dots in their names under most
3915 fix completion of files with dots in their names under most
3884 profiles (pysh was OK because the completion order is different).
3916 profiles (pysh was OK because the completion order is different).
3885
3917
3886 2004-07-27 Fernando Perez <fperez@colorado.edu>
3918 2004-07-27 Fernando Perez <fperez@colorado.edu>
3887
3919
3888 * IPython/iplib.py (InteractiveShell.__init__): build dict of
3920 * IPython/iplib.py (InteractiveShell.__init__): build dict of
3889 keywords manually, b/c the one in keyword.py was removed in python
3921 keywords manually, b/c the one in keyword.py was removed in python
3890 2.4. Patch by Anakim Border <aborder-AT-users.sourceforge.net>.
3922 2.4. Patch by Anakim Border <aborder-AT-users.sourceforge.net>.
3891 This is NOT a bug under python 2.3 and earlier.
3923 This is NOT a bug under python 2.3 and earlier.
3892
3924
3893 2004-07-26 Fernando Perez <fperez@colorado.edu>
3925 2004-07-26 Fernando Perez <fperez@colorado.edu>
3894
3926
3895 * IPython/ultraTB.py (VerboseTB.text): Add another
3927 * IPython/ultraTB.py (VerboseTB.text): Add another
3896 linecache.checkcache() call to try to prevent inspect.py from
3928 linecache.checkcache() call to try to prevent inspect.py from
3897 crashing under python 2.3. I think this fixes
3929 crashing under python 2.3. I think this fixes
3898 http://www.scipy.net/roundup/ipython/issue17.
3930 http://www.scipy.net/roundup/ipython/issue17.
3899
3931
3900 2004-07-26 *** Released version 0.6.2
3932 2004-07-26 *** Released version 0.6.2
3901
3933
3902 2004-07-26 Fernando Perez <fperez@colorado.edu>
3934 2004-07-26 Fernando Perez <fperez@colorado.edu>
3903
3935
3904 * IPython/Magic.py (Magic.magic_cd): Fix bug where 'cd -N' would
3936 * IPython/Magic.py (Magic.magic_cd): Fix bug where 'cd -N' would
3905 fail for any number.
3937 fail for any number.
3906 (Magic.magic_bookmark): Fix bug where 'bookmark -l' would fail for
3938 (Magic.magic_bookmark): Fix bug where 'bookmark -l' would fail for
3907 empty bookmarks.
3939 empty bookmarks.
3908
3940
3909 2004-07-26 *** Released version 0.6.1
3941 2004-07-26 *** Released version 0.6.1
3910
3942
3911 2004-07-26 Fernando Perez <fperez@colorado.edu>
3943 2004-07-26 Fernando Perez <fperez@colorado.edu>
3912
3944
3913 * ipython_win_post_install.py (run): Added pysh shortcut for Windows.
3945 * ipython_win_post_install.py (run): Added pysh shortcut for Windows.
3914
3946
3915 * IPython/iplib.py (protect_filename): Applied Ville's patch for
3947 * IPython/iplib.py (protect_filename): Applied Ville's patch for
3916 escaping '()[]{}' in filenames.
3948 escaping '()[]{}' in filenames.
3917
3949
3918 * IPython/Magic.py (shlex_split): Fix handling of '*' and '?' for
3950 * IPython/Magic.py (shlex_split): Fix handling of '*' and '?' for
3919 Python 2.2 users who lack a proper shlex.split.
3951 Python 2.2 users who lack a proper shlex.split.
3920
3952
3921 2004-07-19 Fernando Perez <fperez@colorado.edu>
3953 2004-07-19 Fernando Perez <fperez@colorado.edu>
3922
3954
3923 * IPython/iplib.py (InteractiveShell.init_readline): Add support
3955 * IPython/iplib.py (InteractiveShell.init_readline): Add support
3924 for reading readline's init file. I follow the normal chain:
3956 for reading readline's init file. I follow the normal chain:
3925 $INPUTRC is honored, otherwise ~/.inputrc is used. Thanks to a
3957 $INPUTRC is honored, otherwise ~/.inputrc is used. Thanks to a
3926 report by Mike Heeter. This closes
3958 report by Mike Heeter. This closes
3927 http://www.scipy.net/roundup/ipython/issue16.
3959 http://www.scipy.net/roundup/ipython/issue16.
3928
3960
3929 2004-07-18 Fernando Perez <fperez@colorado.edu>
3961 2004-07-18 Fernando Perez <fperez@colorado.edu>
3930
3962
3931 * IPython/iplib.py (__init__): Add better handling of '\' under
3963 * IPython/iplib.py (__init__): Add better handling of '\' under
3932 Win32 for filenames. After a patch by Ville.
3964 Win32 for filenames. After a patch by Ville.
3933
3965
3934 2004-07-17 Fernando Perez <fperez@colorado.edu>
3966 2004-07-17 Fernando Perez <fperez@colorado.edu>
3935
3967
3936 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
3968 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
3937 autocalling would be triggered for 'foo is bar' if foo is
3969 autocalling would be triggered for 'foo is bar' if foo is
3938 callable. I also cleaned up the autocall detection code to use a
3970 callable. I also cleaned up the autocall detection code to use a
3939 regexp, which is faster. Bug reported by Alexander Schmolck.
3971 regexp, which is faster. Bug reported by Alexander Schmolck.
3940
3972
3941 * IPython/Magic.py (Magic.magic_pinfo): Fix bug where strings with
3973 * IPython/Magic.py (Magic.magic_pinfo): Fix bug where strings with
3942 '?' in them would confuse the help system. Reported by Alex
3974 '?' in them would confuse the help system. Reported by Alex
3943 Schmolck.
3975 Schmolck.
3944
3976
3945 2004-07-16 Fernando Perez <fperez@colorado.edu>
3977 2004-07-16 Fernando Perez <fperez@colorado.edu>
3946
3978
3947 * IPython/GnuplotInteractive.py (__all__): added plot2.
3979 * IPython/GnuplotInteractive.py (__all__): added plot2.
3948
3980
3949 * IPython/Gnuplot2.py (Gnuplot.plot2): added new function for
3981 * IPython/Gnuplot2.py (Gnuplot.plot2): added new function for
3950 plotting dictionaries, lists or tuples of 1d arrays.
3982 plotting dictionaries, lists or tuples of 1d arrays.
3951
3983
3952 * IPython/Magic.py (Magic.magic_hist): small clenaups and
3984 * IPython/Magic.py (Magic.magic_hist): small clenaups and
3953 optimizations.
3985 optimizations.
3954
3986
3955 * IPython/iplib.py:Remove old Changelog info for cleanup. This is
3987 * IPython/iplib.py:Remove old Changelog info for cleanup. This is
3956 the information which was there from Janko's original IPP code:
3988 the information which was there from Janko's original IPP code:
3957
3989
3958 03.05.99 20:53 porto.ifm.uni-kiel.de
3990 03.05.99 20:53 porto.ifm.uni-kiel.de
3959 --Started changelog.
3991 --Started changelog.
3960 --make clear do what it say it does
3992 --make clear do what it say it does
3961 --added pretty output of lines from inputcache
3993 --added pretty output of lines from inputcache
3962 --Made Logger a mixin class, simplifies handling of switches
3994 --Made Logger a mixin class, simplifies handling of switches
3963 --Added own completer class. .string<TAB> expands to last history
3995 --Added own completer class. .string<TAB> expands to last history
3964 line which starts with string. The new expansion is also present
3996 line which starts with string. The new expansion is also present
3965 with Ctrl-r from the readline library. But this shows, who this
3997 with Ctrl-r from the readline library. But this shows, who this
3966 can be done for other cases.
3998 can be done for other cases.
3967 --Added convention that all shell functions should accept a
3999 --Added convention that all shell functions should accept a
3968 parameter_string This opens the door for different behaviour for
4000 parameter_string This opens the door for different behaviour for
3969 each function. @cd is a good example of this.
4001 each function. @cd is a good example of this.
3970
4002
3971 04.05.99 12:12 porto.ifm.uni-kiel.de
4003 04.05.99 12:12 porto.ifm.uni-kiel.de
3972 --added logfile rotation
4004 --added logfile rotation
3973 --added new mainloop method which freezes first the namespace
4005 --added new mainloop method which freezes first the namespace
3974
4006
3975 07.05.99 21:24 porto.ifm.uni-kiel.de
4007 07.05.99 21:24 porto.ifm.uni-kiel.de
3976 --added the docreader classes. Now there is a help system.
4008 --added the docreader classes. Now there is a help system.
3977 -This is only a first try. Currently it's not easy to put new
4009 -This is only a first try. Currently it's not easy to put new
3978 stuff in the indices. But this is the way to go. Info would be
4010 stuff in the indices. But this is the way to go. Info would be
3979 better, but HTML is every where and not everybody has an info
4011 better, but HTML is every where and not everybody has an info
3980 system installed and it's not so easy to change html-docs to info.
4012 system installed and it's not so easy to change html-docs to info.
3981 --added global logfile option
4013 --added global logfile option
3982 --there is now a hook for object inspection method pinfo needs to
4014 --there is now a hook for object inspection method pinfo needs to
3983 be provided for this. Can be reached by two '??'.
4015 be provided for this. Can be reached by two '??'.
3984
4016
3985 08.05.99 20:51 porto.ifm.uni-kiel.de
4017 08.05.99 20:51 porto.ifm.uni-kiel.de
3986 --added a README
4018 --added a README
3987 --bug in rc file. Something has changed so functions in the rc
4019 --bug in rc file. Something has changed so functions in the rc
3988 file need to reference the shell and not self. Not clear if it's a
4020 file need to reference the shell and not self. Not clear if it's a
3989 bug or feature.
4021 bug or feature.
3990 --changed rc file for new behavior
4022 --changed rc file for new behavior
3991
4023
3992 2004-07-15 Fernando Perez <fperez@colorado.edu>
4024 2004-07-15 Fernando Perez <fperez@colorado.edu>
3993
4025
3994 * IPython/Logger.py (Logger.log): fixed recent bug where the input
4026 * IPython/Logger.py (Logger.log): fixed recent bug where the input
3995 cache was falling out of sync in bizarre manners when multi-line
4027 cache was falling out of sync in bizarre manners when multi-line
3996 input was present. Minor optimizations and cleanup.
4028 input was present. Minor optimizations and cleanup.
3997
4029
3998 (Logger): Remove old Changelog info for cleanup. This is the
4030 (Logger): Remove old Changelog info for cleanup. This is the
3999 information which was there from Janko's original code:
4031 information which was there from Janko's original code:
4000
4032
4001 Changes to Logger: - made the default log filename a parameter
4033 Changes to Logger: - made the default log filename a parameter
4002
4034
4003 - put a check for lines beginning with !@? in log(). Needed
4035 - put a check for lines beginning with !@? in log(). Needed
4004 (even if the handlers properly log their lines) for mid-session
4036 (even if the handlers properly log their lines) for mid-session
4005 logging activation to work properly. Without this, lines logged
4037 logging activation to work properly. Without this, lines logged
4006 in mid session, which get read from the cache, would end up
4038 in mid session, which get read from the cache, would end up
4007 'bare' (with !@? in the open) in the log. Now they are caught
4039 'bare' (with !@? in the open) in the log. Now they are caught
4008 and prepended with a #.
4040 and prepended with a #.
4009
4041
4010 * IPython/iplib.py (InteractiveShell.init_readline): added check
4042 * IPython/iplib.py (InteractiveShell.init_readline): added check
4011 in case MagicCompleter fails to be defined, so we don't crash.
4043 in case MagicCompleter fails to be defined, so we don't crash.
4012
4044
4013 2004-07-13 Fernando Perez <fperez@colorado.edu>
4045 2004-07-13 Fernando Perez <fperez@colorado.edu>
4014
4046
4015 * IPython/Gnuplot2.py (Gnuplot.hardcopy): add automatic generation
4047 * IPython/Gnuplot2.py (Gnuplot.hardcopy): add automatic generation
4016 of EPS if the requested filename ends in '.eps'.
4048 of EPS if the requested filename ends in '.eps'.
4017
4049
4018 2004-07-04 Fernando Perez <fperez@colorado.edu>
4050 2004-07-04 Fernando Perez <fperez@colorado.edu>
4019
4051
4020 * IPython/iplib.py (InteractiveShell.handle_shell_escape): Fix
4052 * IPython/iplib.py (InteractiveShell.handle_shell_escape): Fix
4021 escaping of quotes when calling the shell.
4053 escaping of quotes when calling the shell.
4022
4054
4023 2004-07-02 Fernando Perez <fperez@colorado.edu>
4055 2004-07-02 Fernando Perez <fperez@colorado.edu>
4024
4056
4025 * IPython/Prompts.py (CachedOutput.update): Fix problem with
4057 * IPython/Prompts.py (CachedOutput.update): Fix problem with
4026 gettext not working because we were clobbering '_'. Fixes
4058 gettext not working because we were clobbering '_'. Fixes
4027 http://www.scipy.net/roundup/ipython/issue6.
4059 http://www.scipy.net/roundup/ipython/issue6.
4028
4060
4029 2004-07-01 Fernando Perez <fperez@colorado.edu>
4061 2004-07-01 Fernando Perez <fperez@colorado.edu>
4030
4062
4031 * IPython/Magic.py (Magic.magic_cd): integrated bookmark handling
4063 * IPython/Magic.py (Magic.magic_cd): integrated bookmark handling
4032 into @cd. Patch by Ville.
4064 into @cd. Patch by Ville.
4033
4065
4034 * IPython/iplib.py (InteractiveShell.post_config_initialization):
4066 * IPython/iplib.py (InteractiveShell.post_config_initialization):
4035 new function to store things after ipmaker runs. Patch by Ville.
4067 new function to store things after ipmaker runs. Patch by Ville.
4036 Eventually this will go away once ipmaker is removed and the class
4068 Eventually this will go away once ipmaker is removed and the class
4037 gets cleaned up, but for now it's ok. Key functionality here is
4069 gets cleaned up, but for now it's ok. Key functionality here is
4038 the addition of the persistent storage mechanism, a dict for
4070 the addition of the persistent storage mechanism, a dict for
4039 keeping data across sessions (for now just bookmarks, but more can
4071 keeping data across sessions (for now just bookmarks, but more can
4040 be implemented later).
4072 be implemented later).
4041
4073
4042 * IPython/Magic.py (Magic.magic_bookmark): New bookmark system,
4074 * IPython/Magic.py (Magic.magic_bookmark): New bookmark system,
4043 persistent across sections. Patch by Ville, I modified it
4075 persistent across sections. Patch by Ville, I modified it
4044 soemwhat to allow bookmarking arbitrary dirs other than CWD. Also
4076 soemwhat to allow bookmarking arbitrary dirs other than CWD. Also
4045 added a '-l' option to list all bookmarks.
4077 added a '-l' option to list all bookmarks.
4046
4078
4047 * IPython/iplib.py (InteractiveShell.atexit_operations): new
4079 * IPython/iplib.py (InteractiveShell.atexit_operations): new
4048 center for cleanup. Registered with atexit.register(). I moved
4080 center for cleanup. Registered with atexit.register(). I moved
4049 here the old exit_cleanup(). After a patch by Ville.
4081 here the old exit_cleanup(). After a patch by Ville.
4050
4082
4051 * IPython/Magic.py (get_py_filename): added '~' to the accepted
4083 * IPython/Magic.py (get_py_filename): added '~' to the accepted
4052 characters in the hacked shlex_split for python 2.2.
4084 characters in the hacked shlex_split for python 2.2.
4053
4085
4054 * IPython/iplib.py (file_matches): more fixes to filenames with
4086 * IPython/iplib.py (file_matches): more fixes to filenames with
4055 whitespace in them. It's not perfect, but limitations in python's
4087 whitespace in them. It's not perfect, but limitations in python's
4056 readline make it impossible to go further.
4088 readline make it impossible to go further.
4057
4089
4058 2004-06-29 Fernando Perez <fperez@colorado.edu>
4090 2004-06-29 Fernando Perez <fperez@colorado.edu>
4059
4091
4060 * IPython/iplib.py (file_matches): escape whitespace correctly in
4092 * IPython/iplib.py (file_matches): escape whitespace correctly in
4061 filename completions. Bug reported by Ville.
4093 filename completions. Bug reported by Ville.
4062
4094
4063 2004-06-28 Fernando Perez <fperez@colorado.edu>
4095 2004-06-28 Fernando Perez <fperez@colorado.edu>
4064
4096
4065 * IPython/ipmaker.py (__call__): Added per-profile histories. Now
4097 * IPython/ipmaker.py (__call__): Added per-profile histories. Now
4066 the history file will be called 'history-PROFNAME' (or just
4098 the history file will be called 'history-PROFNAME' (or just
4067 'history' if no profile is loaded). I was getting annoyed at
4099 'history' if no profile is loaded). I was getting annoyed at
4068 getting my Numerical work history clobbered by pysh sessions.
4100 getting my Numerical work history clobbered by pysh sessions.
4069
4101
4070 * IPython/iplib.py (InteractiveShell.__init__): Internal
4102 * IPython/iplib.py (InteractiveShell.__init__): Internal
4071 getoutputerror() function so that we can honor the system_verbose
4103 getoutputerror() function so that we can honor the system_verbose
4072 flag for _all_ system calls. I also added escaping of #
4104 flag for _all_ system calls. I also added escaping of #
4073 characters here to avoid confusing Itpl.
4105 characters here to avoid confusing Itpl.
4074
4106
4075 * IPython/Magic.py (shlex_split): removed call to shell in
4107 * IPython/Magic.py (shlex_split): removed call to shell in
4076 parse_options and replaced it with shlex.split(). The annoying
4108 parse_options and replaced it with shlex.split(). The annoying
4077 part was that in Python 2.2, shlex.split() doesn't exist, so I had
4109 part was that in Python 2.2, shlex.split() doesn't exist, so I had
4078 to backport it from 2.3, with several frail hacks (the shlex
4110 to backport it from 2.3, with several frail hacks (the shlex
4079 module is rather limited in 2.2). Thanks to a suggestion by Ville
4111 module is rather limited in 2.2). Thanks to a suggestion by Ville
4080 Vainio <vivainio@kolumbus.fi>. For Python 2.3 there should be no
4112 Vainio <vivainio@kolumbus.fi>. For Python 2.3 there should be no
4081 problem.
4113 problem.
4082
4114
4083 (Magic.magic_system_verbose): new toggle to print the actual
4115 (Magic.magic_system_verbose): new toggle to print the actual
4084 system calls made by ipython. Mainly for debugging purposes.
4116 system calls made by ipython. Mainly for debugging purposes.
4085
4117
4086 * IPython/GnuplotRuntime.py (gnu_out): fix bug for cygwin, which
4118 * IPython/GnuplotRuntime.py (gnu_out): fix bug for cygwin, which
4087 doesn't support persistence. Reported (and fix suggested) by
4119 doesn't support persistence. Reported (and fix suggested) by
4088 Travis Caldwell <travis_caldwell2000@yahoo.com>.
4120 Travis Caldwell <travis_caldwell2000@yahoo.com>.
4089
4121
4090 2004-06-26 Fernando Perez <fperez@colorado.edu>
4122 2004-06-26 Fernando Perez <fperez@colorado.edu>
4091
4123
4092 * IPython/Logger.py (Logger.log): fix to handle correctly empty
4124 * IPython/Logger.py (Logger.log): fix to handle correctly empty
4093 continue prompts.
4125 continue prompts.
4094
4126
4095 * IPython/Extensions/InterpreterExec.py (pysh): moved the pysh()
4127 * IPython/Extensions/InterpreterExec.py (pysh): moved the pysh()
4096 function (basically a big docstring) and a few more things here to
4128 function (basically a big docstring) and a few more things here to
4097 speedup startup. pysh.py is now very lightweight. We want because
4129 speedup startup. pysh.py is now very lightweight. We want because
4098 it gets execfile'd, while InterpreterExec gets imported, so
4130 it gets execfile'd, while InterpreterExec gets imported, so
4099 byte-compilation saves time.
4131 byte-compilation saves time.
4100
4132
4101 2004-06-25 Fernando Perez <fperez@colorado.edu>
4133 2004-06-25 Fernando Perez <fperez@colorado.edu>
4102
4134
4103 * IPython/Magic.py (Magic.magic_cd): Fixed to restore usage of 'cd
4135 * IPython/Magic.py (Magic.magic_cd): Fixed to restore usage of 'cd
4104 -NUM', which was recently broken.
4136 -NUM', which was recently broken.
4105
4137
4106 * IPython/iplib.py (InteractiveShell.handle_shell_escape): allow !
4138 * IPython/iplib.py (InteractiveShell.handle_shell_escape): allow !
4107 in multi-line input (but not !!, which doesn't make sense there).
4139 in multi-line input (but not !!, which doesn't make sense there).
4108
4140
4109 * IPython/UserConfig/ipythonrc: made autoindent on by default.
4141 * IPython/UserConfig/ipythonrc: made autoindent on by default.
4110 It's just too useful, and people can turn it off in the less
4142 It's just too useful, and people can turn it off in the less
4111 common cases where it's a problem.
4143 common cases where it's a problem.
4112
4144
4113 2004-06-24 Fernando Perez <fperez@colorado.edu>
4145 2004-06-24 Fernando Perez <fperez@colorado.edu>
4114
4146
4115 * IPython/iplib.py (InteractiveShell._prefilter): big change -
4147 * IPython/iplib.py (InteractiveShell._prefilter): big change -
4116 special syntaxes (like alias calling) is now allied in multi-line
4148 special syntaxes (like alias calling) is now allied in multi-line
4117 input. This is still _very_ experimental, but it's necessary for
4149 input. This is still _very_ experimental, but it's necessary for
4118 efficient shell usage combining python looping syntax with system
4150 efficient shell usage combining python looping syntax with system
4119 calls. For now it's restricted to aliases, I don't think it
4151 calls. For now it's restricted to aliases, I don't think it
4120 really even makes sense to have this for magics.
4152 really even makes sense to have this for magics.
4121
4153
4122 2004-06-23 Fernando Perez <fperez@colorado.edu>
4154 2004-06-23 Fernando Perez <fperez@colorado.edu>
4123
4155
4124 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Added
4156 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Added
4125 $var=cmd <=> @sc var=cmd and $$var=cmd <=> @sc -l var=cmd.
4157 $var=cmd <=> @sc var=cmd and $$var=cmd <=> @sc -l var=cmd.
4126
4158
4127 * IPython/Magic.py (Magic.magic_rehashx): modified to handle
4159 * IPython/Magic.py (Magic.magic_rehashx): modified to handle
4128 extensions under Windows (after code sent by Gary Bishop). The
4160 extensions under Windows (after code sent by Gary Bishop). The
4129 extensions considered 'executable' are stored in IPython's rc
4161 extensions considered 'executable' are stored in IPython's rc
4130 structure as win_exec_ext.
4162 structure as win_exec_ext.
4131
4163
4132 * IPython/genutils.py (shell): new function, like system() but
4164 * IPython/genutils.py (shell): new function, like system() but
4133 without return value. Very useful for interactive shell work.
4165 without return value. Very useful for interactive shell work.
4134
4166
4135 * IPython/Magic.py (Magic.magic_unalias): New @unalias function to
4167 * IPython/Magic.py (Magic.magic_unalias): New @unalias function to
4136 delete aliases.
4168 delete aliases.
4137
4169
4138 * IPython/iplib.py (InteractiveShell.alias_table_update): make
4170 * IPython/iplib.py (InteractiveShell.alias_table_update): make
4139 sure that the alias table doesn't contain python keywords.
4171 sure that the alias table doesn't contain python keywords.
4140
4172
4141 2004-06-21 Fernando Perez <fperez@colorado.edu>
4173 2004-06-21 Fernando Perez <fperez@colorado.edu>
4142
4174
4143 * IPython/Magic.py (Magic.magic_rehash): Fix crash when
4175 * IPython/Magic.py (Magic.magic_rehash): Fix crash when
4144 non-existent items are found in $PATH. Reported by Thorsten.
4176 non-existent items are found in $PATH. Reported by Thorsten.
4145
4177
4146 2004-06-20 Fernando Perez <fperez@colorado.edu>
4178 2004-06-20 Fernando Perez <fperez@colorado.edu>
4147
4179
4148 * IPython/iplib.py (complete): modified the completer so that the
4180 * IPython/iplib.py (complete): modified the completer so that the
4149 order of priorities can be easily changed at runtime.
4181 order of priorities can be easily changed at runtime.
4150
4182
4151 * IPython/Extensions/InterpreterExec.py (prefilter_shell):
4183 * IPython/Extensions/InterpreterExec.py (prefilter_shell):
4152 Modified to auto-execute all lines beginning with '~', '/' or '.'.
4184 Modified to auto-execute all lines beginning with '~', '/' or '.'.
4153
4185
4154 * IPython/Magic.py (Magic.magic_sx): modified @sc and @sx to
4186 * IPython/Magic.py (Magic.magic_sx): modified @sc and @sx to
4155 expand Python variables prepended with $ in all system calls. The
4187 expand Python variables prepended with $ in all system calls. The
4156 same was done to InteractiveShell.handle_shell_escape. Now all
4188 same was done to InteractiveShell.handle_shell_escape. Now all
4157 system access mechanisms (!, !!, @sc, @sx and aliases) allow the
4189 system access mechanisms (!, !!, @sc, @sx and aliases) allow the
4158 expansion of python variables and expressions according to the
4190 expansion of python variables and expressions according to the
4159 syntax of PEP-215 - http://www.python.org/peps/pep-0215.html.
4191 syntax of PEP-215 - http://www.python.org/peps/pep-0215.html.
4160
4192
4161 Though PEP-215 has been rejected, a similar (but simpler) one
4193 Though PEP-215 has been rejected, a similar (but simpler) one
4162 seems like it will go into Python 2.4, PEP-292 -
4194 seems like it will go into Python 2.4, PEP-292 -
4163 http://www.python.org/peps/pep-0292.html.
4195 http://www.python.org/peps/pep-0292.html.
4164
4196
4165 I'll keep the full syntax of PEP-215, since IPython has since the
4197 I'll keep the full syntax of PEP-215, since IPython has since the
4166 start used Ka-Ping Yee's reference implementation discussed there
4198 start used Ka-Ping Yee's reference implementation discussed there
4167 (Itpl), and I actually like the powerful semantics it offers.
4199 (Itpl), and I actually like the powerful semantics it offers.
4168
4200
4169 In order to access normal shell variables, the $ has to be escaped
4201 In order to access normal shell variables, the $ has to be escaped
4170 via an extra $. For example:
4202 via an extra $. For example:
4171
4203
4172 In [7]: PATH='a python variable'
4204 In [7]: PATH='a python variable'
4173
4205
4174 In [8]: !echo $PATH
4206 In [8]: !echo $PATH
4175 a python variable
4207 a python variable
4176
4208
4177 In [9]: !echo $$PATH
4209 In [9]: !echo $$PATH
4178 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
4210 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
4179
4211
4180 (Magic.parse_options): escape $ so the shell doesn't evaluate
4212 (Magic.parse_options): escape $ so the shell doesn't evaluate
4181 things prematurely.
4213 things prematurely.
4182
4214
4183 * IPython/iplib.py (InteractiveShell.call_alias): added the
4215 * IPython/iplib.py (InteractiveShell.call_alias): added the
4184 ability for aliases to expand python variables via $.
4216 ability for aliases to expand python variables via $.
4185
4217
4186 * IPython/Magic.py (Magic.magic_rehash): based on the new alias
4218 * IPython/Magic.py (Magic.magic_rehash): based on the new alias
4187 system, now there's a @rehash/@rehashx pair of magics. These work
4219 system, now there's a @rehash/@rehashx pair of magics. These work
4188 like the csh rehash command, and can be invoked at any time. They
4220 like the csh rehash command, and can be invoked at any time. They
4189 build a table of aliases to everything in the user's $PATH
4221 build a table of aliases to everything in the user's $PATH
4190 (@rehash uses everything, @rehashx is slower but only adds
4222 (@rehash uses everything, @rehashx is slower but only adds
4191 executable files). With this, the pysh.py-based shell profile can
4223 executable files). With this, the pysh.py-based shell profile can
4192 now simply call rehash upon startup, and full access to all
4224 now simply call rehash upon startup, and full access to all
4193 programs in the user's path is obtained.
4225 programs in the user's path is obtained.
4194
4226
4195 * IPython/iplib.py (InteractiveShell.call_alias): The new alias
4227 * IPython/iplib.py (InteractiveShell.call_alias): The new alias
4196 functionality is now fully in place. I removed the old dynamic
4228 functionality is now fully in place. I removed the old dynamic
4197 code generation based approach, in favor of a much lighter one
4229 code generation based approach, in favor of a much lighter one
4198 based on a simple dict. The advantage is that this allows me to
4230 based on a simple dict. The advantage is that this allows me to
4199 now have thousands of aliases with negligible cost (unthinkable
4231 now have thousands of aliases with negligible cost (unthinkable
4200 with the old system).
4232 with the old system).
4201
4233
4202 2004-06-19 Fernando Perez <fperez@colorado.edu>
4234 2004-06-19 Fernando Perez <fperez@colorado.edu>
4203
4235
4204 * IPython/iplib.py (__init__): extended MagicCompleter class to
4236 * IPython/iplib.py (__init__): extended MagicCompleter class to
4205 also complete (last in priority) on user aliases.
4237 also complete (last in priority) on user aliases.
4206
4238
4207 * IPython/Itpl.py (Itpl.__str__): fixed order of globals/locals in
4239 * IPython/Itpl.py (Itpl.__str__): fixed order of globals/locals in
4208 call to eval.
4240 call to eval.
4209 (ItplNS.__init__): Added a new class which functions like Itpl,
4241 (ItplNS.__init__): Added a new class which functions like Itpl,
4210 but allows configuring the namespace for the evaluation to occur
4242 but allows configuring the namespace for the evaluation to occur
4211 in.
4243 in.
4212
4244
4213 2004-06-18 Fernando Perez <fperez@colorado.edu>
4245 2004-06-18 Fernando Perez <fperez@colorado.edu>
4214
4246
4215 * IPython/iplib.py (InteractiveShell.runcode): modify to print a
4247 * IPython/iplib.py (InteractiveShell.runcode): modify to print a
4216 better message when 'exit' or 'quit' are typed (a common newbie
4248 better message when 'exit' or 'quit' are typed (a common newbie
4217 confusion).
4249 confusion).
4218
4250
4219 * IPython/Magic.py (Magic.magic_colors): Added the runtime color
4251 * IPython/Magic.py (Magic.magic_colors): Added the runtime color
4220 check for Windows users.
4252 check for Windows users.
4221
4253
4222 * IPython/iplib.py (InteractiveShell.user_setup): removed
4254 * IPython/iplib.py (InteractiveShell.user_setup): removed
4223 disabling of colors for Windows. I'll test at runtime and issue a
4255 disabling of colors for Windows. I'll test at runtime and issue a
4224 warning if Gary's readline isn't found, as to nudge users to
4256 warning if Gary's readline isn't found, as to nudge users to
4225 download it.
4257 download it.
4226
4258
4227 2004-06-16 Fernando Perez <fperez@colorado.edu>
4259 2004-06-16 Fernando Perez <fperez@colorado.edu>
4228
4260
4229 * IPython/genutils.py (Stream.__init__): changed to print errors
4261 * IPython/genutils.py (Stream.__init__): changed to print errors
4230 to sys.stderr. I had a circular dependency here. Now it's
4262 to sys.stderr. I had a circular dependency here. Now it's
4231 possible to run ipython as IDLE's shell (consider this pre-alpha,
4263 possible to run ipython as IDLE's shell (consider this pre-alpha,
4232 since true stdout things end up in the starting terminal instead
4264 since true stdout things end up in the starting terminal instead
4233 of IDLE's out).
4265 of IDLE's out).
4234
4266
4235 * IPython/Prompts.py (Prompt2.set_colors): prevent crashes for
4267 * IPython/Prompts.py (Prompt2.set_colors): prevent crashes for
4236 users who haven't # updated their prompt_in2 definitions. Remove
4268 users who haven't # updated their prompt_in2 definitions. Remove
4237 eventually.
4269 eventually.
4238 (multiple_replace): added credit to original ASPN recipe.
4270 (multiple_replace): added credit to original ASPN recipe.
4239
4271
4240 2004-06-15 Fernando Perez <fperez@colorado.edu>
4272 2004-06-15 Fernando Perez <fperez@colorado.edu>
4241
4273
4242 * IPython/iplib.py (InteractiveShell.__init__): add 'cp' to the
4274 * IPython/iplib.py (InteractiveShell.__init__): add 'cp' to the
4243 list of auto-defined aliases.
4275 list of auto-defined aliases.
4244
4276
4245 2004-06-13 Fernando Perez <fperez@colorado.edu>
4277 2004-06-13 Fernando Perez <fperez@colorado.edu>
4246
4278
4247 * setup.py (scriptfiles): Don't trigger win_post_install unless an
4279 * setup.py (scriptfiles): Don't trigger win_post_install unless an
4248 install was really requested (so setup.py can be used for other
4280 install was really requested (so setup.py can be used for other
4249 things under Windows).
4281 things under Windows).
4250
4282
4251 2004-06-10 Fernando Perez <fperez@colorado.edu>
4283 2004-06-10 Fernando Perez <fperez@colorado.edu>
4252
4284
4253 * IPython/Logger.py (Logger.create_log): Manually remove any old
4285 * IPython/Logger.py (Logger.create_log): Manually remove any old
4254 backup, since os.remove may fail under Windows. Fixes bug
4286 backup, since os.remove may fail under Windows. Fixes bug
4255 reported by Thorsten.
4287 reported by Thorsten.
4256
4288
4257 2004-06-09 Fernando Perez <fperez@colorado.edu>
4289 2004-06-09 Fernando Perez <fperez@colorado.edu>
4258
4290
4259 * examples/example-embed.py: fixed all references to %n (replaced
4291 * examples/example-embed.py: fixed all references to %n (replaced
4260 with \\# for ps1/out prompts and with \\D for ps2 prompts). Done
4292 with \\# for ps1/out prompts and with \\D for ps2 prompts). Done
4261 for all examples and the manual as well.
4293 for all examples and the manual as well.
4262
4294
4263 2004-06-08 Fernando Perez <fperez@colorado.edu>
4295 2004-06-08 Fernando Perez <fperez@colorado.edu>
4264
4296
4265 * IPython/Prompts.py (Prompt2.set_p_str): fixed all prompt
4297 * IPython/Prompts.py (Prompt2.set_p_str): fixed all prompt
4266 alignment and color management. All 3 prompt subsystems now
4298 alignment and color management. All 3 prompt subsystems now
4267 inherit from BasePrompt.
4299 inherit from BasePrompt.
4268
4300
4269 * tools/release: updates for windows installer build and tag rpms
4301 * tools/release: updates for windows installer build and tag rpms
4270 with python version (since paths are fixed).
4302 with python version (since paths are fixed).
4271
4303
4272 * IPython/UserConfig/ipythonrc: modified to use \# instead of %n,
4304 * IPython/UserConfig/ipythonrc: modified to use \# instead of %n,
4273 which will become eventually obsolete. Also fixed the default
4305 which will become eventually obsolete. Also fixed the default
4274 prompt_in2 to use \D, so at least new users start with the correct
4306 prompt_in2 to use \D, so at least new users start with the correct
4275 defaults.
4307 defaults.
4276 WARNING: Users with existing ipythonrc files will need to apply
4308 WARNING: Users with existing ipythonrc files will need to apply
4277 this fix manually!
4309 this fix manually!
4278
4310
4279 * setup.py: make windows installer (.exe). This is finally the
4311 * setup.py: make windows installer (.exe). This is finally the
4280 integration of an old patch by Cory Dodt <dodt-AT-fcoe.k12.ca.us>,
4312 integration of an old patch by Cory Dodt <dodt-AT-fcoe.k12.ca.us>,
4281 which I hadn't included because it required Python 2.3 (or recent
4313 which I hadn't included because it required Python 2.3 (or recent
4282 distutils).
4314 distutils).
4283
4315
4284 * IPython/usage.py (__doc__): update docs (and manpage) to reflect
4316 * IPython/usage.py (__doc__): update docs (and manpage) to reflect
4285 usage of new '\D' escape.
4317 usage of new '\D' escape.
4286
4318
4287 * IPython/Prompts.py (ROOT_SYMBOL): Small fix for Windows (which
4319 * IPython/Prompts.py (ROOT_SYMBOL): Small fix for Windows (which
4288 lacks os.getuid())
4320 lacks os.getuid())
4289 (CachedOutput.set_colors): Added the ability to turn coloring
4321 (CachedOutput.set_colors): Added the ability to turn coloring
4290 on/off with @colors even for manually defined prompt colors. It
4322 on/off with @colors even for manually defined prompt colors. It
4291 uses a nasty global, but it works safely and via the generic color
4323 uses a nasty global, but it works safely and via the generic color
4292 handling mechanism.
4324 handling mechanism.
4293 (Prompt2.__init__): Introduced new escape '\D' for continuation
4325 (Prompt2.__init__): Introduced new escape '\D' for continuation
4294 prompts. It represents the counter ('\#') as dots.
4326 prompts. It represents the counter ('\#') as dots.
4295 *** NOTE *** THIS IS A BACKWARDS-INCOMPATIBLE CHANGE. Users will
4327 *** NOTE *** THIS IS A BACKWARDS-INCOMPATIBLE CHANGE. Users will
4296 need to update their ipythonrc files and replace '%n' with '\D' in
4328 need to update their ipythonrc files and replace '%n' with '\D' in
4297 their prompt_in2 settings everywhere. Sorry, but there's
4329 their prompt_in2 settings everywhere. Sorry, but there's
4298 otherwise no clean way to get all prompts to properly align. The
4330 otherwise no clean way to get all prompts to properly align. The
4299 ipythonrc shipped with IPython has been updated.
4331 ipythonrc shipped with IPython has been updated.
4300
4332
4301 2004-06-07 Fernando Perez <fperez@colorado.edu>
4333 2004-06-07 Fernando Perez <fperez@colorado.edu>
4302
4334
4303 * setup.py (isfile): Pass local_icons option to latex2html, so the
4335 * setup.py (isfile): Pass local_icons option to latex2html, so the
4304 resulting HTML file is self-contained. Thanks to
4336 resulting HTML file is self-contained. Thanks to
4305 dryice-AT-liu.com.cn for the tip.
4337 dryice-AT-liu.com.cn for the tip.
4306
4338
4307 * pysh.py: I created a new profile 'shell', which implements a
4339 * pysh.py: I created a new profile 'shell', which implements a
4308 _rudimentary_ IPython-based shell. This is in NO WAY a realy
4340 _rudimentary_ IPython-based shell. This is in NO WAY a realy
4309 system shell, nor will it become one anytime soon. It's mainly
4341 system shell, nor will it become one anytime soon. It's mainly
4310 meant to illustrate the use of the new flexible bash-like prompts.
4342 meant to illustrate the use of the new flexible bash-like prompts.
4311 I guess it could be used by hardy souls for true shell management,
4343 I guess it could be used by hardy souls for true shell management,
4312 but it's no tcsh/bash... pysh.py is loaded by the 'shell'
4344 but it's no tcsh/bash... pysh.py is loaded by the 'shell'
4313 profile. This uses the InterpreterExec extension provided by
4345 profile. This uses the InterpreterExec extension provided by
4314 W.J. van der Laan <gnufnork-AT-hetdigitalegat.nl>
4346 W.J. van der Laan <gnufnork-AT-hetdigitalegat.nl>
4315
4347
4316 * IPython/Prompts.py (PromptOut.__str__): now it will correctly
4348 * IPython/Prompts.py (PromptOut.__str__): now it will correctly
4317 auto-align itself with the length of the previous input prompt
4349 auto-align itself with the length of the previous input prompt
4318 (taking into account the invisible color escapes).
4350 (taking into account the invisible color escapes).
4319 (CachedOutput.__init__): Large restructuring of this class. Now
4351 (CachedOutput.__init__): Large restructuring of this class. Now
4320 all three prompts (primary1, primary2, output) are proper objects,
4352 all three prompts (primary1, primary2, output) are proper objects,
4321 managed by the 'parent' CachedOutput class. The code is still a
4353 managed by the 'parent' CachedOutput class. The code is still a
4322 bit hackish (all prompts share state via a pointer to the cache),
4354 bit hackish (all prompts share state via a pointer to the cache),
4323 but it's overall far cleaner than before.
4355 but it's overall far cleaner than before.
4324
4356
4325 * IPython/genutils.py (getoutputerror): modified to add verbose,
4357 * IPython/genutils.py (getoutputerror): modified to add verbose,
4326 debug and header options. This makes the interface of all getout*
4358 debug and header options. This makes the interface of all getout*
4327 functions uniform.
4359 functions uniform.
4328 (SystemExec.getoutputerror): added getoutputerror to SystemExec.
4360 (SystemExec.getoutputerror): added getoutputerror to SystemExec.
4329
4361
4330 * IPython/Magic.py (Magic.default_option): added a function to
4362 * IPython/Magic.py (Magic.default_option): added a function to
4331 allow registering default options for any magic command. This
4363 allow registering default options for any magic command. This
4332 makes it easy to have profiles which customize the magics globally
4364 makes it easy to have profiles which customize the magics globally
4333 for a certain use. The values set through this function are
4365 for a certain use. The values set through this function are
4334 picked up by the parse_options() method, which all magics should
4366 picked up by the parse_options() method, which all magics should
4335 use to parse their options.
4367 use to parse their options.
4336
4368
4337 * IPython/genutils.py (warn): modified the warnings framework to
4369 * IPython/genutils.py (warn): modified the warnings framework to
4338 use the Term I/O class. I'm trying to slowly unify all of
4370 use the Term I/O class. I'm trying to slowly unify all of
4339 IPython's I/O operations to pass through Term.
4371 IPython's I/O operations to pass through Term.
4340
4372
4341 * IPython/Prompts.py (Prompt2._str_other): Added functionality in
4373 * IPython/Prompts.py (Prompt2._str_other): Added functionality in
4342 the secondary prompt to correctly match the length of the primary
4374 the secondary prompt to correctly match the length of the primary
4343 one for any prompt. Now multi-line code will properly line up
4375 one for any prompt. Now multi-line code will properly line up
4344 even for path dependent prompts, such as the new ones available
4376 even for path dependent prompts, such as the new ones available
4345 via the prompt_specials.
4377 via the prompt_specials.
4346
4378
4347 2004-06-06 Fernando Perez <fperez@colorado.edu>
4379 2004-06-06 Fernando Perez <fperez@colorado.edu>
4348
4380
4349 * IPython/Prompts.py (prompt_specials): Added the ability to have
4381 * IPython/Prompts.py (prompt_specials): Added the ability to have
4350 bash-like special sequences in the prompts, which get
4382 bash-like special sequences in the prompts, which get
4351 automatically expanded. Things like hostname, current working
4383 automatically expanded. Things like hostname, current working
4352 directory and username are implemented already, but it's easy to
4384 directory and username are implemented already, but it's easy to
4353 add more in the future. Thanks to a patch by W.J. van der Laan
4385 add more in the future. Thanks to a patch by W.J. van der Laan
4354 <gnufnork-AT-hetdigitalegat.nl>
4386 <gnufnork-AT-hetdigitalegat.nl>
4355 (prompt_specials): Added color support for prompt strings, so
4387 (prompt_specials): Added color support for prompt strings, so
4356 users can define arbitrary color setups for their prompts.
4388 users can define arbitrary color setups for their prompts.
4357
4389
4358 2004-06-05 Fernando Perez <fperez@colorado.edu>
4390 2004-06-05 Fernando Perez <fperez@colorado.edu>
4359
4391
4360 * IPython/genutils.py (Term.reopen_all): Added Windows-specific
4392 * IPython/genutils.py (Term.reopen_all): Added Windows-specific
4361 code to load Gary Bishop's readline and configure it
4393 code to load Gary Bishop's readline and configure it
4362 automatically. Thanks to Gary for help on this.
4394 automatically. Thanks to Gary for help on this.
4363
4395
4364 2004-06-01 Fernando Perez <fperez@colorado.edu>
4396 2004-06-01 Fernando Perez <fperez@colorado.edu>
4365
4397
4366 * IPython/Logger.py (Logger.create_log): fix bug for logging
4398 * IPython/Logger.py (Logger.create_log): fix bug for logging
4367 with no filename (previous fix was incomplete).
4399 with no filename (previous fix was incomplete).
4368
4400
4369 2004-05-25 Fernando Perez <fperez@colorado.edu>
4401 2004-05-25 Fernando Perez <fperez@colorado.edu>
4370
4402
4371 * IPython/Magic.py (Magic.parse_options): fix bug where naked
4403 * IPython/Magic.py (Magic.parse_options): fix bug where naked
4372 parens would get passed to the shell.
4404 parens would get passed to the shell.
4373
4405
4374 2004-05-20 Fernando Perez <fperez@colorado.edu>
4406 2004-05-20 Fernando Perez <fperez@colorado.edu>
4375
4407
4376 * IPython/Magic.py (Magic.magic_prun): changed default profile
4408 * IPython/Magic.py (Magic.magic_prun): changed default profile
4377 sort order to 'time' (the more common profiling need).
4409 sort order to 'time' (the more common profiling need).
4378
4410
4379 * IPython/OInspect.py (Inspector.pinfo): flush the inspect cache
4411 * IPython/OInspect.py (Inspector.pinfo): flush the inspect cache
4380 so that source code shown is guaranteed in sync with the file on
4412 so that source code shown is guaranteed in sync with the file on
4381 disk (also changed in psource). Similar fix to the one for
4413 disk (also changed in psource). Similar fix to the one for
4382 ultraTB on 2004-05-06. Thanks to a bug report by Yann Le Du
4414 ultraTB on 2004-05-06. Thanks to a bug report by Yann Le Du
4383 <yann.ledu-AT-noos.fr>.
4415 <yann.ledu-AT-noos.fr>.
4384
4416
4385 * IPython/Magic.py (Magic.parse_options): Fixed bug where commands
4417 * IPython/Magic.py (Magic.parse_options): Fixed bug where commands
4386 with a single option would not be correctly parsed. Closes
4418 with a single option would not be correctly parsed. Closes
4387 http://www.scipy.net/roundup/ipython/issue14. This bug had been
4419 http://www.scipy.net/roundup/ipython/issue14. This bug had been
4388 introduced in 0.6.0 (on 2004-05-06).
4420 introduced in 0.6.0 (on 2004-05-06).
4389
4421
4390 2004-05-13 *** Released version 0.6.0
4422 2004-05-13 *** Released version 0.6.0
4391
4423
4392 2004-05-13 Fernando Perez <fperez@colorado.edu>
4424 2004-05-13 Fernando Perez <fperez@colorado.edu>
4393
4425
4394 * debian/: Added debian/ directory to CVS, so that debian support
4426 * debian/: Added debian/ directory to CVS, so that debian support
4395 is publicly accessible. The debian package is maintained by Jack
4427 is publicly accessible. The debian package is maintained by Jack
4396 Moffit <jack-AT-xiph.org>.
4428 Moffit <jack-AT-xiph.org>.
4397
4429
4398 * Documentation: included the notes about an ipython-based system
4430 * Documentation: included the notes about an ipython-based system
4399 shell (the hypothetical 'pysh') into the new_design.pdf document,
4431 shell (the hypothetical 'pysh') into the new_design.pdf document,
4400 so that these ideas get distributed to users along with the
4432 so that these ideas get distributed to users along with the
4401 official documentation.
4433 official documentation.
4402
4434
4403 2004-05-10 Fernando Perez <fperez@colorado.edu>
4435 2004-05-10 Fernando Perez <fperez@colorado.edu>
4404
4436
4405 * IPython/Logger.py (Logger.create_log): fix recently introduced
4437 * IPython/Logger.py (Logger.create_log): fix recently introduced
4406 bug (misindented line) where logstart would fail when not given an
4438 bug (misindented line) where logstart would fail when not given an
4407 explicit filename.
4439 explicit filename.
4408
4440
4409 2004-05-09 Fernando Perez <fperez@colorado.edu>
4441 2004-05-09 Fernando Perez <fperez@colorado.edu>
4410
4442
4411 * IPython/Magic.py (Magic.parse_options): skip system call when
4443 * IPython/Magic.py (Magic.parse_options): skip system call when
4412 there are no options to look for. Faster, cleaner for the common
4444 there are no options to look for. Faster, cleaner for the common
4413 case.
4445 case.
4414
4446
4415 * Documentation: many updates to the manual: describing Windows
4447 * Documentation: many updates to the manual: describing Windows
4416 support better, Gnuplot updates, credits, misc small stuff. Also
4448 support better, Gnuplot updates, credits, misc small stuff. Also
4417 updated the new_design doc a bit.
4449 updated the new_design doc a bit.
4418
4450
4419 2004-05-06 *** Released version 0.6.0.rc1
4451 2004-05-06 *** Released version 0.6.0.rc1
4420
4452
4421 2004-05-06 Fernando Perez <fperez@colorado.edu>
4453 2004-05-06 Fernando Perez <fperez@colorado.edu>
4422
4454
4423 * IPython/ultraTB.py (ListTB.text): modified a ton of string +=
4455 * IPython/ultraTB.py (ListTB.text): modified a ton of string +=
4424 operations to use the vastly more efficient list/''.join() method.
4456 operations to use the vastly more efficient list/''.join() method.
4425 (FormattedTB.text): Fix
4457 (FormattedTB.text): Fix
4426 http://www.scipy.net/roundup/ipython/issue12 - exception source
4458 http://www.scipy.net/roundup/ipython/issue12 - exception source
4427 extract not updated after reload. Thanks to Mike Salib
4459 extract not updated after reload. Thanks to Mike Salib
4428 <msalib-AT-mit.edu> for pinning the source of the problem.
4460 <msalib-AT-mit.edu> for pinning the source of the problem.
4429 Fortunately, the solution works inside ipython and doesn't require
4461 Fortunately, the solution works inside ipython and doesn't require
4430 any changes to python proper.
4462 any changes to python proper.
4431
4463
4432 * IPython/Magic.py (Magic.parse_options): Improved to process the
4464 * IPython/Magic.py (Magic.parse_options): Improved to process the
4433 argument list as a true shell would (by actually using the
4465 argument list as a true shell would (by actually using the
4434 underlying system shell). This way, all @magics automatically get
4466 underlying system shell). This way, all @magics automatically get
4435 shell expansion for variables. Thanks to a comment by Alex
4467 shell expansion for variables. Thanks to a comment by Alex
4436 Schmolck.
4468 Schmolck.
4437
4469
4438 2004-04-04 Fernando Perez <fperez@colorado.edu>
4470 2004-04-04 Fernando Perez <fperez@colorado.edu>
4439
4471
4440 * IPython/iplib.py (InteractiveShell.interact): Added a special
4472 * IPython/iplib.py (InteractiveShell.interact): Added a special
4441 trap for a debugger quit exception, which is basically impossible
4473 trap for a debugger quit exception, which is basically impossible
4442 to handle by normal mechanisms, given what pdb does to the stack.
4474 to handle by normal mechanisms, given what pdb does to the stack.
4443 This fixes a crash reported by <fgibbons-AT-llama.med.harvard.edu>.
4475 This fixes a crash reported by <fgibbons-AT-llama.med.harvard.edu>.
4444
4476
4445 2004-04-03 Fernando Perez <fperez@colorado.edu>
4477 2004-04-03 Fernando Perez <fperez@colorado.edu>
4446
4478
4447 * IPython/genutils.py (Term): Standardized the names of the Term
4479 * IPython/genutils.py (Term): Standardized the names of the Term
4448 class streams to cin/cout/cerr, following C++ naming conventions
4480 class streams to cin/cout/cerr, following C++ naming conventions
4449 (I can't use in/out/err because 'in' is not a valid attribute
4481 (I can't use in/out/err because 'in' is not a valid attribute
4450 name).
4482 name).
4451
4483
4452 * IPython/iplib.py (InteractiveShell.interact): don't increment
4484 * IPython/iplib.py (InteractiveShell.interact): don't increment
4453 the prompt if there's no user input. By Daniel 'Dang' Griffith
4485 the prompt if there's no user input. By Daniel 'Dang' Griffith
4454 <pythondev-dang-AT-lazytwinacres.net>, after a suggestion from
4486 <pythondev-dang-AT-lazytwinacres.net>, after a suggestion from
4455 Francois Pinard.
4487 Francois Pinard.
4456
4488
4457 2004-04-02 Fernando Perez <fperez@colorado.edu>
4489 2004-04-02 Fernando Perez <fperez@colorado.edu>
4458
4490
4459 * IPython/genutils.py (Stream.__init__): Modified to survive at
4491 * IPython/genutils.py (Stream.__init__): Modified to survive at
4460 least importing in contexts where stdin/out/err aren't true file
4492 least importing in contexts where stdin/out/err aren't true file
4461 objects, such as PyCrust (they lack fileno() and mode). However,
4493 objects, such as PyCrust (they lack fileno() and mode). However,
4462 the recovery facilities which rely on these things existing will
4494 the recovery facilities which rely on these things existing will
4463 not work.
4495 not work.
4464
4496
4465 2004-04-01 Fernando Perez <fperez@colorado.edu>
4497 2004-04-01 Fernando Perez <fperez@colorado.edu>
4466
4498
4467 * IPython/Magic.py (Magic.magic_sx): modified (as well as @sc) to
4499 * IPython/Magic.py (Magic.magic_sx): modified (as well as @sc) to
4468 use the new getoutputerror() function, so it properly
4500 use the new getoutputerror() function, so it properly
4469 distinguishes stdout/err.
4501 distinguishes stdout/err.
4470
4502
4471 * IPython/genutils.py (getoutputerror): added a function to
4503 * IPython/genutils.py (getoutputerror): added a function to
4472 capture separately the standard output and error of a command.
4504 capture separately the standard output and error of a command.
4473 After a comment from dang on the mailing lists. This code is
4505 After a comment from dang on the mailing lists. This code is
4474 basically a modified version of commands.getstatusoutput(), from
4506 basically a modified version of commands.getstatusoutput(), from
4475 the standard library.
4507 the standard library.
4476
4508
4477 * IPython/iplib.py (InteractiveShell.handle_shell_escape): added
4509 * IPython/iplib.py (InteractiveShell.handle_shell_escape): added
4478 '!!' as a special syntax (shorthand) to access @sx.
4510 '!!' as a special syntax (shorthand) to access @sx.
4479
4511
4480 * IPython/Magic.py (Magic.magic_sx): new magic, to execute a shell
4512 * IPython/Magic.py (Magic.magic_sx): new magic, to execute a shell
4481 command and return its output as a list split on '\n'.
4513 command and return its output as a list split on '\n'.
4482
4514
4483 2004-03-31 Fernando Perez <fperez@colorado.edu>
4515 2004-03-31 Fernando Perez <fperez@colorado.edu>
4484
4516
4485 * IPython/FakeModule.py (FakeModule.__init__): added __nonzero__
4517 * IPython/FakeModule.py (FakeModule.__init__): added __nonzero__
4486 method to dictionaries used as FakeModule instances if they lack
4518 method to dictionaries used as FakeModule instances if they lack
4487 it. At least pydoc in python2.3 breaks for runtime-defined
4519 it. At least pydoc in python2.3 breaks for runtime-defined
4488 functions without this hack. At some point I need to _really_
4520 functions without this hack. At some point I need to _really_
4489 understand what FakeModule is doing, because it's a gross hack.
4521 understand what FakeModule is doing, because it's a gross hack.
4490 But it solves Arnd's problem for now...
4522 But it solves Arnd's problem for now...
4491
4523
4492 2004-02-27 Fernando Perez <fperez@colorado.edu>
4524 2004-02-27 Fernando Perez <fperez@colorado.edu>
4493
4525
4494 * IPython/Logger.py (Logger.create_log): Fix bug where 'rotate'
4526 * IPython/Logger.py (Logger.create_log): Fix bug where 'rotate'
4495 mode would behave erratically. Also increased the number of
4527 mode would behave erratically. Also increased the number of
4496 possible logs in rotate mod to 999. Thanks to Rod Holland
4528 possible logs in rotate mod to 999. Thanks to Rod Holland
4497 <rhh@StructureLABS.com> for the report and fixes.
4529 <rhh@StructureLABS.com> for the report and fixes.
4498
4530
4499 2004-02-26 Fernando Perez <fperez@colorado.edu>
4531 2004-02-26 Fernando Perez <fperez@colorado.edu>
4500
4532
4501 * IPython/genutils.py (page): Check that the curses module really
4533 * IPython/genutils.py (page): Check that the curses module really
4502 has the initscr attribute before trying to use it. For some
4534 has the initscr attribute before trying to use it. For some
4503 reason, the Solaris curses module is missing this. I think this
4535 reason, the Solaris curses module is missing this. I think this
4504 should be considered a Solaris python bug, but I'm not sure.
4536 should be considered a Solaris python bug, but I'm not sure.
4505
4537
4506 2004-01-17 Fernando Perez <fperez@colorado.edu>
4538 2004-01-17 Fernando Perez <fperez@colorado.edu>
4507
4539
4508 * IPython/genutils.py (Stream.__init__): Changes to try to make
4540 * IPython/genutils.py (Stream.__init__): Changes to try to make
4509 ipython robust against stdin/out/err being closed by the user.
4541 ipython robust against stdin/out/err being closed by the user.
4510 This is 'user error' (and blocks a normal python session, at least
4542 This is 'user error' (and blocks a normal python session, at least
4511 the stdout case). However, Ipython should be able to survive such
4543 the stdout case). However, Ipython should be able to survive such
4512 instances of abuse as gracefully as possible. To simplify the
4544 instances of abuse as gracefully as possible. To simplify the
4513 coding and maintain compatibility with Gary Bishop's Term
4545 coding and maintain compatibility with Gary Bishop's Term
4514 contributions, I've made use of classmethods for this. I think
4546 contributions, I've made use of classmethods for this. I think
4515 this introduces a dependency on python 2.2.
4547 this introduces a dependency on python 2.2.
4516
4548
4517 2004-01-13 Fernando Perez <fperez@colorado.edu>
4549 2004-01-13 Fernando Perez <fperez@colorado.edu>
4518
4550
4519 * IPython/numutils.py (exp_safe): simplified the code a bit and
4551 * IPython/numutils.py (exp_safe): simplified the code a bit and
4520 removed the need for importing the kinds module altogether.
4552 removed the need for importing the kinds module altogether.
4521
4553
4522 2004-01-06 Fernando Perez <fperez@colorado.edu>
4554 2004-01-06 Fernando Perez <fperez@colorado.edu>
4523
4555
4524 * IPython/Magic.py (Magic.magic_sc): Made the shell capture system
4556 * IPython/Magic.py (Magic.magic_sc): Made the shell capture system
4525 a magic function instead, after some community feedback. No
4557 a magic function instead, after some community feedback. No
4526 special syntax will exist for it, but its name is deliberately
4558 special syntax will exist for it, but its name is deliberately
4527 very short.
4559 very short.
4528
4560
4529 2003-12-20 Fernando Perez <fperez@colorado.edu>
4561 2003-12-20 Fernando Perez <fperez@colorado.edu>
4530
4562
4531 * IPython/iplib.py (InteractiveShell.handle_shell_assign): Added
4563 * IPython/iplib.py (InteractiveShell.handle_shell_assign): Added
4532 new functionality, to automagically assign the result of a shell
4564 new functionality, to automagically assign the result of a shell
4533 command to a variable. I'll solicit some community feedback on
4565 command to a variable. I'll solicit some community feedback on
4534 this before making it permanent.
4566 this before making it permanent.
4535
4567
4536 * IPython/OInspect.py (Inspector.pinfo): Fix crash when info was
4568 * IPython/OInspect.py (Inspector.pinfo): Fix crash when info was
4537 requested about callables for which inspect couldn't obtain a
4569 requested about callables for which inspect couldn't obtain a
4538 proper argspec. Thanks to a crash report sent by Etienne
4570 proper argspec. Thanks to a crash report sent by Etienne
4539 Posthumus <etienne-AT-apple01.cs.vu.nl>.
4571 Posthumus <etienne-AT-apple01.cs.vu.nl>.
4540
4572
4541 2003-12-09 Fernando Perez <fperez@colorado.edu>
4573 2003-12-09 Fernando Perez <fperez@colorado.edu>
4542
4574
4543 * IPython/genutils.py (page): patch for the pager to work across
4575 * IPython/genutils.py (page): patch for the pager to work across
4544 various versions of Windows. By Gary Bishop.
4576 various versions of Windows. By Gary Bishop.
4545
4577
4546 2003-12-04 Fernando Perez <fperez@colorado.edu>
4578 2003-12-04 Fernando Perez <fperez@colorado.edu>
4547
4579
4548 * IPython/Gnuplot2.py (PlotItems): Fixes for working with
4580 * IPython/Gnuplot2.py (PlotItems): Fixes for working with
4549 Gnuplot.py version 1.7, whose internal names changed quite a bit.
4581 Gnuplot.py version 1.7, whose internal names changed quite a bit.
4550 While I tested this and it looks ok, there may still be corner
4582 While I tested this and it looks ok, there may still be corner
4551 cases I've missed.
4583 cases I've missed.
4552
4584
4553 2003-12-01 Fernando Perez <fperez@colorado.edu>
4585 2003-12-01 Fernando Perez <fperez@colorado.edu>
4554
4586
4555 * IPython/iplib.py (InteractiveShell._prefilter): Fixed a bug
4587 * IPython/iplib.py (InteractiveShell._prefilter): Fixed a bug
4556 where a line like 'p,q=1,2' would fail because the automagic
4588 where a line like 'p,q=1,2' would fail because the automagic
4557 system would be triggered for @p.
4589 system would be triggered for @p.
4558
4590
4559 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): Tab-related
4591 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): Tab-related
4560 cleanups, code unmodified.
4592 cleanups, code unmodified.
4561
4593
4562 * IPython/genutils.py (Term): added a class for IPython to handle
4594 * IPython/genutils.py (Term): added a class for IPython to handle
4563 output. In most cases it will just be a proxy for stdout/err, but
4595 output. In most cases it will just be a proxy for stdout/err, but
4564 having this allows modifications to be made for some platforms,
4596 having this allows modifications to be made for some platforms,
4565 such as handling color escapes under Windows. All of this code
4597 such as handling color escapes under Windows. All of this code
4566 was contributed by Gary Bishop, with minor modifications by me.
4598 was contributed by Gary Bishop, with minor modifications by me.
4567 The actual changes affect many files.
4599 The actual changes affect many files.
4568
4600
4569 2003-11-30 Fernando Perez <fperez@colorado.edu>
4601 2003-11-30 Fernando Perez <fperez@colorado.edu>
4570
4602
4571 * IPython/iplib.py (file_matches): new completion code, courtesy
4603 * IPython/iplib.py (file_matches): new completion code, courtesy
4572 of Jeff Collins. This enables filename completion again under
4604 of Jeff Collins. This enables filename completion again under
4573 python 2.3, which disabled it at the C level.
4605 python 2.3, which disabled it at the C level.
4574
4606
4575 2003-11-11 Fernando Perez <fperez@colorado.edu>
4607 2003-11-11 Fernando Perez <fperez@colorado.edu>
4576
4608
4577 * IPython/numutils.py (amap): Added amap() fn. Simple shorthand
4609 * IPython/numutils.py (amap): Added amap() fn. Simple shorthand
4578 for Numeric.array(map(...)), but often convenient.
4610 for Numeric.array(map(...)), but often convenient.
4579
4611
4580 2003-11-05 Fernando Perez <fperez@colorado.edu>
4612 2003-11-05 Fernando Perez <fperez@colorado.edu>
4581
4613
4582 * IPython/numutils.py (frange): Changed a call from int() to
4614 * IPython/numutils.py (frange): Changed a call from int() to
4583 int(round()) to prevent a problem reported with arange() in the
4615 int(round()) to prevent a problem reported with arange() in the
4584 numpy list.
4616 numpy list.
4585
4617
4586 2003-10-06 Fernando Perez <fperez@colorado.edu>
4618 2003-10-06 Fernando Perez <fperez@colorado.edu>
4587
4619
4588 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): changed to
4620 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): changed to
4589 prevent crashes if sys lacks an argv attribute (it happens with
4621 prevent crashes if sys lacks an argv attribute (it happens with
4590 embedded interpreters which build a bare-bones sys module).
4622 embedded interpreters which build a bare-bones sys module).
4591 Thanks to a report/bugfix by Adam Hupp <hupp-AT-cs.wisc.edu>.
4623 Thanks to a report/bugfix by Adam Hupp <hupp-AT-cs.wisc.edu>.
4592
4624
4593 2003-09-24 Fernando Perez <fperez@colorado.edu>
4625 2003-09-24 Fernando Perez <fperez@colorado.edu>
4594
4626
4595 * IPython/Magic.py (Magic._ofind): blanket except around getattr()
4627 * IPython/Magic.py (Magic._ofind): blanket except around getattr()
4596 to protect against poorly written user objects where __getattr__
4628 to protect against poorly written user objects where __getattr__
4597 raises exceptions other than AttributeError. Thanks to a bug
4629 raises exceptions other than AttributeError. Thanks to a bug
4598 report by Oliver Sander <osander-AT-gmx.de>.
4630 report by Oliver Sander <osander-AT-gmx.de>.
4599
4631
4600 * IPython/FakeModule.py (FakeModule.__repr__): this method was
4632 * IPython/FakeModule.py (FakeModule.__repr__): this method was
4601 missing. Thanks to bug report by Ralf Schmitt <ralf-AT-brainbot.com>.
4633 missing. Thanks to bug report by Ralf Schmitt <ralf-AT-brainbot.com>.
4602
4634
4603 2003-09-09 Fernando Perez <fperez@colorado.edu>
4635 2003-09-09 Fernando Perez <fperez@colorado.edu>
4604
4636
4605 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
4637 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
4606 unpacking a list whith a callable as first element would
4638 unpacking a list whith a callable as first element would
4607 mistakenly trigger autocalling. Thanks to a bug report by Jeffery
4639 mistakenly trigger autocalling. Thanks to a bug report by Jeffery
4608 Collins.
4640 Collins.
4609
4641
4610 2003-08-25 *** Released version 0.5.0
4642 2003-08-25 *** Released version 0.5.0
4611
4643
4612 2003-08-22 Fernando Perez <fperez@colorado.edu>
4644 2003-08-22 Fernando Perez <fperez@colorado.edu>
4613
4645
4614 * IPython/ultraTB.py (VerboseTB.linereader): Improved handling of
4646 * IPython/ultraTB.py (VerboseTB.linereader): Improved handling of
4615 improperly defined user exceptions. Thanks to feedback from Mark
4647 improperly defined user exceptions. Thanks to feedback from Mark
4616 Russell <mrussell-AT-verio.net>.
4648 Russell <mrussell-AT-verio.net>.
4617
4649
4618 2003-08-20 Fernando Perez <fperez@colorado.edu>
4650 2003-08-20 Fernando Perez <fperez@colorado.edu>
4619
4651
4620 * IPython/OInspect.py (Inspector.pinfo): changed String Form
4652 * IPython/OInspect.py (Inspector.pinfo): changed String Form
4621 printing so that it would print multi-line string forms starting
4653 printing so that it would print multi-line string forms starting
4622 with a new line. This way the formatting is better respected for
4654 with a new line. This way the formatting is better respected for
4623 objects which work hard to make nice string forms.
4655 objects which work hard to make nice string forms.
4624
4656
4625 * IPython/iplib.py (InteractiveShell.handle_auto): Fix bug where
4657 * IPython/iplib.py (InteractiveShell.handle_auto): Fix bug where
4626 autocall would overtake data access for objects with both
4658 autocall would overtake data access for objects with both
4627 __getitem__ and __call__.
4659 __getitem__ and __call__.
4628
4660
4629 2003-08-19 *** Released version 0.5.0-rc1
4661 2003-08-19 *** Released version 0.5.0-rc1
4630
4662
4631 2003-08-19 Fernando Perez <fperez@colorado.edu>
4663 2003-08-19 Fernando Perez <fperez@colorado.edu>
4632
4664
4633 * IPython/deep_reload.py (load_tail): single tiny change here
4665 * IPython/deep_reload.py (load_tail): single tiny change here
4634 seems to fix the long-standing bug of dreload() failing to work
4666 seems to fix the long-standing bug of dreload() failing to work
4635 for dotted names. But this module is pretty tricky, so I may have
4667 for dotted names. But this module is pretty tricky, so I may have
4636 missed some subtlety. Needs more testing!.
4668 missed some subtlety. Needs more testing!.
4637
4669
4638 * IPython/ultraTB.py (VerboseTB.linereader): harden against user
4670 * IPython/ultraTB.py (VerboseTB.linereader): harden against user
4639 exceptions which have badly implemented __str__ methods.
4671 exceptions which have badly implemented __str__ methods.
4640 (VerboseTB.text): harden against inspect.getinnerframes crashing,
4672 (VerboseTB.text): harden against inspect.getinnerframes crashing,
4641 which I've been getting reports about from Python 2.3 users. I
4673 which I've been getting reports about from Python 2.3 users. I
4642 wish I had a simple test case to reproduce the problem, so I could
4674 wish I had a simple test case to reproduce the problem, so I could
4643 either write a cleaner workaround or file a bug report if
4675 either write a cleaner workaround or file a bug report if
4644 necessary.
4676 necessary.
4645
4677
4646 * IPython/Magic.py (Magic.magic_edit): fixed bug where after
4678 * IPython/Magic.py (Magic.magic_edit): fixed bug where after
4647 making a class 'foo', file 'foo.py' couldn't be edited. Thanks to
4679 making a class 'foo', file 'foo.py' couldn't be edited. Thanks to
4648 a bug report by Tjabo Kloppenburg.
4680 a bug report by Tjabo Kloppenburg.
4649
4681
4650 * IPython/ultraTB.py (VerboseTB.debugger): hardened against pdb
4682 * IPython/ultraTB.py (VerboseTB.debugger): hardened against pdb
4651 crashes. Wrapped the pdb call in a blanket try/except, since pdb
4683 crashes. Wrapped the pdb call in a blanket try/except, since pdb
4652 seems rather unstable. Thanks to a bug report by Tjabo
4684 seems rather unstable. Thanks to a bug report by Tjabo
4653 Kloppenburg <tjabo.kloppenburg-AT-unix-ag.uni-siegen.de>.
4685 Kloppenburg <tjabo.kloppenburg-AT-unix-ag.uni-siegen.de>.
4654
4686
4655 * IPython/Release.py (version): release 0.5.0-rc1. I want to put
4687 * IPython/Release.py (version): release 0.5.0-rc1. I want to put
4656 this out soon because of the critical fixes in the inner loop for
4688 this out soon because of the critical fixes in the inner loop for
4657 generators.
4689 generators.
4658
4690
4659 * IPython/Magic.py (Magic.getargspec): removed. This (and
4691 * IPython/Magic.py (Magic.getargspec): removed. This (and
4660 _get_def) have been obsoleted by OInspect for a long time, I
4692 _get_def) have been obsoleted by OInspect for a long time, I
4661 hadn't noticed that they were dead code.
4693 hadn't noticed that they were dead code.
4662 (Magic._ofind): restored _ofind functionality for a few literals
4694 (Magic._ofind): restored _ofind functionality for a few literals
4663 (those in ["''",'""','[]','{}','()']). But it won't work anymore
4695 (those in ["''",'""','[]','{}','()']). But it won't work anymore
4664 for things like "hello".capitalize?, since that would require a
4696 for things like "hello".capitalize?, since that would require a
4665 potentially dangerous eval() again.
4697 potentially dangerous eval() again.
4666
4698
4667 * IPython/iplib.py (InteractiveShell._prefilter): reorganized the
4699 * IPython/iplib.py (InteractiveShell._prefilter): reorganized the
4668 logic a bit more to clean up the escapes handling and minimize the
4700 logic a bit more to clean up the escapes handling and minimize the
4669 use of _ofind to only necessary cases. The interactive 'feel' of
4701 use of _ofind to only necessary cases. The interactive 'feel' of
4670 IPython should have improved quite a bit with the changes in
4702 IPython should have improved quite a bit with the changes in
4671 _prefilter and _ofind (besides being far safer than before).
4703 _prefilter and _ofind (besides being far safer than before).
4672
4704
4673 * IPython/Magic.py (Magic.magic_edit): Fixed old bug (but rather
4705 * IPython/Magic.py (Magic.magic_edit): Fixed old bug (but rather
4674 obscure, never reported). Edit would fail to find the object to
4706 obscure, never reported). Edit would fail to find the object to
4675 edit under some circumstances.
4707 edit under some circumstances.
4676 (Magic._ofind): CRITICAL FIX. Finally removed the eval() calls
4708 (Magic._ofind): CRITICAL FIX. Finally removed the eval() calls
4677 which were causing double-calling of generators. Those eval calls
4709 which were causing double-calling of generators. Those eval calls
4678 were _very_ dangerous, since code with side effects could be
4710 were _very_ dangerous, since code with side effects could be
4679 triggered. As they say, 'eval is evil'... These were the
4711 triggered. As they say, 'eval is evil'... These were the
4680 nastiest evals in IPython. Besides, _ofind is now far simpler,
4712 nastiest evals in IPython. Besides, _ofind is now far simpler,
4681 and it should also be quite a bit faster. Its use of inspect is
4713 and it should also be quite a bit faster. Its use of inspect is
4682 also safer, so perhaps some of the inspect-related crashes I've
4714 also safer, so perhaps some of the inspect-related crashes I've
4683 seen lately with Python 2.3 might be taken care of. That will
4715 seen lately with Python 2.3 might be taken care of. That will
4684 need more testing.
4716 need more testing.
4685
4717
4686 2003-08-17 Fernando Perez <fperez@colorado.edu>
4718 2003-08-17 Fernando Perez <fperez@colorado.edu>
4687
4719
4688 * IPython/iplib.py (InteractiveShell._prefilter): significant
4720 * IPython/iplib.py (InteractiveShell._prefilter): significant
4689 simplifications to the logic for handling user escapes. Faster
4721 simplifications to the logic for handling user escapes. Faster
4690 and simpler code.
4722 and simpler code.
4691
4723
4692 2003-08-14 Fernando Perez <fperez@colorado.edu>
4724 2003-08-14 Fernando Perez <fperez@colorado.edu>
4693
4725
4694 * IPython/numutils.py (sum_flat): rewrote to be non-recursive.
4726 * IPython/numutils.py (sum_flat): rewrote to be non-recursive.
4695 Now it requires O(N) storage (N=size(a)) for non-contiguous input,
4727 Now it requires O(N) storage (N=size(a)) for non-contiguous input,
4696 but it should be quite a bit faster. And the recursive version
4728 but it should be quite a bit faster. And the recursive version
4697 generated O(log N) intermediate storage for all rank>1 arrays,
4729 generated O(log N) intermediate storage for all rank>1 arrays,
4698 even if they were contiguous.
4730 even if they were contiguous.
4699 (l1norm): Added this function.
4731 (l1norm): Added this function.
4700 (norm): Added this function for arbitrary norms (including
4732 (norm): Added this function for arbitrary norms (including
4701 l-infinity). l1 and l2 are still special cases for convenience
4733 l-infinity). l1 and l2 are still special cases for convenience
4702 and speed.
4734 and speed.
4703
4735
4704 2003-08-03 Fernando Perez <fperez@colorado.edu>
4736 2003-08-03 Fernando Perez <fperez@colorado.edu>
4705
4737
4706 * IPython/Magic.py (Magic.magic_edit): Removed all remaining string
4738 * IPython/Magic.py (Magic.magic_edit): Removed all remaining string
4707 exceptions, which now raise PendingDeprecationWarnings in Python
4739 exceptions, which now raise PendingDeprecationWarnings in Python
4708 2.3. There were some in Magic and some in Gnuplot2.
4740 2.3. There were some in Magic and some in Gnuplot2.
4709
4741
4710 2003-06-30 Fernando Perez <fperez@colorado.edu>
4742 2003-06-30 Fernando Perez <fperez@colorado.edu>
4711
4743
4712 * IPython/genutils.py (page): modified to call curses only for
4744 * IPython/genutils.py (page): modified to call curses only for
4713 terminals where TERM=='xterm'. After problems under many other
4745 terminals where TERM=='xterm'. After problems under many other
4714 terminals were reported by Keith Beattie <KSBeattie-AT-lbl.gov>.
4746 terminals were reported by Keith Beattie <KSBeattie-AT-lbl.gov>.
4715
4747
4716 * IPython/iplib.py (complete): removed spurious 'print "IE"' which
4748 * IPython/iplib.py (complete): removed spurious 'print "IE"' which
4717 would be triggered when readline was absent. This was just an old
4749 would be triggered when readline was absent. This was just an old
4718 debugging statement I'd forgotten to take out.
4750 debugging statement I'd forgotten to take out.
4719
4751
4720 2003-06-20 Fernando Perez <fperez@colorado.edu>
4752 2003-06-20 Fernando Perez <fperez@colorado.edu>
4721
4753
4722 * IPython/genutils.py (clock): modified to return only user time
4754 * IPython/genutils.py (clock): modified to return only user time
4723 (not counting system time), after a discussion on scipy. While
4755 (not counting system time), after a discussion on scipy. While
4724 system time may be a useful quantity occasionally, it may much
4756 system time may be a useful quantity occasionally, it may much
4725 more easily be skewed by occasional swapping or other similar
4757 more easily be skewed by occasional swapping or other similar
4726 activity.
4758 activity.
4727
4759
4728 2003-06-05 Fernando Perez <fperez@colorado.edu>
4760 2003-06-05 Fernando Perez <fperez@colorado.edu>
4729
4761
4730 * IPython/numutils.py (identity): new function, for building
4762 * IPython/numutils.py (identity): new function, for building
4731 arbitrary rank Kronecker deltas (mostly backwards compatible with
4763 arbitrary rank Kronecker deltas (mostly backwards compatible with
4732 Numeric.identity)
4764 Numeric.identity)
4733
4765
4734 2003-06-03 Fernando Perez <fperez@colorado.edu>
4766 2003-06-03 Fernando Perez <fperez@colorado.edu>
4735
4767
4736 * IPython/iplib.py (InteractiveShell.handle_magic): protect
4768 * IPython/iplib.py (InteractiveShell.handle_magic): protect
4737 arguments passed to magics with spaces, to allow trailing '\' to
4769 arguments passed to magics with spaces, to allow trailing '\' to
4738 work normally (mainly for Windows users).
4770 work normally (mainly for Windows users).
4739
4771
4740 2003-05-29 Fernando Perez <fperez@colorado.edu>
4772 2003-05-29 Fernando Perez <fperez@colorado.edu>
4741
4773
4742 * IPython/ipmaker.py (make_IPython): Load site._Helper() as help
4774 * IPython/ipmaker.py (make_IPython): Load site._Helper() as help
4743 instead of pydoc.help. This fixes a bizarre behavior where
4775 instead of pydoc.help. This fixes a bizarre behavior where
4744 printing '%s' % locals() would trigger the help system. Now
4776 printing '%s' % locals() would trigger the help system. Now
4745 ipython behaves like normal python does.
4777 ipython behaves like normal python does.
4746
4778
4747 Note that if one does 'from pydoc import help', the bizarre
4779 Note that if one does 'from pydoc import help', the bizarre
4748 behavior returns, but this will also happen in normal python, so
4780 behavior returns, but this will also happen in normal python, so
4749 it's not an ipython bug anymore (it has to do with how pydoc.help
4781 it's not an ipython bug anymore (it has to do with how pydoc.help
4750 is implemented).
4782 is implemented).
4751
4783
4752 2003-05-22 Fernando Perez <fperez@colorado.edu>
4784 2003-05-22 Fernando Perez <fperez@colorado.edu>
4753
4785
4754 * IPython/FlexCompleter.py (Completer.attr_matches): fixed to
4786 * IPython/FlexCompleter.py (Completer.attr_matches): fixed to
4755 return [] instead of None when nothing matches, also match to end
4787 return [] instead of None when nothing matches, also match to end
4756 of line. Patch by Gary Bishop.
4788 of line. Patch by Gary Bishop.
4757
4789
4758 * IPython/ipmaker.py (make_IPython): Added same sys.excepthook
4790 * IPython/ipmaker.py (make_IPython): Added same sys.excepthook
4759 protection as before, for files passed on the command line. This
4791 protection as before, for files passed on the command line. This
4760 prevents the CrashHandler from kicking in if user files call into
4792 prevents the CrashHandler from kicking in if user files call into
4761 sys.excepthook (such as PyQt and WxWindows have a nasty habit of
4793 sys.excepthook (such as PyQt and WxWindows have a nasty habit of
4762 doing). After a report by Kasper Souren <Kasper.Souren-AT-ircam.fr>
4794 doing). After a report by Kasper Souren <Kasper.Souren-AT-ircam.fr>
4763
4795
4764 2003-05-20 *** Released version 0.4.0
4796 2003-05-20 *** Released version 0.4.0
4765
4797
4766 2003-05-20 Fernando Perez <fperez@colorado.edu>
4798 2003-05-20 Fernando Perez <fperez@colorado.edu>
4767
4799
4768 * setup.py: added support for manpages. It's a bit hackish b/c of
4800 * setup.py: added support for manpages. It's a bit hackish b/c of
4769 a bug in the way the bdist_rpm distutils target handles gzipped
4801 a bug in the way the bdist_rpm distutils target handles gzipped
4770 manpages, but it works. After a patch by Jack.
4802 manpages, but it works. After a patch by Jack.
4771
4803
4772 2003-05-19 Fernando Perez <fperez@colorado.edu>
4804 2003-05-19 Fernando Perez <fperez@colorado.edu>
4773
4805
4774 * IPython/numutils.py: added a mockup of the kinds module, since
4806 * IPython/numutils.py: added a mockup of the kinds module, since
4775 it was recently removed from Numeric. This way, numutils will
4807 it was recently removed from Numeric. This way, numutils will
4776 work for all users even if they are missing kinds.
4808 work for all users even if they are missing kinds.
4777
4809
4778 * IPython/Magic.py (Magic._ofind): Harden against an inspect
4810 * IPython/Magic.py (Magic._ofind): Harden against an inspect
4779 failure, which can occur with SWIG-wrapped extensions. After a
4811 failure, which can occur with SWIG-wrapped extensions. After a
4780 crash report from Prabhu.
4812 crash report from Prabhu.
4781
4813
4782 2003-05-16 Fernando Perez <fperez@colorado.edu>
4814 2003-05-16 Fernando Perez <fperez@colorado.edu>
4783
4815
4784 * IPython/iplib.py (InteractiveShell.excepthook): New method to
4816 * IPython/iplib.py (InteractiveShell.excepthook): New method to
4785 protect ipython from user code which may call directly
4817 protect ipython from user code which may call directly
4786 sys.excepthook (this looks like an ipython crash to the user, even
4818 sys.excepthook (this looks like an ipython crash to the user, even
4787 when it isn't). After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
4819 when it isn't). After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
4788 This is especially important to help users of WxWindows, but may
4820 This is especially important to help users of WxWindows, but may
4789 also be useful in other cases.
4821 also be useful in other cases.
4790
4822
4791 * IPython/ultraTB.py (AutoFormattedTB.__call__): Changed to allow
4823 * IPython/ultraTB.py (AutoFormattedTB.__call__): Changed to allow
4792 an optional tb_offset to be specified, and to preserve exception
4824 an optional tb_offset to be specified, and to preserve exception
4793 info if given. After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
4825 info if given. After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
4794
4826
4795 * ipython.1 (Default): Thanks to Jack's work, we now have manpages!
4827 * ipython.1 (Default): Thanks to Jack's work, we now have manpages!
4796
4828
4797 2003-05-15 Fernando Perez <fperez@colorado.edu>
4829 2003-05-15 Fernando Perez <fperez@colorado.edu>
4798
4830
4799 * IPython/iplib.py (InteractiveShell.user_setup): Fix crash when
4831 * IPython/iplib.py (InteractiveShell.user_setup): Fix crash when
4800 installing for a new user under Windows.
4832 installing for a new user under Windows.
4801
4833
4802 2003-05-12 Fernando Perez <fperez@colorado.edu>
4834 2003-05-12 Fernando Perez <fperez@colorado.edu>
4803
4835
4804 * IPython/iplib.py (InteractiveShell.handle_emacs): New line
4836 * IPython/iplib.py (InteractiveShell.handle_emacs): New line
4805 handler for Emacs comint-based lines. Currently it doesn't do
4837 handler for Emacs comint-based lines. Currently it doesn't do
4806 much (but importantly, it doesn't update the history cache). In
4838 much (but importantly, it doesn't update the history cache). In
4807 the future it may be expanded if Alex needs more functionality
4839 the future it may be expanded if Alex needs more functionality
4808 there.
4840 there.
4809
4841
4810 * IPython/CrashHandler.py (CrashHandler.__call__): Added platform
4842 * IPython/CrashHandler.py (CrashHandler.__call__): Added platform
4811 info to crash reports.
4843 info to crash reports.
4812
4844
4813 * IPython/iplib.py (InteractiveShell.mainloop): Added -c option,
4845 * IPython/iplib.py (InteractiveShell.mainloop): Added -c option,
4814 just like Python's -c. Also fixed crash with invalid -color
4846 just like Python's -c. Also fixed crash with invalid -color
4815 option value at startup. Thanks to Will French
4847 option value at startup. Thanks to Will French
4816 <wfrench-AT-bestweb.net> for the bug report.
4848 <wfrench-AT-bestweb.net> for the bug report.
4817
4849
4818 2003-05-09 Fernando Perez <fperez@colorado.edu>
4850 2003-05-09 Fernando Perez <fperez@colorado.edu>
4819
4851
4820 * IPython/genutils.py (EvalDict.__getitem__): Renamed EvalString
4852 * IPython/genutils.py (EvalDict.__getitem__): Renamed EvalString
4821 to EvalDict (it's a mapping, after all) and simplified its code
4853 to EvalDict (it's a mapping, after all) and simplified its code
4822 quite a bit, after a nice discussion on c.l.py where Gustavo
4854 quite a bit, after a nice discussion on c.l.py where Gustavo
4823 CΓ³rdova <gcordova-AT-sismex.com> suggested the new version.
4855 CΓ³rdova <gcordova-AT-sismex.com> suggested the new version.
4824
4856
4825 2003-04-30 Fernando Perez <fperez@colorado.edu>
4857 2003-04-30 Fernando Perez <fperez@colorado.edu>
4826
4858
4827 * IPython/genutils.py (timings_out): modified it to reduce its
4859 * IPython/genutils.py (timings_out): modified it to reduce its
4828 overhead in the common reps==1 case.
4860 overhead in the common reps==1 case.
4829
4861
4830 2003-04-29 Fernando Perez <fperez@colorado.edu>
4862 2003-04-29 Fernando Perez <fperez@colorado.edu>
4831
4863
4832 * IPython/genutils.py (timings_out): Modified to use the resource
4864 * IPython/genutils.py (timings_out): Modified to use the resource
4833 module, which avoids the wraparound problems of time.clock().
4865 module, which avoids the wraparound problems of time.clock().
4834
4866
4835 2003-04-17 *** Released version 0.2.15pre4
4867 2003-04-17 *** Released version 0.2.15pre4
4836
4868
4837 2003-04-17 Fernando Perez <fperez@colorado.edu>
4869 2003-04-17 Fernando Perez <fperez@colorado.edu>
4838
4870
4839 * setup.py (scriptfiles): Split windows-specific stuff over to a
4871 * setup.py (scriptfiles): Split windows-specific stuff over to a
4840 separate file, in an attempt to have a Windows GUI installer.
4872 separate file, in an attempt to have a Windows GUI installer.
4841 That didn't work, but part of the groundwork is done.
4873 That didn't work, but part of the groundwork is done.
4842
4874
4843 * IPython/UserConfig/ipythonrc: Added M-i, M-o and M-I for
4875 * IPython/UserConfig/ipythonrc: Added M-i, M-o and M-I for
4844 indent/unindent with 4 spaces. Particularly useful in combination
4876 indent/unindent with 4 spaces. Particularly useful in combination
4845 with the new auto-indent option.
4877 with the new auto-indent option.
4846
4878
4847 2003-04-16 Fernando Perez <fperez@colorado.edu>
4879 2003-04-16 Fernando Perez <fperez@colorado.edu>
4848
4880
4849 * IPython/Magic.py: various replacements of self.rc for
4881 * IPython/Magic.py: various replacements of self.rc for
4850 self.shell.rc. A lot more remains to be done to fully disentangle
4882 self.shell.rc. A lot more remains to be done to fully disentangle
4851 this class from the main Shell class.
4883 this class from the main Shell class.
4852
4884
4853 * IPython/GnuplotRuntime.py: added checks for mouse support so
4885 * IPython/GnuplotRuntime.py: added checks for mouse support so
4854 that we don't try to enable it if the current gnuplot doesn't
4886 that we don't try to enable it if the current gnuplot doesn't
4855 really support it. Also added checks so that we don't try to
4887 really support it. Also added checks so that we don't try to
4856 enable persist under Windows (where Gnuplot doesn't recognize the
4888 enable persist under Windows (where Gnuplot doesn't recognize the
4857 option).
4889 option).
4858
4890
4859 * IPython/iplib.py (InteractiveShell.interact): Added optional
4891 * IPython/iplib.py (InteractiveShell.interact): Added optional
4860 auto-indenting code, after a patch by King C. Shu
4892 auto-indenting code, after a patch by King C. Shu
4861 <kingshu-AT-myrealbox.com>. It's off by default because it doesn't
4893 <kingshu-AT-myrealbox.com>. It's off by default because it doesn't
4862 get along well with pasting indented code. If I ever figure out
4894 get along well with pasting indented code. If I ever figure out
4863 how to make that part go well, it will become on by default.
4895 how to make that part go well, it will become on by default.
4864
4896
4865 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixed bug which would
4897 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixed bug which would
4866 crash ipython if there was an unmatched '%' in the user's prompt
4898 crash ipython if there was an unmatched '%' in the user's prompt
4867 string. Reported by Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
4899 string. Reported by Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
4868
4900
4869 * IPython/iplib.py (InteractiveShell.interact): removed the
4901 * IPython/iplib.py (InteractiveShell.interact): removed the
4870 ability to ask the user whether he wants to crash or not at the
4902 ability to ask the user whether he wants to crash or not at the
4871 'last line' exception handler. Calling functions at that point
4903 'last line' exception handler. Calling functions at that point
4872 changes the stack, and the error reports would have incorrect
4904 changes the stack, and the error reports would have incorrect
4873 tracebacks.
4905 tracebacks.
4874
4906
4875 * IPython/Magic.py (Magic.magic_page): Added new @page magic, to
4907 * IPython/Magic.py (Magic.magic_page): Added new @page magic, to
4876 pass through a peger a pretty-printed form of any object. After a
4908 pass through a peger a pretty-printed form of any object. After a
4877 contribution by Olivier Aubert <oaubert-AT-bat710.univ-lyon1.fr>
4909 contribution by Olivier Aubert <oaubert-AT-bat710.univ-lyon1.fr>
4878
4910
4879 2003-04-14 Fernando Perez <fperez@colorado.edu>
4911 2003-04-14 Fernando Perez <fperez@colorado.edu>
4880
4912
4881 * IPython/iplib.py (InteractiveShell.user_setup): Fixed bug where
4913 * IPython/iplib.py (InteractiveShell.user_setup): Fixed bug where
4882 all files in ~ would be modified at first install (instead of
4914 all files in ~ would be modified at first install (instead of
4883 ~/.ipython). This could be potentially disastrous, as the
4915 ~/.ipython). This could be potentially disastrous, as the
4884 modification (make line-endings native) could damage binary files.
4916 modification (make line-endings native) could damage binary files.
4885
4917
4886 2003-04-10 Fernando Perez <fperez@colorado.edu>
4918 2003-04-10 Fernando Perez <fperez@colorado.edu>
4887
4919
4888 * IPython/iplib.py (InteractiveShell.handle_help): Modified to
4920 * IPython/iplib.py (InteractiveShell.handle_help): Modified to
4889 handle only lines which are invalid python. This now means that
4921 handle only lines which are invalid python. This now means that
4890 lines like 'x=1 #?' execute properly. Thanks to Jeffery Collins
4922 lines like 'x=1 #?' execute properly. Thanks to Jeffery Collins
4891 for the bug report.
4923 for the bug report.
4892
4924
4893 2003-04-01 Fernando Perez <fperez@colorado.edu>
4925 2003-04-01 Fernando Perez <fperez@colorado.edu>
4894
4926
4895 * IPython/iplib.py (InteractiveShell.showtraceback): Fixed bug
4927 * IPython/iplib.py (InteractiveShell.showtraceback): Fixed bug
4896 where failing to set sys.last_traceback would crash pdb.pm().
4928 where failing to set sys.last_traceback would crash pdb.pm().
4897 Thanks to Jeffery D. Collins <Jeff.Collins-AT-vexcel.com> for the bug
4929 Thanks to Jeffery D. Collins <Jeff.Collins-AT-vexcel.com> for the bug
4898 report.
4930 report.
4899
4931
4900 2003-03-25 Fernando Perez <fperez@colorado.edu>
4932 2003-03-25 Fernando Perez <fperez@colorado.edu>
4901
4933
4902 * IPython/Magic.py (Magic.magic_prun): rstrip() output of profiler
4934 * IPython/Magic.py (Magic.magic_prun): rstrip() output of profiler
4903 before printing it (it had a lot of spurious blank lines at the
4935 before printing it (it had a lot of spurious blank lines at the
4904 end).
4936 end).
4905
4937
4906 * IPython/Gnuplot2.py (Gnuplot.hardcopy): fixed bug where lpr
4938 * IPython/Gnuplot2.py (Gnuplot.hardcopy): fixed bug where lpr
4907 output would be sent 21 times! Obviously people don't use this
4939 output would be sent 21 times! Obviously people don't use this
4908 too often, or I would have heard about it.
4940 too often, or I would have heard about it.
4909
4941
4910 2003-03-24 Fernando Perez <fperez@colorado.edu>
4942 2003-03-24 Fernando Perez <fperez@colorado.edu>
4911
4943
4912 * setup.py (scriptfiles): renamed the data_files parameter from
4944 * setup.py (scriptfiles): renamed the data_files parameter from
4913 'base' to 'data' to fix rpm build issues. Thanks to Ralf Ahlbrink
4945 'base' to 'data' to fix rpm build issues. Thanks to Ralf Ahlbrink
4914 for the patch.
4946 for the patch.
4915
4947
4916 2003-03-20 Fernando Perez <fperez@colorado.edu>
4948 2003-03-20 Fernando Perez <fperez@colorado.edu>
4917
4949
4918 * IPython/genutils.py (error): added error() and fatal()
4950 * IPython/genutils.py (error): added error() and fatal()
4919 functions.
4951 functions.
4920
4952
4921 2003-03-18 *** Released version 0.2.15pre3
4953 2003-03-18 *** Released version 0.2.15pre3
4922
4954
4923 2003-03-18 Fernando Perez <fperez@colorado.edu>
4955 2003-03-18 Fernando Perez <fperez@colorado.edu>
4924
4956
4925 * setupext/install_data_ext.py
4957 * setupext/install_data_ext.py
4926 (install_data_ext.initialize_options): Class contributed by Jack
4958 (install_data_ext.initialize_options): Class contributed by Jack
4927 Moffit for fixing the old distutils hack. He is sending this to
4959 Moffit for fixing the old distutils hack. He is sending this to
4928 the distutils folks so in the future we may not need it as a
4960 the distutils folks so in the future we may not need it as a
4929 private fix.
4961 private fix.
4930
4962
4931 * MANIFEST.in: Extensive reorganization, based on Jack Moffit's
4963 * MANIFEST.in: Extensive reorganization, based on Jack Moffit's
4932 changes for Debian packaging. See his patch for full details.
4964 changes for Debian packaging. See his patch for full details.
4933 The old distutils hack of making the ipythonrc* files carry a
4965 The old distutils hack of making the ipythonrc* files carry a
4934 bogus .py extension is gone, at last. Examples were moved to a
4966 bogus .py extension is gone, at last. Examples were moved to a
4935 separate subdir under doc/, and the separate executable scripts
4967 separate subdir under doc/, and the separate executable scripts
4936 now live in their own directory. Overall a great cleanup. The
4968 now live in their own directory. Overall a great cleanup. The
4937 manual was updated to use the new files, and setup.py has been
4969 manual was updated to use the new files, and setup.py has been
4938 fixed for this setup.
4970 fixed for this setup.
4939
4971
4940 * IPython/PyColorize.py (Parser.usage): made non-executable and
4972 * IPython/PyColorize.py (Parser.usage): made non-executable and
4941 created a pycolor wrapper around it to be included as a script.
4973 created a pycolor wrapper around it to be included as a script.
4942
4974
4943 2003-03-12 *** Released version 0.2.15pre2
4975 2003-03-12 *** Released version 0.2.15pre2
4944
4976
4945 2003-03-12 Fernando Perez <fperez@colorado.edu>
4977 2003-03-12 Fernando Perez <fperez@colorado.edu>
4946
4978
4947 * IPython/ColorANSI.py (make_color_table): Finally fixed the
4979 * IPython/ColorANSI.py (make_color_table): Finally fixed the
4948 long-standing problem with garbage characters in some terminals.
4980 long-standing problem with garbage characters in some terminals.
4949 The issue was really that the \001 and \002 escapes must _only_ be
4981 The issue was really that the \001 and \002 escapes must _only_ be
4950 passed to input prompts (which call readline), but _never_ to
4982 passed to input prompts (which call readline), but _never_ to
4951 normal text to be printed on screen. I changed ColorANSI to have
4983 normal text to be printed on screen. I changed ColorANSI to have
4952 two classes: TermColors and InputTermColors, each with the
4984 two classes: TermColors and InputTermColors, each with the
4953 appropriate escapes for input prompts or normal text. The code in
4985 appropriate escapes for input prompts or normal text. The code in
4954 Prompts.py got slightly more complicated, but this very old and
4986 Prompts.py got slightly more complicated, but this very old and
4955 annoying bug is finally fixed.
4987 annoying bug is finally fixed.
4956
4988
4957 All the credit for nailing down the real origin of this problem
4989 All the credit for nailing down the real origin of this problem
4958 and the correct solution goes to Jack Moffit <jack-AT-xiph.org>.
4990 and the correct solution goes to Jack Moffit <jack-AT-xiph.org>.
4959 *Many* thanks to him for spending quite a bit of effort on this.
4991 *Many* thanks to him for spending quite a bit of effort on this.
4960
4992
4961 2003-03-05 *** Released version 0.2.15pre1
4993 2003-03-05 *** Released version 0.2.15pre1
4962
4994
4963 2003-03-03 Fernando Perez <fperez@colorado.edu>
4995 2003-03-03 Fernando Perez <fperez@colorado.edu>
4964
4996
4965 * IPython/FakeModule.py: Moved the former _FakeModule to a
4997 * IPython/FakeModule.py: Moved the former _FakeModule to a
4966 separate file, because it's also needed by Magic (to fix a similar
4998 separate file, because it's also needed by Magic (to fix a similar
4967 pickle-related issue in @run).
4999 pickle-related issue in @run).
4968
5000
4969 2003-03-02 Fernando Perez <fperez@colorado.edu>
5001 2003-03-02 Fernando Perez <fperez@colorado.edu>
4970
5002
4971 * IPython/Magic.py (Magic.magic_autocall): new magic to control
5003 * IPython/Magic.py (Magic.magic_autocall): new magic to control
4972 the autocall option at runtime.
5004 the autocall option at runtime.
4973 (Magic.magic_dhist): changed self.user_ns to self.shell.user_ns
5005 (Magic.magic_dhist): changed self.user_ns to self.shell.user_ns
4974 across Magic.py to start separating Magic from InteractiveShell.
5006 across Magic.py to start separating Magic from InteractiveShell.
4975 (Magic._ofind): Fixed to return proper namespace for dotted
5007 (Magic._ofind): Fixed to return proper namespace for dotted
4976 names. Before, a dotted name would always return 'not currently
5008 names. Before, a dotted name would always return 'not currently
4977 defined', because it would find the 'parent'. s.x would be found,
5009 defined', because it would find the 'parent'. s.x would be found,
4978 but since 'x' isn't defined by itself, it would get confused.
5010 but since 'x' isn't defined by itself, it would get confused.
4979 (Magic.magic_run): Fixed pickling problems reported by Ralf
5011 (Magic.magic_run): Fixed pickling problems reported by Ralf
4980 Ahlbrink <RAhlbrink-AT-RosenInspection.net>. The fix was similar to
5012 Ahlbrink <RAhlbrink-AT-RosenInspection.net>. The fix was similar to
4981 that I'd used when Mike Heeter reported similar issues at the
5013 that I'd used when Mike Heeter reported similar issues at the
4982 top-level, but now for @run. It boils down to injecting the
5014 top-level, but now for @run. It boils down to injecting the
4983 namespace where code is being executed with something that looks
5015 namespace where code is being executed with something that looks
4984 enough like a module to fool pickle.dump(). Since a pickle stores
5016 enough like a module to fool pickle.dump(). Since a pickle stores
4985 a named reference to the importing module, we need this for
5017 a named reference to the importing module, we need this for
4986 pickles to save something sensible.
5018 pickles to save something sensible.
4987
5019
4988 * IPython/ipmaker.py (make_IPython): added an autocall option.
5020 * IPython/ipmaker.py (make_IPython): added an autocall option.
4989
5021
4990 * IPython/iplib.py (InteractiveShell._prefilter): reordered all of
5022 * IPython/iplib.py (InteractiveShell._prefilter): reordered all of
4991 the auto-eval code. Now autocalling is an option, and the code is
5023 the auto-eval code. Now autocalling is an option, and the code is
4992 also vastly safer. There is no more eval() involved at all.
5024 also vastly safer. There is no more eval() involved at all.
4993
5025
4994 2003-03-01 Fernando Perez <fperez@colorado.edu>
5026 2003-03-01 Fernando Perez <fperez@colorado.edu>
4995
5027
4996 * IPython/Magic.py (Magic._ofind): Changed interface to return a
5028 * IPython/Magic.py (Magic._ofind): Changed interface to return a
4997 dict with named keys instead of a tuple.
5029 dict with named keys instead of a tuple.
4998
5030
4999 * IPython: Started using CVS for IPython as of 0.2.15pre1.
5031 * IPython: Started using CVS for IPython as of 0.2.15pre1.
5000
5032
5001 * setup.py (make_shortcut): Fixed message about directories
5033 * setup.py (make_shortcut): Fixed message about directories
5002 created during Windows installation (the directories were ok, just
5034 created during Windows installation (the directories were ok, just
5003 the printed message was misleading). Thanks to Chris Liechti
5035 the printed message was misleading). Thanks to Chris Liechti
5004 <cliechti-AT-gmx.net> for the heads up.
5036 <cliechti-AT-gmx.net> for the heads up.
5005
5037
5006 2003-02-21 Fernando Perez <fperez@colorado.edu>
5038 2003-02-21 Fernando Perez <fperez@colorado.edu>
5007
5039
5008 * IPython/iplib.py (InteractiveShell._prefilter): Fixed catching
5040 * IPython/iplib.py (InteractiveShell._prefilter): Fixed catching
5009 of ValueError exception when checking for auto-execution. This
5041 of ValueError exception when checking for auto-execution. This
5010 one is raised by things like Numeric arrays arr.flat when the
5042 one is raised by things like Numeric arrays arr.flat when the
5011 array is non-contiguous.
5043 array is non-contiguous.
5012
5044
5013 2003-01-31 Fernando Perez <fperez@colorado.edu>
5045 2003-01-31 Fernando Perez <fperez@colorado.edu>
5014
5046
5015 * IPython/genutils.py (SystemExec.bq): Fixed bug where bq would
5047 * IPython/genutils.py (SystemExec.bq): Fixed bug where bq would
5016 not return any value at all (even though the command would get
5048 not return any value at all (even though the command would get
5017 executed).
5049 executed).
5018 (xsys): Flush stdout right after printing the command to ensure
5050 (xsys): Flush stdout right after printing the command to ensure
5019 proper ordering of commands and command output in the total
5051 proper ordering of commands and command output in the total
5020 output.
5052 output.
5021 (SystemExec/xsys/bq): Switched the names of xsys/bq and
5053 (SystemExec/xsys/bq): Switched the names of xsys/bq and
5022 system/getoutput as defaults. The old ones are kept for
5054 system/getoutput as defaults. The old ones are kept for
5023 compatibility reasons, so no code which uses this library needs
5055 compatibility reasons, so no code which uses this library needs
5024 changing.
5056 changing.
5025
5057
5026 2003-01-27 *** Released version 0.2.14
5058 2003-01-27 *** Released version 0.2.14
5027
5059
5028 2003-01-25 Fernando Perez <fperez@colorado.edu>
5060 2003-01-25 Fernando Perez <fperez@colorado.edu>
5029
5061
5030 * IPython/Magic.py (Magic.magic_edit): Fixed problem where
5062 * IPython/Magic.py (Magic.magic_edit): Fixed problem where
5031 functions defined in previous edit sessions could not be re-edited
5063 functions defined in previous edit sessions could not be re-edited
5032 (because the temp files were immediately removed). Now temp files
5064 (because the temp files were immediately removed). Now temp files
5033 are removed only at IPython's exit.
5065 are removed only at IPython's exit.
5034 (Magic.magic_run): Improved @run to perform shell-like expansions
5066 (Magic.magic_run): Improved @run to perform shell-like expansions
5035 on its arguments (~users and $VARS). With this, @run becomes more
5067 on its arguments (~users and $VARS). With this, @run becomes more
5036 like a normal command-line.
5068 like a normal command-line.
5037
5069
5038 * IPython/Shell.py (IPShellEmbed.__call__): Fixed a bunch of small
5070 * IPython/Shell.py (IPShellEmbed.__call__): Fixed a bunch of small
5039 bugs related to embedding and cleaned up that code. A fairly
5071 bugs related to embedding and cleaned up that code. A fairly
5040 important one was the impossibility to access the global namespace
5072 important one was the impossibility to access the global namespace
5041 through the embedded IPython (only local variables were visible).
5073 through the embedded IPython (only local variables were visible).
5042
5074
5043 2003-01-14 Fernando Perez <fperez@colorado.edu>
5075 2003-01-14 Fernando Perez <fperez@colorado.edu>
5044
5076
5045 * IPython/iplib.py (InteractiveShell._prefilter): Fixed
5077 * IPython/iplib.py (InteractiveShell._prefilter): Fixed
5046 auto-calling to be a bit more conservative. Now it doesn't get
5078 auto-calling to be a bit more conservative. Now it doesn't get
5047 triggered if any of '!=()<>' are in the rest of the input line, to
5079 triggered if any of '!=()<>' are in the rest of the input line, to
5048 allow comparing callables. Thanks to Alex for the heads up.
5080 allow comparing callables. Thanks to Alex for the heads up.
5049
5081
5050 2003-01-07 Fernando Perez <fperez@colorado.edu>
5082 2003-01-07 Fernando Perez <fperez@colorado.edu>
5051
5083
5052 * IPython/genutils.py (page): fixed estimation of the number of
5084 * IPython/genutils.py (page): fixed estimation of the number of
5053 lines in a string to be paged to simply count newlines. This
5085 lines in a string to be paged to simply count newlines. This
5054 prevents over-guessing due to embedded escape sequences. A better
5086 prevents over-guessing due to embedded escape sequences. A better
5055 long-term solution would involve stripping out the control chars
5087 long-term solution would involve stripping out the control chars
5056 for the count, but it's potentially so expensive I just don't
5088 for the count, but it's potentially so expensive I just don't
5057 think it's worth doing.
5089 think it's worth doing.
5058
5090
5059 2002-12-19 *** Released version 0.2.14pre50
5091 2002-12-19 *** Released version 0.2.14pre50
5060
5092
5061 2002-12-19 Fernando Perez <fperez@colorado.edu>
5093 2002-12-19 Fernando Perez <fperez@colorado.edu>
5062
5094
5063 * tools/release (version): Changed release scripts to inform
5095 * tools/release (version): Changed release scripts to inform
5064 Andrea and build a NEWS file with a list of recent changes.
5096 Andrea and build a NEWS file with a list of recent changes.
5065
5097
5066 * IPython/ColorANSI.py (__all__): changed terminal detection
5098 * IPython/ColorANSI.py (__all__): changed terminal detection
5067 code. Seems to work better for xterms without breaking
5099 code. Seems to work better for xterms without breaking
5068 konsole. Will need more testing to determine if WinXP and Mac OSX
5100 konsole. Will need more testing to determine if WinXP and Mac OSX
5069 also work ok.
5101 also work ok.
5070
5102
5071 2002-12-18 *** Released version 0.2.14pre49
5103 2002-12-18 *** Released version 0.2.14pre49
5072
5104
5073 2002-12-18 Fernando Perez <fperez@colorado.edu>
5105 2002-12-18 Fernando Perez <fperez@colorado.edu>
5074
5106
5075 * Docs: added new info about Mac OSX, from Andrea.
5107 * Docs: added new info about Mac OSX, from Andrea.
5076
5108
5077 * IPython/Gnuplot2.py (String): Added a String PlotItem class to
5109 * IPython/Gnuplot2.py (String): Added a String PlotItem class to
5078 allow direct plotting of python strings whose format is the same
5110 allow direct plotting of python strings whose format is the same
5079 of gnuplot data files.
5111 of gnuplot data files.
5080
5112
5081 2002-12-16 Fernando Perez <fperez@colorado.edu>
5113 2002-12-16 Fernando Perez <fperez@colorado.edu>
5082
5114
5083 * IPython/iplib.py (InteractiveShell.interact): fixed default (y)
5115 * IPython/iplib.py (InteractiveShell.interact): fixed default (y)
5084 value of exit question to be acknowledged.
5116 value of exit question to be acknowledged.
5085
5117
5086 2002-12-03 Fernando Perez <fperez@colorado.edu>
5118 2002-12-03 Fernando Perez <fperez@colorado.edu>
5087
5119
5088 * IPython/ipmaker.py: removed generators, which had been added
5120 * IPython/ipmaker.py: removed generators, which had been added
5089 by mistake in an earlier debugging run. This was causing trouble
5121 by mistake in an earlier debugging run. This was causing trouble
5090 to users of python 2.1.x. Thanks to Abel Daniel <abli-AT-freemail.hu>
5122 to users of python 2.1.x. Thanks to Abel Daniel <abli-AT-freemail.hu>
5091 for pointing this out.
5123 for pointing this out.
5092
5124
5093 2002-11-17 Fernando Perez <fperez@colorado.edu>
5125 2002-11-17 Fernando Perez <fperez@colorado.edu>
5094
5126
5095 * Manual: updated the Gnuplot section.
5127 * Manual: updated the Gnuplot section.
5096
5128
5097 * IPython/GnuplotRuntime.py: refactored a lot all this code, with
5129 * IPython/GnuplotRuntime.py: refactored a lot all this code, with
5098 a much better split of what goes in Runtime and what goes in
5130 a much better split of what goes in Runtime and what goes in
5099 Interactive.
5131 Interactive.
5100
5132
5101 * IPython/ipmaker.py: fixed bug where import_fail_info wasn't
5133 * IPython/ipmaker.py: fixed bug where import_fail_info wasn't
5102 being imported from iplib.
5134 being imported from iplib.
5103
5135
5104 * IPython/GnuplotInteractive.py (magic_gpc): renamed @gp to @gpc
5136 * IPython/GnuplotInteractive.py (magic_gpc): renamed @gp to @gpc
5105 for command-passing. Now the global Gnuplot instance is called
5137 for command-passing. Now the global Gnuplot instance is called
5106 'gp' instead of 'g', which was really a far too fragile and
5138 'gp' instead of 'g', which was really a far too fragile and
5107 common name.
5139 common name.
5108
5140
5109 * IPython/Gnuplot2.py (eps_fix_bbox): added this to fix broken
5141 * IPython/Gnuplot2.py (eps_fix_bbox): added this to fix broken
5110 bounding boxes generated by Gnuplot for square plots.
5142 bounding boxes generated by Gnuplot for square plots.
5111
5143
5112 * IPython/genutils.py (popkey): new function added. I should
5144 * IPython/genutils.py (popkey): new function added. I should
5113 suggest this on c.l.py as a dict method, it seems useful.
5145 suggest this on c.l.py as a dict method, it seems useful.
5114
5146
5115 * IPython/Gnuplot2.py (Gnuplot.plot): Overhauled plot and replot
5147 * IPython/Gnuplot2.py (Gnuplot.plot): Overhauled plot and replot
5116 to transparently handle PostScript generation. MUCH better than
5148 to transparently handle PostScript generation. MUCH better than
5117 the previous plot_eps/replot_eps (which I removed now). The code
5149 the previous plot_eps/replot_eps (which I removed now). The code
5118 is also fairly clean and well documented now (including
5150 is also fairly clean and well documented now (including
5119 docstrings).
5151 docstrings).
5120
5152
5121 2002-11-13 Fernando Perez <fperez@colorado.edu>
5153 2002-11-13 Fernando Perez <fperez@colorado.edu>
5122
5154
5123 * IPython/Magic.py (Magic.magic_edit): fixed docstring
5155 * IPython/Magic.py (Magic.magic_edit): fixed docstring
5124 (inconsistent with options).
5156 (inconsistent with options).
5125
5157
5126 * IPython/Gnuplot2.py (Gnuplot.hardcopy): hardcopy had been
5158 * IPython/Gnuplot2.py (Gnuplot.hardcopy): hardcopy had been
5127 manually disabled, I don't know why. Fixed it.
5159 manually disabled, I don't know why. Fixed it.
5128 (Gnuplot._plot_eps): added new plot_eps/replot_eps to get directly
5160 (Gnuplot._plot_eps): added new plot_eps/replot_eps to get directly
5129 eps output.
5161 eps output.
5130
5162
5131 2002-11-12 Fernando Perez <fperez@colorado.edu>
5163 2002-11-12 Fernando Perez <fperez@colorado.edu>
5132
5164
5133 * IPython/genutils.py (ask_yes_no): trap EOF and ^C so that they
5165 * IPython/genutils.py (ask_yes_no): trap EOF and ^C so that they
5134 don't propagate up to caller. Fixes crash reported by François
5166 don't propagate up to caller. Fixes crash reported by François
5135 Pinard.
5167 Pinard.
5136
5168
5137 2002-11-09 Fernando Perez <fperez@colorado.edu>
5169 2002-11-09 Fernando Perez <fperez@colorado.edu>
5138
5170
5139 * IPython/ipmaker.py (make_IPython): fixed problem with writing
5171 * IPython/ipmaker.py (make_IPython): fixed problem with writing
5140 history file for new users.
5172 history file for new users.
5141 (make_IPython): fixed bug where initial install would leave the
5173 (make_IPython): fixed bug where initial install would leave the
5142 user running in the .ipython dir.
5174 user running in the .ipython dir.
5143 (make_IPython): fixed bug where config dir .ipython would be
5175 (make_IPython): fixed bug where config dir .ipython would be
5144 created regardless of the given -ipythondir option. Thanks to Cory
5176 created regardless of the given -ipythondir option. Thanks to Cory
5145 Dodt <cdodt-AT-fcoe.k12.ca.us> for the bug report.
5177 Dodt <cdodt-AT-fcoe.k12.ca.us> for the bug report.
5146
5178
5147 * IPython/genutils.py (ask_yes_no): new function for asking yes/no
5179 * IPython/genutils.py (ask_yes_no): new function for asking yes/no
5148 type confirmations. Will need to use it in all of IPython's code
5180 type confirmations. Will need to use it in all of IPython's code
5149 consistently.
5181 consistently.
5150
5182
5151 * IPython/CrashHandler.py (CrashHandler.__call__): changed the
5183 * IPython/CrashHandler.py (CrashHandler.__call__): changed the
5152 context to print 31 lines instead of the default 5. This will make
5184 context to print 31 lines instead of the default 5. This will make
5153 the crash reports extremely detailed in case the problem is in
5185 the crash reports extremely detailed in case the problem is in
5154 libraries I don't have access to.
5186 libraries I don't have access to.
5155
5187
5156 * IPython/iplib.py (InteractiveShell.interact): changed the 'last
5188 * IPython/iplib.py (InteractiveShell.interact): changed the 'last
5157 line of defense' code to still crash, but giving users fair
5189 line of defense' code to still crash, but giving users fair
5158 warning. I don't want internal errors to go unreported: if there's
5190 warning. I don't want internal errors to go unreported: if there's
5159 an internal problem, IPython should crash and generate a full
5191 an internal problem, IPython should crash and generate a full
5160 report.
5192 report.
5161
5193
5162 2002-11-08 Fernando Perez <fperez@colorado.edu>
5194 2002-11-08 Fernando Perez <fperez@colorado.edu>
5163
5195
5164 * IPython/iplib.py (InteractiveShell.interact): added code to trap
5196 * IPython/iplib.py (InteractiveShell.interact): added code to trap
5165 otherwise uncaught exceptions which can appear if people set
5197 otherwise uncaught exceptions which can appear if people set
5166 sys.stdout to something badly broken. Thanks to a crash report
5198 sys.stdout to something badly broken. Thanks to a crash report
5167 from henni-AT-mail.brainbot.com.
5199 from henni-AT-mail.brainbot.com.
5168
5200
5169 2002-11-04 Fernando Perez <fperez@colorado.edu>
5201 2002-11-04 Fernando Perez <fperez@colorado.edu>
5170
5202
5171 * IPython/iplib.py (InteractiveShell.interact): added
5203 * IPython/iplib.py (InteractiveShell.interact): added
5172 __IPYTHON__active to the builtins. It's a flag which goes on when
5204 __IPYTHON__active to the builtins. It's a flag which goes on when
5173 the interaction starts and goes off again when it stops. This
5205 the interaction starts and goes off again when it stops. This
5174 allows embedding code to detect being inside IPython. Before this
5206 allows embedding code to detect being inside IPython. Before this
5175 was done via __IPYTHON__, but that only shows that an IPython
5207 was done via __IPYTHON__, but that only shows that an IPython
5176 instance has been created.
5208 instance has been created.
5177
5209
5178 * IPython/Magic.py (Magic.magic_env): I realized that in a
5210 * IPython/Magic.py (Magic.magic_env): I realized that in a
5179 UserDict, instance.data holds the data as a normal dict. So I
5211 UserDict, instance.data holds the data as a normal dict. So I
5180 modified @env to return os.environ.data instead of rebuilding a
5212 modified @env to return os.environ.data instead of rebuilding a
5181 dict by hand.
5213 dict by hand.
5182
5214
5183 2002-11-02 Fernando Perez <fperez@colorado.edu>
5215 2002-11-02 Fernando Perez <fperez@colorado.edu>
5184
5216
5185 * IPython/genutils.py (warn): changed so that level 1 prints no
5217 * IPython/genutils.py (warn): changed so that level 1 prints no
5186 header. Level 2 is now the default (with 'WARNING' header, as
5218 header. Level 2 is now the default (with 'WARNING' header, as
5187 before). I think I tracked all places where changes were needed in
5219 before). I think I tracked all places where changes were needed in
5188 IPython, but outside code using the old level numbering may have
5220 IPython, but outside code using the old level numbering may have
5189 broken.
5221 broken.
5190
5222
5191 * IPython/iplib.py (InteractiveShell.runcode): added this to
5223 * IPython/iplib.py (InteractiveShell.runcode): added this to
5192 handle the tracebacks in SystemExit traps correctly. The previous
5224 handle the tracebacks in SystemExit traps correctly. The previous
5193 code (through interact) was printing more of the stack than
5225 code (through interact) was printing more of the stack than
5194 necessary, showing IPython internal code to the user.
5226 necessary, showing IPython internal code to the user.
5195
5227
5196 * IPython/UserConfig/ipythonrc.py: Made confirm_exit 1 by
5228 * IPython/UserConfig/ipythonrc.py: Made confirm_exit 1 by
5197 default. Now that the default at the confirmation prompt is yes,
5229 default. Now that the default at the confirmation prompt is yes,
5198 it's not so intrusive. François' argument that ipython sessions
5230 it's not so intrusive. François' argument that ipython sessions
5199 tend to be complex enough not to lose them from an accidental C-d,
5231 tend to be complex enough not to lose them from an accidental C-d,
5200 is a valid one.
5232 is a valid one.
5201
5233
5202 * IPython/iplib.py (InteractiveShell.interact): added a
5234 * IPython/iplib.py (InteractiveShell.interact): added a
5203 showtraceback() call to the SystemExit trap, and modified the exit
5235 showtraceback() call to the SystemExit trap, and modified the exit
5204 confirmation to have yes as the default.
5236 confirmation to have yes as the default.
5205
5237
5206 * IPython/UserConfig/ipythonrc.py: removed 'session' option from
5238 * IPython/UserConfig/ipythonrc.py: removed 'session' option from
5207 this file. It's been gone from the code for a long time, this was
5239 this file. It's been gone from the code for a long time, this was
5208 simply leftover junk.
5240 simply leftover junk.
5209
5241
5210 2002-11-01 Fernando Perez <fperez@colorado.edu>
5242 2002-11-01 Fernando Perez <fperez@colorado.edu>
5211
5243
5212 * IPython/UserConfig/ipythonrc.py: new confirm_exit option
5244 * IPython/UserConfig/ipythonrc.py: new confirm_exit option
5213 added. If set, IPython now traps EOF and asks for
5245 added. If set, IPython now traps EOF and asks for
5214 confirmation. After a request by François Pinard.
5246 confirmation. After a request by François Pinard.
5215
5247
5216 * IPython/Magic.py (Magic.magic_Exit): New @Exit and @Quit instead
5248 * IPython/Magic.py (Magic.magic_Exit): New @Exit and @Quit instead
5217 of @abort, and with a new (better) mechanism for handling the
5249 of @abort, and with a new (better) mechanism for handling the
5218 exceptions.
5250 exceptions.
5219
5251
5220 2002-10-27 Fernando Perez <fperez@colorado.edu>
5252 2002-10-27 Fernando Perez <fperez@colorado.edu>
5221
5253
5222 * IPython/usage.py (__doc__): updated the --help information and
5254 * IPython/usage.py (__doc__): updated the --help information and
5223 the ipythonrc file to indicate that -log generates
5255 the ipythonrc file to indicate that -log generates
5224 ./ipython.log. Also fixed the corresponding info in @logstart.
5256 ./ipython.log. Also fixed the corresponding info in @logstart.
5225 This and several other fixes in the manuals thanks to reports by
5257 This and several other fixes in the manuals thanks to reports by
5226 François Pinard <pinard-AT-iro.umontreal.ca>.
5258 François Pinard <pinard-AT-iro.umontreal.ca>.
5227
5259
5228 * IPython/Logger.py (Logger.switch_log): Fixed error message to
5260 * IPython/Logger.py (Logger.switch_log): Fixed error message to
5229 refer to @logstart (instead of @log, which doesn't exist).
5261 refer to @logstart (instead of @log, which doesn't exist).
5230
5262
5231 * IPython/iplib.py (InteractiveShell._prefilter): fixed
5263 * IPython/iplib.py (InteractiveShell._prefilter): fixed
5232 AttributeError crash. Thanks to Christopher Armstrong
5264 AttributeError crash. Thanks to Christopher Armstrong
5233 <radix-AT-twistedmatrix.com> for the report/fix. This bug had been
5265 <radix-AT-twistedmatrix.com> for the report/fix. This bug had been
5234 introduced recently (in 0.2.14pre37) with the fix to the eval
5266 introduced recently (in 0.2.14pre37) with the fix to the eval
5235 problem mentioned below.
5267 problem mentioned below.
5236
5268
5237 2002-10-17 Fernando Perez <fperez@colorado.edu>
5269 2002-10-17 Fernando Perez <fperez@colorado.edu>
5238
5270
5239 * IPython/ConfigLoader.py (ConfigLoader.load): Fixes for Windows
5271 * IPython/ConfigLoader.py (ConfigLoader.load): Fixes for Windows
5240 installation. Thanks to Leonardo Santagada <retype-AT-terra.com.br>.
5272 installation. Thanks to Leonardo Santagada <retype-AT-terra.com.br>.
5241
5273
5242 * IPython/iplib.py (InteractiveShell._prefilter): Many changes to
5274 * IPython/iplib.py (InteractiveShell._prefilter): Many changes to
5243 this function to fix a problem reported by Alex Schmolck. He saw
5275 this function to fix a problem reported by Alex Schmolck. He saw
5244 it with list comprehensions and generators, which were getting
5276 it with list comprehensions and generators, which were getting
5245 called twice. The real problem was an 'eval' call in testing for
5277 called twice. The real problem was an 'eval' call in testing for
5246 automagic which was evaluating the input line silently.
5278 automagic which was evaluating the input line silently.
5247
5279
5248 This is a potentially very nasty bug, if the input has side
5280 This is a potentially very nasty bug, if the input has side
5249 effects which must not be repeated. The code is much cleaner now,
5281 effects which must not be repeated. The code is much cleaner now,
5250 without any blanket 'except' left and with a regexp test for
5282 without any blanket 'except' left and with a regexp test for
5251 actual function names.
5283 actual function names.
5252
5284
5253 But an eval remains, which I'm not fully comfortable with. I just
5285 But an eval remains, which I'm not fully comfortable with. I just
5254 don't know how to find out if an expression could be a callable in
5286 don't know how to find out if an expression could be a callable in
5255 the user's namespace without doing an eval on the string. However
5287 the user's namespace without doing an eval on the string. However
5256 that string is now much more strictly checked so that no code
5288 that string is now much more strictly checked so that no code
5257 slips by, so the eval should only happen for things that can
5289 slips by, so the eval should only happen for things that can
5258 really be only function/method names.
5290 really be only function/method names.
5259
5291
5260 2002-10-15 Fernando Perez <fperez@colorado.edu>
5292 2002-10-15 Fernando Perez <fperez@colorado.edu>
5261
5293
5262 * Updated LyX to 1.2.1 so I can work on the docs again. Added Mac
5294 * Updated LyX to 1.2.1 so I can work on the docs again. Added Mac
5263 OSX information to main manual, removed README_Mac_OSX file from
5295 OSX information to main manual, removed README_Mac_OSX file from
5264 distribution. Also updated credits for recent additions.
5296 distribution. Also updated credits for recent additions.
5265
5297
5266 2002-10-10 Fernando Perez <fperez@colorado.edu>
5298 2002-10-10 Fernando Perez <fperez@colorado.edu>
5267
5299
5268 * README_Mac_OSX: Added a README for Mac OSX users for fixing
5300 * README_Mac_OSX: Added a README for Mac OSX users for fixing
5269 terminal-related issues. Many thanks to Andrea Riciputi
5301 terminal-related issues. Many thanks to Andrea Riciputi
5270 <andrea.riciputi-AT-libero.it> for writing it.
5302 <andrea.riciputi-AT-libero.it> for writing it.
5271
5303
5272 * IPython/UserConfig/ipythonrc.py: Fixes to various small issues,
5304 * IPython/UserConfig/ipythonrc.py: Fixes to various small issues,
5273 thanks to Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
5305 thanks to Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
5274
5306
5275 * setup.py (make_shortcut): Fixes for Windows installation. Thanks
5307 * setup.py (make_shortcut): Fixes for Windows installation. Thanks
5276 to Fredrik Kant <fredrik.kant-AT-front.com> and Syver Enstad
5308 to Fredrik Kant <fredrik.kant-AT-front.com> and Syver Enstad
5277 <syver-en-AT-online.no> who both submitted patches for this problem.
5309 <syver-en-AT-online.no> who both submitted patches for this problem.
5278
5310
5279 * IPython/iplib.py (InteractiveShell.embed_mainloop): Patch for
5311 * IPython/iplib.py (InteractiveShell.embed_mainloop): Patch for
5280 global embedding to make sure that things don't overwrite user
5312 global embedding to make sure that things don't overwrite user
5281 globals accidentally. Thanks to Richard <rxe-AT-renre-europe.com>
5313 globals accidentally. Thanks to Richard <rxe-AT-renre-europe.com>
5282
5314
5283 * IPython/Gnuplot2.py (gp): Patch for Gnuplot.py 1.6
5315 * IPython/Gnuplot2.py (gp): Patch for Gnuplot.py 1.6
5284 compatibility. Thanks to Hayden Callow
5316 compatibility. Thanks to Hayden Callow
5285 <h.callow-AT-elec.canterbury.ac.nz>
5317 <h.callow-AT-elec.canterbury.ac.nz>
5286
5318
5287 2002-10-04 Fernando Perez <fperez@colorado.edu>
5319 2002-10-04 Fernando Perez <fperez@colorado.edu>
5288
5320
5289 * IPython/Gnuplot2.py (PlotItem): Added 'index' option for
5321 * IPython/Gnuplot2.py (PlotItem): Added 'index' option for
5290 Gnuplot.File objects.
5322 Gnuplot.File objects.
5291
5323
5292 2002-07-23 Fernando Perez <fperez@colorado.edu>
5324 2002-07-23 Fernando Perez <fperez@colorado.edu>
5293
5325
5294 * IPython/genutils.py (timing): Added timings() and timing() for
5326 * IPython/genutils.py (timing): Added timings() and timing() for
5295 quick access to the most commonly needed data, the execution
5327 quick access to the most commonly needed data, the execution
5296 times. Old timing() renamed to timings_out().
5328 times. Old timing() renamed to timings_out().
5297
5329
5298 2002-07-18 Fernando Perez <fperez@colorado.edu>
5330 2002-07-18 Fernando Perez <fperez@colorado.edu>
5299
5331
5300 * IPython/Shell.py (IPShellEmbed.restore_system_completer): fixed
5332 * IPython/Shell.py (IPShellEmbed.restore_system_completer): fixed
5301 bug with nested instances disrupting the parent's tab completion.
5333 bug with nested instances disrupting the parent's tab completion.
5302
5334
5303 * IPython/iplib.py (all_completions): Added Alex Schmolck's
5335 * IPython/iplib.py (all_completions): Added Alex Schmolck's
5304 all_completions code to begin the emacs integration.
5336 all_completions code to begin the emacs integration.
5305
5337
5306 * IPython/Gnuplot2.py (zip_items): Added optional 'titles'
5338 * IPython/Gnuplot2.py (zip_items): Added optional 'titles'
5307 argument to allow titling individual arrays when plotting.
5339 argument to allow titling individual arrays when plotting.
5308
5340
5309 2002-07-15 Fernando Perez <fperez@colorado.edu>
5341 2002-07-15 Fernando Perez <fperez@colorado.edu>
5310
5342
5311 * setup.py (make_shortcut): changed to retrieve the value of
5343 * setup.py (make_shortcut): changed to retrieve the value of
5312 'Program Files' directory from the registry (this value changes in
5344 'Program Files' directory from the registry (this value changes in
5313 non-english versions of Windows). Thanks to Thomas Fanslau
5345 non-english versions of Windows). Thanks to Thomas Fanslau
5314 <tfanslau-AT-gmx.de> for the report.
5346 <tfanslau-AT-gmx.de> for the report.
5315
5347
5316 2002-07-10 Fernando Perez <fperez@colorado.edu>
5348 2002-07-10 Fernando Perez <fperez@colorado.edu>
5317
5349
5318 * IPython/ultraTB.py (VerboseTB.debugger): enabled workaround for
5350 * IPython/ultraTB.py (VerboseTB.debugger): enabled workaround for
5319 a bug in pdb, which crashes if a line with only whitespace is
5351 a bug in pdb, which crashes if a line with only whitespace is
5320 entered. Bug report submitted to sourceforge.
5352 entered. Bug report submitted to sourceforge.
5321
5353
5322 2002-07-09 Fernando Perez <fperez@colorado.edu>
5354 2002-07-09 Fernando Perez <fperez@colorado.edu>
5323
5355
5324 * IPython/ultraTB.py (VerboseTB.nullrepr): fixed rare crash when
5356 * IPython/ultraTB.py (VerboseTB.nullrepr): fixed rare crash when
5325 reporting exceptions (it's a bug in inspect.py, I just set a
5357 reporting exceptions (it's a bug in inspect.py, I just set a
5326 workaround).
5358 workaround).
5327
5359
5328 2002-07-08 Fernando Perez <fperez@colorado.edu>
5360 2002-07-08 Fernando Perez <fperez@colorado.edu>
5329
5361
5330 * IPython/iplib.py (InteractiveShell.__init__): fixed reference to
5362 * IPython/iplib.py (InteractiveShell.__init__): fixed reference to
5331 __IPYTHON__ in __builtins__ to show up in user_ns.
5363 __IPYTHON__ in __builtins__ to show up in user_ns.
5332
5364
5333 2002-07-03 Fernando Perez <fperez@colorado.edu>
5365 2002-07-03 Fernando Perez <fperez@colorado.edu>
5334
5366
5335 * IPython/GnuplotInteractive.py (magic_gp_set_default): changed
5367 * IPython/GnuplotInteractive.py (magic_gp_set_default): changed
5336 name from @gp_set_instance to @gp_set_default.
5368 name from @gp_set_instance to @gp_set_default.
5337
5369
5338 * IPython/ipmaker.py (make_IPython): default editor value set to
5370 * IPython/ipmaker.py (make_IPython): default editor value set to
5339 '0' (a string), to match the rc file. Otherwise will crash when
5371 '0' (a string), to match the rc file. Otherwise will crash when
5340 .strip() is called on it.
5372 .strip() is called on it.
5341
5373
5342
5374
5343 2002-06-28 Fernando Perez <fperez@colorado.edu>
5375 2002-06-28 Fernando Perez <fperez@colorado.edu>
5344
5376
5345 * IPython/iplib.py (InteractiveShell.safe_execfile): fix importing
5377 * IPython/iplib.py (InteractiveShell.safe_execfile): fix importing
5346 of files in current directory when a file is executed via
5378 of files in current directory when a file is executed via
5347 @run. Patch also by RA <ralf_ahlbrink-AT-web.de>.
5379 @run. Patch also by RA <ralf_ahlbrink-AT-web.de>.
5348
5380
5349 * setup.py (manfiles): fix for rpm builds, submitted by RA
5381 * setup.py (manfiles): fix for rpm builds, submitted by RA
5350 <ralf_ahlbrink-AT-web.de>. Now we have RPMs!
5382 <ralf_ahlbrink-AT-web.de>. Now we have RPMs!
5351
5383
5352 * IPython/ipmaker.py (make_IPython): fixed lookup of default
5384 * IPython/ipmaker.py (make_IPython): fixed lookup of default
5353 editor when set to '0'. Problem was, '0' evaluates to True (it's a
5385 editor when set to '0'. Problem was, '0' evaluates to True (it's a
5354 string!). A. Schmolck caught this one.
5386 string!). A. Schmolck caught this one.
5355
5387
5356 2002-06-27 Fernando Perez <fperez@colorado.edu>
5388 2002-06-27 Fernando Perez <fperez@colorado.edu>
5357
5389
5358 * IPython/ipmaker.py (make_IPython): fixed bug when running user
5390 * IPython/ipmaker.py (make_IPython): fixed bug when running user
5359 defined files at the cmd line. __name__ wasn't being set to
5391 defined files at the cmd line. __name__ wasn't being set to
5360 __main__.
5392 __main__.
5361
5393
5362 * IPython/Gnuplot2.py (zip_items): improved it so it can plot also
5394 * IPython/Gnuplot2.py (zip_items): improved it so it can plot also
5363 regular lists and tuples besides Numeric arrays.
5395 regular lists and tuples besides Numeric arrays.
5364
5396
5365 * IPython/Prompts.py (CachedOutput.__call__): Added output
5397 * IPython/Prompts.py (CachedOutput.__call__): Added output
5366 supression for input ending with ';'. Similar to Mathematica and
5398 supression for input ending with ';'. Similar to Mathematica and
5367 Matlab. The _* vars and Out[] list are still updated, just like
5399 Matlab. The _* vars and Out[] list are still updated, just like
5368 Mathematica behaves.
5400 Mathematica behaves.
5369
5401
5370 2002-06-25 Fernando Perez <fperez@colorado.edu>
5402 2002-06-25 Fernando Perez <fperez@colorado.edu>
5371
5403
5372 * IPython/ConfigLoader.py (ConfigLoader.load): fixed checking of
5404 * IPython/ConfigLoader.py (ConfigLoader.load): fixed checking of
5373 .ini extensions for profiels under Windows.
5405 .ini extensions for profiels under Windows.
5374
5406
5375 * IPython/OInspect.py (Inspector.pinfo): improved alignment of
5407 * IPython/OInspect.py (Inspector.pinfo): improved alignment of
5376 string form. Fix contributed by Alexander Schmolck
5408 string form. Fix contributed by Alexander Schmolck
5377 <a.schmolck-AT-gmx.net>
5409 <a.schmolck-AT-gmx.net>
5378
5410
5379 * IPython/GnuplotRuntime.py (gp_new): new function. Returns a
5411 * IPython/GnuplotRuntime.py (gp_new): new function. Returns a
5380 pre-configured Gnuplot instance.
5412 pre-configured Gnuplot instance.
5381
5413
5382 2002-06-21 Fernando Perez <fperez@colorado.edu>
5414 2002-06-21 Fernando Perez <fperez@colorado.edu>
5383
5415
5384 * IPython/numutils.py (exp_safe): new function, works around the
5416 * IPython/numutils.py (exp_safe): new function, works around the
5385 underflow problems in Numeric.
5417 underflow problems in Numeric.
5386 (log2): New fn. Safe log in base 2: returns exact integer answer
5418 (log2): New fn. Safe log in base 2: returns exact integer answer
5387 for exact integer powers of 2.
5419 for exact integer powers of 2.
5388
5420
5389 * IPython/Magic.py (get_py_filename): fixed it not expanding '~'
5421 * IPython/Magic.py (get_py_filename): fixed it not expanding '~'
5390 properly.
5422 properly.
5391
5423
5392 2002-06-20 Fernando Perez <fperez@colorado.edu>
5424 2002-06-20 Fernando Perez <fperez@colorado.edu>
5393
5425
5394 * IPython/genutils.py (timing): new function like
5426 * IPython/genutils.py (timing): new function like
5395 Mathematica's. Similar to time_test, but returns more info.
5427 Mathematica's. Similar to time_test, but returns more info.
5396
5428
5397 2002-06-18 Fernando Perez <fperez@colorado.edu>
5429 2002-06-18 Fernando Perez <fperez@colorado.edu>
5398
5430
5399 * IPython/Magic.py (Magic.magic_save): modified @save and @r
5431 * IPython/Magic.py (Magic.magic_save): modified @save and @r
5400 according to Mike Heeter's suggestions.
5432 according to Mike Heeter's suggestions.
5401
5433
5402 2002-06-16 Fernando Perez <fperez@colorado.edu>
5434 2002-06-16 Fernando Perez <fperez@colorado.edu>
5403
5435
5404 * IPython/GnuplotRuntime.py: Massive overhaul to the Gnuplot
5436 * IPython/GnuplotRuntime.py: Massive overhaul to the Gnuplot
5405 system. GnuplotMagic is gone as a user-directory option. New files
5437 system. GnuplotMagic is gone as a user-directory option. New files
5406 make it easier to use all the gnuplot stuff both from external
5438 make it easier to use all the gnuplot stuff both from external
5407 programs as well as from IPython. Had to rewrite part of
5439 programs as well as from IPython. Had to rewrite part of
5408 hardcopy() b/c of a strange bug: often the ps files simply don't
5440 hardcopy() b/c of a strange bug: often the ps files simply don't
5409 get created, and require a repeat of the command (often several
5441 get created, and require a repeat of the command (often several
5410 times).
5442 times).
5411
5443
5412 * IPython/ultraTB.py (AutoFormattedTB.__call__): changed to
5444 * IPython/ultraTB.py (AutoFormattedTB.__call__): changed to
5413 resolve output channel at call time, so that if sys.stderr has
5445 resolve output channel at call time, so that if sys.stderr has
5414 been redirected by user this gets honored.
5446 been redirected by user this gets honored.
5415
5447
5416 2002-06-13 Fernando Perez <fperez@colorado.edu>
5448 2002-06-13 Fernando Perez <fperez@colorado.edu>
5417
5449
5418 * IPython/Shell.py (IPShell.__init__): Changed IPythonShell to
5450 * IPython/Shell.py (IPShell.__init__): Changed IPythonShell to
5419 IPShell. Kept a copy with the old names to avoid breaking people's
5451 IPShell. Kept a copy with the old names to avoid breaking people's
5420 embedded code.
5452 embedded code.
5421
5453
5422 * IPython/ipython: simplified it to the bare minimum after
5454 * IPython/ipython: simplified it to the bare minimum after
5423 Holger's suggestions. Added info about how to use it in
5455 Holger's suggestions. Added info about how to use it in
5424 PYTHONSTARTUP.
5456 PYTHONSTARTUP.
5425
5457
5426 * IPython/Shell.py (IPythonShell): changed the options passing
5458 * IPython/Shell.py (IPythonShell): changed the options passing
5427 from a string with funky %s replacements to a straight list. Maybe
5459 from a string with funky %s replacements to a straight list. Maybe
5428 a bit more typing, but it follows sys.argv conventions, so there's
5460 a bit more typing, but it follows sys.argv conventions, so there's
5429 less special-casing to remember.
5461 less special-casing to remember.
5430
5462
5431 2002-06-12 Fernando Perez <fperez@colorado.edu>
5463 2002-06-12 Fernando Perez <fperez@colorado.edu>
5432
5464
5433 * IPython/Magic.py (Magic.magic_r): new magic auto-repeat
5465 * IPython/Magic.py (Magic.magic_r): new magic auto-repeat
5434 command. Thanks to a suggestion by Mike Heeter.
5466 command. Thanks to a suggestion by Mike Heeter.
5435 (Magic.magic_pfile): added behavior to look at filenames if given
5467 (Magic.magic_pfile): added behavior to look at filenames if given
5436 arg is not a defined object.
5468 arg is not a defined object.
5437 (Magic.magic_save): New @save function to save code snippets. Also
5469 (Magic.magic_save): New @save function to save code snippets. Also
5438 a Mike Heeter idea.
5470 a Mike Heeter idea.
5439
5471
5440 * IPython/UserConfig/GnuplotMagic.py (plot): Improvements to
5472 * IPython/UserConfig/GnuplotMagic.py (plot): Improvements to
5441 plot() and replot(). Much more convenient now, especially for
5473 plot() and replot(). Much more convenient now, especially for
5442 interactive use.
5474 interactive use.
5443
5475
5444 * IPython/Magic.py (Magic.magic_run): Added .py automatically to
5476 * IPython/Magic.py (Magic.magic_run): Added .py automatically to
5445 filenames.
5477 filenames.
5446
5478
5447 2002-06-02 Fernando Perez <fperez@colorado.edu>
5479 2002-06-02 Fernando Perez <fperez@colorado.edu>
5448
5480
5449 * IPython/Struct.py (Struct.__init__): modified to admit
5481 * IPython/Struct.py (Struct.__init__): modified to admit
5450 initialization via another struct.
5482 initialization via another struct.
5451
5483
5452 * IPython/genutils.py (SystemExec.__init__): New stateful
5484 * IPython/genutils.py (SystemExec.__init__): New stateful
5453 interface to xsys and bq. Useful for writing system scripts.
5485 interface to xsys and bq. Useful for writing system scripts.
5454
5486
5455 2002-05-30 Fernando Perez <fperez@colorado.edu>
5487 2002-05-30 Fernando Perez <fperez@colorado.edu>
5456
5488
5457 * MANIFEST.in: Changed docfile selection to exclude all the lyx
5489 * MANIFEST.in: Changed docfile selection to exclude all the lyx
5458 documents. This will make the user download smaller (it's getting
5490 documents. This will make the user download smaller (it's getting
5459 too big).
5491 too big).
5460
5492
5461 2002-05-29 Fernando Perez <fperez@colorado.edu>
5493 2002-05-29 Fernando Perez <fperez@colorado.edu>
5462
5494
5463 * IPython/iplib.py (_FakeModule.__init__): New class introduced to
5495 * IPython/iplib.py (_FakeModule.__init__): New class introduced to
5464 fix problems with shelve and pickle. Seems to work, but I don't
5496 fix problems with shelve and pickle. Seems to work, but I don't
5465 know if corner cases break it. Thanks to Mike Heeter
5497 know if corner cases break it. Thanks to Mike Heeter
5466 <korora-AT-SDF.LONESTAR.ORG> for the bug reports and test cases.
5498 <korora-AT-SDF.LONESTAR.ORG> for the bug reports and test cases.
5467
5499
5468 2002-05-24 Fernando Perez <fperez@colorado.edu>
5500 2002-05-24 Fernando Perez <fperez@colorado.edu>
5469
5501
5470 * IPython/Magic.py (Macro.__init__): fixed magics embedded in
5502 * IPython/Magic.py (Macro.__init__): fixed magics embedded in
5471 macros having broken.
5503 macros having broken.
5472
5504
5473 2002-05-21 Fernando Perez <fperez@colorado.edu>
5505 2002-05-21 Fernando Perez <fperez@colorado.edu>
5474
5506
5475 * IPython/Magic.py (Magic.magic_logstart): fixed recently
5507 * IPython/Magic.py (Magic.magic_logstart): fixed recently
5476 introduced logging bug: all history before logging started was
5508 introduced logging bug: all history before logging started was
5477 being written one character per line! This came from the redesign
5509 being written one character per line! This came from the redesign
5478 of the input history as a special list which slices to strings,
5510 of the input history as a special list which slices to strings,
5479 not to lists.
5511 not to lists.
5480
5512
5481 2002-05-20 Fernando Perez <fperez@colorado.edu>
5513 2002-05-20 Fernando Perez <fperez@colorado.edu>
5482
5514
5483 * IPython/Prompts.py (CachedOutput.__init__): made the color table
5515 * IPython/Prompts.py (CachedOutput.__init__): made the color table
5484 be an attribute of all classes in this module. The design of these
5516 be an attribute of all classes in this module. The design of these
5485 classes needs some serious overhauling.
5517 classes needs some serious overhauling.
5486
5518
5487 * IPython/DPyGetOpt.py (DPyGetOpt.setPosixCompliance): fixed bug
5519 * IPython/DPyGetOpt.py (DPyGetOpt.setPosixCompliance): fixed bug
5488 which was ignoring '_' in option names.
5520 which was ignoring '_' in option names.
5489
5521
5490 * IPython/ultraTB.py (FormattedTB.__init__): Changed
5522 * IPython/ultraTB.py (FormattedTB.__init__): Changed
5491 'Verbose_novars' to 'Context' and made it the new default. It's a
5523 'Verbose_novars' to 'Context' and made it the new default. It's a
5492 bit more readable and also safer than verbose.
5524 bit more readable and also safer than verbose.
5493
5525
5494 * IPython/PyColorize.py (Parser.__call__): Fixed coloring of
5526 * IPython/PyColorize.py (Parser.__call__): Fixed coloring of
5495 triple-quoted strings.
5527 triple-quoted strings.
5496
5528
5497 * IPython/OInspect.py (__all__): new module exposing the object
5529 * IPython/OInspect.py (__all__): new module exposing the object
5498 introspection facilities. Now the corresponding magics are dummy
5530 introspection facilities. Now the corresponding magics are dummy
5499 wrappers around this. Having this module will make it much easier
5531 wrappers around this. Having this module will make it much easier
5500 to put these functions into our modified pdb.
5532 to put these functions into our modified pdb.
5501 This new object inspector system uses the new colorizing module,
5533 This new object inspector system uses the new colorizing module,
5502 so source code and other things are nicely syntax highlighted.
5534 so source code and other things are nicely syntax highlighted.
5503
5535
5504 2002-05-18 Fernando Perez <fperez@colorado.edu>
5536 2002-05-18 Fernando Perez <fperez@colorado.edu>
5505
5537
5506 * IPython/ColorANSI.py: Split the coloring tools into a separate
5538 * IPython/ColorANSI.py: Split the coloring tools into a separate
5507 module so I can use them in other code easier (they were part of
5539 module so I can use them in other code easier (they were part of
5508 ultraTB).
5540 ultraTB).
5509
5541
5510 2002-05-17 Fernando Perez <fperez@colorado.edu>
5542 2002-05-17 Fernando Perez <fperez@colorado.edu>
5511
5543
5512 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
5544 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
5513 fixed it to set the global 'g' also to the called instance, as
5545 fixed it to set the global 'g' also to the called instance, as
5514 long as 'g' was still a gnuplot instance (so it doesn't overwrite
5546 long as 'g' was still a gnuplot instance (so it doesn't overwrite
5515 user's 'g' variables).
5547 user's 'g' variables).
5516
5548
5517 * IPython/iplib.py (InteractiveShell.__init__): Added In/Out
5549 * IPython/iplib.py (InteractiveShell.__init__): Added In/Out
5518 global variables (aliases to _ih,_oh) so that users which expect
5550 global variables (aliases to _ih,_oh) so that users which expect
5519 In[5] or Out[7] to work aren't unpleasantly surprised.
5551 In[5] or Out[7] to work aren't unpleasantly surprised.
5520 (InputList.__getslice__): new class to allow executing slices of
5552 (InputList.__getslice__): new class to allow executing slices of
5521 input history directly. Very simple class, complements the use of
5553 input history directly. Very simple class, complements the use of
5522 macros.
5554 macros.
5523
5555
5524 2002-05-16 Fernando Perez <fperez@colorado.edu>
5556 2002-05-16 Fernando Perez <fperez@colorado.edu>
5525
5557
5526 * setup.py (docdirbase): make doc directory be just doc/IPython
5558 * setup.py (docdirbase): make doc directory be just doc/IPython
5527 without version numbers, it will reduce clutter for users.
5559 without version numbers, it will reduce clutter for users.
5528
5560
5529 * IPython/Magic.py (Magic.magic_run): Add explicit local dict to
5561 * IPython/Magic.py (Magic.magic_run): Add explicit local dict to
5530 execfile call to prevent possible memory leak. See for details:
5562 execfile call to prevent possible memory leak. See for details:
5531 http://mail.python.org/pipermail/python-list/2002-February/088476.html
5563 http://mail.python.org/pipermail/python-list/2002-February/088476.html
5532
5564
5533 2002-05-15 Fernando Perez <fperez@colorado.edu>
5565 2002-05-15 Fernando Perez <fperez@colorado.edu>
5534
5566
5535 * IPython/Magic.py (Magic.magic_psource): made the object
5567 * IPython/Magic.py (Magic.magic_psource): made the object
5536 introspection names be more standard: pdoc, pdef, pfile and
5568 introspection names be more standard: pdoc, pdef, pfile and
5537 psource. They all print/page their output, and it makes
5569 psource. They all print/page their output, and it makes
5538 remembering them easier. Kept old names for compatibility as
5570 remembering them easier. Kept old names for compatibility as
5539 aliases.
5571 aliases.
5540
5572
5541 2002-05-14 Fernando Perez <fperez@colorado.edu>
5573 2002-05-14 Fernando Perez <fperez@colorado.edu>
5542
5574
5543 * IPython/UserConfig/GnuplotMagic.py: I think I finally understood
5575 * IPython/UserConfig/GnuplotMagic.py: I think I finally understood
5544 what the mouse problem was. The trick is to use gnuplot with temp
5576 what the mouse problem was. The trick is to use gnuplot with temp
5545 files and NOT with pipes (for data communication), because having
5577 files and NOT with pipes (for data communication), because having
5546 both pipes and the mouse on is bad news.
5578 both pipes and the mouse on is bad news.
5547
5579
5548 2002-05-13 Fernando Perez <fperez@colorado.edu>
5580 2002-05-13 Fernando Perez <fperez@colorado.edu>
5549
5581
5550 * IPython/Magic.py (Magic._ofind): fixed namespace order search
5582 * IPython/Magic.py (Magic._ofind): fixed namespace order search
5551 bug. Information would be reported about builtins even when
5583 bug. Information would be reported about builtins even when
5552 user-defined functions overrode them.
5584 user-defined functions overrode them.
5553
5585
5554 2002-05-11 Fernando Perez <fperez@colorado.edu>
5586 2002-05-11 Fernando Perez <fperez@colorado.edu>
5555
5587
5556 * IPython/__init__.py (__all__): removed FlexCompleter from
5588 * IPython/__init__.py (__all__): removed FlexCompleter from
5557 __all__ so that things don't fail in platforms without readline.
5589 __all__ so that things don't fail in platforms without readline.
5558
5590
5559 2002-05-10 Fernando Perez <fperez@colorado.edu>
5591 2002-05-10 Fernando Perez <fperez@colorado.edu>
5560
5592
5561 * IPython/__init__.py (__all__): removed numutils from __all__ b/c
5593 * IPython/__init__.py (__all__): removed numutils from __all__ b/c
5562 it requires Numeric, effectively making Numeric a dependency for
5594 it requires Numeric, effectively making Numeric a dependency for
5563 IPython.
5595 IPython.
5564
5596
5565 * Released 0.2.13
5597 * Released 0.2.13
5566
5598
5567 * IPython/Magic.py (Magic.magic_prun): big overhaul to the
5599 * IPython/Magic.py (Magic.magic_prun): big overhaul to the
5568 profiler interface. Now all the major options from the profiler
5600 profiler interface. Now all the major options from the profiler
5569 module are directly supported in IPython, both for single
5601 module are directly supported in IPython, both for single
5570 expressions (@prun) and for full programs (@run -p).
5602 expressions (@prun) and for full programs (@run -p).
5571
5603
5572 2002-05-09 Fernando Perez <fperez@colorado.edu>
5604 2002-05-09 Fernando Perez <fperez@colorado.edu>
5573
5605
5574 * IPython/Magic.py (Magic.magic_doc): fixed to show docstrings of
5606 * IPython/Magic.py (Magic.magic_doc): fixed to show docstrings of
5575 magic properly formatted for screen.
5607 magic properly formatted for screen.
5576
5608
5577 * setup.py (make_shortcut): Changed things to put pdf version in
5609 * setup.py (make_shortcut): Changed things to put pdf version in
5578 doc/ instead of doc/manual (had to change lyxport a bit).
5610 doc/ instead of doc/manual (had to change lyxport a bit).
5579
5611
5580 * IPython/Magic.py (Profile.string_stats): made profile runs go
5612 * IPython/Magic.py (Profile.string_stats): made profile runs go
5581 through pager (they are long and a pager allows searching, saving,
5613 through pager (they are long and a pager allows searching, saving,
5582 etc.)
5614 etc.)
5583
5615
5584 2002-05-08 Fernando Perez <fperez@colorado.edu>
5616 2002-05-08 Fernando Perez <fperez@colorado.edu>
5585
5617
5586 * Released 0.2.12
5618 * Released 0.2.12
5587
5619
5588 2002-05-06 Fernando Perez <fperez@colorado.edu>
5620 2002-05-06 Fernando Perez <fperez@colorado.edu>
5589
5621
5590 * IPython/Magic.py (Magic.magic_hist): small bug fixed (recently
5622 * IPython/Magic.py (Magic.magic_hist): small bug fixed (recently
5591 introduced); 'hist n1 n2' was broken.
5623 introduced); 'hist n1 n2' was broken.
5592 (Magic.magic_pdb): added optional on/off arguments to @pdb
5624 (Magic.magic_pdb): added optional on/off arguments to @pdb
5593 (Magic.magic_run): added option -i to @run, which executes code in
5625 (Magic.magic_run): added option -i to @run, which executes code in
5594 the IPython namespace instead of a clean one. Also added @irun as
5626 the IPython namespace instead of a clean one. Also added @irun as
5595 an alias to @run -i.
5627 an alias to @run -i.
5596
5628
5597 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
5629 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
5598 fixed (it didn't really do anything, the namespaces were wrong).
5630 fixed (it didn't really do anything, the namespaces were wrong).
5599
5631
5600 * IPython/Debugger.py (__init__): Added workaround for python 2.1
5632 * IPython/Debugger.py (__init__): Added workaround for python 2.1
5601
5633
5602 * IPython/__init__.py (__all__): Fixed package namespace, now
5634 * IPython/__init__.py (__all__): Fixed package namespace, now
5603 'import IPython' does give access to IPython.<all> as
5635 'import IPython' does give access to IPython.<all> as
5604 expected. Also renamed __release__ to Release.
5636 expected. Also renamed __release__ to Release.
5605
5637
5606 * IPython/Debugger.py (__license__): created new Pdb class which
5638 * IPython/Debugger.py (__license__): created new Pdb class which
5607 functions like a drop-in for the normal pdb.Pdb but does NOT
5639 functions like a drop-in for the normal pdb.Pdb but does NOT
5608 import readline by default. This way it doesn't muck up IPython's
5640 import readline by default. This way it doesn't muck up IPython's
5609 readline handling, and now tab-completion finally works in the
5641 readline handling, and now tab-completion finally works in the
5610 debugger -- sort of. It completes things globally visible, but the
5642 debugger -- sort of. It completes things globally visible, but the
5611 completer doesn't track the stack as pdb walks it. That's a bit
5643 completer doesn't track the stack as pdb walks it. That's a bit
5612 tricky, and I'll have to implement it later.
5644 tricky, and I'll have to implement it later.
5613
5645
5614 2002-05-05 Fernando Perez <fperez@colorado.edu>
5646 2002-05-05 Fernando Perez <fperez@colorado.edu>
5615
5647
5616 * IPython/Magic.py (Magic.magic_oinfo): fixed formatting bug for
5648 * IPython/Magic.py (Magic.magic_oinfo): fixed formatting bug for
5617 magic docstrings when printed via ? (explicit \'s were being
5649 magic docstrings when printed via ? (explicit \'s were being
5618 printed).
5650 printed).
5619
5651
5620 * IPython/ipmaker.py (make_IPython): fixed namespace
5652 * IPython/ipmaker.py (make_IPython): fixed namespace
5621 identification bug. Now variables loaded via logs or command-line
5653 identification bug. Now variables loaded via logs or command-line
5622 files are recognized in the interactive namespace by @who.
5654 files are recognized in the interactive namespace by @who.
5623
5655
5624 * IPython/iplib.py (InteractiveShell.safe_execfile): Fixed bug in
5656 * IPython/iplib.py (InteractiveShell.safe_execfile): Fixed bug in
5625 log replay system stemming from the string form of Structs.
5657 log replay system stemming from the string form of Structs.
5626
5658
5627 * IPython/Magic.py (Macro.__init__): improved macros to properly
5659 * IPython/Magic.py (Macro.__init__): improved macros to properly
5628 handle magic commands in them.
5660 handle magic commands in them.
5629 (Magic.magic_logstart): usernames are now expanded so 'logstart
5661 (Magic.magic_logstart): usernames are now expanded so 'logstart
5630 ~/mylog' now works.
5662 ~/mylog' now works.
5631
5663
5632 * IPython/iplib.py (complete): fixed bug where paths starting with
5664 * IPython/iplib.py (complete): fixed bug where paths starting with
5633 '/' would be completed as magic names.
5665 '/' would be completed as magic names.
5634
5666
5635 2002-05-04 Fernando Perez <fperez@colorado.edu>
5667 2002-05-04 Fernando Perez <fperez@colorado.edu>
5636
5668
5637 * IPython/Magic.py (Magic.magic_run): added options -p and -f to
5669 * IPython/Magic.py (Magic.magic_run): added options -p and -f to
5638 allow running full programs under the profiler's control.
5670 allow running full programs under the profiler's control.
5639
5671
5640 * IPython/ultraTB.py (FormattedTB.__init__): Added Verbose_novars
5672 * IPython/ultraTB.py (FormattedTB.__init__): Added Verbose_novars
5641 mode to report exceptions verbosely but without formatting
5673 mode to report exceptions verbosely but without formatting
5642 variables. This addresses the issue of ipython 'freezing' (it's
5674 variables. This addresses the issue of ipython 'freezing' (it's
5643 not frozen, but caught in an expensive formatting loop) when huge
5675 not frozen, but caught in an expensive formatting loop) when huge
5644 variables are in the context of an exception.
5676 variables are in the context of an exception.
5645 (VerboseTB.text): Added '--->' markers at line where exception was
5677 (VerboseTB.text): Added '--->' markers at line where exception was
5646 triggered. Much clearer to read, especially in NoColor modes.
5678 triggered. Much clearer to read, especially in NoColor modes.
5647
5679
5648 * IPython/Magic.py (Magic.magic_run): bugfix: -n option had been
5680 * IPython/Magic.py (Magic.magic_run): bugfix: -n option had been
5649 implemented in reverse when changing to the new parse_options().
5681 implemented in reverse when changing to the new parse_options().
5650
5682
5651 2002-05-03 Fernando Perez <fperez@colorado.edu>
5683 2002-05-03 Fernando Perez <fperez@colorado.edu>
5652
5684
5653 * IPython/Magic.py (Magic.parse_options): new function so that
5685 * IPython/Magic.py (Magic.parse_options): new function so that
5654 magics can parse options easier.
5686 magics can parse options easier.
5655 (Magic.magic_prun): new function similar to profile.run(),
5687 (Magic.magic_prun): new function similar to profile.run(),
5656 suggested by Chris Hart.
5688 suggested by Chris Hart.
5657 (Magic.magic_cd): fixed behavior so that it only changes if
5689 (Magic.magic_cd): fixed behavior so that it only changes if
5658 directory actually is in history.
5690 directory actually is in history.
5659
5691
5660 * IPython/usage.py (__doc__): added information about potential
5692 * IPython/usage.py (__doc__): added information about potential
5661 slowness of Verbose exception mode when there are huge data
5693 slowness of Verbose exception mode when there are huge data
5662 structures to be formatted (thanks to Archie Paulson).
5694 structures to be formatted (thanks to Archie Paulson).
5663
5695
5664 * IPython/ipmaker.py (make_IPython): Changed default logging
5696 * IPython/ipmaker.py (make_IPython): Changed default logging
5665 (when simply called with -log) to use curr_dir/ipython.log in
5697 (when simply called with -log) to use curr_dir/ipython.log in
5666 rotate mode. Fixed crash which was occuring with -log before
5698 rotate mode. Fixed crash which was occuring with -log before
5667 (thanks to Jim Boyle).
5699 (thanks to Jim Boyle).
5668
5700
5669 2002-05-01 Fernando Perez <fperez@colorado.edu>
5701 2002-05-01 Fernando Perez <fperez@colorado.edu>
5670
5702
5671 * Released 0.2.11 for these fixes (mainly the ultraTB one which
5703 * Released 0.2.11 for these fixes (mainly the ultraTB one which
5672 was nasty -- though somewhat of a corner case).
5704 was nasty -- though somewhat of a corner case).
5673
5705
5674 * IPython/ultraTB.py (AutoFormattedTB.text): renamed __text to
5706 * IPython/ultraTB.py (AutoFormattedTB.text): renamed __text to
5675 text (was a bug).
5707 text (was a bug).
5676
5708
5677 2002-04-30 Fernando Perez <fperez@colorado.edu>
5709 2002-04-30 Fernando Perez <fperez@colorado.edu>
5678
5710
5679 * IPython/UserConfig/GnuplotMagic.py (magic_gp): Minor fix to add
5711 * IPython/UserConfig/GnuplotMagic.py (magic_gp): Minor fix to add
5680 a print after ^D or ^C from the user so that the In[] prompt
5712 a print after ^D or ^C from the user so that the In[] prompt
5681 doesn't over-run the gnuplot one.
5713 doesn't over-run the gnuplot one.
5682
5714
5683 2002-04-29 Fernando Perez <fperez@colorado.edu>
5715 2002-04-29 Fernando Perez <fperez@colorado.edu>
5684
5716
5685 * Released 0.2.10
5717 * Released 0.2.10
5686
5718
5687 * IPython/__release__.py (version): get date dynamically.
5719 * IPython/__release__.py (version): get date dynamically.
5688
5720
5689 * Misc. documentation updates thanks to Arnd's comments. Also ran
5721 * Misc. documentation updates thanks to Arnd's comments. Also ran
5690 a full spellcheck on the manual (hadn't been done in a while).
5722 a full spellcheck on the manual (hadn't been done in a while).
5691
5723
5692 2002-04-27 Fernando Perez <fperez@colorado.edu>
5724 2002-04-27 Fernando Perez <fperez@colorado.edu>
5693
5725
5694 * IPython/Magic.py (Magic.magic_logstart): Fixed bug where
5726 * IPython/Magic.py (Magic.magic_logstart): Fixed bug where
5695 starting a log in mid-session would reset the input history list.
5727 starting a log in mid-session would reset the input history list.
5696
5728
5697 2002-04-26 Fernando Perez <fperez@colorado.edu>
5729 2002-04-26 Fernando Perez <fperez@colorado.edu>
5698
5730
5699 * IPython/iplib.py (InteractiveShell.wait): Fixed bug where not
5731 * IPython/iplib.py (InteractiveShell.wait): Fixed bug where not
5700 all files were being included in an update. Now anything in
5732 all files were being included in an update. Now anything in
5701 UserConfig that matches [A-Za-z]*.py will go (this excludes
5733 UserConfig that matches [A-Za-z]*.py will go (this excludes
5702 __init__.py)
5734 __init__.py)
5703
5735
5704 2002-04-25 Fernando Perez <fperez@colorado.edu>
5736 2002-04-25 Fernando Perez <fperez@colorado.edu>
5705
5737
5706 * IPython/iplib.py (InteractiveShell.__init__): Added __IPYTHON__
5738 * IPython/iplib.py (InteractiveShell.__init__): Added __IPYTHON__
5707 to __builtins__ so that any form of embedded or imported code can
5739 to __builtins__ so that any form of embedded or imported code can
5708 test for being inside IPython.
5740 test for being inside IPython.
5709
5741
5710 * IPython/UserConfig/GnuplotMagic.py: (magic_gp_set_instance):
5742 * IPython/UserConfig/GnuplotMagic.py: (magic_gp_set_instance):
5711 changed to GnuplotMagic because it's now an importable module,
5743 changed to GnuplotMagic because it's now an importable module,
5712 this makes the name follow that of the standard Gnuplot module.
5744 this makes the name follow that of the standard Gnuplot module.
5713 GnuplotMagic can now be loaded at any time in mid-session.
5745 GnuplotMagic can now be loaded at any time in mid-session.
5714
5746
5715 2002-04-24 Fernando Perez <fperez@colorado.edu>
5747 2002-04-24 Fernando Perez <fperez@colorado.edu>
5716
5748
5717 * IPython/numutils.py: removed SIUnits. It doesn't properly set
5749 * IPython/numutils.py: removed SIUnits. It doesn't properly set
5718 the globals (IPython has its own namespace) and the
5750 the globals (IPython has its own namespace) and the
5719 PhysicalQuantity stuff is much better anyway.
5751 PhysicalQuantity stuff is much better anyway.
5720
5752
5721 * IPython/UserConfig/example-gnuplot.py (g2): Added gnuplot
5753 * IPython/UserConfig/example-gnuplot.py (g2): Added gnuplot
5722 embedding example to standard user directory for
5754 embedding example to standard user directory for
5723 distribution. Also put it in the manual.
5755 distribution. Also put it in the manual.
5724
5756
5725 * IPython/numutils.py (gnuplot_exec): Changed to take a gnuplot
5757 * IPython/numutils.py (gnuplot_exec): Changed to take a gnuplot
5726 instance as first argument (so it doesn't rely on some obscure
5758 instance as first argument (so it doesn't rely on some obscure
5727 hidden global).
5759 hidden global).
5728
5760
5729 * IPython/UserConfig/ipythonrc.py: put () back in accepted
5761 * IPython/UserConfig/ipythonrc.py: put () back in accepted
5730 delimiters. While it prevents ().TAB from working, it allows
5762 delimiters. While it prevents ().TAB from working, it allows
5731 completions in open (... expressions. This is by far a more common
5763 completions in open (... expressions. This is by far a more common
5732 case.
5764 case.
5733
5765
5734 2002-04-23 Fernando Perez <fperez@colorado.edu>
5766 2002-04-23 Fernando Perez <fperez@colorado.edu>
5735
5767
5736 * IPython/Extensions/InterpreterPasteInput.py: new
5768 * IPython/Extensions/InterpreterPasteInput.py: new
5737 syntax-processing module for pasting lines with >>> or ... at the
5769 syntax-processing module for pasting lines with >>> or ... at the
5738 start.
5770 start.
5739
5771
5740 * IPython/Extensions/PhysicalQ_Interactive.py
5772 * IPython/Extensions/PhysicalQ_Interactive.py
5741 (PhysicalQuantityInteractive.__int__): fixed to work with either
5773 (PhysicalQuantityInteractive.__int__): fixed to work with either
5742 Numeric or math.
5774 Numeric or math.
5743
5775
5744 * IPython/UserConfig/ipythonrc-numeric.py: reorganized the
5776 * IPython/UserConfig/ipythonrc-numeric.py: reorganized the
5745 provided profiles. Now we have:
5777 provided profiles. Now we have:
5746 -math -> math module as * and cmath with its own namespace.
5778 -math -> math module as * and cmath with its own namespace.
5747 -numeric -> Numeric as *, plus gnuplot & grace
5779 -numeric -> Numeric as *, plus gnuplot & grace
5748 -physics -> same as before
5780 -physics -> same as before
5749
5781
5750 * IPython/Magic.py (Magic.magic_magic): Fixed bug where
5782 * IPython/Magic.py (Magic.magic_magic): Fixed bug where
5751 user-defined magics wouldn't be found by @magic if they were
5783 user-defined magics wouldn't be found by @magic if they were
5752 defined as class methods. Also cleaned up the namespace search
5784 defined as class methods. Also cleaned up the namespace search
5753 logic and the string building (to use %s instead of many repeated
5785 logic and the string building (to use %s instead of many repeated
5754 string adds).
5786 string adds).
5755
5787
5756 * IPython/UserConfig/example-magic.py (magic_foo): updated example
5788 * IPython/UserConfig/example-magic.py (magic_foo): updated example
5757 of user-defined magics to operate with class methods (cleaner, in
5789 of user-defined magics to operate with class methods (cleaner, in
5758 line with the gnuplot code).
5790 line with the gnuplot code).
5759
5791
5760 2002-04-22 Fernando Perez <fperez@colorado.edu>
5792 2002-04-22 Fernando Perez <fperez@colorado.edu>
5761
5793
5762 * setup.py: updated dependency list so that manual is updated when
5794 * setup.py: updated dependency list so that manual is updated when
5763 all included files change.
5795 all included files change.
5764
5796
5765 * IPython/ipmaker.py (make_IPython): Fixed bug which was ignoring
5797 * IPython/ipmaker.py (make_IPython): Fixed bug which was ignoring
5766 the delimiter removal option (the fix is ugly right now).
5798 the delimiter removal option (the fix is ugly right now).
5767
5799
5768 * IPython/UserConfig/ipythonrc-physics.py: simplified not to load
5800 * IPython/UserConfig/ipythonrc-physics.py: simplified not to load
5769 all of the math profile (quicker loading, no conflict between
5801 all of the math profile (quicker loading, no conflict between
5770 g-9.8 and g-gnuplot).
5802 g-9.8 and g-gnuplot).
5771
5803
5772 * IPython/CrashHandler.py (CrashHandler.__call__): changed default
5804 * IPython/CrashHandler.py (CrashHandler.__call__): changed default
5773 name of post-mortem files to IPython_crash_report.txt.
5805 name of post-mortem files to IPython_crash_report.txt.
5774
5806
5775 * Cleanup/update of the docs. Added all the new readline info and
5807 * Cleanup/update of the docs. Added all the new readline info and
5776 formatted all lists as 'real lists'.
5808 formatted all lists as 'real lists'.
5777
5809
5778 * IPython/ipmaker.py (make_IPython): removed now-obsolete
5810 * IPython/ipmaker.py (make_IPython): removed now-obsolete
5779 tab-completion options, since the full readline parse_and_bind is
5811 tab-completion options, since the full readline parse_and_bind is
5780 now accessible.
5812 now accessible.
5781
5813
5782 * IPython/iplib.py (InteractiveShell.init_readline): Changed
5814 * IPython/iplib.py (InteractiveShell.init_readline): Changed
5783 handling of readline options. Now users can specify any string to
5815 handling of readline options. Now users can specify any string to
5784 be passed to parse_and_bind(), as well as the delimiters to be
5816 be passed to parse_and_bind(), as well as the delimiters to be
5785 removed.
5817 removed.
5786 (InteractiveShell.__init__): Added __name__ to the global
5818 (InteractiveShell.__init__): Added __name__ to the global
5787 namespace so that things like Itpl which rely on its existence
5819 namespace so that things like Itpl which rely on its existence
5788 don't crash.
5820 don't crash.
5789 (InteractiveShell._prefilter): Defined the default with a _ so
5821 (InteractiveShell._prefilter): Defined the default with a _ so
5790 that prefilter() is easier to override, while the default one
5822 that prefilter() is easier to override, while the default one
5791 remains available.
5823 remains available.
5792
5824
5793 2002-04-18 Fernando Perez <fperez@colorado.edu>
5825 2002-04-18 Fernando Perez <fperez@colorado.edu>
5794
5826
5795 * Added information about pdb in the docs.
5827 * Added information about pdb in the docs.
5796
5828
5797 2002-04-17 Fernando Perez <fperez@colorado.edu>
5829 2002-04-17 Fernando Perez <fperez@colorado.edu>
5798
5830
5799 * IPython/ipmaker.py (make_IPython): added rc_override option to
5831 * IPython/ipmaker.py (make_IPython): added rc_override option to
5800 allow passing config options at creation time which may override
5832 allow passing config options at creation time which may override
5801 anything set in the config files or command line. This is
5833 anything set in the config files or command line. This is
5802 particularly useful for configuring embedded instances.
5834 particularly useful for configuring embedded instances.
5803
5835
5804 2002-04-15 Fernando Perez <fperez@colorado.edu>
5836 2002-04-15 Fernando Perez <fperez@colorado.edu>
5805
5837
5806 * IPython/Logger.py (Logger.log): Fixed a nasty bug which could
5838 * IPython/Logger.py (Logger.log): Fixed a nasty bug which could
5807 crash embedded instances because of the input cache falling out of
5839 crash embedded instances because of the input cache falling out of
5808 sync with the output counter.
5840 sync with the output counter.
5809
5841
5810 * IPython/Shell.py (IPythonShellEmbed.__init__): added a debug
5842 * IPython/Shell.py (IPythonShellEmbed.__init__): added a debug
5811 mode which calls pdb after an uncaught exception in IPython itself.
5843 mode which calls pdb after an uncaught exception in IPython itself.
5812
5844
5813 2002-04-14 Fernando Perez <fperez@colorado.edu>
5845 2002-04-14 Fernando Perez <fperez@colorado.edu>
5814
5846
5815 * IPython/iplib.py (InteractiveShell.showtraceback): pdb mucks up
5847 * IPython/iplib.py (InteractiveShell.showtraceback): pdb mucks up
5816 readline, fix it back after each call.
5848 readline, fix it back after each call.
5817
5849
5818 * IPython/ultraTB.py (AutoFormattedTB.__text): made text a private
5850 * IPython/ultraTB.py (AutoFormattedTB.__text): made text a private
5819 method to force all access via __call__(), which guarantees that
5851 method to force all access via __call__(), which guarantees that
5820 traceback references are properly deleted.
5852 traceback references are properly deleted.
5821
5853
5822 * IPython/Prompts.py (CachedOutput._display): minor fixes to
5854 * IPython/Prompts.py (CachedOutput._display): minor fixes to
5823 improve printing when pprint is in use.
5855 improve printing when pprint is in use.
5824
5856
5825 2002-04-13 Fernando Perez <fperez@colorado.edu>
5857 2002-04-13 Fernando Perez <fperez@colorado.edu>
5826
5858
5827 * IPython/Shell.py (IPythonShellEmbed.__call__): SystemExit
5859 * IPython/Shell.py (IPythonShellEmbed.__call__): SystemExit
5828 exceptions aren't caught anymore. If the user triggers one, he
5860 exceptions aren't caught anymore. If the user triggers one, he
5829 should know why he's doing it and it should go all the way up,
5861 should know why he's doing it and it should go all the way up,
5830 just like any other exception. So now @abort will fully kill the
5862 just like any other exception. So now @abort will fully kill the
5831 embedded interpreter and the embedding code (unless that happens
5863 embedded interpreter and the embedding code (unless that happens
5832 to catch SystemExit).
5864 to catch SystemExit).
5833
5865
5834 * IPython/ultraTB.py (VerboseTB.__init__): added a call_pdb flag
5866 * IPython/ultraTB.py (VerboseTB.__init__): added a call_pdb flag
5835 and a debugger() method to invoke the interactive pdb debugger
5867 and a debugger() method to invoke the interactive pdb debugger
5836 after printing exception information. Also added the corresponding
5868 after printing exception information. Also added the corresponding
5837 -pdb option and @pdb magic to control this feature, and updated
5869 -pdb option and @pdb magic to control this feature, and updated
5838 the docs. After a suggestion from Christopher Hart
5870 the docs. After a suggestion from Christopher Hart
5839 (hart-AT-caltech.edu).
5871 (hart-AT-caltech.edu).
5840
5872
5841 2002-04-12 Fernando Perez <fperez@colorado.edu>
5873 2002-04-12 Fernando Perez <fperez@colorado.edu>
5842
5874
5843 * IPython/Shell.py (IPythonShellEmbed.__init__): modified to use
5875 * IPython/Shell.py (IPythonShellEmbed.__init__): modified to use
5844 the exception handlers defined by the user (not the CrashHandler)
5876 the exception handlers defined by the user (not the CrashHandler)
5845 so that user exceptions don't trigger an ipython bug report.
5877 so that user exceptions don't trigger an ipython bug report.
5846
5878
5847 * IPython/ultraTB.py (ColorTB.__init__): made the color scheme
5879 * IPython/ultraTB.py (ColorTB.__init__): made the color scheme
5848 configurable (it should have always been so).
5880 configurable (it should have always been so).
5849
5881
5850 2002-03-26 Fernando Perez <fperez@colorado.edu>
5882 2002-03-26 Fernando Perez <fperez@colorado.edu>
5851
5883
5852 * IPython/Shell.py (IPythonShellEmbed.__call__): many changes here
5884 * IPython/Shell.py (IPythonShellEmbed.__call__): many changes here
5853 and there to fix embedding namespace issues. This should all be
5885 and there to fix embedding namespace issues. This should all be
5854 done in a more elegant way.
5886 done in a more elegant way.
5855
5887
5856 2002-03-25 Fernando Perez <fperez@colorado.edu>
5888 2002-03-25 Fernando Perez <fperez@colorado.edu>
5857
5889
5858 * IPython/genutils.py (get_home_dir): Try to make it work under
5890 * IPython/genutils.py (get_home_dir): Try to make it work under
5859 win9x also.
5891 win9x also.
5860
5892
5861 2002-03-20 Fernando Perez <fperez@colorado.edu>
5893 2002-03-20 Fernando Perez <fperez@colorado.edu>
5862
5894
5863 * IPython/Shell.py (IPythonShellEmbed.__init__): leave
5895 * IPython/Shell.py (IPythonShellEmbed.__init__): leave
5864 sys.displayhook untouched upon __init__.
5896 sys.displayhook untouched upon __init__.
5865
5897
5866 2002-03-19 Fernando Perez <fperez@colorado.edu>
5898 2002-03-19 Fernando Perez <fperez@colorado.edu>
5867
5899
5868 * Released 0.2.9 (for embedding bug, basically).
5900 * Released 0.2.9 (for embedding bug, basically).
5869
5901
5870 * IPython/Shell.py (IPythonShellEmbed.__call__): Trap SystemExit
5902 * IPython/Shell.py (IPythonShellEmbed.__call__): Trap SystemExit
5871 exceptions so that enclosing shell's state can be restored.
5903 exceptions so that enclosing shell's state can be restored.
5872
5904
5873 * Changed magic_gnuplot.py to magic-gnuplot.py to standardize
5905 * Changed magic_gnuplot.py to magic-gnuplot.py to standardize
5874 naming conventions in the .ipython/ dir.
5906 naming conventions in the .ipython/ dir.
5875
5907
5876 * IPython/iplib.py (InteractiveShell.init_readline): removed '-'
5908 * IPython/iplib.py (InteractiveShell.init_readline): removed '-'
5877 from delimiters list so filenames with - in them get expanded.
5909 from delimiters list so filenames with - in them get expanded.
5878
5910
5879 * IPython/Shell.py (IPythonShellEmbed.__call__): fixed bug with
5911 * IPython/Shell.py (IPythonShellEmbed.__call__): fixed bug with
5880 sys.displayhook not being properly restored after an embedded call.
5912 sys.displayhook not being properly restored after an embedded call.
5881
5913
5882 2002-03-18 Fernando Perez <fperez@colorado.edu>
5914 2002-03-18 Fernando Perez <fperez@colorado.edu>
5883
5915
5884 * Released 0.2.8
5916 * Released 0.2.8
5885
5917
5886 * IPython/iplib.py (InteractiveShell.user_setup): fixed bug where
5918 * IPython/iplib.py (InteractiveShell.user_setup): fixed bug where
5887 some files weren't being included in a -upgrade.
5919 some files weren't being included in a -upgrade.
5888 (InteractiveShell.init_readline): Added 'set show-all-if-ambiguous
5920 (InteractiveShell.init_readline): Added 'set show-all-if-ambiguous
5889 on' so that the first tab completes.
5921 on' so that the first tab completes.
5890 (InteractiveShell.handle_magic): fixed bug with spaces around
5922 (InteractiveShell.handle_magic): fixed bug with spaces around
5891 quotes breaking many magic commands.
5923 quotes breaking many magic commands.
5892
5924
5893 * setup.py: added note about ignoring the syntax error messages at
5925 * setup.py: added note about ignoring the syntax error messages at
5894 installation.
5926 installation.
5895
5927
5896 * IPython/UserConfig/magic_gnuplot.py (magic_gp): finished
5928 * IPython/UserConfig/magic_gnuplot.py (magic_gp): finished
5897 streamlining the gnuplot interface, now there's only one magic @gp.
5929 streamlining the gnuplot interface, now there's only one magic @gp.
5898
5930
5899 2002-03-17 Fernando Perez <fperez@colorado.edu>
5931 2002-03-17 Fernando Perez <fperez@colorado.edu>
5900
5932
5901 * IPython/UserConfig/magic_gnuplot.py: new name for the
5933 * IPython/UserConfig/magic_gnuplot.py: new name for the
5902 example-magic_pm.py file. Much enhanced system, now with a shell
5934 example-magic_pm.py file. Much enhanced system, now with a shell
5903 for communicating directly with gnuplot, one command at a time.
5935 for communicating directly with gnuplot, one command at a time.
5904
5936
5905 * IPython/Magic.py (Magic.magic_run): added option -n to prevent
5937 * IPython/Magic.py (Magic.magic_run): added option -n to prevent
5906 setting __name__=='__main__'.
5938 setting __name__=='__main__'.
5907
5939
5908 * IPython/UserConfig/example-magic_pm.py (magic_pm): Added
5940 * IPython/UserConfig/example-magic_pm.py (magic_pm): Added
5909 mini-shell for accessing gnuplot from inside ipython. Should
5941 mini-shell for accessing gnuplot from inside ipython. Should
5910 extend it later for grace access too. Inspired by Arnd's
5942 extend it later for grace access too. Inspired by Arnd's
5911 suggestion.
5943 suggestion.
5912
5944
5913 * IPython/iplib.py (InteractiveShell.handle_magic): fixed bug when
5945 * IPython/iplib.py (InteractiveShell.handle_magic): fixed bug when
5914 calling magic functions with () in their arguments. Thanks to Arnd
5946 calling magic functions with () in their arguments. Thanks to Arnd
5915 Baecker for pointing this to me.
5947 Baecker for pointing this to me.
5916
5948
5917 * IPython/numutils.py (sum_flat): fixed bug. Would recurse
5949 * IPython/numutils.py (sum_flat): fixed bug. Would recurse
5918 infinitely for integer or complex arrays (only worked with floats).
5950 infinitely for integer or complex arrays (only worked with floats).
5919
5951
5920 2002-03-16 Fernando Perez <fperez@colorado.edu>
5952 2002-03-16 Fernando Perez <fperez@colorado.edu>
5921
5953
5922 * setup.py: Merged setup and setup_windows into a single script
5954 * setup.py: Merged setup and setup_windows into a single script
5923 which properly handles things for windows users.
5955 which properly handles things for windows users.
5924
5956
5925 2002-03-15 Fernando Perez <fperez@colorado.edu>
5957 2002-03-15 Fernando Perez <fperez@colorado.edu>
5926
5958
5927 * Big change to the manual: now the magics are all automatically
5959 * Big change to the manual: now the magics are all automatically
5928 documented. This information is generated from their docstrings
5960 documented. This information is generated from their docstrings
5929 and put in a latex file included by the manual lyx file. This way
5961 and put in a latex file included by the manual lyx file. This way
5930 we get always up to date information for the magics. The manual
5962 we get always up to date information for the magics. The manual
5931 now also has proper version information, also auto-synced.
5963 now also has proper version information, also auto-synced.
5932
5964
5933 For this to work, an undocumented --magic_docstrings option was added.
5965 For this to work, an undocumented --magic_docstrings option was added.
5934
5966
5935 2002-03-13 Fernando Perez <fperez@colorado.edu>
5967 2002-03-13 Fernando Perez <fperez@colorado.edu>
5936
5968
5937 * IPython/ultraTB.py (TermColors): fixed problem with dark colors
5969 * IPython/ultraTB.py (TermColors): fixed problem with dark colors
5938 under CDE terminals. An explicit ;2 color reset is needed in the escapes.
5970 under CDE terminals. An explicit ;2 color reset is needed in the escapes.
5939
5971
5940 2002-03-12 Fernando Perez <fperez@colorado.edu>
5972 2002-03-12 Fernando Perez <fperez@colorado.edu>
5941
5973
5942 * IPython/ultraTB.py (TermColors): changed color escapes again to
5974 * IPython/ultraTB.py (TermColors): changed color escapes again to
5943 fix the (old, reintroduced) line-wrapping bug. Basically, if
5975 fix the (old, reintroduced) line-wrapping bug. Basically, if
5944 \001..\002 aren't given in the color escapes, lines get wrapped
5976 \001..\002 aren't given in the color escapes, lines get wrapped
5945 weirdly. But giving those screws up old xterms and emacs terms. So
5977 weirdly. But giving those screws up old xterms and emacs terms. So
5946 I added some logic for emacs terms to be ok, but I can't identify old
5978 I added some logic for emacs terms to be ok, but I can't identify old
5947 xterms separately ($TERM=='xterm' for many terminals, like konsole).
5979 xterms separately ($TERM=='xterm' for many terminals, like konsole).
5948
5980
5949 2002-03-10 Fernando Perez <fperez@colorado.edu>
5981 2002-03-10 Fernando Perez <fperez@colorado.edu>
5950
5982
5951 * IPython/usage.py (__doc__): Various documentation cleanups and
5983 * IPython/usage.py (__doc__): Various documentation cleanups and
5952 updates, both in usage docstrings and in the manual.
5984 updates, both in usage docstrings and in the manual.
5953
5985
5954 * IPython/Prompts.py (CachedOutput.set_colors): cleanups for
5986 * IPython/Prompts.py (CachedOutput.set_colors): cleanups for
5955 handling of caching. Set minimum acceptabe value for having a
5987 handling of caching. Set minimum acceptabe value for having a
5956 cache at 20 values.
5988 cache at 20 values.
5957
5989
5958 * IPython/iplib.py (InteractiveShell.user_setup): moved the
5990 * IPython/iplib.py (InteractiveShell.user_setup): moved the
5959 install_first_time function to a method, renamed it and added an
5991 install_first_time function to a method, renamed it and added an
5960 'upgrade' mode. Now people can update their config directory with
5992 'upgrade' mode. Now people can update their config directory with
5961 a simple command line switch (-upgrade, also new).
5993 a simple command line switch (-upgrade, also new).
5962
5994
5963 * IPython/Magic.py (Magic.magic_pfile): Made @pfile an alias to
5995 * IPython/Magic.py (Magic.magic_pfile): Made @pfile an alias to
5964 @file (convenient for automagic users under Python >= 2.2).
5996 @file (convenient for automagic users under Python >= 2.2).
5965 Removed @files (it seemed more like a plural than an abbrev. of
5997 Removed @files (it seemed more like a plural than an abbrev. of
5966 'file show').
5998 'file show').
5967
5999
5968 * IPython/iplib.py (install_first_time): Fixed crash if there were
6000 * IPython/iplib.py (install_first_time): Fixed crash if there were
5969 backup files ('~') in .ipython/ install directory.
6001 backup files ('~') in .ipython/ install directory.
5970
6002
5971 * IPython/ipmaker.py (make_IPython): fixes for new prompt
6003 * IPython/ipmaker.py (make_IPython): fixes for new prompt
5972 system. Things look fine, but these changes are fairly
6004 system. Things look fine, but these changes are fairly
5973 intrusive. Test them for a few days.
6005 intrusive. Test them for a few days.
5974
6006
5975 * IPython/Prompts.py (CachedOutput.__init__): Massive rewrite of
6007 * IPython/Prompts.py (CachedOutput.__init__): Massive rewrite of
5976 the prompts system. Now all in/out prompt strings are user
6008 the prompts system. Now all in/out prompt strings are user
5977 controllable. This is particularly useful for embedding, as one
6009 controllable. This is particularly useful for embedding, as one
5978 can tag embedded instances with particular prompts.
6010 can tag embedded instances with particular prompts.
5979
6011
5980 Also removed global use of sys.ps1/2, which now allows nested
6012 Also removed global use of sys.ps1/2, which now allows nested
5981 embeddings without any problems. Added command-line options for
6013 embeddings without any problems. Added command-line options for
5982 the prompt strings.
6014 the prompt strings.
5983
6015
5984 2002-03-08 Fernando Perez <fperez@colorado.edu>
6016 2002-03-08 Fernando Perez <fperez@colorado.edu>
5985
6017
5986 * IPython/UserConfig/example-embed-short.py (ipshell): added
6018 * IPython/UserConfig/example-embed-short.py (ipshell): added
5987 example file with the bare minimum code for embedding.
6019 example file with the bare minimum code for embedding.
5988
6020
5989 * IPython/Shell.py (IPythonShellEmbed.set_dummy_mode): added
6021 * IPython/Shell.py (IPythonShellEmbed.set_dummy_mode): added
5990 functionality for the embeddable shell to be activated/deactivated
6022 functionality for the embeddable shell to be activated/deactivated
5991 either globally or at each call.
6023 either globally or at each call.
5992
6024
5993 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixes the problem of
6025 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixes the problem of
5994 rewriting the prompt with '--->' for auto-inputs with proper
6026 rewriting the prompt with '--->' for auto-inputs with proper
5995 coloring. Now the previous UGLY hack in handle_auto() is gone, and
6027 coloring. Now the previous UGLY hack in handle_auto() is gone, and
5996 this is handled by the prompts class itself, as it should.
6028 this is handled by the prompts class itself, as it should.
5997
6029
5998 2002-03-05 Fernando Perez <fperez@colorado.edu>
6030 2002-03-05 Fernando Perez <fperez@colorado.edu>
5999
6031
6000 * IPython/Magic.py (Magic.magic_logstart): Changed @log to
6032 * IPython/Magic.py (Magic.magic_logstart): Changed @log to
6001 @logstart to avoid name clashes with the math log function.
6033 @logstart to avoid name clashes with the math log function.
6002
6034
6003 * Big updates to X/Emacs section of the manual.
6035 * Big updates to X/Emacs section of the manual.
6004
6036
6005 * Removed ipython_emacs. Milan explained to me how to pass
6037 * Removed ipython_emacs. Milan explained to me how to pass
6006 arguments to ipython through Emacs. Some day I'm going to end up
6038 arguments to ipython through Emacs. Some day I'm going to end up
6007 learning some lisp...
6039 learning some lisp...
6008
6040
6009 2002-03-04 Fernando Perez <fperez@colorado.edu>
6041 2002-03-04 Fernando Perez <fperez@colorado.edu>
6010
6042
6011 * IPython/ipython_emacs: Created script to be used as the
6043 * IPython/ipython_emacs: Created script to be used as the
6012 py-python-command Emacs variable so we can pass IPython
6044 py-python-command Emacs variable so we can pass IPython
6013 parameters. I can't figure out how to tell Emacs directly to pass
6045 parameters. I can't figure out how to tell Emacs directly to pass
6014 parameters to IPython, so a dummy shell script will do it.
6046 parameters to IPython, so a dummy shell script will do it.
6015
6047
6016 Other enhancements made for things to work better under Emacs'
6048 Other enhancements made for things to work better under Emacs'
6017 various types of terminals. Many thanks to Milan Zamazal
6049 various types of terminals. Many thanks to Milan Zamazal
6018 <pdm-AT-zamazal.org> for all the suggestions and pointers.
6050 <pdm-AT-zamazal.org> for all the suggestions and pointers.
6019
6051
6020 2002-03-01 Fernando Perez <fperez@colorado.edu>
6052 2002-03-01 Fernando Perez <fperez@colorado.edu>
6021
6053
6022 * IPython/ipmaker.py (make_IPython): added a --readline! option so
6054 * IPython/ipmaker.py (make_IPython): added a --readline! option so
6023 that loading of readline is now optional. This gives better
6055 that loading of readline is now optional. This gives better
6024 control to emacs users.
6056 control to emacs users.
6025
6057
6026 * IPython/ultraTB.py (__date__): Modified color escape sequences
6058 * IPython/ultraTB.py (__date__): Modified color escape sequences
6027 and now things work fine under xterm and in Emacs' term buffers
6059 and now things work fine under xterm and in Emacs' term buffers
6028 (though not shell ones). Well, in emacs you get colors, but all
6060 (though not shell ones). Well, in emacs you get colors, but all
6029 seem to be 'light' colors (no difference between dark and light
6061 seem to be 'light' colors (no difference between dark and light
6030 ones). But the garbage chars are gone, and also in xterms. It
6062 ones). But the garbage chars are gone, and also in xterms. It
6031 seems that now I'm using 'cleaner' ansi sequences.
6063 seems that now I'm using 'cleaner' ansi sequences.
6032
6064
6033 2002-02-21 Fernando Perez <fperez@colorado.edu>
6065 2002-02-21 Fernando Perez <fperez@colorado.edu>
6034
6066
6035 * Released 0.2.7 (mainly to publish the scoping fix).
6067 * Released 0.2.7 (mainly to publish the scoping fix).
6036
6068
6037 * IPython/Logger.py (Logger.logstate): added. A corresponding
6069 * IPython/Logger.py (Logger.logstate): added. A corresponding
6038 @logstate magic was created.
6070 @logstate magic was created.
6039
6071
6040 * IPython/Magic.py: fixed nested scoping problem under Python
6072 * IPython/Magic.py: fixed nested scoping problem under Python
6041 2.1.x (automagic wasn't working).
6073 2.1.x (automagic wasn't working).
6042
6074
6043 2002-02-20 Fernando Perez <fperez@colorado.edu>
6075 2002-02-20 Fernando Perez <fperez@colorado.edu>
6044
6076
6045 * Released 0.2.6.
6077 * Released 0.2.6.
6046
6078
6047 * IPython/OutputTrap.py (OutputTrap.__init__): added a 'quiet'
6079 * IPython/OutputTrap.py (OutputTrap.__init__): added a 'quiet'
6048 option so that logs can come out without any headers at all.
6080 option so that logs can come out without any headers at all.
6049
6081
6050 * IPython/UserConfig/ipythonrc-scipy.py: created a profile for
6082 * IPython/UserConfig/ipythonrc-scipy.py: created a profile for
6051 SciPy.
6083 SciPy.
6052
6084
6053 * IPython/iplib.py (InteractiveShell.embed_mainloop): Changed so
6085 * IPython/iplib.py (InteractiveShell.embed_mainloop): Changed so
6054 that embedded IPython calls don't require vars() to be explicitly
6086 that embedded IPython calls don't require vars() to be explicitly
6055 passed. Now they are extracted from the caller's frame (code
6087 passed. Now they are extracted from the caller's frame (code
6056 snatched from Eric Jones' weave). Added better documentation to
6088 snatched from Eric Jones' weave). Added better documentation to
6057 the section on embedding and the example file.
6089 the section on embedding and the example file.
6058
6090
6059 * IPython/genutils.py (page): Changed so that under emacs, it just
6091 * IPython/genutils.py (page): Changed so that under emacs, it just
6060 prints the string. You can then page up and down in the emacs
6092 prints the string. You can then page up and down in the emacs
6061 buffer itself. This is how the builtin help() works.
6093 buffer itself. This is how the builtin help() works.
6062
6094
6063 * IPython/Prompts.py (CachedOutput.__call__): Fixed issue with
6095 * IPython/Prompts.py (CachedOutput.__call__): Fixed issue with
6064 macro scoping: macros need to be executed in the user's namespace
6096 macro scoping: macros need to be executed in the user's namespace
6065 to work as if they had been typed by the user.
6097 to work as if they had been typed by the user.
6066
6098
6067 * IPython/Magic.py (Magic.magic_macro): Changed macros so they
6099 * IPython/Magic.py (Magic.magic_macro): Changed macros so they
6068 execute automatically (no need to type 'exec...'). They then
6100 execute automatically (no need to type 'exec...'). They then
6069 behave like 'true macros'. The printing system was also modified
6101 behave like 'true macros'. The printing system was also modified
6070 for this to work.
6102 for this to work.
6071
6103
6072 2002-02-19 Fernando Perez <fperez@colorado.edu>
6104 2002-02-19 Fernando Perez <fperez@colorado.edu>
6073
6105
6074 * IPython/genutils.py (page_file): new function for paging files
6106 * IPython/genutils.py (page_file): new function for paging files
6075 in an OS-independent way. Also necessary for file viewing to work
6107 in an OS-independent way. Also necessary for file viewing to work
6076 well inside Emacs buffers.
6108 well inside Emacs buffers.
6077 (page): Added checks for being in an emacs buffer.
6109 (page): Added checks for being in an emacs buffer.
6078 (page): fixed bug for Windows ($TERM isn't set in Windows). Fixed
6110 (page): fixed bug for Windows ($TERM isn't set in Windows). Fixed
6079 same bug in iplib.
6111 same bug in iplib.
6080
6112
6081 2002-02-18 Fernando Perez <fperez@colorado.edu>
6113 2002-02-18 Fernando Perez <fperez@colorado.edu>
6082
6114
6083 * IPython/iplib.py (InteractiveShell.init_readline): modified use
6115 * IPython/iplib.py (InteractiveShell.init_readline): modified use
6084 of readline so that IPython can work inside an Emacs buffer.
6116 of readline so that IPython can work inside an Emacs buffer.
6085
6117
6086 * IPython/ultraTB.py (AutoFormattedTB.__call__): some fixes to
6118 * IPython/ultraTB.py (AutoFormattedTB.__call__): some fixes to
6087 method signatures (they weren't really bugs, but it looks cleaner
6119 method signatures (they weren't really bugs, but it looks cleaner
6088 and keeps PyChecker happy).
6120 and keeps PyChecker happy).
6089
6121
6090 * IPython/ipmaker.py (make_IPython): added hooks Struct to __IP
6122 * IPython/ipmaker.py (make_IPython): added hooks Struct to __IP
6091 for implementing various user-defined hooks. Currently only
6123 for implementing various user-defined hooks. Currently only
6092 display is done.
6124 display is done.
6093
6125
6094 * IPython/Prompts.py (CachedOutput._display): changed display
6126 * IPython/Prompts.py (CachedOutput._display): changed display
6095 functions so that they can be dynamically changed by users easily.
6127 functions so that they can be dynamically changed by users easily.
6096
6128
6097 * IPython/Extensions/numeric_formats.py (num_display): added an
6129 * IPython/Extensions/numeric_formats.py (num_display): added an
6098 extension for printing NumPy arrays in flexible manners. It
6130 extension for printing NumPy arrays in flexible manners. It
6099 doesn't do anything yet, but all the structure is in
6131 doesn't do anything yet, but all the structure is in
6100 place. Ultimately the plan is to implement output format control
6132 place. Ultimately the plan is to implement output format control
6101 like in Octave.
6133 like in Octave.
6102
6134
6103 * IPython/Magic.py (Magic.lsmagic): changed so that bound magic
6135 * IPython/Magic.py (Magic.lsmagic): changed so that bound magic
6104 methods are found at run-time by all the automatic machinery.
6136 methods are found at run-time by all the automatic machinery.
6105
6137
6106 2002-02-17 Fernando Perez <fperez@colorado.edu>
6138 2002-02-17 Fernando Perez <fperez@colorado.edu>
6107
6139
6108 * setup_Windows.py (make_shortcut): documented. Cleaned up the
6140 * setup_Windows.py (make_shortcut): documented. Cleaned up the
6109 whole file a little.
6141 whole file a little.
6110
6142
6111 * ToDo: closed this document. Now there's a new_design.lyx
6143 * ToDo: closed this document. Now there's a new_design.lyx
6112 document for all new ideas. Added making a pdf of it for the
6144 document for all new ideas. Added making a pdf of it for the
6113 end-user distro.
6145 end-user distro.
6114
6146
6115 * IPython/Logger.py (Logger.switch_log): Created this to replace
6147 * IPython/Logger.py (Logger.switch_log): Created this to replace
6116 logon() and logoff(). It also fixes a nasty crash reported by
6148 logon() and logoff(). It also fixes a nasty crash reported by
6117 Philip Hisley <compsys-AT-starpower.net>. Many thanks to him.
6149 Philip Hisley <compsys-AT-starpower.net>. Many thanks to him.
6118
6150
6119 * IPython/iplib.py (complete): got auto-completion to work with
6151 * IPython/iplib.py (complete): got auto-completion to work with
6120 automagic (I had wanted this for a long time).
6152 automagic (I had wanted this for a long time).
6121
6153
6122 * IPython/Magic.py (Magic.magic_files): Added @files as an alias
6154 * IPython/Magic.py (Magic.magic_files): Added @files as an alias
6123 to @file, since file() is now a builtin and clashes with automagic
6155 to @file, since file() is now a builtin and clashes with automagic
6124 for @file.
6156 for @file.
6125
6157
6126 * Made some new files: Prompts, CrashHandler, Magic, Logger. All
6158 * Made some new files: Prompts, CrashHandler, Magic, Logger. All
6127 of this was previously in iplib, which had grown to more than 2000
6159 of this was previously in iplib, which had grown to more than 2000
6128 lines, way too long. No new functionality, but it makes managing
6160 lines, way too long. No new functionality, but it makes managing
6129 the code a bit easier.
6161 the code a bit easier.
6130
6162
6131 * IPython/iplib.py (IPythonCrashHandler.__call__): Added version
6163 * IPython/iplib.py (IPythonCrashHandler.__call__): Added version
6132 information to crash reports.
6164 information to crash reports.
6133
6165
6134 2002-02-12 Fernando Perez <fperez@colorado.edu>
6166 2002-02-12 Fernando Perez <fperez@colorado.edu>
6135
6167
6136 * Released 0.2.5.
6168 * Released 0.2.5.
6137
6169
6138 2002-02-11 Fernando Perez <fperez@colorado.edu>
6170 2002-02-11 Fernando Perez <fperez@colorado.edu>
6139
6171
6140 * Wrote a relatively complete Windows installer. It puts
6172 * Wrote a relatively complete Windows installer. It puts
6141 everything in place, creates Start Menu entries and fixes the
6173 everything in place, creates Start Menu entries and fixes the
6142 color issues. Nothing fancy, but it works.
6174 color issues. Nothing fancy, but it works.
6143
6175
6144 2002-02-10 Fernando Perez <fperez@colorado.edu>
6176 2002-02-10 Fernando Perez <fperez@colorado.edu>
6145
6177
6146 * IPython/iplib.py (InteractiveShell.safe_execfile): added an
6178 * IPython/iplib.py (InteractiveShell.safe_execfile): added an
6147 os.path.expanduser() call so that we can type @run ~/myfile.py and
6179 os.path.expanduser() call so that we can type @run ~/myfile.py and
6148 have thigs work as expected.
6180 have thigs work as expected.
6149
6181
6150 * IPython/genutils.py (page): fixed exception handling so things
6182 * IPython/genutils.py (page): fixed exception handling so things
6151 work both in Unix and Windows correctly. Quitting a pager triggers
6183 work both in Unix and Windows correctly. Quitting a pager triggers
6152 an IOError/broken pipe in Unix, and in windows not finding a pager
6184 an IOError/broken pipe in Unix, and in windows not finding a pager
6153 is also an IOError, so I had to actually look at the return value
6185 is also an IOError, so I had to actually look at the return value
6154 of the exception, not just the exception itself. Should be ok now.
6186 of the exception, not just the exception itself. Should be ok now.
6155
6187
6156 * IPython/ultraTB.py (ColorSchemeTable.set_active_scheme):
6188 * IPython/ultraTB.py (ColorSchemeTable.set_active_scheme):
6157 modified to allow case-insensitive color scheme changes.
6189 modified to allow case-insensitive color scheme changes.
6158
6190
6159 2002-02-09 Fernando Perez <fperez@colorado.edu>
6191 2002-02-09 Fernando Perez <fperez@colorado.edu>
6160
6192
6161 * IPython/genutils.py (native_line_ends): new function to leave
6193 * IPython/genutils.py (native_line_ends): new function to leave
6162 user config files with os-native line-endings.
6194 user config files with os-native line-endings.
6163
6195
6164 * README and manual updates.
6196 * README and manual updates.
6165
6197
6166 * IPython/genutils.py: fixed unicode bug: use types.StringTypes
6198 * IPython/genutils.py: fixed unicode bug: use types.StringTypes
6167 instead of StringType to catch Unicode strings.
6199 instead of StringType to catch Unicode strings.
6168
6200
6169 * IPython/genutils.py (filefind): fixed bug for paths with
6201 * IPython/genutils.py (filefind): fixed bug for paths with
6170 embedded spaces (very common in Windows).
6202 embedded spaces (very common in Windows).
6171
6203
6172 * IPython/ipmaker.py (make_IPython): added a '.ini' to the rc
6204 * IPython/ipmaker.py (make_IPython): added a '.ini' to the rc
6173 files under Windows, so that they get automatically associated
6205 files under Windows, so that they get automatically associated
6174 with a text editor. Windows makes it a pain to handle
6206 with a text editor. Windows makes it a pain to handle
6175 extension-less files.
6207 extension-less files.
6176
6208
6177 * IPython/iplib.py (InteractiveShell.init_readline): Made the
6209 * IPython/iplib.py (InteractiveShell.init_readline): Made the
6178 warning about readline only occur for Posix. In Windows there's no
6210 warning about readline only occur for Posix. In Windows there's no
6179 way to get readline, so why bother with the warning.
6211 way to get readline, so why bother with the warning.
6180
6212
6181 * IPython/Struct.py (Struct.__str__): fixed to use self.__dict__
6213 * IPython/Struct.py (Struct.__str__): fixed to use self.__dict__
6182 for __str__ instead of dir(self), since dir() changed in 2.2.
6214 for __str__ instead of dir(self), since dir() changed in 2.2.
6183
6215
6184 * Ported to Windows! Tested on XP, I suspect it should work fine
6216 * Ported to Windows! Tested on XP, I suspect it should work fine
6185 on NT/2000, but I don't think it will work on 98 et al. That
6217 on NT/2000, but I don't think it will work on 98 et al. That
6186 series of Windows is such a piece of junk anyway that I won't try
6218 series of Windows is such a piece of junk anyway that I won't try
6187 porting it there. The XP port was straightforward, showed a few
6219 porting it there. The XP port was straightforward, showed a few
6188 bugs here and there (fixed all), in particular some string
6220 bugs here and there (fixed all), in particular some string
6189 handling stuff which required considering Unicode strings (which
6221 handling stuff which required considering Unicode strings (which
6190 Windows uses). This is good, but hasn't been too tested :) No
6222 Windows uses). This is good, but hasn't been too tested :) No
6191 fancy installer yet, I'll put a note in the manual so people at
6223 fancy installer yet, I'll put a note in the manual so people at
6192 least make manually a shortcut.
6224 least make manually a shortcut.
6193
6225
6194 * IPython/iplib.py (Magic.magic_colors): Unified the color options
6226 * IPython/iplib.py (Magic.magic_colors): Unified the color options
6195 into a single one, "colors". This now controls both prompt and
6227 into a single one, "colors". This now controls both prompt and
6196 exception color schemes, and can be changed both at startup
6228 exception color schemes, and can be changed both at startup
6197 (either via command-line switches or via ipythonrc files) and at
6229 (either via command-line switches or via ipythonrc files) and at
6198 runtime, with @colors.
6230 runtime, with @colors.
6199 (Magic.magic_run): renamed @prun to @run and removed the old
6231 (Magic.magic_run): renamed @prun to @run and removed the old
6200 @run. The two were too similar to warrant keeping both.
6232 @run. The two were too similar to warrant keeping both.
6201
6233
6202 2002-02-03 Fernando Perez <fperez@colorado.edu>
6234 2002-02-03 Fernando Perez <fperez@colorado.edu>
6203
6235
6204 * IPython/iplib.py (install_first_time): Added comment on how to
6236 * IPython/iplib.py (install_first_time): Added comment on how to
6205 configure the color options for first-time users. Put a <return>
6237 configure the color options for first-time users. Put a <return>
6206 request at the end so that small-terminal users get a chance to
6238 request at the end so that small-terminal users get a chance to
6207 read the startup info.
6239 read the startup info.
6208
6240
6209 2002-01-23 Fernando Perez <fperez@colorado.edu>
6241 2002-01-23 Fernando Perez <fperez@colorado.edu>
6210
6242
6211 * IPython/iplib.py (CachedOutput.update): Changed output memory
6243 * IPython/iplib.py (CachedOutput.update): Changed output memory
6212 variable names from _o,_oo,_ooo,_o<n> to simply _,__,___,_<n>. For
6244 variable names from _o,_oo,_ooo,_o<n> to simply _,__,___,_<n>. For
6213 input history we still use _i. Did this b/c these variable are
6245 input history we still use _i. Did this b/c these variable are
6214 very commonly used in interactive work, so the less we need to
6246 very commonly used in interactive work, so the less we need to
6215 type the better off we are.
6247 type the better off we are.
6216 (Magic.magic_prun): updated @prun to better handle the namespaces
6248 (Magic.magic_prun): updated @prun to better handle the namespaces
6217 the file will run in, including a fix for __name__ not being set
6249 the file will run in, including a fix for __name__ not being set
6218 before.
6250 before.
6219
6251
6220 2002-01-20 Fernando Perez <fperez@colorado.edu>
6252 2002-01-20 Fernando Perez <fperez@colorado.edu>
6221
6253
6222 * IPython/ultraTB.py (VerboseTB.linereader): Fixed printing of
6254 * IPython/ultraTB.py (VerboseTB.linereader): Fixed printing of
6223 extra garbage for Python 2.2. Need to look more carefully into
6255 extra garbage for Python 2.2. Need to look more carefully into
6224 this later.
6256 this later.
6225
6257
6226 2002-01-19 Fernando Perez <fperez@colorado.edu>
6258 2002-01-19 Fernando Perez <fperez@colorado.edu>
6227
6259
6228 * IPython/iplib.py (InteractiveShell.showtraceback): fixed to
6260 * IPython/iplib.py (InteractiveShell.showtraceback): fixed to
6229 display SyntaxError exceptions properly formatted when they occur
6261 display SyntaxError exceptions properly formatted when they occur
6230 (they can be triggered by imported code).
6262 (they can be triggered by imported code).
6231
6263
6232 2002-01-18 Fernando Perez <fperez@colorado.edu>
6264 2002-01-18 Fernando Perez <fperez@colorado.edu>
6233
6265
6234 * IPython/iplib.py (InteractiveShell.safe_execfile): now
6266 * IPython/iplib.py (InteractiveShell.safe_execfile): now
6235 SyntaxError exceptions are reported nicely formatted, instead of
6267 SyntaxError exceptions are reported nicely formatted, instead of
6236 spitting out only offset information as before.
6268 spitting out only offset information as before.
6237 (Magic.magic_prun): Added the @prun function for executing
6269 (Magic.magic_prun): Added the @prun function for executing
6238 programs with command line args inside IPython.
6270 programs with command line args inside IPython.
6239
6271
6240 2002-01-16 Fernando Perez <fperez@colorado.edu>
6272 2002-01-16 Fernando Perez <fperez@colorado.edu>
6241
6273
6242 * IPython/iplib.py (Magic.magic_hist): Changed @hist and @dhist
6274 * IPython/iplib.py (Magic.magic_hist): Changed @hist and @dhist
6243 to *not* include the last item given in a range. This brings their
6275 to *not* include the last item given in a range. This brings their
6244 behavior in line with Python's slicing:
6276 behavior in line with Python's slicing:
6245 a[n1:n2] -> a[n1]...a[n2-1]
6277 a[n1:n2] -> a[n1]...a[n2-1]
6246 It may be a bit less convenient, but I prefer to stick to Python's
6278 It may be a bit less convenient, but I prefer to stick to Python's
6247 conventions *everywhere*, so users never have to wonder.
6279 conventions *everywhere*, so users never have to wonder.
6248 (Magic.magic_macro): Added @macro function to ease the creation of
6280 (Magic.magic_macro): Added @macro function to ease the creation of
6249 macros.
6281 macros.
6250
6282
6251 2002-01-05 Fernando Perez <fperez@colorado.edu>
6283 2002-01-05 Fernando Perez <fperez@colorado.edu>
6252
6284
6253 * Released 0.2.4.
6285 * Released 0.2.4.
6254
6286
6255 * IPython/iplib.py (Magic.magic_pdef):
6287 * IPython/iplib.py (Magic.magic_pdef):
6256 (InteractiveShell.safe_execfile): report magic lines and error
6288 (InteractiveShell.safe_execfile): report magic lines and error
6257 lines without line numbers so one can easily copy/paste them for
6289 lines without line numbers so one can easily copy/paste them for
6258 re-execution.
6290 re-execution.
6259
6291
6260 * Updated manual with recent changes.
6292 * Updated manual with recent changes.
6261
6293
6262 * IPython/iplib.py (Magic.magic_oinfo): added constructor
6294 * IPython/iplib.py (Magic.magic_oinfo): added constructor
6263 docstring printing when class? is called. Very handy for knowing
6295 docstring printing when class? is called. Very handy for knowing
6264 how to create class instances (as long as __init__ is well
6296 how to create class instances (as long as __init__ is well
6265 documented, of course :)
6297 documented, of course :)
6266 (Magic.magic_doc): print both class and constructor docstrings.
6298 (Magic.magic_doc): print both class and constructor docstrings.
6267 (Magic.magic_pdef): give constructor info if passed a class and
6299 (Magic.magic_pdef): give constructor info if passed a class and
6268 __call__ info for callable object instances.
6300 __call__ info for callable object instances.
6269
6301
6270 2002-01-04 Fernando Perez <fperez@colorado.edu>
6302 2002-01-04 Fernando Perez <fperez@colorado.edu>
6271
6303
6272 * Made deep_reload() off by default. It doesn't always work
6304 * Made deep_reload() off by default. It doesn't always work
6273 exactly as intended, so it's probably safer to have it off. It's
6305 exactly as intended, so it's probably safer to have it off. It's
6274 still available as dreload() anyway, so nothing is lost.
6306 still available as dreload() anyway, so nothing is lost.
6275
6307
6276 2002-01-02 Fernando Perez <fperez@colorado.edu>
6308 2002-01-02 Fernando Perez <fperez@colorado.edu>
6277
6309
6278 * Released 0.2.3 (contacted R.Singh at CU about biopython course,
6310 * Released 0.2.3 (contacted R.Singh at CU about biopython course,
6279 so I wanted an updated release).
6311 so I wanted an updated release).
6280
6312
6281 2001-12-27 Fernando Perez <fperez@colorado.edu>
6313 2001-12-27 Fernando Perez <fperez@colorado.edu>
6282
6314
6283 * IPython/iplib.py (InteractiveShell.interact): Added the original
6315 * IPython/iplib.py (InteractiveShell.interact): Added the original
6284 code from 'code.py' for this module in order to change the
6316 code from 'code.py' for this module in order to change the
6285 handling of a KeyboardInterrupt. This was necessary b/c otherwise
6317 handling of a KeyboardInterrupt. This was necessary b/c otherwise
6286 the history cache would break when the user hit Ctrl-C, and
6318 the history cache would break when the user hit Ctrl-C, and
6287 interact() offers no way to add any hooks to it.
6319 interact() offers no way to add any hooks to it.
6288
6320
6289 2001-12-23 Fernando Perez <fperez@colorado.edu>
6321 2001-12-23 Fernando Perez <fperez@colorado.edu>
6290
6322
6291 * setup.py: added check for 'MANIFEST' before trying to remove
6323 * setup.py: added check for 'MANIFEST' before trying to remove
6292 it. Thanks to Sean Reifschneider.
6324 it. Thanks to Sean Reifschneider.
6293
6325
6294 2001-12-22 Fernando Perez <fperez@colorado.edu>
6326 2001-12-22 Fernando Perez <fperez@colorado.edu>
6295
6327
6296 * Released 0.2.2.
6328 * Released 0.2.2.
6297
6329
6298 * Finished (reasonably) writing the manual. Later will add the
6330 * Finished (reasonably) writing the manual. Later will add the
6299 python-standard navigation stylesheets, but for the time being
6331 python-standard navigation stylesheets, but for the time being
6300 it's fairly complete. Distribution will include html and pdf
6332 it's fairly complete. Distribution will include html and pdf
6301 versions.
6333 versions.
6302
6334
6303 * Bugfix: '.' wasn't being added to sys.path. Thanks to Prabhu
6335 * Bugfix: '.' wasn't being added to sys.path. Thanks to Prabhu
6304 (MayaVi author).
6336 (MayaVi author).
6305
6337
6306 2001-12-21 Fernando Perez <fperez@colorado.edu>
6338 2001-12-21 Fernando Perez <fperez@colorado.edu>
6307
6339
6308 * Released 0.2.1. Barring any nasty bugs, this is it as far as a
6340 * Released 0.2.1. Barring any nasty bugs, this is it as far as a
6309 good public release, I think (with the manual and the distutils
6341 good public release, I think (with the manual and the distutils
6310 installer). The manual can use some work, but that can go
6342 installer). The manual can use some work, but that can go
6311 slowly. Otherwise I think it's quite nice for end users. Next
6343 slowly. Otherwise I think it's quite nice for end users. Next
6312 summer, rewrite the guts of it...
6344 summer, rewrite the guts of it...
6313
6345
6314 * Changed format of ipythonrc files to use whitespace as the
6346 * Changed format of ipythonrc files to use whitespace as the
6315 separator instead of an explicit '='. Cleaner.
6347 separator instead of an explicit '='. Cleaner.
6316
6348
6317 2001-12-20 Fernando Perez <fperez@colorado.edu>
6349 2001-12-20 Fernando Perez <fperez@colorado.edu>
6318
6350
6319 * Started a manual in LyX. For now it's just a quick merge of the
6351 * Started a manual in LyX. For now it's just a quick merge of the
6320 various internal docstrings and READMEs. Later it may grow into a
6352 various internal docstrings and READMEs. Later it may grow into a
6321 nice, full-blown manual.
6353 nice, full-blown manual.
6322
6354
6323 * Set up a distutils based installer. Installation should now be
6355 * Set up a distutils based installer. Installation should now be
6324 trivially simple for end-users.
6356 trivially simple for end-users.
6325
6357
6326 2001-12-11 Fernando Perez <fperez@colorado.edu>
6358 2001-12-11 Fernando Perez <fperez@colorado.edu>
6327
6359
6328 * Released 0.2.0. First public release, announced it at
6360 * Released 0.2.0. First public release, announced it at
6329 comp.lang.python. From now on, just bugfixes...
6361 comp.lang.python. From now on, just bugfixes...
6330
6362
6331 * Went through all the files, set copyright/license notices and
6363 * Went through all the files, set copyright/license notices and
6332 cleaned up things. Ready for release.
6364 cleaned up things. Ready for release.
6333
6365
6334 2001-12-10 Fernando Perez <fperez@colorado.edu>
6366 2001-12-10 Fernando Perez <fperez@colorado.edu>
6335
6367
6336 * Changed the first-time installer not to use tarfiles. It's more
6368 * Changed the first-time installer not to use tarfiles. It's more
6337 robust now and less unix-dependent. Also makes it easier for
6369 robust now and less unix-dependent. Also makes it easier for
6338 people to later upgrade versions.
6370 people to later upgrade versions.
6339
6371
6340 * Changed @exit to @abort to reflect the fact that it's pretty
6372 * Changed @exit to @abort to reflect the fact that it's pretty
6341 brutal (a sys.exit()). The difference between @abort and Ctrl-D
6373 brutal (a sys.exit()). The difference between @abort and Ctrl-D
6342 becomes significant only when IPyhton is embedded: in that case,
6374 becomes significant only when IPyhton is embedded: in that case,
6343 C-D closes IPython only, but @abort kills the enclosing program
6375 C-D closes IPython only, but @abort kills the enclosing program
6344 too (unless it had called IPython inside a try catching
6376 too (unless it had called IPython inside a try catching
6345 SystemExit).
6377 SystemExit).
6346
6378
6347 * Created Shell module which exposes the actuall IPython Shell
6379 * Created Shell module which exposes the actuall IPython Shell
6348 classes, currently the normal and the embeddable one. This at
6380 classes, currently the normal and the embeddable one. This at
6349 least offers a stable interface we won't need to change when
6381 least offers a stable interface we won't need to change when
6350 (later) the internals are rewritten. That rewrite will be confined
6382 (later) the internals are rewritten. That rewrite will be confined
6351 to iplib and ipmaker, but the Shell interface should remain as is.
6383 to iplib and ipmaker, but the Shell interface should remain as is.
6352
6384
6353 * Added embed module which offers an embeddable IPShell object,
6385 * Added embed module which offers an embeddable IPShell object,
6354 useful to fire up IPython *inside* a running program. Great for
6386 useful to fire up IPython *inside* a running program. Great for
6355 debugging or dynamical data analysis.
6387 debugging or dynamical data analysis.
6356
6388
6357 2001-12-08 Fernando Perez <fperez@colorado.edu>
6389 2001-12-08 Fernando Perez <fperez@colorado.edu>
6358
6390
6359 * Fixed small bug preventing seeing info from methods of defined
6391 * Fixed small bug preventing seeing info from methods of defined
6360 objects (incorrect namespace in _ofind()).
6392 objects (incorrect namespace in _ofind()).
6361
6393
6362 * Documentation cleanup. Moved the main usage docstrings to a
6394 * Documentation cleanup. Moved the main usage docstrings to a
6363 separate file, usage.py (cleaner to maintain, and hopefully in the
6395 separate file, usage.py (cleaner to maintain, and hopefully in the
6364 future some perlpod-like way of producing interactive, man and
6396 future some perlpod-like way of producing interactive, man and
6365 html docs out of it will be found).
6397 html docs out of it will be found).
6366
6398
6367 * Added @profile to see your profile at any time.
6399 * Added @profile to see your profile at any time.
6368
6400
6369 * Added @p as an alias for 'print'. It's especially convenient if
6401 * Added @p as an alias for 'print'. It's especially convenient if
6370 using automagic ('p x' prints x).
6402 using automagic ('p x' prints x).
6371
6403
6372 * Small cleanups and fixes after a pychecker run.
6404 * Small cleanups and fixes after a pychecker run.
6373
6405
6374 * Changed the @cd command to handle @cd - and @cd -<n> for
6406 * Changed the @cd command to handle @cd - and @cd -<n> for
6375 visiting any directory in _dh.
6407 visiting any directory in _dh.
6376
6408
6377 * Introduced _dh, a history of visited directories. @dhist prints
6409 * Introduced _dh, a history of visited directories. @dhist prints
6378 it out with numbers.
6410 it out with numbers.
6379
6411
6380 2001-12-07 Fernando Perez <fperez@colorado.edu>
6412 2001-12-07 Fernando Perez <fperez@colorado.edu>
6381
6413
6382 * Released 0.1.22
6414 * Released 0.1.22
6383
6415
6384 * Made initialization a bit more robust against invalid color
6416 * Made initialization a bit more robust against invalid color
6385 options in user input (exit, not traceback-crash).
6417 options in user input (exit, not traceback-crash).
6386
6418
6387 * Changed the bug crash reporter to write the report only in the
6419 * Changed the bug crash reporter to write the report only in the
6388 user's .ipython directory. That way IPython won't litter people's
6420 user's .ipython directory. That way IPython won't litter people's
6389 hard disks with crash files all over the place. Also print on
6421 hard disks with crash files all over the place. Also print on
6390 screen the necessary mail command.
6422 screen the necessary mail command.
6391
6423
6392 * With the new ultraTB, implemented LightBG color scheme for light
6424 * With the new ultraTB, implemented LightBG color scheme for light
6393 background terminals. A lot of people like white backgrounds, so I
6425 background terminals. A lot of people like white backgrounds, so I
6394 guess we should at least give them something readable.
6426 guess we should at least give them something readable.
6395
6427
6396 2001-12-06 Fernando Perez <fperez@colorado.edu>
6428 2001-12-06 Fernando Perez <fperez@colorado.edu>
6397
6429
6398 * Modified the structure of ultraTB. Now there's a proper class
6430 * Modified the structure of ultraTB. Now there's a proper class
6399 for tables of color schemes which allow adding schemes easily and
6431 for tables of color schemes which allow adding schemes easily and
6400 switching the active scheme without creating a new instance every
6432 switching the active scheme without creating a new instance every
6401 time (which was ridiculous). The syntax for creating new schemes
6433 time (which was ridiculous). The syntax for creating new schemes
6402 is also cleaner. I think ultraTB is finally done, with a clean
6434 is also cleaner. I think ultraTB is finally done, with a clean
6403 class structure. Names are also much cleaner (now there's proper
6435 class structure. Names are also much cleaner (now there's proper
6404 color tables, no need for every variable to also have 'color' in
6436 color tables, no need for every variable to also have 'color' in
6405 its name).
6437 its name).
6406
6438
6407 * Broke down genutils into separate files. Now genutils only
6439 * Broke down genutils into separate files. Now genutils only
6408 contains utility functions, and classes have been moved to their
6440 contains utility functions, and classes have been moved to their
6409 own files (they had enough independent functionality to warrant
6441 own files (they had enough independent functionality to warrant
6410 it): ConfigLoader, OutputTrap, Struct.
6442 it): ConfigLoader, OutputTrap, Struct.
6411
6443
6412 2001-12-05 Fernando Perez <fperez@colorado.edu>
6444 2001-12-05 Fernando Perez <fperez@colorado.edu>
6413
6445
6414 * IPython turns 21! Released version 0.1.21, as a candidate for
6446 * IPython turns 21! Released version 0.1.21, as a candidate for
6415 public consumption. If all goes well, release in a few days.
6447 public consumption. If all goes well, release in a few days.
6416
6448
6417 * Fixed path bug (files in Extensions/ directory wouldn't be found
6449 * Fixed path bug (files in Extensions/ directory wouldn't be found
6418 unless IPython/ was explicitly in sys.path).
6450 unless IPython/ was explicitly in sys.path).
6419
6451
6420 * Extended the FlexCompleter class as MagicCompleter to allow
6452 * Extended the FlexCompleter class as MagicCompleter to allow
6421 completion of @-starting lines.
6453 completion of @-starting lines.
6422
6454
6423 * Created __release__.py file as a central repository for release
6455 * Created __release__.py file as a central repository for release
6424 info that other files can read from.
6456 info that other files can read from.
6425
6457
6426 * Fixed small bug in logging: when logging was turned on in
6458 * Fixed small bug in logging: when logging was turned on in
6427 mid-session, old lines with special meanings (!@?) were being
6459 mid-session, old lines with special meanings (!@?) were being
6428 logged without the prepended comment, which is necessary since
6460 logged without the prepended comment, which is necessary since
6429 they are not truly valid python syntax. This should make session
6461 they are not truly valid python syntax. This should make session
6430 restores produce less errors.
6462 restores produce less errors.
6431
6463
6432 * The namespace cleanup forced me to make a FlexCompleter class
6464 * The namespace cleanup forced me to make a FlexCompleter class
6433 which is nothing but a ripoff of rlcompleter, but with selectable
6465 which is nothing but a ripoff of rlcompleter, but with selectable
6434 namespace (rlcompleter only works in __main__.__dict__). I'll try
6466 namespace (rlcompleter only works in __main__.__dict__). I'll try
6435 to submit a note to the authors to see if this change can be
6467 to submit a note to the authors to see if this change can be
6436 incorporated in future rlcompleter releases (Dec.6: done)
6468 incorporated in future rlcompleter releases (Dec.6: done)
6437
6469
6438 * More fixes to namespace handling. It was a mess! Now all
6470 * More fixes to namespace handling. It was a mess! Now all
6439 explicit references to __main__.__dict__ are gone (except when
6471 explicit references to __main__.__dict__ are gone (except when
6440 really needed) and everything is handled through the namespace
6472 really needed) and everything is handled through the namespace
6441 dicts in the IPython instance. We seem to be getting somewhere
6473 dicts in the IPython instance. We seem to be getting somewhere
6442 with this, finally...
6474 with this, finally...
6443
6475
6444 * Small documentation updates.
6476 * Small documentation updates.
6445
6477
6446 * Created the Extensions directory under IPython (with an
6478 * Created the Extensions directory under IPython (with an
6447 __init__.py). Put the PhysicalQ stuff there. This directory should
6479 __init__.py). Put the PhysicalQ stuff there. This directory should
6448 be used for all special-purpose extensions.
6480 be used for all special-purpose extensions.
6449
6481
6450 * File renaming:
6482 * File renaming:
6451 ipythonlib --> ipmaker
6483 ipythonlib --> ipmaker
6452 ipplib --> iplib
6484 ipplib --> iplib
6453 This makes a bit more sense in terms of what these files actually do.
6485 This makes a bit more sense in terms of what these files actually do.
6454
6486
6455 * Moved all the classes and functions in ipythonlib to ipplib, so
6487 * Moved all the classes and functions in ipythonlib to ipplib, so
6456 now ipythonlib only has make_IPython(). This will ease up its
6488 now ipythonlib only has make_IPython(). This will ease up its
6457 splitting in smaller functional chunks later.
6489 splitting in smaller functional chunks later.
6458
6490
6459 * Cleaned up (done, I think) output of @whos. Better column
6491 * Cleaned up (done, I think) output of @whos. Better column
6460 formatting, and now shows str(var) for as much as it can, which is
6492 formatting, and now shows str(var) for as much as it can, which is
6461 typically what one gets with a 'print var'.
6493 typically what one gets with a 'print var'.
6462
6494
6463 2001-12-04 Fernando Perez <fperez@colorado.edu>
6495 2001-12-04 Fernando Perez <fperez@colorado.edu>
6464
6496
6465 * Fixed namespace problems. Now builtin/IPyhton/user names get
6497 * Fixed namespace problems. Now builtin/IPyhton/user names get
6466 properly reported in their namespace. Internal namespace handling
6498 properly reported in their namespace. Internal namespace handling
6467 is finally getting decent (not perfect yet, but much better than
6499 is finally getting decent (not perfect yet, but much better than
6468 the ad-hoc mess we had).
6500 the ad-hoc mess we had).
6469
6501
6470 * Removed -exit option. If people just want to run a python
6502 * Removed -exit option. If people just want to run a python
6471 script, that's what the normal interpreter is for. Less
6503 script, that's what the normal interpreter is for. Less
6472 unnecessary options, less chances for bugs.
6504 unnecessary options, less chances for bugs.
6473
6505
6474 * Added a crash handler which generates a complete post-mortem if
6506 * Added a crash handler which generates a complete post-mortem if
6475 IPython crashes. This will help a lot in tracking bugs down the
6507 IPython crashes. This will help a lot in tracking bugs down the
6476 road.
6508 road.
6477
6509
6478 * Fixed nasty bug in auto-evaluation part of prefilter(). Names
6510 * Fixed nasty bug in auto-evaluation part of prefilter(). Names
6479 which were boud to functions being reassigned would bypass the
6511 which were boud to functions being reassigned would bypass the
6480 logger, breaking the sync of _il with the prompt counter. This
6512 logger, breaking the sync of _il with the prompt counter. This
6481 would then crash IPython later when a new line was logged.
6513 would then crash IPython later when a new line was logged.
6482
6514
6483 2001-12-02 Fernando Perez <fperez@colorado.edu>
6515 2001-12-02 Fernando Perez <fperez@colorado.edu>
6484
6516
6485 * Made IPython a package. This means people don't have to clutter
6517 * Made IPython a package. This means people don't have to clutter
6486 their sys.path with yet another directory. Changed the INSTALL
6518 their sys.path with yet another directory. Changed the INSTALL
6487 file accordingly.
6519 file accordingly.
6488
6520
6489 * Cleaned up the output of @who_ls, @who and @whos. @who_ls now
6521 * Cleaned up the output of @who_ls, @who and @whos. @who_ls now
6490 sorts its output (so @who shows it sorted) and @whos formats the
6522 sorts its output (so @who shows it sorted) and @whos formats the
6491 table according to the width of the first column. Nicer, easier to
6523 table according to the width of the first column. Nicer, easier to
6492 read. Todo: write a generic table_format() which takes a list of
6524 read. Todo: write a generic table_format() which takes a list of
6493 lists and prints it nicely formatted, with optional row/column
6525 lists and prints it nicely formatted, with optional row/column
6494 separators and proper padding and justification.
6526 separators and proper padding and justification.
6495
6527
6496 * Released 0.1.20
6528 * Released 0.1.20
6497
6529
6498 * Fixed bug in @log which would reverse the inputcache list (a
6530 * Fixed bug in @log which would reverse the inputcache list (a
6499 copy operation was missing).
6531 copy operation was missing).
6500
6532
6501 * Code cleanup. @config was changed to use page(). Better, since
6533 * Code cleanup. @config was changed to use page(). Better, since
6502 its output is always quite long.
6534 its output is always quite long.
6503
6535
6504 * Itpl is back as a dependency. I was having too many problems
6536 * Itpl is back as a dependency. I was having too many problems
6505 getting the parametric aliases to work reliably, and it's just
6537 getting the parametric aliases to work reliably, and it's just
6506 easier to code weird string operations with it than playing %()s
6538 easier to code weird string operations with it than playing %()s
6507 games. It's only ~6k, so I don't think it's too big a deal.
6539 games. It's only ~6k, so I don't think it's too big a deal.
6508
6540
6509 * Found (and fixed) a very nasty bug with history. !lines weren't
6541 * Found (and fixed) a very nasty bug with history. !lines weren't
6510 getting cached, and the out of sync caches would crash
6542 getting cached, and the out of sync caches would crash
6511 IPython. Fixed it by reorganizing the prefilter/handlers/logger
6543 IPython. Fixed it by reorganizing the prefilter/handlers/logger
6512 division of labor a bit better. Bug fixed, cleaner structure.
6544 division of labor a bit better. Bug fixed, cleaner structure.
6513
6545
6514 2001-12-01 Fernando Perez <fperez@colorado.edu>
6546 2001-12-01 Fernando Perez <fperez@colorado.edu>
6515
6547
6516 * Released 0.1.19
6548 * Released 0.1.19
6517
6549
6518 * Added option -n to @hist to prevent line number printing. Much
6550 * Added option -n to @hist to prevent line number printing. Much
6519 easier to copy/paste code this way.
6551 easier to copy/paste code this way.
6520
6552
6521 * Created global _il to hold the input list. Allows easy
6553 * Created global _il to hold the input list. Allows easy
6522 re-execution of blocks of code by slicing it (inspired by Janko's
6554 re-execution of blocks of code by slicing it (inspired by Janko's
6523 comment on 'macros').
6555 comment on 'macros').
6524
6556
6525 * Small fixes and doc updates.
6557 * Small fixes and doc updates.
6526
6558
6527 * Rewrote @history function (was @h). Renamed it to @hist, @h is
6559 * Rewrote @history function (was @h). Renamed it to @hist, @h is
6528 much too fragile with automagic. Handles properly multi-line
6560 much too fragile with automagic. Handles properly multi-line
6529 statements and takes parameters.
6561 statements and takes parameters.
6530
6562
6531 2001-11-30 Fernando Perez <fperez@colorado.edu>
6563 2001-11-30 Fernando Perez <fperez@colorado.edu>
6532
6564
6533 * Version 0.1.18 released.
6565 * Version 0.1.18 released.
6534
6566
6535 * Fixed nasty namespace bug in initial module imports.
6567 * Fixed nasty namespace bug in initial module imports.
6536
6568
6537 * Added copyright/license notes to all code files (except
6569 * Added copyright/license notes to all code files (except
6538 DPyGetOpt). For the time being, LGPL. That could change.
6570 DPyGetOpt). For the time being, LGPL. That could change.
6539
6571
6540 * Rewrote a much nicer README, updated INSTALL, cleaned up
6572 * Rewrote a much nicer README, updated INSTALL, cleaned up
6541 ipythonrc-* samples.
6573 ipythonrc-* samples.
6542
6574
6543 * Overall code/documentation cleanup. Basically ready for
6575 * Overall code/documentation cleanup. Basically ready for
6544 release. Only remaining thing: licence decision (LGPL?).
6576 release. Only remaining thing: licence decision (LGPL?).
6545
6577
6546 * Converted load_config to a class, ConfigLoader. Now recursion
6578 * Converted load_config to a class, ConfigLoader. Now recursion
6547 control is better organized. Doesn't include the same file twice.
6579 control is better organized. Doesn't include the same file twice.
6548
6580
6549 2001-11-29 Fernando Perez <fperez@colorado.edu>
6581 2001-11-29 Fernando Perez <fperez@colorado.edu>
6550
6582
6551 * Got input history working. Changed output history variables from
6583 * Got input history working. Changed output history variables from
6552 _p to _o so that _i is for input and _o for output. Just cleaner
6584 _p to _o so that _i is for input and _o for output. Just cleaner
6553 convention.
6585 convention.
6554
6586
6555 * Implemented parametric aliases. This pretty much allows the
6587 * Implemented parametric aliases. This pretty much allows the
6556 alias system to offer full-blown shell convenience, I think.
6588 alias system to offer full-blown shell convenience, I think.
6557
6589
6558 * Version 0.1.17 released, 0.1.18 opened.
6590 * Version 0.1.17 released, 0.1.18 opened.
6559
6591
6560 * dot_ipython/ipythonrc (alias): added documentation.
6592 * dot_ipython/ipythonrc (alias): added documentation.
6561 (xcolor): Fixed small bug (xcolors -> xcolor)
6593 (xcolor): Fixed small bug (xcolors -> xcolor)
6562
6594
6563 * Changed the alias system. Now alias is a magic command to define
6595 * Changed the alias system. Now alias is a magic command to define
6564 aliases just like the shell. Rationale: the builtin magics should
6596 aliases just like the shell. Rationale: the builtin magics should
6565 be there for things deeply connected to IPython's
6597 be there for things deeply connected to IPython's
6566 architecture. And this is a much lighter system for what I think
6598 architecture. And this is a much lighter system for what I think
6567 is the really important feature: allowing users to define quickly
6599 is the really important feature: allowing users to define quickly
6568 magics that will do shell things for them, so they can customize
6600 magics that will do shell things for them, so they can customize
6569 IPython easily to match their work habits. If someone is really
6601 IPython easily to match their work habits. If someone is really
6570 desperate to have another name for a builtin alias, they can
6602 desperate to have another name for a builtin alias, they can
6571 always use __IP.magic_newname = __IP.magic_oldname. Hackish but
6603 always use __IP.magic_newname = __IP.magic_oldname. Hackish but
6572 works.
6604 works.
6573
6605
6574 2001-11-28 Fernando Perez <fperez@colorado.edu>
6606 2001-11-28 Fernando Perez <fperez@colorado.edu>
6575
6607
6576 * Changed @file so that it opens the source file at the proper
6608 * Changed @file so that it opens the source file at the proper
6577 line. Since it uses less, if your EDITOR environment is
6609 line. Since it uses less, if your EDITOR environment is
6578 configured, typing v will immediately open your editor of choice
6610 configured, typing v will immediately open your editor of choice
6579 right at the line where the object is defined. Not as quick as
6611 right at the line where the object is defined. Not as quick as
6580 having a direct @edit command, but for all intents and purposes it
6612 having a direct @edit command, but for all intents and purposes it
6581 works. And I don't have to worry about writing @edit to deal with
6613 works. And I don't have to worry about writing @edit to deal with
6582 all the editors, less does that.
6614 all the editors, less does that.
6583
6615
6584 * Version 0.1.16 released, 0.1.17 opened.
6616 * Version 0.1.16 released, 0.1.17 opened.
6585
6617
6586 * Fixed some nasty bugs in the page/page_dumb combo that could
6618 * Fixed some nasty bugs in the page/page_dumb combo that could
6587 crash IPython.
6619 crash IPython.
6588
6620
6589 2001-11-27 Fernando Perez <fperez@colorado.edu>
6621 2001-11-27 Fernando Perez <fperez@colorado.edu>
6590
6622
6591 * Version 0.1.15 released, 0.1.16 opened.
6623 * Version 0.1.15 released, 0.1.16 opened.
6592
6624
6593 * Finally got ? and ?? to work for undefined things: now it's
6625 * Finally got ? and ?? to work for undefined things: now it's
6594 possible to type {}.get? and get information about the get method
6626 possible to type {}.get? and get information about the get method
6595 of dicts, or os.path? even if only os is defined (so technically
6627 of dicts, or os.path? even if only os is defined (so technically
6596 os.path isn't). Works at any level. For example, after import os,
6628 os.path isn't). Works at any level. For example, after import os,
6597 os?, os.path?, os.path.abspath? all work. This is great, took some
6629 os?, os.path?, os.path.abspath? all work. This is great, took some
6598 work in _ofind.
6630 work in _ofind.
6599
6631
6600 * Fixed more bugs with logging. The sanest way to do it was to add
6632 * Fixed more bugs with logging. The sanest way to do it was to add
6601 to @log a 'mode' parameter. Killed two in one shot (this mode
6633 to @log a 'mode' parameter. Killed two in one shot (this mode
6602 option was a request of Janko's). I think it's finally clean
6634 option was a request of Janko's). I think it's finally clean
6603 (famous last words).
6635 (famous last words).
6604
6636
6605 * Added a page_dumb() pager which does a decent job of paging on
6637 * Added a page_dumb() pager which does a decent job of paging on
6606 screen, if better things (like less) aren't available. One less
6638 screen, if better things (like less) aren't available. One less
6607 unix dependency (someday maybe somebody will port this to
6639 unix dependency (someday maybe somebody will port this to
6608 windows).
6640 windows).
6609
6641
6610 * Fixed problem in magic_log: would lock of logging out if log
6642 * Fixed problem in magic_log: would lock of logging out if log
6611 creation failed (because it would still think it had succeeded).
6643 creation failed (because it would still think it had succeeded).
6612
6644
6613 * Improved the page() function using curses to auto-detect screen
6645 * Improved the page() function using curses to auto-detect screen
6614 size. Now it can make a much better decision on whether to print
6646 size. Now it can make a much better decision on whether to print
6615 or page a string. Option screen_length was modified: a value 0
6647 or page a string. Option screen_length was modified: a value 0
6616 means auto-detect, and that's the default now.
6648 means auto-detect, and that's the default now.
6617
6649
6618 * Version 0.1.14 released, 0.1.15 opened. I think this is ready to
6650 * Version 0.1.14 released, 0.1.15 opened. I think this is ready to
6619 go out. I'll test it for a few days, then talk to Janko about
6651 go out. I'll test it for a few days, then talk to Janko about
6620 licences and announce it.
6652 licences and announce it.
6621
6653
6622 * Fixed the length of the auto-generated ---> prompt which appears
6654 * Fixed the length of the auto-generated ---> prompt which appears
6623 for auto-parens and auto-quotes. Getting this right isn't trivial,
6655 for auto-parens and auto-quotes. Getting this right isn't trivial,
6624 with all the color escapes, different prompt types and optional
6656 with all the color escapes, different prompt types and optional
6625 separators. But it seems to be working in all the combinations.
6657 separators. But it seems to be working in all the combinations.
6626
6658
6627 2001-11-26 Fernando Perez <fperez@colorado.edu>
6659 2001-11-26 Fernando Perez <fperez@colorado.edu>
6628
6660
6629 * Wrote a regexp filter to get option types from the option names
6661 * Wrote a regexp filter to get option types from the option names
6630 string. This eliminates the need to manually keep two duplicate
6662 string. This eliminates the need to manually keep two duplicate
6631 lists.
6663 lists.
6632
6664
6633 * Removed the unneeded check_option_names. Now options are handled
6665 * Removed the unneeded check_option_names. Now options are handled
6634 in a much saner manner and it's easy to visually check that things
6666 in a much saner manner and it's easy to visually check that things
6635 are ok.
6667 are ok.
6636
6668
6637 * Updated version numbers on all files I modified to carry a
6669 * Updated version numbers on all files I modified to carry a
6638 notice so Janko and Nathan have clear version markers.
6670 notice so Janko and Nathan have clear version markers.
6639
6671
6640 * Updated docstring for ultraTB with my changes. I should send
6672 * Updated docstring for ultraTB with my changes. I should send
6641 this to Nathan.
6673 this to Nathan.
6642
6674
6643 * Lots of small fixes. Ran everything through pychecker again.
6675 * Lots of small fixes. Ran everything through pychecker again.
6644
6676
6645 * Made loading of deep_reload an cmd line option. If it's not too
6677 * Made loading of deep_reload an cmd line option. If it's not too
6646 kosher, now people can just disable it. With -nodeep_reload it's
6678 kosher, now people can just disable it. With -nodeep_reload it's
6647 still available as dreload(), it just won't overwrite reload().
6679 still available as dreload(), it just won't overwrite reload().
6648
6680
6649 * Moved many options to the no| form (-opt and -noopt
6681 * Moved many options to the no| form (-opt and -noopt
6650 accepted). Cleaner.
6682 accepted). Cleaner.
6651
6683
6652 * Changed magic_log so that if called with no parameters, it uses
6684 * Changed magic_log so that if called with no parameters, it uses
6653 'rotate' mode. That way auto-generated logs aren't automatically
6685 'rotate' mode. That way auto-generated logs aren't automatically
6654 over-written. For normal logs, now a backup is made if it exists
6686 over-written. For normal logs, now a backup is made if it exists
6655 (only 1 level of backups). A new 'backup' mode was added to the
6687 (only 1 level of backups). A new 'backup' mode was added to the
6656 Logger class to support this. This was a request by Janko.
6688 Logger class to support this. This was a request by Janko.
6657
6689
6658 * Added @logoff/@logon to stop/restart an active log.
6690 * Added @logoff/@logon to stop/restart an active log.
6659
6691
6660 * Fixed a lot of bugs in log saving/replay. It was pretty
6692 * Fixed a lot of bugs in log saving/replay. It was pretty
6661 broken. Now special lines (!@,/) appear properly in the command
6693 broken. Now special lines (!@,/) appear properly in the command
6662 history after a log replay.
6694 history after a log replay.
6663
6695
6664 * Tried and failed to implement full session saving via pickle. My
6696 * Tried and failed to implement full session saving via pickle. My
6665 idea was to pickle __main__.__dict__, but modules can't be
6697 idea was to pickle __main__.__dict__, but modules can't be
6666 pickled. This would be a better alternative to replaying logs, but
6698 pickled. This would be a better alternative to replaying logs, but
6667 seems quite tricky to get to work. Changed -session to be called
6699 seems quite tricky to get to work. Changed -session to be called
6668 -logplay, which more accurately reflects what it does. And if we
6700 -logplay, which more accurately reflects what it does. And if we
6669 ever get real session saving working, -session is now available.
6701 ever get real session saving working, -session is now available.
6670
6702
6671 * Implemented color schemes for prompts also. As for tracebacks,
6703 * Implemented color schemes for prompts also. As for tracebacks,
6672 currently only NoColor and Linux are supported. But now the
6704 currently only NoColor and Linux are supported. But now the
6673 infrastructure is in place, based on a generic ColorScheme
6705 infrastructure is in place, based on a generic ColorScheme
6674 class. So writing and activating new schemes both for the prompts
6706 class. So writing and activating new schemes both for the prompts
6675 and the tracebacks should be straightforward.
6707 and the tracebacks should be straightforward.
6676
6708
6677 * Version 0.1.13 released, 0.1.14 opened.
6709 * Version 0.1.13 released, 0.1.14 opened.
6678
6710
6679 * Changed handling of options for output cache. Now counter is
6711 * Changed handling of options for output cache. Now counter is
6680 hardwired starting at 1 and one specifies the maximum number of
6712 hardwired starting at 1 and one specifies the maximum number of
6681 entries *in the outcache* (not the max prompt counter). This is
6713 entries *in the outcache* (not the max prompt counter). This is
6682 much better, since many statements won't increase the cache
6714 much better, since many statements won't increase the cache
6683 count. It also eliminated some confusing options, now there's only
6715 count. It also eliminated some confusing options, now there's only
6684 one: cache_size.
6716 one: cache_size.
6685
6717
6686 * Added 'alias' magic function and magic_alias option in the
6718 * Added 'alias' magic function and magic_alias option in the
6687 ipythonrc file. Now the user can easily define whatever names he
6719 ipythonrc file. Now the user can easily define whatever names he
6688 wants for the magic functions without having to play weird
6720 wants for the magic functions without having to play weird
6689 namespace games. This gives IPython a real shell-like feel.
6721 namespace games. This gives IPython a real shell-like feel.
6690
6722
6691 * Fixed doc/?/?? for magics. Now all work, in all forms (explicit
6723 * Fixed doc/?/?? for magics. Now all work, in all forms (explicit
6692 @ or not).
6724 @ or not).
6693
6725
6694 This was one of the last remaining 'visible' bugs (that I know
6726 This was one of the last remaining 'visible' bugs (that I know
6695 of). I think if I can clean up the session loading so it works
6727 of). I think if I can clean up the session loading so it works
6696 100% I'll release a 0.2.0 version on c.p.l (talk to Janko first
6728 100% I'll release a 0.2.0 version on c.p.l (talk to Janko first
6697 about licensing).
6729 about licensing).
6698
6730
6699 2001-11-25 Fernando Perez <fperez@colorado.edu>
6731 2001-11-25 Fernando Perez <fperez@colorado.edu>
6700
6732
6701 * Rewrote somewhat oinfo (?/??). Nicer, now uses page() and
6733 * Rewrote somewhat oinfo (?/??). Nicer, now uses page() and
6702 there's a cleaner distinction between what ? and ?? show.
6734 there's a cleaner distinction between what ? and ?? show.
6703
6735
6704 * Added screen_length option. Now the user can define his own
6736 * Added screen_length option. Now the user can define his own
6705 screen size for page() operations.
6737 screen size for page() operations.
6706
6738
6707 * Implemented magic shell-like functions with automatic code
6739 * Implemented magic shell-like functions with automatic code
6708 generation. Now adding another function is just a matter of adding
6740 generation. Now adding another function is just a matter of adding
6709 an entry to a dict, and the function is dynamically generated at
6741 an entry to a dict, and the function is dynamically generated at
6710 run-time. Python has some really cool features!
6742 run-time. Python has some really cool features!
6711
6743
6712 * Renamed many options to cleanup conventions a little. Now all
6744 * Renamed many options to cleanup conventions a little. Now all
6713 are lowercase, and only underscores where needed. Also in the code
6745 are lowercase, and only underscores where needed. Also in the code
6714 option name tables are clearer.
6746 option name tables are clearer.
6715
6747
6716 * Changed prompts a little. Now input is 'In [n]:' instead of
6748 * Changed prompts a little. Now input is 'In [n]:' instead of
6717 'In[n]:='. This allows it the numbers to be aligned with the
6749 'In[n]:='. This allows it the numbers to be aligned with the
6718 Out[n] numbers, and removes usage of ':=' which doesn't exist in
6750 Out[n] numbers, and removes usage of ':=' which doesn't exist in
6719 Python (it was a Mathematica thing). The '...' continuation prompt
6751 Python (it was a Mathematica thing). The '...' continuation prompt
6720 was also changed a little to align better.
6752 was also changed a little to align better.
6721
6753
6722 * Fixed bug when flushing output cache. Not all _p<n> variables
6754 * Fixed bug when flushing output cache. Not all _p<n> variables
6723 exist, so their deletion needs to be wrapped in a try:
6755 exist, so their deletion needs to be wrapped in a try:
6724
6756
6725 * Figured out how to properly use inspect.formatargspec() (it
6757 * Figured out how to properly use inspect.formatargspec() (it
6726 requires the args preceded by *). So I removed all the code from
6758 requires the args preceded by *). So I removed all the code from
6727 _get_pdef in Magic, which was just replicating that.
6759 _get_pdef in Magic, which was just replicating that.
6728
6760
6729 * Added test to prefilter to allow redefining magic function names
6761 * Added test to prefilter to allow redefining magic function names
6730 as variables. This is ok, since the @ form is always available,
6762 as variables. This is ok, since the @ form is always available,
6731 but whe should allow the user to define a variable called 'ls' if
6763 but whe should allow the user to define a variable called 'ls' if
6732 he needs it.
6764 he needs it.
6733
6765
6734 * Moved the ToDo information from README into a separate ToDo.
6766 * Moved the ToDo information from README into a separate ToDo.
6735
6767
6736 * General code cleanup and small bugfixes. I think it's close to a
6768 * General code cleanup and small bugfixes. I think it's close to a
6737 state where it can be released, obviously with a big 'beta'
6769 state where it can be released, obviously with a big 'beta'
6738 warning on it.
6770 warning on it.
6739
6771
6740 * Got the magic function split to work. Now all magics are defined
6772 * Got the magic function split to work. Now all magics are defined
6741 in a separate class. It just organizes things a bit, and now
6773 in a separate class. It just organizes things a bit, and now
6742 Xemacs behaves nicer (it was choking on InteractiveShell b/c it
6774 Xemacs behaves nicer (it was choking on InteractiveShell b/c it
6743 was too long).
6775 was too long).
6744
6776
6745 * Changed @clear to @reset to avoid potential confusions with
6777 * Changed @clear to @reset to avoid potential confusions with
6746 the shell command clear. Also renamed @cl to @clear, which does
6778 the shell command clear. Also renamed @cl to @clear, which does
6747 exactly what people expect it to from their shell experience.
6779 exactly what people expect it to from their shell experience.
6748
6780
6749 Added a check to the @reset command (since it's so
6781 Added a check to the @reset command (since it's so
6750 destructive, it's probably a good idea to ask for confirmation).
6782 destructive, it's probably a good idea to ask for confirmation).
6751 But now reset only works for full namespace resetting. Since the
6783 But now reset only works for full namespace resetting. Since the
6752 del keyword is already there for deleting a few specific
6784 del keyword is already there for deleting a few specific
6753 variables, I don't see the point of having a redundant magic
6785 variables, I don't see the point of having a redundant magic
6754 function for the same task.
6786 function for the same task.
6755
6787
6756 2001-11-24 Fernando Perez <fperez@colorado.edu>
6788 2001-11-24 Fernando Perez <fperez@colorado.edu>
6757
6789
6758 * Updated the builtin docs (esp. the ? ones).
6790 * Updated the builtin docs (esp. the ? ones).
6759
6791
6760 * Ran all the code through pychecker. Not terribly impressed with
6792 * Ran all the code through pychecker. Not terribly impressed with
6761 it: lots of spurious warnings and didn't really find anything of
6793 it: lots of spurious warnings and didn't really find anything of
6762 substance (just a few modules being imported and not used).
6794 substance (just a few modules being imported and not used).
6763
6795
6764 * Implemented the new ultraTB functionality into IPython. New
6796 * Implemented the new ultraTB functionality into IPython. New
6765 option: xcolors. This chooses color scheme. xmode now only selects
6797 option: xcolors. This chooses color scheme. xmode now only selects
6766 between Plain and Verbose. Better orthogonality.
6798 between Plain and Verbose. Better orthogonality.
6767
6799
6768 * Large rewrite of ultraTB. Much cleaner now, with a separation of
6800 * Large rewrite of ultraTB. Much cleaner now, with a separation of
6769 mode and color scheme for the exception handlers. Now it's
6801 mode and color scheme for the exception handlers. Now it's
6770 possible to have the verbose traceback with no coloring.
6802 possible to have the verbose traceback with no coloring.
6771
6803
6772 2001-11-23 Fernando Perez <fperez@colorado.edu>
6804 2001-11-23 Fernando Perez <fperez@colorado.edu>
6773
6805
6774 * Version 0.1.12 released, 0.1.13 opened.
6806 * Version 0.1.12 released, 0.1.13 opened.
6775
6807
6776 * Removed option to set auto-quote and auto-paren escapes by
6808 * Removed option to set auto-quote and auto-paren escapes by
6777 user. The chances of breaking valid syntax are just too high. If
6809 user. The chances of breaking valid syntax are just too high. If
6778 someone *really* wants, they can always dig into the code.
6810 someone *really* wants, they can always dig into the code.
6779
6811
6780 * Made prompt separators configurable.
6812 * Made prompt separators configurable.
6781
6813
6782 2001-11-22 Fernando Perez <fperez@colorado.edu>
6814 2001-11-22 Fernando Perez <fperez@colorado.edu>
6783
6815
6784 * Small bugfixes in many places.
6816 * Small bugfixes in many places.
6785
6817
6786 * Removed the MyCompleter class from ipplib. It seemed redundant
6818 * Removed the MyCompleter class from ipplib. It seemed redundant
6787 with the C-p,C-n history search functionality. Less code to
6819 with the C-p,C-n history search functionality. Less code to
6788 maintain.
6820 maintain.
6789
6821
6790 * Moved all the original ipython.py code into ipythonlib.py. Right
6822 * Moved all the original ipython.py code into ipythonlib.py. Right
6791 now it's just one big dump into a function called make_IPython, so
6823 now it's just one big dump into a function called make_IPython, so
6792 no real modularity has been gained. But at least it makes the
6824 no real modularity has been gained. But at least it makes the
6793 wrapper script tiny, and since ipythonlib is a module, it gets
6825 wrapper script tiny, and since ipythonlib is a module, it gets
6794 compiled and startup is much faster.
6826 compiled and startup is much faster.
6795
6827
6796 This is a reasobably 'deep' change, so we should test it for a
6828 This is a reasobably 'deep' change, so we should test it for a
6797 while without messing too much more with the code.
6829 while without messing too much more with the code.
6798
6830
6799 2001-11-21 Fernando Perez <fperez@colorado.edu>
6831 2001-11-21 Fernando Perez <fperez@colorado.edu>
6800
6832
6801 * Version 0.1.11 released, 0.1.12 opened for further work.
6833 * Version 0.1.11 released, 0.1.12 opened for further work.
6802
6834
6803 * Removed dependency on Itpl. It was only needed in one place. It
6835 * Removed dependency on Itpl. It was only needed in one place. It
6804 would be nice if this became part of python, though. It makes life
6836 would be nice if this became part of python, though. It makes life
6805 *a lot* easier in some cases.
6837 *a lot* easier in some cases.
6806
6838
6807 * Simplified the prefilter code a bit. Now all handlers are
6839 * Simplified the prefilter code a bit. Now all handlers are
6808 expected to explicitly return a value (at least a blank string).
6840 expected to explicitly return a value (at least a blank string).
6809
6841
6810 * Heavy edits in ipplib. Removed the help system altogether. Now
6842 * Heavy edits in ipplib. Removed the help system altogether. Now
6811 obj?/?? is used for inspecting objects, a magic @doc prints
6843 obj?/?? is used for inspecting objects, a magic @doc prints
6812 docstrings, and full-blown Python help is accessed via the 'help'
6844 docstrings, and full-blown Python help is accessed via the 'help'
6813 keyword. This cleans up a lot of code (less to maintain) and does
6845 keyword. This cleans up a lot of code (less to maintain) and does
6814 the job. Since 'help' is now a standard Python component, might as
6846 the job. Since 'help' is now a standard Python component, might as
6815 well use it and remove duplicate functionality.
6847 well use it and remove duplicate functionality.
6816
6848
6817 Also removed the option to use ipplib as a standalone program. By
6849 Also removed the option to use ipplib as a standalone program. By
6818 now it's too dependent on other parts of IPython to function alone.
6850 now it's too dependent on other parts of IPython to function alone.
6819
6851
6820 * Fixed bug in genutils.pager. It would crash if the pager was
6852 * Fixed bug in genutils.pager. It would crash if the pager was
6821 exited immediately after opening (broken pipe).
6853 exited immediately after opening (broken pipe).
6822
6854
6823 * Trimmed down the VerboseTB reporting a little. The header is
6855 * Trimmed down the VerboseTB reporting a little. The header is
6824 much shorter now and the repeated exception arguments at the end
6856 much shorter now and the repeated exception arguments at the end
6825 have been removed. For interactive use the old header seemed a bit
6857 have been removed. For interactive use the old header seemed a bit
6826 excessive.
6858 excessive.
6827
6859
6828 * Fixed small bug in output of @whos for variables with multi-word
6860 * Fixed small bug in output of @whos for variables with multi-word
6829 types (only first word was displayed).
6861 types (only first word was displayed).
6830
6862
6831 2001-11-17 Fernando Perez <fperez@colorado.edu>
6863 2001-11-17 Fernando Perez <fperez@colorado.edu>
6832
6864
6833 * Version 0.1.10 released, 0.1.11 opened for further work.
6865 * Version 0.1.10 released, 0.1.11 opened for further work.
6834
6866
6835 * Modified dirs and friends. dirs now *returns* the stack (not
6867 * Modified dirs and friends. dirs now *returns* the stack (not
6836 prints), so one can manipulate it as a variable. Convenient to
6868 prints), so one can manipulate it as a variable. Convenient to
6837 travel along many directories.
6869 travel along many directories.
6838
6870
6839 * Fixed bug in magic_pdef: would only work with functions with
6871 * Fixed bug in magic_pdef: would only work with functions with
6840 arguments with default values.
6872 arguments with default values.
6841
6873
6842 2001-11-14 Fernando Perez <fperez@colorado.edu>
6874 2001-11-14 Fernando Perez <fperez@colorado.edu>
6843
6875
6844 * Added the PhysicsInput stuff to dot_ipython so it ships as an
6876 * Added the PhysicsInput stuff to dot_ipython so it ships as an
6845 example with IPython. Various other minor fixes and cleanups.
6877 example with IPython. Various other minor fixes and cleanups.
6846
6878
6847 * Version 0.1.9 released, 0.1.10 opened for further work.
6879 * Version 0.1.9 released, 0.1.10 opened for further work.
6848
6880
6849 * Added sys.path to the list of directories searched in the
6881 * Added sys.path to the list of directories searched in the
6850 execfile= option. It used to be the current directory and the
6882 execfile= option. It used to be the current directory and the
6851 user's IPYTHONDIR only.
6883 user's IPYTHONDIR only.
6852
6884
6853 2001-11-13 Fernando Perez <fperez@colorado.edu>
6885 2001-11-13 Fernando Perez <fperez@colorado.edu>
6854
6886
6855 * Reinstated the raw_input/prefilter separation that Janko had
6887 * Reinstated the raw_input/prefilter separation that Janko had
6856 initially. This gives a more convenient setup for extending the
6888 initially. This gives a more convenient setup for extending the
6857 pre-processor from the outside: raw_input always gets a string,
6889 pre-processor from the outside: raw_input always gets a string,
6858 and prefilter has to process it. We can then redefine prefilter
6890 and prefilter has to process it. We can then redefine prefilter
6859 from the outside and implement extensions for special
6891 from the outside and implement extensions for special
6860 purposes.
6892 purposes.
6861
6893
6862 Today I got one for inputting PhysicalQuantity objects
6894 Today I got one for inputting PhysicalQuantity objects
6863 (from Scientific) without needing any function calls at
6895 (from Scientific) without needing any function calls at
6864 all. Extremely convenient, and it's all done as a user-level
6896 all. Extremely convenient, and it's all done as a user-level
6865 extension (no IPython code was touched). Now instead of:
6897 extension (no IPython code was touched). Now instead of:
6866 a = PhysicalQuantity(4.2,'m/s**2')
6898 a = PhysicalQuantity(4.2,'m/s**2')
6867 one can simply say
6899 one can simply say
6868 a = 4.2 m/s**2
6900 a = 4.2 m/s**2
6869 or even
6901 or even
6870 a = 4.2 m/s^2
6902 a = 4.2 m/s^2
6871
6903
6872 I use this, but it's also a proof of concept: IPython really is
6904 I use this, but it's also a proof of concept: IPython really is
6873 fully user-extensible, even at the level of the parsing of the
6905 fully user-extensible, even at the level of the parsing of the
6874 command line. It's not trivial, but it's perfectly doable.
6906 command line. It's not trivial, but it's perfectly doable.
6875
6907
6876 * Added 'add_flip' method to inclusion conflict resolver. Fixes
6908 * Added 'add_flip' method to inclusion conflict resolver. Fixes
6877 the problem of modules being loaded in the inverse order in which
6909 the problem of modules being loaded in the inverse order in which
6878 they were defined in
6910 they were defined in
6879
6911
6880 * Version 0.1.8 released, 0.1.9 opened for further work.
6912 * Version 0.1.8 released, 0.1.9 opened for further work.
6881
6913
6882 * Added magics pdef, source and file. They respectively show the
6914 * Added magics pdef, source and file. They respectively show the
6883 definition line ('prototype' in C), source code and full python
6915 definition line ('prototype' in C), source code and full python
6884 file for any callable object. The object inspector oinfo uses
6916 file for any callable object. The object inspector oinfo uses
6885 these to show the same information.
6917 these to show the same information.
6886
6918
6887 * Version 0.1.7 released, 0.1.8 opened for further work.
6919 * Version 0.1.7 released, 0.1.8 opened for further work.
6888
6920
6889 * Separated all the magic functions into a class called Magic. The
6921 * Separated all the magic functions into a class called Magic. The
6890 InteractiveShell class was becoming too big for Xemacs to handle
6922 InteractiveShell class was becoming too big for Xemacs to handle
6891 (de-indenting a line would lock it up for 10 seconds while it
6923 (de-indenting a line would lock it up for 10 seconds while it
6892 backtracked on the whole class!)
6924 backtracked on the whole class!)
6893
6925
6894 FIXME: didn't work. It can be done, but right now namespaces are
6926 FIXME: didn't work. It can be done, but right now namespaces are
6895 all messed up. Do it later (reverted it for now, so at least
6927 all messed up. Do it later (reverted it for now, so at least
6896 everything works as before).
6928 everything works as before).
6897
6929
6898 * Got the object introspection system (magic_oinfo) working! I
6930 * Got the object introspection system (magic_oinfo) working! I
6899 think this is pretty much ready for release to Janko, so he can
6931 think this is pretty much ready for release to Janko, so he can
6900 test it for a while and then announce it. Pretty much 100% of what
6932 test it for a while and then announce it. Pretty much 100% of what
6901 I wanted for the 'phase 1' release is ready. Happy, tired.
6933 I wanted for the 'phase 1' release is ready. Happy, tired.
6902
6934
6903 2001-11-12 Fernando Perez <fperez@colorado.edu>
6935 2001-11-12 Fernando Perez <fperez@colorado.edu>
6904
6936
6905 * Version 0.1.6 released, 0.1.7 opened for further work.
6937 * Version 0.1.6 released, 0.1.7 opened for further work.
6906
6938
6907 * Fixed bug in printing: it used to test for truth before
6939 * Fixed bug in printing: it used to test for truth before
6908 printing, so 0 wouldn't print. Now checks for None.
6940 printing, so 0 wouldn't print. Now checks for None.
6909
6941
6910 * Fixed bug where auto-execs increase the prompt counter by 2 (b/c
6942 * Fixed bug where auto-execs increase the prompt counter by 2 (b/c
6911 they have to call len(str(sys.ps1)) ). But the fix is ugly, it
6943 they have to call len(str(sys.ps1)) ). But the fix is ugly, it
6912 reaches by hand into the outputcache. Think of a better way to do
6944 reaches by hand into the outputcache. Think of a better way to do
6913 this later.
6945 this later.
6914
6946
6915 * Various small fixes thanks to Nathan's comments.
6947 * Various small fixes thanks to Nathan's comments.
6916
6948
6917 * Changed magic_pprint to magic_Pprint. This way it doesn't
6949 * Changed magic_pprint to magic_Pprint. This way it doesn't
6918 collide with pprint() and the name is consistent with the command
6950 collide with pprint() and the name is consistent with the command
6919 line option.
6951 line option.
6920
6952
6921 * Changed prompt counter behavior to be fully like
6953 * Changed prompt counter behavior to be fully like
6922 Mathematica's. That is, even input that doesn't return a result
6954 Mathematica's. That is, even input that doesn't return a result
6923 raises the prompt counter. The old behavior was kind of confusing
6955 raises the prompt counter. The old behavior was kind of confusing
6924 (getting the same prompt number several times if the operation
6956 (getting the same prompt number several times if the operation
6925 didn't return a result).
6957 didn't return a result).
6926
6958
6927 * Fixed Nathan's last name in a couple of places (Gray, not Graham).
6959 * Fixed Nathan's last name in a couple of places (Gray, not Graham).
6928
6960
6929 * Fixed -Classic mode (wasn't working anymore).
6961 * Fixed -Classic mode (wasn't working anymore).
6930
6962
6931 * Added colored prompts using Nathan's new code. Colors are
6963 * Added colored prompts using Nathan's new code. Colors are
6932 currently hardwired, they can be user-configurable. For
6964 currently hardwired, they can be user-configurable. For
6933 developers, they can be chosen in file ipythonlib.py, at the
6965 developers, they can be chosen in file ipythonlib.py, at the
6934 beginning of the CachedOutput class def.
6966 beginning of the CachedOutput class def.
6935
6967
6936 2001-11-11 Fernando Perez <fperez@colorado.edu>
6968 2001-11-11 Fernando Perez <fperez@colorado.edu>
6937
6969
6938 * Version 0.1.5 released, 0.1.6 opened for further work.
6970 * Version 0.1.5 released, 0.1.6 opened for further work.
6939
6971
6940 * Changed magic_env to *return* the environment as a dict (not to
6972 * Changed magic_env to *return* the environment as a dict (not to
6941 print it). This way it prints, but it can also be processed.
6973 print it). This way it prints, but it can also be processed.
6942
6974
6943 * Added Verbose exception reporting to interactive
6975 * Added Verbose exception reporting to interactive
6944 exceptions. Very nice, now even 1/0 at the prompt gives a verbose
6976 exceptions. Very nice, now even 1/0 at the prompt gives a verbose
6945 traceback. Had to make some changes to the ultraTB file. This is
6977 traceback. Had to make some changes to the ultraTB file. This is
6946 probably the last 'big' thing in my mental todo list. This ties
6978 probably the last 'big' thing in my mental todo list. This ties
6947 in with the next entry:
6979 in with the next entry:
6948
6980
6949 * Changed -Xi and -Xf to a single -xmode option. Now all the user
6981 * Changed -Xi and -Xf to a single -xmode option. Now all the user
6950 has to specify is Plain, Color or Verbose for all exception
6982 has to specify is Plain, Color or Verbose for all exception
6951 handling.
6983 handling.
6952
6984
6953 * Removed ShellServices option. All this can really be done via
6985 * Removed ShellServices option. All this can really be done via
6954 the magic system. It's easier to extend, cleaner and has automatic
6986 the magic system. It's easier to extend, cleaner and has automatic
6955 namespace protection and documentation.
6987 namespace protection and documentation.
6956
6988
6957 2001-11-09 Fernando Perez <fperez@colorado.edu>
6989 2001-11-09 Fernando Perez <fperez@colorado.edu>
6958
6990
6959 * Fixed bug in output cache flushing (missing parameter to
6991 * Fixed bug in output cache flushing (missing parameter to
6960 __init__). Other small bugs fixed (found using pychecker).
6992 __init__). Other small bugs fixed (found using pychecker).
6961
6993
6962 * Version 0.1.4 opened for bugfixing.
6994 * Version 0.1.4 opened for bugfixing.
6963
6995
6964 2001-11-07 Fernando Perez <fperez@colorado.edu>
6996 2001-11-07 Fernando Perez <fperez@colorado.edu>
6965
6997
6966 * Version 0.1.3 released, mainly because of the raw_input bug.
6998 * Version 0.1.3 released, mainly because of the raw_input bug.
6967
6999
6968 * Fixed NASTY bug in raw_input: input line wasn't properly parsed
7000 * Fixed NASTY bug in raw_input: input line wasn't properly parsed
6969 and when testing for whether things were callable, a call could
7001 and when testing for whether things were callable, a call could
6970 actually be made to certain functions. They would get called again
7002 actually be made to certain functions. They would get called again
6971 once 'really' executed, with a resulting double call. A disaster
7003 once 'really' executed, with a resulting double call. A disaster
6972 in many cases (list.reverse() would never work!).
7004 in many cases (list.reverse() would never work!).
6973
7005
6974 * Removed prefilter() function, moved its code to raw_input (which
7006 * Removed prefilter() function, moved its code to raw_input (which
6975 after all was just a near-empty caller for prefilter). This saves
7007 after all was just a near-empty caller for prefilter). This saves
6976 a function call on every prompt, and simplifies the class a tiny bit.
7008 a function call on every prompt, and simplifies the class a tiny bit.
6977
7009
6978 * Fix _ip to __ip name in magic example file.
7010 * Fix _ip to __ip name in magic example file.
6979
7011
6980 * Changed 'tar -x -f' to 'tar xvf' in auto-installer. This should
7012 * Changed 'tar -x -f' to 'tar xvf' in auto-installer. This should
6981 work with non-gnu versions of tar.
7013 work with non-gnu versions of tar.
6982
7014
6983 2001-11-06 Fernando Perez <fperez@colorado.edu>
7015 2001-11-06 Fernando Perez <fperez@colorado.edu>
6984
7016
6985 * Version 0.1.2. Just to keep track of the recent changes.
7017 * Version 0.1.2. Just to keep track of the recent changes.
6986
7018
6987 * Fixed nasty bug in output prompt routine. It used to check 'if
7019 * Fixed nasty bug in output prompt routine. It used to check 'if
6988 arg != None...'. Problem is, this fails if arg implements a
7020 arg != None...'. Problem is, this fails if arg implements a
6989 special comparison (__cmp__) which disallows comparing to
7021 special comparison (__cmp__) which disallows comparing to
6990 None. Found it when trying to use the PhysicalQuantity module from
7022 None. Found it when trying to use the PhysicalQuantity module from
6991 ScientificPython.
7023 ScientificPython.
6992
7024
6993 2001-11-05 Fernando Perez <fperez@colorado.edu>
7025 2001-11-05 Fernando Perez <fperez@colorado.edu>
6994
7026
6995 * Also added dirs. Now the pushd/popd/dirs family functions
7027 * Also added dirs. Now the pushd/popd/dirs family functions
6996 basically like the shell, with the added convenience of going home
7028 basically like the shell, with the added convenience of going home
6997 when called with no args.
7029 when called with no args.
6998
7030
6999 * pushd/popd slightly modified to mimic shell behavior more
7031 * pushd/popd slightly modified to mimic shell behavior more
7000 closely.
7032 closely.
7001
7033
7002 * Added env,pushd,popd from ShellServices as magic functions. I
7034 * Added env,pushd,popd from ShellServices as magic functions. I
7003 think the cleanest will be to port all desired functions from
7035 think the cleanest will be to port all desired functions from
7004 ShellServices as magics and remove ShellServices altogether. This
7036 ShellServices as magics and remove ShellServices altogether. This
7005 will provide a single, clean way of adding functionality
7037 will provide a single, clean way of adding functionality
7006 (shell-type or otherwise) to IP.
7038 (shell-type or otherwise) to IP.
7007
7039
7008 2001-11-04 Fernando Perez <fperez@colorado.edu>
7040 2001-11-04 Fernando Perez <fperez@colorado.edu>
7009
7041
7010 * Added .ipython/ directory to sys.path. This way users can keep
7042 * Added .ipython/ directory to sys.path. This way users can keep
7011 customizations there and access them via import.
7043 customizations there and access them via import.
7012
7044
7013 2001-11-03 Fernando Perez <fperez@colorado.edu>
7045 2001-11-03 Fernando Perez <fperez@colorado.edu>
7014
7046
7015 * Opened version 0.1.1 for new changes.
7047 * Opened version 0.1.1 for new changes.
7016
7048
7017 * Changed version number to 0.1.0: first 'public' release, sent to
7049 * Changed version number to 0.1.0: first 'public' release, sent to
7018 Nathan and Janko.
7050 Nathan and Janko.
7019
7051
7020 * Lots of small fixes and tweaks.
7052 * Lots of small fixes and tweaks.
7021
7053
7022 * Minor changes to whos format. Now strings are shown, snipped if
7054 * Minor changes to whos format. Now strings are shown, snipped if
7023 too long.
7055 too long.
7024
7056
7025 * Changed ShellServices to work on __main__ so they show up in @who
7057 * Changed ShellServices to work on __main__ so they show up in @who
7026
7058
7027 * Help also works with ? at the end of a line:
7059 * Help also works with ? at the end of a line:
7028 ?sin and sin?
7060 ?sin and sin?
7029 both produce the same effect. This is nice, as often I use the
7061 both produce the same effect. This is nice, as often I use the
7030 tab-complete to find the name of a method, but I used to then have
7062 tab-complete to find the name of a method, but I used to then have
7031 to go to the beginning of the line to put a ? if I wanted more
7063 to go to the beginning of the line to put a ? if I wanted more
7032 info. Now I can just add the ? and hit return. Convenient.
7064 info. Now I can just add the ? and hit return. Convenient.
7033
7065
7034 2001-11-02 Fernando Perez <fperez@colorado.edu>
7066 2001-11-02 Fernando Perez <fperez@colorado.edu>
7035
7067
7036 * Python version check (>=2.1) added.
7068 * Python version check (>=2.1) added.
7037
7069
7038 * Added LazyPython documentation. At this point the docs are quite
7070 * Added LazyPython documentation. At this point the docs are quite
7039 a mess. A cleanup is in order.
7071 a mess. A cleanup is in order.
7040
7072
7041 * Auto-installer created. For some bizarre reason, the zipfiles
7073 * Auto-installer created. For some bizarre reason, the zipfiles
7042 module isn't working on my system. So I made a tar version
7074 module isn't working on my system. So I made a tar version
7043 (hopefully the command line options in various systems won't kill
7075 (hopefully the command line options in various systems won't kill
7044 me).
7076 me).
7045
7077
7046 * Fixes to Struct in genutils. Now all dictionary-like methods are
7078 * Fixes to Struct in genutils. Now all dictionary-like methods are
7047 protected (reasonably).
7079 protected (reasonably).
7048
7080
7049 * Added pager function to genutils and changed ? to print usage
7081 * Added pager function to genutils and changed ? to print usage
7050 note through it (it was too long).
7082 note through it (it was too long).
7051
7083
7052 * Added the LazyPython functionality. Works great! I changed the
7084 * Added the LazyPython functionality. Works great! I changed the
7053 auto-quote escape to ';', it's on home row and next to '. But
7085 auto-quote escape to ';', it's on home row and next to '. But
7054 both auto-quote and auto-paren (still /) escapes are command-line
7086 both auto-quote and auto-paren (still /) escapes are command-line
7055 parameters.
7087 parameters.
7056
7088
7057
7089
7058 2001-11-01 Fernando Perez <fperez@colorado.edu>
7090 2001-11-01 Fernando Perez <fperez@colorado.edu>
7059
7091
7060 * Version changed to 0.0.7. Fairly large change: configuration now
7092 * Version changed to 0.0.7. Fairly large change: configuration now
7061 is all stored in a directory, by default .ipython. There, all
7093 is all stored in a directory, by default .ipython. There, all
7062 config files have normal looking names (not .names)
7094 config files have normal looking names (not .names)
7063
7095
7064 * Version 0.0.6 Released first to Lucas and Archie as a test
7096 * Version 0.0.6 Released first to Lucas and Archie as a test
7065 run. Since it's the first 'semi-public' release, change version to
7097 run. Since it's the first 'semi-public' release, change version to
7066 > 0.0.6 for any changes now.
7098 > 0.0.6 for any changes now.
7067
7099
7068 * Stuff I had put in the ipplib.py changelog:
7100 * Stuff I had put in the ipplib.py changelog:
7069
7101
7070 Changes to InteractiveShell:
7102 Changes to InteractiveShell:
7071
7103
7072 - Made the usage message a parameter.
7104 - Made the usage message a parameter.
7073
7105
7074 - Require the name of the shell variable to be given. It's a bit
7106 - Require the name of the shell variable to be given. It's a bit
7075 of a hack, but allows the name 'shell' not to be hardwired in the
7107 of a hack, but allows the name 'shell' not to be hardwired in the
7076 magic (@) handler, which is problematic b/c it requires
7108 magic (@) handler, which is problematic b/c it requires
7077 polluting the global namespace with 'shell'. This in turn is
7109 polluting the global namespace with 'shell'. This in turn is
7078 fragile: if a user redefines a variable called shell, things
7110 fragile: if a user redefines a variable called shell, things
7079 break.
7111 break.
7080
7112
7081 - magic @: all functions available through @ need to be defined
7113 - magic @: all functions available through @ need to be defined
7082 as magic_<name>, even though they can be called simply as
7114 as magic_<name>, even though they can be called simply as
7083 @<name>. This allows the special command @magic to gather
7115 @<name>. This allows the special command @magic to gather
7084 information automatically about all existing magic functions,
7116 information automatically about all existing magic functions,
7085 even if they are run-time user extensions, by parsing the shell
7117 even if they are run-time user extensions, by parsing the shell
7086 instance __dict__ looking for special magic_ names.
7118 instance __dict__ looking for special magic_ names.
7087
7119
7088 - mainloop: added *two* local namespace parameters. This allows
7120 - mainloop: added *two* local namespace parameters. This allows
7089 the class to differentiate between parameters which were there
7121 the class to differentiate between parameters which were there
7090 before and after command line initialization was processed. This
7122 before and after command line initialization was processed. This
7091 way, later @who can show things loaded at startup by the
7123 way, later @who can show things loaded at startup by the
7092 user. This trick was necessary to make session saving/reloading
7124 user. This trick was necessary to make session saving/reloading
7093 really work: ideally after saving/exiting/reloading a session,
7125 really work: ideally after saving/exiting/reloading a session,
7094 *everything* should look the same, including the output of @who. I
7126 *everything* should look the same, including the output of @who. I
7095 was only able to make this work with this double namespace
7127 was only able to make this work with this double namespace
7096 trick.
7128 trick.
7097
7129
7098 - added a header to the logfile which allows (almost) full
7130 - added a header to the logfile which allows (almost) full
7099 session restoring.
7131 session restoring.
7100
7132
7101 - prepend lines beginning with @ or !, with a and log
7133 - prepend lines beginning with @ or !, with a and log
7102 them. Why? !lines: may be useful to know what you did @lines:
7134 them. Why? !lines: may be useful to know what you did @lines:
7103 they may affect session state. So when restoring a session, at
7135 they may affect session state. So when restoring a session, at
7104 least inform the user of their presence. I couldn't quite get
7136 least inform the user of their presence. I couldn't quite get
7105 them to properly re-execute, but at least the user is warned.
7137 them to properly re-execute, but at least the user is warned.
7106
7138
7107 * Started ChangeLog.
7139 * Started ChangeLog.
General Comments 0
You need to be logged in to leave comments. Login now