##// END OF EJS Templates
New system for interactively running scripts. After a submission by Ken...
fperez -
Show More
@@ -0,0 +1,276 b''
1 #!/usr/bin/env python
2 """Module for interactively running scripts.
3
4 This module implements classes for interactively running scripts written for
5 any system with a prompt which can be matched by a regexp suitable for
6 pexpect. It can be used to run as if they had been typed up interactively, an
7 arbitrary series of commands for the target system.
8
9 The module includes classes ready for IPython (with the default prompts),
10 plain Python and SAGE, but making a new one is trivial. To see how to use it,
11 simply run the module as a script:
12
13 ./irunner.py --help
14
15
16 This is an extension of Ken Schutte <kschutte-AT-csail.mit.edu>'s script
17 contributed on the ipython-user list:
18
19 http://scipy.net/pipermail/ipython-user/2006-May/001705.html
20
21
22 NOTES:
23
24 - This module requires pexpect, available in most linux distros, or which can
25 be downloaded from
26
27 http://pexpect.sourceforge.net
28
29 - Because pexpect only works under Unix or Windows-Cygwin, this has the same
30 limitations. This means that it will NOT work under native windows Python.
31 """
32
33 # Stdlib imports
34 import optparse
35 import sys
36
37 # Third-party modules.
38 import pexpect
39
40 # Global usage strings, to avoid indentation issues when typing it below.
41 USAGE = """
42 Interactive script runner, type: %s
43
44 runner [opts] script_name
45 """
46
47 # The generic runner class
48 class InteractiveRunner(object):
49 """Class to run a sequence of commands through an interactive program."""
50
51 def __init__(self,program,prompts,args=None):
52 """Construct a runner.
53
54 Inputs:
55
56 - program: command to execute the given program.
57
58 - prompts: a list of patterns to match as valid prompts, in the
59 format used by pexpect. This basically means that it can be either
60 a string (to be compiled as a regular expression) or a list of such
61 (it must be a true list, as pexpect does type checks).
62
63 If more than one prompt is given, the first is treated as the main
64 program prompt and the others as 'continuation' prompts, like
65 python's. This means that blank lines in the input source are
66 ommitted when the first prompt is matched, but are NOT ommitted when
67 the continuation one matches, since this is how python signals the
68 end of multiline input interactively.
69
70 Optional inputs:
71
72 - args(None): optional list of strings to pass as arguments to the
73 child program.
74 """
75
76 self.program = program
77 self.prompts = prompts
78 if args is None: args = []
79 self.args = args
80
81 def run_file(self,fname,interact=False):
82 """Run the given file interactively.
83
84 Inputs:
85
86 -fname: name of the file to execute.
87
88 See the run_source docstring for the meaning of the optional
89 arguments."""
90
91 fobj = open(fname,'r')
92 try:
93 self.run_source(fobj,interact)
94 finally:
95 fobj.close()
96
97 def run_source(self,source,interact=False):
98 """Run the given source code interactively.
99
100 Inputs:
101
102 - source: a string of code to be executed, or an open file object we
103 can iterate over.
104
105 Optional inputs:
106
107 - interact(False): if true, start to interact with the running
108 program at the end of the script. Otherwise, just exit.
109 """
110
111 # if the source is a string, chop it up in lines so we can iterate
112 # over it just as if it were an open file.
113 if not isinstance(source,file):
114 source = source.splitlines(True)
115
116 # grab the true write method of stdout, in case anything later
117 # reassigns sys.stdout, so that we really are writing to the true
118 # stdout and not to something else.
119 write = sys.stdout.write
120
121 c = pexpect.spawn(self.program,self.args,timeout=None)
122
123 prompts = c.compile_pattern_list(self.prompts[0])
124 prompts = c.compile_pattern_list(self.prompts)
125
126 prompt_idx = c.expect_list(prompts)
127 # Flag whether the script ends normally or not, to know whether we can
128 # do anything further with the underlying process.
129 end_normal = True
130 for cmd in source:
131 # skip blank lines for all matches to the 'main' prompt, while the
132 # secondary prompts do not
133 if prompt_idx==0 and cmd.isspace():
134 continue
135
136 write(c.after)
137 c.send(cmd)
138 try:
139 prompt_idx = c.expect_list(prompts)
140 except pexpect.EOF:
141 # this will happen if the child dies unexpectedly
142 write(c.before)
143 end_normal = False
144 break
145 write(c.before)
146
147 if isinstance(source,file):
148 source.close()
149
150 if end_normal:
151 if interact:
152 c.send('\n')
153 print '<< Starting interactive mode >>',
154 try:
155 c.interact()
156 except OSError:
157 # This is what fires when the child stops. Simply print a
158 # newline so the system prompt is alingned. The extra
159 # space is there to make sure it gets printed, otherwise
160 # OS buffering sometimes just suppresses it.
161 write(' \n')
162 sys.stdout.flush()
163 else:
164 c.close()
165 else:
166 if interact:
167 e="Further interaction is not possible: child process is dead."
168 print >> sys.stderr, e
169
170 def main(self,argv=None):
171 """Run as a command-line script."""
172
173 parser = optparse.OptionParser(usage=USAGE % self.__class__.__name__)
174 newopt = parser.add_option
175 newopt('-i','--interact',action='store_true',default=False,
176 help='Interact with the program after the script is run.')
177
178 opts,args = parser.parse_args(argv)
179
180 if len(args) != 1:
181 print >> sys.stderr,"You must supply exactly one file to run."
182 sys.exit(1)
183
184 self.run_file(args[0],opts.interact)
185
186
187 # Specific runners for particular programs
188 class IPythonRunner(InteractiveRunner):
189 """Interactive IPython runner.
190
191 This initalizes IPython in 'nocolor' mode for simplicity. This lets us
192 avoid having to write a regexp that matches ANSI sequences, though pexpect
193 does support them. If anyone contributes patches for ANSI color support,
194 they will be welcome.
195
196 It also sets the prompts manually, since the prompt regexps for
197 pexpect need to be matched to the actual prompts, so user-customized
198 prompts would break this.
199 """
200
201 def __init__(self,program = 'ipython',args=None):
202 """New runner, optionally passing the ipython command to use."""
203
204 args0 = ['-colors','NoColor',
205 '-pi1','In [\\#]: ',
206 '-pi2',' .\\D.: ']
207 if args is None: args = args0
208 else: args = args0 + args
209 prompts = [r'In \[\d+\]: ',r' \.*: ']
210 InteractiveRunner.__init__(self,program,prompts,args)
211
212
213 class PythonRunner(InteractiveRunner):
214 """Interactive Python runner."""
215
216 def __init__(self,program='python',args=None):
217 """New runner, optionally passing the python command to use."""
218
219 prompts = [r'>>> ',r'\.\.\. ']
220 InteractiveRunner.__init__(self,program,prompts,args)
221
222
223 class SAGERunner(InteractiveRunner):
224 """Interactive SAGE runner.
225
226 XXX - This class is currently untested, meant for feedback from the SAGE
227 team. """
228
229 def __init__(self,program='sage',args=None):
230 """New runner, optionally passing the sage command to use."""
231 print 'XXX - This class is currently untested!!!'
232 print 'It is a placeholder, meant for feedback from the SAGE team.'
233
234 prompts = ['sage: ',r'\s*\.\.\. ']
235 InteractiveRunner.__init__(self,program,prompts,args)
236
237 # Global usage string, to avoid indentation issues if typed in a function def.
238 MAIN_USAGE = """
239 %prog [options] file_to_run
240
241 This is an interface to the various interactive runners available in this
242 module. If you want to pass specific options to one of the runners, you need
243 to first terminate the main options with a '--', and then provide the runner's
244 options. For example:
245
246 irunner.py --python -- --help
247
248 will pass --help to the python runner. Similarly,
249
250 irunner.py --ipython -- --log test.log script.ipy
251
252 will run the script.ipy file under the IPython runner, logging all output into
253 the test.log file.
254 """
255
256 def main():
257 """Run as a command-line script."""
258
259 parser = optparse.OptionParser(usage=MAIN_USAGE)
260 newopt = parser.add_option
261 parser.set_defaults(mode='ipython')
262 newopt('--ipython',action='store_const',dest='mode',const='ipython',
263 help='IPython interactive runner (default).')
264 newopt('--python',action='store_const',dest='mode',const='python',
265 help='Python interactive runner.')
266 newopt('--sage',action='store_const',dest='mode',const='sage',
267 help='SAGE interactive runner - UNTESTED.')
268
269 opts,args = parser.parse_args()
270 runners = dict(ipython=IPythonRunner,
271 python=PythonRunner,
272 sage=SAGERunner)
273 runners[opts.mode]().main(args)
274
275 if __name__ == '__main__':
276 main()
@@ -0,0 +1,156 b''
1 #!/usr/bin/env python
2 """Test suite for the irunner module.
3
4 Not the most elegant or fine-grained, but it does cover at least the bulk
5 functionality."""
6
7 # Global to make tests extra verbose and help debugging
8 VERBOSE = True
9
10 # stdlib imports
11 import cStringIO as StringIO
12 import unittest
13
14 # IPython imports
15 from IPython import irunner
16 from IPython.OutputTrap import OutputTrap
17
18 # Testing code begins
19 class RunnerTestCase(unittest.TestCase):
20
21 def _test_runner(self,runner,source,output):
22 """Test that a given runner's input/output match."""
23
24 log = OutputTrap(out_head='',quiet_out=True)
25 log.trap_out()
26 runner.run_source(source)
27 log.release_out()
28 out = log.summary_out()
29 # this output contains nasty \r\n lineends, and the initial ipython
30 # banner. clean it up for comparison
31 output_l = output.split()
32 out_l = out.split()
33 mismatch = 0
34 for n in range(len(output_l)):
35 ol1 = output_l[n].strip()
36 ol2 = out_l[n].strip()
37 if ol1 != ol2:
38 mismatch += 1
39 if VERBOSE:
40 print '<<< line %s does not match:' % n
41 print repr(ol1)
42 print repr(ol2)
43 print '>>>'
44 self.assert_(mismatch==0,'Number of mismatched lines: %s' %
45 mismatch)
46
47 def testIPython(self):
48 """Test the IPython runner."""
49 source = """
50 print 'hello, this is python'
51
52 # some more code
53 x=1;y=2
54 x+y**2
55
56 # An example of autocall functionality
57 from math import *
58 autocall 1
59 cos pi
60 autocall 0
61 cos pi
62 cos(pi)
63
64 for i in range(5):
65 print i,
66
67 print "that's all folks!"
68
69 %Exit
70 """
71 output = """\
72 In [1]: print 'hello, this is python'
73 hello, this is python
74
75 In [2]: # some more code
76
77 In [3]: x=1;y=2
78
79 In [4]: x+y**2
80 Out[4]: 5
81
82 In [5]: # An example of autocall functionality
83
84 In [6]: from math import *
85
86 In [7]: autocall 1
87 Automatic calling is: Smart
88
89 In [8]: cos pi
90 ------> cos(pi)
91 Out[8]: -1.0
92
93 In [9]: autocall 0
94 Automatic calling is: OFF
95
96 In [10]: cos pi
97 ------------------------------------------------------------
98 File "<ipython console>", line 1
99 cos pi
100 ^
101 SyntaxError: invalid syntax
102
103
104 In [11]: cos(pi)
105 Out[11]: -1.0
106
107 In [12]: for i in range(5):
108 ....: print i,
109 ....:
110 0 1 2 3 4
111
112 In [13]: print "that's all folks!"
113 that's all folks!
114
115 In [14]: %Exit"""
116 runner = irunner.IPythonRunner()
117 self._test_runner(runner,source,output)
118
119 def testPython(self):
120 """Test the Python runner."""
121 runner = irunner.PythonRunner()
122 source = """
123 print 'hello, this is python'
124
125 # some more code
126 x=1;y=2
127 x+y**2
128
129 from math import *
130 cos(pi)
131
132 for i in range(5):
133 print i,
134
135 print "that's all folks!"
136 """
137 output = """\
138 >>> print 'hello, this is python'
139 hello, this is python
140 >>> # some more code
141 ... x=1;y=2
142 >>> x+y**2
143 5
144 >>> from math import *
145 >>> cos(pi)
146 -1.0
147 >>> for i in range(5):
148 ... print i,
149 ...
150 0 1 2 3 4
151 >>> print "that's all folks!"
152 that's all folks!"""
153 self._test_runner(runner,source,output)
154
155 if __name__ == '__main__':
156 unittest.main()
@@ -1,2300 +1,2299 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.3 or newer.
5 Requires Python 2.3 or newer.
6
6
7 This file contains all the classes and helper functions specific to IPython.
7 This file contains all the classes and helper functions specific to IPython.
8
8
9 $Id: iplib.py 1329 2006-05-26 07:52:45Z fperez $
9 $Id: iplib.py 1332 2006-05-30 01:41:28Z fperez $
10 """
10 """
11
11
12 #*****************************************************************************
12 #*****************************************************************************
13 # Copyright (C) 2001 Janko Hauser <jhauser@zscout.de> and
13 # Copyright (C) 2001 Janko Hauser <jhauser@zscout.de> and
14 # Copyright (C) 2001-2006 Fernando Perez. <fperez@colorado.edu>
14 # Copyright (C) 2001-2006 Fernando Perez. <fperez@colorado.edu>
15 #
15 #
16 # Distributed under the terms of the BSD License. The full license is in
16 # Distributed under the terms of the BSD License. The full license is in
17 # the file COPYING, distributed as part of this software.
17 # the file COPYING, distributed as part of this software.
18 #
18 #
19 # Note: this code originally subclassed code.InteractiveConsole from the
19 # Note: this code originally subclassed code.InteractiveConsole from the
20 # Python standard library. Over time, all of that class has been copied
20 # Python standard library. Over time, all of that class has been copied
21 # verbatim here for modifications which could not be accomplished by
21 # verbatim here for modifications which could not be accomplished by
22 # subclassing. At this point, there are no dependencies at all on the code
22 # subclassing. At this point, there are no dependencies at all on the code
23 # module anymore (it is not even imported). The Python License (sec. 2)
23 # module anymore (it is not even imported). The Python License (sec. 2)
24 # allows for this, but it's always nice to acknowledge credit where credit is
24 # allows for this, but it's always nice to acknowledge credit where credit is
25 # due.
25 # due.
26 #*****************************************************************************
26 #*****************************************************************************
27
27
28 #****************************************************************************
28 #****************************************************************************
29 # Modules and globals
29 # Modules and globals
30
30
31 from IPython import Release
31 from IPython import Release
32 __author__ = '%s <%s>\n%s <%s>' % \
32 __author__ = '%s <%s>\n%s <%s>' % \
33 ( Release.authors['Janko'] + Release.authors['Fernando'] )
33 ( Release.authors['Janko'] + Release.authors['Fernando'] )
34 __license__ = Release.license
34 __license__ = Release.license
35 __version__ = Release.version
35 __version__ = Release.version
36
36
37 # Python standard modules
37 # Python standard modules
38 import __main__
38 import __main__
39 import __builtin__
39 import __builtin__
40 import StringIO
40 import StringIO
41 import bdb
41 import bdb
42 import cPickle as pickle
42 import cPickle as pickle
43 import codeop
43 import codeop
44 import exceptions
44 import exceptions
45 import glob
45 import glob
46 import inspect
46 import inspect
47 import keyword
47 import keyword
48 import new
48 import new
49 import os
49 import os
50 import pdb
50 import pdb
51 import pydoc
51 import pydoc
52 import re
52 import re
53 import shutil
53 import shutil
54 import string
54 import string
55 import sys
55 import sys
56 import tempfile
56 import tempfile
57 import traceback
57 import traceback
58 import types
58 import types
59 import pickleshare
59 import pickleshare
60
60
61 from pprint import pprint, pformat
61 from pprint import pprint, pformat
62
62
63 # IPython's own modules
63 # IPython's own modules
64 import IPython
64 import IPython
65 from IPython import OInspect,PyColorize,ultraTB
65 from IPython import OInspect,PyColorize,ultraTB
66 from IPython.ColorANSI import ColorScheme,ColorSchemeTable # too long names
66 from IPython.ColorANSI import ColorScheme,ColorSchemeTable # too long names
67 from IPython.FakeModule import FakeModule
67 from IPython.FakeModule import FakeModule
68 from IPython.Itpl import Itpl,itpl,printpl,ItplNS,itplns
68 from IPython.Itpl import Itpl,itpl,printpl,ItplNS,itplns
69 from IPython.Logger import Logger
69 from IPython.Logger import Logger
70 from IPython.Magic import Magic
70 from IPython.Magic import Magic
71 from IPython.Prompts import CachedOutput
71 from IPython.Prompts import CachedOutput
72 from IPython.ipstruct import Struct
72 from IPython.ipstruct import Struct
73 from IPython.background_jobs import BackgroundJobManager
73 from IPython.background_jobs import BackgroundJobManager
74 from IPython.usage import cmd_line_usage,interactive_usage
74 from IPython.usage import cmd_line_usage,interactive_usage
75 from IPython.genutils import *
75 from IPython.genutils import *
76 import IPython.ipapi
76 import IPython.ipapi
77
77
78 # Globals
78 # Globals
79
79
80 # store the builtin raw_input globally, and use this always, in case user code
80 # store the builtin raw_input globally, and use this always, in case user code
81 # overwrites it (like wx.py.PyShell does)
81 # overwrites it (like wx.py.PyShell does)
82 raw_input_original = raw_input
82 raw_input_original = raw_input
83
83
84 # compiled regexps for autoindent management
84 # compiled regexps for autoindent management
85 dedent_re = re.compile(r'^\s+raise|^\s+return|^\s+pass')
85 dedent_re = re.compile(r'^\s+raise|^\s+return|^\s+pass')
86
86
87
87
88 #****************************************************************************
88 #****************************************************************************
89 # Some utility function definitions
89 # Some utility function definitions
90
90
91 ini_spaces_re = re.compile(r'^(\s+)')
91 ini_spaces_re = re.compile(r'^(\s+)')
92
92
93 def num_ini_spaces(strng):
93 def num_ini_spaces(strng):
94 """Return the number of initial spaces in a string"""
94 """Return the number of initial spaces in a string"""
95
95
96 ini_spaces = ini_spaces_re.match(strng)
96 ini_spaces = ini_spaces_re.match(strng)
97 if ini_spaces:
97 if ini_spaces:
98 return ini_spaces.end()
98 return ini_spaces.end()
99 else:
99 else:
100 return 0
100 return 0
101
101
102 def softspace(file, newvalue):
102 def softspace(file, newvalue):
103 """Copied from code.py, to remove the dependency"""
103 """Copied from code.py, to remove the dependency"""
104
104
105 oldvalue = 0
105 oldvalue = 0
106 try:
106 try:
107 oldvalue = file.softspace
107 oldvalue = file.softspace
108 except AttributeError:
108 except AttributeError:
109 pass
109 pass
110 try:
110 try:
111 file.softspace = newvalue
111 file.softspace = newvalue
112 except (AttributeError, TypeError):
112 except (AttributeError, TypeError):
113 # "attribute-less object" or "read-only attributes"
113 # "attribute-less object" or "read-only attributes"
114 pass
114 pass
115 return oldvalue
115 return oldvalue
116
116
117
117
118 #****************************************************************************
118 #****************************************************************************
119 # Local use exceptions
119 # Local use exceptions
120 class SpaceInInput(exceptions.Exception): pass
120 class SpaceInInput(exceptions.Exception): pass
121
121
122
122
123 #****************************************************************************
123 #****************************************************************************
124 # Local use classes
124 # Local use classes
125 class Bunch: pass
125 class Bunch: pass
126
126
127 class Undefined: pass
127 class Undefined: pass
128
128
129 class InputList(list):
129 class InputList(list):
130 """Class to store user input.
130 """Class to store user input.
131
131
132 It's basically a list, but slices return a string instead of a list, thus
132 It's basically a list, but slices return a string instead of a list, thus
133 allowing things like (assuming 'In' is an instance):
133 allowing things like (assuming 'In' is an instance):
134
134
135 exec In[4:7]
135 exec In[4:7]
136
136
137 or
137 or
138
138
139 exec In[5:9] + In[14] + In[21:25]"""
139 exec In[5:9] + In[14] + In[21:25]"""
140
140
141 def __getslice__(self,i,j):
141 def __getslice__(self,i,j):
142 return ''.join(list.__getslice__(self,i,j))
142 return ''.join(list.__getslice__(self,i,j))
143
143
144 class SyntaxTB(ultraTB.ListTB):
144 class SyntaxTB(ultraTB.ListTB):
145 """Extension which holds some state: the last exception value"""
145 """Extension which holds some state: the last exception value"""
146
146
147 def __init__(self,color_scheme = 'NoColor'):
147 def __init__(self,color_scheme = 'NoColor'):
148 ultraTB.ListTB.__init__(self,color_scheme)
148 ultraTB.ListTB.__init__(self,color_scheme)
149 self.last_syntax_error = None
149 self.last_syntax_error = None
150
150
151 def __call__(self, etype, value, elist):
151 def __call__(self, etype, value, elist):
152 self.last_syntax_error = value
152 self.last_syntax_error = value
153 ultraTB.ListTB.__call__(self,etype,value,elist)
153 ultraTB.ListTB.__call__(self,etype,value,elist)
154
154
155 def clear_err_state(self):
155 def clear_err_state(self):
156 """Return the current error state and clear it"""
156 """Return the current error state and clear it"""
157 e = self.last_syntax_error
157 e = self.last_syntax_error
158 self.last_syntax_error = None
158 self.last_syntax_error = None
159 return e
159 return e
160
160
161 #****************************************************************************
161 #****************************************************************************
162 # Main IPython class
162 # Main IPython class
163
163
164 # FIXME: the Magic class is a mixin for now, and will unfortunately remain so
164 # FIXME: the Magic class is a mixin for now, and will unfortunately remain so
165 # until a full rewrite is made. I've cleaned all cross-class uses of
165 # until a full rewrite is made. I've cleaned all cross-class uses of
166 # attributes and methods, but too much user code out there relies on the
166 # attributes and methods, but too much user code out there relies on the
167 # equlity %foo == __IP.magic_foo, so I can't actually remove the mixin usage.
167 # equlity %foo == __IP.magic_foo, so I can't actually remove the mixin usage.
168 #
168 #
169 # But at least now, all the pieces have been separated and we could, in
169 # But at least now, all the pieces have been separated and we could, in
170 # principle, stop using the mixin. This will ease the transition to the
170 # principle, stop using the mixin. This will ease the transition to the
171 # chainsaw branch.
171 # chainsaw branch.
172
172
173 # For reference, the following is the list of 'self.foo' uses in the Magic
173 # For reference, the following is the list of 'self.foo' uses in the Magic
174 # class as of 2005-12-28. These are names we CAN'T use in the main ipython
174 # class as of 2005-12-28. These are names we CAN'T use in the main ipython
175 # class, to prevent clashes.
175 # class, to prevent clashes.
176
176
177 # ['self.__class__', 'self.__dict__', 'self._inspect', 'self._ofind',
177 # ['self.__class__', 'self.__dict__', 'self._inspect', 'self._ofind',
178 # 'self.arg_err', 'self.extract_input', 'self.format_', 'self.lsmagic',
178 # 'self.arg_err', 'self.extract_input', 'self.format_', 'self.lsmagic',
179 # 'self.magic_', 'self.options_table', 'self.parse', 'self.shell',
179 # 'self.magic_', 'self.options_table', 'self.parse', 'self.shell',
180 # 'self.value']
180 # 'self.value']
181
181
182 class InteractiveShell(object,Magic):
182 class InteractiveShell(object,Magic):
183 """An enhanced console for Python."""
183 """An enhanced console for Python."""
184
184
185 # class attribute to indicate whether the class supports threads or not.
185 # class attribute to indicate whether the class supports threads or not.
186 # Subclasses with thread support should override this as needed.
186 # Subclasses with thread support should override this as needed.
187 isthreaded = False
187 isthreaded = False
188
188
189 def __init__(self,name,usage=None,rc=Struct(opts=None,args=None),
189 def __init__(self,name,usage=None,rc=Struct(opts=None,args=None),
190 user_ns = None,user_global_ns=None,banner2='',
190 user_ns = None,user_global_ns=None,banner2='',
191 custom_exceptions=((),None),embedded=False):
191 custom_exceptions=((),None),embedded=False):
192
192
193
194 # log system
193 # log system
195 self.logger = Logger(self,logfname='ipython_log.py',logmode='rotate')
194 self.logger = Logger(self,logfname='ipython_log.py',logmode='rotate')
196
195
197 # some minimal strict typechecks. For some core data structures, I
196 # some minimal strict typechecks. For some core data structures, I
198 # want actual basic python types, not just anything that looks like
197 # want actual basic python types, not just anything that looks like
199 # one. This is especially true for namespaces.
198 # one. This is especially true for namespaces.
200 for ns in (user_ns,user_global_ns):
199 for ns in (user_ns,user_global_ns):
201 if ns is not None and type(ns) != types.DictType:
200 if ns is not None and type(ns) != types.DictType:
202 raise TypeError,'namespace must be a dictionary'
201 raise TypeError,'namespace must be a dictionary'
203
202
204 # Job manager (for jobs run as background threads)
203 # Job manager (for jobs run as background threads)
205 self.jobs = BackgroundJobManager()
204 self.jobs = BackgroundJobManager()
206
205
207 # Store the actual shell's name
206 # Store the actual shell's name
208 self.name = name
207 self.name = name
209
208
210 # We need to know whether the instance is meant for embedding, since
209 # We need to know whether the instance is meant for embedding, since
211 # global/local namespaces need to be handled differently in that case
210 # global/local namespaces need to be handled differently in that case
212 self.embedded = embedded
211 self.embedded = embedded
213
212
214 # command compiler
213 # command compiler
215 self.compile = codeop.CommandCompiler()
214 self.compile = codeop.CommandCompiler()
216
215
217 # User input buffer
216 # User input buffer
218 self.buffer = []
217 self.buffer = []
219
218
220 # Default name given in compilation of code
219 # Default name given in compilation of code
221 self.filename = '<ipython console>'
220 self.filename = '<ipython console>'
222
221
223 # Make an empty namespace, which extension writers can rely on both
222 # Make an empty namespace, which extension writers can rely on both
224 # existing and NEVER being used by ipython itself. This gives them a
223 # existing and NEVER being used by ipython itself. This gives them a
225 # convenient location for storing additional information and state
224 # convenient location for storing additional information and state
226 # their extensions may require, without fear of collisions with other
225 # their extensions may require, without fear of collisions with other
227 # ipython names that may develop later.
226 # ipython names that may develop later.
228 self.meta = Struct()
227 self.meta = Struct()
229
228
230 # Create the namespace where the user will operate. user_ns is
229 # Create the namespace where the user will operate. user_ns is
231 # normally the only one used, and it is passed to the exec calls as
230 # normally the only one used, and it is passed to the exec calls as
232 # the locals argument. But we do carry a user_global_ns namespace
231 # the locals argument. But we do carry a user_global_ns namespace
233 # given as the exec 'globals' argument, This is useful in embedding
232 # given as the exec 'globals' argument, This is useful in embedding
234 # situations where the ipython shell opens in a context where the
233 # situations where the ipython shell opens in a context where the
235 # distinction between locals and globals is meaningful.
234 # distinction between locals and globals is meaningful.
236
235
237 # FIXME. For some strange reason, __builtins__ is showing up at user
236 # FIXME. For some strange reason, __builtins__ is showing up at user
238 # level as a dict instead of a module. This is a manual fix, but I
237 # level as a dict instead of a module. This is a manual fix, but I
239 # should really track down where the problem is coming from. Alex
238 # should really track down where the problem is coming from. Alex
240 # Schmolck reported this problem first.
239 # Schmolck reported this problem first.
241
240
242 # A useful post by Alex Martelli on this topic:
241 # A useful post by Alex Martelli on this topic:
243 # Re: inconsistent value from __builtins__
242 # Re: inconsistent value from __builtins__
244 # Von: Alex Martelli <aleaxit@yahoo.com>
243 # Von: Alex Martelli <aleaxit@yahoo.com>
245 # Datum: Freitag 01 Oktober 2004 04:45:34 nachmittags/abends
244 # Datum: Freitag 01 Oktober 2004 04:45:34 nachmittags/abends
246 # Gruppen: comp.lang.python
245 # Gruppen: comp.lang.python
247
246
248 # Michael Hohn <hohn@hooknose.lbl.gov> wrote:
247 # Michael Hohn <hohn@hooknose.lbl.gov> wrote:
249 # > >>> print type(builtin_check.get_global_binding('__builtins__'))
248 # > >>> print type(builtin_check.get_global_binding('__builtins__'))
250 # > <type 'dict'>
249 # > <type 'dict'>
251 # > >>> print type(__builtins__)
250 # > >>> print type(__builtins__)
252 # > <type 'module'>
251 # > <type 'module'>
253 # > Is this difference in return value intentional?
252 # > Is this difference in return value intentional?
254
253
255 # Well, it's documented that '__builtins__' can be either a dictionary
254 # Well, it's documented that '__builtins__' can be either a dictionary
256 # or a module, and it's been that way for a long time. Whether it's
255 # or a module, and it's been that way for a long time. Whether it's
257 # intentional (or sensible), I don't know. In any case, the idea is
256 # intentional (or sensible), I don't know. In any case, the idea is
258 # that if you need to access the built-in namespace directly, you
257 # that if you need to access the built-in namespace directly, you
259 # should start with "import __builtin__" (note, no 's') which will
258 # should start with "import __builtin__" (note, no 's') which will
260 # definitely give you a module. Yeah, it's somewhat confusing:-(.
259 # definitely give you a module. Yeah, it's somewhat confusing:-(.
261
260
262 # These routines return properly built dicts as needed by the rest of
261 # These routines return properly built dicts as needed by the rest of
263 # the code, and can also be used by extension writers to generate
262 # the code, and can also be used by extension writers to generate
264 # properly initialized namespaces.
263 # properly initialized namespaces.
265 user_ns = IPython.ipapi.make_user_ns(user_ns)
264 user_ns = IPython.ipapi.make_user_ns(user_ns)
266 user_global_ns = IPython.ipapi.make_user_global_ns(user_global_ns)
265 user_global_ns = IPython.ipapi.make_user_global_ns(user_global_ns)
267
266
268 # Assign namespaces
267 # Assign namespaces
269 # This is the namespace where all normal user variables live
268 # This is the namespace where all normal user variables live
270 self.user_ns = user_ns
269 self.user_ns = user_ns
271 # Embedded instances require a separate namespace for globals.
270 # Embedded instances require a separate namespace for globals.
272 # Normally this one is unused by non-embedded instances.
271 # Normally this one is unused by non-embedded instances.
273 self.user_global_ns = user_global_ns
272 self.user_global_ns = user_global_ns
274 # A namespace to keep track of internal data structures to prevent
273 # A namespace to keep track of internal data structures to prevent
275 # them from cluttering user-visible stuff. Will be updated later
274 # them from cluttering user-visible stuff. Will be updated later
276 self.internal_ns = {}
275 self.internal_ns = {}
277
276
278 # Namespace of system aliases. Each entry in the alias
277 # Namespace of system aliases. Each entry in the alias
279 # table must be a 2-tuple of the form (N,name), where N is the number
278 # table must be a 2-tuple of the form (N,name), where N is the number
280 # of positional arguments of the alias.
279 # of positional arguments of the alias.
281 self.alias_table = {}
280 self.alias_table = {}
282
281
283 # A table holding all the namespaces IPython deals with, so that
282 # A table holding all the namespaces IPython deals with, so that
284 # introspection facilities can search easily.
283 # introspection facilities can search easily.
285 self.ns_table = {'user':user_ns,
284 self.ns_table = {'user':user_ns,
286 'user_global':user_global_ns,
285 'user_global':user_global_ns,
287 'alias':self.alias_table,
286 'alias':self.alias_table,
288 'internal':self.internal_ns,
287 'internal':self.internal_ns,
289 'builtin':__builtin__.__dict__
288 'builtin':__builtin__.__dict__
290 }
289 }
291
290
292 # The user namespace MUST have a pointer to the shell itself.
291 # The user namespace MUST have a pointer to the shell itself.
293 self.user_ns[name] = self
292 self.user_ns[name] = self
294
293
295 # We need to insert into sys.modules something that looks like a
294 # We need to insert into sys.modules something that looks like a
296 # module but which accesses the IPython namespace, for shelve and
295 # module but which accesses the IPython namespace, for shelve and
297 # pickle to work interactively. Normally they rely on getting
296 # pickle to work interactively. Normally they rely on getting
298 # everything out of __main__, but for embedding purposes each IPython
297 # everything out of __main__, but for embedding purposes each IPython
299 # instance has its own private namespace, so we can't go shoving
298 # instance has its own private namespace, so we can't go shoving
300 # everything into __main__.
299 # everything into __main__.
301
300
302 # note, however, that we should only do this for non-embedded
301 # note, however, that we should only do this for non-embedded
303 # ipythons, which really mimic the __main__.__dict__ with their own
302 # ipythons, which really mimic the __main__.__dict__ with their own
304 # namespace. Embedded instances, on the other hand, should not do
303 # namespace. Embedded instances, on the other hand, should not do
305 # this because they need to manage the user local/global namespaces
304 # this because they need to manage the user local/global namespaces
306 # only, but they live within a 'normal' __main__ (meaning, they
305 # only, but they live within a 'normal' __main__ (meaning, they
307 # shouldn't overtake the execution environment of the script they're
306 # shouldn't overtake the execution environment of the script they're
308 # embedded in).
307 # embedded in).
309
308
310 if not embedded:
309 if not embedded:
311 try:
310 try:
312 main_name = self.user_ns['__name__']
311 main_name = self.user_ns['__name__']
313 except KeyError:
312 except KeyError:
314 raise KeyError,'user_ns dictionary MUST have a "__name__" key'
313 raise KeyError,'user_ns dictionary MUST have a "__name__" key'
315 else:
314 else:
316 #print "pickle hack in place" # dbg
315 #print "pickle hack in place" # dbg
317 #print 'main_name:',main_name # dbg
316 #print 'main_name:',main_name # dbg
318 sys.modules[main_name] = FakeModule(self.user_ns)
317 sys.modules[main_name] = FakeModule(self.user_ns)
319
318
320 # List of input with multi-line handling.
319 # List of input with multi-line handling.
321 # Fill its zero entry, user counter starts at 1
320 # Fill its zero entry, user counter starts at 1
322 self.input_hist = InputList(['\n'])
321 self.input_hist = InputList(['\n'])
323 # This one will hold the 'raw' input history, without any
322 # This one will hold the 'raw' input history, without any
324 # pre-processing. This will allow users to retrieve the input just as
323 # pre-processing. This will allow users to retrieve the input just as
325 # it was exactly typed in by the user, with %hist -r.
324 # it was exactly typed in by the user, with %hist -r.
326 self.input_hist_raw = InputList(['\n'])
325 self.input_hist_raw = InputList(['\n'])
327
326
328 # list of visited directories
327 # list of visited directories
329 try:
328 try:
330 self.dir_hist = [os.getcwd()]
329 self.dir_hist = [os.getcwd()]
331 except IOError, e:
330 except IOError, e:
332 self.dir_hist = []
331 self.dir_hist = []
333
332
334 # dict of output history
333 # dict of output history
335 self.output_hist = {}
334 self.output_hist = {}
336
335
337 # dict of things NOT to alias (keywords, builtins and some magics)
336 # dict of things NOT to alias (keywords, builtins and some magics)
338 no_alias = {}
337 no_alias = {}
339 no_alias_magics = ['cd','popd','pushd','dhist','alias','unalias']
338 no_alias_magics = ['cd','popd','pushd','dhist','alias','unalias']
340 for key in keyword.kwlist + no_alias_magics:
339 for key in keyword.kwlist + no_alias_magics:
341 no_alias[key] = 1
340 no_alias[key] = 1
342 no_alias.update(__builtin__.__dict__)
341 no_alias.update(__builtin__.__dict__)
343 self.no_alias = no_alias
342 self.no_alias = no_alias
344
343
345 # make global variables for user access to these
344 # make global variables for user access to these
346 self.user_ns['_ih'] = self.input_hist
345 self.user_ns['_ih'] = self.input_hist
347 self.user_ns['_oh'] = self.output_hist
346 self.user_ns['_oh'] = self.output_hist
348 self.user_ns['_dh'] = self.dir_hist
347 self.user_ns['_dh'] = self.dir_hist
349
348
350 # user aliases to input and output histories
349 # user aliases to input and output histories
351 self.user_ns['In'] = self.input_hist
350 self.user_ns['In'] = self.input_hist
352 self.user_ns['Out'] = self.output_hist
351 self.user_ns['Out'] = self.output_hist
353
352
354 # Object variable to store code object waiting execution. This is
353 # Object variable to store code object waiting execution. This is
355 # used mainly by the multithreaded shells, but it can come in handy in
354 # used mainly by the multithreaded shells, but it can come in handy in
356 # other situations. No need to use a Queue here, since it's a single
355 # other situations. No need to use a Queue here, since it's a single
357 # item which gets cleared once run.
356 # item which gets cleared once run.
358 self.code_to_run = None
357 self.code_to_run = None
359
358
360 # escapes for automatic behavior on the command line
359 # escapes for automatic behavior on the command line
361 self.ESC_SHELL = '!'
360 self.ESC_SHELL = '!'
362 self.ESC_HELP = '?'
361 self.ESC_HELP = '?'
363 self.ESC_MAGIC = '%'
362 self.ESC_MAGIC = '%'
364 self.ESC_QUOTE = ','
363 self.ESC_QUOTE = ','
365 self.ESC_QUOTE2 = ';'
364 self.ESC_QUOTE2 = ';'
366 self.ESC_PAREN = '/'
365 self.ESC_PAREN = '/'
367
366
368 # And their associated handlers
367 # And their associated handlers
369 self.esc_handlers = {self.ESC_PAREN : self.handle_auto,
368 self.esc_handlers = {self.ESC_PAREN : self.handle_auto,
370 self.ESC_QUOTE : self.handle_auto,
369 self.ESC_QUOTE : self.handle_auto,
371 self.ESC_QUOTE2 : self.handle_auto,
370 self.ESC_QUOTE2 : self.handle_auto,
372 self.ESC_MAGIC : self.handle_magic,
371 self.ESC_MAGIC : self.handle_magic,
373 self.ESC_HELP : self.handle_help,
372 self.ESC_HELP : self.handle_help,
374 self.ESC_SHELL : self.handle_shell_escape,
373 self.ESC_SHELL : self.handle_shell_escape,
375 }
374 }
376
375
377 # class initializations
376 # class initializations
378 Magic.__init__(self,self)
377 Magic.__init__(self,self)
379
378
380 # Python source parser/formatter for syntax highlighting
379 # Python source parser/formatter for syntax highlighting
381 pyformat = PyColorize.Parser().format
380 pyformat = PyColorize.Parser().format
382 self.pycolorize = lambda src: pyformat(src,'str',self.rc['colors'])
381 self.pycolorize = lambda src: pyformat(src,'str',self.rc['colors'])
383
382
384 # hooks holds pointers used for user-side customizations
383 # hooks holds pointers used for user-side customizations
385 self.hooks = Struct()
384 self.hooks = Struct()
386
385
387 # Set all default hooks, defined in the IPython.hooks module.
386 # Set all default hooks, defined in the IPython.hooks module.
388 hooks = IPython.hooks
387 hooks = IPython.hooks
389 for hook_name in hooks.__all__:
388 for hook_name in hooks.__all__:
390 # default hooks have priority 100, i.e. low; user hooks should have 0-100 priority
389 # default hooks have priority 100, i.e. low; user hooks should have 0-100 priority
391 self.set_hook(hook_name,getattr(hooks,hook_name), 100)
390 self.set_hook(hook_name,getattr(hooks,hook_name), 100)
392 #print "bound hook",hook_name
391 #print "bound hook",hook_name
393
392
394 # Flag to mark unconditional exit
393 # Flag to mark unconditional exit
395 self.exit_now = False
394 self.exit_now = False
396
395
397 self.usage_min = """\
396 self.usage_min = """\
398 An enhanced console for Python.
397 An enhanced console for Python.
399 Some of its features are:
398 Some of its features are:
400 - Readline support if the readline library is present.
399 - Readline support if the readline library is present.
401 - Tab completion in the local namespace.
400 - Tab completion in the local namespace.
402 - Logging of input, see command-line options.
401 - Logging of input, see command-line options.
403 - System shell escape via ! , eg !ls.
402 - System shell escape via ! , eg !ls.
404 - Magic commands, starting with a % (like %ls, %pwd, %cd, etc.)
403 - Magic commands, starting with a % (like %ls, %pwd, %cd, etc.)
405 - Keeps track of locally defined variables via %who, %whos.
404 - Keeps track of locally defined variables via %who, %whos.
406 - Show object information with a ? eg ?x or x? (use ?? for more info).
405 - Show object information with a ? eg ?x or x? (use ?? for more info).
407 """
406 """
408 if usage: self.usage = usage
407 if usage: self.usage = usage
409 else: self.usage = self.usage_min
408 else: self.usage = self.usage_min
410
409
411 # Storage
410 # Storage
412 self.rc = rc # This will hold all configuration information
411 self.rc = rc # This will hold all configuration information
413 self.pager = 'less'
412 self.pager = 'less'
414 # temporary files used for various purposes. Deleted at exit.
413 # temporary files used for various purposes. Deleted at exit.
415 self.tempfiles = []
414 self.tempfiles = []
416
415
417 # Keep track of readline usage (later set by init_readline)
416 # Keep track of readline usage (later set by init_readline)
418 self.has_readline = False
417 self.has_readline = False
419
418
420 # template for logfile headers. It gets resolved at runtime by the
419 # template for logfile headers. It gets resolved at runtime by the
421 # logstart method.
420 # logstart method.
422 self.loghead_tpl = \
421 self.loghead_tpl = \
423 """#log# Automatic Logger file. *** THIS MUST BE THE FIRST LINE ***
422 """#log# Automatic Logger file. *** THIS MUST BE THE FIRST LINE ***
424 #log# DO NOT CHANGE THIS LINE OR THE TWO BELOW
423 #log# DO NOT CHANGE THIS LINE OR THE TWO BELOW
425 #log# opts = %s
424 #log# opts = %s
426 #log# args = %s
425 #log# args = %s
427 #log# It is safe to make manual edits below here.
426 #log# It is safe to make manual edits below here.
428 #log#-----------------------------------------------------------------------
427 #log#-----------------------------------------------------------------------
429 """
428 """
430 # for pushd/popd management
429 # for pushd/popd management
431 try:
430 try:
432 self.home_dir = get_home_dir()
431 self.home_dir = get_home_dir()
433 except HomeDirError,msg:
432 except HomeDirError,msg:
434 fatal(msg)
433 fatal(msg)
435
434
436 self.dir_stack = [os.getcwd().replace(self.home_dir,'~')]
435 self.dir_stack = [os.getcwd().replace(self.home_dir,'~')]
437
436
438 # Functions to call the underlying shell.
437 # Functions to call the underlying shell.
439
438
440 # utility to expand user variables via Itpl
439 # utility to expand user variables via Itpl
441 self.var_expand = lambda cmd: str(ItplNS(cmd.replace('#','\#'),
440 self.var_expand = lambda cmd: str(ItplNS(cmd.replace('#','\#'),
442 self.user_ns))
441 self.user_ns))
443 # The first is similar to os.system, but it doesn't return a value,
442 # The first is similar to os.system, but it doesn't return a value,
444 # and it allows interpolation of variables in the user's namespace.
443 # and it allows interpolation of variables in the user's namespace.
445 self.system = lambda cmd: shell(self.var_expand(cmd),
444 self.system = lambda cmd: shell(self.var_expand(cmd),
446 header='IPython system call: ',
445 header='IPython system call: ',
447 verbose=self.rc.system_verbose)
446 verbose=self.rc.system_verbose)
448 # These are for getoutput and getoutputerror:
447 # These are for getoutput and getoutputerror:
449 self.getoutput = lambda cmd: \
448 self.getoutput = lambda cmd: \
450 getoutput(self.var_expand(cmd),
449 getoutput(self.var_expand(cmd),
451 header='IPython system call: ',
450 header='IPython system call: ',
452 verbose=self.rc.system_verbose)
451 verbose=self.rc.system_verbose)
453 self.getoutputerror = lambda cmd: \
452 self.getoutputerror = lambda cmd: \
454 getoutputerror(str(ItplNS(cmd.replace('#','\#'),
453 getoutputerror(str(ItplNS(cmd.replace('#','\#'),
455 self.user_ns)),
454 self.user_ns)),
456 header='IPython system call: ',
455 header='IPython system call: ',
457 verbose=self.rc.system_verbose)
456 verbose=self.rc.system_verbose)
458
457
459 # RegExp for splitting line contents into pre-char//first
458 # RegExp for splitting line contents into pre-char//first
460 # word-method//rest. For clarity, each group in on one line.
459 # word-method//rest. For clarity, each group in on one line.
461
460
462 # WARNING: update the regexp if the above escapes are changed, as they
461 # WARNING: update the regexp if the above escapes are changed, as they
463 # are hardwired in.
462 # are hardwired in.
464
463
465 # Don't get carried away with trying to make the autocalling catch too
464 # Don't get carried away with trying to make the autocalling catch too
466 # much: it's better to be conservative rather than to trigger hidden
465 # much: it's better to be conservative rather than to trigger hidden
467 # evals() somewhere and end up causing side effects.
466 # evals() somewhere and end up causing side effects.
468
467
469 self.line_split = re.compile(r'^([\s*,;/])'
468 self.line_split = re.compile(r'^([\s*,;/])'
470 r'([\?\w\.]+\w*\s*)'
469 r'([\?\w\.]+\w*\s*)'
471 r'(\(?.*$)')
470 r'(\(?.*$)')
472
471
473 # Original re, keep around for a while in case changes break something
472 # Original re, keep around for a while in case changes break something
474 #self.line_split = re.compile(r'(^[\s*!\?%,/]?)'
473 #self.line_split = re.compile(r'(^[\s*!\?%,/]?)'
475 # r'(\s*[\?\w\.]+\w*\s*)'
474 # r'(\s*[\?\w\.]+\w*\s*)'
476 # r'(\(?.*$)')
475 # r'(\(?.*$)')
477
476
478 # RegExp to identify potential function names
477 # RegExp to identify potential function names
479 self.re_fun_name = re.compile(r'[a-zA-Z_]([a-zA-Z0-9_.]*) *$')
478 self.re_fun_name = re.compile(r'[a-zA-Z_]([a-zA-Z0-9_.]*) *$')
480
479
481 # RegExp to exclude strings with this start from autocalling. In
480 # RegExp to exclude strings with this start from autocalling. In
482 # particular, all binary operators should be excluded, so that if foo
481 # particular, all binary operators should be excluded, so that if foo
483 # is callable, foo OP bar doesn't become foo(OP bar), which is
482 # is callable, foo OP bar doesn't become foo(OP bar), which is
484 # invalid. The characters '!=()' don't need to be checked for, as the
483 # invalid. The characters '!=()' don't need to be checked for, as the
485 # _prefilter routine explicitely does so, to catch direct calls and
484 # _prefilter routine explicitely does so, to catch direct calls and
486 # rebindings of existing names.
485 # rebindings of existing names.
487
486
488 # Warning: the '-' HAS TO BE AT THE END of the first group, otherwise
487 # Warning: the '-' HAS TO BE AT THE END of the first group, otherwise
489 # it affects the rest of the group in square brackets.
488 # it affects the rest of the group in square brackets.
490 self.re_exclude_auto = re.compile(r'^[<>,&^\|\*/\+-]'
489 self.re_exclude_auto = re.compile(r'^[<>,&^\|\*/\+-]'
491 '|^is |^not |^in |^and |^or ')
490 '|^is |^not |^in |^and |^or ')
492
491
493 # try to catch also methods for stuff in lists/tuples/dicts: off
492 # try to catch also methods for stuff in lists/tuples/dicts: off
494 # (experimental). For this to work, the line_split regexp would need
493 # (experimental). For this to work, the line_split regexp would need
495 # to be modified so it wouldn't break things at '['. That line is
494 # to be modified so it wouldn't break things at '['. That line is
496 # nasty enough that I shouldn't change it until I can test it _well_.
495 # nasty enough that I shouldn't change it until I can test it _well_.
497 #self.re_fun_name = re.compile (r'[a-zA-Z_]([a-zA-Z0-9_.\[\]]*) ?$')
496 #self.re_fun_name = re.compile (r'[a-zA-Z_]([a-zA-Z0-9_.\[\]]*) ?$')
498
497
499 # keep track of where we started running (mainly for crash post-mortem)
498 # keep track of where we started running (mainly for crash post-mortem)
500 self.starting_dir = os.getcwd()
499 self.starting_dir = os.getcwd()
501
500
502 # Various switches which can be set
501 # Various switches which can be set
503 self.CACHELENGTH = 5000 # this is cheap, it's just text
502 self.CACHELENGTH = 5000 # this is cheap, it's just text
504 self.BANNER = "Python %(version)s on %(platform)s\n" % sys.__dict__
503 self.BANNER = "Python %(version)s on %(platform)s\n" % sys.__dict__
505 self.banner2 = banner2
504 self.banner2 = banner2
506
505
507 # TraceBack handlers:
506 # TraceBack handlers:
508
507
509 # Syntax error handler.
508 # Syntax error handler.
510 self.SyntaxTB = SyntaxTB(color_scheme='NoColor')
509 self.SyntaxTB = SyntaxTB(color_scheme='NoColor')
511
510
512 # The interactive one is initialized with an offset, meaning we always
511 # The interactive one is initialized with an offset, meaning we always
513 # want to remove the topmost item in the traceback, which is our own
512 # want to remove the topmost item in the traceback, which is our own
514 # internal code. Valid modes: ['Plain','Context','Verbose']
513 # internal code. Valid modes: ['Plain','Context','Verbose']
515 self.InteractiveTB = ultraTB.AutoFormattedTB(mode = 'Plain',
514 self.InteractiveTB = ultraTB.AutoFormattedTB(mode = 'Plain',
516 color_scheme='NoColor',
515 color_scheme='NoColor',
517 tb_offset = 1)
516 tb_offset = 1)
518
517
519 # IPython itself shouldn't crash. This will produce a detailed
518 # IPython itself shouldn't crash. This will produce a detailed
520 # post-mortem if it does. But we only install the crash handler for
519 # post-mortem if it does. But we only install the crash handler for
521 # non-threaded shells, the threaded ones use a normal verbose reporter
520 # non-threaded shells, the threaded ones use a normal verbose reporter
522 # and lose the crash handler. This is because exceptions in the main
521 # and lose the crash handler. This is because exceptions in the main
523 # thread (such as in GUI code) propagate directly to sys.excepthook,
522 # thread (such as in GUI code) propagate directly to sys.excepthook,
524 # and there's no point in printing crash dumps for every user exception.
523 # and there's no point in printing crash dumps for every user exception.
525 if self.isthreaded:
524 if self.isthreaded:
526 sys.excepthook = ultraTB.FormattedTB()
525 sys.excepthook = ultraTB.FormattedTB()
527 else:
526 else:
528 from IPython import CrashHandler
527 from IPython import CrashHandler
529 sys.excepthook = CrashHandler.CrashHandler(self)
528 sys.excepthook = CrashHandler.CrashHandler(self)
530
529
531 # The instance will store a pointer to this, so that runtime code
530 # The instance will store a pointer to this, so that runtime code
532 # (such as magics) can access it. This is because during the
531 # (such as magics) can access it. This is because during the
533 # read-eval loop, it gets temporarily overwritten (to deal with GUI
532 # read-eval loop, it gets temporarily overwritten (to deal with GUI
534 # frameworks).
533 # frameworks).
535 self.sys_excepthook = sys.excepthook
534 self.sys_excepthook = sys.excepthook
536
535
537 # and add any custom exception handlers the user may have specified
536 # and add any custom exception handlers the user may have specified
538 self.set_custom_exc(*custom_exceptions)
537 self.set_custom_exc(*custom_exceptions)
539
538
540 # indentation management
539 # indentation management
541 self.autoindent = False
540 self.autoindent = False
542 self.indent_current_nsp = 0
541 self.indent_current_nsp = 0
543
542
544 # Make some aliases automatically
543 # Make some aliases automatically
545 # Prepare list of shell aliases to auto-define
544 # Prepare list of shell aliases to auto-define
546 if os.name == 'posix':
545 if os.name == 'posix':
547 auto_alias = ('mkdir mkdir', 'rmdir rmdir',
546 auto_alias = ('mkdir mkdir', 'rmdir rmdir',
548 'mv mv -i','rm rm -i','cp cp -i',
547 'mv mv -i','rm rm -i','cp cp -i',
549 'cat cat','less less','clear clear',
548 'cat cat','less less','clear clear',
550 # a better ls
549 # a better ls
551 'ls ls -F',
550 'ls ls -F',
552 # long ls
551 # long ls
553 'll ls -lF',
552 'll ls -lF',
554 # color ls
553 # color ls
555 'lc ls -F -o --color',
554 'lc ls -F -o --color',
556 # ls normal files only
555 # ls normal files only
557 'lf ls -F -o --color %l | grep ^-',
556 'lf ls -F -o --color %l | grep ^-',
558 # ls symbolic links
557 # ls symbolic links
559 'lk ls -F -o --color %l | grep ^l',
558 'lk ls -F -o --color %l | grep ^l',
560 # directories or links to directories,
559 # directories or links to directories,
561 'ldir ls -F -o --color %l | grep /$',
560 'ldir ls -F -o --color %l | grep /$',
562 # things which are executable
561 # things which are executable
563 'lx ls -F -o --color %l | grep ^-..x',
562 'lx ls -F -o --color %l | grep ^-..x',
564 )
563 )
565 elif os.name in ['nt','dos']:
564 elif os.name in ['nt','dos']:
566 auto_alias = ('dir dir /on', 'ls dir /on',
565 auto_alias = ('dir dir /on', 'ls dir /on',
567 'ddir dir /ad /on', 'ldir dir /ad /on',
566 'ddir dir /ad /on', 'ldir dir /ad /on',
568 'mkdir mkdir','rmdir rmdir','echo echo',
567 'mkdir mkdir','rmdir rmdir','echo echo',
569 'ren ren','cls cls','copy copy')
568 'ren ren','cls cls','copy copy')
570 else:
569 else:
571 auto_alias = ()
570 auto_alias = ()
572 self.auto_alias = map(lambda s:s.split(None,1),auto_alias)
571 self.auto_alias = map(lambda s:s.split(None,1),auto_alias)
573 # Call the actual (public) initializer
572 # Call the actual (public) initializer
574 self.init_auto_alias()
573 self.init_auto_alias()
575
574
576 # Produce a public API instance
575 # Produce a public API instance
577 self.api = IPython.ipapi.IPApi(self)
576 self.api = IPython.ipapi.IPApi(self)
578
577
579 # track which builtins we add, so we can clean up later
578 # track which builtins we add, so we can clean up later
580 self.builtins_added = {}
579 self.builtins_added = {}
581 # This method will add the necessary builtins for operation, but
580 # This method will add the necessary builtins for operation, but
582 # tracking what it did via the builtins_added dict.
581 # tracking what it did via the builtins_added dict.
583 self.add_builtins()
582 self.add_builtins()
584
583
585 # end __init__
584 # end __init__
586
585
587 def pre_config_initialization(self):
586 def pre_config_initialization(self):
588 """Pre-configuration init method
587 """Pre-configuration init method
589
588
590 This is called before the configuration files are processed to
589 This is called before the configuration files are processed to
591 prepare the services the config files might need.
590 prepare the services the config files might need.
592
591
593 self.rc already has reasonable default values at this point.
592 self.rc already has reasonable default values at this point.
594 """
593 """
595 rc = self.rc
594 rc = self.rc
596
595
597 self.db = pickleshare.PickleShareDB(rc.ipythondir + "/db")
596 self.db = pickleshare.PickleShareDB(rc.ipythondir + "/db")
598
597
599 def post_config_initialization(self):
598 def post_config_initialization(self):
600 """Post configuration init method
599 """Post configuration init method
601
600
602 This is called after the configuration files have been processed to
601 This is called after the configuration files have been processed to
603 'finalize' the initialization."""
602 'finalize' the initialization."""
604
603
605 rc = self.rc
604 rc = self.rc
606
605
607 # Object inspector
606 # Object inspector
608 self.inspector = OInspect.Inspector(OInspect.InspectColors,
607 self.inspector = OInspect.Inspector(OInspect.InspectColors,
609 PyColorize.ANSICodeColors,
608 PyColorize.ANSICodeColors,
610 'NoColor',
609 'NoColor',
611 rc.object_info_string_level)
610 rc.object_info_string_level)
612
611
613 # Load readline proper
612 # Load readline proper
614 if rc.readline:
613 if rc.readline:
615 self.init_readline()
614 self.init_readline()
616
615
617 # local shortcut, this is used a LOT
616 # local shortcut, this is used a LOT
618 self.log = self.logger.log
617 self.log = self.logger.log
619
618
620 # Initialize cache, set in/out prompts and printing system
619 # Initialize cache, set in/out prompts and printing system
621 self.outputcache = CachedOutput(self,
620 self.outputcache = CachedOutput(self,
622 rc.cache_size,
621 rc.cache_size,
623 rc.pprint,
622 rc.pprint,
624 input_sep = rc.separate_in,
623 input_sep = rc.separate_in,
625 output_sep = rc.separate_out,
624 output_sep = rc.separate_out,
626 output_sep2 = rc.separate_out2,
625 output_sep2 = rc.separate_out2,
627 ps1 = rc.prompt_in1,
626 ps1 = rc.prompt_in1,
628 ps2 = rc.prompt_in2,
627 ps2 = rc.prompt_in2,
629 ps_out = rc.prompt_out,
628 ps_out = rc.prompt_out,
630 pad_left = rc.prompts_pad_left)
629 pad_left = rc.prompts_pad_left)
631
630
632 # user may have over-ridden the default print hook:
631 # user may have over-ridden the default print hook:
633 try:
632 try:
634 self.outputcache.__class__.display = self.hooks.display
633 self.outputcache.__class__.display = self.hooks.display
635 except AttributeError:
634 except AttributeError:
636 pass
635 pass
637
636
638 # I don't like assigning globally to sys, because it means when embedding
637 # I don't like assigning globally to sys, because it means when embedding
639 # instances, each embedded instance overrides the previous choice. But
638 # instances, each embedded instance overrides the previous choice. But
640 # sys.displayhook seems to be called internally by exec, so I don't see a
639 # sys.displayhook seems to be called internally by exec, so I don't see a
641 # way around it.
640 # way around it.
642 sys.displayhook = self.outputcache
641 sys.displayhook = self.outputcache
643
642
644 # Set user colors (don't do it in the constructor above so that it
643 # Set user colors (don't do it in the constructor above so that it
645 # doesn't crash if colors option is invalid)
644 # doesn't crash if colors option is invalid)
646 self.magic_colors(rc.colors)
645 self.magic_colors(rc.colors)
647
646
648 # Set calling of pdb on exceptions
647 # Set calling of pdb on exceptions
649 self.call_pdb = rc.pdb
648 self.call_pdb = rc.pdb
650
649
651 # Load user aliases
650 # Load user aliases
652 for alias in rc.alias:
651 for alias in rc.alias:
653 self.magic_alias(alias)
652 self.magic_alias(alias)
654 self.hooks.late_startup_hook()
653 self.hooks.late_startup_hook()
655
654
656 for batchfile in [path(arg) for arg in self.rc.args
655 for batchfile in [path(arg) for arg in self.rc.args
657 if arg.lower().endswith('.ipy')]:
656 if arg.lower().endswith('.ipy')]:
658 if not batchfile.isfile():
657 if not batchfile.isfile():
659 print "No such batch file:", batchfile
658 print "No such batch file:", batchfile
660 continue
659 continue
661 self.api.runlines(batchfile.text())
660 self.api.runlines(batchfile.text())
662
661
663 def add_builtins(self):
662 def add_builtins(self):
664 """Store ipython references into the builtin namespace.
663 """Store ipython references into the builtin namespace.
665
664
666 Some parts of ipython operate via builtins injected here, which hold a
665 Some parts of ipython operate via builtins injected here, which hold a
667 reference to IPython itself."""
666 reference to IPython itself."""
668
667
669 # TODO: deprecate all except _ip; 'jobs' should be installed
668 # TODO: deprecate all except _ip; 'jobs' should be installed
670 # by an extension and the rest are under _ip, ipalias is redundant
669 # by an extension and the rest are under _ip, ipalias is redundant
671 builtins_new = dict(__IPYTHON__ = self,
670 builtins_new = dict(__IPYTHON__ = self,
672 ip_set_hook = self.set_hook,
671 ip_set_hook = self.set_hook,
673 jobs = self.jobs,
672 jobs = self.jobs,
674 ipmagic = self.ipmagic,
673 ipmagic = self.ipmagic,
675 ipalias = self.ipalias,
674 ipalias = self.ipalias,
676 ipsystem = self.ipsystem,
675 ipsystem = self.ipsystem,
677 _ip = self.api
676 _ip = self.api
678 )
677 )
679 for biname,bival in builtins_new.items():
678 for biname,bival in builtins_new.items():
680 try:
679 try:
681 # store the orignal value so we can restore it
680 # store the orignal value so we can restore it
682 self.builtins_added[biname] = __builtin__.__dict__[biname]
681 self.builtins_added[biname] = __builtin__.__dict__[biname]
683 except KeyError:
682 except KeyError:
684 # or mark that it wasn't defined, and we'll just delete it at
683 # or mark that it wasn't defined, and we'll just delete it at
685 # cleanup
684 # cleanup
686 self.builtins_added[biname] = Undefined
685 self.builtins_added[biname] = Undefined
687 __builtin__.__dict__[biname] = bival
686 __builtin__.__dict__[biname] = bival
688
687
689 # Keep in the builtins a flag for when IPython is active. We set it
688 # Keep in the builtins a flag for when IPython is active. We set it
690 # with setdefault so that multiple nested IPythons don't clobber one
689 # with setdefault so that multiple nested IPythons don't clobber one
691 # another. Each will increase its value by one upon being activated,
690 # another. Each will increase its value by one upon being activated,
692 # which also gives us a way to determine the nesting level.
691 # which also gives us a way to determine the nesting level.
693 __builtin__.__dict__.setdefault('__IPYTHON__active',0)
692 __builtin__.__dict__.setdefault('__IPYTHON__active',0)
694
693
695 def clean_builtins(self):
694 def clean_builtins(self):
696 """Remove any builtins which might have been added by add_builtins, or
695 """Remove any builtins which might have been added by add_builtins, or
697 restore overwritten ones to their previous values."""
696 restore overwritten ones to their previous values."""
698 for biname,bival in self.builtins_added.items():
697 for biname,bival in self.builtins_added.items():
699 if bival is Undefined:
698 if bival is Undefined:
700 del __builtin__.__dict__[biname]
699 del __builtin__.__dict__[biname]
701 else:
700 else:
702 __builtin__.__dict__[biname] = bival
701 __builtin__.__dict__[biname] = bival
703 self.builtins_added.clear()
702 self.builtins_added.clear()
704
703
705 def set_hook(self,name,hook, priority = 50):
704 def set_hook(self,name,hook, priority = 50):
706 """set_hook(name,hook) -> sets an internal IPython hook.
705 """set_hook(name,hook) -> sets an internal IPython hook.
707
706
708 IPython exposes some of its internal API as user-modifiable hooks. By
707 IPython exposes some of its internal API as user-modifiable hooks. By
709 adding your function to one of these hooks, you can modify IPython's
708 adding your function to one of these hooks, you can modify IPython's
710 behavior to call at runtime your own routines."""
709 behavior to call at runtime your own routines."""
711
710
712 # At some point in the future, this should validate the hook before it
711 # At some point in the future, this should validate the hook before it
713 # accepts it. Probably at least check that the hook takes the number
712 # accepts it. Probably at least check that the hook takes the number
714 # of args it's supposed to.
713 # of args it's supposed to.
715 dp = getattr(self.hooks, name, None)
714 dp = getattr(self.hooks, name, None)
716 if name not in IPython.hooks.__all__:
715 if name not in IPython.hooks.__all__:
717 print "Warning! Hook '%s' is not one of %s" % (name, IPython.hooks.__all__ )
716 print "Warning! Hook '%s' is not one of %s" % (name, IPython.hooks.__all__ )
718 if not dp:
717 if not dp:
719 dp = IPython.hooks.CommandChainDispatcher()
718 dp = IPython.hooks.CommandChainDispatcher()
720
719
721 f = new.instancemethod(hook,self,self.__class__)
720 f = new.instancemethod(hook,self,self.__class__)
722 try:
721 try:
723 dp.add(f,priority)
722 dp.add(f,priority)
724 except AttributeError:
723 except AttributeError:
725 # it was not commandchain, plain old func - replace
724 # it was not commandchain, plain old func - replace
726 dp = f
725 dp = f
727
726
728 setattr(self.hooks,name, dp)
727 setattr(self.hooks,name, dp)
729
728
730
729
731 #setattr(self.hooks,name,new.instancemethod(hook,self,self.__class__))
730 #setattr(self.hooks,name,new.instancemethod(hook,self,self.__class__))
732
731
733 def set_custom_exc(self,exc_tuple,handler):
732 def set_custom_exc(self,exc_tuple,handler):
734 """set_custom_exc(exc_tuple,handler)
733 """set_custom_exc(exc_tuple,handler)
735
734
736 Set a custom exception handler, which will be called if any of the
735 Set a custom exception handler, which will be called if any of the
737 exceptions in exc_tuple occur in the mainloop (specifically, in the
736 exceptions in exc_tuple occur in the mainloop (specifically, in the
738 runcode() method.
737 runcode() method.
739
738
740 Inputs:
739 Inputs:
741
740
742 - exc_tuple: a *tuple* of valid exceptions to call the defined
741 - exc_tuple: a *tuple* of valid exceptions to call the defined
743 handler for. It is very important that you use a tuple, and NOT A
742 handler for. It is very important that you use a tuple, and NOT A
744 LIST here, because of the way Python's except statement works. If
743 LIST here, because of the way Python's except statement works. If
745 you only want to trap a single exception, use a singleton tuple:
744 you only want to trap a single exception, use a singleton tuple:
746
745
747 exc_tuple == (MyCustomException,)
746 exc_tuple == (MyCustomException,)
748
747
749 - handler: this must be defined as a function with the following
748 - handler: this must be defined as a function with the following
750 basic interface: def my_handler(self,etype,value,tb).
749 basic interface: def my_handler(self,etype,value,tb).
751
750
752 This will be made into an instance method (via new.instancemethod)
751 This will be made into an instance method (via new.instancemethod)
753 of IPython itself, and it will be called if any of the exceptions
752 of IPython itself, and it will be called if any of the exceptions
754 listed in the exc_tuple are caught. If the handler is None, an
753 listed in the exc_tuple are caught. If the handler is None, an
755 internal basic one is used, which just prints basic info.
754 internal basic one is used, which just prints basic info.
756
755
757 WARNING: by putting in your own exception handler into IPython's main
756 WARNING: by putting in your own exception handler into IPython's main
758 execution loop, you run a very good chance of nasty crashes. This
757 execution loop, you run a very good chance of nasty crashes. This
759 facility should only be used if you really know what you are doing."""
758 facility should only be used if you really know what you are doing."""
760
759
761 assert type(exc_tuple)==type(()) , \
760 assert type(exc_tuple)==type(()) , \
762 "The custom exceptions must be given AS A TUPLE."
761 "The custom exceptions must be given AS A TUPLE."
763
762
764 def dummy_handler(self,etype,value,tb):
763 def dummy_handler(self,etype,value,tb):
765 print '*** Simple custom exception handler ***'
764 print '*** Simple custom exception handler ***'
766 print 'Exception type :',etype
765 print 'Exception type :',etype
767 print 'Exception value:',value
766 print 'Exception value:',value
768 print 'Traceback :',tb
767 print 'Traceback :',tb
769 print 'Source code :','\n'.join(self.buffer)
768 print 'Source code :','\n'.join(self.buffer)
770
769
771 if handler is None: handler = dummy_handler
770 if handler is None: handler = dummy_handler
772
771
773 self.CustomTB = new.instancemethod(handler,self,self.__class__)
772 self.CustomTB = new.instancemethod(handler,self,self.__class__)
774 self.custom_exceptions = exc_tuple
773 self.custom_exceptions = exc_tuple
775
774
776 def set_custom_completer(self,completer,pos=0):
775 def set_custom_completer(self,completer,pos=0):
777 """set_custom_completer(completer,pos=0)
776 """set_custom_completer(completer,pos=0)
778
777
779 Adds a new custom completer function.
778 Adds a new custom completer function.
780
779
781 The position argument (defaults to 0) is the index in the completers
780 The position argument (defaults to 0) is the index in the completers
782 list where you want the completer to be inserted."""
781 list where you want the completer to be inserted."""
783
782
784 newcomp = new.instancemethod(completer,self.Completer,
783 newcomp = new.instancemethod(completer,self.Completer,
785 self.Completer.__class__)
784 self.Completer.__class__)
786 self.Completer.matchers.insert(pos,newcomp)
785 self.Completer.matchers.insert(pos,newcomp)
787
786
788 def _get_call_pdb(self):
787 def _get_call_pdb(self):
789 return self._call_pdb
788 return self._call_pdb
790
789
791 def _set_call_pdb(self,val):
790 def _set_call_pdb(self,val):
792
791
793 if val not in (0,1,False,True):
792 if val not in (0,1,False,True):
794 raise ValueError,'new call_pdb value must be boolean'
793 raise ValueError,'new call_pdb value must be boolean'
795
794
796 # store value in instance
795 # store value in instance
797 self._call_pdb = val
796 self._call_pdb = val
798
797
799 # notify the actual exception handlers
798 # notify the actual exception handlers
800 self.InteractiveTB.call_pdb = val
799 self.InteractiveTB.call_pdb = val
801 if self.isthreaded:
800 if self.isthreaded:
802 try:
801 try:
803 self.sys_excepthook.call_pdb = val
802 self.sys_excepthook.call_pdb = val
804 except:
803 except:
805 warn('Failed to activate pdb for threaded exception handler')
804 warn('Failed to activate pdb for threaded exception handler')
806
805
807 call_pdb = property(_get_call_pdb,_set_call_pdb,None,
806 call_pdb = property(_get_call_pdb,_set_call_pdb,None,
808 'Control auto-activation of pdb at exceptions')
807 'Control auto-activation of pdb at exceptions')
809
808
810
809
811 # These special functions get installed in the builtin namespace, to
810 # These special functions get installed in the builtin namespace, to
812 # provide programmatic (pure python) access to magics, aliases and system
811 # provide programmatic (pure python) access to magics, aliases and system
813 # calls. This is important for logging, user scripting, and more.
812 # calls. This is important for logging, user scripting, and more.
814
813
815 # We are basically exposing, via normal python functions, the three
814 # We are basically exposing, via normal python functions, the three
816 # mechanisms in which ipython offers special call modes (magics for
815 # mechanisms in which ipython offers special call modes (magics for
817 # internal control, aliases for direct system access via pre-selected
816 # internal control, aliases for direct system access via pre-selected
818 # names, and !cmd for calling arbitrary system commands).
817 # names, and !cmd for calling arbitrary system commands).
819
818
820 def ipmagic(self,arg_s):
819 def ipmagic(self,arg_s):
821 """Call a magic function by name.
820 """Call a magic function by name.
822
821
823 Input: a string containing the name of the magic function to call and any
822 Input: a string containing the name of the magic function to call and any
824 additional arguments to be passed to the magic.
823 additional arguments to be passed to the magic.
825
824
826 ipmagic('name -opt foo bar') is equivalent to typing at the ipython
825 ipmagic('name -opt foo bar') is equivalent to typing at the ipython
827 prompt:
826 prompt:
828
827
829 In[1]: %name -opt foo bar
828 In[1]: %name -opt foo bar
830
829
831 To call a magic without arguments, simply use ipmagic('name').
830 To call a magic without arguments, simply use ipmagic('name').
832
831
833 This provides a proper Python function to call IPython's magics in any
832 This provides a proper Python function to call IPython's magics in any
834 valid Python code you can type at the interpreter, including loops and
833 valid Python code you can type at the interpreter, including loops and
835 compound statements. It is added by IPython to the Python builtin
834 compound statements. It is added by IPython to the Python builtin
836 namespace upon initialization."""
835 namespace upon initialization."""
837
836
838 args = arg_s.split(' ',1)
837 args = arg_s.split(' ',1)
839 magic_name = args[0]
838 magic_name = args[0]
840 magic_name = magic_name.lstrip(self.ESC_MAGIC)
839 magic_name = magic_name.lstrip(self.ESC_MAGIC)
841
840
842 try:
841 try:
843 magic_args = args[1]
842 magic_args = args[1]
844 except IndexError:
843 except IndexError:
845 magic_args = ''
844 magic_args = ''
846 fn = getattr(self,'magic_'+magic_name,None)
845 fn = getattr(self,'magic_'+magic_name,None)
847 if fn is None:
846 if fn is None:
848 error("Magic function `%s` not found." % magic_name)
847 error("Magic function `%s` not found." % magic_name)
849 else:
848 else:
850 magic_args = self.var_expand(magic_args)
849 magic_args = self.var_expand(magic_args)
851 return fn(magic_args)
850 return fn(magic_args)
852
851
853 def ipalias(self,arg_s):
852 def ipalias(self,arg_s):
854 """Call an alias by name.
853 """Call an alias by name.
855
854
856 Input: a string containing the name of the alias to call and any
855 Input: a string containing the name of the alias to call and any
857 additional arguments to be passed to the magic.
856 additional arguments to be passed to the magic.
858
857
859 ipalias('name -opt foo bar') is equivalent to typing at the ipython
858 ipalias('name -opt foo bar') is equivalent to typing at the ipython
860 prompt:
859 prompt:
861
860
862 In[1]: name -opt foo bar
861 In[1]: name -opt foo bar
863
862
864 To call an alias without arguments, simply use ipalias('name').
863 To call an alias without arguments, simply use ipalias('name').
865
864
866 This provides a proper Python function to call IPython's aliases in any
865 This provides a proper Python function to call IPython's aliases in any
867 valid Python code you can type at the interpreter, including loops and
866 valid Python code you can type at the interpreter, including loops and
868 compound statements. It is added by IPython to the Python builtin
867 compound statements. It is added by IPython to the Python builtin
869 namespace upon initialization."""
868 namespace upon initialization."""
870
869
871 args = arg_s.split(' ',1)
870 args = arg_s.split(' ',1)
872 alias_name = args[0]
871 alias_name = args[0]
873 try:
872 try:
874 alias_args = args[1]
873 alias_args = args[1]
875 except IndexError:
874 except IndexError:
876 alias_args = ''
875 alias_args = ''
877 if alias_name in self.alias_table:
876 if alias_name in self.alias_table:
878 self.call_alias(alias_name,alias_args)
877 self.call_alias(alias_name,alias_args)
879 else:
878 else:
880 error("Alias `%s` not found." % alias_name)
879 error("Alias `%s` not found." % alias_name)
881
880
882 def ipsystem(self,arg_s):
881 def ipsystem(self,arg_s):
883 """Make a system call, using IPython."""
882 """Make a system call, using IPython."""
884
883
885 self.system(arg_s)
884 self.system(arg_s)
886
885
887 def complete(self,text):
886 def complete(self,text):
888 """Return a sorted list of all possible completions on text.
887 """Return a sorted list of all possible completions on text.
889
888
890 Inputs:
889 Inputs:
891
890
892 - text: a string of text to be completed on.
891 - text: a string of text to be completed on.
893
892
894 This is a wrapper around the completion mechanism, similar to what
893 This is a wrapper around the completion mechanism, similar to what
895 readline does at the command line when the TAB key is hit. By
894 readline does at the command line when the TAB key is hit. By
896 exposing it as a method, it can be used by other non-readline
895 exposing it as a method, it can be used by other non-readline
897 environments (such as GUIs) for text completion.
896 environments (such as GUIs) for text completion.
898
897
899 Simple usage example:
898 Simple usage example:
900
899
901 In [1]: x = 'hello'
900 In [1]: x = 'hello'
902
901
903 In [2]: __IP.complete('x.l')
902 In [2]: __IP.complete('x.l')
904 Out[2]: ['x.ljust', 'x.lower', 'x.lstrip']"""
903 Out[2]: ['x.ljust', 'x.lower', 'x.lstrip']"""
905
904
906 complete = self.Completer.complete
905 complete = self.Completer.complete
907 state = 0
906 state = 0
908 # use a dict so we get unique keys, since ipyhton's multiple
907 # use a dict so we get unique keys, since ipyhton's multiple
909 # completers can return duplicates.
908 # completers can return duplicates.
910 comps = {}
909 comps = {}
911 while True:
910 while True:
912 newcomp = complete(text,state)
911 newcomp = complete(text,state)
913 if newcomp is None:
912 if newcomp is None:
914 break
913 break
915 comps[newcomp] = 1
914 comps[newcomp] = 1
916 state += 1
915 state += 1
917 outcomps = comps.keys()
916 outcomps = comps.keys()
918 outcomps.sort()
917 outcomps.sort()
919 return outcomps
918 return outcomps
920
919
921 def set_completer_frame(self, frame=None):
920 def set_completer_frame(self, frame=None):
922 if frame:
921 if frame:
923 self.Completer.namespace = frame.f_locals
922 self.Completer.namespace = frame.f_locals
924 self.Completer.global_namespace = frame.f_globals
923 self.Completer.global_namespace = frame.f_globals
925 else:
924 else:
926 self.Completer.namespace = self.user_ns
925 self.Completer.namespace = self.user_ns
927 self.Completer.global_namespace = self.user_global_ns
926 self.Completer.global_namespace = self.user_global_ns
928
927
929 def init_auto_alias(self):
928 def init_auto_alias(self):
930 """Define some aliases automatically.
929 """Define some aliases automatically.
931
930
932 These are ALL parameter-less aliases"""
931 These are ALL parameter-less aliases"""
933
932
934 for alias,cmd in self.auto_alias:
933 for alias,cmd in self.auto_alias:
935 self.alias_table[alias] = (0,cmd)
934 self.alias_table[alias] = (0,cmd)
936
935
937 def alias_table_validate(self,verbose=0):
936 def alias_table_validate(self,verbose=0):
938 """Update information about the alias table.
937 """Update information about the alias table.
939
938
940 In particular, make sure no Python keywords/builtins are in it."""
939 In particular, make sure no Python keywords/builtins are in it."""
941
940
942 no_alias = self.no_alias
941 no_alias = self.no_alias
943 for k in self.alias_table.keys():
942 for k in self.alias_table.keys():
944 if k in no_alias:
943 if k in no_alias:
945 del self.alias_table[k]
944 del self.alias_table[k]
946 if verbose:
945 if verbose:
947 print ("Deleting alias <%s>, it's a Python "
946 print ("Deleting alias <%s>, it's a Python "
948 "keyword or builtin." % k)
947 "keyword or builtin." % k)
949
948
950 def set_autoindent(self,value=None):
949 def set_autoindent(self,value=None):
951 """Set the autoindent flag, checking for readline support.
950 """Set the autoindent flag, checking for readline support.
952
951
953 If called with no arguments, it acts as a toggle."""
952 If called with no arguments, it acts as a toggle."""
954
953
955 if not self.has_readline:
954 if not self.has_readline:
956 if os.name == 'posix':
955 if os.name == 'posix':
957 warn("The auto-indent feature requires the readline library")
956 warn("The auto-indent feature requires the readline library")
958 self.autoindent = 0
957 self.autoindent = 0
959 return
958 return
960 if value is None:
959 if value is None:
961 self.autoindent = not self.autoindent
960 self.autoindent = not self.autoindent
962 else:
961 else:
963 self.autoindent = value
962 self.autoindent = value
964
963
965 def rc_set_toggle(self,rc_field,value=None):
964 def rc_set_toggle(self,rc_field,value=None):
966 """Set or toggle a field in IPython's rc config. structure.
965 """Set or toggle a field in IPython's rc config. structure.
967
966
968 If called with no arguments, it acts as a toggle.
967 If called with no arguments, it acts as a toggle.
969
968
970 If called with a non-existent field, the resulting AttributeError
969 If called with a non-existent field, the resulting AttributeError
971 exception will propagate out."""
970 exception will propagate out."""
972
971
973 rc_val = getattr(self.rc,rc_field)
972 rc_val = getattr(self.rc,rc_field)
974 if value is None:
973 if value is None:
975 value = not rc_val
974 value = not rc_val
976 setattr(self.rc,rc_field,value)
975 setattr(self.rc,rc_field,value)
977
976
978 def user_setup(self,ipythondir,rc_suffix,mode='install'):
977 def user_setup(self,ipythondir,rc_suffix,mode='install'):
979 """Install the user configuration directory.
978 """Install the user configuration directory.
980
979
981 Can be called when running for the first time or to upgrade the user's
980 Can be called when running for the first time or to upgrade the user's
982 .ipython/ directory with the mode parameter. Valid modes are 'install'
981 .ipython/ directory with the mode parameter. Valid modes are 'install'
983 and 'upgrade'."""
982 and 'upgrade'."""
984
983
985 def wait():
984 def wait():
986 try:
985 try:
987 raw_input("Please press <RETURN> to start IPython.")
986 raw_input("Please press <RETURN> to start IPython.")
988 except EOFError:
987 except EOFError:
989 print >> Term.cout
988 print >> Term.cout
990 print '*'*70
989 print '*'*70
991
990
992 cwd = os.getcwd() # remember where we started
991 cwd = os.getcwd() # remember where we started
993 glb = glob.glob
992 glb = glob.glob
994 print '*'*70
993 print '*'*70
995 if mode == 'install':
994 if mode == 'install':
996 print \
995 print \
997 """Welcome to IPython. I will try to create a personal configuration directory
996 """Welcome to IPython. I will try to create a personal configuration directory
998 where you can customize many aspects of IPython's functionality in:\n"""
997 where you can customize many aspects of IPython's functionality in:\n"""
999 else:
998 else:
1000 print 'I am going to upgrade your configuration in:'
999 print 'I am going to upgrade your configuration in:'
1001
1000
1002 print ipythondir
1001 print ipythondir
1003
1002
1004 rcdirend = os.path.join('IPython','UserConfig')
1003 rcdirend = os.path.join('IPython','UserConfig')
1005 cfg = lambda d: os.path.join(d,rcdirend)
1004 cfg = lambda d: os.path.join(d,rcdirend)
1006 try:
1005 try:
1007 rcdir = filter(os.path.isdir,map(cfg,sys.path))[0]
1006 rcdir = filter(os.path.isdir,map(cfg,sys.path))[0]
1008 except IOError:
1007 except IOError:
1009 warning = """
1008 warning = """
1010 Installation error. IPython's directory was not found.
1009 Installation error. IPython's directory was not found.
1011
1010
1012 Check the following:
1011 Check the following:
1013
1012
1014 The ipython/IPython directory should be in a directory belonging to your
1013 The ipython/IPython directory should be in a directory belonging to your
1015 PYTHONPATH environment variable (that is, it should be in a directory
1014 PYTHONPATH environment variable (that is, it should be in a directory
1016 belonging to sys.path). You can copy it explicitly there or just link to it.
1015 belonging to sys.path). You can copy it explicitly there or just link to it.
1017
1016
1018 IPython will proceed with builtin defaults.
1017 IPython will proceed with builtin defaults.
1019 """
1018 """
1020 warn(warning)
1019 warn(warning)
1021 wait()
1020 wait()
1022 return
1021 return
1023
1022
1024 if mode == 'install':
1023 if mode == 'install':
1025 try:
1024 try:
1026 shutil.copytree(rcdir,ipythondir)
1025 shutil.copytree(rcdir,ipythondir)
1027 os.chdir(ipythondir)
1026 os.chdir(ipythondir)
1028 rc_files = glb("ipythonrc*")
1027 rc_files = glb("ipythonrc*")
1029 for rc_file in rc_files:
1028 for rc_file in rc_files:
1030 os.rename(rc_file,rc_file+rc_suffix)
1029 os.rename(rc_file,rc_file+rc_suffix)
1031 except:
1030 except:
1032 warning = """
1031 warning = """
1033
1032
1034 There was a problem with the installation:
1033 There was a problem with the installation:
1035 %s
1034 %s
1036 Try to correct it or contact the developers if you think it's a bug.
1035 Try to correct it or contact the developers if you think it's a bug.
1037 IPython will proceed with builtin defaults.""" % sys.exc_info()[1]
1036 IPython will proceed with builtin defaults.""" % sys.exc_info()[1]
1038 warn(warning)
1037 warn(warning)
1039 wait()
1038 wait()
1040 return
1039 return
1041
1040
1042 elif mode == 'upgrade':
1041 elif mode == 'upgrade':
1043 try:
1042 try:
1044 os.chdir(ipythondir)
1043 os.chdir(ipythondir)
1045 except:
1044 except:
1046 print """
1045 print """
1047 Can not upgrade: changing to directory %s failed. Details:
1046 Can not upgrade: changing to directory %s failed. Details:
1048 %s
1047 %s
1049 """ % (ipythondir,sys.exc_info()[1])
1048 """ % (ipythondir,sys.exc_info()[1])
1050 wait()
1049 wait()
1051 return
1050 return
1052 else:
1051 else:
1053 sources = glb(os.path.join(rcdir,'[A-Za-z]*'))
1052 sources = glb(os.path.join(rcdir,'[A-Za-z]*'))
1054 for new_full_path in sources:
1053 for new_full_path in sources:
1055 new_filename = os.path.basename(new_full_path)
1054 new_filename = os.path.basename(new_full_path)
1056 if new_filename.startswith('ipythonrc'):
1055 if new_filename.startswith('ipythonrc'):
1057 new_filename = new_filename + rc_suffix
1056 new_filename = new_filename + rc_suffix
1058 # The config directory should only contain files, skip any
1057 # The config directory should only contain files, skip any
1059 # directories which may be there (like CVS)
1058 # directories which may be there (like CVS)
1060 if os.path.isdir(new_full_path):
1059 if os.path.isdir(new_full_path):
1061 continue
1060 continue
1062 if os.path.exists(new_filename):
1061 if os.path.exists(new_filename):
1063 old_file = new_filename+'.old'
1062 old_file = new_filename+'.old'
1064 if os.path.exists(old_file):
1063 if os.path.exists(old_file):
1065 os.remove(old_file)
1064 os.remove(old_file)
1066 os.rename(new_filename,old_file)
1065 os.rename(new_filename,old_file)
1067 shutil.copy(new_full_path,new_filename)
1066 shutil.copy(new_full_path,new_filename)
1068 else:
1067 else:
1069 raise ValueError,'unrecognized mode for install:',`mode`
1068 raise ValueError,'unrecognized mode for install:',`mode`
1070
1069
1071 # Fix line-endings to those native to each platform in the config
1070 # Fix line-endings to those native to each platform in the config
1072 # directory.
1071 # directory.
1073 try:
1072 try:
1074 os.chdir(ipythondir)
1073 os.chdir(ipythondir)
1075 except:
1074 except:
1076 print """
1075 print """
1077 Problem: changing to directory %s failed.
1076 Problem: changing to directory %s failed.
1078 Details:
1077 Details:
1079 %s
1078 %s
1080
1079
1081 Some configuration files may have incorrect line endings. This should not
1080 Some configuration files may have incorrect line endings. This should not
1082 cause any problems during execution. """ % (ipythondir,sys.exc_info()[1])
1081 cause any problems during execution. """ % (ipythondir,sys.exc_info()[1])
1083 wait()
1082 wait()
1084 else:
1083 else:
1085 for fname in glb('ipythonrc*'):
1084 for fname in glb('ipythonrc*'):
1086 try:
1085 try:
1087 native_line_ends(fname,backup=0)
1086 native_line_ends(fname,backup=0)
1088 except IOError:
1087 except IOError:
1089 pass
1088 pass
1090
1089
1091 if mode == 'install':
1090 if mode == 'install':
1092 print """
1091 print """
1093 Successful installation!
1092 Successful installation!
1094
1093
1095 Please read the sections 'Initial Configuration' and 'Quick Tips' in the
1094 Please read the sections 'Initial Configuration' and 'Quick Tips' in the
1096 IPython manual (there are both HTML and PDF versions supplied with the
1095 IPython manual (there are both HTML and PDF versions supplied with the
1097 distribution) to make sure that your system environment is properly configured
1096 distribution) to make sure that your system environment is properly configured
1098 to take advantage of IPython's features.
1097 to take advantage of IPython's features.
1099
1098
1100 Important note: the configuration system has changed! The old system is
1099 Important note: the configuration system has changed! The old system is
1101 still in place, but its setting may be partly overridden by the settings in
1100 still in place, but its setting may be partly overridden by the settings in
1102 "~/.ipython/ipy_user_conf.py" config file. Please take a look at the file
1101 "~/.ipython/ipy_user_conf.py" config file. Please take a look at the file
1103 if some of the new settings bother you.
1102 if some of the new settings bother you.
1104
1103
1105 """
1104 """
1106 else:
1105 else:
1107 print """
1106 print """
1108 Successful upgrade!
1107 Successful upgrade!
1109
1108
1110 All files in your directory:
1109 All files in your directory:
1111 %(ipythondir)s
1110 %(ipythondir)s
1112 which would have been overwritten by the upgrade were backed up with a .old
1111 which would have been overwritten by the upgrade were backed up with a .old
1113 extension. If you had made particular customizations in those files you may
1112 extension. If you had made particular customizations in those files you may
1114 want to merge them back into the new files.""" % locals()
1113 want to merge them back into the new files.""" % locals()
1115 wait()
1114 wait()
1116 os.chdir(cwd)
1115 os.chdir(cwd)
1117 # end user_setup()
1116 # end user_setup()
1118
1117
1119 def atexit_operations(self):
1118 def atexit_operations(self):
1120 """This will be executed at the time of exit.
1119 """This will be executed at the time of exit.
1121
1120
1122 Saving of persistent data should be performed here. """
1121 Saving of persistent data should be performed here. """
1123
1122
1124 #print '*** IPython exit cleanup ***' # dbg
1123 #print '*** IPython exit cleanup ***' # dbg
1125 # input history
1124 # input history
1126 self.savehist()
1125 self.savehist()
1127
1126
1128 # Cleanup all tempfiles left around
1127 # Cleanup all tempfiles left around
1129 for tfile in self.tempfiles:
1128 for tfile in self.tempfiles:
1130 try:
1129 try:
1131 os.unlink(tfile)
1130 os.unlink(tfile)
1132 except OSError:
1131 except OSError:
1133 pass
1132 pass
1134
1133
1135 # save the "persistent data" catch-all dictionary
1134 # save the "persistent data" catch-all dictionary
1136 self.hooks.shutdown_hook()
1135 self.hooks.shutdown_hook()
1137
1136
1138 def savehist(self):
1137 def savehist(self):
1139 """Save input history to a file (via readline library)."""
1138 """Save input history to a file (via readline library)."""
1140 try:
1139 try:
1141 self.readline.write_history_file(self.histfile)
1140 self.readline.write_history_file(self.histfile)
1142 except:
1141 except:
1143 print 'Unable to save IPython command history to file: ' + \
1142 print 'Unable to save IPython command history to file: ' + \
1144 `self.histfile`
1143 `self.histfile`
1145
1144
1146 def pre_readline(self):
1145 def pre_readline(self):
1147 """readline hook to be used at the start of each line.
1146 """readline hook to be used at the start of each line.
1148
1147
1149 Currently it handles auto-indent only."""
1148 Currently it handles auto-indent only."""
1150
1149
1151 #debugx('self.indent_current_nsp','pre_readline:')
1150 #debugx('self.indent_current_nsp','pre_readline:')
1152 self.readline.insert_text(self.indent_current_str())
1151 self.readline.insert_text(self.indent_current_str())
1153
1152
1154 def init_readline(self):
1153 def init_readline(self):
1155 """Command history completion/saving/reloading."""
1154 """Command history completion/saving/reloading."""
1156
1155
1157 import IPython.rlineimpl as readline
1156 import IPython.rlineimpl as readline
1158 if not readline.have_readline:
1157 if not readline.have_readline:
1159 self.has_readline = 0
1158 self.has_readline = 0
1160 self.readline = None
1159 self.readline = None
1161 # no point in bugging windows users with this every time:
1160 # no point in bugging windows users with this every time:
1162 warn('Readline services not available on this platform.')
1161 warn('Readline services not available on this platform.')
1163 else:
1162 else:
1164 sys.modules['readline'] = readline
1163 sys.modules['readline'] = readline
1165 import atexit
1164 import atexit
1166 from IPython.completer import IPCompleter
1165 from IPython.completer import IPCompleter
1167 self.Completer = IPCompleter(self,
1166 self.Completer = IPCompleter(self,
1168 self.user_ns,
1167 self.user_ns,
1169 self.user_global_ns,
1168 self.user_global_ns,
1170 self.rc.readline_omit__names,
1169 self.rc.readline_omit__names,
1171 self.alias_table)
1170 self.alias_table)
1172
1171
1173 # Platform-specific configuration
1172 # Platform-specific configuration
1174 if os.name == 'nt':
1173 if os.name == 'nt':
1175 self.readline_startup_hook = readline.set_pre_input_hook
1174 self.readline_startup_hook = readline.set_pre_input_hook
1176 else:
1175 else:
1177 self.readline_startup_hook = readline.set_startup_hook
1176 self.readline_startup_hook = readline.set_startup_hook
1178
1177
1179 # Load user's initrc file (readline config)
1178 # Load user's initrc file (readline config)
1180 inputrc_name = os.environ.get('INPUTRC')
1179 inputrc_name = os.environ.get('INPUTRC')
1181 if inputrc_name is None:
1180 if inputrc_name is None:
1182 home_dir = get_home_dir()
1181 home_dir = get_home_dir()
1183 if home_dir is not None:
1182 if home_dir is not None:
1184 inputrc_name = os.path.join(home_dir,'.inputrc')
1183 inputrc_name = os.path.join(home_dir,'.inputrc')
1185 if os.path.isfile(inputrc_name):
1184 if os.path.isfile(inputrc_name):
1186 try:
1185 try:
1187 readline.read_init_file(inputrc_name)
1186 readline.read_init_file(inputrc_name)
1188 except:
1187 except:
1189 warn('Problems reading readline initialization file <%s>'
1188 warn('Problems reading readline initialization file <%s>'
1190 % inputrc_name)
1189 % inputrc_name)
1191
1190
1192 self.has_readline = 1
1191 self.has_readline = 1
1193 self.readline = readline
1192 self.readline = readline
1194 # save this in sys so embedded copies can restore it properly
1193 # save this in sys so embedded copies can restore it properly
1195 sys.ipcompleter = self.Completer.complete
1194 sys.ipcompleter = self.Completer.complete
1196 readline.set_completer(self.Completer.complete)
1195 readline.set_completer(self.Completer.complete)
1197
1196
1198 # Configure readline according to user's prefs
1197 # Configure readline according to user's prefs
1199 for rlcommand in self.rc.readline_parse_and_bind:
1198 for rlcommand in self.rc.readline_parse_and_bind:
1200 readline.parse_and_bind(rlcommand)
1199 readline.parse_and_bind(rlcommand)
1201
1200
1202 # remove some chars from the delimiters list
1201 # remove some chars from the delimiters list
1203 delims = readline.get_completer_delims()
1202 delims = readline.get_completer_delims()
1204 delims = delims.translate(string._idmap,
1203 delims = delims.translate(string._idmap,
1205 self.rc.readline_remove_delims)
1204 self.rc.readline_remove_delims)
1206 readline.set_completer_delims(delims)
1205 readline.set_completer_delims(delims)
1207 # otherwise we end up with a monster history after a while:
1206 # otherwise we end up with a monster history after a while:
1208 readline.set_history_length(1000)
1207 readline.set_history_length(1000)
1209 try:
1208 try:
1210 #print '*** Reading readline history' # dbg
1209 #print '*** Reading readline history' # dbg
1211 readline.read_history_file(self.histfile)
1210 readline.read_history_file(self.histfile)
1212 except IOError:
1211 except IOError:
1213 pass # It doesn't exist yet.
1212 pass # It doesn't exist yet.
1214
1213
1215 atexit.register(self.atexit_operations)
1214 atexit.register(self.atexit_operations)
1216 del atexit
1215 del atexit
1217
1216
1218 # Configure auto-indent for all platforms
1217 # Configure auto-indent for all platforms
1219 self.set_autoindent(self.rc.autoindent)
1218 self.set_autoindent(self.rc.autoindent)
1220
1219
1221 def _should_recompile(self,e):
1220 def _should_recompile(self,e):
1222 """Utility routine for edit_syntax_error"""
1221 """Utility routine for edit_syntax_error"""
1223
1222
1224 if e.filename in ('<ipython console>','<input>','<string>',
1223 if e.filename in ('<ipython console>','<input>','<string>',
1225 '<console>','<BackgroundJob compilation>',
1224 '<console>','<BackgroundJob compilation>',
1226 None):
1225 None):
1227
1226
1228 return False
1227 return False
1229 try:
1228 try:
1230 if (self.rc.autoedit_syntax and
1229 if (self.rc.autoedit_syntax and
1231 not ask_yes_no('Return to editor to correct syntax error? '
1230 not ask_yes_no('Return to editor to correct syntax error? '
1232 '[Y/n] ','y')):
1231 '[Y/n] ','y')):
1233 return False
1232 return False
1234 except EOFError:
1233 except EOFError:
1235 return False
1234 return False
1236
1235
1237 def int0(x):
1236 def int0(x):
1238 try:
1237 try:
1239 return int(x)
1238 return int(x)
1240 except TypeError:
1239 except TypeError:
1241 return 0
1240 return 0
1242 # always pass integer line and offset values to editor hook
1241 # always pass integer line and offset values to editor hook
1243 self.hooks.fix_error_editor(e.filename,
1242 self.hooks.fix_error_editor(e.filename,
1244 int0(e.lineno),int0(e.offset),e.msg)
1243 int0(e.lineno),int0(e.offset),e.msg)
1245 return True
1244 return True
1246
1245
1247 def edit_syntax_error(self):
1246 def edit_syntax_error(self):
1248 """The bottom half of the syntax error handler called in the main loop.
1247 """The bottom half of the syntax error handler called in the main loop.
1249
1248
1250 Loop until syntax error is fixed or user cancels.
1249 Loop until syntax error is fixed or user cancels.
1251 """
1250 """
1252
1251
1253 while self.SyntaxTB.last_syntax_error:
1252 while self.SyntaxTB.last_syntax_error:
1254 # copy and clear last_syntax_error
1253 # copy and clear last_syntax_error
1255 err = self.SyntaxTB.clear_err_state()
1254 err = self.SyntaxTB.clear_err_state()
1256 if not self._should_recompile(err):
1255 if not self._should_recompile(err):
1257 return
1256 return
1258 try:
1257 try:
1259 # may set last_syntax_error again if a SyntaxError is raised
1258 # may set last_syntax_error again if a SyntaxError is raised
1260 self.safe_execfile(err.filename,self.shell.user_ns)
1259 self.safe_execfile(err.filename,self.shell.user_ns)
1261 except:
1260 except:
1262 self.showtraceback()
1261 self.showtraceback()
1263 else:
1262 else:
1264 try:
1263 try:
1265 f = file(err.filename)
1264 f = file(err.filename)
1266 try:
1265 try:
1267 sys.displayhook(f.read())
1266 sys.displayhook(f.read())
1268 finally:
1267 finally:
1269 f.close()
1268 f.close()
1270 except:
1269 except:
1271 self.showtraceback()
1270 self.showtraceback()
1272
1271
1273 def showsyntaxerror(self, filename=None):
1272 def showsyntaxerror(self, filename=None):
1274 """Display the syntax error that just occurred.
1273 """Display the syntax error that just occurred.
1275
1274
1276 This doesn't display a stack trace because there isn't one.
1275 This doesn't display a stack trace because there isn't one.
1277
1276
1278 If a filename is given, it is stuffed in the exception instead
1277 If a filename is given, it is stuffed in the exception instead
1279 of what was there before (because Python's parser always uses
1278 of what was there before (because Python's parser always uses
1280 "<string>" when reading from a string).
1279 "<string>" when reading from a string).
1281 """
1280 """
1282 etype, value, last_traceback = sys.exc_info()
1281 etype, value, last_traceback = sys.exc_info()
1283
1282
1284 # See note about these variables in showtraceback() below
1283 # See note about these variables in showtraceback() below
1285 sys.last_type = etype
1284 sys.last_type = etype
1286 sys.last_value = value
1285 sys.last_value = value
1287 sys.last_traceback = last_traceback
1286 sys.last_traceback = last_traceback
1288
1287
1289 if filename and etype is SyntaxError:
1288 if filename and etype is SyntaxError:
1290 # Work hard to stuff the correct filename in the exception
1289 # Work hard to stuff the correct filename in the exception
1291 try:
1290 try:
1292 msg, (dummy_filename, lineno, offset, line) = value
1291 msg, (dummy_filename, lineno, offset, line) = value
1293 except:
1292 except:
1294 # Not the format we expect; leave it alone
1293 # Not the format we expect; leave it alone
1295 pass
1294 pass
1296 else:
1295 else:
1297 # Stuff in the right filename
1296 # Stuff in the right filename
1298 try:
1297 try:
1299 # Assume SyntaxError is a class exception
1298 # Assume SyntaxError is a class exception
1300 value = SyntaxError(msg, (filename, lineno, offset, line))
1299 value = SyntaxError(msg, (filename, lineno, offset, line))
1301 except:
1300 except:
1302 # If that failed, assume SyntaxError is a string
1301 # If that failed, assume SyntaxError is a string
1303 value = msg, (filename, lineno, offset, line)
1302 value = msg, (filename, lineno, offset, line)
1304 self.SyntaxTB(etype,value,[])
1303 self.SyntaxTB(etype,value,[])
1305
1304
1306 def debugger(self):
1305 def debugger(self):
1307 """Call the pdb debugger."""
1306 """Call the pdb debugger."""
1308
1307
1309 if not self.rc.pdb:
1308 if not self.rc.pdb:
1310 return
1309 return
1311 pdb.pm()
1310 pdb.pm()
1312
1311
1313 def showtraceback(self,exc_tuple = None,filename=None,tb_offset=None):
1312 def showtraceback(self,exc_tuple = None,filename=None,tb_offset=None):
1314 """Display the exception that just occurred.
1313 """Display the exception that just occurred.
1315
1314
1316 If nothing is known about the exception, this is the method which
1315 If nothing is known about the exception, this is the method which
1317 should be used throughout the code for presenting user tracebacks,
1316 should be used throughout the code for presenting user tracebacks,
1318 rather than directly invoking the InteractiveTB object.
1317 rather than directly invoking the InteractiveTB object.
1319
1318
1320 A specific showsyntaxerror() also exists, but this method can take
1319 A specific showsyntaxerror() also exists, but this method can take
1321 care of calling it if needed, so unless you are explicitly catching a
1320 care of calling it if needed, so unless you are explicitly catching a
1322 SyntaxError exception, don't try to analyze the stack manually and
1321 SyntaxError exception, don't try to analyze the stack manually and
1323 simply call this method."""
1322 simply call this method."""
1324
1323
1325 # Though this won't be called by syntax errors in the input line,
1324 # Though this won't be called by syntax errors in the input line,
1326 # there may be SyntaxError cases whith imported code.
1325 # there may be SyntaxError cases whith imported code.
1327 if exc_tuple is None:
1326 if exc_tuple is None:
1328 etype, value, tb = sys.exc_info()
1327 etype, value, tb = sys.exc_info()
1329 else:
1328 else:
1330 etype, value, tb = exc_tuple
1329 etype, value, tb = exc_tuple
1331 if etype is SyntaxError:
1330 if etype is SyntaxError:
1332 self.showsyntaxerror(filename)
1331 self.showsyntaxerror(filename)
1333 else:
1332 else:
1334 # WARNING: these variables are somewhat deprecated and not
1333 # WARNING: these variables are somewhat deprecated and not
1335 # necessarily safe to use in a threaded environment, but tools
1334 # necessarily safe to use in a threaded environment, but tools
1336 # like pdb depend on their existence, so let's set them. If we
1335 # like pdb depend on their existence, so let's set them. If we
1337 # find problems in the field, we'll need to revisit their use.
1336 # find problems in the field, we'll need to revisit their use.
1338 sys.last_type = etype
1337 sys.last_type = etype
1339 sys.last_value = value
1338 sys.last_value = value
1340 sys.last_traceback = tb
1339 sys.last_traceback = tb
1341
1340
1342 self.InteractiveTB(etype,value,tb,tb_offset=tb_offset)
1341 self.InteractiveTB(etype,value,tb,tb_offset=tb_offset)
1343 if self.InteractiveTB.call_pdb and self.has_readline:
1342 if self.InteractiveTB.call_pdb and self.has_readline:
1344 # pdb mucks up readline, fix it back
1343 # pdb mucks up readline, fix it back
1345 self.readline.set_completer(self.Completer.complete)
1344 self.readline.set_completer(self.Completer.complete)
1346
1345
1347 def mainloop(self,banner=None):
1346 def mainloop(self,banner=None):
1348 """Creates the local namespace and starts the mainloop.
1347 """Creates the local namespace and starts the mainloop.
1349
1348
1350 If an optional banner argument is given, it will override the
1349 If an optional banner argument is given, it will override the
1351 internally created default banner."""
1350 internally created default banner."""
1352
1351
1353 if self.rc.c: # Emulate Python's -c option
1352 if self.rc.c: # Emulate Python's -c option
1354 self.exec_init_cmd()
1353 self.exec_init_cmd()
1355 if banner is None:
1354 if banner is None:
1356 if not self.rc.banner:
1355 if not self.rc.banner:
1357 banner = ''
1356 banner = ''
1358 # banner is string? Use it directly!
1357 # banner is string? Use it directly!
1359 elif isinstance(self.rc.banner,basestring):
1358 elif isinstance(self.rc.banner,basestring):
1360 banner = self.rc.banner
1359 banner = self.rc.banner
1361 else:
1360 else:
1362 banner = self.BANNER+self.banner2
1361 banner = self.BANNER+self.banner2
1363
1362
1364 self.interact(banner)
1363 self.interact(banner)
1365
1364
1366 def exec_init_cmd(self):
1365 def exec_init_cmd(self):
1367 """Execute a command given at the command line.
1366 """Execute a command given at the command line.
1368
1367
1369 This emulates Python's -c option."""
1368 This emulates Python's -c option."""
1370
1369
1371 #sys.argv = ['-c']
1370 #sys.argv = ['-c']
1372 self.push(self.rc.c)
1371 self.push(self.rc.c)
1373
1372
1374 def embed_mainloop(self,header='',local_ns=None,global_ns=None,stack_depth=0):
1373 def embed_mainloop(self,header='',local_ns=None,global_ns=None,stack_depth=0):
1375 """Embeds IPython into a running python program.
1374 """Embeds IPython into a running python program.
1376
1375
1377 Input:
1376 Input:
1378
1377
1379 - header: An optional header message can be specified.
1378 - header: An optional header message can be specified.
1380
1379
1381 - local_ns, global_ns: working namespaces. If given as None, the
1380 - local_ns, global_ns: working namespaces. If given as None, the
1382 IPython-initialized one is updated with __main__.__dict__, so that
1381 IPython-initialized one is updated with __main__.__dict__, so that
1383 program variables become visible but user-specific configuration
1382 program variables become visible but user-specific configuration
1384 remains possible.
1383 remains possible.
1385
1384
1386 - stack_depth: specifies how many levels in the stack to go to
1385 - stack_depth: specifies how many levels in the stack to go to
1387 looking for namespaces (when local_ns and global_ns are None). This
1386 looking for namespaces (when local_ns and global_ns are None). This
1388 allows an intermediate caller to make sure that this function gets
1387 allows an intermediate caller to make sure that this function gets
1389 the namespace from the intended level in the stack. By default (0)
1388 the namespace from the intended level in the stack. By default (0)
1390 it will get its locals and globals from the immediate caller.
1389 it will get its locals and globals from the immediate caller.
1391
1390
1392 Warning: it's possible to use this in a program which is being run by
1391 Warning: it's possible to use this in a program which is being run by
1393 IPython itself (via %run), but some funny things will happen (a few
1392 IPython itself (via %run), but some funny things will happen (a few
1394 globals get overwritten). In the future this will be cleaned up, as
1393 globals get overwritten). In the future this will be cleaned up, as
1395 there is no fundamental reason why it can't work perfectly."""
1394 there is no fundamental reason why it can't work perfectly."""
1396
1395
1397 # Get locals and globals from caller
1396 # Get locals and globals from caller
1398 if local_ns is None or global_ns is None:
1397 if local_ns is None or global_ns is None:
1399 call_frame = sys._getframe(stack_depth).f_back
1398 call_frame = sys._getframe(stack_depth).f_back
1400
1399
1401 if local_ns is None:
1400 if local_ns is None:
1402 local_ns = call_frame.f_locals
1401 local_ns = call_frame.f_locals
1403 if global_ns is None:
1402 if global_ns is None:
1404 global_ns = call_frame.f_globals
1403 global_ns = call_frame.f_globals
1405
1404
1406 # Update namespaces and fire up interpreter
1405 # Update namespaces and fire up interpreter
1407
1406
1408 # The global one is easy, we can just throw it in
1407 # The global one is easy, we can just throw it in
1409 self.user_global_ns = global_ns
1408 self.user_global_ns = global_ns
1410
1409
1411 # but the user/local one is tricky: ipython needs it to store internal
1410 # but the user/local one is tricky: ipython needs it to store internal
1412 # data, but we also need the locals. We'll copy locals in the user
1411 # data, but we also need the locals. We'll copy locals in the user
1413 # one, but will track what got copied so we can delete them at exit.
1412 # one, but will track what got copied so we can delete them at exit.
1414 # This is so that a later embedded call doesn't see locals from a
1413 # This is so that a later embedded call doesn't see locals from a
1415 # previous call (which most likely existed in a separate scope).
1414 # previous call (which most likely existed in a separate scope).
1416 local_varnames = local_ns.keys()
1415 local_varnames = local_ns.keys()
1417 self.user_ns.update(local_ns)
1416 self.user_ns.update(local_ns)
1418
1417
1419 # Patch for global embedding to make sure that things don't overwrite
1418 # Patch for global embedding to make sure that things don't overwrite
1420 # user globals accidentally. Thanks to Richard <rxe@renre-europe.com>
1419 # user globals accidentally. Thanks to Richard <rxe@renre-europe.com>
1421 # FIXME. Test this a bit more carefully (the if.. is new)
1420 # FIXME. Test this a bit more carefully (the if.. is new)
1422 if local_ns is None and global_ns is None:
1421 if local_ns is None and global_ns is None:
1423 self.user_global_ns.update(__main__.__dict__)
1422 self.user_global_ns.update(__main__.__dict__)
1424
1423
1425 # make sure the tab-completer has the correct frame information, so it
1424 # make sure the tab-completer has the correct frame information, so it
1426 # actually completes using the frame's locals/globals
1425 # actually completes using the frame's locals/globals
1427 self.set_completer_frame()
1426 self.set_completer_frame()
1428
1427
1429 # before activating the interactive mode, we need to make sure that
1428 # before activating the interactive mode, we need to make sure that
1430 # all names in the builtin namespace needed by ipython point to
1429 # all names in the builtin namespace needed by ipython point to
1431 # ourselves, and not to other instances.
1430 # ourselves, and not to other instances.
1432 self.add_builtins()
1431 self.add_builtins()
1433
1432
1434 self.interact(header)
1433 self.interact(header)
1435
1434
1436 # now, purge out the user namespace from anything we might have added
1435 # now, purge out the user namespace from anything we might have added
1437 # from the caller's local namespace
1436 # from the caller's local namespace
1438 delvar = self.user_ns.pop
1437 delvar = self.user_ns.pop
1439 for var in local_varnames:
1438 for var in local_varnames:
1440 delvar(var,None)
1439 delvar(var,None)
1441 # and clean builtins we may have overridden
1440 # and clean builtins we may have overridden
1442 self.clean_builtins()
1441 self.clean_builtins()
1443
1442
1444 def interact(self, banner=None):
1443 def interact(self, banner=None):
1445 """Closely emulate the interactive Python console.
1444 """Closely emulate the interactive Python console.
1446
1445
1447 The optional banner argument specify the banner to print
1446 The optional banner argument specify the banner to print
1448 before the first interaction; by default it prints a banner
1447 before the first interaction; by default it prints a banner
1449 similar to the one printed by the real Python interpreter,
1448 similar to the one printed by the real Python interpreter,
1450 followed by the current class name in parentheses (so as not
1449 followed by the current class name in parentheses (so as not
1451 to confuse this with the real interpreter -- since it's so
1450 to confuse this with the real interpreter -- since it's so
1452 close!).
1451 close!).
1453
1452
1454 """
1453 """
1455 cprt = 'Type "copyright", "credits" or "license" for more information.'
1454 cprt = 'Type "copyright", "credits" or "license" for more information.'
1456 if banner is None:
1455 if banner is None:
1457 self.write("Python %s on %s\n%s\n(%s)\n" %
1456 self.write("Python %s on %s\n%s\n(%s)\n" %
1458 (sys.version, sys.platform, cprt,
1457 (sys.version, sys.platform, cprt,
1459 self.__class__.__name__))
1458 self.__class__.__name__))
1460 else:
1459 else:
1461 self.write(banner)
1460 self.write(banner)
1462
1461
1463 more = 0
1462 more = 0
1464
1463
1465 # Mark activity in the builtins
1464 # Mark activity in the builtins
1466 __builtin__.__dict__['__IPYTHON__active'] += 1
1465 __builtin__.__dict__['__IPYTHON__active'] += 1
1467
1466
1468 # exit_now is set by a call to %Exit or %Quit
1467 # exit_now is set by a call to %Exit or %Quit
1469 self.exit_now = False
1468 self.exit_now = False
1470 while not self.exit_now:
1469 while not self.exit_now:
1471 if more:
1470 if more:
1472 prompt = self.outputcache.prompt2
1471 prompt = self.outputcache.prompt2
1473 if self.autoindent:
1472 if self.autoindent:
1474 self.readline_startup_hook(self.pre_readline)
1473 self.readline_startup_hook(self.pre_readline)
1475 else:
1474 else:
1476 prompt = self.outputcache.prompt1
1475 prompt = self.outputcache.prompt1
1477 try:
1476 try:
1478 line = self.raw_input(prompt,more)
1477 line = self.raw_input(prompt,more)
1479 if self.autoindent:
1478 if self.autoindent:
1480 self.readline_startup_hook(None)
1479 self.readline_startup_hook(None)
1481 except KeyboardInterrupt:
1480 except KeyboardInterrupt:
1482 self.write('\nKeyboardInterrupt\n')
1481 self.write('\nKeyboardInterrupt\n')
1483 self.resetbuffer()
1482 self.resetbuffer()
1484 # keep cache in sync with the prompt counter:
1483 # keep cache in sync with the prompt counter:
1485 self.outputcache.prompt_count -= 1
1484 self.outputcache.prompt_count -= 1
1486
1485
1487 if self.autoindent:
1486 if self.autoindent:
1488 self.indent_current_nsp = 0
1487 self.indent_current_nsp = 0
1489 more = 0
1488 more = 0
1490 except EOFError:
1489 except EOFError:
1491 if self.autoindent:
1490 if self.autoindent:
1492 self.readline_startup_hook(None)
1491 self.readline_startup_hook(None)
1493 self.write('\n')
1492 self.write('\n')
1494 self.exit()
1493 self.exit()
1495 except bdb.BdbQuit:
1494 except bdb.BdbQuit:
1496 warn('The Python debugger has exited with a BdbQuit exception.\n'
1495 warn('The Python debugger has exited with a BdbQuit exception.\n'
1497 'Because of how pdb handles the stack, it is impossible\n'
1496 'Because of how pdb handles the stack, it is impossible\n'
1498 'for IPython to properly format this particular exception.\n'
1497 'for IPython to properly format this particular exception.\n'
1499 'IPython will resume normal operation.')
1498 'IPython will resume normal operation.')
1500 except:
1499 except:
1501 # exceptions here are VERY RARE, but they can be triggered
1500 # exceptions here are VERY RARE, but they can be triggered
1502 # asynchronously by signal handlers, for example.
1501 # asynchronously by signal handlers, for example.
1503 self.showtraceback()
1502 self.showtraceback()
1504 else:
1503 else:
1505 more = self.push(line)
1504 more = self.push(line)
1506 if (self.SyntaxTB.last_syntax_error and
1505 if (self.SyntaxTB.last_syntax_error and
1507 self.rc.autoedit_syntax):
1506 self.rc.autoedit_syntax):
1508 self.edit_syntax_error()
1507 self.edit_syntax_error()
1509
1508
1510 # We are off again...
1509 # We are off again...
1511 __builtin__.__dict__['__IPYTHON__active'] -= 1
1510 __builtin__.__dict__['__IPYTHON__active'] -= 1
1512
1511
1513 def excepthook(self, etype, value, tb):
1512 def excepthook(self, etype, value, tb):
1514 """One more defense for GUI apps that call sys.excepthook.
1513 """One more defense for GUI apps that call sys.excepthook.
1515
1514
1516 GUI frameworks like wxPython trap exceptions and call
1515 GUI frameworks like wxPython trap exceptions and call
1517 sys.excepthook themselves. I guess this is a feature that
1516 sys.excepthook themselves. I guess this is a feature that
1518 enables them to keep running after exceptions that would
1517 enables them to keep running after exceptions that would
1519 otherwise kill their mainloop. This is a bother for IPython
1518 otherwise kill their mainloop. This is a bother for IPython
1520 which excepts to catch all of the program exceptions with a try:
1519 which excepts to catch all of the program exceptions with a try:
1521 except: statement.
1520 except: statement.
1522
1521
1523 Normally, IPython sets sys.excepthook to a CrashHandler instance, so if
1522 Normally, IPython sets sys.excepthook to a CrashHandler instance, so if
1524 any app directly invokes sys.excepthook, it will look to the user like
1523 any app directly invokes sys.excepthook, it will look to the user like
1525 IPython crashed. In order to work around this, we can disable the
1524 IPython crashed. In order to work around this, we can disable the
1526 CrashHandler and replace it with this excepthook instead, which prints a
1525 CrashHandler and replace it with this excepthook instead, which prints a
1527 regular traceback using our InteractiveTB. In this fashion, apps which
1526 regular traceback using our InteractiveTB. In this fashion, apps which
1528 call sys.excepthook will generate a regular-looking exception from
1527 call sys.excepthook will generate a regular-looking exception from
1529 IPython, and the CrashHandler will only be triggered by real IPython
1528 IPython, and the CrashHandler will only be triggered by real IPython
1530 crashes.
1529 crashes.
1531
1530
1532 This hook should be used sparingly, only in places which are not likely
1531 This hook should be used sparingly, only in places which are not likely
1533 to be true IPython errors.
1532 to be true IPython errors.
1534 """
1533 """
1535 self.showtraceback((etype,value,tb),tb_offset=0)
1534 self.showtraceback((etype,value,tb),tb_offset=0)
1536
1535
1537 def transform_alias(self, alias,rest=''):
1536 def transform_alias(self, alias,rest=''):
1538 """ Transform alias to system command string
1537 """ Transform alias to system command string
1539
1538
1540 """
1539 """
1541 nargs,cmd = self.alias_table[alias]
1540 nargs,cmd = self.alias_table[alias]
1542 if ' ' in cmd and os.path.isfile(cmd):
1541 if ' ' in cmd and os.path.isfile(cmd):
1543 cmd = '"%s"' % cmd
1542 cmd = '"%s"' % cmd
1544
1543
1545 # Expand the %l special to be the user's input line
1544 # Expand the %l special to be the user's input line
1546 if cmd.find('%l') >= 0:
1545 if cmd.find('%l') >= 0:
1547 cmd = cmd.replace('%l',rest)
1546 cmd = cmd.replace('%l',rest)
1548 rest = ''
1547 rest = ''
1549 if nargs==0:
1548 if nargs==0:
1550 # Simple, argument-less aliases
1549 # Simple, argument-less aliases
1551 cmd = '%s %s' % (cmd,rest)
1550 cmd = '%s %s' % (cmd,rest)
1552 else:
1551 else:
1553 # Handle aliases with positional arguments
1552 # Handle aliases with positional arguments
1554 args = rest.split(None,nargs)
1553 args = rest.split(None,nargs)
1555 if len(args)< nargs:
1554 if len(args)< nargs:
1556 error('Alias <%s> requires %s arguments, %s given.' %
1555 error('Alias <%s> requires %s arguments, %s given.' %
1557 (alias,nargs,len(args)))
1556 (alias,nargs,len(args)))
1558 return None
1557 return None
1559 cmd = '%s %s' % (cmd % tuple(args[:nargs]),' '.join(args[nargs:]))
1558 cmd = '%s %s' % (cmd % tuple(args[:nargs]),' '.join(args[nargs:]))
1560 # Now call the macro, evaluating in the user's namespace
1559 # Now call the macro, evaluating in the user's namespace
1561
1560
1562 return cmd
1561 return cmd
1563
1562
1564 def call_alias(self,alias,rest=''):
1563 def call_alias(self,alias,rest=''):
1565 """Call an alias given its name and the rest of the line.
1564 """Call an alias given its name and the rest of the line.
1566
1565
1567 This is only used to provide backwards compatibility for users of
1566 This is only used to provide backwards compatibility for users of
1568 ipalias(), use of which is not recommended for anymore."""
1567 ipalias(), use of which is not recommended for anymore."""
1569
1568
1570 # Now call the macro, evaluating in the user's namespace
1569 # Now call the macro, evaluating in the user's namespace
1571 cmd = self.transform_alias(alias, rest)
1570 cmd = self.transform_alias(alias, rest)
1572 try:
1571 try:
1573 self.system(cmd)
1572 self.system(cmd)
1574 except:
1573 except:
1575 self.showtraceback()
1574 self.showtraceback()
1576
1575
1577 def indent_current_str(self):
1576 def indent_current_str(self):
1578 """return the current level of indentation as a string"""
1577 """return the current level of indentation as a string"""
1579 return self.indent_current_nsp * ' '
1578 return self.indent_current_nsp * ' '
1580
1579
1581 def autoindent_update(self,line):
1580 def autoindent_update(self,line):
1582 """Keep track of the indent level."""
1581 """Keep track of the indent level."""
1583
1582
1584 #debugx('line')
1583 #debugx('line')
1585 #debugx('self.indent_current_nsp')
1584 #debugx('self.indent_current_nsp')
1586 if self.autoindent:
1585 if self.autoindent:
1587 if line:
1586 if line:
1588 inisp = num_ini_spaces(line)
1587 inisp = num_ini_spaces(line)
1589 if inisp < self.indent_current_nsp:
1588 if inisp < self.indent_current_nsp:
1590 self.indent_current_nsp = inisp
1589 self.indent_current_nsp = inisp
1591
1590
1592 if line[-1] == ':':
1591 if line[-1] == ':':
1593 self.indent_current_nsp += 4
1592 self.indent_current_nsp += 4
1594 elif dedent_re.match(line):
1593 elif dedent_re.match(line):
1595 self.indent_current_nsp -= 4
1594 self.indent_current_nsp -= 4
1596 else:
1595 else:
1597 self.indent_current_nsp = 0
1596 self.indent_current_nsp = 0
1598
1597
1599 def runlines(self,lines):
1598 def runlines(self,lines):
1600 """Run a string of one or more lines of source.
1599 """Run a string of one or more lines of source.
1601
1600
1602 This method is capable of running a string containing multiple source
1601 This method is capable of running a string containing multiple source
1603 lines, as if they had been entered at the IPython prompt. Since it
1602 lines, as if they had been entered at the IPython prompt. Since it
1604 exposes IPython's processing machinery, the given strings can contain
1603 exposes IPython's processing machinery, the given strings can contain
1605 magic calls (%magic), special shell access (!cmd), etc."""
1604 magic calls (%magic), special shell access (!cmd), etc."""
1606
1605
1607 # We must start with a clean buffer, in case this is run from an
1606 # We must start with a clean buffer, in case this is run from an
1608 # interactive IPython session (via a magic, for example).
1607 # interactive IPython session (via a magic, for example).
1609 self.resetbuffer()
1608 self.resetbuffer()
1610 lines = lines.split('\n')
1609 lines = lines.split('\n')
1611 more = 0
1610 more = 0
1612 for line in lines:
1611 for line in lines:
1613 # skip blank lines so we don't mess up the prompt counter, but do
1612 # skip blank lines so we don't mess up the prompt counter, but do
1614 # NOT skip even a blank line if we are in a code block (more is
1613 # NOT skip even a blank line if we are in a code block (more is
1615 # true)
1614 # true)
1616 if line or more:
1615 if line or more:
1617 more = self.push(self.prefilter(line,more))
1616 more = self.push(self.prefilter(line,more))
1618 # IPython's runsource returns None if there was an error
1617 # IPython's runsource returns None if there was an error
1619 # compiling the code. This allows us to stop processing right
1618 # compiling the code. This allows us to stop processing right
1620 # away, so the user gets the error message at the right place.
1619 # away, so the user gets the error message at the right place.
1621 if more is None:
1620 if more is None:
1622 break
1621 break
1623 # final newline in case the input didn't have it, so that the code
1622 # final newline in case the input didn't have it, so that the code
1624 # actually does get executed
1623 # actually does get executed
1625 if more:
1624 if more:
1626 self.push('\n')
1625 self.push('\n')
1627
1626
1628 def runsource(self, source, filename='<input>', symbol='single'):
1627 def runsource(self, source, filename='<input>', symbol='single'):
1629 """Compile and run some source in the interpreter.
1628 """Compile and run some source in the interpreter.
1630
1629
1631 Arguments are as for compile_command().
1630 Arguments are as for compile_command().
1632
1631
1633 One several things can happen:
1632 One several things can happen:
1634
1633
1635 1) The input is incorrect; compile_command() raised an
1634 1) The input is incorrect; compile_command() raised an
1636 exception (SyntaxError or OverflowError). A syntax traceback
1635 exception (SyntaxError or OverflowError). A syntax traceback
1637 will be printed by calling the showsyntaxerror() method.
1636 will be printed by calling the showsyntaxerror() method.
1638
1637
1639 2) The input is incomplete, and more input is required;
1638 2) The input is incomplete, and more input is required;
1640 compile_command() returned None. Nothing happens.
1639 compile_command() returned None. Nothing happens.
1641
1640
1642 3) The input is complete; compile_command() returned a code
1641 3) The input is complete; compile_command() returned a code
1643 object. The code is executed by calling self.runcode() (which
1642 object. The code is executed by calling self.runcode() (which
1644 also handles run-time exceptions, except for SystemExit).
1643 also handles run-time exceptions, except for SystemExit).
1645
1644
1646 The return value is:
1645 The return value is:
1647
1646
1648 - True in case 2
1647 - True in case 2
1649
1648
1650 - False in the other cases, unless an exception is raised, where
1649 - False in the other cases, unless an exception is raised, where
1651 None is returned instead. This can be used by external callers to
1650 None is returned instead. This can be used by external callers to
1652 know whether to continue feeding input or not.
1651 know whether to continue feeding input or not.
1653
1652
1654 The return value can be used to decide whether to use sys.ps1 or
1653 The return value can be used to decide whether to use sys.ps1 or
1655 sys.ps2 to prompt the next line."""
1654 sys.ps2 to prompt the next line."""
1656
1655
1657 try:
1656 try:
1658 code = self.compile(source,filename,symbol)
1657 code = self.compile(source,filename,symbol)
1659 except (OverflowError, SyntaxError, ValueError):
1658 except (OverflowError, SyntaxError, ValueError):
1660 # Case 1
1659 # Case 1
1661 self.showsyntaxerror(filename)
1660 self.showsyntaxerror(filename)
1662 return None
1661 return None
1663
1662
1664 if code is None:
1663 if code is None:
1665 # Case 2
1664 # Case 2
1666 return True
1665 return True
1667
1666
1668 # Case 3
1667 # Case 3
1669 # We store the code object so that threaded shells and
1668 # We store the code object so that threaded shells and
1670 # custom exception handlers can access all this info if needed.
1669 # custom exception handlers can access all this info if needed.
1671 # The source corresponding to this can be obtained from the
1670 # The source corresponding to this can be obtained from the
1672 # buffer attribute as '\n'.join(self.buffer).
1671 # buffer attribute as '\n'.join(self.buffer).
1673 self.code_to_run = code
1672 self.code_to_run = code
1674 # now actually execute the code object
1673 # now actually execute the code object
1675 if self.runcode(code) == 0:
1674 if self.runcode(code) == 0:
1676 return False
1675 return False
1677 else:
1676 else:
1678 return None
1677 return None
1679
1678
1680 def runcode(self,code_obj):
1679 def runcode(self,code_obj):
1681 """Execute a code object.
1680 """Execute a code object.
1682
1681
1683 When an exception occurs, self.showtraceback() is called to display a
1682 When an exception occurs, self.showtraceback() is called to display a
1684 traceback.
1683 traceback.
1685
1684
1686 Return value: a flag indicating whether the code to be run completed
1685 Return value: a flag indicating whether the code to be run completed
1687 successfully:
1686 successfully:
1688
1687
1689 - 0: successful execution.
1688 - 0: successful execution.
1690 - 1: an error occurred.
1689 - 1: an error occurred.
1691 """
1690 """
1692
1691
1693 # Set our own excepthook in case the user code tries to call it
1692 # Set our own excepthook in case the user code tries to call it
1694 # directly, so that the IPython crash handler doesn't get triggered
1693 # directly, so that the IPython crash handler doesn't get triggered
1695 old_excepthook,sys.excepthook = sys.excepthook, self.excepthook
1694 old_excepthook,sys.excepthook = sys.excepthook, self.excepthook
1696
1695
1697 # we save the original sys.excepthook in the instance, in case config
1696 # we save the original sys.excepthook in the instance, in case config
1698 # code (such as magics) needs access to it.
1697 # code (such as magics) needs access to it.
1699 self.sys_excepthook = old_excepthook
1698 self.sys_excepthook = old_excepthook
1700 outflag = 1 # happens in more places, so it's easier as default
1699 outflag = 1 # happens in more places, so it's easier as default
1701 try:
1700 try:
1702 try:
1701 try:
1703 # Embedded instances require separate global/local namespaces
1702 # Embedded instances require separate global/local namespaces
1704 # so they can see both the surrounding (local) namespace and
1703 # so they can see both the surrounding (local) namespace and
1705 # the module-level globals when called inside another function.
1704 # the module-level globals when called inside another function.
1706 if self.embedded:
1705 if self.embedded:
1707 exec code_obj in self.user_global_ns, self.user_ns
1706 exec code_obj in self.user_global_ns, self.user_ns
1708 # Normal (non-embedded) instances should only have a single
1707 # Normal (non-embedded) instances should only have a single
1709 # namespace for user code execution, otherwise functions won't
1708 # namespace for user code execution, otherwise functions won't
1710 # see interactive top-level globals.
1709 # see interactive top-level globals.
1711 else:
1710 else:
1712 exec code_obj in self.user_ns
1711 exec code_obj in self.user_ns
1713 finally:
1712 finally:
1714 # Reset our crash handler in place
1713 # Reset our crash handler in place
1715 sys.excepthook = old_excepthook
1714 sys.excepthook = old_excepthook
1716 except SystemExit:
1715 except SystemExit:
1717 self.resetbuffer()
1716 self.resetbuffer()
1718 self.showtraceback()
1717 self.showtraceback()
1719 warn("Type exit or quit to exit IPython "
1718 warn("Type exit or quit to exit IPython "
1720 "(%Exit or %Quit do so unconditionally).",level=1)
1719 "(%Exit or %Quit do so unconditionally).",level=1)
1721 except self.custom_exceptions:
1720 except self.custom_exceptions:
1722 etype,value,tb = sys.exc_info()
1721 etype,value,tb = sys.exc_info()
1723 self.CustomTB(etype,value,tb)
1722 self.CustomTB(etype,value,tb)
1724 except:
1723 except:
1725 self.showtraceback()
1724 self.showtraceback()
1726 else:
1725 else:
1727 outflag = 0
1726 outflag = 0
1728 if softspace(sys.stdout, 0):
1727 if softspace(sys.stdout, 0):
1729 print
1728 print
1730 # Flush out code object which has been run (and source)
1729 # Flush out code object which has been run (and source)
1731 self.code_to_run = None
1730 self.code_to_run = None
1732 return outflag
1731 return outflag
1733
1732
1734 def push(self, line):
1733 def push(self, line):
1735 """Push a line to the interpreter.
1734 """Push a line to the interpreter.
1736
1735
1737 The line should not have a trailing newline; it may have
1736 The line should not have a trailing newline; it may have
1738 internal newlines. The line is appended to a buffer and the
1737 internal newlines. The line is appended to a buffer and the
1739 interpreter's runsource() method is called with the
1738 interpreter's runsource() method is called with the
1740 concatenated contents of the buffer as source. If this
1739 concatenated contents of the buffer as source. If this
1741 indicates that the command was executed or invalid, the buffer
1740 indicates that the command was executed or invalid, the buffer
1742 is reset; otherwise, the command is incomplete, and the buffer
1741 is reset; otherwise, the command is incomplete, and the buffer
1743 is left as it was after the line was appended. The return
1742 is left as it was after the line was appended. The return
1744 value is 1 if more input is required, 0 if the line was dealt
1743 value is 1 if more input is required, 0 if the line was dealt
1745 with in some way (this is the same as runsource()).
1744 with in some way (this is the same as runsource()).
1746 """
1745 """
1747
1746
1748 # autoindent management should be done here, and not in the
1747 # autoindent management should be done here, and not in the
1749 # interactive loop, since that one is only seen by keyboard input. We
1748 # interactive loop, since that one is only seen by keyboard input. We
1750 # need this done correctly even for code run via runlines (which uses
1749 # need this done correctly even for code run via runlines (which uses
1751 # push).
1750 # push).
1752
1751
1753 #print 'push line: <%s>' % line # dbg
1752 #print 'push line: <%s>' % line # dbg
1754 self.autoindent_update(line)
1753 self.autoindent_update(line)
1755
1754
1756 self.buffer.append(line)
1755 self.buffer.append(line)
1757 more = self.runsource('\n'.join(self.buffer), self.filename)
1756 more = self.runsource('\n'.join(self.buffer), self.filename)
1758 if not more:
1757 if not more:
1759 self.resetbuffer()
1758 self.resetbuffer()
1760 return more
1759 return more
1761
1760
1762 def resetbuffer(self):
1761 def resetbuffer(self):
1763 """Reset the input buffer."""
1762 """Reset the input buffer."""
1764 self.buffer[:] = []
1763 self.buffer[:] = []
1765
1764
1766 def raw_input(self,prompt='',continue_prompt=False):
1765 def raw_input(self,prompt='',continue_prompt=False):
1767 """Write a prompt and read a line.
1766 """Write a prompt and read a line.
1768
1767
1769 The returned line does not include the trailing newline.
1768 The returned line does not include the trailing newline.
1770 When the user enters the EOF key sequence, EOFError is raised.
1769 When the user enters the EOF key sequence, EOFError is raised.
1771
1770
1772 Optional inputs:
1771 Optional inputs:
1773
1772
1774 - prompt(''): a string to be printed to prompt the user.
1773 - prompt(''): a string to be printed to prompt the user.
1775
1774
1776 - continue_prompt(False): whether this line is the first one or a
1775 - continue_prompt(False): whether this line is the first one or a
1777 continuation in a sequence of inputs.
1776 continuation in a sequence of inputs.
1778 """
1777 """
1779
1778
1780 line = raw_input_original(prompt)
1779 line = raw_input_original(prompt)
1781
1780
1782 # Try to be reasonably smart about not re-indenting pasted input more
1781 # Try to be reasonably smart about not re-indenting pasted input more
1783 # than necessary. We do this by trimming out the auto-indent initial
1782 # than necessary. We do this by trimming out the auto-indent initial
1784 # spaces, if the user's actual input started itself with whitespace.
1783 # spaces, if the user's actual input started itself with whitespace.
1785 #debugx('self.buffer[-1]')
1784 #debugx('self.buffer[-1]')
1786
1785
1787 if self.autoindent:
1786 if self.autoindent:
1788 if num_ini_spaces(line) > self.indent_current_nsp:
1787 if num_ini_spaces(line) > self.indent_current_nsp:
1789 line = line[self.indent_current_nsp:]
1788 line = line[self.indent_current_nsp:]
1790 self.indent_current_nsp = 0
1789 self.indent_current_nsp = 0
1791
1790
1792 # store the unfiltered input before the user has any chance to modify
1791 # store the unfiltered input before the user has any chance to modify
1793 # it.
1792 # it.
1794 if line.strip():
1793 if line.strip():
1795 if continue_prompt:
1794 if continue_prompt:
1796 self.input_hist_raw[-1] += '%s\n' % line
1795 self.input_hist_raw[-1] += '%s\n' % line
1797 else:
1796 else:
1798 self.input_hist_raw.append('%s\n' % line)
1797 self.input_hist_raw.append('%s\n' % line)
1799
1798
1800 try:
1799 try:
1801 lineout = self.prefilter(line,continue_prompt)
1800 lineout = self.prefilter(line,continue_prompt)
1802 except:
1801 except:
1803 # blanket except, in case a user-defined prefilter crashes, so it
1802 # blanket except, in case a user-defined prefilter crashes, so it
1804 # can't take all of ipython with it.
1803 # can't take all of ipython with it.
1805 self.showtraceback()
1804 self.showtraceback()
1806 return lineout
1805 return lineout
1807
1806
1808 def split_user_input(self,line):
1807 def split_user_input(self,line):
1809 """Split user input into pre-char, function part and rest."""
1808 """Split user input into pre-char, function part and rest."""
1810
1809
1811 lsplit = self.line_split.match(line)
1810 lsplit = self.line_split.match(line)
1812 if lsplit is None: # no regexp match returns None
1811 if lsplit is None: # no regexp match returns None
1813 try:
1812 try:
1814 iFun,theRest = line.split(None,1)
1813 iFun,theRest = line.split(None,1)
1815 except ValueError:
1814 except ValueError:
1816 iFun,theRest = line,''
1815 iFun,theRest = line,''
1817 pre = re.match('^(\s*)(.*)',line).groups()[0]
1816 pre = re.match('^(\s*)(.*)',line).groups()[0]
1818 else:
1817 else:
1819 pre,iFun,theRest = lsplit.groups()
1818 pre,iFun,theRest = lsplit.groups()
1820
1819
1821 #print 'line:<%s>' % line # dbg
1820 #print 'line:<%s>' % line # dbg
1822 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun.strip(),theRest) # dbg
1821 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun.strip(),theRest) # dbg
1823 return pre,iFun.strip(),theRest
1822 return pre,iFun.strip(),theRest
1824
1823
1825 def _prefilter(self, line, continue_prompt):
1824 def _prefilter(self, line, continue_prompt):
1826 """Calls different preprocessors, depending on the form of line."""
1825 """Calls different preprocessors, depending on the form of line."""
1827
1826
1828 # All handlers *must* return a value, even if it's blank ('').
1827 # All handlers *must* return a value, even if it's blank ('').
1829
1828
1830 # Lines are NOT logged here. Handlers should process the line as
1829 # Lines are NOT logged here. Handlers should process the line as
1831 # needed, update the cache AND log it (so that the input cache array
1830 # needed, update the cache AND log it (so that the input cache array
1832 # stays synced).
1831 # stays synced).
1833
1832
1834 # This function is _very_ delicate, and since it's also the one which
1833 # This function is _very_ delicate, and since it's also the one which
1835 # determines IPython's response to user input, it must be as efficient
1834 # determines IPython's response to user input, it must be as efficient
1836 # as possible. For this reason it has _many_ returns in it, trying
1835 # as possible. For this reason it has _many_ returns in it, trying
1837 # always to exit as quickly as it can figure out what it needs to do.
1836 # always to exit as quickly as it can figure out what it needs to do.
1838
1837
1839 # This function is the main responsible for maintaining IPython's
1838 # This function is the main responsible for maintaining IPython's
1840 # behavior respectful of Python's semantics. So be _very_ careful if
1839 # behavior respectful of Python's semantics. So be _very_ careful if
1841 # making changes to anything here.
1840 # making changes to anything here.
1842
1841
1843 #.....................................................................
1842 #.....................................................................
1844 # Code begins
1843 # Code begins
1845
1844
1846 #if line.startswith('%crash'): raise RuntimeError,'Crash now!' # dbg
1845 #if line.startswith('%crash'): raise RuntimeError,'Crash now!' # dbg
1847
1846
1848 # save the line away in case we crash, so the post-mortem handler can
1847 # save the line away in case we crash, so the post-mortem handler can
1849 # record it
1848 # record it
1850 self._last_input_line = line
1849 self._last_input_line = line
1851
1850
1852 #print '***line: <%s>' % line # dbg
1851 #print '***line: <%s>' % line # dbg
1853
1852
1854 # the input history needs to track even empty lines
1853 # the input history needs to track even empty lines
1855 stripped = line.strip()
1854 stripped = line.strip()
1856
1855
1857 if not stripped:
1856 if not stripped:
1858 if not continue_prompt:
1857 if not continue_prompt:
1859 self.outputcache.prompt_count -= 1
1858 self.outputcache.prompt_count -= 1
1860 return self.handle_normal(line,continue_prompt)
1859 return self.handle_normal(line,continue_prompt)
1861 #return self.handle_normal('',continue_prompt)
1860 #return self.handle_normal('',continue_prompt)
1862
1861
1863 # print '***cont',continue_prompt # dbg
1862 # print '***cont',continue_prompt # dbg
1864 # special handlers are only allowed for single line statements
1863 # special handlers are only allowed for single line statements
1865 if continue_prompt and not self.rc.multi_line_specials:
1864 if continue_prompt and not self.rc.multi_line_specials:
1866 return self.handle_normal(line,continue_prompt)
1865 return self.handle_normal(line,continue_prompt)
1867
1866
1868
1867
1869 # For the rest, we need the structure of the input
1868 # For the rest, we need the structure of the input
1870 pre,iFun,theRest = self.split_user_input(line)
1869 pre,iFun,theRest = self.split_user_input(line)
1871
1870
1872 # See whether any pre-existing handler can take care of it
1871 # See whether any pre-existing handler can take care of it
1873
1872
1874 rewritten = self.hooks.input_prefilter(stripped)
1873 rewritten = self.hooks.input_prefilter(stripped)
1875 if rewritten != stripped: # ok, some prefilter did something
1874 if rewritten != stripped: # ok, some prefilter did something
1876 rewritten = pre + rewritten # add indentation
1875 rewritten = pre + rewritten # add indentation
1877 return self.handle_normal(rewritten)
1876 return self.handle_normal(rewritten)
1878
1877
1879 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
1878 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
1880
1879
1881 # First check for explicit escapes in the last/first character
1880 # First check for explicit escapes in the last/first character
1882 handler = None
1881 handler = None
1883 if line[-1] == self.ESC_HELP:
1882 if line[-1] == self.ESC_HELP:
1884 handler = self.esc_handlers.get(line[-1]) # the ? can be at the end
1883 handler = self.esc_handlers.get(line[-1]) # the ? can be at the end
1885 if handler is None:
1884 if handler is None:
1886 # look at the first character of iFun, NOT of line, so we skip
1885 # look at the first character of iFun, NOT of line, so we skip
1887 # leading whitespace in multiline input
1886 # leading whitespace in multiline input
1888 handler = self.esc_handlers.get(iFun[0:1])
1887 handler = self.esc_handlers.get(iFun[0:1])
1889 if handler is not None:
1888 if handler is not None:
1890 return handler(line,continue_prompt,pre,iFun,theRest)
1889 return handler(line,continue_prompt,pre,iFun,theRest)
1891 # Emacs ipython-mode tags certain input lines
1890 # Emacs ipython-mode tags certain input lines
1892 if line.endswith('# PYTHON-MODE'):
1891 if line.endswith('# PYTHON-MODE'):
1893 return self.handle_emacs(line,continue_prompt)
1892 return self.handle_emacs(line,continue_prompt)
1894
1893
1895 # Next, check if we can automatically execute this thing
1894 # Next, check if we can automatically execute this thing
1896
1895
1897 # Allow ! in multi-line statements if multi_line_specials is on:
1896 # Allow ! in multi-line statements if multi_line_specials is on:
1898 if continue_prompt and self.rc.multi_line_specials and \
1897 if continue_prompt and self.rc.multi_line_specials and \
1899 iFun.startswith(self.ESC_SHELL):
1898 iFun.startswith(self.ESC_SHELL):
1900 return self.handle_shell_escape(line,continue_prompt,
1899 return self.handle_shell_escape(line,continue_prompt,
1901 pre=pre,iFun=iFun,
1900 pre=pre,iFun=iFun,
1902 theRest=theRest)
1901 theRest=theRest)
1903
1902
1904 # Let's try to find if the input line is a magic fn
1903 # Let's try to find if the input line is a magic fn
1905 oinfo = None
1904 oinfo = None
1906 if hasattr(self,'magic_'+iFun):
1905 if hasattr(self,'magic_'+iFun):
1907 # WARNING: _ofind uses getattr(), so it can consume generators and
1906 # WARNING: _ofind uses getattr(), so it can consume generators and
1908 # cause other side effects.
1907 # cause other side effects.
1909 oinfo = self._ofind(iFun) # FIXME - _ofind is part of Magic
1908 oinfo = self._ofind(iFun) # FIXME - _ofind is part of Magic
1910 if oinfo['ismagic']:
1909 if oinfo['ismagic']:
1911 # Be careful not to call magics when a variable assignment is
1910 # Be careful not to call magics when a variable assignment is
1912 # being made (ls='hi', for example)
1911 # being made (ls='hi', for example)
1913 if self.rc.automagic and \
1912 if self.rc.automagic and \
1914 (len(theRest)==0 or theRest[0] not in '!=()<>,') and \
1913 (len(theRest)==0 or theRest[0] not in '!=()<>,') and \
1915 (self.rc.multi_line_specials or not continue_prompt):
1914 (self.rc.multi_line_specials or not continue_prompt):
1916 return self.handle_magic(line,continue_prompt,
1915 return self.handle_magic(line,continue_prompt,
1917 pre,iFun,theRest)
1916 pre,iFun,theRest)
1918 else:
1917 else:
1919 return self.handle_normal(line,continue_prompt)
1918 return self.handle_normal(line,continue_prompt)
1920
1919
1921 # If the rest of the line begins with an (in)equality, assginment or
1920 # If the rest of the line begins with an (in)equality, assginment or
1922 # function call, we should not call _ofind but simply execute it.
1921 # function call, we should not call _ofind but simply execute it.
1923 # This avoids spurious geattr() accesses on objects upon assignment.
1922 # This avoids spurious geattr() accesses on objects upon assignment.
1924 #
1923 #
1925 # It also allows users to assign to either alias or magic names true
1924 # It also allows users to assign to either alias or magic names true
1926 # python variables (the magic/alias systems always take second seat to
1925 # python variables (the magic/alias systems always take second seat to
1927 # true python code).
1926 # true python code).
1928 if theRest and theRest[0] in '!=()':
1927 if theRest and theRest[0] in '!=()':
1929 return self.handle_normal(line,continue_prompt)
1928 return self.handle_normal(line,continue_prompt)
1930
1929
1931 if oinfo is None:
1930 if oinfo is None:
1932 # let's try to ensure that _oinfo is ONLY called when autocall is
1931 # let's try to ensure that _oinfo is ONLY called when autocall is
1933 # on. Since it has inevitable potential side effects, at least
1932 # on. Since it has inevitable potential side effects, at least
1934 # having autocall off should be a guarantee to the user that no
1933 # having autocall off should be a guarantee to the user that no
1935 # weird things will happen.
1934 # weird things will happen.
1936
1935
1937 if self.rc.autocall:
1936 if self.rc.autocall:
1938 oinfo = self._ofind(iFun) # FIXME - _ofind is part of Magic
1937 oinfo = self._ofind(iFun) # FIXME - _ofind is part of Magic
1939 else:
1938 else:
1940 # in this case, all that's left is either an alias or
1939 # in this case, all that's left is either an alias or
1941 # processing the line normally.
1940 # processing the line normally.
1942 if iFun in self.alias_table:
1941 if iFun in self.alias_table:
1943 # if autocall is off, by not running _ofind we won't know
1942 # if autocall is off, by not running _ofind we won't know
1944 # whether the given name may also exist in one of the
1943 # whether the given name may also exist in one of the
1945 # user's namespace. At this point, it's best to do a
1944 # user's namespace. At this point, it's best to do a
1946 # quick check just to be sure that we don't let aliases
1945 # quick check just to be sure that we don't let aliases
1947 # shadow variables.
1946 # shadow variables.
1948 head = iFun.split('.',1)[0]
1947 head = iFun.split('.',1)[0]
1949 if head in self.user_ns or head in self.internal_ns \
1948 if head in self.user_ns or head in self.internal_ns \
1950 or head in __builtin__.__dict__:
1949 or head in __builtin__.__dict__:
1951 return self.handle_normal(line,continue_prompt)
1950 return self.handle_normal(line,continue_prompt)
1952 else:
1951 else:
1953 return self.handle_alias(line,continue_prompt,
1952 return self.handle_alias(line,continue_prompt,
1954 pre,iFun,theRest)
1953 pre,iFun,theRest)
1955
1954
1956 else:
1955 else:
1957 return self.handle_normal(line,continue_prompt)
1956 return self.handle_normal(line,continue_prompt)
1958
1957
1959 if not oinfo['found']:
1958 if not oinfo['found']:
1960 return self.handle_normal(line,continue_prompt)
1959 return self.handle_normal(line,continue_prompt)
1961 else:
1960 else:
1962 #print 'pre<%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
1961 #print 'pre<%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
1963 if oinfo['isalias']:
1962 if oinfo['isalias']:
1964 return self.handle_alias(line,continue_prompt,
1963 return self.handle_alias(line,continue_prompt,
1965 pre,iFun,theRest)
1964 pre,iFun,theRest)
1966
1965
1967 if (self.rc.autocall
1966 if (self.rc.autocall
1968 and
1967 and
1969 (
1968 (
1970 #only consider exclusion re if not "," or ";" autoquoting
1969 #only consider exclusion re if not "," or ";" autoquoting
1971 (pre == self.ESC_QUOTE or pre == self.ESC_QUOTE2
1970 (pre == self.ESC_QUOTE or pre == self.ESC_QUOTE2
1972 or pre == self.ESC_PAREN) or
1971 or pre == self.ESC_PAREN) or
1973 (not self.re_exclude_auto.match(theRest)))
1972 (not self.re_exclude_auto.match(theRest)))
1974 and
1973 and
1975 self.re_fun_name.match(iFun) and
1974 self.re_fun_name.match(iFun) and
1976 callable(oinfo['obj'])) :
1975 callable(oinfo['obj'])) :
1977 #print 'going auto' # dbg
1976 #print 'going auto' # dbg
1978 return self.handle_auto(line,continue_prompt,
1977 return self.handle_auto(line,continue_prompt,
1979 pre,iFun,theRest,oinfo['obj'])
1978 pre,iFun,theRest,oinfo['obj'])
1980 else:
1979 else:
1981 #print 'was callable?', callable(oinfo['obj']) # dbg
1980 #print 'was callable?', callable(oinfo['obj']) # dbg
1982 return self.handle_normal(line,continue_prompt)
1981 return self.handle_normal(line,continue_prompt)
1983
1982
1984 # If we get here, we have a normal Python line. Log and return.
1983 # If we get here, we have a normal Python line. Log and return.
1985 return self.handle_normal(line,continue_prompt)
1984 return self.handle_normal(line,continue_prompt)
1986
1985
1987 def _prefilter_dumb(self, line, continue_prompt):
1986 def _prefilter_dumb(self, line, continue_prompt):
1988 """simple prefilter function, for debugging"""
1987 """simple prefilter function, for debugging"""
1989 return self.handle_normal(line,continue_prompt)
1988 return self.handle_normal(line,continue_prompt)
1990
1989
1991 # Set the default prefilter() function (this can be user-overridden)
1990 # Set the default prefilter() function (this can be user-overridden)
1992 prefilter = _prefilter
1991 prefilter = _prefilter
1993
1992
1994 def handle_normal(self,line,continue_prompt=None,
1993 def handle_normal(self,line,continue_prompt=None,
1995 pre=None,iFun=None,theRest=None):
1994 pre=None,iFun=None,theRest=None):
1996 """Handle normal input lines. Use as a template for handlers."""
1995 """Handle normal input lines. Use as a template for handlers."""
1997
1996
1998 # With autoindent on, we need some way to exit the input loop, and I
1997 # With autoindent on, we need some way to exit the input loop, and I
1999 # don't want to force the user to have to backspace all the way to
1998 # don't want to force the user to have to backspace all the way to
2000 # clear the line. The rule will be in this case, that either two
1999 # clear the line. The rule will be in this case, that either two
2001 # lines of pure whitespace in a row, or a line of pure whitespace but
2000 # lines of pure whitespace in a row, or a line of pure whitespace but
2002 # of a size different to the indent level, will exit the input loop.
2001 # of a size different to the indent level, will exit the input loop.
2003
2002
2004 if (continue_prompt and self.autoindent and line.isspace() and
2003 if (continue_prompt and self.autoindent and line.isspace() and
2005 (0 < abs(len(line) - self.indent_current_nsp) <= 2 or
2004 (0 < abs(len(line) - self.indent_current_nsp) <= 2 or
2006 (self.buffer[-1]).isspace() )):
2005 (self.buffer[-1]).isspace() )):
2007 line = ''
2006 line = ''
2008
2007
2009 self.log(line,continue_prompt)
2008 self.log(line,continue_prompt)
2010 return line
2009 return line
2011
2010
2012 def handle_alias(self,line,continue_prompt=None,
2011 def handle_alias(self,line,continue_prompt=None,
2013 pre=None,iFun=None,theRest=None):
2012 pre=None,iFun=None,theRest=None):
2014 """Handle alias input lines. """
2013 """Handle alias input lines. """
2015
2014
2016 # pre is needed, because it carries the leading whitespace. Otherwise
2015 # pre is needed, because it carries the leading whitespace. Otherwise
2017 # aliases won't work in indented sections.
2016 # aliases won't work in indented sections.
2018 transformed = self.transform_alias(iFun, theRest)
2017 transformed = self.transform_alias(iFun, theRest)
2019 line_out = '%s_ip.system(%s)' % (pre, make_quoted_expr( transformed ))
2018 line_out = '%s_ip.system(%s)' % (pre, make_quoted_expr( transformed ))
2020 self.log(line_out,continue_prompt)
2019 self.log(line_out,continue_prompt)
2021 return line_out
2020 return line_out
2022
2021
2023 def handle_shell_escape(self, line, continue_prompt=None,
2022 def handle_shell_escape(self, line, continue_prompt=None,
2024 pre=None,iFun=None,theRest=None):
2023 pre=None,iFun=None,theRest=None):
2025 """Execute the line in a shell, empty return value"""
2024 """Execute the line in a shell, empty return value"""
2026
2025
2027 #print 'line in :', `line` # dbg
2026 #print 'line in :', `line` # dbg
2028 # Example of a special handler. Others follow a similar pattern.
2027 # Example of a special handler. Others follow a similar pattern.
2029 if line.lstrip().startswith('!!'):
2028 if line.lstrip().startswith('!!'):
2030 # rewrite iFun/theRest to properly hold the call to %sx and
2029 # rewrite iFun/theRest to properly hold the call to %sx and
2031 # the actual command to be executed, so handle_magic can work
2030 # the actual command to be executed, so handle_magic can work
2032 # correctly
2031 # correctly
2033 theRest = '%s %s' % (iFun[2:],theRest)
2032 theRest = '%s %s' % (iFun[2:],theRest)
2034 iFun = 'sx'
2033 iFun = 'sx'
2035 return self.handle_magic('%ssx %s' % (self.ESC_MAGIC,
2034 return self.handle_magic('%ssx %s' % (self.ESC_MAGIC,
2036 line.lstrip()[2:]),
2035 line.lstrip()[2:]),
2037 continue_prompt,pre,iFun,theRest)
2036 continue_prompt,pre,iFun,theRest)
2038 else:
2037 else:
2039 cmd=line.lstrip().lstrip('!')
2038 cmd=line.lstrip().lstrip('!')
2040 line_out = '%s_ip.system(%s)' % (pre,make_quoted_expr(cmd))
2039 line_out = '%s_ip.system(%s)' % (pre,make_quoted_expr(cmd))
2041 # update cache/log and return
2040 # update cache/log and return
2042 self.log(line_out,continue_prompt)
2041 self.log(line_out,continue_prompt)
2043 return line_out
2042 return line_out
2044
2043
2045 def handle_magic(self, line, continue_prompt=None,
2044 def handle_magic(self, line, continue_prompt=None,
2046 pre=None,iFun=None,theRest=None):
2045 pre=None,iFun=None,theRest=None):
2047 """Execute magic functions."""
2046 """Execute magic functions."""
2048
2047
2049
2048
2050 cmd = '%s_ip.magic(%s)' % (pre,make_quoted_expr(iFun + " " + theRest))
2049 cmd = '%s_ip.magic(%s)' % (pre,make_quoted_expr(iFun + " " + theRest))
2051 self.log(cmd,continue_prompt)
2050 self.log(cmd,continue_prompt)
2052 #print 'in handle_magic, cmd=<%s>' % cmd # dbg
2051 #print 'in handle_magic, cmd=<%s>' % cmd # dbg
2053 return cmd
2052 return cmd
2054
2053
2055 def handle_auto(self, line, continue_prompt=None,
2054 def handle_auto(self, line, continue_prompt=None,
2056 pre=None,iFun=None,theRest=None,obj=None):
2055 pre=None,iFun=None,theRest=None,obj=None):
2057 """Hande lines which can be auto-executed, quoting if requested."""
2056 """Hande lines which can be auto-executed, quoting if requested."""
2058
2057
2059 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
2058 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
2060
2059
2061 # This should only be active for single-line input!
2060 # This should only be active for single-line input!
2062 if continue_prompt:
2061 if continue_prompt:
2063 self.log(line,continue_prompt)
2062 self.log(line,continue_prompt)
2064 return line
2063 return line
2065
2064
2066 auto_rewrite = True
2065 auto_rewrite = True
2067
2066
2068 if pre == self.ESC_QUOTE:
2067 if pre == self.ESC_QUOTE:
2069 # Auto-quote splitting on whitespace
2068 # Auto-quote splitting on whitespace
2070 newcmd = '%s("%s")' % (iFun,'", "'.join(theRest.split()) )
2069 newcmd = '%s("%s")' % (iFun,'", "'.join(theRest.split()) )
2071 elif pre == self.ESC_QUOTE2:
2070 elif pre == self.ESC_QUOTE2:
2072 # Auto-quote whole string
2071 # Auto-quote whole string
2073 newcmd = '%s("%s")' % (iFun,theRest)
2072 newcmd = '%s("%s")' % (iFun,theRest)
2074 elif pre == self.ESC_PAREN:
2073 elif pre == self.ESC_PAREN:
2075 newcmd = '%s(%s)' % (iFun,",".join(theRest.split()))
2074 newcmd = '%s(%s)' % (iFun,",".join(theRest.split()))
2076 else:
2075 else:
2077 # Auto-paren.
2076 # Auto-paren.
2078 # We only apply it to argument-less calls if the autocall
2077 # We only apply it to argument-less calls if the autocall
2079 # parameter is set to 2. We only need to check that autocall is <
2078 # parameter is set to 2. We only need to check that autocall is <
2080 # 2, since this function isn't called unless it's at least 1.
2079 # 2, since this function isn't called unless it's at least 1.
2081 if not theRest and (self.rc.autocall < 2):
2080 if not theRest and (self.rc.autocall < 2):
2082 newcmd = '%s %s' % (iFun,theRest)
2081 newcmd = '%s %s' % (iFun,theRest)
2083 auto_rewrite = False
2082 auto_rewrite = False
2084 else:
2083 else:
2085 if theRest.startswith('['):
2084 if theRest.startswith('['):
2086 if hasattr(obj,'__getitem__'):
2085 if hasattr(obj,'__getitem__'):
2087 # Don't autocall in this case: item access for an object
2086 # Don't autocall in this case: item access for an object
2088 # which is BOTH callable and implements __getitem__.
2087 # which is BOTH callable and implements __getitem__.
2089 newcmd = '%s %s' % (iFun,theRest)
2088 newcmd = '%s %s' % (iFun,theRest)
2090 auto_rewrite = False
2089 auto_rewrite = False
2091 else:
2090 else:
2092 # if the object doesn't support [] access, go ahead and
2091 # if the object doesn't support [] access, go ahead and
2093 # autocall
2092 # autocall
2094 newcmd = '%s(%s)' % (iFun.rstrip(),theRest)
2093 newcmd = '%s(%s)' % (iFun.rstrip(),theRest)
2095 elif theRest.endswith(';'):
2094 elif theRest.endswith(';'):
2096 newcmd = '%s(%s);' % (iFun.rstrip(),theRest[:-1])
2095 newcmd = '%s(%s);' % (iFun.rstrip(),theRest[:-1])
2097 else:
2096 else:
2098 newcmd = '%s(%s)' % (iFun.rstrip(), theRest)
2097 newcmd = '%s(%s)' % (iFun.rstrip(), theRest)
2099
2098
2100 if auto_rewrite:
2099 if auto_rewrite:
2101 print >>Term.cout, self.outputcache.prompt1.auto_rewrite() + newcmd
2100 print >>Term.cout, self.outputcache.prompt1.auto_rewrite() + newcmd
2102 # log what is now valid Python, not the actual user input (without the
2101 # log what is now valid Python, not the actual user input (without the
2103 # final newline)
2102 # final newline)
2104 self.log(newcmd,continue_prompt)
2103 self.log(newcmd,continue_prompt)
2105 return newcmd
2104 return newcmd
2106
2105
2107 def handle_help(self, line, continue_prompt=None,
2106 def handle_help(self, line, continue_prompt=None,
2108 pre=None,iFun=None,theRest=None):
2107 pre=None,iFun=None,theRest=None):
2109 """Try to get some help for the object.
2108 """Try to get some help for the object.
2110
2109
2111 obj? or ?obj -> basic information.
2110 obj? or ?obj -> basic information.
2112 obj?? or ??obj -> more details.
2111 obj?? or ??obj -> more details.
2113 """
2112 """
2114
2113
2115 # We need to make sure that we don't process lines which would be
2114 # We need to make sure that we don't process lines which would be
2116 # otherwise valid python, such as "x=1 # what?"
2115 # otherwise valid python, such as "x=1 # what?"
2117 try:
2116 try:
2118 codeop.compile_command(line)
2117 codeop.compile_command(line)
2119 except SyntaxError:
2118 except SyntaxError:
2120 # We should only handle as help stuff which is NOT valid syntax
2119 # We should only handle as help stuff which is NOT valid syntax
2121 if line[0]==self.ESC_HELP:
2120 if line[0]==self.ESC_HELP:
2122 line = line[1:]
2121 line = line[1:]
2123 elif line[-1]==self.ESC_HELP:
2122 elif line[-1]==self.ESC_HELP:
2124 line = line[:-1]
2123 line = line[:-1]
2125 self.log('#?'+line)
2124 self.log('#?'+line)
2126 if line:
2125 if line:
2127 self.magic_pinfo(line)
2126 self.magic_pinfo(line)
2128 else:
2127 else:
2129 page(self.usage,screen_lines=self.rc.screen_length)
2128 page(self.usage,screen_lines=self.rc.screen_length)
2130 return '' # Empty string is needed here!
2129 return '' # Empty string is needed here!
2131 except:
2130 except:
2132 # Pass any other exceptions through to the normal handler
2131 # Pass any other exceptions through to the normal handler
2133 return self.handle_normal(line,continue_prompt)
2132 return self.handle_normal(line,continue_prompt)
2134 else:
2133 else:
2135 # If the code compiles ok, we should handle it normally
2134 # If the code compiles ok, we should handle it normally
2136 return self.handle_normal(line,continue_prompt)
2135 return self.handle_normal(line,continue_prompt)
2137
2136
2138 def getapi(self):
2137 def getapi(self):
2139 """ Get an IPApi object for this shell instance
2138 """ Get an IPApi object for this shell instance
2140
2139
2141 Getting an IPApi object is always preferable to accessing the shell
2140 Getting an IPApi object is always preferable to accessing the shell
2142 directly, but this holds true especially for extensions.
2141 directly, but this holds true especially for extensions.
2143
2142
2144 It should always be possible to implement an extension with IPApi
2143 It should always be possible to implement an extension with IPApi
2145 alone. If not, contact maintainer to request an addition.
2144 alone. If not, contact maintainer to request an addition.
2146
2145
2147 """
2146 """
2148 return self.api
2147 return self.api
2149
2148
2150 def handle_emacs(self,line,continue_prompt=None,
2149 def handle_emacs(self,line,continue_prompt=None,
2151 pre=None,iFun=None,theRest=None):
2150 pre=None,iFun=None,theRest=None):
2152 """Handle input lines marked by python-mode."""
2151 """Handle input lines marked by python-mode."""
2153
2152
2154 # Currently, nothing is done. Later more functionality can be added
2153 # Currently, nothing is done. Later more functionality can be added
2155 # here if needed.
2154 # here if needed.
2156
2155
2157 # The input cache shouldn't be updated
2156 # The input cache shouldn't be updated
2158
2157
2159 return line
2158 return line
2160
2159
2161 def mktempfile(self,data=None):
2160 def mktempfile(self,data=None):
2162 """Make a new tempfile and return its filename.
2161 """Make a new tempfile and return its filename.
2163
2162
2164 This makes a call to tempfile.mktemp, but it registers the created
2163 This makes a call to tempfile.mktemp, but it registers the created
2165 filename internally so ipython cleans it up at exit time.
2164 filename internally so ipython cleans it up at exit time.
2166
2165
2167 Optional inputs:
2166 Optional inputs:
2168
2167
2169 - data(None): if data is given, it gets written out to the temp file
2168 - data(None): if data is given, it gets written out to the temp file
2170 immediately, and the file is closed again."""
2169 immediately, and the file is closed again."""
2171
2170
2172 filename = tempfile.mktemp('.py','ipython_edit_')
2171 filename = tempfile.mktemp('.py','ipython_edit_')
2173 self.tempfiles.append(filename)
2172 self.tempfiles.append(filename)
2174
2173
2175 if data:
2174 if data:
2176 tmp_file = open(filename,'w')
2175 tmp_file = open(filename,'w')
2177 tmp_file.write(data)
2176 tmp_file.write(data)
2178 tmp_file.close()
2177 tmp_file.close()
2179 return filename
2178 return filename
2180
2179
2181 def write(self,data):
2180 def write(self,data):
2182 """Write a string to the default output"""
2181 """Write a string to the default output"""
2183 Term.cout.write(data)
2182 Term.cout.write(data)
2184
2183
2185 def write_err(self,data):
2184 def write_err(self,data):
2186 """Write a string to the default error output"""
2185 """Write a string to the default error output"""
2187 Term.cerr.write(data)
2186 Term.cerr.write(data)
2188
2187
2189 def exit(self):
2188 def exit(self):
2190 """Handle interactive exit.
2189 """Handle interactive exit.
2191
2190
2192 This method sets the exit_now attribute."""
2191 This method sets the exit_now attribute."""
2193
2192
2194 if self.rc.confirm_exit:
2193 if self.rc.confirm_exit:
2195 if ask_yes_no('Do you really want to exit ([y]/n)?','y'):
2194 if ask_yes_no('Do you really want to exit ([y]/n)?','y'):
2196 self.exit_now = True
2195 self.exit_now = True
2197 else:
2196 else:
2198 self.exit_now = True
2197 self.exit_now = True
2199 return self.exit_now
2198 return self.exit_now
2200
2199
2201 def safe_execfile(self,fname,*where,**kw):
2200 def safe_execfile(self,fname,*where,**kw):
2202 fname = os.path.expanduser(fname)
2201 fname = os.path.expanduser(fname)
2203
2202
2204 # find things also in current directory
2203 # find things also in current directory
2205 dname = os.path.dirname(fname)
2204 dname = os.path.dirname(fname)
2206 if not sys.path.count(dname):
2205 if not sys.path.count(dname):
2207 sys.path.append(dname)
2206 sys.path.append(dname)
2208
2207
2209 try:
2208 try:
2210 xfile = open(fname)
2209 xfile = open(fname)
2211 except:
2210 except:
2212 print >> Term.cerr, \
2211 print >> Term.cerr, \
2213 'Could not open file <%s> for safe execution.' % fname
2212 'Could not open file <%s> for safe execution.' % fname
2214 return None
2213 return None
2215
2214
2216 kw.setdefault('islog',0)
2215 kw.setdefault('islog',0)
2217 kw.setdefault('quiet',1)
2216 kw.setdefault('quiet',1)
2218 kw.setdefault('exit_ignore',0)
2217 kw.setdefault('exit_ignore',0)
2219 first = xfile.readline()
2218 first = xfile.readline()
2220 loghead = str(self.loghead_tpl).split('\n',1)[0].strip()
2219 loghead = str(self.loghead_tpl).split('\n',1)[0].strip()
2221 xfile.close()
2220 xfile.close()
2222 # line by line execution
2221 # line by line execution
2223 if first.startswith(loghead) or kw['islog']:
2222 if first.startswith(loghead) or kw['islog']:
2224 print 'Loading log file <%s> one line at a time...' % fname
2223 print 'Loading log file <%s> one line at a time...' % fname
2225 if kw['quiet']:
2224 if kw['quiet']:
2226 stdout_save = sys.stdout
2225 stdout_save = sys.stdout
2227 sys.stdout = StringIO.StringIO()
2226 sys.stdout = StringIO.StringIO()
2228 try:
2227 try:
2229 globs,locs = where[0:2]
2228 globs,locs = where[0:2]
2230 except:
2229 except:
2231 try:
2230 try:
2232 globs = locs = where[0]
2231 globs = locs = where[0]
2233 except:
2232 except:
2234 globs = locs = globals()
2233 globs = locs = globals()
2235 badblocks = []
2234 badblocks = []
2236
2235
2237 # we also need to identify indented blocks of code when replaying
2236 # we also need to identify indented blocks of code when replaying
2238 # logs and put them together before passing them to an exec
2237 # logs and put them together before passing them to an exec
2239 # statement. This takes a bit of regexp and look-ahead work in the
2238 # statement. This takes a bit of regexp and look-ahead work in the
2240 # file. It's easiest if we swallow the whole thing in memory
2239 # file. It's easiest if we swallow the whole thing in memory
2241 # first, and manually walk through the lines list moving the
2240 # first, and manually walk through the lines list moving the
2242 # counter ourselves.
2241 # counter ourselves.
2243 indent_re = re.compile('\s+\S')
2242 indent_re = re.compile('\s+\S')
2244 xfile = open(fname)
2243 xfile = open(fname)
2245 filelines = xfile.readlines()
2244 filelines = xfile.readlines()
2246 xfile.close()
2245 xfile.close()
2247 nlines = len(filelines)
2246 nlines = len(filelines)
2248 lnum = 0
2247 lnum = 0
2249 while lnum < nlines:
2248 while lnum < nlines:
2250 line = filelines[lnum]
2249 line = filelines[lnum]
2251 lnum += 1
2250 lnum += 1
2252 # don't re-insert logger status info into cache
2251 # don't re-insert logger status info into cache
2253 if line.startswith('#log#'):
2252 if line.startswith('#log#'):
2254 continue
2253 continue
2255 else:
2254 else:
2256 # build a block of code (maybe a single line) for execution
2255 # build a block of code (maybe a single line) for execution
2257 block = line
2256 block = line
2258 try:
2257 try:
2259 next = filelines[lnum] # lnum has already incremented
2258 next = filelines[lnum] # lnum has already incremented
2260 except:
2259 except:
2261 next = None
2260 next = None
2262 while next and indent_re.match(next):
2261 while next and indent_re.match(next):
2263 block += next
2262 block += next
2264 lnum += 1
2263 lnum += 1
2265 try:
2264 try:
2266 next = filelines[lnum]
2265 next = filelines[lnum]
2267 except:
2266 except:
2268 next = None
2267 next = None
2269 # now execute the block of one or more lines
2268 # now execute the block of one or more lines
2270 try:
2269 try:
2271 exec block in globs,locs
2270 exec block in globs,locs
2272 except SystemExit:
2271 except SystemExit:
2273 pass
2272 pass
2274 except:
2273 except:
2275 badblocks.append(block.rstrip())
2274 badblocks.append(block.rstrip())
2276 if kw['quiet']: # restore stdout
2275 if kw['quiet']: # restore stdout
2277 sys.stdout.close()
2276 sys.stdout.close()
2278 sys.stdout = stdout_save
2277 sys.stdout = stdout_save
2279 print 'Finished replaying log file <%s>' % fname
2278 print 'Finished replaying log file <%s>' % fname
2280 if badblocks:
2279 if badblocks:
2281 print >> sys.stderr, ('\nThe following lines/blocks in file '
2280 print >> sys.stderr, ('\nThe following lines/blocks in file '
2282 '<%s> reported errors:' % fname)
2281 '<%s> reported errors:' % fname)
2283
2282
2284 for badline in badblocks:
2283 for badline in badblocks:
2285 print >> sys.stderr, badline
2284 print >> sys.stderr, badline
2286 else: # regular file execution
2285 else: # regular file execution
2287 try:
2286 try:
2288 execfile(fname,*where)
2287 execfile(fname,*where)
2289 except SyntaxError:
2288 except SyntaxError:
2290 self.showsyntaxerror()
2289 self.showsyntaxerror()
2291 warn('Failure executing file: <%s>' % fname)
2290 warn('Failure executing file: <%s>' % fname)
2292 except SystemExit,status:
2291 except SystemExit,status:
2293 if not kw['exit_ignore']:
2292 if not kw['exit_ignore']:
2294 self.showtraceback()
2293 self.showtraceback()
2295 warn('Failure executing file: <%s>' % fname)
2294 warn('Failure executing file: <%s>' % fname)
2296 except:
2295 except:
2297 self.showtraceback()
2296 self.showtraceback()
2298 warn('Failure executing file: <%s>' % fname)
2297 warn('Failure executing file: <%s>' % fname)
2299
2298
2300 #************************* end of file <iplib.py> *****************************
2299 #************************* end of file <iplib.py> *****************************
@@ -1,641 +1,641 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 1301 2006-05-15 17:21:55Z vivainio $
9 # $Id: usage.py 1332 2006-05-30 01:41:28Z 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, -wthread, -pylab
56 -gthread, -qthread, -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 three options, IPython starts running a
63 With any of the first three 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 three provide
66 IPython command line, without blocking. All three provide
67 essentially the same functionality, respectively for GTK, QT and
67 essentially the same functionality, respectively for GTK, QT and
68 WXWidgets (via their Python interfaces).
68 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/wthread options, and -pylab (if matplotlib is
84 -tk The -g/q/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, -wthread or -pylab).
91 above (-gthread, -qthread, -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??, ?obj,??obj : Get help, or more help for object
606 ?os.p* : List names in os starting with p
606 ?os.p* : List names in os starting with p
607
607
608 Example magic:
608 Example magic:
609
609
610 %alias d ls -F : 'd' is now an alias for 'ls -F'
610 %alias d ls -F : 'd' is now an alias for 'ls -F'
611 alias d ls -F : Works if 'alias' not a python name
611 alias d ls -F : Works if 'alias' not a python name
612 alist = %alias : Get list of aliases to 'alist'
612 alist = %alias : Get list of aliases to 'alist'
613
613
614 System commands:
614 System commands:
615
615
616 !cp a.txt b/ : System command escape, calls os.system()
616 !cp a.txt b/ : System command escape, calls os.system()
617 cp a.txt b/ : after %rehashx, most system commands work without !
617 cp a.txt b/ : after %rehashx, most system commands work without !
618 cp ${f}.txt $bar : Variable expansion in magics and system commands
618 cp ${f}.txt $bar : Variable expansion in magics and system commands
619 files = !ls /usr : Capture sytem command output
619 files = !ls /usr : Capture sytem command output
620 files.s, files.l, files.n: "a b c", ['a','b','c'], 'a\nb\nc'
620 files.s, files.l, files.n: "a b c", ['a','b','c'], 'a\nb\nc'
621 cd /usr/share : Obvious, also 'cd d:\home\_ipython' works
621 cd /usr/share : Obvious, also 'cd d:\home\_ipython' works
622
622
623 History:
623 History:
624
624
625 _i, _ii, _iii : Previous, next previous, next next previous input
625 _i, _ii, _iii : Previous, next previous, next next previous input
626 _ih[4], _ih[2:5] : Input history line 4, lines 2-4
626 _ih[4], _ih[2:5] : Input history line 4, lines 2-4
627 _, __, ___ : previous, next previous, next next previous output
627 _, __, ___ : previous, next previous, next next previous output
628 _dh : Directory history
628 _dh : Directory history
629 _oh : Output history
629 _oh : Output history
630 %hist : Command history
630 %hist : Command history
631
631
632 Autocall:
632 Autocall:
633
633
634 f 1,2 : f(1,2)
634 f 1,2 : f(1,2)
635 /f 1,2 : f(1,2) (forced autoparen)
635 /f 1,2 : f(1,2) (forced autoparen)
636 ,f 1 2 : f("1","2")
636 ,f 1 2 : f("1","2")
637 ;f 1 2 : f("1 2")
637 ;f 1 2 : f("1 2")
638
638
639 """
639 """
640
640
641
641
@@ -1,5457 +1,5469 b''
1 2006-05-29 Fernando Perez <Fernando.Perez@colorado.edu>
2
3 * IPython/irunner.py: New module to run scripts as if manually
4 typed into an interactive environment, based on pexpect. After a
5 submission by Ken Schutte <kschutte-AT-csail.mit.edu> on the
6 ipython-user list. Simple unittests in the tests/ directory.
7
8 * tools/release: add Will Maier, OpenBSD port maintainer, to
9 recepients list. We are now officially part of the OpenBSD ports:
10 http://www.openbsd.org/ports.html ! Many thanks to Will for the
11 work.
12
1 2006-05-26 Fernando Perez <Fernando.Perez@colorado.edu>
13 2006-05-26 Fernando Perez <Fernando.Perez@colorado.edu>
2
14
3 * IPython/ipmaker.py (make_IPython): modify sys.argv fix (below)
15 * IPython/ipmaker.py (make_IPython): modify sys.argv fix (below)
4 so that it doesn't break tkinter apps.
16 so that it doesn't break tkinter apps.
5
17
6 * IPython/iplib.py (_prefilter): fix bug where aliases would
18 * IPython/iplib.py (_prefilter): fix bug where aliases would
7 shadow variables when autocall was fully off. Reported by SAGE
19 shadow variables when autocall was fully off. Reported by SAGE
8 author William Stein.
20 author William Stein.
9
21
10 * IPython/OInspect.py (Inspector.__init__): add a flag to control
22 * IPython/OInspect.py (Inspector.__init__): add a flag to control
11 at what detail level strings are computed when foo? is requested.
23 at what detail level strings are computed when foo? is requested.
12 This allows users to ask for example that the string form of an
24 This allows users to ask for example that the string form of an
13 object is only computed when foo?? is called, or even never, by
25 object is only computed when foo?? is called, or even never, by
14 setting the object_info_string_level >= 2 in the configuration
26 setting the object_info_string_level >= 2 in the configuration
15 file. This new option has been added and documented. After a
27 file. This new option has been added and documented. After a
16 request by SAGE to be able to control the printing of very large
28 request by SAGE to be able to control the printing of very large
17 objects more easily.
29 objects more easily.
18
30
19 2006-05-25 Fernando Perez <Fernando.Perez@colorado.edu>
31 2006-05-25 Fernando Perez <Fernando.Perez@colorado.edu>
20
32
21 * IPython/ipmaker.py (make_IPython): remove the ipython call path
33 * IPython/ipmaker.py (make_IPython): remove the ipython call path
22 from sys.argv, to be 100% consistent with how Python itself works
34 from sys.argv, to be 100% consistent with how Python itself works
23 (as seen for example with python -i file.py). After a bug report
35 (as seen for example with python -i file.py). After a bug report
24 by Jeffrey Collins.
36 by Jeffrey Collins.
25
37
26 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix
38 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix
27 nasty bug which was preventing custom namespaces with -pylab,
39 nasty bug which was preventing custom namespaces with -pylab,
28 reported by M. Foord. Minor cleanup, remove old matplotlib.matlab
40 reported by M. Foord. Minor cleanup, remove old matplotlib.matlab
29 compatibility (long gone from mpl).
41 compatibility (long gone from mpl).
30
42
31 * IPython/ipapi.py (make_session): name change: create->make. We
43 * IPython/ipapi.py (make_session): name change: create->make. We
32 use make in other places (ipmaker,...), it's shorter and easier to
44 use make in other places (ipmaker,...), it's shorter and easier to
33 type and say, etc. I'm trying to clean things before 0.7.2 so
45 type and say, etc. I'm trying to clean things before 0.7.2 so
34 that I can keep things stable wrt to ipapi in the chainsaw branch.
46 that I can keep things stable wrt to ipapi in the chainsaw branch.
35
47
36 * ipython.el: fix the py-pdbtrack-input-prompt variable so that
48 * ipython.el: fix the py-pdbtrack-input-prompt variable so that
37 python-mode recognizes our debugger mode. Add support for
49 python-mode recognizes our debugger mode. Add support for
38 autoindent inside (X)emacs. After a patch sent in by Jin Liu
50 autoindent inside (X)emacs. After a patch sent in by Jin Liu
39 <m.liu.jin-AT-gmail.com> originally written by
51 <m.liu.jin-AT-gmail.com> originally written by
40 doxgen-AT-newsmth.net (with minor modifications for xemacs
52 doxgen-AT-newsmth.net (with minor modifications for xemacs
41 compatibility)
53 compatibility)
42
54
43 * IPython/Debugger.py (Pdb.format_stack_entry): fix formatting of
55 * IPython/Debugger.py (Pdb.format_stack_entry): fix formatting of
44 tracebacks when walking the stack so that the stack tracking system
56 tracebacks when walking the stack so that the stack tracking system
45 in emacs' python-mode can identify the frames correctly.
57 in emacs' python-mode can identify the frames correctly.
46
58
47 * IPython/ipmaker.py (make_IPython): make the internal (and
59 * IPython/ipmaker.py (make_IPython): make the internal (and
48 default config) autoedit_syntax value false by default. Too many
60 default config) autoedit_syntax value false by default. Too many
49 users have complained to me (both on and off-list) about problems
61 users have complained to me (both on and off-list) about problems
50 with this option being on by default, so I'm making it default to
62 with this option being on by default, so I'm making it default to
51 off. It can still be enabled by anyone via the usual mechanisms.
63 off. It can still be enabled by anyone via the usual mechanisms.
52
64
53 * IPython/completer.py (Completer.attr_matches): add support for
65 * IPython/completer.py (Completer.attr_matches): add support for
54 PyCrust-style _getAttributeNames magic method. Patch contributed
66 PyCrust-style _getAttributeNames magic method. Patch contributed
55 by <mscott-AT-goldenspud.com>. Closes #50.
67 by <mscott-AT-goldenspud.com>. Closes #50.
56
68
57 * IPython/iplib.py (InteractiveShell.__init__): remove the
69 * IPython/iplib.py (InteractiveShell.__init__): remove the
58 deletion of exit/quit from __builtin__, which can break
70 deletion of exit/quit from __builtin__, which can break
59 third-party tools like the Zope debugging console. The
71 third-party tools like the Zope debugging console. The
60 %exit/%quit magics remain. In general, it's probably a good idea
72 %exit/%quit magics remain. In general, it's probably a good idea
61 not to delete anything from __builtin__, since we never know what
73 not to delete anything from __builtin__, since we never know what
62 that will break. In any case, python now (for 2.5) will support
74 that will break. In any case, python now (for 2.5) will support
63 'real' exit/quit, so this issue is moot. Closes #55.
75 'real' exit/quit, so this issue is moot. Closes #55.
64
76
65 * IPython/genutils.py (with_obj): rename the 'with' function to
77 * IPython/genutils.py (with_obj): rename the 'with' function to
66 'withobj' to avoid incompatibilities with Python 2.5, where 'with'
78 'withobj' to avoid incompatibilities with Python 2.5, where 'with'
67 becomes a language keyword. Closes #53.
79 becomes a language keyword. Closes #53.
68
80
69 * IPython/FakeModule.py (FakeModule.__init__): add a proper
81 * IPython/FakeModule.py (FakeModule.__init__): add a proper
70 __file__ attribute to this so it fools more things into thinking
82 __file__ attribute to this so it fools more things into thinking
71 it is a real module. Closes #59.
83 it is a real module. Closes #59.
72
84
73 * IPython/Magic.py (magic_edit): add -n option to open the editor
85 * IPython/Magic.py (magic_edit): add -n option to open the editor
74 at a specific line number. After a patch by Stefan van der Walt.
86 at a specific line number. After a patch by Stefan van der Walt.
75
87
76 2006-05-23 Fernando Perez <Fernando.Perez@colorado.edu>
88 2006-05-23 Fernando Perez <Fernando.Perez@colorado.edu>
77
89
78 * IPython/iplib.py (edit_syntax_error): fix crash when for some
90 * IPython/iplib.py (edit_syntax_error): fix crash when for some
79 reason the file could not be opened. After automatic crash
91 reason the file could not be opened. After automatic crash
80 reports sent by James Graham <jgraham-AT-ast.cam.ac.uk> and
92 reports sent by James Graham <jgraham-AT-ast.cam.ac.uk> and
81 Charles Dolan <charlespatrickdolan-AT-yahoo.com>.
93 Charles Dolan <charlespatrickdolan-AT-yahoo.com>.
82 (_should_recompile): Don't fire editor if using %bg, since there
94 (_should_recompile): Don't fire editor if using %bg, since there
83 is no file in the first place. From the same report as above.
95 is no file in the first place. From the same report as above.
84 (raw_input): protect against faulty third-party prefilters. After
96 (raw_input): protect against faulty third-party prefilters. After
85 an automatic crash report sent by Dirk Laurie <dirk-AT-sun.ac.za>
97 an automatic crash report sent by Dirk Laurie <dirk-AT-sun.ac.za>
86 while running under SAGE.
98 while running under SAGE.
87
99
88 2006-05-23 Ville Vainio <vivainio@gmail.com>
100 2006-05-23 Ville Vainio <vivainio@gmail.com>
89
101
90 * ipapi.py: Stripped down ip.to_user_ns() to work only as
102 * ipapi.py: Stripped down ip.to_user_ns() to work only as
91 ip.to_user_ns("x1 y1"), which exposes vars x1 and y1. ipapi.get()
103 ip.to_user_ns("x1 y1"), which exposes vars x1 and y1. ipapi.get()
92 now returns None (again), unless dummy is specifically allowed by
104 now returns None (again), unless dummy is specifically allowed by
93 ipapi.get(allow_dummy=True).
105 ipapi.get(allow_dummy=True).
94
106
95 2006-05-18 Fernando Perez <Fernando.Perez@colorado.edu>
107 2006-05-18 Fernando Perez <Fernando.Perez@colorado.edu>
96
108
97 * IPython: remove all 2.2-compatibility objects and hacks from
109 * IPython: remove all 2.2-compatibility objects and hacks from
98 everywhere, since we only support 2.3 at this point. Docs
110 everywhere, since we only support 2.3 at this point. Docs
99 updated.
111 updated.
100
112
101 * IPython/ipapi.py (IPApi.__init__): Clean up of all getters.
113 * IPython/ipapi.py (IPApi.__init__): Clean up of all getters.
102 Anything requiring extra validation can be turned into a Python
114 Anything requiring extra validation can be turned into a Python
103 property in the future. I used a property for the db one b/c
115 property in the future. I used a property for the db one b/c
104 there was a nasty circularity problem with the initialization
116 there was a nasty circularity problem with the initialization
105 order, which right now I don't have time to clean up.
117 order, which right now I don't have time to clean up.
106
118
107 * IPython/Shell.py (MTInteractiveShell.runcode): Fix, I think,
119 * IPython/Shell.py (MTInteractiveShell.runcode): Fix, I think,
108 another locking bug reported by Jorgen. I'm not 100% sure though,
120 another locking bug reported by Jorgen. I'm not 100% sure though,
109 so more testing is needed...
121 so more testing is needed...
110
122
111 2006-05-17 Fernando Perez <Fernando.Perez@colorado.edu>
123 2006-05-17 Fernando Perez <Fernando.Perez@colorado.edu>
112
124
113 * IPython/ipapi.py (IPApi.to_user_ns): New function to inject
125 * IPython/ipapi.py (IPApi.to_user_ns): New function to inject
114 local variables from any routine in user code (typically executed
126 local variables from any routine in user code (typically executed
115 with %run) directly into the interactive namespace. Very useful
127 with %run) directly into the interactive namespace. Very useful
116 when doing complex debugging.
128 when doing complex debugging.
117 (IPythonNotRunning): Changed the default None object to a dummy
129 (IPythonNotRunning): Changed the default None object to a dummy
118 whose attributes can be queried as well as called without
130 whose attributes can be queried as well as called without
119 exploding, to ease writing code which works transparently both in
131 exploding, to ease writing code which works transparently both in
120 and out of ipython and uses some of this API.
132 and out of ipython and uses some of this API.
121
133
122 2006-05-16 Fernando Perez <Fernando.Perez@colorado.edu>
134 2006-05-16 Fernando Perez <Fernando.Perez@colorado.edu>
123
135
124 * IPython/hooks.py (result_display): Fix the fact that our display
136 * IPython/hooks.py (result_display): Fix the fact that our display
125 hook was using str() instead of repr(), as the default python
137 hook was using str() instead of repr(), as the default python
126 console does. This had gone unnoticed b/c it only happened if
138 console does. This had gone unnoticed b/c it only happened if
127 %Pprint was off, but the inconsistency was there.
139 %Pprint was off, but the inconsistency was there.
128
140
129 2006-05-15 Ville Vainio <vivainio@gmail.com>
141 2006-05-15 Ville Vainio <vivainio@gmail.com>
130
142
131 * Oinspect.py: Only show docstring for nonexisting/binary files
143 * Oinspect.py: Only show docstring for nonexisting/binary files
132 when doing object??, closing ticket #62
144 when doing object??, closing ticket #62
133
145
134 2006-05-13 Fernando Perez <Fernando.Perez@colorado.edu>
146 2006-05-13 Fernando Perez <Fernando.Perez@colorado.edu>
135
147
136 * IPython/Shell.py (MTInteractiveShell.runsource): Fix threading
148 * IPython/Shell.py (MTInteractiveShell.runsource): Fix threading
137 bug, closes http://www.scipy.net/roundup/ipython/issue55. A lock
149 bug, closes http://www.scipy.net/roundup/ipython/issue55. A lock
138 was being released in a routine which hadn't checked if it had
150 was being released in a routine which hadn't checked if it had
139 been the one to acquire it.
151 been the one to acquire it.
140
152
141 2006-05-07 Fernando Perez <Fernando.Perez@colorado.edu>
153 2006-05-07 Fernando Perez <Fernando.Perez@colorado.edu>
142
154
143 * IPython/Release.py (version): put out 0.7.2.rc1 for testing.
155 * IPython/Release.py (version): put out 0.7.2.rc1 for testing.
144
156
145 2006-04-11 Ville Vainio <vivainio@gmail.com>
157 2006-04-11 Ville Vainio <vivainio@gmail.com>
146
158
147 * iplib.py, ipmaker.py: .ipy extension now means "ipython batch file"
159 * iplib.py, ipmaker.py: .ipy extension now means "ipython batch file"
148 in command line. E.g. "ipython test.ipy" runs test.ipy with ipython
160 in command line. E.g. "ipython test.ipy" runs test.ipy with ipython
149 prefilters, allowing stuff like magics and aliases in the file.
161 prefilters, allowing stuff like magics and aliases in the file.
150
162
151 * Prompts.py, Extensions/clearcmd.py, ipy_system_conf.py: %clear magic
163 * Prompts.py, Extensions/clearcmd.py, ipy_system_conf.py: %clear magic
152 added. Supported now are "%clear in" and "%clear out" (clear input and
164 added. Supported now are "%clear in" and "%clear out" (clear input and
153 output history, respectively). Also fixed CachedOutput.flush to
165 output history, respectively). Also fixed CachedOutput.flush to
154 properly flush the output cache.
166 properly flush the output cache.
155
167
156 * Extensions/pspersistence.py: Fix %store to avoid "%store obj.attr"
168 * Extensions/pspersistence.py: Fix %store to avoid "%store obj.attr"
157 half-success (and fail explicitly).
169 half-success (and fail explicitly).
158
170
159 2006-03-28 Ville Vainio <vivainio@gmail.com>
171 2006-03-28 Ville Vainio <vivainio@gmail.com>
160
172
161 * iplib.py: Fix quoting of aliases so that only argless ones
173 * iplib.py: Fix quoting of aliases so that only argless ones
162 are quoted
174 are quoted
163
175
164 2006-03-28 Ville Vainio <vivainio@gmail.com>
176 2006-03-28 Ville Vainio <vivainio@gmail.com>
165
177
166 * iplib.py: Quote aliases with spaces in the name.
178 * iplib.py: Quote aliases with spaces in the name.
167 "c:\program files\blah\bin" is now legal alias target.
179 "c:\program files\blah\bin" is now legal alias target.
168
180
169 * ext_rehashdir.py: Space no longer allowed as arg
181 * ext_rehashdir.py: Space no longer allowed as arg
170 separator, since space is legal in path names.
182 separator, since space is legal in path names.
171
183
172 2006-03-16 Ville Vainio <vivainio@gmail.com>
184 2006-03-16 Ville Vainio <vivainio@gmail.com>
173
185
174 * upgrade_dir.py: Take path.py from Extensions, correcting
186 * upgrade_dir.py: Take path.py from Extensions, correcting
175 %upgrade magic
187 %upgrade magic
176
188
177 * ipmaker.py: Suggest using %upgrade if ipy_user_conf.py isn't found.
189 * ipmaker.py: Suggest using %upgrade if ipy_user_conf.py isn't found.
178
190
179 * hooks.py: Only enclose editor binary in quotes if legal and
191 * hooks.py: Only enclose editor binary in quotes if legal and
180 necessary (space in the name, and is an existing file). Fixes a bug
192 necessary (space in the name, and is an existing file). Fixes a bug
181 reported by Zachary Pincus.
193 reported by Zachary Pincus.
182
194
183 2006-03-13 Fernando Perez <Fernando.Perez@colorado.edu>
195 2006-03-13 Fernando Perez <Fernando.Perez@colorado.edu>
184
196
185 * Manual: thanks to a tip on proper color handling for Emacs, by
197 * Manual: thanks to a tip on proper color handling for Emacs, by
186 Eric J Haywiser <ejh1-AT-MIT.EDU>.
198 Eric J Haywiser <ejh1-AT-MIT.EDU>.
187
199
188 * ipython.el: close http://www.scipy.net/roundup/ipython/issue57
200 * ipython.el: close http://www.scipy.net/roundup/ipython/issue57
189 by applying the provided patch. Thanks to Liu Jin
201 by applying the provided patch. Thanks to Liu Jin
190 <m.liu.jin-AT-gmail.com> for the contribution. No problems under
202 <m.liu.jin-AT-gmail.com> for the contribution. No problems under
191 XEmacs/Linux, I'm trusting the submitter that it actually helps
203 XEmacs/Linux, I'm trusting the submitter that it actually helps
192 under win32/GNU Emacs. Will revisit if any problems are reported.
204 under win32/GNU Emacs. Will revisit if any problems are reported.
193
205
194 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
206 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
195
207
196 * IPython/Gnuplot2.py (_FileClass): update for current Gnuplot.py
208 * IPython/Gnuplot2.py (_FileClass): update for current Gnuplot.py
197 from SVN, thanks to a patch by Ryan Woodard <rywo@bas.ac.uk>.
209 from SVN, thanks to a patch by Ryan Woodard <rywo@bas.ac.uk>.
198
210
199 2006-03-12 Ville Vainio <vivainio@gmail.com>
211 2006-03-12 Ville Vainio <vivainio@gmail.com>
200
212
201 * Magic.py (magic_timeit): Added %timeit magic, contributed by
213 * Magic.py (magic_timeit): Added %timeit magic, contributed by
202 Torsten Marek.
214 Torsten Marek.
203
215
204 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
216 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
205
217
206 * IPython/Magic.py (magic_macro): fix so that the n1-n2 syntax for
218 * IPython/Magic.py (magic_macro): fix so that the n1-n2 syntax for
207 line ranges works again.
219 line ranges works again.
208
220
209 2006-03-11 Fernando Perez <Fernando.Perez@colorado.edu>
221 2006-03-11 Fernando Perez <Fernando.Perez@colorado.edu>
210
222
211 * IPython/iplib.py (showtraceback): add back sys.last_traceback
223 * IPython/iplib.py (showtraceback): add back sys.last_traceback
212 and friends, after a discussion with Zach Pincus on ipython-user.
224 and friends, after a discussion with Zach Pincus on ipython-user.
213 I'm not 100% sure, but after thinking aobut it quite a bit, it may
225 I'm not 100% sure, but after thinking aobut it quite a bit, it may
214 be OK. Testing with the multithreaded shells didn't reveal any
226 be OK. Testing with the multithreaded shells didn't reveal any
215 problems, but let's keep an eye out.
227 problems, but let's keep an eye out.
216
228
217 In the process, I fixed a few things which were calling
229 In the process, I fixed a few things which were calling
218 self.InteractiveTB() directly (like safe_execfile), which is a
230 self.InteractiveTB() directly (like safe_execfile), which is a
219 mistake: ALL exception reporting should be done by calling
231 mistake: ALL exception reporting should be done by calling
220 self.showtraceback(), which handles state and tab-completion and
232 self.showtraceback(), which handles state and tab-completion and
221 more.
233 more.
222
234
223 2006-03-01 Ville Vainio <vivainio@gmail.com>
235 2006-03-01 Ville Vainio <vivainio@gmail.com>
224
236
225 * Extensions/ipipe.py: Added Walter Doerwald's "ipipe" module.
237 * Extensions/ipipe.py: Added Walter Doerwald's "ipipe" module.
226 To use, do "from ipipe import *".
238 To use, do "from ipipe import *".
227
239
228 2006-02-24 Ville Vainio <vivainio@gmail.com>
240 2006-02-24 Ville Vainio <vivainio@gmail.com>
229
241
230 * Magic.py, upgrade_dir.py: %upgrade magic added. Does things more
242 * Magic.py, upgrade_dir.py: %upgrade magic added. Does things more
231 "cleanly" and safely than the older upgrade mechanism.
243 "cleanly" and safely than the older upgrade mechanism.
232
244
233 2006-02-21 Ville Vainio <vivainio@gmail.com>
245 2006-02-21 Ville Vainio <vivainio@gmail.com>
234
246
235 * Magic.py: %save works again.
247 * Magic.py: %save works again.
236
248
237 2006-02-15 Ville Vainio <vivainio@gmail.com>
249 2006-02-15 Ville Vainio <vivainio@gmail.com>
238
250
239 * Magic.py: %Pprint works again
251 * Magic.py: %Pprint works again
240
252
241 * Extensions/ipy_sane_defaults.py: Provide everything provided
253 * Extensions/ipy_sane_defaults.py: Provide everything provided
242 in default ipythonrc, to make it possible to have a completely empty
254 in default ipythonrc, to make it possible to have a completely empty
243 ipythonrc (and thus completely rc-file free configuration)
255 ipythonrc (and thus completely rc-file free configuration)
244
256
245
257
246 2006-02-11 Fernando Perez <Fernando.Perez@colorado.edu>
258 2006-02-11 Fernando Perez <Fernando.Perez@colorado.edu>
247
259
248 * IPython/hooks.py (editor): quote the call to the editor command,
260 * IPython/hooks.py (editor): quote the call to the editor command,
249 to allow commands with spaces in them. Problem noted by watching
261 to allow commands with spaces in them. Problem noted by watching
250 Ian Oswald's video about textpad under win32 at
262 Ian Oswald's video about textpad under win32 at
251 http://showmedo.com/videoListPage?listKey=PythonIPythonSeries
263 http://showmedo.com/videoListPage?listKey=PythonIPythonSeries
252
264
253 * IPython/UserConfig/ipythonrc: Replace @ signs with % when
265 * IPython/UserConfig/ipythonrc: Replace @ signs with % when
254 describing magics (we haven't used @ for a loong time).
266 describing magics (we haven't used @ for a loong time).
255
267
256 * IPython/ultraTB.py (VerboseTB.text.text_repr): Added patch
268 * IPython/ultraTB.py (VerboseTB.text.text_repr): Added patch
257 contributed by marienz to close
269 contributed by marienz to close
258 http://www.scipy.net/roundup/ipython/issue53.
270 http://www.scipy.net/roundup/ipython/issue53.
259
271
260 2006-02-10 Ville Vainio <vivainio@gmail.com>
272 2006-02-10 Ville Vainio <vivainio@gmail.com>
261
273
262 * genutils.py: getoutput now works in win32 too
274 * genutils.py: getoutput now works in win32 too
263
275
264 * completer.py: alias and magic completion only invoked
276 * completer.py: alias and magic completion only invoked
265 at the first "item" in the line, to avoid "cd %store"
277 at the first "item" in the line, to avoid "cd %store"
266 nonsense.
278 nonsense.
267
279
268 2006-02-09 Ville Vainio <vivainio@gmail.com>
280 2006-02-09 Ville Vainio <vivainio@gmail.com>
269
281
270 * test/*: Added a unit testing framework (finally).
282 * test/*: Added a unit testing framework (finally).
271 '%run runtests.py' to run test_*.
283 '%run runtests.py' to run test_*.
272
284
273 * ipapi.py: Exposed runlines and set_custom_exc
285 * ipapi.py: Exposed runlines and set_custom_exc
274
286
275 2006-02-07 Ville Vainio <vivainio@gmail.com>
287 2006-02-07 Ville Vainio <vivainio@gmail.com>
276
288
277 * iplib.py: don't split "f 1 2" to "f(1,2)" in autocall,
289 * iplib.py: don't split "f 1 2" to "f(1,2)" in autocall,
278 instead use "f(1 2)" as before.
290 instead use "f(1 2)" as before.
279
291
280 2006-02-05 Fernando Perez <Fernando.Perez@colorado.edu>
292 2006-02-05 Fernando Perez <Fernando.Perez@colorado.edu>
281
293
282 * IPython/demo.py (IPythonDemo): Add new classes to the demo
294 * IPython/demo.py (IPythonDemo): Add new classes to the demo
283 facilities, for demos processed by the IPython input filter
295 facilities, for demos processed by the IPython input filter
284 (IPythonDemo), and for running a script one-line-at-a-time as a
296 (IPythonDemo), and for running a script one-line-at-a-time as a
285 demo, both for pure Python (LineDemo) and for IPython-processed
297 demo, both for pure Python (LineDemo) and for IPython-processed
286 input (IPythonLineDemo). After a request by Dave Kohel, from the
298 input (IPythonLineDemo). After a request by Dave Kohel, from the
287 SAGE team.
299 SAGE team.
288 (Demo.edit): added and edit() method to the demo objects, to edit
300 (Demo.edit): added and edit() method to the demo objects, to edit
289 the in-memory copy of the last executed block.
301 the in-memory copy of the last executed block.
290
302
291 * IPython/Magic.py (magic_edit): add '-r' option for 'raw'
303 * IPython/Magic.py (magic_edit): add '-r' option for 'raw'
292 processing to %edit, %macro and %save. These commands can now be
304 processing to %edit, %macro and %save. These commands can now be
293 invoked on the unprocessed input as it was typed by the user
305 invoked on the unprocessed input as it was typed by the user
294 (without any prefilters applied). After requests by the SAGE team
306 (without any prefilters applied). After requests by the SAGE team
295 at SAGE days 2006: http://modular.ucsd.edu/sage/days1/schedule.html.
307 at SAGE days 2006: http://modular.ucsd.edu/sage/days1/schedule.html.
296
308
297 2006-02-01 Ville Vainio <vivainio@gmail.com>
309 2006-02-01 Ville Vainio <vivainio@gmail.com>
298
310
299 * setup.py, eggsetup.py: easy_install ipython==dev works
311 * setup.py, eggsetup.py: easy_install ipython==dev works
300 correctly now (on Linux)
312 correctly now (on Linux)
301
313
302 * ipy_user_conf,ipmaker: user config changes, removed spurious
314 * ipy_user_conf,ipmaker: user config changes, removed spurious
303 warnings
315 warnings
304
316
305 * iplib: if rc.banner is string, use it as is.
317 * iplib: if rc.banner is string, use it as is.
306
318
307 * Magic: %pycat accepts a string argument and pages it's contents.
319 * Magic: %pycat accepts a string argument and pages it's contents.
308
320
309
321
310 2006-01-30 Ville Vainio <vivainio@gmail.com>
322 2006-01-30 Ville Vainio <vivainio@gmail.com>
311
323
312 * pickleshare,pspersistence,ipapi,Magic: persistence overhaul.
324 * pickleshare,pspersistence,ipapi,Magic: persistence overhaul.
313 Now %store and bookmarks work through PickleShare, meaning that
325 Now %store and bookmarks work through PickleShare, meaning that
314 concurrent access is possible and all ipython sessions see the
326 concurrent access is possible and all ipython sessions see the
315 same database situation all the time, instead of snapshot of
327 same database situation all the time, instead of snapshot of
316 the situation when the session was started. Hence, %bookmark
328 the situation when the session was started. Hence, %bookmark
317 results are immediately accessible from othes sessions. The database
329 results are immediately accessible from othes sessions. The database
318 is also available for use by user extensions. See:
330 is also available for use by user extensions. See:
319 http://www.python.org/pypi/pickleshare
331 http://www.python.org/pypi/pickleshare
320
332
321 * hooks.py: Two new hooks, 'shutdown_hook' and 'late_startup_hook'.
333 * hooks.py: Two new hooks, 'shutdown_hook' and 'late_startup_hook'.
322
334
323 * aliases can now be %store'd
335 * aliases can now be %store'd
324
336
325 * path.py move to Extensions so that pickleshare does not need
337 * path.py move to Extensions so that pickleshare does not need
326 IPython-specific import. Extensions added to pythonpath right
338 IPython-specific import. Extensions added to pythonpath right
327 at __init__.
339 at __init__.
328
340
329 * iplib.py: ipalias deprecated/redundant; aliases are converted and
341 * iplib.py: ipalias deprecated/redundant; aliases are converted and
330 called with _ip.system and the pre-transformed command string.
342 called with _ip.system and the pre-transformed command string.
331
343
332 2006-01-29 Fernando Perez <Fernando.Perez@colorado.edu>
344 2006-01-29 Fernando Perez <Fernando.Perez@colorado.edu>
333
345
334 * IPython/iplib.py (interact): Fix that we were not catching
346 * IPython/iplib.py (interact): Fix that we were not catching
335 KeyboardInterrupt exceptions properly. I'm not quite sure why the
347 KeyboardInterrupt exceptions properly. I'm not quite sure why the
336 logic here had to change, but it's fixed now.
348 logic here had to change, but it's fixed now.
337
349
338 2006-01-29 Ville Vainio <vivainio@gmail.com>
350 2006-01-29 Ville Vainio <vivainio@gmail.com>
339
351
340 * iplib.py: Try to import pyreadline on Windows.
352 * iplib.py: Try to import pyreadline on Windows.
341
353
342 2006-01-27 Ville Vainio <vivainio@gmail.com>
354 2006-01-27 Ville Vainio <vivainio@gmail.com>
343
355
344 * iplib.py: Expose ipapi as _ip in builtin namespace.
356 * iplib.py: Expose ipapi as _ip in builtin namespace.
345 Makes ipmagic (-> _ip.magic), ipsystem (-> _ip.system)
357 Makes ipmagic (-> _ip.magic), ipsystem (-> _ip.system)
346 and ip_set_hook (-> _ip.set_hook) redundant. % and !
358 and ip_set_hook (-> _ip.set_hook) redundant. % and !
347 syntax now produce _ip.* variant of the commands.
359 syntax now produce _ip.* variant of the commands.
348
360
349 * "_ip.options().autoedit_syntax = 2" automatically throws
361 * "_ip.options().autoedit_syntax = 2" automatically throws
350 user to editor for syntax error correction without prompting.
362 user to editor for syntax error correction without prompting.
351
363
352 2006-01-27 Ville Vainio <vivainio@gmail.com>
364 2006-01-27 Ville Vainio <vivainio@gmail.com>
353
365
354 * ipmaker.py: Give "realistic" sys.argv for scripts (without
366 * ipmaker.py: Give "realistic" sys.argv for scripts (without
355 'ipython' at argv[0]) executed through command line.
367 'ipython' at argv[0]) executed through command line.
356 NOTE: this DEPRECATES calling ipython with multiple scripts
368 NOTE: this DEPRECATES calling ipython with multiple scripts
357 ("ipython a.py b.py c.py")
369 ("ipython a.py b.py c.py")
358
370
359 * iplib.py, hooks.py: Added configurable input prefilter,
371 * iplib.py, hooks.py: Added configurable input prefilter,
360 named 'input_prefilter'. See ext_rescapture.py for example
372 named 'input_prefilter'. See ext_rescapture.py for example
361 usage.
373 usage.
362
374
363 * ext_rescapture.py, Magic.py: Better system command output capture
375 * ext_rescapture.py, Magic.py: Better system command output capture
364 through 'var = !ls' (deprecates user-visible %sc). Same notation
376 through 'var = !ls' (deprecates user-visible %sc). Same notation
365 applies for magics, 'var = %alias' assigns alias list to var.
377 applies for magics, 'var = %alias' assigns alias list to var.
366
378
367 * ipapi.py: added meta() for accessing extension-usable data store.
379 * ipapi.py: added meta() for accessing extension-usable data store.
368
380
369 * iplib.py: added InteractiveShell.getapi(). New magics should be
381 * iplib.py: added InteractiveShell.getapi(). New magics should be
370 written doing self.getapi() instead of using the shell directly.
382 written doing self.getapi() instead of using the shell directly.
371
383
372 * Magic.py: %store now allows doing %store foo > ~/myfoo.txt and
384 * Magic.py: %store now allows doing %store foo > ~/myfoo.txt and
373 %store foo >> ~/myfoo.txt to store variables to files (in clean
385 %store foo >> ~/myfoo.txt to store variables to files (in clean
374 textual form, not a restorable pickle).
386 textual form, not a restorable pickle).
375
387
376 * ipmaker.py: now import ipy_profile_PROFILENAME automatically
388 * ipmaker.py: now import ipy_profile_PROFILENAME automatically
377
389
378 * usage.py, Magic.py: added %quickref
390 * usage.py, Magic.py: added %quickref
379
391
380 * iplib.py: ESC_PAREN fixes: /f 1 2 -> f(1,2), not f(1 2).
392 * iplib.py: ESC_PAREN fixes: /f 1 2 -> f(1,2), not f(1 2).
381
393
382 * GetoptErrors when invoking magics etc. with wrong args
394 * GetoptErrors when invoking magics etc. with wrong args
383 are now more helpful:
395 are now more helpful:
384 GetoptError: option -l not recognized (allowed: "qb" )
396 GetoptError: option -l not recognized (allowed: "qb" )
385
397
386 2006-01-25 Fernando Perez <Fernando.Perez@colorado.edu>
398 2006-01-25 Fernando Perez <Fernando.Perez@colorado.edu>
387
399
388 * IPython/demo.py (Demo.show): Flush stdout after each block, so
400 * IPython/demo.py (Demo.show): Flush stdout after each block, so
389 computationally intensive blocks don't appear to stall the demo.
401 computationally intensive blocks don't appear to stall the demo.
390
402
391 2006-01-24 Ville Vainio <vivainio@gmail.com>
403 2006-01-24 Ville Vainio <vivainio@gmail.com>
392
404
393 * iplib.py, hooks.py: 'result_display' hook can return a non-None
405 * iplib.py, hooks.py: 'result_display' hook can return a non-None
394 value to manipulate resulting history entry.
406 value to manipulate resulting history entry.
395
407
396 * ipapi.py: Moved TryNext here from hooks.py. Moved functions
408 * ipapi.py: Moved TryNext here from hooks.py. Moved functions
397 to instance methods of IPApi class, to make extending an embedded
409 to instance methods of IPApi class, to make extending an embedded
398 IPython feasible. See ext_rehashdir.py for example usage.
410 IPython feasible. See ext_rehashdir.py for example usage.
399
411
400 * Merged 1071-1076 from banches/0.7.1
412 * Merged 1071-1076 from banches/0.7.1
401
413
402
414
403 2006-01-23 Fernando Perez <Fernando.Perez@colorado.edu>
415 2006-01-23 Fernando Perez <Fernando.Perez@colorado.edu>
404
416
405 * tools/release (daystamp): Fix build tools to use the new
417 * tools/release (daystamp): Fix build tools to use the new
406 eggsetup.py script to build lightweight eggs.
418 eggsetup.py script to build lightweight eggs.
407
419
408 * Applied changesets 1062 and 1064 before 0.7.1 release.
420 * Applied changesets 1062 and 1064 before 0.7.1 release.
409
421
410 * IPython/Magic.py (magic_history): Add '-r' option to %hist, to
422 * IPython/Magic.py (magic_history): Add '-r' option to %hist, to
411 see the raw input history (without conversions like %ls ->
423 see the raw input history (without conversions like %ls ->
412 ipmagic("ls")). After a request from W. Stein, SAGE
424 ipmagic("ls")). After a request from W. Stein, SAGE
413 (http://modular.ucsd.edu/sage) developer. This information is
425 (http://modular.ucsd.edu/sage) developer. This information is
414 stored in the input_hist_raw attribute of the IPython instance, so
426 stored in the input_hist_raw attribute of the IPython instance, so
415 developers can access it if needed (it's an InputList instance).
427 developers can access it if needed (it's an InputList instance).
416
428
417 * Versionstring = 0.7.2.svn
429 * Versionstring = 0.7.2.svn
418
430
419 * eggsetup.py: A separate script for constructing eggs, creates
431 * eggsetup.py: A separate script for constructing eggs, creates
420 proper launch scripts even on Windows (an .exe file in
432 proper launch scripts even on Windows (an .exe file in
421 \python24\scripts).
433 \python24\scripts).
422
434
423 * ipapi.py: launch_new_instance, launch entry point needed for the
435 * ipapi.py: launch_new_instance, launch entry point needed for the
424 egg.
436 egg.
425
437
426 2006-01-23 Ville Vainio <vivainio@gmail.com>
438 2006-01-23 Ville Vainio <vivainio@gmail.com>
427
439
428 * Added %cpaste magic for pasting python code
440 * Added %cpaste magic for pasting python code
429
441
430 2006-01-22 Ville Vainio <vivainio@gmail.com>
442 2006-01-22 Ville Vainio <vivainio@gmail.com>
431
443
432 * Merge from branches/0.7.1 into trunk, revs 1052-1057
444 * Merge from branches/0.7.1 into trunk, revs 1052-1057
433
445
434 * Versionstring = 0.7.2.svn
446 * Versionstring = 0.7.2.svn
435
447
436 * eggsetup.py: A separate script for constructing eggs, creates
448 * eggsetup.py: A separate script for constructing eggs, creates
437 proper launch scripts even on Windows (an .exe file in
449 proper launch scripts even on Windows (an .exe file in
438 \python24\scripts).
450 \python24\scripts).
439
451
440 * ipapi.py: launch_new_instance, launch entry point needed for the
452 * ipapi.py: launch_new_instance, launch entry point needed for the
441 egg.
453 egg.
442
454
443 2006-01-22 Fernando Perez <Fernando.Perez@colorado.edu>
455 2006-01-22 Fernando Perez <Fernando.Perez@colorado.edu>
444
456
445 * IPython/OInspect.py (Inspector.pinfo): fix bug where foo?? or
457 * IPython/OInspect.py (Inspector.pinfo): fix bug where foo?? or
446 %pfile foo would print the file for foo even if it was a binary.
458 %pfile foo would print the file for foo even if it was a binary.
447 Now, extensions '.so' and '.dll' are skipped.
459 Now, extensions '.so' and '.dll' are skipped.
448
460
449 * IPython/Shell.py (MTInteractiveShell.__init__): Fix threading
461 * IPython/Shell.py (MTInteractiveShell.__init__): Fix threading
450 bug, where macros would fail in all threaded modes. I'm not 100%
462 bug, where macros would fail in all threaded modes. I'm not 100%
451 sure, so I'm going to put out an rc instead of making a release
463 sure, so I'm going to put out an rc instead of making a release
452 today, and wait for feedback for at least a few days.
464 today, and wait for feedback for at least a few days.
453
465
454 * IPython/iplib.py (handle_normal): fix (finally? somehow I doubt
466 * IPython/iplib.py (handle_normal): fix (finally? somehow I doubt
455 it...) the handling of pasting external code with autoindent on.
467 it...) the handling of pasting external code with autoindent on.
456 To get out of a multiline input, the rule will appear for most
468 To get out of a multiline input, the rule will appear for most
457 users unchanged: two blank lines or change the indent level
469 users unchanged: two blank lines or change the indent level
458 proposed by IPython. But there is a twist now: you can
470 proposed by IPython. But there is a twist now: you can
459 add/subtract only *one or two spaces*. If you add/subtract three
471 add/subtract only *one or two spaces*. If you add/subtract three
460 or more (unless you completely delete the line), IPython will
472 or more (unless you completely delete the line), IPython will
461 accept that line, and you'll need to enter a second one of pure
473 accept that line, and you'll need to enter a second one of pure
462 whitespace. I know it sounds complicated, but I can't find a
474 whitespace. I know it sounds complicated, but I can't find a
463 different solution that covers all the cases, with the right
475 different solution that covers all the cases, with the right
464 heuristics. Hopefully in actual use, nobody will really notice
476 heuristics. Hopefully in actual use, nobody will really notice
465 all these strange rules and things will 'just work'.
477 all these strange rules and things will 'just work'.
466
478
467 2006-01-21 Fernando Perez <Fernando.Perez@colorado.edu>
479 2006-01-21 Fernando Perez <Fernando.Perez@colorado.edu>
468
480
469 * IPython/iplib.py (interact): catch exceptions which can be
481 * IPython/iplib.py (interact): catch exceptions which can be
470 triggered asynchronously by signal handlers. Thanks to an
482 triggered asynchronously by signal handlers. Thanks to an
471 automatic crash report, submitted by Colin Kingsley
483 automatic crash report, submitted by Colin Kingsley
472 <tercel-AT-gentoo.org>.
484 <tercel-AT-gentoo.org>.
473
485
474 2006-01-20 Ville Vainio <vivainio@gmail.com>
486 2006-01-20 Ville Vainio <vivainio@gmail.com>
475
487
476 * Ipython/Extensions/ext_rehashdir.py: Created a usable example
488 * Ipython/Extensions/ext_rehashdir.py: Created a usable example
477 (%rehashdir, very useful, try it out) of how to extend ipython
489 (%rehashdir, very useful, try it out) of how to extend ipython
478 with new magics. Also added Extensions dir to pythonpath to make
490 with new magics. Also added Extensions dir to pythonpath to make
479 importing extensions easy.
491 importing extensions easy.
480
492
481 * %store now complains when trying to store interactively declared
493 * %store now complains when trying to store interactively declared
482 classes / instances of those classes.
494 classes / instances of those classes.
483
495
484 * Extensions/ipy_system_conf.py, UserConfig/ipy_user_conf.py,
496 * Extensions/ipy_system_conf.py, UserConfig/ipy_user_conf.py,
485 ipmaker.py: Config rehaul. Now ipy_..._conf.py are always imported
497 ipmaker.py: Config rehaul. Now ipy_..._conf.py are always imported
486 if they exist, and ipy_user_conf.py with some defaults is created for
498 if they exist, and ipy_user_conf.py with some defaults is created for
487 the user.
499 the user.
488
500
489 * Startup rehashing done by the config file, not InterpreterExec.
501 * Startup rehashing done by the config file, not InterpreterExec.
490 This means system commands are available even without selecting the
502 This means system commands are available even without selecting the
491 pysh profile. It's the sensible default after all.
503 pysh profile. It's the sensible default after all.
492
504
493 2006-01-20 Fernando Perez <Fernando.Perez@colorado.edu>
505 2006-01-20 Fernando Perez <Fernando.Perez@colorado.edu>
494
506
495 * IPython/iplib.py (raw_input): I _think_ I got the pasting of
507 * IPython/iplib.py (raw_input): I _think_ I got the pasting of
496 multiline code with autoindent on working. But I am really not
508 multiline code with autoindent on working. But I am really not
497 sure, so this needs more testing. Will commit a debug-enabled
509 sure, so this needs more testing. Will commit a debug-enabled
498 version for now, while I test it some more, so that Ville and
510 version for now, while I test it some more, so that Ville and
499 others may also catch any problems. Also made
511 others may also catch any problems. Also made
500 self.indent_current_str() a method, to ensure that there's no
512 self.indent_current_str() a method, to ensure that there's no
501 chance of the indent space count and the corresponding string
513 chance of the indent space count and the corresponding string
502 falling out of sync. All code needing the string should just call
514 falling out of sync. All code needing the string should just call
503 the method.
515 the method.
504
516
505 2006-01-18 Fernando Perez <Fernando.Perez@colorado.edu>
517 2006-01-18 Fernando Perez <Fernando.Perez@colorado.edu>
506
518
507 * IPython/Magic.py (magic_edit): fix check for when users don't
519 * IPython/Magic.py (magic_edit): fix check for when users don't
508 save their output files, the try/except was in the wrong section.
520 save their output files, the try/except was in the wrong section.
509
521
510 2006-01-17 Fernando Perez <Fernando.Perez@colorado.edu>
522 2006-01-17 Fernando Perez <Fernando.Perez@colorado.edu>
511
523
512 * IPython/Magic.py (magic_run): fix __file__ global missing from
524 * IPython/Magic.py (magic_run): fix __file__ global missing from
513 script's namespace when executed via %run. After a report by
525 script's namespace when executed via %run. After a report by
514 Vivian.
526 Vivian.
515
527
516 * IPython/Debugger.py (Pdb.__init__): Fix breakage with '%run -d'
528 * IPython/Debugger.py (Pdb.__init__): Fix breakage with '%run -d'
517 when using python 2.4. The parent constructor changed in 2.4, and
529 when using python 2.4. The parent constructor changed in 2.4, and
518 we need to track it directly (we can't call it, as it messes up
530 we need to track it directly (we can't call it, as it messes up
519 readline and tab-completion inside our pdb would stop working).
531 readline and tab-completion inside our pdb would stop working).
520 After a bug report by R. Bernstein <rocky-AT-panix.com>.
532 After a bug report by R. Bernstein <rocky-AT-panix.com>.
521
533
522 2006-01-16 Ville Vainio <vivainio@gmail.com>
534 2006-01-16 Ville Vainio <vivainio@gmail.com>
523
535
524 * Ipython/magic.py:Reverted back to old %edit functionality
536 * Ipython/magic.py:Reverted back to old %edit functionality
525 that returns file contents on exit.
537 that returns file contents on exit.
526
538
527 * IPython/path.py: Added Jason Orendorff's "path" module to
539 * IPython/path.py: Added Jason Orendorff's "path" module to
528 IPython tree, http://www.jorendorff.com/articles/python/path/.
540 IPython tree, http://www.jorendorff.com/articles/python/path/.
529 You can get path objects conveniently through %sc, and !!, e.g.:
541 You can get path objects conveniently through %sc, and !!, e.g.:
530 sc files=ls
542 sc files=ls
531 for p in files.paths: # or files.p
543 for p in files.paths: # or files.p
532 print p,p.mtime
544 print p,p.mtime
533
545
534 * Ipython/iplib.py:"," and ";" autoquoting-upon-autocall
546 * Ipython/iplib.py:"," and ";" autoquoting-upon-autocall
535 now work again without considering the exclusion regexp -
547 now work again without considering the exclusion regexp -
536 hence, things like ',foo my/path' turn to 'foo("my/path")'
548 hence, things like ',foo my/path' turn to 'foo("my/path")'
537 instead of syntax error.
549 instead of syntax error.
538
550
539
551
540 2006-01-14 Ville Vainio <vivainio@gmail.com>
552 2006-01-14 Ville Vainio <vivainio@gmail.com>
541
553
542 * IPython/ipapi.py (ashook, asmagic, options): Added convenience
554 * IPython/ipapi.py (ashook, asmagic, options): Added convenience
543 ipapi decorators for python 2.4 users, options() provides access to rc
555 ipapi decorators for python 2.4 users, options() provides access to rc
544 data.
556 data.
545
557
546 * IPython/Magic.py (magic_cd): %cd now accepts backslashes
558 * IPython/Magic.py (magic_cd): %cd now accepts backslashes
547 as path separators (even on Linux ;-). Space character after
559 as path separators (even on Linux ;-). Space character after
548 backslash (as yielded by tab completer) is still space;
560 backslash (as yielded by tab completer) is still space;
549 "%cd long\ name" works as expected.
561 "%cd long\ name" works as expected.
550
562
551 * IPython/ipapi.py,hooks.py,iplib.py: Hooks now implemented
563 * IPython/ipapi.py,hooks.py,iplib.py: Hooks now implemented
552 as "chain of command", with priority. API stays the same,
564 as "chain of command", with priority. API stays the same,
553 TryNext exception raised by a hook function signals that
565 TryNext exception raised by a hook function signals that
554 current hook failed and next hook should try handling it, as
566 current hook failed and next hook should try handling it, as
555 suggested by Walter DΓΆrwald <walter@livinglogic.de>. Walter also
567 suggested by Walter DΓΆrwald <walter@livinglogic.de>. Walter also
556 requested configurable display hook, which is now implemented.
568 requested configurable display hook, which is now implemented.
557
569
558 2006-01-13 Ville Vainio <vivainio@gmail.com>
570 2006-01-13 Ville Vainio <vivainio@gmail.com>
559
571
560 * IPython/platutils*.py: platform specific utility functions,
572 * IPython/platutils*.py: platform specific utility functions,
561 so far only set_term_title is implemented (change terminal
573 so far only set_term_title is implemented (change terminal
562 label in windowing systems). %cd now changes the title to
574 label in windowing systems). %cd now changes the title to
563 current dir.
575 current dir.
564
576
565 * IPython/Release.py: Added myself to "authors" list,
577 * IPython/Release.py: Added myself to "authors" list,
566 had to create new files.
578 had to create new files.
567
579
568 * IPython/iplib.py (handle_shell_escape): fixed logical flaw in
580 * IPython/iplib.py (handle_shell_escape): fixed logical flaw in
569 shell escape; not a known bug but had potential to be one in the
581 shell escape; not a known bug but had potential to be one in the
570 future.
582 future.
571
583
572 * IPython/ipapi.py (added),OInspect.py,iplib.py: "Public"
584 * IPython/ipapi.py (added),OInspect.py,iplib.py: "Public"
573 extension API for IPython! See the module for usage example. Fix
585 extension API for IPython! See the module for usage example. Fix
574 OInspect for docstring-less magic functions.
586 OInspect for docstring-less magic functions.
575
587
576
588
577 2006-01-13 Fernando Perez <Fernando.Perez@colorado.edu>
589 2006-01-13 Fernando Perez <Fernando.Perez@colorado.edu>
578
590
579 * IPython/iplib.py (raw_input): temporarily deactivate all
591 * IPython/iplib.py (raw_input): temporarily deactivate all
580 attempts at allowing pasting of code with autoindent on. It
592 attempts at allowing pasting of code with autoindent on. It
581 introduced bugs (reported by Prabhu) and I can't seem to find a
593 introduced bugs (reported by Prabhu) and I can't seem to find a
582 robust combination which works in all cases. Will have to revisit
594 robust combination which works in all cases. Will have to revisit
583 later.
595 later.
584
596
585 * IPython/genutils.py: remove isspace() function. We've dropped
597 * IPython/genutils.py: remove isspace() function. We've dropped
586 2.2 compatibility, so it's OK to use the string method.
598 2.2 compatibility, so it's OK to use the string method.
587
599
588 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
600 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
589
601
590 * IPython/iplib.py (InteractiveShell.__init__): fix regexp
602 * IPython/iplib.py (InteractiveShell.__init__): fix regexp
591 matching what NOT to autocall on, to include all python binary
603 matching what NOT to autocall on, to include all python binary
592 operators (including things like 'and', 'or', 'is' and 'in').
604 operators (including things like 'and', 'or', 'is' and 'in').
593 Prompted by a bug report on 'foo & bar', but I realized we had
605 Prompted by a bug report on 'foo & bar', but I realized we had
594 many more potential bug cases with other operators. The regexp is
606 many more potential bug cases with other operators. The regexp is
595 self.re_exclude_auto, it's fairly commented.
607 self.re_exclude_auto, it's fairly commented.
596
608
597 2006-01-12 Ville Vainio <vivainio@gmail.com>
609 2006-01-12 Ville Vainio <vivainio@gmail.com>
598
610
599 * IPython/iplib.py (make_quoted_expr,handle_shell_escape):
611 * IPython/iplib.py (make_quoted_expr,handle_shell_escape):
600 Prettified and hardened string/backslash quoting with ipsystem(),
612 Prettified and hardened string/backslash quoting with ipsystem(),
601 ipalias() and ipmagic(). Now even \ characters are passed to
613 ipalias() and ipmagic(). Now even \ characters are passed to
602 %magics, !shell escapes and aliases exactly as they are in the
614 %magics, !shell escapes and aliases exactly as they are in the
603 ipython command line. Should improve backslash experience,
615 ipython command line. Should improve backslash experience,
604 particularly in Windows (path delimiter for some commands that
616 particularly in Windows (path delimiter for some commands that
605 won't understand '/'), but Unix benefits as well (regexps). %cd
617 won't understand '/'), but Unix benefits as well (regexps). %cd
606 magic still doesn't support backslash path delimiters, though. Also
618 magic still doesn't support backslash path delimiters, though. Also
607 deleted all pretense of supporting multiline command strings in
619 deleted all pretense of supporting multiline command strings in
608 !system or %magic commands. Thanks to Jerry McRae for suggestions.
620 !system or %magic commands. Thanks to Jerry McRae for suggestions.
609
621
610 * doc/build_doc_instructions.txt added. Documentation on how to
622 * doc/build_doc_instructions.txt added. Documentation on how to
611 use doc/update_manual.py, added yesterday. Both files contributed
623 use doc/update_manual.py, added yesterday. Both files contributed
612 by JΓΆrgen Stenarson <jorgen.stenarson-AT-bostream.nu>. This slates
624 by JΓΆrgen Stenarson <jorgen.stenarson-AT-bostream.nu>. This slates
613 doc/*.sh for deprecation at a later date.
625 doc/*.sh for deprecation at a later date.
614
626
615 * /ipython.py Added ipython.py to root directory for
627 * /ipython.py Added ipython.py to root directory for
616 zero-installation (tar xzvf ipython.tgz; cd ipython; python
628 zero-installation (tar xzvf ipython.tgz; cd ipython; python
617 ipython.py) and development convenience (no need to kee doing
629 ipython.py) and development convenience (no need to kee doing
618 "setup.py install" between changes).
630 "setup.py install" between changes).
619
631
620 * Made ! and !! shell escapes work (again) in multiline expressions:
632 * Made ! and !! shell escapes work (again) in multiline expressions:
621 if 1:
633 if 1:
622 !ls
634 !ls
623 !!ls
635 !!ls
624
636
625 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
637 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
626
638
627 * IPython/ipstruct.py (Struct): Rename IPython.Struct to
639 * IPython/ipstruct.py (Struct): Rename IPython.Struct to
628 IPython.ipstruct, to avoid local shadowing of the stdlib 'struct'
640 IPython.ipstruct, to avoid local shadowing of the stdlib 'struct'
629 module in case-insensitive installation. Was causing crashes
641 module in case-insensitive installation. Was causing crashes
630 under win32. Closes http://www.scipy.net/roundup/ipython/issue49.
642 under win32. Closes http://www.scipy.net/roundup/ipython/issue49.
631
643
632 * IPython/Magic.py (magic_pycat): Fix pycat, patch by Marien Zwart
644 * IPython/Magic.py (magic_pycat): Fix pycat, patch by Marien Zwart
633 <marienz-AT-gentoo.org>, closes
645 <marienz-AT-gentoo.org>, closes
634 http://www.scipy.net/roundup/ipython/issue51.
646 http://www.scipy.net/roundup/ipython/issue51.
635
647
636 2006-01-11 Fernando Perez <Fernando.Perez@colorado.edu>
648 2006-01-11 Fernando Perez <Fernando.Perez@colorado.edu>
637
649
638 * IPython/Shell.py (IPShellGTK.on_timer): Finally fix the the
650 * IPython/Shell.py (IPShellGTK.on_timer): Finally fix the the
639 problem of excessive CPU usage under *nix and keyboard lag under
651 problem of excessive CPU usage under *nix and keyboard lag under
640 win32.
652 win32.
641
653
642 2006-01-10 *** Released version 0.7.0
654 2006-01-10 *** Released version 0.7.0
643
655
644 2006-01-10 Fernando Perez <Fernando.Perez@colorado.edu>
656 2006-01-10 Fernando Perez <Fernando.Perez@colorado.edu>
645
657
646 * IPython/Release.py (revision): tag version number to 0.7.0,
658 * IPython/Release.py (revision): tag version number to 0.7.0,
647 ready for release.
659 ready for release.
648
660
649 * IPython/Magic.py (magic_edit): Add print statement to %edit so
661 * IPython/Magic.py (magic_edit): Add print statement to %edit so
650 it informs the user of the name of the temp. file used. This can
662 it informs the user of the name of the temp. file used. This can
651 help if you decide later to reuse that same file, so you know
663 help if you decide later to reuse that same file, so you know
652 where to copy the info from.
664 where to copy the info from.
653
665
654 2006-01-09 Fernando Perez <Fernando.Perez@colorado.edu>
666 2006-01-09 Fernando Perez <Fernando.Perez@colorado.edu>
655
667
656 * setup_bdist_egg.py: little script to build an egg. Added
668 * setup_bdist_egg.py: little script to build an egg. Added
657 support in the release tools as well.
669 support in the release tools as well.
658
670
659 2006-01-08 Fernando Perez <Fernando.Perez@colorado.edu>
671 2006-01-08 Fernando Perez <Fernando.Perez@colorado.edu>
660
672
661 * IPython/Shell.py (IPShellWX.__init__): add support for WXPython
673 * IPython/Shell.py (IPShellWX.__init__): add support for WXPython
662 version selection (new -wxversion command line and ipythonrc
674 version selection (new -wxversion command line and ipythonrc
663 parameter). Patch contributed by Arnd Baecker
675 parameter). Patch contributed by Arnd Baecker
664 <arnd.baecker-AT-web.de>.
676 <arnd.baecker-AT-web.de>.
665
677
666 * IPython/iplib.py (embed_mainloop): fix tab-completion in
678 * IPython/iplib.py (embed_mainloop): fix tab-completion in
667 embedded instances, for variables defined at the interactive
679 embedded instances, for variables defined at the interactive
668 prompt of the embedded ipython. Reported by Arnd.
680 prompt of the embedded ipython. Reported by Arnd.
669
681
670 * IPython/Magic.py (magic_autocall): Fix %autocall magic. Now
682 * IPython/Magic.py (magic_autocall): Fix %autocall magic. Now
671 it can be used as a (stateful) toggle, or with a direct parameter.
683 it can be used as a (stateful) toggle, or with a direct parameter.
672
684
673 * IPython/ultraTB.py (_fixed_getinnerframes): remove debug assert which
685 * IPython/ultraTB.py (_fixed_getinnerframes): remove debug assert which
674 could be triggered in certain cases and cause the traceback
686 could be triggered in certain cases and cause the traceback
675 printer not to work.
687 printer not to work.
676
688
677 2006-01-07 Fernando Perez <Fernando.Perez@colorado.edu>
689 2006-01-07 Fernando Perez <Fernando.Perez@colorado.edu>
678
690
679 * IPython/iplib.py (_should_recompile): Small fix, closes
691 * IPython/iplib.py (_should_recompile): Small fix, closes
680 http://www.scipy.net/roundup/ipython/issue48. Patch by Scott.
692 http://www.scipy.net/roundup/ipython/issue48. Patch by Scott.
681
693
682 2006-01-04 Fernando Perez <Fernando.Perez@colorado.edu>
694 2006-01-04 Fernando Perez <Fernando.Perez@colorado.edu>
683
695
684 * IPython/Shell.py (IPShellGTK.mainloop): fix bug in the GTK
696 * IPython/Shell.py (IPShellGTK.mainloop): fix bug in the GTK
685 backend for matplotlib (100% cpu utiliziation). Thanks to Charlie
697 backend for matplotlib (100% cpu utiliziation). Thanks to Charlie
686 Moad for help with tracking it down.
698 Moad for help with tracking it down.
687
699
688 * IPython/iplib.py (handle_auto): fix autocall handling for
700 * IPython/iplib.py (handle_auto): fix autocall handling for
689 objects which support BOTH __getitem__ and __call__ (so that f [x]
701 objects which support BOTH __getitem__ and __call__ (so that f [x]
690 is left alone, instead of becoming f([x]) automatically).
702 is left alone, instead of becoming f([x]) automatically).
691
703
692 * IPython/Magic.py (magic_cd): fix crash when cd -b was used.
704 * IPython/Magic.py (magic_cd): fix crash when cd -b was used.
693 Ville's patch.
705 Ville's patch.
694
706
695 2006-01-03 Fernando Perez <Fernando.Perez@colorado.edu>
707 2006-01-03 Fernando Perez <Fernando.Perez@colorado.edu>
696
708
697 * IPython/iplib.py (handle_auto): changed autocall semantics to
709 * IPython/iplib.py (handle_auto): changed autocall semantics to
698 include 'smart' mode, where the autocall transformation is NOT
710 include 'smart' mode, where the autocall transformation is NOT
699 applied if there are no arguments on the line. This allows you to
711 applied if there are no arguments on the line. This allows you to
700 just type 'foo' if foo is a callable to see its internal form,
712 just type 'foo' if foo is a callable to see its internal form,
701 instead of having it called with no arguments (typically a
713 instead of having it called with no arguments (typically a
702 mistake). The old 'full' autocall still exists: for that, you
714 mistake). The old 'full' autocall still exists: for that, you
703 need to set the 'autocall' parameter to 2 in your ipythonrc file.
715 need to set the 'autocall' parameter to 2 in your ipythonrc file.
704
716
705 * IPython/completer.py (Completer.attr_matches): add
717 * IPython/completer.py (Completer.attr_matches): add
706 tab-completion support for Enthoughts' traits. After a report by
718 tab-completion support for Enthoughts' traits. After a report by
707 Arnd and a patch by Prabhu.
719 Arnd and a patch by Prabhu.
708
720
709 2006-01-02 Fernando Perez <Fernando.Perez@colorado.edu>
721 2006-01-02 Fernando Perez <Fernando.Perez@colorado.edu>
710
722
711 * IPython/ultraTB.py (_fixed_getinnerframes): added Alex
723 * IPython/ultraTB.py (_fixed_getinnerframes): added Alex
712 Schmolck's patch to fix inspect.getinnerframes().
724 Schmolck's patch to fix inspect.getinnerframes().
713
725
714 * IPython/iplib.py (InteractiveShell.__init__): significant fixes
726 * IPython/iplib.py (InteractiveShell.__init__): significant fixes
715 for embedded instances, regarding handling of namespaces and items
727 for embedded instances, regarding handling of namespaces and items
716 added to the __builtin__ one. Multiple embedded instances and
728 added to the __builtin__ one. Multiple embedded instances and
717 recursive embeddings should work better now (though I'm not sure
729 recursive embeddings should work better now (though I'm not sure
718 I've got all the corner cases fixed, that code is a bit of a brain
730 I've got all the corner cases fixed, that code is a bit of a brain
719 twister).
731 twister).
720
732
721 * IPython/Magic.py (magic_edit): added support to edit in-memory
733 * IPython/Magic.py (magic_edit): added support to edit in-memory
722 macros (automatically creates the necessary temp files). %edit
734 macros (automatically creates the necessary temp files). %edit
723 also doesn't return the file contents anymore, it's just noise.
735 also doesn't return the file contents anymore, it's just noise.
724
736
725 * IPython/completer.py (Completer.attr_matches): revert change to
737 * IPython/completer.py (Completer.attr_matches): revert change to
726 complete only on attributes listed in __all__. I realized it
738 complete only on attributes listed in __all__. I realized it
727 cripples the tab-completion system as a tool for exploring the
739 cripples the tab-completion system as a tool for exploring the
728 internals of unknown libraries (it renders any non-__all__
740 internals of unknown libraries (it renders any non-__all__
729 attribute off-limits). I got bit by this when trying to see
741 attribute off-limits). I got bit by this when trying to see
730 something inside the dis module.
742 something inside the dis module.
731
743
732 2005-12-31 Fernando Perez <Fernando.Perez@colorado.edu>
744 2005-12-31 Fernando Perez <Fernando.Perez@colorado.edu>
733
745
734 * IPython/iplib.py (InteractiveShell.__init__): add .meta
746 * IPython/iplib.py (InteractiveShell.__init__): add .meta
735 namespace for users and extension writers to hold data in. This
747 namespace for users and extension writers to hold data in. This
736 follows the discussion in
748 follows the discussion in
737 http://projects.scipy.org/ipython/ipython/wiki/RefactoringIPython.
749 http://projects.scipy.org/ipython/ipython/wiki/RefactoringIPython.
738
750
739 * IPython/completer.py (IPCompleter.complete): small patch to help
751 * IPython/completer.py (IPCompleter.complete): small patch to help
740 tab-completion under Emacs, after a suggestion by John Barnard
752 tab-completion under Emacs, after a suggestion by John Barnard
741 <barnarj-AT-ccf.org>.
753 <barnarj-AT-ccf.org>.
742
754
743 * IPython/Magic.py (Magic.extract_input_slices): added support for
755 * IPython/Magic.py (Magic.extract_input_slices): added support for
744 the slice notation in magics to use N-M to represent numbers N...M
756 the slice notation in magics to use N-M to represent numbers N...M
745 (closed endpoints). This is used by %macro and %save.
757 (closed endpoints). This is used by %macro and %save.
746
758
747 * IPython/completer.py (Completer.attr_matches): for modules which
759 * IPython/completer.py (Completer.attr_matches): for modules which
748 define __all__, complete only on those. After a patch by Jeffrey
760 define __all__, complete only on those. After a patch by Jeffrey
749 Collins <jcollins_boulder-AT-earthlink.net>. Also, clean up and
761 Collins <jcollins_boulder-AT-earthlink.net>. Also, clean up and
750 speed up this routine.
762 speed up this routine.
751
763
752 * IPython/Logger.py (Logger.log): fix a history handling bug. I
764 * IPython/Logger.py (Logger.log): fix a history handling bug. I
753 don't know if this is the end of it, but the behavior now is
765 don't know if this is the end of it, but the behavior now is
754 certainly much more correct. Note that coupled with macros,
766 certainly much more correct. Note that coupled with macros,
755 slightly surprising (at first) behavior may occur: a macro will in
767 slightly surprising (at first) behavior may occur: a macro will in
756 general expand to multiple lines of input, so upon exiting, the
768 general expand to multiple lines of input, so upon exiting, the
757 in/out counters will both be bumped by the corresponding amount
769 in/out counters will both be bumped by the corresponding amount
758 (as if the macro's contents had been typed interactively). Typing
770 (as if the macro's contents had been typed interactively). Typing
759 %hist will reveal the intermediate (silently processed) lines.
771 %hist will reveal the intermediate (silently processed) lines.
760
772
761 * IPython/Magic.py (magic_run): fix a subtle bug which could cause
773 * IPython/Magic.py (magic_run): fix a subtle bug which could cause
762 pickle to fail (%run was overwriting __main__ and not restoring
774 pickle to fail (%run was overwriting __main__ and not restoring
763 it, but pickle relies on __main__ to operate).
775 it, but pickle relies on __main__ to operate).
764
776
765 * IPython/iplib.py (InteractiveShell): fix pdb calling: I'm now
777 * IPython/iplib.py (InteractiveShell): fix pdb calling: I'm now
766 using properties, but forgot to make the main InteractiveShell
778 using properties, but forgot to make the main InteractiveShell
767 class a new-style class. Properties fail silently, and
779 class a new-style class. Properties fail silently, and
768 misteriously, with old-style class (getters work, but
780 misteriously, with old-style class (getters work, but
769 setters don't do anything).
781 setters don't do anything).
770
782
771 2005-12-30 Fernando Perez <Fernando.Perez@colorado.edu>
783 2005-12-30 Fernando Perez <Fernando.Perez@colorado.edu>
772
784
773 * IPython/Magic.py (magic_history): fix history reporting bug (I
785 * IPython/Magic.py (magic_history): fix history reporting bug (I
774 know some nasties are still there, I just can't seem to find a
786 know some nasties are still there, I just can't seem to find a
775 reproducible test case to track them down; the input history is
787 reproducible test case to track them down; the input history is
776 falling out of sync...)
788 falling out of sync...)
777
789
778 * IPython/iplib.py (handle_shell_escape): fix bug where both
790 * IPython/iplib.py (handle_shell_escape): fix bug where both
779 aliases and system accesses where broken for indented code (such
791 aliases and system accesses where broken for indented code (such
780 as loops).
792 as loops).
781
793
782 * IPython/genutils.py (shell): fix small but critical bug for
794 * IPython/genutils.py (shell): fix small but critical bug for
783 win32 system access.
795 win32 system access.
784
796
785 2005-12-29 Fernando Perez <Fernando.Perez@colorado.edu>
797 2005-12-29 Fernando Perez <Fernando.Perez@colorado.edu>
786
798
787 * IPython/iplib.py (showtraceback): remove use of the
799 * IPython/iplib.py (showtraceback): remove use of the
788 sys.last_{type/value/traceback} structures, which are non
800 sys.last_{type/value/traceback} structures, which are non
789 thread-safe.
801 thread-safe.
790 (_prefilter): change control flow to ensure that we NEVER
802 (_prefilter): change control flow to ensure that we NEVER
791 introspect objects when autocall is off. This will guarantee that
803 introspect objects when autocall is off. This will guarantee that
792 having an input line of the form 'x.y', where access to attribute
804 having an input line of the form 'x.y', where access to attribute
793 'y' has side effects, doesn't trigger the side effect TWICE. It
805 'y' has side effects, doesn't trigger the side effect TWICE. It
794 is important to note that, with autocall on, these side effects
806 is important to note that, with autocall on, these side effects
795 can still happen.
807 can still happen.
796 (ipsystem): new builtin, to complete the ip{magic/alias/system}
808 (ipsystem): new builtin, to complete the ip{magic/alias/system}
797 trio. IPython offers these three kinds of special calls which are
809 trio. IPython offers these three kinds of special calls which are
798 not python code, and it's a good thing to have their call method
810 not python code, and it's a good thing to have their call method
799 be accessible as pure python functions (not just special syntax at
811 be accessible as pure python functions (not just special syntax at
800 the command line). It gives us a better internal implementation
812 the command line). It gives us a better internal implementation
801 structure, as well as exposing these for user scripting more
813 structure, as well as exposing these for user scripting more
802 cleanly.
814 cleanly.
803
815
804 * IPython/macro.py (Macro.__init__): moved macros to a standalone
816 * IPython/macro.py (Macro.__init__): moved macros to a standalone
805 file. Now that they'll be more likely to be used with the
817 file. Now that they'll be more likely to be used with the
806 persistance system (%store), I want to make sure their module path
818 persistance system (%store), I want to make sure their module path
807 doesn't change in the future, so that we don't break things for
819 doesn't change in the future, so that we don't break things for
808 users' persisted data.
820 users' persisted data.
809
821
810 * IPython/iplib.py (autoindent_update): move indentation
822 * IPython/iplib.py (autoindent_update): move indentation
811 management into the _text_ processing loop, not the keyboard
823 management into the _text_ processing loop, not the keyboard
812 interactive one. This is necessary to correctly process non-typed
824 interactive one. This is necessary to correctly process non-typed
813 multiline input (such as macros).
825 multiline input (such as macros).
814
826
815 * IPython/Magic.py (Magic.format_latex): patch by Stefan van der
827 * IPython/Magic.py (Magic.format_latex): patch by Stefan van der
816 Walt <stefan-AT-sun.ac.za> to fix latex formatting of docstrings,
828 Walt <stefan-AT-sun.ac.za> to fix latex formatting of docstrings,
817 which was producing problems in the resulting manual.
829 which was producing problems in the resulting manual.
818 (magic_whos): improve reporting of instances (show their class,
830 (magic_whos): improve reporting of instances (show their class,
819 instead of simply printing 'instance' which isn't terribly
831 instead of simply printing 'instance' which isn't terribly
820 informative).
832 informative).
821
833
822 * IPython/genutils.py (shell): commit Jorgen Stenarson's patch
834 * IPython/genutils.py (shell): commit Jorgen Stenarson's patch
823 (minor mods) to support network shares under win32.
835 (minor mods) to support network shares under win32.
824
836
825 * IPython/winconsole.py (get_console_size): add new winconsole
837 * IPython/winconsole.py (get_console_size): add new winconsole
826 module and fixes to page_dumb() to improve its behavior under
838 module and fixes to page_dumb() to improve its behavior under
827 win32. Contributed by Alexander Belchenko <bialix-AT-ukr.net>.
839 win32. Contributed by Alexander Belchenko <bialix-AT-ukr.net>.
828
840
829 * IPython/Magic.py (Macro): simplified Macro class to just
841 * IPython/Magic.py (Macro): simplified Macro class to just
830 subclass list. We've had only 2.2 compatibility for a very long
842 subclass list. We've had only 2.2 compatibility for a very long
831 time, yet I was still avoiding subclassing the builtin types. No
843 time, yet I was still avoiding subclassing the builtin types. No
832 more (I'm also starting to use properties, though I won't shift to
844 more (I'm also starting to use properties, though I won't shift to
833 2.3-specific features quite yet).
845 2.3-specific features quite yet).
834 (magic_store): added Ville's patch for lightweight variable
846 (magic_store): added Ville's patch for lightweight variable
835 persistence, after a request on the user list by Matt Wilkie
847 persistence, after a request on the user list by Matt Wilkie
836 <maphew-AT-gmail.com>. The new %store magic's docstring has full
848 <maphew-AT-gmail.com>. The new %store magic's docstring has full
837 details.
849 details.
838
850
839 * IPython/iplib.py (InteractiveShell.post_config_initialization):
851 * IPython/iplib.py (InteractiveShell.post_config_initialization):
840 changed the default logfile name from 'ipython.log' to
852 changed the default logfile name from 'ipython.log' to
841 'ipython_log.py'. These logs are real python files, and now that
853 'ipython_log.py'. These logs are real python files, and now that
842 we have much better multiline support, people are more likely to
854 we have much better multiline support, people are more likely to
843 want to use them as such. Might as well name them correctly.
855 want to use them as such. Might as well name them correctly.
844
856
845 * IPython/Magic.py: substantial cleanup. While we can't stop
857 * IPython/Magic.py: substantial cleanup. While we can't stop
846 using magics as mixins, due to the existing customizations 'out
858 using magics as mixins, due to the existing customizations 'out
847 there' which rely on the mixin naming conventions, at least I
859 there' which rely on the mixin naming conventions, at least I
848 cleaned out all cross-class name usage. So once we are OK with
860 cleaned out all cross-class name usage. So once we are OK with
849 breaking compatibility, the two systems can be separated.
861 breaking compatibility, the two systems can be separated.
850
862
851 * IPython/Logger.py: major cleanup. This one is NOT a mixin
863 * IPython/Logger.py: major cleanup. This one is NOT a mixin
852 anymore, and the class is a fair bit less hideous as well. New
864 anymore, and the class is a fair bit less hideous as well. New
853 features were also introduced: timestamping of input, and logging
865 features were also introduced: timestamping of input, and logging
854 of output results. These are user-visible with the -t and -o
866 of output results. These are user-visible with the -t and -o
855 options to %logstart. Closes
867 options to %logstart. Closes
856 http://www.scipy.net/roundup/ipython/issue11 and a request by
868 http://www.scipy.net/roundup/ipython/issue11 and a request by
857 William Stein (SAGE developer - http://modular.ucsd.edu/sage).
869 William Stein (SAGE developer - http://modular.ucsd.edu/sage).
858
870
859 2005-12-28 Fernando Perez <Fernando.Perez@colorado.edu>
871 2005-12-28 Fernando Perez <Fernando.Perez@colorado.edu>
860
872
861 * IPython/iplib.py (handle_shell_escape): add Ville's patch to
873 * IPython/iplib.py (handle_shell_escape): add Ville's patch to
862 better hadnle backslashes in paths. See the thread 'More Windows
874 better hadnle backslashes in paths. See the thread 'More Windows
863 questions part 2 - \/ characters revisited' on the iypthon user
875 questions part 2 - \/ characters revisited' on the iypthon user
864 list:
876 list:
865 http://scipy.net/pipermail/ipython-user/2005-June/000907.html
877 http://scipy.net/pipermail/ipython-user/2005-June/000907.html
866
878
867 (InteractiveShell.__init__): fix tab-completion bug in threaded shells.
879 (InteractiveShell.__init__): fix tab-completion bug in threaded shells.
868
880
869 (InteractiveShell.__init__): change threaded shells to not use the
881 (InteractiveShell.__init__): change threaded shells to not use the
870 ipython crash handler. This was causing more problems than not,
882 ipython crash handler. This was causing more problems than not,
871 as exceptions in the main thread (GUI code, typically) would
883 as exceptions in the main thread (GUI code, typically) would
872 always show up as a 'crash', when they really weren't.
884 always show up as a 'crash', when they really weren't.
873
885
874 The colors and exception mode commands (%colors/%xmode) have been
886 The colors and exception mode commands (%colors/%xmode) have been
875 synchronized to also take this into account, so users can get
887 synchronized to also take this into account, so users can get
876 verbose exceptions for their threaded code as well. I also added
888 verbose exceptions for their threaded code as well. I also added
877 support for activating pdb inside this exception handler as well,
889 support for activating pdb inside this exception handler as well,
878 so now GUI authors can use IPython's enhanced pdb at runtime.
890 so now GUI authors can use IPython's enhanced pdb at runtime.
879
891
880 * IPython/ipmaker.py (make_IPython): make the autoedit_syntax flag
892 * IPython/ipmaker.py (make_IPython): make the autoedit_syntax flag
881 true by default, and add it to the shipped ipythonrc file. Since
893 true by default, and add it to the shipped ipythonrc file. Since
882 this asks the user before proceeding, I think it's OK to make it
894 this asks the user before proceeding, I think it's OK to make it
883 true by default.
895 true by default.
884
896
885 * IPython/Magic.py (magic_exit): make new exit/quit magics instead
897 * IPython/Magic.py (magic_exit): make new exit/quit magics instead
886 of the previous special-casing of input in the eval loop. I think
898 of the previous special-casing of input in the eval loop. I think
887 this is cleaner, as they really are commands and shouldn't have
899 this is cleaner, as they really are commands and shouldn't have
888 a special role in the middle of the core code.
900 a special role in the middle of the core code.
889
901
890 2005-12-27 Fernando Perez <Fernando.Perez@colorado.edu>
902 2005-12-27 Fernando Perez <Fernando.Perez@colorado.edu>
891
903
892 * IPython/iplib.py (edit_syntax_error): added support for
904 * IPython/iplib.py (edit_syntax_error): added support for
893 automatically reopening the editor if the file had a syntax error
905 automatically reopening the editor if the file had a syntax error
894 in it. Thanks to scottt who provided the patch at:
906 in it. Thanks to scottt who provided the patch at:
895 http://www.scipy.net/roundup/ipython/issue36 (slightly modified
907 http://www.scipy.net/roundup/ipython/issue36 (slightly modified
896 version committed).
908 version committed).
897
909
898 * IPython/iplib.py (handle_normal): add suport for multi-line
910 * IPython/iplib.py (handle_normal): add suport for multi-line
899 input with emtpy lines. This fixes
911 input with emtpy lines. This fixes
900 http://www.scipy.net/roundup/ipython/issue43 and a similar
912 http://www.scipy.net/roundup/ipython/issue43 and a similar
901 discussion on the user list.
913 discussion on the user list.
902
914
903 WARNING: a behavior change is necessarily introduced to support
915 WARNING: a behavior change is necessarily introduced to support
904 blank lines: now a single blank line with whitespace does NOT
916 blank lines: now a single blank line with whitespace does NOT
905 break the input loop, which means that when autoindent is on, by
917 break the input loop, which means that when autoindent is on, by
906 default hitting return on the next (indented) line does NOT exit.
918 default hitting return on the next (indented) line does NOT exit.
907
919
908 Instead, to exit a multiline input you can either have:
920 Instead, to exit a multiline input you can either have:
909
921
910 - TWO whitespace lines (just hit return again), or
922 - TWO whitespace lines (just hit return again), or
911 - a single whitespace line of a different length than provided
923 - a single whitespace line of a different length than provided
912 by the autoindent (add or remove a space).
924 by the autoindent (add or remove a space).
913
925
914 * IPython/completer.py (MagicCompleter.__init__): new 'completer'
926 * IPython/completer.py (MagicCompleter.__init__): new 'completer'
915 module to better organize all readline-related functionality.
927 module to better organize all readline-related functionality.
916 I've deleted FlexCompleter and put all completion clases here.
928 I've deleted FlexCompleter and put all completion clases here.
917
929
918 * IPython/iplib.py (raw_input): improve indentation management.
930 * IPython/iplib.py (raw_input): improve indentation management.
919 It is now possible to paste indented code with autoindent on, and
931 It is now possible to paste indented code with autoindent on, and
920 the code is interpreted correctly (though it still looks bad on
932 the code is interpreted correctly (though it still looks bad on
921 screen, due to the line-oriented nature of ipython).
933 screen, due to the line-oriented nature of ipython).
922 (MagicCompleter.complete): change behavior so that a TAB key on an
934 (MagicCompleter.complete): change behavior so that a TAB key on an
923 otherwise empty line actually inserts a tab, instead of completing
935 otherwise empty line actually inserts a tab, instead of completing
924 on the entire global namespace. This makes it easier to use the
936 on the entire global namespace. This makes it easier to use the
925 TAB key for indentation. After a request by Hans Meine
937 TAB key for indentation. After a request by Hans Meine
926 <hans_meine-AT-gmx.net>
938 <hans_meine-AT-gmx.net>
927 (_prefilter): add support so that typing plain 'exit' or 'quit'
939 (_prefilter): add support so that typing plain 'exit' or 'quit'
928 does a sensible thing. Originally I tried to deviate as little as
940 does a sensible thing. Originally I tried to deviate as little as
929 possible from the default python behavior, but even that one may
941 possible from the default python behavior, but even that one may
930 change in this direction (thread on python-dev to that effect).
942 change in this direction (thread on python-dev to that effect).
931 Regardless, ipython should do the right thing even if CPython's
943 Regardless, ipython should do the right thing even if CPython's
932 '>>>' prompt doesn't.
944 '>>>' prompt doesn't.
933 (InteractiveShell): removed subclassing code.InteractiveConsole
945 (InteractiveShell): removed subclassing code.InteractiveConsole
934 class. By now we'd overridden just about all of its methods: I've
946 class. By now we'd overridden just about all of its methods: I've
935 copied the remaining two over, and now ipython is a standalone
947 copied the remaining two over, and now ipython is a standalone
936 class. This will provide a clearer picture for the chainsaw
948 class. This will provide a clearer picture for the chainsaw
937 branch refactoring.
949 branch refactoring.
938
950
939 2005-12-26 Fernando Perez <Fernando.Perez@colorado.edu>
951 2005-12-26 Fernando Perez <Fernando.Perez@colorado.edu>
940
952
941 * IPython/ultraTB.py (VerboseTB.text): harden reporting against
953 * IPython/ultraTB.py (VerboseTB.text): harden reporting against
942 failures for objects which break when dir() is called on them.
954 failures for objects which break when dir() is called on them.
943
955
944 * IPython/FlexCompleter.py (Completer.__init__): Added support for
956 * IPython/FlexCompleter.py (Completer.__init__): Added support for
945 distinct local and global namespaces in the completer API. This
957 distinct local and global namespaces in the completer API. This
946 change allows us top properly handle completion with distinct
958 change allows us top properly handle completion with distinct
947 scopes, including in embedded instances (this had never really
959 scopes, including in embedded instances (this had never really
948 worked correctly).
960 worked correctly).
949
961
950 Note: this introduces a change in the constructor for
962 Note: this introduces a change in the constructor for
951 MagicCompleter, as a new global_namespace parameter is now the
963 MagicCompleter, as a new global_namespace parameter is now the
952 second argument (the others were bumped one position).
964 second argument (the others were bumped one position).
953
965
954 2005-12-25 Fernando Perez <Fernando.Perez@colorado.edu>
966 2005-12-25 Fernando Perez <Fernando.Perez@colorado.edu>
955
967
956 * IPython/iplib.py (embed_mainloop): fix tab-completion in
968 * IPython/iplib.py (embed_mainloop): fix tab-completion in
957 embedded instances (which can be done now thanks to Vivian's
969 embedded instances (which can be done now thanks to Vivian's
958 frame-handling fixes for pdb).
970 frame-handling fixes for pdb).
959 (InteractiveShell.__init__): Fix namespace handling problem in
971 (InteractiveShell.__init__): Fix namespace handling problem in
960 embedded instances. We were overwriting __main__ unconditionally,
972 embedded instances. We were overwriting __main__ unconditionally,
961 and this should only be done for 'full' (non-embedded) IPython;
973 and this should only be done for 'full' (non-embedded) IPython;
962 embedded instances must respect the caller's __main__. Thanks to
974 embedded instances must respect the caller's __main__. Thanks to
963 a bug report by Yaroslav Bulatov <yaroslavvb-AT-gmail.com>
975 a bug report by Yaroslav Bulatov <yaroslavvb-AT-gmail.com>
964
976
965 2005-12-24 Fernando Perez <Fernando.Perez@colorado.edu>
977 2005-12-24 Fernando Perez <Fernando.Perez@colorado.edu>
966
978
967 * setup.py: added download_url to setup(). This registers the
979 * setup.py: added download_url to setup(). This registers the
968 download address at PyPI, which is not only useful to humans
980 download address at PyPI, which is not only useful to humans
969 browsing the site, but is also picked up by setuptools (the Eggs
981 browsing the site, but is also picked up by setuptools (the Eggs
970 machinery). Thanks to Ville and R. Kern for the info/discussion
982 machinery). Thanks to Ville and R. Kern for the info/discussion
971 on this.
983 on this.
972
984
973 2005-12-23 Fernando Perez <Fernando.Perez@colorado.edu>
985 2005-12-23 Fernando Perez <Fernando.Perez@colorado.edu>
974
986
975 * IPython/Debugger.py (Pdb.__init__): Major pdb mode enhancements.
987 * IPython/Debugger.py (Pdb.__init__): Major pdb mode enhancements.
976 This brings a lot of nice functionality to the pdb mode, which now
988 This brings a lot of nice functionality to the pdb mode, which now
977 has tab-completion, syntax highlighting, and better stack handling
989 has tab-completion, syntax highlighting, and better stack handling
978 than before. Many thanks to Vivian De Smedt
990 than before. Many thanks to Vivian De Smedt
979 <vivian-AT-vdesmedt.com> for the original patches.
991 <vivian-AT-vdesmedt.com> for the original patches.
980
992
981 2005-12-08 Fernando Perez <Fernando.Perez@colorado.edu>
993 2005-12-08 Fernando Perez <Fernando.Perez@colorado.edu>
982
994
983 * IPython/Shell.py (IPShellGTK.mainloop): fix mainloop() calling
995 * IPython/Shell.py (IPShellGTK.mainloop): fix mainloop() calling
984 sequence to consistently accept the banner argument. The
996 sequence to consistently accept the banner argument. The
985 inconsistency was tripping SAGE, thanks to Gary Zablackis
997 inconsistency was tripping SAGE, thanks to Gary Zablackis
986 <gzabl-AT-yahoo.com> for the report.
998 <gzabl-AT-yahoo.com> for the report.
987
999
988 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
1000 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
989
1001
990 * IPython/iplib.py (InteractiveShell.post_config_initialization):
1002 * IPython/iplib.py (InteractiveShell.post_config_initialization):
991 Fix bug where a naked 'alias' call in the ipythonrc file would
1003 Fix bug where a naked 'alias' call in the ipythonrc file would
992 cause a crash. Bug reported by Jorgen Stenarson.
1004 cause a crash. Bug reported by Jorgen Stenarson.
993
1005
994 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
1006 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
995
1007
996 * IPython/ipmaker.py (make_IPython): cleanups which should improve
1008 * IPython/ipmaker.py (make_IPython): cleanups which should improve
997 startup time.
1009 startup time.
998
1010
999 * IPython/iplib.py (runcode): my globals 'fix' for embedded
1011 * IPython/iplib.py (runcode): my globals 'fix' for embedded
1000 instances had introduced a bug with globals in normal code. Now
1012 instances had introduced a bug with globals in normal code. Now
1001 it's working in all cases.
1013 it's working in all cases.
1002
1014
1003 * IPython/Magic.py (magic_psearch): Finish wildcard cleanup and
1015 * IPython/Magic.py (magic_psearch): Finish wildcard cleanup and
1004 API changes. A new ipytonrc option, 'wildcards_case_sensitive'
1016 API changes. A new ipytonrc option, 'wildcards_case_sensitive'
1005 has been introduced to set the default case sensitivity of the
1017 has been introduced to set the default case sensitivity of the
1006 searches. Users can still select either mode at runtime on a
1018 searches. Users can still select either mode at runtime on a
1007 per-search basis.
1019 per-search basis.
1008
1020
1009 2005-11-13 Fernando Perez <Fernando.Perez@colorado.edu>
1021 2005-11-13 Fernando Perez <Fernando.Perez@colorado.edu>
1010
1022
1011 * IPython/wildcard.py (NameSpace.__init__): fix resolution of
1023 * IPython/wildcard.py (NameSpace.__init__): fix resolution of
1012 attributes in wildcard searches for subclasses. Modified version
1024 attributes in wildcard searches for subclasses. Modified version
1013 of a patch by Jorgen.
1025 of a patch by Jorgen.
1014
1026
1015 2005-11-12 Fernando Perez <Fernando.Perez@colorado.edu>
1027 2005-11-12 Fernando Perez <Fernando.Perez@colorado.edu>
1016
1028
1017 * IPython/iplib.py (embed_mainloop): Fix handling of globals for
1029 * IPython/iplib.py (embed_mainloop): Fix handling of globals for
1018 embedded instances. I added a user_global_ns attribute to the
1030 embedded instances. I added a user_global_ns attribute to the
1019 InteractiveShell class to handle this.
1031 InteractiveShell class to handle this.
1020
1032
1021 2005-10-31 Fernando Perez <Fernando.Perez@colorado.edu>
1033 2005-10-31 Fernando Perez <Fernando.Perez@colorado.edu>
1022
1034
1023 * IPython/Shell.py (IPShellGTK.mainloop): Change timeout_add to
1035 * IPython/Shell.py (IPShellGTK.mainloop): Change timeout_add to
1024 idle_add, which fixes horrible keyboard lag problems under gtk 2.6
1036 idle_add, which fixes horrible keyboard lag problems under gtk 2.6
1025 (reported under win32, but may happen also in other platforms).
1037 (reported under win32, but may happen also in other platforms).
1026 Bug report and fix courtesy of Sean Moore <smm-AT-logic.bm>
1038 Bug report and fix courtesy of Sean Moore <smm-AT-logic.bm>
1027
1039
1028 2005-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
1040 2005-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
1029
1041
1030 * IPython/Magic.py (magic_psearch): new support for wildcard
1042 * IPython/Magic.py (magic_psearch): new support for wildcard
1031 patterns. Now, typing ?a*b will list all names which begin with a
1043 patterns. Now, typing ?a*b will list all names which begin with a
1032 and end in b, for example. The %psearch magic has full
1044 and end in b, for example. The %psearch magic has full
1033 docstrings. Many thanks to JΓΆrgen Stenarson
1045 docstrings. Many thanks to JΓΆrgen Stenarson
1034 <jorgen.stenarson-AT-bostream.nu>, author of the patches
1046 <jorgen.stenarson-AT-bostream.nu>, author of the patches
1035 implementing this functionality.
1047 implementing this functionality.
1036
1048
1037 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
1049 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
1038
1050
1039 * Manual: fixed long-standing annoyance of double-dashes (as in
1051 * Manual: fixed long-standing annoyance of double-dashes (as in
1040 --prefix=~, for example) being stripped in the HTML version. This
1052 --prefix=~, for example) being stripped in the HTML version. This
1041 is a latex2html bug, but a workaround was provided. Many thanks
1053 is a latex2html bug, but a workaround was provided. Many thanks
1042 to George K. Thiruvathukal <gthiruv-AT-luc.edu> for the detailed
1054 to George K. Thiruvathukal <gthiruv-AT-luc.edu> for the detailed
1043 help, and Michael Tobis <mtobis-AT-gmail.com> for getting the ball
1055 help, and Michael Tobis <mtobis-AT-gmail.com> for getting the ball
1044 rolling. This seemingly small issue had tripped a number of users
1056 rolling. This seemingly small issue had tripped a number of users
1045 when first installing, so I'm glad to see it gone.
1057 when first installing, so I'm glad to see it gone.
1046
1058
1047 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
1059 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
1048
1060
1049 * IPython/Extensions/numeric_formats.py: fix missing import,
1061 * IPython/Extensions/numeric_formats.py: fix missing import,
1050 reported by Stephen Walton.
1062 reported by Stephen Walton.
1051
1063
1052 2005-09-24 Fernando Perez <Fernando.Perez@colorado.edu>
1064 2005-09-24 Fernando Perez <Fernando.Perez@colorado.edu>
1053
1065
1054 * IPython/demo.py: finish demo module, fully documented now.
1066 * IPython/demo.py: finish demo module, fully documented now.
1055
1067
1056 * IPython/genutils.py (file_read): simple little utility to read a
1068 * IPython/genutils.py (file_read): simple little utility to read a
1057 file and ensure it's closed afterwards.
1069 file and ensure it's closed afterwards.
1058
1070
1059 2005-09-23 Fernando Perez <Fernando.Perez@colorado.edu>
1071 2005-09-23 Fernando Perez <Fernando.Perez@colorado.edu>
1060
1072
1061 * IPython/demo.py (Demo.__init__): added support for individually
1073 * IPython/demo.py (Demo.__init__): added support for individually
1062 tagging blocks for automatic execution.
1074 tagging blocks for automatic execution.
1063
1075
1064 * IPython/Magic.py (magic_pycat): new %pycat magic for showing
1076 * IPython/Magic.py (magic_pycat): new %pycat magic for showing
1065 syntax-highlighted python sources, requested by John.
1077 syntax-highlighted python sources, requested by John.
1066
1078
1067 2005-09-22 Fernando Perez <Fernando.Perez@colorado.edu>
1079 2005-09-22 Fernando Perez <Fernando.Perez@colorado.edu>
1068
1080
1069 * IPython/demo.py (Demo.again): fix bug where again() blocks after
1081 * IPython/demo.py (Demo.again): fix bug where again() blocks after
1070 finishing.
1082 finishing.
1071
1083
1072 * IPython/genutils.py (shlex_split): moved from Magic to here,
1084 * IPython/genutils.py (shlex_split): moved from Magic to here,
1073 where all 2.2 compatibility stuff lives. I needed it for demo.py.
1085 where all 2.2 compatibility stuff lives. I needed it for demo.py.
1074
1086
1075 * IPython/demo.py (Demo.__init__): added support for silent
1087 * IPython/demo.py (Demo.__init__): added support for silent
1076 blocks, improved marks as regexps, docstrings written.
1088 blocks, improved marks as regexps, docstrings written.
1077 (Demo.__init__): better docstring, added support for sys.argv.
1089 (Demo.__init__): better docstring, added support for sys.argv.
1078
1090
1079 * IPython/genutils.py (marquee): little utility used by the demo
1091 * IPython/genutils.py (marquee): little utility used by the demo
1080 code, handy in general.
1092 code, handy in general.
1081
1093
1082 * IPython/demo.py (Demo.__init__): new class for interactive
1094 * IPython/demo.py (Demo.__init__): new class for interactive
1083 demos. Not documented yet, I just wrote it in a hurry for
1095 demos. Not documented yet, I just wrote it in a hurry for
1084 scipy'05. Will docstring later.
1096 scipy'05. Will docstring later.
1085
1097
1086 2005-09-20 Fernando Perez <Fernando.Perez@colorado.edu>
1098 2005-09-20 Fernando Perez <Fernando.Perez@colorado.edu>
1087
1099
1088 * IPython/Shell.py (sigint_handler): Drastic simplification which
1100 * IPython/Shell.py (sigint_handler): Drastic simplification which
1089 also seems to make Ctrl-C work correctly across threads! This is
1101 also seems to make Ctrl-C work correctly across threads! This is
1090 so simple, that I can't beleive I'd missed it before. Needs more
1102 so simple, that I can't beleive I'd missed it before. Needs more
1091 testing, though.
1103 testing, though.
1092 (KBINT): Never mind, revert changes. I'm sure I'd tried something
1104 (KBINT): Never mind, revert changes. I'm sure I'd tried something
1093 like this before...
1105 like this before...
1094
1106
1095 * IPython/genutils.py (get_home_dir): add protection against
1107 * IPython/genutils.py (get_home_dir): add protection against
1096 non-dirs in win32 registry.
1108 non-dirs in win32 registry.
1097
1109
1098 * IPython/iplib.py (InteractiveShell.alias_table_validate): fix
1110 * IPython/iplib.py (InteractiveShell.alias_table_validate): fix
1099 bug where dict was mutated while iterating (pysh crash).
1111 bug where dict was mutated while iterating (pysh crash).
1100
1112
1101 2005-09-06 Fernando Perez <Fernando.Perez@colorado.edu>
1113 2005-09-06 Fernando Perez <Fernando.Perez@colorado.edu>
1102
1114
1103 * IPython/iplib.py (handle_auto): Fix inconsistency arising from
1115 * IPython/iplib.py (handle_auto): Fix inconsistency arising from
1104 spurious newlines added by this routine. After a report by
1116 spurious newlines added by this routine. After a report by
1105 F. Mantegazza.
1117 F. Mantegazza.
1106
1118
1107 2005-09-05 Fernando Perez <Fernando.Perez@colorado.edu>
1119 2005-09-05 Fernando Perez <Fernando.Perez@colorado.edu>
1108
1120
1109 * IPython/Shell.py (hijack_gtk): remove pygtk.require("2.0")
1121 * IPython/Shell.py (hijack_gtk): remove pygtk.require("2.0")
1110 calls. These were a leftover from the GTK 1.x days, and can cause
1122 calls. These were a leftover from the GTK 1.x days, and can cause
1111 problems in certain cases (after a report by John Hunter).
1123 problems in certain cases (after a report by John Hunter).
1112
1124
1113 * IPython/iplib.py (InteractiveShell.__init__): Trap exception if
1125 * IPython/iplib.py (InteractiveShell.__init__): Trap exception if
1114 os.getcwd() fails at init time. Thanks to patch from David Remahl
1126 os.getcwd() fails at init time. Thanks to patch from David Remahl
1115 <chmod007-AT-mac.com>.
1127 <chmod007-AT-mac.com>.
1116 (InteractiveShell.__init__): prevent certain special magics from
1128 (InteractiveShell.__init__): prevent certain special magics from
1117 being shadowed by aliases. Closes
1129 being shadowed by aliases. Closes
1118 http://www.scipy.net/roundup/ipython/issue41.
1130 http://www.scipy.net/roundup/ipython/issue41.
1119
1131
1120 2005-08-31 Fernando Perez <Fernando.Perez@colorado.edu>
1132 2005-08-31 Fernando Perez <Fernando.Perez@colorado.edu>
1121
1133
1122 * IPython/iplib.py (InteractiveShell.complete): Added new
1134 * IPython/iplib.py (InteractiveShell.complete): Added new
1123 top-level completion method to expose the completion mechanism
1135 top-level completion method to expose the completion mechanism
1124 beyond readline-based environments.
1136 beyond readline-based environments.
1125
1137
1126 2005-08-19 Fernando Perez <Fernando.Perez@colorado.edu>
1138 2005-08-19 Fernando Perez <Fernando.Perez@colorado.edu>
1127
1139
1128 * tools/ipsvnc (svnversion): fix svnversion capture.
1140 * tools/ipsvnc (svnversion): fix svnversion capture.
1129
1141
1130 * IPython/iplib.py (InteractiveShell.__init__): Add has_readline
1142 * IPython/iplib.py (InteractiveShell.__init__): Add has_readline
1131 attribute to self, which was missing. Before, it was set by a
1143 attribute to self, which was missing. Before, it was set by a
1132 routine which in certain cases wasn't being called, so the
1144 routine which in certain cases wasn't being called, so the
1133 instance could end up missing the attribute. This caused a crash.
1145 instance could end up missing the attribute. This caused a crash.
1134 Closes http://www.scipy.net/roundup/ipython/issue40.
1146 Closes http://www.scipy.net/roundup/ipython/issue40.
1135
1147
1136 2005-08-16 Fernando Perez <fperez@colorado.edu>
1148 2005-08-16 Fernando Perez <fperez@colorado.edu>
1137
1149
1138 * IPython/ultraTB.py (VerboseTB.text): don't crash if object
1150 * IPython/ultraTB.py (VerboseTB.text): don't crash if object
1139 contains non-string attribute. Closes
1151 contains non-string attribute. Closes
1140 http://www.scipy.net/roundup/ipython/issue38.
1152 http://www.scipy.net/roundup/ipython/issue38.
1141
1153
1142 2005-08-14 Fernando Perez <fperez@colorado.edu>
1154 2005-08-14 Fernando Perez <fperez@colorado.edu>
1143
1155
1144 * tools/ipsvnc: Minor improvements, to add changeset info.
1156 * tools/ipsvnc: Minor improvements, to add changeset info.
1145
1157
1146 2005-08-12 Fernando Perez <fperez@colorado.edu>
1158 2005-08-12 Fernando Perez <fperez@colorado.edu>
1147
1159
1148 * IPython/iplib.py (runsource): remove self.code_to_run_src
1160 * IPython/iplib.py (runsource): remove self.code_to_run_src
1149 attribute. I realized this is nothing more than
1161 attribute. I realized this is nothing more than
1150 '\n'.join(self.buffer), and having the same data in two different
1162 '\n'.join(self.buffer), and having the same data in two different
1151 places is just asking for synchronization bugs. This may impact
1163 places is just asking for synchronization bugs. This may impact
1152 people who have custom exception handlers, so I need to warn
1164 people who have custom exception handlers, so I need to warn
1153 ipython-dev about it (F. Mantegazza may use them).
1165 ipython-dev about it (F. Mantegazza may use them).
1154
1166
1155 2005-07-29 Fernando Perez <Fernando.Perez@colorado.edu>
1167 2005-07-29 Fernando Perez <Fernando.Perez@colorado.edu>
1156
1168
1157 * IPython/genutils.py: fix 2.2 compatibility (generators)
1169 * IPython/genutils.py: fix 2.2 compatibility (generators)
1158
1170
1159 2005-07-18 Fernando Perez <fperez@colorado.edu>
1171 2005-07-18 Fernando Perez <fperez@colorado.edu>
1160
1172
1161 * IPython/genutils.py (get_home_dir): fix to help users with
1173 * IPython/genutils.py (get_home_dir): fix to help users with
1162 invalid $HOME under win32.
1174 invalid $HOME under win32.
1163
1175
1164 2005-07-17 Fernando Perez <fperez@colorado.edu>
1176 2005-07-17 Fernando Perez <fperez@colorado.edu>
1165
1177
1166 * IPython/Prompts.py (str_safe): Make unicode-safe. Also remove
1178 * IPython/Prompts.py (str_safe): Make unicode-safe. Also remove
1167 some old hacks and clean up a bit other routines; code should be
1179 some old hacks and clean up a bit other routines; code should be
1168 simpler and a bit faster.
1180 simpler and a bit faster.
1169
1181
1170 * IPython/iplib.py (interact): removed some last-resort attempts
1182 * IPython/iplib.py (interact): removed some last-resort attempts
1171 to survive broken stdout/stderr. That code was only making it
1183 to survive broken stdout/stderr. That code was only making it
1172 harder to abstract out the i/o (necessary for gui integration),
1184 harder to abstract out the i/o (necessary for gui integration),
1173 and the crashes it could prevent were extremely rare in practice
1185 and the crashes it could prevent were extremely rare in practice
1174 (besides being fully user-induced in a pretty violent manner).
1186 (besides being fully user-induced in a pretty violent manner).
1175
1187
1176 * IPython/genutils.py (IOStream.__init__): Simplify the i/o stuff.
1188 * IPython/genutils.py (IOStream.__init__): Simplify the i/o stuff.
1177 Nothing major yet, but the code is simpler to read; this should
1189 Nothing major yet, but the code is simpler to read; this should
1178 make it easier to do more serious modifications in the future.
1190 make it easier to do more serious modifications in the future.
1179
1191
1180 * IPython/Extensions/InterpreterExec.py: Fix auto-quoting in pysh,
1192 * IPython/Extensions/InterpreterExec.py: Fix auto-quoting in pysh,
1181 which broke in .15 (thanks to a report by Ville).
1193 which broke in .15 (thanks to a report by Ville).
1182
1194
1183 * IPython/Itpl.py (Itpl.__init__): add unicode support (it may not
1195 * IPython/Itpl.py (Itpl.__init__): add unicode support (it may not
1184 be quite correct, I know next to nothing about unicode). This
1196 be quite correct, I know next to nothing about unicode). This
1185 will allow unicode strings to be used in prompts, amongst other
1197 will allow unicode strings to be used in prompts, amongst other
1186 cases. It also will prevent ipython from crashing when unicode
1198 cases. It also will prevent ipython from crashing when unicode
1187 shows up unexpectedly in many places. If ascii encoding fails, we
1199 shows up unexpectedly in many places. If ascii encoding fails, we
1188 assume utf_8. Currently the encoding is not a user-visible
1200 assume utf_8. Currently the encoding is not a user-visible
1189 setting, though it could be made so if there is demand for it.
1201 setting, though it could be made so if there is demand for it.
1190
1202
1191 * IPython/ipmaker.py (make_IPython): remove old 2.1-specific hack.
1203 * IPython/ipmaker.py (make_IPython): remove old 2.1-specific hack.
1192
1204
1193 * IPython/Struct.py (Struct.merge): switch keys() to iterator.
1205 * IPython/Struct.py (Struct.merge): switch keys() to iterator.
1194
1206
1195 * IPython/background_jobs.py: moved 2.2 compatibility to genutils.
1207 * IPython/background_jobs.py: moved 2.2 compatibility to genutils.
1196
1208
1197 * IPython/genutils.py: Add 2.2 compatibility here, so all other
1209 * IPython/genutils.py: Add 2.2 compatibility here, so all other
1198 code can work transparently for 2.2/2.3.
1210 code can work transparently for 2.2/2.3.
1199
1211
1200 2005-07-16 Fernando Perez <fperez@colorado.edu>
1212 2005-07-16 Fernando Perez <fperez@colorado.edu>
1201
1213
1202 * IPython/ultraTB.py (ExceptionColors): Make a global variable
1214 * IPython/ultraTB.py (ExceptionColors): Make a global variable
1203 out of the color scheme table used for coloring exception
1215 out of the color scheme table used for coloring exception
1204 tracebacks. This allows user code to add new schemes at runtime.
1216 tracebacks. This allows user code to add new schemes at runtime.
1205 This is a minimally modified version of the patch at
1217 This is a minimally modified version of the patch at
1206 http://www.scipy.net/roundup/ipython/issue35, many thanks to pabw
1218 http://www.scipy.net/roundup/ipython/issue35, many thanks to pabw
1207 for the contribution.
1219 for the contribution.
1208
1220
1209 * IPython/FlexCompleter.py (Completer.attr_matches): Add a
1221 * IPython/FlexCompleter.py (Completer.attr_matches): Add a
1210 slightly modified version of the patch in
1222 slightly modified version of the patch in
1211 http://www.scipy.net/roundup/ipython/issue34, which also allows me
1223 http://www.scipy.net/roundup/ipython/issue34, which also allows me
1212 to remove the previous try/except solution (which was costlier).
1224 to remove the previous try/except solution (which was costlier).
1213 Thanks to Gaetan Lehmann <gaetan.lehmann-AT-jouy.inra.fr> for the fix.
1225 Thanks to Gaetan Lehmann <gaetan.lehmann-AT-jouy.inra.fr> for the fix.
1214
1226
1215 2005-06-08 Fernando Perez <fperez@colorado.edu>
1227 2005-06-08 Fernando Perez <fperez@colorado.edu>
1216
1228
1217 * IPython/iplib.py (write/write_err): Add methods to abstract all
1229 * IPython/iplib.py (write/write_err): Add methods to abstract all
1218 I/O a bit more.
1230 I/O a bit more.
1219
1231
1220 * IPython/Shell.py (IPShellGTK.mainloop): Fix GTK deprecation
1232 * IPython/Shell.py (IPShellGTK.mainloop): Fix GTK deprecation
1221 warning, reported by Aric Hagberg, fix by JD Hunter.
1233 warning, reported by Aric Hagberg, fix by JD Hunter.
1222
1234
1223 2005-06-02 *** Released version 0.6.15
1235 2005-06-02 *** Released version 0.6.15
1224
1236
1225 2005-06-01 Fernando Perez <fperez@colorado.edu>
1237 2005-06-01 Fernando Perez <fperez@colorado.edu>
1226
1238
1227 * IPython/iplib.py (MagicCompleter.file_matches): Fix
1239 * IPython/iplib.py (MagicCompleter.file_matches): Fix
1228 tab-completion of filenames within open-quoted strings. Note that
1240 tab-completion of filenames within open-quoted strings. Note that
1229 this requires that in ~/.ipython/ipythonrc, users change the
1241 this requires that in ~/.ipython/ipythonrc, users change the
1230 readline delimiters configuration to read:
1242 readline delimiters configuration to read:
1231
1243
1232 readline_remove_delims -/~
1244 readline_remove_delims -/~
1233
1245
1234
1246
1235 2005-05-31 *** Released version 0.6.14
1247 2005-05-31 *** Released version 0.6.14
1236
1248
1237 2005-05-29 Fernando Perez <fperez@colorado.edu>
1249 2005-05-29 Fernando Perez <fperez@colorado.edu>
1238
1250
1239 * IPython/ultraTB.py (VerboseTB.text): Fix crash for tracebacks
1251 * IPython/ultraTB.py (VerboseTB.text): Fix crash for tracebacks
1240 with files not on the filesystem. Reported by Eliyahu Sandler
1252 with files not on the filesystem. Reported by Eliyahu Sandler
1241 <eli@gondolin.net>
1253 <eli@gondolin.net>
1242
1254
1243 2005-05-22 Fernando Perez <fperez@colorado.edu>
1255 2005-05-22 Fernando Perez <fperez@colorado.edu>
1244
1256
1245 * IPython/iplib.py: Fix a few crashes in the --upgrade option.
1257 * IPython/iplib.py: Fix a few crashes in the --upgrade option.
1246 After an initial report by LUK ShunTim <shuntim.luk@polyu.edu.hk>.
1258 After an initial report by LUK ShunTim <shuntim.luk@polyu.edu.hk>.
1247
1259
1248 2005-05-19 Fernando Perez <fperez@colorado.edu>
1260 2005-05-19 Fernando Perez <fperez@colorado.edu>
1249
1261
1250 * IPython/iplib.py (safe_execfile): close a file which could be
1262 * IPython/iplib.py (safe_execfile): close a file which could be
1251 left open (causing problems in win32, which locks open files).
1263 left open (causing problems in win32, which locks open files).
1252 Thanks to a bug report by D Brown <dbrown2@yahoo.com>.
1264 Thanks to a bug report by D Brown <dbrown2@yahoo.com>.
1253
1265
1254 2005-05-18 Fernando Perez <fperez@colorado.edu>
1266 2005-05-18 Fernando Perez <fperez@colorado.edu>
1255
1267
1256 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): pass all
1268 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): pass all
1257 keyword arguments correctly to safe_execfile().
1269 keyword arguments correctly to safe_execfile().
1258
1270
1259 2005-05-13 Fernando Perez <fperez@colorado.edu>
1271 2005-05-13 Fernando Perez <fperez@colorado.edu>
1260
1272
1261 * ipython.1: Added info about Qt to manpage, and threads warning
1273 * ipython.1: Added info about Qt to manpage, and threads warning
1262 to usage page (invoked with --help).
1274 to usage page (invoked with --help).
1263
1275
1264 * IPython/iplib.py (MagicCompleter.python_func_kw_matches): Added
1276 * IPython/iplib.py (MagicCompleter.python_func_kw_matches): Added
1265 new matcher (it goes at the end of the priority list) to do
1277 new matcher (it goes at the end of the priority list) to do
1266 tab-completion on named function arguments. Submitted by George
1278 tab-completion on named function arguments. Submitted by George
1267 Sakkis <gsakkis-AT-eden.rutgers.edu>. See the thread at
1279 Sakkis <gsakkis-AT-eden.rutgers.edu>. See the thread at
1268 http://www.scipy.net/pipermail/ipython-dev/2005-April/000436.html
1280 http://www.scipy.net/pipermail/ipython-dev/2005-April/000436.html
1269 for more details.
1281 for more details.
1270
1282
1271 * IPython/Magic.py (magic_run): Added new -e flag to ignore
1283 * IPython/Magic.py (magic_run): Added new -e flag to ignore
1272 SystemExit exceptions in the script being run. Thanks to a report
1284 SystemExit exceptions in the script being run. Thanks to a report
1273 by danny shevitz <danny_shevitz-AT-yahoo.com>, about this
1285 by danny shevitz <danny_shevitz-AT-yahoo.com>, about this
1274 producing very annoying behavior when running unit tests.
1286 producing very annoying behavior when running unit tests.
1275
1287
1276 2005-05-12 Fernando Perez <fperez@colorado.edu>
1288 2005-05-12 Fernando Perez <fperez@colorado.edu>
1277
1289
1278 * IPython/iplib.py (handle_auto): fixed auto-quoting and parens,
1290 * IPython/iplib.py (handle_auto): fixed auto-quoting and parens,
1279 which I'd broken (again) due to a changed regexp. In the process,
1291 which I'd broken (again) due to a changed regexp. In the process,
1280 added ';' as an escape to auto-quote the whole line without
1292 added ';' as an escape to auto-quote the whole line without
1281 splitting its arguments. Thanks to a report by Jerry McRae
1293 splitting its arguments. Thanks to a report by Jerry McRae
1282 <qrs0xyc02-AT-sneakemail.com>.
1294 <qrs0xyc02-AT-sneakemail.com>.
1283
1295
1284 * IPython/ultraTB.py (VerboseTB.text): protect against rare but
1296 * IPython/ultraTB.py (VerboseTB.text): protect against rare but
1285 possible crashes caused by a TokenError. Reported by Ed Schofield
1297 possible crashes caused by a TokenError. Reported by Ed Schofield
1286 <schofield-AT-ftw.at>.
1298 <schofield-AT-ftw.at>.
1287
1299
1288 2005-05-06 Fernando Perez <fperez@colorado.edu>
1300 2005-05-06 Fernando Perez <fperez@colorado.edu>
1289
1301
1290 * IPython/Shell.py (hijack_wx): Fix to work with WX v.2.6.
1302 * IPython/Shell.py (hijack_wx): Fix to work with WX v.2.6.
1291
1303
1292 2005-04-29 Fernando Perez <fperez@colorado.edu>
1304 2005-04-29 Fernando Perez <fperez@colorado.edu>
1293
1305
1294 * IPython/Shell.py (IPShellQt): Thanks to Denis Rivière
1306 * IPython/Shell.py (IPShellQt): Thanks to Denis Rivière
1295 <nudz-AT-free.fr>, Yann Cointepas <yann-AT-sapetnioc.org> and Benjamin
1307 <nudz-AT-free.fr>, Yann Cointepas <yann-AT-sapetnioc.org> and Benjamin
1296 Thyreau <Benji2-AT-decideur.info>, we now have a -qthread option
1308 Thyreau <Benji2-AT-decideur.info>, we now have a -qthread option
1297 which provides support for Qt interactive usage (similar to the
1309 which provides support for Qt interactive usage (similar to the
1298 existing one for WX and GTK). This had been often requested.
1310 existing one for WX and GTK). This had been often requested.
1299
1311
1300 2005-04-14 *** Released version 0.6.13
1312 2005-04-14 *** Released version 0.6.13
1301
1313
1302 2005-04-08 Fernando Perez <fperez@colorado.edu>
1314 2005-04-08 Fernando Perez <fperez@colorado.edu>
1303
1315
1304 * IPython/Magic.py (Magic._ofind): remove docstring evaluation
1316 * IPython/Magic.py (Magic._ofind): remove docstring evaluation
1305 from _ofind, which gets called on almost every input line. Now,
1317 from _ofind, which gets called on almost every input line. Now,
1306 we only try to get docstrings if they are actually going to be
1318 we only try to get docstrings if they are actually going to be
1307 used (the overhead of fetching unnecessary docstrings can be
1319 used (the overhead of fetching unnecessary docstrings can be
1308 noticeable for certain objects, such as Pyro proxies).
1320 noticeable for certain objects, such as Pyro proxies).
1309
1321
1310 * IPython/iplib.py (MagicCompleter.python_matches): Change the API
1322 * IPython/iplib.py (MagicCompleter.python_matches): Change the API
1311 for completers. For some reason I had been passing them the state
1323 for completers. For some reason I had been passing them the state
1312 variable, which completers never actually need, and was in
1324 variable, which completers never actually need, and was in
1313 conflict with the rlcompleter API. Custom completers ONLY need to
1325 conflict with the rlcompleter API. Custom completers ONLY need to
1314 take the text parameter.
1326 take the text parameter.
1315
1327
1316 * IPython/Extensions/InterpreterExec.py: Fix regexp so that magics
1328 * IPython/Extensions/InterpreterExec.py: Fix regexp so that magics
1317 work correctly in pysh. I've also moved all the logic which used
1329 work correctly in pysh. I've also moved all the logic which used
1318 to be in pysh.py here, which will prevent problems with future
1330 to be in pysh.py here, which will prevent problems with future
1319 upgrades. However, this time I must warn users to update their
1331 upgrades. However, this time I must warn users to update their
1320 pysh profile to include the line
1332 pysh profile to include the line
1321
1333
1322 import_all IPython.Extensions.InterpreterExec
1334 import_all IPython.Extensions.InterpreterExec
1323
1335
1324 because otherwise things won't work for them. They MUST also
1336 because otherwise things won't work for them. They MUST also
1325 delete pysh.py and the line
1337 delete pysh.py and the line
1326
1338
1327 execfile pysh.py
1339 execfile pysh.py
1328
1340
1329 from their ipythonrc-pysh.
1341 from their ipythonrc-pysh.
1330
1342
1331 * IPython/FlexCompleter.py (Completer.attr_matches): Make more
1343 * IPython/FlexCompleter.py (Completer.attr_matches): Make more
1332 robust in the face of objects whose dir() returns non-strings
1344 robust in the face of objects whose dir() returns non-strings
1333 (which it shouldn't, but some broken libs like ITK do). Thanks to
1345 (which it shouldn't, but some broken libs like ITK do). Thanks to
1334 a patch by John Hunter (implemented differently, though). Also
1346 a patch by John Hunter (implemented differently, though). Also
1335 minor improvements by using .extend instead of + on lists.
1347 minor improvements by using .extend instead of + on lists.
1336
1348
1337 * pysh.py:
1349 * pysh.py:
1338
1350
1339 2005-04-06 Fernando Perez <fperez@colorado.edu>
1351 2005-04-06 Fernando Perez <fperez@colorado.edu>
1340
1352
1341 * IPython/ipmaker.py (make_IPython): Make multi_line_specials on
1353 * IPython/ipmaker.py (make_IPython): Make multi_line_specials on
1342 by default, so that all users benefit from it. Those who don't
1354 by default, so that all users benefit from it. Those who don't
1343 want it can still turn it off.
1355 want it can still turn it off.
1344
1356
1345 * IPython/UserConfig/ipythonrc: Add multi_line_specials to the
1357 * IPython/UserConfig/ipythonrc: Add multi_line_specials to the
1346 config file, I'd forgotten about this, so users were getting it
1358 config file, I'd forgotten about this, so users were getting it
1347 off by default.
1359 off by default.
1348
1360
1349 * IPython/iplib.py (ipmagic): big overhaul of the magic system for
1361 * IPython/iplib.py (ipmagic): big overhaul of the magic system for
1350 consistency. Now magics can be called in multiline statements,
1362 consistency. Now magics can be called in multiline statements,
1351 and python variables can be expanded in magic calls via $var.
1363 and python variables can be expanded in magic calls via $var.
1352 This makes the magic system behave just like aliases or !system
1364 This makes the magic system behave just like aliases or !system
1353 calls.
1365 calls.
1354
1366
1355 2005-03-28 Fernando Perez <fperez@colorado.edu>
1367 2005-03-28 Fernando Perez <fperez@colorado.edu>
1356
1368
1357 * IPython/iplib.py (handle_auto): cleanup to use %s instead of
1369 * IPython/iplib.py (handle_auto): cleanup to use %s instead of
1358 expensive string additions for building command. Add support for
1370 expensive string additions for building command. Add support for
1359 trailing ';' when autocall is used.
1371 trailing ';' when autocall is used.
1360
1372
1361 2005-03-26 Fernando Perez <fperez@colorado.edu>
1373 2005-03-26 Fernando Perez <fperez@colorado.edu>
1362
1374
1363 * ipython.el: Fix http://www.scipy.net/roundup/ipython/issue31.
1375 * ipython.el: Fix http://www.scipy.net/roundup/ipython/issue31.
1364 Bugfix by A. Schmolck, the ipython.el maintainer. Also make
1376 Bugfix by A. Schmolck, the ipython.el maintainer. Also make
1365 ipython.el robust against prompts with any number of spaces
1377 ipython.el robust against prompts with any number of spaces
1366 (including 0) after the ':' character.
1378 (including 0) after the ':' character.
1367
1379
1368 * IPython/Prompts.py (Prompt2.set_p_str): Fix spurious space in
1380 * IPython/Prompts.py (Prompt2.set_p_str): Fix spurious space in
1369 continuation prompt, which misled users to think the line was
1381 continuation prompt, which misled users to think the line was
1370 already indented. Closes debian Bug#300847, reported to me by
1382 already indented. Closes debian Bug#300847, reported to me by
1371 Norbert Tretkowski <tretkowski-AT-inittab.de>.
1383 Norbert Tretkowski <tretkowski-AT-inittab.de>.
1372
1384
1373 2005-03-23 Fernando Perez <fperez@colorado.edu>
1385 2005-03-23 Fernando Perez <fperez@colorado.edu>
1374
1386
1375 * IPython/Prompts.py (Prompt1.__str__): Make sure that prompts are
1387 * IPython/Prompts.py (Prompt1.__str__): Make sure that prompts are
1376 properly aligned if they have embedded newlines.
1388 properly aligned if they have embedded newlines.
1377
1389
1378 * IPython/iplib.py (runlines): Add a public method to expose
1390 * IPython/iplib.py (runlines): Add a public method to expose
1379 IPython's code execution machinery, so that users can run strings
1391 IPython's code execution machinery, so that users can run strings
1380 as if they had been typed at the prompt interactively.
1392 as if they had been typed at the prompt interactively.
1381 (InteractiveShell.__init__): Added getoutput() to the __IPYTHON__
1393 (InteractiveShell.__init__): Added getoutput() to the __IPYTHON__
1382 methods which can call the system shell, but with python variable
1394 methods which can call the system shell, but with python variable
1383 expansion. The three such methods are: __IPYTHON__.system,
1395 expansion. The three such methods are: __IPYTHON__.system,
1384 .getoutput and .getoutputerror. These need to be documented in a
1396 .getoutput and .getoutputerror. These need to be documented in a
1385 'public API' section (to be written) of the manual.
1397 'public API' section (to be written) of the manual.
1386
1398
1387 2005-03-20 Fernando Perez <fperez@colorado.edu>
1399 2005-03-20 Fernando Perez <fperez@colorado.edu>
1388
1400
1389 * IPython/iplib.py (InteractiveShell.set_custom_exc): new system
1401 * IPython/iplib.py (InteractiveShell.set_custom_exc): new system
1390 for custom exception handling. This is quite powerful, and it
1402 for custom exception handling. This is quite powerful, and it
1391 allows for user-installable exception handlers which can trap
1403 allows for user-installable exception handlers which can trap
1392 custom exceptions at runtime and treat them separately from
1404 custom exceptions at runtime and treat them separately from
1393 IPython's default mechanisms. At the request of FrΓ©dΓ©ric
1405 IPython's default mechanisms. At the request of FrΓ©dΓ©ric
1394 Mantegazza <mantegazza-AT-ill.fr>.
1406 Mantegazza <mantegazza-AT-ill.fr>.
1395 (InteractiveShell.set_custom_completer): public API function to
1407 (InteractiveShell.set_custom_completer): public API function to
1396 add new completers at runtime.
1408 add new completers at runtime.
1397
1409
1398 2005-03-19 Fernando Perez <fperez@colorado.edu>
1410 2005-03-19 Fernando Perez <fperez@colorado.edu>
1399
1411
1400 * IPython/OInspect.py (getdoc): Add a call to obj.getdoc(), to
1412 * IPython/OInspect.py (getdoc): Add a call to obj.getdoc(), to
1401 allow objects which provide their docstrings via non-standard
1413 allow objects which provide their docstrings via non-standard
1402 mechanisms (like Pyro proxies) to still be inspected by ipython's
1414 mechanisms (like Pyro proxies) to still be inspected by ipython's
1403 ? system.
1415 ? system.
1404
1416
1405 * IPython/iplib.py (InteractiveShell.__init__): back off the _o/_e
1417 * IPython/iplib.py (InteractiveShell.__init__): back off the _o/_e
1406 automatic capture system. I tried quite hard to make it work
1418 automatic capture system. I tried quite hard to make it work
1407 reliably, and simply failed. I tried many combinations with the
1419 reliably, and simply failed. I tried many combinations with the
1408 subprocess module, but eventually nothing worked in all needed
1420 subprocess module, but eventually nothing worked in all needed
1409 cases (not blocking stdin for the child, duplicating stdout
1421 cases (not blocking stdin for the child, duplicating stdout
1410 without blocking, etc). The new %sc/%sx still do capture to these
1422 without blocking, etc). The new %sc/%sx still do capture to these
1411 magical list/string objects which make shell use much more
1423 magical list/string objects which make shell use much more
1412 conveninent, so not all is lost.
1424 conveninent, so not all is lost.
1413
1425
1414 XXX - FIX MANUAL for the change above!
1426 XXX - FIX MANUAL for the change above!
1415
1427
1416 (runsource): I copied code.py's runsource() into ipython to modify
1428 (runsource): I copied code.py's runsource() into ipython to modify
1417 it a bit. Now the code object and source to be executed are
1429 it a bit. Now the code object and source to be executed are
1418 stored in ipython. This makes this info accessible to third-party
1430 stored in ipython. This makes this info accessible to third-party
1419 tools, like custom exception handlers. After a request by FrΓ©dΓ©ric
1431 tools, like custom exception handlers. After a request by FrΓ©dΓ©ric
1420 Mantegazza <mantegazza-AT-ill.fr>.
1432 Mantegazza <mantegazza-AT-ill.fr>.
1421
1433
1422 * IPython/UserConfig/ipythonrc: Add up/down arrow keys to
1434 * IPython/UserConfig/ipythonrc: Add up/down arrow keys to
1423 history-search via readline (like C-p/C-n). I'd wanted this for a
1435 history-search via readline (like C-p/C-n). I'd wanted this for a
1424 long time, but only recently found out how to do it. For users
1436 long time, but only recently found out how to do it. For users
1425 who already have their ipythonrc files made and want this, just
1437 who already have their ipythonrc files made and want this, just
1426 add:
1438 add:
1427
1439
1428 readline_parse_and_bind "\e[A": history-search-backward
1440 readline_parse_and_bind "\e[A": history-search-backward
1429 readline_parse_and_bind "\e[B": history-search-forward
1441 readline_parse_and_bind "\e[B": history-search-forward
1430
1442
1431 2005-03-18 Fernando Perez <fperez@colorado.edu>
1443 2005-03-18 Fernando Perez <fperez@colorado.edu>
1432
1444
1433 * IPython/Magic.py (magic_sc): %sc and %sx now use the fancy
1445 * IPython/Magic.py (magic_sc): %sc and %sx now use the fancy
1434 LSString and SList classes which allow transparent conversions
1446 LSString and SList classes which allow transparent conversions
1435 between list mode and whitespace-separated string.
1447 between list mode and whitespace-separated string.
1436 (magic_r): Fix recursion problem in %r.
1448 (magic_r): Fix recursion problem in %r.
1437
1449
1438 * IPython/genutils.py (LSString): New class to be used for
1450 * IPython/genutils.py (LSString): New class to be used for
1439 automatic storage of the results of all alias/system calls in _o
1451 automatic storage of the results of all alias/system calls in _o
1440 and _e (stdout/err). These provide a .l/.list attribute which
1452 and _e (stdout/err). These provide a .l/.list attribute which
1441 does automatic splitting on newlines. This means that for most
1453 does automatic splitting on newlines. This means that for most
1442 uses, you'll never need to do capturing of output with %sc/%sx
1454 uses, you'll never need to do capturing of output with %sc/%sx
1443 anymore, since ipython keeps this always done for you. Note that
1455 anymore, since ipython keeps this always done for you. Note that
1444 only the LAST results are stored, the _o/e variables are
1456 only the LAST results are stored, the _o/e variables are
1445 overwritten on each call. If you need to save their contents
1457 overwritten on each call. If you need to save their contents
1446 further, simply bind them to any other name.
1458 further, simply bind them to any other name.
1447
1459
1448 2005-03-17 Fernando Perez <fperez@colorado.edu>
1460 2005-03-17 Fernando Perez <fperez@colorado.edu>
1449
1461
1450 * IPython/Prompts.py (BasePrompt.cwd_filt): a few more fixes for
1462 * IPython/Prompts.py (BasePrompt.cwd_filt): a few more fixes for
1451 prompt namespace handling.
1463 prompt namespace handling.
1452
1464
1453 2005-03-16 Fernando Perez <fperez@colorado.edu>
1465 2005-03-16 Fernando Perez <fperez@colorado.edu>
1454
1466
1455 * IPython/Prompts.py (CachedOutput.__init__): Fix default and
1467 * IPython/Prompts.py (CachedOutput.__init__): Fix default and
1456 classic prompts to be '>>> ' (final space was missing, and it
1468 classic prompts to be '>>> ' (final space was missing, and it
1457 trips the emacs python mode).
1469 trips the emacs python mode).
1458 (BasePrompt.__str__): Added safe support for dynamic prompt
1470 (BasePrompt.__str__): Added safe support for dynamic prompt
1459 strings. Now you can set your prompt string to be '$x', and the
1471 strings. Now you can set your prompt string to be '$x', and the
1460 value of x will be printed from your interactive namespace. The
1472 value of x will be printed from your interactive namespace. The
1461 interpolation syntax includes the full Itpl support, so
1473 interpolation syntax includes the full Itpl support, so
1462 ${foo()+x+bar()} is a valid prompt string now, and the function
1474 ${foo()+x+bar()} is a valid prompt string now, and the function
1463 calls will be made at runtime.
1475 calls will be made at runtime.
1464
1476
1465 2005-03-15 Fernando Perez <fperez@colorado.edu>
1477 2005-03-15 Fernando Perez <fperez@colorado.edu>
1466
1478
1467 * IPython/Magic.py (magic_history): renamed %hist to %history, to
1479 * IPython/Magic.py (magic_history): renamed %hist to %history, to
1468 avoid name clashes in pylab. %hist still works, it just forwards
1480 avoid name clashes in pylab. %hist still works, it just forwards
1469 the call to %history.
1481 the call to %history.
1470
1482
1471 2005-03-02 *** Released version 0.6.12
1483 2005-03-02 *** Released version 0.6.12
1472
1484
1473 2005-03-02 Fernando Perez <fperez@colorado.edu>
1485 2005-03-02 Fernando Perez <fperez@colorado.edu>
1474
1486
1475 * IPython/iplib.py (handle_magic): log magic calls properly as
1487 * IPython/iplib.py (handle_magic): log magic calls properly as
1476 ipmagic() function calls.
1488 ipmagic() function calls.
1477
1489
1478 * IPython/Magic.py (magic_time): Improved %time to support
1490 * IPython/Magic.py (magic_time): Improved %time to support
1479 statements and provide wall-clock as well as CPU time.
1491 statements and provide wall-clock as well as CPU time.
1480
1492
1481 2005-02-27 Fernando Perez <fperez@colorado.edu>
1493 2005-02-27 Fernando Perez <fperez@colorado.edu>
1482
1494
1483 * IPython/hooks.py: New hooks module, to expose user-modifiable
1495 * IPython/hooks.py: New hooks module, to expose user-modifiable
1484 IPython functionality in a clean manner. For now only the editor
1496 IPython functionality in a clean manner. For now only the editor
1485 hook is actually written, and other thigns which I intend to turn
1497 hook is actually written, and other thigns which I intend to turn
1486 into proper hooks aren't yet there. The display and prefilter
1498 into proper hooks aren't yet there. The display and prefilter
1487 stuff, for example, should be hooks. But at least now the
1499 stuff, for example, should be hooks. But at least now the
1488 framework is in place, and the rest can be moved here with more
1500 framework is in place, and the rest can be moved here with more
1489 time later. IPython had had a .hooks variable for a long time for
1501 time later. IPython had had a .hooks variable for a long time for
1490 this purpose, but I'd never actually used it for anything.
1502 this purpose, but I'd never actually used it for anything.
1491
1503
1492 2005-02-26 Fernando Perez <fperez@colorado.edu>
1504 2005-02-26 Fernando Perez <fperez@colorado.edu>
1493
1505
1494 * IPython/ipmaker.py (make_IPython): make the default ipython
1506 * IPython/ipmaker.py (make_IPython): make the default ipython
1495 directory be called _ipython under win32, to follow more the
1507 directory be called _ipython under win32, to follow more the
1496 naming peculiarities of that platform (where buggy software like
1508 naming peculiarities of that platform (where buggy software like
1497 Visual Sourcesafe breaks with .named directories). Reported by
1509 Visual Sourcesafe breaks with .named directories). Reported by
1498 Ville Vainio.
1510 Ville Vainio.
1499
1511
1500 2005-02-23 Fernando Perez <fperez@colorado.edu>
1512 2005-02-23 Fernando Perez <fperez@colorado.edu>
1501
1513
1502 * IPython/iplib.py (InteractiveShell.__init__): removed a few
1514 * IPython/iplib.py (InteractiveShell.__init__): removed a few
1503 auto_aliases for win32 which were causing problems. Users can
1515 auto_aliases for win32 which were causing problems. Users can
1504 define the ones they personally like.
1516 define the ones they personally like.
1505
1517
1506 2005-02-21 Fernando Perez <fperez@colorado.edu>
1518 2005-02-21 Fernando Perez <fperez@colorado.edu>
1507
1519
1508 * IPython/Magic.py (magic_time): new magic to time execution of
1520 * IPython/Magic.py (magic_time): new magic to time execution of
1509 expressions. After a request by Charles Moad <cmoad-AT-indiana.edu>.
1521 expressions. After a request by Charles Moad <cmoad-AT-indiana.edu>.
1510
1522
1511 2005-02-19 Fernando Perez <fperez@colorado.edu>
1523 2005-02-19 Fernando Perez <fperez@colorado.edu>
1512
1524
1513 * IPython/ConfigLoader.py (ConfigLoader.load): Allow empty strings
1525 * IPython/ConfigLoader.py (ConfigLoader.load): Allow empty strings
1514 into keys (for prompts, for example).
1526 into keys (for prompts, for example).
1515
1527
1516 * IPython/Prompts.py (BasePrompt.set_p_str): Fix to allow empty
1528 * IPython/Prompts.py (BasePrompt.set_p_str): Fix to allow empty
1517 prompts in case users want them. This introduces a small behavior
1529 prompts in case users want them. This introduces a small behavior
1518 change: ipython does not automatically add a space to all prompts
1530 change: ipython does not automatically add a space to all prompts
1519 anymore. To get the old prompts with a space, users should add it
1531 anymore. To get the old prompts with a space, users should add it
1520 manually to their ipythonrc file, so for example prompt_in1 should
1532 manually to their ipythonrc file, so for example prompt_in1 should
1521 now read 'In [\#]: ' instead of 'In [\#]:'.
1533 now read 'In [\#]: ' instead of 'In [\#]:'.
1522 (BasePrompt.__init__): New option prompts_pad_left (only in rc
1534 (BasePrompt.__init__): New option prompts_pad_left (only in rc
1523 file) to control left-padding of secondary prompts.
1535 file) to control left-padding of secondary prompts.
1524
1536
1525 * IPython/Magic.py (Magic.profile_missing_notice): Don't crash if
1537 * IPython/Magic.py (Magic.profile_missing_notice): Don't crash if
1526 the profiler can't be imported. Fix for Debian, which removed
1538 the profiler can't be imported. Fix for Debian, which removed
1527 profile.py because of License issues. I applied a slightly
1539 profile.py because of License issues. I applied a slightly
1528 modified version of the original Debian patch at
1540 modified version of the original Debian patch at
1529 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=294500.
1541 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=294500.
1530
1542
1531 2005-02-17 Fernando Perez <fperez@colorado.edu>
1543 2005-02-17 Fernando Perez <fperez@colorado.edu>
1532
1544
1533 * IPython/genutils.py (native_line_ends): Fix bug which would
1545 * IPython/genutils.py (native_line_ends): Fix bug which would
1534 cause improper line-ends under win32 b/c I was not opening files
1546 cause improper line-ends under win32 b/c I was not opening files
1535 in binary mode. Bug report and fix thanks to Ville.
1547 in binary mode. Bug report and fix thanks to Ville.
1536
1548
1537 * IPython/iplib.py (handle_auto): Fix bug which I introduced when
1549 * IPython/iplib.py (handle_auto): Fix bug which I introduced when
1538 trying to catch spurious foo[1] autocalls. My fix actually broke
1550 trying to catch spurious foo[1] autocalls. My fix actually broke
1539 ',/' autoquote/call with explicit escape (bad regexp).
1551 ',/' autoquote/call with explicit escape (bad regexp).
1540
1552
1541 2005-02-15 *** Released version 0.6.11
1553 2005-02-15 *** Released version 0.6.11
1542
1554
1543 2005-02-14 Fernando Perez <fperez@colorado.edu>
1555 2005-02-14 Fernando Perez <fperez@colorado.edu>
1544
1556
1545 * IPython/background_jobs.py: New background job management
1557 * IPython/background_jobs.py: New background job management
1546 subsystem. This is implemented via a new set of classes, and
1558 subsystem. This is implemented via a new set of classes, and
1547 IPython now provides a builtin 'jobs' object for background job
1559 IPython now provides a builtin 'jobs' object for background job
1548 execution. A convenience %bg magic serves as a lightweight
1560 execution. A convenience %bg magic serves as a lightweight
1549 frontend for starting the more common type of calls. This was
1561 frontend for starting the more common type of calls. This was
1550 inspired by discussions with B. Granger and the BackgroundCommand
1562 inspired by discussions with B. Granger and the BackgroundCommand
1551 class described in the book Python Scripting for Computational
1563 class described in the book Python Scripting for Computational
1552 Science, by H. P. Langtangen: http://folk.uio.no/hpl/scripting
1564 Science, by H. P. Langtangen: http://folk.uio.no/hpl/scripting
1553 (although ultimately no code from this text was used, as IPython's
1565 (although ultimately no code from this text was used, as IPython's
1554 system is a separate implementation).
1566 system is a separate implementation).
1555
1567
1556 * IPython/iplib.py (MagicCompleter.python_matches): add new option
1568 * IPython/iplib.py (MagicCompleter.python_matches): add new option
1557 to control the completion of single/double underscore names
1569 to control the completion of single/double underscore names
1558 separately. As documented in the example ipytonrc file, the
1570 separately. As documented in the example ipytonrc file, the
1559 readline_omit__names variable can now be set to 2, to omit even
1571 readline_omit__names variable can now be set to 2, to omit even
1560 single underscore names. Thanks to a patch by Brian Wong
1572 single underscore names. Thanks to a patch by Brian Wong
1561 <BrianWong-AT-AirgoNetworks.Com>.
1573 <BrianWong-AT-AirgoNetworks.Com>.
1562 (InteractiveShell.__init__): Fix bug which would cause foo[1] to
1574 (InteractiveShell.__init__): Fix bug which would cause foo[1] to
1563 be autocalled as foo([1]) if foo were callable. A problem for
1575 be autocalled as foo([1]) if foo were callable. A problem for
1564 things which are both callable and implement __getitem__.
1576 things which are both callable and implement __getitem__.
1565 (init_readline): Fix autoindentation for win32. Thanks to a patch
1577 (init_readline): Fix autoindentation for win32. Thanks to a patch
1566 by Vivian De Smedt <vivian-AT-vdesmedt.com>.
1578 by Vivian De Smedt <vivian-AT-vdesmedt.com>.
1567
1579
1568 2005-02-12 Fernando Perez <fperez@colorado.edu>
1580 2005-02-12 Fernando Perez <fperez@colorado.edu>
1569
1581
1570 * IPython/ipmaker.py (make_IPython): Disabled the stout traps
1582 * IPython/ipmaker.py (make_IPython): Disabled the stout traps
1571 which I had written long ago to sort out user error messages which
1583 which I had written long ago to sort out user error messages which
1572 may occur during startup. This seemed like a good idea initially,
1584 may occur during startup. This seemed like a good idea initially,
1573 but it has proven a disaster in retrospect. I don't want to
1585 but it has proven a disaster in retrospect. I don't want to
1574 change much code for now, so my fix is to set the internal 'debug'
1586 change much code for now, so my fix is to set the internal 'debug'
1575 flag to true everywhere, whose only job was precisely to control
1587 flag to true everywhere, whose only job was precisely to control
1576 this subsystem. This closes issue 28 (as well as avoiding all
1588 this subsystem. This closes issue 28 (as well as avoiding all
1577 sorts of strange hangups which occur from time to time).
1589 sorts of strange hangups which occur from time to time).
1578
1590
1579 2005-02-07 Fernando Perez <fperez@colorado.edu>
1591 2005-02-07 Fernando Perez <fperez@colorado.edu>
1580
1592
1581 * IPython/Magic.py (magic_edit): Fix 'ed -p' not working when the
1593 * IPython/Magic.py (magic_edit): Fix 'ed -p' not working when the
1582 previous call produced a syntax error.
1594 previous call produced a syntax error.
1583
1595
1584 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
1596 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
1585 classes without constructor.
1597 classes without constructor.
1586
1598
1587 2005-02-06 Fernando Perez <fperez@colorado.edu>
1599 2005-02-06 Fernando Perez <fperez@colorado.edu>
1588
1600
1589 * IPython/iplib.py (MagicCompleter.complete): Extend the list of
1601 * IPython/iplib.py (MagicCompleter.complete): Extend the list of
1590 completions with the results of each matcher, so we return results
1602 completions with the results of each matcher, so we return results
1591 to the user from all namespaces. This breaks with ipython
1603 to the user from all namespaces. This breaks with ipython
1592 tradition, but I think it's a nicer behavior. Now you get all
1604 tradition, but I think it's a nicer behavior. Now you get all
1593 possible completions listed, from all possible namespaces (python,
1605 possible completions listed, from all possible namespaces (python,
1594 filesystem, magics...) After a request by John Hunter
1606 filesystem, magics...) After a request by John Hunter
1595 <jdhunter-AT-nitace.bsd.uchicago.edu>.
1607 <jdhunter-AT-nitace.bsd.uchicago.edu>.
1596
1608
1597 2005-02-05 Fernando Perez <fperez@colorado.edu>
1609 2005-02-05 Fernando Perez <fperez@colorado.edu>
1598
1610
1599 * IPython/Magic.py (magic_prun): Fix bug where prun would fail if
1611 * IPython/Magic.py (magic_prun): Fix bug where prun would fail if
1600 the call had quote characters in it (the quotes were stripped).
1612 the call had quote characters in it (the quotes were stripped).
1601
1613
1602 2005-01-31 Fernando Perez <fperez@colorado.edu>
1614 2005-01-31 Fernando Perez <fperez@colorado.edu>
1603
1615
1604 * IPython/iplib.py (InteractiveShell.__init__): reduce reliance on
1616 * IPython/iplib.py (InteractiveShell.__init__): reduce reliance on
1605 Itpl.itpl() to make the code more robust against psyco
1617 Itpl.itpl() to make the code more robust against psyco
1606 optimizations.
1618 optimizations.
1607
1619
1608 * IPython/Itpl.py (Itpl.__str__): Use a _getframe() call instead
1620 * IPython/Itpl.py (Itpl.__str__): Use a _getframe() call instead
1609 of causing an exception. Quicker, cleaner.
1621 of causing an exception. Quicker, cleaner.
1610
1622
1611 2005-01-28 Fernando Perez <fperez@colorado.edu>
1623 2005-01-28 Fernando Perez <fperez@colorado.edu>
1612
1624
1613 * scripts/ipython_win_post_install.py (install): hardcode
1625 * scripts/ipython_win_post_install.py (install): hardcode
1614 sys.prefix+'python.exe' as the executable path. It turns out that
1626 sys.prefix+'python.exe' as the executable path. It turns out that
1615 during the post-installation run, sys.executable resolves to the
1627 during the post-installation run, sys.executable resolves to the
1616 name of the binary installer! I should report this as a distutils
1628 name of the binary installer! I should report this as a distutils
1617 bug, I think. I updated the .10 release with this tiny fix, to
1629 bug, I think. I updated the .10 release with this tiny fix, to
1618 avoid annoying the lists further.
1630 avoid annoying the lists further.
1619
1631
1620 2005-01-27 *** Released version 0.6.10
1632 2005-01-27 *** Released version 0.6.10
1621
1633
1622 2005-01-27 Fernando Perez <fperez@colorado.edu>
1634 2005-01-27 Fernando Perez <fperez@colorado.edu>
1623
1635
1624 * IPython/numutils.py (norm): Added 'inf' as optional name for
1636 * IPython/numutils.py (norm): Added 'inf' as optional name for
1625 L-infinity norm, included references to mathworld.com for vector
1637 L-infinity norm, included references to mathworld.com for vector
1626 norm definitions.
1638 norm definitions.
1627 (amin/amax): added amin/amax for array min/max. Similar to what
1639 (amin/amax): added amin/amax for array min/max. Similar to what
1628 pylab ships with after the recent reorganization of names.
1640 pylab ships with after the recent reorganization of names.
1629 (spike/spike_odd): removed deprecated spike/spike_odd functions.
1641 (spike/spike_odd): removed deprecated spike/spike_odd functions.
1630
1642
1631 * ipython.el: committed Alex's recent fixes and improvements.
1643 * ipython.el: committed Alex's recent fixes and improvements.
1632 Tested with python-mode from CVS, and it looks excellent. Since
1644 Tested with python-mode from CVS, and it looks excellent. Since
1633 python-mode hasn't released anything in a while, I'm temporarily
1645 python-mode hasn't released anything in a while, I'm temporarily
1634 putting a copy of today's CVS (v 4.70) of python-mode in:
1646 putting a copy of today's CVS (v 4.70) of python-mode in:
1635 http://ipython.scipy.org/tmp/python-mode.el
1647 http://ipython.scipy.org/tmp/python-mode.el
1636
1648
1637 * scripts/ipython_win_post_install.py (install): Win32 fix to use
1649 * scripts/ipython_win_post_install.py (install): Win32 fix to use
1638 sys.executable for the executable name, instead of assuming it's
1650 sys.executable for the executable name, instead of assuming it's
1639 called 'python.exe' (the post-installer would have produced broken
1651 called 'python.exe' (the post-installer would have produced broken
1640 setups on systems with a differently named python binary).
1652 setups on systems with a differently named python binary).
1641
1653
1642 * IPython/PyColorize.py (Parser.__call__): change explicit '\n'
1654 * IPython/PyColorize.py (Parser.__call__): change explicit '\n'
1643 references to os.linesep, to make the code more
1655 references to os.linesep, to make the code more
1644 platform-independent. This is also part of the win32 coloring
1656 platform-independent. This is also part of the win32 coloring
1645 fixes.
1657 fixes.
1646
1658
1647 * IPython/genutils.py (page_dumb): Remove attempts to chop long
1659 * IPython/genutils.py (page_dumb): Remove attempts to chop long
1648 lines, which actually cause coloring bugs because the length of
1660 lines, which actually cause coloring bugs because the length of
1649 the line is very difficult to correctly compute with embedded
1661 the line is very difficult to correctly compute with embedded
1650 escapes. This was the source of all the coloring problems under
1662 escapes. This was the source of all the coloring problems under
1651 Win32. I think that _finally_, Win32 users have a properly
1663 Win32. I think that _finally_, Win32 users have a properly
1652 working ipython in all respects. This would never have happened
1664 working ipython in all respects. This would never have happened
1653 if not for Gary Bishop and Viktor Ransmayr's great help and work.
1665 if not for Gary Bishop and Viktor Ransmayr's great help and work.
1654
1666
1655 2005-01-26 *** Released version 0.6.9
1667 2005-01-26 *** Released version 0.6.9
1656
1668
1657 2005-01-25 Fernando Perez <fperez@colorado.edu>
1669 2005-01-25 Fernando Perez <fperez@colorado.edu>
1658
1670
1659 * setup.py: finally, we have a true Windows installer, thanks to
1671 * setup.py: finally, we have a true Windows installer, thanks to
1660 the excellent work of Viktor Ransmayr
1672 the excellent work of Viktor Ransmayr
1661 <viktor.ransmayr-AT-t-online.de>. The docs have been updated for
1673 <viktor.ransmayr-AT-t-online.de>. The docs have been updated for
1662 Windows users. The setup routine is quite a bit cleaner thanks to
1674 Windows users. The setup routine is quite a bit cleaner thanks to
1663 this, and the post-install script uses the proper functions to
1675 this, and the post-install script uses the proper functions to
1664 allow a clean de-installation using the standard Windows Control
1676 allow a clean de-installation using the standard Windows Control
1665 Panel.
1677 Panel.
1666
1678
1667 * IPython/genutils.py (get_home_dir): changed to use the $HOME
1679 * IPython/genutils.py (get_home_dir): changed to use the $HOME
1668 environment variable under all OSes (including win32) if
1680 environment variable under all OSes (including win32) if
1669 available. This will give consistency to win32 users who have set
1681 available. This will give consistency to win32 users who have set
1670 this variable for any reason. If os.environ['HOME'] fails, the
1682 this variable for any reason. If os.environ['HOME'] fails, the
1671 previous policy of using HOMEDRIVE\HOMEPATH kicks in.
1683 previous policy of using HOMEDRIVE\HOMEPATH kicks in.
1672
1684
1673 2005-01-24 Fernando Perez <fperez@colorado.edu>
1685 2005-01-24 Fernando Perez <fperez@colorado.edu>
1674
1686
1675 * IPython/numutils.py (empty_like): add empty_like(), similar to
1687 * IPython/numutils.py (empty_like): add empty_like(), similar to
1676 zeros_like() but taking advantage of the new empty() Numeric routine.
1688 zeros_like() but taking advantage of the new empty() Numeric routine.
1677
1689
1678 2005-01-23 *** Released version 0.6.8
1690 2005-01-23 *** Released version 0.6.8
1679
1691
1680 2005-01-22 Fernando Perez <fperez@colorado.edu>
1692 2005-01-22 Fernando Perez <fperez@colorado.edu>
1681
1693
1682 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): I removed the
1694 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): I removed the
1683 automatic show() calls. After discussing things with JDH, it
1695 automatic show() calls. After discussing things with JDH, it
1684 turns out there are too many corner cases where this can go wrong.
1696 turns out there are too many corner cases where this can go wrong.
1685 It's best not to try to be 'too smart', and simply have ipython
1697 It's best not to try to be 'too smart', and simply have ipython
1686 reproduce as much as possible the default behavior of a normal
1698 reproduce as much as possible the default behavior of a normal
1687 python shell.
1699 python shell.
1688
1700
1689 * IPython/iplib.py (InteractiveShell.__init__): Modified the
1701 * IPython/iplib.py (InteractiveShell.__init__): Modified the
1690 line-splitting regexp and _prefilter() to avoid calling getattr()
1702 line-splitting regexp and _prefilter() to avoid calling getattr()
1691 on assignments. This closes
1703 on assignments. This closes
1692 http://www.scipy.net/roundup/ipython/issue24. Note that Python's
1704 http://www.scipy.net/roundup/ipython/issue24. Note that Python's
1693 readline uses getattr(), so a simple <TAB> keypress is still
1705 readline uses getattr(), so a simple <TAB> keypress is still
1694 enough to trigger getattr() calls on an object.
1706 enough to trigger getattr() calls on an object.
1695
1707
1696 2005-01-21 Fernando Perez <fperez@colorado.edu>
1708 2005-01-21 Fernando Perez <fperez@colorado.edu>
1697
1709
1698 * IPython/Shell.py (MatplotlibShellBase.magic_run): Fix the %run
1710 * IPython/Shell.py (MatplotlibShellBase.magic_run): Fix the %run
1699 docstring under pylab so it doesn't mask the original.
1711 docstring under pylab so it doesn't mask the original.
1700
1712
1701 2005-01-21 *** Released version 0.6.7
1713 2005-01-21 *** Released version 0.6.7
1702
1714
1703 2005-01-21 Fernando Perez <fperez@colorado.edu>
1715 2005-01-21 Fernando Perez <fperez@colorado.edu>
1704
1716
1705 * IPython/Shell.py (MTInteractiveShell.runcode): Trap a crash with
1717 * IPython/Shell.py (MTInteractiveShell.runcode): Trap a crash with
1706 signal handling for win32 users in multithreaded mode.
1718 signal handling for win32 users in multithreaded mode.
1707
1719
1708 2005-01-17 Fernando Perez <fperez@colorado.edu>
1720 2005-01-17 Fernando Perez <fperez@colorado.edu>
1709
1721
1710 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
1722 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
1711 instances with no __init__. After a crash report by Norbert Nemec
1723 instances with no __init__. After a crash report by Norbert Nemec
1712 <Norbert-AT-nemec-online.de>.
1724 <Norbert-AT-nemec-online.de>.
1713
1725
1714 2005-01-14 Fernando Perez <fperez@colorado.edu>
1726 2005-01-14 Fernando Perez <fperez@colorado.edu>
1715
1727
1716 * IPython/ultraTB.py (VerboseTB.text): Fix bug in reporting of
1728 * IPython/ultraTB.py (VerboseTB.text): Fix bug in reporting of
1717 names for verbose exceptions, when multiple dotted names and the
1729 names for verbose exceptions, when multiple dotted names and the
1718 'parent' object were present on the same line.
1730 'parent' object were present on the same line.
1719
1731
1720 2005-01-11 Fernando Perez <fperez@colorado.edu>
1732 2005-01-11 Fernando Perez <fperez@colorado.edu>
1721
1733
1722 * IPython/genutils.py (flag_calls): new utility to trap and flag
1734 * IPython/genutils.py (flag_calls): new utility to trap and flag
1723 calls in functions. I need it to clean up matplotlib support.
1735 calls in functions. I need it to clean up matplotlib support.
1724 Also removed some deprecated code in genutils.
1736 Also removed some deprecated code in genutils.
1725
1737
1726 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): small fix so
1738 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): small fix so
1727 that matplotlib scripts called with %run, which don't call show()
1739 that matplotlib scripts called with %run, which don't call show()
1728 themselves, still have their plotting windows open.
1740 themselves, still have their plotting windows open.
1729
1741
1730 2005-01-05 Fernando Perez <fperez@colorado.edu>
1742 2005-01-05 Fernando Perez <fperez@colorado.edu>
1731
1743
1732 * IPython/Shell.py (IPShellGTK.__init__): Patch by Andrew Straw
1744 * IPython/Shell.py (IPShellGTK.__init__): Patch by Andrew Straw
1733 <astraw-AT-caltech.edu>, to fix gtk deprecation warnings.
1745 <astraw-AT-caltech.edu>, to fix gtk deprecation warnings.
1734
1746
1735 2004-12-19 Fernando Perez <fperez@colorado.edu>
1747 2004-12-19 Fernando Perez <fperez@colorado.edu>
1736
1748
1737 * IPython/Shell.py (MTInteractiveShell.runcode): Get rid of
1749 * IPython/Shell.py (MTInteractiveShell.runcode): Get rid of
1738 parent_runcode, which was an eyesore. The same result can be
1750 parent_runcode, which was an eyesore. The same result can be
1739 obtained with Python's regular superclass mechanisms.
1751 obtained with Python's regular superclass mechanisms.
1740
1752
1741 2004-12-17 Fernando Perez <fperez@colorado.edu>
1753 2004-12-17 Fernando Perez <fperez@colorado.edu>
1742
1754
1743 * IPython/Magic.py (Magic.magic_sc): Fix quote stripping problem
1755 * IPython/Magic.py (Magic.magic_sc): Fix quote stripping problem
1744 reported by Prabhu.
1756 reported by Prabhu.
1745 (Magic.magic_sx): direct all errors to Term.cerr (defaults to
1757 (Magic.magic_sx): direct all errors to Term.cerr (defaults to
1746 sys.stderr) instead of explicitly calling sys.stderr. This helps
1758 sys.stderr) instead of explicitly calling sys.stderr. This helps
1747 maintain our I/O abstractions clean, for future GUI embeddings.
1759 maintain our I/O abstractions clean, for future GUI embeddings.
1748
1760
1749 * IPython/genutils.py (info): added new utility for sys.stderr
1761 * IPython/genutils.py (info): added new utility for sys.stderr
1750 unified info message handling (thin wrapper around warn()).
1762 unified info message handling (thin wrapper around warn()).
1751
1763
1752 * IPython/ultraTB.py (VerboseTB.text): Fix misreported global
1764 * IPython/ultraTB.py (VerboseTB.text): Fix misreported global
1753 composite (dotted) names on verbose exceptions.
1765 composite (dotted) names on verbose exceptions.
1754 (VerboseTB.nullrepr): harden against another kind of errors which
1766 (VerboseTB.nullrepr): harden against another kind of errors which
1755 Python's inspect module can trigger, and which were crashing
1767 Python's inspect module can trigger, and which were crashing
1756 IPython. Thanks to a report by Marco Lombardi
1768 IPython. Thanks to a report by Marco Lombardi
1757 <mlombard-AT-ma010192.hq.eso.org>.
1769 <mlombard-AT-ma010192.hq.eso.org>.
1758
1770
1759 2004-12-13 *** Released version 0.6.6
1771 2004-12-13 *** Released version 0.6.6
1760
1772
1761 2004-12-12 Fernando Perez <fperez@colorado.edu>
1773 2004-12-12 Fernando Perez <fperez@colorado.edu>
1762
1774
1763 * IPython/Shell.py (IPShellGTK.mainloop): catch RuntimeErrors
1775 * IPython/Shell.py (IPShellGTK.mainloop): catch RuntimeErrors
1764 generated by pygtk upon initialization if it was built without
1776 generated by pygtk upon initialization if it was built without
1765 threads (for matplotlib users). After a crash reported by
1777 threads (for matplotlib users). After a crash reported by
1766 Leguijt, Jaap J SIEP-EPT-RES <Jaap.Leguijt-AT-shell.com>.
1778 Leguijt, Jaap J SIEP-EPT-RES <Jaap.Leguijt-AT-shell.com>.
1767
1779
1768 * IPython/ipmaker.py (make_IPython): fix small bug in the
1780 * IPython/ipmaker.py (make_IPython): fix small bug in the
1769 import_some parameter for multiple imports.
1781 import_some parameter for multiple imports.
1770
1782
1771 * IPython/iplib.py (ipmagic): simplified the interface of
1783 * IPython/iplib.py (ipmagic): simplified the interface of
1772 ipmagic() to take a single string argument, just as it would be
1784 ipmagic() to take a single string argument, just as it would be
1773 typed at the IPython cmd line.
1785 typed at the IPython cmd line.
1774 (ipalias): Added new ipalias() with an interface identical to
1786 (ipalias): Added new ipalias() with an interface identical to
1775 ipmagic(). This completes exposing a pure python interface to the
1787 ipmagic(). This completes exposing a pure python interface to the
1776 alias and magic system, which can be used in loops or more complex
1788 alias and magic system, which can be used in loops or more complex
1777 code where IPython's automatic line mangling is not active.
1789 code where IPython's automatic line mangling is not active.
1778
1790
1779 * IPython/genutils.py (timing): changed interface of timing to
1791 * IPython/genutils.py (timing): changed interface of timing to
1780 simply run code once, which is the most common case. timings()
1792 simply run code once, which is the most common case. timings()
1781 remains unchanged, for the cases where you want multiple runs.
1793 remains unchanged, for the cases where you want multiple runs.
1782
1794
1783 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix a
1795 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix a
1784 bug where Python2.2 crashes with exec'ing code which does not end
1796 bug where Python2.2 crashes with exec'ing code which does not end
1785 in a single newline. Python 2.3 is OK, so I hadn't noticed this
1797 in a single newline. Python 2.3 is OK, so I hadn't noticed this
1786 before.
1798 before.
1787
1799
1788 2004-12-10 Fernando Perez <fperez@colorado.edu>
1800 2004-12-10 Fernando Perez <fperez@colorado.edu>
1789
1801
1790 * IPython/Magic.py (Magic.magic_prun): changed name of option from
1802 * IPython/Magic.py (Magic.magic_prun): changed name of option from
1791 -t to -T, to accomodate the new -t flag in %run (the %run and
1803 -t to -T, to accomodate the new -t flag in %run (the %run and
1792 %prun options are kind of intermixed, and it's not easy to change
1804 %prun options are kind of intermixed, and it's not easy to change
1793 this with the limitations of python's getopt).
1805 this with the limitations of python's getopt).
1794
1806
1795 * IPython/Magic.py (Magic.magic_run): Added new -t option to time
1807 * IPython/Magic.py (Magic.magic_run): Added new -t option to time
1796 the execution of scripts. It's not as fine-tuned as timeit.py,
1808 the execution of scripts. It's not as fine-tuned as timeit.py,
1797 but it works from inside ipython (and under 2.2, which lacks
1809 but it works from inside ipython (and under 2.2, which lacks
1798 timeit.py). Optionally a number of runs > 1 can be given for
1810 timeit.py). Optionally a number of runs > 1 can be given for
1799 timing very short-running code.
1811 timing very short-running code.
1800
1812
1801 * IPython/genutils.py (uniq_stable): new routine which returns a
1813 * IPython/genutils.py (uniq_stable): new routine which returns a
1802 list of unique elements in any iterable, but in stable order of
1814 list of unique elements in any iterable, but in stable order of
1803 appearance. I needed this for the ultraTB fixes, and it's a handy
1815 appearance. I needed this for the ultraTB fixes, and it's a handy
1804 utility.
1816 utility.
1805
1817
1806 * IPython/ultraTB.py (VerboseTB.text): Fix proper reporting of
1818 * IPython/ultraTB.py (VerboseTB.text): Fix proper reporting of
1807 dotted names in Verbose exceptions. This had been broken since
1819 dotted names in Verbose exceptions. This had been broken since
1808 the very start, now x.y will properly be printed in a Verbose
1820 the very start, now x.y will properly be printed in a Verbose
1809 traceback, instead of x being shown and y appearing always as an
1821 traceback, instead of x being shown and y appearing always as an
1810 'undefined global'. Getting this to work was a bit tricky,
1822 'undefined global'. Getting this to work was a bit tricky,
1811 because by default python tokenizers are stateless. Saved by
1823 because by default python tokenizers are stateless. Saved by
1812 python's ability to easily add a bit of state to an arbitrary
1824 python's ability to easily add a bit of state to an arbitrary
1813 function (without needing to build a full-blown callable object).
1825 function (without needing to build a full-blown callable object).
1814
1826
1815 Also big cleanup of this code, which had horrendous runtime
1827 Also big cleanup of this code, which had horrendous runtime
1816 lookups of zillions of attributes for colorization. Moved all
1828 lookups of zillions of attributes for colorization. Moved all
1817 this code into a few templates, which make it cleaner and quicker.
1829 this code into a few templates, which make it cleaner and quicker.
1818
1830
1819 Printout quality was also improved for Verbose exceptions: one
1831 Printout quality was also improved for Verbose exceptions: one
1820 variable per line, and memory addresses are printed (this can be
1832 variable per line, and memory addresses are printed (this can be
1821 quite handy in nasty debugging situations, which is what Verbose
1833 quite handy in nasty debugging situations, which is what Verbose
1822 is for).
1834 is for).
1823
1835
1824 * IPython/ipmaker.py (make_IPython): Do NOT execute files named in
1836 * IPython/ipmaker.py (make_IPython): Do NOT execute files named in
1825 the command line as scripts to be loaded by embedded instances.
1837 the command line as scripts to be loaded by embedded instances.
1826 Doing so has the potential for an infinite recursion if there are
1838 Doing so has the potential for an infinite recursion if there are
1827 exceptions thrown in the process. This fixes a strange crash
1839 exceptions thrown in the process. This fixes a strange crash
1828 reported by Philippe MULLER <muller-AT-irit.fr>.
1840 reported by Philippe MULLER <muller-AT-irit.fr>.
1829
1841
1830 2004-12-09 Fernando Perez <fperez@colorado.edu>
1842 2004-12-09 Fernando Perez <fperez@colorado.edu>
1831
1843
1832 * IPython/Shell.py (MatplotlibShellBase.use): Change pylab support
1844 * IPython/Shell.py (MatplotlibShellBase.use): Change pylab support
1833 to reflect new names in matplotlib, which now expose the
1845 to reflect new names in matplotlib, which now expose the
1834 matlab-compatible interface via a pylab module instead of the
1846 matlab-compatible interface via a pylab module instead of the
1835 'matlab' name. The new code is backwards compatible, so users of
1847 'matlab' name. The new code is backwards compatible, so users of
1836 all matplotlib versions are OK. Patch by J. Hunter.
1848 all matplotlib versions are OK. Patch by J. Hunter.
1837
1849
1838 * IPython/OInspect.py (Inspector.pinfo): Add to object? printing
1850 * IPython/OInspect.py (Inspector.pinfo): Add to object? printing
1839 of __init__ docstrings for instances (class docstrings are already
1851 of __init__ docstrings for instances (class docstrings are already
1840 automatically printed). Instances with customized docstrings
1852 automatically printed). Instances with customized docstrings
1841 (indep. of the class) are also recognized and all 3 separate
1853 (indep. of the class) are also recognized and all 3 separate
1842 docstrings are printed (instance, class, constructor). After some
1854 docstrings are printed (instance, class, constructor). After some
1843 comments/suggestions by J. Hunter.
1855 comments/suggestions by J. Hunter.
1844
1856
1845 2004-12-05 Fernando Perez <fperez@colorado.edu>
1857 2004-12-05 Fernando Perez <fperez@colorado.edu>
1846
1858
1847 * IPython/iplib.py (MagicCompleter.complete): Remove annoying
1859 * IPython/iplib.py (MagicCompleter.complete): Remove annoying
1848 warnings when tab-completion fails and triggers an exception.
1860 warnings when tab-completion fails and triggers an exception.
1849
1861
1850 2004-12-03 Fernando Perez <fperez@colorado.edu>
1862 2004-12-03 Fernando Perez <fperez@colorado.edu>
1851
1863
1852 * IPython/Magic.py (magic_prun): Fix bug where an exception would
1864 * IPython/Magic.py (magic_prun): Fix bug where an exception would
1853 be triggered when using 'run -p'. An incorrect option flag was
1865 be triggered when using 'run -p'. An incorrect option flag was
1854 being set ('d' instead of 'D').
1866 being set ('d' instead of 'D').
1855 (manpage): fix missing escaped \- sign.
1867 (manpage): fix missing escaped \- sign.
1856
1868
1857 2004-11-30 *** Released version 0.6.5
1869 2004-11-30 *** Released version 0.6.5
1858
1870
1859 2004-11-30 Fernando Perez <fperez@colorado.edu>
1871 2004-11-30 Fernando Perez <fperez@colorado.edu>
1860
1872
1861 * IPython/Magic.py (Magic.magic_run): Fix bug in breakpoint
1873 * IPython/Magic.py (Magic.magic_run): Fix bug in breakpoint
1862 setting with -d option.
1874 setting with -d option.
1863
1875
1864 * setup.py (docfiles): Fix problem where the doc glob I was using
1876 * setup.py (docfiles): Fix problem where the doc glob I was using
1865 was COMPLETELY BROKEN. It was giving the right files by pure
1877 was COMPLETELY BROKEN. It was giving the right files by pure
1866 accident, but failed once I tried to include ipython.el. Note:
1878 accident, but failed once I tried to include ipython.el. Note:
1867 glob() does NOT allow you to do exclusion on multiple endings!
1879 glob() does NOT allow you to do exclusion on multiple endings!
1868
1880
1869 2004-11-29 Fernando Perez <fperez@colorado.edu>
1881 2004-11-29 Fernando Perez <fperez@colorado.edu>
1870
1882
1871 * IPython/usage.py (__doc__): cleaned up usage docstring, by using
1883 * IPython/usage.py (__doc__): cleaned up usage docstring, by using
1872 the manpage as the source. Better formatting & consistency.
1884 the manpage as the source. Better formatting & consistency.
1873
1885
1874 * IPython/Magic.py (magic_run): Added new -d option, to run
1886 * IPython/Magic.py (magic_run): Added new -d option, to run
1875 scripts under the control of the python pdb debugger. Note that
1887 scripts under the control of the python pdb debugger. Note that
1876 this required changing the %prun option -d to -D, to avoid a clash
1888 this required changing the %prun option -d to -D, to avoid a clash
1877 (since %run must pass options to %prun, and getopt is too dumb to
1889 (since %run must pass options to %prun, and getopt is too dumb to
1878 handle options with string values with embedded spaces). Thanks
1890 handle options with string values with embedded spaces). Thanks
1879 to a suggestion by Matthew Arnison <maffew-AT-cat.org.au>.
1891 to a suggestion by Matthew Arnison <maffew-AT-cat.org.au>.
1880 (magic_who_ls): added type matching to %who and %whos, so that one
1892 (magic_who_ls): added type matching to %who and %whos, so that one
1881 can filter their output to only include variables of certain
1893 can filter their output to only include variables of certain
1882 types. Another suggestion by Matthew.
1894 types. Another suggestion by Matthew.
1883 (magic_whos): Added memory summaries in kb and Mb for arrays.
1895 (magic_whos): Added memory summaries in kb and Mb for arrays.
1884 (magic_who): Improve formatting (break lines every 9 vars).
1896 (magic_who): Improve formatting (break lines every 9 vars).
1885
1897
1886 2004-11-28 Fernando Perez <fperez@colorado.edu>
1898 2004-11-28 Fernando Perez <fperez@colorado.edu>
1887
1899
1888 * IPython/Logger.py (Logger.log): Fix bug in syncing the input
1900 * IPython/Logger.py (Logger.log): Fix bug in syncing the input
1889 cache when empty lines were present.
1901 cache when empty lines were present.
1890
1902
1891 2004-11-24 Fernando Perez <fperez@colorado.edu>
1903 2004-11-24 Fernando Perez <fperez@colorado.edu>
1892
1904
1893 * IPython/usage.py (__doc__): document the re-activated threading
1905 * IPython/usage.py (__doc__): document the re-activated threading
1894 options for WX and GTK.
1906 options for WX and GTK.
1895
1907
1896 2004-11-23 Fernando Perez <fperez@colorado.edu>
1908 2004-11-23 Fernando Perez <fperez@colorado.edu>
1897
1909
1898 * IPython/Shell.py (start): Added Prabhu's big patch to reactivate
1910 * IPython/Shell.py (start): Added Prabhu's big patch to reactivate
1899 the -wthread and -gthread options, along with a new -tk one to try
1911 the -wthread and -gthread options, along with a new -tk one to try
1900 and coordinate Tk threading with wx/gtk. The tk support is very
1912 and coordinate Tk threading with wx/gtk. The tk support is very
1901 platform dependent, since it seems to require Tcl and Tk to be
1913 platform dependent, since it seems to require Tcl and Tk to be
1902 built with threads (Fedora1/2 appears NOT to have it, but in
1914 built with threads (Fedora1/2 appears NOT to have it, but in
1903 Prabhu's Debian boxes it works OK). But even with some Tk
1915 Prabhu's Debian boxes it works OK). But even with some Tk
1904 limitations, this is a great improvement.
1916 limitations, this is a great improvement.
1905
1917
1906 * IPython/Prompts.py (prompt_specials_color): Added \t for time
1918 * IPython/Prompts.py (prompt_specials_color): Added \t for time
1907 info in user prompts. Patch by Prabhu.
1919 info in user prompts. Patch by Prabhu.
1908
1920
1909 2004-11-18 Fernando Perez <fperez@colorado.edu>
1921 2004-11-18 Fernando Perez <fperez@colorado.edu>
1910
1922
1911 * IPython/genutils.py (ask_yes_no): Add check for a max of 20
1923 * IPython/genutils.py (ask_yes_no): Add check for a max of 20
1912 EOFErrors and bail, to avoid infinite loops if a non-terminating
1924 EOFErrors and bail, to avoid infinite loops if a non-terminating
1913 file is fed into ipython. Patch submitted in issue 19 by user,
1925 file is fed into ipython. Patch submitted in issue 19 by user,
1914 many thanks.
1926 many thanks.
1915
1927
1916 * IPython/iplib.py (InteractiveShell.handle_auto): do NOT trigger
1928 * IPython/iplib.py (InteractiveShell.handle_auto): do NOT trigger
1917 autoquote/parens in continuation prompts, which can cause lots of
1929 autoquote/parens in continuation prompts, which can cause lots of
1918 problems. Closes roundup issue 20.
1930 problems. Closes roundup issue 20.
1919
1931
1920 2004-11-17 Fernando Perez <fperez@colorado.edu>
1932 2004-11-17 Fernando Perez <fperez@colorado.edu>
1921
1933
1922 * debian/control (Build-Depends-Indep): Fix dpatch dependency,
1934 * debian/control (Build-Depends-Indep): Fix dpatch dependency,
1923 reported as debian bug #280505. I'm not sure my local changelog
1935 reported as debian bug #280505. I'm not sure my local changelog
1924 entry has the proper debian format (Jack?).
1936 entry has the proper debian format (Jack?).
1925
1937
1926 2004-11-08 *** Released version 0.6.4
1938 2004-11-08 *** Released version 0.6.4
1927
1939
1928 2004-11-08 Fernando Perez <fperez@colorado.edu>
1940 2004-11-08 Fernando Perez <fperez@colorado.edu>
1929
1941
1930 * IPython/iplib.py (init_readline): Fix exit message for Windows
1942 * IPython/iplib.py (init_readline): Fix exit message for Windows
1931 when readline is active. Thanks to a report by Eric Jones
1943 when readline is active. Thanks to a report by Eric Jones
1932 <eric-AT-enthought.com>.
1944 <eric-AT-enthought.com>.
1933
1945
1934 2004-11-07 Fernando Perez <fperez@colorado.edu>
1946 2004-11-07 Fernando Perez <fperez@colorado.edu>
1935
1947
1936 * IPython/genutils.py (page): Add a trap for OSError exceptions,
1948 * IPython/genutils.py (page): Add a trap for OSError exceptions,
1937 sometimes seen by win2k/cygwin users.
1949 sometimes seen by win2k/cygwin users.
1938
1950
1939 2004-11-06 Fernando Perez <fperez@colorado.edu>
1951 2004-11-06 Fernando Perez <fperez@colorado.edu>
1940
1952
1941 * IPython/iplib.py (interact): Change the handling of %Exit from
1953 * IPython/iplib.py (interact): Change the handling of %Exit from
1942 trying to propagate a SystemExit to an internal ipython flag.
1954 trying to propagate a SystemExit to an internal ipython flag.
1943 This is less elegant than using Python's exception mechanism, but
1955 This is less elegant than using Python's exception mechanism, but
1944 I can't get that to work reliably with threads, so under -pylab
1956 I can't get that to work reliably with threads, so under -pylab
1945 %Exit was hanging IPython. Cross-thread exception handling is
1957 %Exit was hanging IPython. Cross-thread exception handling is
1946 really a bitch. Thaks to a bug report by Stephen Walton
1958 really a bitch. Thaks to a bug report by Stephen Walton
1947 <stephen.walton-AT-csun.edu>.
1959 <stephen.walton-AT-csun.edu>.
1948
1960
1949 2004-11-04 Fernando Perez <fperez@colorado.edu>
1961 2004-11-04 Fernando Perez <fperez@colorado.edu>
1950
1962
1951 * IPython/iplib.py (raw_input_original): store a pointer to the
1963 * IPython/iplib.py (raw_input_original): store a pointer to the
1952 true raw_input to harden against code which can modify it
1964 true raw_input to harden against code which can modify it
1953 (wx.py.PyShell does this and would otherwise crash ipython).
1965 (wx.py.PyShell does this and would otherwise crash ipython).
1954 Thanks to a bug report by Jim Flowers <james.flowers-AT-lgx.com>.
1966 Thanks to a bug report by Jim Flowers <james.flowers-AT-lgx.com>.
1955
1967
1956 * IPython/Shell.py (MTInteractiveShell.runsource): Cleaner fix for
1968 * IPython/Shell.py (MTInteractiveShell.runsource): Cleaner fix for
1957 Ctrl-C problem, which does not mess up the input line.
1969 Ctrl-C problem, which does not mess up the input line.
1958
1970
1959 2004-11-03 Fernando Perez <fperez@colorado.edu>
1971 2004-11-03 Fernando Perez <fperez@colorado.edu>
1960
1972
1961 * IPython/Release.py: Changed licensing to BSD, in all files.
1973 * IPython/Release.py: Changed licensing to BSD, in all files.
1962 (name): lowercase name for tarball/RPM release.
1974 (name): lowercase name for tarball/RPM release.
1963
1975
1964 * IPython/OInspect.py (getdoc): wrap inspect.getdoc() safely for
1976 * IPython/OInspect.py (getdoc): wrap inspect.getdoc() safely for
1965 use throughout ipython.
1977 use throughout ipython.
1966
1978
1967 * IPython/Magic.py (Magic._ofind): Switch to using the new
1979 * IPython/Magic.py (Magic._ofind): Switch to using the new
1968 OInspect.getdoc() function.
1980 OInspect.getdoc() function.
1969
1981
1970 * IPython/Shell.py (sigint_handler): Hack to ignore the execution
1982 * IPython/Shell.py (sigint_handler): Hack to ignore the execution
1971 of the line currently being canceled via Ctrl-C. It's extremely
1983 of the line currently being canceled via Ctrl-C. It's extremely
1972 ugly, but I don't know how to do it better (the problem is one of
1984 ugly, but I don't know how to do it better (the problem is one of
1973 handling cross-thread exceptions).
1985 handling cross-thread exceptions).
1974
1986
1975 2004-10-28 Fernando Perez <fperez@colorado.edu>
1987 2004-10-28 Fernando Perez <fperez@colorado.edu>
1976
1988
1977 * IPython/Shell.py (signal_handler): add signal handlers to trap
1989 * IPython/Shell.py (signal_handler): add signal handlers to trap
1978 SIGINT and SIGSEGV in threaded code properly. Thanks to a bug
1990 SIGINT and SIGSEGV in threaded code properly. Thanks to a bug
1979 report by Francesc Alted.
1991 report by Francesc Alted.
1980
1992
1981 2004-10-21 Fernando Perez <fperez@colorado.edu>
1993 2004-10-21 Fernando Perez <fperez@colorado.edu>
1982
1994
1983 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Fix @
1995 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Fix @
1984 to % for pysh syntax extensions.
1996 to % for pysh syntax extensions.
1985
1997
1986 2004-10-09 Fernando Perez <fperez@colorado.edu>
1998 2004-10-09 Fernando Perez <fperez@colorado.edu>
1987
1999
1988 * IPython/Magic.py (Magic.magic_whos): modify output of Numeric
2000 * IPython/Magic.py (Magic.magic_whos): modify output of Numeric
1989 arrays to print a more useful summary, without calling str(arr).
2001 arrays to print a more useful summary, without calling str(arr).
1990 This avoids the problem of extremely lengthy computations which
2002 This avoids the problem of extremely lengthy computations which
1991 occur if arr is large, and appear to the user as a system lockup
2003 occur if arr is large, and appear to the user as a system lockup
1992 with 100% cpu activity. After a suggestion by Kristian Sandberg
2004 with 100% cpu activity. After a suggestion by Kristian Sandberg
1993 <Kristian.Sandberg@colorado.edu>.
2005 <Kristian.Sandberg@colorado.edu>.
1994 (Magic.__init__): fix bug in global magic escapes not being
2006 (Magic.__init__): fix bug in global magic escapes not being
1995 correctly set.
2007 correctly set.
1996
2008
1997 2004-10-08 Fernando Perez <fperez@colorado.edu>
2009 2004-10-08 Fernando Perez <fperez@colorado.edu>
1998
2010
1999 * IPython/Magic.py (__license__): change to absolute imports of
2011 * IPython/Magic.py (__license__): change to absolute imports of
2000 ipython's own internal packages, to start adapting to the absolute
2012 ipython's own internal packages, to start adapting to the absolute
2001 import requirement of PEP-328.
2013 import requirement of PEP-328.
2002
2014
2003 * IPython/genutils.py (__author__): Fix coding to utf-8 on all
2015 * IPython/genutils.py (__author__): Fix coding to utf-8 on all
2004 files, and standardize author/license marks through the Release
2016 files, and standardize author/license marks through the Release
2005 module instead of having per/file stuff (except for files with
2017 module instead of having per/file stuff (except for files with
2006 particular licenses, like the MIT/PSF-licensed codes).
2018 particular licenses, like the MIT/PSF-licensed codes).
2007
2019
2008 * IPython/Debugger.py: remove dead code for python 2.1
2020 * IPython/Debugger.py: remove dead code for python 2.1
2009
2021
2010 2004-10-04 Fernando Perez <fperez@colorado.edu>
2022 2004-10-04 Fernando Perez <fperez@colorado.edu>
2011
2023
2012 * IPython/iplib.py (ipmagic): New function for accessing magics
2024 * IPython/iplib.py (ipmagic): New function for accessing magics
2013 via a normal python function call.
2025 via a normal python function call.
2014
2026
2015 * IPython/Magic.py (Magic.magic_magic): Change the magic escape
2027 * IPython/Magic.py (Magic.magic_magic): Change the magic escape
2016 from '@' to '%', to accomodate the new @decorator syntax of python
2028 from '@' to '%', to accomodate the new @decorator syntax of python
2017 2.4.
2029 2.4.
2018
2030
2019 2004-09-29 Fernando Perez <fperez@colorado.edu>
2031 2004-09-29 Fernando Perez <fperez@colorado.edu>
2020
2032
2021 * IPython/Shell.py (MatplotlibShellBase.use): Added a wrapper to
2033 * IPython/Shell.py (MatplotlibShellBase.use): Added a wrapper to
2022 matplotlib.use to prevent running scripts which try to switch
2034 matplotlib.use to prevent running scripts which try to switch
2023 interactive backends from within ipython. This will just crash
2035 interactive backends from within ipython. This will just crash
2024 the python interpreter, so we can't allow it (but a detailed error
2036 the python interpreter, so we can't allow it (but a detailed error
2025 is given to the user).
2037 is given to the user).
2026
2038
2027 2004-09-28 Fernando Perez <fperez@colorado.edu>
2039 2004-09-28 Fernando Perez <fperez@colorado.edu>
2028
2040
2029 * IPython/Shell.py (MatplotlibShellBase.mplot_exec):
2041 * IPython/Shell.py (MatplotlibShellBase.mplot_exec):
2030 matplotlib-related fixes so that using @run with non-matplotlib
2042 matplotlib-related fixes so that using @run with non-matplotlib
2031 scripts doesn't pop up spurious plot windows. This requires
2043 scripts doesn't pop up spurious plot windows. This requires
2032 matplotlib >= 0.63, where I had to make some changes as well.
2044 matplotlib >= 0.63, where I had to make some changes as well.
2033
2045
2034 * IPython/ipmaker.py (make_IPython): update version requirement to
2046 * IPython/ipmaker.py (make_IPython): update version requirement to
2035 python 2.2.
2047 python 2.2.
2036
2048
2037 * IPython/iplib.py (InteractiveShell.mainloop): Add an optional
2049 * IPython/iplib.py (InteractiveShell.mainloop): Add an optional
2038 banner arg for embedded customization.
2050 banner arg for embedded customization.
2039
2051
2040 * IPython/Magic.py (Magic.__init__): big cleanup to remove all
2052 * IPython/Magic.py (Magic.__init__): big cleanup to remove all
2041 explicit uses of __IP as the IPython's instance name. Now things
2053 explicit uses of __IP as the IPython's instance name. Now things
2042 are properly handled via the shell.name value. The actual code
2054 are properly handled via the shell.name value. The actual code
2043 is a bit ugly b/c I'm doing it via a global in Magic.py, but this
2055 is a bit ugly b/c I'm doing it via a global in Magic.py, but this
2044 is much better than before. I'll clean things completely when the
2056 is much better than before. I'll clean things completely when the
2045 magic stuff gets a real overhaul.
2057 magic stuff gets a real overhaul.
2046
2058
2047 * ipython.1: small fixes, sent in by Jack Moffit. He also sent in
2059 * ipython.1: small fixes, sent in by Jack Moffit. He also sent in
2048 minor changes to debian dir.
2060 minor changes to debian dir.
2049
2061
2050 * IPython/iplib.py (InteractiveShell.__init__): Fix adding a
2062 * IPython/iplib.py (InteractiveShell.__init__): Fix adding a
2051 pointer to the shell itself in the interactive namespace even when
2063 pointer to the shell itself in the interactive namespace even when
2052 a user-supplied dict is provided. This is needed for embedding
2064 a user-supplied dict is provided. This is needed for embedding
2053 purposes (found by tests with Michel Sanner).
2065 purposes (found by tests with Michel Sanner).
2054
2066
2055 2004-09-27 Fernando Perez <fperez@colorado.edu>
2067 2004-09-27 Fernando Perez <fperez@colorado.edu>
2056
2068
2057 * IPython/UserConfig/ipythonrc: remove []{} from
2069 * IPython/UserConfig/ipythonrc: remove []{} from
2058 readline_remove_delims, so that things like [modname.<TAB> do
2070 readline_remove_delims, so that things like [modname.<TAB> do
2059 proper completion. This disables [].TAB, but that's a less common
2071 proper completion. This disables [].TAB, but that's a less common
2060 case than module names in list comprehensions, for example.
2072 case than module names in list comprehensions, for example.
2061 Thanks to a report by Andrea Riciputi.
2073 Thanks to a report by Andrea Riciputi.
2062
2074
2063 2004-09-09 Fernando Perez <fperez@colorado.edu>
2075 2004-09-09 Fernando Perez <fperez@colorado.edu>
2064
2076
2065 * IPython/Shell.py (IPShellGTK.mainloop): reorder to avoid
2077 * IPython/Shell.py (IPShellGTK.mainloop): reorder to avoid
2066 blocking problems in win32 and osx. Fix by John.
2078 blocking problems in win32 and osx. Fix by John.
2067
2079
2068 2004-09-08 Fernando Perez <fperez@colorado.edu>
2080 2004-09-08 Fernando Perez <fperez@colorado.edu>
2069
2081
2070 * IPython/Shell.py (IPShellWX.OnInit): Fix output redirection bug
2082 * IPython/Shell.py (IPShellWX.OnInit): Fix output redirection bug
2071 for Win32 and OSX. Fix by John Hunter.
2083 for Win32 and OSX. Fix by John Hunter.
2072
2084
2073 2004-08-30 *** Released version 0.6.3
2085 2004-08-30 *** Released version 0.6.3
2074
2086
2075 2004-08-30 Fernando Perez <fperez@colorado.edu>
2087 2004-08-30 Fernando Perez <fperez@colorado.edu>
2076
2088
2077 * setup.py (isfile): Add manpages to list of dependent files to be
2089 * setup.py (isfile): Add manpages to list of dependent files to be
2078 updated.
2090 updated.
2079
2091
2080 2004-08-27 Fernando Perez <fperez@colorado.edu>
2092 2004-08-27 Fernando Perez <fperez@colorado.edu>
2081
2093
2082 * IPython/Shell.py (start): I've disabled -wthread and -gthread
2094 * IPython/Shell.py (start): I've disabled -wthread and -gthread
2083 for now. They don't really work with standalone WX/GTK code
2095 for now. They don't really work with standalone WX/GTK code
2084 (though matplotlib IS working fine with both of those backends).
2096 (though matplotlib IS working fine with both of those backends).
2085 This will neeed much more testing. I disabled most things with
2097 This will neeed much more testing. I disabled most things with
2086 comments, so turning it back on later should be pretty easy.
2098 comments, so turning it back on later should be pretty easy.
2087
2099
2088 * IPython/iplib.py (InteractiveShell.__init__): Fix accidental
2100 * IPython/iplib.py (InteractiveShell.__init__): Fix accidental
2089 autocalling of expressions like r'foo', by modifying the line
2101 autocalling of expressions like r'foo', by modifying the line
2090 split regexp. Closes
2102 split regexp. Closes
2091 http://www.scipy.net/roundup/ipython/issue18, reported by Nicholas
2103 http://www.scipy.net/roundup/ipython/issue18, reported by Nicholas
2092 Riley <ipythonbugs-AT-sabi.net>.
2104 Riley <ipythonbugs-AT-sabi.net>.
2093 (InteractiveShell.mainloop): honor --nobanner with banner
2105 (InteractiveShell.mainloop): honor --nobanner with banner
2094 extensions.
2106 extensions.
2095
2107
2096 * IPython/Shell.py: Significant refactoring of all classes, so
2108 * IPython/Shell.py: Significant refactoring of all classes, so
2097 that we can really support ALL matplotlib backends and threading
2109 that we can really support ALL matplotlib backends and threading
2098 models (John spotted a bug with Tk which required this). Now we
2110 models (John spotted a bug with Tk which required this). Now we
2099 should support single-threaded, WX-threads and GTK-threads, both
2111 should support single-threaded, WX-threads and GTK-threads, both
2100 for generic code and for matplotlib.
2112 for generic code and for matplotlib.
2101
2113
2102 * IPython/ipmaker.py (__call__): Changed -mpthread option to
2114 * IPython/ipmaker.py (__call__): Changed -mpthread option to
2103 -pylab, to simplify things for users. Will also remove the pylab
2115 -pylab, to simplify things for users. Will also remove the pylab
2104 profile, since now all of matplotlib configuration is directly
2116 profile, since now all of matplotlib configuration is directly
2105 handled here. This also reduces startup time.
2117 handled here. This also reduces startup time.
2106
2118
2107 * IPython/Shell.py (IPShellGTK.run): Fixed bug where mainloop() of
2119 * IPython/Shell.py (IPShellGTK.run): Fixed bug where mainloop() of
2108 shell wasn't being correctly called. Also in IPShellWX.
2120 shell wasn't being correctly called. Also in IPShellWX.
2109
2121
2110 * IPython/iplib.py (InteractiveShell.__init__): Added option to
2122 * IPython/iplib.py (InteractiveShell.__init__): Added option to
2111 fine-tune banner.
2123 fine-tune banner.
2112
2124
2113 * IPython/numutils.py (spike): Deprecate these spike functions,
2125 * IPython/numutils.py (spike): Deprecate these spike functions,
2114 delete (long deprecated) gnuplot_exec handler.
2126 delete (long deprecated) gnuplot_exec handler.
2115
2127
2116 2004-08-26 Fernando Perez <fperez@colorado.edu>
2128 2004-08-26 Fernando Perez <fperez@colorado.edu>
2117
2129
2118 * ipython.1: Update for threading options, plus some others which
2130 * ipython.1: Update for threading options, plus some others which
2119 were missing.
2131 were missing.
2120
2132
2121 * IPython/ipmaker.py (__call__): Added -wthread option for
2133 * IPython/ipmaker.py (__call__): Added -wthread option for
2122 wxpython thread handling. Make sure threading options are only
2134 wxpython thread handling. Make sure threading options are only
2123 valid at the command line.
2135 valid at the command line.
2124
2136
2125 * scripts/ipython: moved shell selection into a factory function
2137 * scripts/ipython: moved shell selection into a factory function
2126 in Shell.py, to keep the starter script to a minimum.
2138 in Shell.py, to keep the starter script to a minimum.
2127
2139
2128 2004-08-25 Fernando Perez <fperez@colorado.edu>
2140 2004-08-25 Fernando Perez <fperez@colorado.edu>
2129
2141
2130 * IPython/Shell.py (IPShellWX.wxexit): fixes to WX threading, by
2142 * IPython/Shell.py (IPShellWX.wxexit): fixes to WX threading, by
2131 John. Along with some recent changes he made to matplotlib, the
2143 John. Along with some recent changes he made to matplotlib, the
2132 next versions of both systems should work very well together.
2144 next versions of both systems should work very well together.
2133
2145
2134 2004-08-24 Fernando Perez <fperez@colorado.edu>
2146 2004-08-24 Fernando Perez <fperez@colorado.edu>
2135
2147
2136 * IPython/Magic.py (Magic.magic_prun): cleanup some dead code. I
2148 * IPython/Magic.py (Magic.magic_prun): cleanup some dead code. I
2137 tried to switch the profiling to using hotshot, but I'm getting
2149 tried to switch the profiling to using hotshot, but I'm getting
2138 strange errors from prof.runctx() there. I may be misreading the
2150 strange errors from prof.runctx() there. I may be misreading the
2139 docs, but it looks weird. For now the profiling code will
2151 docs, but it looks weird. For now the profiling code will
2140 continue to use the standard profiler.
2152 continue to use the standard profiler.
2141
2153
2142 2004-08-23 Fernando Perez <fperez@colorado.edu>
2154 2004-08-23 Fernando Perez <fperez@colorado.edu>
2143
2155
2144 * IPython/Shell.py (IPShellWX.__init__): Improvements to the WX
2156 * IPython/Shell.py (IPShellWX.__init__): Improvements to the WX
2145 threaded shell, by John Hunter. It's not quite ready yet, but
2157 threaded shell, by John Hunter. It's not quite ready yet, but
2146 close.
2158 close.
2147
2159
2148 2004-08-22 Fernando Perez <fperez@colorado.edu>
2160 2004-08-22 Fernando Perez <fperez@colorado.edu>
2149
2161
2150 * IPython/iplib.py (InteractiveShell.interact): tab cleanups, also
2162 * IPython/iplib.py (InteractiveShell.interact): tab cleanups, also
2151 in Magic and ultraTB.
2163 in Magic and ultraTB.
2152
2164
2153 * ipython.1: document threading options in manpage.
2165 * ipython.1: document threading options in manpage.
2154
2166
2155 * scripts/ipython: Changed name of -thread option to -gthread,
2167 * scripts/ipython: Changed name of -thread option to -gthread,
2156 since this is GTK specific. I want to leave the door open for a
2168 since this is GTK specific. I want to leave the door open for a
2157 -wthread option for WX, which will most likely be necessary. This
2169 -wthread option for WX, which will most likely be necessary. This
2158 change affects usage and ipmaker as well.
2170 change affects usage and ipmaker as well.
2159
2171
2160 * IPython/Shell.py (matplotlib_shell): Add a factory function to
2172 * IPython/Shell.py (matplotlib_shell): Add a factory function to
2161 handle the matplotlib shell issues. Code by John Hunter
2173 handle the matplotlib shell issues. Code by John Hunter
2162 <jdhunter-AT-nitace.bsd.uchicago.edu>.
2174 <jdhunter-AT-nitace.bsd.uchicago.edu>.
2163 (IPShellMatplotlibWX.__init__): Rudimentary WX support. It's
2175 (IPShellMatplotlibWX.__init__): Rudimentary WX support. It's
2164 broken (and disabled for end users) for now, but it puts the
2176 broken (and disabled for end users) for now, but it puts the
2165 infrastructure in place.
2177 infrastructure in place.
2166
2178
2167 2004-08-21 Fernando Perez <fperez@colorado.edu>
2179 2004-08-21 Fernando Perez <fperez@colorado.edu>
2168
2180
2169 * ipythonrc-pylab: Add matplotlib support.
2181 * ipythonrc-pylab: Add matplotlib support.
2170
2182
2171 * matplotlib_config.py: new files for matplotlib support, part of
2183 * matplotlib_config.py: new files for matplotlib support, part of
2172 the pylab profile.
2184 the pylab profile.
2173
2185
2174 * IPython/usage.py (__doc__): documented the threading options.
2186 * IPython/usage.py (__doc__): documented the threading options.
2175
2187
2176 2004-08-20 Fernando Perez <fperez@colorado.edu>
2188 2004-08-20 Fernando Perez <fperez@colorado.edu>
2177
2189
2178 * ipython: Modified the main calling routine to handle the -thread
2190 * ipython: Modified the main calling routine to handle the -thread
2179 and -mpthread options. This needs to be done as a top-level hack,
2191 and -mpthread options. This needs to be done as a top-level hack,
2180 because it determines which class to instantiate for IPython
2192 because it determines which class to instantiate for IPython
2181 itself.
2193 itself.
2182
2194
2183 * IPython/Shell.py (MTInteractiveShell.__init__): New set of
2195 * IPython/Shell.py (MTInteractiveShell.__init__): New set of
2184 classes to support multithreaded GTK operation without blocking,
2196 classes to support multithreaded GTK operation without blocking,
2185 and matplotlib with all backends. This is a lot of still very
2197 and matplotlib with all backends. This is a lot of still very
2186 experimental code, and threads are tricky. So it may still have a
2198 experimental code, and threads are tricky. So it may still have a
2187 few rough edges... This code owes a lot to
2199 few rough edges... This code owes a lot to
2188 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65109, by
2200 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65109, by
2189 Brian # McErlean and John Finlay, to Antoon Pardon for fixes, and
2201 Brian # McErlean and John Finlay, to Antoon Pardon for fixes, and
2190 to John Hunter for all the matplotlib work.
2202 to John Hunter for all the matplotlib work.
2191
2203
2192 * IPython/ipmaker.py (__call__): Added -thread and -mpthread
2204 * IPython/ipmaker.py (__call__): Added -thread and -mpthread
2193 options for gtk thread and matplotlib support.
2205 options for gtk thread and matplotlib support.
2194
2206
2195 2004-08-16 Fernando Perez <fperez@colorado.edu>
2207 2004-08-16 Fernando Perez <fperez@colorado.edu>
2196
2208
2197 * IPython/iplib.py (InteractiveShell.__init__): don't trigger
2209 * IPython/iplib.py (InteractiveShell.__init__): don't trigger
2198 autocall for things like p*q,p/q,p+q,p-q, when p is callable. Bug
2210 autocall for things like p*q,p/q,p+q,p-q, when p is callable. Bug
2199 reported by Stephen Walton <stephen.walton-AT-csun.edu>.
2211 reported by Stephen Walton <stephen.walton-AT-csun.edu>.
2200
2212
2201 2004-08-11 Fernando Perez <fperez@colorado.edu>
2213 2004-08-11 Fernando Perez <fperez@colorado.edu>
2202
2214
2203 * setup.py (isfile): Fix build so documentation gets updated for
2215 * setup.py (isfile): Fix build so documentation gets updated for
2204 rpms (it was only done for .tgz builds).
2216 rpms (it was only done for .tgz builds).
2205
2217
2206 2004-08-10 Fernando Perez <fperez@colorado.edu>
2218 2004-08-10 Fernando Perez <fperez@colorado.edu>
2207
2219
2208 * genutils.py (Term): Fix misspell of stdin stream (sin->cin).
2220 * genutils.py (Term): Fix misspell of stdin stream (sin->cin).
2209
2221
2210 * iplib.py : Silence syntax error exceptions in tab-completion.
2222 * iplib.py : Silence syntax error exceptions in tab-completion.
2211
2223
2212 2004-08-05 Fernando Perez <fperez@colorado.edu>
2224 2004-08-05 Fernando Perez <fperez@colorado.edu>
2213
2225
2214 * IPython/Prompts.py (Prompt2.set_colors): Fix incorrectly set
2226 * IPython/Prompts.py (Prompt2.set_colors): Fix incorrectly set
2215 'color off' mark for continuation prompts. This was causing long
2227 'color off' mark for continuation prompts. This was causing long
2216 continuation lines to mis-wrap.
2228 continuation lines to mis-wrap.
2217
2229
2218 2004-08-01 Fernando Perez <fperez@colorado.edu>
2230 2004-08-01 Fernando Perez <fperez@colorado.edu>
2219
2231
2220 * IPython/ipmaker.py (make_IPython): Allow the shell class used
2232 * IPython/ipmaker.py (make_IPython): Allow the shell class used
2221 for building ipython to be a parameter. All this is necessary
2233 for building ipython to be a parameter. All this is necessary
2222 right now to have a multithreaded version, but this insane
2234 right now to have a multithreaded version, but this insane
2223 non-design will be cleaned up soon. For now, it's a hack that
2235 non-design will be cleaned up soon. For now, it's a hack that
2224 works.
2236 works.
2225
2237
2226 * IPython/Shell.py (IPShell.__init__): Stop using mutable default
2238 * IPython/Shell.py (IPShell.__init__): Stop using mutable default
2227 args in various places. No bugs so far, but it's a dangerous
2239 args in various places. No bugs so far, but it's a dangerous
2228 practice.
2240 practice.
2229
2241
2230 2004-07-31 Fernando Perez <fperez@colorado.edu>
2242 2004-07-31 Fernando Perez <fperez@colorado.edu>
2231
2243
2232 * IPython/iplib.py (complete): ignore SyntaxError exceptions to
2244 * IPython/iplib.py (complete): ignore SyntaxError exceptions to
2233 fix completion of files with dots in their names under most
2245 fix completion of files with dots in their names under most
2234 profiles (pysh was OK because the completion order is different).
2246 profiles (pysh was OK because the completion order is different).
2235
2247
2236 2004-07-27 Fernando Perez <fperez@colorado.edu>
2248 2004-07-27 Fernando Perez <fperez@colorado.edu>
2237
2249
2238 * IPython/iplib.py (InteractiveShell.__init__): build dict of
2250 * IPython/iplib.py (InteractiveShell.__init__): build dict of
2239 keywords manually, b/c the one in keyword.py was removed in python
2251 keywords manually, b/c the one in keyword.py was removed in python
2240 2.4. Patch by Anakim Border <aborder-AT-users.sourceforge.net>.
2252 2.4. Patch by Anakim Border <aborder-AT-users.sourceforge.net>.
2241 This is NOT a bug under python 2.3 and earlier.
2253 This is NOT a bug under python 2.3 and earlier.
2242
2254
2243 2004-07-26 Fernando Perez <fperez@colorado.edu>
2255 2004-07-26 Fernando Perez <fperez@colorado.edu>
2244
2256
2245 * IPython/ultraTB.py (VerboseTB.text): Add another
2257 * IPython/ultraTB.py (VerboseTB.text): Add another
2246 linecache.checkcache() call to try to prevent inspect.py from
2258 linecache.checkcache() call to try to prevent inspect.py from
2247 crashing under python 2.3. I think this fixes
2259 crashing under python 2.3. I think this fixes
2248 http://www.scipy.net/roundup/ipython/issue17.
2260 http://www.scipy.net/roundup/ipython/issue17.
2249
2261
2250 2004-07-26 *** Released version 0.6.2
2262 2004-07-26 *** Released version 0.6.2
2251
2263
2252 2004-07-26 Fernando Perez <fperez@colorado.edu>
2264 2004-07-26 Fernando Perez <fperez@colorado.edu>
2253
2265
2254 * IPython/Magic.py (Magic.magic_cd): Fix bug where 'cd -N' would
2266 * IPython/Magic.py (Magic.magic_cd): Fix bug where 'cd -N' would
2255 fail for any number.
2267 fail for any number.
2256 (Magic.magic_bookmark): Fix bug where 'bookmark -l' would fail for
2268 (Magic.magic_bookmark): Fix bug where 'bookmark -l' would fail for
2257 empty bookmarks.
2269 empty bookmarks.
2258
2270
2259 2004-07-26 *** Released version 0.6.1
2271 2004-07-26 *** Released version 0.6.1
2260
2272
2261 2004-07-26 Fernando Perez <fperez@colorado.edu>
2273 2004-07-26 Fernando Perez <fperez@colorado.edu>
2262
2274
2263 * ipython_win_post_install.py (run): Added pysh shortcut for Windows.
2275 * ipython_win_post_install.py (run): Added pysh shortcut for Windows.
2264
2276
2265 * IPython/iplib.py (protect_filename): Applied Ville's patch for
2277 * IPython/iplib.py (protect_filename): Applied Ville's patch for
2266 escaping '()[]{}' in filenames.
2278 escaping '()[]{}' in filenames.
2267
2279
2268 * IPython/Magic.py (shlex_split): Fix handling of '*' and '?' for
2280 * IPython/Magic.py (shlex_split): Fix handling of '*' and '?' for
2269 Python 2.2 users who lack a proper shlex.split.
2281 Python 2.2 users who lack a proper shlex.split.
2270
2282
2271 2004-07-19 Fernando Perez <fperez@colorado.edu>
2283 2004-07-19 Fernando Perez <fperez@colorado.edu>
2272
2284
2273 * IPython/iplib.py (InteractiveShell.init_readline): Add support
2285 * IPython/iplib.py (InteractiveShell.init_readline): Add support
2274 for reading readline's init file. I follow the normal chain:
2286 for reading readline's init file. I follow the normal chain:
2275 $INPUTRC is honored, otherwise ~/.inputrc is used. Thanks to a
2287 $INPUTRC is honored, otherwise ~/.inputrc is used. Thanks to a
2276 report by Mike Heeter. This closes
2288 report by Mike Heeter. This closes
2277 http://www.scipy.net/roundup/ipython/issue16.
2289 http://www.scipy.net/roundup/ipython/issue16.
2278
2290
2279 2004-07-18 Fernando Perez <fperez@colorado.edu>
2291 2004-07-18 Fernando Perez <fperez@colorado.edu>
2280
2292
2281 * IPython/iplib.py (__init__): Add better handling of '\' under
2293 * IPython/iplib.py (__init__): Add better handling of '\' under
2282 Win32 for filenames. After a patch by Ville.
2294 Win32 for filenames. After a patch by Ville.
2283
2295
2284 2004-07-17 Fernando Perez <fperez@colorado.edu>
2296 2004-07-17 Fernando Perez <fperez@colorado.edu>
2285
2297
2286 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
2298 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
2287 autocalling would be triggered for 'foo is bar' if foo is
2299 autocalling would be triggered for 'foo is bar' if foo is
2288 callable. I also cleaned up the autocall detection code to use a
2300 callable. I also cleaned up the autocall detection code to use a
2289 regexp, which is faster. Bug reported by Alexander Schmolck.
2301 regexp, which is faster. Bug reported by Alexander Schmolck.
2290
2302
2291 * IPython/Magic.py (Magic.magic_pinfo): Fix bug where strings with
2303 * IPython/Magic.py (Magic.magic_pinfo): Fix bug where strings with
2292 '?' in them would confuse the help system. Reported by Alex
2304 '?' in them would confuse the help system. Reported by Alex
2293 Schmolck.
2305 Schmolck.
2294
2306
2295 2004-07-16 Fernando Perez <fperez@colorado.edu>
2307 2004-07-16 Fernando Perez <fperez@colorado.edu>
2296
2308
2297 * IPython/GnuplotInteractive.py (__all__): added plot2.
2309 * IPython/GnuplotInteractive.py (__all__): added plot2.
2298
2310
2299 * IPython/Gnuplot2.py (Gnuplot.plot2): added new function for
2311 * IPython/Gnuplot2.py (Gnuplot.plot2): added new function for
2300 plotting dictionaries, lists or tuples of 1d arrays.
2312 plotting dictionaries, lists or tuples of 1d arrays.
2301
2313
2302 * IPython/Magic.py (Magic.magic_hist): small clenaups and
2314 * IPython/Magic.py (Magic.magic_hist): small clenaups and
2303 optimizations.
2315 optimizations.
2304
2316
2305 * IPython/iplib.py:Remove old Changelog info for cleanup. This is
2317 * IPython/iplib.py:Remove old Changelog info for cleanup. This is
2306 the information which was there from Janko's original IPP code:
2318 the information which was there from Janko's original IPP code:
2307
2319
2308 03.05.99 20:53 porto.ifm.uni-kiel.de
2320 03.05.99 20:53 porto.ifm.uni-kiel.de
2309 --Started changelog.
2321 --Started changelog.
2310 --make clear do what it say it does
2322 --make clear do what it say it does
2311 --added pretty output of lines from inputcache
2323 --added pretty output of lines from inputcache
2312 --Made Logger a mixin class, simplifies handling of switches
2324 --Made Logger a mixin class, simplifies handling of switches
2313 --Added own completer class. .string<TAB> expands to last history
2325 --Added own completer class. .string<TAB> expands to last history
2314 line which starts with string. The new expansion is also present
2326 line which starts with string. The new expansion is also present
2315 with Ctrl-r from the readline library. But this shows, who this
2327 with Ctrl-r from the readline library. But this shows, who this
2316 can be done for other cases.
2328 can be done for other cases.
2317 --Added convention that all shell functions should accept a
2329 --Added convention that all shell functions should accept a
2318 parameter_string This opens the door for different behaviour for
2330 parameter_string This opens the door for different behaviour for
2319 each function. @cd is a good example of this.
2331 each function. @cd is a good example of this.
2320
2332
2321 04.05.99 12:12 porto.ifm.uni-kiel.de
2333 04.05.99 12:12 porto.ifm.uni-kiel.de
2322 --added logfile rotation
2334 --added logfile rotation
2323 --added new mainloop method which freezes first the namespace
2335 --added new mainloop method which freezes first the namespace
2324
2336
2325 07.05.99 21:24 porto.ifm.uni-kiel.de
2337 07.05.99 21:24 porto.ifm.uni-kiel.de
2326 --added the docreader classes. Now there is a help system.
2338 --added the docreader classes. Now there is a help system.
2327 -This is only a first try. Currently it's not easy to put new
2339 -This is only a first try. Currently it's not easy to put new
2328 stuff in the indices. But this is the way to go. Info would be
2340 stuff in the indices. But this is the way to go. Info would be
2329 better, but HTML is every where and not everybody has an info
2341 better, but HTML is every where and not everybody has an info
2330 system installed and it's not so easy to change html-docs to info.
2342 system installed and it's not so easy to change html-docs to info.
2331 --added global logfile option
2343 --added global logfile option
2332 --there is now a hook for object inspection method pinfo needs to
2344 --there is now a hook for object inspection method pinfo needs to
2333 be provided for this. Can be reached by two '??'.
2345 be provided for this. Can be reached by two '??'.
2334
2346
2335 08.05.99 20:51 porto.ifm.uni-kiel.de
2347 08.05.99 20:51 porto.ifm.uni-kiel.de
2336 --added a README
2348 --added a README
2337 --bug in rc file. Something has changed so functions in the rc
2349 --bug in rc file. Something has changed so functions in the rc
2338 file need to reference the shell and not self. Not clear if it's a
2350 file need to reference the shell and not self. Not clear if it's a
2339 bug or feature.
2351 bug or feature.
2340 --changed rc file for new behavior
2352 --changed rc file for new behavior
2341
2353
2342 2004-07-15 Fernando Perez <fperez@colorado.edu>
2354 2004-07-15 Fernando Perez <fperez@colorado.edu>
2343
2355
2344 * IPython/Logger.py (Logger.log): fixed recent bug where the input
2356 * IPython/Logger.py (Logger.log): fixed recent bug where the input
2345 cache was falling out of sync in bizarre manners when multi-line
2357 cache was falling out of sync in bizarre manners when multi-line
2346 input was present. Minor optimizations and cleanup.
2358 input was present. Minor optimizations and cleanup.
2347
2359
2348 (Logger): Remove old Changelog info for cleanup. This is the
2360 (Logger): Remove old Changelog info for cleanup. This is the
2349 information which was there from Janko's original code:
2361 information which was there from Janko's original code:
2350
2362
2351 Changes to Logger: - made the default log filename a parameter
2363 Changes to Logger: - made the default log filename a parameter
2352
2364
2353 - put a check for lines beginning with !@? in log(). Needed
2365 - put a check for lines beginning with !@? in log(). Needed
2354 (even if the handlers properly log their lines) for mid-session
2366 (even if the handlers properly log their lines) for mid-session
2355 logging activation to work properly. Without this, lines logged
2367 logging activation to work properly. Without this, lines logged
2356 in mid session, which get read from the cache, would end up
2368 in mid session, which get read from the cache, would end up
2357 'bare' (with !@? in the open) in the log. Now they are caught
2369 'bare' (with !@? in the open) in the log. Now they are caught
2358 and prepended with a #.
2370 and prepended with a #.
2359
2371
2360 * IPython/iplib.py (InteractiveShell.init_readline): added check
2372 * IPython/iplib.py (InteractiveShell.init_readline): added check
2361 in case MagicCompleter fails to be defined, so we don't crash.
2373 in case MagicCompleter fails to be defined, so we don't crash.
2362
2374
2363 2004-07-13 Fernando Perez <fperez@colorado.edu>
2375 2004-07-13 Fernando Perez <fperez@colorado.edu>
2364
2376
2365 * IPython/Gnuplot2.py (Gnuplot.hardcopy): add automatic generation
2377 * IPython/Gnuplot2.py (Gnuplot.hardcopy): add automatic generation
2366 of EPS if the requested filename ends in '.eps'.
2378 of EPS if the requested filename ends in '.eps'.
2367
2379
2368 2004-07-04 Fernando Perez <fperez@colorado.edu>
2380 2004-07-04 Fernando Perez <fperez@colorado.edu>
2369
2381
2370 * IPython/iplib.py (InteractiveShell.handle_shell_escape): Fix
2382 * IPython/iplib.py (InteractiveShell.handle_shell_escape): Fix
2371 escaping of quotes when calling the shell.
2383 escaping of quotes when calling the shell.
2372
2384
2373 2004-07-02 Fernando Perez <fperez@colorado.edu>
2385 2004-07-02 Fernando Perez <fperez@colorado.edu>
2374
2386
2375 * IPython/Prompts.py (CachedOutput.update): Fix problem with
2387 * IPython/Prompts.py (CachedOutput.update): Fix problem with
2376 gettext not working because we were clobbering '_'. Fixes
2388 gettext not working because we were clobbering '_'. Fixes
2377 http://www.scipy.net/roundup/ipython/issue6.
2389 http://www.scipy.net/roundup/ipython/issue6.
2378
2390
2379 2004-07-01 Fernando Perez <fperez@colorado.edu>
2391 2004-07-01 Fernando Perez <fperez@colorado.edu>
2380
2392
2381 * IPython/Magic.py (Magic.magic_cd): integrated bookmark handling
2393 * IPython/Magic.py (Magic.magic_cd): integrated bookmark handling
2382 into @cd. Patch by Ville.
2394 into @cd. Patch by Ville.
2383
2395
2384 * IPython/iplib.py (InteractiveShell.post_config_initialization):
2396 * IPython/iplib.py (InteractiveShell.post_config_initialization):
2385 new function to store things after ipmaker runs. Patch by Ville.
2397 new function to store things after ipmaker runs. Patch by Ville.
2386 Eventually this will go away once ipmaker is removed and the class
2398 Eventually this will go away once ipmaker is removed and the class
2387 gets cleaned up, but for now it's ok. Key functionality here is
2399 gets cleaned up, but for now it's ok. Key functionality here is
2388 the addition of the persistent storage mechanism, a dict for
2400 the addition of the persistent storage mechanism, a dict for
2389 keeping data across sessions (for now just bookmarks, but more can
2401 keeping data across sessions (for now just bookmarks, but more can
2390 be implemented later).
2402 be implemented later).
2391
2403
2392 * IPython/Magic.py (Magic.magic_bookmark): New bookmark system,
2404 * IPython/Magic.py (Magic.magic_bookmark): New bookmark system,
2393 persistent across sections. Patch by Ville, I modified it
2405 persistent across sections. Patch by Ville, I modified it
2394 soemwhat to allow bookmarking arbitrary dirs other than CWD. Also
2406 soemwhat to allow bookmarking arbitrary dirs other than CWD. Also
2395 added a '-l' option to list all bookmarks.
2407 added a '-l' option to list all bookmarks.
2396
2408
2397 * IPython/iplib.py (InteractiveShell.atexit_operations): new
2409 * IPython/iplib.py (InteractiveShell.atexit_operations): new
2398 center for cleanup. Registered with atexit.register(). I moved
2410 center for cleanup. Registered with atexit.register(). I moved
2399 here the old exit_cleanup(). After a patch by Ville.
2411 here the old exit_cleanup(). After a patch by Ville.
2400
2412
2401 * IPython/Magic.py (get_py_filename): added '~' to the accepted
2413 * IPython/Magic.py (get_py_filename): added '~' to the accepted
2402 characters in the hacked shlex_split for python 2.2.
2414 characters in the hacked shlex_split for python 2.2.
2403
2415
2404 * IPython/iplib.py (file_matches): more fixes to filenames with
2416 * IPython/iplib.py (file_matches): more fixes to filenames with
2405 whitespace in them. It's not perfect, but limitations in python's
2417 whitespace in them. It's not perfect, but limitations in python's
2406 readline make it impossible to go further.
2418 readline make it impossible to go further.
2407
2419
2408 2004-06-29 Fernando Perez <fperez@colorado.edu>
2420 2004-06-29 Fernando Perez <fperez@colorado.edu>
2409
2421
2410 * IPython/iplib.py (file_matches): escape whitespace correctly in
2422 * IPython/iplib.py (file_matches): escape whitespace correctly in
2411 filename completions. Bug reported by Ville.
2423 filename completions. Bug reported by Ville.
2412
2424
2413 2004-06-28 Fernando Perez <fperez@colorado.edu>
2425 2004-06-28 Fernando Perez <fperez@colorado.edu>
2414
2426
2415 * IPython/ipmaker.py (__call__): Added per-profile histories. Now
2427 * IPython/ipmaker.py (__call__): Added per-profile histories. Now
2416 the history file will be called 'history-PROFNAME' (or just
2428 the history file will be called 'history-PROFNAME' (or just
2417 'history' if no profile is loaded). I was getting annoyed at
2429 'history' if no profile is loaded). I was getting annoyed at
2418 getting my Numerical work history clobbered by pysh sessions.
2430 getting my Numerical work history clobbered by pysh sessions.
2419
2431
2420 * IPython/iplib.py (InteractiveShell.__init__): Internal
2432 * IPython/iplib.py (InteractiveShell.__init__): Internal
2421 getoutputerror() function so that we can honor the system_verbose
2433 getoutputerror() function so that we can honor the system_verbose
2422 flag for _all_ system calls. I also added escaping of #
2434 flag for _all_ system calls. I also added escaping of #
2423 characters here to avoid confusing Itpl.
2435 characters here to avoid confusing Itpl.
2424
2436
2425 * IPython/Magic.py (shlex_split): removed call to shell in
2437 * IPython/Magic.py (shlex_split): removed call to shell in
2426 parse_options and replaced it with shlex.split(). The annoying
2438 parse_options and replaced it with shlex.split(). The annoying
2427 part was that in Python 2.2, shlex.split() doesn't exist, so I had
2439 part was that in Python 2.2, shlex.split() doesn't exist, so I had
2428 to backport it from 2.3, with several frail hacks (the shlex
2440 to backport it from 2.3, with several frail hacks (the shlex
2429 module is rather limited in 2.2). Thanks to a suggestion by Ville
2441 module is rather limited in 2.2). Thanks to a suggestion by Ville
2430 Vainio <vivainio@kolumbus.fi>. For Python 2.3 there should be no
2442 Vainio <vivainio@kolumbus.fi>. For Python 2.3 there should be no
2431 problem.
2443 problem.
2432
2444
2433 (Magic.magic_system_verbose): new toggle to print the actual
2445 (Magic.magic_system_verbose): new toggle to print the actual
2434 system calls made by ipython. Mainly for debugging purposes.
2446 system calls made by ipython. Mainly for debugging purposes.
2435
2447
2436 * IPython/GnuplotRuntime.py (gnu_out): fix bug for cygwin, which
2448 * IPython/GnuplotRuntime.py (gnu_out): fix bug for cygwin, which
2437 doesn't support persistence. Reported (and fix suggested) by
2449 doesn't support persistence. Reported (and fix suggested) by
2438 Travis Caldwell <travis_caldwell2000@yahoo.com>.
2450 Travis Caldwell <travis_caldwell2000@yahoo.com>.
2439
2451
2440 2004-06-26 Fernando Perez <fperez@colorado.edu>
2452 2004-06-26 Fernando Perez <fperez@colorado.edu>
2441
2453
2442 * IPython/Logger.py (Logger.log): fix to handle correctly empty
2454 * IPython/Logger.py (Logger.log): fix to handle correctly empty
2443 continue prompts.
2455 continue prompts.
2444
2456
2445 * IPython/Extensions/InterpreterExec.py (pysh): moved the pysh()
2457 * IPython/Extensions/InterpreterExec.py (pysh): moved the pysh()
2446 function (basically a big docstring) and a few more things here to
2458 function (basically a big docstring) and a few more things here to
2447 speedup startup. pysh.py is now very lightweight. We want because
2459 speedup startup. pysh.py is now very lightweight. We want because
2448 it gets execfile'd, while InterpreterExec gets imported, so
2460 it gets execfile'd, while InterpreterExec gets imported, so
2449 byte-compilation saves time.
2461 byte-compilation saves time.
2450
2462
2451 2004-06-25 Fernando Perez <fperez@colorado.edu>
2463 2004-06-25 Fernando Perez <fperez@colorado.edu>
2452
2464
2453 * IPython/Magic.py (Magic.magic_cd): Fixed to restore usage of 'cd
2465 * IPython/Magic.py (Magic.magic_cd): Fixed to restore usage of 'cd
2454 -NUM', which was recently broken.
2466 -NUM', which was recently broken.
2455
2467
2456 * IPython/iplib.py (InteractiveShell.handle_shell_escape): allow !
2468 * IPython/iplib.py (InteractiveShell.handle_shell_escape): allow !
2457 in multi-line input (but not !!, which doesn't make sense there).
2469 in multi-line input (but not !!, which doesn't make sense there).
2458
2470
2459 * IPython/UserConfig/ipythonrc: made autoindent on by default.
2471 * IPython/UserConfig/ipythonrc: made autoindent on by default.
2460 It's just too useful, and people can turn it off in the less
2472 It's just too useful, and people can turn it off in the less
2461 common cases where it's a problem.
2473 common cases where it's a problem.
2462
2474
2463 2004-06-24 Fernando Perez <fperez@colorado.edu>
2475 2004-06-24 Fernando Perez <fperez@colorado.edu>
2464
2476
2465 * IPython/iplib.py (InteractiveShell._prefilter): big change -
2477 * IPython/iplib.py (InteractiveShell._prefilter): big change -
2466 special syntaxes (like alias calling) is now allied in multi-line
2478 special syntaxes (like alias calling) is now allied in multi-line
2467 input. This is still _very_ experimental, but it's necessary for
2479 input. This is still _very_ experimental, but it's necessary for
2468 efficient shell usage combining python looping syntax with system
2480 efficient shell usage combining python looping syntax with system
2469 calls. For now it's restricted to aliases, I don't think it
2481 calls. For now it's restricted to aliases, I don't think it
2470 really even makes sense to have this for magics.
2482 really even makes sense to have this for magics.
2471
2483
2472 2004-06-23 Fernando Perez <fperez@colorado.edu>
2484 2004-06-23 Fernando Perez <fperez@colorado.edu>
2473
2485
2474 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Added
2486 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Added
2475 $var=cmd <=> @sc var=cmd and $$var=cmd <=> @sc -l var=cmd.
2487 $var=cmd <=> @sc var=cmd and $$var=cmd <=> @sc -l var=cmd.
2476
2488
2477 * IPython/Magic.py (Magic.magic_rehashx): modified to handle
2489 * IPython/Magic.py (Magic.magic_rehashx): modified to handle
2478 extensions under Windows (after code sent by Gary Bishop). The
2490 extensions under Windows (after code sent by Gary Bishop). The
2479 extensions considered 'executable' are stored in IPython's rc
2491 extensions considered 'executable' are stored in IPython's rc
2480 structure as win_exec_ext.
2492 structure as win_exec_ext.
2481
2493
2482 * IPython/genutils.py (shell): new function, like system() but
2494 * IPython/genutils.py (shell): new function, like system() but
2483 without return value. Very useful for interactive shell work.
2495 without return value. Very useful for interactive shell work.
2484
2496
2485 * IPython/Magic.py (Magic.magic_unalias): New @unalias function to
2497 * IPython/Magic.py (Magic.magic_unalias): New @unalias function to
2486 delete aliases.
2498 delete aliases.
2487
2499
2488 * IPython/iplib.py (InteractiveShell.alias_table_update): make
2500 * IPython/iplib.py (InteractiveShell.alias_table_update): make
2489 sure that the alias table doesn't contain python keywords.
2501 sure that the alias table doesn't contain python keywords.
2490
2502
2491 2004-06-21 Fernando Perez <fperez@colorado.edu>
2503 2004-06-21 Fernando Perez <fperez@colorado.edu>
2492
2504
2493 * IPython/Magic.py (Magic.magic_rehash): Fix crash when
2505 * IPython/Magic.py (Magic.magic_rehash): Fix crash when
2494 non-existent items are found in $PATH. Reported by Thorsten.
2506 non-existent items are found in $PATH. Reported by Thorsten.
2495
2507
2496 2004-06-20 Fernando Perez <fperez@colorado.edu>
2508 2004-06-20 Fernando Perez <fperez@colorado.edu>
2497
2509
2498 * IPython/iplib.py (complete): modified the completer so that the
2510 * IPython/iplib.py (complete): modified the completer so that the
2499 order of priorities can be easily changed at runtime.
2511 order of priorities can be easily changed at runtime.
2500
2512
2501 * IPython/Extensions/InterpreterExec.py (prefilter_shell):
2513 * IPython/Extensions/InterpreterExec.py (prefilter_shell):
2502 Modified to auto-execute all lines beginning with '~', '/' or '.'.
2514 Modified to auto-execute all lines beginning with '~', '/' or '.'.
2503
2515
2504 * IPython/Magic.py (Magic.magic_sx): modified @sc and @sx to
2516 * IPython/Magic.py (Magic.magic_sx): modified @sc and @sx to
2505 expand Python variables prepended with $ in all system calls. The
2517 expand Python variables prepended with $ in all system calls. The
2506 same was done to InteractiveShell.handle_shell_escape. Now all
2518 same was done to InteractiveShell.handle_shell_escape. Now all
2507 system access mechanisms (!, !!, @sc, @sx and aliases) allow the
2519 system access mechanisms (!, !!, @sc, @sx and aliases) allow the
2508 expansion of python variables and expressions according to the
2520 expansion of python variables and expressions according to the
2509 syntax of PEP-215 - http://www.python.org/peps/pep-0215.html.
2521 syntax of PEP-215 - http://www.python.org/peps/pep-0215.html.
2510
2522
2511 Though PEP-215 has been rejected, a similar (but simpler) one
2523 Though PEP-215 has been rejected, a similar (but simpler) one
2512 seems like it will go into Python 2.4, PEP-292 -
2524 seems like it will go into Python 2.4, PEP-292 -
2513 http://www.python.org/peps/pep-0292.html.
2525 http://www.python.org/peps/pep-0292.html.
2514
2526
2515 I'll keep the full syntax of PEP-215, since IPython has since the
2527 I'll keep the full syntax of PEP-215, since IPython has since the
2516 start used Ka-Ping Yee's reference implementation discussed there
2528 start used Ka-Ping Yee's reference implementation discussed there
2517 (Itpl), and I actually like the powerful semantics it offers.
2529 (Itpl), and I actually like the powerful semantics it offers.
2518
2530
2519 In order to access normal shell variables, the $ has to be escaped
2531 In order to access normal shell variables, the $ has to be escaped
2520 via an extra $. For example:
2532 via an extra $. For example:
2521
2533
2522 In [7]: PATH='a python variable'
2534 In [7]: PATH='a python variable'
2523
2535
2524 In [8]: !echo $PATH
2536 In [8]: !echo $PATH
2525 a python variable
2537 a python variable
2526
2538
2527 In [9]: !echo $$PATH
2539 In [9]: !echo $$PATH
2528 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
2540 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
2529
2541
2530 (Magic.parse_options): escape $ so the shell doesn't evaluate
2542 (Magic.parse_options): escape $ so the shell doesn't evaluate
2531 things prematurely.
2543 things prematurely.
2532
2544
2533 * IPython/iplib.py (InteractiveShell.call_alias): added the
2545 * IPython/iplib.py (InteractiveShell.call_alias): added the
2534 ability for aliases to expand python variables via $.
2546 ability for aliases to expand python variables via $.
2535
2547
2536 * IPython/Magic.py (Magic.magic_rehash): based on the new alias
2548 * IPython/Magic.py (Magic.magic_rehash): based on the new alias
2537 system, now there's a @rehash/@rehashx pair of magics. These work
2549 system, now there's a @rehash/@rehashx pair of magics. These work
2538 like the csh rehash command, and can be invoked at any time. They
2550 like the csh rehash command, and can be invoked at any time. They
2539 build a table of aliases to everything in the user's $PATH
2551 build a table of aliases to everything in the user's $PATH
2540 (@rehash uses everything, @rehashx is slower but only adds
2552 (@rehash uses everything, @rehashx is slower but only adds
2541 executable files). With this, the pysh.py-based shell profile can
2553 executable files). With this, the pysh.py-based shell profile can
2542 now simply call rehash upon startup, and full access to all
2554 now simply call rehash upon startup, and full access to all
2543 programs in the user's path is obtained.
2555 programs in the user's path is obtained.
2544
2556
2545 * IPython/iplib.py (InteractiveShell.call_alias): The new alias
2557 * IPython/iplib.py (InteractiveShell.call_alias): The new alias
2546 functionality is now fully in place. I removed the old dynamic
2558 functionality is now fully in place. I removed the old dynamic
2547 code generation based approach, in favor of a much lighter one
2559 code generation based approach, in favor of a much lighter one
2548 based on a simple dict. The advantage is that this allows me to
2560 based on a simple dict. The advantage is that this allows me to
2549 now have thousands of aliases with negligible cost (unthinkable
2561 now have thousands of aliases with negligible cost (unthinkable
2550 with the old system).
2562 with the old system).
2551
2563
2552 2004-06-19 Fernando Perez <fperez@colorado.edu>
2564 2004-06-19 Fernando Perez <fperez@colorado.edu>
2553
2565
2554 * IPython/iplib.py (__init__): extended MagicCompleter class to
2566 * IPython/iplib.py (__init__): extended MagicCompleter class to
2555 also complete (last in priority) on user aliases.
2567 also complete (last in priority) on user aliases.
2556
2568
2557 * IPython/Itpl.py (Itpl.__str__): fixed order of globals/locals in
2569 * IPython/Itpl.py (Itpl.__str__): fixed order of globals/locals in
2558 call to eval.
2570 call to eval.
2559 (ItplNS.__init__): Added a new class which functions like Itpl,
2571 (ItplNS.__init__): Added a new class which functions like Itpl,
2560 but allows configuring the namespace for the evaluation to occur
2572 but allows configuring the namespace for the evaluation to occur
2561 in.
2573 in.
2562
2574
2563 2004-06-18 Fernando Perez <fperez@colorado.edu>
2575 2004-06-18 Fernando Perez <fperez@colorado.edu>
2564
2576
2565 * IPython/iplib.py (InteractiveShell.runcode): modify to print a
2577 * IPython/iplib.py (InteractiveShell.runcode): modify to print a
2566 better message when 'exit' or 'quit' are typed (a common newbie
2578 better message when 'exit' or 'quit' are typed (a common newbie
2567 confusion).
2579 confusion).
2568
2580
2569 * IPython/Magic.py (Magic.magic_colors): Added the runtime color
2581 * IPython/Magic.py (Magic.magic_colors): Added the runtime color
2570 check for Windows users.
2582 check for Windows users.
2571
2583
2572 * IPython/iplib.py (InteractiveShell.user_setup): removed
2584 * IPython/iplib.py (InteractiveShell.user_setup): removed
2573 disabling of colors for Windows. I'll test at runtime and issue a
2585 disabling of colors for Windows. I'll test at runtime and issue a
2574 warning if Gary's readline isn't found, as to nudge users to
2586 warning if Gary's readline isn't found, as to nudge users to
2575 download it.
2587 download it.
2576
2588
2577 2004-06-16 Fernando Perez <fperez@colorado.edu>
2589 2004-06-16 Fernando Perez <fperez@colorado.edu>
2578
2590
2579 * IPython/genutils.py (Stream.__init__): changed to print errors
2591 * IPython/genutils.py (Stream.__init__): changed to print errors
2580 to sys.stderr. I had a circular dependency here. Now it's
2592 to sys.stderr. I had a circular dependency here. Now it's
2581 possible to run ipython as IDLE's shell (consider this pre-alpha,
2593 possible to run ipython as IDLE's shell (consider this pre-alpha,
2582 since true stdout things end up in the starting terminal instead
2594 since true stdout things end up in the starting terminal instead
2583 of IDLE's out).
2595 of IDLE's out).
2584
2596
2585 * IPython/Prompts.py (Prompt2.set_colors): prevent crashes for
2597 * IPython/Prompts.py (Prompt2.set_colors): prevent crashes for
2586 users who haven't # updated their prompt_in2 definitions. Remove
2598 users who haven't # updated their prompt_in2 definitions. Remove
2587 eventually.
2599 eventually.
2588 (multiple_replace): added credit to original ASPN recipe.
2600 (multiple_replace): added credit to original ASPN recipe.
2589
2601
2590 2004-06-15 Fernando Perez <fperez@colorado.edu>
2602 2004-06-15 Fernando Perez <fperez@colorado.edu>
2591
2603
2592 * IPython/iplib.py (InteractiveShell.__init__): add 'cp' to the
2604 * IPython/iplib.py (InteractiveShell.__init__): add 'cp' to the
2593 list of auto-defined aliases.
2605 list of auto-defined aliases.
2594
2606
2595 2004-06-13 Fernando Perez <fperez@colorado.edu>
2607 2004-06-13 Fernando Perez <fperez@colorado.edu>
2596
2608
2597 * setup.py (scriptfiles): Don't trigger win_post_install unless an
2609 * setup.py (scriptfiles): Don't trigger win_post_install unless an
2598 install was really requested (so setup.py can be used for other
2610 install was really requested (so setup.py can be used for other
2599 things under Windows).
2611 things under Windows).
2600
2612
2601 2004-06-10 Fernando Perez <fperez@colorado.edu>
2613 2004-06-10 Fernando Perez <fperez@colorado.edu>
2602
2614
2603 * IPython/Logger.py (Logger.create_log): Manually remove any old
2615 * IPython/Logger.py (Logger.create_log): Manually remove any old
2604 backup, since os.remove may fail under Windows. Fixes bug
2616 backup, since os.remove may fail under Windows. Fixes bug
2605 reported by Thorsten.
2617 reported by Thorsten.
2606
2618
2607 2004-06-09 Fernando Perez <fperez@colorado.edu>
2619 2004-06-09 Fernando Perez <fperez@colorado.edu>
2608
2620
2609 * examples/example-embed.py: fixed all references to %n (replaced
2621 * examples/example-embed.py: fixed all references to %n (replaced
2610 with \\# for ps1/out prompts and with \\D for ps2 prompts). Done
2622 with \\# for ps1/out prompts and with \\D for ps2 prompts). Done
2611 for all examples and the manual as well.
2623 for all examples and the manual as well.
2612
2624
2613 2004-06-08 Fernando Perez <fperez@colorado.edu>
2625 2004-06-08 Fernando Perez <fperez@colorado.edu>
2614
2626
2615 * IPython/Prompts.py (Prompt2.set_p_str): fixed all prompt
2627 * IPython/Prompts.py (Prompt2.set_p_str): fixed all prompt
2616 alignment and color management. All 3 prompt subsystems now
2628 alignment and color management. All 3 prompt subsystems now
2617 inherit from BasePrompt.
2629 inherit from BasePrompt.
2618
2630
2619 * tools/release: updates for windows installer build and tag rpms
2631 * tools/release: updates for windows installer build and tag rpms
2620 with python version (since paths are fixed).
2632 with python version (since paths are fixed).
2621
2633
2622 * IPython/UserConfig/ipythonrc: modified to use \# instead of %n,
2634 * IPython/UserConfig/ipythonrc: modified to use \# instead of %n,
2623 which will become eventually obsolete. Also fixed the default
2635 which will become eventually obsolete. Also fixed the default
2624 prompt_in2 to use \D, so at least new users start with the correct
2636 prompt_in2 to use \D, so at least new users start with the correct
2625 defaults.
2637 defaults.
2626 WARNING: Users with existing ipythonrc files will need to apply
2638 WARNING: Users with existing ipythonrc files will need to apply
2627 this fix manually!
2639 this fix manually!
2628
2640
2629 * setup.py: make windows installer (.exe). This is finally the
2641 * setup.py: make windows installer (.exe). This is finally the
2630 integration of an old patch by Cory Dodt <dodt-AT-fcoe.k12.ca.us>,
2642 integration of an old patch by Cory Dodt <dodt-AT-fcoe.k12.ca.us>,
2631 which I hadn't included because it required Python 2.3 (or recent
2643 which I hadn't included because it required Python 2.3 (or recent
2632 distutils).
2644 distutils).
2633
2645
2634 * IPython/usage.py (__doc__): update docs (and manpage) to reflect
2646 * IPython/usage.py (__doc__): update docs (and manpage) to reflect
2635 usage of new '\D' escape.
2647 usage of new '\D' escape.
2636
2648
2637 * IPython/Prompts.py (ROOT_SYMBOL): Small fix for Windows (which
2649 * IPython/Prompts.py (ROOT_SYMBOL): Small fix for Windows (which
2638 lacks os.getuid())
2650 lacks os.getuid())
2639 (CachedOutput.set_colors): Added the ability to turn coloring
2651 (CachedOutput.set_colors): Added the ability to turn coloring
2640 on/off with @colors even for manually defined prompt colors. It
2652 on/off with @colors even for manually defined prompt colors. It
2641 uses a nasty global, but it works safely and via the generic color
2653 uses a nasty global, but it works safely and via the generic color
2642 handling mechanism.
2654 handling mechanism.
2643 (Prompt2.__init__): Introduced new escape '\D' for continuation
2655 (Prompt2.__init__): Introduced new escape '\D' for continuation
2644 prompts. It represents the counter ('\#') as dots.
2656 prompts. It represents the counter ('\#') as dots.
2645 *** NOTE *** THIS IS A BACKWARDS-INCOMPATIBLE CHANGE. Users will
2657 *** NOTE *** THIS IS A BACKWARDS-INCOMPATIBLE CHANGE. Users will
2646 need to update their ipythonrc files and replace '%n' with '\D' in
2658 need to update their ipythonrc files and replace '%n' with '\D' in
2647 their prompt_in2 settings everywhere. Sorry, but there's
2659 their prompt_in2 settings everywhere. Sorry, but there's
2648 otherwise no clean way to get all prompts to properly align. The
2660 otherwise no clean way to get all prompts to properly align. The
2649 ipythonrc shipped with IPython has been updated.
2661 ipythonrc shipped with IPython has been updated.
2650
2662
2651 2004-06-07 Fernando Perez <fperez@colorado.edu>
2663 2004-06-07 Fernando Perez <fperez@colorado.edu>
2652
2664
2653 * setup.py (isfile): Pass local_icons option to latex2html, so the
2665 * setup.py (isfile): Pass local_icons option to latex2html, so the
2654 resulting HTML file is self-contained. Thanks to
2666 resulting HTML file is self-contained. Thanks to
2655 dryice-AT-liu.com.cn for the tip.
2667 dryice-AT-liu.com.cn for the tip.
2656
2668
2657 * pysh.py: I created a new profile 'shell', which implements a
2669 * pysh.py: I created a new profile 'shell', which implements a
2658 _rudimentary_ IPython-based shell. This is in NO WAY a realy
2670 _rudimentary_ IPython-based shell. This is in NO WAY a realy
2659 system shell, nor will it become one anytime soon. It's mainly
2671 system shell, nor will it become one anytime soon. It's mainly
2660 meant to illustrate the use of the new flexible bash-like prompts.
2672 meant to illustrate the use of the new flexible bash-like prompts.
2661 I guess it could be used by hardy souls for true shell management,
2673 I guess it could be used by hardy souls for true shell management,
2662 but it's no tcsh/bash... pysh.py is loaded by the 'shell'
2674 but it's no tcsh/bash... pysh.py is loaded by the 'shell'
2663 profile. This uses the InterpreterExec extension provided by
2675 profile. This uses the InterpreterExec extension provided by
2664 W.J. van der Laan <gnufnork-AT-hetdigitalegat.nl>
2676 W.J. van der Laan <gnufnork-AT-hetdigitalegat.nl>
2665
2677
2666 * IPython/Prompts.py (PromptOut.__str__): now it will correctly
2678 * IPython/Prompts.py (PromptOut.__str__): now it will correctly
2667 auto-align itself with the length of the previous input prompt
2679 auto-align itself with the length of the previous input prompt
2668 (taking into account the invisible color escapes).
2680 (taking into account the invisible color escapes).
2669 (CachedOutput.__init__): Large restructuring of this class. Now
2681 (CachedOutput.__init__): Large restructuring of this class. Now
2670 all three prompts (primary1, primary2, output) are proper objects,
2682 all three prompts (primary1, primary2, output) are proper objects,
2671 managed by the 'parent' CachedOutput class. The code is still a
2683 managed by the 'parent' CachedOutput class. The code is still a
2672 bit hackish (all prompts share state via a pointer to the cache),
2684 bit hackish (all prompts share state via a pointer to the cache),
2673 but it's overall far cleaner than before.
2685 but it's overall far cleaner than before.
2674
2686
2675 * IPython/genutils.py (getoutputerror): modified to add verbose,
2687 * IPython/genutils.py (getoutputerror): modified to add verbose,
2676 debug and header options. This makes the interface of all getout*
2688 debug and header options. This makes the interface of all getout*
2677 functions uniform.
2689 functions uniform.
2678 (SystemExec.getoutputerror): added getoutputerror to SystemExec.
2690 (SystemExec.getoutputerror): added getoutputerror to SystemExec.
2679
2691
2680 * IPython/Magic.py (Magic.default_option): added a function to
2692 * IPython/Magic.py (Magic.default_option): added a function to
2681 allow registering default options for any magic command. This
2693 allow registering default options for any magic command. This
2682 makes it easy to have profiles which customize the magics globally
2694 makes it easy to have profiles which customize the magics globally
2683 for a certain use. The values set through this function are
2695 for a certain use. The values set through this function are
2684 picked up by the parse_options() method, which all magics should
2696 picked up by the parse_options() method, which all magics should
2685 use to parse their options.
2697 use to parse their options.
2686
2698
2687 * IPython/genutils.py (warn): modified the warnings framework to
2699 * IPython/genutils.py (warn): modified the warnings framework to
2688 use the Term I/O class. I'm trying to slowly unify all of
2700 use the Term I/O class. I'm trying to slowly unify all of
2689 IPython's I/O operations to pass through Term.
2701 IPython's I/O operations to pass through Term.
2690
2702
2691 * IPython/Prompts.py (Prompt2._str_other): Added functionality in
2703 * IPython/Prompts.py (Prompt2._str_other): Added functionality in
2692 the secondary prompt to correctly match the length of the primary
2704 the secondary prompt to correctly match the length of the primary
2693 one for any prompt. Now multi-line code will properly line up
2705 one for any prompt. Now multi-line code will properly line up
2694 even for path dependent prompts, such as the new ones available
2706 even for path dependent prompts, such as the new ones available
2695 via the prompt_specials.
2707 via the prompt_specials.
2696
2708
2697 2004-06-06 Fernando Perez <fperez@colorado.edu>
2709 2004-06-06 Fernando Perez <fperez@colorado.edu>
2698
2710
2699 * IPython/Prompts.py (prompt_specials): Added the ability to have
2711 * IPython/Prompts.py (prompt_specials): Added the ability to have
2700 bash-like special sequences in the prompts, which get
2712 bash-like special sequences in the prompts, which get
2701 automatically expanded. Things like hostname, current working
2713 automatically expanded. Things like hostname, current working
2702 directory and username are implemented already, but it's easy to
2714 directory and username are implemented already, but it's easy to
2703 add more in the future. Thanks to a patch by W.J. van der Laan
2715 add more in the future. Thanks to a patch by W.J. van der Laan
2704 <gnufnork-AT-hetdigitalegat.nl>
2716 <gnufnork-AT-hetdigitalegat.nl>
2705 (prompt_specials): Added color support for prompt strings, so
2717 (prompt_specials): Added color support for prompt strings, so
2706 users can define arbitrary color setups for their prompts.
2718 users can define arbitrary color setups for their prompts.
2707
2719
2708 2004-06-05 Fernando Perez <fperez@colorado.edu>
2720 2004-06-05 Fernando Perez <fperez@colorado.edu>
2709
2721
2710 * IPython/genutils.py (Term.reopen_all): Added Windows-specific
2722 * IPython/genutils.py (Term.reopen_all): Added Windows-specific
2711 code to load Gary Bishop's readline and configure it
2723 code to load Gary Bishop's readline and configure it
2712 automatically. Thanks to Gary for help on this.
2724 automatically. Thanks to Gary for help on this.
2713
2725
2714 2004-06-01 Fernando Perez <fperez@colorado.edu>
2726 2004-06-01 Fernando Perez <fperez@colorado.edu>
2715
2727
2716 * IPython/Logger.py (Logger.create_log): fix bug for logging
2728 * IPython/Logger.py (Logger.create_log): fix bug for logging
2717 with no filename (previous fix was incomplete).
2729 with no filename (previous fix was incomplete).
2718
2730
2719 2004-05-25 Fernando Perez <fperez@colorado.edu>
2731 2004-05-25 Fernando Perez <fperez@colorado.edu>
2720
2732
2721 * IPython/Magic.py (Magic.parse_options): fix bug where naked
2733 * IPython/Magic.py (Magic.parse_options): fix bug where naked
2722 parens would get passed to the shell.
2734 parens would get passed to the shell.
2723
2735
2724 2004-05-20 Fernando Perez <fperez@colorado.edu>
2736 2004-05-20 Fernando Perez <fperez@colorado.edu>
2725
2737
2726 * IPython/Magic.py (Magic.magic_prun): changed default profile
2738 * IPython/Magic.py (Magic.magic_prun): changed default profile
2727 sort order to 'time' (the more common profiling need).
2739 sort order to 'time' (the more common profiling need).
2728
2740
2729 * IPython/OInspect.py (Inspector.pinfo): flush the inspect cache
2741 * IPython/OInspect.py (Inspector.pinfo): flush the inspect cache
2730 so that source code shown is guaranteed in sync with the file on
2742 so that source code shown is guaranteed in sync with the file on
2731 disk (also changed in psource). Similar fix to the one for
2743 disk (also changed in psource). Similar fix to the one for
2732 ultraTB on 2004-05-06. Thanks to a bug report by Yann Le Du
2744 ultraTB on 2004-05-06. Thanks to a bug report by Yann Le Du
2733 <yann.ledu-AT-noos.fr>.
2745 <yann.ledu-AT-noos.fr>.
2734
2746
2735 * IPython/Magic.py (Magic.parse_options): Fixed bug where commands
2747 * IPython/Magic.py (Magic.parse_options): Fixed bug where commands
2736 with a single option would not be correctly parsed. Closes
2748 with a single option would not be correctly parsed. Closes
2737 http://www.scipy.net/roundup/ipython/issue14. This bug had been
2749 http://www.scipy.net/roundup/ipython/issue14. This bug had been
2738 introduced in 0.6.0 (on 2004-05-06).
2750 introduced in 0.6.0 (on 2004-05-06).
2739
2751
2740 2004-05-13 *** Released version 0.6.0
2752 2004-05-13 *** Released version 0.6.0
2741
2753
2742 2004-05-13 Fernando Perez <fperez@colorado.edu>
2754 2004-05-13 Fernando Perez <fperez@colorado.edu>
2743
2755
2744 * debian/: Added debian/ directory to CVS, so that debian support
2756 * debian/: Added debian/ directory to CVS, so that debian support
2745 is publicly accessible. The debian package is maintained by Jack
2757 is publicly accessible. The debian package is maintained by Jack
2746 Moffit <jack-AT-xiph.org>.
2758 Moffit <jack-AT-xiph.org>.
2747
2759
2748 * Documentation: included the notes about an ipython-based system
2760 * Documentation: included the notes about an ipython-based system
2749 shell (the hypothetical 'pysh') into the new_design.pdf document,
2761 shell (the hypothetical 'pysh') into the new_design.pdf document,
2750 so that these ideas get distributed to users along with the
2762 so that these ideas get distributed to users along with the
2751 official documentation.
2763 official documentation.
2752
2764
2753 2004-05-10 Fernando Perez <fperez@colorado.edu>
2765 2004-05-10 Fernando Perez <fperez@colorado.edu>
2754
2766
2755 * IPython/Logger.py (Logger.create_log): fix recently introduced
2767 * IPython/Logger.py (Logger.create_log): fix recently introduced
2756 bug (misindented line) where logstart would fail when not given an
2768 bug (misindented line) where logstart would fail when not given an
2757 explicit filename.
2769 explicit filename.
2758
2770
2759 2004-05-09 Fernando Perez <fperez@colorado.edu>
2771 2004-05-09 Fernando Perez <fperez@colorado.edu>
2760
2772
2761 * IPython/Magic.py (Magic.parse_options): skip system call when
2773 * IPython/Magic.py (Magic.parse_options): skip system call when
2762 there are no options to look for. Faster, cleaner for the common
2774 there are no options to look for. Faster, cleaner for the common
2763 case.
2775 case.
2764
2776
2765 * Documentation: many updates to the manual: describing Windows
2777 * Documentation: many updates to the manual: describing Windows
2766 support better, Gnuplot updates, credits, misc small stuff. Also
2778 support better, Gnuplot updates, credits, misc small stuff. Also
2767 updated the new_design doc a bit.
2779 updated the new_design doc a bit.
2768
2780
2769 2004-05-06 *** Released version 0.6.0.rc1
2781 2004-05-06 *** Released version 0.6.0.rc1
2770
2782
2771 2004-05-06 Fernando Perez <fperez@colorado.edu>
2783 2004-05-06 Fernando Perez <fperez@colorado.edu>
2772
2784
2773 * IPython/ultraTB.py (ListTB.text): modified a ton of string +=
2785 * IPython/ultraTB.py (ListTB.text): modified a ton of string +=
2774 operations to use the vastly more efficient list/''.join() method.
2786 operations to use the vastly more efficient list/''.join() method.
2775 (FormattedTB.text): Fix
2787 (FormattedTB.text): Fix
2776 http://www.scipy.net/roundup/ipython/issue12 - exception source
2788 http://www.scipy.net/roundup/ipython/issue12 - exception source
2777 extract not updated after reload. Thanks to Mike Salib
2789 extract not updated after reload. Thanks to Mike Salib
2778 <msalib-AT-mit.edu> for pinning the source of the problem.
2790 <msalib-AT-mit.edu> for pinning the source of the problem.
2779 Fortunately, the solution works inside ipython and doesn't require
2791 Fortunately, the solution works inside ipython and doesn't require
2780 any changes to python proper.
2792 any changes to python proper.
2781
2793
2782 * IPython/Magic.py (Magic.parse_options): Improved to process the
2794 * IPython/Magic.py (Magic.parse_options): Improved to process the
2783 argument list as a true shell would (by actually using the
2795 argument list as a true shell would (by actually using the
2784 underlying system shell). This way, all @magics automatically get
2796 underlying system shell). This way, all @magics automatically get
2785 shell expansion for variables. Thanks to a comment by Alex
2797 shell expansion for variables. Thanks to a comment by Alex
2786 Schmolck.
2798 Schmolck.
2787
2799
2788 2004-04-04 Fernando Perez <fperez@colorado.edu>
2800 2004-04-04 Fernando Perez <fperez@colorado.edu>
2789
2801
2790 * IPython/iplib.py (InteractiveShell.interact): Added a special
2802 * IPython/iplib.py (InteractiveShell.interact): Added a special
2791 trap for a debugger quit exception, which is basically impossible
2803 trap for a debugger quit exception, which is basically impossible
2792 to handle by normal mechanisms, given what pdb does to the stack.
2804 to handle by normal mechanisms, given what pdb does to the stack.
2793 This fixes a crash reported by <fgibbons-AT-llama.med.harvard.edu>.
2805 This fixes a crash reported by <fgibbons-AT-llama.med.harvard.edu>.
2794
2806
2795 2004-04-03 Fernando Perez <fperez@colorado.edu>
2807 2004-04-03 Fernando Perez <fperez@colorado.edu>
2796
2808
2797 * IPython/genutils.py (Term): Standardized the names of the Term
2809 * IPython/genutils.py (Term): Standardized the names of the Term
2798 class streams to cin/cout/cerr, following C++ naming conventions
2810 class streams to cin/cout/cerr, following C++ naming conventions
2799 (I can't use in/out/err because 'in' is not a valid attribute
2811 (I can't use in/out/err because 'in' is not a valid attribute
2800 name).
2812 name).
2801
2813
2802 * IPython/iplib.py (InteractiveShell.interact): don't increment
2814 * IPython/iplib.py (InteractiveShell.interact): don't increment
2803 the prompt if there's no user input. By Daniel 'Dang' Griffith
2815 the prompt if there's no user input. By Daniel 'Dang' Griffith
2804 <pythondev-dang-AT-lazytwinacres.net>, after a suggestion from
2816 <pythondev-dang-AT-lazytwinacres.net>, after a suggestion from
2805 Francois Pinard.
2817 Francois Pinard.
2806
2818
2807 2004-04-02 Fernando Perez <fperez@colorado.edu>
2819 2004-04-02 Fernando Perez <fperez@colorado.edu>
2808
2820
2809 * IPython/genutils.py (Stream.__init__): Modified to survive at
2821 * IPython/genutils.py (Stream.__init__): Modified to survive at
2810 least importing in contexts where stdin/out/err aren't true file
2822 least importing in contexts where stdin/out/err aren't true file
2811 objects, such as PyCrust (they lack fileno() and mode). However,
2823 objects, such as PyCrust (they lack fileno() and mode). However,
2812 the recovery facilities which rely on these things existing will
2824 the recovery facilities which rely on these things existing will
2813 not work.
2825 not work.
2814
2826
2815 2004-04-01 Fernando Perez <fperez@colorado.edu>
2827 2004-04-01 Fernando Perez <fperez@colorado.edu>
2816
2828
2817 * IPython/Magic.py (Magic.magic_sx): modified (as well as @sc) to
2829 * IPython/Magic.py (Magic.magic_sx): modified (as well as @sc) to
2818 use the new getoutputerror() function, so it properly
2830 use the new getoutputerror() function, so it properly
2819 distinguishes stdout/err.
2831 distinguishes stdout/err.
2820
2832
2821 * IPython/genutils.py (getoutputerror): added a function to
2833 * IPython/genutils.py (getoutputerror): added a function to
2822 capture separately the standard output and error of a command.
2834 capture separately the standard output and error of a command.
2823 After a comment from dang on the mailing lists. This code is
2835 After a comment from dang on the mailing lists. This code is
2824 basically a modified version of commands.getstatusoutput(), from
2836 basically a modified version of commands.getstatusoutput(), from
2825 the standard library.
2837 the standard library.
2826
2838
2827 * IPython/iplib.py (InteractiveShell.handle_shell_escape): added
2839 * IPython/iplib.py (InteractiveShell.handle_shell_escape): added
2828 '!!' as a special syntax (shorthand) to access @sx.
2840 '!!' as a special syntax (shorthand) to access @sx.
2829
2841
2830 * IPython/Magic.py (Magic.magic_sx): new magic, to execute a shell
2842 * IPython/Magic.py (Magic.magic_sx): new magic, to execute a shell
2831 command and return its output as a list split on '\n'.
2843 command and return its output as a list split on '\n'.
2832
2844
2833 2004-03-31 Fernando Perez <fperez@colorado.edu>
2845 2004-03-31 Fernando Perez <fperez@colorado.edu>
2834
2846
2835 * IPython/FakeModule.py (FakeModule.__init__): added __nonzero__
2847 * IPython/FakeModule.py (FakeModule.__init__): added __nonzero__
2836 method to dictionaries used as FakeModule instances if they lack
2848 method to dictionaries used as FakeModule instances if they lack
2837 it. At least pydoc in python2.3 breaks for runtime-defined
2849 it. At least pydoc in python2.3 breaks for runtime-defined
2838 functions without this hack. At some point I need to _really_
2850 functions without this hack. At some point I need to _really_
2839 understand what FakeModule is doing, because it's a gross hack.
2851 understand what FakeModule is doing, because it's a gross hack.
2840 But it solves Arnd's problem for now...
2852 But it solves Arnd's problem for now...
2841
2853
2842 2004-02-27 Fernando Perez <fperez@colorado.edu>
2854 2004-02-27 Fernando Perez <fperez@colorado.edu>
2843
2855
2844 * IPython/Logger.py (Logger.create_log): Fix bug where 'rotate'
2856 * IPython/Logger.py (Logger.create_log): Fix bug where 'rotate'
2845 mode would behave erratically. Also increased the number of
2857 mode would behave erratically. Also increased the number of
2846 possible logs in rotate mod to 999. Thanks to Rod Holland
2858 possible logs in rotate mod to 999. Thanks to Rod Holland
2847 <rhh@StructureLABS.com> for the report and fixes.
2859 <rhh@StructureLABS.com> for the report and fixes.
2848
2860
2849 2004-02-26 Fernando Perez <fperez@colorado.edu>
2861 2004-02-26 Fernando Perez <fperez@colorado.edu>
2850
2862
2851 * IPython/genutils.py (page): Check that the curses module really
2863 * IPython/genutils.py (page): Check that the curses module really
2852 has the initscr attribute before trying to use it. For some
2864 has the initscr attribute before trying to use it. For some
2853 reason, the Solaris curses module is missing this. I think this
2865 reason, the Solaris curses module is missing this. I think this
2854 should be considered a Solaris python bug, but I'm not sure.
2866 should be considered a Solaris python bug, but I'm not sure.
2855
2867
2856 2004-01-17 Fernando Perez <fperez@colorado.edu>
2868 2004-01-17 Fernando Perez <fperez@colorado.edu>
2857
2869
2858 * IPython/genutils.py (Stream.__init__): Changes to try to make
2870 * IPython/genutils.py (Stream.__init__): Changes to try to make
2859 ipython robust against stdin/out/err being closed by the user.
2871 ipython robust against stdin/out/err being closed by the user.
2860 This is 'user error' (and blocks a normal python session, at least
2872 This is 'user error' (and blocks a normal python session, at least
2861 the stdout case). However, Ipython should be able to survive such
2873 the stdout case). However, Ipython should be able to survive such
2862 instances of abuse as gracefully as possible. To simplify the
2874 instances of abuse as gracefully as possible. To simplify the
2863 coding and maintain compatibility with Gary Bishop's Term
2875 coding and maintain compatibility with Gary Bishop's Term
2864 contributions, I've made use of classmethods for this. I think
2876 contributions, I've made use of classmethods for this. I think
2865 this introduces a dependency on python 2.2.
2877 this introduces a dependency on python 2.2.
2866
2878
2867 2004-01-13 Fernando Perez <fperez@colorado.edu>
2879 2004-01-13 Fernando Perez <fperez@colorado.edu>
2868
2880
2869 * IPython/numutils.py (exp_safe): simplified the code a bit and
2881 * IPython/numutils.py (exp_safe): simplified the code a bit and
2870 removed the need for importing the kinds module altogether.
2882 removed the need for importing the kinds module altogether.
2871
2883
2872 2004-01-06 Fernando Perez <fperez@colorado.edu>
2884 2004-01-06 Fernando Perez <fperez@colorado.edu>
2873
2885
2874 * IPython/Magic.py (Magic.magic_sc): Made the shell capture system
2886 * IPython/Magic.py (Magic.magic_sc): Made the shell capture system
2875 a magic function instead, after some community feedback. No
2887 a magic function instead, after some community feedback. No
2876 special syntax will exist for it, but its name is deliberately
2888 special syntax will exist for it, but its name is deliberately
2877 very short.
2889 very short.
2878
2890
2879 2003-12-20 Fernando Perez <fperez@colorado.edu>
2891 2003-12-20 Fernando Perez <fperez@colorado.edu>
2880
2892
2881 * IPython/iplib.py (InteractiveShell.handle_shell_assign): Added
2893 * IPython/iplib.py (InteractiveShell.handle_shell_assign): Added
2882 new functionality, to automagically assign the result of a shell
2894 new functionality, to automagically assign the result of a shell
2883 command to a variable. I'll solicit some community feedback on
2895 command to a variable. I'll solicit some community feedback on
2884 this before making it permanent.
2896 this before making it permanent.
2885
2897
2886 * IPython/OInspect.py (Inspector.pinfo): Fix crash when info was
2898 * IPython/OInspect.py (Inspector.pinfo): Fix crash when info was
2887 requested about callables for which inspect couldn't obtain a
2899 requested about callables for which inspect couldn't obtain a
2888 proper argspec. Thanks to a crash report sent by Etienne
2900 proper argspec. Thanks to a crash report sent by Etienne
2889 Posthumus <etienne-AT-apple01.cs.vu.nl>.
2901 Posthumus <etienne-AT-apple01.cs.vu.nl>.
2890
2902
2891 2003-12-09 Fernando Perez <fperez@colorado.edu>
2903 2003-12-09 Fernando Perez <fperez@colorado.edu>
2892
2904
2893 * IPython/genutils.py (page): patch for the pager to work across
2905 * IPython/genutils.py (page): patch for the pager to work across
2894 various versions of Windows. By Gary Bishop.
2906 various versions of Windows. By Gary Bishop.
2895
2907
2896 2003-12-04 Fernando Perez <fperez@colorado.edu>
2908 2003-12-04 Fernando Perez <fperez@colorado.edu>
2897
2909
2898 * IPython/Gnuplot2.py (PlotItems): Fixes for working with
2910 * IPython/Gnuplot2.py (PlotItems): Fixes for working with
2899 Gnuplot.py version 1.7, whose internal names changed quite a bit.
2911 Gnuplot.py version 1.7, whose internal names changed quite a bit.
2900 While I tested this and it looks ok, there may still be corner
2912 While I tested this and it looks ok, there may still be corner
2901 cases I've missed.
2913 cases I've missed.
2902
2914
2903 2003-12-01 Fernando Perez <fperez@colorado.edu>
2915 2003-12-01 Fernando Perez <fperez@colorado.edu>
2904
2916
2905 * IPython/iplib.py (InteractiveShell._prefilter): Fixed a bug
2917 * IPython/iplib.py (InteractiveShell._prefilter): Fixed a bug
2906 where a line like 'p,q=1,2' would fail because the automagic
2918 where a line like 'p,q=1,2' would fail because the automagic
2907 system would be triggered for @p.
2919 system would be triggered for @p.
2908
2920
2909 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): Tab-related
2921 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): Tab-related
2910 cleanups, code unmodified.
2922 cleanups, code unmodified.
2911
2923
2912 * IPython/genutils.py (Term): added a class for IPython to handle
2924 * IPython/genutils.py (Term): added a class for IPython to handle
2913 output. In most cases it will just be a proxy for stdout/err, but
2925 output. In most cases it will just be a proxy for stdout/err, but
2914 having this allows modifications to be made for some platforms,
2926 having this allows modifications to be made for some platforms,
2915 such as handling color escapes under Windows. All of this code
2927 such as handling color escapes under Windows. All of this code
2916 was contributed by Gary Bishop, with minor modifications by me.
2928 was contributed by Gary Bishop, with minor modifications by me.
2917 The actual changes affect many files.
2929 The actual changes affect many files.
2918
2930
2919 2003-11-30 Fernando Perez <fperez@colorado.edu>
2931 2003-11-30 Fernando Perez <fperez@colorado.edu>
2920
2932
2921 * IPython/iplib.py (file_matches): new completion code, courtesy
2933 * IPython/iplib.py (file_matches): new completion code, courtesy
2922 of Jeff Collins. This enables filename completion again under
2934 of Jeff Collins. This enables filename completion again under
2923 python 2.3, which disabled it at the C level.
2935 python 2.3, which disabled it at the C level.
2924
2936
2925 2003-11-11 Fernando Perez <fperez@colorado.edu>
2937 2003-11-11 Fernando Perez <fperez@colorado.edu>
2926
2938
2927 * IPython/numutils.py (amap): Added amap() fn. Simple shorthand
2939 * IPython/numutils.py (amap): Added amap() fn. Simple shorthand
2928 for Numeric.array(map(...)), but often convenient.
2940 for Numeric.array(map(...)), but often convenient.
2929
2941
2930 2003-11-05 Fernando Perez <fperez@colorado.edu>
2942 2003-11-05 Fernando Perez <fperez@colorado.edu>
2931
2943
2932 * IPython/numutils.py (frange): Changed a call from int() to
2944 * IPython/numutils.py (frange): Changed a call from int() to
2933 int(round()) to prevent a problem reported with arange() in the
2945 int(round()) to prevent a problem reported with arange() in the
2934 numpy list.
2946 numpy list.
2935
2947
2936 2003-10-06 Fernando Perez <fperez@colorado.edu>
2948 2003-10-06 Fernando Perez <fperez@colorado.edu>
2937
2949
2938 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): changed to
2950 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): changed to
2939 prevent crashes if sys lacks an argv attribute (it happens with
2951 prevent crashes if sys lacks an argv attribute (it happens with
2940 embedded interpreters which build a bare-bones sys module).
2952 embedded interpreters which build a bare-bones sys module).
2941 Thanks to a report/bugfix by Adam Hupp <hupp-AT-cs.wisc.edu>.
2953 Thanks to a report/bugfix by Adam Hupp <hupp-AT-cs.wisc.edu>.
2942
2954
2943 2003-09-24 Fernando Perez <fperez@colorado.edu>
2955 2003-09-24 Fernando Perez <fperez@colorado.edu>
2944
2956
2945 * IPython/Magic.py (Magic._ofind): blanket except around getattr()
2957 * IPython/Magic.py (Magic._ofind): blanket except around getattr()
2946 to protect against poorly written user objects where __getattr__
2958 to protect against poorly written user objects where __getattr__
2947 raises exceptions other than AttributeError. Thanks to a bug
2959 raises exceptions other than AttributeError. Thanks to a bug
2948 report by Oliver Sander <osander-AT-gmx.de>.
2960 report by Oliver Sander <osander-AT-gmx.de>.
2949
2961
2950 * IPython/FakeModule.py (FakeModule.__repr__): this method was
2962 * IPython/FakeModule.py (FakeModule.__repr__): this method was
2951 missing. Thanks to bug report by Ralf Schmitt <ralf-AT-brainbot.com>.
2963 missing. Thanks to bug report by Ralf Schmitt <ralf-AT-brainbot.com>.
2952
2964
2953 2003-09-09 Fernando Perez <fperez@colorado.edu>
2965 2003-09-09 Fernando Perez <fperez@colorado.edu>
2954
2966
2955 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
2967 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
2956 unpacking a list whith a callable as first element would
2968 unpacking a list whith a callable as first element would
2957 mistakenly trigger autocalling. Thanks to a bug report by Jeffery
2969 mistakenly trigger autocalling. Thanks to a bug report by Jeffery
2958 Collins.
2970 Collins.
2959
2971
2960 2003-08-25 *** Released version 0.5.0
2972 2003-08-25 *** Released version 0.5.0
2961
2973
2962 2003-08-22 Fernando Perez <fperez@colorado.edu>
2974 2003-08-22 Fernando Perez <fperez@colorado.edu>
2963
2975
2964 * IPython/ultraTB.py (VerboseTB.linereader): Improved handling of
2976 * IPython/ultraTB.py (VerboseTB.linereader): Improved handling of
2965 improperly defined user exceptions. Thanks to feedback from Mark
2977 improperly defined user exceptions. Thanks to feedback from Mark
2966 Russell <mrussell-AT-verio.net>.
2978 Russell <mrussell-AT-verio.net>.
2967
2979
2968 2003-08-20 Fernando Perez <fperez@colorado.edu>
2980 2003-08-20 Fernando Perez <fperez@colorado.edu>
2969
2981
2970 * IPython/OInspect.py (Inspector.pinfo): changed String Form
2982 * IPython/OInspect.py (Inspector.pinfo): changed String Form
2971 printing so that it would print multi-line string forms starting
2983 printing so that it would print multi-line string forms starting
2972 with a new line. This way the formatting is better respected for
2984 with a new line. This way the formatting is better respected for
2973 objects which work hard to make nice string forms.
2985 objects which work hard to make nice string forms.
2974
2986
2975 * IPython/iplib.py (InteractiveShell.handle_auto): Fix bug where
2987 * IPython/iplib.py (InteractiveShell.handle_auto): Fix bug where
2976 autocall would overtake data access for objects with both
2988 autocall would overtake data access for objects with both
2977 __getitem__ and __call__.
2989 __getitem__ and __call__.
2978
2990
2979 2003-08-19 *** Released version 0.5.0-rc1
2991 2003-08-19 *** Released version 0.5.0-rc1
2980
2992
2981 2003-08-19 Fernando Perez <fperez@colorado.edu>
2993 2003-08-19 Fernando Perez <fperez@colorado.edu>
2982
2994
2983 * IPython/deep_reload.py (load_tail): single tiny change here
2995 * IPython/deep_reload.py (load_tail): single tiny change here
2984 seems to fix the long-standing bug of dreload() failing to work
2996 seems to fix the long-standing bug of dreload() failing to work
2985 for dotted names. But this module is pretty tricky, so I may have
2997 for dotted names. But this module is pretty tricky, so I may have
2986 missed some subtlety. Needs more testing!.
2998 missed some subtlety. Needs more testing!.
2987
2999
2988 * IPython/ultraTB.py (VerboseTB.linereader): harden against user
3000 * IPython/ultraTB.py (VerboseTB.linereader): harden against user
2989 exceptions which have badly implemented __str__ methods.
3001 exceptions which have badly implemented __str__ methods.
2990 (VerboseTB.text): harden against inspect.getinnerframes crashing,
3002 (VerboseTB.text): harden against inspect.getinnerframes crashing,
2991 which I've been getting reports about from Python 2.3 users. I
3003 which I've been getting reports about from Python 2.3 users. I
2992 wish I had a simple test case to reproduce the problem, so I could
3004 wish I had a simple test case to reproduce the problem, so I could
2993 either write a cleaner workaround or file a bug report if
3005 either write a cleaner workaround or file a bug report if
2994 necessary.
3006 necessary.
2995
3007
2996 * IPython/Magic.py (Magic.magic_edit): fixed bug where after
3008 * IPython/Magic.py (Magic.magic_edit): fixed bug where after
2997 making a class 'foo', file 'foo.py' couldn't be edited. Thanks to
3009 making a class 'foo', file 'foo.py' couldn't be edited. Thanks to
2998 a bug report by Tjabo Kloppenburg.
3010 a bug report by Tjabo Kloppenburg.
2999
3011
3000 * IPython/ultraTB.py (VerboseTB.debugger): hardened against pdb
3012 * IPython/ultraTB.py (VerboseTB.debugger): hardened against pdb
3001 crashes. Wrapped the pdb call in a blanket try/except, since pdb
3013 crashes. Wrapped the pdb call in a blanket try/except, since pdb
3002 seems rather unstable. Thanks to a bug report by Tjabo
3014 seems rather unstable. Thanks to a bug report by Tjabo
3003 Kloppenburg <tjabo.kloppenburg-AT-unix-ag.uni-siegen.de>.
3015 Kloppenburg <tjabo.kloppenburg-AT-unix-ag.uni-siegen.de>.
3004
3016
3005 * IPython/Release.py (version): release 0.5.0-rc1. I want to put
3017 * IPython/Release.py (version): release 0.5.0-rc1. I want to put
3006 this out soon because of the critical fixes in the inner loop for
3018 this out soon because of the critical fixes in the inner loop for
3007 generators.
3019 generators.
3008
3020
3009 * IPython/Magic.py (Magic.getargspec): removed. This (and
3021 * IPython/Magic.py (Magic.getargspec): removed. This (and
3010 _get_def) have been obsoleted by OInspect for a long time, I
3022 _get_def) have been obsoleted by OInspect for a long time, I
3011 hadn't noticed that they were dead code.
3023 hadn't noticed that they were dead code.
3012 (Magic._ofind): restored _ofind functionality for a few literals
3024 (Magic._ofind): restored _ofind functionality for a few literals
3013 (those in ["''",'""','[]','{}','()']). But it won't work anymore
3025 (those in ["''",'""','[]','{}','()']). But it won't work anymore
3014 for things like "hello".capitalize?, since that would require a
3026 for things like "hello".capitalize?, since that would require a
3015 potentially dangerous eval() again.
3027 potentially dangerous eval() again.
3016
3028
3017 * IPython/iplib.py (InteractiveShell._prefilter): reorganized the
3029 * IPython/iplib.py (InteractiveShell._prefilter): reorganized the
3018 logic a bit more to clean up the escapes handling and minimize the
3030 logic a bit more to clean up the escapes handling and minimize the
3019 use of _ofind to only necessary cases. The interactive 'feel' of
3031 use of _ofind to only necessary cases. The interactive 'feel' of
3020 IPython should have improved quite a bit with the changes in
3032 IPython should have improved quite a bit with the changes in
3021 _prefilter and _ofind (besides being far safer than before).
3033 _prefilter and _ofind (besides being far safer than before).
3022
3034
3023 * IPython/Magic.py (Magic.magic_edit): Fixed old bug (but rather
3035 * IPython/Magic.py (Magic.magic_edit): Fixed old bug (but rather
3024 obscure, never reported). Edit would fail to find the object to
3036 obscure, never reported). Edit would fail to find the object to
3025 edit under some circumstances.
3037 edit under some circumstances.
3026 (Magic._ofind): CRITICAL FIX. Finally removed the eval() calls
3038 (Magic._ofind): CRITICAL FIX. Finally removed the eval() calls
3027 which were causing double-calling of generators. Those eval calls
3039 which were causing double-calling of generators. Those eval calls
3028 were _very_ dangerous, since code with side effects could be
3040 were _very_ dangerous, since code with side effects could be
3029 triggered. As they say, 'eval is evil'... These were the
3041 triggered. As they say, 'eval is evil'... These were the
3030 nastiest evals in IPython. Besides, _ofind is now far simpler,
3042 nastiest evals in IPython. Besides, _ofind is now far simpler,
3031 and it should also be quite a bit faster. Its use of inspect is
3043 and it should also be quite a bit faster. Its use of inspect is
3032 also safer, so perhaps some of the inspect-related crashes I've
3044 also safer, so perhaps some of the inspect-related crashes I've
3033 seen lately with Python 2.3 might be taken care of. That will
3045 seen lately with Python 2.3 might be taken care of. That will
3034 need more testing.
3046 need more testing.
3035
3047
3036 2003-08-17 Fernando Perez <fperez@colorado.edu>
3048 2003-08-17 Fernando Perez <fperez@colorado.edu>
3037
3049
3038 * IPython/iplib.py (InteractiveShell._prefilter): significant
3050 * IPython/iplib.py (InteractiveShell._prefilter): significant
3039 simplifications to the logic for handling user escapes. Faster
3051 simplifications to the logic for handling user escapes. Faster
3040 and simpler code.
3052 and simpler code.
3041
3053
3042 2003-08-14 Fernando Perez <fperez@colorado.edu>
3054 2003-08-14 Fernando Perez <fperez@colorado.edu>
3043
3055
3044 * IPython/numutils.py (sum_flat): rewrote to be non-recursive.
3056 * IPython/numutils.py (sum_flat): rewrote to be non-recursive.
3045 Now it requires O(N) storage (N=size(a)) for non-contiguous input,
3057 Now it requires O(N) storage (N=size(a)) for non-contiguous input,
3046 but it should be quite a bit faster. And the recursive version
3058 but it should be quite a bit faster. And the recursive version
3047 generated O(log N) intermediate storage for all rank>1 arrays,
3059 generated O(log N) intermediate storage for all rank>1 arrays,
3048 even if they were contiguous.
3060 even if they were contiguous.
3049 (l1norm): Added this function.
3061 (l1norm): Added this function.
3050 (norm): Added this function for arbitrary norms (including
3062 (norm): Added this function for arbitrary norms (including
3051 l-infinity). l1 and l2 are still special cases for convenience
3063 l-infinity). l1 and l2 are still special cases for convenience
3052 and speed.
3064 and speed.
3053
3065
3054 2003-08-03 Fernando Perez <fperez@colorado.edu>
3066 2003-08-03 Fernando Perez <fperez@colorado.edu>
3055
3067
3056 * IPython/Magic.py (Magic.magic_edit): Removed all remaining string
3068 * IPython/Magic.py (Magic.magic_edit): Removed all remaining string
3057 exceptions, which now raise PendingDeprecationWarnings in Python
3069 exceptions, which now raise PendingDeprecationWarnings in Python
3058 2.3. There were some in Magic and some in Gnuplot2.
3070 2.3. There were some in Magic and some in Gnuplot2.
3059
3071
3060 2003-06-30 Fernando Perez <fperez@colorado.edu>
3072 2003-06-30 Fernando Perez <fperez@colorado.edu>
3061
3073
3062 * IPython/genutils.py (page): modified to call curses only for
3074 * IPython/genutils.py (page): modified to call curses only for
3063 terminals where TERM=='xterm'. After problems under many other
3075 terminals where TERM=='xterm'. After problems under many other
3064 terminals were reported by Keith Beattie <KSBeattie-AT-lbl.gov>.
3076 terminals were reported by Keith Beattie <KSBeattie-AT-lbl.gov>.
3065
3077
3066 * IPython/iplib.py (complete): removed spurious 'print "IE"' which
3078 * IPython/iplib.py (complete): removed spurious 'print "IE"' which
3067 would be triggered when readline was absent. This was just an old
3079 would be triggered when readline was absent. This was just an old
3068 debugging statement I'd forgotten to take out.
3080 debugging statement I'd forgotten to take out.
3069
3081
3070 2003-06-20 Fernando Perez <fperez@colorado.edu>
3082 2003-06-20 Fernando Perez <fperez@colorado.edu>
3071
3083
3072 * IPython/genutils.py (clock): modified to return only user time
3084 * IPython/genutils.py (clock): modified to return only user time
3073 (not counting system time), after a discussion on scipy. While
3085 (not counting system time), after a discussion on scipy. While
3074 system time may be a useful quantity occasionally, it may much
3086 system time may be a useful quantity occasionally, it may much
3075 more easily be skewed by occasional swapping or other similar
3087 more easily be skewed by occasional swapping or other similar
3076 activity.
3088 activity.
3077
3089
3078 2003-06-05 Fernando Perez <fperez@colorado.edu>
3090 2003-06-05 Fernando Perez <fperez@colorado.edu>
3079
3091
3080 * IPython/numutils.py (identity): new function, for building
3092 * IPython/numutils.py (identity): new function, for building
3081 arbitrary rank Kronecker deltas (mostly backwards compatible with
3093 arbitrary rank Kronecker deltas (mostly backwards compatible with
3082 Numeric.identity)
3094 Numeric.identity)
3083
3095
3084 2003-06-03 Fernando Perez <fperez@colorado.edu>
3096 2003-06-03 Fernando Perez <fperez@colorado.edu>
3085
3097
3086 * IPython/iplib.py (InteractiveShell.handle_magic): protect
3098 * IPython/iplib.py (InteractiveShell.handle_magic): protect
3087 arguments passed to magics with spaces, to allow trailing '\' to
3099 arguments passed to magics with spaces, to allow trailing '\' to
3088 work normally (mainly for Windows users).
3100 work normally (mainly for Windows users).
3089
3101
3090 2003-05-29 Fernando Perez <fperez@colorado.edu>
3102 2003-05-29 Fernando Perez <fperez@colorado.edu>
3091
3103
3092 * IPython/ipmaker.py (make_IPython): Load site._Helper() as help
3104 * IPython/ipmaker.py (make_IPython): Load site._Helper() as help
3093 instead of pydoc.help. This fixes a bizarre behavior where
3105 instead of pydoc.help. This fixes a bizarre behavior where
3094 printing '%s' % locals() would trigger the help system. Now
3106 printing '%s' % locals() would trigger the help system. Now
3095 ipython behaves like normal python does.
3107 ipython behaves like normal python does.
3096
3108
3097 Note that if one does 'from pydoc import help', the bizarre
3109 Note that if one does 'from pydoc import help', the bizarre
3098 behavior returns, but this will also happen in normal python, so
3110 behavior returns, but this will also happen in normal python, so
3099 it's not an ipython bug anymore (it has to do with how pydoc.help
3111 it's not an ipython bug anymore (it has to do with how pydoc.help
3100 is implemented).
3112 is implemented).
3101
3113
3102 2003-05-22 Fernando Perez <fperez@colorado.edu>
3114 2003-05-22 Fernando Perez <fperez@colorado.edu>
3103
3115
3104 * IPython/FlexCompleter.py (Completer.attr_matches): fixed to
3116 * IPython/FlexCompleter.py (Completer.attr_matches): fixed to
3105 return [] instead of None when nothing matches, also match to end
3117 return [] instead of None when nothing matches, also match to end
3106 of line. Patch by Gary Bishop.
3118 of line. Patch by Gary Bishop.
3107
3119
3108 * IPython/ipmaker.py (make_IPython): Added same sys.excepthook
3120 * IPython/ipmaker.py (make_IPython): Added same sys.excepthook
3109 protection as before, for files passed on the command line. This
3121 protection as before, for files passed on the command line. This
3110 prevents the CrashHandler from kicking in if user files call into
3122 prevents the CrashHandler from kicking in if user files call into
3111 sys.excepthook (such as PyQt and WxWindows have a nasty habit of
3123 sys.excepthook (such as PyQt and WxWindows have a nasty habit of
3112 doing). After a report by Kasper Souren <Kasper.Souren-AT-ircam.fr>
3124 doing). After a report by Kasper Souren <Kasper.Souren-AT-ircam.fr>
3113
3125
3114 2003-05-20 *** Released version 0.4.0
3126 2003-05-20 *** Released version 0.4.0
3115
3127
3116 2003-05-20 Fernando Perez <fperez@colorado.edu>
3128 2003-05-20 Fernando Perez <fperez@colorado.edu>
3117
3129
3118 * setup.py: added support for manpages. It's a bit hackish b/c of
3130 * setup.py: added support for manpages. It's a bit hackish b/c of
3119 a bug in the way the bdist_rpm distutils target handles gzipped
3131 a bug in the way the bdist_rpm distutils target handles gzipped
3120 manpages, but it works. After a patch by Jack.
3132 manpages, but it works. After a patch by Jack.
3121
3133
3122 2003-05-19 Fernando Perez <fperez@colorado.edu>
3134 2003-05-19 Fernando Perez <fperez@colorado.edu>
3123
3135
3124 * IPython/numutils.py: added a mockup of the kinds module, since
3136 * IPython/numutils.py: added a mockup of the kinds module, since
3125 it was recently removed from Numeric. This way, numutils will
3137 it was recently removed from Numeric. This way, numutils will
3126 work for all users even if they are missing kinds.
3138 work for all users even if they are missing kinds.
3127
3139
3128 * IPython/Magic.py (Magic._ofind): Harden against an inspect
3140 * IPython/Magic.py (Magic._ofind): Harden against an inspect
3129 failure, which can occur with SWIG-wrapped extensions. After a
3141 failure, which can occur with SWIG-wrapped extensions. After a
3130 crash report from Prabhu.
3142 crash report from Prabhu.
3131
3143
3132 2003-05-16 Fernando Perez <fperez@colorado.edu>
3144 2003-05-16 Fernando Perez <fperez@colorado.edu>
3133
3145
3134 * IPython/iplib.py (InteractiveShell.excepthook): New method to
3146 * IPython/iplib.py (InteractiveShell.excepthook): New method to
3135 protect ipython from user code which may call directly
3147 protect ipython from user code which may call directly
3136 sys.excepthook (this looks like an ipython crash to the user, even
3148 sys.excepthook (this looks like an ipython crash to the user, even
3137 when it isn't). After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
3149 when it isn't). After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
3138 This is especially important to help users of WxWindows, but may
3150 This is especially important to help users of WxWindows, but may
3139 also be useful in other cases.
3151 also be useful in other cases.
3140
3152
3141 * IPython/ultraTB.py (AutoFormattedTB.__call__): Changed to allow
3153 * IPython/ultraTB.py (AutoFormattedTB.__call__): Changed to allow
3142 an optional tb_offset to be specified, and to preserve exception
3154 an optional tb_offset to be specified, and to preserve exception
3143 info if given. After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
3155 info if given. After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
3144
3156
3145 * ipython.1 (Default): Thanks to Jack's work, we now have manpages!
3157 * ipython.1 (Default): Thanks to Jack's work, we now have manpages!
3146
3158
3147 2003-05-15 Fernando Perez <fperez@colorado.edu>
3159 2003-05-15 Fernando Perez <fperez@colorado.edu>
3148
3160
3149 * IPython/iplib.py (InteractiveShell.user_setup): Fix crash when
3161 * IPython/iplib.py (InteractiveShell.user_setup): Fix crash when
3150 installing for a new user under Windows.
3162 installing for a new user under Windows.
3151
3163
3152 2003-05-12 Fernando Perez <fperez@colorado.edu>
3164 2003-05-12 Fernando Perez <fperez@colorado.edu>
3153
3165
3154 * IPython/iplib.py (InteractiveShell.handle_emacs): New line
3166 * IPython/iplib.py (InteractiveShell.handle_emacs): New line
3155 handler for Emacs comint-based lines. Currently it doesn't do
3167 handler for Emacs comint-based lines. Currently it doesn't do
3156 much (but importantly, it doesn't update the history cache). In
3168 much (but importantly, it doesn't update the history cache). In
3157 the future it may be expanded if Alex needs more functionality
3169 the future it may be expanded if Alex needs more functionality
3158 there.
3170 there.
3159
3171
3160 * IPython/CrashHandler.py (CrashHandler.__call__): Added platform
3172 * IPython/CrashHandler.py (CrashHandler.__call__): Added platform
3161 info to crash reports.
3173 info to crash reports.
3162
3174
3163 * IPython/iplib.py (InteractiveShell.mainloop): Added -c option,
3175 * IPython/iplib.py (InteractiveShell.mainloop): Added -c option,
3164 just like Python's -c. Also fixed crash with invalid -color
3176 just like Python's -c. Also fixed crash with invalid -color
3165 option value at startup. Thanks to Will French
3177 option value at startup. Thanks to Will French
3166 <wfrench-AT-bestweb.net> for the bug report.
3178 <wfrench-AT-bestweb.net> for the bug report.
3167
3179
3168 2003-05-09 Fernando Perez <fperez@colorado.edu>
3180 2003-05-09 Fernando Perez <fperez@colorado.edu>
3169
3181
3170 * IPython/genutils.py (EvalDict.__getitem__): Renamed EvalString
3182 * IPython/genutils.py (EvalDict.__getitem__): Renamed EvalString
3171 to EvalDict (it's a mapping, after all) and simplified its code
3183 to EvalDict (it's a mapping, after all) and simplified its code
3172 quite a bit, after a nice discussion on c.l.py where Gustavo
3184 quite a bit, after a nice discussion on c.l.py where Gustavo
3173 CΓ³rdova <gcordova-AT-sismex.com> suggested the new version.
3185 CΓ³rdova <gcordova-AT-sismex.com> suggested the new version.
3174
3186
3175 2003-04-30 Fernando Perez <fperez@colorado.edu>
3187 2003-04-30 Fernando Perez <fperez@colorado.edu>
3176
3188
3177 * IPython/genutils.py (timings_out): modified it to reduce its
3189 * IPython/genutils.py (timings_out): modified it to reduce its
3178 overhead in the common reps==1 case.
3190 overhead in the common reps==1 case.
3179
3191
3180 2003-04-29 Fernando Perez <fperez@colorado.edu>
3192 2003-04-29 Fernando Perez <fperez@colorado.edu>
3181
3193
3182 * IPython/genutils.py (timings_out): Modified to use the resource
3194 * IPython/genutils.py (timings_out): Modified to use the resource
3183 module, which avoids the wraparound problems of time.clock().
3195 module, which avoids the wraparound problems of time.clock().
3184
3196
3185 2003-04-17 *** Released version 0.2.15pre4
3197 2003-04-17 *** Released version 0.2.15pre4
3186
3198
3187 2003-04-17 Fernando Perez <fperez@colorado.edu>
3199 2003-04-17 Fernando Perez <fperez@colorado.edu>
3188
3200
3189 * setup.py (scriptfiles): Split windows-specific stuff over to a
3201 * setup.py (scriptfiles): Split windows-specific stuff over to a
3190 separate file, in an attempt to have a Windows GUI installer.
3202 separate file, in an attempt to have a Windows GUI installer.
3191 That didn't work, but part of the groundwork is done.
3203 That didn't work, but part of the groundwork is done.
3192
3204
3193 * IPython/UserConfig/ipythonrc: Added M-i, M-o and M-I for
3205 * IPython/UserConfig/ipythonrc: Added M-i, M-o and M-I for
3194 indent/unindent with 4 spaces. Particularly useful in combination
3206 indent/unindent with 4 spaces. Particularly useful in combination
3195 with the new auto-indent option.
3207 with the new auto-indent option.
3196
3208
3197 2003-04-16 Fernando Perez <fperez@colorado.edu>
3209 2003-04-16 Fernando Perez <fperez@colorado.edu>
3198
3210
3199 * IPython/Magic.py: various replacements of self.rc for
3211 * IPython/Magic.py: various replacements of self.rc for
3200 self.shell.rc. A lot more remains to be done to fully disentangle
3212 self.shell.rc. A lot more remains to be done to fully disentangle
3201 this class from the main Shell class.
3213 this class from the main Shell class.
3202
3214
3203 * IPython/GnuplotRuntime.py: added checks for mouse support so
3215 * IPython/GnuplotRuntime.py: added checks for mouse support so
3204 that we don't try to enable it if the current gnuplot doesn't
3216 that we don't try to enable it if the current gnuplot doesn't
3205 really support it. Also added checks so that we don't try to
3217 really support it. Also added checks so that we don't try to
3206 enable persist under Windows (where Gnuplot doesn't recognize the
3218 enable persist under Windows (where Gnuplot doesn't recognize the
3207 option).
3219 option).
3208
3220
3209 * IPython/iplib.py (InteractiveShell.interact): Added optional
3221 * IPython/iplib.py (InteractiveShell.interact): Added optional
3210 auto-indenting code, after a patch by King C. Shu
3222 auto-indenting code, after a patch by King C. Shu
3211 <kingshu-AT-myrealbox.com>. It's off by default because it doesn't
3223 <kingshu-AT-myrealbox.com>. It's off by default because it doesn't
3212 get along well with pasting indented code. If I ever figure out
3224 get along well with pasting indented code. If I ever figure out
3213 how to make that part go well, it will become on by default.
3225 how to make that part go well, it will become on by default.
3214
3226
3215 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixed bug which would
3227 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixed bug which would
3216 crash ipython if there was an unmatched '%' in the user's prompt
3228 crash ipython if there was an unmatched '%' in the user's prompt
3217 string. Reported by Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
3229 string. Reported by Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
3218
3230
3219 * IPython/iplib.py (InteractiveShell.interact): removed the
3231 * IPython/iplib.py (InteractiveShell.interact): removed the
3220 ability to ask the user whether he wants to crash or not at the
3232 ability to ask the user whether he wants to crash or not at the
3221 'last line' exception handler. Calling functions at that point
3233 'last line' exception handler. Calling functions at that point
3222 changes the stack, and the error reports would have incorrect
3234 changes the stack, and the error reports would have incorrect
3223 tracebacks.
3235 tracebacks.
3224
3236
3225 * IPython/Magic.py (Magic.magic_page): Added new @page magic, to
3237 * IPython/Magic.py (Magic.magic_page): Added new @page magic, to
3226 pass through a peger a pretty-printed form of any object. After a
3238 pass through a peger a pretty-printed form of any object. After a
3227 contribution by Olivier Aubert <oaubert-AT-bat710.univ-lyon1.fr>
3239 contribution by Olivier Aubert <oaubert-AT-bat710.univ-lyon1.fr>
3228
3240
3229 2003-04-14 Fernando Perez <fperez@colorado.edu>
3241 2003-04-14 Fernando Perez <fperez@colorado.edu>
3230
3242
3231 * IPython/iplib.py (InteractiveShell.user_setup): Fixed bug where
3243 * IPython/iplib.py (InteractiveShell.user_setup): Fixed bug where
3232 all files in ~ would be modified at first install (instead of
3244 all files in ~ would be modified at first install (instead of
3233 ~/.ipython). This could be potentially disastrous, as the
3245 ~/.ipython). This could be potentially disastrous, as the
3234 modification (make line-endings native) could damage binary files.
3246 modification (make line-endings native) could damage binary files.
3235
3247
3236 2003-04-10 Fernando Perez <fperez@colorado.edu>
3248 2003-04-10 Fernando Perez <fperez@colorado.edu>
3237
3249
3238 * IPython/iplib.py (InteractiveShell.handle_help): Modified to
3250 * IPython/iplib.py (InteractiveShell.handle_help): Modified to
3239 handle only lines which are invalid python. This now means that
3251 handle only lines which are invalid python. This now means that
3240 lines like 'x=1 #?' execute properly. Thanks to Jeffery Collins
3252 lines like 'x=1 #?' execute properly. Thanks to Jeffery Collins
3241 for the bug report.
3253 for the bug report.
3242
3254
3243 2003-04-01 Fernando Perez <fperez@colorado.edu>
3255 2003-04-01 Fernando Perez <fperez@colorado.edu>
3244
3256
3245 * IPython/iplib.py (InteractiveShell.showtraceback): Fixed bug
3257 * IPython/iplib.py (InteractiveShell.showtraceback): Fixed bug
3246 where failing to set sys.last_traceback would crash pdb.pm().
3258 where failing to set sys.last_traceback would crash pdb.pm().
3247 Thanks to Jeffery D. Collins <Jeff.Collins-AT-vexcel.com> for the bug
3259 Thanks to Jeffery D. Collins <Jeff.Collins-AT-vexcel.com> for the bug
3248 report.
3260 report.
3249
3261
3250 2003-03-25 Fernando Perez <fperez@colorado.edu>
3262 2003-03-25 Fernando Perez <fperez@colorado.edu>
3251
3263
3252 * IPython/Magic.py (Magic.magic_prun): rstrip() output of profiler
3264 * IPython/Magic.py (Magic.magic_prun): rstrip() output of profiler
3253 before printing it (it had a lot of spurious blank lines at the
3265 before printing it (it had a lot of spurious blank lines at the
3254 end).
3266 end).
3255
3267
3256 * IPython/Gnuplot2.py (Gnuplot.hardcopy): fixed bug where lpr
3268 * IPython/Gnuplot2.py (Gnuplot.hardcopy): fixed bug where lpr
3257 output would be sent 21 times! Obviously people don't use this
3269 output would be sent 21 times! Obviously people don't use this
3258 too often, or I would have heard about it.
3270 too often, or I would have heard about it.
3259
3271
3260 2003-03-24 Fernando Perez <fperez@colorado.edu>
3272 2003-03-24 Fernando Perez <fperez@colorado.edu>
3261
3273
3262 * setup.py (scriptfiles): renamed the data_files parameter from
3274 * setup.py (scriptfiles): renamed the data_files parameter from
3263 'base' to 'data' to fix rpm build issues. Thanks to Ralf Ahlbrink
3275 'base' to 'data' to fix rpm build issues. Thanks to Ralf Ahlbrink
3264 for the patch.
3276 for the patch.
3265
3277
3266 2003-03-20 Fernando Perez <fperez@colorado.edu>
3278 2003-03-20 Fernando Perez <fperez@colorado.edu>
3267
3279
3268 * IPython/genutils.py (error): added error() and fatal()
3280 * IPython/genutils.py (error): added error() and fatal()
3269 functions.
3281 functions.
3270
3282
3271 2003-03-18 *** Released version 0.2.15pre3
3283 2003-03-18 *** Released version 0.2.15pre3
3272
3284
3273 2003-03-18 Fernando Perez <fperez@colorado.edu>
3285 2003-03-18 Fernando Perez <fperez@colorado.edu>
3274
3286
3275 * setupext/install_data_ext.py
3287 * setupext/install_data_ext.py
3276 (install_data_ext.initialize_options): Class contributed by Jack
3288 (install_data_ext.initialize_options): Class contributed by Jack
3277 Moffit for fixing the old distutils hack. He is sending this to
3289 Moffit for fixing the old distutils hack. He is sending this to
3278 the distutils folks so in the future we may not need it as a
3290 the distutils folks so in the future we may not need it as a
3279 private fix.
3291 private fix.
3280
3292
3281 * MANIFEST.in: Extensive reorganization, based on Jack Moffit's
3293 * MANIFEST.in: Extensive reorganization, based on Jack Moffit's
3282 changes for Debian packaging. See his patch for full details.
3294 changes for Debian packaging. See his patch for full details.
3283 The old distutils hack of making the ipythonrc* files carry a
3295 The old distutils hack of making the ipythonrc* files carry a
3284 bogus .py extension is gone, at last. Examples were moved to a
3296 bogus .py extension is gone, at last. Examples were moved to a
3285 separate subdir under doc/, and the separate executable scripts
3297 separate subdir under doc/, and the separate executable scripts
3286 now live in their own directory. Overall a great cleanup. The
3298 now live in their own directory. Overall a great cleanup. The
3287 manual was updated to use the new files, and setup.py has been
3299 manual was updated to use the new files, and setup.py has been
3288 fixed for this setup.
3300 fixed for this setup.
3289
3301
3290 * IPython/PyColorize.py (Parser.usage): made non-executable and
3302 * IPython/PyColorize.py (Parser.usage): made non-executable and
3291 created a pycolor wrapper around it to be included as a script.
3303 created a pycolor wrapper around it to be included as a script.
3292
3304
3293 2003-03-12 *** Released version 0.2.15pre2
3305 2003-03-12 *** Released version 0.2.15pre2
3294
3306
3295 2003-03-12 Fernando Perez <fperez@colorado.edu>
3307 2003-03-12 Fernando Perez <fperez@colorado.edu>
3296
3308
3297 * IPython/ColorANSI.py (make_color_table): Finally fixed the
3309 * IPython/ColorANSI.py (make_color_table): Finally fixed the
3298 long-standing problem with garbage characters in some terminals.
3310 long-standing problem with garbage characters in some terminals.
3299 The issue was really that the \001 and \002 escapes must _only_ be
3311 The issue was really that the \001 and \002 escapes must _only_ be
3300 passed to input prompts (which call readline), but _never_ to
3312 passed to input prompts (which call readline), but _never_ to
3301 normal text to be printed on screen. I changed ColorANSI to have
3313 normal text to be printed on screen. I changed ColorANSI to have
3302 two classes: TermColors and InputTermColors, each with the
3314 two classes: TermColors and InputTermColors, each with the
3303 appropriate escapes for input prompts or normal text. The code in
3315 appropriate escapes for input prompts or normal text. The code in
3304 Prompts.py got slightly more complicated, but this very old and
3316 Prompts.py got slightly more complicated, but this very old and
3305 annoying bug is finally fixed.
3317 annoying bug is finally fixed.
3306
3318
3307 All the credit for nailing down the real origin of this problem
3319 All the credit for nailing down the real origin of this problem
3308 and the correct solution goes to Jack Moffit <jack-AT-xiph.org>.
3320 and the correct solution goes to Jack Moffit <jack-AT-xiph.org>.
3309 *Many* thanks to him for spending quite a bit of effort on this.
3321 *Many* thanks to him for spending quite a bit of effort on this.
3310
3322
3311 2003-03-05 *** Released version 0.2.15pre1
3323 2003-03-05 *** Released version 0.2.15pre1
3312
3324
3313 2003-03-03 Fernando Perez <fperez@colorado.edu>
3325 2003-03-03 Fernando Perez <fperez@colorado.edu>
3314
3326
3315 * IPython/FakeModule.py: Moved the former _FakeModule to a
3327 * IPython/FakeModule.py: Moved the former _FakeModule to a
3316 separate file, because it's also needed by Magic (to fix a similar
3328 separate file, because it's also needed by Magic (to fix a similar
3317 pickle-related issue in @run).
3329 pickle-related issue in @run).
3318
3330
3319 2003-03-02 Fernando Perez <fperez@colorado.edu>
3331 2003-03-02 Fernando Perez <fperez@colorado.edu>
3320
3332
3321 * IPython/Magic.py (Magic.magic_autocall): new magic to control
3333 * IPython/Magic.py (Magic.magic_autocall): new magic to control
3322 the autocall option at runtime.
3334 the autocall option at runtime.
3323 (Magic.magic_dhist): changed self.user_ns to self.shell.user_ns
3335 (Magic.magic_dhist): changed self.user_ns to self.shell.user_ns
3324 across Magic.py to start separating Magic from InteractiveShell.
3336 across Magic.py to start separating Magic from InteractiveShell.
3325 (Magic._ofind): Fixed to return proper namespace for dotted
3337 (Magic._ofind): Fixed to return proper namespace for dotted
3326 names. Before, a dotted name would always return 'not currently
3338 names. Before, a dotted name would always return 'not currently
3327 defined', because it would find the 'parent'. s.x would be found,
3339 defined', because it would find the 'parent'. s.x would be found,
3328 but since 'x' isn't defined by itself, it would get confused.
3340 but since 'x' isn't defined by itself, it would get confused.
3329 (Magic.magic_run): Fixed pickling problems reported by Ralf
3341 (Magic.magic_run): Fixed pickling problems reported by Ralf
3330 Ahlbrink <RAhlbrink-AT-RosenInspection.net>. The fix was similar to
3342 Ahlbrink <RAhlbrink-AT-RosenInspection.net>. The fix was similar to
3331 that I'd used when Mike Heeter reported similar issues at the
3343 that I'd used when Mike Heeter reported similar issues at the
3332 top-level, but now for @run. It boils down to injecting the
3344 top-level, but now for @run. It boils down to injecting the
3333 namespace where code is being executed with something that looks
3345 namespace where code is being executed with something that looks
3334 enough like a module to fool pickle.dump(). Since a pickle stores
3346 enough like a module to fool pickle.dump(). Since a pickle stores
3335 a named reference to the importing module, we need this for
3347 a named reference to the importing module, we need this for
3336 pickles to save something sensible.
3348 pickles to save something sensible.
3337
3349
3338 * IPython/ipmaker.py (make_IPython): added an autocall option.
3350 * IPython/ipmaker.py (make_IPython): added an autocall option.
3339
3351
3340 * IPython/iplib.py (InteractiveShell._prefilter): reordered all of
3352 * IPython/iplib.py (InteractiveShell._prefilter): reordered all of
3341 the auto-eval code. Now autocalling is an option, and the code is
3353 the auto-eval code. Now autocalling is an option, and the code is
3342 also vastly safer. There is no more eval() involved at all.
3354 also vastly safer. There is no more eval() involved at all.
3343
3355
3344 2003-03-01 Fernando Perez <fperez@colorado.edu>
3356 2003-03-01 Fernando Perez <fperez@colorado.edu>
3345
3357
3346 * IPython/Magic.py (Magic._ofind): Changed interface to return a
3358 * IPython/Magic.py (Magic._ofind): Changed interface to return a
3347 dict with named keys instead of a tuple.
3359 dict with named keys instead of a tuple.
3348
3360
3349 * IPython: Started using CVS for IPython as of 0.2.15pre1.
3361 * IPython: Started using CVS for IPython as of 0.2.15pre1.
3350
3362
3351 * setup.py (make_shortcut): Fixed message about directories
3363 * setup.py (make_shortcut): Fixed message about directories
3352 created during Windows installation (the directories were ok, just
3364 created during Windows installation (the directories were ok, just
3353 the printed message was misleading). Thanks to Chris Liechti
3365 the printed message was misleading). Thanks to Chris Liechti
3354 <cliechti-AT-gmx.net> for the heads up.
3366 <cliechti-AT-gmx.net> for the heads up.
3355
3367
3356 2003-02-21 Fernando Perez <fperez@colorado.edu>
3368 2003-02-21 Fernando Perez <fperez@colorado.edu>
3357
3369
3358 * IPython/iplib.py (InteractiveShell._prefilter): Fixed catching
3370 * IPython/iplib.py (InteractiveShell._prefilter): Fixed catching
3359 of ValueError exception when checking for auto-execution. This
3371 of ValueError exception when checking for auto-execution. This
3360 one is raised by things like Numeric arrays arr.flat when the
3372 one is raised by things like Numeric arrays arr.flat when the
3361 array is non-contiguous.
3373 array is non-contiguous.
3362
3374
3363 2003-01-31 Fernando Perez <fperez@colorado.edu>
3375 2003-01-31 Fernando Perez <fperez@colorado.edu>
3364
3376
3365 * IPython/genutils.py (SystemExec.bq): Fixed bug where bq would
3377 * IPython/genutils.py (SystemExec.bq): Fixed bug where bq would
3366 not return any value at all (even though the command would get
3378 not return any value at all (even though the command would get
3367 executed).
3379 executed).
3368 (xsys): Flush stdout right after printing the command to ensure
3380 (xsys): Flush stdout right after printing the command to ensure
3369 proper ordering of commands and command output in the total
3381 proper ordering of commands and command output in the total
3370 output.
3382 output.
3371 (SystemExec/xsys/bq): Switched the names of xsys/bq and
3383 (SystemExec/xsys/bq): Switched the names of xsys/bq and
3372 system/getoutput as defaults. The old ones are kept for
3384 system/getoutput as defaults. The old ones are kept for
3373 compatibility reasons, so no code which uses this library needs
3385 compatibility reasons, so no code which uses this library needs
3374 changing.
3386 changing.
3375
3387
3376 2003-01-27 *** Released version 0.2.14
3388 2003-01-27 *** Released version 0.2.14
3377
3389
3378 2003-01-25 Fernando Perez <fperez@colorado.edu>
3390 2003-01-25 Fernando Perez <fperez@colorado.edu>
3379
3391
3380 * IPython/Magic.py (Magic.magic_edit): Fixed problem where
3392 * IPython/Magic.py (Magic.magic_edit): Fixed problem where
3381 functions defined in previous edit sessions could not be re-edited
3393 functions defined in previous edit sessions could not be re-edited
3382 (because the temp files were immediately removed). Now temp files
3394 (because the temp files were immediately removed). Now temp files
3383 are removed only at IPython's exit.
3395 are removed only at IPython's exit.
3384 (Magic.magic_run): Improved @run to perform shell-like expansions
3396 (Magic.magic_run): Improved @run to perform shell-like expansions
3385 on its arguments (~users and $VARS). With this, @run becomes more
3397 on its arguments (~users and $VARS). With this, @run becomes more
3386 like a normal command-line.
3398 like a normal command-line.
3387
3399
3388 * IPython/Shell.py (IPShellEmbed.__call__): Fixed a bunch of small
3400 * IPython/Shell.py (IPShellEmbed.__call__): Fixed a bunch of small
3389 bugs related to embedding and cleaned up that code. A fairly
3401 bugs related to embedding and cleaned up that code. A fairly
3390 important one was the impossibility to access the global namespace
3402 important one was the impossibility to access the global namespace
3391 through the embedded IPython (only local variables were visible).
3403 through the embedded IPython (only local variables were visible).
3392
3404
3393 2003-01-14 Fernando Perez <fperez@colorado.edu>
3405 2003-01-14 Fernando Perez <fperez@colorado.edu>
3394
3406
3395 * IPython/iplib.py (InteractiveShell._prefilter): Fixed
3407 * IPython/iplib.py (InteractiveShell._prefilter): Fixed
3396 auto-calling to be a bit more conservative. Now it doesn't get
3408 auto-calling to be a bit more conservative. Now it doesn't get
3397 triggered if any of '!=()<>' are in the rest of the input line, to
3409 triggered if any of '!=()<>' are in the rest of the input line, to
3398 allow comparing callables. Thanks to Alex for the heads up.
3410 allow comparing callables. Thanks to Alex for the heads up.
3399
3411
3400 2003-01-07 Fernando Perez <fperez@colorado.edu>
3412 2003-01-07 Fernando Perez <fperez@colorado.edu>
3401
3413
3402 * IPython/genutils.py (page): fixed estimation of the number of
3414 * IPython/genutils.py (page): fixed estimation of the number of
3403 lines in a string to be paged to simply count newlines. This
3415 lines in a string to be paged to simply count newlines. This
3404 prevents over-guessing due to embedded escape sequences. A better
3416 prevents over-guessing due to embedded escape sequences. A better
3405 long-term solution would involve stripping out the control chars
3417 long-term solution would involve stripping out the control chars
3406 for the count, but it's potentially so expensive I just don't
3418 for the count, but it's potentially so expensive I just don't
3407 think it's worth doing.
3419 think it's worth doing.
3408
3420
3409 2002-12-19 *** Released version 0.2.14pre50
3421 2002-12-19 *** Released version 0.2.14pre50
3410
3422
3411 2002-12-19 Fernando Perez <fperez@colorado.edu>
3423 2002-12-19 Fernando Perez <fperez@colorado.edu>
3412
3424
3413 * tools/release (version): Changed release scripts to inform
3425 * tools/release (version): Changed release scripts to inform
3414 Andrea and build a NEWS file with a list of recent changes.
3426 Andrea and build a NEWS file with a list of recent changes.
3415
3427
3416 * IPython/ColorANSI.py (__all__): changed terminal detection
3428 * IPython/ColorANSI.py (__all__): changed terminal detection
3417 code. Seems to work better for xterms without breaking
3429 code. Seems to work better for xterms without breaking
3418 konsole. Will need more testing to determine if WinXP and Mac OSX
3430 konsole. Will need more testing to determine if WinXP and Mac OSX
3419 also work ok.
3431 also work ok.
3420
3432
3421 2002-12-18 *** Released version 0.2.14pre49
3433 2002-12-18 *** Released version 0.2.14pre49
3422
3434
3423 2002-12-18 Fernando Perez <fperez@colorado.edu>
3435 2002-12-18 Fernando Perez <fperez@colorado.edu>
3424
3436
3425 * Docs: added new info about Mac OSX, from Andrea.
3437 * Docs: added new info about Mac OSX, from Andrea.
3426
3438
3427 * IPython/Gnuplot2.py (String): Added a String PlotItem class to
3439 * IPython/Gnuplot2.py (String): Added a String PlotItem class to
3428 allow direct plotting of python strings whose format is the same
3440 allow direct plotting of python strings whose format is the same
3429 of gnuplot data files.
3441 of gnuplot data files.
3430
3442
3431 2002-12-16 Fernando Perez <fperez@colorado.edu>
3443 2002-12-16 Fernando Perez <fperez@colorado.edu>
3432
3444
3433 * IPython/iplib.py (InteractiveShell.interact): fixed default (y)
3445 * IPython/iplib.py (InteractiveShell.interact): fixed default (y)
3434 value of exit question to be acknowledged.
3446 value of exit question to be acknowledged.
3435
3447
3436 2002-12-03 Fernando Perez <fperez@colorado.edu>
3448 2002-12-03 Fernando Perez <fperez@colorado.edu>
3437
3449
3438 * IPython/ipmaker.py: removed generators, which had been added
3450 * IPython/ipmaker.py: removed generators, which had been added
3439 by mistake in an earlier debugging run. This was causing trouble
3451 by mistake in an earlier debugging run. This was causing trouble
3440 to users of python 2.1.x. Thanks to Abel Daniel <abli-AT-freemail.hu>
3452 to users of python 2.1.x. Thanks to Abel Daniel <abli-AT-freemail.hu>
3441 for pointing this out.
3453 for pointing this out.
3442
3454
3443 2002-11-17 Fernando Perez <fperez@colorado.edu>
3455 2002-11-17 Fernando Perez <fperez@colorado.edu>
3444
3456
3445 * Manual: updated the Gnuplot section.
3457 * Manual: updated the Gnuplot section.
3446
3458
3447 * IPython/GnuplotRuntime.py: refactored a lot all this code, with
3459 * IPython/GnuplotRuntime.py: refactored a lot all this code, with
3448 a much better split of what goes in Runtime and what goes in
3460 a much better split of what goes in Runtime and what goes in
3449 Interactive.
3461 Interactive.
3450
3462
3451 * IPython/ipmaker.py: fixed bug where import_fail_info wasn't
3463 * IPython/ipmaker.py: fixed bug where import_fail_info wasn't
3452 being imported from iplib.
3464 being imported from iplib.
3453
3465
3454 * IPython/GnuplotInteractive.py (magic_gpc): renamed @gp to @gpc
3466 * IPython/GnuplotInteractive.py (magic_gpc): renamed @gp to @gpc
3455 for command-passing. Now the global Gnuplot instance is called
3467 for command-passing. Now the global Gnuplot instance is called
3456 'gp' instead of 'g', which was really a far too fragile and
3468 'gp' instead of 'g', which was really a far too fragile and
3457 common name.
3469 common name.
3458
3470
3459 * IPython/Gnuplot2.py (eps_fix_bbox): added this to fix broken
3471 * IPython/Gnuplot2.py (eps_fix_bbox): added this to fix broken
3460 bounding boxes generated by Gnuplot for square plots.
3472 bounding boxes generated by Gnuplot for square plots.
3461
3473
3462 * IPython/genutils.py (popkey): new function added. I should
3474 * IPython/genutils.py (popkey): new function added. I should
3463 suggest this on c.l.py as a dict method, it seems useful.
3475 suggest this on c.l.py as a dict method, it seems useful.
3464
3476
3465 * IPython/Gnuplot2.py (Gnuplot.plot): Overhauled plot and replot
3477 * IPython/Gnuplot2.py (Gnuplot.plot): Overhauled plot and replot
3466 to transparently handle PostScript generation. MUCH better than
3478 to transparently handle PostScript generation. MUCH better than
3467 the previous plot_eps/replot_eps (which I removed now). The code
3479 the previous plot_eps/replot_eps (which I removed now). The code
3468 is also fairly clean and well documented now (including
3480 is also fairly clean and well documented now (including
3469 docstrings).
3481 docstrings).
3470
3482
3471 2002-11-13 Fernando Perez <fperez@colorado.edu>
3483 2002-11-13 Fernando Perez <fperez@colorado.edu>
3472
3484
3473 * IPython/Magic.py (Magic.magic_edit): fixed docstring
3485 * IPython/Magic.py (Magic.magic_edit): fixed docstring
3474 (inconsistent with options).
3486 (inconsistent with options).
3475
3487
3476 * IPython/Gnuplot2.py (Gnuplot.hardcopy): hardcopy had been
3488 * IPython/Gnuplot2.py (Gnuplot.hardcopy): hardcopy had been
3477 manually disabled, I don't know why. Fixed it.
3489 manually disabled, I don't know why. Fixed it.
3478 (Gnuplot._plot_eps): added new plot_eps/replot_eps to get directly
3490 (Gnuplot._plot_eps): added new plot_eps/replot_eps to get directly
3479 eps output.
3491 eps output.
3480
3492
3481 2002-11-12 Fernando Perez <fperez@colorado.edu>
3493 2002-11-12 Fernando Perez <fperez@colorado.edu>
3482
3494
3483 * IPython/genutils.py (ask_yes_no): trap EOF and ^C so that they
3495 * IPython/genutils.py (ask_yes_no): trap EOF and ^C so that they
3484 don't propagate up to caller. Fixes crash reported by François
3496 don't propagate up to caller. Fixes crash reported by François
3485 Pinard.
3497 Pinard.
3486
3498
3487 2002-11-09 Fernando Perez <fperez@colorado.edu>
3499 2002-11-09 Fernando Perez <fperez@colorado.edu>
3488
3500
3489 * IPython/ipmaker.py (make_IPython): fixed problem with writing
3501 * IPython/ipmaker.py (make_IPython): fixed problem with writing
3490 history file for new users.
3502 history file for new users.
3491 (make_IPython): fixed bug where initial install would leave the
3503 (make_IPython): fixed bug where initial install would leave the
3492 user running in the .ipython dir.
3504 user running in the .ipython dir.
3493 (make_IPython): fixed bug where config dir .ipython would be
3505 (make_IPython): fixed bug where config dir .ipython would be
3494 created regardless of the given -ipythondir option. Thanks to Cory
3506 created regardless of the given -ipythondir option. Thanks to Cory
3495 Dodt <cdodt-AT-fcoe.k12.ca.us> for the bug report.
3507 Dodt <cdodt-AT-fcoe.k12.ca.us> for the bug report.
3496
3508
3497 * IPython/genutils.py (ask_yes_no): new function for asking yes/no
3509 * IPython/genutils.py (ask_yes_no): new function for asking yes/no
3498 type confirmations. Will need to use it in all of IPython's code
3510 type confirmations. Will need to use it in all of IPython's code
3499 consistently.
3511 consistently.
3500
3512
3501 * IPython/CrashHandler.py (CrashHandler.__call__): changed the
3513 * IPython/CrashHandler.py (CrashHandler.__call__): changed the
3502 context to print 31 lines instead of the default 5. This will make
3514 context to print 31 lines instead of the default 5. This will make
3503 the crash reports extremely detailed in case the problem is in
3515 the crash reports extremely detailed in case the problem is in
3504 libraries I don't have access to.
3516 libraries I don't have access to.
3505
3517
3506 * IPython/iplib.py (InteractiveShell.interact): changed the 'last
3518 * IPython/iplib.py (InteractiveShell.interact): changed the 'last
3507 line of defense' code to still crash, but giving users fair
3519 line of defense' code to still crash, but giving users fair
3508 warning. I don't want internal errors to go unreported: if there's
3520 warning. I don't want internal errors to go unreported: if there's
3509 an internal problem, IPython should crash and generate a full
3521 an internal problem, IPython should crash and generate a full
3510 report.
3522 report.
3511
3523
3512 2002-11-08 Fernando Perez <fperez@colorado.edu>
3524 2002-11-08 Fernando Perez <fperez@colorado.edu>
3513
3525
3514 * IPython/iplib.py (InteractiveShell.interact): added code to trap
3526 * IPython/iplib.py (InteractiveShell.interact): added code to trap
3515 otherwise uncaught exceptions which can appear if people set
3527 otherwise uncaught exceptions which can appear if people set
3516 sys.stdout to something badly broken. Thanks to a crash report
3528 sys.stdout to something badly broken. Thanks to a crash report
3517 from henni-AT-mail.brainbot.com.
3529 from henni-AT-mail.brainbot.com.
3518
3530
3519 2002-11-04 Fernando Perez <fperez@colorado.edu>
3531 2002-11-04 Fernando Perez <fperez@colorado.edu>
3520
3532
3521 * IPython/iplib.py (InteractiveShell.interact): added
3533 * IPython/iplib.py (InteractiveShell.interact): added
3522 __IPYTHON__active to the builtins. It's a flag which goes on when
3534 __IPYTHON__active to the builtins. It's a flag which goes on when
3523 the interaction starts and goes off again when it stops. This
3535 the interaction starts and goes off again when it stops. This
3524 allows embedding code to detect being inside IPython. Before this
3536 allows embedding code to detect being inside IPython. Before this
3525 was done via __IPYTHON__, but that only shows that an IPython
3537 was done via __IPYTHON__, but that only shows that an IPython
3526 instance has been created.
3538 instance has been created.
3527
3539
3528 * IPython/Magic.py (Magic.magic_env): I realized that in a
3540 * IPython/Magic.py (Magic.magic_env): I realized that in a
3529 UserDict, instance.data holds the data as a normal dict. So I
3541 UserDict, instance.data holds the data as a normal dict. So I
3530 modified @env to return os.environ.data instead of rebuilding a
3542 modified @env to return os.environ.data instead of rebuilding a
3531 dict by hand.
3543 dict by hand.
3532
3544
3533 2002-11-02 Fernando Perez <fperez@colorado.edu>
3545 2002-11-02 Fernando Perez <fperez@colorado.edu>
3534
3546
3535 * IPython/genutils.py (warn): changed so that level 1 prints no
3547 * IPython/genutils.py (warn): changed so that level 1 prints no
3536 header. Level 2 is now the default (with 'WARNING' header, as
3548 header. Level 2 is now the default (with 'WARNING' header, as
3537 before). I think I tracked all places where changes were needed in
3549 before). I think I tracked all places where changes were needed in
3538 IPython, but outside code using the old level numbering may have
3550 IPython, but outside code using the old level numbering may have
3539 broken.
3551 broken.
3540
3552
3541 * IPython/iplib.py (InteractiveShell.runcode): added this to
3553 * IPython/iplib.py (InteractiveShell.runcode): added this to
3542 handle the tracebacks in SystemExit traps correctly. The previous
3554 handle the tracebacks in SystemExit traps correctly. The previous
3543 code (through interact) was printing more of the stack than
3555 code (through interact) was printing more of the stack than
3544 necessary, showing IPython internal code to the user.
3556 necessary, showing IPython internal code to the user.
3545
3557
3546 * IPython/UserConfig/ipythonrc.py: Made confirm_exit 1 by
3558 * IPython/UserConfig/ipythonrc.py: Made confirm_exit 1 by
3547 default. Now that the default at the confirmation prompt is yes,
3559 default. Now that the default at the confirmation prompt is yes,
3548 it's not so intrusive. François' argument that ipython sessions
3560 it's not so intrusive. François' argument that ipython sessions
3549 tend to be complex enough not to lose them from an accidental C-d,
3561 tend to be complex enough not to lose them from an accidental C-d,
3550 is a valid one.
3562 is a valid one.
3551
3563
3552 * IPython/iplib.py (InteractiveShell.interact): added a
3564 * IPython/iplib.py (InteractiveShell.interact): added a
3553 showtraceback() call to the SystemExit trap, and modified the exit
3565 showtraceback() call to the SystemExit trap, and modified the exit
3554 confirmation to have yes as the default.
3566 confirmation to have yes as the default.
3555
3567
3556 * IPython/UserConfig/ipythonrc.py: removed 'session' option from
3568 * IPython/UserConfig/ipythonrc.py: removed 'session' option from
3557 this file. It's been gone from the code for a long time, this was
3569 this file. It's been gone from the code for a long time, this was
3558 simply leftover junk.
3570 simply leftover junk.
3559
3571
3560 2002-11-01 Fernando Perez <fperez@colorado.edu>
3572 2002-11-01 Fernando Perez <fperez@colorado.edu>
3561
3573
3562 * IPython/UserConfig/ipythonrc.py: new confirm_exit option
3574 * IPython/UserConfig/ipythonrc.py: new confirm_exit option
3563 added. If set, IPython now traps EOF and asks for
3575 added. If set, IPython now traps EOF and asks for
3564 confirmation. After a request by François Pinard.
3576 confirmation. After a request by François Pinard.
3565
3577
3566 * IPython/Magic.py (Magic.magic_Exit): New @Exit and @Quit instead
3578 * IPython/Magic.py (Magic.magic_Exit): New @Exit and @Quit instead
3567 of @abort, and with a new (better) mechanism for handling the
3579 of @abort, and with a new (better) mechanism for handling the
3568 exceptions.
3580 exceptions.
3569
3581
3570 2002-10-27 Fernando Perez <fperez@colorado.edu>
3582 2002-10-27 Fernando Perez <fperez@colorado.edu>
3571
3583
3572 * IPython/usage.py (__doc__): updated the --help information and
3584 * IPython/usage.py (__doc__): updated the --help information and
3573 the ipythonrc file to indicate that -log generates
3585 the ipythonrc file to indicate that -log generates
3574 ./ipython.log. Also fixed the corresponding info in @logstart.
3586 ./ipython.log. Also fixed the corresponding info in @logstart.
3575 This and several other fixes in the manuals thanks to reports by
3587 This and several other fixes in the manuals thanks to reports by
3576 François Pinard <pinard-AT-iro.umontreal.ca>.
3588 François Pinard <pinard-AT-iro.umontreal.ca>.
3577
3589
3578 * IPython/Logger.py (Logger.switch_log): Fixed error message to
3590 * IPython/Logger.py (Logger.switch_log): Fixed error message to
3579 refer to @logstart (instead of @log, which doesn't exist).
3591 refer to @logstart (instead of @log, which doesn't exist).
3580
3592
3581 * IPython/iplib.py (InteractiveShell._prefilter): fixed
3593 * IPython/iplib.py (InteractiveShell._prefilter): fixed
3582 AttributeError crash. Thanks to Christopher Armstrong
3594 AttributeError crash. Thanks to Christopher Armstrong
3583 <radix-AT-twistedmatrix.com> for the report/fix. This bug had been
3595 <radix-AT-twistedmatrix.com> for the report/fix. This bug had been
3584 introduced recently (in 0.2.14pre37) with the fix to the eval
3596 introduced recently (in 0.2.14pre37) with the fix to the eval
3585 problem mentioned below.
3597 problem mentioned below.
3586
3598
3587 2002-10-17 Fernando Perez <fperez@colorado.edu>
3599 2002-10-17 Fernando Perez <fperez@colorado.edu>
3588
3600
3589 * IPython/ConfigLoader.py (ConfigLoader.load): Fixes for Windows
3601 * IPython/ConfigLoader.py (ConfigLoader.load): Fixes for Windows
3590 installation. Thanks to Leonardo Santagada <retype-AT-terra.com.br>.
3602 installation. Thanks to Leonardo Santagada <retype-AT-terra.com.br>.
3591
3603
3592 * IPython/iplib.py (InteractiveShell._prefilter): Many changes to
3604 * IPython/iplib.py (InteractiveShell._prefilter): Many changes to
3593 this function to fix a problem reported by Alex Schmolck. He saw
3605 this function to fix a problem reported by Alex Schmolck. He saw
3594 it with list comprehensions and generators, which were getting
3606 it with list comprehensions and generators, which were getting
3595 called twice. The real problem was an 'eval' call in testing for
3607 called twice. The real problem was an 'eval' call in testing for
3596 automagic which was evaluating the input line silently.
3608 automagic which was evaluating the input line silently.
3597
3609
3598 This is a potentially very nasty bug, if the input has side
3610 This is a potentially very nasty bug, if the input has side
3599 effects which must not be repeated. The code is much cleaner now,
3611 effects which must not be repeated. The code is much cleaner now,
3600 without any blanket 'except' left and with a regexp test for
3612 without any blanket 'except' left and with a regexp test for
3601 actual function names.
3613 actual function names.
3602
3614
3603 But an eval remains, which I'm not fully comfortable with. I just
3615 But an eval remains, which I'm not fully comfortable with. I just
3604 don't know how to find out if an expression could be a callable in
3616 don't know how to find out if an expression could be a callable in
3605 the user's namespace without doing an eval on the string. However
3617 the user's namespace without doing an eval on the string. However
3606 that string is now much more strictly checked so that no code
3618 that string is now much more strictly checked so that no code
3607 slips by, so the eval should only happen for things that can
3619 slips by, so the eval should only happen for things that can
3608 really be only function/method names.
3620 really be only function/method names.
3609
3621
3610 2002-10-15 Fernando Perez <fperez@colorado.edu>
3622 2002-10-15 Fernando Perez <fperez@colorado.edu>
3611
3623
3612 * Updated LyX to 1.2.1 so I can work on the docs again. Added Mac
3624 * Updated LyX to 1.2.1 so I can work on the docs again. Added Mac
3613 OSX information to main manual, removed README_Mac_OSX file from
3625 OSX information to main manual, removed README_Mac_OSX file from
3614 distribution. Also updated credits for recent additions.
3626 distribution. Also updated credits for recent additions.
3615
3627
3616 2002-10-10 Fernando Perez <fperez@colorado.edu>
3628 2002-10-10 Fernando Perez <fperez@colorado.edu>
3617
3629
3618 * README_Mac_OSX: Added a README for Mac OSX users for fixing
3630 * README_Mac_OSX: Added a README for Mac OSX users for fixing
3619 terminal-related issues. Many thanks to Andrea Riciputi
3631 terminal-related issues. Many thanks to Andrea Riciputi
3620 <andrea.riciputi-AT-libero.it> for writing it.
3632 <andrea.riciputi-AT-libero.it> for writing it.
3621
3633
3622 * IPython/UserConfig/ipythonrc.py: Fixes to various small issues,
3634 * IPython/UserConfig/ipythonrc.py: Fixes to various small issues,
3623 thanks to Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
3635 thanks to Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
3624
3636
3625 * setup.py (make_shortcut): Fixes for Windows installation. Thanks
3637 * setup.py (make_shortcut): Fixes for Windows installation. Thanks
3626 to Fredrik Kant <fredrik.kant-AT-front.com> and Syver Enstad
3638 to Fredrik Kant <fredrik.kant-AT-front.com> and Syver Enstad
3627 <syver-en-AT-online.no> who both submitted patches for this problem.
3639 <syver-en-AT-online.no> who both submitted patches for this problem.
3628
3640
3629 * IPython/iplib.py (InteractiveShell.embed_mainloop): Patch for
3641 * IPython/iplib.py (InteractiveShell.embed_mainloop): Patch for
3630 global embedding to make sure that things don't overwrite user
3642 global embedding to make sure that things don't overwrite user
3631 globals accidentally. Thanks to Richard <rxe-AT-renre-europe.com>
3643 globals accidentally. Thanks to Richard <rxe-AT-renre-europe.com>
3632
3644
3633 * IPython/Gnuplot2.py (gp): Patch for Gnuplot.py 1.6
3645 * IPython/Gnuplot2.py (gp): Patch for Gnuplot.py 1.6
3634 compatibility. Thanks to Hayden Callow
3646 compatibility. Thanks to Hayden Callow
3635 <h.callow-AT-elec.canterbury.ac.nz>
3647 <h.callow-AT-elec.canterbury.ac.nz>
3636
3648
3637 2002-10-04 Fernando Perez <fperez@colorado.edu>
3649 2002-10-04 Fernando Perez <fperez@colorado.edu>
3638
3650
3639 * IPython/Gnuplot2.py (PlotItem): Added 'index' option for
3651 * IPython/Gnuplot2.py (PlotItem): Added 'index' option for
3640 Gnuplot.File objects.
3652 Gnuplot.File objects.
3641
3653
3642 2002-07-23 Fernando Perez <fperez@colorado.edu>
3654 2002-07-23 Fernando Perez <fperez@colorado.edu>
3643
3655
3644 * IPython/genutils.py (timing): Added timings() and timing() for
3656 * IPython/genutils.py (timing): Added timings() and timing() for
3645 quick access to the most commonly needed data, the execution
3657 quick access to the most commonly needed data, the execution
3646 times. Old timing() renamed to timings_out().
3658 times. Old timing() renamed to timings_out().
3647
3659
3648 2002-07-18 Fernando Perez <fperez@colorado.edu>
3660 2002-07-18 Fernando Perez <fperez@colorado.edu>
3649
3661
3650 * IPython/Shell.py (IPShellEmbed.restore_system_completer): fixed
3662 * IPython/Shell.py (IPShellEmbed.restore_system_completer): fixed
3651 bug with nested instances disrupting the parent's tab completion.
3663 bug with nested instances disrupting the parent's tab completion.
3652
3664
3653 * IPython/iplib.py (all_completions): Added Alex Schmolck's
3665 * IPython/iplib.py (all_completions): Added Alex Schmolck's
3654 all_completions code to begin the emacs integration.
3666 all_completions code to begin the emacs integration.
3655
3667
3656 * IPython/Gnuplot2.py (zip_items): Added optional 'titles'
3668 * IPython/Gnuplot2.py (zip_items): Added optional 'titles'
3657 argument to allow titling individual arrays when plotting.
3669 argument to allow titling individual arrays when plotting.
3658
3670
3659 2002-07-15 Fernando Perez <fperez@colorado.edu>
3671 2002-07-15 Fernando Perez <fperez@colorado.edu>
3660
3672
3661 * setup.py (make_shortcut): changed to retrieve the value of
3673 * setup.py (make_shortcut): changed to retrieve the value of
3662 'Program Files' directory from the registry (this value changes in
3674 'Program Files' directory from the registry (this value changes in
3663 non-english versions of Windows). Thanks to Thomas Fanslau
3675 non-english versions of Windows). Thanks to Thomas Fanslau
3664 <tfanslau-AT-gmx.de> for the report.
3676 <tfanslau-AT-gmx.de> for the report.
3665
3677
3666 2002-07-10 Fernando Perez <fperez@colorado.edu>
3678 2002-07-10 Fernando Perez <fperez@colorado.edu>
3667
3679
3668 * IPython/ultraTB.py (VerboseTB.debugger): enabled workaround for
3680 * IPython/ultraTB.py (VerboseTB.debugger): enabled workaround for
3669 a bug in pdb, which crashes if a line with only whitespace is
3681 a bug in pdb, which crashes if a line with only whitespace is
3670 entered. Bug report submitted to sourceforge.
3682 entered. Bug report submitted to sourceforge.
3671
3683
3672 2002-07-09 Fernando Perez <fperez@colorado.edu>
3684 2002-07-09 Fernando Perez <fperez@colorado.edu>
3673
3685
3674 * IPython/ultraTB.py (VerboseTB.nullrepr): fixed rare crash when
3686 * IPython/ultraTB.py (VerboseTB.nullrepr): fixed rare crash when
3675 reporting exceptions (it's a bug in inspect.py, I just set a
3687 reporting exceptions (it's a bug in inspect.py, I just set a
3676 workaround).
3688 workaround).
3677
3689
3678 2002-07-08 Fernando Perez <fperez@colorado.edu>
3690 2002-07-08 Fernando Perez <fperez@colorado.edu>
3679
3691
3680 * IPython/iplib.py (InteractiveShell.__init__): fixed reference to
3692 * IPython/iplib.py (InteractiveShell.__init__): fixed reference to
3681 __IPYTHON__ in __builtins__ to show up in user_ns.
3693 __IPYTHON__ in __builtins__ to show up in user_ns.
3682
3694
3683 2002-07-03 Fernando Perez <fperez@colorado.edu>
3695 2002-07-03 Fernando Perez <fperez@colorado.edu>
3684
3696
3685 * IPython/GnuplotInteractive.py (magic_gp_set_default): changed
3697 * IPython/GnuplotInteractive.py (magic_gp_set_default): changed
3686 name from @gp_set_instance to @gp_set_default.
3698 name from @gp_set_instance to @gp_set_default.
3687
3699
3688 * IPython/ipmaker.py (make_IPython): default editor value set to
3700 * IPython/ipmaker.py (make_IPython): default editor value set to
3689 '0' (a string), to match the rc file. Otherwise will crash when
3701 '0' (a string), to match the rc file. Otherwise will crash when
3690 .strip() is called on it.
3702 .strip() is called on it.
3691
3703
3692
3704
3693 2002-06-28 Fernando Perez <fperez@colorado.edu>
3705 2002-06-28 Fernando Perez <fperez@colorado.edu>
3694
3706
3695 * IPython/iplib.py (InteractiveShell.safe_execfile): fix importing
3707 * IPython/iplib.py (InteractiveShell.safe_execfile): fix importing
3696 of files in current directory when a file is executed via
3708 of files in current directory when a file is executed via
3697 @run. Patch also by RA <ralf_ahlbrink-AT-web.de>.
3709 @run. Patch also by RA <ralf_ahlbrink-AT-web.de>.
3698
3710
3699 * setup.py (manfiles): fix for rpm builds, submitted by RA
3711 * setup.py (manfiles): fix for rpm builds, submitted by RA
3700 <ralf_ahlbrink-AT-web.de>. Now we have RPMs!
3712 <ralf_ahlbrink-AT-web.de>. Now we have RPMs!
3701
3713
3702 * IPython/ipmaker.py (make_IPython): fixed lookup of default
3714 * IPython/ipmaker.py (make_IPython): fixed lookup of default
3703 editor when set to '0'. Problem was, '0' evaluates to True (it's a
3715 editor when set to '0'. Problem was, '0' evaluates to True (it's a
3704 string!). A. Schmolck caught this one.
3716 string!). A. Schmolck caught this one.
3705
3717
3706 2002-06-27 Fernando Perez <fperez@colorado.edu>
3718 2002-06-27 Fernando Perez <fperez@colorado.edu>
3707
3719
3708 * IPython/ipmaker.py (make_IPython): fixed bug when running user
3720 * IPython/ipmaker.py (make_IPython): fixed bug when running user
3709 defined files at the cmd line. __name__ wasn't being set to
3721 defined files at the cmd line. __name__ wasn't being set to
3710 __main__.
3722 __main__.
3711
3723
3712 * IPython/Gnuplot2.py (zip_items): improved it so it can plot also
3724 * IPython/Gnuplot2.py (zip_items): improved it so it can plot also
3713 regular lists and tuples besides Numeric arrays.
3725 regular lists and tuples besides Numeric arrays.
3714
3726
3715 * IPython/Prompts.py (CachedOutput.__call__): Added output
3727 * IPython/Prompts.py (CachedOutput.__call__): Added output
3716 supression for input ending with ';'. Similar to Mathematica and
3728 supression for input ending with ';'. Similar to Mathematica and
3717 Matlab. The _* vars and Out[] list are still updated, just like
3729 Matlab. The _* vars and Out[] list are still updated, just like
3718 Mathematica behaves.
3730 Mathematica behaves.
3719
3731
3720 2002-06-25 Fernando Perez <fperez@colorado.edu>
3732 2002-06-25 Fernando Perez <fperez@colorado.edu>
3721
3733
3722 * IPython/ConfigLoader.py (ConfigLoader.load): fixed checking of
3734 * IPython/ConfigLoader.py (ConfigLoader.load): fixed checking of
3723 .ini extensions for profiels under Windows.
3735 .ini extensions for profiels under Windows.
3724
3736
3725 * IPython/OInspect.py (Inspector.pinfo): improved alignment of
3737 * IPython/OInspect.py (Inspector.pinfo): improved alignment of
3726 string form. Fix contributed by Alexander Schmolck
3738 string form. Fix contributed by Alexander Schmolck
3727 <a.schmolck-AT-gmx.net>
3739 <a.schmolck-AT-gmx.net>
3728
3740
3729 * IPython/GnuplotRuntime.py (gp_new): new function. Returns a
3741 * IPython/GnuplotRuntime.py (gp_new): new function. Returns a
3730 pre-configured Gnuplot instance.
3742 pre-configured Gnuplot instance.
3731
3743
3732 2002-06-21 Fernando Perez <fperez@colorado.edu>
3744 2002-06-21 Fernando Perez <fperez@colorado.edu>
3733
3745
3734 * IPython/numutils.py (exp_safe): new function, works around the
3746 * IPython/numutils.py (exp_safe): new function, works around the
3735 underflow problems in Numeric.
3747 underflow problems in Numeric.
3736 (log2): New fn. Safe log in base 2: returns exact integer answer
3748 (log2): New fn. Safe log in base 2: returns exact integer answer
3737 for exact integer powers of 2.
3749 for exact integer powers of 2.
3738
3750
3739 * IPython/Magic.py (get_py_filename): fixed it not expanding '~'
3751 * IPython/Magic.py (get_py_filename): fixed it not expanding '~'
3740 properly.
3752 properly.
3741
3753
3742 2002-06-20 Fernando Perez <fperez@colorado.edu>
3754 2002-06-20 Fernando Perez <fperez@colorado.edu>
3743
3755
3744 * IPython/genutils.py (timing): new function like
3756 * IPython/genutils.py (timing): new function like
3745 Mathematica's. Similar to time_test, but returns more info.
3757 Mathematica's. Similar to time_test, but returns more info.
3746
3758
3747 2002-06-18 Fernando Perez <fperez@colorado.edu>
3759 2002-06-18 Fernando Perez <fperez@colorado.edu>
3748
3760
3749 * IPython/Magic.py (Magic.magic_save): modified @save and @r
3761 * IPython/Magic.py (Magic.magic_save): modified @save and @r
3750 according to Mike Heeter's suggestions.
3762 according to Mike Heeter's suggestions.
3751
3763
3752 2002-06-16 Fernando Perez <fperez@colorado.edu>
3764 2002-06-16 Fernando Perez <fperez@colorado.edu>
3753
3765
3754 * IPython/GnuplotRuntime.py: Massive overhaul to the Gnuplot
3766 * IPython/GnuplotRuntime.py: Massive overhaul to the Gnuplot
3755 system. GnuplotMagic is gone as a user-directory option. New files
3767 system. GnuplotMagic is gone as a user-directory option. New files
3756 make it easier to use all the gnuplot stuff both from external
3768 make it easier to use all the gnuplot stuff both from external
3757 programs as well as from IPython. Had to rewrite part of
3769 programs as well as from IPython. Had to rewrite part of
3758 hardcopy() b/c of a strange bug: often the ps files simply don't
3770 hardcopy() b/c of a strange bug: often the ps files simply don't
3759 get created, and require a repeat of the command (often several
3771 get created, and require a repeat of the command (often several
3760 times).
3772 times).
3761
3773
3762 * IPython/ultraTB.py (AutoFormattedTB.__call__): changed to
3774 * IPython/ultraTB.py (AutoFormattedTB.__call__): changed to
3763 resolve output channel at call time, so that if sys.stderr has
3775 resolve output channel at call time, so that if sys.stderr has
3764 been redirected by user this gets honored.
3776 been redirected by user this gets honored.
3765
3777
3766 2002-06-13 Fernando Perez <fperez@colorado.edu>
3778 2002-06-13 Fernando Perez <fperez@colorado.edu>
3767
3779
3768 * IPython/Shell.py (IPShell.__init__): Changed IPythonShell to
3780 * IPython/Shell.py (IPShell.__init__): Changed IPythonShell to
3769 IPShell. Kept a copy with the old names to avoid breaking people's
3781 IPShell. Kept a copy with the old names to avoid breaking people's
3770 embedded code.
3782 embedded code.
3771
3783
3772 * IPython/ipython: simplified it to the bare minimum after
3784 * IPython/ipython: simplified it to the bare minimum after
3773 Holger's suggestions. Added info about how to use it in
3785 Holger's suggestions. Added info about how to use it in
3774 PYTHONSTARTUP.
3786 PYTHONSTARTUP.
3775
3787
3776 * IPython/Shell.py (IPythonShell): changed the options passing
3788 * IPython/Shell.py (IPythonShell): changed the options passing
3777 from a string with funky %s replacements to a straight list. Maybe
3789 from a string with funky %s replacements to a straight list. Maybe
3778 a bit more typing, but it follows sys.argv conventions, so there's
3790 a bit more typing, but it follows sys.argv conventions, so there's
3779 less special-casing to remember.
3791 less special-casing to remember.
3780
3792
3781 2002-06-12 Fernando Perez <fperez@colorado.edu>
3793 2002-06-12 Fernando Perez <fperez@colorado.edu>
3782
3794
3783 * IPython/Magic.py (Magic.magic_r): new magic auto-repeat
3795 * IPython/Magic.py (Magic.magic_r): new magic auto-repeat
3784 command. Thanks to a suggestion by Mike Heeter.
3796 command. Thanks to a suggestion by Mike Heeter.
3785 (Magic.magic_pfile): added behavior to look at filenames if given
3797 (Magic.magic_pfile): added behavior to look at filenames if given
3786 arg is not a defined object.
3798 arg is not a defined object.
3787 (Magic.magic_save): New @save function to save code snippets. Also
3799 (Magic.magic_save): New @save function to save code snippets. Also
3788 a Mike Heeter idea.
3800 a Mike Heeter idea.
3789
3801
3790 * IPython/UserConfig/GnuplotMagic.py (plot): Improvements to
3802 * IPython/UserConfig/GnuplotMagic.py (plot): Improvements to
3791 plot() and replot(). Much more convenient now, especially for
3803 plot() and replot(). Much more convenient now, especially for
3792 interactive use.
3804 interactive use.
3793
3805
3794 * IPython/Magic.py (Magic.magic_run): Added .py automatically to
3806 * IPython/Magic.py (Magic.magic_run): Added .py automatically to
3795 filenames.
3807 filenames.
3796
3808
3797 2002-06-02 Fernando Perez <fperez@colorado.edu>
3809 2002-06-02 Fernando Perez <fperez@colorado.edu>
3798
3810
3799 * IPython/Struct.py (Struct.__init__): modified to admit
3811 * IPython/Struct.py (Struct.__init__): modified to admit
3800 initialization via another struct.
3812 initialization via another struct.
3801
3813
3802 * IPython/genutils.py (SystemExec.__init__): New stateful
3814 * IPython/genutils.py (SystemExec.__init__): New stateful
3803 interface to xsys and bq. Useful for writing system scripts.
3815 interface to xsys and bq. Useful for writing system scripts.
3804
3816
3805 2002-05-30 Fernando Perez <fperez@colorado.edu>
3817 2002-05-30 Fernando Perez <fperez@colorado.edu>
3806
3818
3807 * MANIFEST.in: Changed docfile selection to exclude all the lyx
3819 * MANIFEST.in: Changed docfile selection to exclude all the lyx
3808 documents. This will make the user download smaller (it's getting
3820 documents. This will make the user download smaller (it's getting
3809 too big).
3821 too big).
3810
3822
3811 2002-05-29 Fernando Perez <fperez@colorado.edu>
3823 2002-05-29 Fernando Perez <fperez@colorado.edu>
3812
3824
3813 * IPython/iplib.py (_FakeModule.__init__): New class introduced to
3825 * IPython/iplib.py (_FakeModule.__init__): New class introduced to
3814 fix problems with shelve and pickle. Seems to work, but I don't
3826 fix problems with shelve and pickle. Seems to work, but I don't
3815 know if corner cases break it. Thanks to Mike Heeter
3827 know if corner cases break it. Thanks to Mike Heeter
3816 <korora-AT-SDF.LONESTAR.ORG> for the bug reports and test cases.
3828 <korora-AT-SDF.LONESTAR.ORG> for the bug reports and test cases.
3817
3829
3818 2002-05-24 Fernando Perez <fperez@colorado.edu>
3830 2002-05-24 Fernando Perez <fperez@colorado.edu>
3819
3831
3820 * IPython/Magic.py (Macro.__init__): fixed magics embedded in
3832 * IPython/Magic.py (Macro.__init__): fixed magics embedded in
3821 macros having broken.
3833 macros having broken.
3822
3834
3823 2002-05-21 Fernando Perez <fperez@colorado.edu>
3835 2002-05-21 Fernando Perez <fperez@colorado.edu>
3824
3836
3825 * IPython/Magic.py (Magic.magic_logstart): fixed recently
3837 * IPython/Magic.py (Magic.magic_logstart): fixed recently
3826 introduced logging bug: all history before logging started was
3838 introduced logging bug: all history before logging started was
3827 being written one character per line! This came from the redesign
3839 being written one character per line! This came from the redesign
3828 of the input history as a special list which slices to strings,
3840 of the input history as a special list which slices to strings,
3829 not to lists.
3841 not to lists.
3830
3842
3831 2002-05-20 Fernando Perez <fperez@colorado.edu>
3843 2002-05-20 Fernando Perez <fperez@colorado.edu>
3832
3844
3833 * IPython/Prompts.py (CachedOutput.__init__): made the color table
3845 * IPython/Prompts.py (CachedOutput.__init__): made the color table
3834 be an attribute of all classes in this module. The design of these
3846 be an attribute of all classes in this module. The design of these
3835 classes needs some serious overhauling.
3847 classes needs some serious overhauling.
3836
3848
3837 * IPython/DPyGetOpt.py (DPyGetOpt.setPosixCompliance): fixed bug
3849 * IPython/DPyGetOpt.py (DPyGetOpt.setPosixCompliance): fixed bug
3838 which was ignoring '_' in option names.
3850 which was ignoring '_' in option names.
3839
3851
3840 * IPython/ultraTB.py (FormattedTB.__init__): Changed
3852 * IPython/ultraTB.py (FormattedTB.__init__): Changed
3841 'Verbose_novars' to 'Context' and made it the new default. It's a
3853 'Verbose_novars' to 'Context' and made it the new default. It's a
3842 bit more readable and also safer than verbose.
3854 bit more readable and also safer than verbose.
3843
3855
3844 * IPython/PyColorize.py (Parser.__call__): Fixed coloring of
3856 * IPython/PyColorize.py (Parser.__call__): Fixed coloring of
3845 triple-quoted strings.
3857 triple-quoted strings.
3846
3858
3847 * IPython/OInspect.py (__all__): new module exposing the object
3859 * IPython/OInspect.py (__all__): new module exposing the object
3848 introspection facilities. Now the corresponding magics are dummy
3860 introspection facilities. Now the corresponding magics are dummy
3849 wrappers around this. Having this module will make it much easier
3861 wrappers around this. Having this module will make it much easier
3850 to put these functions into our modified pdb.
3862 to put these functions into our modified pdb.
3851 This new object inspector system uses the new colorizing module,
3863 This new object inspector system uses the new colorizing module,
3852 so source code and other things are nicely syntax highlighted.
3864 so source code and other things are nicely syntax highlighted.
3853
3865
3854 2002-05-18 Fernando Perez <fperez@colorado.edu>
3866 2002-05-18 Fernando Perez <fperez@colorado.edu>
3855
3867
3856 * IPython/ColorANSI.py: Split the coloring tools into a separate
3868 * IPython/ColorANSI.py: Split the coloring tools into a separate
3857 module so I can use them in other code easier (they were part of
3869 module so I can use them in other code easier (they were part of
3858 ultraTB).
3870 ultraTB).
3859
3871
3860 2002-05-17 Fernando Perez <fperez@colorado.edu>
3872 2002-05-17 Fernando Perez <fperez@colorado.edu>
3861
3873
3862 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
3874 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
3863 fixed it to set the global 'g' also to the called instance, as
3875 fixed it to set the global 'g' also to the called instance, as
3864 long as 'g' was still a gnuplot instance (so it doesn't overwrite
3876 long as 'g' was still a gnuplot instance (so it doesn't overwrite
3865 user's 'g' variables).
3877 user's 'g' variables).
3866
3878
3867 * IPython/iplib.py (InteractiveShell.__init__): Added In/Out
3879 * IPython/iplib.py (InteractiveShell.__init__): Added In/Out
3868 global variables (aliases to _ih,_oh) so that users which expect
3880 global variables (aliases to _ih,_oh) so that users which expect
3869 In[5] or Out[7] to work aren't unpleasantly surprised.
3881 In[5] or Out[7] to work aren't unpleasantly surprised.
3870 (InputList.__getslice__): new class to allow executing slices of
3882 (InputList.__getslice__): new class to allow executing slices of
3871 input history directly. Very simple class, complements the use of
3883 input history directly. Very simple class, complements the use of
3872 macros.
3884 macros.
3873
3885
3874 2002-05-16 Fernando Perez <fperez@colorado.edu>
3886 2002-05-16 Fernando Perez <fperez@colorado.edu>
3875
3887
3876 * setup.py (docdirbase): make doc directory be just doc/IPython
3888 * setup.py (docdirbase): make doc directory be just doc/IPython
3877 without version numbers, it will reduce clutter for users.
3889 without version numbers, it will reduce clutter for users.
3878
3890
3879 * IPython/Magic.py (Magic.magic_run): Add explicit local dict to
3891 * IPython/Magic.py (Magic.magic_run): Add explicit local dict to
3880 execfile call to prevent possible memory leak. See for details:
3892 execfile call to prevent possible memory leak. See for details:
3881 http://mail.python.org/pipermail/python-list/2002-February/088476.html
3893 http://mail.python.org/pipermail/python-list/2002-February/088476.html
3882
3894
3883 2002-05-15 Fernando Perez <fperez@colorado.edu>
3895 2002-05-15 Fernando Perez <fperez@colorado.edu>
3884
3896
3885 * IPython/Magic.py (Magic.magic_psource): made the object
3897 * IPython/Magic.py (Magic.magic_psource): made the object
3886 introspection names be more standard: pdoc, pdef, pfile and
3898 introspection names be more standard: pdoc, pdef, pfile and
3887 psource. They all print/page their output, and it makes
3899 psource. They all print/page their output, and it makes
3888 remembering them easier. Kept old names for compatibility as
3900 remembering them easier. Kept old names for compatibility as
3889 aliases.
3901 aliases.
3890
3902
3891 2002-05-14 Fernando Perez <fperez@colorado.edu>
3903 2002-05-14 Fernando Perez <fperez@colorado.edu>
3892
3904
3893 * IPython/UserConfig/GnuplotMagic.py: I think I finally understood
3905 * IPython/UserConfig/GnuplotMagic.py: I think I finally understood
3894 what the mouse problem was. The trick is to use gnuplot with temp
3906 what the mouse problem was. The trick is to use gnuplot with temp
3895 files and NOT with pipes (for data communication), because having
3907 files and NOT with pipes (for data communication), because having
3896 both pipes and the mouse on is bad news.
3908 both pipes and the mouse on is bad news.
3897
3909
3898 2002-05-13 Fernando Perez <fperez@colorado.edu>
3910 2002-05-13 Fernando Perez <fperez@colorado.edu>
3899
3911
3900 * IPython/Magic.py (Magic._ofind): fixed namespace order search
3912 * IPython/Magic.py (Magic._ofind): fixed namespace order search
3901 bug. Information would be reported about builtins even when
3913 bug. Information would be reported about builtins even when
3902 user-defined functions overrode them.
3914 user-defined functions overrode them.
3903
3915
3904 2002-05-11 Fernando Perez <fperez@colorado.edu>
3916 2002-05-11 Fernando Perez <fperez@colorado.edu>
3905
3917
3906 * IPython/__init__.py (__all__): removed FlexCompleter from
3918 * IPython/__init__.py (__all__): removed FlexCompleter from
3907 __all__ so that things don't fail in platforms without readline.
3919 __all__ so that things don't fail in platforms without readline.
3908
3920
3909 2002-05-10 Fernando Perez <fperez@colorado.edu>
3921 2002-05-10 Fernando Perez <fperez@colorado.edu>
3910
3922
3911 * IPython/__init__.py (__all__): removed numutils from __all__ b/c
3923 * IPython/__init__.py (__all__): removed numutils from __all__ b/c
3912 it requires Numeric, effectively making Numeric a dependency for
3924 it requires Numeric, effectively making Numeric a dependency for
3913 IPython.
3925 IPython.
3914
3926
3915 * Released 0.2.13
3927 * Released 0.2.13
3916
3928
3917 * IPython/Magic.py (Magic.magic_prun): big overhaul to the
3929 * IPython/Magic.py (Magic.magic_prun): big overhaul to the
3918 profiler interface. Now all the major options from the profiler
3930 profiler interface. Now all the major options from the profiler
3919 module are directly supported in IPython, both for single
3931 module are directly supported in IPython, both for single
3920 expressions (@prun) and for full programs (@run -p).
3932 expressions (@prun) and for full programs (@run -p).
3921
3933
3922 2002-05-09 Fernando Perez <fperez@colorado.edu>
3934 2002-05-09 Fernando Perez <fperez@colorado.edu>
3923
3935
3924 * IPython/Magic.py (Magic.magic_doc): fixed to show docstrings of
3936 * IPython/Magic.py (Magic.magic_doc): fixed to show docstrings of
3925 magic properly formatted for screen.
3937 magic properly formatted for screen.
3926
3938
3927 * setup.py (make_shortcut): Changed things to put pdf version in
3939 * setup.py (make_shortcut): Changed things to put pdf version in
3928 doc/ instead of doc/manual (had to change lyxport a bit).
3940 doc/ instead of doc/manual (had to change lyxport a bit).
3929
3941
3930 * IPython/Magic.py (Profile.string_stats): made profile runs go
3942 * IPython/Magic.py (Profile.string_stats): made profile runs go
3931 through pager (they are long and a pager allows searching, saving,
3943 through pager (they are long and a pager allows searching, saving,
3932 etc.)
3944 etc.)
3933
3945
3934 2002-05-08 Fernando Perez <fperez@colorado.edu>
3946 2002-05-08 Fernando Perez <fperez@colorado.edu>
3935
3947
3936 * Released 0.2.12
3948 * Released 0.2.12
3937
3949
3938 2002-05-06 Fernando Perez <fperez@colorado.edu>
3950 2002-05-06 Fernando Perez <fperez@colorado.edu>
3939
3951
3940 * IPython/Magic.py (Magic.magic_hist): small bug fixed (recently
3952 * IPython/Magic.py (Magic.magic_hist): small bug fixed (recently
3941 introduced); 'hist n1 n2' was broken.
3953 introduced); 'hist n1 n2' was broken.
3942 (Magic.magic_pdb): added optional on/off arguments to @pdb
3954 (Magic.magic_pdb): added optional on/off arguments to @pdb
3943 (Magic.magic_run): added option -i to @run, which executes code in
3955 (Magic.magic_run): added option -i to @run, which executes code in
3944 the IPython namespace instead of a clean one. Also added @irun as
3956 the IPython namespace instead of a clean one. Also added @irun as
3945 an alias to @run -i.
3957 an alias to @run -i.
3946
3958
3947 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
3959 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
3948 fixed (it didn't really do anything, the namespaces were wrong).
3960 fixed (it didn't really do anything, the namespaces were wrong).
3949
3961
3950 * IPython/Debugger.py (__init__): Added workaround for python 2.1
3962 * IPython/Debugger.py (__init__): Added workaround for python 2.1
3951
3963
3952 * IPython/__init__.py (__all__): Fixed package namespace, now
3964 * IPython/__init__.py (__all__): Fixed package namespace, now
3953 'import IPython' does give access to IPython.<all> as
3965 'import IPython' does give access to IPython.<all> as
3954 expected. Also renamed __release__ to Release.
3966 expected. Also renamed __release__ to Release.
3955
3967
3956 * IPython/Debugger.py (__license__): created new Pdb class which
3968 * IPython/Debugger.py (__license__): created new Pdb class which
3957 functions like a drop-in for the normal pdb.Pdb but does NOT
3969 functions like a drop-in for the normal pdb.Pdb but does NOT
3958 import readline by default. This way it doesn't muck up IPython's
3970 import readline by default. This way it doesn't muck up IPython's
3959 readline handling, and now tab-completion finally works in the
3971 readline handling, and now tab-completion finally works in the
3960 debugger -- sort of. It completes things globally visible, but the
3972 debugger -- sort of. It completes things globally visible, but the
3961 completer doesn't track the stack as pdb walks it. That's a bit
3973 completer doesn't track the stack as pdb walks it. That's a bit
3962 tricky, and I'll have to implement it later.
3974 tricky, and I'll have to implement it later.
3963
3975
3964 2002-05-05 Fernando Perez <fperez@colorado.edu>
3976 2002-05-05 Fernando Perez <fperez@colorado.edu>
3965
3977
3966 * IPython/Magic.py (Magic.magic_oinfo): fixed formatting bug for
3978 * IPython/Magic.py (Magic.magic_oinfo): fixed formatting bug for
3967 magic docstrings when printed via ? (explicit \'s were being
3979 magic docstrings when printed via ? (explicit \'s were being
3968 printed).
3980 printed).
3969
3981
3970 * IPython/ipmaker.py (make_IPython): fixed namespace
3982 * IPython/ipmaker.py (make_IPython): fixed namespace
3971 identification bug. Now variables loaded via logs or command-line
3983 identification bug. Now variables loaded via logs or command-line
3972 files are recognized in the interactive namespace by @who.
3984 files are recognized in the interactive namespace by @who.
3973
3985
3974 * IPython/iplib.py (InteractiveShell.safe_execfile): Fixed bug in
3986 * IPython/iplib.py (InteractiveShell.safe_execfile): Fixed bug in
3975 log replay system stemming from the string form of Structs.
3987 log replay system stemming from the string form of Structs.
3976
3988
3977 * IPython/Magic.py (Macro.__init__): improved macros to properly
3989 * IPython/Magic.py (Macro.__init__): improved macros to properly
3978 handle magic commands in them.
3990 handle magic commands in them.
3979 (Magic.magic_logstart): usernames are now expanded so 'logstart
3991 (Magic.magic_logstart): usernames are now expanded so 'logstart
3980 ~/mylog' now works.
3992 ~/mylog' now works.
3981
3993
3982 * IPython/iplib.py (complete): fixed bug where paths starting with
3994 * IPython/iplib.py (complete): fixed bug where paths starting with
3983 '/' would be completed as magic names.
3995 '/' would be completed as magic names.
3984
3996
3985 2002-05-04 Fernando Perez <fperez@colorado.edu>
3997 2002-05-04 Fernando Perez <fperez@colorado.edu>
3986
3998
3987 * IPython/Magic.py (Magic.magic_run): added options -p and -f to
3999 * IPython/Magic.py (Magic.magic_run): added options -p and -f to
3988 allow running full programs under the profiler's control.
4000 allow running full programs under the profiler's control.
3989
4001
3990 * IPython/ultraTB.py (FormattedTB.__init__): Added Verbose_novars
4002 * IPython/ultraTB.py (FormattedTB.__init__): Added Verbose_novars
3991 mode to report exceptions verbosely but without formatting
4003 mode to report exceptions verbosely but without formatting
3992 variables. This addresses the issue of ipython 'freezing' (it's
4004 variables. This addresses the issue of ipython 'freezing' (it's
3993 not frozen, but caught in an expensive formatting loop) when huge
4005 not frozen, but caught in an expensive formatting loop) when huge
3994 variables are in the context of an exception.
4006 variables are in the context of an exception.
3995 (VerboseTB.text): Added '--->' markers at line where exception was
4007 (VerboseTB.text): Added '--->' markers at line where exception was
3996 triggered. Much clearer to read, especially in NoColor modes.
4008 triggered. Much clearer to read, especially in NoColor modes.
3997
4009
3998 * IPython/Magic.py (Magic.magic_run): bugfix: -n option had been
4010 * IPython/Magic.py (Magic.magic_run): bugfix: -n option had been
3999 implemented in reverse when changing to the new parse_options().
4011 implemented in reverse when changing to the new parse_options().
4000
4012
4001 2002-05-03 Fernando Perez <fperez@colorado.edu>
4013 2002-05-03 Fernando Perez <fperez@colorado.edu>
4002
4014
4003 * IPython/Magic.py (Magic.parse_options): new function so that
4015 * IPython/Magic.py (Magic.parse_options): new function so that
4004 magics can parse options easier.
4016 magics can parse options easier.
4005 (Magic.magic_prun): new function similar to profile.run(),
4017 (Magic.magic_prun): new function similar to profile.run(),
4006 suggested by Chris Hart.
4018 suggested by Chris Hart.
4007 (Magic.magic_cd): fixed behavior so that it only changes if
4019 (Magic.magic_cd): fixed behavior so that it only changes if
4008 directory actually is in history.
4020 directory actually is in history.
4009
4021
4010 * IPython/usage.py (__doc__): added information about potential
4022 * IPython/usage.py (__doc__): added information about potential
4011 slowness of Verbose exception mode when there are huge data
4023 slowness of Verbose exception mode when there are huge data
4012 structures to be formatted (thanks to Archie Paulson).
4024 structures to be formatted (thanks to Archie Paulson).
4013
4025
4014 * IPython/ipmaker.py (make_IPython): Changed default logging
4026 * IPython/ipmaker.py (make_IPython): Changed default logging
4015 (when simply called with -log) to use curr_dir/ipython.log in
4027 (when simply called with -log) to use curr_dir/ipython.log in
4016 rotate mode. Fixed crash which was occuring with -log before
4028 rotate mode. Fixed crash which was occuring with -log before
4017 (thanks to Jim Boyle).
4029 (thanks to Jim Boyle).
4018
4030
4019 2002-05-01 Fernando Perez <fperez@colorado.edu>
4031 2002-05-01 Fernando Perez <fperez@colorado.edu>
4020
4032
4021 * Released 0.2.11 for these fixes (mainly the ultraTB one which
4033 * Released 0.2.11 for these fixes (mainly the ultraTB one which
4022 was nasty -- though somewhat of a corner case).
4034 was nasty -- though somewhat of a corner case).
4023
4035
4024 * IPython/ultraTB.py (AutoFormattedTB.text): renamed __text to
4036 * IPython/ultraTB.py (AutoFormattedTB.text): renamed __text to
4025 text (was a bug).
4037 text (was a bug).
4026
4038
4027 2002-04-30 Fernando Perez <fperez@colorado.edu>
4039 2002-04-30 Fernando Perez <fperez@colorado.edu>
4028
4040
4029 * IPython/UserConfig/GnuplotMagic.py (magic_gp): Minor fix to add
4041 * IPython/UserConfig/GnuplotMagic.py (magic_gp): Minor fix to add
4030 a print after ^D or ^C from the user so that the In[] prompt
4042 a print after ^D or ^C from the user so that the In[] prompt
4031 doesn't over-run the gnuplot one.
4043 doesn't over-run the gnuplot one.
4032
4044
4033 2002-04-29 Fernando Perez <fperez@colorado.edu>
4045 2002-04-29 Fernando Perez <fperez@colorado.edu>
4034
4046
4035 * Released 0.2.10
4047 * Released 0.2.10
4036
4048
4037 * IPython/__release__.py (version): get date dynamically.
4049 * IPython/__release__.py (version): get date dynamically.
4038
4050
4039 * Misc. documentation updates thanks to Arnd's comments. Also ran
4051 * Misc. documentation updates thanks to Arnd's comments. Also ran
4040 a full spellcheck on the manual (hadn't been done in a while).
4052 a full spellcheck on the manual (hadn't been done in a while).
4041
4053
4042 2002-04-27 Fernando Perez <fperez@colorado.edu>
4054 2002-04-27 Fernando Perez <fperez@colorado.edu>
4043
4055
4044 * IPython/Magic.py (Magic.magic_logstart): Fixed bug where
4056 * IPython/Magic.py (Magic.magic_logstart): Fixed bug where
4045 starting a log in mid-session would reset the input history list.
4057 starting a log in mid-session would reset the input history list.
4046
4058
4047 2002-04-26 Fernando Perez <fperez@colorado.edu>
4059 2002-04-26 Fernando Perez <fperez@colorado.edu>
4048
4060
4049 * IPython/iplib.py (InteractiveShell.wait): Fixed bug where not
4061 * IPython/iplib.py (InteractiveShell.wait): Fixed bug where not
4050 all files were being included in an update. Now anything in
4062 all files were being included in an update. Now anything in
4051 UserConfig that matches [A-Za-z]*.py will go (this excludes
4063 UserConfig that matches [A-Za-z]*.py will go (this excludes
4052 __init__.py)
4064 __init__.py)
4053
4065
4054 2002-04-25 Fernando Perez <fperez@colorado.edu>
4066 2002-04-25 Fernando Perez <fperez@colorado.edu>
4055
4067
4056 * IPython/iplib.py (InteractiveShell.__init__): Added __IPYTHON__
4068 * IPython/iplib.py (InteractiveShell.__init__): Added __IPYTHON__
4057 to __builtins__ so that any form of embedded or imported code can
4069 to __builtins__ so that any form of embedded or imported code can
4058 test for being inside IPython.
4070 test for being inside IPython.
4059
4071
4060 * IPython/UserConfig/GnuplotMagic.py: (magic_gp_set_instance):
4072 * IPython/UserConfig/GnuplotMagic.py: (magic_gp_set_instance):
4061 changed to GnuplotMagic because it's now an importable module,
4073 changed to GnuplotMagic because it's now an importable module,
4062 this makes the name follow that of the standard Gnuplot module.
4074 this makes the name follow that of the standard Gnuplot module.
4063 GnuplotMagic can now be loaded at any time in mid-session.
4075 GnuplotMagic can now be loaded at any time in mid-session.
4064
4076
4065 2002-04-24 Fernando Perez <fperez@colorado.edu>
4077 2002-04-24 Fernando Perez <fperez@colorado.edu>
4066
4078
4067 * IPython/numutils.py: removed SIUnits. It doesn't properly set
4079 * IPython/numutils.py: removed SIUnits. It doesn't properly set
4068 the globals (IPython has its own namespace) and the
4080 the globals (IPython has its own namespace) and the
4069 PhysicalQuantity stuff is much better anyway.
4081 PhysicalQuantity stuff is much better anyway.
4070
4082
4071 * IPython/UserConfig/example-gnuplot.py (g2): Added gnuplot
4083 * IPython/UserConfig/example-gnuplot.py (g2): Added gnuplot
4072 embedding example to standard user directory for
4084 embedding example to standard user directory for
4073 distribution. Also put it in the manual.
4085 distribution. Also put it in the manual.
4074
4086
4075 * IPython/numutils.py (gnuplot_exec): Changed to take a gnuplot
4087 * IPython/numutils.py (gnuplot_exec): Changed to take a gnuplot
4076 instance as first argument (so it doesn't rely on some obscure
4088 instance as first argument (so it doesn't rely on some obscure
4077 hidden global).
4089 hidden global).
4078
4090
4079 * IPython/UserConfig/ipythonrc.py: put () back in accepted
4091 * IPython/UserConfig/ipythonrc.py: put () back in accepted
4080 delimiters. While it prevents ().TAB from working, it allows
4092 delimiters. While it prevents ().TAB from working, it allows
4081 completions in open (... expressions. This is by far a more common
4093 completions in open (... expressions. This is by far a more common
4082 case.
4094 case.
4083
4095
4084 2002-04-23 Fernando Perez <fperez@colorado.edu>
4096 2002-04-23 Fernando Perez <fperez@colorado.edu>
4085
4097
4086 * IPython/Extensions/InterpreterPasteInput.py: new
4098 * IPython/Extensions/InterpreterPasteInput.py: new
4087 syntax-processing module for pasting lines with >>> or ... at the
4099 syntax-processing module for pasting lines with >>> or ... at the
4088 start.
4100 start.
4089
4101
4090 * IPython/Extensions/PhysicalQ_Interactive.py
4102 * IPython/Extensions/PhysicalQ_Interactive.py
4091 (PhysicalQuantityInteractive.__int__): fixed to work with either
4103 (PhysicalQuantityInteractive.__int__): fixed to work with either
4092 Numeric or math.
4104 Numeric or math.
4093
4105
4094 * IPython/UserConfig/ipythonrc-numeric.py: reorganized the
4106 * IPython/UserConfig/ipythonrc-numeric.py: reorganized the
4095 provided profiles. Now we have:
4107 provided profiles. Now we have:
4096 -math -> math module as * and cmath with its own namespace.
4108 -math -> math module as * and cmath with its own namespace.
4097 -numeric -> Numeric as *, plus gnuplot & grace
4109 -numeric -> Numeric as *, plus gnuplot & grace
4098 -physics -> same as before
4110 -physics -> same as before
4099
4111
4100 * IPython/Magic.py (Magic.magic_magic): Fixed bug where
4112 * IPython/Magic.py (Magic.magic_magic): Fixed bug where
4101 user-defined magics wouldn't be found by @magic if they were
4113 user-defined magics wouldn't be found by @magic if they were
4102 defined as class methods. Also cleaned up the namespace search
4114 defined as class methods. Also cleaned up the namespace search
4103 logic and the string building (to use %s instead of many repeated
4115 logic and the string building (to use %s instead of many repeated
4104 string adds).
4116 string adds).
4105
4117
4106 * IPython/UserConfig/example-magic.py (magic_foo): updated example
4118 * IPython/UserConfig/example-magic.py (magic_foo): updated example
4107 of user-defined magics to operate with class methods (cleaner, in
4119 of user-defined magics to operate with class methods (cleaner, in
4108 line with the gnuplot code).
4120 line with the gnuplot code).
4109
4121
4110 2002-04-22 Fernando Perez <fperez@colorado.edu>
4122 2002-04-22 Fernando Perez <fperez@colorado.edu>
4111
4123
4112 * setup.py: updated dependency list so that manual is updated when
4124 * setup.py: updated dependency list so that manual is updated when
4113 all included files change.
4125 all included files change.
4114
4126
4115 * IPython/ipmaker.py (make_IPython): Fixed bug which was ignoring
4127 * IPython/ipmaker.py (make_IPython): Fixed bug which was ignoring
4116 the delimiter removal option (the fix is ugly right now).
4128 the delimiter removal option (the fix is ugly right now).
4117
4129
4118 * IPython/UserConfig/ipythonrc-physics.py: simplified not to load
4130 * IPython/UserConfig/ipythonrc-physics.py: simplified not to load
4119 all of the math profile (quicker loading, no conflict between
4131 all of the math profile (quicker loading, no conflict between
4120 g-9.8 and g-gnuplot).
4132 g-9.8 and g-gnuplot).
4121
4133
4122 * IPython/CrashHandler.py (CrashHandler.__call__): changed default
4134 * IPython/CrashHandler.py (CrashHandler.__call__): changed default
4123 name of post-mortem files to IPython_crash_report.txt.
4135 name of post-mortem files to IPython_crash_report.txt.
4124
4136
4125 * Cleanup/update of the docs. Added all the new readline info and
4137 * Cleanup/update of the docs. Added all the new readline info and
4126 formatted all lists as 'real lists'.
4138 formatted all lists as 'real lists'.
4127
4139
4128 * IPython/ipmaker.py (make_IPython): removed now-obsolete
4140 * IPython/ipmaker.py (make_IPython): removed now-obsolete
4129 tab-completion options, since the full readline parse_and_bind is
4141 tab-completion options, since the full readline parse_and_bind is
4130 now accessible.
4142 now accessible.
4131
4143
4132 * IPython/iplib.py (InteractiveShell.init_readline): Changed
4144 * IPython/iplib.py (InteractiveShell.init_readline): Changed
4133 handling of readline options. Now users can specify any string to
4145 handling of readline options. Now users can specify any string to
4134 be passed to parse_and_bind(), as well as the delimiters to be
4146 be passed to parse_and_bind(), as well as the delimiters to be
4135 removed.
4147 removed.
4136 (InteractiveShell.__init__): Added __name__ to the global
4148 (InteractiveShell.__init__): Added __name__ to the global
4137 namespace so that things like Itpl which rely on its existence
4149 namespace so that things like Itpl which rely on its existence
4138 don't crash.
4150 don't crash.
4139 (InteractiveShell._prefilter): Defined the default with a _ so
4151 (InteractiveShell._prefilter): Defined the default with a _ so
4140 that prefilter() is easier to override, while the default one
4152 that prefilter() is easier to override, while the default one
4141 remains available.
4153 remains available.
4142
4154
4143 2002-04-18 Fernando Perez <fperez@colorado.edu>
4155 2002-04-18 Fernando Perez <fperez@colorado.edu>
4144
4156
4145 * Added information about pdb in the docs.
4157 * Added information about pdb in the docs.
4146
4158
4147 2002-04-17 Fernando Perez <fperez@colorado.edu>
4159 2002-04-17 Fernando Perez <fperez@colorado.edu>
4148
4160
4149 * IPython/ipmaker.py (make_IPython): added rc_override option to
4161 * IPython/ipmaker.py (make_IPython): added rc_override option to
4150 allow passing config options at creation time which may override
4162 allow passing config options at creation time which may override
4151 anything set in the config files or command line. This is
4163 anything set in the config files or command line. This is
4152 particularly useful for configuring embedded instances.
4164 particularly useful for configuring embedded instances.
4153
4165
4154 2002-04-15 Fernando Perez <fperez@colorado.edu>
4166 2002-04-15 Fernando Perez <fperez@colorado.edu>
4155
4167
4156 * IPython/Logger.py (Logger.log): Fixed a nasty bug which could
4168 * IPython/Logger.py (Logger.log): Fixed a nasty bug which could
4157 crash embedded instances because of the input cache falling out of
4169 crash embedded instances because of the input cache falling out of
4158 sync with the output counter.
4170 sync with the output counter.
4159
4171
4160 * IPython/Shell.py (IPythonShellEmbed.__init__): added a debug
4172 * IPython/Shell.py (IPythonShellEmbed.__init__): added a debug
4161 mode which calls pdb after an uncaught exception in IPython itself.
4173 mode which calls pdb after an uncaught exception in IPython itself.
4162
4174
4163 2002-04-14 Fernando Perez <fperez@colorado.edu>
4175 2002-04-14 Fernando Perez <fperez@colorado.edu>
4164
4176
4165 * IPython/iplib.py (InteractiveShell.showtraceback): pdb mucks up
4177 * IPython/iplib.py (InteractiveShell.showtraceback): pdb mucks up
4166 readline, fix it back after each call.
4178 readline, fix it back after each call.
4167
4179
4168 * IPython/ultraTB.py (AutoFormattedTB.__text): made text a private
4180 * IPython/ultraTB.py (AutoFormattedTB.__text): made text a private
4169 method to force all access via __call__(), which guarantees that
4181 method to force all access via __call__(), which guarantees that
4170 traceback references are properly deleted.
4182 traceback references are properly deleted.
4171
4183
4172 * IPython/Prompts.py (CachedOutput._display): minor fixes to
4184 * IPython/Prompts.py (CachedOutput._display): minor fixes to
4173 improve printing when pprint is in use.
4185 improve printing when pprint is in use.
4174
4186
4175 2002-04-13 Fernando Perez <fperez@colorado.edu>
4187 2002-04-13 Fernando Perez <fperez@colorado.edu>
4176
4188
4177 * IPython/Shell.py (IPythonShellEmbed.__call__): SystemExit
4189 * IPython/Shell.py (IPythonShellEmbed.__call__): SystemExit
4178 exceptions aren't caught anymore. If the user triggers one, he
4190 exceptions aren't caught anymore. If the user triggers one, he
4179 should know why he's doing it and it should go all the way up,
4191 should know why he's doing it and it should go all the way up,
4180 just like any other exception. So now @abort will fully kill the
4192 just like any other exception. So now @abort will fully kill the
4181 embedded interpreter and the embedding code (unless that happens
4193 embedded interpreter and the embedding code (unless that happens
4182 to catch SystemExit).
4194 to catch SystemExit).
4183
4195
4184 * IPython/ultraTB.py (VerboseTB.__init__): added a call_pdb flag
4196 * IPython/ultraTB.py (VerboseTB.__init__): added a call_pdb flag
4185 and a debugger() method to invoke the interactive pdb debugger
4197 and a debugger() method to invoke the interactive pdb debugger
4186 after printing exception information. Also added the corresponding
4198 after printing exception information. Also added the corresponding
4187 -pdb option and @pdb magic to control this feature, and updated
4199 -pdb option and @pdb magic to control this feature, and updated
4188 the docs. After a suggestion from Christopher Hart
4200 the docs. After a suggestion from Christopher Hart
4189 (hart-AT-caltech.edu).
4201 (hart-AT-caltech.edu).
4190
4202
4191 2002-04-12 Fernando Perez <fperez@colorado.edu>
4203 2002-04-12 Fernando Perez <fperez@colorado.edu>
4192
4204
4193 * IPython/Shell.py (IPythonShellEmbed.__init__): modified to use
4205 * IPython/Shell.py (IPythonShellEmbed.__init__): modified to use
4194 the exception handlers defined by the user (not the CrashHandler)
4206 the exception handlers defined by the user (not the CrashHandler)
4195 so that user exceptions don't trigger an ipython bug report.
4207 so that user exceptions don't trigger an ipython bug report.
4196
4208
4197 * IPython/ultraTB.py (ColorTB.__init__): made the color scheme
4209 * IPython/ultraTB.py (ColorTB.__init__): made the color scheme
4198 configurable (it should have always been so).
4210 configurable (it should have always been so).
4199
4211
4200 2002-03-26 Fernando Perez <fperez@colorado.edu>
4212 2002-03-26 Fernando Perez <fperez@colorado.edu>
4201
4213
4202 * IPython/Shell.py (IPythonShellEmbed.__call__): many changes here
4214 * IPython/Shell.py (IPythonShellEmbed.__call__): many changes here
4203 and there to fix embedding namespace issues. This should all be
4215 and there to fix embedding namespace issues. This should all be
4204 done in a more elegant way.
4216 done in a more elegant way.
4205
4217
4206 2002-03-25 Fernando Perez <fperez@colorado.edu>
4218 2002-03-25 Fernando Perez <fperez@colorado.edu>
4207
4219
4208 * IPython/genutils.py (get_home_dir): Try to make it work under
4220 * IPython/genutils.py (get_home_dir): Try to make it work under
4209 win9x also.
4221 win9x also.
4210
4222
4211 2002-03-20 Fernando Perez <fperez@colorado.edu>
4223 2002-03-20 Fernando Perez <fperez@colorado.edu>
4212
4224
4213 * IPython/Shell.py (IPythonShellEmbed.__init__): leave
4225 * IPython/Shell.py (IPythonShellEmbed.__init__): leave
4214 sys.displayhook untouched upon __init__.
4226 sys.displayhook untouched upon __init__.
4215
4227
4216 2002-03-19 Fernando Perez <fperez@colorado.edu>
4228 2002-03-19 Fernando Perez <fperez@colorado.edu>
4217
4229
4218 * Released 0.2.9 (for embedding bug, basically).
4230 * Released 0.2.9 (for embedding bug, basically).
4219
4231
4220 * IPython/Shell.py (IPythonShellEmbed.__call__): Trap SystemExit
4232 * IPython/Shell.py (IPythonShellEmbed.__call__): Trap SystemExit
4221 exceptions so that enclosing shell's state can be restored.
4233 exceptions so that enclosing shell's state can be restored.
4222
4234
4223 * Changed magic_gnuplot.py to magic-gnuplot.py to standardize
4235 * Changed magic_gnuplot.py to magic-gnuplot.py to standardize
4224 naming conventions in the .ipython/ dir.
4236 naming conventions in the .ipython/ dir.
4225
4237
4226 * IPython/iplib.py (InteractiveShell.init_readline): removed '-'
4238 * IPython/iplib.py (InteractiveShell.init_readline): removed '-'
4227 from delimiters list so filenames with - in them get expanded.
4239 from delimiters list so filenames with - in them get expanded.
4228
4240
4229 * IPython/Shell.py (IPythonShellEmbed.__call__): fixed bug with
4241 * IPython/Shell.py (IPythonShellEmbed.__call__): fixed bug with
4230 sys.displayhook not being properly restored after an embedded call.
4242 sys.displayhook not being properly restored after an embedded call.
4231
4243
4232 2002-03-18 Fernando Perez <fperez@colorado.edu>
4244 2002-03-18 Fernando Perez <fperez@colorado.edu>
4233
4245
4234 * Released 0.2.8
4246 * Released 0.2.8
4235
4247
4236 * IPython/iplib.py (InteractiveShell.user_setup): fixed bug where
4248 * IPython/iplib.py (InteractiveShell.user_setup): fixed bug where
4237 some files weren't being included in a -upgrade.
4249 some files weren't being included in a -upgrade.
4238 (InteractiveShell.init_readline): Added 'set show-all-if-ambiguous
4250 (InteractiveShell.init_readline): Added 'set show-all-if-ambiguous
4239 on' so that the first tab completes.
4251 on' so that the first tab completes.
4240 (InteractiveShell.handle_magic): fixed bug with spaces around
4252 (InteractiveShell.handle_magic): fixed bug with spaces around
4241 quotes breaking many magic commands.
4253 quotes breaking many magic commands.
4242
4254
4243 * setup.py: added note about ignoring the syntax error messages at
4255 * setup.py: added note about ignoring the syntax error messages at
4244 installation.
4256 installation.
4245
4257
4246 * IPython/UserConfig/magic_gnuplot.py (magic_gp): finished
4258 * IPython/UserConfig/magic_gnuplot.py (magic_gp): finished
4247 streamlining the gnuplot interface, now there's only one magic @gp.
4259 streamlining the gnuplot interface, now there's only one magic @gp.
4248
4260
4249 2002-03-17 Fernando Perez <fperez@colorado.edu>
4261 2002-03-17 Fernando Perez <fperez@colorado.edu>
4250
4262
4251 * IPython/UserConfig/magic_gnuplot.py: new name for the
4263 * IPython/UserConfig/magic_gnuplot.py: new name for the
4252 example-magic_pm.py file. Much enhanced system, now with a shell
4264 example-magic_pm.py file. Much enhanced system, now with a shell
4253 for communicating directly with gnuplot, one command at a time.
4265 for communicating directly with gnuplot, one command at a time.
4254
4266
4255 * IPython/Magic.py (Magic.magic_run): added option -n to prevent
4267 * IPython/Magic.py (Magic.magic_run): added option -n to prevent
4256 setting __name__=='__main__'.
4268 setting __name__=='__main__'.
4257
4269
4258 * IPython/UserConfig/example-magic_pm.py (magic_pm): Added
4270 * IPython/UserConfig/example-magic_pm.py (magic_pm): Added
4259 mini-shell for accessing gnuplot from inside ipython. Should
4271 mini-shell for accessing gnuplot from inside ipython. Should
4260 extend it later for grace access too. Inspired by Arnd's
4272 extend it later for grace access too. Inspired by Arnd's
4261 suggestion.
4273 suggestion.
4262
4274
4263 * IPython/iplib.py (InteractiveShell.handle_magic): fixed bug when
4275 * IPython/iplib.py (InteractiveShell.handle_magic): fixed bug when
4264 calling magic functions with () in their arguments. Thanks to Arnd
4276 calling magic functions with () in their arguments. Thanks to Arnd
4265 Baecker for pointing this to me.
4277 Baecker for pointing this to me.
4266
4278
4267 * IPython/numutils.py (sum_flat): fixed bug. Would recurse
4279 * IPython/numutils.py (sum_flat): fixed bug. Would recurse
4268 infinitely for integer or complex arrays (only worked with floats).
4280 infinitely for integer or complex arrays (only worked with floats).
4269
4281
4270 2002-03-16 Fernando Perez <fperez@colorado.edu>
4282 2002-03-16 Fernando Perez <fperez@colorado.edu>
4271
4283
4272 * setup.py: Merged setup and setup_windows into a single script
4284 * setup.py: Merged setup and setup_windows into a single script
4273 which properly handles things for windows users.
4285 which properly handles things for windows users.
4274
4286
4275 2002-03-15 Fernando Perez <fperez@colorado.edu>
4287 2002-03-15 Fernando Perez <fperez@colorado.edu>
4276
4288
4277 * Big change to the manual: now the magics are all automatically
4289 * Big change to the manual: now the magics are all automatically
4278 documented. This information is generated from their docstrings
4290 documented. This information is generated from their docstrings
4279 and put in a latex file included by the manual lyx file. This way
4291 and put in a latex file included by the manual lyx file. This way
4280 we get always up to date information for the magics. The manual
4292 we get always up to date information for the magics. The manual
4281 now also has proper version information, also auto-synced.
4293 now also has proper version information, also auto-synced.
4282
4294
4283 For this to work, an undocumented --magic_docstrings option was added.
4295 For this to work, an undocumented --magic_docstrings option was added.
4284
4296
4285 2002-03-13 Fernando Perez <fperez@colorado.edu>
4297 2002-03-13 Fernando Perez <fperez@colorado.edu>
4286
4298
4287 * IPython/ultraTB.py (TermColors): fixed problem with dark colors
4299 * IPython/ultraTB.py (TermColors): fixed problem with dark colors
4288 under CDE terminals. An explicit ;2 color reset is needed in the escapes.
4300 under CDE terminals. An explicit ;2 color reset is needed in the escapes.
4289
4301
4290 2002-03-12 Fernando Perez <fperez@colorado.edu>
4302 2002-03-12 Fernando Perez <fperez@colorado.edu>
4291
4303
4292 * IPython/ultraTB.py (TermColors): changed color escapes again to
4304 * IPython/ultraTB.py (TermColors): changed color escapes again to
4293 fix the (old, reintroduced) line-wrapping bug. Basically, if
4305 fix the (old, reintroduced) line-wrapping bug. Basically, if
4294 \001..\002 aren't given in the color escapes, lines get wrapped
4306 \001..\002 aren't given in the color escapes, lines get wrapped
4295 weirdly. But giving those screws up old xterms and emacs terms. So
4307 weirdly. But giving those screws up old xterms and emacs terms. So
4296 I added some logic for emacs terms to be ok, but I can't identify old
4308 I added some logic for emacs terms to be ok, but I can't identify old
4297 xterms separately ($TERM=='xterm' for many terminals, like konsole).
4309 xterms separately ($TERM=='xterm' for many terminals, like konsole).
4298
4310
4299 2002-03-10 Fernando Perez <fperez@colorado.edu>
4311 2002-03-10 Fernando Perez <fperez@colorado.edu>
4300
4312
4301 * IPython/usage.py (__doc__): Various documentation cleanups and
4313 * IPython/usage.py (__doc__): Various documentation cleanups and
4302 updates, both in usage docstrings and in the manual.
4314 updates, both in usage docstrings and in the manual.
4303
4315
4304 * IPython/Prompts.py (CachedOutput.set_colors): cleanups for
4316 * IPython/Prompts.py (CachedOutput.set_colors): cleanups for
4305 handling of caching. Set minimum acceptabe value for having a
4317 handling of caching. Set minimum acceptabe value for having a
4306 cache at 20 values.
4318 cache at 20 values.
4307
4319
4308 * IPython/iplib.py (InteractiveShell.user_setup): moved the
4320 * IPython/iplib.py (InteractiveShell.user_setup): moved the
4309 install_first_time function to a method, renamed it and added an
4321 install_first_time function to a method, renamed it and added an
4310 'upgrade' mode. Now people can update their config directory with
4322 'upgrade' mode. Now people can update their config directory with
4311 a simple command line switch (-upgrade, also new).
4323 a simple command line switch (-upgrade, also new).
4312
4324
4313 * IPython/Magic.py (Magic.magic_pfile): Made @pfile an alias to
4325 * IPython/Magic.py (Magic.magic_pfile): Made @pfile an alias to
4314 @file (convenient for automagic users under Python >= 2.2).
4326 @file (convenient for automagic users under Python >= 2.2).
4315 Removed @files (it seemed more like a plural than an abbrev. of
4327 Removed @files (it seemed more like a plural than an abbrev. of
4316 'file show').
4328 'file show').
4317
4329
4318 * IPython/iplib.py (install_first_time): Fixed crash if there were
4330 * IPython/iplib.py (install_first_time): Fixed crash if there were
4319 backup files ('~') in .ipython/ install directory.
4331 backup files ('~') in .ipython/ install directory.
4320
4332
4321 * IPython/ipmaker.py (make_IPython): fixes for new prompt
4333 * IPython/ipmaker.py (make_IPython): fixes for new prompt
4322 system. Things look fine, but these changes are fairly
4334 system. Things look fine, but these changes are fairly
4323 intrusive. Test them for a few days.
4335 intrusive. Test them for a few days.
4324
4336
4325 * IPython/Prompts.py (CachedOutput.__init__): Massive rewrite of
4337 * IPython/Prompts.py (CachedOutput.__init__): Massive rewrite of
4326 the prompts system. Now all in/out prompt strings are user
4338 the prompts system. Now all in/out prompt strings are user
4327 controllable. This is particularly useful for embedding, as one
4339 controllable. This is particularly useful for embedding, as one
4328 can tag embedded instances with particular prompts.
4340 can tag embedded instances with particular prompts.
4329
4341
4330 Also removed global use of sys.ps1/2, which now allows nested
4342 Also removed global use of sys.ps1/2, which now allows nested
4331 embeddings without any problems. Added command-line options for
4343 embeddings without any problems. Added command-line options for
4332 the prompt strings.
4344 the prompt strings.
4333
4345
4334 2002-03-08 Fernando Perez <fperez@colorado.edu>
4346 2002-03-08 Fernando Perez <fperez@colorado.edu>
4335
4347
4336 * IPython/UserConfig/example-embed-short.py (ipshell): added
4348 * IPython/UserConfig/example-embed-short.py (ipshell): added
4337 example file with the bare minimum code for embedding.
4349 example file with the bare minimum code for embedding.
4338
4350
4339 * IPython/Shell.py (IPythonShellEmbed.set_dummy_mode): added
4351 * IPython/Shell.py (IPythonShellEmbed.set_dummy_mode): added
4340 functionality for the embeddable shell to be activated/deactivated
4352 functionality for the embeddable shell to be activated/deactivated
4341 either globally or at each call.
4353 either globally or at each call.
4342
4354
4343 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixes the problem of
4355 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixes the problem of
4344 rewriting the prompt with '--->' for auto-inputs with proper
4356 rewriting the prompt with '--->' for auto-inputs with proper
4345 coloring. Now the previous UGLY hack in handle_auto() is gone, and
4357 coloring. Now the previous UGLY hack in handle_auto() is gone, and
4346 this is handled by the prompts class itself, as it should.
4358 this is handled by the prompts class itself, as it should.
4347
4359
4348 2002-03-05 Fernando Perez <fperez@colorado.edu>
4360 2002-03-05 Fernando Perez <fperez@colorado.edu>
4349
4361
4350 * IPython/Magic.py (Magic.magic_logstart): Changed @log to
4362 * IPython/Magic.py (Magic.magic_logstart): Changed @log to
4351 @logstart to avoid name clashes with the math log function.
4363 @logstart to avoid name clashes with the math log function.
4352
4364
4353 * Big updates to X/Emacs section of the manual.
4365 * Big updates to X/Emacs section of the manual.
4354
4366
4355 * Removed ipython_emacs. Milan explained to me how to pass
4367 * Removed ipython_emacs. Milan explained to me how to pass
4356 arguments to ipython through Emacs. Some day I'm going to end up
4368 arguments to ipython through Emacs. Some day I'm going to end up
4357 learning some lisp...
4369 learning some lisp...
4358
4370
4359 2002-03-04 Fernando Perez <fperez@colorado.edu>
4371 2002-03-04 Fernando Perez <fperez@colorado.edu>
4360
4372
4361 * IPython/ipython_emacs: Created script to be used as the
4373 * IPython/ipython_emacs: Created script to be used as the
4362 py-python-command Emacs variable so we can pass IPython
4374 py-python-command Emacs variable so we can pass IPython
4363 parameters. I can't figure out how to tell Emacs directly to pass
4375 parameters. I can't figure out how to tell Emacs directly to pass
4364 parameters to IPython, so a dummy shell script will do it.
4376 parameters to IPython, so a dummy shell script will do it.
4365
4377
4366 Other enhancements made for things to work better under Emacs'
4378 Other enhancements made for things to work better under Emacs'
4367 various types of terminals. Many thanks to Milan Zamazal
4379 various types of terminals. Many thanks to Milan Zamazal
4368 <pdm-AT-zamazal.org> for all the suggestions and pointers.
4380 <pdm-AT-zamazal.org> for all the suggestions and pointers.
4369
4381
4370 2002-03-01 Fernando Perez <fperez@colorado.edu>
4382 2002-03-01 Fernando Perez <fperez@colorado.edu>
4371
4383
4372 * IPython/ipmaker.py (make_IPython): added a --readline! option so
4384 * IPython/ipmaker.py (make_IPython): added a --readline! option so
4373 that loading of readline is now optional. This gives better
4385 that loading of readline is now optional. This gives better
4374 control to emacs users.
4386 control to emacs users.
4375
4387
4376 * IPython/ultraTB.py (__date__): Modified color escape sequences
4388 * IPython/ultraTB.py (__date__): Modified color escape sequences
4377 and now things work fine under xterm and in Emacs' term buffers
4389 and now things work fine under xterm and in Emacs' term buffers
4378 (though not shell ones). Well, in emacs you get colors, but all
4390 (though not shell ones). Well, in emacs you get colors, but all
4379 seem to be 'light' colors (no difference between dark and light
4391 seem to be 'light' colors (no difference between dark and light
4380 ones). But the garbage chars are gone, and also in xterms. It
4392 ones). But the garbage chars are gone, and also in xterms. It
4381 seems that now I'm using 'cleaner' ansi sequences.
4393 seems that now I'm using 'cleaner' ansi sequences.
4382
4394
4383 2002-02-21 Fernando Perez <fperez@colorado.edu>
4395 2002-02-21 Fernando Perez <fperez@colorado.edu>
4384
4396
4385 * Released 0.2.7 (mainly to publish the scoping fix).
4397 * Released 0.2.7 (mainly to publish the scoping fix).
4386
4398
4387 * IPython/Logger.py (Logger.logstate): added. A corresponding
4399 * IPython/Logger.py (Logger.logstate): added. A corresponding
4388 @logstate magic was created.
4400 @logstate magic was created.
4389
4401
4390 * IPython/Magic.py: fixed nested scoping problem under Python
4402 * IPython/Magic.py: fixed nested scoping problem under Python
4391 2.1.x (automagic wasn't working).
4403 2.1.x (automagic wasn't working).
4392
4404
4393 2002-02-20 Fernando Perez <fperez@colorado.edu>
4405 2002-02-20 Fernando Perez <fperez@colorado.edu>
4394
4406
4395 * Released 0.2.6.
4407 * Released 0.2.6.
4396
4408
4397 * IPython/OutputTrap.py (OutputTrap.__init__): added a 'quiet'
4409 * IPython/OutputTrap.py (OutputTrap.__init__): added a 'quiet'
4398 option so that logs can come out without any headers at all.
4410 option so that logs can come out without any headers at all.
4399
4411
4400 * IPython/UserConfig/ipythonrc-scipy.py: created a profile for
4412 * IPython/UserConfig/ipythonrc-scipy.py: created a profile for
4401 SciPy.
4413 SciPy.
4402
4414
4403 * IPython/iplib.py (InteractiveShell.embed_mainloop): Changed so
4415 * IPython/iplib.py (InteractiveShell.embed_mainloop): Changed so
4404 that embedded IPython calls don't require vars() to be explicitly
4416 that embedded IPython calls don't require vars() to be explicitly
4405 passed. Now they are extracted from the caller's frame (code
4417 passed. Now they are extracted from the caller's frame (code
4406 snatched from Eric Jones' weave). Added better documentation to
4418 snatched from Eric Jones' weave). Added better documentation to
4407 the section on embedding and the example file.
4419 the section on embedding and the example file.
4408
4420
4409 * IPython/genutils.py (page): Changed so that under emacs, it just
4421 * IPython/genutils.py (page): Changed so that under emacs, it just
4410 prints the string. You can then page up and down in the emacs
4422 prints the string. You can then page up and down in the emacs
4411 buffer itself. This is how the builtin help() works.
4423 buffer itself. This is how the builtin help() works.
4412
4424
4413 * IPython/Prompts.py (CachedOutput.__call__): Fixed issue with
4425 * IPython/Prompts.py (CachedOutput.__call__): Fixed issue with
4414 macro scoping: macros need to be executed in the user's namespace
4426 macro scoping: macros need to be executed in the user's namespace
4415 to work as if they had been typed by the user.
4427 to work as if they had been typed by the user.
4416
4428
4417 * IPython/Magic.py (Magic.magic_macro): Changed macros so they
4429 * IPython/Magic.py (Magic.magic_macro): Changed macros so they
4418 execute automatically (no need to type 'exec...'). They then
4430 execute automatically (no need to type 'exec...'). They then
4419 behave like 'true macros'. The printing system was also modified
4431 behave like 'true macros'. The printing system was also modified
4420 for this to work.
4432 for this to work.
4421
4433
4422 2002-02-19 Fernando Perez <fperez@colorado.edu>
4434 2002-02-19 Fernando Perez <fperez@colorado.edu>
4423
4435
4424 * IPython/genutils.py (page_file): new function for paging files
4436 * IPython/genutils.py (page_file): new function for paging files
4425 in an OS-independent way. Also necessary for file viewing to work
4437 in an OS-independent way. Also necessary for file viewing to work
4426 well inside Emacs buffers.
4438 well inside Emacs buffers.
4427 (page): Added checks for being in an emacs buffer.
4439 (page): Added checks for being in an emacs buffer.
4428 (page): fixed bug for Windows ($TERM isn't set in Windows). Fixed
4440 (page): fixed bug for Windows ($TERM isn't set in Windows). Fixed
4429 same bug in iplib.
4441 same bug in iplib.
4430
4442
4431 2002-02-18 Fernando Perez <fperez@colorado.edu>
4443 2002-02-18 Fernando Perez <fperez@colorado.edu>
4432
4444
4433 * IPython/iplib.py (InteractiveShell.init_readline): modified use
4445 * IPython/iplib.py (InteractiveShell.init_readline): modified use
4434 of readline so that IPython can work inside an Emacs buffer.
4446 of readline so that IPython can work inside an Emacs buffer.
4435
4447
4436 * IPython/ultraTB.py (AutoFormattedTB.__call__): some fixes to
4448 * IPython/ultraTB.py (AutoFormattedTB.__call__): some fixes to
4437 method signatures (they weren't really bugs, but it looks cleaner
4449 method signatures (they weren't really bugs, but it looks cleaner
4438 and keeps PyChecker happy).
4450 and keeps PyChecker happy).
4439
4451
4440 * IPython/ipmaker.py (make_IPython): added hooks Struct to __IP
4452 * IPython/ipmaker.py (make_IPython): added hooks Struct to __IP
4441 for implementing various user-defined hooks. Currently only
4453 for implementing various user-defined hooks. Currently only
4442 display is done.
4454 display is done.
4443
4455
4444 * IPython/Prompts.py (CachedOutput._display): changed display
4456 * IPython/Prompts.py (CachedOutput._display): changed display
4445 functions so that they can be dynamically changed by users easily.
4457 functions so that they can be dynamically changed by users easily.
4446
4458
4447 * IPython/Extensions/numeric_formats.py (num_display): added an
4459 * IPython/Extensions/numeric_formats.py (num_display): added an
4448 extension for printing NumPy arrays in flexible manners. It
4460 extension for printing NumPy arrays in flexible manners. It
4449 doesn't do anything yet, but all the structure is in
4461 doesn't do anything yet, but all the structure is in
4450 place. Ultimately the plan is to implement output format control
4462 place. Ultimately the plan is to implement output format control
4451 like in Octave.
4463 like in Octave.
4452
4464
4453 * IPython/Magic.py (Magic.lsmagic): changed so that bound magic
4465 * IPython/Magic.py (Magic.lsmagic): changed so that bound magic
4454 methods are found at run-time by all the automatic machinery.
4466 methods are found at run-time by all the automatic machinery.
4455
4467
4456 2002-02-17 Fernando Perez <fperez@colorado.edu>
4468 2002-02-17 Fernando Perez <fperez@colorado.edu>
4457
4469
4458 * setup_Windows.py (make_shortcut): documented. Cleaned up the
4470 * setup_Windows.py (make_shortcut): documented. Cleaned up the
4459 whole file a little.
4471 whole file a little.
4460
4472
4461 * ToDo: closed this document. Now there's a new_design.lyx
4473 * ToDo: closed this document. Now there's a new_design.lyx
4462 document for all new ideas. Added making a pdf of it for the
4474 document for all new ideas. Added making a pdf of it for the
4463 end-user distro.
4475 end-user distro.
4464
4476
4465 * IPython/Logger.py (Logger.switch_log): Created this to replace
4477 * IPython/Logger.py (Logger.switch_log): Created this to replace
4466 logon() and logoff(). It also fixes a nasty crash reported by
4478 logon() and logoff(). It also fixes a nasty crash reported by
4467 Philip Hisley <compsys-AT-starpower.net>. Many thanks to him.
4479 Philip Hisley <compsys-AT-starpower.net>. Many thanks to him.
4468
4480
4469 * IPython/iplib.py (complete): got auto-completion to work with
4481 * IPython/iplib.py (complete): got auto-completion to work with
4470 automagic (I had wanted this for a long time).
4482 automagic (I had wanted this for a long time).
4471
4483
4472 * IPython/Magic.py (Magic.magic_files): Added @files as an alias
4484 * IPython/Magic.py (Magic.magic_files): Added @files as an alias
4473 to @file, since file() is now a builtin and clashes with automagic
4485 to @file, since file() is now a builtin and clashes with automagic
4474 for @file.
4486 for @file.
4475
4487
4476 * Made some new files: Prompts, CrashHandler, Magic, Logger. All
4488 * Made some new files: Prompts, CrashHandler, Magic, Logger. All
4477 of this was previously in iplib, which had grown to more than 2000
4489 of this was previously in iplib, which had grown to more than 2000
4478 lines, way too long. No new functionality, but it makes managing
4490 lines, way too long. No new functionality, but it makes managing
4479 the code a bit easier.
4491 the code a bit easier.
4480
4492
4481 * IPython/iplib.py (IPythonCrashHandler.__call__): Added version
4493 * IPython/iplib.py (IPythonCrashHandler.__call__): Added version
4482 information to crash reports.
4494 information to crash reports.
4483
4495
4484 2002-02-12 Fernando Perez <fperez@colorado.edu>
4496 2002-02-12 Fernando Perez <fperez@colorado.edu>
4485
4497
4486 * Released 0.2.5.
4498 * Released 0.2.5.
4487
4499
4488 2002-02-11 Fernando Perez <fperez@colorado.edu>
4500 2002-02-11 Fernando Perez <fperez@colorado.edu>
4489
4501
4490 * Wrote a relatively complete Windows installer. It puts
4502 * Wrote a relatively complete Windows installer. It puts
4491 everything in place, creates Start Menu entries and fixes the
4503 everything in place, creates Start Menu entries and fixes the
4492 color issues. Nothing fancy, but it works.
4504 color issues. Nothing fancy, but it works.
4493
4505
4494 2002-02-10 Fernando Perez <fperez@colorado.edu>
4506 2002-02-10 Fernando Perez <fperez@colorado.edu>
4495
4507
4496 * IPython/iplib.py (InteractiveShell.safe_execfile): added an
4508 * IPython/iplib.py (InteractiveShell.safe_execfile): added an
4497 os.path.expanduser() call so that we can type @run ~/myfile.py and
4509 os.path.expanduser() call so that we can type @run ~/myfile.py and
4498 have thigs work as expected.
4510 have thigs work as expected.
4499
4511
4500 * IPython/genutils.py (page): fixed exception handling so things
4512 * IPython/genutils.py (page): fixed exception handling so things
4501 work both in Unix and Windows correctly. Quitting a pager triggers
4513 work both in Unix and Windows correctly. Quitting a pager triggers
4502 an IOError/broken pipe in Unix, and in windows not finding a pager
4514 an IOError/broken pipe in Unix, and in windows not finding a pager
4503 is also an IOError, so I had to actually look at the return value
4515 is also an IOError, so I had to actually look at the return value
4504 of the exception, not just the exception itself. Should be ok now.
4516 of the exception, not just the exception itself. Should be ok now.
4505
4517
4506 * IPython/ultraTB.py (ColorSchemeTable.set_active_scheme):
4518 * IPython/ultraTB.py (ColorSchemeTable.set_active_scheme):
4507 modified to allow case-insensitive color scheme changes.
4519 modified to allow case-insensitive color scheme changes.
4508
4520
4509 2002-02-09 Fernando Perez <fperez@colorado.edu>
4521 2002-02-09 Fernando Perez <fperez@colorado.edu>
4510
4522
4511 * IPython/genutils.py (native_line_ends): new function to leave
4523 * IPython/genutils.py (native_line_ends): new function to leave
4512 user config files with os-native line-endings.
4524 user config files with os-native line-endings.
4513
4525
4514 * README and manual updates.
4526 * README and manual updates.
4515
4527
4516 * IPython/genutils.py: fixed unicode bug: use types.StringTypes
4528 * IPython/genutils.py: fixed unicode bug: use types.StringTypes
4517 instead of StringType to catch Unicode strings.
4529 instead of StringType to catch Unicode strings.
4518
4530
4519 * IPython/genutils.py (filefind): fixed bug for paths with
4531 * IPython/genutils.py (filefind): fixed bug for paths with
4520 embedded spaces (very common in Windows).
4532 embedded spaces (very common in Windows).
4521
4533
4522 * IPython/ipmaker.py (make_IPython): added a '.ini' to the rc
4534 * IPython/ipmaker.py (make_IPython): added a '.ini' to the rc
4523 files under Windows, so that they get automatically associated
4535 files under Windows, so that they get automatically associated
4524 with a text editor. Windows makes it a pain to handle
4536 with a text editor. Windows makes it a pain to handle
4525 extension-less files.
4537 extension-less files.
4526
4538
4527 * IPython/iplib.py (InteractiveShell.init_readline): Made the
4539 * IPython/iplib.py (InteractiveShell.init_readline): Made the
4528 warning about readline only occur for Posix. In Windows there's no
4540 warning about readline only occur for Posix. In Windows there's no
4529 way to get readline, so why bother with the warning.
4541 way to get readline, so why bother with the warning.
4530
4542
4531 * IPython/Struct.py (Struct.__str__): fixed to use self.__dict__
4543 * IPython/Struct.py (Struct.__str__): fixed to use self.__dict__
4532 for __str__ instead of dir(self), since dir() changed in 2.2.
4544 for __str__ instead of dir(self), since dir() changed in 2.2.
4533
4545
4534 * Ported to Windows! Tested on XP, I suspect it should work fine
4546 * Ported to Windows! Tested on XP, I suspect it should work fine
4535 on NT/2000, but I don't think it will work on 98 et al. That
4547 on NT/2000, but I don't think it will work on 98 et al. That
4536 series of Windows is such a piece of junk anyway that I won't try
4548 series of Windows is such a piece of junk anyway that I won't try
4537 porting it there. The XP port was straightforward, showed a few
4549 porting it there. The XP port was straightforward, showed a few
4538 bugs here and there (fixed all), in particular some string
4550 bugs here and there (fixed all), in particular some string
4539 handling stuff which required considering Unicode strings (which
4551 handling stuff which required considering Unicode strings (which
4540 Windows uses). This is good, but hasn't been too tested :) No
4552 Windows uses). This is good, but hasn't been too tested :) No
4541 fancy installer yet, I'll put a note in the manual so people at
4553 fancy installer yet, I'll put a note in the manual so people at
4542 least make manually a shortcut.
4554 least make manually a shortcut.
4543
4555
4544 * IPython/iplib.py (Magic.magic_colors): Unified the color options
4556 * IPython/iplib.py (Magic.magic_colors): Unified the color options
4545 into a single one, "colors". This now controls both prompt and
4557 into a single one, "colors". This now controls both prompt and
4546 exception color schemes, and can be changed both at startup
4558 exception color schemes, and can be changed both at startup
4547 (either via command-line switches or via ipythonrc files) and at
4559 (either via command-line switches or via ipythonrc files) and at
4548 runtime, with @colors.
4560 runtime, with @colors.
4549 (Magic.magic_run): renamed @prun to @run and removed the old
4561 (Magic.magic_run): renamed @prun to @run and removed the old
4550 @run. The two were too similar to warrant keeping both.
4562 @run. The two were too similar to warrant keeping both.
4551
4563
4552 2002-02-03 Fernando Perez <fperez@colorado.edu>
4564 2002-02-03 Fernando Perez <fperez@colorado.edu>
4553
4565
4554 * IPython/iplib.py (install_first_time): Added comment on how to
4566 * IPython/iplib.py (install_first_time): Added comment on how to
4555 configure the color options for first-time users. Put a <return>
4567 configure the color options for first-time users. Put a <return>
4556 request at the end so that small-terminal users get a chance to
4568 request at the end so that small-terminal users get a chance to
4557 read the startup info.
4569 read the startup info.
4558
4570
4559 2002-01-23 Fernando Perez <fperez@colorado.edu>
4571 2002-01-23 Fernando Perez <fperez@colorado.edu>
4560
4572
4561 * IPython/iplib.py (CachedOutput.update): Changed output memory
4573 * IPython/iplib.py (CachedOutput.update): Changed output memory
4562 variable names from _o,_oo,_ooo,_o<n> to simply _,__,___,_<n>. For
4574 variable names from _o,_oo,_ooo,_o<n> to simply _,__,___,_<n>. For
4563 input history we still use _i. Did this b/c these variable are
4575 input history we still use _i. Did this b/c these variable are
4564 very commonly used in interactive work, so the less we need to
4576 very commonly used in interactive work, so the less we need to
4565 type the better off we are.
4577 type the better off we are.
4566 (Magic.magic_prun): updated @prun to better handle the namespaces
4578 (Magic.magic_prun): updated @prun to better handle the namespaces
4567 the file will run in, including a fix for __name__ not being set
4579 the file will run in, including a fix for __name__ not being set
4568 before.
4580 before.
4569
4581
4570 2002-01-20 Fernando Perez <fperez@colorado.edu>
4582 2002-01-20 Fernando Perez <fperez@colorado.edu>
4571
4583
4572 * IPython/ultraTB.py (VerboseTB.linereader): Fixed printing of
4584 * IPython/ultraTB.py (VerboseTB.linereader): Fixed printing of
4573 extra garbage for Python 2.2. Need to look more carefully into
4585 extra garbage for Python 2.2. Need to look more carefully into
4574 this later.
4586 this later.
4575
4587
4576 2002-01-19 Fernando Perez <fperez@colorado.edu>
4588 2002-01-19 Fernando Perez <fperez@colorado.edu>
4577
4589
4578 * IPython/iplib.py (InteractiveShell.showtraceback): fixed to
4590 * IPython/iplib.py (InteractiveShell.showtraceback): fixed to
4579 display SyntaxError exceptions properly formatted when they occur
4591 display SyntaxError exceptions properly formatted when they occur
4580 (they can be triggered by imported code).
4592 (they can be triggered by imported code).
4581
4593
4582 2002-01-18 Fernando Perez <fperez@colorado.edu>
4594 2002-01-18 Fernando Perez <fperez@colorado.edu>
4583
4595
4584 * IPython/iplib.py (InteractiveShell.safe_execfile): now
4596 * IPython/iplib.py (InteractiveShell.safe_execfile): now
4585 SyntaxError exceptions are reported nicely formatted, instead of
4597 SyntaxError exceptions are reported nicely formatted, instead of
4586 spitting out only offset information as before.
4598 spitting out only offset information as before.
4587 (Magic.magic_prun): Added the @prun function for executing
4599 (Magic.magic_prun): Added the @prun function for executing
4588 programs with command line args inside IPython.
4600 programs with command line args inside IPython.
4589
4601
4590 2002-01-16 Fernando Perez <fperez@colorado.edu>
4602 2002-01-16 Fernando Perez <fperez@colorado.edu>
4591
4603
4592 * IPython/iplib.py (Magic.magic_hist): Changed @hist and @dhist
4604 * IPython/iplib.py (Magic.magic_hist): Changed @hist and @dhist
4593 to *not* include the last item given in a range. This brings their
4605 to *not* include the last item given in a range. This brings their
4594 behavior in line with Python's slicing:
4606 behavior in line with Python's slicing:
4595 a[n1:n2] -> a[n1]...a[n2-1]
4607 a[n1:n2] -> a[n1]...a[n2-1]
4596 It may be a bit less convenient, but I prefer to stick to Python's
4608 It may be a bit less convenient, but I prefer to stick to Python's
4597 conventions *everywhere*, so users never have to wonder.
4609 conventions *everywhere*, so users never have to wonder.
4598 (Magic.magic_macro): Added @macro function to ease the creation of
4610 (Magic.magic_macro): Added @macro function to ease the creation of
4599 macros.
4611 macros.
4600
4612
4601 2002-01-05 Fernando Perez <fperez@colorado.edu>
4613 2002-01-05 Fernando Perez <fperez@colorado.edu>
4602
4614
4603 * Released 0.2.4.
4615 * Released 0.2.4.
4604
4616
4605 * IPython/iplib.py (Magic.magic_pdef):
4617 * IPython/iplib.py (Magic.magic_pdef):
4606 (InteractiveShell.safe_execfile): report magic lines and error
4618 (InteractiveShell.safe_execfile): report magic lines and error
4607 lines without line numbers so one can easily copy/paste them for
4619 lines without line numbers so one can easily copy/paste them for
4608 re-execution.
4620 re-execution.
4609
4621
4610 * Updated manual with recent changes.
4622 * Updated manual with recent changes.
4611
4623
4612 * IPython/iplib.py (Magic.magic_oinfo): added constructor
4624 * IPython/iplib.py (Magic.magic_oinfo): added constructor
4613 docstring printing when class? is called. Very handy for knowing
4625 docstring printing when class? is called. Very handy for knowing
4614 how to create class instances (as long as __init__ is well
4626 how to create class instances (as long as __init__ is well
4615 documented, of course :)
4627 documented, of course :)
4616 (Magic.magic_doc): print both class and constructor docstrings.
4628 (Magic.magic_doc): print both class and constructor docstrings.
4617 (Magic.magic_pdef): give constructor info if passed a class and
4629 (Magic.magic_pdef): give constructor info if passed a class and
4618 __call__ info for callable object instances.
4630 __call__ info for callable object instances.
4619
4631
4620 2002-01-04 Fernando Perez <fperez@colorado.edu>
4632 2002-01-04 Fernando Perez <fperez@colorado.edu>
4621
4633
4622 * Made deep_reload() off by default. It doesn't always work
4634 * Made deep_reload() off by default. It doesn't always work
4623 exactly as intended, so it's probably safer to have it off. It's
4635 exactly as intended, so it's probably safer to have it off. It's
4624 still available as dreload() anyway, so nothing is lost.
4636 still available as dreload() anyway, so nothing is lost.
4625
4637
4626 2002-01-02 Fernando Perez <fperez@colorado.edu>
4638 2002-01-02 Fernando Perez <fperez@colorado.edu>
4627
4639
4628 * Released 0.2.3 (contacted R.Singh at CU about biopython course,
4640 * Released 0.2.3 (contacted R.Singh at CU about biopython course,
4629 so I wanted an updated release).
4641 so I wanted an updated release).
4630
4642
4631 2001-12-27 Fernando Perez <fperez@colorado.edu>
4643 2001-12-27 Fernando Perez <fperez@colorado.edu>
4632
4644
4633 * IPython/iplib.py (InteractiveShell.interact): Added the original
4645 * IPython/iplib.py (InteractiveShell.interact): Added the original
4634 code from 'code.py' for this module in order to change the
4646 code from 'code.py' for this module in order to change the
4635 handling of a KeyboardInterrupt. This was necessary b/c otherwise
4647 handling of a KeyboardInterrupt. This was necessary b/c otherwise
4636 the history cache would break when the user hit Ctrl-C, and
4648 the history cache would break when the user hit Ctrl-C, and
4637 interact() offers no way to add any hooks to it.
4649 interact() offers no way to add any hooks to it.
4638
4650
4639 2001-12-23 Fernando Perez <fperez@colorado.edu>
4651 2001-12-23 Fernando Perez <fperez@colorado.edu>
4640
4652
4641 * setup.py: added check for 'MANIFEST' before trying to remove
4653 * setup.py: added check for 'MANIFEST' before trying to remove
4642 it. Thanks to Sean Reifschneider.
4654 it. Thanks to Sean Reifschneider.
4643
4655
4644 2001-12-22 Fernando Perez <fperez@colorado.edu>
4656 2001-12-22 Fernando Perez <fperez@colorado.edu>
4645
4657
4646 * Released 0.2.2.
4658 * Released 0.2.2.
4647
4659
4648 * Finished (reasonably) writing the manual. Later will add the
4660 * Finished (reasonably) writing the manual. Later will add the
4649 python-standard navigation stylesheets, but for the time being
4661 python-standard navigation stylesheets, but for the time being
4650 it's fairly complete. Distribution will include html and pdf
4662 it's fairly complete. Distribution will include html and pdf
4651 versions.
4663 versions.
4652
4664
4653 * Bugfix: '.' wasn't being added to sys.path. Thanks to Prabhu
4665 * Bugfix: '.' wasn't being added to sys.path. Thanks to Prabhu
4654 (MayaVi author).
4666 (MayaVi author).
4655
4667
4656 2001-12-21 Fernando Perez <fperez@colorado.edu>
4668 2001-12-21 Fernando Perez <fperez@colorado.edu>
4657
4669
4658 * Released 0.2.1. Barring any nasty bugs, this is it as far as a
4670 * Released 0.2.1. Barring any nasty bugs, this is it as far as a
4659 good public release, I think (with the manual and the distutils
4671 good public release, I think (with the manual and the distutils
4660 installer). The manual can use some work, but that can go
4672 installer). The manual can use some work, but that can go
4661 slowly. Otherwise I think it's quite nice for end users. Next
4673 slowly. Otherwise I think it's quite nice for end users. Next
4662 summer, rewrite the guts of it...
4674 summer, rewrite the guts of it...
4663
4675
4664 * Changed format of ipythonrc files to use whitespace as the
4676 * Changed format of ipythonrc files to use whitespace as the
4665 separator instead of an explicit '='. Cleaner.
4677 separator instead of an explicit '='. Cleaner.
4666
4678
4667 2001-12-20 Fernando Perez <fperez@colorado.edu>
4679 2001-12-20 Fernando Perez <fperez@colorado.edu>
4668
4680
4669 * Started a manual in LyX. For now it's just a quick merge of the
4681 * Started a manual in LyX. For now it's just a quick merge of the
4670 various internal docstrings and READMEs. Later it may grow into a
4682 various internal docstrings and READMEs. Later it may grow into a
4671 nice, full-blown manual.
4683 nice, full-blown manual.
4672
4684
4673 * Set up a distutils based installer. Installation should now be
4685 * Set up a distutils based installer. Installation should now be
4674 trivially simple for end-users.
4686 trivially simple for end-users.
4675
4687
4676 2001-12-11 Fernando Perez <fperez@colorado.edu>
4688 2001-12-11 Fernando Perez <fperez@colorado.edu>
4677
4689
4678 * Released 0.2.0. First public release, announced it at
4690 * Released 0.2.0. First public release, announced it at
4679 comp.lang.python. From now on, just bugfixes...
4691 comp.lang.python. From now on, just bugfixes...
4680
4692
4681 * Went through all the files, set copyright/license notices and
4693 * Went through all the files, set copyright/license notices and
4682 cleaned up things. Ready for release.
4694 cleaned up things. Ready for release.
4683
4695
4684 2001-12-10 Fernando Perez <fperez@colorado.edu>
4696 2001-12-10 Fernando Perez <fperez@colorado.edu>
4685
4697
4686 * Changed the first-time installer not to use tarfiles. It's more
4698 * Changed the first-time installer not to use tarfiles. It's more
4687 robust now and less unix-dependent. Also makes it easier for
4699 robust now and less unix-dependent. Also makes it easier for
4688 people to later upgrade versions.
4700 people to later upgrade versions.
4689
4701
4690 * Changed @exit to @abort to reflect the fact that it's pretty
4702 * Changed @exit to @abort to reflect the fact that it's pretty
4691 brutal (a sys.exit()). The difference between @abort and Ctrl-D
4703 brutal (a sys.exit()). The difference between @abort and Ctrl-D
4692 becomes significant only when IPyhton is embedded: in that case,
4704 becomes significant only when IPyhton is embedded: in that case,
4693 C-D closes IPython only, but @abort kills the enclosing program
4705 C-D closes IPython only, but @abort kills the enclosing program
4694 too (unless it had called IPython inside a try catching
4706 too (unless it had called IPython inside a try catching
4695 SystemExit).
4707 SystemExit).
4696
4708
4697 * Created Shell module which exposes the actuall IPython Shell
4709 * Created Shell module which exposes the actuall IPython Shell
4698 classes, currently the normal and the embeddable one. This at
4710 classes, currently the normal and the embeddable one. This at
4699 least offers a stable interface we won't need to change when
4711 least offers a stable interface we won't need to change when
4700 (later) the internals are rewritten. That rewrite will be confined
4712 (later) the internals are rewritten. That rewrite will be confined
4701 to iplib and ipmaker, but the Shell interface should remain as is.
4713 to iplib and ipmaker, but the Shell interface should remain as is.
4702
4714
4703 * Added embed module which offers an embeddable IPShell object,
4715 * Added embed module which offers an embeddable IPShell object,
4704 useful to fire up IPython *inside* a running program. Great for
4716 useful to fire up IPython *inside* a running program. Great for
4705 debugging or dynamical data analysis.
4717 debugging or dynamical data analysis.
4706
4718
4707 2001-12-08 Fernando Perez <fperez@colorado.edu>
4719 2001-12-08 Fernando Perez <fperez@colorado.edu>
4708
4720
4709 * Fixed small bug preventing seeing info from methods of defined
4721 * Fixed small bug preventing seeing info from methods of defined
4710 objects (incorrect namespace in _ofind()).
4722 objects (incorrect namespace in _ofind()).
4711
4723
4712 * Documentation cleanup. Moved the main usage docstrings to a
4724 * Documentation cleanup. Moved the main usage docstrings to a
4713 separate file, usage.py (cleaner to maintain, and hopefully in the
4725 separate file, usage.py (cleaner to maintain, and hopefully in the
4714 future some perlpod-like way of producing interactive, man and
4726 future some perlpod-like way of producing interactive, man and
4715 html docs out of it will be found).
4727 html docs out of it will be found).
4716
4728
4717 * Added @profile to see your profile at any time.
4729 * Added @profile to see your profile at any time.
4718
4730
4719 * Added @p as an alias for 'print'. It's especially convenient if
4731 * Added @p as an alias for 'print'. It's especially convenient if
4720 using automagic ('p x' prints x).
4732 using automagic ('p x' prints x).
4721
4733
4722 * Small cleanups and fixes after a pychecker run.
4734 * Small cleanups and fixes after a pychecker run.
4723
4735
4724 * Changed the @cd command to handle @cd - and @cd -<n> for
4736 * Changed the @cd command to handle @cd - and @cd -<n> for
4725 visiting any directory in _dh.
4737 visiting any directory in _dh.
4726
4738
4727 * Introduced _dh, a history of visited directories. @dhist prints
4739 * Introduced _dh, a history of visited directories. @dhist prints
4728 it out with numbers.
4740 it out with numbers.
4729
4741
4730 2001-12-07 Fernando Perez <fperez@colorado.edu>
4742 2001-12-07 Fernando Perez <fperez@colorado.edu>
4731
4743
4732 * Released 0.1.22
4744 * Released 0.1.22
4733
4745
4734 * Made initialization a bit more robust against invalid color
4746 * Made initialization a bit more robust against invalid color
4735 options in user input (exit, not traceback-crash).
4747 options in user input (exit, not traceback-crash).
4736
4748
4737 * Changed the bug crash reporter to write the report only in the
4749 * Changed the bug crash reporter to write the report only in the
4738 user's .ipython directory. That way IPython won't litter people's
4750 user's .ipython directory. That way IPython won't litter people's
4739 hard disks with crash files all over the place. Also print on
4751 hard disks with crash files all over the place. Also print on
4740 screen the necessary mail command.
4752 screen the necessary mail command.
4741
4753
4742 * With the new ultraTB, implemented LightBG color scheme for light
4754 * With the new ultraTB, implemented LightBG color scheme for light
4743 background terminals. A lot of people like white backgrounds, so I
4755 background terminals. A lot of people like white backgrounds, so I
4744 guess we should at least give them something readable.
4756 guess we should at least give them something readable.
4745
4757
4746 2001-12-06 Fernando Perez <fperez@colorado.edu>
4758 2001-12-06 Fernando Perez <fperez@colorado.edu>
4747
4759
4748 * Modified the structure of ultraTB. Now there's a proper class
4760 * Modified the structure of ultraTB. Now there's a proper class
4749 for tables of color schemes which allow adding schemes easily and
4761 for tables of color schemes which allow adding schemes easily and
4750 switching the active scheme without creating a new instance every
4762 switching the active scheme without creating a new instance every
4751 time (which was ridiculous). The syntax for creating new schemes
4763 time (which was ridiculous). The syntax for creating new schemes
4752 is also cleaner. I think ultraTB is finally done, with a clean
4764 is also cleaner. I think ultraTB is finally done, with a clean
4753 class structure. Names are also much cleaner (now there's proper
4765 class structure. Names are also much cleaner (now there's proper
4754 color tables, no need for every variable to also have 'color' in
4766 color tables, no need for every variable to also have 'color' in
4755 its name).
4767 its name).
4756
4768
4757 * Broke down genutils into separate files. Now genutils only
4769 * Broke down genutils into separate files. Now genutils only
4758 contains utility functions, and classes have been moved to their
4770 contains utility functions, and classes have been moved to their
4759 own files (they had enough independent functionality to warrant
4771 own files (they had enough independent functionality to warrant
4760 it): ConfigLoader, OutputTrap, Struct.
4772 it): ConfigLoader, OutputTrap, Struct.
4761
4773
4762 2001-12-05 Fernando Perez <fperez@colorado.edu>
4774 2001-12-05 Fernando Perez <fperez@colorado.edu>
4763
4775
4764 * IPython turns 21! Released version 0.1.21, as a candidate for
4776 * IPython turns 21! Released version 0.1.21, as a candidate for
4765 public consumption. If all goes well, release in a few days.
4777 public consumption. If all goes well, release in a few days.
4766
4778
4767 * Fixed path bug (files in Extensions/ directory wouldn't be found
4779 * Fixed path bug (files in Extensions/ directory wouldn't be found
4768 unless IPython/ was explicitly in sys.path).
4780 unless IPython/ was explicitly in sys.path).
4769
4781
4770 * Extended the FlexCompleter class as MagicCompleter to allow
4782 * Extended the FlexCompleter class as MagicCompleter to allow
4771 completion of @-starting lines.
4783 completion of @-starting lines.
4772
4784
4773 * Created __release__.py file as a central repository for release
4785 * Created __release__.py file as a central repository for release
4774 info that other files can read from.
4786 info that other files can read from.
4775
4787
4776 * Fixed small bug in logging: when logging was turned on in
4788 * Fixed small bug in logging: when logging was turned on in
4777 mid-session, old lines with special meanings (!@?) were being
4789 mid-session, old lines with special meanings (!@?) were being
4778 logged without the prepended comment, which is necessary since
4790 logged without the prepended comment, which is necessary since
4779 they are not truly valid python syntax. This should make session
4791 they are not truly valid python syntax. This should make session
4780 restores produce less errors.
4792 restores produce less errors.
4781
4793
4782 * The namespace cleanup forced me to make a FlexCompleter class
4794 * The namespace cleanup forced me to make a FlexCompleter class
4783 which is nothing but a ripoff of rlcompleter, but with selectable
4795 which is nothing but a ripoff of rlcompleter, but with selectable
4784 namespace (rlcompleter only works in __main__.__dict__). I'll try
4796 namespace (rlcompleter only works in __main__.__dict__). I'll try
4785 to submit a note to the authors to see if this change can be
4797 to submit a note to the authors to see if this change can be
4786 incorporated in future rlcompleter releases (Dec.6: done)
4798 incorporated in future rlcompleter releases (Dec.6: done)
4787
4799
4788 * More fixes to namespace handling. It was a mess! Now all
4800 * More fixes to namespace handling. It was a mess! Now all
4789 explicit references to __main__.__dict__ are gone (except when
4801 explicit references to __main__.__dict__ are gone (except when
4790 really needed) and everything is handled through the namespace
4802 really needed) and everything is handled through the namespace
4791 dicts in the IPython instance. We seem to be getting somewhere
4803 dicts in the IPython instance. We seem to be getting somewhere
4792 with this, finally...
4804 with this, finally...
4793
4805
4794 * Small documentation updates.
4806 * Small documentation updates.
4795
4807
4796 * Created the Extensions directory under IPython (with an
4808 * Created the Extensions directory under IPython (with an
4797 __init__.py). Put the PhysicalQ stuff there. This directory should
4809 __init__.py). Put the PhysicalQ stuff there. This directory should
4798 be used for all special-purpose extensions.
4810 be used for all special-purpose extensions.
4799
4811
4800 * File renaming:
4812 * File renaming:
4801 ipythonlib --> ipmaker
4813 ipythonlib --> ipmaker
4802 ipplib --> iplib
4814 ipplib --> iplib
4803 This makes a bit more sense in terms of what these files actually do.
4815 This makes a bit more sense in terms of what these files actually do.
4804
4816
4805 * Moved all the classes and functions in ipythonlib to ipplib, so
4817 * Moved all the classes and functions in ipythonlib to ipplib, so
4806 now ipythonlib only has make_IPython(). This will ease up its
4818 now ipythonlib only has make_IPython(). This will ease up its
4807 splitting in smaller functional chunks later.
4819 splitting in smaller functional chunks later.
4808
4820
4809 * Cleaned up (done, I think) output of @whos. Better column
4821 * Cleaned up (done, I think) output of @whos. Better column
4810 formatting, and now shows str(var) for as much as it can, which is
4822 formatting, and now shows str(var) for as much as it can, which is
4811 typically what one gets with a 'print var'.
4823 typically what one gets with a 'print var'.
4812
4824
4813 2001-12-04 Fernando Perez <fperez@colorado.edu>
4825 2001-12-04 Fernando Perez <fperez@colorado.edu>
4814
4826
4815 * Fixed namespace problems. Now builtin/IPyhton/user names get
4827 * Fixed namespace problems. Now builtin/IPyhton/user names get
4816 properly reported in their namespace. Internal namespace handling
4828 properly reported in their namespace. Internal namespace handling
4817 is finally getting decent (not perfect yet, but much better than
4829 is finally getting decent (not perfect yet, but much better than
4818 the ad-hoc mess we had).
4830 the ad-hoc mess we had).
4819
4831
4820 * Removed -exit option. If people just want to run a python
4832 * Removed -exit option. If people just want to run a python
4821 script, that's what the normal interpreter is for. Less
4833 script, that's what the normal interpreter is for. Less
4822 unnecessary options, less chances for bugs.
4834 unnecessary options, less chances for bugs.
4823
4835
4824 * Added a crash handler which generates a complete post-mortem if
4836 * Added a crash handler which generates a complete post-mortem if
4825 IPython crashes. This will help a lot in tracking bugs down the
4837 IPython crashes. This will help a lot in tracking bugs down the
4826 road.
4838 road.
4827
4839
4828 * Fixed nasty bug in auto-evaluation part of prefilter(). Names
4840 * Fixed nasty bug in auto-evaluation part of prefilter(). Names
4829 which were boud to functions being reassigned would bypass the
4841 which were boud to functions being reassigned would bypass the
4830 logger, breaking the sync of _il with the prompt counter. This
4842 logger, breaking the sync of _il with the prompt counter. This
4831 would then crash IPython later when a new line was logged.
4843 would then crash IPython later when a new line was logged.
4832
4844
4833 2001-12-02 Fernando Perez <fperez@colorado.edu>
4845 2001-12-02 Fernando Perez <fperez@colorado.edu>
4834
4846
4835 * Made IPython a package. This means people don't have to clutter
4847 * Made IPython a package. This means people don't have to clutter
4836 their sys.path with yet another directory. Changed the INSTALL
4848 their sys.path with yet another directory. Changed the INSTALL
4837 file accordingly.
4849 file accordingly.
4838
4850
4839 * Cleaned up the output of @who_ls, @who and @whos. @who_ls now
4851 * Cleaned up the output of @who_ls, @who and @whos. @who_ls now
4840 sorts its output (so @who shows it sorted) and @whos formats the
4852 sorts its output (so @who shows it sorted) and @whos formats the
4841 table according to the width of the first column. Nicer, easier to
4853 table according to the width of the first column. Nicer, easier to
4842 read. Todo: write a generic table_format() which takes a list of
4854 read. Todo: write a generic table_format() which takes a list of
4843 lists and prints it nicely formatted, with optional row/column
4855 lists and prints it nicely formatted, with optional row/column
4844 separators and proper padding and justification.
4856 separators and proper padding and justification.
4845
4857
4846 * Released 0.1.20
4858 * Released 0.1.20
4847
4859
4848 * Fixed bug in @log which would reverse the inputcache list (a
4860 * Fixed bug in @log which would reverse the inputcache list (a
4849 copy operation was missing).
4861 copy operation was missing).
4850
4862
4851 * Code cleanup. @config was changed to use page(). Better, since
4863 * Code cleanup. @config was changed to use page(). Better, since
4852 its output is always quite long.
4864 its output is always quite long.
4853
4865
4854 * Itpl is back as a dependency. I was having too many problems
4866 * Itpl is back as a dependency. I was having too many problems
4855 getting the parametric aliases to work reliably, and it's just
4867 getting the parametric aliases to work reliably, and it's just
4856 easier to code weird string operations with it than playing %()s
4868 easier to code weird string operations with it than playing %()s
4857 games. It's only ~6k, so I don't think it's too big a deal.
4869 games. It's only ~6k, so I don't think it's too big a deal.
4858
4870
4859 * Found (and fixed) a very nasty bug with history. !lines weren't
4871 * Found (and fixed) a very nasty bug with history. !lines weren't
4860 getting cached, and the out of sync caches would crash
4872 getting cached, and the out of sync caches would crash
4861 IPython. Fixed it by reorganizing the prefilter/handlers/logger
4873 IPython. Fixed it by reorganizing the prefilter/handlers/logger
4862 division of labor a bit better. Bug fixed, cleaner structure.
4874 division of labor a bit better. Bug fixed, cleaner structure.
4863
4875
4864 2001-12-01 Fernando Perez <fperez@colorado.edu>
4876 2001-12-01 Fernando Perez <fperez@colorado.edu>
4865
4877
4866 * Released 0.1.19
4878 * Released 0.1.19
4867
4879
4868 * Added option -n to @hist to prevent line number printing. Much
4880 * Added option -n to @hist to prevent line number printing. Much
4869 easier to copy/paste code this way.
4881 easier to copy/paste code this way.
4870
4882
4871 * Created global _il to hold the input list. Allows easy
4883 * Created global _il to hold the input list. Allows easy
4872 re-execution of blocks of code by slicing it (inspired by Janko's
4884 re-execution of blocks of code by slicing it (inspired by Janko's
4873 comment on 'macros').
4885 comment on 'macros').
4874
4886
4875 * Small fixes and doc updates.
4887 * Small fixes and doc updates.
4876
4888
4877 * Rewrote @history function (was @h). Renamed it to @hist, @h is
4889 * Rewrote @history function (was @h). Renamed it to @hist, @h is
4878 much too fragile with automagic. Handles properly multi-line
4890 much too fragile with automagic. Handles properly multi-line
4879 statements and takes parameters.
4891 statements and takes parameters.
4880
4892
4881 2001-11-30 Fernando Perez <fperez@colorado.edu>
4893 2001-11-30 Fernando Perez <fperez@colorado.edu>
4882
4894
4883 * Version 0.1.18 released.
4895 * Version 0.1.18 released.
4884
4896
4885 * Fixed nasty namespace bug in initial module imports.
4897 * Fixed nasty namespace bug in initial module imports.
4886
4898
4887 * Added copyright/license notes to all code files (except
4899 * Added copyright/license notes to all code files (except
4888 DPyGetOpt). For the time being, LGPL. That could change.
4900 DPyGetOpt). For the time being, LGPL. That could change.
4889
4901
4890 * Rewrote a much nicer README, updated INSTALL, cleaned up
4902 * Rewrote a much nicer README, updated INSTALL, cleaned up
4891 ipythonrc-* samples.
4903 ipythonrc-* samples.
4892
4904
4893 * Overall code/documentation cleanup. Basically ready for
4905 * Overall code/documentation cleanup. Basically ready for
4894 release. Only remaining thing: licence decision (LGPL?).
4906 release. Only remaining thing: licence decision (LGPL?).
4895
4907
4896 * Converted load_config to a class, ConfigLoader. Now recursion
4908 * Converted load_config to a class, ConfigLoader. Now recursion
4897 control is better organized. Doesn't include the same file twice.
4909 control is better organized. Doesn't include the same file twice.
4898
4910
4899 2001-11-29 Fernando Perez <fperez@colorado.edu>
4911 2001-11-29 Fernando Perez <fperez@colorado.edu>
4900
4912
4901 * Got input history working. Changed output history variables from
4913 * Got input history working. Changed output history variables from
4902 _p to _o so that _i is for input and _o for output. Just cleaner
4914 _p to _o so that _i is for input and _o for output. Just cleaner
4903 convention.
4915 convention.
4904
4916
4905 * Implemented parametric aliases. This pretty much allows the
4917 * Implemented parametric aliases. This pretty much allows the
4906 alias system to offer full-blown shell convenience, I think.
4918 alias system to offer full-blown shell convenience, I think.
4907
4919
4908 * Version 0.1.17 released, 0.1.18 opened.
4920 * Version 0.1.17 released, 0.1.18 opened.
4909
4921
4910 * dot_ipython/ipythonrc (alias): added documentation.
4922 * dot_ipython/ipythonrc (alias): added documentation.
4911 (xcolor): Fixed small bug (xcolors -> xcolor)
4923 (xcolor): Fixed small bug (xcolors -> xcolor)
4912
4924
4913 * Changed the alias system. Now alias is a magic command to define
4925 * Changed the alias system. Now alias is a magic command to define
4914 aliases just like the shell. Rationale: the builtin magics should
4926 aliases just like the shell. Rationale: the builtin magics should
4915 be there for things deeply connected to IPython's
4927 be there for things deeply connected to IPython's
4916 architecture. And this is a much lighter system for what I think
4928 architecture. And this is a much lighter system for what I think
4917 is the really important feature: allowing users to define quickly
4929 is the really important feature: allowing users to define quickly
4918 magics that will do shell things for them, so they can customize
4930 magics that will do shell things for them, so they can customize
4919 IPython easily to match their work habits. If someone is really
4931 IPython easily to match their work habits. If someone is really
4920 desperate to have another name for a builtin alias, they can
4932 desperate to have another name for a builtin alias, they can
4921 always use __IP.magic_newname = __IP.magic_oldname. Hackish but
4933 always use __IP.magic_newname = __IP.magic_oldname. Hackish but
4922 works.
4934 works.
4923
4935
4924 2001-11-28 Fernando Perez <fperez@colorado.edu>
4936 2001-11-28 Fernando Perez <fperez@colorado.edu>
4925
4937
4926 * Changed @file so that it opens the source file at the proper
4938 * Changed @file so that it opens the source file at the proper
4927 line. Since it uses less, if your EDITOR environment is
4939 line. Since it uses less, if your EDITOR environment is
4928 configured, typing v will immediately open your editor of choice
4940 configured, typing v will immediately open your editor of choice
4929 right at the line where the object is defined. Not as quick as
4941 right at the line where the object is defined. Not as quick as
4930 having a direct @edit command, but for all intents and purposes it
4942 having a direct @edit command, but for all intents and purposes it
4931 works. And I don't have to worry about writing @edit to deal with
4943 works. And I don't have to worry about writing @edit to deal with
4932 all the editors, less does that.
4944 all the editors, less does that.
4933
4945
4934 * Version 0.1.16 released, 0.1.17 opened.
4946 * Version 0.1.16 released, 0.1.17 opened.
4935
4947
4936 * Fixed some nasty bugs in the page/page_dumb combo that could
4948 * Fixed some nasty bugs in the page/page_dumb combo that could
4937 crash IPython.
4949 crash IPython.
4938
4950
4939 2001-11-27 Fernando Perez <fperez@colorado.edu>
4951 2001-11-27 Fernando Perez <fperez@colorado.edu>
4940
4952
4941 * Version 0.1.15 released, 0.1.16 opened.
4953 * Version 0.1.15 released, 0.1.16 opened.
4942
4954
4943 * Finally got ? and ?? to work for undefined things: now it's
4955 * Finally got ? and ?? to work for undefined things: now it's
4944 possible to type {}.get? and get information about the get method
4956 possible to type {}.get? and get information about the get method
4945 of dicts, or os.path? even if only os is defined (so technically
4957 of dicts, or os.path? even if only os is defined (so technically
4946 os.path isn't). Works at any level. For example, after import os,
4958 os.path isn't). Works at any level. For example, after import os,
4947 os?, os.path?, os.path.abspath? all work. This is great, took some
4959 os?, os.path?, os.path.abspath? all work. This is great, took some
4948 work in _ofind.
4960 work in _ofind.
4949
4961
4950 * Fixed more bugs with logging. The sanest way to do it was to add
4962 * Fixed more bugs with logging. The sanest way to do it was to add
4951 to @log a 'mode' parameter. Killed two in one shot (this mode
4963 to @log a 'mode' parameter. Killed two in one shot (this mode
4952 option was a request of Janko's). I think it's finally clean
4964 option was a request of Janko's). I think it's finally clean
4953 (famous last words).
4965 (famous last words).
4954
4966
4955 * Added a page_dumb() pager which does a decent job of paging on
4967 * Added a page_dumb() pager which does a decent job of paging on
4956 screen, if better things (like less) aren't available. One less
4968 screen, if better things (like less) aren't available. One less
4957 unix dependency (someday maybe somebody will port this to
4969 unix dependency (someday maybe somebody will port this to
4958 windows).
4970 windows).
4959
4971
4960 * Fixed problem in magic_log: would lock of logging out if log
4972 * Fixed problem in magic_log: would lock of logging out if log
4961 creation failed (because it would still think it had succeeded).
4973 creation failed (because it would still think it had succeeded).
4962
4974
4963 * Improved the page() function using curses to auto-detect screen
4975 * Improved the page() function using curses to auto-detect screen
4964 size. Now it can make a much better decision on whether to print
4976 size. Now it can make a much better decision on whether to print
4965 or page a string. Option screen_length was modified: a value 0
4977 or page a string. Option screen_length was modified: a value 0
4966 means auto-detect, and that's the default now.
4978 means auto-detect, and that's the default now.
4967
4979
4968 * Version 0.1.14 released, 0.1.15 opened. I think this is ready to
4980 * Version 0.1.14 released, 0.1.15 opened. I think this is ready to
4969 go out. I'll test it for a few days, then talk to Janko about
4981 go out. I'll test it for a few days, then talk to Janko about
4970 licences and announce it.
4982 licences and announce it.
4971
4983
4972 * Fixed the length of the auto-generated ---> prompt which appears
4984 * Fixed the length of the auto-generated ---> prompt which appears
4973 for auto-parens and auto-quotes. Getting this right isn't trivial,
4985 for auto-parens and auto-quotes. Getting this right isn't trivial,
4974 with all the color escapes, different prompt types and optional
4986 with all the color escapes, different prompt types and optional
4975 separators. But it seems to be working in all the combinations.
4987 separators. But it seems to be working in all the combinations.
4976
4988
4977 2001-11-26 Fernando Perez <fperez@colorado.edu>
4989 2001-11-26 Fernando Perez <fperez@colorado.edu>
4978
4990
4979 * Wrote a regexp filter to get option types from the option names
4991 * Wrote a regexp filter to get option types from the option names
4980 string. This eliminates the need to manually keep two duplicate
4992 string. This eliminates the need to manually keep two duplicate
4981 lists.
4993 lists.
4982
4994
4983 * Removed the unneeded check_option_names. Now options are handled
4995 * Removed the unneeded check_option_names. Now options are handled
4984 in a much saner manner and it's easy to visually check that things
4996 in a much saner manner and it's easy to visually check that things
4985 are ok.
4997 are ok.
4986
4998
4987 * Updated version numbers on all files I modified to carry a
4999 * Updated version numbers on all files I modified to carry a
4988 notice so Janko and Nathan have clear version markers.
5000 notice so Janko and Nathan have clear version markers.
4989
5001
4990 * Updated docstring for ultraTB with my changes. I should send
5002 * Updated docstring for ultraTB with my changes. I should send
4991 this to Nathan.
5003 this to Nathan.
4992
5004
4993 * Lots of small fixes. Ran everything through pychecker again.
5005 * Lots of small fixes. Ran everything through pychecker again.
4994
5006
4995 * Made loading of deep_reload an cmd line option. If it's not too
5007 * Made loading of deep_reload an cmd line option. If it's not too
4996 kosher, now people can just disable it. With -nodeep_reload it's
5008 kosher, now people can just disable it. With -nodeep_reload it's
4997 still available as dreload(), it just won't overwrite reload().
5009 still available as dreload(), it just won't overwrite reload().
4998
5010
4999 * Moved many options to the no| form (-opt and -noopt
5011 * Moved many options to the no| form (-opt and -noopt
5000 accepted). Cleaner.
5012 accepted). Cleaner.
5001
5013
5002 * Changed magic_log so that if called with no parameters, it uses
5014 * Changed magic_log so that if called with no parameters, it uses
5003 'rotate' mode. That way auto-generated logs aren't automatically
5015 'rotate' mode. That way auto-generated logs aren't automatically
5004 over-written. For normal logs, now a backup is made if it exists
5016 over-written. For normal logs, now a backup is made if it exists
5005 (only 1 level of backups). A new 'backup' mode was added to the
5017 (only 1 level of backups). A new 'backup' mode was added to the
5006 Logger class to support this. This was a request by Janko.
5018 Logger class to support this. This was a request by Janko.
5007
5019
5008 * Added @logoff/@logon to stop/restart an active log.
5020 * Added @logoff/@logon to stop/restart an active log.
5009
5021
5010 * Fixed a lot of bugs in log saving/replay. It was pretty
5022 * Fixed a lot of bugs in log saving/replay. It was pretty
5011 broken. Now special lines (!@,/) appear properly in the command
5023 broken. Now special lines (!@,/) appear properly in the command
5012 history after a log replay.
5024 history after a log replay.
5013
5025
5014 * Tried and failed to implement full session saving via pickle. My
5026 * Tried and failed to implement full session saving via pickle. My
5015 idea was to pickle __main__.__dict__, but modules can't be
5027 idea was to pickle __main__.__dict__, but modules can't be
5016 pickled. This would be a better alternative to replaying logs, but
5028 pickled. This would be a better alternative to replaying logs, but
5017 seems quite tricky to get to work. Changed -session to be called
5029 seems quite tricky to get to work. Changed -session to be called
5018 -logplay, which more accurately reflects what it does. And if we
5030 -logplay, which more accurately reflects what it does. And if we
5019 ever get real session saving working, -session is now available.
5031 ever get real session saving working, -session is now available.
5020
5032
5021 * Implemented color schemes for prompts also. As for tracebacks,
5033 * Implemented color schemes for prompts also. As for tracebacks,
5022 currently only NoColor and Linux are supported. But now the
5034 currently only NoColor and Linux are supported. But now the
5023 infrastructure is in place, based on a generic ColorScheme
5035 infrastructure is in place, based on a generic ColorScheme
5024 class. So writing and activating new schemes both for the prompts
5036 class. So writing and activating new schemes both for the prompts
5025 and the tracebacks should be straightforward.
5037 and the tracebacks should be straightforward.
5026
5038
5027 * Version 0.1.13 released, 0.1.14 opened.
5039 * Version 0.1.13 released, 0.1.14 opened.
5028
5040
5029 * Changed handling of options for output cache. Now counter is
5041 * Changed handling of options for output cache. Now counter is
5030 hardwired starting at 1 and one specifies the maximum number of
5042 hardwired starting at 1 and one specifies the maximum number of
5031 entries *in the outcache* (not the max prompt counter). This is
5043 entries *in the outcache* (not the max prompt counter). This is
5032 much better, since many statements won't increase the cache
5044 much better, since many statements won't increase the cache
5033 count. It also eliminated some confusing options, now there's only
5045 count. It also eliminated some confusing options, now there's only
5034 one: cache_size.
5046 one: cache_size.
5035
5047
5036 * Added 'alias' magic function and magic_alias option in the
5048 * Added 'alias' magic function and magic_alias option in the
5037 ipythonrc file. Now the user can easily define whatever names he
5049 ipythonrc file. Now the user can easily define whatever names he
5038 wants for the magic functions without having to play weird
5050 wants for the magic functions without having to play weird
5039 namespace games. This gives IPython a real shell-like feel.
5051 namespace games. This gives IPython a real shell-like feel.
5040
5052
5041 * Fixed doc/?/?? for magics. Now all work, in all forms (explicit
5053 * Fixed doc/?/?? for magics. Now all work, in all forms (explicit
5042 @ or not).
5054 @ or not).
5043
5055
5044 This was one of the last remaining 'visible' bugs (that I know
5056 This was one of the last remaining 'visible' bugs (that I know
5045 of). I think if I can clean up the session loading so it works
5057 of). I think if I can clean up the session loading so it works
5046 100% I'll release a 0.2.0 version on c.p.l (talk to Janko first
5058 100% I'll release a 0.2.0 version on c.p.l (talk to Janko first
5047 about licensing).
5059 about licensing).
5048
5060
5049 2001-11-25 Fernando Perez <fperez@colorado.edu>
5061 2001-11-25 Fernando Perez <fperez@colorado.edu>
5050
5062
5051 * Rewrote somewhat oinfo (?/??). Nicer, now uses page() and
5063 * Rewrote somewhat oinfo (?/??). Nicer, now uses page() and
5052 there's a cleaner distinction between what ? and ?? show.
5064 there's a cleaner distinction between what ? and ?? show.
5053
5065
5054 * Added screen_length option. Now the user can define his own
5066 * Added screen_length option. Now the user can define his own
5055 screen size for page() operations.
5067 screen size for page() operations.
5056
5068
5057 * Implemented magic shell-like functions with automatic code
5069 * Implemented magic shell-like functions with automatic code
5058 generation. Now adding another function is just a matter of adding
5070 generation. Now adding another function is just a matter of adding
5059 an entry to a dict, and the function is dynamically generated at
5071 an entry to a dict, and the function is dynamically generated at
5060 run-time. Python has some really cool features!
5072 run-time. Python has some really cool features!
5061
5073
5062 * Renamed many options to cleanup conventions a little. Now all
5074 * Renamed many options to cleanup conventions a little. Now all
5063 are lowercase, and only underscores where needed. Also in the code
5075 are lowercase, and only underscores where needed. Also in the code
5064 option name tables are clearer.
5076 option name tables are clearer.
5065
5077
5066 * Changed prompts a little. Now input is 'In [n]:' instead of
5078 * Changed prompts a little. Now input is 'In [n]:' instead of
5067 'In[n]:='. This allows it the numbers to be aligned with the
5079 'In[n]:='. This allows it the numbers to be aligned with the
5068 Out[n] numbers, and removes usage of ':=' which doesn't exist in
5080 Out[n] numbers, and removes usage of ':=' which doesn't exist in
5069 Python (it was a Mathematica thing). The '...' continuation prompt
5081 Python (it was a Mathematica thing). The '...' continuation prompt
5070 was also changed a little to align better.
5082 was also changed a little to align better.
5071
5083
5072 * Fixed bug when flushing output cache. Not all _p<n> variables
5084 * Fixed bug when flushing output cache. Not all _p<n> variables
5073 exist, so their deletion needs to be wrapped in a try:
5085 exist, so their deletion needs to be wrapped in a try:
5074
5086
5075 * Figured out how to properly use inspect.formatargspec() (it
5087 * Figured out how to properly use inspect.formatargspec() (it
5076 requires the args preceded by *). So I removed all the code from
5088 requires the args preceded by *). So I removed all the code from
5077 _get_pdef in Magic, which was just replicating that.
5089 _get_pdef in Magic, which was just replicating that.
5078
5090
5079 * Added test to prefilter to allow redefining magic function names
5091 * Added test to prefilter to allow redefining magic function names
5080 as variables. This is ok, since the @ form is always available,
5092 as variables. This is ok, since the @ form is always available,
5081 but whe should allow the user to define a variable called 'ls' if
5093 but whe should allow the user to define a variable called 'ls' if
5082 he needs it.
5094 he needs it.
5083
5095
5084 * Moved the ToDo information from README into a separate ToDo.
5096 * Moved the ToDo information from README into a separate ToDo.
5085
5097
5086 * General code cleanup and small bugfixes. I think it's close to a
5098 * General code cleanup and small bugfixes. I think it's close to a
5087 state where it can be released, obviously with a big 'beta'
5099 state where it can be released, obviously with a big 'beta'
5088 warning on it.
5100 warning on it.
5089
5101
5090 * Got the magic function split to work. Now all magics are defined
5102 * Got the magic function split to work. Now all magics are defined
5091 in a separate class. It just organizes things a bit, and now
5103 in a separate class. It just organizes things a bit, and now
5092 Xemacs behaves nicer (it was choking on InteractiveShell b/c it
5104 Xemacs behaves nicer (it was choking on InteractiveShell b/c it
5093 was too long).
5105 was too long).
5094
5106
5095 * Changed @clear to @reset to avoid potential confusions with
5107 * Changed @clear to @reset to avoid potential confusions with
5096 the shell command clear. Also renamed @cl to @clear, which does
5108 the shell command clear. Also renamed @cl to @clear, which does
5097 exactly what people expect it to from their shell experience.
5109 exactly what people expect it to from their shell experience.
5098
5110
5099 Added a check to the @reset command (since it's so
5111 Added a check to the @reset command (since it's so
5100 destructive, it's probably a good idea to ask for confirmation).
5112 destructive, it's probably a good idea to ask for confirmation).
5101 But now reset only works for full namespace resetting. Since the
5113 But now reset only works for full namespace resetting. Since the
5102 del keyword is already there for deleting a few specific
5114 del keyword is already there for deleting a few specific
5103 variables, I don't see the point of having a redundant magic
5115 variables, I don't see the point of having a redundant magic
5104 function for the same task.
5116 function for the same task.
5105
5117
5106 2001-11-24 Fernando Perez <fperez@colorado.edu>
5118 2001-11-24 Fernando Perez <fperez@colorado.edu>
5107
5119
5108 * Updated the builtin docs (esp. the ? ones).
5120 * Updated the builtin docs (esp. the ? ones).
5109
5121
5110 * Ran all the code through pychecker. Not terribly impressed with
5122 * Ran all the code through pychecker. Not terribly impressed with
5111 it: lots of spurious warnings and didn't really find anything of
5123 it: lots of spurious warnings and didn't really find anything of
5112 substance (just a few modules being imported and not used).
5124 substance (just a few modules being imported and not used).
5113
5125
5114 * Implemented the new ultraTB functionality into IPython. New
5126 * Implemented the new ultraTB functionality into IPython. New
5115 option: xcolors. This chooses color scheme. xmode now only selects
5127 option: xcolors. This chooses color scheme. xmode now only selects
5116 between Plain and Verbose. Better orthogonality.
5128 between Plain and Verbose. Better orthogonality.
5117
5129
5118 * Large rewrite of ultraTB. Much cleaner now, with a separation of
5130 * Large rewrite of ultraTB. Much cleaner now, with a separation of
5119 mode and color scheme for the exception handlers. Now it's
5131 mode and color scheme for the exception handlers. Now it's
5120 possible to have the verbose traceback with no coloring.
5132 possible to have the verbose traceback with no coloring.
5121
5133
5122 2001-11-23 Fernando Perez <fperez@colorado.edu>
5134 2001-11-23 Fernando Perez <fperez@colorado.edu>
5123
5135
5124 * Version 0.1.12 released, 0.1.13 opened.
5136 * Version 0.1.12 released, 0.1.13 opened.
5125
5137
5126 * Removed option to set auto-quote and auto-paren escapes by
5138 * Removed option to set auto-quote and auto-paren escapes by
5127 user. The chances of breaking valid syntax are just too high. If
5139 user. The chances of breaking valid syntax are just too high. If
5128 someone *really* wants, they can always dig into the code.
5140 someone *really* wants, they can always dig into the code.
5129
5141
5130 * Made prompt separators configurable.
5142 * Made prompt separators configurable.
5131
5143
5132 2001-11-22 Fernando Perez <fperez@colorado.edu>
5144 2001-11-22 Fernando Perez <fperez@colorado.edu>
5133
5145
5134 * Small bugfixes in many places.
5146 * Small bugfixes in many places.
5135
5147
5136 * Removed the MyCompleter class from ipplib. It seemed redundant
5148 * Removed the MyCompleter class from ipplib. It seemed redundant
5137 with the C-p,C-n history search functionality. Less code to
5149 with the C-p,C-n history search functionality. Less code to
5138 maintain.
5150 maintain.
5139
5151
5140 * Moved all the original ipython.py code into ipythonlib.py. Right
5152 * Moved all the original ipython.py code into ipythonlib.py. Right
5141 now it's just one big dump into a function called make_IPython, so
5153 now it's just one big dump into a function called make_IPython, so
5142 no real modularity has been gained. But at least it makes the
5154 no real modularity has been gained. But at least it makes the
5143 wrapper script tiny, and since ipythonlib is a module, it gets
5155 wrapper script tiny, and since ipythonlib is a module, it gets
5144 compiled and startup is much faster.
5156 compiled and startup is much faster.
5145
5157
5146 This is a reasobably 'deep' change, so we should test it for a
5158 This is a reasobably 'deep' change, so we should test it for a
5147 while without messing too much more with the code.
5159 while without messing too much more with the code.
5148
5160
5149 2001-11-21 Fernando Perez <fperez@colorado.edu>
5161 2001-11-21 Fernando Perez <fperez@colorado.edu>
5150
5162
5151 * Version 0.1.11 released, 0.1.12 opened for further work.
5163 * Version 0.1.11 released, 0.1.12 opened for further work.
5152
5164
5153 * Removed dependency on Itpl. It was only needed in one place. It
5165 * Removed dependency on Itpl. It was only needed in one place. It
5154 would be nice if this became part of python, though. It makes life
5166 would be nice if this became part of python, though. It makes life
5155 *a lot* easier in some cases.
5167 *a lot* easier in some cases.
5156
5168
5157 * Simplified the prefilter code a bit. Now all handlers are
5169 * Simplified the prefilter code a bit. Now all handlers are
5158 expected to explicitly return a value (at least a blank string).
5170 expected to explicitly return a value (at least a blank string).
5159
5171
5160 * Heavy edits in ipplib. Removed the help system altogether. Now
5172 * Heavy edits in ipplib. Removed the help system altogether. Now
5161 obj?/?? is used for inspecting objects, a magic @doc prints
5173 obj?/?? is used for inspecting objects, a magic @doc prints
5162 docstrings, and full-blown Python help is accessed via the 'help'
5174 docstrings, and full-blown Python help is accessed via the 'help'
5163 keyword. This cleans up a lot of code (less to maintain) and does
5175 keyword. This cleans up a lot of code (less to maintain) and does
5164 the job. Since 'help' is now a standard Python component, might as
5176 the job. Since 'help' is now a standard Python component, might as
5165 well use it and remove duplicate functionality.
5177 well use it and remove duplicate functionality.
5166
5178
5167 Also removed the option to use ipplib as a standalone program. By
5179 Also removed the option to use ipplib as a standalone program. By
5168 now it's too dependent on other parts of IPython to function alone.
5180 now it's too dependent on other parts of IPython to function alone.
5169
5181
5170 * Fixed bug in genutils.pager. It would crash if the pager was
5182 * Fixed bug in genutils.pager. It would crash if the pager was
5171 exited immediately after opening (broken pipe).
5183 exited immediately after opening (broken pipe).
5172
5184
5173 * Trimmed down the VerboseTB reporting a little. The header is
5185 * Trimmed down the VerboseTB reporting a little. The header is
5174 much shorter now and the repeated exception arguments at the end
5186 much shorter now and the repeated exception arguments at the end
5175 have been removed. For interactive use the old header seemed a bit
5187 have been removed. For interactive use the old header seemed a bit
5176 excessive.
5188 excessive.
5177
5189
5178 * Fixed small bug in output of @whos for variables with multi-word
5190 * Fixed small bug in output of @whos for variables with multi-word
5179 types (only first word was displayed).
5191 types (only first word was displayed).
5180
5192
5181 2001-11-17 Fernando Perez <fperez@colorado.edu>
5193 2001-11-17 Fernando Perez <fperez@colorado.edu>
5182
5194
5183 * Version 0.1.10 released, 0.1.11 opened for further work.
5195 * Version 0.1.10 released, 0.1.11 opened for further work.
5184
5196
5185 * Modified dirs and friends. dirs now *returns* the stack (not
5197 * Modified dirs and friends. dirs now *returns* the stack (not
5186 prints), so one can manipulate it as a variable. Convenient to
5198 prints), so one can manipulate it as a variable. Convenient to
5187 travel along many directories.
5199 travel along many directories.
5188
5200
5189 * Fixed bug in magic_pdef: would only work with functions with
5201 * Fixed bug in magic_pdef: would only work with functions with
5190 arguments with default values.
5202 arguments with default values.
5191
5203
5192 2001-11-14 Fernando Perez <fperez@colorado.edu>
5204 2001-11-14 Fernando Perez <fperez@colorado.edu>
5193
5205
5194 * Added the PhysicsInput stuff to dot_ipython so it ships as an
5206 * Added the PhysicsInput stuff to dot_ipython so it ships as an
5195 example with IPython. Various other minor fixes and cleanups.
5207 example with IPython. Various other minor fixes and cleanups.
5196
5208
5197 * Version 0.1.9 released, 0.1.10 opened for further work.
5209 * Version 0.1.9 released, 0.1.10 opened for further work.
5198
5210
5199 * Added sys.path to the list of directories searched in the
5211 * Added sys.path to the list of directories searched in the
5200 execfile= option. It used to be the current directory and the
5212 execfile= option. It used to be the current directory and the
5201 user's IPYTHONDIR only.
5213 user's IPYTHONDIR only.
5202
5214
5203 2001-11-13 Fernando Perez <fperez@colorado.edu>
5215 2001-11-13 Fernando Perez <fperez@colorado.edu>
5204
5216
5205 * Reinstated the raw_input/prefilter separation that Janko had
5217 * Reinstated the raw_input/prefilter separation that Janko had
5206 initially. This gives a more convenient setup for extending the
5218 initially. This gives a more convenient setup for extending the
5207 pre-processor from the outside: raw_input always gets a string,
5219 pre-processor from the outside: raw_input always gets a string,
5208 and prefilter has to process it. We can then redefine prefilter
5220 and prefilter has to process it. We can then redefine prefilter
5209 from the outside and implement extensions for special
5221 from the outside and implement extensions for special
5210 purposes.
5222 purposes.
5211
5223
5212 Today I got one for inputting PhysicalQuantity objects
5224 Today I got one for inputting PhysicalQuantity objects
5213 (from Scientific) without needing any function calls at
5225 (from Scientific) without needing any function calls at
5214 all. Extremely convenient, and it's all done as a user-level
5226 all. Extremely convenient, and it's all done as a user-level
5215 extension (no IPython code was touched). Now instead of:
5227 extension (no IPython code was touched). Now instead of:
5216 a = PhysicalQuantity(4.2,'m/s**2')
5228 a = PhysicalQuantity(4.2,'m/s**2')
5217 one can simply say
5229 one can simply say
5218 a = 4.2 m/s**2
5230 a = 4.2 m/s**2
5219 or even
5231 or even
5220 a = 4.2 m/s^2
5232 a = 4.2 m/s^2
5221
5233
5222 I use this, but it's also a proof of concept: IPython really is
5234 I use this, but it's also a proof of concept: IPython really is
5223 fully user-extensible, even at the level of the parsing of the
5235 fully user-extensible, even at the level of the parsing of the
5224 command line. It's not trivial, but it's perfectly doable.
5236 command line. It's not trivial, but it's perfectly doable.
5225
5237
5226 * Added 'add_flip' method to inclusion conflict resolver. Fixes
5238 * Added 'add_flip' method to inclusion conflict resolver. Fixes
5227 the problem of modules being loaded in the inverse order in which
5239 the problem of modules being loaded in the inverse order in which
5228 they were defined in
5240 they were defined in
5229
5241
5230 * Version 0.1.8 released, 0.1.9 opened for further work.
5242 * Version 0.1.8 released, 0.1.9 opened for further work.
5231
5243
5232 * Added magics pdef, source and file. They respectively show the
5244 * Added magics pdef, source and file. They respectively show the
5233 definition line ('prototype' in C), source code and full python
5245 definition line ('prototype' in C), source code and full python
5234 file for any callable object. The object inspector oinfo uses
5246 file for any callable object. The object inspector oinfo uses
5235 these to show the same information.
5247 these to show the same information.
5236
5248
5237 * Version 0.1.7 released, 0.1.8 opened for further work.
5249 * Version 0.1.7 released, 0.1.8 opened for further work.
5238
5250
5239 * Separated all the magic functions into a class called Magic. The
5251 * Separated all the magic functions into a class called Magic. The
5240 InteractiveShell class was becoming too big for Xemacs to handle
5252 InteractiveShell class was becoming too big for Xemacs to handle
5241 (de-indenting a line would lock it up for 10 seconds while it
5253 (de-indenting a line would lock it up for 10 seconds while it
5242 backtracked on the whole class!)
5254 backtracked on the whole class!)
5243
5255
5244 FIXME: didn't work. It can be done, but right now namespaces are
5256 FIXME: didn't work. It can be done, but right now namespaces are
5245 all messed up. Do it later (reverted it for now, so at least
5257 all messed up. Do it later (reverted it for now, so at least
5246 everything works as before).
5258 everything works as before).
5247
5259
5248 * Got the object introspection system (magic_oinfo) working! I
5260 * Got the object introspection system (magic_oinfo) working! I
5249 think this is pretty much ready for release to Janko, so he can
5261 think this is pretty much ready for release to Janko, so he can
5250 test it for a while and then announce it. Pretty much 100% of what
5262 test it for a while and then announce it. Pretty much 100% of what
5251 I wanted for the 'phase 1' release is ready. Happy, tired.
5263 I wanted for the 'phase 1' release is ready. Happy, tired.
5252
5264
5253 2001-11-12 Fernando Perez <fperez@colorado.edu>
5265 2001-11-12 Fernando Perez <fperez@colorado.edu>
5254
5266
5255 * Version 0.1.6 released, 0.1.7 opened for further work.
5267 * Version 0.1.6 released, 0.1.7 opened for further work.
5256
5268
5257 * Fixed bug in printing: it used to test for truth before
5269 * Fixed bug in printing: it used to test for truth before
5258 printing, so 0 wouldn't print. Now checks for None.
5270 printing, so 0 wouldn't print. Now checks for None.
5259
5271
5260 * Fixed bug where auto-execs increase the prompt counter by 2 (b/c
5272 * Fixed bug where auto-execs increase the prompt counter by 2 (b/c
5261 they have to call len(str(sys.ps1)) ). But the fix is ugly, it
5273 they have to call len(str(sys.ps1)) ). But the fix is ugly, it
5262 reaches by hand into the outputcache. Think of a better way to do
5274 reaches by hand into the outputcache. Think of a better way to do
5263 this later.
5275 this later.
5264
5276
5265 * Various small fixes thanks to Nathan's comments.
5277 * Various small fixes thanks to Nathan's comments.
5266
5278
5267 * Changed magic_pprint to magic_Pprint. This way it doesn't
5279 * Changed magic_pprint to magic_Pprint. This way it doesn't
5268 collide with pprint() and the name is consistent with the command
5280 collide with pprint() and the name is consistent with the command
5269 line option.
5281 line option.
5270
5282
5271 * Changed prompt counter behavior to be fully like
5283 * Changed prompt counter behavior to be fully like
5272 Mathematica's. That is, even input that doesn't return a result
5284 Mathematica's. That is, even input that doesn't return a result
5273 raises the prompt counter. The old behavior was kind of confusing
5285 raises the prompt counter. The old behavior was kind of confusing
5274 (getting the same prompt number several times if the operation
5286 (getting the same prompt number several times if the operation
5275 didn't return a result).
5287 didn't return a result).
5276
5288
5277 * Fixed Nathan's last name in a couple of places (Gray, not Graham).
5289 * Fixed Nathan's last name in a couple of places (Gray, not Graham).
5278
5290
5279 * Fixed -Classic mode (wasn't working anymore).
5291 * Fixed -Classic mode (wasn't working anymore).
5280
5292
5281 * Added colored prompts using Nathan's new code. Colors are
5293 * Added colored prompts using Nathan's new code. Colors are
5282 currently hardwired, they can be user-configurable. For
5294 currently hardwired, they can be user-configurable. For
5283 developers, they can be chosen in file ipythonlib.py, at the
5295 developers, they can be chosen in file ipythonlib.py, at the
5284 beginning of the CachedOutput class def.
5296 beginning of the CachedOutput class def.
5285
5297
5286 2001-11-11 Fernando Perez <fperez@colorado.edu>
5298 2001-11-11 Fernando Perez <fperez@colorado.edu>
5287
5299
5288 * Version 0.1.5 released, 0.1.6 opened for further work.
5300 * Version 0.1.5 released, 0.1.6 opened for further work.
5289
5301
5290 * Changed magic_env to *return* the environment as a dict (not to
5302 * Changed magic_env to *return* the environment as a dict (not to
5291 print it). This way it prints, but it can also be processed.
5303 print it). This way it prints, but it can also be processed.
5292
5304
5293 * Added Verbose exception reporting to interactive
5305 * Added Verbose exception reporting to interactive
5294 exceptions. Very nice, now even 1/0 at the prompt gives a verbose
5306 exceptions. Very nice, now even 1/0 at the prompt gives a verbose
5295 traceback. Had to make some changes to the ultraTB file. This is
5307 traceback. Had to make some changes to the ultraTB file. This is
5296 probably the last 'big' thing in my mental todo list. This ties
5308 probably the last 'big' thing in my mental todo list. This ties
5297 in with the next entry:
5309 in with the next entry:
5298
5310
5299 * Changed -Xi and -Xf to a single -xmode option. Now all the user
5311 * Changed -Xi and -Xf to a single -xmode option. Now all the user
5300 has to specify is Plain, Color or Verbose for all exception
5312 has to specify is Plain, Color or Verbose for all exception
5301 handling.
5313 handling.
5302
5314
5303 * Removed ShellServices option. All this can really be done via
5315 * Removed ShellServices option. All this can really be done via
5304 the magic system. It's easier to extend, cleaner and has automatic
5316 the magic system. It's easier to extend, cleaner and has automatic
5305 namespace protection and documentation.
5317 namespace protection and documentation.
5306
5318
5307 2001-11-09 Fernando Perez <fperez@colorado.edu>
5319 2001-11-09 Fernando Perez <fperez@colorado.edu>
5308
5320
5309 * Fixed bug in output cache flushing (missing parameter to
5321 * Fixed bug in output cache flushing (missing parameter to
5310 __init__). Other small bugs fixed (found using pychecker).
5322 __init__). Other small bugs fixed (found using pychecker).
5311
5323
5312 * Version 0.1.4 opened for bugfixing.
5324 * Version 0.1.4 opened for bugfixing.
5313
5325
5314 2001-11-07 Fernando Perez <fperez@colorado.edu>
5326 2001-11-07 Fernando Perez <fperez@colorado.edu>
5315
5327
5316 * Version 0.1.3 released, mainly because of the raw_input bug.
5328 * Version 0.1.3 released, mainly because of the raw_input bug.
5317
5329
5318 * Fixed NASTY bug in raw_input: input line wasn't properly parsed
5330 * Fixed NASTY bug in raw_input: input line wasn't properly parsed
5319 and when testing for whether things were callable, a call could
5331 and when testing for whether things were callable, a call could
5320 actually be made to certain functions. They would get called again
5332 actually be made to certain functions. They would get called again
5321 once 'really' executed, with a resulting double call. A disaster
5333 once 'really' executed, with a resulting double call. A disaster
5322 in many cases (list.reverse() would never work!).
5334 in many cases (list.reverse() would never work!).
5323
5335
5324 * Removed prefilter() function, moved its code to raw_input (which
5336 * Removed prefilter() function, moved its code to raw_input (which
5325 after all was just a near-empty caller for prefilter). This saves
5337 after all was just a near-empty caller for prefilter). This saves
5326 a function call on every prompt, and simplifies the class a tiny bit.
5338 a function call on every prompt, and simplifies the class a tiny bit.
5327
5339
5328 * Fix _ip to __ip name in magic example file.
5340 * Fix _ip to __ip name in magic example file.
5329
5341
5330 * Changed 'tar -x -f' to 'tar xvf' in auto-installer. This should
5342 * Changed 'tar -x -f' to 'tar xvf' in auto-installer. This should
5331 work with non-gnu versions of tar.
5343 work with non-gnu versions of tar.
5332
5344
5333 2001-11-06 Fernando Perez <fperez@colorado.edu>
5345 2001-11-06 Fernando Perez <fperez@colorado.edu>
5334
5346
5335 * Version 0.1.2. Just to keep track of the recent changes.
5347 * Version 0.1.2. Just to keep track of the recent changes.
5336
5348
5337 * Fixed nasty bug in output prompt routine. It used to check 'if
5349 * Fixed nasty bug in output prompt routine. It used to check 'if
5338 arg != None...'. Problem is, this fails if arg implements a
5350 arg != None...'. Problem is, this fails if arg implements a
5339 special comparison (__cmp__) which disallows comparing to
5351 special comparison (__cmp__) which disallows comparing to
5340 None. Found it when trying to use the PhysicalQuantity module from
5352 None. Found it when trying to use the PhysicalQuantity module from
5341 ScientificPython.
5353 ScientificPython.
5342
5354
5343 2001-11-05 Fernando Perez <fperez@colorado.edu>
5355 2001-11-05 Fernando Perez <fperez@colorado.edu>
5344
5356
5345 * Also added dirs. Now the pushd/popd/dirs family functions
5357 * Also added dirs. Now the pushd/popd/dirs family functions
5346 basically like the shell, with the added convenience of going home
5358 basically like the shell, with the added convenience of going home
5347 when called with no args.
5359 when called with no args.
5348
5360
5349 * pushd/popd slightly modified to mimic shell behavior more
5361 * pushd/popd slightly modified to mimic shell behavior more
5350 closely.
5362 closely.
5351
5363
5352 * Added env,pushd,popd from ShellServices as magic functions. I
5364 * Added env,pushd,popd from ShellServices as magic functions. I
5353 think the cleanest will be to port all desired functions from
5365 think the cleanest will be to port all desired functions from
5354 ShellServices as magics and remove ShellServices altogether. This
5366 ShellServices as magics and remove ShellServices altogether. This
5355 will provide a single, clean way of adding functionality
5367 will provide a single, clean way of adding functionality
5356 (shell-type or otherwise) to IP.
5368 (shell-type or otherwise) to IP.
5357
5369
5358 2001-11-04 Fernando Perez <fperez@colorado.edu>
5370 2001-11-04 Fernando Perez <fperez@colorado.edu>
5359
5371
5360 * Added .ipython/ directory to sys.path. This way users can keep
5372 * Added .ipython/ directory to sys.path. This way users can keep
5361 customizations there and access them via import.
5373 customizations there and access them via import.
5362
5374
5363 2001-11-03 Fernando Perez <fperez@colorado.edu>
5375 2001-11-03 Fernando Perez <fperez@colorado.edu>
5364
5376
5365 * Opened version 0.1.1 for new changes.
5377 * Opened version 0.1.1 for new changes.
5366
5378
5367 * Changed version number to 0.1.0: first 'public' release, sent to
5379 * Changed version number to 0.1.0: first 'public' release, sent to
5368 Nathan and Janko.
5380 Nathan and Janko.
5369
5381
5370 * Lots of small fixes and tweaks.
5382 * Lots of small fixes and tweaks.
5371
5383
5372 * Minor changes to whos format. Now strings are shown, snipped if
5384 * Minor changes to whos format. Now strings are shown, snipped if
5373 too long.
5385 too long.
5374
5386
5375 * Changed ShellServices to work on __main__ so they show up in @who
5387 * Changed ShellServices to work on __main__ so they show up in @who
5376
5388
5377 * Help also works with ? at the end of a line:
5389 * Help also works with ? at the end of a line:
5378 ?sin and sin?
5390 ?sin and sin?
5379 both produce the same effect. This is nice, as often I use the
5391 both produce the same effect. This is nice, as often I use the
5380 tab-complete to find the name of a method, but I used to then have
5392 tab-complete to find the name of a method, but I used to then have
5381 to go to the beginning of the line to put a ? if I wanted more
5393 to go to the beginning of the line to put a ? if I wanted more
5382 info. Now I can just add the ? and hit return. Convenient.
5394 info. Now I can just add the ? and hit return. Convenient.
5383
5395
5384 2001-11-02 Fernando Perez <fperez@colorado.edu>
5396 2001-11-02 Fernando Perez <fperez@colorado.edu>
5385
5397
5386 * Python version check (>=2.1) added.
5398 * Python version check (>=2.1) added.
5387
5399
5388 * Added LazyPython documentation. At this point the docs are quite
5400 * Added LazyPython documentation. At this point the docs are quite
5389 a mess. A cleanup is in order.
5401 a mess. A cleanup is in order.
5390
5402
5391 * Auto-installer created. For some bizarre reason, the zipfiles
5403 * Auto-installer created. For some bizarre reason, the zipfiles
5392 module isn't working on my system. So I made a tar version
5404 module isn't working on my system. So I made a tar version
5393 (hopefully the command line options in various systems won't kill
5405 (hopefully the command line options in various systems won't kill
5394 me).
5406 me).
5395
5407
5396 * Fixes to Struct in genutils. Now all dictionary-like methods are
5408 * Fixes to Struct in genutils. Now all dictionary-like methods are
5397 protected (reasonably).
5409 protected (reasonably).
5398
5410
5399 * Added pager function to genutils and changed ? to print usage
5411 * Added pager function to genutils and changed ? to print usage
5400 note through it (it was too long).
5412 note through it (it was too long).
5401
5413
5402 * Added the LazyPython functionality. Works great! I changed the
5414 * Added the LazyPython functionality. Works great! I changed the
5403 auto-quote escape to ';', it's on home row and next to '. But
5415 auto-quote escape to ';', it's on home row and next to '. But
5404 both auto-quote and auto-paren (still /) escapes are command-line
5416 both auto-quote and auto-paren (still /) escapes are command-line
5405 parameters.
5417 parameters.
5406
5418
5407
5419
5408 2001-11-01 Fernando Perez <fperez@colorado.edu>
5420 2001-11-01 Fernando Perez <fperez@colorado.edu>
5409
5421
5410 * Version changed to 0.0.7. Fairly large change: configuration now
5422 * Version changed to 0.0.7. Fairly large change: configuration now
5411 is all stored in a directory, by default .ipython. There, all
5423 is all stored in a directory, by default .ipython. There, all
5412 config files have normal looking names (not .names)
5424 config files have normal looking names (not .names)
5413
5425
5414 * Version 0.0.6 Released first to Lucas and Archie as a test
5426 * Version 0.0.6 Released first to Lucas and Archie as a test
5415 run. Since it's the first 'semi-public' release, change version to
5427 run. Since it's the first 'semi-public' release, change version to
5416 > 0.0.6 for any changes now.
5428 > 0.0.6 for any changes now.
5417
5429
5418 * Stuff I had put in the ipplib.py changelog:
5430 * Stuff I had put in the ipplib.py changelog:
5419
5431
5420 Changes to InteractiveShell:
5432 Changes to InteractiveShell:
5421
5433
5422 - Made the usage message a parameter.
5434 - Made the usage message a parameter.
5423
5435
5424 - Require the name of the shell variable to be given. It's a bit
5436 - Require the name of the shell variable to be given. It's a bit
5425 of a hack, but allows the name 'shell' not to be hardwire in the
5437 of a hack, but allows the name 'shell' not to be hardwire in the
5426 magic (@) handler, which is problematic b/c it requires
5438 magic (@) handler, which is problematic b/c it requires
5427 polluting the global namespace with 'shell'. This in turn is
5439 polluting the global namespace with 'shell'. This in turn is
5428 fragile: if a user redefines a variable called shell, things
5440 fragile: if a user redefines a variable called shell, things
5429 break.
5441 break.
5430
5442
5431 - magic @: all functions available through @ need to be defined
5443 - magic @: all functions available through @ need to be defined
5432 as magic_<name>, even though they can be called simply as
5444 as magic_<name>, even though they can be called simply as
5433 @<name>. This allows the special command @magic to gather
5445 @<name>. This allows the special command @magic to gather
5434 information automatically about all existing magic functions,
5446 information automatically about all existing magic functions,
5435 even if they are run-time user extensions, by parsing the shell
5447 even if they are run-time user extensions, by parsing the shell
5436 instance __dict__ looking for special magic_ names.
5448 instance __dict__ looking for special magic_ names.
5437
5449
5438 - mainloop: added *two* local namespace parameters. This allows
5450 - mainloop: added *two* local namespace parameters. This allows
5439 the class to differentiate between parameters which were there
5451 the class to differentiate between parameters which were there
5440 before and after command line initialization was processed. This
5452 before and after command line initialization was processed. This
5441 way, later @who can show things loaded at startup by the
5453 way, later @who can show things loaded at startup by the
5442 user. This trick was necessary to make session saving/reloading
5454 user. This trick was necessary to make session saving/reloading
5443 really work: ideally after saving/exiting/reloading a session,
5455 really work: ideally after saving/exiting/reloading a session,
5444 *everythin* should look the same, including the output of @who. I
5456 *everythin* should look the same, including the output of @who. I
5445 was only able to make this work with this double namespace
5457 was only able to make this work with this double namespace
5446 trick.
5458 trick.
5447
5459
5448 - added a header to the logfile which allows (almost) full
5460 - added a header to the logfile which allows (almost) full
5449 session restoring.
5461 session restoring.
5450
5462
5451 - prepend lines beginning with @ or !, with a and log
5463 - prepend lines beginning with @ or !, with a and log
5452 them. Why? !lines: may be useful to know what you did @lines:
5464 them. Why? !lines: may be useful to know what you did @lines:
5453 they may affect session state. So when restoring a session, at
5465 they may affect session state. So when restoring a session, at
5454 least inform the user of their presence. I couldn't quite get
5466 least inform the user of their presence. I couldn't quite get
5455 them to properly re-execute, but at least the user is warned.
5467 them to properly re-execute, but at least the user is warned.
5456
5468
5457 * Started ChangeLog.
5469 * Started ChangeLog.
@@ -1,406 +1,406 b''
1 .\" Hey, EMACS: -*- nroff -*-
1 .\" Hey, EMACS: -*- nroff -*-
2 .\" First parameter, NAME, should be all caps
2 .\" First parameter, NAME, should be all caps
3 .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
3 .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
4 .\" other parameters are allowed: see man(7), man(1)
4 .\" other parameters are allowed: see man(7), man(1)
5 .TH IPYTHON 1 "November 30, 2004"
5 .TH IPYTHON 1 "November 30, 2004"
6 .\" Please adjust this date whenever revising the manpage.
6 .\" Please adjust this date whenever revising the manpage.
7 .\"
7 .\"
8 .\" Some roff macros, for reference:
8 .\" Some roff macros, for reference:
9 .\" .nh disable hyphenation
9 .\" .nh disable hyphenation
10 .\" .hy enable hyphenation
10 .\" .hy enable hyphenation
11 .\" .ad l left justify
11 .\" .ad l left justify
12 .\" .ad b justify to both left and right margins
12 .\" .ad b justify to both left and right margins
13 .\" .nf disable filling
13 .\" .nf disable filling
14 .\" .fi enable filling
14 .\" .fi enable filling
15 .\" .br insert line break
15 .\" .br insert line break
16 .\" .sp <n> insert n+1 empty lines
16 .\" .sp <n> insert n+1 empty lines
17 .\" for manpage-specific macros, see man(7) and groff_man(7)
17 .\" for manpage-specific macros, see man(7) and groff_man(7)
18 .\" .SH section heading
18 .\" .SH section heading
19 .\" .SS secondary section heading
19 .\" .SS secondary section heading
20 .\"
20 .\"
21 .\"
21 .\"
22 .\" To preview this page as plain text: nroff -man ipython.1
22 .\" To preview this page as plain text: nroff -man ipython.1
23 .\"
23 .\"
24 .SH NAME
24 .SH NAME
25 ipython \- An Enhanced Interactive Python
25 ipython \- An Enhanced Interactive Python
26 .SH SYNOPSIS
26 .SH SYNOPSIS
27 .B ipython
27 .B ipython
28 .RI [ options ] " files" ...
28 .RI [ options ] " files" ...
29 .SH DESCRIPTION
29 .SH DESCRIPTION
30 An interactive Python shell with automatic history (input and output),
30 An interactive Python shell with automatic history (input and output),
31 dynamic object introspection, easier configuration, command
31 dynamic object introspection, easier configuration, command
32 completion, access to the system shell, integration with numerical and
32 completion, access to the system shell, integration with numerical and
33 scientific computing tools, and more.
33 scientific computing tools, and more.
34 .SH SPECIAL THREADING OPTIONS
34 .SH SPECIAL THREADING OPTIONS
35 The following special options are ONLY valid at the beginning of the command
35 The following special options are ONLY valid at the beginning of the command
36 line, and not later. This is because they control the initialization of
36 line, and not later. This is because they control the initialization of
37 ipython itself, before the normal option-handling mechanism is active.
37 ipython itself, before the normal option-handling mechanism is active.
38 .TP
38 .TP
39 .B \-gthread, \-qthread, \-wthread, \-pylab
39 .B \-gthread, \-qthread, \-wthread, \-pylab
40 Only ONE of these can be given, and it can only be given as the first option
40 Only ONE of these can be given, and it can only be given as the first option
41 passed to IPython (it will have no effect in any other position). They
41 passed to IPython (it will have no effect in any other position). They
42 provide threading support for the GTK, QT and WXWidgets toolkits, and for the
42 provide threading support for the GTK, QT and WXWidgets toolkits, and for the
43 matplotlib library.
43 matplotlib library.
44 .br
44 .br
45 .sp 1
45 .sp 1
46 With any of the first three options, IPython starts running a separate thread
46 With any of the first three options, IPython starts running a separate thread
47 for the graphical toolkit's operation, so that you can open and control
47 for the graphical toolkit's operation, so that you can open and control
48 graphical elements from within an IPython command line, without blocking. All
48 graphical elements from within an IPython command line, without blocking. All
49 three provide essentially the same functionality, respectively for GTK, QT and
49 three provide essentially the same functionality, respectively for GTK, QT and
50 WXWidgets (via their Python interfaces).
50 WXWidgets (via their Python interfaces).
51 .br
51 .br
52 .sp 1
52 .sp 1
53 Note that with \-wthread, you can additionally use the \-wxversion option to
53 Note that with \-wthread, you can additionally use the \-wxversion option to
54 request a specific version of wx to be used. This requires that you have the
54 request a specific version of wx to be used. This requires that you have the
55 'wxversion' Python module installed, which is part of recent wxPython
55 'wxversion' Python module installed, which is part of recent wxPython
56 distributions.
56 distributions.
57 .br
57 .br
58 .sp 1
58 .sp 1
59 If \-pylab is given, IPython loads special support for the matplotlib library
59 If \-pylab is given, IPython loads special support for the matplotlib library
60 (http://matplotlib.sourceforge.net), allowing interactive usage of any of its
60 (http://matplotlib.sourceforge.net), allowing interactive usage of any of its
61 backends as defined in the user's .matplotlibrc file. It automatically
61 backends as defined in the user's .matplotlibrc file. It automatically
62 activates GTK, QT or WX threading for IPyhton if the choice of matplotlib
62 activates GTK, QT or WX threading for IPyhton if the choice of matplotlib
63 backend requires it. It also modifies the %run command to correctly execute
63 backend requires it. It also modifies the %run command to correctly execute
64 (without blocking) any matplotlib-based script which calls show() at the end.
64 (without blocking) any matplotlib-based script which calls show() at the end.
65 .TP
65 .TP
66 .B \-tk
66 .B \-tk
67 The \-g/q/wthread options, and \-pylab (if matplotlib is configured to use
67 The \-g/q/wthread options, and \-pylab (if matplotlib is configured to use
68 GTK, QT or WX), will normally block Tk graphical interfaces. This means that
68 GTK, QT or WX), will normally block Tk graphical interfaces. This means that
69 when GTK, QT or WX threading is active, any attempt to open a Tk GUI will
69 when GTK, QT or WX threading is active, any attempt to open a Tk GUI will
70 result in a dead window, and possibly cause the Python interpreter to crash.
70 result in a dead window, and possibly cause the Python interpreter to crash.
71 An extra option, \-tk, is available to address this issue. It can ONLY be
71 An extra option, \-tk, is available to address this issue. It can ONLY be
72 given as a SECOND option after any of the above (\-gthread, \-qthread,
72 given as a SECOND option after any of the above (\-gthread, \-qthread,
73 \-wthread or \-pylab).
73 \-wthread or \-pylab).
74 .br
74 .br
75 .sp 1
75 .sp 1
76 If \-tk is given, IPython will try to coordinate Tk threading with GTK, QT or
76 If \-tk is given, IPython will try to coordinate Tk threading with GTK, QT or
77 WX. This is however potentially unreliable, and you will have to test on your
77 WX. This is however potentially unreliable, and you will have to test on your
78 platform and Python configuration to determine whether it works for you.
78 platform and Python configuration to determine whether it works for you.
79 Debian users have reported success, apparently due to the fact that Debian
79 Debian users have reported success, apparently due to the fact that Debian
80 builds all of Tcl, Tk, Tkinter and Python with pthreads support. Under other
80 builds all of Tcl, Tk, Tkinter and Python with pthreads support. Under other
81 Linux environments (such as Fedora Core 2), this option has caused random
81 Linux environments (such as Fedora Core 2), this option has caused random
82 crashes and lockups of the Python interpreter. Under other operating systems
82 crashes and lockups of the Python interpreter. Under other operating systems
83 (Mac OSX and Windows), you'll need to try it to find out, since currently no
83 (Mac OSX and Windows), you'll need to try it to find out, since currently no
84 user reports are available.
84 user reports are available.
85 .br
85 .br
86 .sp 1
86 .sp 1
87 There is unfortunately no way for IPython to determine at runtime whether \-tk
87 There is unfortunately no way for IPython to determine at runtime whether \-tk
88 will work reliably or not, so you will need to do some experiments before
88 will work reliably or not, so you will need to do some experiments before
89 relying on it for regular work.
89 relying on it for regular work.
90 .
90 .
91 .SS A WARNING ABOUT SIGNALS AND THREADS
91 .SS A WARNING ABOUT SIGNALS AND THREADS
92 When any of the thread systems (GTK, QT or WX) are active, either directly or
92 When any of the thread systems (GTK, QT or WX) are active, either directly or
93 via \-pylab with a threaded backend, it is impossible to interrupt
93 via \-pylab with a threaded backend, it is impossible to interrupt
94 long-running Python code via Ctrl\-C. IPython can not pass the
94 long-running Python code via Ctrl\-C. IPython can not pass the
95 KeyboardInterrupt exception (or the underlying SIGINT) across threads, so any
95 KeyboardInterrupt exception (or the underlying SIGINT) across threads, so any
96 long-running process started from IPython will run to completion, or will have
96 long-running process started from IPython will run to completion, or will have
97 to be killed via an external (OS-based) mechanism.
97 to be killed via an external (OS-based) mechanism.
98 .br
98 .br
99 .sp 1
99 .sp 1
100 To the best of my knowledge, this limitation is imposed by the Python
100 To the best of my knowledge, this limitation is imposed by the Python
101 interpreter itself, and it comes from the difficulty of writing portable
101 interpreter itself, and it comes from the difficulty of writing portable
102 signal/threaded code. If any user is an expert on this topic and can suggest
102 signal/threaded code. If any user is an expert on this topic and can suggest
103 a better solution, I would love to hear about it. In the IPython sources,
103 a better solution, I would love to hear about it. In the IPython sources,
104 look at the Shell.py module, and in particular at the runcode() method.
104 look at the Shell.py module, and in particular at the runcode() method.
105 .
105 .
106 .SH REGULAR OPTIONS
106 .SH REGULAR OPTIONS
107 After the above threading options have been given, regular options can follow
107 After the above threading options have been given, regular options can follow
108 in any order. All options can be abbreviated to their shortest non-ambiguous
108 in any order. All options can be abbreviated to their shortest non-ambiguous
109 form and are case-sensitive. One or two dashes can be used. Some options
109 form and are case-sensitive. One or two dashes can be used. Some options
110 have an alternate short form, indicated after a |.
110 have an alternate short form, indicated after a |.
111 .br
111 .br
112 .sp 1
112 .sp 1
113 Most options can also be set from your ipythonrc configuration file.
113 Most options can also be set from your ipythonrc configuration file.
114 See the provided examples for assistance. Options given on the
114 See the provided examples for assistance. Options given on the
115 commandline override the values set in the ipythonrc file.
115 commandline override the values set in the ipythonrc file.
116 .br
116 .br
117 .sp 1
117 .sp 1
118 All options with a [no] prepended can be specified in negated form
118 All options with a [no] prepended can be specified in negated form
119 (\-nooption instead of \-option) to turn the feature off.
119 (\-nooption instead of \-option) to turn the feature off.
120 .TP
120 .TP
121 .B \-h, \-\-help
121 .B \-h, \-\-help
122 Show summary of options.
122 Show summary of options.
123 .TP
123 .TP
124 .B \-autocall <val>
124 .B \-autocall <val>
125 Make IPython automatically call any callable object even if you didn't type
125 Make IPython automatically call any callable object even if you didn't type
126 explicit parentheses. For example, 'str 43' becomes
126 explicit parentheses. For example, 'str 43' becomes
127 'str(43)' automatically. The value can be '0' to disable the
127 'str(43)' automatically. The value can be '0' to disable the
128 feature, '1' for 'smart' autocall, where it is not applied if
128 feature, '1' for 'smart' autocall, where it is not applied if
129 there are no more arguments on the line, and '2' for 'full'
129 there are no more arguments on the line, and '2' for 'full'
130 autocall, where all callable objects are automatically called
130 autocall, where all callable objects are automatically called
131 (even if no arguments are present). The default is '1'.
131 (even if no arguments are present). The default is '1'.
132 .TP
132 .TP
133 .B \-[no]autoindent
133 .B \-[no]autoindent
134 Turn automatic indentation on/off.
134 Turn automatic indentation on/off.
135 .TP
135 .TP
136 .B \-[no]automagic
136 .B \-[no]automagic
137 Make magic commands automatic (without needing their first character
137 Make magic commands automatic (without needing their first character
138 to be %). Type %magic at the IPython prompt for more information.
138 to be %). Type %magic at the IPython prompt for more information.
139 .TP
139 .TP
140 .B \-[no]autoedit_syntax
140 .B \-[no]autoedit_syntax
141 When a syntax error occurs after editing a file, automatically open the file
141 When a syntax error occurs after editing a file, automatically open the file
142 to the trouble causing line for convenient fixing.
142 to the trouble causing line for convenient fixing.
143 .TP
143 .TP
144 .B \-[no]banner
144 .B \-[no]banner
145 Print the intial information banner (default on).
145 Print the intial information banner (default on).
146 .TP
146 .TP
147 .B \-c <command>
147 .B \-c <command>
148 Execute the given command string, and set sys.argv to ['c']. This is similar
148 Execute the given command string, and set sys.argv to ['c']. This is similar
149 to the \-c option in the normal Python interpreter.
149 to the \-c option in the normal Python interpreter.
150 .TP
150 .TP
151 .B \-cache_size|cs <n>
151 .B \-cache_size|cs <n>
152 Size of the output cache (maximum number of entries to hold in
152 Size of the output cache (maximum number of entries to hold in
153 memory). The default is 1000, you can change it permanently in your
153 memory). The default is 1000, you can change it permanently in your
154 config file. Setting it to 0 completely disables the caching system,
154 config file. Setting it to 0 completely disables the caching system,
155 and the minimum value accepted is 20 (if you provide a value less than
155 and the minimum value accepted is 20 (if you provide a value less than
156 20, it is reset to 0 and a warning is issued). This limit is defined
156 20, it is reset to 0 and a warning is issued). This limit is defined
157 because otherwise you'll spend more time re-flushing a too small cache
157 because otherwise you'll spend more time re-flushing a too small cache
158 than working.
158 than working.
159 .TP
159 .TP
160 .B \-classic|cl
160 .B \-classic|cl
161 Gives IPython a similar feel to the classic Python prompt.
161 Gives IPython a similar feel to the classic Python prompt.
162 .TP
162 .TP
163 .B \-colors <scheme>
163 .B \-colors <scheme>
164 Color scheme for prompts and exception reporting. Currently
164 Color scheme for prompts and exception reporting. Currently
165 implemented: NoColor, Linux, and LightBG.
165 implemented: NoColor, Linux, and LightBG.
166 .TP
166 .TP
167 .B \-[no]color_info
167 .B \-[no]color_info
168 IPython can display information about objects via a set of functions,
168 IPython can display information about objects via a set of functions,
169 and optionally can use colors for this, syntax highlighting source
169 and optionally can use colors for this, syntax highlighting source
170 code and various other elements. However, because this information is
170 code and various other elements. However, because this information is
171 passed through a pager (like 'less') and many pagers get confused with
171 passed through a pager (like 'less') and many pagers get confused with
172 color codes, this option is off by default. You can test it and turn
172 color codes, this option is off by default. You can test it and turn
173 it on permanently in your ipythonrc file if it works for you. As a
173 it on permanently in your ipythonrc file if it works for you. As a
174 reference, the 'less' pager supplied with Mandrake 8.2 works ok, but
174 reference, the 'less' pager supplied with Mandrake 8.2 works ok, but
175 that in RedHat 7.2 doesn't.
175 that in RedHat 7.2 doesn't.
176 .br
176 .br
177 .sp 1
177 .sp 1
178 Test it and turn it on permanently if it works with your system. The
178 Test it and turn it on permanently if it works with your system. The
179 magic function @color_info allows you to toggle this interactively for
179 magic function @color_info allows you to toggle this interactively for
180 testing.
180 testing.
181 .TP
181 .TP
182 .B \-[no]confirm_exit
182 .B \-[no]confirm_exit
183 Set to confirm when you try to exit IPython with an EOF (Control-D in
183 Set to confirm when you try to exit IPython with an EOF (Control-D in
184 Unix, Control-Z/Enter in Windows). Note that using the magic functions
184 Unix, Control-Z/Enter in Windows). Note that using the magic functions
185 @Exit or @Quit you can force a direct exit, bypassing any
185 @Exit or @Quit you can force a direct exit, bypassing any
186 confirmation.
186 confirmation.
187 .TP
187 .TP
188 .B \-[no]debug
188 .B \-[no]debug
189 Show information about the loading process. Very useful to pin down
189 Show information about the loading process. Very useful to pin down
190 problems with your configuration files or to get details about session
190 problems with your configuration files or to get details about session
191 restores.
191 restores.
192 .TP
192 .TP
193 .B \-[no]deep_reload
193 .B \-[no]deep_reload
194 IPython can use the deep_reload module which reloads changes in
194 IPython can use the deep_reload module which reloads changes in
195 modules recursively (it replaces the reload() function, so you don't
195 modules recursively (it replaces the reload() function, so you don't
196 need to change anything to use it). deep_reload() forces a full reload
196 need to change anything to use it). deep_reload() forces a full reload
197 of modules whose code may have changed, which the default reload()
197 of modules whose code may have changed, which the default reload()
198 function does not.
198 function does not.
199 .br
199 .br
200 .sp 1
200 .sp 1
201 When deep_reload is off, IPython will use the normal reload(), but
201 When deep_reload is off, IPython will use the normal reload(), but
202 deep_reload will still be available as dreload(). This feature is off
202 deep_reload will still be available as dreload(). This feature is off
203 by default [which means that you have both normal reload() and
203 by default [which means that you have both normal reload() and
204 dreload()].
204 dreload()].
205 .TP
205 .TP
206 .B \-editor <name>
206 .B \-editor <name>
207 Which editor to use with the @edit command. By default, IPython will
207 Which editor to use with the @edit command. By default, IPython will
208 honor your EDITOR environment variable (if not set, vi is the Unix
208 honor your EDITOR environment variable (if not set, vi is the Unix
209 default and notepad the Windows one). Since this editor is invoked on
209 default and notepad the Windows one). Since this editor is invoked on
210 the fly by IPython and is meant for editing small code snippets, you
210 the fly by IPython and is meant for editing small code snippets, you
211 may want to use a small, lightweight editor here (in case your default
211 may want to use a small, lightweight editor here (in case your default
212 EDITOR is something like Emacs).
212 EDITOR is something like Emacs).
213 .TP
213 .TP
214 .B \-ipythondir <name>
214 .B \-ipythondir <name>
215 The name of your IPython configuration directory IPYTHONDIR. This can
215 The name of your IPython configuration directory IPYTHONDIR. This can
216 also be specified through the environment variable IPYTHONDIR.
216 also be specified through the environment variable IPYTHONDIR.
217 .TP
217 .TP
218 .B \-log|l
218 .B \-log|l
219 Generate a log file of all input. The file is named ipython_log.py in your
219 Generate a log file of all input. The file is named ipython_log.py in your
220 current directory (which prevents logs from multiple IPython sessions from
220 current directory (which prevents logs from multiple IPython sessions from
221 trampling each other). You can use this to later restore a session by loading
221 trampling each other). You can use this to later restore a session by loading
222 your logfile as a file to be executed with option -logplay (see below).
222 your logfile as a file to be executed with option -logplay (see below).
223 .TP
223 .TP
224 .B \-logfile|lf
224 .B \-logfile|lf
225 Specify the name of your logfile.
225 Specify the name of your logfile.
226 .TP
226 .TP
227 .B \-logplay|lp
227 .B \-logplay|lp
228 Replay a previous log. For restoring a session as close as possible to
228 Replay a previous log. For restoring a session as close as possible to
229 the state you left it in, use this option (don't just run the
229 the state you left it in, use this option (don't just run the
230 logfile). With \-logplay, IPython will try to reconstruct the previous
230 logfile). With \-logplay, IPython will try to reconstruct the previous
231 working environment in full, not just execute the commands in the
231 working environment in full, not just execute the commands in the
232 logfile.
232 logfile.
233 .br
233 .br
234 .sh 1
234 .sh 1
235 When a session is restored, logging is automatically turned on again
235 When a session is restored, logging is automatically turned on again
236 with the name of the logfile it was invoked with (it is read from the
236 with the name of the logfile it was invoked with (it is read from the
237 log header). So once you've turned logging on for a session, you can
237 log header). So once you've turned logging on for a session, you can
238 quit IPython and reload it as many times as you want and it will
238 quit IPython and reload it as many times as you want and it will
239 continue to log its history and restore from the beginning every time.
239 continue to log its history and restore from the beginning every time.
240 .br
240 .br
241 .sp 1
241 .sp 1
242 Caveats: there are limitations in this option. The history variables
242 Caveats: there are limitations in this option. The history variables
243 _i*,_* and _dh don't get restored properly. In the future we will try
243 _i*,_* and _dh don't get restored properly. In the future we will try
244 to implement full session saving by writing and retrieving a
244 to implement full session saving by writing and retrieving a
245 'snapshot' of the memory state of IPython. But our first attempts
245 'snapshot' of the memory state of IPython. But our first attempts
246 failed because of inherent limitations of Python's Pickle module, so
246 failed because of inherent limitations of Python's Pickle module, so
247 this may have to wait.
247 this may have to wait.
248 .TP
248 .TP
249 .B \-[no]messages
249 .B \-[no]messages
250 Print messages which IPython collects about its startup process
250 Print messages which IPython collects about its startup process
251 (default on).
251 (default on).
252 .TP
252 .TP
253 .B \-[no]pdb
253 .B \-[no]pdb
254 Automatically call the pdb debugger after every uncaught exception. If
254 Automatically call the pdb debugger after every uncaught exception. If
255 you are used to debugging using pdb, this puts you automatically
255 you are used to debugging using pdb, this puts you automatically
256 inside of it after any call (either in IPython or in code called by
256 inside of it after any call (either in IPython or in code called by
257 it) which triggers an exception which goes uncaught.
257 it) which triggers an exception which goes uncaught.
258 .TP
258 .TP
259 .B \-[no]pprint
259 .B \-[no]pprint
260 IPython can optionally use the pprint (pretty printer) module for
260 IPython can optionally use the pprint (pretty printer) module for
261 displaying results. pprint tends to give a nicer display of nested
261 displaying results. pprint tends to give a nicer display of nested
262 data structures. If you like it, you can turn it on permanently in
262 data structures. If you like it, you can turn it on permanently in
263 your config file (default off).
263 your config file (default off).
264 .TP
264 .TP
265 .B \-profile|p <name>
265 .B \-profile|p <name>
266 Assume that your config file is ipythonrc-<name> (looks in current dir
266 Assume that your config file is ipythonrc-<name> (looks in current dir
267 first, then in IPYTHONDIR). This is a quick way to keep and load
267 first, then in IPYTHONDIR). This is a quick way to keep and load
268 multiple config files for different tasks, especially if you use the
268 multiple config files for different tasks, especially if you use the
269 include option of config files. You can keep a basic
269 include option of config files. You can keep a basic
270 IPYTHONDIR/ipythonrc file and then have other 'profiles' which include
270 IPYTHONDIR/ipythonrc file and then have other 'profiles' which include
271 this one and load extra things for particular tasks. For example:
271 this one and load extra things for particular tasks. For example:
272 .br
272 .br
273 .sp 1
273 .sp 1
274 1) $HOME/.ipython/ipythonrc : load basic things you always want.
274 1) $HOME/.ipython/ipythonrc : load basic things you always want.
275 .br
275 .br
276 2) $HOME/.ipython/ipythonrc-math : load (1) and basic math-related
276 2) $HOME/.ipython/ipythonrc-math : load (1) and basic math-related
277 modules.
277 modules.
278 .br
278 .br
279 3) $HOME/.ipython/ipythonrc-numeric : load (1) and Numeric and
279 3) $HOME/.ipython/ipythonrc-numeric : load (1) and Numeric and
280 plotting modules.
280 plotting modules.
281 .br
281 .br
282 .sp 1
282 .sp 1
283 Since it is possible to create an endless loop by having circular file
283 Since it is possible to create an endless loop by having circular file
284 inclusions, IPython will stop if it reaches 15 recursive inclusions.
284 inclusions, IPython will stop if it reaches 15 recursive inclusions.
285 .TP
285 .TP
286 .B \-prompt_in1|pi1 <string>
286 .B \-prompt_in1|pi1 <string>
287 Specify the string used for input prompts. Note that if you are using
287 Specify the string used for input prompts. Note that if you are using
288 numbered prompts, the number is represented with a '\\#' in the
288 numbered prompts, the number is represented with a '\\#' in the
289 string. Don't forget to quote strings with spaces embedded in
289 string. Don't forget to quote strings with spaces embedded in
290 them. Default: 'In [\\#]:'.
290 them. Default: 'In [\\#]: '.
291 .br
291 .br
292 .sp 1
292 .sp 1
293 Most bash-like escapes can be used to customize IPython's prompts, as well as
293 Most bash-like escapes can be used to customize IPython's prompts, as well as
294 a few additional ones which are IPython-specific. All valid prompt escapes
294 a few additional ones which are IPython-specific. All valid prompt escapes
295 are described in detail in the Customization section of the IPython HTML/PDF
295 are described in detail in the Customization section of the IPython HTML/PDF
296 manual.
296 manual.
297 .TP
297 .TP
298 .B \-prompt_in2|pi2 <string>
298 .B \-prompt_in2|pi2 <string>
299 Similar to the previous option, but used for the continuation prompts. The
299 Similar to the previous option, but used for the continuation prompts. The
300 special sequence '\\D' is similar to '\\#', but with all digits replaced dots
300 special sequence '\\D' is similar to '\\#', but with all digits replaced dots
301 (so you can have your continuation prompt aligned with your input
301 (so you can have your continuation prompt aligned with your input
302 prompt). Default: ' .\\D.:' (note three spaces at the start for alignment
302 prompt). Default: ' .\\D.: ' (note three spaces at the start for alignment
303 with 'In [\\#]').
303 with 'In [\\#]').
304 .TP
304 .TP
305 .B \-prompt_out|po <string>
305 .B \-prompt_out|po <string>
306 String used for output prompts, also uses numbers like prompt_in1.
306 String used for output prompts, also uses numbers like prompt_in1.
307 Default: 'Out[\\#]:'.
307 Default: 'Out[\\#]:'.
308 .TP
308 .TP
309 .B \-quick
309 .B \-quick
310 Start in bare bones mode (no config file loaded).
310 Start in bare bones mode (no config file loaded).
311 .TP
311 .TP
312 .B \-rcfile <name>
312 .B \-rcfile <name>
313 Name of your IPython resource configuration file. normally IPython
313 Name of your IPython resource configuration file. normally IPython
314 loads ipythonrc (from current directory) or IPYTHONDIR/ipythonrc. If
314 loads ipythonrc (from current directory) or IPYTHONDIR/ipythonrc. If
315 the loading of your config file fails, IPython starts with a bare
315 the loading of your config file fails, IPython starts with a bare
316 bones configuration (no modules loaded at all).
316 bones configuration (no modules loaded at all).
317 .TP
317 .TP
318 .B \-[no]readline
318 .B \-[no]readline
319 Use the readline library, which is needed to support name completion
319 Use the readline library, which is needed to support name completion
320 and command history, among other things. It is enabled by default, but
320 and command history, among other things. It is enabled by default, but
321 may cause problems for users of X/Emacs in Python comint or shell
321 may cause problems for users of X/Emacs in Python comint or shell
322 buffers.
322 buffers.
323 .br
323 .br
324 .sp 1
324 .sp 1
325 Note that emacs 'eterm' buffers (opened with M-x term) support
325 Note that emacs 'eterm' buffers (opened with M-x term) support
326 IPython's readline and syntax coloring fine, only 'emacs' (M-x shell
326 IPython's readline and syntax coloring fine, only 'emacs' (M-x shell
327 and C-c !) buffers do not.
327 and C-c !) buffers do not.
328 .TP
328 .TP
329 .B \-screen_length|sl <n>
329 .B \-screen_length|sl <n>
330 Number of lines of your screen. This is used to control printing of
330 Number of lines of your screen. This is used to control printing of
331 very long strings. Strings longer than this number of lines will be
331 very long strings. Strings longer than this number of lines will be
332 sent through a pager instead of directly printed.
332 sent through a pager instead of directly printed.
333 .br
333 .br
334 .sp 1
334 .sp 1
335 The default value for this is 0, which means IPython will auto-detect
335 The default value for this is 0, which means IPython will auto-detect
336 your screen size every time it needs to print certain potentially long
336 your screen size every time it needs to print certain potentially long
337 strings (this doesn't change the behavior of the 'print' keyword, it's
337 strings (this doesn't change the behavior of the 'print' keyword, it's
338 only triggered internally). If for some reason this isn't working well
338 only triggered internally). If for some reason this isn't working well
339 (it needs curses support), specify it yourself. Otherwise don't change
339 (it needs curses support), specify it yourself. Otherwise don't change
340 the default.
340 the default.
341 .TP
341 .TP
342 .B \-separate_in|si <string>
342 .B \-separate_in|si <string>
343 Separator before input prompts. Default '\n'.
343 Separator before input prompts. Default '\n'.
344 .TP
344 .TP
345 .B \-separate_out|so <string>
345 .B \-separate_out|so <string>
346 Separator before output prompts. Default: 0 (nothing).
346 Separator before output prompts. Default: 0 (nothing).
347 .TP
347 .TP
348 .B \-separate_out2|so2 <string>
348 .B \-separate_out2|so2 <string>
349 Separator after output prompts. Default: 0 (nothing).
349 Separator after output prompts. Default: 0 (nothing).
350 .TP
350 .TP
351 .B \-nosep
351 .B \-nosep
352 Shorthand for '\-separate_in 0 \-separate_out 0 \-separate_out2 0'.
352 Shorthand for '\-separate_in 0 \-separate_out 0 \-separate_out2 0'.
353 Simply removes all input/output separators.
353 Simply removes all input/output separators.
354 .TP
354 .TP
355 .B \-upgrade
355 .B \-upgrade
356 Allows you to upgrade your IPYTHONDIR configuration when you install a
356 Allows you to upgrade your IPYTHONDIR configuration when you install a
357 new version of IPython. Since new versions may include new command
357 new version of IPython. Since new versions may include new command
358 lines options or example files, this copies updated ipythonrc-type
358 lines options or example files, this copies updated ipythonrc-type
359 files. However, it backs up (with a .old extension) all files which
359 files. However, it backs up (with a .old extension) all files which
360 it overwrites so that you can merge back any custimizations you might
360 it overwrites so that you can merge back any custimizations you might
361 have in your personal files.
361 have in your personal files.
362 .TP
362 .TP
363 .B \-Version
363 .B \-Version
364 Print version information and exit.
364 Print version information and exit.
365 .TP
365 .TP
366 .B -wxversion <string>
366 .B -wxversion <string>
367 Select a specific version of wxPython (used in conjunction with
367 Select a specific version of wxPython (used in conjunction with
368 \-wthread). Requires the wxversion module, part of recent wxPython
368 \-wthread). Requires the wxversion module, part of recent wxPython
369 distributions.
369 distributions.
370 .TP
370 .TP
371 .B \-xmode <modename>
371 .B \-xmode <modename>
372 Mode for exception reporting. The valid modes are Plain, Context, and
372 Mode for exception reporting. The valid modes are Plain, Context, and
373 Verbose.
373 Verbose.
374 .br
374 .br
375 .sp 1
375 .sp 1
376 \- Plain: similar to python's normal traceback printing.
376 \- Plain: similar to python's normal traceback printing.
377 .br
377 .br
378 .sp 1
378 .sp 1
379 \- Context: prints 5 lines of context source code around each line in the
379 \- Context: prints 5 lines of context source code around each line in the
380 traceback.
380 traceback.
381 .br
381 .br
382 .sp 1
382 .sp 1
383 \- Verbose: similar to Context, but additionally prints the variables
383 \- Verbose: similar to Context, but additionally prints the variables
384 currently visible where the exception happened (shortening their strings if
384 currently visible where the exception happened (shortening their strings if
385 too long). This can potentially be very slow, if you happen to have a huge
385 too long). This can potentially be very slow, if you happen to have a huge
386 data structure whose string representation is complex to compute. Your
386 data structure whose string representation is complex to compute. Your
387 computer may appear to freeze for a while with cpu usage at 100%. If this
387 computer may appear to freeze for a while with cpu usage at 100%. If this
388 occurs, you can cancel the traceback with Ctrl-C (maybe hitting it more than
388 occurs, you can cancel the traceback with Ctrl-C (maybe hitting it more than
389 once).
389 once).
390 .
390 .
391 .SH EMBEDDING
391 .SH EMBEDDING
392 It is possible to start an IPython instance inside your own Python
392 It is possible to start an IPython instance inside your own Python
393 programs. In the documentation example files there are some
393 programs. In the documentation example files there are some
394 illustrations on how to do this.
394 illustrations on how to do this.
395 .br
395 .br
396 .sp 1
396 .sp 1
397 This feature allows you to evalutate dynamically the state of your
397 This feature allows you to evalutate dynamically the state of your
398 code, operate with your variables, analyze them, etc. Note however
398 code, operate with your variables, analyze them, etc. Note however
399 that any changes you make to values while in the shell do NOT
399 that any changes you make to values while in the shell do NOT
400 propagate back to the running code, so it is safe to modify your
400 propagate back to the running code, so it is safe to modify your
401 values because you won't break your code in bizarre ways by doing so.
401 values because you won't break your code in bizarre ways by doing so.
402 .SH AUTHOR
402 .SH AUTHOR
403 IPython was written by Fernando Perez <fperez@colorado.edu>, based on earlier
403 IPython was written by Fernando Perez <fperez@colorado.edu>, based on earlier
404 code by Janko Hauser <jh@comunit.de> and Nathaniel Gray
404 code by Janko Hauser <jh@comunit.de> and Nathaniel Gray
405 <n8gray@caltech.edu>. This manual page was written by Jack Moffitt
405 <n8gray@caltech.edu>. This manual page was written by Jack Moffitt
406 <jack@xiph.org>, for the Debian project (but may be used by others).
406 <jack@xiph.org>, for the Debian project (but may be used by others).
@@ -1,9515 +1,9524 b''
1 #LyX 1.3 created this file. For more info see http://www.lyx.org/
1 #LyX 1.3 created this file. For more info see http://www.lyx.org/
2 \lyxformat 221
2 \lyxformat 221
3 \textclass article
3 \textclass article
4 \begin_preamble
4 \begin_preamble
5 %\usepackage{ae,aecompl}
5 %\usepackage{ae,aecompl}
6 \usepackage{color}
6 \usepackage{color}
7
7
8 % A few colors to replace the defaults for certain link types
8 % A few colors to replace the defaults for certain link types
9 \definecolor{orange}{cmyk}{0,0.4,0.8,0.2}
9 \definecolor{orange}{cmyk}{0,0.4,0.8,0.2}
10 \definecolor{darkorange}{rgb}{.71,0.21,0.01}
10 \definecolor{darkorange}{rgb}{.71,0.21,0.01}
11 \definecolor{darkred}{rgb}{.52,0.08,0.01}
11 \definecolor{darkred}{rgb}{.52,0.08,0.01}
12 \definecolor{darkgreen}{rgb}{.12,.54,.11}
12 \definecolor{darkgreen}{rgb}{.12,.54,.11}
13
13
14 % Use and configure listings package for nicely formatted code
14 % Use and configure listings package for nicely formatted code
15 \usepackage{listings}
15 \usepackage{listings}
16 \lstset{
16 \lstset{
17 language=Python,
17 language=Python,
18 basicstyle=\small\ttfamily,
18 basicstyle=\small\ttfamily,
19 commentstyle=\ttfamily\color{blue},
19 commentstyle=\ttfamily\color{blue},
20 stringstyle=\ttfamily\color{darkorange},
20 stringstyle=\ttfamily\color{darkorange},
21 showstringspaces=false,
21 showstringspaces=false,
22 breaklines=true,
22 breaklines=true,
23 postbreak = \space\dots
23 postbreak = \space\dots
24 }
24 }
25
25
26 \usepackage[%pdftex, % needed for pdflatex
26 \usepackage[%pdftex, % needed for pdflatex
27 breaklinks=true, % so long urls are correctly broken across lines
27 breaklinks=true, % so long urls are correctly broken across lines
28 colorlinks=true,
28 colorlinks=true,
29 urlcolor=blue,
29 urlcolor=blue,
30 linkcolor=darkred,
30 linkcolor=darkred,
31 citecolor=darkgreen,
31 citecolor=darkgreen,
32 ]{hyperref}
32 ]{hyperref}
33
33
34 \usepackage{html}
34 \usepackage{html}
35
35
36 % This helps prevent overly long lines that stretch beyond the margins
36 % This helps prevent overly long lines that stretch beyond the margins
37 \sloppy
37 \sloppy
38
38
39 % Define a \codelist command which either uses listings for latex, or
39 % Define a \codelist command which either uses listings for latex, or
40 % plain verbatim for html (since latex2html doesn't understand the
40 % plain verbatim for html (since latex2html doesn't understand the
41 % listings package).
41 % listings package).
42 \usepackage{verbatim}
42 \usepackage{verbatim}
43 \newcommand{\codelist}[1] {
43 \newcommand{\codelist}[1] {
44 \latex{\lstinputlisting{#1}}
44 \latex{\lstinputlisting{#1}}
45 \html{\verbatiminput{#1}}
45 \html{\verbatiminput{#1}}
46 }
46 }
47 \end_preamble
47 \end_preamble
48 \language english
48 \language english
49 \inputencoding latin1
49 \inputencoding latin1
50 \fontscheme palatino
50 \fontscheme palatino
51 \graphics default
51 \graphics default
52 \paperfontsize 11
52 \paperfontsize 11
53 \spacing single
53 \spacing single
54 \papersize Default
54 \papersize Default
55 \paperpackage a4
55 \paperpackage a4
56 \use_geometry 1
56 \use_geometry 1
57 \use_amsmath 0
57 \use_amsmath 0
58 \use_natbib 0
58 \use_natbib 0
59 \use_numerical_citations 0
59 \use_numerical_citations 0
60 \paperorientation portrait
60 \paperorientation portrait
61 \leftmargin 1in
61 \leftmargin 1in
62 \topmargin 1in
62 \topmargin 1in
63 \rightmargin 1in
63 \rightmargin 1in
64 \bottommargin 1in
64 \bottommargin 1in
65 \secnumdepth 3
65 \secnumdepth 3
66 \tocdepth 3
66 \tocdepth 3
67 \paragraph_separation skip
67 \paragraph_separation skip
68 \defskip medskip
68 \defskip medskip
69 \quotes_language english
69 \quotes_language english
70 \quotes_times 2
70 \quotes_times 2
71 \papercolumns 1
71 \papercolumns 1
72 \papersides 2
72 \papersides 2
73 \paperpagestyle fancy
73 \paperpagestyle fancy
74
74
75 \layout Title
75 \layout Title
76
76
77 IPython
77 IPython
78 \newline
78 \newline
79
79
80 \size larger
80 \size larger
81 An enhanced Interactive Python
81 An enhanced Interactive Python
82 \size large
82 \size large
83
83
84 \newline
84 \newline
85 User Manual, v.
85 User Manual, v.
86 __version__
86 __version__
87 \layout Author
87 \layout Author
88
88
89 Fernando PοΏ½rez
89 Fernando PοΏ½rez
90 \begin_inset Foot
90 \begin_inset Foot
91 collapsed true
91 collapsed true
92
92
93 \layout Standard
93 \layout Standard
94
94
95
95
96 \size scriptsize
96 \size scriptsize
97 Department of Applied Mathematics, University of Colorado at Boulder.
97 Department of Applied Mathematics, University of Colorado at Boulder.
98
98
99 \family typewriter
99 \family typewriter
100 <Fernando.Perez@colorado.edu>
100 <Fernando.Perez@colorado.edu>
101 \end_inset
101 \end_inset
102
102
103
103
104 \layout Standard
104 \layout Standard
105
105
106
106
107 \begin_inset ERT
107 \begin_inset ERT
108 status Collapsed
108 status Collapsed
109
109
110 \layout Standard
110 \layout Standard
111
111
112 \backslash
112 \backslash
113 latex{
113 latex{
114 \end_inset
114 \end_inset
115
115
116
116
117 \begin_inset LatexCommand \tableofcontents{}
117 \begin_inset LatexCommand \tableofcontents{}
118
118
119 \end_inset
119 \end_inset
120
120
121
121
122 \begin_inset ERT
122 \begin_inset ERT
123 status Collapsed
123 status Collapsed
124
124
125 \layout Standard
125 \layout Standard
126 }
126 }
127 \end_inset
127 \end_inset
128
128
129
129
130 \layout Standard
130 \layout Standard
131
131
132
132
133 \begin_inset ERT
133 \begin_inset ERT
134 status Open
134 status Open
135
135
136 \layout Standard
136 \layout Standard
137
137
138 \backslash
138 \backslash
139 html{
139 html{
140 \backslash
140 \backslash
141 bodytext{bgcolor=#ffffff}}
141 bodytext{bgcolor=#ffffff}}
142 \end_inset
142 \end_inset
143
143
144
144
145 \layout Section
145 \layout Section
146 \pagebreak_top
146 \pagebreak_top
147 Overview
147 Overview
148 \layout Standard
148 \layout Standard
149
149
150 One of Python's most useful features is its interactive interpreter.
150 One of Python's most useful features is its interactive interpreter.
151 This system allows very fast testing of ideas without the overhead of creating
151 This system allows very fast testing of ideas without the overhead of creating
152 test files as is typical in most programming languages.
152 test files as is typical in most programming languages.
153 However, the interpreter supplied with the standard Python distribution
153 However, the interpreter supplied with the standard Python distribution
154 is somewhat limited for extended interactive use.
154 is somewhat limited for extended interactive use.
155 \layout Standard
155 \layout Standard
156
156
157 IPython is a free software project (released under the BSD license) which
157 IPython is a free software project (released under the BSD license) which
158 tries to:
158 tries to:
159 \layout Enumerate
159 \layout Enumerate
160
160
161 Provide an interactive shell superior to Python's default.
161 Provide an interactive shell superior to Python's default.
162 IPython has many features for object introspection, system shell access,
162 IPython has many features for object introspection, system shell access,
163 and its own special command system for adding functionality when working
163 and its own special command system for adding functionality when working
164 interactively.
164 interactively.
165 It tries to be a very efficient environment both for Python code development
165 It tries to be a very efficient environment both for Python code development
166 and for exploration of problems using Python objects (in situations like
166 and for exploration of problems using Python objects (in situations like
167 data analysis).
167 data analysis).
168 \layout Enumerate
168 \layout Enumerate
169
169
170 Serve as an embeddable, ready to use interpreter for your own programs.
170 Serve as an embeddable, ready to use interpreter for your own programs.
171 IPython can be started with a single call from inside another program,
171 IPython can be started with a single call from inside another program,
172 providing access to the current namespace.
172 providing access to the current namespace.
173 This can be very useful both for debugging purposes and for situations
173 This can be very useful both for debugging purposes and for situations
174 where a blend of batch-processing and interactive exploration are needed.
174 where a blend of batch-processing and interactive exploration are needed.
175 \layout Enumerate
175 \layout Enumerate
176
176
177 Offer a flexible framework which can be used as the base environment for
177 Offer a flexible framework which can be used as the base environment for
178 other systems with Python as the underlying language.
178 other systems with Python as the underlying language.
179 Specifically scientific environments like Mathematica, IDL and Matlab inspired
179 Specifically scientific environments like Mathematica, IDL and Matlab inspired
180 its design, but similar ideas can be useful in many fields.
180 its design, but similar ideas can be useful in many fields.
181 \layout Enumerate
181 \layout Enumerate
182
182
183 Allow interactive testing of threaded graphical toolkits.
183 Allow interactive testing of threaded graphical toolkits.
184 IPython has support for interactive, non-blocking control of GTK, Qt and
184 IPython has support for interactive, non-blocking control of GTK, Qt and
185 WX applications via special threading flags.
185 WX applications via special threading flags.
186 The normal Python shell can only do this for Tkinter applications.
186 The normal Python shell can only do this for Tkinter applications.
187 \layout Subsection
187 \layout Subsection
188
188
189 Main features
189 Main features
190 \layout Itemize
190 \layout Itemize
191
191
192 Dynamic object introspection.
192 Dynamic object introspection.
193 One can access docstrings, function definition prototypes, source code,
193 One can access docstrings, function definition prototypes, source code,
194 source files and other details of any object accessible to the interpreter
194 source files and other details of any object accessible to the interpreter
195 with a single keystroke (`
195 with a single keystroke (`
196 \family typewriter
196 \family typewriter
197 ?
197 ?
198 \family default
198 \family default
199 ', and using `
199 ', and using `
200 \family typewriter
200 \family typewriter
201 ??
201 ??
202 \family default
202 \family default
203 ' provides additional detail).
203 ' provides additional detail).
204 \layout Itemize
204 \layout Itemize
205
205
206 Searching through modules and namespaces with `
206 Searching through modules and namespaces with `
207 \family typewriter
207 \family typewriter
208 *
208 *
209 \family default
209 \family default
210 ' wildcards, both when using the `
210 ' wildcards, both when using the `
211 \family typewriter
211 \family typewriter
212 ?
212 ?
213 \family default
213 \family default
214 ' system and via the
214 ' system and via the
215 \family typewriter
215 \family typewriter
216 %psearch
216 %psearch
217 \family default
217 \family default
218 command.
218 command.
219 \layout Itemize
219 \layout Itemize
220
220
221 Completion in the local namespace, by typing TAB at the prompt.
221 Completion in the local namespace, by typing TAB at the prompt.
222 This works for keywords, methods, variables and files in the current directory.
222 This works for keywords, methods, variables and files in the current directory.
223 This is supported via the readline library, and full access to configuring
223 This is supported via the readline library, and full access to configuring
224 readline's behavior is provided.
224 readline's behavior is provided.
225 \layout Itemize
225 \layout Itemize
226
226
227 Numbered input/output prompts with command history (persistent across sessions
227 Numbered input/output prompts with command history (persistent across sessions
228 and tied to each profile), full searching in this history and caching of
228 and tied to each profile), full searching in this history and caching of
229 all input and output.
229 all input and output.
230 \layout Itemize
230 \layout Itemize
231
231
232 User-extensible `magic' commands.
232 User-extensible `magic' commands.
233 A set of commands prefixed with
233 A set of commands prefixed with
234 \family typewriter
234 \family typewriter
235 %
235 %
236 \family default
236 \family default
237 is available for controlling IPython itself and provides directory control,
237 is available for controlling IPython itself and provides directory control,
238 namespace information and many aliases to common system shell commands.
238 namespace information and many aliases to common system shell commands.
239 \layout Itemize
239 \layout Itemize
240
240
241 Alias facility for defining your own system aliases.
241 Alias facility for defining your own system aliases.
242 \layout Itemize
242 \layout Itemize
243
243
244 Complete system shell access.
244 Complete system shell access.
245 Lines starting with ! are passed directly to the system shell, and using
245 Lines starting with ! are passed directly to the system shell, and using
246 !! captures shell output into python variables for further use.
246 !! captures shell output into python variables for further use.
247 \layout Itemize
247 \layout Itemize
248
248
249 Background execution of Python commands in a separate thread.
249 Background execution of Python commands in a separate thread.
250 IPython has an internal job manager called
250 IPython has an internal job manager called
251 \family typewriter
251 \family typewriter
252 jobs
252 jobs
253 \family default
253 \family default
254 , and a conveninence backgrounding magic function called
254 , and a conveninence backgrounding magic function called
255 \family typewriter
255 \family typewriter
256 %bg
256 %bg
257 \family default
257 \family default
258 .
258 .
259 \layout Itemize
259 \layout Itemize
260
260
261 The ability to expand python variables when calling the system shell.
261 The ability to expand python variables when calling the system shell.
262 In a shell command, any python variable prefixed with
262 In a shell command, any python variable prefixed with
263 \family typewriter
263 \family typewriter
264 $
264 $
265 \family default
265 \family default
266 is expanded.
266 is expanded.
267 A double
267 A double
268 \family typewriter
268 \family typewriter
269 $$
269 $$
270 \family default
270 \family default
271 allows passing a literal
271 allows passing a literal
272 \family typewriter
272 \family typewriter
273 $
273 $
274 \family default
274 \family default
275 to the shell (for access to shell and environment variables like
275 to the shell (for access to shell and environment variables like
276 \family typewriter
276 \family typewriter
277 $PATH
277 $PATH
278 \family default
278 \family default
279 ).
279 ).
280 \layout Itemize
280 \layout Itemize
281
281
282 Filesystem navigation, via a magic
282 Filesystem navigation, via a magic
283 \family typewriter
283 \family typewriter
284 %cd
284 %cd
285 \family default
285 \family default
286 command, along with a persistent bookmark system (using
286 command, along with a persistent bookmark system (using
287 \family typewriter
287 \family typewriter
288 %bookmark
288 %bookmark
289 \family default
289 \family default
290 ) for fast access to frequently visited directories.
290 ) for fast access to frequently visited directories.
291 \layout Itemize
291 \layout Itemize
292
292
293 A lightweight persistence framework via the
293 A lightweight persistence framework via the
294 \family typewriter
294 \family typewriter
295 %store
295 %store
296 \family default
296 \family default
297 command, which allows you to save arbitrary Python variables.
297 command, which allows you to save arbitrary Python variables.
298 These get restored automatically when your session restarts.
298 These get restored automatically when your session restarts.
299 \layout Itemize
299 \layout Itemize
300
300
301 Automatic indentation (optional) of code as you type (through the readline
301 Automatic indentation (optional) of code as you type (through the readline
302 library).
302 library).
303 \layout Itemize
303 \layout Itemize
304
304
305 Macro system for quickly re-executing multiple lines of previous input with
305 Macro system for quickly re-executing multiple lines of previous input with
306 a single name.
306 a single name.
307 Macros can be stored persistently via
307 Macros can be stored persistently via
308 \family typewriter
308 \family typewriter
309 %store
309 %store
310 \family default
310 \family default
311 and edited via
311 and edited via
312 \family typewriter
312 \family typewriter
313 %edit
313 %edit
314 \family default
314 \family default
315 .
315 .
316
316
317 \layout Itemize
317 \layout Itemize
318
318
319 Session logging (you can then later use these logs as code in your programs).
319 Session logging (you can then later use these logs as code in your programs).
320 Logs can optionally timestamp all input, and also store session output
320 Logs can optionally timestamp all input, and also store session output
321 (marked as comments, so the log remains valid Python source code).
321 (marked as comments, so the log remains valid Python source code).
322 \layout Itemize
322 \layout Itemize
323
323
324 Session restoring: logs can be replayed to restore a previous session to
324 Session restoring: logs can be replayed to restore a previous session to
325 the state where you left it.
325 the state where you left it.
326 \layout Itemize
326 \layout Itemize
327
327
328 Verbose and colored exception traceback printouts.
328 Verbose and colored exception traceback printouts.
329 Easier to parse visually, and in verbose mode they produce a lot of useful
329 Easier to parse visually, and in verbose mode they produce a lot of useful
330 debugging information (basically a terminal version of the cgitb module).
330 debugging information (basically a terminal version of the cgitb module).
331 \layout Itemize
331 \layout Itemize
332
332
333 Auto-parentheses: callable objects can be executed without parentheses:
333 Auto-parentheses: callable objects can be executed without parentheses:
334
334
335 \family typewriter
335 \family typewriter
336 `sin 3'
336 `sin 3'
337 \family default
337 \family default
338 is automatically converted to
338 is automatically converted to
339 \family typewriter
339 \family typewriter
340 `sin(3)
340 `sin(3)
341 \family default
341 \family default
342 '.
342 '.
343 \layout Itemize
343 \layout Itemize
344
344
345 Auto-quoting: using `
345 Auto-quoting: using `
346 \family typewriter
346 \family typewriter
347 ,
347 ,
348 \family default
348 \family default
349 ' or `
349 ' or `
350 \family typewriter
350 \family typewriter
351 ;
351 ;
352 \family default
352 \family default
353 ' as the first character forces auto-quoting of the rest of the line:
353 ' as the first character forces auto-quoting of the rest of the line:
354 \family typewriter
354 \family typewriter
355 `,my_function a\SpecialChar ~
355 `,my_function a\SpecialChar ~
356 b'
356 b'
357 \family default
357 \family default
358 becomes automatically
358 becomes automatically
359 \family typewriter
359 \family typewriter
360 `my_function("a","b")'
360 `my_function("a","b")'
361 \family default
361 \family default
362 , while
362 , while
363 \family typewriter
363 \family typewriter
364 `;my_function a\SpecialChar ~
364 `;my_function a\SpecialChar ~
365 b'
365 b'
366 \family default
366 \family default
367 becomes
367 becomes
368 \family typewriter
368 \family typewriter
369 `my_function("a b")'
369 `my_function("a b")'
370 \family default
370 \family default
371 .
371 .
372 \layout Itemize
372 \layout Itemize
373
373
374 Extensible input syntax.
374 Extensible input syntax.
375 You can define filters that pre-process user input to simplify input in
375 You can define filters that pre-process user input to simplify input in
376 special situations.
376 special situations.
377 This allows for example pasting multi-line code fragments which start with
377 This allows for example pasting multi-line code fragments which start with
378
378
379 \family typewriter
379 \family typewriter
380 `>>>'
380 `>>>'
381 \family default
381 \family default
382 or
382 or
383 \family typewriter
383 \family typewriter
384 `...'
384 `...'
385 \family default
385 \family default
386 such as those from other python sessions or the standard Python documentation.
386 such as those from other python sessions or the standard Python documentation.
387 \layout Itemize
387 \layout Itemize
388
388
389 Flexible configuration system.
389 Flexible configuration system.
390 It uses a configuration file which allows permanent setting of all command-line
390 It uses a configuration file which allows permanent setting of all command-line
391 options, module loading, code and file execution.
391 options, module loading, code and file execution.
392 The system allows recursive file inclusion, so you can have a base file
392 The system allows recursive file inclusion, so you can have a base file
393 with defaults and layers which load other customizations for particular
393 with defaults and layers which load other customizations for particular
394 projects.
394 projects.
395 \layout Itemize
395 \layout Itemize
396
396
397 Embeddable.
397 Embeddable.
398 You can call IPython as a python shell inside your own python programs.
398 You can call IPython as a python shell inside your own python programs.
399 This can be used both for debugging code or for providing interactive abilities
399 This can be used both for debugging code or for providing interactive abilities
400 to your programs with knowledge about the local namespaces (very useful
400 to your programs with knowledge about the local namespaces (very useful
401 in debugging and data analysis situations).
401 in debugging and data analysis situations).
402 \layout Itemize
402 \layout Itemize
403
403
404 Easy debugger access.
404 Easy debugger access.
405 You can set IPython to call up an enhanced version of the Python debugger
405 You can set IPython to call up an enhanced version of the Python debugger
406 (
406 (
407 \family typewriter
407 \family typewriter
408 pdb
408 pdb
409 \family default
409 \family default
410 ) every time there is an uncaught exception.
410 ) every time there is an uncaught exception.
411 This drops you inside the code which triggered the exception with all the
411 This drops you inside the code which triggered the exception with all the
412 data live and it is possible to navigate the stack to rapidly isolate the
412 data live and it is possible to navigate the stack to rapidly isolate the
413 source of a bug.
413 source of a bug.
414 The
414 The
415 \family typewriter
415 \family typewriter
416 %run
416 %run
417 \family default
417 \family default
418 magic command --with the
418 magic command --with the
419 \family typewriter
419 \family typewriter
420 -d
420 -d
421 \family default
421 \family default
422 option-- can run any script under
422 option-- can run any script under
423 \family typewriter
423 \family typewriter
424 pdb
424 pdb
425 \family default
425 \family default
426 's control, automatically setting initial breakpoints for you.
426 's control, automatically setting initial breakpoints for you.
427 This version of
427 This version of
428 \family typewriter
428 \family typewriter
429 pdb
429 pdb
430 \family default
430 \family default
431 has IPython-specific improvements, including tab-completion and traceback
431 has IPython-specific improvements, including tab-completion and traceback
432 coloring support.
432 coloring support.
433 \layout Itemize
433 \layout Itemize
434
434
435 Profiler support.
435 Profiler support.
436 You can run single statements (similar to
436 You can run single statements (similar to
437 \family typewriter
437 \family typewriter
438 profile.run()
438 profile.run()
439 \family default
439 \family default
440 ) or complete programs under the profiler's control.
440 ) or complete programs under the profiler's control.
441 While this is possible with the standard
441 While this is possible with the standard
442 \family typewriter
442 \family typewriter
443 profile
443 profile
444 \family default
444 \family default
445 module, IPython wraps this functionality with magic commands (see
445 module, IPython wraps this functionality with magic commands (see
446 \family typewriter
446 \family typewriter
447 `%prun'
447 `%prun'
448 \family default
448 \family default
449 and
449 and
450 \family typewriter
450 \family typewriter
451 `%run -p
451 `%run -p
452 \family default
452 \family default
453 ') convenient for rapid interactive work.
453 ') convenient for rapid interactive work.
454 \layout Subsection
454 \layout Subsection
455
455
456 Portability and Python requirements
456 Portability and Python requirements
457 \layout Standard
457 \layout Standard
458
458
459
459
460 \series bold
460 \series bold
461 Python requirements:
461 Python requirements:
462 \series default
462 \series default
463 IPython requires with Python version 2.3 or newer.
463 IPython requires with Python version 2.3 or newer.
464 If you are still using Python 2.2 and can not upgrade, the last version
464 If you are still using Python 2.2 and can not upgrade, the last version
465 of IPython which worked with Python 2.2 was 0.6.15, so you will have to use
465 of IPython which worked with Python 2.2 was 0.6.15, so you will have to use
466 that.
466 that.
467 \layout Standard
467 \layout Standard
468
468
469 IPython is developed under
469 IPython is developed under
470 \series bold
470 \series bold
471 Linux
471 Linux
472 \series default
472 \series default
473 , but it should work in any reasonable Unix-type system (tested OK under
473 , but it should work in any reasonable Unix-type system (tested OK under
474 Solaris and the *BSD family, for which a port exists thanks to Dryice Liu).
474 Solaris and the *BSD family, for which a port exists thanks to Dryice Liu).
475 \layout Standard
475 \layout Standard
476
476
477
477
478 \series bold
478 \series bold
479 Mac OS X
479 Mac OS X
480 \series default
480 \series default
481 : it works, apparently without any problems (thanks to Jim Boyle at Lawrence
481 : it works, apparently without any problems (thanks to Jim Boyle at Lawrence
482 Livermore for the information).
482 Livermore for the information).
483 Thanks to Andrea Riciputi, Fink support is available.
483 Thanks to Andrea Riciputi, Fink support is available.
484 \layout Standard
484 \layout Standard
485
485
486
486
487 \series bold
487 \series bold
488 CygWin
488 CygWin
489 \series default
489 \series default
490 : it works mostly OK, though some users have reported problems with prompt
490 : it works mostly OK, though some users have reported problems with prompt
491 coloring.
491 coloring.
492 No satisfactory solution to this has been found so far, you may want to
492 No satisfactory solution to this has been found so far, you may want to
493 disable colors permanently in the
493 disable colors permanently in the
494 \family typewriter
494 \family typewriter
495 ipythonrc
495 ipythonrc
496 \family default
496 \family default
497 configuration file if you experience problems.
497 configuration file if you experience problems.
498 If you have proper color support under cygwin, please post to the IPython
498 If you have proper color support under cygwin, please post to the IPython
499 mailing list so this issue can be resolved for all users.
499 mailing list so this issue can be resolved for all users.
500 \layout Standard
500 \layout Standard
501
501
502
502
503 \series bold
503 \series bold
504 Windows
504 Windows
505 \series default
505 \series default
506 : it works well under Windows XP/2k, and I suspect NT should behave similarly.
506 : it works well under Windows XP/2k, and I suspect NT should behave similarly.
507 Section\SpecialChar ~
507 Section\SpecialChar ~
508
508
509 \begin_inset LatexCommand \ref{sub:Under-Windows}
509 \begin_inset LatexCommand \ref{sub:Under-Windows}
510
510
511 \end_inset
511 \end_inset
512
512
513 describes installation details for Windows, including some additional tools
513 describes installation details for Windows, including some additional tools
514 needed on this platform.
514 needed on this platform.
515 \layout Standard
515 \layout Standard
516
516
517 Windows 9x support is present, and has been reported to work fine (at least
517 Windows 9x support is present, and has been reported to work fine (at least
518 on WinME).
518 on WinME).
519 \layout Standard
519 \layout Standard
520
520
521 Note, that I have very little access to and experience with Windows development.
521 Note, that I have very little access to and experience with Windows development.
522 However, an excellent group of Win32 users (led by Ville Vainio), consistenly
522 However, an excellent group of Win32 users (led by Ville Vainio), consistenly
523 contribute bugfixes and platform-specific enhancements, so they more than
523 contribute bugfixes and platform-specific enhancements, so they more than
524 make up for my deficiencies on that front.
524 make up for my deficiencies on that front.
525 In fact, Win32 users report using IPython as a system shell (see Sec.\SpecialChar ~
525 In fact, Win32 users report using IPython as a system shell (see Sec.\SpecialChar ~
526
526
527 \begin_inset LatexCommand \ref{sec:IPython-as-shell}
527 \begin_inset LatexCommand \ref{sec:IPython-as-shell}
528
528
529 \end_inset
529 \end_inset
530
530
531 for details), as it offers a level of control and features which the default
531 for details), as it offers a level of control and features which the default
532
532
533 \family typewriter
533 \family typewriter
534 cmd.exe
534 cmd.exe
535 \family default
535 \family default
536 doesn't provide.
536 doesn't provide.
537 \layout Subsection
537 \layout Subsection
538
538
539 Location
539 Location
540 \layout Standard
540 \layout Standard
541
541
542 IPython is generously hosted at
542 IPython is generously hosted at
543 \begin_inset LatexCommand \htmlurl{http://ipython.scipy.org}
543 \begin_inset LatexCommand \htmlurl{http://ipython.scipy.org}
544
544
545 \end_inset
545 \end_inset
546
546
547 by the Enthought, Inc and the SciPy project.
547 by the Enthought, Inc and the SciPy project.
548 This site offers downloads, subversion access, mailing lists and a bug
548 This site offers downloads, subversion access, mailing lists and a bug
549 tracking system.
549 tracking system.
550 I am very grateful to Enthought (
550 I am very grateful to Enthought (
551 \begin_inset LatexCommand \htmlurl{http://www.enthought.com}
551 \begin_inset LatexCommand \htmlurl{http://www.enthought.com}
552
552
553 \end_inset
553 \end_inset
554
554
555 ) and all of the SciPy team for their contribution.
555 ) and all of the SciPy team for their contribution.
556 \layout Section
556 \layout Section
557
557
558
558
559 \begin_inset LatexCommand \label{sec:install}
559 \begin_inset LatexCommand \label{sec:install}
560
560
561 \end_inset
561 \end_inset
562
562
563 Installation
563 Installation
564 \layout Subsection
564 \layout Subsection
565
565
566 Instant instructions
566 Instant instructions
567 \layout Standard
567 \layout Standard
568
568
569 If you are of the impatient kind, under Linux/Unix simply untar/unzip the
569 If you are of the impatient kind, under Linux/Unix simply untar/unzip the
570 download, then install with
570 download, then install with
571 \family typewriter
571 \family typewriter
572 `python setup.py install'
572 `python setup.py install'
573 \family default
573 \family default
574 .
574 .
575 Under Windows, double-click on the provided
575 Under Windows, double-click on the provided
576 \family typewriter
576 \family typewriter
577 .exe
577 .exe
578 \family default
578 \family default
579 binary installer.
579 binary installer.
580 \layout Standard
580 \layout Standard
581
581
582 Then, take a look at Sections
582 Then, take a look at Sections
583 \begin_inset LatexCommand \ref{sec:good_config}
583 \begin_inset LatexCommand \ref{sec:good_config}
584
584
585 \end_inset
585 \end_inset
586
586
587 for configuring things optimally and
587 for configuring things optimally and
588 \begin_inset LatexCommand \ref{sec:quick_tips}
588 \begin_inset LatexCommand \ref{sec:quick_tips}
589
589
590 \end_inset
590 \end_inset
591
591
592 for quick tips on efficient use of IPython.
592 for quick tips on efficient use of IPython.
593 You can later refer to the rest of the manual for all the gory details.
593 You can later refer to the rest of the manual for all the gory details.
594 \layout Standard
594 \layout Standard
595
595
596 See the notes in sec.
596 See the notes in sec.
597
597
598 \begin_inset LatexCommand \ref{sec:upgrade}
598 \begin_inset LatexCommand \ref{sec:upgrade}
599
599
600 \end_inset
600 \end_inset
601
601
602 for upgrading IPython versions.
602 for upgrading IPython versions.
603 \layout Subsection
603 \layout Subsection
604
604
605 Detailed Unix instructions (Linux, Mac OS X, etc.)
605 Detailed Unix instructions (Linux, Mac OS X, etc.)
606 \layout Standard
606 \layout Standard
607
607
608 For RPM based systems, simply install the supplied package in the usual
608 For RPM based systems, simply install the supplied package in the usual
609 manner.
609 manner.
610 If you download the tar archive, the process is:
610 If you download the tar archive, the process is:
611 \layout Enumerate
611 \layout Enumerate
612
612
613 Unzip/untar the
613 Unzip/untar the
614 \family typewriter
614 \family typewriter
615 ipython-XXX.tar.gz
615 ipython-XXX.tar.gz
616 \family default
616 \family default
617 file wherever you want (
617 file wherever you want (
618 \family typewriter
618 \family typewriter
619 XXX
619 XXX
620 \family default
620 \family default
621 is the version number).
621 is the version number).
622 It will make a directory called
622 It will make a directory called
623 \family typewriter
623 \family typewriter
624 ipython-XXX.
624 ipython-XXX.
625
625
626 \family default
626 \family default
627 Change into that directory where you will find the files
627 Change into that directory where you will find the files
628 \family typewriter
628 \family typewriter
629 README
629 README
630 \family default
630 \family default
631 and
631 and
632 \family typewriter
632 \family typewriter
633 setup.py
633 setup.py
634 \family default
634 \family default
635 .
635 .
636
636
637 \family typewriter
637 \family typewriter
638 O
638 O
639 \family default
639 \family default
640 nce you've completed the installation, you can safely remove this directory.
640 nce you've completed the installation, you can safely remove this directory.
641
641
642 \layout Enumerate
642 \layout Enumerate
643
643
644 If you are installing over a previous installation of version 0.2.0 or earlier,
644 If you are installing over a previous installation of version 0.2.0 or earlier,
645 first remove your
645 first remove your
646 \family typewriter
646 \family typewriter
647 $HOME/.ipython
647 $HOME/.ipython
648 \family default
648 \family default
649 directory, since the configuration file format has changed somewhat (the
649 directory, since the configuration file format has changed somewhat (the
650 '=' were removed from all option specifications).
650 '=' were removed from all option specifications).
651 Or you can call ipython with the
651 Or you can call ipython with the
652 \family typewriter
652 \family typewriter
653 -upgrade
653 -upgrade
654 \family default
654 \family default
655 option and it will do this automatically for you.
655 option and it will do this automatically for you.
656 \layout Enumerate
656 \layout Enumerate
657
657
658 IPython uses distutils, so you can install it by simply typing at the system
658 IPython uses distutils, so you can install it by simply typing at the system
659 prompt (don't type the
659 prompt (don't type the
660 \family typewriter
660 \family typewriter
661 $
661 $
662 \family default
662 \family default
663 )
663 )
664 \newline
664 \newline
665
665
666 \family typewriter
666 \family typewriter
667 $ python setup.py install
667 $ python setup.py install
668 \family default
668 \family default
669
669
670 \newline
670 \newline
671 Note that this assumes you have root access to your machine.
671 Note that this assumes you have root access to your machine.
672 If you don't have root access or don't want IPython to go in the default
672 If you don't have root access or don't want IPython to go in the default
673 python directories, you'll need to use the
673 python directories, you'll need to use the
674 \begin_inset ERT
674 \begin_inset ERT
675 status Collapsed
675 status Collapsed
676
676
677 \layout Standard
677 \layout Standard
678
678
679 \backslash
679 \backslash
680 verb|--home|
680 verb|--home|
681 \end_inset
681 \end_inset
682
682
683 option (or
683 option (or
684 \begin_inset ERT
684 \begin_inset ERT
685 status Collapsed
685 status Collapsed
686
686
687 \layout Standard
687 \layout Standard
688
688
689 \backslash
689 \backslash
690 verb|--prefix|
690 verb|--prefix|
691 \end_inset
691 \end_inset
692
692
693 ).
693 ).
694 For example:
694 For example:
695 \newline
695 \newline
696
696
697 \begin_inset ERT
697 \begin_inset ERT
698 status Collapsed
698 status Collapsed
699
699
700 \layout Standard
700 \layout Standard
701
701
702 \backslash
702 \backslash
703 verb|$ python setup.py install --home $HOME/local|
703 verb|$ python setup.py install --home $HOME/local|
704 \end_inset
704 \end_inset
705
705
706
706
707 \newline
707 \newline
708 will install IPython into
708 will install IPython into
709 \family typewriter
709 \family typewriter
710 $HOME/local
710 $HOME/local
711 \family default
711 \family default
712 and its subdirectories (creating them if necessary).
712 and its subdirectories (creating them if necessary).
713 \newline
713 \newline
714 You can type
714 You can type
715 \newline
715 \newline
716
716
717 \begin_inset ERT
717 \begin_inset ERT
718 status Collapsed
718 status Collapsed
719
719
720 \layout Standard
720 \layout Standard
721
721
722 \backslash
722 \backslash
723 verb|$ python setup.py --help|
723 verb|$ python setup.py --help|
724 \end_inset
724 \end_inset
725
725
726
726
727 \newline
727 \newline
728 for more details.
728 for more details.
729 \newline
729 \newline
730 Note that if you change the default location for
730 Note that if you change the default location for
731 \begin_inset ERT
731 \begin_inset ERT
732 status Collapsed
732 status Collapsed
733
733
734 \layout Standard
734 \layout Standard
735
735
736 \backslash
736 \backslash
737 verb|--home|
737 verb|--home|
738 \end_inset
738 \end_inset
739
739
740 at installation, IPython may end up installed at a location which is not
740 at installation, IPython may end up installed at a location which is not
741 part of your
741 part of your
742 \family typewriter
742 \family typewriter
743 $PYTHONPATH
743 $PYTHONPATH
744 \family default
744 \family default
745 environment variable.
745 environment variable.
746 In this case, you'll need to configure this variable to include the actual
746 In this case, you'll need to configure this variable to include the actual
747 directory where the
747 directory where the
748 \family typewriter
748 \family typewriter
749 IPython/
749 IPython/
750 \family default
750 \family default
751 directory ended (typically the value you give to
751 directory ended (typically the value you give to
752 \begin_inset ERT
752 \begin_inset ERT
753 status Collapsed
753 status Collapsed
754
754
755 \layout Standard
755 \layout Standard
756
756
757 \backslash
757 \backslash
758 verb|--home|
758 verb|--home|
759 \end_inset
759 \end_inset
760
760
761 plus
761 plus
762 \family typewriter
762 \family typewriter
763 /lib/python
763 /lib/python
764 \family default
764 \family default
765 ).
765 ).
766 \layout Subsubsection
766 \layout Subsubsection
767
767
768 Mac OSX information
768 Mac OSX information
769 \layout Standard
769 \layout Standard
770
770
771 Under OSX, there is a choice you need to make.
771 Under OSX, there is a choice you need to make.
772 Apple ships its own build of Python, which lives in the core OSX filesystem
772 Apple ships its own build of Python, which lives in the core OSX filesystem
773 hierarchy.
773 hierarchy.
774 You can also manually install a separate Python, either purely by hand
774 You can also manually install a separate Python, either purely by hand
775 (typically in
775 (typically in
776 \family typewriter
776 \family typewriter
777 /usr/local
777 /usr/local
778 \family default
778 \family default
779 ) or by using Fink, which puts everything under
779 ) or by using Fink, which puts everything under
780 \family typewriter
780 \family typewriter
781 /sw
781 /sw
782 \family default
782 \family default
783 .
783 .
784 Which route to follow is a matter of personal preference, as I've seen
784 Which route to follow is a matter of personal preference, as I've seen
785 users who favor each of the approaches.
785 users who favor each of the approaches.
786 Here I will simply list the known installation issues under OSX, along
786 Here I will simply list the known installation issues under OSX, along
787 with their solutions.
787 with their solutions.
788 \layout Standard
788 \layout Standard
789
789
790 This page:
790 This page:
791 \begin_inset LatexCommand \htmlurl{http://geosci.uchicago.edu/~tobis/pylab.html}
791 \begin_inset LatexCommand \htmlurl{http://geosci.uchicago.edu/~tobis/pylab.html}
792
792
793 \end_inset
793 \end_inset
794
794
795 contains information on this topic, with additional details on how to make
795 contains information on this topic, with additional details on how to make
796 IPython and matplotlib play nicely under OSX.
796 IPython and matplotlib play nicely under OSX.
797 \layout Subsubsection*
797 \layout Subsubsection*
798
798
799 GUI problems
799 GUI problems
800 \layout Standard
800 \layout Standard
801
801
802 The following instructions apply to an install of IPython under OSX from
802 The following instructions apply to an install of IPython under OSX from
803 unpacking the
803 unpacking the
804 \family typewriter
804 \family typewriter
805 .tar.gz
805 .tar.gz
806 \family default
806 \family default
807 distribution and installing it for the default Python interpreter shipped
807 distribution and installing it for the default Python interpreter shipped
808 by Apple.
808 by Apple.
809 If you are using a fink install, fink will take care of these details for
809 If you are using a fink install, fink will take care of these details for
810 you, by installing IPython against fink's Python.
810 you, by installing IPython against fink's Python.
811 \layout Standard
811 \layout Standard
812
812
813 IPython offers various forms of support for interacting with graphical applicati
813 IPython offers various forms of support for interacting with graphical applicati
814 ons from the command line, from simple Tk apps (which are in principle always
814 ons from the command line, from simple Tk apps (which are in principle always
815 supported by Python) to interactive control of WX, Qt and GTK apps.
815 supported by Python) to interactive control of WX, Qt and GTK apps.
816 Under OSX, however, this requires that ipython is installed by calling
816 Under OSX, however, this requires that ipython is installed by calling
817 the special
817 the special
818 \family typewriter
818 \family typewriter
819 pythonw
819 pythonw
820 \family default
820 \family default
821 script at installation time, which takes care of coordinating things with
821 script at installation time, which takes care of coordinating things with
822 Apple's graphical environment.
822 Apple's graphical environment.
823 \layout Standard
823 \layout Standard
824
824
825 So when installing under OSX, it is best to use the following command:
825 So when installing under OSX, it is best to use the following command:
826 \family typewriter
826 \family typewriter
827
827
828 \newline
828 \newline
829
829
830 \family default
830 \family default
831
831
832 \begin_inset ERT
832 \begin_inset ERT
833 status Collapsed
833 status Collapsed
834
834
835 \layout Standard
835 \layout Standard
836
836
837 \backslash
837 \backslash
838 verb| $ sudo pythonw setup.py install --install-scripts=/usr/local/bin|
838 verb| $ sudo pythonw setup.py install --install-scripts=/usr/local/bin|
839 \end_inset
839 \end_inset
840
840
841
841
842 \newline
842 \newline
843 or
843 or
844 \newline
844 \newline
845
845
846 \begin_inset ERT
846 \begin_inset ERT
847 status Collapsed
847 status Collapsed
848
848
849 \layout Standard
849 \layout Standard
850
850
851 \backslash
851 \backslash
852 verb| $ sudo pythonw setup.py install --install-scripts=/usr/bin|
852 verb| $ sudo pythonw setup.py install --install-scripts=/usr/bin|
853 \end_inset
853 \end_inset
854
854
855
855
856 \newline
856 \newline
857 depending on where you like to keep hand-installed executables.
857 depending on where you like to keep hand-installed executables.
858 \layout Standard
858 \layout Standard
859
859
860 The resulting script will have an appropriate shebang line (the first line
860 The resulting script will have an appropriate shebang line (the first line
861 in the script whic begins with
861 in the script whic begins with
862 \family typewriter
862 \family typewriter
863 #!...
863 #!...
864 \family default
864 \family default
865 ) such that the ipython interpreter can interact with the OS X GUI.
865 ) such that the ipython interpreter can interact with the OS X GUI.
866 If the installed version does not work and has a shebang line that points
866 If the installed version does not work and has a shebang line that points
867 to, for example, just
867 to, for example, just
868 \family typewriter
868 \family typewriter
869 /usr/bin/python
869 /usr/bin/python
870 \family default
870 \family default
871 , then you might have a stale, cached version in your
871 , then you might have a stale, cached version in your
872 \family typewriter
872 \family typewriter
873 build/scripts-<python-version>
873 build/scripts-<python-version>
874 \family default
874 \family default
875 directory.
875 directory.
876 Delete that directory and rerun the
876 Delete that directory and rerun the
877 \family typewriter
877 \family typewriter
878 setup.py
878 setup.py
879 \family default
879 \family default
880 .
880 .
881
881
882 \layout Standard
882 \layout Standard
883
883
884 It is also a good idea to use the special flag
884 It is also a good idea to use the special flag
885 \begin_inset ERT
885 \begin_inset ERT
886 status Collapsed
886 status Collapsed
887
887
888 \layout Standard
888 \layout Standard
889
889
890 \backslash
890 \backslash
891 verb|--install-scripts|
891 verb|--install-scripts|
892 \end_inset
892 \end_inset
893
893
894 as indicated above, to ensure that the ipython scripts end up in a location
894 as indicated above, to ensure that the ipython scripts end up in a location
895 which is part of your
895 which is part of your
896 \family typewriter
896 \family typewriter
897 $PATH
897 $PATH
898 \family default
898 \family default
899 .
899 .
900 Otherwise Apple's Python will put the scripts in an internal directory
900 Otherwise Apple's Python will put the scripts in an internal directory
901 not available by default at the command line (if you use
901 not available by default at the command line (if you use
902 \family typewriter
902 \family typewriter
903 /usr/local/bin
903 /usr/local/bin
904 \family default
904 \family default
905 , you need to make sure this is in your
905 , you need to make sure this is in your
906 \family typewriter
906 \family typewriter
907 $PATH
907 $PATH
908 \family default
908 \family default
909 , which may not be true by default).
909 , which may not be true by default).
910 \layout Subsubsection*
910 \layout Subsubsection*
911
911
912 Readline problems
912 Readline problems
913 \layout Standard
913 \layout Standard
914
914
915 By default, the Python version shipped by Apple does
915 By default, the Python version shipped by Apple does
916 \emph on
916 \emph on
917 not
917 not
918 \emph default
918 \emph default
919 include the readline library, so central to IPython's behavior.
919 include the readline library, so central to IPython's behavior.
920 If you install IPython against Apple's Python, you will not have arrow
920 If you install IPython against Apple's Python, you will not have arrow
921 keys, tab completion, etc.
921 keys, tab completion, etc.
922 For Mac OSX 10.3 (Panther), you can find a prebuilt readline library here:
922 For Mac OSX 10.3 (Panther), you can find a prebuilt readline library here:
923 \newline
923 \newline
924
924
925 \begin_inset LatexCommand \htmlurl{http://pythonmac.org/packages/readline-5.0-py2.3-macosx10.3.zip}
925 \begin_inset LatexCommand \htmlurl{http://pythonmac.org/packages/readline-5.0-py2.3-macosx10.3.zip}
926
926
927 \end_inset
927 \end_inset
928
928
929
929
930 \layout Standard
930 \layout Standard
931
931
932 If you are using OSX 10.4 (Tiger), after installing this package you need
932 If you are using OSX 10.4 (Tiger), after installing this package you need
933 to either:
933 to either:
934 \layout Enumerate
934 \layout Enumerate
935
935
936 move
936 move
937 \family typewriter
937 \family typewriter
938 readline.so
938 readline.so
939 \family default
939 \family default
940 from
940 from
941 \family typewriter
941 \family typewriter
942 /Library/Python/2.3
942 /Library/Python/2.3
943 \family default
943 \family default
944 to
944 to
945 \family typewriter
945 \family typewriter
946 /Library/Python/2.3/site-packages
946 /Library/Python/2.3/site-packages
947 \family default
947 \family default
948 , or
948 , or
949 \layout Enumerate
949 \layout Enumerate
950
950
951 install
951 install
952 \begin_inset LatexCommand \htmlurl{http://pythonmac.org/packages/TigerPython23Compat.pkg.zip}
952 \begin_inset LatexCommand \htmlurl{http://pythonmac.org/packages/TigerPython23Compat.pkg.zip}
953
953
954 \end_inset
954 \end_inset
955
955
956
956
957 \layout Standard
957 \layout Standard
958
958
959 Users installing against Fink's Python or a properly hand-built one should
959 Users installing against Fink's Python or a properly hand-built one should
960 not have this problem.
960 not have this problem.
961 \layout Subsubsection*
961 \layout Subsubsection*
962
962
963 DarwinPorts
963 DarwinPorts
964 \layout Standard
964 \layout Standard
965
965
966 I report here a message from an OSX user, who suggests an alternative means
966 I report here a message from an OSX user, who suggests an alternative means
967 of using IPython under this operating system with good results.
967 of using IPython under this operating system with good results.
968 Please let me know of any updates that may be useful for this section.
968 Please let me know of any updates that may be useful for this section.
969 His message is reproduced verbatim below:
969 His message is reproduced verbatim below:
970 \layout Quote
970 \layout Quote
971
971
972 From: Markus Banfi
972 From: Markus Banfi
973 \family typewriter
973 \family typewriter
974 <markus.banfi-AT-mospheira.net>
974 <markus.banfi-AT-mospheira.net>
975 \layout Quote
975 \layout Quote
976
976
977 As a MacOS X (10.4.2) user I prefer to install software using DawinPorts instead
977 As a MacOS X (10.4.2) user I prefer to install software using DawinPorts instead
978 of Fink.
978 of Fink.
979 I had no problems installing ipython with DarwinPorts.
979 I had no problems installing ipython with DarwinPorts.
980 It's just:
980 It's just:
981 \layout Quote
981 \layout Quote
982
982
983
983
984 \family typewriter
984 \family typewriter
985 sudo port install py-ipython
985 sudo port install py-ipython
986 \layout Quote
986 \layout Quote
987
987
988 It automatically resolved all dependencies (python24, readline, py-readline).
988 It automatically resolved all dependencies (python24, readline, py-readline).
989 So far I did not encounter any problems with the DarwinPorts port of ipython.
989 So far I did not encounter any problems with the DarwinPorts port of ipython.
990
990
991 \layout Subsection
991 \layout Subsection
992
992
993
993
994 \begin_inset LatexCommand \label{sub:Under-Windows}
994 \begin_inset LatexCommand \label{sub:Under-Windows}
995
995
996 \end_inset
996 \end_inset
997
997
998 Windows instructions
998 Windows instructions
999 \layout Standard
999 \layout Standard
1000
1000
1001 Some of IPython's very useful features are:
1001 Some of IPython's very useful features are:
1002 \layout Itemize
1002 \layout Itemize
1003
1003
1004 Integrated readline support (Tab-based file, object and attribute completion,
1004 Integrated readline support (Tab-based file, object and attribute completion,
1005 input history across sessions, editable command line, etc.)
1005 input history across sessions, editable command line, etc.)
1006 \layout Itemize
1006 \layout Itemize
1007
1007
1008 Coloring of prompts, code and tracebacks.
1008 Coloring of prompts, code and tracebacks.
1009 \layout Standard
1009 \layout Standard
1010
1010
1011 These, by default, are only available under Unix-like operating systems.
1011 These, by default, are only available under Unix-like operating systems.
1012 However, thanks to Gary Bishop's work, Windows XP/2k users can also benefit
1012 However, thanks to Gary Bishop's work, Windows XP/2k users can also benefit
1013 from them.
1013 from them.
1014 His readline library implements both GNU readline functionality and color
1014 His readline library implements both GNU readline functionality and color
1015 support, so that IPython under Windows XP/2k can be as friendly and powerful
1015 support, so that IPython under Windows XP/2k can be as friendly and powerful
1016 as under Unix-like environments.
1016 as under Unix-like environments.
1017 \layout Standard
1017 \layout Standard
1018
1018
1019 The
1019 The
1020 \family typewriter
1020 \family typewriter
1021 readline
1021 readline
1022 \family default
1022 \family default
1023 extension needs two other libraries to work, so in all you need:
1023 extension needs two other libraries to work, so in all you need:
1024 \layout Enumerate
1024 \layout Enumerate
1025
1025
1026
1026
1027 \family typewriter
1027 \family typewriter
1028 PyWin32
1028 PyWin32
1029 \family default
1029 \family default
1030 from
1030 from
1031 \begin_inset LatexCommand \htmlurl{http://starship.python.net/crew/mhammond}
1031 \begin_inset LatexCommand \htmlurl{http://starship.python.net/crew/mhammond}
1032
1032
1033 \end_inset
1033 \end_inset
1034
1034
1035 .
1035 .
1036 \layout Enumerate
1036 \layout Enumerate
1037
1037
1038
1038
1039 \family typewriter
1039 \family typewriter
1040 CTypes
1040 CTypes
1041 \family default
1041 \family default
1042 from
1042 from
1043 \begin_inset LatexCommand \htmlurl{http://starship.python.net/crew/theller/ctypes}
1043 \begin_inset LatexCommand \htmlurl{http://starship.python.net/crew/theller/ctypes}
1044
1044
1045 \end_inset
1045 \end_inset
1046
1046
1047 (you
1047 (you
1048 \emph on
1048 \emph on
1049 must
1049 must
1050 \emph default
1050 \emph default
1051 use version 0.9.1 or newer).
1051 use version 0.9.1 or newer).
1052 \layout Enumerate
1052 \layout Enumerate
1053
1053
1054
1054
1055 \family typewriter
1055 \family typewriter
1056 Readline
1056 Readline
1057 \family default
1057 \family default
1058 for Windows from
1058 for Windows from
1059 \begin_inset LatexCommand \htmlurl{http://sourceforge.net/projects/uncpythontools}
1059 \begin_inset LatexCommand \htmlurl{http://sourceforge.net/projects/uncpythontools}
1060
1060
1061 \end_inset
1061 \end_inset
1062
1062
1063 .
1063 .
1064 \layout Standard
1064 \layout Standard
1065
1065
1066
1066
1067 \series bold
1067 \series bold
1068 Warning about a broken readline-like library:
1068 Warning about a broken readline-like library:
1069 \series default
1069 \series default
1070 several users have reported problems stemming from using the pseudo-readline
1070 several users have reported problems stemming from using the pseudo-readline
1071 library at
1071 library at
1072 \begin_inset LatexCommand \htmlurl{http://newcenturycomputers.net/projects/readline.html}
1072 \begin_inset LatexCommand \htmlurl{http://newcenturycomputers.net/projects/readline.html}
1073
1073
1074 \end_inset
1074 \end_inset
1075
1075
1076 .
1076 .
1077 This is a broken library which, while called readline, only implements
1077 This is a broken library which, while called readline, only implements
1078 an incomplete subset of the readline API.
1078 an incomplete subset of the readline API.
1079 Since it is still called readline, it fools IPython's detection mechanisms
1079 Since it is still called readline, it fools IPython's detection mechanisms
1080 and causes unpredictable crashes later.
1080 and causes unpredictable crashes later.
1081 If you wish to use IPython under Windows, you must NOT use this library,
1081 If you wish to use IPython under Windows, you must NOT use this library,
1082 which for all purposes is (at least as of version 1.6) terminally broken.
1082 which for all purposes is (at least as of version 1.6) terminally broken.
1083 \layout Subsubsection
1083 \layout Subsubsection
1084
1084
1085 Installation procedure
1085 Installation procedure
1086 \layout Standard
1086 \layout Standard
1087
1087
1088 Once you have the above installed, from the IPython download directory grab
1088 Once you have the above installed, from the IPython download directory grab
1089 the
1089 the
1090 \family typewriter
1090 \family typewriter
1091 ipython-XXX.win32.exe
1091 ipython-XXX.win32.exe
1092 \family default
1092 \family default
1093 file, where
1093 file, where
1094 \family typewriter
1094 \family typewriter
1095 XXX
1095 XXX
1096 \family default
1096 \family default
1097 represents the version number.
1097 represents the version number.
1098 This is a regular windows executable installer, which you can simply double-cli
1098 This is a regular windows executable installer, which you can simply double-cli
1099 ck to install.
1099 ck to install.
1100 It will add an entry for IPython to your Start Menu, as well as registering
1100 It will add an entry for IPython to your Start Menu, as well as registering
1101 IPython in the Windows list of applications, so you can later uninstall
1101 IPython in the Windows list of applications, so you can later uninstall
1102 it from the Control Panel.
1102 it from the Control Panel.
1103
1103
1104 \layout Standard
1104 \layout Standard
1105
1105
1106 IPython tries to install the configuration information in a directory named
1106 IPython tries to install the configuration information in a directory named
1107
1107
1108 \family typewriter
1108 \family typewriter
1109 .ipython
1109 .ipython
1110 \family default
1110 \family default
1111 (
1111 (
1112 \family typewriter
1112 \family typewriter
1113 _ipython
1113 _ipython
1114 \family default
1114 \family default
1115 under Windows) located in your `home' directory.
1115 under Windows) located in your `home' directory.
1116 IPython sets this directory by looking for a
1116 IPython sets this directory by looking for a
1117 \family typewriter
1117 \family typewriter
1118 HOME
1118 HOME
1119 \family default
1119 \family default
1120 environment variable; if such a variable does not exist, it uses
1120 environment variable; if such a variable does not exist, it uses
1121 \family typewriter
1121 \family typewriter
1122 HOMEDRIVE
1122 HOMEDRIVE
1123 \backslash
1123 \backslash
1124 HOMEPATH
1124 HOMEPATH
1125 \family default
1125 \family default
1126 (these are always defined by Windows).
1126 (these are always defined by Windows).
1127 This typically gives something like
1127 This typically gives something like
1128 \family typewriter
1128 \family typewriter
1129 C:
1129 C:
1130 \backslash
1130 \backslash
1131 Documents and Settings
1131 Documents and Settings
1132 \backslash
1132 \backslash
1133 YourUserName
1133 YourUserName
1134 \family default
1134 \family default
1135 , but your local details may vary.
1135 , but your local details may vary.
1136 In this directory you will find all the files that configure IPython's
1136 In this directory you will find all the files that configure IPython's
1137 defaults, and you can put there your profiles and extensions.
1137 defaults, and you can put there your profiles and extensions.
1138 This directory is automatically added by IPython to
1138 This directory is automatically added by IPython to
1139 \family typewriter
1139 \family typewriter
1140 sys.path
1140 sys.path
1141 \family default
1141 \family default
1142 , so anything you place there can be found by
1142 , so anything you place there can be found by
1143 \family typewriter
1143 \family typewriter
1144 import
1144 import
1145 \family default
1145 \family default
1146 statements.
1146 statements.
1147 \layout Paragraph
1147 \layout Paragraph
1148
1148
1149 Upgrading
1149 Upgrading
1150 \layout Standard
1150 \layout Standard
1151
1151
1152 For an IPython upgrade, you should first uninstall the previous version.
1152 For an IPython upgrade, you should first uninstall the previous version.
1153 This will ensure that all files and directories (such as the documentation)
1153 This will ensure that all files and directories (such as the documentation)
1154 which carry embedded version strings in their names are properly removed.
1154 which carry embedded version strings in their names are properly removed.
1155 \layout Paragraph
1155 \layout Paragraph
1156
1156
1157 Manual installation under Win32
1157 Manual installation under Win32
1158 \layout Standard
1158 \layout Standard
1159
1159
1160 In case the automatic installer does not work for some reason, you can download
1160 In case the automatic installer does not work for some reason, you can download
1161 the
1161 the
1162 \family typewriter
1162 \family typewriter
1163 ipython-XXX.tar.gz
1163 ipython-XXX.tar.gz
1164 \family default
1164 \family default
1165 file, which contains the full IPython source distribution (the popular
1165 file, which contains the full IPython source distribution (the popular
1166 WinZip can read
1166 WinZip can read
1167 \family typewriter
1167 \family typewriter
1168 .tar.gz
1168 .tar.gz
1169 \family default
1169 \family default
1170 files).
1170 files).
1171 After uncompressing the archive, you can install it at a command terminal
1171 After uncompressing the archive, you can install it at a command terminal
1172 just like any other Python module, by using
1172 just like any other Python module, by using
1173 \family typewriter
1173 \family typewriter
1174 `python setup.py install'
1174 `python setup.py install'
1175 \family default
1175 \family default
1176 .
1176 .
1177
1177
1178 \layout Standard
1178 \layout Standard
1179
1179
1180 After the installation, run the supplied
1180 After the installation, run the supplied
1181 \family typewriter
1181 \family typewriter
1182 win32_manual_post_install.py
1182 win32_manual_post_install.py
1183 \family default
1183 \family default
1184 script, which creates the necessary Start Menu shortcuts for you.
1184 script, which creates the necessary Start Menu shortcuts for you.
1185 \layout Subsection
1185 \layout Subsection
1186
1186
1187
1187
1188 \begin_inset LatexCommand \label{sec:upgrade}
1188 \begin_inset LatexCommand \label{sec:upgrade}
1189
1189
1190 \end_inset
1190 \end_inset
1191
1191
1192 Upgrading from a previous version
1192 Upgrading from a previous version
1193 \layout Standard
1193 \layout Standard
1194
1194
1195 If you are upgrading from a previous version of IPython, after doing the
1195 If you are upgrading from a previous version of IPython, after doing the
1196 routine installation described above, you should call IPython with the
1196 routine installation described above, you should call IPython with the
1197
1197
1198 \family typewriter
1198 \family typewriter
1199 -upgrade
1199 -upgrade
1200 \family default
1200 \family default
1201 option the first time you run your new copy.
1201 option the first time you run your new copy.
1202 This will automatically update your configuration directory while preserving
1202 This will automatically update your configuration directory while preserving
1203 copies of your old files.
1203 copies of your old files.
1204 You can then later merge back any personal customizations you may have
1204 You can then later merge back any personal customizations you may have
1205 made into the new files.
1205 made into the new files.
1206 It is a good idea to do this as there may be new options available in the
1206 It is a good idea to do this as there may be new options available in the
1207 new configuration files which you will not have.
1207 new configuration files which you will not have.
1208 \layout Standard
1208 \layout Standard
1209
1209
1210 Under Windows, if you don't know how to call python scripts with arguments
1210 Under Windows, if you don't know how to call python scripts with arguments
1211 from a command line, simply delete the old config directory and IPython
1211 from a command line, simply delete the old config directory and IPython
1212 will make a new one.
1212 will make a new one.
1213 Win2k and WinXP users will find it in
1213 Win2k and WinXP users will find it in
1214 \family typewriter
1214 \family typewriter
1215 C:
1215 C:
1216 \backslash
1216 \backslash
1217 Documents and Settings
1217 Documents and Settings
1218 \backslash
1218 \backslash
1219 YourUserName
1219 YourUserName
1220 \backslash
1220 \backslash
1221 _ipython
1221 _ipython
1222 \family default
1222 \family default
1223 , and Win 9x users under
1223 , and Win 9x users under
1224 \family typewriter
1224 \family typewriter
1225 C:
1225 C:
1226 \backslash
1226 \backslash
1227 Program Files
1227 Program Files
1228 \backslash
1228 \backslash
1229 IPython
1229 IPython
1230 \backslash
1230 \backslash
1231 _ipython.
1231 _ipython.
1232 \layout Section
1232 \layout Section
1233
1233
1234
1234
1235 \begin_inset LatexCommand \label{sec:good_config}
1235 \begin_inset LatexCommand \label{sec:good_config}
1236
1236
1237 \end_inset
1237 \end_inset
1238
1238
1239
1239
1240 \begin_inset OptArg
1240 \begin_inset OptArg
1241 collapsed true
1241 collapsed true
1242
1242
1243 \layout Standard
1243 \layout Standard
1244
1244
1245 Initial configuration
1245 Initial configuration
1246 \begin_inset ERT
1246 \begin_inset ERT
1247 status Collapsed
1247 status Collapsed
1248
1248
1249 \layout Standard
1249 \layout Standard
1250
1250
1251 \backslash
1251 \backslash
1252 ldots
1252 ldots
1253 \end_inset
1253 \end_inset
1254
1254
1255
1255
1256 \end_inset
1256 \end_inset
1257
1257
1258 Initial configuration of your environment
1258 Initial configuration of your environment
1259 \layout Standard
1259 \layout Standard
1260
1260
1261 This section will help you set various things in your environment for your
1261 This section will help you set various things in your environment for your
1262 IPython sessions to be as efficient as possible.
1262 IPython sessions to be as efficient as possible.
1263 All of IPython's configuration information, along with several example
1263 All of IPython's configuration information, along with several example
1264 files, is stored in a directory named by default
1264 files, is stored in a directory named by default
1265 \family typewriter
1265 \family typewriter
1266 $HOME/.ipython
1266 $HOME/.ipython
1267 \family default
1267 \family default
1268 .
1268 .
1269 You can change this by defining the environment variable
1269 You can change this by defining the environment variable
1270 \family typewriter
1270 \family typewriter
1271 IPYTHONDIR
1271 IPYTHONDIR
1272 \family default
1272 \family default
1273 , or at runtime with the command line option
1273 , or at runtime with the command line option
1274 \family typewriter
1274 \family typewriter
1275 -ipythondir
1275 -ipythondir
1276 \family default
1276 \family default
1277 .
1277 .
1278 \layout Standard
1278 \layout Standard
1279
1279
1280 If all goes well, the first time you run IPython it should automatically
1280 If all goes well, the first time you run IPython it should automatically
1281 create a user copy of the config directory for you, based on its builtin
1281 create a user copy of the config directory for you, based on its builtin
1282 defaults.
1282 defaults.
1283 You can look at the files it creates to learn more about configuring the
1283 You can look at the files it creates to learn more about configuring the
1284 system.
1284 system.
1285 The main file you will modify to configure IPython's behavior is called
1285 The main file you will modify to configure IPython's behavior is called
1286
1286
1287 \family typewriter
1287 \family typewriter
1288 ipythonrc
1288 ipythonrc
1289 \family default
1289 \family default
1290 (with a
1290 (with a
1291 \family typewriter
1291 \family typewriter
1292 .ini
1292 .ini
1293 \family default
1293 \family default
1294 extension under Windows), included for reference in Sec.
1294 extension under Windows), included for reference in Sec.
1295
1295
1296 \begin_inset LatexCommand \ref{sec:ipytonrc-sample}
1296 \begin_inset LatexCommand \ref{sec:ipytonrc-sample}
1297
1297
1298 \end_inset
1298 \end_inset
1299
1299
1300 .
1300 .
1301 This file is very commented and has many variables you can change to suit
1301 This file is very commented and has many variables you can change to suit
1302 your taste, you can find more details in Sec.
1302 your taste, you can find more details in Sec.
1303
1303
1304 \begin_inset LatexCommand \ref{sec:customization}
1304 \begin_inset LatexCommand \ref{sec:customization}
1305
1305
1306 \end_inset
1306 \end_inset
1307
1307
1308 .
1308 .
1309 Here we discuss the basic things you will want to make sure things are
1309 Here we discuss the basic things you will want to make sure things are
1310 working properly from the beginning.
1310 working properly from the beginning.
1311 \layout Subsection
1311 \layout Subsection
1312
1312
1313
1313
1314 \begin_inset LatexCommand \label{sec:help-access}
1314 \begin_inset LatexCommand \label{sec:help-access}
1315
1315
1316 \end_inset
1316 \end_inset
1317
1317
1318 Access to the Python help system
1318 Access to the Python help system
1319 \layout Standard
1319 \layout Standard
1320
1320
1321 This is true for Python in general (not just for IPython): you should have
1321 This is true for Python in general (not just for IPython): you should have
1322 an environment variable called
1322 an environment variable called
1323 \family typewriter
1323 \family typewriter
1324 PYTHONDOCS
1324 PYTHONDOCS
1325 \family default
1325 \family default
1326 pointing to the directory where your HTML Python documentation lives.
1326 pointing to the directory where your HTML Python documentation lives.
1327 In my system it's
1327 In my system it's
1328 \family typewriter
1328 \family typewriter
1329 /usr/share/doc/python-docs-2.3.4/html
1329 /usr/share/doc/python-docs-2.3.4/html
1330 \family default
1330 \family default
1331 , check your local details or ask your systems administrator.
1331 , check your local details or ask your systems administrator.
1332
1332
1333 \layout Standard
1333 \layout Standard
1334
1334
1335 This is the directory which holds the HTML version of the Python manuals.
1335 This is the directory which holds the HTML version of the Python manuals.
1336 Unfortunately it seems that different Linux distributions package these
1336 Unfortunately it seems that different Linux distributions package these
1337 files differently, so you may have to look around a bit.
1337 files differently, so you may have to look around a bit.
1338 Below I show the contents of this directory on my system for reference:
1338 Below I show the contents of this directory on my system for reference:
1339 \layout Standard
1339 \layout Standard
1340
1340
1341
1341
1342 \family typewriter
1342 \family typewriter
1343 [html]> ls
1343 [html]> ls
1344 \newline
1344 \newline
1345 about.dat acks.html dist/ ext/ index.html lib/ modindex.html stdabout.dat tut/
1345 about.dat acks.html dist/ ext/ index.html lib/ modindex.html stdabout.dat tut/
1346 about.html api/ doc/ icons/ inst/ mac/ ref/ style.css
1346 about.html api/ doc/ icons/ inst/ mac/ ref/ style.css
1347 \layout Standard
1347 \layout Standard
1348
1348
1349 You should really make sure this variable is correctly set so that Python's
1349 You should really make sure this variable is correctly set so that Python's
1350 pydoc-based help system works.
1350 pydoc-based help system works.
1351 It is a powerful and convenient system with full access to the Python manuals
1351 It is a powerful and convenient system with full access to the Python manuals
1352 and all modules accessible to you.
1352 and all modules accessible to you.
1353 \layout Standard
1353 \layout Standard
1354
1354
1355 Under Windows it seems that pydoc finds the documentation automatically,
1355 Under Windows it seems that pydoc finds the documentation automatically,
1356 so no extra setup appears necessary.
1356 so no extra setup appears necessary.
1357 \layout Subsection
1357 \layout Subsection
1358
1358
1359 Editor
1359 Editor
1360 \layout Standard
1360 \layout Standard
1361
1361
1362 The
1362 The
1363 \family typewriter
1363 \family typewriter
1364 %edit
1364 %edit
1365 \family default
1365 \family default
1366 command (and its alias
1366 command (and its alias
1367 \family typewriter
1367 \family typewriter
1368 %ed
1368 %ed
1369 \family default
1369 \family default
1370 ) will invoke the editor set in your environment as
1370 ) will invoke the editor set in your environment as
1371 \family typewriter
1371 \family typewriter
1372 EDITOR
1372 EDITOR
1373 \family default
1373 \family default
1374 .
1374 .
1375 If this variable is not set, it will default to
1375 If this variable is not set, it will default to
1376 \family typewriter
1376 \family typewriter
1377 vi
1377 vi
1378 \family default
1378 \family default
1379 under Linux/Unix and to
1379 under Linux/Unix and to
1380 \family typewriter
1380 \family typewriter
1381 notepad
1381 notepad
1382 \family default
1382 \family default
1383 under Windows.
1383 under Windows.
1384 You may want to set this variable properly and to a lightweight editor
1384 You may want to set this variable properly and to a lightweight editor
1385 which doesn't take too long to start (that is, something other than a new
1385 which doesn't take too long to start (that is, something other than a new
1386 instance of
1386 instance of
1387 \family typewriter
1387 \family typewriter
1388 Emacs
1388 Emacs
1389 \family default
1389 \family default
1390 ).
1390 ).
1391 This way you can edit multi-line code quickly and with the power of a real
1391 This way you can edit multi-line code quickly and with the power of a real
1392 editor right inside IPython.
1392 editor right inside IPython.
1393
1393
1394 \layout Standard
1394 \layout Standard
1395
1395
1396 If you are a dedicated
1396 If you are a dedicated
1397 \family typewriter
1397 \family typewriter
1398 Emacs
1398 Emacs
1399 \family default
1399 \family default
1400 user, you should set up the
1400 user, you should set up the
1401 \family typewriter
1401 \family typewriter
1402 Emacs
1402 Emacs
1403 \family default
1403 \family default
1404 server so that new requests are handled by the original process.
1404 server so that new requests are handled by the original process.
1405 This means that almost no time is spent in handling the request (assuming
1405 This means that almost no time is spent in handling the request (assuming
1406 an
1406 an
1407 \family typewriter
1407 \family typewriter
1408 Emacs
1408 Emacs
1409 \family default
1409 \family default
1410 process is already running).
1410 process is already running).
1411 For this to work, you need to set your
1411 For this to work, you need to set your
1412 \family typewriter
1412 \family typewriter
1413 EDITOR
1413 EDITOR
1414 \family default
1414 \family default
1415 environment variable to
1415 environment variable to
1416 \family typewriter
1416 \family typewriter
1417 'emacsclient'
1417 'emacsclient'
1418 \family default
1418 \family default
1419 .
1419 .
1420
1420
1421 \family typewriter
1421 \family typewriter
1422
1422
1423 \family default
1423 \family default
1424 The code below, supplied by Francois Pinard, can then be used in your
1424 The code below, supplied by Francois Pinard, can then be used in your
1425 \family typewriter
1425 \family typewriter
1426 .emacs
1426 .emacs
1427 \family default
1427 \family default
1428 file to enable the server:
1428 file to enable the server:
1429 \layout Standard
1429 \layout Standard
1430
1430
1431
1431
1432 \family typewriter
1432 \family typewriter
1433 (defvar server-buffer-clients)
1433 (defvar server-buffer-clients)
1434 \newline
1434 \newline
1435 (when (and (fboundp 'server-start) (string-equal (getenv "TERM") 'xterm))
1435 (when (and (fboundp 'server-start) (string-equal (getenv "TERM") 'xterm))
1436 \newline
1436 \newline
1437
1437
1438 \begin_inset ERT
1438 \begin_inset ERT
1439 status Collapsed
1439 status Collapsed
1440
1440
1441 \layout Standard
1441 \layout Standard
1442
1442
1443 \backslash
1443 \backslash
1444 hspace*{0mm}
1444 hspace*{0mm}
1445 \end_inset
1445 \end_inset
1446
1446
1447 \SpecialChar ~
1447 \SpecialChar ~
1448 \SpecialChar ~
1448 \SpecialChar ~
1449 (server-start)
1449 (server-start)
1450 \newline
1450 \newline
1451
1451
1452 \begin_inset ERT
1452 \begin_inset ERT
1453 status Collapsed
1453 status Collapsed
1454
1454
1455 \layout Standard
1455 \layout Standard
1456
1456
1457 \backslash
1457 \backslash
1458 hspace*{0mm}
1458 hspace*{0mm}
1459 \end_inset
1459 \end_inset
1460
1460
1461 \SpecialChar ~
1461 \SpecialChar ~
1462 \SpecialChar ~
1462 \SpecialChar ~
1463 (defun fp-kill-server-with-buffer-routine ()
1463 (defun fp-kill-server-with-buffer-routine ()
1464 \newline
1464 \newline
1465
1465
1466 \begin_inset ERT
1466 \begin_inset ERT
1467 status Collapsed
1467 status Collapsed
1468
1468
1469 \layout Standard
1469 \layout Standard
1470
1470
1471 \backslash
1471 \backslash
1472 hspace*{0mm}
1472 hspace*{0mm}
1473 \end_inset
1473 \end_inset
1474
1474
1475 \SpecialChar ~
1475 \SpecialChar ~
1476 \SpecialChar ~
1476 \SpecialChar ~
1477 \SpecialChar ~
1477 \SpecialChar ~
1478 \SpecialChar ~
1478 \SpecialChar ~
1479 (and server-buffer-clients (server-done)))
1479 (and server-buffer-clients (server-done)))
1480 \newline
1480 \newline
1481
1481
1482 \begin_inset ERT
1482 \begin_inset ERT
1483 status Collapsed
1483 status Collapsed
1484
1484
1485 \layout Standard
1485 \layout Standard
1486
1486
1487 \backslash
1487 \backslash
1488 hspace*{0mm}
1488 hspace*{0mm}
1489 \end_inset
1489 \end_inset
1490
1490
1491 \SpecialChar ~
1491 \SpecialChar ~
1492 \SpecialChar ~
1492 \SpecialChar ~
1493 (add-hook 'kill-buffer-hook 'fp-kill-server-with-buffer-routine))
1493 (add-hook 'kill-buffer-hook 'fp-kill-server-with-buffer-routine))
1494 \layout Standard
1494 \layout Standard
1495
1495
1496 You can also set the value of this editor via the commmand-line option '-
1496 You can also set the value of this editor via the commmand-line option '-
1497 \family typewriter
1497 \family typewriter
1498 editor'
1498 editor'
1499 \family default
1499 \family default
1500 or in your
1500 or in your
1501 \family typewriter
1501 \family typewriter
1502 ipythonrc
1502 ipythonrc
1503 \family default
1503 \family default
1504 file.
1504 file.
1505 This is useful if you wish to use specifically for IPython an editor different
1505 This is useful if you wish to use specifically for IPython an editor different
1506 from your typical default (and for Windows users who tend to use fewer
1506 from your typical default (and for Windows users who tend to use fewer
1507 environment variables).
1507 environment variables).
1508 \layout Subsection
1508 \layout Subsection
1509
1509
1510 Color
1510 Color
1511 \layout Standard
1511 \layout Standard
1512
1512
1513 The default IPython configuration has most bells and whistles turned on
1513 The default IPython configuration has most bells and whistles turned on
1514 (they're pretty safe).
1514 (they're pretty safe).
1515 But there's one that
1515 But there's one that
1516 \emph on
1516 \emph on
1517 may
1517 may
1518 \emph default
1518 \emph default
1519 cause problems on some systems: the use of color on screen for displaying
1519 cause problems on some systems: the use of color on screen for displaying
1520 information.
1520 information.
1521 This is very useful, since IPython can show prompts and exception tracebacks
1521 This is very useful, since IPython can show prompts and exception tracebacks
1522 with various colors, display syntax-highlighted source code, and in general
1522 with various colors, display syntax-highlighted source code, and in general
1523 make it easier to visually parse information.
1523 make it easier to visually parse information.
1524 \layout Standard
1524 \layout Standard
1525
1525
1526 The following terminals seem to handle the color sequences fine:
1526 The following terminals seem to handle the color sequences fine:
1527 \layout Itemize
1527 \layout Itemize
1528
1528
1529 Linux main text console, KDE Konsole, Gnome Terminal, E-term, rxvt, xterm.
1529 Linux main text console, KDE Konsole, Gnome Terminal, E-term, rxvt, xterm.
1530 \layout Itemize
1530 \layout Itemize
1531
1531
1532 CDE terminal (tested under Solaris).
1532 CDE terminal (tested under Solaris).
1533 This one boldfaces light colors.
1533 This one boldfaces light colors.
1534 \layout Itemize
1534 \layout Itemize
1535
1535
1536 (X)Emacs buffers.
1536 (X)Emacs buffers.
1537 See sec.
1537 See sec.
1538 \begin_inset LatexCommand \ref{sec:emacs}
1538 \begin_inset LatexCommand \ref{sec:emacs}
1539
1539
1540 \end_inset
1540 \end_inset
1541
1541
1542 for more details on using IPython with (X)Emacs.
1542 for more details on using IPython with (X)Emacs.
1543 \layout Itemize
1543 \layout Itemize
1544
1544
1545 A Windows (XP/2k) command prompt
1545 A Windows (XP/2k) command prompt
1546 \emph on
1546 \emph on
1547 with Gary Bishop's support extensions
1547 with Gary Bishop's support extensions
1548 \emph default
1548 \emph default
1549 .
1549 .
1550 Gary's extensions are discussed in Sec.\SpecialChar ~
1550 Gary's extensions are discussed in Sec.\SpecialChar ~
1551
1551
1552 \begin_inset LatexCommand \ref{sub:Under-Windows}
1552 \begin_inset LatexCommand \ref{sub:Under-Windows}
1553
1553
1554 \end_inset
1554 \end_inset
1555
1555
1556 .
1556 .
1557 \layout Itemize
1557 \layout Itemize
1558
1558
1559 A Windows (XP/2k) CygWin shell.
1559 A Windows (XP/2k) CygWin shell.
1560 Although some users have reported problems; it is not clear whether there
1560 Although some users have reported problems; it is not clear whether there
1561 is an issue for everyone or only under specific configurations.
1561 is an issue for everyone or only under specific configurations.
1562 If you have full color support under cygwin, please post to the IPython
1562 If you have full color support under cygwin, please post to the IPython
1563 mailing list so this issue can be resolved for all users.
1563 mailing list so this issue can be resolved for all users.
1564 \layout Standard
1564 \layout Standard
1565
1565
1566 These have shown problems:
1566 These have shown problems:
1567 \layout Itemize
1567 \layout Itemize
1568
1568
1569 Windows command prompt in WinXP/2k logged into a Linux machine via telnet
1569 Windows command prompt in WinXP/2k logged into a Linux machine via telnet
1570 or ssh.
1570 or ssh.
1571 \layout Itemize
1571 \layout Itemize
1572
1572
1573 Windows native command prompt in WinXP/2k,
1573 Windows native command prompt in WinXP/2k,
1574 \emph on
1574 \emph on
1575 without
1575 without
1576 \emph default
1576 \emph default
1577 Gary Bishop's extensions.
1577 Gary Bishop's extensions.
1578 Once Gary's readline library is installed, the normal WinXP/2k command
1578 Once Gary's readline library is installed, the normal WinXP/2k command
1579 prompt works perfectly.
1579 prompt works perfectly.
1580 \layout Standard
1580 \layout Standard
1581
1581
1582 Currently the following color schemes are available:
1582 Currently the following color schemes are available:
1583 \layout Itemize
1583 \layout Itemize
1584
1584
1585
1585
1586 \family typewriter
1586 \family typewriter
1587 NoColor
1587 NoColor
1588 \family default
1588 \family default
1589 : uses no color escapes at all (all escapes are empty
1589 : uses no color escapes at all (all escapes are empty
1590 \begin_inset Quotes eld
1590 \begin_inset Quotes eld
1591 \end_inset
1591 \end_inset
1592
1592
1593
1593
1594 \begin_inset Quotes eld
1594 \begin_inset Quotes eld
1595 \end_inset
1595 \end_inset
1596
1596
1597 strings).
1597 strings).
1598 This 'scheme' is thus fully safe to use in any terminal.
1598 This 'scheme' is thus fully safe to use in any terminal.
1599 \layout Itemize
1599 \layout Itemize
1600
1600
1601
1601
1602 \family typewriter
1602 \family typewriter
1603 Linux
1603 Linux
1604 \family default
1604 \family default
1605 : works well in Linux console type environments: dark background with light
1605 : works well in Linux console type environments: dark background with light
1606 fonts.
1606 fonts.
1607 It uses bright colors for information, so it is difficult to read if you
1607 It uses bright colors for information, so it is difficult to read if you
1608 have a light colored background.
1608 have a light colored background.
1609 \layout Itemize
1609 \layout Itemize
1610
1610
1611
1611
1612 \family typewriter
1612 \family typewriter
1613 LightBG
1613 LightBG
1614 \family default
1614 \family default
1615 : the basic colors are similar to those in the
1615 : the basic colors are similar to those in the
1616 \family typewriter
1616 \family typewriter
1617 Linux
1617 Linux
1618 \family default
1618 \family default
1619 scheme but darker.
1619 scheme but darker.
1620 It is easy to read in terminals with light backgrounds.
1620 It is easy to read in terminals with light backgrounds.
1621 \layout Standard
1621 \layout Standard
1622
1622
1623 IPython uses colors for two main groups of things: prompts and tracebacks
1623 IPython uses colors for two main groups of things: prompts and tracebacks
1624 which are directly printed to the terminal, and the object introspection
1624 which are directly printed to the terminal, and the object introspection
1625 system which passes large sets of data through a pager.
1625 system which passes large sets of data through a pager.
1626 \layout Subsubsection
1626 \layout Subsubsection
1627
1627
1628 Input/Output prompts and exception tracebacks
1628 Input/Output prompts and exception tracebacks
1629 \layout Standard
1629 \layout Standard
1630
1630
1631 You can test whether the colored prompts and tracebacks work on your system
1631 You can test whether the colored prompts and tracebacks work on your system
1632 interactively by typing
1632 interactively by typing
1633 \family typewriter
1633 \family typewriter
1634 '%colors Linux'
1634 '%colors Linux'
1635 \family default
1635 \family default
1636 at the prompt (use '
1636 at the prompt (use '
1637 \family typewriter
1637 \family typewriter
1638 %colors LightBG'
1638 %colors LightBG'
1639 \family default
1639 \family default
1640 if your terminal has a light background).
1640 if your terminal has a light background).
1641 If the input prompt shows garbage like:
1641 If the input prompt shows garbage like:
1642 \newline
1642 \newline
1643
1643
1644 \family typewriter
1644 \family typewriter
1645 [0;32mIn [[1;32m1[0;32m]: [0;00m
1645 [0;32mIn [[1;32m1[0;32m]: [0;00m
1646 \family default
1646 \family default
1647
1647
1648 \newline
1648 \newline
1649 instead of (in color) something like:
1649 instead of (in color) something like:
1650 \newline
1650 \newline
1651
1651
1652 \family typewriter
1652 \family typewriter
1653 In [1]:
1653 In [1]:
1654 \family default
1654 \family default
1655
1655
1656 \newline
1656 \newline
1657 this means that your terminal doesn't properly handle color escape sequences.
1657 this means that your terminal doesn't properly handle color escape sequences.
1658 You can go to a 'no color' mode by typing '
1658 You can go to a 'no color' mode by typing '
1659 \family typewriter
1659 \family typewriter
1660 %colors NoColor
1660 %colors NoColor
1661 \family default
1661 \family default
1662 '.
1662 '.
1663
1663
1664 \layout Standard
1664 \layout Standard
1665
1665
1666 You can try using a different terminal emulator program (Emacs users, see
1666 You can try using a different terminal emulator program (Emacs users, see
1667 below).
1667 below).
1668 To permanently set your color preferences, edit the file
1668 To permanently set your color preferences, edit the file
1669 \family typewriter
1669 \family typewriter
1670 $HOME/.ipython/ipythonrc
1670 $HOME/.ipython/ipythonrc
1671 \family default
1671 \family default
1672 and set the
1672 and set the
1673 \family typewriter
1673 \family typewriter
1674 colors
1674 colors
1675 \family default
1675 \family default
1676 option to the desired value.
1676 option to the desired value.
1677 \layout Subsubsection
1677 \layout Subsubsection
1678
1678
1679 Object details (types, docstrings, source code, etc.)
1679 Object details (types, docstrings, source code, etc.)
1680 \layout Standard
1680 \layout Standard
1681
1681
1682 IPython has a set of special functions for studying the objects you are
1682 IPython has a set of special functions for studying the objects you are
1683 working with, discussed in detail in Sec.
1683 working with, discussed in detail in Sec.
1684
1684
1685 \begin_inset LatexCommand \ref{sec:dyn-object-info}
1685 \begin_inset LatexCommand \ref{sec:dyn-object-info}
1686
1686
1687 \end_inset
1687 \end_inset
1688
1688
1689 .
1689 .
1690 But this system relies on passing information which is longer than your
1690 But this system relies on passing information which is longer than your
1691 screen through a data pager, such as the common Unix
1691 screen through a data pager, such as the common Unix
1692 \family typewriter
1692 \family typewriter
1693 less
1693 less
1694 \family default
1694 \family default
1695 and
1695 and
1696 \family typewriter
1696 \family typewriter
1697 more
1697 more
1698 \family default
1698 \family default
1699 programs.
1699 programs.
1700 In order to be able to see this information in color, your pager needs
1700 In order to be able to see this information in color, your pager needs
1701 to be properly configured.
1701 to be properly configured.
1702 I strongly recommend using
1702 I strongly recommend using
1703 \family typewriter
1703 \family typewriter
1704 less
1704 less
1705 \family default
1705 \family default
1706 instead of
1706 instead of
1707 \family typewriter
1707 \family typewriter
1708 more
1708 more
1709 \family default
1709 \family default
1710 , as it seems that
1710 , as it seems that
1711 \family typewriter
1711 \family typewriter
1712 more
1712 more
1713 \family default
1713 \family default
1714 simply can not understand colored text correctly.
1714 simply can not understand colored text correctly.
1715 \layout Standard
1715 \layout Standard
1716
1716
1717 In order to configure
1717 In order to configure
1718 \family typewriter
1718 \family typewriter
1719 less
1719 less
1720 \family default
1720 \family default
1721 as your default pager, do the following:
1721 as your default pager, do the following:
1722 \layout Enumerate
1722 \layout Enumerate
1723
1723
1724 Set the environment
1724 Set the environment
1725 \family typewriter
1725 \family typewriter
1726 PAGER
1726 PAGER
1727 \family default
1727 \family default
1728 variable to
1728 variable to
1729 \family typewriter
1729 \family typewriter
1730 less
1730 less
1731 \family default
1731 \family default
1732 .
1732 .
1733 \layout Enumerate
1733 \layout Enumerate
1734
1734
1735 Set the environment
1735 Set the environment
1736 \family typewriter
1736 \family typewriter
1737 LESS
1737 LESS
1738 \family default
1738 \family default
1739 variable to
1739 variable to
1740 \family typewriter
1740 \family typewriter
1741 -r
1741 -r
1742 \family default
1742 \family default
1743 (plus any other options you always want to pass to
1743 (plus any other options you always want to pass to
1744 \family typewriter
1744 \family typewriter
1745 less
1745 less
1746 \family default
1746 \family default
1747 by default).
1747 by default).
1748 This tells
1748 This tells
1749 \family typewriter
1749 \family typewriter
1750 less
1750 less
1751 \family default
1751 \family default
1752 to properly interpret control sequences, which is how color information
1752 to properly interpret control sequences, which is how color information
1753 is given to your terminal.
1753 is given to your terminal.
1754 \layout Standard
1754 \layout Standard
1755
1755
1756 For the
1756 For the
1757 \family typewriter
1757 \family typewriter
1758 csh
1758 csh
1759 \family default
1759 \family default
1760 or
1760 or
1761 \family typewriter
1761 \family typewriter
1762 tcsh
1762 tcsh
1763 \family default
1763 \family default
1764 shells, add to your
1764 shells, add to your
1765 \family typewriter
1765 \family typewriter
1766 ~/.cshrc
1766 ~/.cshrc
1767 \family default
1767 \family default
1768 file the lines:
1768 file the lines:
1769 \layout Standard
1769 \layout Standard
1770
1770
1771
1771
1772 \family typewriter
1772 \family typewriter
1773 setenv PAGER less
1773 setenv PAGER less
1774 \newline
1774 \newline
1775 setenv LESS -r
1775 setenv LESS -r
1776 \layout Standard
1776 \layout Standard
1777
1777
1778 There is similar syntax for other Unix shells, look at your system documentation
1778 There is similar syntax for other Unix shells, look at your system documentation
1779 for details.
1779 for details.
1780 \layout Standard
1780 \layout Standard
1781
1781
1782 If you are on a system which lacks proper data pagers (such as Windows),
1782 If you are on a system which lacks proper data pagers (such as Windows),
1783 IPython will use a very limited builtin pager.
1783 IPython will use a very limited builtin pager.
1784 \layout Subsection
1784 \layout Subsection
1785
1785
1786
1786
1787 \begin_inset LatexCommand \label{sec:emacs}
1787 \begin_inset LatexCommand \label{sec:emacs}
1788
1788
1789 \end_inset
1789 \end_inset
1790
1790
1791 (X)Emacs configuration
1791 (X)Emacs configuration
1792 \layout Standard
1792 \layout Standard
1793
1793
1794 Thanks to the work of Alexander Schmolck and Prabhu Ramachandran, currently
1794 Thanks to the work of Alexander Schmolck and Prabhu Ramachandran, currently
1795 (X)Emacs and IPython get along very well.
1795 (X)Emacs and IPython get along very well.
1796
1796
1797 \layout Standard
1797 \layout Standard
1798
1798
1799
1799
1800 \series bold
1800 \series bold
1801 Important note:
1801 Important note:
1802 \series default
1802 \series default
1803 You will need to use a recent enough version of
1803 You will need to use a recent enough version of
1804 \family typewriter
1804 \family typewriter
1805 python-mode.el
1805 python-mode.el
1806 \family default
1806 \family default
1807 , along with the file
1807 , along with the file
1808 \family typewriter
1808 \family typewriter
1809 ipython.el
1809 ipython.el
1810 \family default
1810 \family default
1811 .
1811 .
1812 You can check that the version you have of
1812 You can check that the version you have of
1813 \family typewriter
1813 \family typewriter
1814 python-mode.el
1814 python-mode.el
1815 \family default
1815 \family default
1816 is new enough by either looking at the revision number in the file itself,
1816 is new enough by either looking at the revision number in the file itself,
1817 or asking for it in (X)Emacs via
1817 or asking for it in (X)Emacs via
1818 \family typewriter
1818 \family typewriter
1819 M-x py-version
1819 M-x py-version
1820 \family default
1820 \family default
1821 .
1821 .
1822 Versions 4.68 and newer contain the necessary fixes for proper IPython support.
1822 Versions 4.68 and newer contain the necessary fixes for proper IPython support.
1823 \layout Standard
1823 \layout Standard
1824
1824
1825 The file
1825 The file
1826 \family typewriter
1826 \family typewriter
1827 ipython.el
1827 ipython.el
1828 \family default
1828 \family default
1829 is included with the IPython distribution, in the documentation directory
1829 is included with the IPython distribution, in the documentation directory
1830 (where this manual resides in PDF and HTML formats).
1830 (where this manual resides in PDF and HTML formats).
1831 \layout Standard
1831 \layout Standard
1832
1832
1833 Once you put these files in your Emacs path, all you need in your
1833 Once you put these files in your Emacs path, all you need in your
1834 \family typewriter
1834 \family typewriter
1835 .emacs
1835 .emacs
1836 \family default
1836 \family default
1837 file is:
1837 file is:
1838 \layout LyX-Code
1838 \layout LyX-Code
1839
1839
1840 (require 'ipython)
1840 (require 'ipython)
1841 \layout Standard
1841 \layout Standard
1842
1842
1843 This should give you full support for executing code snippets via IPython,
1843 This should give you full support for executing code snippets via IPython,
1844 opening IPython as your Python shell via
1844 opening IPython as your Python shell via
1845 \family typewriter
1845 \family typewriter
1846 C-c\SpecialChar ~
1846 C-c\SpecialChar ~
1847 !
1847 !
1848 \family default
1848 \family default
1849 , etc.
1849 , etc.
1850
1850
1851 \layout Standard
1851 \layout Standard
1852
1852
1853 If you happen to get garbage instead of colored prompts as described in
1853 If you happen to get garbage instead of colored prompts as described in
1854 the previous section, you may need to set also in your
1854 the previous section, you may need to set also in your
1855 \family typewriter
1855 \family typewriter
1856 .emacs
1856 .emacs
1857 \family default
1857 \family default
1858 file:
1858 file:
1859 \layout LyX-Code
1859 \layout LyX-Code
1860
1860
1861 (setq ansi-color-for-comint-mode t)
1861 (setq ansi-color-for-comint-mode t)
1862 \layout Subsubsection*
1862 \layout Subsubsection*
1863
1863
1864 Notes
1864 Notes
1865 \layout Itemize
1865 \layout Itemize
1866
1866
1867 There is one caveat you should be aware of: you must start the IPython shell
1867 There is one caveat you should be aware of: you must start the IPython shell
1868
1868
1869 \emph on
1869 \emph on
1870 before
1870 before
1871 \emph default
1871 \emph default
1872 attempting to execute any code regions via
1872 attempting to execute any code regions via
1873 \family typewriter
1873 \family typewriter
1874 C-c\SpecialChar ~
1874 C-c\SpecialChar ~
1875 |
1875 |
1876 \family default
1876 \family default
1877 .
1877 .
1878 Simply type
1878 Simply type
1879 \family typewriter
1879 \family typewriter
1880 C-c\SpecialChar ~
1880 C-c\SpecialChar ~
1881 !
1881 !
1882 \family default
1882 \family default
1883 to start IPython before passing any code regions to the interpreter, and
1883 to start IPython before passing any code regions to the interpreter, and
1884 you shouldn't experience any problems.
1884 you shouldn't experience any problems.
1885 \newline
1885 \newline
1886 This is due to a bug in Python itself, which has been fixed for Python 2.3,
1886 This is due to a bug in Python itself, which has been fixed for Python 2.3,
1887 but exists as of Python 2.2.2 (reported as SF bug [ 737947 ]).
1887 but exists as of Python 2.2.2 (reported as SF bug [ 737947 ]).
1888 \layout Itemize
1888 \layout Itemize
1889
1889
1890 The (X)Emacs support is maintained by Alexander Schmolck, so all comments/reques
1890 The (X)Emacs support is maintained by Alexander Schmolck, so all comments/reques
1891 ts should be directed to him through the IPython mailing lists.
1891 ts should be directed to him through the IPython mailing lists.
1892
1892
1893 \layout Itemize
1893 \layout Itemize
1894
1894
1895 This code is still somewhat experimental so it's a bit rough around the
1895 This code is still somewhat experimental so it's a bit rough around the
1896 edges (although in practice, it works quite well).
1896 edges (although in practice, it works quite well).
1897 \layout Itemize
1897 \layout Itemize
1898
1898
1899 Be aware that if you customize
1899 Be aware that if you customize
1900 \family typewriter
1900 \family typewriter
1901 py-python-command
1901 py-python-command
1902 \family default
1902 \family default
1903 previously, this value will override what
1903 previously, this value will override what
1904 \family typewriter
1904 \family typewriter
1905 ipython.el
1905 ipython.el
1906 \family default
1906 \family default
1907 does (because loading the customization variables comes later).
1907 does (because loading the customization variables comes later).
1908 \layout Section
1908 \layout Section
1909
1909
1910
1910
1911 \begin_inset LatexCommand \label{sec:quick_tips}
1911 \begin_inset LatexCommand \label{sec:quick_tips}
1912
1912
1913 \end_inset
1913 \end_inset
1914
1914
1915 Quick tips
1915 Quick tips
1916 \layout Standard
1916 \layout Standard
1917
1917
1918 IPython can be used as an improved replacement for the Python prompt, and
1918 IPython can be used as an improved replacement for the Python prompt, and
1919 for that you don't really need to read any more of this manual.
1919 for that you don't really need to read any more of this manual.
1920 But in this section we'll try to summarize a few tips on how to make the
1920 But in this section we'll try to summarize a few tips on how to make the
1921 most effective use of it for everyday Python development, highlighting
1921 most effective use of it for everyday Python development, highlighting
1922 things you might miss in the rest of the manual (which is getting long).
1922 things you might miss in the rest of the manual (which is getting long).
1923 We'll give references to parts in the manual which provide more detail
1923 We'll give references to parts in the manual which provide more detail
1924 when appropriate.
1924 when appropriate.
1925 \layout Standard
1925 \layout Standard
1926
1926
1927 The following article by Jeremy Jones provides an introductory tutorial
1927 The following article by Jeremy Jones provides an introductory tutorial
1928 about IPython:
1928 about IPython:
1929 \newline
1929 \newline
1930
1930
1931 \begin_inset LatexCommand \htmlurl{http://www.onlamp.com/pub/a/python/2005/01/27/ipython.html}
1931 \begin_inset LatexCommand \htmlurl{http://www.onlamp.com/pub/a/python/2005/01/27/ipython.html}
1932
1932
1933 \end_inset
1933 \end_inset
1934
1934
1935
1935
1936 \layout Itemize
1936 \layout Itemize
1937
1937
1938 The TAB key.
1938 The TAB key.
1939 TAB-completion, especially for attributes, is a convenient way to explore
1939 TAB-completion, especially for attributes, is a convenient way to explore
1940 the structure of any object you're dealing with.
1940 the structure of any object you're dealing with.
1941 Simply type
1941 Simply type
1942 \family typewriter
1942 \family typewriter
1943 object_name.<TAB>
1943 object_name.<TAB>
1944 \family default
1944 \family default
1945 and a list of the object's attributes will be printed (see sec.
1945 and a list of the object's attributes will be printed (see sec.
1946
1946
1947 \begin_inset LatexCommand \ref{sec:readline}
1947 \begin_inset LatexCommand \ref{sec:readline}
1948
1948
1949 \end_inset
1949 \end_inset
1950
1950
1951 for more).
1951 for more).
1952 Tab completion also works on file and directory names, which combined with
1952 Tab completion also works on file and directory names, which combined with
1953 IPython's alias system allows you to do from within IPython many of the
1953 IPython's alias system allows you to do from within IPython many of the
1954 things you normally would need the system shell for.
1954 things you normally would need the system shell for.
1955
1955
1956 \layout Itemize
1956 \layout Itemize
1957
1957
1958 Explore your objects.
1958 Explore your objects.
1959 Typing
1959 Typing
1960 \family typewriter
1960 \family typewriter
1961 object_name?
1961 object_name?
1962 \family default
1962 \family default
1963 will print all sorts of details about any object, including docstrings,
1963 will print all sorts of details about any object, including docstrings,
1964 function definition lines (for call arguments) and constructor details
1964 function definition lines (for call arguments) and constructor details
1965 for classes.
1965 for classes.
1966 The magic commands
1966 The magic commands
1967 \family typewriter
1967 \family typewriter
1968 %pdoc
1968 %pdoc
1969 \family default
1969 \family default
1970 ,
1970 ,
1971 \family typewriter
1971 \family typewriter
1972 %pdef
1972 %pdef
1973 \family default
1973 \family default
1974 ,
1974 ,
1975 \family typewriter
1975 \family typewriter
1976 %psource
1976 %psource
1977 \family default
1977 \family default
1978 and
1978 and
1979 \family typewriter
1979 \family typewriter
1980 %pfile
1980 %pfile
1981 \family default
1981 \family default
1982 will respectively print the docstring, function definition line, full source
1982 will respectively print the docstring, function definition line, full source
1983 code and the complete file for any object (when they can be found).
1983 code and the complete file for any object (when they can be found).
1984 If automagic is on (it is by default), you don't need to type the '
1984 If automagic is on (it is by default), you don't need to type the '
1985 \family typewriter
1985 \family typewriter
1986 %
1986 %
1987 \family default
1987 \family default
1988 ' explicitly.
1988 ' explicitly.
1989 See sec.
1989 See sec.
1990
1990
1991 \begin_inset LatexCommand \ref{sec:dyn-object-info}
1991 \begin_inset LatexCommand \ref{sec:dyn-object-info}
1992
1992
1993 \end_inset
1993 \end_inset
1994
1994
1995 for more.
1995 for more.
1996 \layout Itemize
1996 \layout Itemize
1997
1997
1998 The
1998 The
1999 \family typewriter
1999 \family typewriter
2000 %run
2000 %run
2001 \family default
2001 \family default
2002 magic command allows you to run any python script and load all of its data
2002 magic command allows you to run any python script and load all of its data
2003 directly into the interactive namespace.
2003 directly into the interactive namespace.
2004 Since the file is re-read from disk each time, changes you make to it are
2004 Since the file is re-read from disk each time, changes you make to it are
2005 reflected immediately (in contrast to the behavior of
2005 reflected immediately (in contrast to the behavior of
2006 \family typewriter
2006 \family typewriter
2007 import
2007 import
2008 \family default
2008 \family default
2009 ).
2009 ).
2010 I rarely use
2010 I rarely use
2011 \family typewriter
2011 \family typewriter
2012 import
2012 import
2013 \family default
2013 \family default
2014 for code I am testing, relying on
2014 for code I am testing, relying on
2015 \family typewriter
2015 \family typewriter
2016 %run
2016 %run
2017 \family default
2017 \family default
2018 instead.
2018 instead.
2019 See sec.
2019 See sec.
2020
2020
2021 \begin_inset LatexCommand \ref{sec:magic}
2021 \begin_inset LatexCommand \ref{sec:magic}
2022
2022
2023 \end_inset
2023 \end_inset
2024
2024
2025 for more on this and other magic commands, or type the name of any magic
2025 for more on this and other magic commands, or type the name of any magic
2026 command and ? to get details on it.
2026 command and ? to get details on it.
2027 See also sec.
2027 See also sec.
2028
2028
2029 \begin_inset LatexCommand \ref{sec:dreload}
2029 \begin_inset LatexCommand \ref{sec:dreload}
2030
2030
2031 \end_inset
2031 \end_inset
2032
2032
2033 for a recursive reload command.
2033 for a recursive reload command.
2034 \newline
2034 \newline
2035
2035
2036 \family typewriter
2036 \family typewriter
2037 %run
2037 %run
2038 \family default
2038 \family default
2039 also has special flags for timing the execution of your scripts (
2039 also has special flags for timing the execution of your scripts (
2040 \family typewriter
2040 \family typewriter
2041 -t
2041 -t
2042 \family default
2042 \family default
2043 ) and for executing them under the control of either Python's
2043 ) and for executing them under the control of either Python's
2044 \family typewriter
2044 \family typewriter
2045 pdb
2045 pdb
2046 \family default
2046 \family default
2047 debugger (
2047 debugger (
2048 \family typewriter
2048 \family typewriter
2049 -d
2049 -d
2050 \family default
2050 \family default
2051 ) or profiler (
2051 ) or profiler (
2052 \family typewriter
2052 \family typewriter
2053 -p
2053 -p
2054 \family default
2054 \family default
2055 ).
2055 ).
2056 With all of these,
2056 With all of these,
2057 \family typewriter
2057 \family typewriter
2058 %run
2058 %run
2059 \family default
2059 \family default
2060 can be used as the main tool for efficient interactive development of code
2060 can be used as the main tool for efficient interactive development of code
2061 which you write in your editor of choice.
2061 which you write in your editor of choice.
2062 \layout Itemize
2062 \layout Itemize
2063
2063
2064 Use the Python debugger,
2064 Use the Python debugger,
2065 \family typewriter
2065 \family typewriter
2066 pdb
2066 pdb
2067 \family default
2067 \family default
2068
2068
2069 \begin_inset Foot
2069 \begin_inset Foot
2070 collapsed true
2070 collapsed true
2071
2071
2072 \layout Standard
2072 \layout Standard
2073
2073
2074 Thanks to Christian Hart and Matthew Arnison for the suggestions leading
2074 Thanks to Christian Hart and Matthew Arnison for the suggestions leading
2075 to IPython's improved debugger and profiler support.
2075 to IPython's improved debugger and profiler support.
2076 \end_inset
2076 \end_inset
2077
2077
2078 .
2078 .
2079 The
2079 The
2080 \family typewriter
2080 \family typewriter
2081 %pdb
2081 %pdb
2082 \family default
2082 \family default
2083 command allows you to toggle on and off the automatic invocation of an
2083 command allows you to toggle on and off the automatic invocation of an
2084 IPython-enhanced
2084 IPython-enhanced
2085 \family typewriter
2085 \family typewriter
2086 pdb
2086 pdb
2087 \family default
2087 \family default
2088 debugger (with coloring, tab completion and more) at any uncaught exception.
2088 debugger (with coloring, tab completion and more) at any uncaught exception.
2089 The advantage of this is that
2089 The advantage of this is that
2090 \family typewriter
2090 \family typewriter
2091 pdb
2091 pdb
2092 \family default
2092 \family default
2093 starts
2093 starts
2094 \emph on
2094 \emph on
2095 inside
2095 inside
2096 \emph default
2096 \emph default
2097 the function where the exception occurred, with all data still available.
2097 the function where the exception occurred, with all data still available.
2098 You can print variables, see code, execute statements and even walk up
2098 You can print variables, see code, execute statements and even walk up
2099 and down the call stack to track down the true source of the problem (which
2099 and down the call stack to track down the true source of the problem (which
2100 often is many layers in the stack above where the exception gets triggered).
2100 often is many layers in the stack above where the exception gets triggered).
2101 \newline
2101 \newline
2102 Running programs with
2102 Running programs with
2103 \family typewriter
2103 \family typewriter
2104 %run
2104 %run
2105 \family default
2105 \family default
2106 and pdb active can be an efficient to develop and debug code, in many cases
2106 and pdb active can be an efficient to develop and debug code, in many cases
2107 eliminating the need for
2107 eliminating the need for
2108 \family typewriter
2108 \family typewriter
2109 print
2109 print
2110 \family default
2110 \family default
2111 statements or external debugging tools.
2111 statements or external debugging tools.
2112 I often simply put a
2112 I often simply put a
2113 \family typewriter
2113 \family typewriter
2114 1/0
2114 1/0
2115 \family default
2115 \family default
2116 in a place where I want to take a look so that pdb gets called, quickly
2116 in a place where I want to take a look so that pdb gets called, quickly
2117 view whatever variables I need to or test various pieces of code and then
2117 view whatever variables I need to or test various pieces of code and then
2118 remove the
2118 remove the
2119 \family typewriter
2119 \family typewriter
2120 1/0
2120 1/0
2121 \family default
2121 \family default
2122 .
2122 .
2123 \newline
2123 \newline
2124 Note also that `
2124 Note also that `
2125 \family typewriter
2125 \family typewriter
2126 %run -d
2126 %run -d
2127 \family default
2127 \family default
2128 ' activates
2128 ' activates
2129 \family typewriter
2129 \family typewriter
2130 pdb
2130 pdb
2131 \family default
2131 \family default
2132 and automatically sets initial breakpoints for you to step through your
2132 and automatically sets initial breakpoints for you to step through your
2133 code, watch variables, etc.
2133 code, watch variables, etc.
2134 See Sec.\SpecialChar ~
2134 See Sec.\SpecialChar ~
2135
2135
2136 \begin_inset LatexCommand \ref{sec:cache_output}
2136 \begin_inset LatexCommand \ref{sec:cache_output}
2137
2137
2138 \end_inset
2138 \end_inset
2139
2139
2140 for details.
2140 for details.
2141 \layout Itemize
2141 \layout Itemize
2142
2142
2143 Use the output cache.
2143 Use the output cache.
2144 All output results are automatically stored in a global dictionary named
2144 All output results are automatically stored in a global dictionary named
2145
2145
2146 \family typewriter
2146 \family typewriter
2147 Out
2147 Out
2148 \family default
2148 \family default
2149 and variables named
2149 and variables named
2150 \family typewriter
2150 \family typewriter
2151 _1
2151 _1
2152 \family default
2152 \family default
2153 ,
2153 ,
2154 \family typewriter
2154 \family typewriter
2155 _2
2155 _2
2156 \family default
2156 \family default
2157 , etc.
2157 , etc.
2158 alias them.
2158 alias them.
2159 For example, the result of input line 4 is available either as
2159 For example, the result of input line 4 is available either as
2160 \family typewriter
2160 \family typewriter
2161 Out[4]
2161 Out[4]
2162 \family default
2162 \family default
2163 or as
2163 or as
2164 \family typewriter
2164 \family typewriter
2165 _4
2165 _4
2166 \family default
2166 \family default
2167 .
2167 .
2168 Additionally, three variables named
2168 Additionally, three variables named
2169 \family typewriter
2169 \family typewriter
2170 _
2170 _
2171 \family default
2171 \family default
2172 ,
2172 ,
2173 \family typewriter
2173 \family typewriter
2174 __
2174 __
2175 \family default
2175 \family default
2176 and
2176 and
2177 \family typewriter
2177 \family typewriter
2178 ___
2178 ___
2179 \family default
2179 \family default
2180 are always kept updated with the for the last three results.
2180 are always kept updated with the for the last three results.
2181 This allows you to recall any previous result and further use it for new
2181 This allows you to recall any previous result and further use it for new
2182 calculations.
2182 calculations.
2183 See Sec.\SpecialChar ~
2183 See Sec.\SpecialChar ~
2184
2184
2185 \begin_inset LatexCommand \ref{sec:cache_output}
2185 \begin_inset LatexCommand \ref{sec:cache_output}
2186
2186
2187 \end_inset
2187 \end_inset
2188
2188
2189 for more.
2189 for more.
2190 \layout Itemize
2190 \layout Itemize
2191
2191
2192 Put a '
2192 Put a '
2193 \family typewriter
2193 \family typewriter
2194 ;
2194 ;
2195 \family default
2195 \family default
2196 ' at the end of a line to supress the printing of output.
2196 ' at the end of a line to supress the printing of output.
2197 This is useful when doing calculations which generate long output you are
2197 This is useful when doing calculations which generate long output you are
2198 not interested in seeing.
2198 not interested in seeing.
2199 The
2199 The
2200 \family typewriter
2200 \family typewriter
2201 _*
2201 _*
2202 \family default
2202 \family default
2203 variables and the
2203 variables and the
2204 \family typewriter
2204 \family typewriter
2205 Out[]
2205 Out[]
2206 \family default
2206 \family default
2207 list do get updated with the contents of the output, even if it is not
2207 list do get updated with the contents of the output, even if it is not
2208 printed.
2208 printed.
2209 You can thus still access the generated results this way for further processing.
2209 You can thus still access the generated results this way for further processing.
2210 \layout Itemize
2210 \layout Itemize
2211
2211
2212 A similar system exists for caching input.
2212 A similar system exists for caching input.
2213 All input is stored in a global list called
2213 All input is stored in a global list called
2214 \family typewriter
2214 \family typewriter
2215 In
2215 In
2216 \family default
2216 \family default
2217 , so you can re-execute lines 22 through 28 plus line 34 by typing
2217 , so you can re-execute lines 22 through 28 plus line 34 by typing
2218 \family typewriter
2218 \family typewriter
2219 'exec In[22:29]+In[34]'
2219 'exec In[22:29]+In[34]'
2220 \family default
2220 \family default
2221 (using Python slicing notation).
2221 (using Python slicing notation).
2222 If you need to execute the same set of lines often, you can assign them
2222 If you need to execute the same set of lines often, you can assign them
2223 to a macro with the
2223 to a macro with the
2224 \family typewriter
2224 \family typewriter
2225 %macro
2225 %macro
2226 \family default
2226 \family default
2227
2227
2228 \family typewriter
2228 \family typewriter
2229 function.
2229 function.
2230
2230
2231 \family default
2231 \family default
2232 See sec.
2232 See sec.
2233
2233
2234 \begin_inset LatexCommand \ref{sec:cache_input}
2234 \begin_inset LatexCommand \ref{sec:cache_input}
2235
2235
2236 \end_inset
2236 \end_inset
2237
2237
2238 for more.
2238 for more.
2239 \layout Itemize
2239 \layout Itemize
2240
2240
2241 Use your input history.
2241 Use your input history.
2242 The
2242 The
2243 \family typewriter
2243 \family typewriter
2244 %hist
2244 %hist
2245 \family default
2245 \family default
2246 command can show you all previous input, without line numbers if desired
2246 command can show you all previous input, without line numbers if desired
2247 (option
2247 (option
2248 \family typewriter
2248 \family typewriter
2249 -n
2249 -n
2250 \family default
2250 \family default
2251 ) so you can directly copy and paste code either back in IPython or in a
2251 ) so you can directly copy and paste code either back in IPython or in a
2252 text editor.
2252 text editor.
2253 You can also save all your history by turning on logging via
2253 You can also save all your history by turning on logging via
2254 \family typewriter
2254 \family typewriter
2255 %logstart
2255 %logstart
2256 \family default
2256 \family default
2257 ; these logs can later be either reloaded as IPython sessions or used as
2257 ; these logs can later be either reloaded as IPython sessions or used as
2258 code for your programs.
2258 code for your programs.
2259 \layout Itemize
2259 \layout Itemize
2260
2260
2261 Define your own system aliases.
2261 Define your own system aliases.
2262 Even though IPython gives you access to your system shell via the
2262 Even though IPython gives you access to your system shell via the
2263 \family typewriter
2263 \family typewriter
2264 !
2264 !
2265 \family default
2265 \family default
2266 prefix, it is convenient to have aliases to the system commands you use
2266 prefix, it is convenient to have aliases to the system commands you use
2267 most often.
2267 most often.
2268 This allows you to work seamlessly from inside IPython with the same commands
2268 This allows you to work seamlessly from inside IPython with the same commands
2269 you are used to in your system shell.
2269 you are used to in your system shell.
2270 \newline
2270 \newline
2271 IPython comes with some pre-defined aliases and a complete system for changing
2271 IPython comes with some pre-defined aliases and a complete system for changing
2272 directories, both via a stack (see
2272 directories, both via a stack (see
2273 \family typewriter
2273 \family typewriter
2274 %pushd
2274 %pushd
2275 \family default
2275 \family default
2276 ,
2276 ,
2277 \family typewriter
2277 \family typewriter
2278 %popd
2278 %popd
2279 \family default
2279 \family default
2280 and
2280 and
2281 \family typewriter
2281 \family typewriter
2282 %ds
2282 %ds
2283 \family default
2283 \family default
2284 ) and via direct
2284 ) and via direct
2285 \family typewriter
2285 \family typewriter
2286 %cd
2286 %cd
2287 \family default
2287 \family default
2288 .
2288 .
2289 The latter keeps a history of visited directories and allows you to go
2289 The latter keeps a history of visited directories and allows you to go
2290 to any previously visited one.
2290 to any previously visited one.
2291 \layout Itemize
2291 \layout Itemize
2292
2292
2293 Use Python to manipulate the results of system commands.
2293 Use Python to manipulate the results of system commands.
2294 The `
2294 The `
2295 \family typewriter
2295 \family typewriter
2296 !!
2296 !!
2297 \family default
2297 \family default
2298 ' special syntax, and the
2298 ' special syntax, and the
2299 \family typewriter
2299 \family typewriter
2300 %sc
2300 %sc
2301 \family default
2301 \family default
2302 and
2302 and
2303 \family typewriter
2303 \family typewriter
2304 %sx
2304 %sx
2305 \family default
2305 \family default
2306 magic commands allow you to capture system output into Python variables.
2306 magic commands allow you to capture system output into Python variables.
2307 \layout Itemize
2307 \layout Itemize
2308
2308
2309 Expand python variables when calling the shell (either via
2309 Expand python variables when calling the shell (either via
2310 \family typewriter
2310 \family typewriter
2311 `!'
2311 `!'
2312 \family default
2312 \family default
2313 and
2313 and
2314 \family typewriter
2314 \family typewriter
2315 `!!'
2315 `!!'
2316 \family default
2316 \family default
2317 or via aliases) by prepending a
2317 or via aliases) by prepending a
2318 \family typewriter
2318 \family typewriter
2319 $
2319 $
2320 \family default
2320 \family default
2321 in front of them.
2321 in front of them.
2322 You can also expand complete python expressions.
2322 You can also expand complete python expressions.
2323 See sec.\SpecialChar ~
2323 See sec.\SpecialChar ~
2324
2324
2325 \begin_inset LatexCommand \ref{sub:System-shell-access}
2325 \begin_inset LatexCommand \ref{sub:System-shell-access}
2326
2326
2327 \end_inset
2327 \end_inset
2328
2328
2329 for more.
2329 for more.
2330 \layout Itemize
2330 \layout Itemize
2331
2331
2332 Use profiles to maintain different configurations (modules to load, function
2332 Use profiles to maintain different configurations (modules to load, function
2333 definitions, option settings) for particular tasks.
2333 definitions, option settings) for particular tasks.
2334 You can then have customized versions of IPython for specific purposes.
2334 You can then have customized versions of IPython for specific purposes.
2335 See sec.\SpecialChar ~
2335 See sec.\SpecialChar ~
2336
2336
2337 \begin_inset LatexCommand \ref{sec:profiles}
2337 \begin_inset LatexCommand \ref{sec:profiles}
2338
2338
2339 \end_inset
2339 \end_inset
2340
2340
2341 for more.
2341 for more.
2342 \layout Itemize
2342 \layout Itemize
2343
2343
2344 Embed IPython in your programs.
2344 Embed IPython in your programs.
2345 A few lines of code are enough to load a complete IPython inside your own
2345 A few lines of code are enough to load a complete IPython inside your own
2346 programs, giving you the ability to work with your data interactively after
2346 programs, giving you the ability to work with your data interactively after
2347 automatic processing has been completed.
2347 automatic processing has been completed.
2348 See sec.\SpecialChar ~
2348 See sec.\SpecialChar ~
2349
2349
2350 \begin_inset LatexCommand \ref{sec:embed}
2350 \begin_inset LatexCommand \ref{sec:embed}
2351
2351
2352 \end_inset
2352 \end_inset
2353
2353
2354 for more.
2354 for more.
2355 \layout Itemize
2355 \layout Itemize
2356
2356
2357 Use the Python profiler.
2357 Use the Python profiler.
2358 When dealing with performance issues, the
2358 When dealing with performance issues, the
2359 \family typewriter
2359 \family typewriter
2360 %run
2360 %run
2361 \family default
2361 \family default
2362 command with a
2362 command with a
2363 \family typewriter
2363 \family typewriter
2364 -p
2364 -p
2365 \family default
2365 \family default
2366 option allows you to run complete programs under the control of the Python
2366 option allows you to run complete programs under the control of the Python
2367 profiler.
2367 profiler.
2368 The
2368 The
2369 \family typewriter
2369 \family typewriter
2370 %prun
2370 %prun
2371 \family default
2371 \family default
2372 command does a similar job for single Python expressions (like function
2372 command does a similar job for single Python expressions (like function
2373 calls).
2373 calls).
2374 \layout Itemize
2374 \layout Itemize
2375
2375
2376 Use the IPython.demo.Demo class to load any Python script as an interactive
2376 Use the IPython.demo.Demo class to load any Python script as an interactive
2377 demo.
2377 demo.
2378 With a minimal amount of simple markup, you can control the execution of
2378 With a minimal amount of simple markup, you can control the execution of
2379 the script, stopping as needed.
2379 the script, stopping as needed.
2380 See sec.\SpecialChar ~
2380 See sec.\SpecialChar ~
2381
2381
2382 \begin_inset LatexCommand \ref{sec:interactive-demos}
2382 \begin_inset LatexCommand \ref{sec:interactive-demos}
2383
2383
2384 \end_inset
2384 \end_inset
2385
2385
2386 for more.
2386 for more.
2387 \layout Subsection
2387 \layout Subsection
2388
2388
2389 Source code handling tips
2389 Source code handling tips
2390 \layout Standard
2390 \layout Standard
2391
2391
2392 IPython is a line-oriented program, without full control of the terminal.
2392 IPython is a line-oriented program, without full control of the terminal.
2393 Therefore, it doesn't support true multiline editing.
2393 Therefore, it doesn't support true multiline editing.
2394 However, it has a number of useful tools to help you in dealing effectively
2394 However, it has a number of useful tools to help you in dealing effectively
2395 with more complex editing.
2395 with more complex editing.
2396 \layout Standard
2396 \layout Standard
2397
2397
2398 The
2398 The
2399 \family typewriter
2399 \family typewriter
2400 %edit
2400 %edit
2401 \family default
2401 \family default
2402 command gives a reasonable approximation of multiline editing, by invoking
2402 command gives a reasonable approximation of multiline editing, by invoking
2403 your favorite editor on the spot.
2403 your favorite editor on the spot.
2404 IPython will execute the code you type in there as if it were typed interactive
2404 IPython will execute the code you type in there as if it were typed interactive
2405 ly.
2405 ly.
2406 Type
2406 Type
2407 \family typewriter
2407 \family typewriter
2408 %edit?
2408 %edit?
2409 \family default
2409 \family default
2410 for the full details on the edit command.
2410 for the full details on the edit command.
2411 \layout Standard
2411 \layout Standard
2412
2412
2413 If you have typed various commands during a session, which you'd like to
2413 If you have typed various commands during a session, which you'd like to
2414 reuse, IPython provides you with a number of tools.
2414 reuse, IPython provides you with a number of tools.
2415 Start by using
2415 Start by using
2416 \family typewriter
2416 \family typewriter
2417 %hist
2417 %hist
2418 \family default
2418 \family default
2419 to see your input history, so you can see the line numbers of all input.
2419 to see your input history, so you can see the line numbers of all input.
2420 Let us say that you'd like to reuse lines 10 through 20, plus lines 24
2420 Let us say that you'd like to reuse lines 10 through 20, plus lines 24
2421 and 28.
2421 and 28.
2422 All the commands below can operate on these with the syntax
2422 All the commands below can operate on these with the syntax
2423 \layout LyX-Code
2423 \layout LyX-Code
2424
2424
2425 %command 10-20 24 28
2425 %command 10-20 24 28
2426 \layout Standard
2426 \layout Standard
2427
2427
2428 where the command given can be:
2428 where the command given can be:
2429 \layout Itemize
2429 \layout Itemize
2430
2430
2431
2431
2432 \family typewriter
2432 \family typewriter
2433 %macro <macroname>
2433 %macro <macroname>
2434 \family default
2434 \family default
2435 : this stores the lines into a variable which, when called at the prompt,
2435 : this stores the lines into a variable which, when called at the prompt,
2436 re-executes the input.
2436 re-executes the input.
2437 Macros can be edited later using
2437 Macros can be edited later using
2438 \family typewriter
2438 \family typewriter
2439 `%edit macroname
2439 `%edit macroname
2440 \family default
2440 \family default
2441 ', and they can be stored persistently across sessions with `
2441 ', and they can be stored persistently across sessions with `
2442 \family typewriter
2442 \family typewriter
2443 %store macroname
2443 %store macroname
2444 \family default
2444 \family default
2445 ' (the storage system is per-profile).
2445 ' (the storage system is per-profile).
2446 The combination of quick macros, persistent storage and editing, allows
2446 The combination of quick macros, persistent storage and editing, allows
2447 you to easily refine quick-and-dirty interactive input into permanent utilities
2447 you to easily refine quick-and-dirty interactive input into permanent utilities
2448 , always available both in IPython and as files for general reuse.
2448 , always available both in IPython and as files for general reuse.
2449 \layout Itemize
2449 \layout Itemize
2450
2450
2451
2451
2452 \family typewriter
2452 \family typewriter
2453 %edit
2453 %edit
2454 \family default
2454 \family default
2455 : this will open a text editor with those lines pre-loaded for further modificat
2455 : this will open a text editor with those lines pre-loaded for further modificat
2456 ion.
2456 ion.
2457 It will then execute the resulting file's contents as if you had typed
2457 It will then execute the resulting file's contents as if you had typed
2458 it at the prompt.
2458 it at the prompt.
2459 \layout Itemize
2459 \layout Itemize
2460
2460
2461
2461
2462 \family typewriter
2462 \family typewriter
2463 %save <filename>
2463 %save <filename>
2464 \family default
2464 \family default
2465 : this saves the lines directly to a named file on disk.
2465 : this saves the lines directly to a named file on disk.
2466 \layout Standard
2466 \layout Standard
2467
2467
2468 While
2468 While
2469 \family typewriter
2469 \family typewriter
2470 %macro
2470 %macro
2471 \family default
2471 \family default
2472 saves input lines into memory for interactive re-execution, sometimes you'd
2472 saves input lines into memory for interactive re-execution, sometimes you'd
2473 like to save your input directly to a file.
2473 like to save your input directly to a file.
2474 The
2474 The
2475 \family typewriter
2475 \family typewriter
2476 %save
2476 %save
2477 \family default
2477 \family default
2478 magic does this: its input sytnax is the same as
2478 magic does this: its input sytnax is the same as
2479 \family typewriter
2479 \family typewriter
2480 %macro
2480 %macro
2481 \family default
2481 \family default
2482 , but it saves your input directly to a Python file.
2482 , but it saves your input directly to a Python file.
2483 Note that the
2483 Note that the
2484 \family typewriter
2484 \family typewriter
2485 %logstart
2485 %logstart
2486 \family default
2486 \family default
2487 command also saves input, but it logs
2487 command also saves input, but it logs
2488 \emph on
2488 \emph on
2489 all
2489 all
2490 \emph default
2490 \emph default
2491 input to disk (though you can temporarily suspend it and reactivate it
2491 input to disk (though you can temporarily suspend it and reactivate it
2492 with
2492 with
2493 \family typewriter
2493 \family typewriter
2494 %logoff/%logon
2494 %logoff/%logon
2495 \family default
2495 \family default
2496 );
2496 );
2497 \family typewriter
2497 \family typewriter
2498 %save
2498 %save
2499 \family default
2499 \family default
2500 allows you to select which lines of input you need to save.
2500 allows you to select which lines of input you need to save.
2501 \layout Subsubsection*
2501 \layout Subsubsection*
2502
2502
2503 Lightweight 'version control'
2503 Lightweight 'version control'
2504 \layout Standard
2504 \layout Standard
2505
2505
2506 When you call
2506 When you call
2507 \family typewriter
2507 \family typewriter
2508 %edit
2508 %edit
2509 \family default
2509 \family default
2510 with no arguments, IPython opens an empty editor with a temporary file,
2510 with no arguments, IPython opens an empty editor with a temporary file,
2511 and it returns the contents of your editing session as a string variable.
2511 and it returns the contents of your editing session as a string variable.
2512 Thanks to IPython's output caching mechanism, this is automatically stored:
2512 Thanks to IPython's output caching mechanism, this is automatically stored:
2513 \layout LyX-Code
2513 \layout LyX-Code
2514
2514
2515 In [1]: %edit
2515 In [1]: %edit
2516 \layout LyX-Code
2516 \layout LyX-Code
2517
2517
2518 IPython will make a temporary file named: /tmp/ipython_edit_yR-HCN.py
2518 IPython will make a temporary file named: /tmp/ipython_edit_yR-HCN.py
2519 \layout LyX-Code
2519 \layout LyX-Code
2520
2520
2521 Editing...
2521 Editing...
2522 done.
2522 done.
2523 Executing edited code...
2523 Executing edited code...
2524 \layout LyX-Code
2524 \layout LyX-Code
2525
2525
2526 hello - this is a temporary file
2526 hello - this is a temporary file
2527 \layout LyX-Code
2527 \layout LyX-Code
2528
2528
2529 Out[1]: "print 'hello - this is a temporary file'
2529 Out[1]: "print 'hello - this is a temporary file'
2530 \backslash
2530 \backslash
2531 n"
2531 n"
2532 \layout Standard
2532 \layout Standard
2533
2533
2534 Now, if you call
2534 Now, if you call
2535 \family typewriter
2535 \family typewriter
2536 `%edit -p'
2536 `%edit -p'
2537 \family default
2537 \family default
2538 , IPython tries to open an editor with the same data as the last time you
2538 , IPython tries to open an editor with the same data as the last time you
2539 used
2539 used
2540 \family typewriter
2540 \family typewriter
2541 %edit
2541 %edit
2542 \family default
2542 \family default
2543 .
2543 .
2544 So if you haven't used
2544 So if you haven't used
2545 \family typewriter
2545 \family typewriter
2546 %edit
2546 %edit
2547 \family default
2547 \family default
2548 in the meantime, this same contents will reopen; however, it will be done
2548 in the meantime, this same contents will reopen; however, it will be done
2549 in a
2549 in a
2550 \emph on
2550 \emph on
2551 new file
2551 new file
2552 \emph default
2552 \emph default
2553 .
2553 .
2554 This means that if you make changes and you later want to find an old version,
2554 This means that if you make changes and you later want to find an old version,
2555 you can always retrieve it by using its output number, via
2555 you can always retrieve it by using its output number, via
2556 \family typewriter
2556 \family typewriter
2557 `%edit _NN'
2557 `%edit _NN'
2558 \family default
2558 \family default
2559 , where
2559 , where
2560 \family typewriter
2560 \family typewriter
2561 NN
2561 NN
2562 \family default
2562 \family default
2563 is the number of the output prompt.
2563 is the number of the output prompt.
2564 \layout Standard
2564 \layout Standard
2565
2565
2566 Continuing with the example above, this should illustrate this idea:
2566 Continuing with the example above, this should illustrate this idea:
2567 \layout LyX-Code
2567 \layout LyX-Code
2568
2568
2569 In [2]: edit -p
2569 In [2]: edit -p
2570 \layout LyX-Code
2570 \layout LyX-Code
2571
2571
2572 IPython will make a temporary file named: /tmp/ipython_edit_nA09Qk.py
2572 IPython will make a temporary file named: /tmp/ipython_edit_nA09Qk.py
2573 \layout LyX-Code
2573 \layout LyX-Code
2574
2574
2575 Editing...
2575 Editing...
2576 done.
2576 done.
2577 Executing edited code...
2577 Executing edited code...
2578 \layout LyX-Code
2578 \layout LyX-Code
2579
2579
2580 hello - now I made some changes
2580 hello - now I made some changes
2581 \layout LyX-Code
2581 \layout LyX-Code
2582
2582
2583 Out[2]: "print 'hello - now I made some changes'
2583 Out[2]: "print 'hello - now I made some changes'
2584 \backslash
2584 \backslash
2585 n"
2585 n"
2586 \layout LyX-Code
2586 \layout LyX-Code
2587
2587
2588 In [3]: edit _1
2588 In [3]: edit _1
2589 \layout LyX-Code
2589 \layout LyX-Code
2590
2590
2591 IPython will make a temporary file named: /tmp/ipython_edit_gy6-zD.py
2591 IPython will make a temporary file named: /tmp/ipython_edit_gy6-zD.py
2592 \layout LyX-Code
2592 \layout LyX-Code
2593
2593
2594 Editing...
2594 Editing...
2595 done.
2595 done.
2596 Executing edited code...
2596 Executing edited code...
2597 \layout LyX-Code
2597 \layout LyX-Code
2598
2598
2599 hello - this is a temporary file
2599 hello - this is a temporary file
2600 \layout LyX-Code
2600 \layout LyX-Code
2601
2601
2602 IPython version control at work :)
2602 IPython version control at work :)
2603 \layout LyX-Code
2603 \layout LyX-Code
2604
2604
2605 Out[3]: "print 'hello - this is a temporary file'
2605 Out[3]: "print 'hello - this is a temporary file'
2606 \backslash
2606 \backslash
2607 nprint 'IPython version control at work :)'
2607 nprint 'IPython version control at work :)'
2608 \backslash
2608 \backslash
2609 n"
2609 n"
2610 \layout Standard
2610 \layout Standard
2611
2611
2612 This section was written after a contribution by Alexander Belchenko on
2612 This section was written after a contribution by Alexander Belchenko on
2613 the IPython user list.
2613 the IPython user list.
2614 \layout LyX-Code
2614 \layout LyX-Code
2615
2615
2616 \layout Subsection
2616 \layout Subsection
2617
2617
2618 Effective logging
2618 Effective logging
2619 \layout Standard
2619 \layout Standard
2620
2620
2621 A very useful suggestion sent in by Robert Kern follows:
2621 A very useful suggestion sent in by Robert Kern follows:
2622 \layout Standard
2622 \layout Standard
2623
2623
2624 I recently happened on a nifty way to keep tidy per-project log files.
2624 I recently happened on a nifty way to keep tidy per-project log files.
2625 I made a profile for my project (which is called "parkfield").
2625 I made a profile for my project (which is called "parkfield").
2626 \layout LyX-Code
2626 \layout LyX-Code
2627
2627
2628 include ipythonrc
2628 include ipythonrc
2629 \layout LyX-Code
2629 \layout LyX-Code
2630
2630
2631 # cancel earlier logfile invocation:
2631 # cancel earlier logfile invocation:
2632 \layout LyX-Code
2632 \layout LyX-Code
2633
2633
2634 logfile ''
2634 logfile ''
2635 \layout LyX-Code
2635 \layout LyX-Code
2636
2636
2637 execute import time
2637 execute import time
2638 \layout LyX-Code
2638 \layout LyX-Code
2639
2639
2640 execute __cmd = '/Users/kern/research/logfiles/parkfield-%s.log rotate'
2640 execute __cmd = '/Users/kern/research/logfiles/parkfield-%s.log rotate'
2641 \layout LyX-Code
2641 \layout LyX-Code
2642
2642
2643 execute __IP.magic_logstart(__cmd % time.strftime('%Y-%m-%d'))
2643 execute __IP.magic_logstart(__cmd % time.strftime('%Y-%m-%d'))
2644 \layout Standard
2644 \layout Standard
2645
2645
2646 I also added a shell alias for convenience:
2646 I also added a shell alias for convenience:
2647 \layout LyX-Code
2647 \layout LyX-Code
2648
2648
2649 alias parkfield="ipython -pylab -profile parkfield"
2649 alias parkfield="ipython -pylab -profile parkfield"
2650 \layout Standard
2650 \layout Standard
2651
2651
2652 Now I have a nice little directory with everything I ever type in, organized
2652 Now I have a nice little directory with everything I ever type in, organized
2653 by project and date.
2653 by project and date.
2654 \layout Standard
2654 \layout Standard
2655
2655
2656
2656
2657 \series bold
2657 \series bold
2658 Contribute your own:
2658 Contribute your own:
2659 \series default
2659 \series default
2660 If you have your own favorite tip on using IPython efficiently for a certain
2660 If you have your own favorite tip on using IPython efficiently for a certain
2661 task (especially things which can't be done in the normal Python interpreter),
2661 task (especially things which can't be done in the normal Python interpreter),
2662 don't hesitate to send it!
2662 don't hesitate to send it!
2663 \layout Section
2663 \layout Section
2664
2664
2665 Command-line use
2665 Command-line use
2666 \layout Standard
2666 \layout Standard
2667
2667
2668 You start IPython with the command:
2668 You start IPython with the command:
2669 \layout Standard
2669 \layout Standard
2670
2670
2671
2671
2672 \family typewriter
2672 \family typewriter
2673 $ ipython [options] files
2673 $ ipython [options] files
2674 \layout Standard
2674 \layout Standard
2675
2675
2676 If invoked with no options, it executes all the files listed in sequence
2676 If invoked with no options, it executes all the files listed in sequence
2677 and drops you into the interpreter while still acknowledging any options
2677 and drops you into the interpreter while still acknowledging any options
2678 you may have set in your ipythonrc file.
2678 you may have set in your ipythonrc file.
2679 This behavior is different from standard Python, which when called as
2679 This behavior is different from standard Python, which when called as
2680 \family typewriter
2680 \family typewriter
2681 python -i
2681 python -i
2682 \family default
2682 \family default
2683 will only execute one file and ignore your configuration setup.
2683 will only execute one file and ignore your configuration setup.
2684 \layout Standard
2684 \layout Standard
2685
2685
2686 Please note that some of the configuration options are not available at
2686 Please note that some of the configuration options are not available at
2687 the command line, simply because they are not practical here.
2687 the command line, simply because they are not practical here.
2688 Look into your ipythonrc configuration file for details on those.
2688 Look into your ipythonrc configuration file for details on those.
2689 This file typically installed in the
2689 This file typically installed in the
2690 \family typewriter
2690 \family typewriter
2691 $HOME/.ipython
2691 $HOME/.ipython
2692 \family default
2692 \family default
2693 directory.
2693 directory.
2694 For Windows users,
2694 For Windows users,
2695 \family typewriter
2695 \family typewriter
2696 $HOME
2696 $HOME
2697 \family default
2697 \family default
2698 resolves to
2698 resolves to
2699 \family typewriter
2699 \family typewriter
2700 C:
2700 C:
2701 \backslash
2701 \backslash
2702
2702
2703 \backslash
2703 \backslash
2704 Documents and Settings
2704 Documents and Settings
2705 \backslash
2705 \backslash
2706
2706
2707 \backslash
2707 \backslash
2708 YourUserName
2708 YourUserName
2709 \family default
2709 \family default
2710 in most instances.
2710 in most instances.
2711 In the rest of this text, we will refer to this directory as
2711 In the rest of this text, we will refer to this directory as
2712 \family typewriter
2712 \family typewriter
2713 IPYTHONDIR
2713 IPYTHONDIR
2714 \family default
2714 \family default
2715 .
2715 .
2716 \layout Subsection
2716 \layout Subsection
2717
2717
2718
2718
2719 \begin_inset LatexCommand \label{sec:threading-opts}
2719 \begin_inset LatexCommand \label{sec:threading-opts}
2720
2720
2721 \end_inset
2721 \end_inset
2722
2722
2723 Special Threading Options
2723 Special Threading Options
2724 \layout Standard
2724 \layout Standard
2725
2725
2726 The following special options are ONLY valid at the beginning of the command
2726 The following special options are ONLY valid at the beginning of the command
2727 line, and not later.
2727 line, and not later.
2728 This is because they control the initial- ization of ipython itself, before
2728 This is because they control the initial- ization of ipython itself, before
2729 the normal option-handling mechanism is active.
2729 the normal option-handling mechanism is active.
2730 \layout List
2730 \layout List
2731 \labelwidthstring 00.00.0000
2731 \labelwidthstring 00.00.0000
2732
2732
2733
2733
2734 \family typewriter
2734 \family typewriter
2735 \series bold
2735 \series bold
2736 -gthread,\SpecialChar ~
2736 -gthread,\SpecialChar ~
2737 -qthread,\SpecialChar ~
2737 -qthread,\SpecialChar ~
2738 -wthread,\SpecialChar ~
2738 -wthread,\SpecialChar ~
2739 -pylab:
2739 -pylab:
2740 \family default
2740 \family default
2741 \series default
2741 \series default
2742 Only
2742 Only
2743 \emph on
2743 \emph on
2744 one
2744 one
2745 \emph default
2745 \emph default
2746 of these can be given, and it can only be given as the first option passed
2746 of these can be given, and it can only be given as the first option passed
2747 to IPython (it will have no effect in any other position).
2747 to IPython (it will have no effect in any other position).
2748 They provide threading support for the GTK Qt and WXPython toolkits, and
2748 They provide threading support for the GTK Qt and WXPython toolkits, and
2749 for the matplotlib library.
2749 for the matplotlib library.
2750 \layout List
2750 \layout List
2751 \labelwidthstring 00.00.0000
2751 \labelwidthstring 00.00.0000
2752
2752
2753 \SpecialChar ~
2753 \SpecialChar ~
2754 With any of the first three options, IPython starts running a separate
2754 With any of the first three options, IPython starts running a separate
2755 thread for the graphical toolkit's operation, so that you can open and
2755 thread for the graphical toolkit's operation, so that you can open and
2756 control graphical elements from within an IPython command line, without
2756 control graphical elements from within an IPython command line, without
2757 blocking.
2757 blocking.
2758 All three provide essentially the same functionality, respectively for
2758 All three provide essentially the same functionality, respectively for
2759 GTK, QT and WXWidgets (via their Python interfaces).
2759 GTK, QT and WXWidgets (via their Python interfaces).
2760 \layout List
2760 \layout List
2761 \labelwidthstring 00.00.0000
2761 \labelwidthstring 00.00.0000
2762
2762
2763 \SpecialChar ~
2763 \SpecialChar ~
2764 Note that with
2764 Note that with
2765 \family typewriter
2765 \family typewriter
2766 -wthread
2766 -wthread
2767 \family default
2767 \family default
2768 , you can additionally use the -wxversion option to request a specific version
2768 , you can additionally use the -wxversion option to request a specific version
2769 of wx to be used.
2769 of wx to be used.
2770 This requires that you have the
2770 This requires that you have the
2771 \family typewriter
2771 \family typewriter
2772 wxversion
2772 wxversion
2773 \family default
2773 \family default
2774 Python module installed, which is part of recent wxPython distributions.
2774 Python module installed, which is part of recent wxPython distributions.
2775 \layout List
2775 \layout List
2776 \labelwidthstring 00.00.0000
2776 \labelwidthstring 00.00.0000
2777
2777
2778 \SpecialChar ~
2778 \SpecialChar ~
2779 If
2779 If
2780 \family typewriter
2780 \family typewriter
2781 -pylab
2781 -pylab
2782 \family default
2782 \family default
2783 is given, IPython loads special support for the mat plotlib library (
2783 is given, IPython loads special support for the mat plotlib library (
2784 \begin_inset LatexCommand \htmlurl{http://matplotlib.sourceforge.net}
2784 \begin_inset LatexCommand \htmlurl{http://matplotlib.sourceforge.net}
2785
2785
2786 \end_inset
2786 \end_inset
2787
2787
2788 ), allowing interactive usage of any of its backends as defined in the user's
2788 ), allowing interactive usage of any of its backends as defined in the user's
2789
2789
2790 \family typewriter
2790 \family typewriter
2791 ~/.matplotlib/matplotlibrc
2791 ~/.matplotlib/matplotlibrc
2792 \family default
2792 \family default
2793 file.
2793 file.
2794 It automatically activates GTK, Qt or WX threading for IPyhton if the choice
2794 It automatically activates GTK, Qt or WX threading for IPyhton if the choice
2795 of matplotlib backend requires it.
2795 of matplotlib backend requires it.
2796 It also modifies the
2796 It also modifies the
2797 \family typewriter
2797 \family typewriter
2798 %run
2798 %run
2799 \family default
2799 \family default
2800 command to correctly execute (without blocking) any matplotlib-based script
2800 command to correctly execute (without blocking) any matplotlib-based script
2801 which calls
2801 which calls
2802 \family typewriter
2802 \family typewriter
2803 show()
2803 show()
2804 \family default
2804 \family default
2805 at the end.
2805 at the end.
2806
2806
2807 \layout List
2807 \layout List
2808 \labelwidthstring 00.00.0000
2808 \labelwidthstring 00.00.0000
2809
2809
2810
2810
2811 \family typewriter
2811 \family typewriter
2812 \series bold
2812 \series bold
2813 -tk
2813 -tk
2814 \family default
2814 \family default
2815 \series default
2815 \series default
2816 The
2816 The
2817 \family typewriter
2817 \family typewriter
2818 -g/q/wthread
2818 -g/q/wthread
2819 \family default
2819 \family default
2820 options, and
2820 options, and
2821 \family typewriter
2821 \family typewriter
2822 -pylab
2822 -pylab
2823 \family default
2823 \family default
2824 (if matplotlib is configured to use GTK, Qt or WX), will normally block
2824 (if matplotlib is configured to use GTK, Qt or WX), will normally block
2825 Tk graphical interfaces.
2825 Tk graphical interfaces.
2826 This means that when either GTK, Qt or WX threading is active, any attempt
2826 This means that when either GTK, Qt or WX threading is active, any attempt
2827 to open a Tk GUI will result in a dead window, and possibly cause the Python
2827 to open a Tk GUI will result in a dead window, and possibly cause the Python
2828 interpreter to crash.
2828 interpreter to crash.
2829 An extra option,
2829 An extra option,
2830 \family typewriter
2830 \family typewriter
2831 -tk
2831 -tk
2832 \family default
2832 \family default
2833 , is available to address this issue.
2833 , is available to address this issue.
2834 It can
2834 It can
2835 \emph on
2835 \emph on
2836 only
2836 only
2837 \emph default
2837 \emph default
2838 be given as a
2838 be given as a
2839 \emph on
2839 \emph on
2840 second
2840 second
2841 \emph default
2841 \emph default
2842 option after any of the above (
2842 option after any of the above (
2843 \family typewriter
2843 \family typewriter
2844 -gthread
2844 -gthread
2845 \family default
2845 \family default
2846 ,
2846 ,
2847 \family typewriter
2847 \family typewriter
2848 -wthread
2848 -wthread
2849 \family default
2849 \family default
2850 or
2850 or
2851 \family typewriter
2851 \family typewriter
2852 -pylab
2852 -pylab
2853 \family default
2853 \family default
2854 ).
2854 ).
2855 \layout List
2855 \layout List
2856 \labelwidthstring 00.00.0000
2856 \labelwidthstring 00.00.0000
2857
2857
2858 \SpecialChar ~
2858 \SpecialChar ~
2859 If
2859 If
2860 \family typewriter
2860 \family typewriter
2861 -tk
2861 -tk
2862 \family default
2862 \family default
2863 is given, IPython will try to coordinate Tk threading with GTK, Qt or WX.
2863 is given, IPython will try to coordinate Tk threading with GTK, Qt or WX.
2864 This is however potentially unreliable, and you will have to test on your
2864 This is however potentially unreliable, and you will have to test on your
2865 platform and Python configuration to determine whether it works for you.
2865 platform and Python configuration to determine whether it works for you.
2866 Debian users have reported success, apparently due to the fact that Debian
2866 Debian users have reported success, apparently due to the fact that Debian
2867 builds all of Tcl, Tk, Tkinter and Python with pthreads support.
2867 builds all of Tcl, Tk, Tkinter and Python with pthreads support.
2868 Under other Linux environments (such as Fedora Core 2/3), this option has
2868 Under other Linux environments (such as Fedora Core 2/3), this option has
2869 caused random crashes and lockups of the Python interpreter.
2869 caused random crashes and lockups of the Python interpreter.
2870 Under other operating systems (Mac OSX and Windows), you'll need to try
2870 Under other operating systems (Mac OSX and Windows), you'll need to try
2871 it to find out, since currently no user reports are available.
2871 it to find out, since currently no user reports are available.
2872 \layout List
2872 \layout List
2873 \labelwidthstring 00.00.0000
2873 \labelwidthstring 00.00.0000
2874
2874
2875 \SpecialChar ~
2875 \SpecialChar ~
2876 There is unfortunately no way for IPython to determine at run time whether
2876 There is unfortunately no way for IPython to determine at run time whether
2877
2877
2878 \family typewriter
2878 \family typewriter
2879 -tk
2879 -tk
2880 \family default
2880 \family default
2881 will work reliably or not, so you will need to do some experiments before
2881 will work reliably or not, so you will need to do some experiments before
2882 relying on it for regular work.
2882 relying on it for regular work.
2883
2883
2884 \layout Subsection
2884 \layout Subsection
2885
2885
2886
2886
2887 \begin_inset LatexCommand \label{sec:cmd-line-opts}
2887 \begin_inset LatexCommand \label{sec:cmd-line-opts}
2888
2888
2889 \end_inset
2889 \end_inset
2890
2890
2891 Regular Options
2891 Regular Options
2892 \layout Standard
2892 \layout Standard
2893
2893
2894 After the above threading options have been given, regular options can follow
2894 After the above threading options have been given, regular options can follow
2895 in any order.
2895 in any order.
2896 All options can be abbreviated to their shortest non-ambiguous form and
2896 All options can be abbreviated to their shortest non-ambiguous form and
2897 are case-sensitive.
2897 are case-sensitive.
2898 One or two dashes can be used.
2898 One or two dashes can be used.
2899 Some options have an alternate short form, indicated after a
2899 Some options have an alternate short form, indicated after a
2900 \family typewriter
2900 \family typewriter
2901 |
2901 |
2902 \family default
2902 \family default
2903 .
2903 .
2904 \layout Standard
2904 \layout Standard
2905
2905
2906 Most options can also be set from your ipythonrc configuration file.
2906 Most options can also be set from your ipythonrc configuration file.
2907 See the provided example for more details on what the options do.
2907 See the provided example for more details on what the options do.
2908 Options given at the command line override the values set in the ipythonrc
2908 Options given at the command line override the values set in the ipythonrc
2909 file.
2909 file.
2910 \layout Standard
2910 \layout Standard
2911
2911
2912 All options with a
2912 All options with a
2913 \family typewriter
2913 \family typewriter
2914 [no]
2914 [no]
2915 \family default
2915 \family default
2916 prepended can be specified in negated form (
2916 prepended can be specified in negated form (
2917 \family typewriter
2917 \family typewriter
2918 -nooption
2918 -nooption
2919 \family default
2919 \family default
2920 instead of
2920 instead of
2921 \family typewriter
2921 \family typewriter
2922 -option
2922 -option
2923 \family default
2923 \family default
2924 ) to turn the feature off.
2924 ) to turn the feature off.
2925 \layout List
2925 \layout List
2926 \labelwidthstring 00.00.0000
2926 \labelwidthstring 00.00.0000
2927
2927
2928
2928
2929 \family typewriter
2929 \family typewriter
2930 \series bold
2930 \series bold
2931 -help
2931 -help
2932 \family default
2932 \family default
2933 \series default
2933 \series default
2934 : print a help message and exit.
2934 : print a help message and exit.
2935 \layout List
2935 \layout List
2936 \labelwidthstring 00.00.0000
2936 \labelwidthstring 00.00.0000
2937
2937
2938
2938
2939 \family typewriter
2939 \family typewriter
2940 \series bold
2940 \series bold
2941 -pylab:
2941 -pylab:
2942 \family default
2942 \family default
2943 \series default
2943 \series default
2944 this can
2944 this can
2945 \emph on
2945 \emph on
2946 only
2946 only
2947 \emph default
2947 \emph default
2948 be given as the
2948 be given as the
2949 \emph on
2949 \emph on
2950 first
2950 first
2951 \emph default
2951 \emph default
2952 option passed to IPython (it will have no effect in any other position).
2952 option passed to IPython (it will have no effect in any other position).
2953 It adds special support for the matplotlib library (
2953 It adds special support for the matplotlib library (
2954 \begin_inset LatexCommand \htmlurl[http://matplotlib.sourceforge.net]{http://matplotlib.sourceforge.net}
2954 \begin_inset LatexCommand \htmlurl[http://matplotlib.sourceforge.net]{http://matplotlib.sourceforge.net}
2955
2955
2956 \end_inset
2956 \end_inset
2957
2957
2958 ), allowing interactive usage of any of its backends as defined in the user's
2958 ), allowing interactive usage of any of its backends as defined in the user's
2959
2959
2960 \family typewriter
2960 \family typewriter
2961 .matplotlibrc
2961 .matplotlibrc
2962 \family default
2962 \family default
2963 file.
2963 file.
2964 It automatically activates GTK or WX threading for IPyhton if the choice
2964 It automatically activates GTK or WX threading for IPyhton if the choice
2965 of matplotlib backend requires it.
2965 of matplotlib backend requires it.
2966 It also modifies the
2966 It also modifies the
2967 \family typewriter
2967 \family typewriter
2968 %run
2968 %run
2969 \family default
2969 \family default
2970 command to correctly execute (without blocking) any matplotlib-based script
2970 command to correctly execute (without blocking) any matplotlib-based script
2971 which calls
2971 which calls
2972 \family typewriter
2972 \family typewriter
2973 show()
2973 show()
2974 \family default
2974 \family default
2975 at the end.
2975 at the end.
2976 See Sec.\SpecialChar ~
2976 See Sec.\SpecialChar ~
2977
2977
2978 \begin_inset LatexCommand \ref{sec:matplotlib-support}
2978 \begin_inset LatexCommand \ref{sec:matplotlib-support}
2979
2979
2980 \end_inset
2980 \end_inset
2981
2981
2982 for more details.
2982 for more details.
2983 \layout List
2983 \layout List
2984 \labelwidthstring 00.00.0000
2984 \labelwidthstring 00.00.0000
2985
2985
2986
2986
2987 \family typewriter
2987 \family typewriter
2988 \series bold
2988 \series bold
2989 -autocall <val>:
2989 -autocall <val>:
2990 \family default
2990 \family default
2991 \series default
2991 \series default
2992 Make IPython automatically call any callable object even if you didn't
2992 Make IPython automatically call any callable object even if you didn't
2993 type explicit parentheses.
2993 type explicit parentheses.
2994 For example, `str 43' becomes `str(43)' automatically.
2994 For example, `str 43' becomes `str(43)' automatically.
2995 The value can be `0' to disable the feature, `1' for
2995 The value can be `0' to disable the feature, `1' for
2996 \emph on
2996 \emph on
2997 smart
2997 smart
2998 \emph default
2998 \emph default
2999 autocall, where it is not applied if there are no more arguments on the
2999 autocall, where it is not applied if there are no more arguments on the
3000 line, and `2' for
3000 line, and `2' for
3001 \emph on
3001 \emph on
3002 full
3002 full
3003 \emph default
3003 \emph default
3004 autocall, where all callable objects are automatically called (even if
3004 autocall, where all callable objects are automatically called (even if
3005 no arguments are present).
3005 no arguments are present).
3006 The default is `1'.
3006 The default is `1'.
3007 \layout List
3007 \layout List
3008 \labelwidthstring 00.00.0000
3008 \labelwidthstring 00.00.0000
3009
3009
3010
3010
3011 \family typewriter
3011 \family typewriter
3012 \series bold
3012 \series bold
3013 -[no]autoindent:
3013 -[no]autoindent:
3014 \family default
3014 \family default
3015 \series default
3015 \series default
3016 Turn automatic indentation on/off.
3016 Turn automatic indentation on/off.
3017 \layout List
3017 \layout List
3018 \labelwidthstring 00.00.0000
3018 \labelwidthstring 00.00.0000
3019
3019
3020
3020
3021 \family typewriter
3021 \family typewriter
3022 \series bold
3022 \series bold
3023 -[no]automagic
3023 -[no]automagic
3024 \series default
3024 \series default
3025 :
3025 :
3026 \family default
3026 \family default
3027 make magic commands automatic (without needing their first character to
3027 make magic commands automatic (without needing their first character to
3028 be
3028 be
3029 \family typewriter
3029 \family typewriter
3030 %
3030 %
3031 \family default
3031 \family default
3032 ).
3032 ).
3033 Type
3033 Type
3034 \family typewriter
3034 \family typewriter
3035 %magic
3035 %magic
3036 \family default
3036 \family default
3037 at the IPython prompt for more information.
3037 at the IPython prompt for more information.
3038 \layout List
3038 \layout List
3039 \labelwidthstring 00.00.0000
3039 \labelwidthstring 00.00.0000
3040
3040
3041
3041
3042 \family typewriter
3042 \family typewriter
3043 \series bold
3043 \series bold
3044 -[no]autoedit_syntax:
3044 -[no]autoedit_syntax:
3045 \family default
3045 \family default
3046 \series default
3046 \series default
3047 When a syntax error occurs after editing a file, automatically open the
3047 When a syntax error occurs after editing a file, automatically open the
3048 file to the trouble causing line for convenient fixing.
3048 file to the trouble causing line for convenient fixing.
3049
3049
3050 \layout List
3050 \layout List
3051 \labelwidthstring 00.00.0000
3051 \labelwidthstring 00.00.0000
3052
3052
3053
3053
3054 \family typewriter
3054 \family typewriter
3055 \series bold
3055 \series bold
3056 -[no]banner
3056 -[no]banner
3057 \series default
3057 \series default
3058 :
3058 :
3059 \family default
3059 \family default
3060 Print the initial information banner (default on).
3060 Print the initial information banner (default on).
3061 \layout List
3061 \layout List
3062 \labelwidthstring 00.00.0000
3062 \labelwidthstring 00.00.0000
3063
3063
3064
3064
3065 \family typewriter
3065 \family typewriter
3066 \series bold
3066 \series bold
3067 -c\SpecialChar ~
3067 -c\SpecialChar ~
3068 <command>:
3068 <command>:
3069 \family default
3069 \family default
3070 \series default
3070 \series default
3071 execute the given command string, and set sys.argv to
3071 execute the given command string, and set sys.argv to
3072 \family typewriter
3072 \family typewriter
3073 ['c']
3073 ['c']
3074 \family default
3074 \family default
3075 .
3075 .
3076 This is similar to the
3076 This is similar to the
3077 \family typewriter
3077 \family typewriter
3078 -c
3078 -c
3079 \family default
3079 \family default
3080 option in the normal Python interpreter.
3080 option in the normal Python interpreter.
3081
3081
3082 \layout List
3082 \layout List
3083 \labelwidthstring 00.00.0000
3083 \labelwidthstring 00.00.0000
3084
3084
3085
3085
3086 \family typewriter
3086 \family typewriter
3087 \series bold
3087 \series bold
3088 -cache_size|cs\SpecialChar ~
3088 -cache_size|cs\SpecialChar ~
3089 <n>
3089 <n>
3090 \series default
3090 \series default
3091 :
3091 :
3092 \family default
3092 \family default
3093 size of the output cache (maximum number of entries to hold in memory).
3093 size of the output cache (maximum number of entries to hold in memory).
3094 The default is 1000, you can change it permanently in your config file.
3094 The default is 1000, you can change it permanently in your config file.
3095 Setting it to 0 completely disables the caching system, and the minimum
3095 Setting it to 0 completely disables the caching system, and the minimum
3096 value accepted is 20 (if you provide a value less than 20, it is reset
3096 value accepted is 20 (if you provide a value less than 20, it is reset
3097 to 0 and a warning is issued) This limit is defined because otherwise you'll
3097 to 0 and a warning is issued) This limit is defined because otherwise you'll
3098 spend more time re-flushing a too small cache than working.
3098 spend more time re-flushing a too small cache than working.
3099 \layout List
3099 \layout List
3100 \labelwidthstring 00.00.0000
3100 \labelwidthstring 00.00.0000
3101
3101
3102
3102
3103 \family typewriter
3103 \family typewriter
3104 \series bold
3104 \series bold
3105 -classic|cl
3105 -classic|cl
3106 \series default
3106 \series default
3107 :
3107 :
3108 \family default
3108 \family default
3109 Gives IPython a similar feel to the classic Python prompt.
3109 Gives IPython a similar feel to the classic Python prompt.
3110 \layout List
3110 \layout List
3111 \labelwidthstring 00.00.0000
3111 \labelwidthstring 00.00.0000
3112
3112
3113
3113
3114 \family typewriter
3114 \family typewriter
3115 \series bold
3115 \series bold
3116 -colors\SpecialChar ~
3116 -colors\SpecialChar ~
3117 <scheme>:
3117 <scheme>:
3118 \family default
3118 \family default
3119 \series default
3119 \series default
3120 Color scheme for prompts and exception reporting.
3120 Color scheme for prompts and exception reporting.
3121 Currently implemented: NoColor, Linux and LightBG.
3121 Currently implemented: NoColor, Linux and LightBG.
3122 \layout List
3122 \layout List
3123 \labelwidthstring 00.00.0000
3123 \labelwidthstring 00.00.0000
3124
3124
3125
3125
3126 \family typewriter
3126 \family typewriter
3127 \series bold
3127 \series bold
3128 -[no]color_info:
3128 -[no]color_info:
3129 \family default
3129 \family default
3130 \series default
3130 \series default
3131 IPython can display information about objects via a set of functions, and
3131 IPython can display information about objects via a set of functions, and
3132 optionally can use colors for this, syntax highlighting source code and
3132 optionally can use colors for this, syntax highlighting source code and
3133 various other elements.
3133 various other elements.
3134 However, because this information is passed through a pager (like 'less')
3134 However, because this information is passed through a pager (like 'less')
3135 and many pagers get confused with color codes, this option is off by default.
3135 and many pagers get confused with color codes, this option is off by default.
3136 You can test it and turn it on permanently in your ipythonrc file if it
3136 You can test it and turn it on permanently in your ipythonrc file if it
3137 works for you.
3137 works for you.
3138 As a reference, the 'less' pager supplied with Mandrake 8.2 works ok, but
3138 As a reference, the 'less' pager supplied with Mandrake 8.2 works ok, but
3139 that in RedHat 7.2 doesn't.
3139 that in RedHat 7.2 doesn't.
3140 \layout List
3140 \layout List
3141 \labelwidthstring 00.00.0000
3141 \labelwidthstring 00.00.0000
3142
3142
3143 \SpecialChar ~
3143 \SpecialChar ~
3144 Test it and turn it on permanently if it works with your system.
3144 Test it and turn it on permanently if it works with your system.
3145 The magic function
3145 The magic function
3146 \family typewriter
3146 \family typewriter
3147 %color_info
3147 %color_info
3148 \family default
3148 \family default
3149 allows you to toggle this interactively for testing.
3149 allows you to toggle this interactively for testing.
3150 \layout List
3150 \layout List
3151 \labelwidthstring 00.00.0000
3151 \labelwidthstring 00.00.0000
3152
3152
3153
3153
3154 \family typewriter
3154 \family typewriter
3155 \series bold
3155 \series bold
3156 -[no]debug
3156 -[no]debug
3157 \family default
3157 \family default
3158 \series default
3158 \series default
3159 : Show information about the loading process.
3159 : Show information about the loading process.
3160 Very useful to pin down problems with your configuration files or to get
3160 Very useful to pin down problems with your configuration files or to get
3161 details about session restores.
3161 details about session restores.
3162 \layout List
3162 \layout List
3163 \labelwidthstring 00.00.0000
3163 \labelwidthstring 00.00.0000
3164
3164
3165
3165
3166 \family typewriter
3166 \family typewriter
3167 \series bold
3167 \series bold
3168 -[no]deep_reload
3168 -[no]deep_reload
3169 \series default
3169 \series default
3170 :
3170 :
3171 \family default
3171 \family default
3172 IPython can use the
3172 IPython can use the
3173 \family typewriter
3173 \family typewriter
3174 deep_reload
3174 deep_reload
3175 \family default
3175 \family default
3176 module which reloads changes in modules recursively (it replaces the
3176 module which reloads changes in modules recursively (it replaces the
3177 \family typewriter
3177 \family typewriter
3178 reload()
3178 reload()
3179 \family default
3179 \family default
3180 function, so you don't need to change anything to use it).
3180 function, so you don't need to change anything to use it).
3181
3181
3182 \family typewriter
3182 \family typewriter
3183 deep_reload()
3183 deep_reload()
3184 \family default
3184 \family default
3185 forces a full reload of modules whose code may have changed, which the
3185 forces a full reload of modules whose code may have changed, which the
3186 default
3186 default
3187 \family typewriter
3187 \family typewriter
3188 reload()
3188 reload()
3189 \family default
3189 \family default
3190 function does not.
3190 function does not.
3191 \layout List
3191 \layout List
3192 \labelwidthstring 00.00.0000
3192 \labelwidthstring 00.00.0000
3193
3193
3194 \SpecialChar ~
3194 \SpecialChar ~
3195 When deep_reload is off, IPython will use the normal
3195 When deep_reload is off, IPython will use the normal
3196 \family typewriter
3196 \family typewriter
3197 reload()
3197 reload()
3198 \family default
3198 \family default
3199 , but deep_reload will still be available as
3199 , but deep_reload will still be available as
3200 \family typewriter
3200 \family typewriter
3201 dreload()
3201 dreload()
3202 \family default
3202 \family default
3203 .
3203 .
3204 This feature is off by default [which means that you have both normal
3204 This feature is off by default [which means that you have both normal
3205 \family typewriter
3205 \family typewriter
3206 reload()
3206 reload()
3207 \family default
3207 \family default
3208 and
3208 and
3209 \family typewriter
3209 \family typewriter
3210 dreload()
3210 dreload()
3211 \family default
3211 \family default
3212 ].
3212 ].
3213 \layout List
3213 \layout List
3214 \labelwidthstring 00.00.0000
3214 \labelwidthstring 00.00.0000
3215
3215
3216
3216
3217 \family typewriter
3217 \family typewriter
3218 \series bold
3218 \series bold
3219 -editor\SpecialChar ~
3219 -editor\SpecialChar ~
3220 <name>
3220 <name>
3221 \family default
3221 \family default
3222 \series default
3222 \series default
3223 : Which editor to use with the
3223 : Which editor to use with the
3224 \family typewriter
3224 \family typewriter
3225 %edit
3225 %edit
3226 \family default
3226 \family default
3227 command.
3227 command.
3228 By default, IPython will honor your
3228 By default, IPython will honor your
3229 \family typewriter
3229 \family typewriter
3230 EDITOR
3230 EDITOR
3231 \family default
3231 \family default
3232 environment variable (if not set, vi is the Unix default and notepad the
3232 environment variable (if not set, vi is the Unix default and notepad the
3233 Windows one).
3233 Windows one).
3234 Since this editor is invoked on the fly by IPython and is meant for editing
3234 Since this editor is invoked on the fly by IPython and is meant for editing
3235 small code snippets, you may want to use a small, lightweight editor here
3235 small code snippets, you may want to use a small, lightweight editor here
3236 (in case your default
3236 (in case your default
3237 \family typewriter
3237 \family typewriter
3238 EDITOR
3238 EDITOR
3239 \family default
3239 \family default
3240 is something like Emacs).
3240 is something like Emacs).
3241 \layout List
3241 \layout List
3242 \labelwidthstring 00.00.0000
3242 \labelwidthstring 00.00.0000
3243
3243
3244
3244
3245 \family typewriter
3245 \family typewriter
3246 \series bold
3246 \series bold
3247 -ipythondir\SpecialChar ~
3247 -ipythondir\SpecialChar ~
3248 <name>
3248 <name>
3249 \series default
3249 \series default
3250 :
3250 :
3251 \family default
3251 \family default
3252 name of your IPython configuration directory
3252 name of your IPython configuration directory
3253 \family typewriter
3253 \family typewriter
3254 IPYTHONDIR
3254 IPYTHONDIR
3255 \family default
3255 \family default
3256 .
3256 .
3257 This can also be specified through the environment variable
3257 This can also be specified through the environment variable
3258 \family typewriter
3258 \family typewriter
3259 IPYTHONDIR
3259 IPYTHONDIR
3260 \family default
3260 \family default
3261 .
3261 .
3262 \layout List
3262 \layout List
3263 \labelwidthstring 00.00.0000
3263 \labelwidthstring 00.00.0000
3264
3264
3265
3265
3266 \family typewriter
3266 \family typewriter
3267 \series bold
3267 \series bold
3268 -log|l
3268 -log|l
3269 \family default
3269 \family default
3270 \series default
3270 \series default
3271 : generate a log file of all input.
3271 : generate a log file of all input.
3272 The file is named
3272 The file is named
3273 \family typewriter
3273 \family typewriter
3274 ipython_log.py
3274 ipython_log.py
3275 \family default
3275 \family default
3276 in your current directory (which prevents logs from multiple IPython sessions
3276 in your current directory (which prevents logs from multiple IPython sessions
3277 from trampling each other).
3277 from trampling each other).
3278 You can use this to later restore a session by loading your logfile as
3278 You can use this to later restore a session by loading your logfile as
3279 a file to be executed with option
3279 a file to be executed with option
3280 \family typewriter
3280 \family typewriter
3281 -logplay
3281 -logplay
3282 \family default
3282 \family default
3283 (see below).
3283 (see below).
3284 \layout List
3284 \layout List
3285 \labelwidthstring 00.00.0000
3285 \labelwidthstring 00.00.0000
3286
3286
3287
3287
3288 \family typewriter
3288 \family typewriter
3289 \series bold
3289 \series bold
3290 -logfile|lf\SpecialChar ~
3290 -logfile|lf\SpecialChar ~
3291 <name>
3291 <name>
3292 \series default
3292 \series default
3293 :
3293 :
3294 \family default
3294 \family default
3295 specify the name of your logfile.
3295 specify the name of your logfile.
3296 \layout List
3296 \layout List
3297 \labelwidthstring 00.00.0000
3297 \labelwidthstring 00.00.0000
3298
3298
3299
3299
3300 \family typewriter
3300 \family typewriter
3301 \series bold
3301 \series bold
3302 -logplay|lp\SpecialChar ~
3302 -logplay|lp\SpecialChar ~
3303 <name>
3303 <name>
3304 \series default
3304 \series default
3305 :
3305 :
3306 \family default
3306 \family default
3307 you can replay a previous log.
3307 you can replay a previous log.
3308 For restoring a session as close as possible to the state you left it in,
3308 For restoring a session as close as possible to the state you left it in,
3309 use this option (don't just run the logfile).
3309 use this option (don't just run the logfile).
3310 With
3310 With
3311 \family typewriter
3311 \family typewriter
3312 -logplay
3312 -logplay
3313 \family default
3313 \family default
3314 , IPython will try to reconstruct the previous working environment in full,
3314 , IPython will try to reconstruct the previous working environment in full,
3315 not just execute the commands in the logfile.
3315 not just execute the commands in the logfile.
3316 \layout List
3316 \layout List
3317 \labelwidthstring 00.00.0000
3317 \labelwidthstring 00.00.0000
3318
3318
3319 \SpecialChar ~
3319 \SpecialChar ~
3320 When a session is restored, logging is automatically turned on again with
3320 When a session is restored, logging is automatically turned on again with
3321 the name of the logfile it was invoked with (it is read from the log header).
3321 the name of the logfile it was invoked with (it is read from the log header).
3322 So once you've turned logging on for a session, you can quit IPython and
3322 So once you've turned logging on for a session, you can quit IPython and
3323 reload it as many times as you want and it will continue to log its history
3323 reload it as many times as you want and it will continue to log its history
3324 and restore from the beginning every time.
3324 and restore from the beginning every time.
3325 \layout List
3325 \layout List
3326 \labelwidthstring 00.00.0000
3326 \labelwidthstring 00.00.0000
3327
3327
3328 \SpecialChar ~
3328 \SpecialChar ~
3329 Caveats: there are limitations in this option.
3329 Caveats: there are limitations in this option.
3330 The history variables
3330 The history variables
3331 \family typewriter
3331 \family typewriter
3332 _i*
3332 _i*
3333 \family default
3333 \family default
3334 ,
3334 ,
3335 \family typewriter
3335 \family typewriter
3336 _*
3336 _*
3337 \family default
3337 \family default
3338 and
3338 and
3339 \family typewriter
3339 \family typewriter
3340 _dh
3340 _dh
3341 \family default
3341 \family default
3342 don't get restored properly.
3342 don't get restored properly.
3343 In the future we will try to implement full session saving by writing and
3343 In the future we will try to implement full session saving by writing and
3344 retrieving a 'snapshot' of the memory state of IPython.
3344 retrieving a 'snapshot' of the memory state of IPython.
3345 But our first attempts failed because of inherent limitations of Python's
3345 But our first attempts failed because of inherent limitations of Python's
3346 Pickle module, so this may have to wait.
3346 Pickle module, so this may have to wait.
3347 \layout List
3347 \layout List
3348 \labelwidthstring 00.00.0000
3348 \labelwidthstring 00.00.0000
3349
3349
3350
3350
3351 \family typewriter
3351 \family typewriter
3352 \series bold
3352 \series bold
3353 -[no]messages
3353 -[no]messages
3354 \series default
3354 \series default
3355 :
3355 :
3356 \family default
3356 \family default
3357 Print messages which IPython collects about its startup process (default
3357 Print messages which IPython collects about its startup process (default
3358 on).
3358 on).
3359 \layout List
3359 \layout List
3360 \labelwidthstring 00.00.0000
3360 \labelwidthstring 00.00.0000
3361
3361
3362
3362
3363 \family typewriter
3363 \family typewriter
3364 \series bold
3364 \series bold
3365 -[no]pdb
3365 -[no]pdb
3366 \family default
3366 \family default
3367 \series default
3367 \series default
3368 : Automatically call the pdb debugger after every uncaught exception.
3368 : Automatically call the pdb debugger after every uncaught exception.
3369 If you are used to debugging using pdb, this puts you automatically inside
3369 If you are used to debugging using pdb, this puts you automatically inside
3370 of it after any call (either in IPython or in code called by it) which
3370 of it after any call (either in IPython or in code called by it) which
3371 triggers an exception which goes uncaught.
3371 triggers an exception which goes uncaught.
3372 \layout List
3372 \layout List
3373 \labelwidthstring 00.00.0000
3373 \labelwidthstring 00.00.0000
3374
3374
3375
3375
3376 \family typewriter
3376 \family typewriter
3377 \series bold
3377 \series bold
3378 -[no]pprint
3378 -[no]pprint
3379 \series default
3379 \series default
3380 :
3380 :
3381 \family default
3381 \family default
3382 ipython can optionally use the pprint (pretty printer) module for displaying
3382 ipython can optionally use the pprint (pretty printer) module for displaying
3383 results.
3383 results.
3384 pprint tends to give a nicer display of nested data structures.
3384 pprint tends to give a nicer display of nested data structures.
3385 If you like it, you can turn it on permanently in your config file (default
3385 If you like it, you can turn it on permanently in your config file (default
3386 off).
3386 off).
3387 \layout List
3387 \layout List
3388 \labelwidthstring 00.00.0000
3388 \labelwidthstring 00.00.0000
3389
3389
3390
3390
3391 \family typewriter
3391 \family typewriter
3392 \series bold
3392 \series bold
3393 -profile|p <name>
3393 -profile|p <name>
3394 \series default
3394 \series default
3395 :
3395 :
3396 \family default
3396 \family default
3397 assume that your config file is
3397 assume that your config file is
3398 \family typewriter
3398 \family typewriter
3399 ipythonrc-<name>
3399 ipythonrc-<name>
3400 \family default
3400 \family default
3401 (looks in current dir first, then in
3401 (looks in current dir first, then in
3402 \family typewriter
3402 \family typewriter
3403 IPYTHONDIR
3403 IPYTHONDIR
3404 \family default
3404 \family default
3405 ).
3405 ).
3406 This is a quick way to keep and load multiple config files for different
3406 This is a quick way to keep and load multiple config files for different
3407 tasks, especially if you use the include option of config files.
3407 tasks, especially if you use the include option of config files.
3408 You can keep a basic
3408 You can keep a basic
3409 \family typewriter
3409 \family typewriter
3410 IPYTHONDIR/ipythonrc
3410 IPYTHONDIR/ipythonrc
3411 \family default
3411 \family default
3412 file and then have other 'profiles' which include this one and load extra
3412 file and then have other 'profiles' which include this one and load extra
3413 things for particular tasks.
3413 things for particular tasks.
3414 For example:
3414 For example:
3415 \layout List
3415 \layout List
3416 \labelwidthstring 00.00.0000
3416 \labelwidthstring 00.00.0000
3417
3417
3418
3418
3419 \family typewriter
3419 \family typewriter
3420 \SpecialChar ~
3420 \SpecialChar ~
3421
3421
3422 \family default
3422 \family default
3423 1.
3423 1.
3424
3424
3425 \family typewriter
3425 \family typewriter
3426 $HOME/.ipython/ipythonrc
3426 $HOME/.ipython/ipythonrc
3427 \family default
3427 \family default
3428 : load basic things you always want.
3428 : load basic things you always want.
3429 \layout List
3429 \layout List
3430 \labelwidthstring 00.00.0000
3430 \labelwidthstring 00.00.0000
3431
3431
3432
3432
3433 \family typewriter
3433 \family typewriter
3434 \SpecialChar ~
3434 \SpecialChar ~
3435
3435
3436 \family default
3436 \family default
3437 2.
3437 2.
3438
3438
3439 \family typewriter
3439 \family typewriter
3440 $HOME/.ipython/ipythonrc-math
3440 $HOME/.ipython/ipythonrc-math
3441 \family default
3441 \family default
3442 : load (1) and basic math-related modules.
3442 : load (1) and basic math-related modules.
3443
3443
3444 \layout List
3444 \layout List
3445 \labelwidthstring 00.00.0000
3445 \labelwidthstring 00.00.0000
3446
3446
3447
3447
3448 \family typewriter
3448 \family typewriter
3449 \SpecialChar ~
3449 \SpecialChar ~
3450
3450
3451 \family default
3451 \family default
3452 3.
3452 3.
3453
3453
3454 \family typewriter
3454 \family typewriter
3455 $HOME/.ipython/ipythonrc-numeric
3455 $HOME/.ipython/ipythonrc-numeric
3456 \family default
3456 \family default
3457 : load (1) and Numeric and plotting modules.
3457 : load (1) and Numeric and plotting modules.
3458 \layout List
3458 \layout List
3459 \labelwidthstring 00.00.0000
3459 \labelwidthstring 00.00.0000
3460
3460
3461 \SpecialChar ~
3461 \SpecialChar ~
3462 Since it is possible to create an endless loop by having circular file
3462 Since it is possible to create an endless loop by having circular file
3463 inclusions, IPython will stop if it reaches 15 recursive inclusions.
3463 inclusions, IPython will stop if it reaches 15 recursive inclusions.
3464 \layout List
3464 \layout List
3465 \labelwidthstring 00.00.0000
3465 \labelwidthstring 00.00.0000
3466
3466
3467
3467
3468 \family typewriter
3468 \family typewriter
3469 \series bold
3469 \series bold
3470 -prompt_in1|pi1\SpecialChar ~
3470 -prompt_in1|pi1\SpecialChar ~
3471 <string>:
3471 <string>:
3472 \family default
3472 \family default
3473 \series default
3473 \series default
3474 Specify the string used for input prompts.
3474 Specify the string used for input prompts.
3475 Note that if you are using numbered prompts, the number is represented
3475 Note that if you are using numbered prompts, the number is represented
3476 with a '
3476 with a '
3477 \backslash
3477 \backslash
3478 #' in the string.
3478 #' in the string.
3479 Don't forget to quote strings with spaces embedded in them.
3479 Don't forget to quote strings with spaces embedded in them.
3480 Default: '
3480 Default: '
3481 \family typewriter
3481 \family typewriter
3482 In\SpecialChar ~
3482 In\SpecialChar ~
3483 [
3483 [
3484 \backslash
3484 \backslash
3485 #]:
3485 #]:
3486 \family default
3486 \family default
3487 '.
3487 '.
3488 Sec.\SpecialChar ~
3488 Sec.\SpecialChar ~
3489
3489
3490 \begin_inset LatexCommand \ref{sec:prompts}
3490 \begin_inset LatexCommand \ref{sec:prompts}
3491
3491
3492 \end_inset
3492 \end_inset
3493
3493
3494 discusses in detail all the available escapes to customize your prompts.
3494 discusses in detail all the available escapes to customize your prompts.
3495 \layout List
3495 \layout List
3496 \labelwidthstring 00.00.0000
3496 \labelwidthstring 00.00.0000
3497
3497
3498
3498
3499 \family typewriter
3499 \family typewriter
3500 \series bold
3500 \series bold
3501 -prompt_in2|pi2\SpecialChar ~
3501 -prompt_in2|pi2\SpecialChar ~
3502 <string>:
3502 <string>:
3503 \family default
3503 \family default
3504 \series default
3504 \series default
3505 Similar to the previous option, but used for the continuation prompts.
3505 Similar to the previous option, but used for the continuation prompts.
3506 The special sequence '
3506 The special sequence '
3507 \family typewriter
3507 \family typewriter
3508
3508
3509 \backslash
3509 \backslash
3510 D
3510 D
3511 \family default
3511 \family default
3512 ' is similar to '
3512 ' is similar to '
3513 \family typewriter
3513 \family typewriter
3514
3514
3515 \backslash
3515 \backslash
3516 #
3516 #
3517 \family default
3517 \family default
3518 ', but with all digits replaced dots (so you can have your continuation
3518 ', but with all digits replaced dots (so you can have your continuation
3519 prompt aligned with your input prompt).
3519 prompt aligned with your input prompt).
3520 Default: '
3520 Default: '
3521 \family typewriter
3521 \family typewriter
3522 \SpecialChar ~
3522 \SpecialChar ~
3523 \SpecialChar ~
3523 \SpecialChar ~
3524 \SpecialChar ~
3524 \SpecialChar ~
3525 .
3525 .
3526 \backslash
3526 \backslash
3527 D.:
3527 D.:
3528 \family default
3528 \family default
3529 ' (note three spaces at the start for alignment with '
3529 ' (note three spaces at the start for alignment with '
3530 \family typewriter
3530 \family typewriter
3531 In\SpecialChar ~
3531 In\SpecialChar ~
3532 [
3532 [
3533 \backslash
3533 \backslash
3534 #]
3534 #]
3535 \family default
3535 \family default
3536 ').
3536 ').
3537 \layout List
3537 \layout List
3538 \labelwidthstring 00.00.0000
3538 \labelwidthstring 00.00.0000
3539
3539
3540
3540
3541 \family typewriter
3541 \family typewriter
3542 \series bold
3542 \series bold
3543 -prompt_out|po\SpecialChar ~
3543 -prompt_out|po\SpecialChar ~
3544 <string>:
3544 <string>:
3545 \family default
3545 \family default
3546 \series default
3546 \series default
3547 String used for output prompts, also uses numbers like
3547 String used for output prompts, also uses numbers like
3548 \family typewriter
3548 \family typewriter
3549 prompt_in1
3549 prompt_in1
3550 \family default
3550 \family default
3551 .
3551 .
3552 Default: '
3552 Default: '
3553 \family typewriter
3553 \family typewriter
3554 Out[
3554 Out[
3555 \backslash
3555 \backslash
3556 #]:
3556 #]:
3557 \family default
3557 \family default
3558 '
3558 '
3559 \layout List
3559 \layout List
3560 \labelwidthstring 00.00.0000
3560 \labelwidthstring 00.00.0000
3561
3561
3562
3562
3563 \family typewriter
3563 \family typewriter
3564 \series bold
3564 \series bold
3565 -quick
3565 -quick
3566 \family default
3566 \family default
3567 \series default
3567 \series default
3568 : start in bare bones mode (no config file loaded).
3568 : start in bare bones mode (no config file loaded).
3569 \layout List
3569 \layout List
3570 \labelwidthstring 00.00.0000
3570 \labelwidthstring 00.00.0000
3571
3571
3572
3572
3573 \family typewriter
3573 \family typewriter
3574 \series bold
3574 \series bold
3575 -rcfile\SpecialChar ~
3575 -rcfile\SpecialChar ~
3576 <name>
3576 <name>
3577 \series default
3577 \series default
3578 :
3578 :
3579 \family default
3579 \family default
3580 name of your IPython resource configuration file.
3580 name of your IPython resource configuration file.
3581 Normally IPython loads ipythonrc (from current directory) or
3581 Normally IPython loads ipythonrc (from current directory) or
3582 \family typewriter
3582 \family typewriter
3583 IPYTHONDIR/ipythonrc
3583 IPYTHONDIR/ipythonrc
3584 \family default
3584 \family default
3585 .
3585 .
3586 \layout List
3586 \layout List
3587 \labelwidthstring 00.00.0000
3587 \labelwidthstring 00.00.0000
3588
3588
3589 \SpecialChar ~
3589 \SpecialChar ~
3590 If the loading of your config file fails, IPython starts with a bare bones
3590 If the loading of your config file fails, IPython starts with a bare bones
3591 configuration (no modules loaded at all).
3591 configuration (no modules loaded at all).
3592 \layout List
3592 \layout List
3593 \labelwidthstring 00.00.0000
3593 \labelwidthstring 00.00.0000
3594
3594
3595
3595
3596 \family typewriter
3596 \family typewriter
3597 \series bold
3597 \series bold
3598 -[no]readline
3598 -[no]readline
3599 \family default
3599 \family default
3600 \series default
3600 \series default
3601 : use the readline library, which is needed to support name completion and
3601 : use the readline library, which is needed to support name completion and
3602 command history, among other things.
3602 command history, among other things.
3603 It is enabled by default, but may cause problems for users of X/Emacs in
3603 It is enabled by default, but may cause problems for users of X/Emacs in
3604 Python comint or shell buffers.
3604 Python comint or shell buffers.
3605 \layout List
3605 \layout List
3606 \labelwidthstring 00.00.0000
3606 \labelwidthstring 00.00.0000
3607
3607
3608 \SpecialChar ~
3608 \SpecialChar ~
3609 Note that X/Emacs 'eterm' buffers (opened with
3609 Note that X/Emacs 'eterm' buffers (opened with
3610 \family typewriter
3610 \family typewriter
3611 M-x\SpecialChar ~
3611 M-x\SpecialChar ~
3612 term
3612 term
3613 \family default
3613 \family default
3614 ) support IPython's readline and syntax coloring fine, only 'emacs' (
3614 ) support IPython's readline and syntax coloring fine, only 'emacs' (
3615 \family typewriter
3615 \family typewriter
3616 M-x\SpecialChar ~
3616 M-x\SpecialChar ~
3617 shell
3617 shell
3618 \family default
3618 \family default
3619 and
3619 and
3620 \family typewriter
3620 \family typewriter
3621 C-c\SpecialChar ~
3621 C-c\SpecialChar ~
3622 !
3622 !
3623 \family default
3623 \family default
3624 ) buffers do not.
3624 ) buffers do not.
3625 \layout List
3625 \layout List
3626 \labelwidthstring 00.00.0000
3626 \labelwidthstring 00.00.0000
3627
3627
3628
3628
3629 \family typewriter
3629 \family typewriter
3630 \series bold
3630 \series bold
3631 -screen_length|sl\SpecialChar ~
3631 -screen_length|sl\SpecialChar ~
3632 <n>
3632 <n>
3633 \series default
3633 \series default
3634 :
3634 :
3635 \family default
3635 \family default
3636 number of lines of your screen.
3636 number of lines of your screen.
3637 This is used to control printing of very long strings.
3637 This is used to control printing of very long strings.
3638 Strings longer than this number of lines will be sent through a pager instead
3638 Strings longer than this number of lines will be sent through a pager instead
3639 of directly printed.
3639 of directly printed.
3640 \layout List
3640 \layout List
3641 \labelwidthstring 00.00.0000
3641 \labelwidthstring 00.00.0000
3642
3642
3643 \SpecialChar ~
3643 \SpecialChar ~
3644 The default value for this is 0, which means IPython will auto-detect your
3644 The default value for this is 0, which means IPython will auto-detect your
3645 screen size every time it needs to print certain potentially long strings
3645 screen size every time it needs to print certain potentially long strings
3646 (this doesn't change the behavior of the 'print' keyword, it's only triggered
3646 (this doesn't change the behavior of the 'print' keyword, it's only triggered
3647 internally).
3647 internally).
3648 If for some reason this isn't working well (it needs curses support), specify
3648 If for some reason this isn't working well (it needs curses support), specify
3649 it yourself.
3649 it yourself.
3650 Otherwise don't change the default.
3650 Otherwise don't change the default.
3651 \layout List
3651 \layout List
3652 \labelwidthstring 00.00.0000
3652 \labelwidthstring 00.00.0000
3653
3653
3654
3654
3655 \family typewriter
3655 \family typewriter
3656 \series bold
3656 \series bold
3657 -separate_in|si\SpecialChar ~
3657 -separate_in|si\SpecialChar ~
3658 <string>
3658 <string>
3659 \series default
3659 \series default
3660 :
3660 :
3661 \family default
3661 \family default
3662 separator before input prompts.
3662 separator before input prompts.
3663 Default: '
3663 Default: '
3664 \family typewriter
3664 \family typewriter
3665
3665
3666 \backslash
3666 \backslash
3667 n
3667 n
3668 \family default
3668 \family default
3669 '
3669 '
3670 \layout List
3670 \layout List
3671 \labelwidthstring 00.00.0000
3671 \labelwidthstring 00.00.0000
3672
3672
3673
3673
3674 \family typewriter
3674 \family typewriter
3675 \series bold
3675 \series bold
3676 -separate_out|so\SpecialChar ~
3676 -separate_out|so\SpecialChar ~
3677 <string>
3677 <string>
3678 \family default
3678 \family default
3679 \series default
3679 \series default
3680 : separator before output prompts.
3680 : separator before output prompts.
3681 Default: nothing.
3681 Default: nothing.
3682 \layout List
3682 \layout List
3683 \labelwidthstring 00.00.0000
3683 \labelwidthstring 00.00.0000
3684
3684
3685
3685
3686 \family typewriter
3686 \family typewriter
3687 \series bold
3687 \series bold
3688 -separate_out2|so2\SpecialChar ~
3688 -separate_out2|so2\SpecialChar ~
3689 <string>
3689 <string>
3690 \series default
3690 \series default
3691 :
3691 :
3692 \family default
3692 \family default
3693 separator after output prompts.
3693 separator after output prompts.
3694 Default: nothing.
3694 Default: nothing.
3695 \layout List
3695 \layout List
3696 \labelwidthstring 00.00.0000
3696 \labelwidthstring 00.00.0000
3697
3697
3698 \SpecialChar ~
3698 \SpecialChar ~
3699 For these three options, use the value 0 to specify no separator.
3699 For these three options, use the value 0 to specify no separator.
3700 \layout List
3700 \layout List
3701 \labelwidthstring 00.00.0000
3701 \labelwidthstring 00.00.0000
3702
3702
3703
3703
3704 \family typewriter
3704 \family typewriter
3705 \series bold
3705 \series bold
3706 -nosep
3706 -nosep
3707 \series default
3707 \series default
3708 :
3708 :
3709 \family default
3709 \family default
3710 shorthand for
3710 shorthand for
3711 \family typewriter
3711 \family typewriter
3712 '-SeparateIn 0 -SeparateOut 0 -SeparateOut2 0'
3712 '-SeparateIn 0 -SeparateOut 0 -SeparateOut2 0'
3713 \family default
3713 \family default
3714 .
3714 .
3715 Simply removes all input/output separators.
3715 Simply removes all input/output separators.
3716 \layout List
3716 \layout List
3717 \labelwidthstring 00.00.0000
3717 \labelwidthstring 00.00.0000
3718
3718
3719
3719
3720 \family typewriter
3720 \family typewriter
3721 \series bold
3721 \series bold
3722 -upgrade
3722 -upgrade
3723 \family default
3723 \family default
3724 \series default
3724 \series default
3725 : allows you to upgrade your
3725 : allows you to upgrade your
3726 \family typewriter
3726 \family typewriter
3727 IPYTHONDIR
3727 IPYTHONDIR
3728 \family default
3728 \family default
3729 configuration when you install a new version of IPython.
3729 configuration when you install a new version of IPython.
3730 Since new versions may include new command line options or example files,
3730 Since new versions may include new command line options or example files,
3731 this copies updated ipythonrc-type files.
3731 this copies updated ipythonrc-type files.
3732 However, it backs up (with a
3732 However, it backs up (with a
3733 \family typewriter
3733 \family typewriter
3734 .old
3734 .old
3735 \family default
3735 \family default
3736 extension) all files which it overwrites so that you can merge back any
3736 extension) all files which it overwrites so that you can merge back any
3737 customizations you might have in your personal files.
3737 customizations you might have in your personal files.
3738 \layout List
3738 \layout List
3739 \labelwidthstring 00.00.0000
3739 \labelwidthstring 00.00.0000
3740
3740
3741
3741
3742 \family typewriter
3742 \family typewriter
3743 \series bold
3743 \series bold
3744 -Version
3744 -Version
3745 \series default
3745 \series default
3746 :
3746 :
3747 \family default
3747 \family default
3748 print version information and exit.
3748 print version information and exit.
3749 \layout List
3749 \layout List
3750 \labelwidthstring 00.00.0000
3750 \labelwidthstring 00.00.0000
3751
3751
3752
3752
3753 \family typewriter
3753 \family typewriter
3754 \series bold
3754 \series bold
3755 -wxversion\SpecialChar ~
3755 -wxversion\SpecialChar ~
3756 <string>:
3756 <string>:
3757 \family default
3757 \family default
3758 \series default
3758 \series default
3759 Select a specific version of wxPython (used in conjunction with
3759 Select a specific version of wxPython (used in conjunction with
3760 \family typewriter
3760 \family typewriter
3761 -wthread
3761 -wthread
3762 \family default
3762 \family default
3763 ).
3763 ).
3764 Requires the wxversion module, part of recent wxPython distributions
3764 Requires the wxversion module, part of recent wxPython distributions
3765 \layout List
3765 \layout List
3766 \labelwidthstring 00.00.0000
3766 \labelwidthstring 00.00.0000
3767
3767
3768
3768
3769 \family typewriter
3769 \family typewriter
3770 \series bold
3770 \series bold
3771 -xmode\SpecialChar ~
3771 -xmode\SpecialChar ~
3772 <modename>
3772 <modename>
3773 \series default
3773 \series default
3774 :
3774 :
3775 \family default
3775 \family default
3776 Mode for exception reporting.
3776 Mode for exception reporting.
3777 \layout List
3777 \layout List
3778 \labelwidthstring 00.00.0000
3778 \labelwidthstring 00.00.0000
3779
3779
3780 \SpecialChar ~
3780 \SpecialChar ~
3781 Valid modes: Plain, Context and Verbose.
3781 Valid modes: Plain, Context and Verbose.
3782 \layout List
3782 \layout List
3783 \labelwidthstring 00.00.0000
3783 \labelwidthstring 00.00.0000
3784
3784
3785 \SpecialChar ~
3785 \SpecialChar ~
3786 Plain: similar to python's normal traceback printing.
3786 Plain: similar to python's normal traceback printing.
3787 \layout List
3787 \layout List
3788 \labelwidthstring 00.00.0000
3788 \labelwidthstring 00.00.0000
3789
3789
3790 \SpecialChar ~
3790 \SpecialChar ~
3791 Context: prints 5 lines of context source code around each line in the
3791 Context: prints 5 lines of context source code around each line in the
3792 traceback.
3792 traceback.
3793 \layout List
3793 \layout List
3794 \labelwidthstring 00.00.0000
3794 \labelwidthstring 00.00.0000
3795
3795
3796 \SpecialChar ~
3796 \SpecialChar ~
3797 Verbose: similar to Context, but additionally prints the variables currently
3797 Verbose: similar to Context, but additionally prints the variables currently
3798 visible where the exception happened (shortening their strings if too long).
3798 visible where the exception happened (shortening their strings if too long).
3799 This can potentially be very slow, if you happen to have a huge data structure
3799 This can potentially be very slow, if you happen to have a huge data structure
3800 whose string representation is complex to compute.
3800 whose string representation is complex to compute.
3801 Your computer may appear to freeze for a while with cpu usage at 100%.
3801 Your computer may appear to freeze for a while with cpu usage at 100%.
3802 If this occurs, you can cancel the traceback with Ctrl-C (maybe hitting
3802 If this occurs, you can cancel the traceback with Ctrl-C (maybe hitting
3803 it more than once).
3803 it more than once).
3804 \layout Section
3804 \layout Section
3805
3805
3806 Interactive use
3806 Interactive use
3807 \layout Standard
3807 \layout Standard
3808
3808
3809
3809
3810 \series bold
3810 \series bold
3811 Warning
3811 Warning
3812 \series default
3812 \series default
3813 : IPython relies on the existence of a global variable called
3813 : IPython relies on the existence of a global variable called
3814 \family typewriter
3814 \family typewriter
3815 __IP
3815 __IP
3816 \family default
3816 \family default
3817 which controls the shell itself.
3817 which controls the shell itself.
3818 If you redefine
3818 If you redefine
3819 \family typewriter
3819 \family typewriter
3820 __IP
3820 __IP
3821 \family default
3821 \family default
3822 to anything, bizarre behavior will quickly occur.
3822 to anything, bizarre behavior will quickly occur.
3823 \layout Standard
3823 \layout Standard
3824
3824
3825 Other than the above warning, IPython is meant to work as a drop-in replacement
3825 Other than the above warning, IPython is meant to work as a drop-in replacement
3826 for the standard interactive interpreter.
3826 for the standard interactive interpreter.
3827 As such, any code which is valid python should execute normally under IPython
3827 As such, any code which is valid python should execute normally under IPython
3828 (cases where this is not true should be reported as bugs).
3828 (cases where this is not true should be reported as bugs).
3829 It does, however, offer many features which are not available at a standard
3829 It does, however, offer many features which are not available at a standard
3830 python prompt.
3830 python prompt.
3831 What follows is a list of these.
3831 What follows is a list of these.
3832 \layout Subsection
3832 \layout Subsection
3833
3833
3834 Caution for Windows users
3834 Caution for Windows users
3835 \layout Standard
3835 \layout Standard
3836
3836
3837 Windows, unfortunately, uses the `
3837 Windows, unfortunately, uses the `
3838 \family typewriter
3838 \family typewriter
3839
3839
3840 \backslash
3840 \backslash
3841
3841
3842 \family default
3842 \family default
3843 ' character as a path separator.
3843 ' character as a path separator.
3844 This is a terrible choice, because `
3844 This is a terrible choice, because `
3845 \family typewriter
3845 \family typewriter
3846
3846
3847 \backslash
3847 \backslash
3848
3848
3849 \family default
3849 \family default
3850 ' also represents the escape character in most modern programming languages,
3850 ' also represents the escape character in most modern programming languages,
3851 including Python.
3851 including Python.
3852 For this reason, issuing many of the commands discussed below (especially
3852 For this reason, issuing many of the commands discussed below (especially
3853 magics which affect the filesystem) with `
3853 magics which affect the filesystem) with `
3854 \family typewriter
3854 \family typewriter
3855
3855
3856 \backslash
3856 \backslash
3857
3857
3858 \family default
3858 \family default
3859 ' in them will cause strange errors.
3859 ' in them will cause strange errors.
3860 \layout Standard
3860 \layout Standard
3861
3861
3862 A partial solution is to use instead the `
3862 A partial solution is to use instead the `
3863 \family typewriter
3863 \family typewriter
3864 /
3864 /
3865 \family default
3865 \family default
3866 ' character as a path separator, which Windows recognizes in
3866 ' character as a path separator, which Windows recognizes in
3867 \emph on
3867 \emph on
3868 most
3868 most
3869 \emph default
3869 \emph default
3870 situations.
3870 situations.
3871 However, in Windows commands `
3871 However, in Windows commands `
3872 \family typewriter
3872 \family typewriter
3873 /
3873 /
3874 \family default
3874 \family default
3875 ' flags options, so you can not use it for the root directory.
3875 ' flags options, so you can not use it for the root directory.
3876 This means that paths beginning at the root must be typed in a contrived
3876 This means that paths beginning at the root must be typed in a contrived
3877 manner like:
3877 manner like:
3878 \newline
3878 \newline
3879
3879
3880 \family typewriter
3880 \family typewriter
3881 %copy
3881 %copy
3882 \backslash
3882 \backslash
3883 opt/foo/bar.txt
3883 opt/foo/bar.txt
3884 \backslash
3884 \backslash
3885 tmp
3885 tmp
3886 \layout Standard
3886 \layout Standard
3887
3887
3888 There is no sensible thing IPython can do to truly work around this flaw
3888 There is no sensible thing IPython can do to truly work around this flaw
3889 in Windows
3889 in Windows
3890 \begin_inset Foot
3890 \begin_inset Foot
3891 collapsed true
3891 collapsed true
3892
3892
3893 \layout Standard
3893 \layout Standard
3894
3894
3895 If anyone comes up with a
3895 If anyone comes up with a
3896 \emph on
3896 \emph on
3897 clean
3897 clean
3898 \emph default
3898 \emph default
3899 solution which works consistently and does not negatively impact other
3899 solution which works consistently and does not negatively impact other
3900 platforms at all, I'll gladly accept a patch.
3900 platforms at all, I'll gladly accept a patch.
3901 \end_inset
3901 \end_inset
3902
3902
3903 .
3903 .
3904 \layout Subsection
3904 \layout Subsection
3905
3905
3906
3906
3907 \begin_inset LatexCommand \label{sec:magic}
3907 \begin_inset LatexCommand \label{sec:magic}
3908
3908
3909 \end_inset
3909 \end_inset
3910
3910
3911 Magic command system
3911 Magic command system
3912 \layout Standard
3912 \layout Standard
3913
3913
3914 IPython will treat any line whose first character is a
3914 IPython will treat any line whose first character is a
3915 \family typewriter
3915 \family typewriter
3916 %
3916 %
3917 \family default
3917 \family default
3918 as a special call to a 'magic' function.
3918 as a special call to a 'magic' function.
3919 These allow you to control the behavior of IPython itself, plus a lot of
3919 These allow you to control the behavior of IPython itself, plus a lot of
3920 system-type features.
3920 system-type features.
3921 They are all prefixed with a
3921 They are all prefixed with a
3922 \family typewriter
3922 \family typewriter
3923 %
3923 %
3924 \family default
3924 \family default
3925 character, but parameters are given without parentheses or quotes.
3925 character, but parameters are given without parentheses or quotes.
3926 \layout Standard
3926 \layout Standard
3927
3927
3928 Example: typing
3928 Example: typing
3929 \family typewriter
3929 \family typewriter
3930 '%cd mydir'
3930 '%cd mydir'
3931 \family default
3931 \family default
3932 (without the quotes) changes you working directory to
3932 (without the quotes) changes you working directory to
3933 \family typewriter
3933 \family typewriter
3934 'mydir'
3934 'mydir'
3935 \family default
3935 \family default
3936 , if it exists.
3936 , if it exists.
3937 \layout Standard
3937 \layout Standard
3938
3938
3939 If you have 'automagic' enabled (in your
3939 If you have 'automagic' enabled (in your
3940 \family typewriter
3940 \family typewriter
3941 ipythonrc
3941 ipythonrc
3942 \family default
3942 \family default
3943 file, via the command line option
3943 file, via the command line option
3944 \family typewriter
3944 \family typewriter
3945 -automagic
3945 -automagic
3946 \family default
3946 \family default
3947 or with the
3947 or with the
3948 \family typewriter
3948 \family typewriter
3949 %automagic
3949 %automagic
3950 \family default
3950 \family default
3951 function), you don't need to type in the
3951 function), you don't need to type in the
3952 \family typewriter
3952 \family typewriter
3953 %
3953 %
3954 \family default
3954 \family default
3955 explicitly.
3955 explicitly.
3956 IPython will scan its internal list of magic functions and call one if
3956 IPython will scan its internal list of magic functions and call one if
3957 it exists.
3957 it exists.
3958 With automagic on you can then just type '
3958 With automagic on you can then just type '
3959 \family typewriter
3959 \family typewriter
3960 cd mydir
3960 cd mydir
3961 \family default
3961 \family default
3962 ' to go to directory '
3962 ' to go to directory '
3963 \family typewriter
3963 \family typewriter
3964 mydir
3964 mydir
3965 \family default
3965 \family default
3966 '.
3966 '.
3967 The automagic system has the lowest possible precedence in name searches,
3967 The automagic system has the lowest possible precedence in name searches,
3968 so defining an identifier with the same name as an existing magic function
3968 so defining an identifier with the same name as an existing magic function
3969 will shadow it for automagic use.
3969 will shadow it for automagic use.
3970 You can still access the shadowed magic function by explicitly using the
3970 You can still access the shadowed magic function by explicitly using the
3971
3971
3972 \family typewriter
3972 \family typewriter
3973 %
3973 %
3974 \family default
3974 \family default
3975 character at the beginning of the line.
3975 character at the beginning of the line.
3976 \layout Standard
3976 \layout Standard
3977
3977
3978 An example (with automagic on) should clarify all this:
3978 An example (with automagic on) should clarify all this:
3979 \layout LyX-Code
3979 \layout LyX-Code
3980
3980
3981 In [1]: cd ipython # %cd is called by automagic
3981 In [1]: cd ipython # %cd is called by automagic
3982 \layout LyX-Code
3982 \layout LyX-Code
3983
3983
3984 /home/fperez/ipython
3984 /home/fperez/ipython
3985 \layout LyX-Code
3985 \layout LyX-Code
3986
3986
3987 In [2]: cd=1 # now cd is just a variable
3987 In [2]: cd=1 # now cd is just a variable
3988 \layout LyX-Code
3988 \layout LyX-Code
3989
3989
3990 In [3]: cd ..
3990 In [3]: cd ..
3991 # and doesn't work as a function anymore
3991 # and doesn't work as a function anymore
3992 \layout LyX-Code
3992 \layout LyX-Code
3993
3993
3994 ------------------------------------------------------------
3994 ------------------------------------------------------------
3995 \layout LyX-Code
3995 \layout LyX-Code
3996
3996
3997 File "<console>", line 1
3997 File "<console>", line 1
3998 \layout LyX-Code
3998 \layout LyX-Code
3999
3999
4000 cd ..
4000 cd ..
4001 \layout LyX-Code
4001 \layout LyX-Code
4002
4002
4003 ^
4003 ^
4004 \layout LyX-Code
4004 \layout LyX-Code
4005
4005
4006 SyntaxError: invalid syntax
4006 SyntaxError: invalid syntax
4007 \layout LyX-Code
4007 \layout LyX-Code
4008
4008
4009 \layout LyX-Code
4009 \layout LyX-Code
4010
4010
4011 In [4]: %cd ..
4011 In [4]: %cd ..
4012 # but %cd always works
4012 # but %cd always works
4013 \layout LyX-Code
4013 \layout LyX-Code
4014
4014
4015 /home/fperez
4015 /home/fperez
4016 \layout LyX-Code
4016 \layout LyX-Code
4017
4017
4018 In [5]: del cd # if you remove the cd variable
4018 In [5]: del cd # if you remove the cd variable
4019 \layout LyX-Code
4019 \layout LyX-Code
4020
4020
4021 In [6]: cd ipython # automagic can work again
4021 In [6]: cd ipython # automagic can work again
4022 \layout LyX-Code
4022 \layout LyX-Code
4023
4023
4024 /home/fperez/ipython
4024 /home/fperez/ipython
4025 \layout Standard
4025 \layout Standard
4026
4026
4027 You can define your own magic functions to extend the system.
4027 You can define your own magic functions to extend the system.
4028 The following is a snippet of code which shows how to do it.
4028 The following is a snippet of code which shows how to do it.
4029 It is provided as file
4029 It is provided as file
4030 \family typewriter
4030 \family typewriter
4031 example-magic.py
4031 example-magic.py
4032 \family default
4032 \family default
4033 in the examples directory:
4033 in the examples directory:
4034 \layout Standard
4034 \layout Standard
4035
4035
4036
4036
4037 \begin_inset ERT
4037 \begin_inset ERT
4038 status Open
4038 status Open
4039
4039
4040 \layout Standard
4040 \layout Standard
4041
4041
4042 \backslash
4042 \backslash
4043 codelist{examples/example-magic.py}
4043 codelist{examples/example-magic.py}
4044 \end_inset
4044 \end_inset
4045
4045
4046
4046
4047 \layout Standard
4047 \layout Standard
4048
4048
4049 You can also define your own aliased names for magic functions.
4049 You can also define your own aliased names for magic functions.
4050 In your
4050 In your
4051 \family typewriter
4051 \family typewriter
4052 ipythonrc
4052 ipythonrc
4053 \family default
4053 \family default
4054 file, placing a line like:
4054 file, placing a line like:
4055 \layout Standard
4055 \layout Standard
4056
4056
4057
4057
4058 \family typewriter
4058 \family typewriter
4059 execute __IP.magic_cl = __IP.magic_clear
4059 execute __IP.magic_cl = __IP.magic_clear
4060 \layout Standard
4060 \layout Standard
4061
4061
4062 will define
4062 will define
4063 \family typewriter
4063 \family typewriter
4064 %cl
4064 %cl
4065 \family default
4065 \family default
4066 as a new name for
4066 as a new name for
4067 \family typewriter
4067 \family typewriter
4068 %clear
4068 %clear
4069 \family default
4069 \family default
4070 .
4070 .
4071 \layout Standard
4071 \layout Standard
4072
4072
4073 Type
4073 Type
4074 \family typewriter
4074 \family typewriter
4075 %magic
4075 %magic
4076 \family default
4076 \family default
4077 for more information, including a list of all available magic functions
4077 for more information, including a list of all available magic functions
4078 at any time and their docstrings.
4078 at any time and their docstrings.
4079 You can also type
4079 You can also type
4080 \family typewriter
4080 \family typewriter
4081 %magic_function_name?
4081 %magic_function_name?
4082 \family default
4082 \family default
4083 (see sec.
4083 (see sec.
4084
4084
4085 \begin_inset LatexCommand \ref{sec:dyn-object-info}
4085 \begin_inset LatexCommand \ref{sec:dyn-object-info}
4086
4086
4087 \end_inset
4087 \end_inset
4088
4088
4089 for information on the
4089 for information on the
4090 \family typewriter
4090 \family typewriter
4091 '?'
4091 '?'
4092 \family default
4092 \family default
4093 system) to get information about any particular magic function you are
4093 system) to get information about any particular magic function you are
4094 interested in.
4094 interested in.
4095 \layout Subsubsection
4095 \layout Subsubsection
4096
4096
4097 Magic commands
4097 Magic commands
4098 \layout Standard
4098 \layout Standard
4099
4099
4100 The rest of this section is automatically generated for each release from
4100 The rest of this section is automatically generated for each release from
4101 the docstrings in the IPython code.
4101 the docstrings in the IPython code.
4102 Therefore the formatting is somewhat minimal, but this method has the advantage
4102 Therefore the formatting is somewhat minimal, but this method has the advantage
4103 of having information always in sync with the code.
4103 of having information always in sync with the code.
4104 \layout Standard
4104 \layout Standard
4105
4105
4106 A list of all the magic commands available in IPython's
4106 A list of all the magic commands available in IPython's
4107 \emph on
4107 \emph on
4108 default
4108 default
4109 \emph default
4109 \emph default
4110 installation follows.
4110 installation follows.
4111 This is similar to what you'll see by simply typing
4111 This is similar to what you'll see by simply typing
4112 \family typewriter
4112 \family typewriter
4113 %magic
4113 %magic
4114 \family default
4114 \family default
4115 at the prompt, but that will also give you information about magic commands
4115 at the prompt, but that will also give you information about magic commands
4116 you may have added as part of your personal customizations.
4116 you may have added as part of your personal customizations.
4117 \layout Standard
4117 \layout Standard
4118
4118
4119
4119
4120 \begin_inset Include \input{magic.tex}
4120 \begin_inset Include \input{magic.tex}
4121 preview false
4121 preview false
4122
4122
4123 \end_inset
4123 \end_inset
4124
4124
4125
4125
4126 \layout Subsection
4126 \layout Subsection
4127
4127
4128 Access to the standard Python help
4128 Access to the standard Python help
4129 \layout Standard
4129 \layout Standard
4130
4130
4131 As of Python 2.1, a help system is available with access to object docstrings
4131 As of Python 2.1, a help system is available with access to object docstrings
4132 and the Python manuals.
4132 and the Python manuals.
4133 Simply type
4133 Simply type
4134 \family typewriter
4134 \family typewriter
4135 'help'
4135 'help'
4136 \family default
4136 \family default
4137 (no quotes) to access it.
4137 (no quotes) to access it.
4138 You can also type
4138 You can also type
4139 \family typewriter
4139 \family typewriter
4140 help(object)
4140 help(object)
4141 \family default
4141 \family default
4142 to obtain information about a given object, and
4142 to obtain information about a given object, and
4143 \family typewriter
4143 \family typewriter
4144 help('keyword')
4144 help('keyword')
4145 \family default
4145 \family default
4146 for information on a keyword.
4146 for information on a keyword.
4147 As noted in sec.
4147 As noted in sec.
4148
4148
4149 \begin_inset LatexCommand \ref{sec:help-access}
4149 \begin_inset LatexCommand \ref{sec:help-access}
4150
4150
4151 \end_inset
4151 \end_inset
4152
4152
4153 , you need to properly configure your environment variable
4153 , you need to properly configure your environment variable
4154 \family typewriter
4154 \family typewriter
4155 PYTHONDOCS
4155 PYTHONDOCS
4156 \family default
4156 \family default
4157 for this feature to work correctly.
4157 for this feature to work correctly.
4158 \layout Subsection
4158 \layout Subsection
4159
4159
4160
4160
4161 \begin_inset LatexCommand \label{sec:dyn-object-info}
4161 \begin_inset LatexCommand \label{sec:dyn-object-info}
4162
4162
4163 \end_inset
4163 \end_inset
4164
4164
4165 Dynamic object information
4165 Dynamic object information
4166 \layout Standard
4166 \layout Standard
4167
4167
4168 Typing
4168 Typing
4169 \family typewriter
4169 \family typewriter
4170 ?word
4170 ?word
4171 \family default
4171 \family default
4172 or
4172 or
4173 \family typewriter
4173 \family typewriter
4174 word?
4174 word?
4175 \family default
4175 \family default
4176 prints detailed information about an object.
4176 prints detailed information about an object.
4177 If certain strings in the object are too long (docstrings, code, etc.) they
4177 If certain strings in the object are too long (docstrings, code, etc.) they
4178 get snipped in the center for brevity.
4178 get snipped in the center for brevity.
4179 This system gives access variable types and values, full source code for
4179 This system gives access variable types and values, full source code for
4180 any object (if available), function prototypes and other useful information.
4180 any object (if available), function prototypes and other useful information.
4181 \layout Standard
4181 \layout Standard
4182
4182
4183 Typing
4183 Typing
4184 \family typewriter
4184 \family typewriter
4185 ??word
4185 ??word
4186 \family default
4186 \family default
4187 or
4187 or
4188 \family typewriter
4188 \family typewriter
4189 word??
4189 word??
4190 \family default
4190 \family default
4191 gives access to the full information without snipping long strings.
4191 gives access to the full information without snipping long strings.
4192 Long strings are sent to the screen through the
4192 Long strings are sent to the screen through the
4193 \family typewriter
4193 \family typewriter
4194 less
4194 less
4195 \family default
4195 \family default
4196 pager if longer than the screen and printed otherwise.
4196 pager if longer than the screen and printed otherwise.
4197 On systems lacking the
4197 On systems lacking the
4198 \family typewriter
4198 \family typewriter
4199 less
4199 less
4200 \family default
4200 \family default
4201 command, IPython uses a very basic internal pager.
4201 command, IPython uses a very basic internal pager.
4202 \layout Standard
4202 \layout Standard
4203
4203
4204 The following magic functions are particularly useful for gathering information
4204 The following magic functions are particularly useful for gathering information
4205 about your working environment.
4205 about your working environment.
4206 You can get more details by typing
4206 You can get more details by typing
4207 \family typewriter
4207 \family typewriter
4208 %magic
4208 %magic
4209 \family default
4209 \family default
4210 or querying them individually (use
4210 or querying them individually (use
4211 \family typewriter
4211 \family typewriter
4212 %function_name?
4212 %function_name?
4213 \family default
4213 \family default
4214 with or without the
4214 with or without the
4215 \family typewriter
4215 \family typewriter
4216 %
4216 %
4217 \family default
4217 \family default
4218 ), this is just a summary:
4218 ), this is just a summary:
4219 \layout List
4219 \layout List
4220 \labelwidthstring 00.00.0000
4220 \labelwidthstring 00.00.0000
4221
4221
4222
4222
4223 \family typewriter
4223 \family typewriter
4224 \series bold
4224 \series bold
4225 %pdoc\SpecialChar ~
4225 %pdoc\SpecialChar ~
4226 <object>
4226 <object>
4227 \family default
4227 \family default
4228 \series default
4228 \series default
4229 : Print (or run through a pager if too long) the docstring for an object.
4229 : Print (or run through a pager if too long) the docstring for an object.
4230 If the given object is a class, it will print both the class and the constructo
4230 If the given object is a class, it will print both the class and the constructo
4231 r docstrings.
4231 r docstrings.
4232 \layout List
4232 \layout List
4233 \labelwidthstring 00.00.0000
4233 \labelwidthstring 00.00.0000
4234
4234
4235
4235
4236 \family typewriter
4236 \family typewriter
4237 \series bold
4237 \series bold
4238 %pdef\SpecialChar ~
4238 %pdef\SpecialChar ~
4239 <object>
4239 <object>
4240 \family default
4240 \family default
4241 \series default
4241 \series default
4242 : Print the definition header for any callable object.
4242 : Print the definition header for any callable object.
4243 If the object is a class, print the constructor information.
4243 If the object is a class, print the constructor information.
4244 \layout List
4244 \layout List
4245 \labelwidthstring 00.00.0000
4245 \labelwidthstring 00.00.0000
4246
4246
4247
4247
4248 \family typewriter
4248 \family typewriter
4249 \series bold
4249 \series bold
4250 %psource\SpecialChar ~
4250 %psource\SpecialChar ~
4251 <object>
4251 <object>
4252 \family default
4252 \family default
4253 \series default
4253 \series default
4254 : Print (or run through a pager if too long) the source code for an object.
4254 : Print (or run through a pager if too long) the source code for an object.
4255 \layout List
4255 \layout List
4256 \labelwidthstring 00.00.0000
4256 \labelwidthstring 00.00.0000
4257
4257
4258
4258
4259 \family typewriter
4259 \family typewriter
4260 \series bold
4260 \series bold
4261 %pfile\SpecialChar ~
4261 %pfile\SpecialChar ~
4262 <object>
4262 <object>
4263 \family default
4263 \family default
4264 \series default
4264 \series default
4265 : Show the entire source file where an object was defined via a pager, opening
4265 : Show the entire source file where an object was defined via a pager, opening
4266 it at the line where the object definition begins.
4266 it at the line where the object definition begins.
4267 \layout List
4267 \layout List
4268 \labelwidthstring 00.00.0000
4268 \labelwidthstring 00.00.0000
4269
4269
4270
4270
4271 \family typewriter
4271 \family typewriter
4272 \series bold
4272 \series bold
4273 %who/%whos
4273 %who/%whos
4274 \family default
4274 \family default
4275 \series default
4275 \series default
4276 : These functions give information about identifiers you have defined interactiv
4276 : These functions give information about identifiers you have defined interactiv
4277 ely (not things you loaded or defined in your configuration files).
4277 ely (not things you loaded or defined in your configuration files).
4278
4278
4279 \family typewriter
4279 \family typewriter
4280 %who
4280 %who
4281 \family default
4281 \family default
4282 just prints a list of identifiers and
4282 just prints a list of identifiers and
4283 \family typewriter
4283 \family typewriter
4284 %whos
4284 %whos
4285 \family default
4285 \family default
4286 prints a table with some basic details about each identifier.
4286 prints a table with some basic details about each identifier.
4287 \layout Standard
4287 \layout Standard
4288
4288
4289 Note that the dynamic object information functions (
4289 Note that the dynamic object information functions (
4290 \family typewriter
4290 \family typewriter
4291 ?/??, %pdoc, %pfile, %pdef, %psource
4291 ?/??, %pdoc, %pfile, %pdef, %psource
4292 \family default
4292 \family default
4293 ) give you access to documentation even on things which are not really defined
4293 ) give you access to documentation even on things which are not really defined
4294 as separate identifiers.
4294 as separate identifiers.
4295 Try for example typing
4295 Try for example typing
4296 \family typewriter
4296 \family typewriter
4297 {}.get?
4297 {}.get?
4298 \family default
4298 \family default
4299 or after doing
4299 or after doing
4300 \family typewriter
4300 \family typewriter
4301 import os
4301 import os
4302 \family default
4302 \family default
4303 , type
4303 , type
4304 \family typewriter
4304 \family typewriter
4305 os.path.abspath??
4305 os.path.abspath??
4306 \family default
4306 \family default
4307 .
4307 .
4308 \layout Subsection
4308 \layout Subsection
4309
4309
4310
4310
4311 \begin_inset LatexCommand \label{sec:readline}
4311 \begin_inset LatexCommand \label{sec:readline}
4312
4312
4313 \end_inset
4313 \end_inset
4314
4314
4315 Readline-based features
4315 Readline-based features
4316 \layout Standard
4316 \layout Standard
4317
4317
4318 These features require the GNU readline library, so they won't work if your
4318 These features require the GNU readline library, so they won't work if your
4319 Python installation lacks readline support.
4319 Python installation lacks readline support.
4320 We will first describe the default behavior IPython uses, and then how
4320 We will first describe the default behavior IPython uses, and then how
4321 to change it to suit your preferences.
4321 to change it to suit your preferences.
4322 \layout Subsubsection
4322 \layout Subsubsection
4323
4323
4324 Command line completion
4324 Command line completion
4325 \layout Standard
4325 \layout Standard
4326
4326
4327 At any time, hitting TAB will complete any available python commands or
4327 At any time, hitting TAB will complete any available python commands or
4328 variable names, and show you a list of the possible completions if there's
4328 variable names, and show you a list of the possible completions if there's
4329 no unambiguous one.
4329 no unambiguous one.
4330 It will also complete filenames in the current directory if no python names
4330 It will also complete filenames in the current directory if no python names
4331 match what you've typed so far.
4331 match what you've typed so far.
4332 \layout Subsubsection
4332 \layout Subsubsection
4333
4333
4334 Search command history
4334 Search command history
4335 \layout Standard
4335 \layout Standard
4336
4336
4337 IPython provides two ways for searching through previous input and thus
4337 IPython provides two ways for searching through previous input and thus
4338 reduce the need for repetitive typing:
4338 reduce the need for repetitive typing:
4339 \layout Enumerate
4339 \layout Enumerate
4340
4340
4341 Start typing, and then use
4341 Start typing, and then use
4342 \family typewriter
4342 \family typewriter
4343 Ctrl-p
4343 Ctrl-p
4344 \family default
4344 \family default
4345 (previous,up) and
4345 (previous,up) and
4346 \family typewriter
4346 \family typewriter
4347 Ctrl-n
4347 Ctrl-n
4348 \family default
4348 \family default
4349 (next,down) to search through only the history items that match what you've
4349 (next,down) to search through only the history items that match what you've
4350 typed so far.
4350 typed so far.
4351 If you use
4351 If you use
4352 \family typewriter
4352 \family typewriter
4353 Ctrl-p/Ctrl-n
4353 Ctrl-p/Ctrl-n
4354 \family default
4354 \family default
4355 at a blank prompt, they just behave like normal arrow keys.
4355 at a blank prompt, they just behave like normal arrow keys.
4356 \layout Enumerate
4356 \layout Enumerate
4357
4357
4358 Hit
4358 Hit
4359 \family typewriter
4359 \family typewriter
4360 Ctrl-r
4360 Ctrl-r
4361 \family default
4361 \family default
4362 : opens a search prompt.
4362 : opens a search prompt.
4363 Begin typing and the system searches your history for lines that contain
4363 Begin typing and the system searches your history for lines that contain
4364 what you've typed so far, completing as much as it can.
4364 what you've typed so far, completing as much as it can.
4365 \layout Subsubsection
4365 \layout Subsubsection
4366
4366
4367 Persistent command history across sessions
4367 Persistent command history across sessions
4368 \layout Standard
4368 \layout Standard
4369
4369
4370 IPython will save your input history when it leaves and reload it next time
4370 IPython will save your input history when it leaves and reload it next time
4371 you restart it.
4371 you restart it.
4372 By default, the history file is named
4372 By default, the history file is named
4373 \family typewriter
4373 \family typewriter
4374 $IPYTHONDIR/history
4374 $IPYTHONDIR/history
4375 \family default
4375 \family default
4376 , but if you've loaded a named profile, '
4376 , but if you've loaded a named profile, '
4377 \family typewriter
4377 \family typewriter
4378 -PROFILE_NAME
4378 -PROFILE_NAME
4379 \family default
4379 \family default
4380 ' is appended to the name.
4380 ' is appended to the name.
4381 This allows you to keep separate histories related to various tasks: commands
4381 This allows you to keep separate histories related to various tasks: commands
4382 related to numerical work will not be clobbered by a system shell history,
4382 related to numerical work will not be clobbered by a system shell history,
4383 for example.
4383 for example.
4384 \layout Subsubsection
4384 \layout Subsubsection
4385
4385
4386 Autoindent
4386 Autoindent
4387 \layout Standard
4387 \layout Standard
4388
4388
4389 IPython can recognize lines ending in ':' and indent the next line, while
4389 IPython can recognize lines ending in ':' and indent the next line, while
4390 also un-indenting automatically after 'raise' or 'return'.
4390 also un-indenting automatically after 'raise' or 'return'.
4391
4391
4392 \layout Standard
4392 \layout Standard
4393
4393
4394 This feature uses the readline library, so it will honor your
4394 This feature uses the readline library, so it will honor your
4395 \family typewriter
4395 \family typewriter
4396 ~/.inputrc
4396 ~/.inputrc
4397 \family default
4397 \family default
4398 configuration (or whatever file your
4398 configuration (or whatever file your
4399 \family typewriter
4399 \family typewriter
4400 INPUTRC
4400 INPUTRC
4401 \family default
4401 \family default
4402 variable points to).
4402 variable points to).
4403 Adding the following lines to your
4403 Adding the following lines to your
4404 \family typewriter
4404 \family typewriter
4405 .inputrc
4405 .inputrc
4406 \family default
4406 \family default
4407 file can make indenting/unindenting more convenient (
4407 file can make indenting/unindenting more convenient (
4408 \family typewriter
4408 \family typewriter
4409 M-i
4409 M-i
4410 \family default
4410 \family default
4411 indents,
4411 indents,
4412 \family typewriter
4412 \family typewriter
4413 M-u
4413 M-u
4414 \family default
4414 \family default
4415 unindents):
4415 unindents):
4416 \layout Standard
4416 \layout Standard
4417
4417
4418
4418
4419 \family typewriter
4419 \family typewriter
4420 $if Python
4420 $if Python
4421 \newline
4421 \newline
4422 "
4422 "
4423 \backslash
4423 \backslash
4424 M-i": "\SpecialChar ~
4424 M-i": "\SpecialChar ~
4425 \SpecialChar ~
4425 \SpecialChar ~
4426 \SpecialChar ~
4426 \SpecialChar ~
4427 \SpecialChar ~
4427 \SpecialChar ~
4428 "
4428 "
4429 \newline
4429 \newline
4430 "
4430 "
4431 \backslash
4431 \backslash
4432 M-u": "
4432 M-u": "
4433 \backslash
4433 \backslash
4434 d
4434 d
4435 \backslash
4435 \backslash
4436 d
4436 d
4437 \backslash
4437 \backslash
4438 d
4438 d
4439 \backslash
4439 \backslash
4440 d"
4440 d"
4441 \newline
4441 \newline
4442 $endif
4442 $endif
4443 \layout Standard
4443 \layout Standard
4444
4444
4445 Note that there are 4 spaces between the quote marks after
4445 Note that there are 4 spaces between the quote marks after
4446 \family typewriter
4446 \family typewriter
4447 "M-i"
4447 "M-i"
4448 \family default
4448 \family default
4449 above.
4449 above.
4450 \layout Standard
4450 \layout Standard
4451
4451
4452
4452
4453 \series bold
4453 \series bold
4454 Warning:
4454 Warning:
4455 \series default
4455 \series default
4456 this feature is ON by default, but it can cause problems with the pasting
4456 this feature is ON by default, but it can cause problems with the pasting
4457 of multi-line indented code (the pasted code gets re-indented on each line).
4457 of multi-line indented code (the pasted code gets re-indented on each line).
4458 A magic function
4458 A magic function
4459 \family typewriter
4459 \family typewriter
4460 %autoindent
4460 %autoindent
4461 \family default
4461 \family default
4462 allows you to toggle it on/off at runtime.
4462 allows you to toggle it on/off at runtime.
4463 You can also disable it permanently on in your
4463 You can also disable it permanently on in your
4464 \family typewriter
4464 \family typewriter
4465 ipythonrc
4465 ipythonrc
4466 \family default
4466 \family default
4467 file (set
4467 file (set
4468 \family typewriter
4468 \family typewriter
4469 autoindent 0
4469 autoindent 0
4470 \family default
4470 \family default
4471 ).
4471 ).
4472 \layout Subsubsection
4472 \layout Subsubsection
4473
4473
4474 Customizing readline behavior
4474 Customizing readline behavior
4475 \layout Standard
4475 \layout Standard
4476
4476
4477 All these features are based on the GNU readline library, which has an extremely
4477 All these features are based on the GNU readline library, which has an extremely
4478 customizable interface.
4478 customizable interface.
4479 Normally, readline is configured via a file which defines the behavior
4479 Normally, readline is configured via a file which defines the behavior
4480 of the library; the details of the syntax for this can be found in the
4480 of the library; the details of the syntax for this can be found in the
4481 readline documentation available with your system or on the Internet.
4481 readline documentation available with your system or on the Internet.
4482 IPython doesn't read this file (if it exists) directly, but it does support
4482 IPython doesn't read this file (if it exists) directly, but it does support
4483 passing to readline valid options via a simple interface.
4483 passing to readline valid options via a simple interface.
4484 In brief, you can customize readline by setting the following options in
4484 In brief, you can customize readline by setting the following options in
4485 your
4485 your
4486 \family typewriter
4486 \family typewriter
4487 ipythonrc
4487 ipythonrc
4488 \family default
4488 \family default
4489 configuration file (note that these options can
4489 configuration file (note that these options can
4490 \emph on
4490 \emph on
4491 not
4491 not
4492 \emph default
4492 \emph default
4493 be specified at the command line):
4493 be specified at the command line):
4494 \layout List
4494 \layout List
4495 \labelwidthstring 00.00.0000
4495 \labelwidthstring 00.00.0000
4496
4496
4497
4497
4498 \family typewriter
4498 \family typewriter
4499 \series bold
4499 \series bold
4500 readline_parse_and_bind:
4500 readline_parse_and_bind:
4501 \family default
4501 \family default
4502 \series default
4502 \series default
4503 this option can appear as many times as you want, each time defining a
4503 this option can appear as many times as you want, each time defining a
4504 string to be executed via a
4504 string to be executed via a
4505 \family typewriter
4505 \family typewriter
4506 readline.parse_and_bind()
4506 readline.parse_and_bind()
4507 \family default
4507 \family default
4508 command.
4508 command.
4509 The syntax for valid commands of this kind can be found by reading the
4509 The syntax for valid commands of this kind can be found by reading the
4510 documentation for the GNU readline library, as these commands are of the
4510 documentation for the GNU readline library, as these commands are of the
4511 kind which readline accepts in its configuration file.
4511 kind which readline accepts in its configuration file.
4512 \layout List
4512 \layout List
4513 \labelwidthstring 00.00.0000
4513 \labelwidthstring 00.00.0000
4514
4514
4515
4515
4516 \family typewriter
4516 \family typewriter
4517 \series bold
4517 \series bold
4518 readline_remove_delims:
4518 readline_remove_delims:
4519 \family default
4519 \family default
4520 \series default
4520 \series default
4521 a string of characters to be removed from the default word-delimiters list
4521 a string of characters to be removed from the default word-delimiters list
4522 used by readline, so that completions may be performed on strings which
4522 used by readline, so that completions may be performed on strings which
4523 contain them.
4523 contain them.
4524 Do not change the default value unless you know what you're doing.
4524 Do not change the default value unless you know what you're doing.
4525 \layout List
4525 \layout List
4526 \labelwidthstring 00.00.0000
4526 \labelwidthstring 00.00.0000
4527
4527
4528
4528
4529 \family typewriter
4529 \family typewriter
4530 \series bold
4530 \series bold
4531 readline_omit__names
4531 readline_omit__names
4532 \family default
4532 \family default
4533 \series default
4533 \series default
4534 : when tab-completion is enabled, hitting
4534 : when tab-completion is enabled, hitting
4535 \family typewriter
4535 \family typewriter
4536 <tab>
4536 <tab>
4537 \family default
4537 \family default
4538 after a '
4538 after a '
4539 \family typewriter
4539 \family typewriter
4540 .
4540 .
4541 \family default
4541 \family default
4542 ' in a name will complete all attributes of an object, including all the
4542 ' in a name will complete all attributes of an object, including all the
4543 special methods whose names include double underscores (like
4543 special methods whose names include double underscores (like
4544 \family typewriter
4544 \family typewriter
4545 __getitem__
4545 __getitem__
4546 \family default
4546 \family default
4547 or
4547 or
4548 \family typewriter
4548 \family typewriter
4549 __class__
4549 __class__
4550 \family default
4550 \family default
4551 ).
4551 ).
4552 If you'd rather not see these names by default, you can set this option
4552 If you'd rather not see these names by default, you can set this option
4553 to 1.
4553 to 1.
4554 Note that even when this option is set, you can still see those names by
4554 Note that even when this option is set, you can still see those names by
4555 explicitly typing a
4555 explicitly typing a
4556 \family typewriter
4556 \family typewriter
4557 _
4557 _
4558 \family default
4558 \family default
4559 after the period and hitting
4559 after the period and hitting
4560 \family typewriter
4560 \family typewriter
4561 <tab>
4561 <tab>
4562 \family default
4562 \family default
4563 : '
4563 : '
4564 \family typewriter
4564 \family typewriter
4565 name._<tab>
4565 name._<tab>
4566 \family default
4566 \family default
4567 ' will always complete attribute names starting with '
4567 ' will always complete attribute names starting with '
4568 \family typewriter
4568 \family typewriter
4569 _
4569 _
4570 \family default
4570 \family default
4571 '.
4571 '.
4572 \layout List
4572 \layout List
4573 \labelwidthstring 00.00.0000
4573 \labelwidthstring 00.00.0000
4574
4574
4575 \SpecialChar ~
4575 \SpecialChar ~
4576 This option is off by default so that new users see all attributes of any
4576 This option is off by default so that new users see all attributes of any
4577 objects they are dealing with.
4577 objects they are dealing with.
4578 \layout Standard
4578 \layout Standard
4579
4579
4580 You will find the default values along with a corresponding detailed explanation
4580 You will find the default values along with a corresponding detailed explanation
4581 in your
4581 in your
4582 \family typewriter
4582 \family typewriter
4583 ipythonrc
4583 ipythonrc
4584 \family default
4584 \family default
4585 file.
4585 file.
4586 \layout Subsection
4586 \layout Subsection
4587
4587
4588 Session logging and restoring
4588 Session logging and restoring
4589 \layout Standard
4589 \layout Standard
4590
4590
4591 You can log all input from a session either by starting IPython with the
4591 You can log all input from a session either by starting IPython with the
4592 command line switches
4592 command line switches
4593 \family typewriter
4593 \family typewriter
4594 -log
4594 -log
4595 \family default
4595 \family default
4596 or
4596 or
4597 \family typewriter
4597 \family typewriter
4598 -logfile
4598 -logfile
4599 \family default
4599 \family default
4600 (see sec.
4600 (see sec.
4601
4601
4602 \begin_inset LatexCommand \ref{sec:cmd-line-opts}
4602 \begin_inset LatexCommand \ref{sec:cmd-line-opts}
4603
4603
4604 \end_inset
4604 \end_inset
4605
4605
4606 )or by activating the logging at any moment with the magic function
4606 )or by activating the logging at any moment with the magic function
4607 \family typewriter
4607 \family typewriter
4608 %logstart
4608 %logstart
4609 \family default
4609 \family default
4610 .
4610 .
4611
4611
4612 \layout Standard
4612 \layout Standard
4613
4613
4614 Log files can later be reloaded with the
4614 Log files can later be reloaded with the
4615 \family typewriter
4615 \family typewriter
4616 -logplay
4616 -logplay
4617 \family default
4617 \family default
4618 option and IPython will attempt to 'replay' the log by executing all the
4618 option and IPython will attempt to 'replay' the log by executing all the
4619 lines in it, thus restoring the state of a previous session.
4619 lines in it, thus restoring the state of a previous session.
4620 This feature is not quite perfect, but can still be useful in many cases.
4620 This feature is not quite perfect, but can still be useful in many cases.
4621 \layout Standard
4621 \layout Standard
4622
4622
4623 The log files can also be used as a way to have a permanent record of any
4623 The log files can also be used as a way to have a permanent record of any
4624 code you wrote while experimenting.
4624 code you wrote while experimenting.
4625 Log files are regular text files which you can later open in your favorite
4625 Log files are regular text files which you can later open in your favorite
4626 text editor to extract code or to 'clean them up' before using them to
4626 text editor to extract code or to 'clean them up' before using them to
4627 replay a session.
4627 replay a session.
4628 \layout Standard
4628 \layout Standard
4629
4629
4630 The
4630 The
4631 \family typewriter
4631 \family typewriter
4632 %logstart
4632 %logstart
4633 \family default
4633 \family default
4634 function for activating logging in mid-session is used as follows:
4634 function for activating logging in mid-session is used as follows:
4635 \layout Standard
4635 \layout Standard
4636
4636
4637
4637
4638 \family typewriter
4638 \family typewriter
4639 %logstart [log_name [log_mode]]
4639 %logstart [log_name [log_mode]]
4640 \layout Standard
4640 \layout Standard
4641
4641
4642 If no name is given, it defaults to a file named
4642 If no name is given, it defaults to a file named
4643 \family typewriter
4643 \family typewriter
4644 'log'
4644 'log'
4645 \family default
4645 \family default
4646 in your IPYTHONDIR directory, in
4646 in your IPYTHONDIR directory, in
4647 \family typewriter
4647 \family typewriter
4648 'rotate'
4648 'rotate'
4649 \family default
4649 \family default
4650 mode (see below).
4650 mode (see below).
4651 \layout Standard
4651 \layout Standard
4652
4652
4653 '
4653 '
4654 \family typewriter
4654 \family typewriter
4655 %logstart name
4655 %logstart name
4656 \family default
4656 \family default
4657 ' saves to file
4657 ' saves to file
4658 \family typewriter
4658 \family typewriter
4659 'name'
4659 'name'
4660 \family default
4660 \family default
4661 in
4661 in
4662 \family typewriter
4662 \family typewriter
4663 'backup'
4663 'backup'
4664 \family default
4664 \family default
4665 mode.
4665 mode.
4666 It saves your history up to that point and then continues logging.
4666 It saves your history up to that point and then continues logging.
4667 \layout Standard
4667 \layout Standard
4668
4668
4669
4669
4670 \family typewriter
4670 \family typewriter
4671 %logstart
4671 %logstart
4672 \family default
4672 \family default
4673 takes a second optional parameter: logging mode.
4673 takes a second optional parameter: logging mode.
4674 This can be one of (note that the modes are given unquoted):
4674 This can be one of (note that the modes are given unquoted):
4675 \layout List
4675 \layout List
4676 \labelwidthstring 00.00.0000
4676 \labelwidthstring 00.00.0000
4677
4677
4678
4678
4679 \family typewriter
4679 \family typewriter
4680 over
4680 over
4681 \family default
4681 \family default
4682 : overwrite existing
4682 : overwrite existing
4683 \family typewriter
4683 \family typewriter
4684 log_name
4684 log_name
4685 \family default
4685 \family default
4686 .
4686 .
4687 \layout List
4687 \layout List
4688 \labelwidthstring 00.00.0000
4688 \labelwidthstring 00.00.0000
4689
4689
4690
4690
4691 \family typewriter
4691 \family typewriter
4692 backup
4692 backup
4693 \family default
4693 \family default
4694 : rename (if exists) to
4694 : rename (if exists) to
4695 \family typewriter
4695 \family typewriter
4696 log_name~
4696 log_name~
4697 \family default
4697 \family default
4698 and start
4698 and start
4699 \family typewriter
4699 \family typewriter
4700 log_name
4700 log_name
4701 \family default
4701 \family default
4702 .
4702 .
4703 \layout List
4703 \layout List
4704 \labelwidthstring 00.00.0000
4704 \labelwidthstring 00.00.0000
4705
4705
4706
4706
4707 \family typewriter
4707 \family typewriter
4708 append
4708 append
4709 \family default
4709 \family default
4710 : well, that says it.
4710 : well, that says it.
4711 \layout List
4711 \layout List
4712 \labelwidthstring 00.00.0000
4712 \labelwidthstring 00.00.0000
4713
4713
4714
4714
4715 \family typewriter
4715 \family typewriter
4716 rotate
4716 rotate
4717 \family default
4717 \family default
4718 : create rotating logs
4718 : create rotating logs
4719 \family typewriter
4719 \family typewriter
4720 log_name
4720 log_name
4721 \family default
4721 \family default
4722 .
4722 .
4723 \family typewriter
4723 \family typewriter
4724 1~
4724 1~
4725 \family default
4725 \family default
4726 ,
4726 ,
4727 \family typewriter
4727 \family typewriter
4728 log_name.2~
4728 log_name.2~
4729 \family default
4729 \family default
4730 , etc.
4730 , etc.
4731 \layout Standard
4731 \layout Standard
4732
4732
4733 The
4733 The
4734 \family typewriter
4734 \family typewriter
4735 %logoff
4735 %logoff
4736 \family default
4736 \family default
4737 and
4737 and
4738 \family typewriter
4738 \family typewriter
4739 %logon
4739 %logon
4740 \family default
4740 \family default
4741 functions allow you to temporarily stop and resume logging to a file which
4741 functions allow you to temporarily stop and resume logging to a file which
4742 had previously been started with
4742 had previously been started with
4743 \family typewriter
4743 \family typewriter
4744 %logstart
4744 %logstart
4745 \family default
4745 \family default
4746 .
4746 .
4747 They will fail (with an explanation) if you try to use them before logging
4747 They will fail (with an explanation) if you try to use them before logging
4748 has been started.
4748 has been started.
4749 \layout Subsection
4749 \layout Subsection
4750
4750
4751
4751
4752 \begin_inset LatexCommand \label{sub:System-shell-access}
4752 \begin_inset LatexCommand \label{sub:System-shell-access}
4753
4753
4754 \end_inset
4754 \end_inset
4755
4755
4756 System shell access
4756 System shell access
4757 \layout Standard
4757 \layout Standard
4758
4758
4759 Any input line beginning with a
4759 Any input line beginning with a
4760 \family typewriter
4760 \family typewriter
4761 !
4761 !
4762 \family default
4762 \family default
4763 character is passed verbatim (minus the
4763 character is passed verbatim (minus the
4764 \family typewriter
4764 \family typewriter
4765 !
4765 !
4766 \family default
4766 \family default
4767 , of course) to the underlying operating system.
4767 , of course) to the underlying operating system.
4768 For example, typing
4768 For example, typing
4769 \family typewriter
4769 \family typewriter
4770 !ls
4770 !ls
4771 \family default
4771 \family default
4772 will run
4772 will run
4773 \family typewriter
4773 \family typewriter
4774 'ls'
4774 'ls'
4775 \family default
4775 \family default
4776 in the current directory.
4776 in the current directory.
4777 \layout Subsubsection
4777 \layout Subsubsection
4778
4778
4779 Manual capture of command output
4779 Manual capture of command output
4780 \layout Standard
4780 \layout Standard
4781
4781
4782 If the input line begins with
4782 If the input line begins with
4783 \emph on
4783 \emph on
4784 two
4784 two
4785 \emph default
4785 \emph default
4786 exclamation marks,
4786 exclamation marks,
4787 \family typewriter
4787 \family typewriter
4788 !!
4788 !!
4789 \family default
4789 \family default
4790 , the command is executed but its output is captured and returned as a python
4790 , the command is executed but its output is captured and returned as a python
4791 list, split on newlines.
4791 list, split on newlines.
4792 Any output sent by the subprocess to standard error is printed separately,
4792 Any output sent by the subprocess to standard error is printed separately,
4793 so that the resulting list only captures standard output.
4793 so that the resulting list only captures standard output.
4794 The
4794 The
4795 \family typewriter
4795 \family typewriter
4796 !!
4796 !!
4797 \family default
4797 \family default
4798 syntax is a shorthand for the
4798 syntax is a shorthand for the
4799 \family typewriter
4799 \family typewriter
4800 %sx
4800 %sx
4801 \family default
4801 \family default
4802 magic command.
4802 magic command.
4803 \layout Standard
4803 \layout Standard
4804
4804
4805 Finally, the
4805 Finally, the
4806 \family typewriter
4806 \family typewriter
4807 %sc
4807 %sc
4808 \family default
4808 \family default
4809 magic (short for `shell capture') is similar to
4809 magic (short for `shell capture') is similar to
4810 \family typewriter
4810 \family typewriter
4811 %sx
4811 %sx
4812 \family default
4812 \family default
4813 , but allowing more fine-grained control of the capture details, and storing
4813 , but allowing more fine-grained control of the capture details, and storing
4814 the result directly into a named variable.
4814 the result directly into a named variable.
4815 \layout Standard
4815 \layout Standard
4816
4816
4817 See Sec.\SpecialChar ~
4817 See Sec.\SpecialChar ~
4818
4818
4819 \begin_inset LatexCommand \ref{sec:magic}
4819 \begin_inset LatexCommand \ref{sec:magic}
4820
4820
4821 \end_inset
4821 \end_inset
4822
4822
4823 for details on the magics
4823 for details on the magics
4824 \family typewriter
4824 \family typewriter
4825 %sc
4825 %sc
4826 \family default
4826 \family default
4827 and
4827 and
4828 \family typewriter
4828 \family typewriter
4829 %sx
4829 %sx
4830 \family default
4830 \family default
4831 , or use IPython's own help (
4831 , or use IPython's own help (
4832 \family typewriter
4832 \family typewriter
4833 sc?
4833 sc?
4834 \family default
4834 \family default
4835 and
4835 and
4836 \family typewriter
4836 \family typewriter
4837 sx?
4837 sx?
4838 \family default
4838 \family default
4839 ) for further details.
4839 ) for further details.
4840 \layout Standard
4840 \layout Standard
4841
4841
4842 IPython also allows you to expand the value of python variables when making
4842 IPython also allows you to expand the value of python variables when making
4843 system calls.
4843 system calls.
4844 Any python variable or expression which you prepend with
4844 Any python variable or expression which you prepend with
4845 \family typewriter
4845 \family typewriter
4846 $
4846 $
4847 \family default
4847 \family default
4848 will get expanded before the system call is made.
4848 will get expanded before the system call is made.
4849
4849
4850 \layout Standard
4850 \layout Standard
4851
4851
4852
4852
4853 \family typewriter
4853 \family typewriter
4854 In [1]: pyvar='Hello world'
4854 In [1]: pyvar='Hello world'
4855 \newline
4855 \newline
4856 In [2]: !echo "A python variable: $pyvar"
4856 In [2]: !echo "A python variable: $pyvar"
4857 \newline
4857 \newline
4858 A python variable: Hello world
4858 A python variable: Hello world
4859 \layout Standard
4859 \layout Standard
4860
4860
4861 If you want the shell to actually see a literal
4861 If you want the shell to actually see a literal
4862 \family typewriter
4862 \family typewriter
4863 $
4863 $
4864 \family default
4864 \family default
4865 , you need to type it twice:
4865 , you need to type it twice:
4866 \layout Standard
4866 \layout Standard
4867
4867
4868
4868
4869 \family typewriter
4869 \family typewriter
4870 In [3]: !echo "A system variable: $$HOME"
4870 In [3]: !echo "A system variable: $$HOME"
4871 \newline
4871 \newline
4872 A system variable: /home/fperez
4872 A system variable: /home/fperez
4873 \layout Standard
4873 \layout Standard
4874
4874
4875 You can pass arbitrary expressions, though you'll need to delimit them with
4875 You can pass arbitrary expressions, though you'll need to delimit them with
4876
4876
4877 \family typewriter
4877 \family typewriter
4878 {}
4878 {}
4879 \family default
4879 \family default
4880 if there is ambiguity as to the extent of the expression:
4880 if there is ambiguity as to the extent of the expression:
4881 \layout Standard
4881 \layout Standard
4882
4882
4883
4883
4884 \family typewriter
4884 \family typewriter
4885 In [5]: x=10
4885 In [5]: x=10
4886 \newline
4886 \newline
4887 In [6]: y=20
4887 In [6]: y=20
4888 \newline
4888 \newline
4889 In [13]: !echo $x+y
4889 In [13]: !echo $x+y
4890 \newline
4890 \newline
4891 10+y
4891 10+y
4892 \newline
4892 \newline
4893 In [7]: !echo ${x+y}
4893 In [7]: !echo ${x+y}
4894 \newline
4894 \newline
4895 30
4895 30
4896 \layout Standard
4896 \layout Standard
4897
4897
4898 Even object attributes can be expanded:
4898 Even object attributes can be expanded:
4899 \layout Standard
4899 \layout Standard
4900
4900
4901
4901
4902 \family typewriter
4902 \family typewriter
4903 In [12]: !echo $sys.argv
4903 In [12]: !echo $sys.argv
4904 \newline
4904 \newline
4905 [/home/fperez/usr/bin/ipython]
4905 [/home/fperez/usr/bin/ipython]
4906 \layout Subsection
4906 \layout Subsection
4907
4907
4908 System command aliases
4908 System command aliases
4909 \layout Standard
4909 \layout Standard
4910
4910
4911 The
4911 The
4912 \family typewriter
4912 \family typewriter
4913 %alias
4913 %alias
4914 \family default
4914 \family default
4915 magic function and the
4915 magic function and the
4916 \family typewriter
4916 \family typewriter
4917 alias
4917 alias
4918 \family default
4918 \family default
4919 option in the
4919 option in the
4920 \family typewriter
4920 \family typewriter
4921 ipythonrc
4921 ipythonrc
4922 \family default
4922 \family default
4923 configuration file allow you to define magic functions which are in fact
4923 configuration file allow you to define magic functions which are in fact
4924 system shell commands.
4924 system shell commands.
4925 These aliases can have parameters.
4925 These aliases can have parameters.
4926
4926
4927 \layout Standard
4927 \layout Standard
4928
4928
4929 '
4929 '
4930 \family typewriter
4930 \family typewriter
4931 %alias alias_name cmd
4931 %alias alias_name cmd
4932 \family default
4932 \family default
4933 ' defines '
4933 ' defines '
4934 \family typewriter
4934 \family typewriter
4935 alias_name
4935 alias_name
4936 \family default
4936 \family default
4937 ' as an alias for '
4937 ' as an alias for '
4938 \family typewriter
4938 \family typewriter
4939 cmd
4939 cmd
4940 \family default
4940 \family default
4941 '
4941 '
4942 \layout Standard
4942 \layout Standard
4943
4943
4944 Then, typing '
4944 Then, typing '
4945 \family typewriter
4945 \family typewriter
4946 %alias_name params
4946 %alias_name params
4947 \family default
4947 \family default
4948 ' will execute the system command '
4948 ' will execute the system command '
4949 \family typewriter
4949 \family typewriter
4950 cmd params
4950 cmd params
4951 \family default
4951 \family default
4952 ' (from your underlying operating system).
4952 ' (from your underlying operating system).
4953
4953
4954 \layout Standard
4954 \layout Standard
4955
4955
4956 You can also define aliases with parameters using
4956 You can also define aliases with parameters using
4957 \family typewriter
4957 \family typewriter
4958 %s
4958 %s
4959 \family default
4959 \family default
4960 specifiers (one per parameter).
4960 specifiers (one per parameter).
4961 The following example defines the
4961 The following example defines the
4962 \family typewriter
4962 \family typewriter
4963 %parts
4963 %parts
4964 \family default
4964 \family default
4965 function as an alias to the command '
4965 function as an alias to the command '
4966 \family typewriter
4966 \family typewriter
4967 echo first %s second %s
4967 echo first %s second %s
4968 \family default
4968 \family default
4969 ' where each
4969 ' where each
4970 \family typewriter
4970 \family typewriter
4971 %s
4971 %s
4972 \family default
4972 \family default
4973 will be replaced by a positional parameter to the call to
4973 will be replaced by a positional parameter to the call to
4974 \family typewriter
4974 \family typewriter
4975 %parts:
4975 %parts:
4976 \layout Standard
4976 \layout Standard
4977
4977
4978
4978
4979 \family typewriter
4979 \family typewriter
4980 In [1]: alias parts echo first %s second %s
4980 In [1]: alias parts echo first %s second %s
4981 \newline
4981 \newline
4982 In [2]: %parts A B
4982 In [2]: %parts A B
4983 \newline
4983 \newline
4984 first A second B
4984 first A second B
4985 \newline
4985 \newline
4986 In [3]: %parts A
4986 In [3]: %parts A
4987 \newline
4987 \newline
4988 Incorrect number of arguments: 2 expected.
4988 Incorrect number of arguments: 2 expected.
4989
4989
4990 \newline
4990 \newline
4991 parts is an alias to: 'echo first %s second %s'
4991 parts is an alias to: 'echo first %s second %s'
4992 \layout Standard
4992 \layout Standard
4993
4993
4994 If called with no parameters,
4994 If called with no parameters,
4995 \family typewriter
4995 \family typewriter
4996 %alias
4996 %alias
4997 \family default
4997 \family default
4998 prints the table of currently defined aliases.
4998 prints the table of currently defined aliases.
4999 \layout Standard
4999 \layout Standard
5000
5000
5001 The
5001 The
5002 \family typewriter
5002 \family typewriter
5003 %rehash/rehashx
5003 %rehash/rehashx
5004 \family default
5004 \family default
5005 magics allow you to load your entire
5005 magics allow you to load your entire
5006 \family typewriter
5006 \family typewriter
5007 $PATH
5007 $PATH
5008 \family default
5008 \family default
5009 as ipython aliases.
5009 as ipython aliases.
5010 See their respective docstrings (or sec.\SpecialChar ~
5010 See their respective docstrings (or sec.\SpecialChar ~
5011
5011
5012 \begin_inset LatexCommand \ref{sec:magic}
5012 \begin_inset LatexCommand \ref{sec:magic}
5013
5013
5014 \end_inset
5014 \end_inset
5015
5015
5016 for further details).
5016 for further details).
5017 \layout Subsection
5017 \layout Subsection
5018
5018
5019
5019
5020 \begin_inset LatexCommand \label{sec:dreload}
5020 \begin_inset LatexCommand \label{sec:dreload}
5021
5021
5022 \end_inset
5022 \end_inset
5023
5023
5024 Recursive reload
5024 Recursive reload
5025 \layout Standard
5025 \layout Standard
5026
5026
5027 The
5027 The
5028 \family typewriter
5028 \family typewriter
5029 %dreload
5029 %dreload
5030 \family default
5030 \family default
5031 command does a recursive reload of a module: changes made to the module
5031 command does a recursive reload of a module: changes made to the module
5032 since you imported will actually be available without having to exit.
5032 since you imported will actually be available without having to exit.
5033 \layout Subsection
5033 \layout Subsection
5034
5034
5035 Verbose and colored exception traceback printouts
5035 Verbose and colored exception traceback printouts
5036 \layout Standard
5036 \layout Standard
5037
5037
5038 IPython provides the option to see very detailed exception tracebacks, which
5038 IPython provides the option to see very detailed exception tracebacks, which
5039 can be especially useful when debugging large programs.
5039 can be especially useful when debugging large programs.
5040 You can run any Python file with the
5040 You can run any Python file with the
5041 \family typewriter
5041 \family typewriter
5042 %run
5042 %run
5043 \family default
5043 \family default
5044 function to benefit from these detailed tracebacks.
5044 function to benefit from these detailed tracebacks.
5045 Furthermore, both normal and verbose tracebacks can be colored (if your
5045 Furthermore, both normal and verbose tracebacks can be colored (if your
5046 terminal supports it) which makes them much easier to parse visually.
5046 terminal supports it) which makes them much easier to parse visually.
5047 \layout Standard
5047 \layout Standard
5048
5048
5049 See the magic
5049 See the magic
5050 \family typewriter
5050 \family typewriter
5051 xmode
5051 xmode
5052 \family default
5052 \family default
5053 and
5053 and
5054 \family typewriter
5054 \family typewriter
5055 colors
5055 colors
5056 \family default
5056 \family default
5057 functions for details (just type
5057 functions for details (just type
5058 \family typewriter
5058 \family typewriter
5059 %magic
5059 %magic
5060 \family default
5060 \family default
5061 ).
5061 ).
5062 \layout Standard
5062 \layout Standard
5063
5063
5064 These features are basically a terminal version of Ka-Ping Yee's
5064 These features are basically a terminal version of Ka-Ping Yee's
5065 \family typewriter
5065 \family typewriter
5066 cgitb
5066 cgitb
5067 \family default
5067 \family default
5068 module, now part of the standard Python library.
5068 module, now part of the standard Python library.
5069 \layout Subsection
5069 \layout Subsection
5070
5070
5071
5071
5072 \begin_inset LatexCommand \label{sec:cache_input}
5072 \begin_inset LatexCommand \label{sec:cache_input}
5073
5073
5074 \end_inset
5074 \end_inset
5075
5075
5076 Input caching system
5076 Input caching system
5077 \layout Standard
5077 \layout Standard
5078
5078
5079 IPython offers numbered prompts (In/Out) with input and output caching.
5079 IPython offers numbered prompts (In/Out) with input and output caching.
5080 All input is saved and can be retrieved as variables (besides the usual
5080 All input is saved and can be retrieved as variables (besides the usual
5081 arrow key recall).
5081 arrow key recall).
5082 \layout Standard
5082 \layout Standard
5083
5083
5084 The following GLOBAL variables always exist (so don't overwrite them!):
5084 The following GLOBAL variables always exist (so don't overwrite them!):
5085
5085
5086 \family typewriter
5086 \family typewriter
5087 _i
5087 _i
5088 \family default
5088 \family default
5089 : stores previous input.
5089 : stores previous input.
5090
5090
5091 \family typewriter
5091 \family typewriter
5092 _ii
5092 _ii
5093 \family default
5093 \family default
5094 : next previous.
5094 : next previous.
5095
5095
5096 \family typewriter
5096 \family typewriter
5097 _iii
5097 _iii
5098 \family default
5098 \family default
5099 : next-next previous.
5099 : next-next previous.
5100
5100
5101 \family typewriter
5101 \family typewriter
5102 _ih
5102 _ih
5103 \family default
5103 \family default
5104 : a list of all input
5104 : a list of all input
5105 \family typewriter
5105 \family typewriter
5106 _ih[n]
5106 _ih[n]
5107 \family default
5107 \family default
5108 is the input from line
5108 is the input from line
5109 \family typewriter
5109 \family typewriter
5110 n
5110 n
5111 \family default
5111 \family default
5112 and this list is aliased to the global variable
5112 and this list is aliased to the global variable
5113 \family typewriter
5113 \family typewriter
5114 In
5114 In
5115 \family default
5115 \family default
5116 .
5116 .
5117 If you overwrite
5117 If you overwrite
5118 \family typewriter
5118 \family typewriter
5119 In
5119 In
5120 \family default
5120 \family default
5121 with a variable of your own, you can remake the assignment to the internal
5121 with a variable of your own, you can remake the assignment to the internal
5122 list with a simple
5122 list with a simple
5123 \family typewriter
5123 \family typewriter
5124 'In=_ih'
5124 'In=_ih'
5125 \family default
5125 \family default
5126 .
5126 .
5127 \layout Standard
5127 \layout Standard
5128
5128
5129 Additionally, global variables named
5129 Additionally, global variables named
5130 \family typewriter
5130 \family typewriter
5131 _i<n>
5131 _i<n>
5132 \family default
5132 \family default
5133 are dynamically created (
5133 are dynamically created (
5134 \family typewriter
5134 \family typewriter
5135 <n>
5135 <n>
5136 \family default
5136 \family default
5137 being the prompt counter), such that
5137 being the prompt counter), such that
5138 \newline
5138 \newline
5139
5139
5140 \family typewriter
5140 \family typewriter
5141 _i<n> == _ih[<n>] == In[<n>].
5141 _i<n> == _ih[<n>] == In[<n>].
5142 \layout Standard
5142 \layout Standard
5143
5143
5144 For example, what you typed at prompt 14 is available as
5144 For example, what you typed at prompt 14 is available as
5145 \family typewriter
5145 \family typewriter
5146 _i14,
5146 _i14,
5147 \family default
5147 \family default
5148
5148
5149 \family typewriter
5149 \family typewriter
5150 _ih[14]
5150 _ih[14]
5151 \family default
5151 \family default
5152 and
5152 and
5153 \family typewriter
5153 \family typewriter
5154 In[14]
5154 In[14]
5155 \family default
5155 \family default
5156 .
5156 .
5157 \layout Standard
5157 \layout Standard
5158
5158
5159 This allows you to easily cut and paste multi line interactive prompts by
5159 This allows you to easily cut and paste multi line interactive prompts by
5160 printing them out: they print like a clean string, without prompt characters.
5160 printing them out: they print like a clean string, without prompt characters.
5161 You can also manipulate them like regular variables (they are strings),
5161 You can also manipulate them like regular variables (they are strings),
5162 modify or exec them (typing
5162 modify or exec them (typing
5163 \family typewriter
5163 \family typewriter
5164 'exec _i9'
5164 'exec _i9'
5165 \family default
5165 \family default
5166 will re-execute the contents of input prompt 9, '
5166 will re-execute the contents of input prompt 9, '
5167 \family typewriter
5167 \family typewriter
5168 exec In[9:14]+In[18]
5168 exec In[9:14]+In[18]
5169 \family default
5169 \family default
5170 ' will re-execute lines 9 through 13 and line 18).
5170 ' will re-execute lines 9 through 13 and line 18).
5171 \layout Standard
5171 \layout Standard
5172
5172
5173 You can also re-execute multiple lines of input easily by using the magic
5173 You can also re-execute multiple lines of input easily by using the magic
5174
5174
5175 \family typewriter
5175 \family typewriter
5176 %macro
5176 %macro
5177 \family default
5177 \family default
5178 function (which automates the process and allows re-execution without having
5178 function (which automates the process and allows re-execution without having
5179 to type '
5179 to type '
5180 \family typewriter
5180 \family typewriter
5181 exec
5181 exec
5182 \family default
5182 \family default
5183 ' every time).
5183 ' every time).
5184 The macro system also allows you to re-execute previous lines which include
5184 The macro system also allows you to re-execute previous lines which include
5185 magic function calls (which require special processing).
5185 magic function calls (which require special processing).
5186 Type
5186 Type
5187 \family typewriter
5187 \family typewriter
5188 %macro?
5188 %macro?
5189 \family default
5189 \family default
5190 or see sec.
5190 or see sec.
5191
5191
5192 \begin_inset LatexCommand \ref{sec:magic}
5192 \begin_inset LatexCommand \ref{sec:magic}
5193
5193
5194 \end_inset
5194 \end_inset
5195
5195
5196 for more details on the macro system.
5196 for more details on the macro system.
5197 \layout Standard
5197 \layout Standard
5198
5198
5199 A history function
5199 A history function
5200 \family typewriter
5200 \family typewriter
5201 %hist
5201 %hist
5202 \family default
5202 \family default
5203 allows you to see any part of your input history by printing a range of
5203 allows you to see any part of your input history by printing a range of
5204 the
5204 the
5205 \family typewriter
5205 \family typewriter
5206 _i
5206 _i
5207 \family default
5207 \family default
5208 variables.
5208 variables.
5209 \layout Subsection
5209 \layout Subsection
5210
5210
5211
5211
5212 \begin_inset LatexCommand \label{sec:cache_output}
5212 \begin_inset LatexCommand \label{sec:cache_output}
5213
5213
5214 \end_inset
5214 \end_inset
5215
5215
5216 Output caching system
5216 Output caching system
5217 \layout Standard
5217 \layout Standard
5218
5218
5219 For output that is returned from actions, a system similar to the input
5219 For output that is returned from actions, a system similar to the input
5220 cache exists but using
5220 cache exists but using
5221 \family typewriter
5221 \family typewriter
5222 _
5222 _
5223 \family default
5223 \family default
5224 instead of
5224 instead of
5225 \family typewriter
5225 \family typewriter
5226 _i
5226 _i
5227 \family default
5227 \family default
5228 .
5228 .
5229 Only actions that produce a result (NOT assignments, for example) are cached.
5229 Only actions that produce a result (NOT assignments, for example) are cached.
5230 If you are familiar with Mathematica, IPython's
5230 If you are familiar with Mathematica, IPython's
5231 \family typewriter
5231 \family typewriter
5232 _
5232 _
5233 \family default
5233 \family default
5234 variables behave exactly like Mathematica's
5234 variables behave exactly like Mathematica's
5235 \family typewriter
5235 \family typewriter
5236 %
5236 %
5237 \family default
5237 \family default
5238 variables.
5238 variables.
5239 \layout Standard
5239 \layout Standard
5240
5240
5241 The following GLOBAL variables always exist (so don't overwrite them!):
5241 The following GLOBAL variables always exist (so don't overwrite them!):
5242
5242
5243 \layout List
5243 \layout List
5244 \labelwidthstring 00.00.0000
5244 \labelwidthstring 00.00.0000
5245
5245
5246
5246
5247 \family typewriter
5247 \family typewriter
5248 \series bold
5248 \series bold
5249 _
5249 _
5250 \family default
5250 \family default
5251 \series default
5251 \series default
5252 (a
5252 (a
5253 \emph on
5253 \emph on
5254 single
5254 single
5255 \emph default
5255 \emph default
5256 underscore) : stores previous output, like Python's default interpreter.
5256 underscore) : stores previous output, like Python's default interpreter.
5257 \layout List
5257 \layout List
5258 \labelwidthstring 00.00.0000
5258 \labelwidthstring 00.00.0000
5259
5259
5260
5260
5261 \family typewriter
5261 \family typewriter
5262 \series bold
5262 \series bold
5263 __
5263 __
5264 \family default
5264 \family default
5265 \series default
5265 \series default
5266 (two underscores): next previous.
5266 (two underscores): next previous.
5267 \layout List
5267 \layout List
5268 \labelwidthstring 00.00.0000
5268 \labelwidthstring 00.00.0000
5269
5269
5270
5270
5271 \family typewriter
5271 \family typewriter
5272 \series bold
5272 \series bold
5273 ___
5273 ___
5274 \family default
5274 \family default
5275 \series default
5275 \series default
5276 (three underscores): next-next previous.
5276 (three underscores): next-next previous.
5277 \layout Standard
5277 \layout Standard
5278
5278
5279 Additionally, global variables named
5279 Additionally, global variables named
5280 \family typewriter
5280 \family typewriter
5281 _<n>
5281 _<n>
5282 \family default
5282 \family default
5283 are dynamically created (
5283 are dynamically created (
5284 \family typewriter
5284 \family typewriter
5285 <n>
5285 <n>
5286 \family default
5286 \family default
5287 being the prompt counter), such that the result of output
5287 being the prompt counter), such that the result of output
5288 \family typewriter
5288 \family typewriter
5289 <n>
5289 <n>
5290 \family default
5290 \family default
5291 is always available as
5291 is always available as
5292 \family typewriter
5292 \family typewriter
5293 _<n>
5293 _<n>
5294 \family default
5294 \family default
5295 (don't use the angle brackets, just the number, e.g.
5295 (don't use the angle brackets, just the number, e.g.
5296
5296
5297 \family typewriter
5297 \family typewriter
5298 _21
5298 _21
5299 \family default
5299 \family default
5300 ).
5300 ).
5301 \layout Standard
5301 \layout Standard
5302
5302
5303 These global variables are all stored in a global dictionary (not a list,
5303 These global variables are all stored in a global dictionary (not a list,
5304 since it only has entries for lines which returned a result) available
5304 since it only has entries for lines which returned a result) available
5305 under the names
5305 under the names
5306 \family typewriter
5306 \family typewriter
5307 _oh
5307 _oh
5308 \family default
5308 \family default
5309 and
5309 and
5310 \family typewriter
5310 \family typewriter
5311 Out
5311 Out
5312 \family default
5312 \family default
5313 (similar to
5313 (similar to
5314 \family typewriter
5314 \family typewriter
5315 _ih
5315 _ih
5316 \family default
5316 \family default
5317 and
5317 and
5318 \family typewriter
5318 \family typewriter
5319 In
5319 In
5320 \family default
5320 \family default
5321 ).
5321 ).
5322 So the output from line 12 can be obtained as
5322 So the output from line 12 can be obtained as
5323 \family typewriter
5323 \family typewriter
5324 _12
5324 _12
5325 \family default
5325 \family default
5326 ,
5326 ,
5327 \family typewriter
5327 \family typewriter
5328 Out[12]
5328 Out[12]
5329 \family default
5329 \family default
5330 or
5330 or
5331 \family typewriter
5331 \family typewriter
5332 _oh[12]
5332 _oh[12]
5333 \family default
5333 \family default
5334 .
5334 .
5335 If you accidentally overwrite the
5335 If you accidentally overwrite the
5336 \family typewriter
5336 \family typewriter
5337 Out
5337 Out
5338 \family default
5338 \family default
5339 variable you can recover it by typing
5339 variable you can recover it by typing
5340 \family typewriter
5340 \family typewriter
5341 'Out=_oh
5341 'Out=_oh
5342 \family default
5342 \family default
5343 ' at the prompt.
5343 ' at the prompt.
5344 \layout Standard
5344 \layout Standard
5345
5345
5346 This system obviously can potentially put heavy memory demands on your system,
5346 This system obviously can potentially put heavy memory demands on your system,
5347 since it prevents Python's garbage collector from removing any previously
5347 since it prevents Python's garbage collector from removing any previously
5348 computed results.
5348 computed results.
5349 You can control how many results are kept in memory with the option (at
5349 You can control how many results are kept in memory with the option (at
5350 the command line or in your
5350 the command line or in your
5351 \family typewriter
5351 \family typewriter
5352 ipythonrc
5352 ipythonrc
5353 \family default
5353 \family default
5354 file)
5354 file)
5355 \family typewriter
5355 \family typewriter
5356 cache_size
5356 cache_size
5357 \family default
5357 \family default
5358 .
5358 .
5359 If you set it to 0, the whole system is completely disabled and the prompts
5359 If you set it to 0, the whole system is completely disabled and the prompts
5360 revert to the classic
5360 revert to the classic
5361 \family typewriter
5361 \family typewriter
5362 '>>>'
5362 '>>>'
5363 \family default
5363 \family default
5364 of normal Python.
5364 of normal Python.
5365 \layout Subsection
5365 \layout Subsection
5366
5366
5367 Directory history
5367 Directory history
5368 \layout Standard
5368 \layout Standard
5369
5369
5370 Your history of visited directories is kept in the global list
5370 Your history of visited directories is kept in the global list
5371 \family typewriter
5371 \family typewriter
5372 _dh
5372 _dh
5373 \family default
5373 \family default
5374 , and the magic
5374 , and the magic
5375 \family typewriter
5375 \family typewriter
5376 %cd
5376 %cd
5377 \family default
5377 \family default
5378 command can be used to go to any entry in that list.
5378 command can be used to go to any entry in that list.
5379 The
5379 The
5380 \family typewriter
5380 \family typewriter
5381 %dhist
5381 %dhist
5382 \family default
5382 \family default
5383 command allows you to view this history.
5383 command allows you to view this history.
5384 \layout Subsection
5384 \layout Subsection
5385
5385
5386 Automatic parentheses and quotes
5386 Automatic parentheses and quotes
5387 \layout Standard
5387 \layout Standard
5388
5388
5389 These features were adapted from Nathan Gray's LazyPython.
5389 These features were adapted from Nathan Gray's LazyPython.
5390 They are meant to allow less typing for common situations.
5390 They are meant to allow less typing for common situations.
5391 \layout Subsubsection
5391 \layout Subsubsection
5392
5392
5393 Automatic parentheses
5393 Automatic parentheses
5394 \layout Standard
5394 \layout Standard
5395
5395
5396 Callable objects (i.e.
5396 Callable objects (i.e.
5397 functions, methods, etc) can be invoked like this (notice the commas between
5397 functions, methods, etc) can be invoked like this (notice the commas between
5398 the arguments):
5398 the arguments):
5399 \layout Standard
5399 \layout Standard
5400
5400
5401
5401
5402 \family typewriter
5402 \family typewriter
5403 >>> callable_ob arg1, arg2, arg3
5403 >>> callable_ob arg1, arg2, arg3
5404 \layout Standard
5404 \layout Standard
5405
5405
5406 and the input will be translated to this:
5406 and the input will be translated to this:
5407 \layout Standard
5407 \layout Standard
5408
5408
5409
5409
5410 \family typewriter
5410 \family typewriter
5411 --> callable_ob(arg1, arg2, arg3)
5411 --> callable_ob(arg1, arg2, arg3)
5412 \layout Standard
5412 \layout Standard
5413
5413
5414 You can force automatic parentheses by using '/' as the first character
5414 You can force automatic parentheses by using '/' as the first character
5415 of a line.
5415 of a line.
5416 For example:
5416 For example:
5417 \layout Standard
5417 \layout Standard
5418
5418
5419
5419
5420 \family typewriter
5420 \family typewriter
5421 >>> /globals # becomes 'globals()'
5421 >>> /globals # becomes 'globals()'
5422 \layout Standard
5422 \layout Standard
5423
5423
5424 Note that the '/' MUST be the first character on the line! This won't work:
5424 Note that the '/' MUST be the first character on the line! This won't work:
5425
5425
5426 \layout Standard
5426 \layout Standard
5427
5427
5428
5428
5429 \family typewriter
5429 \family typewriter
5430 >>> print /globals # syntax error
5430 >>> print /globals # syntax error
5431 \layout Standard
5431 \layout Standard
5432
5432
5433 In most cases the automatic algorithm should work, so you should rarely
5433 In most cases the automatic algorithm should work, so you should rarely
5434 need to explicitly invoke /.
5434 need to explicitly invoke /.
5435 One notable exception is if you are trying to call a function with a list
5435 One notable exception is if you are trying to call a function with a list
5436 of tuples as arguments (the parenthesis will confuse IPython):
5436 of tuples as arguments (the parenthesis will confuse IPython):
5437 \layout Standard
5437 \layout Standard
5438
5438
5439
5439
5440 \family typewriter
5440 \family typewriter
5441 In [1]: zip (1,2,3),(4,5,6) # won't work
5441 In [1]: zip (1,2,3),(4,5,6) # won't work
5442 \layout Standard
5442 \layout Standard
5443
5443
5444 but this will work:
5444 but this will work:
5445 \layout Standard
5445 \layout Standard
5446
5446
5447
5447
5448 \family typewriter
5448 \family typewriter
5449 In [2]: /zip (1,2,3),(4,5,6)
5449 In [2]: /zip (1,2,3),(4,5,6)
5450 \newline
5450 \newline
5451 ------> zip ((1,2,3),(4,5,6))
5451 ------> zip ((1,2,3),(4,5,6))
5452 \newline
5452 \newline
5453 Out[2]= [(1, 4), (2, 5), (3, 6)]
5453 Out[2]= [(1, 4), (2, 5), (3, 6)]
5454 \layout Standard
5454 \layout Standard
5455
5455
5456 IPython tells you that it has altered your command line by displaying the
5456 IPython tells you that it has altered your command line by displaying the
5457 new command line preceded by
5457 new command line preceded by
5458 \family typewriter
5458 \family typewriter
5459 -->
5459 -->
5460 \family default
5460 \family default
5461 .
5461 .
5462 e.g.:
5462 e.g.:
5463 \layout Standard
5463 \layout Standard
5464
5464
5465
5465
5466 \family typewriter
5466 \family typewriter
5467 In [18]: callable list
5467 In [18]: callable list
5468 \newline
5468 \newline
5469 -------> callable (list)
5469 -------> callable (list)
5470 \layout Subsubsection
5470 \layout Subsubsection
5471
5471
5472 Automatic quoting
5472 Automatic quoting
5473 \layout Standard
5473 \layout Standard
5474
5474
5475 You can force automatic quoting of a function's arguments by using
5475 You can force automatic quoting of a function's arguments by using
5476 \family typewriter
5476 \family typewriter
5477 `,'
5477 `,'
5478 \family default
5478 \family default
5479 or
5479 or
5480 \family typewriter
5480 \family typewriter
5481 `;'
5481 `;'
5482 \family default
5482 \family default
5483 as the first character of a line.
5483 as the first character of a line.
5484 For example:
5484 For example:
5485 \layout Standard
5485 \layout Standard
5486
5486
5487
5487
5488 \family typewriter
5488 \family typewriter
5489 >>> ,my_function /home/me # becomes my_function("/home/me")
5489 >>> ,my_function /home/me # becomes my_function("/home/me")
5490 \layout Standard
5490 \layout Standard
5491
5491
5492 If you use
5492 If you use
5493 \family typewriter
5493 \family typewriter
5494 `;'
5494 `;'
5495 \family default
5495 \family default
5496 instead, the whole argument is quoted as a single string (while
5496 instead, the whole argument is quoted as a single string (while
5497 \family typewriter
5497 \family typewriter
5498 `,'
5498 `,'
5499 \family default
5499 \family default
5500 splits on whitespace):
5500 splits on whitespace):
5501 \layout Standard
5501 \layout Standard
5502
5502
5503
5503
5504 \family typewriter
5504 \family typewriter
5505 >>> ,my_function a b c # becomes my_function("a","b","c")
5505 >>> ,my_function a b c # becomes my_function("a","b","c")
5506 \layout Standard
5506 \layout Standard
5507
5507
5508
5508
5509 \family typewriter
5509 \family typewriter
5510 >>> ;my_function a b c # becomes my_function("a b c")
5510 >>> ;my_function a b c # becomes my_function("a b c")
5511 \layout Standard
5511 \layout Standard
5512
5512
5513 Note that the `
5513 Note that the `
5514 \family typewriter
5514 \family typewriter
5515 ,
5515 ,
5516 \family default
5516 \family default
5517 ' or `
5517 ' or `
5518 \family typewriter
5518 \family typewriter
5519 ;
5519 ;
5520 \family default
5520 \family default
5521 ' MUST be the first character on the line! This won't work:
5521 ' MUST be the first character on the line! This won't work:
5522 \layout Standard
5522 \layout Standard
5523
5523
5524
5524
5525 \family typewriter
5525 \family typewriter
5526 >>> x = ,my_function /home/me # syntax error
5526 >>> x = ,my_function /home/me # syntax error
5527 \layout Section
5527 \layout Section
5528
5528
5529
5529
5530 \begin_inset LatexCommand \label{sec:customization}
5530 \begin_inset LatexCommand \label{sec:customization}
5531
5531
5532 \end_inset
5532 \end_inset
5533
5533
5534 Customization
5534 Customization
5535 \layout Standard
5535 \layout Standard
5536
5536
5537 As we've already mentioned, IPython reads a configuration file which can
5537 As we've already mentioned, IPython reads a configuration file which can
5538 be specified at the command line (
5538 be specified at the command line (
5539 \family typewriter
5539 \family typewriter
5540 -rcfile
5540 -rcfile
5541 \family default
5541 \family default
5542 ) or which by default is assumed to be called
5542 ) or which by default is assumed to be called
5543 \family typewriter
5543 \family typewriter
5544 ipythonrc
5544 ipythonrc
5545 \family default
5545 \family default
5546 .
5546 .
5547 Such a file is looked for in the current directory where IPython is started
5547 Such a file is looked for in the current directory where IPython is started
5548 and then in your
5548 and then in your
5549 \family typewriter
5549 \family typewriter
5550 IPYTHONDIR
5550 IPYTHONDIR
5551 \family default
5551 \family default
5552 , which allows you to have local configuration files for specific projects.
5552 , which allows you to have local configuration files for specific projects.
5553 In this section we will call these types of configuration files simply
5553 In this section we will call these types of configuration files simply
5554 rcfiles (short for resource configuration file).
5554 rcfiles (short for resource configuration file).
5555 \layout Standard
5555 \layout Standard
5556
5556
5557 The syntax of an rcfile is one of key-value pairs separated by whitespace,
5557 The syntax of an rcfile is one of key-value pairs separated by whitespace,
5558 one per line.
5558 one per line.
5559 Lines beginning with a
5559 Lines beginning with a
5560 \family typewriter
5560 \family typewriter
5561 #
5561 #
5562 \family default
5562 \family default
5563 are ignored as comments, but comments can
5563 are ignored as comments, but comments can
5564 \series bold
5564 \series bold
5565 not
5565 not
5566 \series default
5566 \series default
5567 be put on lines with data (the parser is fairly primitive).
5567 be put on lines with data (the parser is fairly primitive).
5568 Note that these are not python files, and this is deliberate, because it
5568 Note that these are not python files, and this is deliberate, because it
5569 allows us to do some things which would be quite tricky to implement if
5569 allows us to do some things which would be quite tricky to implement if
5570 they were normal python files.
5570 they were normal python files.
5571 \layout Standard
5571 \layout Standard
5572
5572
5573 First, an rcfile can contain permanent default values for almost all command
5573 First, an rcfile can contain permanent default values for almost all command
5574 line options (except things like
5574 line options (except things like
5575 \family typewriter
5575 \family typewriter
5576 -help
5576 -help
5577 \family default
5577 \family default
5578 or
5578 or
5579 \family typewriter
5579 \family typewriter
5580 -Version
5580 -Version
5581 \family default
5581 \family default
5582 ).
5582 ).
5583 Sec\SpecialChar ~
5583 Sec\SpecialChar ~
5584
5584
5585 \begin_inset LatexCommand \ref{sec:cmd-line-opts}
5585 \begin_inset LatexCommand \ref{sec:cmd-line-opts}
5586
5586
5587 \end_inset
5587 \end_inset
5588
5588
5589 contains a description of all command-line options.
5589 contains a description of all command-line options.
5590 However, values you explicitly specify at the command line override the
5590 However, values you explicitly specify at the command line override the
5591 values defined in the rcfile.
5591 values defined in the rcfile.
5592 \layout Standard
5592 \layout Standard
5593
5593
5594 Besides command line option values, the rcfile can specify values for certain
5594 Besides command line option values, the rcfile can specify values for certain
5595 extra special options which are not available at the command line.
5595 extra special options which are not available at the command line.
5596 These options are briefly described below.
5596 These options are briefly described below.
5597
5597
5598 \layout Standard
5598 \layout Standard
5599
5599
5600 Each of these options may appear as many times as you need it in the file.
5600 Each of these options may appear as many times as you need it in the file.
5601 \layout List
5601 \layout List
5602 \labelwidthstring 00.00.0000
5602 \labelwidthstring 00.00.0000
5603
5603
5604
5604
5605 \family typewriter
5605 \family typewriter
5606 \series bold
5606 \series bold
5607 include\SpecialChar ~
5607 include\SpecialChar ~
5608 <file1>\SpecialChar ~
5608 <file1>\SpecialChar ~
5609 <file2>\SpecialChar ~
5609 <file2>\SpecialChar ~
5610 ...
5610 ...
5611 \family default
5611 \family default
5612 \series default
5612 \series default
5613 : you can name
5613 : you can name
5614 \emph on
5614 \emph on
5615 other
5615 other
5616 \emph default
5616 \emph default
5617 rcfiles you want to recursively load up to 15 levels (don't use the
5617 rcfiles you want to recursively load up to 15 levels (don't use the
5618 \family typewriter
5618 \family typewriter
5619 <>
5619 <>
5620 \family default
5620 \family default
5621 brackets in your names!).
5621 brackets in your names!).
5622 This feature allows you to define a 'base' rcfile with general options
5622 This feature allows you to define a 'base' rcfile with general options
5623 and special-purpose files which can be loaded only when needed with particular
5623 and special-purpose files which can be loaded only when needed with particular
5624 configuration options.
5624 configuration options.
5625 To make this more convenient, IPython accepts the
5625 To make this more convenient, IPython accepts the
5626 \family typewriter
5626 \family typewriter
5627 -profile <name>
5627 -profile <name>
5628 \family default
5628 \family default
5629 option (abbreviates to
5629 option (abbreviates to
5630 \family typewriter
5630 \family typewriter
5631 -p <name
5631 -p <name
5632 \family default
5632 \family default
5633 >)
5633 >)
5634 \family typewriter
5634 \family typewriter
5635 which
5635 which
5636 \family default
5636 \family default
5637 tells it to look for an rcfile named
5637 tells it to look for an rcfile named
5638 \family typewriter
5638 \family typewriter
5639 ipythonrc-<name>
5639 ipythonrc-<name>
5640 \family default
5640 \family default
5641 .
5641 .
5642
5642
5643 \layout List
5643 \layout List
5644 \labelwidthstring 00.00.0000
5644 \labelwidthstring 00.00.0000
5645
5645
5646
5646
5647 \family typewriter
5647 \family typewriter
5648 \series bold
5648 \series bold
5649 import_mod\SpecialChar ~
5649 import_mod\SpecialChar ~
5650 <mod1>\SpecialChar ~
5650 <mod1>\SpecialChar ~
5651 <mod2>\SpecialChar ~
5651 <mod2>\SpecialChar ~
5652 ...
5652 ...
5653 \family default
5653 \family default
5654 \series default
5654 \series default
5655 : import modules with '
5655 : import modules with '
5656 \family typewriter
5656 \family typewriter
5657 import
5657 import
5658 \family default
5658 \family default
5659
5659
5660 \family typewriter
5660 \family typewriter
5661 <mod1>,<mod2>,...
5661 <mod1>,<mod2>,...
5662 \family default
5662 \family default
5663 '
5663 '
5664 \layout List
5664 \layout List
5665 \labelwidthstring 00.00.0000
5665 \labelwidthstring 00.00.0000
5666
5666
5667
5667
5668 \family typewriter
5668 \family typewriter
5669 \series bold
5669 \series bold
5670 import_some\SpecialChar ~
5670 import_some\SpecialChar ~
5671 <mod>\SpecialChar ~
5671 <mod>\SpecialChar ~
5672 <f1>\SpecialChar ~
5672 <f1>\SpecialChar ~
5673 <f2>\SpecialChar ~
5673 <f2>\SpecialChar ~
5674 ...
5674 ...
5675 \family default
5675 \family default
5676 \series default
5676 \series default
5677 : import functions with '
5677 : import functions with '
5678 \family typewriter
5678 \family typewriter
5679 from <mod> import
5679 from <mod> import
5680 \family default
5680 \family default
5681
5681
5682 \family typewriter
5682 \family typewriter
5683 <f1>,<f2>,...
5683 <f1>,<f2>,...
5684 \family default
5684 \family default
5685 '
5685 '
5686 \layout List
5686 \layout List
5687 \labelwidthstring 00.00.0000
5687 \labelwidthstring 00.00.0000
5688
5688
5689
5689
5690 \family typewriter
5690 \family typewriter
5691 \series bold
5691 \series bold
5692 import_all\SpecialChar ~
5692 import_all\SpecialChar ~
5693 <mod1>\SpecialChar ~
5693 <mod1>\SpecialChar ~
5694 <mod2>\SpecialChar ~
5694 <mod2>\SpecialChar ~
5695 ...
5695 ...
5696 \family default
5696 \family default
5697 \series default
5697 \series default
5698 : for each module listed import functions with '
5698 : for each module listed import functions with '
5699 \family typewriter
5699 \family typewriter
5700 from <mod> import *
5700 from <mod> import *
5701 \family default
5701 \family default
5702 '
5702 '
5703 \layout List
5703 \layout List
5704 \labelwidthstring 00.00.0000
5704 \labelwidthstring 00.00.0000
5705
5705
5706
5706
5707 \family typewriter
5707 \family typewriter
5708 \series bold
5708 \series bold
5709 execute\SpecialChar ~
5709 execute\SpecialChar ~
5710 <python\SpecialChar ~
5710 <python\SpecialChar ~
5711 code>
5711 code>
5712 \family default
5712 \family default
5713 \series default
5713 \series default
5714 : give any single-line python code to be executed.
5714 : give any single-line python code to be executed.
5715 \layout List
5715 \layout List
5716 \labelwidthstring 00.00.0000
5716 \labelwidthstring 00.00.0000
5717
5717
5718
5718
5719 \family typewriter
5719 \family typewriter
5720 \series bold
5720 \series bold
5721 execfile\SpecialChar ~
5721 execfile\SpecialChar ~
5722 <filename>
5722 <filename>
5723 \family default
5723 \family default
5724 \series default
5724 \series default
5725 : execute the python file given with an '
5725 : execute the python file given with an '
5726 \family typewriter
5726 \family typewriter
5727 execfile(filename)
5727 execfile(filename)
5728 \family default
5728 \family default
5729 ' command.
5729 ' command.
5730 Username expansion is performed on the given names.
5730 Username expansion is performed on the given names.
5731 So if you need any amount of extra fancy customization that won't fit in
5731 So if you need any amount of extra fancy customization that won't fit in
5732 any of the above 'canned' options, you can just put it in a separate python
5732 any of the above 'canned' options, you can just put it in a separate python
5733 file and execute it.
5733 file and execute it.
5734 \layout List
5734 \layout List
5735 \labelwidthstring 00.00.0000
5735 \labelwidthstring 00.00.0000
5736
5736
5737
5737
5738 \family typewriter
5738 \family typewriter
5739 \series bold
5739 \series bold
5740 alias\SpecialChar ~
5740 alias\SpecialChar ~
5741 <alias_def>
5741 <alias_def>
5742 \family default
5742 \family default
5743 \series default
5743 \series default
5744 : this is equivalent to calling '
5744 : this is equivalent to calling '
5745 \family typewriter
5745 \family typewriter
5746 %alias\SpecialChar ~
5746 %alias\SpecialChar ~
5747 <alias_def>
5747 <alias_def>
5748 \family default
5748 \family default
5749 ' at the IPython command line.
5749 ' at the IPython command line.
5750 This way, from within IPython you can do common system tasks without having
5750 This way, from within IPython you can do common system tasks without having
5751 to exit it or use the
5751 to exit it or use the
5752 \family typewriter
5752 \family typewriter
5753 !
5753 !
5754 \family default
5754 \family default
5755 escape.
5755 escape.
5756 IPython isn't meant to be a shell replacement, but it is often very useful
5756 IPython isn't meant to be a shell replacement, but it is often very useful
5757 to be able to do things with files while testing code.
5757 to be able to do things with files while testing code.
5758 This gives you the flexibility to have within IPython any aliases you may
5758 This gives you the flexibility to have within IPython any aliases you may
5759 be used to under your normal system shell.
5759 be used to under your normal system shell.
5760 \layout Subsection
5760 \layout Subsection
5761
5761
5762
5762
5763 \begin_inset LatexCommand \label{sec:ipytonrc-sample}
5763 \begin_inset LatexCommand \label{sec:ipytonrc-sample}
5764
5764
5765 \end_inset
5765 \end_inset
5766
5766
5767 Sample
5767 Sample
5768 \family typewriter
5768 \family typewriter
5769 ipythonrc
5769 ipythonrc
5770 \family default
5770 \family default
5771 file
5771 file
5772 \layout Standard
5772 \layout Standard
5773
5773
5774 The default rcfile, called
5774 The default rcfile, called
5775 \family typewriter
5775 \family typewriter
5776 ipythonrc
5776 ipythonrc
5777 \family default
5777 \family default
5778 and supplied in your
5778 and supplied in your
5779 \family typewriter
5779 \family typewriter
5780 IPYTHONDIR
5780 IPYTHONDIR
5781 \family default
5781 \family default
5782 directory contains lots of comments on all of these options.
5782 directory contains lots of comments on all of these options.
5783 We reproduce it here for reference:
5783 We reproduce it here for reference:
5784 \layout Standard
5784 \layout Standard
5785
5785
5786
5786
5787 \begin_inset ERT
5787 \begin_inset ERT
5788 status Open
5788 status Open
5789
5789
5790 \layout Standard
5790 \layout Standard
5791
5791
5792 \backslash
5792 \backslash
5793 codelist{../IPython/UserConfig/ipythonrc}
5793 codelist{../IPython/UserConfig/ipythonrc}
5794 \end_inset
5794 \end_inset
5795
5795
5796
5796
5797 \layout Subsection
5797 \layout Subsection
5798
5798
5799
5799
5800 \begin_inset LatexCommand \label{sec:prompts}
5800 \begin_inset LatexCommand \label{sec:prompts}
5801
5801
5802 \end_inset
5802 \end_inset
5803
5803
5804 Fine-tuning your prompt
5804 Fine-tuning your prompt
5805 \layout Standard
5805 \layout Standard
5806
5806
5807 IPython's prompts can be customized using a syntax similar to that of the
5807 IPython's prompts can be customized using a syntax similar to that of the
5808
5808
5809 \family typewriter
5809 \family typewriter
5810 bash
5810 bash
5811 \family default
5811 \family default
5812 shell.
5812 shell.
5813 Many of
5813 Many of
5814 \family typewriter
5814 \family typewriter
5815 bash
5815 bash
5816 \family default
5816 \family default
5817 's escapes are supported, as well as a few additional ones.
5817 's escapes are supported, as well as a few additional ones.
5818 We list them below:
5818 We list them below:
5819 \layout Description
5819 \layout Description
5820
5820
5821
5821
5822 \backslash
5822 \backslash
5823 # the prompt/history count number
5823 # the prompt/history count number
5824 \layout Description
5824 \layout Description
5825
5825
5826
5826
5827 \backslash
5827 \backslash
5828 D the prompt/history count, with the actual digits replaced by dots.
5828 D the prompt/history count, with the actual digits replaced by dots.
5829 Used mainly in continuation prompts (prompt_in2)
5829 Used mainly in continuation prompts (prompt_in2)
5830 \layout Description
5830 \layout Description
5831
5831
5832
5832
5833 \backslash
5833 \backslash
5834 w the current working directory
5834 w the current working directory
5835 \layout Description
5835 \layout Description
5836
5836
5837
5837
5838 \backslash
5838 \backslash
5839 W the basename of current working directory
5839 W the basename of current working directory
5840 \layout Description
5840 \layout Description
5841
5841
5842
5842
5843 \backslash
5843 \backslash
5844 X
5844 X
5845 \emph on
5845 \emph on
5846 n
5846 n
5847 \emph default
5847 \emph default
5848 where
5848 where
5849 \begin_inset Formula $n=0\ldots5.$
5849 \begin_inset Formula $n=0\ldots5.$
5850 \end_inset
5850 \end_inset
5851
5851
5852 The current working directory, with
5852 The current working directory, with
5853 \family typewriter
5853 \family typewriter
5854 $HOME
5854 $HOME
5855 \family default
5855 \family default
5856 replaced by
5856 replaced by
5857 \family typewriter
5857 \family typewriter
5858 ~
5858 ~
5859 \family default
5859 \family default
5860 , and filtered out to contain only
5860 , and filtered out to contain only
5861 \begin_inset Formula $n$
5861 \begin_inset Formula $n$
5862 \end_inset
5862 \end_inset
5863
5863
5864 path elements
5864 path elements
5865 \layout Description
5865 \layout Description
5866
5866
5867
5867
5868 \backslash
5868 \backslash
5869 Y
5869 Y
5870 \emph on
5870 \emph on
5871 n
5871 n
5872 \emph default
5872 \emph default
5873 Similar to
5873 Similar to
5874 \backslash
5874 \backslash
5875 X
5875 X
5876 \emph on
5876 \emph on
5877 n
5877 n
5878 \emph default
5878 \emph default
5879 , but with the
5879 , but with the
5880 \begin_inset Formula $n+1$
5880 \begin_inset Formula $n+1$
5881 \end_inset
5881 \end_inset
5882
5882
5883 element included if it is
5883 element included if it is
5884 \family typewriter
5884 \family typewriter
5885 ~
5885 ~
5886 \family default
5886 \family default
5887 (this is similar to the behavior of the %c
5887 (this is similar to the behavior of the %c
5888 \emph on
5888 \emph on
5889 n
5889 n
5890 \emph default
5890 \emph default
5891 escapes in
5891 escapes in
5892 \family typewriter
5892 \family typewriter
5893 tcsh
5893 tcsh
5894 \family default
5894 \family default
5895 )
5895 )
5896 \layout Description
5896 \layout Description
5897
5897
5898
5898
5899 \backslash
5899 \backslash
5900 u the username of the current user
5900 u the username of the current user
5901 \layout Description
5901 \layout Description
5902
5902
5903
5903
5904 \backslash
5904 \backslash
5905 $ if the effective UID is 0, a #, otherwise a $
5905 $ if the effective UID is 0, a #, otherwise a $
5906 \layout Description
5906 \layout Description
5907
5907
5908
5908
5909 \backslash
5909 \backslash
5910 h the hostname up to the first `.'
5910 h the hostname up to the first `.'
5911 \layout Description
5911 \layout Description
5912
5912
5913
5913
5914 \backslash
5914 \backslash
5915 H the hostname
5915 H the hostname
5916 \layout Description
5916 \layout Description
5917
5917
5918
5918
5919 \backslash
5919 \backslash
5920 n a newline
5920 n a newline
5921 \layout Description
5921 \layout Description
5922
5922
5923
5923
5924 \backslash
5924 \backslash
5925 r a carriage return
5925 r a carriage return
5926 \layout Description
5926 \layout Description
5927
5927
5928
5928
5929 \backslash
5929 \backslash
5930 v IPython version string
5930 v IPython version string
5931 \layout Standard
5931 \layout Standard
5932
5932
5933 In addition to these, ANSI color escapes can be insterted into the prompts,
5933 In addition to these, ANSI color escapes can be insterted into the prompts,
5934 as
5934 as
5935 \family typewriter
5935 \family typewriter
5936
5936
5937 \backslash
5937 \backslash
5938 C_
5938 C_
5939 \emph on
5939 \emph on
5940 ColorName
5940 ColorName
5941 \family default
5941 \family default
5942 \emph default
5942 \emph default
5943 .
5943 .
5944 The list of valid color names is: Black, Blue, Brown, Cyan, DarkGray, Green,
5944 The list of valid color names is: Black, Blue, Brown, Cyan, DarkGray, Green,
5945 LightBlue, LightCyan, LightGray, LightGreen, LightPurple, LightRed, NoColor,
5945 LightBlue, LightCyan, LightGray, LightGreen, LightPurple, LightRed, NoColor,
5946 Normal, Purple, Red, White, Yellow.
5946 Normal, Purple, Red, White, Yellow.
5947 \layout Standard
5947 \layout Standard
5948
5948
5949 Finally, IPython supports the evaluation of arbitrary expressions in your
5949 Finally, IPython supports the evaluation of arbitrary expressions in your
5950 prompt string.
5950 prompt string.
5951 The prompt strings are evaluated through the syntax of PEP 215, but basically
5951 The prompt strings are evaluated through the syntax of PEP 215, but basically
5952 you can use
5952 you can use
5953 \family typewriter
5953 \family typewriter
5954 $x.y
5954 $x.y
5955 \family default
5955 \family default
5956 to expand the value of
5956 to expand the value of
5957 \family typewriter
5957 \family typewriter
5958 x.y
5958 x.y
5959 \family default
5959 \family default
5960 , and for more complicated expressions you can use braces:
5960 , and for more complicated expressions you can use braces:
5961 \family typewriter
5961 \family typewriter
5962 ${foo()+x}
5962 ${foo()+x}
5963 \family default
5963 \family default
5964 will call function
5964 will call function
5965 \family typewriter
5965 \family typewriter
5966 foo
5966 foo
5967 \family default
5967 \family default
5968 and add to it the value of
5968 and add to it the value of
5969 \family typewriter
5969 \family typewriter
5970 x
5970 x
5971 \family default
5971 \family default
5972 , before putting the result into your prompt.
5972 , before putting the result into your prompt.
5973 For example, using
5973 For example, using
5974 \newline
5974 \newline
5975
5975
5976 \family typewriter
5976 \family typewriter
5977 prompt_in1 '${commands.getoutput("uptime")}
5977 prompt_in1 '${commands.getoutput("uptime")}
5978 \backslash
5978 \backslash
5979 nIn [
5979 nIn [
5980 \backslash
5980 \backslash
5981 #]: '
5981 #]: '
5982 \newline
5982 \newline
5983
5983
5984 \family default
5984 \family default
5985 will print the result of the uptime command on each prompt (assuming the
5985 will print the result of the uptime command on each prompt (assuming the
5986
5986
5987 \family typewriter
5987 \family typewriter
5988 commands
5988 commands
5989 \family default
5989 \family default
5990 module has been imported in your
5990 module has been imported in your
5991 \family typewriter
5991 \family typewriter
5992 ipythonrc
5992 ipythonrc
5993 \family default
5993 \family default
5994 file).
5994 file).
5995 \layout Subsubsection
5995 \layout Subsubsection
5996
5996
5997 Prompt examples
5997 Prompt examples
5998 \layout Standard
5998 \layout Standard
5999
5999
6000 The following options in an ipythonrc file will give you IPython's default
6000 The following options in an ipythonrc file will give you IPython's default
6001 prompts:
6001 prompts:
6002 \layout Standard
6002 \layout Standard
6003
6003
6004
6004
6005 \family typewriter
6005 \family typewriter
6006 prompt_in1 'In [
6006 prompt_in1 'In [
6007 \backslash
6007 \backslash
6008 #]:'
6008 #]:'
6009 \newline
6009 \newline
6010 prompt_in2 '\SpecialChar ~
6010 prompt_in2 '\SpecialChar ~
6011 \SpecialChar ~
6011 \SpecialChar ~
6012 \SpecialChar ~
6012 \SpecialChar ~
6013 .
6013 .
6014 \backslash
6014 \backslash
6015 D.:'
6015 D.:'
6016 \newline
6016 \newline
6017 prompt_out 'Out[
6017 prompt_out 'Out[
6018 \backslash
6018 \backslash
6019 #]:'
6019 #]:'
6020 \layout Standard
6020 \layout Standard
6021
6021
6022 which look like this:
6022 which look like this:
6023 \layout Standard
6023 \layout Standard
6024
6024
6025
6025
6026 \family typewriter
6026 \family typewriter
6027 In [1]: 1+2
6027 In [1]: 1+2
6028 \newline
6028 \newline
6029 Out[1]: 3
6029 Out[1]: 3
6030 \layout Standard
6030 \layout Standard
6031
6031
6032
6032
6033 \family typewriter
6033 \family typewriter
6034 In [2]: for i in (1,2,3):
6034 In [2]: for i in (1,2,3):
6035 \newline
6035 \newline
6036
6036
6037 \begin_inset ERT
6037 \begin_inset ERT
6038 status Collapsed
6038 status Collapsed
6039
6039
6040 \layout Standard
6040 \layout Standard
6041
6041
6042 \backslash
6042 \backslash
6043 hspace*{0mm}
6043 hspace*{0mm}
6044 \end_inset
6044 \end_inset
6045
6045
6046 \SpecialChar ~
6046 \SpecialChar ~
6047 \SpecialChar ~
6047 \SpecialChar ~
6048 \SpecialChar ~
6048 \SpecialChar ~
6049 ...: \SpecialChar ~
6049 ...: \SpecialChar ~
6050 \SpecialChar ~
6050 \SpecialChar ~
6051 \SpecialChar ~
6051 \SpecialChar ~
6052 \SpecialChar ~
6052 \SpecialChar ~
6053 print i,
6053 print i,
6054 \newline
6054 \newline
6055
6055
6056 \begin_inset ERT
6056 \begin_inset ERT
6057 status Collapsed
6057 status Collapsed
6058
6058
6059 \layout Standard
6059 \layout Standard
6060
6060
6061 \backslash
6061 \backslash
6062 hspace*{0mm}
6062 hspace*{0mm}
6063 \end_inset
6063 \end_inset
6064
6064
6065 \SpecialChar ~
6065 \SpecialChar ~
6066 \SpecialChar ~
6066 \SpecialChar ~
6067 \SpecialChar ~
6067 \SpecialChar ~
6068 ...:
6068 ...:
6069 \newline
6069 \newline
6070 1 2 3
6070 1 2 3
6071 \layout Standard
6071 \layout Standard
6072
6072
6073 These will give you a very colorful prompt with path information:
6073 These will give you a very colorful prompt with path information:
6074 \layout Standard
6074 \layout Standard
6075
6075
6076
6076
6077 \family typewriter
6077 \family typewriter
6078 #prompt_in1 '
6078 #prompt_in1 '
6079 \backslash
6079 \backslash
6080 C_Red
6080 C_Red
6081 \backslash
6081 \backslash
6082 u
6082 u
6083 \backslash
6083 \backslash
6084 C_Blue[
6084 C_Blue[
6085 \backslash
6085 \backslash
6086 C_Cyan
6086 C_Cyan
6087 \backslash
6087 \backslash
6088 Y1
6088 Y1
6089 \backslash
6089 \backslash
6090 C_Blue]
6090 C_Blue]
6091 \backslash
6091 \backslash
6092 C_LightGreen
6092 C_LightGreen
6093 \backslash
6093 \backslash
6094 #>'
6094 #>'
6095 \newline
6095 \newline
6096 prompt_in2 ' ..
6096 prompt_in2 ' ..
6097 \backslash
6097 \backslash
6098 D>'
6098 D>'
6099 \newline
6099 \newline
6100 prompt_out '<
6100 prompt_out '<
6101 \backslash
6101 \backslash
6102 #>'
6102 #>'
6103 \layout Standard
6103 \layout Standard
6104
6104
6105 which look like this:
6105 which look like this:
6106 \layout Standard
6106 \layout Standard
6107
6107
6108
6108
6109 \family typewriter
6109 \family typewriter
6110 \color red
6110 \color red
6111 fperez
6111 fperez
6112 \color blue
6112 \color blue
6113 [
6113 [
6114 \color cyan
6114 \color cyan
6115 ~/ipython
6115 ~/ipython
6116 \color blue
6116 \color blue
6117 ]
6117 ]
6118 \color green
6118 \color green
6119 1>
6119 1>
6120 \color default
6120 \color default
6121 1+2
6121 1+2
6122 \newline
6122 \newline
6123
6123
6124 \begin_inset ERT
6124 \begin_inset ERT
6125 status Collapsed
6125 status Collapsed
6126
6126
6127 \layout Standard
6127 \layout Standard
6128
6128
6129 \backslash
6129 \backslash
6130 hspace*{0mm}
6130 hspace*{0mm}
6131 \end_inset
6131 \end_inset
6132
6132
6133 \SpecialChar ~
6133 \SpecialChar ~
6134 \SpecialChar ~
6134 \SpecialChar ~
6135 \SpecialChar ~
6135 \SpecialChar ~
6136 \SpecialChar ~
6136 \SpecialChar ~
6137 \SpecialChar ~
6137 \SpecialChar ~
6138 \SpecialChar ~
6138 \SpecialChar ~
6139 \SpecialChar ~
6139 \SpecialChar ~
6140 \SpecialChar ~
6140 \SpecialChar ~
6141 \SpecialChar ~
6141 \SpecialChar ~
6142 \SpecialChar ~
6142 \SpecialChar ~
6143 \SpecialChar ~
6143 \SpecialChar ~
6144 \SpecialChar ~
6144 \SpecialChar ~
6145 \SpecialChar ~
6145 \SpecialChar ~
6146 \SpecialChar ~
6146 \SpecialChar ~
6147 \SpecialChar ~
6147 \SpecialChar ~
6148 \SpecialChar ~
6148 \SpecialChar ~
6149
6149
6150 \color red
6150 \color red
6151 <1>
6151 <1>
6152 \color default
6152 \color default
6153 3
6153 3
6154 \newline
6154 \newline
6155
6155
6156 \color red
6156 \color red
6157 fperez
6157 fperez
6158 \color blue
6158 \color blue
6159 [
6159 [
6160 \color cyan
6160 \color cyan
6161 ~/ipython
6161 ~/ipython
6162 \color blue
6162 \color blue
6163 ]
6163 ]
6164 \color green
6164 \color green
6165 2>
6165 2>
6166 \color default
6166 \color default
6167 for i in (1,2,3):
6167 for i in (1,2,3):
6168 \newline
6168 \newline
6169
6169
6170 \begin_inset ERT
6170 \begin_inset ERT
6171 status Collapsed
6171 status Collapsed
6172
6172
6173 \layout Standard
6173 \layout Standard
6174
6174
6175 \backslash
6175 \backslash
6176 hspace*{0mm}
6176 hspace*{0mm}
6177 \end_inset
6177 \end_inset
6178
6178
6179 \SpecialChar ~
6179 \SpecialChar ~
6180 \SpecialChar ~
6180 \SpecialChar ~
6181 \SpecialChar ~
6181 \SpecialChar ~
6182 \SpecialChar ~
6182 \SpecialChar ~
6183 \SpecialChar ~
6183 \SpecialChar ~
6184 \SpecialChar ~
6184 \SpecialChar ~
6185 \SpecialChar ~
6185 \SpecialChar ~
6186 \SpecialChar ~
6186 \SpecialChar ~
6187 \SpecialChar ~
6187 \SpecialChar ~
6188 \SpecialChar ~
6188 \SpecialChar ~
6189 \SpecialChar ~
6189 \SpecialChar ~
6190 \SpecialChar ~
6190 \SpecialChar ~
6191 \SpecialChar ~
6191 \SpecialChar ~
6192 \SpecialChar ~
6192 \SpecialChar ~
6193 \SpecialChar ~
6193 \SpecialChar ~
6194
6194
6195 \color green
6195 \color green
6196 ...>
6196 ...>
6197 \color default
6197 \color default
6198 \SpecialChar ~
6198 \SpecialChar ~
6199 \SpecialChar ~
6199 \SpecialChar ~
6200 \SpecialChar ~
6200 \SpecialChar ~
6201 \SpecialChar ~
6201 \SpecialChar ~
6202 print i,
6202 print i,
6203 \newline
6203 \newline
6204
6204
6205 \begin_inset ERT
6205 \begin_inset ERT
6206 status Collapsed
6206 status Collapsed
6207
6207
6208 \layout Standard
6208 \layout Standard
6209
6209
6210 \backslash
6210 \backslash
6211 hspace*{0mm}
6211 hspace*{0mm}
6212 \end_inset
6212 \end_inset
6213
6213
6214 \SpecialChar ~
6214 \SpecialChar ~
6215 \SpecialChar ~
6215 \SpecialChar ~
6216 \SpecialChar ~
6216 \SpecialChar ~
6217 \SpecialChar ~
6217 \SpecialChar ~
6218 \SpecialChar ~
6218 \SpecialChar ~
6219 \SpecialChar ~
6219 \SpecialChar ~
6220 \SpecialChar ~
6220 \SpecialChar ~
6221 \SpecialChar ~
6221 \SpecialChar ~
6222 \SpecialChar ~
6222 \SpecialChar ~
6223 \SpecialChar ~
6223 \SpecialChar ~
6224 \SpecialChar ~
6224 \SpecialChar ~
6225 \SpecialChar ~
6225 \SpecialChar ~
6226 \SpecialChar ~
6226 \SpecialChar ~
6227 \SpecialChar ~
6227 \SpecialChar ~
6228 \SpecialChar ~
6228 \SpecialChar ~
6229
6229
6230 \color green
6230 \color green
6231 ...>
6231 ...>
6232 \color default
6232 \color default
6233
6233
6234 \newline
6234 \newline
6235 1 2 3
6235 1 2 3
6236 \layout Standard
6236 \layout Standard
6237
6237
6238 The following shows the usage of dynamic expression evaluation:
6238 The following shows the usage of dynamic expression evaluation:
6239 \layout Subsection
6239 \layout Subsection
6240
6240
6241
6241
6242 \begin_inset LatexCommand \label{sec:profiles}
6242 \begin_inset LatexCommand \label{sec:profiles}
6243
6243
6244 \end_inset
6244 \end_inset
6245
6245
6246 IPython profiles
6246 IPython profiles
6247 \layout Standard
6247 \layout Standard
6248
6248
6249 As we already mentioned, IPython supports the
6249 As we already mentioned, IPython supports the
6250 \family typewriter
6250 \family typewriter
6251 -profile
6251 -profile
6252 \family default
6252 \family default
6253 command-line option (see sec.
6253 command-line option (see sec.
6254
6254
6255 \begin_inset LatexCommand \ref{sec:cmd-line-opts}
6255 \begin_inset LatexCommand \ref{sec:cmd-line-opts}
6256
6256
6257 \end_inset
6257 \end_inset
6258
6258
6259 ).
6259 ).
6260 A profile is nothing more than a particular configuration file like your
6260 A profile is nothing more than a particular configuration file like your
6261 basic
6261 basic
6262 \family typewriter
6262 \family typewriter
6263 ipythonrc
6263 ipythonrc
6264 \family default
6264 \family default
6265 one, but with particular customizations for a specific purpose.
6265 one, but with particular customizations for a specific purpose.
6266 When you start IPython with '
6266 When you start IPython with '
6267 \family typewriter
6267 \family typewriter
6268 ipython -profile <name>
6268 ipython -profile <name>
6269 \family default
6269 \family default
6270 ', it assumes that in your
6270 ', it assumes that in your
6271 \family typewriter
6271 \family typewriter
6272 IPYTHONDIR
6272 IPYTHONDIR
6273 \family default
6273 \family default
6274 there is a file called
6274 there is a file called
6275 \family typewriter
6275 \family typewriter
6276 ipythonrc-<name>
6276 ipythonrc-<name>
6277 \family default
6277 \family default
6278 , and loads it instead of the normal
6278 , and loads it instead of the normal
6279 \family typewriter
6279 \family typewriter
6280 ipythonrc
6280 ipythonrc
6281 \family default
6281 \family default
6282 .
6282 .
6283 \layout Standard
6283 \layout Standard
6284
6284
6285 This system allows you to maintain multiple configurations which load modules,
6285 This system allows you to maintain multiple configurations which load modules,
6286 set options, define functions, etc.
6286 set options, define functions, etc.
6287 suitable for different tasks and activate them in a very simple manner.
6287 suitable for different tasks and activate them in a very simple manner.
6288 In order to avoid having to repeat all of your basic options (common things
6288 In order to avoid having to repeat all of your basic options (common things
6289 that don't change such as your color preferences, for example), any profile
6289 that don't change such as your color preferences, for example), any profile
6290 can include another configuration file.
6290 can include another configuration file.
6291 The most common way to use profiles is then to have each one include your
6291 The most common way to use profiles is then to have each one include your
6292 basic
6292 basic
6293 \family typewriter
6293 \family typewriter
6294 ipythonrc
6294 ipythonrc
6295 \family default
6295 \family default
6296 file as a starting point, and then add further customizations.
6296 file as a starting point, and then add further customizations.
6297 \layout Standard
6297 \layout Standard
6298
6298
6299 In sections
6299 In sections
6300 \begin_inset LatexCommand \ref{sec:syntax-extensions}
6300 \begin_inset LatexCommand \ref{sec:syntax-extensions}
6301
6301
6302 \end_inset
6302 \end_inset
6303
6303
6304 and
6304 and
6305 \begin_inset LatexCommand \ref{sec:Gnuplot}
6305 \begin_inset LatexCommand \ref{sec:Gnuplot}
6306
6306
6307 \end_inset
6307 \end_inset
6308
6308
6309 we discuss some particular profiles which come as part of the standard
6309 we discuss some particular profiles which come as part of the standard
6310 IPython distribution.
6310 IPython distribution.
6311 You may also look in your
6311 You may also look in your
6312 \family typewriter
6312 \family typewriter
6313 IPYTHONDIR
6313 IPYTHONDIR
6314 \family default
6314 \family default
6315 directory, any file whose name begins with
6315 directory, any file whose name begins with
6316 \family typewriter
6316 \family typewriter
6317 ipythonrc-
6317 ipythonrc-
6318 \family default
6318 \family default
6319 is a profile.
6319 is a profile.
6320 You can use those as examples for further customizations to suit your own
6320 You can use those as examples for further customizations to suit your own
6321 needs.
6321 needs.
6322 \layout Section
6322 \layout Section
6323
6323
6324
6324
6325 \begin_inset OptArg
6325 \begin_inset OptArg
6326 collapsed false
6326 collapsed false
6327
6327
6328 \layout Standard
6328 \layout Standard
6329
6329
6330 IPython as default...
6330 IPython as default...
6331 \end_inset
6331 \end_inset
6332
6332
6333 IPython as your default Python environment
6333 IPython as your default Python environment
6334 \layout Standard
6334 \layout Standard
6335
6335
6336 Python honors the environment variable
6336 Python honors the environment variable
6337 \family typewriter
6337 \family typewriter
6338 PYTHONSTARTUP
6338 PYTHONSTARTUP
6339 \family default
6339 \family default
6340 and will execute at startup the file referenced by this variable.
6340 and will execute at startup the file referenced by this variable.
6341 If you put at the end of this file the following two lines of code:
6341 If you put at the end of this file the following two lines of code:
6342 \layout Standard
6342 \layout Standard
6343
6343
6344
6344
6345 \family typewriter
6345 \family typewriter
6346 import IPython
6346 import IPython
6347 \newline
6347 \newline
6348 IPython.Shell.IPShell().mainloop(sys_exit=1)
6348 IPython.Shell.IPShell().mainloop(sys_exit=1)
6349 \layout Standard
6349 \layout Standard
6350
6350
6351 then IPython will be your working environment anytime you start Python.
6351 then IPython will be your working environment anytime you start Python.
6352 The
6352 The
6353 \family typewriter
6353 \family typewriter
6354 sys_exit=1
6354 sys_exit=1
6355 \family default
6355 \family default
6356 is needed to have IPython issue a call to
6356 is needed to have IPython issue a call to
6357 \family typewriter
6357 \family typewriter
6358 sys.exit()
6358 sys.exit()
6359 \family default
6359 \family default
6360 when it finishes, otherwise you'll be back at the normal Python '
6360 when it finishes, otherwise you'll be back at the normal Python '
6361 \family typewriter
6361 \family typewriter
6362 >>>
6362 >>>
6363 \family default
6363 \family default
6364 ' prompt
6364 ' prompt
6365 \begin_inset Foot
6365 \begin_inset Foot
6366 collapsed true
6366 collapsed true
6367
6367
6368 \layout Standard
6368 \layout Standard
6369
6369
6370 Based on an idea by Holger Krekel.
6370 Based on an idea by Holger Krekel.
6371 \end_inset
6371 \end_inset
6372
6372
6373 .
6373 .
6374 \layout Standard
6374 \layout Standard
6375
6375
6376 This is probably useful to developers who manage multiple Python versions
6376 This is probably useful to developers who manage multiple Python versions
6377 and don't want to have correspondingly multiple IPython versions.
6377 and don't want to have correspondingly multiple IPython versions.
6378 Note that in this mode, there is no way to pass IPython any command-line
6378 Note that in this mode, there is no way to pass IPython any command-line
6379 options, as those are trapped first by Python itself.
6379 options, as those are trapped first by Python itself.
6380 \layout Section
6380 \layout Section
6381
6381
6382
6382
6383 \begin_inset LatexCommand \label{sec:embed}
6383 \begin_inset LatexCommand \label{sec:embed}
6384
6384
6385 \end_inset
6385 \end_inset
6386
6386
6387 Embedding IPython
6387 Embedding IPython
6388 \layout Standard
6388 \layout Standard
6389
6389
6390 It is possible to start an IPython instance
6390 It is possible to start an IPython instance
6391 \emph on
6391 \emph on
6392 inside
6392 inside
6393 \emph default
6393 \emph default
6394 your own Python programs.
6394 your own Python programs.
6395 This allows you to evaluate dynamically the state of your code, operate
6395 This allows you to evaluate dynamically the state of your code, operate
6396 with your variables, analyze them, etc.
6396 with your variables, analyze them, etc.
6397 Note however that any changes you make to values while in the shell do
6397 Note however that any changes you make to values while in the shell do
6398
6398
6399 \emph on
6399 \emph on
6400 not
6400 not
6401 \emph default
6401 \emph default
6402 propagate back to the running code, so it is safe to modify your values
6402 propagate back to the running code, so it is safe to modify your values
6403 because you won't break your code in bizarre ways by doing so.
6403 because you won't break your code in bizarre ways by doing so.
6404 \layout Standard
6404 \layout Standard
6405
6405
6406 This feature allows you to easily have a fully functional python environment
6406 This feature allows you to easily have a fully functional python environment
6407 for doing object introspection anywhere in your code with a simple function
6407 for doing object introspection anywhere in your code with a simple function
6408 call.
6408 call.
6409 In some cases a simple print statement is enough, but if you need to do
6409 In some cases a simple print statement is enough, but if you need to do
6410 more detailed analysis of a code fragment this feature can be very valuable.
6410 more detailed analysis of a code fragment this feature can be very valuable.
6411 \layout Standard
6411 \layout Standard
6412
6412
6413 It can also be useful in scientific computing situations where it is common
6413 It can also be useful in scientific computing situations where it is common
6414 to need to do some automatic, computationally intensive part and then stop
6414 to need to do some automatic, computationally intensive part and then stop
6415 to look at data, plots, etc
6415 to look at data, plots, etc
6416 \begin_inset Foot
6416 \begin_inset Foot
6417 collapsed true
6417 collapsed true
6418
6418
6419 \layout Standard
6419 \layout Standard
6420
6420
6421 This functionality was inspired by IDL's combination of the
6421 This functionality was inspired by IDL's combination of the
6422 \family typewriter
6422 \family typewriter
6423 stop
6423 stop
6424 \family default
6424 \family default
6425 keyword and the
6425 keyword and the
6426 \family typewriter
6426 \family typewriter
6427 .continue
6427 .continue
6428 \family default
6428 \family default
6429 executive command, which I have found very useful in the past, and by a
6429 executive command, which I have found very useful in the past, and by a
6430 posting on comp.lang.python by cmkl <cmkleffner-AT-gmx.de> on Dec.
6430 posting on comp.lang.python by cmkl <cmkleffner-AT-gmx.de> on Dec.
6431 06/01 concerning similar uses of pyrepl.
6431 06/01 concerning similar uses of pyrepl.
6432 \end_inset
6432 \end_inset
6433
6433
6434 .
6434 .
6435 Opening an IPython instance will give you full access to your data and
6435 Opening an IPython instance will give you full access to your data and
6436 functions, and you can resume program execution once you are done with
6436 functions, and you can resume program execution once you are done with
6437 the interactive part (perhaps to stop again later, as many times as needed).
6437 the interactive part (perhaps to stop again later, as many times as needed).
6438 \layout Standard
6438 \layout Standard
6439
6439
6440 The following code snippet is the bare minimum you need to include in your
6440 The following code snippet is the bare minimum you need to include in your
6441 Python programs for this to work (detailed examples follow later):
6441 Python programs for this to work (detailed examples follow later):
6442 \layout LyX-Code
6442 \layout LyX-Code
6443
6443
6444 from IPython.Shell import IPShellEmbed
6444 from IPython.Shell import IPShellEmbed
6445 \layout LyX-Code
6445 \layout LyX-Code
6446
6446
6447 ipshell = IPShellEmbed()
6447 ipshell = IPShellEmbed()
6448 \layout LyX-Code
6448 \layout LyX-Code
6449
6449
6450 ipshell() # this call anywhere in your program will start IPython
6450 ipshell() # this call anywhere in your program will start IPython
6451 \layout Standard
6451 \layout Standard
6452
6452
6453 You can run embedded instances even in code which is itself being run at
6453 You can run embedded instances even in code which is itself being run at
6454 the IPython interactive prompt with '
6454 the IPython interactive prompt with '
6455 \family typewriter
6455 \family typewriter
6456 %run\SpecialChar ~
6456 %run\SpecialChar ~
6457 <filename>
6457 <filename>
6458 \family default
6458 \family default
6459 '.
6459 '.
6460 Since it's easy to get lost as to where you are (in your top-level IPython
6460 Since it's easy to get lost as to where you are (in your top-level IPython
6461 or in your embedded one), it's a good idea in such cases to set the in/out
6461 or in your embedded one), it's a good idea in such cases to set the in/out
6462 prompts to something different for the embedded instances.
6462 prompts to something different for the embedded instances.
6463 The code examples below illustrate this.
6463 The code examples below illustrate this.
6464 \layout Standard
6464 \layout Standard
6465
6465
6466 You can also have multiple IPython instances in your program and open them
6466 You can also have multiple IPython instances in your program and open them
6467 separately, for example with different options for data presentation.
6467 separately, for example with different options for data presentation.
6468 If you close and open the same instance multiple times, its prompt counters
6468 If you close and open the same instance multiple times, its prompt counters
6469 simply continue from each execution to the next.
6469 simply continue from each execution to the next.
6470 \layout Standard
6470 \layout Standard
6471
6471
6472 Please look at the docstrings in the
6472 Please look at the docstrings in the
6473 \family typewriter
6473 \family typewriter
6474 Shell.py
6474 Shell.py
6475 \family default
6475 \family default
6476 module for more details on the use of this system.
6476 module for more details on the use of this system.
6477 \layout Standard
6477 \layout Standard
6478
6478
6479 The following sample file illustrating how to use the embedding functionality
6479 The following sample file illustrating how to use the embedding functionality
6480 is provided in the examples directory as
6480 is provided in the examples directory as
6481 \family typewriter
6481 \family typewriter
6482 example-embed.py
6482 example-embed.py
6483 \family default
6483 \family default
6484 .
6484 .
6485 It should be fairly self-explanatory:
6485 It should be fairly self-explanatory:
6486 \layout Standard
6486 \layout Standard
6487
6487
6488
6488
6489 \begin_inset ERT
6489 \begin_inset ERT
6490 status Open
6490 status Open
6491
6491
6492 \layout Standard
6492 \layout Standard
6493
6493
6494 \backslash
6494 \backslash
6495 codelist{examples/example-embed.py}
6495 codelist{examples/example-embed.py}
6496 \end_inset
6496 \end_inset
6497
6497
6498
6498
6499 \layout Standard
6499 \layout Standard
6500
6500
6501 Once you understand how the system functions, you can use the following
6501 Once you understand how the system functions, you can use the following
6502 code fragments in your programs which are ready for cut and paste:
6502 code fragments in your programs which are ready for cut and paste:
6503 \layout Standard
6503 \layout Standard
6504
6504
6505
6505
6506 \begin_inset ERT
6506 \begin_inset ERT
6507 status Open
6507 status Open
6508
6508
6509 \layout Standard
6509 \layout Standard
6510
6510
6511 \backslash
6511 \backslash
6512 codelist{examples/example-embed-short.py}
6512 codelist{examples/example-embed-short.py}
6513 \end_inset
6513 \end_inset
6514
6514
6515
6515
6516 \layout Section
6516 \layout Section
6517
6517
6518
6518
6519 \begin_inset LatexCommand \label{sec:using-pdb}
6519 \begin_inset LatexCommand \label{sec:using-pdb}
6520
6520
6521 \end_inset
6521 \end_inset
6522
6522
6523 Using the Python debugger (
6523 Using the Python debugger (
6524 \family typewriter
6524 \family typewriter
6525 pdb
6525 pdb
6526 \family default
6526 \family default
6527 )
6527 )
6528 \layout Subsection
6528 \layout Subsection
6529
6529
6530 Running entire programs via
6530 Running entire programs via
6531 \family typewriter
6531 \family typewriter
6532 pdb
6532 pdb
6533 \layout Standard
6533 \layout Standard
6534
6534
6535
6535
6536 \family typewriter
6536 \family typewriter
6537 pdb
6537 pdb
6538 \family default
6538 \family default
6539 , the Python debugger, is a powerful interactive debugger which allows you
6539 , the Python debugger, is a powerful interactive debugger which allows you
6540 to step through code, set breakpoints, watch variables, etc.
6540 to step through code, set breakpoints, watch variables, etc.
6541 IPython makes it very easy to start any script under the control of
6541 IPython makes it very easy to start any script under the control of
6542 \family typewriter
6542 \family typewriter
6543 pdb
6543 pdb
6544 \family default
6544 \family default
6545 , regardless of whether you have wrapped it into a
6545 , regardless of whether you have wrapped it into a
6546 \family typewriter
6546 \family typewriter
6547 `main()'
6547 `main()'
6548 \family default
6548 \family default
6549 function or not.
6549 function or not.
6550 For this, simply type
6550 For this, simply type
6551 \family typewriter
6551 \family typewriter
6552 `%run -d myscript'
6552 `%run -d myscript'
6553 \family default
6553 \family default
6554 at an IPython prompt.
6554 at an IPython prompt.
6555 See the
6555 See the
6556 \family typewriter
6556 \family typewriter
6557 %run
6557 %run
6558 \family default
6558 \family default
6559 command's documentation (via
6559 command's documentation (via
6560 \family typewriter
6560 \family typewriter
6561 `%run?'
6561 `%run?'
6562 \family default
6562 \family default
6563 or in Sec.\SpecialChar ~
6563 or in Sec.\SpecialChar ~
6564
6564
6565 \begin_inset LatexCommand \ref{sec:magic}
6565 \begin_inset LatexCommand \ref{sec:magic}
6566
6566
6567 \end_inset
6567 \end_inset
6568
6568
6569 ) for more details, including how to control where
6569 ) for more details, including how to control where
6570 \family typewriter
6570 \family typewriter
6571 pdb
6571 pdb
6572 \family default
6572 \family default
6573 will stop execution first.
6573 will stop execution first.
6574 \layout Standard
6574 \layout Standard
6575
6575
6576 For more information on the use of the
6576 For more information on the use of the
6577 \family typewriter
6577 \family typewriter
6578 pdb
6578 pdb
6579 \family default
6579 \family default
6580 debugger, read the included
6580 debugger, read the included
6581 \family typewriter
6581 \family typewriter
6582 pdb.doc
6582 pdb.doc
6583 \family default
6583 \family default
6584 file (part of the standard Python distribution).
6584 file (part of the standard Python distribution).
6585 On a stock Linux system it is located at
6585 On a stock Linux system it is located at
6586 \family typewriter
6586 \family typewriter
6587 /usr/lib/python2.3/pdb.doc
6587 /usr/lib/python2.3/pdb.doc
6588 \family default
6588 \family default
6589 , but the easiest way to read it is by using the
6589 , but the easiest way to read it is by using the
6590 \family typewriter
6590 \family typewriter
6591 help()
6591 help()
6592 \family default
6592 \family default
6593 function of the
6593 function of the
6594 \family typewriter
6594 \family typewriter
6595 pdb
6595 pdb
6596 \family default
6596 \family default
6597 module as follows (in an IPython prompt):
6597 module as follows (in an IPython prompt):
6598 \layout Standard
6598 \layout Standard
6599
6599
6600
6600
6601 \family typewriter
6601 \family typewriter
6602 In [1]: import pdb
6602 In [1]: import pdb
6603 \newline
6603 \newline
6604 In [2]: pdb.help()
6604 In [2]: pdb.help()
6605 \layout Standard
6605 \layout Standard
6606
6606
6607 This will load the
6607 This will load the
6608 \family typewriter
6608 \family typewriter
6609 pdb.doc
6609 pdb.doc
6610 \family default
6610 \family default
6611 document in a file viewer for you automatically.
6611 document in a file viewer for you automatically.
6612 \layout Subsection
6612 \layout Subsection
6613
6613
6614 Automatic invocation of
6614 Automatic invocation of
6615 \family typewriter
6615 \family typewriter
6616 pdb
6616 pdb
6617 \family default
6617 \family default
6618 on exceptions
6618 on exceptions
6619 \layout Standard
6619 \layout Standard
6620
6620
6621 IPython, if started with the
6621 IPython, if started with the
6622 \family typewriter
6622 \family typewriter
6623 -pdb
6623 -pdb
6624 \family default
6624 \family default
6625 option (or if the option is set in your rc file) can call the Python
6625 option (or if the option is set in your rc file) can call the Python
6626 \family typewriter
6626 \family typewriter
6627 pdb
6627 pdb
6628 \family default
6628 \family default
6629 debugger every time your code triggers an uncaught exception
6629 debugger every time your code triggers an uncaught exception
6630 \begin_inset Foot
6630 \begin_inset Foot
6631 collapsed true
6631 collapsed true
6632
6632
6633 \layout Standard
6633 \layout Standard
6634
6634
6635 Many thanks to Christopher Hart for the request which prompted adding this
6635 Many thanks to Christopher Hart for the request which prompted adding this
6636 feature to IPython.
6636 feature to IPython.
6637 \end_inset
6637 \end_inset
6638
6638
6639 .
6639 .
6640 This feature can also be toggled at any time with the
6640 This feature can also be toggled at any time with the
6641 \family typewriter
6641 \family typewriter
6642 %pdb
6642 %pdb
6643 \family default
6643 \family default
6644 magic command.
6644 magic command.
6645 This can be extremely useful in order to find the origin of subtle bugs,
6645 This can be extremely useful in order to find the origin of subtle bugs,
6646 because
6646 because
6647 \family typewriter
6647 \family typewriter
6648 pdb
6648 pdb
6649 \family default
6649 \family default
6650 opens up at the point in your code which triggered the exception, and while
6650 opens up at the point in your code which triggered the exception, and while
6651 your program is at this point `dead', all the data is still available and
6651 your program is at this point `dead', all the data is still available and
6652 you can walk up and down the stack frame and understand the origin of the
6652 you can walk up and down the stack frame and understand the origin of the
6653 problem.
6653 problem.
6654 \layout Standard
6654 \layout Standard
6655
6655
6656 Furthermore, you can use these debugging facilities both with the embedded
6656 Furthermore, you can use these debugging facilities both with the embedded
6657 IPython mode and without IPython at all.
6657 IPython mode and without IPython at all.
6658 For an embedded shell (see sec.
6658 For an embedded shell (see sec.
6659
6659
6660 \begin_inset LatexCommand \ref{sec:embed}
6660 \begin_inset LatexCommand \ref{sec:embed}
6661
6661
6662 \end_inset
6662 \end_inset
6663
6663
6664 ), simply call the constructor with
6664 ), simply call the constructor with
6665 \family typewriter
6665 \family typewriter
6666 `-pdb'
6666 `-pdb'
6667 \family default
6667 \family default
6668 in the argument string and automatically
6668 in the argument string and automatically
6669 \family typewriter
6669 \family typewriter
6670 pdb
6670 pdb
6671 \family default
6671 \family default
6672 will be called if an uncaught exception is triggered by your code.
6672 will be called if an uncaught exception is triggered by your code.
6673
6673
6674 \layout Standard
6674 \layout Standard
6675
6675
6676 For stand-alone use of the feature in your programs which do not use IPython
6676 For stand-alone use of the feature in your programs which do not use IPython
6677 at all, put the following lines toward the top of your `main' routine:
6677 at all, put the following lines toward the top of your `main' routine:
6678 \layout Standard
6678 \layout Standard
6679 \align left
6679 \align left
6680
6680
6681 \family typewriter
6681 \family typewriter
6682 import sys,IPython.ultraTB
6682 import sys,IPython.ultraTB
6683 \newline
6683 \newline
6684 sys.excepthook = IPython.ultraTB.FormattedTB(mode=`Verbose', color_scheme=`Linux',
6684 sys.excepthook = IPython.ultraTB.FormattedTB(mode=`Verbose', color_scheme=`Linux',
6685 call_pdb=1)
6685 call_pdb=1)
6686 \layout Standard
6686 \layout Standard
6687
6687
6688 The
6688 The
6689 \family typewriter
6689 \family typewriter
6690 mode
6690 mode
6691 \family default
6691 \family default
6692 keyword can be either
6692 keyword can be either
6693 \family typewriter
6693 \family typewriter
6694 `Verbose'
6694 `Verbose'
6695 \family default
6695 \family default
6696 or
6696 or
6697 \family typewriter
6697 \family typewriter
6698 `Plain'
6698 `Plain'
6699 \family default
6699 \family default
6700 , giving either very detailed or normal tracebacks respectively.
6700 , giving either very detailed or normal tracebacks respectively.
6701 The
6701 The
6702 \family typewriter
6702 \family typewriter
6703 color_scheme
6703 color_scheme
6704 \family default
6704 \family default
6705 keyword can be one of
6705 keyword can be one of
6706 \family typewriter
6706 \family typewriter
6707 `NoColor'
6707 `NoColor'
6708 \family default
6708 \family default
6709 ,
6709 ,
6710 \family typewriter
6710 \family typewriter
6711 `Linux'
6711 `Linux'
6712 \family default
6712 \family default
6713 (default) or
6713 (default) or
6714 \family typewriter
6714 \family typewriter
6715 `LightBG'
6715 `LightBG'
6716 \family default
6716 \family default
6717 .
6717 .
6718 These are the same options which can be set in IPython with
6718 These are the same options which can be set in IPython with
6719 \family typewriter
6719 \family typewriter
6720 -colors
6720 -colors
6721 \family default
6721 \family default
6722 and
6722 and
6723 \family typewriter
6723 \family typewriter
6724 -xmode
6724 -xmode
6725 \family default
6725 \family default
6726 .
6726 .
6727 \layout Standard
6727 \layout Standard
6728
6728
6729 This will give any of your programs detailed, colored tracebacks with automatic
6729 This will give any of your programs detailed, colored tracebacks with automatic
6730 invocation of
6730 invocation of
6731 \family typewriter
6731 \family typewriter
6732 pdb
6732 pdb
6733 \family default
6733 \family default
6734 .
6734 .
6735 \layout Section
6735 \layout Section
6736
6736
6737
6737
6738 \begin_inset LatexCommand \label{sec:syntax-extensions}
6738 \begin_inset LatexCommand \label{sec:syntax-extensions}
6739
6739
6740 \end_inset
6740 \end_inset
6741
6741
6742 Extensions for syntax processing
6742 Extensions for syntax processing
6743 \layout Standard
6743 \layout Standard
6744
6744
6745 This isn't for the faint of heart, because the potential for breaking things
6745 This isn't for the faint of heart, because the potential for breaking things
6746 is quite high.
6746 is quite high.
6747 But it can be a very powerful and useful feature.
6747 But it can be a very powerful and useful feature.
6748 In a nutshell, you can redefine the way IPython processes the user input
6748 In a nutshell, you can redefine the way IPython processes the user input
6749 line to accept new, special extensions to the syntax without needing to
6749 line to accept new, special extensions to the syntax without needing to
6750 change any of IPython's own code.
6750 change any of IPython's own code.
6751 \layout Standard
6751 \layout Standard
6752
6752
6753 In the
6753 In the
6754 \family typewriter
6754 \family typewriter
6755 IPython/Extensions
6755 IPython/Extensions
6756 \family default
6756 \family default
6757 directory you will find some examples supplied, which we will briefly describe
6757 directory you will find some examples supplied, which we will briefly describe
6758 now.
6758 now.
6759 These can be used `as is' (and both provide very useful functionality),
6759 These can be used `as is' (and both provide very useful functionality),
6760 or you can use them as a starting point for writing your own extensions.
6760 or you can use them as a starting point for writing your own extensions.
6761 \layout Subsection
6761 \layout Subsection
6762
6762
6763 Pasting of code starting with
6763 Pasting of code starting with
6764 \family typewriter
6764 \family typewriter
6765 `>>>
6765 `>>>
6766 \family default
6766 \family default
6767 ' or
6767 ' or
6768 \family typewriter
6768 \family typewriter
6769 `...
6769 `...
6770
6770
6771 \family default
6771 \family default
6772 '
6772 '
6773 \layout Standard
6773 \layout Standard
6774
6774
6775 In the python tutorial it is common to find code examples which have been
6775 In the python tutorial it is common to find code examples which have been
6776 taken from real python sessions.
6776 taken from real python sessions.
6777 The problem with those is that all the lines begin with either
6777 The problem with those is that all the lines begin with either
6778 \family typewriter
6778 \family typewriter
6779 `>>>
6779 `>>>
6780 \family default
6780 \family default
6781 ' or
6781 ' or
6782 \family typewriter
6782 \family typewriter
6783 `...
6783 `...
6784
6784
6785 \family default
6785 \family default
6786 ', which makes it impossible to paste them all at once.
6786 ', which makes it impossible to paste them all at once.
6787 One must instead do a line by line manual copying, carefully removing the
6787 One must instead do a line by line manual copying, carefully removing the
6788 leading extraneous characters.
6788 leading extraneous characters.
6789 \layout Standard
6789 \layout Standard
6790
6790
6791 This extension identifies those starting characters and removes them from
6791 This extension identifies those starting characters and removes them from
6792 the input automatically, so that one can paste multi-line examples directly
6792 the input automatically, so that one can paste multi-line examples directly
6793 into IPython, saving a lot of time.
6793 into IPython, saving a lot of time.
6794 Please look at the file
6794 Please look at the file
6795 \family typewriter
6795 \family typewriter
6796 InterpreterPasteInput.py
6796 InterpreterPasteInput.py
6797 \family default
6797 \family default
6798 in the
6798 in the
6799 \family typewriter
6799 \family typewriter
6800 IPython/Extensions
6800 IPython/Extensions
6801 \family default
6801 \family default
6802 directory for details on how this is done.
6802 directory for details on how this is done.
6803 \layout Standard
6803 \layout Standard
6804
6804
6805 IPython comes with a special profile enabling this feature, called
6805 IPython comes with a special profile enabling this feature, called
6806 \family typewriter
6806 \family typewriter
6807 tutorial
6807 tutorial
6808 \family default
6808 \family default
6809 \emph on
6809 \emph on
6810 .
6810 .
6811
6811
6812 \emph default
6812 \emph default
6813 Simply start IPython via
6813 Simply start IPython via
6814 \family typewriter
6814 \family typewriter
6815 `ipython\SpecialChar ~
6815 `ipython\SpecialChar ~
6816 -p\SpecialChar ~
6816 -p\SpecialChar ~
6817 tutorial'
6817 tutorial'
6818 \family default
6818 \family default
6819 and the feature will be available.
6819 and the feature will be available.
6820 In a normal IPython session you can activate the feature by importing the
6820 In a normal IPython session you can activate the feature by importing the
6821 corresponding module with:
6821 corresponding module with:
6822 \newline
6822 \newline
6823
6823
6824 \family typewriter
6824 \family typewriter
6825 In [1]: import IPython.Extensions.InterpreterPasteInput
6825 In [1]: import IPython.Extensions.InterpreterPasteInput
6826 \layout Standard
6826 \layout Standard
6827
6827
6828 The following is a 'screenshot' of how things work when this extension is
6828 The following is a 'screenshot' of how things work when this extension is
6829 on, copying an example from the standard tutorial:
6829 on, copying an example from the standard tutorial:
6830 \layout Standard
6830 \layout Standard
6831
6831
6832
6832
6833 \family typewriter
6833 \family typewriter
6834 IPython profile: tutorial
6834 IPython profile: tutorial
6835 \newline
6835 \newline
6836 \SpecialChar ~
6836 \SpecialChar ~
6837
6837
6838 \newline
6838 \newline
6839 *** Pasting of code with ">>>" or "..." has been enabled.
6839 *** Pasting of code with ">>>" or "..." has been enabled.
6840 \newline
6840 \newline
6841 \SpecialChar ~
6841 \SpecialChar ~
6842
6842
6843 \newline
6843 \newline
6844 In [1]: >>> def fib2(n): # return Fibonacci series up to n
6844 In [1]: >>> def fib2(n): # return Fibonacci series up to n
6845 \newline
6845 \newline
6846
6846
6847 \begin_inset ERT
6847 \begin_inset ERT
6848 status Collapsed
6848 status Collapsed
6849
6849
6850 \layout Standard
6850 \layout Standard
6851
6851
6852 \backslash
6852 \backslash
6853 hspace*{0mm}
6853 hspace*{0mm}
6854 \end_inset
6854 \end_inset
6855
6855
6856 \SpecialChar ~
6856 \SpecialChar ~
6857 \SpecialChar ~
6857 \SpecialChar ~
6858 ...: ...\SpecialChar ~
6858 ...: ...\SpecialChar ~
6859 \SpecialChar ~
6859 \SpecialChar ~
6860 \SpecialChar ~
6860 \SpecialChar ~
6861 \SpecialChar ~
6861 \SpecialChar ~
6862 """Return a list containing the Fibonacci series up to n."""
6862 """Return a list containing the Fibonacci series up to n."""
6863 \newline
6863 \newline
6864
6864
6865 \begin_inset ERT
6865 \begin_inset ERT
6866 status Collapsed
6866 status Collapsed
6867
6867
6868 \layout Standard
6868 \layout Standard
6869
6869
6870 \backslash
6870 \backslash
6871 hspace*{0mm}
6871 hspace*{0mm}
6872 \end_inset
6872 \end_inset
6873
6873
6874 \SpecialChar ~
6874 \SpecialChar ~
6875 \SpecialChar ~
6875 \SpecialChar ~
6876 ...: ...\SpecialChar ~
6876 ...: ...\SpecialChar ~
6877 \SpecialChar ~
6877 \SpecialChar ~
6878 \SpecialChar ~
6878 \SpecialChar ~
6879 \SpecialChar ~
6879 \SpecialChar ~
6880 result = []
6880 result = []
6881 \newline
6881 \newline
6882
6882
6883 \begin_inset ERT
6883 \begin_inset ERT
6884 status Collapsed
6884 status Collapsed
6885
6885
6886 \layout Standard
6886 \layout Standard
6887
6887
6888 \backslash
6888 \backslash
6889 hspace*{0mm}
6889 hspace*{0mm}
6890 \end_inset
6890 \end_inset
6891
6891
6892 \SpecialChar ~
6892 \SpecialChar ~
6893 \SpecialChar ~
6893 \SpecialChar ~
6894 ...: ...\SpecialChar ~
6894 ...: ...\SpecialChar ~
6895 \SpecialChar ~
6895 \SpecialChar ~
6896 \SpecialChar ~
6896 \SpecialChar ~
6897 \SpecialChar ~
6897 \SpecialChar ~
6898 a, b = 0, 1
6898 a, b = 0, 1
6899 \newline
6899 \newline
6900
6900
6901 \begin_inset ERT
6901 \begin_inset ERT
6902 status Collapsed
6902 status Collapsed
6903
6903
6904 \layout Standard
6904 \layout Standard
6905
6905
6906 \backslash
6906 \backslash
6907 hspace*{0mm}
6907 hspace*{0mm}
6908 \end_inset
6908 \end_inset
6909
6909
6910 \SpecialChar ~
6910 \SpecialChar ~
6911 \SpecialChar ~
6911 \SpecialChar ~
6912 ...: ...\SpecialChar ~
6912 ...: ...\SpecialChar ~
6913 \SpecialChar ~
6913 \SpecialChar ~
6914 \SpecialChar ~
6914 \SpecialChar ~
6915 \SpecialChar ~
6915 \SpecialChar ~
6916 while b < n:
6916 while b < n:
6917 \newline
6917 \newline
6918
6918
6919 \begin_inset ERT
6919 \begin_inset ERT
6920 status Collapsed
6920 status Collapsed
6921
6921
6922 \layout Standard
6922 \layout Standard
6923
6923
6924 \backslash
6924 \backslash
6925 hspace*{0mm}
6925 hspace*{0mm}
6926 \end_inset
6926 \end_inset
6927
6927
6928 \SpecialChar ~
6928 \SpecialChar ~
6929 \SpecialChar ~
6929 \SpecialChar ~
6930 ...: ...\SpecialChar ~
6930 ...: ...\SpecialChar ~
6931 \SpecialChar ~
6931 \SpecialChar ~
6932 \SpecialChar ~
6932 \SpecialChar ~
6933 \SpecialChar ~
6933 \SpecialChar ~
6934 \SpecialChar ~
6934 \SpecialChar ~
6935 \SpecialChar ~
6935 \SpecialChar ~
6936 \SpecialChar ~
6936 \SpecialChar ~
6937 \SpecialChar ~
6937 \SpecialChar ~
6938 result.append(b)\SpecialChar ~
6938 result.append(b)\SpecialChar ~
6939 \SpecialChar ~
6939 \SpecialChar ~
6940 \SpecialChar ~
6940 \SpecialChar ~
6941 # see below
6941 # see below
6942 \newline
6942 \newline
6943
6943
6944 \begin_inset ERT
6944 \begin_inset ERT
6945 status Collapsed
6945 status Collapsed
6946
6946
6947 \layout Standard
6947 \layout Standard
6948
6948
6949 \backslash
6949 \backslash
6950 hspace*{0mm}
6950 hspace*{0mm}
6951 \end_inset
6951 \end_inset
6952
6952
6953 \SpecialChar ~
6953 \SpecialChar ~
6954 \SpecialChar ~
6954 \SpecialChar ~
6955 ...: ...\SpecialChar ~
6955 ...: ...\SpecialChar ~
6956 \SpecialChar ~
6956 \SpecialChar ~
6957 \SpecialChar ~
6957 \SpecialChar ~
6958 \SpecialChar ~
6958 \SpecialChar ~
6959 \SpecialChar ~
6959 \SpecialChar ~
6960 \SpecialChar ~
6960 \SpecialChar ~
6961 \SpecialChar ~
6961 \SpecialChar ~
6962 \SpecialChar ~
6962 \SpecialChar ~
6963 a, b = b, a+b
6963 a, b = b, a+b
6964 \newline
6964 \newline
6965
6965
6966 \begin_inset ERT
6966 \begin_inset ERT
6967 status Collapsed
6967 status Collapsed
6968
6968
6969 \layout Standard
6969 \layout Standard
6970
6970
6971 \backslash
6971 \backslash
6972 hspace*{0mm}
6972 hspace*{0mm}
6973 \end_inset
6973 \end_inset
6974
6974
6975 \SpecialChar ~
6975 \SpecialChar ~
6976 \SpecialChar ~
6976 \SpecialChar ~
6977 ...: ...\SpecialChar ~
6977 ...: ...\SpecialChar ~
6978 \SpecialChar ~
6978 \SpecialChar ~
6979 \SpecialChar ~
6979 \SpecialChar ~
6980 \SpecialChar ~
6980 \SpecialChar ~
6981 return result
6981 return result
6982 \newline
6982 \newline
6983
6983
6984 \begin_inset ERT
6984 \begin_inset ERT
6985 status Collapsed
6985 status Collapsed
6986
6986
6987 \layout Standard
6987 \layout Standard
6988
6988
6989 \backslash
6989 \backslash
6990 hspace*{0mm}
6990 hspace*{0mm}
6991 \end_inset
6991 \end_inset
6992
6992
6993 \SpecialChar ~
6993 \SpecialChar ~
6994 \SpecialChar ~
6994 \SpecialChar ~
6995 ...:
6995 ...:
6996 \newline
6996 \newline
6997 \SpecialChar ~
6997 \SpecialChar ~
6998
6998
6999 \newline
6999 \newline
7000 In [2]: fib2(10)
7000 In [2]: fib2(10)
7001 \newline
7001 \newline
7002 Out[2]: [1, 1, 2, 3, 5, 8]
7002 Out[2]: [1, 1, 2, 3, 5, 8]
7003 \layout Standard
7003 \layout Standard
7004
7004
7005 Note that as currently written, this extension does
7005 Note that as currently written, this extension does
7006 \emph on
7006 \emph on
7007 not
7007 not
7008 \emph default
7008 \emph default
7009 recognize IPython's prompts for pasting.
7009 recognize IPython's prompts for pasting.
7010 Those are more complicated, since the user can change them very easily,
7010 Those are more complicated, since the user can change them very easily,
7011 they involve numbers and can vary in length.
7011 they involve numbers and can vary in length.
7012 One could however extract all the relevant information from the IPython
7012 One could however extract all the relevant information from the IPython
7013 instance and build an appropriate regular expression.
7013 instance and build an appropriate regular expression.
7014 This is left as an exercise for the reader.
7014 This is left as an exercise for the reader.
7015 \layout Subsection
7015 \layout Subsection
7016
7016
7017 Input of physical quantities with units
7017 Input of physical quantities with units
7018 \layout Standard
7018 \layout Standard
7019
7019
7020 The module
7020 The module
7021 \family typewriter
7021 \family typewriter
7022 PhysicalQInput
7022 PhysicalQInput
7023 \family default
7023 \family default
7024 allows a simplified form of input for physical quantities with units.
7024 allows a simplified form of input for physical quantities with units.
7025 This file is meant to be used in conjunction with the
7025 This file is meant to be used in conjunction with the
7026 \family typewriter
7026 \family typewriter
7027 PhysicalQInteractive
7027 PhysicalQInteractive
7028 \family default
7028 \family default
7029 module (in the same directory) and
7029 module (in the same directory) and
7030 \family typewriter
7030 \family typewriter
7031 Physics.PhysicalQuantities
7031 Physics.PhysicalQuantities
7032 \family default
7032 \family default
7033 from Konrad Hinsen's ScientificPython (
7033 from Konrad Hinsen's ScientificPython (
7034 \begin_inset LatexCommand \htmlurl{http://starship.python.net/crew/hinsen/scientific.html}
7034 \begin_inset LatexCommand \htmlurl{http://starship.python.net/crew/hinsen/scientific.html}
7035
7035
7036 \end_inset
7036 \end_inset
7037
7037
7038 ).
7038 ).
7039 \layout Standard
7039 \layout Standard
7040
7040
7041 The
7041 The
7042 \family typewriter
7042 \family typewriter
7043 Physics.PhysicalQuantities
7043 Physics.PhysicalQuantities
7044 \family default
7044 \family default
7045 module defines
7045 module defines
7046 \family typewriter
7046 \family typewriter
7047 PhysicalQuantity
7047 PhysicalQuantity
7048 \family default
7048 \family default
7049 objects, but these must be declared as instances of a class.
7049 objects, but these must be declared as instances of a class.
7050 For example, to define
7050 For example, to define
7051 \family typewriter
7051 \family typewriter
7052 v
7052 v
7053 \family default
7053 \family default
7054 as a velocity of 3\SpecialChar ~
7054 as a velocity of 3\SpecialChar ~
7055 m/s, normally you would write:
7055 m/s, normally you would write:
7056 \family typewriter
7056 \family typewriter
7057
7057
7058 \newline
7058 \newline
7059 In [1]: v = PhysicalQuantity(3,'m/s')
7059 In [1]: v = PhysicalQuantity(3,'m/s')
7060 \layout Standard
7060 \layout Standard
7061
7061
7062 Using the
7062 Using the
7063 \family typewriter
7063 \family typewriter
7064 PhysicalQ_Input
7064 PhysicalQ_Input
7065 \family default
7065 \family default
7066 extension this can be input instead as:
7066 extension this can be input instead as:
7067 \family typewriter
7067 \family typewriter
7068
7068
7069 \newline
7069 \newline
7070 In [1]: v = 3 m/s
7070 In [1]: v = 3 m/s
7071 \family default
7071 \family default
7072
7072
7073 \newline
7073 \newline
7074 which is much more convenient for interactive use (even though it is blatantly
7074 which is much more convenient for interactive use (even though it is blatantly
7075 invalid Python syntax).
7075 invalid Python syntax).
7076 \layout Standard
7076 \layout Standard
7077
7077
7078 The
7078 The
7079 \family typewriter
7079 \family typewriter
7080 physics
7080 physics
7081 \family default
7081 \family default
7082 profile supplied with IPython (enabled via
7082 profile supplied with IPython (enabled via
7083 \family typewriter
7083 \family typewriter
7084 'ipython -p physics'
7084 'ipython -p physics'
7085 \family default
7085 \family default
7086 ) uses these extensions, which you can also activate with:
7086 ) uses these extensions, which you can also activate with:
7087 \layout Standard
7087 \layout Standard
7088
7088
7089
7089
7090 \family typewriter
7090 \family typewriter
7091 from math import * # math MUST be imported BEFORE PhysicalQInteractive
7091 from math import * # math MUST be imported BEFORE PhysicalQInteractive
7092 \newline
7092 \newline
7093 from IPython.Extensions.PhysicalQInteractive import *
7093 from IPython.Extensions.PhysicalQInteractive import *
7094 \newline
7094 \newline
7095 import IPython.Extensions.PhysicalQInput
7095 import IPython.Extensions.PhysicalQInput
7096 \layout Section
7096 \layout Section
7097
7097
7098
7098
7099 \begin_inset LatexCommand \label{sec:IPython-as-shell}
7099 \begin_inset LatexCommand \label{sec:IPython-as-shell}
7100
7100
7101 \end_inset
7101 \end_inset
7102
7102
7103 IPython as a system shell
7103 IPython as a system shell
7104 \layout Standard
7104 \layout Standard
7105
7105
7106 IPython ships with a special profile called
7106 IPython ships with a special profile called
7107 \family typewriter
7107 \family typewriter
7108 pysh
7108 pysh
7109 \family default
7109 \family default
7110 , which you can activate at the command line as
7110 , which you can activate at the command line as
7111 \family typewriter
7111 \family typewriter
7112 `ipython -p pysh'
7112 `ipython -p pysh'
7113 \family default
7113 \family default
7114 .
7114 .
7115 This loads
7115 This loads
7116 \family typewriter
7116 \family typewriter
7117 InterpreterExec
7117 InterpreterExec
7118 \family default
7118 \family default
7119 , along with some additional facilities and a prompt customized for filesystem
7119 , along with some additional facilities and a prompt customized for filesystem
7120 navigation.
7120 navigation.
7121 \layout Standard
7121 \layout Standard
7122
7122
7123 Note that this does
7123 Note that this does
7124 \emph on
7124 \emph on
7125 not
7125 not
7126 \emph default
7126 \emph default
7127 make IPython a full-fledged system shell.
7127 make IPython a full-fledged system shell.
7128 In particular, it has no job control, so if you type Ctrl-Z (under Unix),
7128 In particular, it has no job control, so if you type Ctrl-Z (under Unix),
7129 you'll suspend pysh itself, not the process you just started.
7129 you'll suspend pysh itself, not the process you just started.
7130
7130
7131 \layout Standard
7131 \layout Standard
7132
7132
7133 What the shell profile allows you to do is to use the convenient and powerful
7133 What the shell profile allows you to do is to use the convenient and powerful
7134 syntax of Python to do quick scripting at the command line.
7134 syntax of Python to do quick scripting at the command line.
7135 Below we describe some of its features.
7135 Below we describe some of its features.
7136 \layout Subsection
7136 \layout Subsection
7137
7137
7138 Aliases
7138 Aliases
7139 \layout Standard
7139 \layout Standard
7140
7140
7141 All of your
7141 All of your
7142 \family typewriter
7142 \family typewriter
7143 $PATH
7143 $PATH
7144 \family default
7144 \family default
7145 has been loaded as IPython aliases, so you should be able to type any normal
7145 has been loaded as IPython aliases, so you should be able to type any normal
7146 system command and have it executed.
7146 system command and have it executed.
7147 See
7147 See
7148 \family typewriter
7148 \family typewriter
7149 %alias?
7149 %alias?
7150 \family default
7150 \family default
7151 and
7151 and
7152 \family typewriter
7152 \family typewriter
7153 %unalias?
7153 %unalias?
7154 \family default
7154 \family default
7155 for details on the alias facilities.
7155 for details on the alias facilities.
7156 See also
7156 See also
7157 \family typewriter
7157 \family typewriter
7158 %rehash?
7158 %rehash?
7159 \family default
7159 \family default
7160 and
7160 and
7161 \family typewriter
7161 \family typewriter
7162 %rehashx?
7162 %rehashx?
7163 \family default
7163 \family default
7164 for details on the mechanism used to load
7164 for details on the mechanism used to load
7165 \family typewriter
7165 \family typewriter
7166 $PATH
7166 $PATH
7167 \family default
7167 \family default
7168 .
7168 .
7169 \layout Subsection
7169 \layout Subsection
7170
7170
7171 Special syntax
7171 Special syntax
7172 \layout Standard
7172 \layout Standard
7173
7173
7174 Any lines which begin with
7174 Any lines which begin with
7175 \family typewriter
7175 \family typewriter
7176 `~'
7176 `~'
7177 \family default
7177 \family default
7178 ,
7178 ,
7179 \family typewriter
7179 \family typewriter
7180 `/'
7180 `/'
7181 \family default
7181 \family default
7182 and
7182 and
7183 \family typewriter
7183 \family typewriter
7184 `.'
7184 `.'
7185 \family default
7185 \family default
7186 will be executed as shell commands instead of as Python code.
7186 will be executed as shell commands instead of as Python code.
7187 The special escapes below are also recognized.
7187 The special escapes below are also recognized.
7188
7188
7189 \family typewriter
7189 \family typewriter
7190 !cmd
7190 !cmd
7191 \family default
7191 \family default
7192 is valid in single or multi-line input, all others are only valid in single-lin
7192 is valid in single or multi-line input, all others are only valid in single-lin
7193 e input:
7193 e input:
7194 \layout Description
7194 \layout Description
7195
7195
7196
7196
7197 \family typewriter
7197 \family typewriter
7198 !cmd
7198 !cmd
7199 \family default
7199 \family default
7200 pass `cmd' directly to the shell
7200 pass `cmd' directly to the shell
7201 \layout Description
7201 \layout Description
7202
7202
7203
7203
7204 \family typewriter
7204 \family typewriter
7205 !!cmd
7205 !!cmd
7206 \family default
7206 \family default
7207 execute `cmd' and return output as a list (split on `
7207 execute `cmd' and return output as a list (split on `
7208 \backslash
7208 \backslash
7209 n')
7209 n')
7210 \layout Description
7210 \layout Description
7211
7211
7212
7212
7213 \family typewriter
7213 \family typewriter
7214 $var=cmd
7214 $var=cmd
7215 \family default
7215 \family default
7216 capture output of cmd into var, as a string
7216 capture output of cmd into var, as a string
7217 \layout Description
7217 \layout Description
7218
7218
7219
7219
7220 \family typewriter
7220 \family typewriter
7221 $$var=cmd
7221 $$var=cmd
7222 \family default
7222 \family default
7223 capture output of cmd into var, as a list (split on `
7223 capture output of cmd into var, as a list (split on `
7224 \backslash
7224 \backslash
7225 n')
7225 n')
7226 \layout Standard
7226 \layout Standard
7227
7227
7228 The
7228 The
7229 \family typewriter
7229 \family typewriter
7230 $
7230 $
7231 \family default
7231 \family default
7232 /
7232 /
7233 \family typewriter
7233 \family typewriter
7234 $$
7234 $$
7235 \family default
7235 \family default
7236 syntaxes make Python variables from system output, which you can later
7236 syntaxes make Python variables from system output, which you can later
7237 use for further scripting.
7237 use for further scripting.
7238 The converse is also possible: when executing an alias or calling to the
7238 The converse is also possible: when executing an alias or calling to the
7239 system via
7239 system via
7240 \family typewriter
7240 \family typewriter
7241 !
7241 !
7242 \family default
7242 \family default
7243 /
7243 /
7244 \family typewriter
7244 \family typewriter
7245 !!
7245 !!
7246 \family default
7246 \family default
7247 , you can expand any python variable or expression by prepending it with
7247 , you can expand any python variable or expression by prepending it with
7248
7248
7249 \family typewriter
7249 \family typewriter
7250 $
7250 $
7251 \family default
7251 \family default
7252 .
7252 .
7253 Full details of the allowed syntax can be found in Python's PEP 215.
7253 Full details of the allowed syntax can be found in Python's PEP 215.
7254 \layout Standard
7254 \layout Standard
7255
7255
7256 A few brief examples will illustrate these (note that the indentation below
7256 A few brief examples will illustrate these (note that the indentation below
7257 may be incorrectly displayed):
7257 may be incorrectly displayed):
7258 \layout Standard
7258 \layout Standard
7259
7259
7260
7260
7261 \family typewriter
7261 \family typewriter
7262 fperez[~/test]|3> !ls *s.py
7262 fperez[~/test]|3> !ls *s.py
7263 \newline
7263 \newline
7264 scopes.py strings.py
7264 scopes.py strings.py
7265 \layout Standard
7265 \layout Standard
7266
7266
7267 ls is an internal alias, so there's no need to use
7267 ls is an internal alias, so there's no need to use
7268 \family typewriter
7268 \family typewriter
7269 !
7269 !
7270 \family default
7270 \family default
7271 :
7271 :
7272 \layout Standard
7272 \layout Standard
7273
7273
7274
7274
7275 \family typewriter
7275 \family typewriter
7276 fperez[~/test]|4> ls *s.py
7276 fperez[~/test]|4> ls *s.py
7277 \newline
7277 \newline
7278 scopes.py* strings.py
7278 scopes.py* strings.py
7279 \layout Standard
7279 \layout Standard
7280
7280
7281 !!ls will return the output into a Python variable:
7281 !!ls will return the output into a Python variable:
7282 \layout Standard
7282 \layout Standard
7283
7283
7284
7284
7285 \family typewriter
7285 \family typewriter
7286 fperez[~/test]|5> !!ls *s.py
7286 fperez[~/test]|5> !!ls *s.py
7287 \newline
7287 \newline
7288
7288
7289 \begin_inset ERT
7289 \begin_inset ERT
7290 status Collapsed
7290 status Collapsed
7291
7291
7292 \layout Standard
7292 \layout Standard
7293
7293
7294 \backslash
7294 \backslash
7295 hspace*{0mm}
7295 hspace*{0mm}
7296 \end_inset
7296 \end_inset
7297
7297
7298 \SpecialChar ~
7298 \SpecialChar ~
7299 \SpecialChar ~
7299 \SpecialChar ~
7300 \SpecialChar ~
7300 \SpecialChar ~
7301 \SpecialChar ~
7301 \SpecialChar ~
7302 \SpecialChar ~
7302 \SpecialChar ~
7303 \SpecialChar ~
7303 \SpecialChar ~
7304 \SpecialChar ~
7304 \SpecialChar ~
7305 \SpecialChar ~
7305 \SpecialChar ~
7306 \SpecialChar ~
7306 \SpecialChar ~
7307 \SpecialChar ~
7307 \SpecialChar ~
7308 \SpecialChar ~
7308 \SpecialChar ~
7309 \SpecialChar ~
7309 \SpecialChar ~
7310 \SpecialChar ~
7310 \SpecialChar ~
7311 \SpecialChar ~
7311 \SpecialChar ~
7312 <5> ['scopes.py', 'strings.py']
7312 <5> ['scopes.py', 'strings.py']
7313 \newline
7313 \newline
7314 fperez[~/test]|6> print _5
7314 fperez[~/test]|6> print _5
7315 \newline
7315 \newline
7316 ['scopes.py', 'strings.py']
7316 ['scopes.py', 'strings.py']
7317 \layout Standard
7317 \layout Standard
7318
7318
7319
7319
7320 \family typewriter
7320 \family typewriter
7321 $
7321 $
7322 \family default
7322 \family default
7323 and
7323 and
7324 \family typewriter
7324 \family typewriter
7325 $$
7325 $$
7326 \family default
7326 \family default
7327 allow direct capture to named variables:
7327 allow direct capture to named variables:
7328 \layout Standard
7328 \layout Standard
7329
7329
7330
7330
7331 \family typewriter
7331 \family typewriter
7332 fperez[~/test]|7> $astr = ls *s.py
7332 fperez[~/test]|7> $astr = ls *s.py
7333 \newline
7333 \newline
7334 fperez[~/test]|8> astr
7334 fperez[~/test]|8> astr
7335 \newline
7335 \newline
7336
7336
7337 \begin_inset ERT
7337 \begin_inset ERT
7338 status Collapsed
7338 status Collapsed
7339
7339
7340 \layout Standard
7340 \layout Standard
7341
7341
7342 \backslash
7342 \backslash
7343 hspace*{0mm}
7343 hspace*{0mm}
7344 \end_inset
7344 \end_inset
7345
7345
7346 \SpecialChar ~
7346 \SpecialChar ~
7347 \SpecialChar ~
7347 \SpecialChar ~
7348 \SpecialChar ~
7348 \SpecialChar ~
7349 \SpecialChar ~
7349 \SpecialChar ~
7350 \SpecialChar ~
7350 \SpecialChar ~
7351 \SpecialChar ~
7351 \SpecialChar ~
7352 \SpecialChar ~
7352 \SpecialChar ~
7353 \SpecialChar ~
7353 \SpecialChar ~
7354 \SpecialChar ~
7354 \SpecialChar ~
7355 \SpecialChar ~
7355 \SpecialChar ~
7356 \SpecialChar ~
7356 \SpecialChar ~
7357 \SpecialChar ~
7357 \SpecialChar ~
7358 \SpecialChar ~
7358 \SpecialChar ~
7359 \SpecialChar ~
7359 \SpecialChar ~
7360 <8> 'scopes.py
7360 <8> 'scopes.py
7361 \backslash
7361 \backslash
7362 nstrings.py'
7362 nstrings.py'
7363 \layout Standard
7363 \layout Standard
7364
7364
7365
7365
7366 \family typewriter
7366 \family typewriter
7367 fperez[~/test]|9> $$alist = ls *s.py
7367 fperez[~/test]|9> $$alist = ls *s.py
7368 \newline
7368 \newline
7369 fperez[~/test]|10> alist
7369 fperez[~/test]|10> alist
7370 \newline
7370 \newline
7371
7371
7372 \begin_inset ERT
7372 \begin_inset ERT
7373 status Collapsed
7373 status Collapsed
7374
7374
7375 \layout Standard
7375 \layout Standard
7376
7376
7377 \backslash
7377 \backslash
7378 hspace*{0mm}
7378 hspace*{0mm}
7379 \end_inset
7379 \end_inset
7380
7380
7381 \SpecialChar ~
7381 \SpecialChar ~
7382 \SpecialChar ~
7382 \SpecialChar ~
7383 \SpecialChar ~
7383 \SpecialChar ~
7384 \SpecialChar ~
7384 \SpecialChar ~
7385 \SpecialChar ~
7385 \SpecialChar ~
7386 \SpecialChar ~
7386 \SpecialChar ~
7387 \SpecialChar ~
7387 \SpecialChar ~
7388 \SpecialChar ~
7388 \SpecialChar ~
7389 \SpecialChar ~
7389 \SpecialChar ~
7390 \SpecialChar ~
7390 \SpecialChar ~
7391 \SpecialChar ~
7391 \SpecialChar ~
7392 \SpecialChar ~
7392 \SpecialChar ~
7393 \SpecialChar ~
7393 \SpecialChar ~
7394 \SpecialChar ~
7394 \SpecialChar ~
7395 <10> ['scopes.py', 'strings.py']
7395 <10> ['scopes.py', 'strings.py']
7396 \layout Standard
7396 \layout Standard
7397
7397
7398 alist is now a normal python list you can loop over.
7398 alist is now a normal python list you can loop over.
7399 Using
7399 Using
7400 \family typewriter
7400 \family typewriter
7401 $
7401 $
7402 \family default
7402 \family default
7403 will expand back the python values when alias calls are made:
7403 will expand back the python values when alias calls are made:
7404 \layout Standard
7404 \layout Standard
7405
7405
7406
7406
7407 \family typewriter
7407 \family typewriter
7408 fperez[~/test]|11> for f in alist:
7408 fperez[~/test]|11> for f in alist:
7409 \newline
7409 \newline
7410
7410
7411 \begin_inset ERT
7411 \begin_inset ERT
7412 status Collapsed
7412 status Collapsed
7413
7413
7414 \layout Standard
7414 \layout Standard
7415
7415
7416 \backslash
7416 \backslash
7417 hspace*{0mm}
7417 hspace*{0mm}
7418 \end_inset
7418 \end_inset
7419
7419
7420 \SpecialChar ~
7420 \SpecialChar ~
7421 \SpecialChar ~
7421 \SpecialChar ~
7422 \SpecialChar ~
7422 \SpecialChar ~
7423 \SpecialChar ~
7423 \SpecialChar ~
7424 \SpecialChar ~
7424 \SpecialChar ~
7425 \SpecialChar ~
7425 \SpecialChar ~
7426 \SpecialChar ~
7426 \SpecialChar ~
7427 \SpecialChar ~
7427 \SpecialChar ~
7428 \SpecialChar ~
7428 \SpecialChar ~
7429 \SpecialChar ~
7429 \SpecialChar ~
7430 \SpecialChar ~
7430 \SpecialChar ~
7431 \SpecialChar ~
7431 \SpecialChar ~
7432 \SpecialChar ~
7432 \SpecialChar ~
7433 \SpecialChar ~
7433 \SpecialChar ~
7434 |..> \SpecialChar ~
7434 |..> \SpecialChar ~
7435 \SpecialChar ~
7435 \SpecialChar ~
7436 \SpecialChar ~
7436 \SpecialChar ~
7437 \SpecialChar ~
7437 \SpecialChar ~
7438 print 'file',f,
7438 print 'file',f,
7439 \newline
7439 \newline
7440
7440
7441 \begin_inset ERT
7441 \begin_inset ERT
7442 status Collapsed
7442 status Collapsed
7443
7443
7444 \layout Standard
7444 \layout Standard
7445
7445
7446 \backslash
7446 \backslash
7447 hspace*{0mm}
7447 hspace*{0mm}
7448 \end_inset
7448 \end_inset
7449
7449
7450 \SpecialChar ~
7450 \SpecialChar ~
7451 \SpecialChar ~
7451 \SpecialChar ~
7452 \SpecialChar ~
7452 \SpecialChar ~
7453 \SpecialChar ~
7453 \SpecialChar ~
7454 \SpecialChar ~
7454 \SpecialChar ~
7455 \SpecialChar ~
7455 \SpecialChar ~
7456 \SpecialChar ~
7456 \SpecialChar ~
7457 \SpecialChar ~
7457 \SpecialChar ~
7458 \SpecialChar ~
7458 \SpecialChar ~
7459 \SpecialChar ~
7459 \SpecialChar ~
7460 \SpecialChar ~
7460 \SpecialChar ~
7461 \SpecialChar ~
7461 \SpecialChar ~
7462 \SpecialChar ~
7462 \SpecialChar ~
7463 \SpecialChar ~
7463 \SpecialChar ~
7464 |..> \SpecialChar ~
7464 |..> \SpecialChar ~
7465 \SpecialChar ~
7465 \SpecialChar ~
7466 \SpecialChar ~
7466 \SpecialChar ~
7467 \SpecialChar ~
7467 \SpecialChar ~
7468 wc -l $f
7468 wc -l $f
7469 \newline
7469 \newline
7470
7470
7471 \begin_inset ERT
7471 \begin_inset ERT
7472 status Collapsed
7472 status Collapsed
7473
7473
7474 \layout Standard
7474 \layout Standard
7475
7475
7476 \backslash
7476 \backslash
7477 hspace*{0mm}
7477 hspace*{0mm}
7478 \end_inset
7478 \end_inset
7479
7479
7480 \SpecialChar ~
7480 \SpecialChar ~
7481 \SpecialChar ~
7481 \SpecialChar ~
7482 \SpecialChar ~
7482 \SpecialChar ~
7483 \SpecialChar ~
7483 \SpecialChar ~
7484 \SpecialChar ~
7484 \SpecialChar ~
7485 \SpecialChar ~
7485 \SpecialChar ~
7486 \SpecialChar ~
7486 \SpecialChar ~
7487 \SpecialChar ~
7487 \SpecialChar ~
7488 \SpecialChar ~
7488 \SpecialChar ~
7489 \SpecialChar ~
7489 \SpecialChar ~
7490 \SpecialChar ~
7490 \SpecialChar ~
7491 \SpecialChar ~
7491 \SpecialChar ~
7492 \SpecialChar ~
7492 \SpecialChar ~
7493 \SpecialChar ~
7493 \SpecialChar ~
7494 |..>
7494 |..>
7495 \newline
7495 \newline
7496 file scopes.py 13 scopes.py
7496 file scopes.py 13 scopes.py
7497 \newline
7497 \newline
7498 file strings.py 4 strings.py
7498 file strings.py 4 strings.py
7499 \layout Standard
7499 \layout Standard
7500
7500
7501 Note that you may need to protect your variables with braces if you want
7501 Note that you may need to protect your variables with braces if you want
7502 to append strings to their names.
7502 to append strings to their names.
7503 To copy all files in alist to
7503 To copy all files in alist to
7504 \family typewriter
7504 \family typewriter
7505 .bak
7505 .bak
7506 \family default
7506 \family default
7507 extensions, you must use:
7507 extensions, you must use:
7508 \layout Standard
7508 \layout Standard
7509
7509
7510
7510
7511 \family typewriter
7511 \family typewriter
7512 fperez[~/test]|12> for f in alist:
7512 fperez[~/test]|12> for f in alist:
7513 \newline
7513 \newline
7514
7514
7515 \begin_inset ERT
7515 \begin_inset ERT
7516 status Collapsed
7516 status Collapsed
7517
7517
7518 \layout Standard
7518 \layout Standard
7519
7519
7520 \backslash
7520 \backslash
7521 hspace*{0mm}
7521 hspace*{0mm}
7522 \end_inset
7522 \end_inset
7523
7523
7524 \SpecialChar ~
7524 \SpecialChar ~
7525 \SpecialChar ~
7525 \SpecialChar ~
7526 \SpecialChar ~
7526 \SpecialChar ~
7527 \SpecialChar ~
7527 \SpecialChar ~
7528 \SpecialChar ~
7528 \SpecialChar ~
7529 \SpecialChar ~
7529 \SpecialChar ~
7530 \SpecialChar ~
7530 \SpecialChar ~
7531 \SpecialChar ~
7531 \SpecialChar ~
7532 \SpecialChar ~
7532 \SpecialChar ~
7533 \SpecialChar ~
7533 \SpecialChar ~
7534 \SpecialChar ~
7534 \SpecialChar ~
7535 \SpecialChar ~
7535 \SpecialChar ~
7536 \SpecialChar ~
7536 \SpecialChar ~
7537 \SpecialChar ~
7537 \SpecialChar ~
7538 |..> \SpecialChar ~
7538 |..> \SpecialChar ~
7539 \SpecialChar ~
7539 \SpecialChar ~
7540 \SpecialChar ~
7540 \SpecialChar ~
7541 \SpecialChar ~
7541 \SpecialChar ~
7542 cp $f ${f}.bak
7542 cp $f ${f}.bak
7543 \layout Standard
7543 \layout Standard
7544
7544
7545 If you try using
7545 If you try using
7546 \family typewriter
7546 \family typewriter
7547 $f.bak
7547 $f.bak
7548 \family default
7548 \family default
7549 , you'll get an AttributeError exception saying that your string object
7549 , you'll get an AttributeError exception saying that your string object
7550 doesn't have a
7550 doesn't have a
7551 \family typewriter
7551 \family typewriter
7552 .bak
7552 .bak
7553 \family default
7553 \family default
7554 attribute.
7554 attribute.
7555 This is because the
7555 This is because the
7556 \family typewriter
7556 \family typewriter
7557 $
7557 $
7558 \family default
7558 \family default
7559 expansion mechanism allows you to expand full Python expressions:
7559 expansion mechanism allows you to expand full Python expressions:
7560 \layout Standard
7560 \layout Standard
7561
7561
7562
7562
7563 \family typewriter
7563 \family typewriter
7564 fperez[~/test]|13> echo "sys.platform is: $sys.platform"
7564 fperez[~/test]|13> echo "sys.platform is: $sys.platform"
7565 \newline
7565 \newline
7566 sys.platform is: linux2
7566 sys.platform is: linux2
7567 \layout Standard
7567 \layout Standard
7568
7568
7569 IPython's input history handling is still active, which allows you to rerun
7569 IPython's input history handling is still active, which allows you to rerun
7570 a single block of multi-line input by simply using exec:
7570 a single block of multi-line input by simply using exec:
7571 \newline
7571 \newline
7572
7572
7573 \family typewriter
7573 \family typewriter
7574 fperez[~/test]|14> $$alist = ls *.eps
7574 fperez[~/test]|14> $$alist = ls *.eps
7575 \newline
7575 \newline
7576 fperez[~/test]|15> exec _i11
7576 fperez[~/test]|15> exec _i11
7577 \newline
7577 \newline
7578 file image2.eps 921 image2.eps
7578 file image2.eps 921 image2.eps
7579 \newline
7579 \newline
7580 file image.eps 921 image.eps
7580 file image.eps 921 image.eps
7581 \layout Standard
7581 \layout Standard
7582
7582
7583 While these are new special-case syntaxes, they are designed to allow very
7583 While these are new special-case syntaxes, they are designed to allow very
7584 efficient use of the shell with minimal typing.
7584 efficient use of the shell with minimal typing.
7585 At an interactive shell prompt, conciseness of expression wins over readability.
7585 At an interactive shell prompt, conciseness of expression wins over readability.
7586 \layout Subsection
7586 \layout Subsection
7587
7587
7588 Useful functions and modules
7588 Useful functions and modules
7589 \layout Standard
7589 \layout Standard
7590
7590
7591 The os, sys and shutil modules from the Python standard library are automaticall
7591 The os, sys and shutil modules from the Python standard library are automaticall
7592 y loaded.
7592 y loaded.
7593 Some additional functions, useful for shell usage, are listed below.
7593 Some additional functions, useful for shell usage, are listed below.
7594 You can request more help about them with `
7594 You can request more help about them with `
7595 \family typewriter
7595 \family typewriter
7596 ?
7596 ?
7597 \family default
7597 \family default
7598 '.
7598 '.
7599 \layout Description
7599 \layout Description
7600
7600
7601
7601
7602 \family typewriter
7602 \family typewriter
7603 shell
7603 shell
7604 \family default
7604 \family default
7605 - execute a command in the underlying system shell
7605 - execute a command in the underlying system shell
7606 \layout Description
7606 \layout Description
7607
7607
7608
7608
7609 \family typewriter
7609 \family typewriter
7610 system
7610 system
7611 \family default
7611 \family default
7612 - like
7612 - like
7613 \family typewriter
7613 \family typewriter
7614 shell()
7614 shell()
7615 \family default
7615 \family default
7616 , but return the exit status of the command
7616 , but return the exit status of the command
7617 \layout Description
7617 \layout Description
7618
7618
7619
7619
7620 \family typewriter
7620 \family typewriter
7621 sout
7621 sout
7622 \family default
7622 \family default
7623 - capture the output of a command as a string
7623 - capture the output of a command as a string
7624 \layout Description
7624 \layout Description
7625
7625
7626
7626
7627 \family typewriter
7627 \family typewriter
7628 lout
7628 lout
7629 \family default
7629 \family default
7630 - capture the output of a command as a list (split on `
7630 - capture the output of a command as a list (split on `
7631 \backslash
7631 \backslash
7632 n')
7632 n')
7633 \layout Description
7633 \layout Description
7634
7634
7635
7635
7636 \family typewriter
7636 \family typewriter
7637 getoutputerror
7637 getoutputerror
7638 \family default
7638 \family default
7639 - capture (output,error) of a shell commandss
7639 - capture (output,error) of a shell commandss
7640 \layout Standard
7640 \layout Standard
7641
7641
7642
7642
7643 \family typewriter
7643 \family typewriter
7644 sout
7644 sout
7645 \family default
7645 \family default
7646 /
7646 /
7647 \family typewriter
7647 \family typewriter
7648 lout
7648 lout
7649 \family default
7649 \family default
7650 are the functional equivalents of
7650 are the functional equivalents of
7651 \family typewriter
7651 \family typewriter
7652 $
7652 $
7653 \family default
7653 \family default
7654 /
7654 /
7655 \family typewriter
7655 \family typewriter
7656 $$
7656 $$
7657 \family default
7657 \family default
7658 .
7658 .
7659 They are provided to allow you to capture system output in the middle of
7659 They are provided to allow you to capture system output in the middle of
7660 true python code, function definitions, etc (where
7660 true python code, function definitions, etc (where
7661 \family typewriter
7661 \family typewriter
7662 $
7662 $
7663 \family default
7663 \family default
7664 and
7664 and
7665 \family typewriter
7665 \family typewriter
7666 $$
7666 $$
7667 \family default
7667 \family default
7668 are invalid).
7668 are invalid).
7669 \layout Subsection
7669 \layout Subsection
7670
7670
7671 Directory management
7671 Directory management
7672 \layout Standard
7672 \layout Standard
7673
7673
7674 Since each command passed by pysh to the underlying system is executed in
7674 Since each command passed by pysh to the underlying system is executed in
7675 a subshell which exits immediately, you can NOT use !cd to navigate the
7675 a subshell which exits immediately, you can NOT use !cd to navigate the
7676 filesystem.
7676 filesystem.
7677 \layout Standard
7677 \layout Standard
7678
7678
7679 Pysh provides its own builtin
7679 Pysh provides its own builtin
7680 \family typewriter
7680 \family typewriter
7681 `%cd
7681 `%cd
7682 \family default
7682 \family default
7683 ' magic command to move in the filesystem (the
7683 ' magic command to move in the filesystem (the
7684 \family typewriter
7684 \family typewriter
7685 %
7685 %
7686 \family default
7686 \family default
7687 is not required with automagic on).
7687 is not required with automagic on).
7688 It also maintains a list of visited directories (use
7688 It also maintains a list of visited directories (use
7689 \family typewriter
7689 \family typewriter
7690 %dhist
7690 %dhist
7691 \family default
7691 \family default
7692 to see it) and allows direct switching to any of them.
7692 to see it) and allows direct switching to any of them.
7693 Type
7693 Type
7694 \family typewriter
7694 \family typewriter
7695 `cd?
7695 `cd?
7696 \family default
7696 \family default
7697 ' for more details.
7697 ' for more details.
7698 \layout Standard
7698 \layout Standard
7699
7699
7700
7700
7701 \family typewriter
7701 \family typewriter
7702 %pushd
7702 %pushd
7703 \family default
7703 \family default
7704 ,
7704 ,
7705 \family typewriter
7705 \family typewriter
7706 %popd
7706 %popd
7707 \family default
7707 \family default
7708 and
7708 and
7709 \family typewriter
7709 \family typewriter
7710 %dirs
7710 %dirs
7711 \family default
7711 \family default
7712 are provided for directory stack handling.
7712 are provided for directory stack handling.
7713 \layout Subsection
7713 \layout Subsection
7714
7714
7715 Prompt customization
7715 Prompt customization
7716 \layout Standard
7716 \layout Standard
7717
7717
7718 The supplied
7718 The supplied
7719 \family typewriter
7719 \family typewriter
7720 ipythonrc-pysh
7720 ipythonrc-pysh
7721 \family default
7721 \family default
7722 profile comes with an example of a very colored and detailed prompt, mainly
7722 profile comes with an example of a very colored and detailed prompt, mainly
7723 to serve as an illustration.
7723 to serve as an illustration.
7724 The valid escape sequences, besides color names, are:
7724 The valid escape sequences, besides color names, are:
7725 \layout Description
7725 \layout Description
7726
7726
7727
7727
7728 \backslash
7728 \backslash
7729 # - Prompt number.
7729 # - Prompt number.
7730 \layout Description
7730 \layout Description
7731
7731
7732
7732
7733 \backslash
7733 \backslash
7734 D - Dots, as many as there are digits in
7734 D - Dots, as many as there are digits in
7735 \backslash
7735 \backslash
7736 # (so they align).
7736 # (so they align).
7737 \layout Description
7737 \layout Description
7738
7738
7739
7739
7740 \backslash
7740 \backslash
7741 w - Current working directory (cwd).
7741 w - Current working directory (cwd).
7742 \layout Description
7742 \layout Description
7743
7743
7744
7744
7745 \backslash
7745 \backslash
7746 W - Basename of current working directory.
7746 W - Basename of current working directory.
7747 \layout Description
7747 \layout Description
7748
7748
7749
7749
7750 \backslash
7750 \backslash
7751 X
7751 X
7752 \emph on
7752 \emph on
7753 N
7753 N
7754 \emph default
7754 \emph default
7755 - Where
7755 - Where
7756 \emph on
7756 \emph on
7757 N
7757 N
7758 \emph default
7758 \emph default
7759 =0..5.
7759 =0..5.
7760 N terms of the cwd, with $HOME written as ~.
7760 N terms of the cwd, with $HOME written as ~.
7761 \layout Description
7761 \layout Description
7762
7762
7763
7763
7764 \backslash
7764 \backslash
7765 Y
7765 Y
7766 \emph on
7766 \emph on
7767 N
7767 N
7768 \emph default
7768 \emph default
7769 - Where
7769 - Where
7770 \emph on
7770 \emph on
7771 N
7771 N
7772 \emph default
7772 \emph default
7773 =0..5.
7773 =0..5.
7774 Like X
7774 Like X
7775 \emph on
7775 \emph on
7776 N
7776 N
7777 \emph default
7777 \emph default
7778 , but if ~ is term
7778 , but if ~ is term
7779 \emph on
7779 \emph on
7780 N
7780 N
7781 \emph default
7781 \emph default
7782 +1 it's also shown.
7782 +1 it's also shown.
7783 \layout Description
7783 \layout Description
7784
7784
7785
7785
7786 \backslash
7786 \backslash
7787 u - Username.
7787 u - Username.
7788 \layout Description
7788 \layout Description
7789
7789
7790
7790
7791 \backslash
7791 \backslash
7792 H - Full hostname.
7792 H - Full hostname.
7793 \layout Description
7793 \layout Description
7794
7794
7795
7795
7796 \backslash
7796 \backslash
7797 h - Hostname up to first '.'
7797 h - Hostname up to first '.'
7798 \layout Description
7798 \layout Description
7799
7799
7800
7800
7801 \backslash
7801 \backslash
7802 $ - Root symbol ($ or #).
7802 $ - Root symbol ($ or #).
7803
7803
7804 \layout Description
7804 \layout Description
7805
7805
7806
7806
7807 \backslash
7807 \backslash
7808 t - Current time, in H:M:S format.
7808 t - Current time, in H:M:S format.
7809 \layout Description
7809 \layout Description
7810
7810
7811
7811
7812 \backslash
7812 \backslash
7813 v - IPython release version.
7813 v - IPython release version.
7814
7814
7815 \layout Description
7815 \layout Description
7816
7816
7817
7817
7818 \backslash
7818 \backslash
7819 n - Newline.
7819 n - Newline.
7820
7820
7821 \layout Description
7821 \layout Description
7822
7822
7823
7823
7824 \backslash
7824 \backslash
7825 r - Carriage return.
7825 r - Carriage return.
7826
7826
7827 \layout Description
7827 \layout Description
7828
7828
7829
7829
7830 \backslash
7830 \backslash
7831
7831
7832 \backslash
7832 \backslash
7833 - An explicitly escaped '
7833 - An explicitly escaped '
7834 \backslash
7834 \backslash
7835 '.
7835 '.
7836 \layout Standard
7836 \layout Standard
7837
7837
7838 You can configure your prompt colors using any ANSI color escape.
7838 You can configure your prompt colors using any ANSI color escape.
7839 Each color escape sets the color for any subsequent text, until another
7839 Each color escape sets the color for any subsequent text, until another
7840 escape comes in and changes things.
7840 escape comes in and changes things.
7841 The valid color escapes are:
7841 The valid color escapes are:
7842 \layout Description
7842 \layout Description
7843
7843
7844
7844
7845 \backslash
7845 \backslash
7846 C_Black
7846 C_Black
7847 \layout Description
7847 \layout Description
7848
7848
7849
7849
7850 \backslash
7850 \backslash
7851 C_Blue
7851 C_Blue
7852 \layout Description
7852 \layout Description
7853
7853
7854
7854
7855 \backslash
7855 \backslash
7856 C_Brown
7856 C_Brown
7857 \layout Description
7857 \layout Description
7858
7858
7859
7859
7860 \backslash
7860 \backslash
7861 C_Cyan
7861 C_Cyan
7862 \layout Description
7862 \layout Description
7863
7863
7864
7864
7865 \backslash
7865 \backslash
7866 C_DarkGray
7866 C_DarkGray
7867 \layout Description
7867 \layout Description
7868
7868
7869
7869
7870 \backslash
7870 \backslash
7871 C_Green
7871 C_Green
7872 \layout Description
7872 \layout Description
7873
7873
7874
7874
7875 \backslash
7875 \backslash
7876 C_LightBlue
7876 C_LightBlue
7877 \layout Description
7877 \layout Description
7878
7878
7879
7879
7880 \backslash
7880 \backslash
7881 C_LightCyan
7881 C_LightCyan
7882 \layout Description
7882 \layout Description
7883
7883
7884
7884
7885 \backslash
7885 \backslash
7886 C_LightGray
7886 C_LightGray
7887 \layout Description
7887 \layout Description
7888
7888
7889
7889
7890 \backslash
7890 \backslash
7891 C_LightGreen
7891 C_LightGreen
7892 \layout Description
7892 \layout Description
7893
7893
7894
7894
7895 \backslash
7895 \backslash
7896 C_LightPurple
7896 C_LightPurple
7897 \layout Description
7897 \layout Description
7898
7898
7899
7899
7900 \backslash
7900 \backslash
7901 C_LightRed
7901 C_LightRed
7902 \layout Description
7902 \layout Description
7903
7903
7904
7904
7905 \backslash
7905 \backslash
7906 C_Purple
7906 C_Purple
7907 \layout Description
7907 \layout Description
7908
7908
7909
7909
7910 \backslash
7910 \backslash
7911 C_Red
7911 C_Red
7912 \layout Description
7912 \layout Description
7913
7913
7914
7914
7915 \backslash
7915 \backslash
7916 C_White
7916 C_White
7917 \layout Description
7917 \layout Description
7918
7918
7919
7919
7920 \backslash
7920 \backslash
7921 C_Yellow
7921 C_Yellow
7922 \layout Description
7922 \layout Description
7923
7923
7924
7924
7925 \backslash
7925 \backslash
7926 C_Normal Stop coloring, defaults to your terminal settings.
7926 C_Normal Stop coloring, defaults to your terminal settings.
7927 \layout Section
7927 \layout Section
7928
7928
7929
7929
7930 \begin_inset LatexCommand \label{sec:Threading-support}
7930 \begin_inset LatexCommand \label{sec:Threading-support}
7931
7931
7932 \end_inset
7932 \end_inset
7933
7933
7934 Threading support
7934 Threading support
7935 \layout Standard
7935 \layout Standard
7936
7936
7937
7937
7938 \series bold
7938 \series bold
7939 WARNING:
7939 WARNING:
7940 \series default
7940 \series default
7941 The threading support is still somewhat experimental, and it has only seen
7941 The threading support is still somewhat experimental, and it has only seen
7942 reasonable testing under Linux.
7942 reasonable testing under Linux.
7943 Threaded code is particularly tricky to debug, and it tends to show extremely
7943 Threaded code is particularly tricky to debug, and it tends to show extremely
7944 platform-dependent behavior.
7944 platform-dependent behavior.
7945 Since I only have access to Linux machines, I will have to rely on user's
7945 Since I only have access to Linux machines, I will have to rely on user's
7946 experiences and assistance for this area of IPython to improve under other
7946 experiences and assistance for this area of IPython to improve under other
7947 platforms.
7947 platforms.
7948 \layout Standard
7948 \layout Standard
7949
7949
7950 IPython, via the
7950 IPython, via the
7951 \family typewriter
7951 \family typewriter
7952 -gthread
7952 -gthread
7953 \family default
7953 \family default
7954 ,
7954 ,
7955 \family typewriter
7955 \family typewriter
7956 -qthread
7956 -qthread
7957 \family default
7957 \family default
7958 and
7958 and
7959 \family typewriter
7959 \family typewriter
7960 -wthread
7960 -wthread
7961 \family default
7961 \family default
7962 options (described in Sec.\SpecialChar ~
7962 options (described in Sec.\SpecialChar ~
7963
7963
7964 \begin_inset LatexCommand \ref{sec:threading-opts}
7964 \begin_inset LatexCommand \ref{sec:threading-opts}
7965
7965
7966 \end_inset
7966 \end_inset
7967
7967
7968 ), can run in multithreaded mode to support pyGTK, Qt and WXPython applications
7968 ), can run in multithreaded mode to support pyGTK, Qt and WXPython applications
7969 respectively.
7969 respectively.
7970 These GUI toolkits need to control the python main loop of execution, so
7970 These GUI toolkits need to control the python main loop of execution, so
7971 under a normal Python interpreter, starting a pyGTK, Qt or WXPython application
7971 under a normal Python interpreter, starting a pyGTK, Qt or WXPython application
7972 will immediately freeze the shell.
7972 will immediately freeze the shell.
7973
7973
7974 \layout Standard
7974 \layout Standard
7975
7975
7976 IPython, with one of these options (you can only use one at a time), separates
7976 IPython, with one of these options (you can only use one at a time), separates
7977 the graphical loop and IPython's code execution run into different threads.
7977 the graphical loop and IPython's code execution run into different threads.
7978 This allows you to test interactively (with
7978 This allows you to test interactively (with
7979 \family typewriter
7979 \family typewriter
7980 %run
7980 %run
7981 \family default
7981 \family default
7982 , for example) your GUI code without blocking.
7982 , for example) your GUI code without blocking.
7983 \layout Standard
7983 \layout Standard
7984
7984
7985 A nice mini-tutorial on using IPython along with the Qt Designer application
7985 A nice mini-tutorial on using IPython along with the Qt Designer application
7986 is available at the SciPy wiki:
7986 is available at the SciPy wiki:
7987 \begin_inset LatexCommand \htmlurl{http://www.scipy.org/wikis/topical_software/QtWithIPythonAndDesigner}
7987 \begin_inset LatexCommand \htmlurl{http://www.scipy.org/wikis/topical_software/QtWithIPythonAndDesigner}
7988
7988
7989 \end_inset
7989 \end_inset
7990
7990
7991 .
7991 .
7992 \layout Subsection
7992 \layout Subsection
7993
7993
7994 Tk issues
7994 Tk issues
7995 \layout Standard
7995 \layout Standard
7996
7996
7997 As indicated in Sec.\SpecialChar ~
7997 As indicated in Sec.\SpecialChar ~
7998
7998
7999 \begin_inset LatexCommand \ref{sec:threading-opts}
7999 \begin_inset LatexCommand \ref{sec:threading-opts}
8000
8000
8001 \end_inset
8001 \end_inset
8002
8002
8003 , a special
8003 , a special
8004 \family typewriter
8004 \family typewriter
8005 -tk
8005 -tk
8006 \family default
8006 \family default
8007 option is provided to try and allow Tk graphical applications to coexist
8007 option is provided to try and allow Tk graphical applications to coexist
8008 interactively with WX, Qt or GTK ones.
8008 interactively with WX, Qt or GTK ones.
8009 Whether this works at all, however, is very platform and configuration
8009 Whether this works at all, however, is very platform and configuration
8010 dependent.
8010 dependent.
8011 Please experiment with simple test cases before committing to using this
8011 Please experiment with simple test cases before committing to using this
8012 combination of Tk and GTK/Qt/WX threading in a production environment.
8012 combination of Tk and GTK/Qt/WX threading in a production environment.
8013 \layout Subsection
8013 \layout Subsection
8014
8014
8015 Signals and Threads
8015 Signals and Threads
8016 \layout Standard
8016 \layout Standard
8017
8017
8018 When any of the thread systems (GTK, Qt or WX) are active, either directly
8018 When any of the thread systems (GTK, Qt or WX) are active, either directly
8019 or via
8019 or via
8020 \family typewriter
8020 \family typewriter
8021 -pylab
8021 -pylab
8022 \family default
8022 \family default
8023 with a threaded backend, it is impossible to interrupt long-running Python
8023 with a threaded backend, it is impossible to interrupt long-running Python
8024 code via
8024 code via
8025 \family typewriter
8025 \family typewriter
8026 Ctrl-C
8026 Ctrl-C
8027 \family default
8027 \family default
8028 .
8028 .
8029 IPython can not pass the KeyboardInterrupt exception (or the underlying
8029 IPython can not pass the KeyboardInterrupt exception (or the underlying
8030
8030
8031 \family typewriter
8031 \family typewriter
8032 SIGINT
8032 SIGINT
8033 \family default
8033 \family default
8034 ) across threads, so any long-running process started from IPython will
8034 ) across threads, so any long-running process started from IPython will
8035 run to completion, or will have to be killed via an external (OS-based)
8035 run to completion, or will have to be killed via an external (OS-based)
8036 mechanism.
8036 mechanism.
8037 \layout Standard
8037 \layout Standard
8038
8038
8039 To the best of my knowledge, this limitation is imposed by the Python interprete
8039 To the best of my knowledge, this limitation is imposed by the Python interprete
8040 r itself, and it comes from the difficulty of writing portable signal/threaded
8040 r itself, and it comes from the difficulty of writing portable signal/threaded
8041 code.
8041 code.
8042 If any user is an expert on this topic and can suggest a better solution,
8042 If any user is an expert on this topic and can suggest a better solution,
8043 I would love to hear about it.
8043 I would love to hear about it.
8044 In the IPython sources, look at the
8044 In the IPython sources, look at the
8045 \family typewriter
8045 \family typewriter
8046 Shell.py
8046 Shell.py
8047 \family default
8047 \family default
8048 module, and in particular at the
8048 module, and in particular at the
8049 \family typewriter
8049 \family typewriter
8050 runcode()
8050 runcode()
8051 \family default
8051 \family default
8052 method.
8052 method.
8053
8053
8054 \layout Subsection
8054 \layout Subsection
8055
8055
8056 I/O pitfalls
8056 I/O pitfalls
8057 \layout Standard
8057 \layout Standard
8058
8058
8059 Be mindful that the Python interpreter switches between threads every
8059 Be mindful that the Python interpreter switches between threads every
8060 \begin_inset Formula $N$
8060 \begin_inset Formula $N$
8061 \end_inset
8061 \end_inset
8062
8062
8063 bytecodes, where the default value as of Python\SpecialChar ~
8063 bytecodes, where the default value as of Python\SpecialChar ~
8064 2.3 is
8064 2.3 is
8065 \begin_inset Formula $N=100.$
8065 \begin_inset Formula $N=100.$
8066 \end_inset
8066 \end_inset
8067
8067
8068 This value can be read by using the
8068 This value can be read by using the
8069 \family typewriter
8069 \family typewriter
8070 sys.getcheckinterval()
8070 sys.getcheckinterval()
8071 \family default
8071 \family default
8072 function, and it can be reset via
8072 function, and it can be reset via
8073 \family typewriter
8073 \family typewriter
8074 sys.setcheckinterval(
8074 sys.setcheckinterval(
8075 \emph on
8075 \emph on
8076 N
8076 N
8077 \emph default
8077 \emph default
8078 )
8078 )
8079 \family default
8079 \family default
8080 .
8080 .
8081 This switching of threads can cause subtly confusing effects if one of
8081 This switching of threads can cause subtly confusing effects if one of
8082 your threads is doing file I/O.
8082 your threads is doing file I/O.
8083 In text mode, most systems only flush file buffers when they encounter
8083 In text mode, most systems only flush file buffers when they encounter
8084 a
8084 a
8085 \family typewriter
8085 \family typewriter
8086 `
8086 `
8087 \backslash
8087 \backslash
8088 n'
8088 n'
8089 \family default
8089 \family default
8090 .
8090 .
8091 An instruction as simple as
8091 An instruction as simple as
8092 \family typewriter
8092 \family typewriter
8093
8093
8094 \newline
8094 \newline
8095 \SpecialChar ~
8095 \SpecialChar ~
8096 \SpecialChar ~
8096 \SpecialChar ~
8097 print >> filehandle,
8097 print >> filehandle,
8098 \begin_inset Quotes eld
8098 \begin_inset Quotes eld
8099 \end_inset
8099 \end_inset
8100
8100
8101 hello world
8101 hello world
8102 \begin_inset Quotes erd
8102 \begin_inset Quotes erd
8103 \end_inset
8103 \end_inset
8104
8104
8105
8105
8106 \family default
8106 \family default
8107
8107
8108 \newline
8108 \newline
8109 actually consists of several bytecodes, so it is possible that the newline
8109 actually consists of several bytecodes, so it is possible that the newline
8110 does not reach your file before the next thread switch.
8110 does not reach your file before the next thread switch.
8111 Similarly, if you are writing to a file in binary mode, the file won't
8111 Similarly, if you are writing to a file in binary mode, the file won't
8112 be flushed until the buffer fills, and your other thread may see apparently
8112 be flushed until the buffer fills, and your other thread may see apparently
8113 truncated files.
8113 truncated files.
8114
8114
8115 \layout Standard
8115 \layout Standard
8116
8116
8117 For this reason, if you are using IPython's thread support and have (for
8117 For this reason, if you are using IPython's thread support and have (for
8118 example) a GUI application which will read data generated by files written
8118 example) a GUI application which will read data generated by files written
8119 to from the IPython thread, the safest approach is to open all of your
8119 to from the IPython thread, the safest approach is to open all of your
8120 files in unbuffered mode (the third argument to the
8120 files in unbuffered mode (the third argument to the
8121 \family typewriter
8121 \family typewriter
8122 file/open
8122 file/open
8123 \family default
8123 \family default
8124 function is the buffering value):
8124 function is the buffering value):
8125 \newline
8125 \newline
8126
8126
8127 \family typewriter
8127 \family typewriter
8128 \SpecialChar ~
8128 \SpecialChar ~
8129 \SpecialChar ~
8129 \SpecialChar ~
8130 filehandle = open(filename,mode,0)
8130 filehandle = open(filename,mode,0)
8131 \layout Standard
8131 \layout Standard
8132
8132
8133 This is obviously a brute force way of avoiding race conditions with the
8133 This is obviously a brute force way of avoiding race conditions with the
8134 file buffering.
8134 file buffering.
8135 If you want to do it cleanly, and you have a resource which is being shared
8135 If you want to do it cleanly, and you have a resource which is being shared
8136 by the interactive IPython loop and your GUI thread, you should really
8136 by the interactive IPython loop and your GUI thread, you should really
8137 handle it with thread locking and syncrhonization properties.
8137 handle it with thread locking and syncrhonization properties.
8138 The Python documentation discusses these.
8138 The Python documentation discusses these.
8139 \layout Section
8139 \layout Section
8140
8140
8141
8141
8142 \begin_inset LatexCommand \label{sec:interactive-demos}
8142 \begin_inset LatexCommand \label{sec:interactive-demos}
8143
8143
8144 \end_inset
8144 \end_inset
8145
8145
8146 Interactive demos with IPython
8146 Interactive demos with IPython
8147 \layout Standard
8147 \layout Standard
8148
8148
8149 IPython ships with a basic system for running scripts interactively in sections,
8149 IPython ships with a basic system for running scripts interactively in sections,
8150 useful when presenting code to audiences.
8150 useful when presenting code to audiences.
8151 A few tags embedded in comments (so that the script remains valid Python
8151 A few tags embedded in comments (so that the script remains valid Python
8152 code) divide a file into separate blocks, and the demo can be run one block
8152 code) divide a file into separate blocks, and the demo can be run one block
8153 at a time, with IPython printing (with syntax highlighting) the block before
8153 at a time, with IPython printing (with syntax highlighting) the block before
8154 executing it, and returning to the interactive prompt after each block.
8154 executing it, and returning to the interactive prompt after each block.
8155 The interactive namespace is updated after each block is run with the contents
8155 The interactive namespace is updated after each block is run with the contents
8156 of the demo's namespace.
8156 of the demo's namespace.
8157 \layout Standard
8157 \layout Standard
8158
8158
8159 This allows you to show a piece of code, run it and then execute interactively
8159 This allows you to show a piece of code, run it and then execute interactively
8160 commands based on the variables just created.
8160 commands based on the variables just created.
8161 Once you want to continue, you simply execute the next block of the demo.
8161 Once you want to continue, you simply execute the next block of the demo.
8162 The following listing shows the markup necessary for dividing a script
8162 The following listing shows the markup necessary for dividing a script
8163 into sections for execution as a demo.
8163 into sections for execution as a demo.
8164 \layout Standard
8164 \layout Standard
8165
8165
8166
8166
8167 \begin_inset ERT
8167 \begin_inset ERT
8168 status Open
8168 status Open
8169
8169
8170 \layout Standard
8170 \layout Standard
8171
8171
8172 \backslash
8172 \backslash
8173 codelist{examples/example-demo.py}
8173 codelist{examples/example-demo.py}
8174 \end_inset
8174 \end_inset
8175
8175
8176
8176
8177 \layout Standard
8177 \layout Standard
8178
8178
8179 In order to run a file as a demo, you must first make a
8179 In order to run a file as a demo, you must first make a
8180 \family typewriter
8180 \family typewriter
8181 Demo
8181 Demo
8182 \family default
8182 \family default
8183 object out of it.
8183 object out of it.
8184 If the file is named
8184 If the file is named
8185 \family typewriter
8185 \family typewriter
8186 myscript.py
8186 myscript.py
8187 \family default
8187 \family default
8188 , the following code will make a demo:
8188 , the following code will make a demo:
8189 \layout LyX-Code
8189 \layout LyX-Code
8190
8190
8191 from IPython.demo import Demo
8191 from IPython.demo import Demo
8192 \layout LyX-Code
8192 \layout LyX-Code
8193
8193
8194 mydemo = Demo('myscript.py')
8194 mydemo = Demo('myscript.py')
8195 \layout Standard
8195 \layout Standard
8196
8196
8197 This creates the
8197 This creates the
8198 \family typewriter
8198 \family typewriter
8199 mydemo
8199 mydemo
8200 \family default
8200 \family default
8201 object, whose blocks you run one at a time by simply calling the object
8201 object, whose blocks you run one at a time by simply calling the object
8202 with no arguments.
8202 with no arguments.
8203 If you have autocall active in IPython (the default), all you need to do
8203 If you have autocall active in IPython (the default), all you need to do
8204 is type
8204 is type
8205 \layout LyX-Code
8205 \layout LyX-Code
8206
8206
8207 mydemo
8207 mydemo
8208 \layout Standard
8208 \layout Standard
8209
8209
8210 and IPython will call it, executing each block.
8210 and IPython will call it, executing each block.
8211 Demo objects can be restarted, you can move forward or back skipping blocks,
8211 Demo objects can be restarted, you can move forward or back skipping blocks,
8212 re-execute the last block, etc.
8212 re-execute the last block, etc.
8213 Simply use the Tab key on a demo object to see its methods, and call
8213 Simply use the Tab key on a demo object to see its methods, and call
8214 \family typewriter
8214 \family typewriter
8215 `?'
8215 `?'
8216 \family default
8216 \family default
8217 on them to see their docstrings for more usage details.
8217 on them to see their docstrings for more usage details.
8218 In addition, the
8218 In addition, the
8219 \family typewriter
8219 \family typewriter
8220 demo
8220 demo
8221 \family default
8221 \family default
8222 module itself contains a comprehensive docstring, which you can access
8222 module itself contains a comprehensive docstring, which you can access
8223 via
8223 via
8224 \layout LyX-Code
8224 \layout LyX-Code
8225
8225
8226 from IPython import demo
8226 from IPython import demo
8227 \layout LyX-Code
8227 \layout LyX-Code
8228
8228
8229 demo?
8229 demo?
8230 \layout Standard
8230 \layout Standard
8231
8231
8232
8232
8233 \series bold
8233 \series bold
8234 Limitations:
8234 Limitations:
8235 \series default
8235 \series default
8236 It is important to note that these demos are limited to fairly simple uses.
8236 It is important to note that these demos are limited to fairly simple uses.
8237 In particular, you can
8237 In particular, you can
8238 \emph on
8238 \emph on
8239 not
8239 not
8240 \emph default
8240 \emph default
8241 put division marks in indented code (loops, if statements, function definitions
8241 put division marks in indented code (loops, if statements, function definitions
8242 , etc.) Supporting something like this would basically require tracking the
8242 , etc.) Supporting something like this would basically require tracking the
8243 internal execution state of the Python interpreter, so only top-level divisions
8243 internal execution state of the Python interpreter, so only top-level divisions
8244 are allowed.
8244 are allowed.
8245 If you want to be able to open an IPython instance at an arbitrary point
8245 If you want to be able to open an IPython instance at an arbitrary point
8246 in a program, you can use IPython's embedding facilities, described in
8246 in a program, you can use IPython's embedding facilities, described in
8247 detail in Sec\SpecialChar \@.
8247 detail in Sec\SpecialChar \@.
8248 \SpecialChar ~
8248 \SpecialChar ~
8249
8249
8250 \begin_inset LatexCommand \ref{sec:embed}
8250 \begin_inset LatexCommand \ref{sec:embed}
8251
8251
8252 \end_inset
8252 \end_inset
8253
8253
8254 .
8254 .
8255 \layout Section
8255 \layout Section
8256
8256
8257
8257
8258 \begin_inset LatexCommand \label{sec:matplotlib-support}
8258 \begin_inset LatexCommand \label{sec:matplotlib-support}
8259
8259
8260 \end_inset
8260 \end_inset
8261
8261
8262 Plotting with
8262 Plotting with
8263 \family typewriter
8263 \family typewriter
8264 matplotlib
8264 matplotlib
8265 \family default
8265 \family default
8266
8266
8267 \layout Standard
8267 \layout Standard
8268
8268
8269 The matplotlib library (
8269 The matplotlib library (
8270 \begin_inset LatexCommand \htmlurl[http://matplotlib.sourceforge.net]{http://matplotlib.sourceforge.net}
8270 \begin_inset LatexCommand \htmlurl[http://matplotlib.sourceforge.net]{http://matplotlib.sourceforge.net}
8271
8271
8272 \end_inset
8272 \end_inset
8273
8273
8274 ) provides high quality 2D plotting for Python.
8274 ) provides high quality 2D plotting for Python.
8275 Matplotlib can produce plots on screen using a variety of GUI toolkits,
8275 Matplotlib can produce plots on screen using a variety of GUI toolkits,
8276 including Tk, GTK and WXPython.
8276 including Tk, GTK and WXPython.
8277 It also provides a number of commands useful for scientific computing,
8277 It also provides a number of commands useful for scientific computing,
8278 all with a syntax compatible with that of the popular Matlab program.
8278 all with a syntax compatible with that of the popular Matlab program.
8279 \layout Standard
8279 \layout Standard
8280
8280
8281 IPython accepts the special option
8281 IPython accepts the special option
8282 \family typewriter
8282 \family typewriter
8283 -pylab
8283 -pylab
8284 \family default
8284 \family default
8285 (Sec.\SpecialChar ~
8285 (Sec.\SpecialChar ~
8286
8286
8287 \begin_inset LatexCommand \ref{sec:cmd-line-opts}
8287 \begin_inset LatexCommand \ref{sec:cmd-line-opts}
8288
8288
8289 \end_inset
8289 \end_inset
8290
8290
8291 ).
8291 ).
8292 This configures it to support matplotlib, honoring the settings in the
8292 This configures it to support matplotlib, honoring the settings in the
8293
8293
8294 \family typewriter
8294 \family typewriter
8295 .matplotlibrc
8295 .matplotlibrc
8296 \family default
8296 \family default
8297 file.
8297 file.
8298 IPython will detect the user's choice of matplotlib GUI backend, and automatica
8298 IPython will detect the user's choice of matplotlib GUI backend, and automatica
8299 lly select the proper threading model to prevent blocking.
8299 lly select the proper threading model to prevent blocking.
8300 It also sets matplotlib in interactive mode and modifies
8300 It also sets matplotlib in interactive mode and modifies
8301 \family typewriter
8301 \family typewriter
8302 %run
8302 %run
8303 \family default
8303 \family default
8304 slightly, so that any matplotlib-based script can be executed using
8304 slightly, so that any matplotlib-based script can be executed using
8305 \family typewriter
8305 \family typewriter
8306 %run
8306 %run
8307 \family default
8307 \family default
8308 and the final
8308 and the final
8309 \family typewriter
8309 \family typewriter
8310 show()
8310 show()
8311 \family default
8311 \family default
8312 command does not block the interactive shell.
8312 command does not block the interactive shell.
8313 \layout Standard
8313 \layout Standard
8314
8314
8315 The
8315 The
8316 \family typewriter
8316 \family typewriter
8317 -pylab
8317 -pylab
8318 \family default
8318 \family default
8319 option must be given first in order for IPython to configure its threading
8319 option must be given first in order for IPython to configure its threading
8320 mode.
8320 mode.
8321 However, you can still issue other options afterwards.
8321 However, you can still issue other options afterwards.
8322 This allows you to have a matplotlib-based environment customized with
8322 This allows you to have a matplotlib-based environment customized with
8323 additional modules using the standard IPython profile mechanism (Sec.\SpecialChar ~
8323 additional modules using the standard IPython profile mechanism (Sec.\SpecialChar ~
8324
8324
8325 \begin_inset LatexCommand \ref{sec:profiles}
8325 \begin_inset LatexCommand \ref{sec:profiles}
8326
8326
8327 \end_inset
8327 \end_inset
8328
8328
8329 ): ``
8329 ): ``
8330 \family typewriter
8330 \family typewriter
8331 ipython -pylab -p myprofile
8331 ipython -pylab -p myprofile
8332 \family default
8332 \family default
8333 '' will load the profile defined in
8333 '' will load the profile defined in
8334 \family typewriter
8334 \family typewriter
8335 ipythonrc-myprofile
8335 ipythonrc-myprofile
8336 \family default
8336 \family default
8337 after configuring matplotlib.
8337 after configuring matplotlib.
8338 \layout Section
8338 \layout Section
8339
8339
8340
8340
8341 \begin_inset LatexCommand \label{sec:Gnuplot}
8341 \begin_inset LatexCommand \label{sec:Gnuplot}
8342
8342
8343 \end_inset
8343 \end_inset
8344
8344
8345 Plotting with
8345 Plotting with
8346 \family typewriter
8346 \family typewriter
8347 Gnuplot
8347 Gnuplot
8348 \layout Standard
8348 \layout Standard
8349
8349
8350 Through the magic extension system described in sec.
8350 Through the magic extension system described in sec.
8351
8351
8352 \begin_inset LatexCommand \ref{sec:magic}
8352 \begin_inset LatexCommand \ref{sec:magic}
8353
8353
8354 \end_inset
8354 \end_inset
8355
8355
8356 , IPython incorporates a mechanism for conveniently interfacing with the
8356 , IPython incorporates a mechanism for conveniently interfacing with the
8357 Gnuplot system (
8357 Gnuplot system (
8358 \begin_inset LatexCommand \htmlurl{http://www.gnuplot.info}
8358 \begin_inset LatexCommand \htmlurl{http://www.gnuplot.info}
8359
8359
8360 \end_inset
8360 \end_inset
8361
8361
8362 ).
8362 ).
8363 Gnuplot is a very complete 2D and 3D plotting package available for many
8363 Gnuplot is a very complete 2D and 3D plotting package available for many
8364 operating systems and commonly included in modern Linux distributions.
8364 operating systems and commonly included in modern Linux distributions.
8365
8365
8366 \layout Standard
8366 \layout Standard
8367
8367
8368 Besides having Gnuplot installed, this functionality requires the
8368 Besides having Gnuplot installed, this functionality requires the
8369 \family typewriter
8369 \family typewriter
8370 Gnuplot.py
8370 Gnuplot.py
8371 \family default
8371 \family default
8372 module for interfacing python with Gnuplot.
8372 module for interfacing python with Gnuplot.
8373 It can be downloaded from:
8373 It can be downloaded from:
8374 \begin_inset LatexCommand \htmlurl{http://gnuplot-py.sourceforge.net}
8374 \begin_inset LatexCommand \htmlurl{http://gnuplot-py.sourceforge.net}
8375
8375
8376 \end_inset
8376 \end_inset
8377
8377
8378 .
8378 .
8379 \layout Subsection
8379 \layout Subsection
8380
8380
8381 Proper Gnuplot configuration
8381 Proper Gnuplot configuration
8382 \layout Standard
8382 \layout Standard
8383
8383
8384 As of version 4.0, Gnuplot has excellent mouse and interactive keyboard support.
8384 As of version 4.0, Gnuplot has excellent mouse and interactive keyboard support.
8385 However, as of
8385 However, as of
8386 \family typewriter
8386 \family typewriter
8387 Gnuplot.py
8387 Gnuplot.py
8388 \family default
8388 \family default
8389 version 1.7, a new option was added to communicate between Python and Gnuplot
8389 version 1.7, a new option was added to communicate between Python and Gnuplot
8390 via FIFOs (pipes).
8390 via FIFOs (pipes).
8391 This mechanism, while fast, also breaks the mouse system.
8391 This mechanism, while fast, also breaks the mouse system.
8392 You must therefore set the variable
8392 You must therefore set the variable
8393 \family typewriter
8393 \family typewriter
8394 prefer_fifo_data
8394 prefer_fifo_data
8395 \family default
8395 \family default
8396 to
8396 to
8397 \family typewriter
8397 \family typewriter
8398 0
8398 0
8399 \family default
8399 \family default
8400 in file
8400 in file
8401 \family typewriter
8401 \family typewriter
8402 gp_unix.py
8402 gp_unix.py
8403 \family default
8403 \family default
8404 if you wish to keep the interactive mouse and keyboard features working
8404 if you wish to keep the interactive mouse and keyboard features working
8405 properly (
8405 properly (
8406 \family typewriter
8406 \family typewriter
8407 prefer_inline_data
8407 prefer_inline_data
8408 \family default
8408 \family default
8409 also must be
8409 also must be
8410 \family typewriter
8410 \family typewriter
8411 0
8411 0
8412 \family default
8412 \family default
8413 , but this is the default so unless you've changed it manually you should
8413 , but this is the default so unless you've changed it manually you should
8414 be fine).
8414 be fine).
8415 \layout Standard
8415 \layout Standard
8416
8416
8417 'Out of the box', Gnuplot is configured with a rather poor set of size,
8417 'Out of the box', Gnuplot is configured with a rather poor set of size,
8418 color and linewidth choices which make the graphs fairly hard to read on
8418 color and linewidth choices which make the graphs fairly hard to read on
8419 modern high-resolution displays (although they work fine on old 640x480
8419 modern high-resolution displays (although they work fine on old 640x480
8420 ones).
8420 ones).
8421 Below is a section of my
8421 Below is a section of my
8422 \family typewriter
8422 \family typewriter
8423 .Xdefaults
8423 .Xdefaults
8424 \family default
8424 \family default
8425 file which I use for having a more convenient Gnuplot setup.
8425 file which I use for having a more convenient Gnuplot setup.
8426 Remember to load it by running
8426 Remember to load it by running
8427 \family typewriter
8427 \family typewriter
8428 `xrdb .Xdefaults`
8428 `xrdb .Xdefaults`
8429 \family default
8429 \family default
8430 :
8430 :
8431 \layout Standard
8431 \layout Standard
8432
8432
8433
8433
8434 \family typewriter
8434 \family typewriter
8435 !******************************************************************
8435 !******************************************************************
8436 \newline
8436 \newline
8437 ! gnuplot options
8437 ! gnuplot options
8438 \newline
8438 \newline
8439 ! modify this for a convenient window size
8439 ! modify this for a convenient window size
8440 \newline
8440 \newline
8441 gnuplot*geometry: 780x580
8441 gnuplot*geometry: 780x580
8442 \layout Standard
8442 \layout Standard
8443
8443
8444
8444
8445 \family typewriter
8445 \family typewriter
8446 ! on-screen font (not for PostScript)
8446 ! on-screen font (not for PostScript)
8447 \newline
8447 \newline
8448 gnuplot*font: -misc-fixed-bold-r-normal--15-120-100-100-c-90-iso8859-1
8448 gnuplot*font: -misc-fixed-bold-r-normal--15-120-100-100-c-90-iso8859-1
8449 \layout Standard
8449 \layout Standard
8450
8450
8451
8451
8452 \family typewriter
8452 \family typewriter
8453 ! color options
8453 ! color options
8454 \newline
8454 \newline
8455 gnuplot*background: black
8455 gnuplot*background: black
8456 \newline
8456 \newline
8457 gnuplot*textColor: white
8457 gnuplot*textColor: white
8458 \newline
8458 \newline
8459 gnuplot*borderColor: white
8459 gnuplot*borderColor: white
8460 \newline
8460 \newline
8461 gnuplot*axisColor: white
8461 gnuplot*axisColor: white
8462 \newline
8462 \newline
8463 gnuplot*line1Color: red
8463 gnuplot*line1Color: red
8464 \newline
8464 \newline
8465 gnuplot*line2Color: green
8465 gnuplot*line2Color: green
8466 \newline
8466 \newline
8467 gnuplot*line3Color: blue
8467 gnuplot*line3Color: blue
8468 \newline
8468 \newline
8469 gnuplot*line4Color: magenta
8469 gnuplot*line4Color: magenta
8470 \newline
8470 \newline
8471 gnuplot*line5Color: cyan
8471 gnuplot*line5Color: cyan
8472 \newline
8472 \newline
8473 gnuplot*line6Color: sienna
8473 gnuplot*line6Color: sienna
8474 \newline
8474 \newline
8475 gnuplot*line7Color: orange
8475 gnuplot*line7Color: orange
8476 \newline
8476 \newline
8477 gnuplot*line8Color: coral
8477 gnuplot*line8Color: coral
8478 \layout Standard
8478 \layout Standard
8479
8479
8480
8480
8481 \family typewriter
8481 \family typewriter
8482 ! multiplicative factor for point styles
8482 ! multiplicative factor for point styles
8483 \newline
8483 \newline
8484 gnuplot*pointsize: 2
8484 gnuplot*pointsize: 2
8485 \layout Standard
8485 \layout Standard
8486
8486
8487
8487
8488 \family typewriter
8488 \family typewriter
8489 ! line width options (in pixels)
8489 ! line width options (in pixels)
8490 \newline
8490 \newline
8491 gnuplot*borderWidth: 2
8491 gnuplot*borderWidth: 2
8492 \newline
8492 \newline
8493 gnuplot*axisWidth: 2
8493 gnuplot*axisWidth: 2
8494 \newline
8494 \newline
8495 gnuplot*line1Width: 2
8495 gnuplot*line1Width: 2
8496 \newline
8496 \newline
8497 gnuplot*line2Width: 2
8497 gnuplot*line2Width: 2
8498 \newline
8498 \newline
8499 gnuplot*line3Width: 2
8499 gnuplot*line3Width: 2
8500 \newline
8500 \newline
8501 gnuplot*line4Width: 2
8501 gnuplot*line4Width: 2
8502 \newline
8502 \newline
8503 gnuplot*line5Width: 2
8503 gnuplot*line5Width: 2
8504 \newline
8504 \newline
8505 gnuplot*line6Width: 2
8505 gnuplot*line6Width: 2
8506 \newline
8506 \newline
8507 gnuplot*line7Width: 2
8507 gnuplot*line7Width: 2
8508 \newline
8508 \newline
8509 gnuplot*line8Width: 2
8509 gnuplot*line8Width: 2
8510 \layout Subsection
8510 \layout Subsection
8511
8511
8512 The
8512 The
8513 \family typewriter
8513 \family typewriter
8514 IPython.GnuplotRuntime
8514 IPython.GnuplotRuntime
8515 \family default
8515 \family default
8516 module
8516 module
8517 \layout Standard
8517 \layout Standard
8518
8518
8519 IPython includes a module called
8519 IPython includes a module called
8520 \family typewriter
8520 \family typewriter
8521 Gnuplot2.py
8521 Gnuplot2.py
8522 \family default
8522 \family default
8523 which extends and improves the default
8523 which extends and improves the default
8524 \family typewriter
8524 \family typewriter
8525 Gnuplot
8525 Gnuplot
8526 \family default
8526 \family default
8527 .
8527 .
8528 \family typewriter
8528 \family typewriter
8529 py
8529 py
8530 \family default
8530 \family default
8531 (which it still relies upon).
8531 (which it still relies upon).
8532 For example, the new
8532 For example, the new
8533 \family typewriter
8533 \family typewriter
8534 plot
8534 plot
8535 \family default
8535 \family default
8536 function adds several improvements to the original making it more convenient
8536 function adds several improvements to the original making it more convenient
8537 for interactive use, and
8537 for interactive use, and
8538 \family typewriter
8538 \family typewriter
8539 hardcopy
8539 hardcopy
8540 \family default
8540 \family default
8541 fixes a bug in the original which under some circumstances blocks the creation
8541 fixes a bug in the original which under some circumstances blocks the creation
8542 of PostScript output.
8542 of PostScript output.
8543 \layout Standard
8543 \layout Standard
8544
8544
8545 For scripting use,
8545 For scripting use,
8546 \family typewriter
8546 \family typewriter
8547 GnuplotRuntime.py
8547 GnuplotRuntime.py
8548 \family default
8548 \family default
8549 is provided, which wraps
8549 is provided, which wraps
8550 \family typewriter
8550 \family typewriter
8551 Gnuplot2.py
8551 Gnuplot2.py
8552 \family default
8552 \family default
8553 and creates a series of global aliases.
8553 and creates a series of global aliases.
8554 These make it easy to control Gnuplot plotting jobs through the Python
8554 These make it easy to control Gnuplot plotting jobs through the Python
8555 language.
8555 language.
8556 \layout Standard
8556 \layout Standard
8557
8557
8558 Below is some example code which illustrates how to configure Gnuplot inside
8558 Below is some example code which illustrates how to configure Gnuplot inside
8559 your own programs but have it available for further interactive use through
8559 your own programs but have it available for further interactive use through
8560 an embedded IPython instance.
8560 an embedded IPython instance.
8561 Simply run this file at a system prompt.
8561 Simply run this file at a system prompt.
8562 This file is provided as
8562 This file is provided as
8563 \family typewriter
8563 \family typewriter
8564 example-gnuplot.py
8564 example-gnuplot.py
8565 \family default
8565 \family default
8566 in the examples directory:
8566 in the examples directory:
8567 \layout Standard
8567 \layout Standard
8568
8568
8569
8569
8570 \begin_inset ERT
8570 \begin_inset ERT
8571 status Open
8571 status Open
8572
8572
8573 \layout Standard
8573 \layout Standard
8574
8574
8575 \backslash
8575 \backslash
8576 codelist{examples/example-gnuplot.py}
8576 codelist{examples/example-gnuplot.py}
8577 \end_inset
8577 \end_inset
8578
8578
8579
8579
8580 \layout Subsection
8580 \layout Subsection
8581
8581
8582 The
8582 The
8583 \family typewriter
8583 \family typewriter
8584 numeric
8584 numeric
8585 \family default
8585 \family default
8586 profile: a scientific computing environment
8586 profile: a scientific computing environment
8587 \layout Standard
8587 \layout Standard
8588
8588
8589 The
8589 The
8590 \family typewriter
8590 \family typewriter
8591 numeric
8591 numeric
8592 \family default
8592 \family default
8593 IPython profile, which you can activate with
8593 IPython profile, which you can activate with
8594 \family typewriter
8594 \family typewriter
8595 `ipython -p numeric
8595 `ipython -p numeric
8596 \family default
8596 \family default
8597 ' will automatically load the IPython Gnuplot extensions (plus Numeric and
8597 ' will automatically load the IPython Gnuplot extensions (plus Numeric and
8598 other useful things for numerical computing), contained in the
8598 other useful things for numerical computing), contained in the
8599 \family typewriter
8599 \family typewriter
8600 IPython.GnuplotInteractive
8600 IPython.GnuplotInteractive
8601 \family default
8601 \family default
8602 module.
8602 module.
8603 This will create the globals
8603 This will create the globals
8604 \family typewriter
8604 \family typewriter
8605 Gnuplot
8605 Gnuplot
8606 \family default
8606 \family default
8607 (an alias to the improved Gnuplot2 module),
8607 (an alias to the improved Gnuplot2 module),
8608 \family typewriter
8608 \family typewriter
8609 gp
8609 gp
8610 \family default
8610 \family default
8611 (a Gnuplot active instance), the new magic commands
8611 (a Gnuplot active instance), the new magic commands
8612 \family typewriter
8612 \family typewriter
8613 %gpc
8613 %gpc
8614 \family default
8614 \family default
8615 and
8615 and
8616 \family typewriter
8616 \family typewriter
8617 %gp_set_instance
8617 %gp_set_instance
8618 \family default
8618 \family default
8619 and several other convenient globals.
8619 and several other convenient globals.
8620 Type
8620 Type
8621 \family typewriter
8621 \family typewriter
8622 gphelp()
8622 gphelp()
8623 \family default
8623 \family default
8624 for further details.
8624 for further details.
8625 \layout Standard
8625 \layout Standard
8626
8626
8627 This should turn IPython into a convenient environment for numerical computing,
8627 This should turn IPython into a convenient environment for numerical computing,
8628 with all the functions in the NumPy library and the Gnuplot facilities
8628 with all the functions in the NumPy library and the Gnuplot facilities
8629 for plotting.
8629 for plotting.
8630 Further improvements can be obtained by loading the SciPy libraries for
8630 Further improvements can be obtained by loading the SciPy libraries for
8631 scientific computing, available at
8631 scientific computing, available at
8632 \begin_inset LatexCommand \htmlurl{http://scipy.org}
8632 \begin_inset LatexCommand \htmlurl{http://scipy.org}
8633
8633
8634 \end_inset
8634 \end_inset
8635
8635
8636 .
8636 .
8637 \layout Standard
8637 \layout Standard
8638
8638
8639 If you are in the middle of a working session with numerical objects and
8639 If you are in the middle of a working session with numerical objects and
8640 need to plot them but you didn't start the
8640 need to plot them but you didn't start the
8641 \family typewriter
8641 \family typewriter
8642 numeric
8642 numeric
8643 \family default
8643 \family default
8644 profile, you can load these extensions at any time by typing
8644 profile, you can load these extensions at any time by typing
8645 \newline
8645 \newline
8646
8646
8647 \family typewriter
8647 \family typewriter
8648 from IPython.GnuplotInteractive import *
8648 from IPython.GnuplotInteractive import *
8649 \newline
8649 \newline
8650
8650
8651 \family default
8651 \family default
8652 at the IPython prompt.
8652 at the IPython prompt.
8653 This will allow you to keep your objects intact and start using Gnuplot
8653 This will allow you to keep your objects intact and start using Gnuplot
8654 to view them.
8654 to view them.
8655 \layout Section
8655 \layout Section
8656
8656
8657 Reporting bugs
8657 Reporting bugs
8658 \layout Subsection*
8658 \layout Subsection*
8659
8659
8660 Automatic crash reports
8660 Automatic crash reports
8661 \layout Standard
8661 \layout Standard
8662
8662
8663 Ideally, IPython itself shouldn't crash.
8663 Ideally, IPython itself shouldn't crash.
8664 It will catch exceptions produced by you, but bugs in its internals will
8664 It will catch exceptions produced by you, but bugs in its internals will
8665 still crash it.
8665 still crash it.
8666 \layout Standard
8666 \layout Standard
8667
8667
8668 In such a situation, IPython will leave a file named
8668 In such a situation, IPython will leave a file named
8669 \family typewriter
8669 \family typewriter
8670 IPython_crash_report.txt
8670 IPython_crash_report.txt
8671 \family default
8671 \family default
8672 in your IPYTHONDIR directory (that way if crashes happen several times
8672 in your IPYTHONDIR directory (that way if crashes happen several times
8673 it won't litter many directories, the post-mortem file is always located
8673 it won't litter many directories, the post-mortem file is always located
8674 in the same place and new occurrences just overwrite the previous one).
8674 in the same place and new occurrences just overwrite the previous one).
8675 If you can mail this file to the developers (see sec.
8675 If you can mail this file to the developers (see sec.
8676
8676
8677 \begin_inset LatexCommand \ref{sec:credits}
8677 \begin_inset LatexCommand \ref{sec:credits}
8678
8678
8679 \end_inset
8679 \end_inset
8680
8680
8681 for names and addresses), it will help us
8681 for names and addresses), it will help us
8682 \emph on
8682 \emph on
8683 a lot
8683 a lot
8684 \emph default
8684 \emph default
8685 in understanding the cause of the problem and fixing it sooner.
8685 in understanding the cause of the problem and fixing it sooner.
8686 \layout Subsection*
8686 \layout Subsection*
8687
8687
8688 The bug tracker
8688 The bug tracker
8689 \layout Standard
8689 \layout Standard
8690
8690
8691 IPython also has an online bug-tracker, located at
8691 IPython also has an online bug-tracker, located at
8692 \begin_inset LatexCommand \htmlurl{http://www.scipy.net/roundup/ipython}
8692 \begin_inset LatexCommand \htmlurl{http://www.scipy.net/roundup/ipython}
8693
8693
8694 \end_inset
8694 \end_inset
8695
8695
8696 .
8696 .
8697 In addition to mailing the developers, it would be a good idea to file
8697 In addition to mailing the developers, it would be a good idea to file
8698 a bug report here.
8698 a bug report here.
8699 This will ensure that the issue is properly followed to conclusion.
8699 This will ensure that the issue is properly followed to conclusion.
8700 \layout Standard
8700 \layout Standard
8701
8701
8702 You can also use this bug tracker to file feature requests.
8702 You can also use this bug tracker to file feature requests.
8703 \layout Section
8703 \layout Section
8704
8704
8705 Brief history
8705 Brief history
8706 \layout Subsection
8706 \layout Subsection
8707
8707
8708 Origins
8708 Origins
8709 \layout Standard
8709 \layout Standard
8710
8710
8711 The current IPython system grew out of the following three projects:
8711 The current IPython system grew out of the following three projects:
8712 \layout List
8712 \layout List
8713 \labelwidthstring 00.00.0000
8713 \labelwidthstring 00.00.0000
8714
8714
8715 ipython by Fernando P
8715 ipython by Fernando P
8716 \begin_inset ERT
8716 \begin_inset ERT
8717 status Collapsed
8717 status Collapsed
8718
8718
8719 \layout Standard
8719 \layout Standard
8720
8720
8721 \backslash
8721 \backslash
8722 '{e}
8722 '{e}
8723 \end_inset
8723 \end_inset
8724
8724
8725 rez.
8725 rez.
8726 I was working on adding Mathematica-type prompts and a flexible configuration
8726 I was working on adding Mathematica-type prompts and a flexible configuration
8727 system (something better than
8727 system (something better than
8728 \family typewriter
8728 \family typewriter
8729 $PYTHONSTARTUP
8729 $PYTHONSTARTUP
8730 \family default
8730 \family default
8731 ) to the standard Python interactive interpreter.
8731 ) to the standard Python interactive interpreter.
8732 \layout List
8732 \layout List
8733 \labelwidthstring 00.00.0000
8733 \labelwidthstring 00.00.0000
8734
8734
8735 IPP by Janko Hauser.
8735 IPP by Janko Hauser.
8736 Very well organized, great usability.
8736 Very well organized, great usability.
8737 Had an old help system.
8737 Had an old help system.
8738 IPP was used as the `container' code into which I added the functionality
8738 IPP was used as the `container' code into which I added the functionality
8739 from ipython and LazyPython.
8739 from ipython and LazyPython.
8740 \layout List
8740 \layout List
8741 \labelwidthstring 00.00.0000
8741 \labelwidthstring 00.00.0000
8742
8742
8743 LazyPython by Nathan Gray.
8743 LazyPython by Nathan Gray.
8744 Simple but
8744 Simple but
8745 \emph on
8745 \emph on
8746 very
8746 very
8747 \emph default
8747 \emph default
8748 powerful.
8748 powerful.
8749 The quick syntax (auto parens, auto quotes) and verbose/colored tracebacks
8749 The quick syntax (auto parens, auto quotes) and verbose/colored tracebacks
8750 were all taken from here.
8750 were all taken from here.
8751 \layout Standard
8751 \layout Standard
8752
8752
8753 When I found out (see sec.
8753 When I found out (see sec.
8754
8754
8755 \begin_inset LatexCommand \ref{figgins}
8755 \begin_inset LatexCommand \ref{figgins}
8756
8756
8757 \end_inset
8757 \end_inset
8758
8758
8759 ) about IPP and LazyPython I tried to join all three into a unified system.
8759 ) about IPP and LazyPython I tried to join all three into a unified system.
8760 I thought this could provide a very nice working environment, both for
8760 I thought this could provide a very nice working environment, both for
8761 regular programming and scientific computing: shell-like features, IDL/Matlab
8761 regular programming and scientific computing: shell-like features, IDL/Matlab
8762 numerics, Mathematica-type prompt history and great object introspection
8762 numerics, Mathematica-type prompt history and great object introspection
8763 and help facilities.
8763 and help facilities.
8764 I think it worked reasonably well, though it was a lot more work than I
8764 I think it worked reasonably well, though it was a lot more work than I
8765 had initially planned.
8765 had initially planned.
8766 \layout Subsection
8766 \layout Subsection
8767
8767
8768 Current status
8768 Current status
8769 \layout Standard
8769 \layout Standard
8770
8770
8771 The above listed features work, and quite well for the most part.
8771 The above listed features work, and quite well for the most part.
8772 But until a major internal restructuring is done (see below), only bug
8772 But until a major internal restructuring is done (see below), only bug
8773 fixing will be done, no other features will be added (unless very minor
8773 fixing will be done, no other features will be added (unless very minor
8774 and well localized in the cleaner parts of the code).
8774 and well localized in the cleaner parts of the code).
8775 \layout Standard
8775 \layout Standard
8776
8776
8777 IPython consists of some 18000 lines of pure python code, of which roughly
8777 IPython consists of some 18000 lines of pure python code, of which roughly
8778 two thirds is reasonably clean.
8778 two thirds is reasonably clean.
8779 The rest is, messy code which needs a massive restructuring before any
8779 The rest is, messy code which needs a massive restructuring before any
8780 further major work is done.
8780 further major work is done.
8781 Even the messy code is fairly well documented though, and most of the problems
8781 Even the messy code is fairly well documented though, and most of the problems
8782 in the (non-existent) class design are well pointed to by a PyChecker run.
8782 in the (non-existent) class design are well pointed to by a PyChecker run.
8783 So the rewriting work isn't that bad, it will just be time-consuming.
8783 So the rewriting work isn't that bad, it will just be time-consuming.
8784 \layout Subsection
8784 \layout Subsection
8785
8785
8786 Future
8786 Future
8787 \layout Standard
8787 \layout Standard
8788
8788
8789 See the separate
8789 See the separate
8790 \family typewriter
8790 \family typewriter
8791 new_design
8791 new_design
8792 \family default
8792 \family default
8793 document for details.
8793 document for details.
8794 Ultimately, I would like to see IPython become part of the standard Python
8794 Ultimately, I would like to see IPython become part of the standard Python
8795 distribution as a `big brother with batteries' to the standard Python interacti
8795 distribution as a `big brother with batteries' to the standard Python interacti
8796 ve interpreter.
8796 ve interpreter.
8797 But that will never happen with the current state of the code, so all contribut
8797 But that will never happen with the current state of the code, so all contribut
8798 ions are welcome.
8798 ions are welcome.
8799 \layout Section
8799 \layout Section
8800
8800
8801 License
8801 License
8802 \layout Standard
8802 \layout Standard
8803
8803
8804 IPython is released under the terms of the BSD license, whose general form
8804 IPython is released under the terms of the BSD license, whose general form
8805 can be found at:
8805 can be found at:
8806 \begin_inset LatexCommand \htmlurl{http://www.opensource.org/licenses/bsd-license.php}
8806 \begin_inset LatexCommand \htmlurl{http://www.opensource.org/licenses/bsd-license.php}
8807
8807
8808 \end_inset
8808 \end_inset
8809
8809
8810 .
8810 .
8811 The full text of the IPython license is reproduced below:
8811 The full text of the IPython license is reproduced below:
8812 \layout Quote
8812 \layout Quote
8813
8813
8814
8814
8815 \family typewriter
8815 \family typewriter
8816 \size small
8816 \size small
8817 IPython is released under a BSD-type license.
8817 IPython is released under a BSD-type license.
8818 \layout Quote
8818 \layout Quote
8819
8819
8820
8820
8821 \family typewriter
8821 \family typewriter
8822 \size small
8822 \size small
8823 Copyright (c) 2001, 2002, 2003, 2004 Fernando Perez <fperez@colorado.edu>.
8823 Copyright (c) 2001, 2002, 2003, 2004 Fernando Perez <fperez@colorado.edu>.
8824 \layout Quote
8824 \layout Quote
8825
8825
8826
8826
8827 \family typewriter
8827 \family typewriter
8828 \size small
8828 \size small
8829 Copyright (c) 2001 Janko Hauser <jhauser@zscout.de> and
8829 Copyright (c) 2001 Janko Hauser <jhauser@zscout.de> and
8830 \newline
8830 \newline
8831 Nathaniel Gray <n8gray@caltech.edu>.
8831 Nathaniel Gray <n8gray@caltech.edu>.
8832 \layout Quote
8832 \layout Quote
8833
8833
8834
8834
8835 \family typewriter
8835 \family typewriter
8836 \size small
8836 \size small
8837 All rights reserved.
8837 All rights reserved.
8838 \layout Quote
8838 \layout Quote
8839
8839
8840
8840
8841 \family typewriter
8841 \family typewriter
8842 \size small
8842 \size small
8843 Redistribution and use in source and binary forms, with or without modification,
8843 Redistribution and use in source and binary forms, with or without modification,
8844 are permitted provided that the following conditions are met:
8844 are permitted provided that the following conditions are met:
8845 \layout Quote
8845 \layout Quote
8846
8846
8847
8847
8848 \family typewriter
8848 \family typewriter
8849 \size small
8849 \size small
8850 a.
8850 a.
8851 Redistributions of source code must retain the above copyright notice,
8851 Redistributions of source code must retain the above copyright notice,
8852 this list of conditions and the following disclaimer.
8852 this list of conditions and the following disclaimer.
8853 \layout Quote
8853 \layout Quote
8854
8854
8855
8855
8856 \family typewriter
8856 \family typewriter
8857 \size small
8857 \size small
8858 b.
8858 b.
8859 Redistributions in binary form must reproduce the above copyright notice,
8859 Redistributions in binary form must reproduce the above copyright notice,
8860 this list of conditions and the following disclaimer in the documentation
8860 this list of conditions and the following disclaimer in the documentation
8861 and/or other materials provided with the distribution.
8861 and/or other materials provided with the distribution.
8862 \layout Quote
8862 \layout Quote
8863
8863
8864
8864
8865 \family typewriter
8865 \family typewriter
8866 \size small
8866 \size small
8867 c.
8867 c.
8868 Neither the name of the copyright holders nor the names of any contributors
8868 Neither the name of the copyright holders nor the names of any contributors
8869 to this software may be used to endorse or promote products derived from
8869 to this software may be used to endorse or promote products derived from
8870 this software without specific prior written permission.
8870 this software without specific prior written permission.
8871 \layout Quote
8871 \layout Quote
8872
8872
8873
8873
8874 \family typewriter
8874 \family typewriter
8875 \size small
8875 \size small
8876 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
8876 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
8877 IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
8877 IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
8878 THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
8878 THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
8879 PURPOSE ARE DISCLAIMED.
8879 PURPOSE ARE DISCLAIMED.
8880 IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
8880 IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
8881 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
8881 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
8882 BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
8882 BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
8883 USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
8883 USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
8884 ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
8884 ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
8885 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
8885 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
8886 THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
8886 THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
8887
8887
8888 \layout Standard
8888 \layout Standard
8889
8889
8890 Individual authors are the holders of the copyright for their code and are
8890 Individual authors are the holders of the copyright for their code and are
8891 listed in each file.
8891 listed in each file.
8892 \layout Standard
8892 \layout Standard
8893
8893
8894 Some files (
8894 Some files (
8895 \family typewriter
8895 \family typewriter
8896 DPyGetOpt.py
8896 DPyGetOpt.py
8897 \family default
8897 \family default
8898 , for example) may be licensed under different conditions.
8898 , for example) may be licensed under different conditions.
8899 Ultimately each file indicates clearly the conditions under which its author/au
8899 Ultimately each file indicates clearly the conditions under which its author/au
8900 thors have decided to publish the code.
8900 thors have decided to publish the code.
8901 \layout Standard
8901 \layout Standard
8902
8902
8903 Versions of IPython up to and including 0.6.3 were released under the GNU
8903 Versions of IPython up to and including 0.6.3 were released under the GNU
8904 Lesser General Public License (LGPL), available at
8904 Lesser General Public License (LGPL), available at
8905 \begin_inset LatexCommand \htmlurl{http://www.gnu.org/copyleft/lesser.html}
8905 \begin_inset LatexCommand \htmlurl{http://www.gnu.org/copyleft/lesser.html}
8906
8906
8907 \end_inset
8907 \end_inset
8908
8908
8909 .
8909 .
8910 \layout Section
8910 \layout Section
8911
8911
8912
8912
8913 \begin_inset LatexCommand \label{sec:credits}
8913 \begin_inset LatexCommand \label{sec:credits}
8914
8914
8915 \end_inset
8915 \end_inset
8916
8916
8917 Credits
8917 Credits
8918 \layout Standard
8918 \layout Standard
8919
8919
8920 IPython is mainly developed by Fernando P
8920 IPython is mainly developed by Fernando P
8921 \begin_inset ERT
8921 \begin_inset ERT
8922 status Collapsed
8922 status Collapsed
8923
8923
8924 \layout Standard
8924 \layout Standard
8925
8925
8926 \backslash
8926 \backslash
8927 '{e}
8927 '{e}
8928 \end_inset
8928 \end_inset
8929
8929
8930 rez
8930 rez
8931 \family typewriter
8931 \family typewriter
8932 <Fernando.Perez@colorado.edu>
8932 <Fernando.Perez@colorado.edu>
8933 \family default
8933 \family default
8934 , but the project was born from mixing in Fernando's code with the IPP project
8934 , but the project was born from mixing in Fernando's code with the IPP project
8935 by Janko Hauser
8935 by Janko Hauser
8936 \family typewriter
8936 \family typewriter
8937 <jhauser-AT-zscout.de>
8937 <jhauser-AT-zscout.de>
8938 \family default
8938 \family default
8939 and LazyPython by Nathan Gray
8939 and LazyPython by Nathan Gray
8940 \family typewriter
8940 \family typewriter
8941 <n8gray-AT-caltech.edu>
8941 <n8gray-AT-caltech.edu>
8942 \family default
8942 \family default
8943 .
8943 .
8944 For all IPython-related requests, please contact Fernando.
8944 For all IPython-related requests, please contact Fernando.
8945
8945
8946 \layout Standard
8946 \layout Standard
8947
8947
8948 As of early 2006, the following developers have joined the core team:
8948 As of early 2006, the following developers have joined the core team:
8949 \layout List
8949 \layout List
8950 \labelwidthstring 00.00.0000
8950 \labelwidthstring 00.00.0000
8951
8951
8952 Robert\SpecialChar ~
8952 Robert\SpecialChar ~
8953 Kern
8953 Kern
8954 \family typewriter
8954 \family typewriter
8955 <rkern-AT-enthought.com>
8955 <rkern-AT-enthought.com>
8956 \family default
8956 \family default
8957 : co-mentored the 2005 Google Summer of Code project to develop python interacti
8957 : co-mentored the 2005 Google Summer of Code project to develop python interacti
8958 ve notebooks (XML documents) and graphical interface.
8958 ve notebooks (XML documents) and graphical interface.
8959 This project was awarded to the students Tzanko Matev
8959 This project was awarded to the students Tzanko Matev
8960 \family typewriter
8960 \family typewriter
8961 <tsanko-AT-gmail.com>
8961 <tsanko-AT-gmail.com>
8962 \family default
8962 \family default
8963 and Toni Alatalo
8963 and Toni Alatalo
8964 \family typewriter
8964 \family typewriter
8965 <antont-AT-an.org>
8965 <antont-AT-an.org>
8966 \layout List
8966 \layout List
8967 \labelwidthstring 00.00.0000
8967 \labelwidthstring 00.00.0000
8968
8968
8969 Brian\SpecialChar ~
8969 Brian\SpecialChar ~
8970 Granger
8970 Granger
8971 \family typewriter
8971 \family typewriter
8972 <bgranger-AT-scu.edu>
8972 <bgranger-AT-scu.edu>
8973 \family default
8973 \family default
8974 : extending IPython to allow support for interactive parallel computing.
8974 : extending IPython to allow support for interactive parallel computing.
8975 \layout List
8975 \layout List
8976 \labelwidthstring 00.00.0000
8976 \labelwidthstring 00.00.0000
8977
8977
8978 Ville\SpecialChar ~
8978 Ville\SpecialChar ~
8979 Vainio
8979 Vainio
8980 \family typewriter
8980 \family typewriter
8981 <vivainio-AT-gmail.com>
8981 <vivainio-AT-gmail.com>
8982 \family default
8982 \family default
8983 : Ville is the new maintainer for the main trunk of IPython after version
8983 : Ville is the new maintainer for the main trunk of IPython after version
8984 0.7.1.
8984 0.7.1.
8985 \layout Standard
8985 \layout Standard
8986
8986
8987 User or development help should be requested via the IPython mailing lists:
8987 User or development help should be requested via the IPython mailing lists:
8988 \layout Description
8988 \layout Description
8989
8989
8990 User\SpecialChar ~
8990 User\SpecialChar ~
8991 list:
8991 list:
8992 \begin_inset LatexCommand \htmlurl{http://scipy.net/mailman/listinfo/ipython-user}
8992 \begin_inset LatexCommand \htmlurl{http://scipy.net/mailman/listinfo/ipython-user}
8993
8993
8994 \end_inset
8994 \end_inset
8995
8995
8996
8996
8997 \layout Description
8997 \layout Description
8998
8998
8999 Developer's\SpecialChar ~
8999 Developer's\SpecialChar ~
9000 list:
9000 list:
9001 \begin_inset LatexCommand \htmlurl{http://scipy.net/mailman/listinfo/ipython-dev}
9001 \begin_inset LatexCommand \htmlurl{http://scipy.net/mailman/listinfo/ipython-dev}
9002
9002
9003 \end_inset
9003 \end_inset
9004
9004
9005
9005
9006 \layout Standard
9006 \layout Standard
9007
9007
9008 The IPython project is also very grateful to
9008 The IPython project is also very grateful to
9009 \begin_inset Foot
9009 \begin_inset Foot
9010 collapsed true
9010 collapsed true
9011
9011
9012 \layout Standard
9012 \layout Standard
9013
9013
9014 I've mangled email addresses to reduce spam, since the IPython manuals can
9014 I've mangled email addresses to reduce spam, since the IPython manuals can
9015 be accessed online.
9015 be accessed online.
9016 \end_inset
9016 \end_inset
9017
9017
9018 :
9018 :
9019 \layout Standard
9019 \layout Standard
9020
9020
9021 Bill Bumgarner
9021 Bill Bumgarner
9022 \family typewriter
9022 \family typewriter
9023 <bbum-AT-friday.com>
9023 <bbum-AT-friday.com>
9024 \family default
9024 \family default
9025 : for providing the DPyGetOpt module which gives very powerful and convenient
9025 : for providing the DPyGetOpt module which gives very powerful and convenient
9026 handling of command-line options (light years ahead of what Python 2.1.1's
9026 handling of command-line options (light years ahead of what Python 2.1.1's
9027 getopt module does).
9027 getopt module does).
9028 \layout Standard
9028 \layout Standard
9029
9029
9030 Ka-Ping Yee
9030 Ka-Ping Yee
9031 \family typewriter
9031 \family typewriter
9032 <ping-AT-lfw.org>
9032 <ping-AT-lfw.org>
9033 \family default
9033 \family default
9034 : for providing the Itpl module for convenient and powerful string interpolation
9034 : for providing the Itpl module for convenient and powerful string interpolation
9035 with a much nicer syntax than formatting through the '%' operator.
9035 with a much nicer syntax than formatting through the '%' operator.
9036 \layout Standard
9036 \layout Standard
9037
9037
9038 Arnd Baecker
9038 Arnd Baecker
9039 \family typewriter
9039 \family typewriter
9040 <baecker-AT-physik.tu-dresden.de>
9040 <baecker-AT-physik.tu-dresden.de>
9041 \family default
9041 \family default
9042 : for his many very useful suggestions and comments, and lots of help with
9042 : for his many very useful suggestions and comments, and lots of help with
9043 testing and documentation checking.
9043 testing and documentation checking.
9044 Many of IPython's newer features are a result of discussions with him (bugs
9044 Many of IPython's newer features are a result of discussions with him (bugs
9045 are still my fault, not his).
9045 are still my fault, not his).
9046 \layout Standard
9046 \layout Standard
9047
9047
9048 Obviously Guido van\SpecialChar ~
9048 Obviously Guido van\SpecialChar ~
9049 Rossum and the whole Python development team, that goes
9049 Rossum and the whole Python development team, that goes
9050 without saying.
9050 without saying.
9051 \layout Standard
9051 \layout Standard
9052
9052
9053 IPython's website is generously hosted at
9053 IPython's website is generously hosted at
9054 \begin_inset LatexCommand \htmlurl{http://ipython.scipy.org}
9054 \begin_inset LatexCommand \htmlurl{http://ipython.scipy.org}
9055
9055
9056 \end_inset
9056 \end_inset
9057
9057
9058 by Enthought (
9058 by Enthought (
9059 \begin_inset LatexCommand \htmlurl{http://www.enthought.com}
9059 \begin_inset LatexCommand \htmlurl{http://www.enthought.com}
9060
9060
9061 \end_inset
9061 \end_inset
9062
9062
9063 ).
9063 ).
9064 I am very grateful to them and all of the SciPy team for their contribution.
9064 I am very grateful to them and all of the SciPy team for their contribution.
9065 \layout Standard
9065 \layout Standard
9066
9066
9067
9067
9068 \begin_inset LatexCommand \label{figgins}
9068 \begin_inset LatexCommand \label{figgins}
9069
9069
9070 \end_inset
9070 \end_inset
9071
9071
9072 Fernando would also like to thank Stephen Figgins
9072 Fernando would also like to thank Stephen Figgins
9073 \family typewriter
9073 \family typewriter
9074 <fig-AT-monitor.net>
9074 <fig-AT-monitor.net>
9075 \family default
9075 \family default
9076 , an O'Reilly Python editor.
9076 , an O'Reilly Python editor.
9077 His Oct/11/2001 article about IPP and LazyPython, was what got this project
9077 His Oct/11/2001 article about IPP and LazyPython, was what got this project
9078 started.
9078 started.
9079 You can read it at:
9079 You can read it at:
9080 \begin_inset LatexCommand \htmlurl{http://www.onlamp.com/pub/a/python/2001/10/11/pythonnews.html}
9080 \begin_inset LatexCommand \htmlurl{http://www.onlamp.com/pub/a/python/2001/10/11/pythonnews.html}
9081
9081
9082 \end_inset
9082 \end_inset
9083
9083
9084 .
9084 .
9085 \layout Standard
9085 \layout Standard
9086
9086
9087 And last but not least, all the kind IPython users who have emailed new
9087 And last but not least, all the kind IPython users who have emailed new
9088 code, bug reports, fixes, comments and ideas.
9088 code, bug reports, fixes, comments and ideas.
9089 A brief list follows, please let me know if I have ommitted your name by
9089 A brief list follows, please let me know if I have ommitted your name by
9090 accident:
9090 accident:
9091 \layout List
9091 \layout List
9092 \labelwidthstring 00.00.0000
9092 \labelwidthstring 00.00.0000
9093
9093
9094 Jack\SpecialChar ~
9094 Jack\SpecialChar ~
9095 Moffit
9095 Moffit
9096 \family typewriter
9096 \family typewriter
9097 <jack-AT-xiph.org>
9097 <jack-AT-xiph.org>
9098 \family default
9098 \family default
9099 Bug fixes, including the infamous color problem.
9099 Bug fixes, including the infamous color problem.
9100 This bug alone caused many lost hours and frustration, many thanks to him
9100 This bug alone caused many lost hours and frustration, many thanks to him
9101 for the fix.
9101 for the fix.
9102 I've always been a fan of Ogg & friends, now I have one more reason to
9102 I've always been a fan of Ogg & friends, now I have one more reason to
9103 like these folks.
9103 like these folks.
9104 \newline
9104 \newline
9105 Jack is also contributing with Debian packaging and many other things.
9105 Jack is also contributing with Debian packaging and many other things.
9106 \layout List
9106 \layout List
9107 \labelwidthstring 00.00.0000
9107 \labelwidthstring 00.00.0000
9108
9108
9109 Alexander\SpecialChar ~
9109 Alexander\SpecialChar ~
9110 Schmolck
9110 Schmolck
9111 \family typewriter
9111 \family typewriter
9112 <a.schmolck-AT-gmx.net>
9112 <a.schmolck-AT-gmx.net>
9113 \family default
9113 \family default
9114 Emacs work, bug reports, bug fixes, ideas, lots more.
9114 Emacs work, bug reports, bug fixes, ideas, lots more.
9115 The ipython.el mode for (X)Emacs is Alex's code, providing full support
9115 The ipython.el mode for (X)Emacs is Alex's code, providing full support
9116 for IPython under (X)Emacs.
9116 for IPython under (X)Emacs.
9117 \layout List
9117 \layout List
9118 \labelwidthstring 00.00.0000
9118 \labelwidthstring 00.00.0000
9119
9119
9120 Andrea\SpecialChar ~
9120 Andrea\SpecialChar ~
9121 Riciputi
9121 Riciputi
9122 \family typewriter
9122 \family typewriter
9123 <andrea.riciputi-AT-libero.it>
9123 <andrea.riciputi-AT-libero.it>
9124 \family default
9124 \family default
9125 Mac OSX information, Fink package management.
9125 Mac OSX information, Fink package management.
9126 \layout List
9126 \layout List
9127 \labelwidthstring 00.00.0000
9127 \labelwidthstring 00.00.0000
9128
9128
9129 Gary\SpecialChar ~
9129 Gary\SpecialChar ~
9130 Bishop
9130 Bishop
9131 \family typewriter
9131 \family typewriter
9132 <gb-AT-cs.unc.edu>
9132 <gb-AT-cs.unc.edu>
9133 \family default
9133 \family default
9134 Bug reports, and patches to work around the exception handling idiosyncracies
9134 Bug reports, and patches to work around the exception handling idiosyncracies
9135 of WxPython.
9135 of WxPython.
9136 Readline and color support for Windows.
9136 Readline and color support for Windows.
9137 \layout List
9137 \layout List
9138 \labelwidthstring 00.00.0000
9138 \labelwidthstring 00.00.0000
9139
9139
9140 Jeffrey\SpecialChar ~
9140 Jeffrey\SpecialChar ~
9141 Collins
9141 Collins
9142 \family typewriter
9142 \family typewriter
9143 <Jeff.Collins-AT-vexcel.com>
9143 <Jeff.Collins-AT-vexcel.com>
9144 \family default
9144 \family default
9145 Bug reports.
9145 Bug reports.
9146 Much improved readline support, including fixes for Python 2.3.
9146 Much improved readline support, including fixes for Python 2.3.
9147 \layout List
9147 \layout List
9148 \labelwidthstring 00.00.0000
9148 \labelwidthstring 00.00.0000
9149
9149
9150 Dryice\SpecialChar ~
9150 Dryice\SpecialChar ~
9151 Liu
9151 Liu
9152 \family typewriter
9152 \family typewriter
9153 <dryice-AT-liu.com.cn>
9153 <dryice-AT-liu.com.cn>
9154 \family default
9154 \family default
9155 FreeBSD port.
9155 FreeBSD port.
9156 \layout List
9156 \layout List
9157 \labelwidthstring 00.00.0000
9157 \labelwidthstring 00.00.0000
9158
9158
9159 Mike\SpecialChar ~
9159 Mike\SpecialChar ~
9160 Heeter
9160 Heeter
9161 \family typewriter
9161 \family typewriter
9162 <korora-AT-SDF.LONESTAR.ORG>
9162 <korora-AT-SDF.LONESTAR.ORG>
9163 \layout List
9163 \layout List
9164 \labelwidthstring 00.00.0000
9164 \labelwidthstring 00.00.0000
9165
9165
9166 Christopher\SpecialChar ~
9166 Christopher\SpecialChar ~
9167 Hart
9167 Hart
9168 \family typewriter
9168 \family typewriter
9169 <hart-AT-caltech.edu>
9169 <hart-AT-caltech.edu>
9170 \family default
9170 \family default
9171 PDB integration.
9171 PDB integration.
9172 \layout List
9172 \layout List
9173 \labelwidthstring 00.00.0000
9173 \labelwidthstring 00.00.0000
9174
9174
9175 Milan\SpecialChar ~
9175 Milan\SpecialChar ~
9176 Zamazal
9176 Zamazal
9177 \family typewriter
9177 \family typewriter
9178 <pdm-AT-zamazal.org>
9178 <pdm-AT-zamazal.org>
9179 \family default
9179 \family default
9180 Emacs info.
9180 Emacs info.
9181 \layout List
9181 \layout List
9182 \labelwidthstring 00.00.0000
9182 \labelwidthstring 00.00.0000
9183
9183
9184 Philip\SpecialChar ~
9184 Philip\SpecialChar ~
9185 Hisley
9185 Hisley
9186 \family typewriter
9186 \family typewriter
9187 <compsys-AT-starpower.net>
9187 <compsys-AT-starpower.net>
9188 \layout List
9188 \layout List
9189 \labelwidthstring 00.00.0000
9189 \labelwidthstring 00.00.0000
9190
9190
9191 Holger\SpecialChar ~
9191 Holger\SpecialChar ~
9192 Krekel
9192 Krekel
9193 \family typewriter
9193 \family typewriter
9194 <pyth-AT-devel.trillke.net>
9194 <pyth-AT-devel.trillke.net>
9195 \family default
9195 \family default
9196 Tab completion, lots more.
9196 Tab completion, lots more.
9197 \layout List
9197 \layout List
9198 \labelwidthstring 00.00.0000
9198 \labelwidthstring 00.00.0000
9199
9199
9200 Robin\SpecialChar ~
9200 Robin\SpecialChar ~
9201 Siebler
9201 Siebler
9202 \family typewriter
9202 \family typewriter
9203 <robinsiebler-AT-starband.net>
9203 <robinsiebler-AT-starband.net>
9204 \layout List
9204 \layout List
9205 \labelwidthstring 00.00.0000
9205 \labelwidthstring 00.00.0000
9206
9206
9207 Ralf\SpecialChar ~
9207 Ralf\SpecialChar ~
9208 Ahlbrink
9208 Ahlbrink
9209 \family typewriter
9209 \family typewriter
9210 <ralf_ahlbrink-AT-web.de>
9210 <ralf_ahlbrink-AT-web.de>
9211 \layout List
9211 \layout List
9212 \labelwidthstring 00.00.0000
9212 \labelwidthstring 00.00.0000
9213
9213
9214 Thorsten\SpecialChar ~
9214 Thorsten\SpecialChar ~
9215 Kampe
9215 Kampe
9216 \family typewriter
9216 \family typewriter
9217 <thorsten-AT-thorstenkampe.de>
9217 <thorsten-AT-thorstenkampe.de>
9218 \layout List
9218 \layout List
9219 \labelwidthstring 00.00.0000
9219 \labelwidthstring 00.00.0000
9220
9220
9221 Fredrik\SpecialChar ~
9221 Fredrik\SpecialChar ~
9222 Kant
9222 Kant
9223 \family typewriter
9223 \family typewriter
9224 <fredrik.kant-AT-front.com>
9224 <fredrik.kant-AT-front.com>
9225 \family default
9225 \family default
9226 Windows setup.
9226 Windows setup.
9227 \layout List
9227 \layout List
9228 \labelwidthstring 00.00.0000
9228 \labelwidthstring 00.00.0000
9229
9229
9230 Syver\SpecialChar ~
9230 Syver\SpecialChar ~
9231 Enstad
9231 Enstad
9232 \family typewriter
9232 \family typewriter
9233 <syver-en-AT-online.no>
9233 <syver-en-AT-online.no>
9234 \family default
9234 \family default
9235 Windows setup.
9235 Windows setup.
9236 \layout List
9236 \layout List
9237 \labelwidthstring 00.00.0000
9237 \labelwidthstring 00.00.0000
9238
9238
9239 Richard
9239 Richard
9240 \family typewriter
9240 \family typewriter
9241 <rxe-AT-renre-europe.com>
9241 <rxe-AT-renre-europe.com>
9242 \family default
9242 \family default
9243 Global embedding.
9243 Global embedding.
9244 \layout List
9244 \layout List
9245 \labelwidthstring 00.00.0000
9245 \labelwidthstring 00.00.0000
9246
9246
9247 Hayden\SpecialChar ~
9247 Hayden\SpecialChar ~
9248 Callow
9248 Callow
9249 \family typewriter
9249 \family typewriter
9250 <h.callow-AT-elec.canterbury.ac.nz>
9250 <h.callow-AT-elec.canterbury.ac.nz>
9251 \family default
9251 \family default
9252 Gnuplot.py 1.6 compatibility.
9252 Gnuplot.py 1.6 compatibility.
9253 \layout List
9253 \layout List
9254 \labelwidthstring 00.00.0000
9254 \labelwidthstring 00.00.0000
9255
9255
9256 Leonardo\SpecialChar ~
9256 Leonardo\SpecialChar ~
9257 Santagada
9257 Santagada
9258 \family typewriter
9258 \family typewriter
9259 <retype-AT-terra.com.br>
9259 <retype-AT-terra.com.br>
9260 \family default
9260 \family default
9261 Fixes for Windows installation.
9261 Fixes for Windows installation.
9262 \layout List
9262 \layout List
9263 \labelwidthstring 00.00.0000
9263 \labelwidthstring 00.00.0000
9264
9264
9265 Christopher\SpecialChar ~
9265 Christopher\SpecialChar ~
9266 Armstrong
9266 Armstrong
9267 \family typewriter
9267 \family typewriter
9268 <radix-AT-twistedmatrix.com>
9268 <radix-AT-twistedmatrix.com>
9269 \family default
9269 \family default
9270 Bugfixes.
9270 Bugfixes.
9271 \layout List
9271 \layout List
9272 \labelwidthstring 00.00.0000
9272 \labelwidthstring 00.00.0000
9273
9273
9274 Francois\SpecialChar ~
9274 Francois\SpecialChar ~
9275 Pinard
9275 Pinard
9276 \family typewriter
9276 \family typewriter
9277 <pinard-AT-iro.umontreal.ca>
9277 <pinard-AT-iro.umontreal.ca>
9278 \family default
9278 \family default
9279 Code and documentation fixes.
9279 Code and documentation fixes.
9280 \layout List
9280 \layout List
9281 \labelwidthstring 00.00.0000
9281 \labelwidthstring 00.00.0000
9282
9282
9283 Cory\SpecialChar ~
9283 Cory\SpecialChar ~
9284 Dodt
9284 Dodt
9285 \family typewriter
9285 \family typewriter
9286 <cdodt-AT-fcoe.k12.ca.us>
9286 <cdodt-AT-fcoe.k12.ca.us>
9287 \family default
9287 \family default
9288 Bug reports and Windows ideas.
9288 Bug reports and Windows ideas.
9289 Patches for Windows installer.
9289 Patches for Windows installer.
9290 \layout List
9290 \layout List
9291 \labelwidthstring 00.00.0000
9291 \labelwidthstring 00.00.0000
9292
9292
9293 Olivier\SpecialChar ~
9293 Olivier\SpecialChar ~
9294 Aubert
9294 Aubert
9295 \family typewriter
9295 \family typewriter
9296 <oaubert-AT-bat710.univ-lyon1.fr>
9296 <oaubert-AT-bat710.univ-lyon1.fr>
9297 \family default
9297 \family default
9298 New magics.
9298 New magics.
9299 \layout List
9299 \layout List
9300 \labelwidthstring 00.00.0000
9300 \labelwidthstring 00.00.0000
9301
9301
9302 King\SpecialChar ~
9302 King\SpecialChar ~
9303 C.\SpecialChar ~
9303 C.\SpecialChar ~
9304 Shu
9304 Shu
9305 \family typewriter
9305 \family typewriter
9306 <kingshu-AT-myrealbox.com>
9306 <kingshu-AT-myrealbox.com>
9307 \family default
9307 \family default
9308 Autoindent patch.
9308 Autoindent patch.
9309 \layout List
9309 \layout List
9310 \labelwidthstring 00.00.0000
9310 \labelwidthstring 00.00.0000
9311
9311
9312 Chris\SpecialChar ~
9312 Chris\SpecialChar ~
9313 Drexler
9313 Drexler
9314 \family typewriter
9314 \family typewriter
9315 <chris-AT-ac-drexler.de>
9315 <chris-AT-ac-drexler.de>
9316 \family default
9316 \family default
9317 Readline packages for Win32/CygWin.
9317 Readline packages for Win32/CygWin.
9318 \layout List
9318 \layout List
9319 \labelwidthstring 00.00.0000
9319 \labelwidthstring 00.00.0000
9320
9320
9321 Gustavo\SpecialChar ~
9321 Gustavo\SpecialChar ~
9322 Cordova\SpecialChar ~
9322 Cordova\SpecialChar ~
9323 Avila
9323 Avila
9324 \family typewriter
9324 \family typewriter
9325 <gcordova-AT-sismex.com>
9325 <gcordova-AT-sismex.com>
9326 \family default
9326 \family default
9327 EvalDict code for nice, lightweight string interpolation.
9327 EvalDict code for nice, lightweight string interpolation.
9328 \layout List
9328 \layout List
9329 \labelwidthstring 00.00.0000
9329 \labelwidthstring 00.00.0000
9330
9330
9331 Kasper\SpecialChar ~
9331 Kasper\SpecialChar ~
9332 Souren
9332 Souren
9333 \family typewriter
9333 \family typewriter
9334 <Kasper.Souren-AT-ircam.fr>
9334 <Kasper.Souren-AT-ircam.fr>
9335 \family default
9335 \family default
9336 Bug reports, ideas.
9336 Bug reports, ideas.
9337 \layout List
9337 \layout List
9338 \labelwidthstring 00.00.0000
9338 \labelwidthstring 00.00.0000
9339
9339
9340 Gever\SpecialChar ~
9340 Gever\SpecialChar ~
9341 Tulley
9341 Tulley
9342 \family typewriter
9342 \family typewriter
9343 <gever-AT-helium.com>
9343 <gever-AT-helium.com>
9344 \family default
9344 \family default
9345 Code contributions.
9345 Code contributions.
9346 \layout List
9346 \layout List
9347 \labelwidthstring 00.00.0000
9347 \labelwidthstring 00.00.0000
9348
9348
9349 Ralf\SpecialChar ~
9349 Ralf\SpecialChar ~
9350 Schmitt
9350 Schmitt
9351 \family typewriter
9351 \family typewriter
9352 <ralf-AT-brainbot.com>
9352 <ralf-AT-brainbot.com>
9353 \family default
9353 \family default
9354 Bug reports & fixes.
9354 Bug reports & fixes.
9355 \layout List
9355 \layout List
9356 \labelwidthstring 00.00.0000
9356 \labelwidthstring 00.00.0000
9357
9357
9358 Oliver\SpecialChar ~
9358 Oliver\SpecialChar ~
9359 Sander
9359 Sander
9360 \family typewriter
9360 \family typewriter
9361 <osander-AT-gmx.de>
9361 <osander-AT-gmx.de>
9362 \family default
9362 \family default
9363 Bug reports.
9363 Bug reports.
9364 \layout List
9364 \layout List
9365 \labelwidthstring 00.00.0000
9365 \labelwidthstring 00.00.0000
9366
9366
9367 Rod\SpecialChar ~
9367 Rod\SpecialChar ~
9368 Holland
9368 Holland
9369 \family typewriter
9369 \family typewriter
9370 <rhh-AT-structurelabs.com>
9370 <rhh-AT-structurelabs.com>
9371 \family default
9371 \family default
9372 Bug reports and fixes to logging module.
9372 Bug reports and fixes to logging module.
9373 \layout List
9373 \layout List
9374 \labelwidthstring 00.00.0000
9374 \labelwidthstring 00.00.0000
9375
9375
9376 Daniel\SpecialChar ~
9376 Daniel\SpecialChar ~
9377 'Dang'\SpecialChar ~
9377 'Dang'\SpecialChar ~
9378 Griffith
9378 Griffith
9379 \family typewriter
9379 \family typewriter
9380 <pythondev-dang-AT-lazytwinacres.net>
9380 <pythondev-dang-AT-lazytwinacres.net>
9381 \family default
9381 \family default
9382 Fixes, enhancement suggestions for system shell use.
9382 Fixes, enhancement suggestions for system shell use.
9383 \layout List
9383 \layout List
9384 \labelwidthstring 00.00.0000
9384 \labelwidthstring 00.00.0000
9385
9385
9386 Viktor\SpecialChar ~
9386 Viktor\SpecialChar ~
9387 Ransmayr
9387 Ransmayr
9388 \family typewriter
9388 \family typewriter
9389 <viktor.ransmayr-AT-t-online.de>
9389 <viktor.ransmayr-AT-t-online.de>
9390 \family default
9390 \family default
9391 Tests and reports on Windows installation issues.
9391 Tests and reports on Windows installation issues.
9392 Contributed a true Windows binary installer.
9392 Contributed a true Windows binary installer.
9393 \layout List
9393 \layout List
9394 \labelwidthstring 00.00.0000
9394 \labelwidthstring 00.00.0000
9395
9395
9396 Mike\SpecialChar ~
9396 Mike\SpecialChar ~
9397 Salib
9397 Salib
9398 \family typewriter
9398 \family typewriter
9399 <msalib-AT-mit.edu>
9399 <msalib-AT-mit.edu>
9400 \family default
9400 \family default
9401 Help fixing a subtle bug related to traceback printing.
9401 Help fixing a subtle bug related to traceback printing.
9402 \layout List
9402 \layout List
9403 \labelwidthstring 00.00.0000
9403 \labelwidthstring 00.00.0000
9404
9404
9405 W.J.\SpecialChar ~
9405 W.J.\SpecialChar ~
9406 van\SpecialChar ~
9406 van\SpecialChar ~
9407 der\SpecialChar ~
9407 der\SpecialChar ~
9408 Laan
9408 Laan
9409 \family typewriter
9409 \family typewriter
9410 <gnufnork-AT-hetdigitalegat.nl>
9410 <gnufnork-AT-hetdigitalegat.nl>
9411 \family default
9411 \family default
9412 Bash-like prompt specials.
9412 Bash-like prompt specials.
9413 \layout List
9413 \layout List
9414 \labelwidthstring 00.00.0000
9414 \labelwidthstring 00.00.0000
9415
9415
9416 Antoon\SpecialChar ~
9416 Antoon\SpecialChar ~
9417 Pardon
9417 Pardon
9418 \family typewriter
9418 \family typewriter
9419 <Antoon.Pardon-AT-rece.vub.ac.be>
9419 <Antoon.Pardon-AT-rece.vub.ac.be>
9420 \family default
9420 \family default
9421 Critical fix for the multithreaded IPython.
9421 Critical fix for the multithreaded IPython.
9422 \layout List
9422 \layout List
9423 \labelwidthstring 00.00.0000
9423 \labelwidthstring 00.00.0000
9424
9424
9425 John\SpecialChar ~
9425 John\SpecialChar ~
9426 Hunter
9426 Hunter
9427 \family typewriter
9427 \family typewriter
9428 <jdhunter-AT-nitace.bsd.uchicago.edu>
9428 <jdhunter-AT-nitace.bsd.uchicago.edu>
9429 \family default
9429 \family default
9430 Matplotlib author, helped with all the development of support for matplotlib
9430 Matplotlib author, helped with all the development of support for matplotlib
9431 in IPyhton, including making necessary changes to matplotlib itself.
9431 in IPyhton, including making necessary changes to matplotlib itself.
9432 \layout List
9432 \layout List
9433 \labelwidthstring 00.00.0000
9433 \labelwidthstring 00.00.0000
9434
9434
9435 Matthew\SpecialChar ~
9435 Matthew\SpecialChar ~
9436 Arnison
9436 Arnison
9437 \family typewriter
9437 \family typewriter
9438 <maffew-AT-cat.org.au>
9438 <maffew-AT-cat.org.au>
9439 \family default
9439 \family default
9440 Bug reports, `
9440 Bug reports, `
9441 \family typewriter
9441 \family typewriter
9442 %run -d
9442 %run -d
9443 \family default
9443 \family default
9444 ' idea.
9444 ' idea.
9445 \layout List
9445 \layout List
9446 \labelwidthstring 00.00.0000
9446 \labelwidthstring 00.00.0000
9447
9447
9448 Prabhu\SpecialChar ~
9448 Prabhu\SpecialChar ~
9449 Ramachandran
9449 Ramachandran
9450 \family typewriter
9450 \family typewriter
9451 <prabhu_r-AT-users.sourceforge.net>
9451 <prabhu_r-AT-users.sourceforge.net>
9452 \family default
9452 \family default
9453 Help with (X)Emacs support, threading patches, ideas...
9453 Help with (X)Emacs support, threading patches, ideas...
9454 \layout List
9454 \layout List
9455 \labelwidthstring 00.00.0000
9455 \labelwidthstring 00.00.0000
9456
9456
9457 Norbert\SpecialChar ~
9457 Norbert\SpecialChar ~
9458 Tretkowski
9458 Tretkowski
9459 \family typewriter
9459 \family typewriter
9460 <tretkowski-AT-inittab.de>
9460 <tretkowski-AT-inittab.de>
9461 \family default
9461 \family default
9462 help with Debian packaging and distribution.
9462 help with Debian packaging and distribution.
9463 \layout List
9463 \layout List
9464 \labelwidthstring 00.00.0000
9464 \labelwidthstring 00.00.0000
9465
9465
9466 George\SpecialChar ~
9466 George\SpecialChar ~
9467 Sakkis <
9467 Sakkis <
9468 \family typewriter
9468 \family typewriter
9469 gsakkis-AT-eden.rutgers.edu>
9469 gsakkis-AT-eden.rutgers.edu>
9470 \family default
9470 \family default
9471 New matcher for tab-completing named arguments of user-defined functions.
9471 New matcher for tab-completing named arguments of user-defined functions.
9472 \layout List
9472 \layout List
9473 \labelwidthstring 00.00.0000
9473 \labelwidthstring 00.00.0000
9474
9474
9475 JοΏ½rgen\SpecialChar ~
9475 JοΏ½rgen\SpecialChar ~
9476 Stenarson
9476 Stenarson
9477 \family typewriter
9477 \family typewriter
9478 <jorgen.stenarson-AT-bostream.nu>
9478 <jorgen.stenarson-AT-bostream.nu>
9479 \family default
9479 \family default
9480 Wildcard support implementation for searching namespaces.
9480 Wildcard support implementation for searching namespaces.
9481 \layout List
9481 \layout List
9482 \labelwidthstring 00.00.0000
9482 \labelwidthstring 00.00.0000
9483
9483
9484 Vivian\SpecialChar ~
9484 Vivian\SpecialChar ~
9485 De\SpecialChar ~
9485 De\SpecialChar ~
9486 Smedt
9486 Smedt
9487 \family typewriter
9487 \family typewriter
9488 <vivian-AT-vdesmedt.com>
9488 <vivian-AT-vdesmedt.com>
9489 \family default
9489 \family default
9490 Debugger enhancements, so that when pdb is activated from within IPython,
9490 Debugger enhancements, so that when pdb is activated from within IPython,
9491 coloring, tab completion and other features continue to work seamlessly.
9491 coloring, tab completion and other features continue to work seamlessly.
9492 \layout List
9492 \layout List
9493 \labelwidthstring 00.00.0000
9493 \labelwidthstring 00.00.0000
9494
9494
9495 Scott\SpecialChar ~
9495 Scott\SpecialChar ~
9496 Tsai
9496 Tsai
9497 \family typewriter
9497 \family typewriter
9498 <scottt958-AT-yahoo.com.tw>
9498 <scottt958-AT-yahoo.com.tw>
9499 \family default
9499 \family default
9500 Support for automatic editor invocation on syntax errors (see
9500 Support for automatic editor invocation on syntax errors (see
9501 \begin_inset LatexCommand \htmlurl{http://www.scipy.net/roundup/ipython/issue36}
9501 \begin_inset LatexCommand \htmlurl{http://www.scipy.net/roundup/ipython/issue36}
9502
9502
9503 \end_inset
9503 \end_inset
9504
9504
9505 ).
9505 ).
9506 \layout List
9506 \layout List
9507 \labelwidthstring 00.00.0000
9507 \labelwidthstring 00.00.0000
9508
9508
9509 Alexander\SpecialChar ~
9509 Alexander\SpecialChar ~
9510 Belchenko
9510 Belchenko
9511 \family typewriter
9511 \family typewriter
9512 <bialix-AT-ukr.net>
9512 <bialix-AT-ukr.net>
9513 \family default
9513 \family default
9514 Improvements for win32 paging system.
9514 Improvements for win32 paging system.
9515 \layout List
9516 \labelwidthstring 00.00.0000
9517
9518 Will\SpecialChar ~
9519 Maier
9520 \family typewriter
9521 <willmaier-AT-ml1.net>
9522 \family default
9523 Official OpenBSD port.
9515 \the_end
9524 \the_end
@@ -1,102 +1,102 b''
1 #!/bin/sh
1 #!/bin/sh
2 # IPython release script
2 # IPython release script
3
3
4 PYVER=`python -V 2>&1 | awk '{print $2}' | awk -F '.' '{print $1$2}' `
4 PYVER=`python -V 2>&1 | awk '{print $2}' | awk -F '.' '{print $1$2}' `
5 version=`ipython -Version`
5 version=`ipython -Version`
6 ipdir=~/ipython/ipython
6 ipdir=~/ipython/ipython
7
7
8 echo
8 echo
9 echo "Releasing IPython version $version"
9 echo "Releasing IPython version $version"
10 echo "=================================="
10 echo "=================================="
11
11
12 echo "Marking ChangeLog with release information and making NEWS file..."
12 echo "Marking ChangeLog with release information and making NEWS file..."
13
13
14 # Stamp changelog and save a copy of the status at each version, in case later
14 # Stamp changelog and save a copy of the status at each version, in case later
15 # we want the NEWS file to start from a point before the very last release (if
15 # we want the NEWS file to start from a point before the very last release (if
16 # very small interim releases have no significant changes).
16 # very small interim releases have no significant changes).
17
17
18 cd $ipdir/doc
18 cd $ipdir/doc
19 cp ChangeLog ChangeLog.old
19 cp ChangeLog ChangeLog.old
20 cp ChangeLog ChangeLog.$version
20 cp ChangeLog ChangeLog.$version
21 daystamp=`date +%Y-%m-%d`
21 daystamp=`date +%Y-%m-%d`
22 echo $daystamp " ***" Released version $version > ChangeLog
22 echo $daystamp " ***" Released version $version > ChangeLog
23 echo >> ChangeLog
23 echo >> ChangeLog
24 cat ChangeLog.old >> ChangeLog
24 cat ChangeLog.old >> ChangeLog
25 rm ChangeLog.old
25 rm ChangeLog.old
26
26
27 # Build NEWS file
27 # Build NEWS file
28 echo "Changes between the last two releases (major or minor)" > NEWS
28 echo "Changes between the last two releases (major or minor)" > NEWS
29 echo "Note that this is an auto-generated diff of the ChangeLogs" >> NEWS
29 echo "Note that this is an auto-generated diff of the ChangeLogs" >> NEWS
30 echo >> NEWS
30 echo >> NEWS
31 diff ChangeLog.previous ChangeLog | grep -v '^0a' | sed 's/^> //g' >> NEWS
31 diff ChangeLog.previous ChangeLog | grep -v '^0a' | sed 's/^> //g' >> NEWS
32 cp ChangeLog ChangeLog.previous
32 cp ChangeLog ChangeLog.previous
33
33
34 # Clean up build/dist directories
34 # Clean up build/dist directories
35 rm -rf $ipdir/build/*
35 rm -rf $ipdir/build/*
36 rm -rf $ipdir/dist/*
36 rm -rf $ipdir/dist/*
37
37
38 # Perform local backup
38 # Perform local backup
39 cd $ipdir/tools
39 cd $ipdir/tools
40 ./bkp.py
40 ./bkp.py
41
41
42 # Build source and binary distros
42 # Build source and binary distros
43 cd $ipdir
43 cd $ipdir
44 ./setup.py sdist --formats=gztar
44 ./setup.py sdist --formats=gztar
45 #./setup.py bdist_rpm --release=py$PYVER
45 #./setup.py bdist_rpm --release=py$PYVER
46 python2.3 ./setup.py bdist_rpm --release=py23 --python=/usr/bin/python2.3
46 python2.3 ./setup.py bdist_rpm --release=py23 --python=/usr/bin/python2.3
47
47
48 # A 2.4-specific RPM, where we must use the --python option to ensure that
48 # A 2.4-specific RPM, where we must use the --python option to ensure that
49 # the resulting RPM is really built with 2.4 (so things go to
49 # the resulting RPM is really built with 2.4 (so things go to
50 # lib/python2.4/...)
50 # lib/python2.4/...)
51 python2.4 ./setup.py bdist_rpm --release=py24 --python=/usr/bin/python2.4
51 python2.4 ./setup.py bdist_rpm --release=py24 --python=/usr/bin/python2.4
52
52
53 # Build eggs
53 # Build eggs
54 python2.3 ./eggsetup.py bdist_egg
54 python2.3 ./eggsetup.py bdist_egg
55 python2.4 ./eggsetup.py bdist_egg
55 python2.4 ./eggsetup.py bdist_egg
56
56
57 # Call the windows build separately, so that the extra Windows scripts don't
57 # Call the windows build separately, so that the extra Windows scripts don't
58 # get pulled into Unix builds (setup.py has code which checks for
58 # get pulled into Unix builds (setup.py has code which checks for
59 # bdist_wininst)
59 # bdist_wininst)
60 #./setup.py bdist_wininst --install-script=ipython_win_post_install.py
60 #./setup.py bdist_wininst --install-script=ipython_win_post_install.py
61
61
62 # For now, make the win32 installer with a hand-built 2.3.5 python, which is
62 # For now, make the win32 installer with a hand-built 2.3.5 python, which is
63 # the only one that fixes a crash in the post-install phase.
63 # the only one that fixes a crash in the post-install phase.
64 $HOME/tmp/local/bin/python2.3 setup.py bdist_wininst \
64 $HOME/tmp/local/bin/python2.3 setup.py bdist_wininst \
65 --install-script=ipython_win_post_install.py
65 --install-script=ipython_win_post_install.py
66
66
67 # Register with the Python Package Index (PyPI)
67 # Register with the Python Package Index (PyPI)
68 echo "Registering with PyPI..."
68 echo "Registering with PyPI..."
69 cd $ipdir
69 cd $ipdir
70 ./setup.py register
70 ./setup.py register
71
71
72 # Upload all files
72 # Upload all files
73 cd $ipdir/dist
73 cd $ipdir/dist
74 echo "Uploading distribution files..."
74 echo "Uploading distribution files..."
75 scp * ipython@ipython.scipy.org:www/dist/
75 scp * ipython@ipython.scipy.org:www/dist/
76
76
77 echo "Uploading backup files..."
77 echo "Uploading backup files..."
78 cd ~/ipython/backup
78 cd ~/ipython/backup
79 scp `ls -1tr | tail -1` ipython@ipython.scipy.org:www/backup/
79 scp `ls -1tr | tail -1` ipython@ipython.scipy.org:www/backup/
80
80
81 echo "Updating webpage..."
81 echo "Updating webpage..."
82 cd $ipdir/doc
82 cd $ipdir/doc
83 www=~/ipython/homepage
83 www=~/ipython/homepage
84 cp ChangeLog NEWS $www
84 cp ChangeLog NEWS $www
85 rm -rf $www/doc/*
85 rm -rf $www/doc/*
86 cp -r manual.pdf manual/ $www/doc
86 cp -r manual.pdf manual/ $www/doc
87 cd $www
87 cd $www
88 ./update
88 ./update
89
89
90 # Alert package maintainers
90 # Alert package maintainers
91 echo "Alerting package maintainers..."
91 echo "Alerting package maintainers..."
92 maintainers='fperez@colorado.edu ariciputi@users.sourceforge.net jack@xiph.org tretkowski@inittab.de dryice@hotpop.com'
92 maintainers='fperez@colorado.edu ariciputi@users.sourceforge.net jack@xiph.org tretkowski@inittab.de dryice@hotpop.com willmaier@ml1.net'
93 #maintainers='fperez@colorado.edu'
93 #maintainers='fperez@colorado.edu'
94
94
95 for email in $maintainers
95 for email in $maintainers
96 do
96 do
97 echo "Emailing $email..."
97 echo "Emailing $email..."
98 mail -s "[Package maintainer notice] A new IPython is out. Version: $version" \
98 mail -s "[Package maintainer notice] A new IPython is out. Version: $version" \
99 $email < NEWS
99 $email < NEWS
100 done
100 done
101
101
102 echo "Done!"
102 echo "Done!"
General Comments 0
You need to be logged in to leave comments. Login now