##// END OF EJS Templates
- new doctest_mode magic to toggle doctest pasting/prompts....
fperez -
Show More
@@ -1,118 +1,122 b''
1 # -*- coding: utf-8 -*-
1 # -*- coding: utf-8 -*-
2 """Modified input prompt for entering text with >>> or ... at the start.
2 """Modified input prompt for entering text with >>> or ... at the start.
3
3
4 We define a special input line filter to allow typing lines which begin with
4 We define a special input line filter to allow typing lines which begin with
5 '>>> ' or '... '. These two strings, if present at the start of the input
5 '>>> ' or '... '. These two strings, if present at the start of the input
6 line, are stripped. This allows for direct pasting of code from examples such
6 line, are stripped. This allows for direct pasting of code from examples such
7 as those available in the standard Python tutorial.
7 as those available in the standard Python tutorial.
8
8
9 Normally pasting such code is one chunk is impossible because of the
9 Normally pasting such code is one chunk is impossible because of the
10 extraneous >>> and ..., requiring one to do a line by line paste with careful
10 extraneous >>> and ..., requiring one to do a line by line paste with careful
11 removal of those characters. This module allows pasting that kind of
11 removal of those characters. This module allows pasting that kind of
12 multi-line examples in one pass.
12 multi-line examples in one pass.
13
13
14 Here is an 'screenshot' of a section of the tutorial pasted into IPython with
14 Here is an 'screenshot' of a section of the tutorial pasted into IPython with
15 this feature enabled:
15 this feature enabled:
16
16
17 In [1]: >>> def fib2(n): # return Fibonacci series up to n
17 In [1]: >>> def fib2(n): # return Fibonacci series up to n
18 ...: ... '''Return a list containing the Fibonacci series up to n.'''
18 ...: ... '''Return a list containing the Fibonacci series up to n.'''
19 ...: ... result = []
19 ...: ... result = []
20 ...: ... a, b = 0, 1
20 ...: ... a, b = 0, 1
21 ...: ... while b < n:
21 ...: ... while b < n:
22 ...: ... result.append(b) # see below
22 ...: ... result.append(b) # see below
23 ...: ... a, b = b, a+b
23 ...: ... a, b = b, a+b
24 ...: ... return result
24 ...: ... return result
25 ...:
25 ...:
26
26
27 In [2]: fib2(10)
27 In [2]: fib2(10)
28 Out[2]: [1, 1, 2, 3, 5, 8]
28 Out[2]: [1, 1, 2, 3, 5, 8]
29
29
30 The >>> and ... are stripped from the input so that the python interpreter
30 The >>> and ... are stripped from the input so that the python interpreter
31 only sees the real part of the code.
31 only sees the real part of the code.
32
32
33 All other input is processed normally.
33 All other input is processed normally.
34
34
35 Notes
35 Notes
36 =====
36 =====
37
37
38 * You can even paste code that has extra initial spaces, such as is common in
38 * You can even paste code that has extra initial spaces, such as is common in
39 doctests:
39 doctests:
40
40
41 In [3]: >>> a = ['Mary', 'had', 'a', 'little', 'lamb']
41 In [3]: >>> a = ['Mary', 'had', 'a', 'little', 'lamb']
42
42
43 In [4]: >>> for i in range(len(a)):
43 In [4]: >>> for i in range(len(a)):
44 ...: ... print i, a[i]
44 ...: ... print i, a[i]
45 ...: ...
45 ...: ...
46 0 Mary
46 0 Mary
47 1 had
47 1 had
48 2 a
48 2 a
49 3 little
49 3 little
50 4 lamb
50 4 lamb
51 """
51 """
52
52
53 #*****************************************************************************
53 #*****************************************************************************
54 # Copyright (C) 2001-2006 Fernando Perez <fperez@colorado.edu>
54 # Copyright (C) 2001-2006 Fernando Perez <fperez@colorado.edu>
55 #
55 #
56 # Distributed under the terms of the BSD License. The full license is in
56 # Distributed under the terms of the BSD License. The full license is in
57 # the file COPYING, distributed as part of this software.
57 # the file COPYING, distributed as part of this software.
58 #*****************************************************************************
58 #*****************************************************************************
59
59
60 from IPython import Release
60 from IPython import Release
61 __author__ = '%s <%s>' % Release.authors['Fernando']
61 __author__ = '%s <%s>' % Release.authors['Fernando']
62 __license__ = Release.license
62 __license__ = Release.license
63
63
64 # This file is an example of how to modify IPython's line-processing behavior
64 # This file is an example of how to modify IPython's line-processing behavior
65 # without touching the internal code. We'll define an alternate pre-processing
65 # without touching the internal code. We'll define an alternate pre-processing
66 # stage which allows a special form of input (which is invalid Python syntax)
66 # stage which allows a special form of input (which is invalid Python syntax)
67 # for certain quantities, rewrites a line of proper Python in those cases, and
67 # for certain quantities, rewrites a line of proper Python in those cases, and
68 # then passes it off to IPython's normal processor for further work.
68 # then passes it off to IPython's normal processor for further work.
69
69
70 # With this kind of customization, IPython can be adapted for many
70 # With this kind of customization, IPython can be adapted for many
71 # special-purpose scenarios providing alternate input syntaxes.
71 # special-purpose scenarios providing alternate input syntaxes.
72
72
73 # This file can be imported like a regular module.
73 # This file can be imported like a regular module.
74
74
75 # IPython has a prefilter() function that analyzes each input line. We redefine
75 # IPython has a prefilter() function that analyzes each input line. We redefine
76 # it here to first pre-process certain forms of input
76 # it here to first pre-process certain forms of input
77
77
78 # The prototype of any alternate prefilter must be like this one (the name
78 # The prototype of any alternate prefilter must be like this one (the name
79 # doesn't matter):
79 # doesn't matter):
80 # - line is a string containing the user input line.
80 # - line is a string containing the user input line.
81 # - continuation is a parameter which tells us if we are processing a first
81 # - continuation is a parameter which tells us if we are processing a first
82 # line of user input or the second or higher of a multi-line statement.
82 # line of user input or the second or higher of a multi-line statement.
83
83
84 import re
84 import re
85
85
86 from IPython.iplib import InteractiveShell
87
86 PROMPT_RE = re.compile(r'(^[ \t]*>>> |^[ \t]*\.\.\. )')
88 PROMPT_RE = re.compile(r'(^[ \t]*>>> |^[ \t]*\.\.\. )')
87
89
88 def prefilter_paste(self,line,continuation):
90 def prefilter_paste(self,line,continuation):
89 """Alternate prefilter for input of pasted code from an interpreter.
91 """Alternate prefilter for input of pasted code from an interpreter.
90 """
92 """
91 if not line:
93 if not line:
92 return ''
94 return ''
93 m = PROMPT_RE.match(line)
95 m = PROMPT_RE.match(line)
94 if m:
96 if m:
95 # In the end, always call the default IPython _prefilter() function.
97 # In the end, always call the default IPython _prefilter() function.
96 # Note that self must be passed explicitly, b/c we're calling the
98 # Note that self must be passed explicitly, b/c we're calling the
97 # unbound class method (since this method will overwrite the instance
99 # unbound class method (since this method will overwrite the instance
98 # prefilter())
100 # prefilter())
99 return self._prefilter(line[len(m.group(0)):],continuation)
101 return self._prefilter(line[len(m.group(0)):],continuation)
100 elif line.strip() == '...':
102 elif line.strip() == '...':
101 return self._prefilter('',continuation)
103 return self._prefilter('',continuation)
102 elif line.isspace():
104 elif line.isspace():
103 # This allows us to recognize multiple input prompts separated by blank
105 # This allows us to recognize multiple input prompts separated by blank
104 # lines and pasted in a single chunk, very common when pasting doctests
106 # lines and pasted in a single chunk, very common when pasting doctests
105 # or long tutorial passages.
107 # or long tutorial passages.
106 return ''
108 return ''
107 else:
109 else:
108 return self._prefilter(line,continuation)
110 return self._prefilter(line,continuation)
109
111
110 # Rebind this to be the new IPython prefilter:
112 def activate_prefilter():
111 from IPython.iplib import InteractiveShell
113 """Rebind the input-pasting filter to be the new IPython prefilter"""
112 InteractiveShell.prefilter = prefilter_paste
114 InteractiveShell.prefilter = prefilter_paste
113
115
114 # Clean up the namespace.
116 def deactivate_prefilter():
115 del InteractiveShell,prefilter_paste
117 """Reset the filter."""
118 InteractiveShell.prefilter = InteractiveShell._prefilter
116
119
117 # Just a heads up at the console
120 # Just a heads up at the console
121 activate_prefilter()
118 print '*** Pasting of code with ">>>" or "..." has been enabled.'
122 print '*** Pasting of code with ">>>" or "..." has been enabled.'
@@ -1,45 +1,48 b''
1 """Config file for 'doctest' profile.
1 """Config file for 'doctest' profile.
2
2
3 This profile modifies the prompts to be the standard Python ones, so that you
3 This profile modifies the prompts to be the standard Python ones, so that you
4 can generate easily doctests from an IPython session.
4 can generate easily doctests from an IPython session.
5
5
6 But more importantly, it enables pasting of code with '>>>' prompts and
6 But more importantly, it enables pasting of code with '>>>' prompts and
7 arbitrary initial whitespace, as is typical of doctests in reST files and
7 arbitrary initial whitespace, as is typical of doctests in reST files and
8 docstrings. This allows you to easily re-run existing doctests and iteratively
8 docstrings. This allows you to easily re-run existing doctests and iteratively
9 work on them as part of your development workflow.
9 work on them as part of your development workflow.
10
10
11 The exception mode is also set to 'plain' so the generated exceptions are as
11 The exception mode is also set to 'plain' so the generated exceptions are as
12 similar as possible to the default Python ones, for inclusion in doctests."""
12 similar as possible to the default Python ones, for inclusion in doctests."""
13
13
14 # get various stuff that are there for historical / familiarity reasons
14 # get various stuff that are there for historical / familiarity reasons
15 import ipy_legacy
15 import ipy_legacy
16
16
17 from IPython import ipapi
17 from IPython import ipapi
18
18
19 from IPython.Extensions import InterpreterPasteInput
19 from IPython.Extensions import InterpreterPasteInput
20
20
21 def main():
21 def main():
22 ip = ipapi.get()
22 ip = ipapi.get()
23 o = ip.options
23 o = ip.options
24
24
25 # Set the prompts similar to the defaults
25 # Set the prompts similar to the defaults
26 o.prompt_in1 = '>>> '
26 o.prompt_in1 = '>>> '
27 o.prompt_in2 = '... '
27 o.prompt_in2 = '... '
28 o.prompt_out = ''
28 o.prompt_out = ''
29
29
30 # No separation between successive inputs
30 # No separation between successive inputs
31 o.separate_in = ''
31 o.separate_in = ''
32 o.separate_out = ''
32 o.separate_out = ''
33 # But add a blank line after any output, to help separate doctests from
33 # But add a blank line after any output, to help separate doctests from
34 # each other. This is needed by doctest to distinguish each test from the
34 # each other. This is needed by doctest to distinguish each test from the
35 # next.
35 # next.
36 o.separate_out2 = '\n'
36 o.separate_out2 = '\n'
37
37
38 # Disable pprint, so that outputs are printed as similarly to standard
38 # Disable pprint, so that outputs are printed as similarly to standard
39 # python as possible
39 # python as possible
40 o.pprint = False
40 o.pprint = False
41
41
42 # Use plain exceptions, to also resemble normal pyhton.
42 # Use plain exceptions, to also resemble normal pyhton.
43 o.xmode = 'plain'
43 o.xmode = 'plain'
44
44
45 # Store the activity flag in the metadata bag from the running shell
46 ip.IP.meta.doctest_mode = True
47
45 main()
48 main()
@@ -1,25 +1,25 b''
1 """ IPython 'sci' profile
1 """ IPython 'sci' profile
2
2
3 Replaces the old scipy profile.
3 Replaces the old scipy profile.
4
4
5 """
5 """
6
6
7
7
8 import IPython.ipapi
8 import IPython.ipapi
9 import ipy_defaults
9 import ipy_defaults
10
10
11 def main():
11 def main():
12 ip = IPython.ipapi.get()
12 ip = IPython.ipapi.get()
13
13
14 try:
14 try:
15 ip.ex("import scipy")
16 ip.ex("import numpy")
15 ip.ex("import numpy")
16 ip.ex("import scipy")
17
17
18 ip.ex("from scipy import *")
19 ip.ex("from numpy import *")
18 ip.ex("from numpy import *")
19 ip.ex("from scipy import *")
20 print "SciPy profile successfully loaded."
20 print "SciPy profile successfully loaded."
21 except ImportError:
21 except ImportError:
22 print "Unable to start scipy profile, are scipy and numpy installed?"
22 print "Unable to start scipy profile, are scipy and numpy installed?"
23
23
24
24
25 main()
25 main()
@@ -1,2915 +1,3001 b''
1 # -*- coding: utf-8 -*-
1 # -*- coding: utf-8 -*-
2 """Magic functions for InteractiveShell.
2 """Magic functions for InteractiveShell.
3
3
4 $Id: Magic.py 2595 2007-08-08 09:41:33Z vivainio $"""
4 $Id: Magic.py 2601 2007-08-10 07:01:29Z fperez $"""
5
5
6 #*****************************************************************************
6 #*****************************************************************************
7 # Copyright (C) 2001 Janko Hauser <jhauser@zscout.de> and
7 # Copyright (C) 2001 Janko Hauser <jhauser@zscout.de> and
8 # Copyright (C) 2001-2006 Fernando Perez <fperez@colorado.edu>
8 # Copyright (C) 2001-2006 Fernando Perez <fperez@colorado.edu>
9 #
9 #
10 # Distributed under the terms of the BSD License. The full license is in
10 # Distributed under the terms of the BSD License. The full license is in
11 # the file COPYING, distributed as part of this software.
11 # the file COPYING, distributed as part of this software.
12 #*****************************************************************************
12 #*****************************************************************************
13
13
14 #****************************************************************************
14 #****************************************************************************
15 # Modules and globals
15 # Modules and globals
16
16
17 from IPython import Release
17 from IPython import Release
18 __author__ = '%s <%s>\n%s <%s>' % \
18 __author__ = '%s <%s>\n%s <%s>' % \
19 ( Release.authors['Janko'] + Release.authors['Fernando'] )
19 ( Release.authors['Janko'] + Release.authors['Fernando'] )
20 __license__ = Release.license
20 __license__ = Release.license
21
21
22 # Python standard modules
22 # Python standard modules
23 import __builtin__
23 import __builtin__
24 import bdb
24 import bdb
25 import inspect
25 import inspect
26 import os
26 import os
27 import pdb
27 import pdb
28 import pydoc
28 import pydoc
29 import sys
29 import sys
30 import re
30 import re
31 import tempfile
31 import tempfile
32 import time
32 import time
33 import cPickle as pickle
33 import cPickle as pickle
34 import textwrap
34 import textwrap
35 from cStringIO import StringIO
35 from cStringIO import StringIO
36 from getopt import getopt,GetoptError
36 from getopt import getopt,GetoptError
37 from pprint import pprint, pformat
37 from pprint import pprint, pformat
38 from sets import Set
38 from sets import Set
39
39
40 # cProfile was added in Python2.5
40 # cProfile was added in Python2.5
41 try:
41 try:
42 import cProfile as profile
42 import cProfile as profile
43 import pstats
43 import pstats
44 except ImportError:
44 except ImportError:
45 # profile isn't bundled by default in Debian for license reasons
45 # profile isn't bundled by default in Debian for license reasons
46 try:
46 try:
47 import profile,pstats
47 import profile,pstats
48 except ImportError:
48 except ImportError:
49 profile = pstats = None
49 profile = pstats = None
50
50
51 # Homebrewed
51 # Homebrewed
52 import IPython
52 import IPython
53 from IPython import Debugger, OInspect, wildcard
53 from IPython import Debugger, OInspect, wildcard
54 from IPython.FakeModule import FakeModule
54 from IPython.FakeModule import FakeModule
55 from IPython.Itpl import Itpl, itpl, printpl,itplns
55 from IPython.Itpl import Itpl, itpl, printpl,itplns
56 from IPython.PyColorize import Parser
56 from IPython.PyColorize import Parser
57 from IPython.ipstruct import Struct
57 from IPython.ipstruct import Struct
58 from IPython.macro import Macro
58 from IPython.macro import Macro
59 from IPython.genutils import *
59 from IPython.genutils import *
60 from IPython import platutils
60 from IPython import platutils
61 import IPython.generics
61 import IPython.generics
62 import IPython.ipapi
62 import IPython.ipapi
63
63
64 #***************************************************************************
64 #***************************************************************************
65 # Utility functions
65 # Utility functions
66 def on_off(tag):
66 def on_off(tag):
67 """Return an ON/OFF string for a 1/0 input. Simple utility function."""
67 """Return an ON/OFF string for a 1/0 input. Simple utility function."""
68 return ['OFF','ON'][tag]
68 return ['OFF','ON'][tag]
69
69
70 class Bunch: pass
70 class Bunch: pass
71
71
72 def compress_dhist(dh):
72 def compress_dhist(dh):
73 head, tail = dh[:-10], dh[-10:]
73 head, tail = dh[:-10], dh[-10:]
74
74
75 newhead = []
75 newhead = []
76 done = Set()
76 done = Set()
77 for h in head:
77 for h in head:
78 if h in done:
78 if h in done:
79 continue
79 continue
80 newhead.append(h)
80 newhead.append(h)
81 done.add(h)
81 done.add(h)
82
82
83 return newhead + tail
83 return newhead + tail
84
84
85
85
86 #***************************************************************************
86 #***************************************************************************
87 # Main class implementing Magic functionality
87 # Main class implementing Magic functionality
88 class Magic:
88 class Magic:
89 """Magic functions for InteractiveShell.
89 """Magic functions for InteractiveShell.
90
90
91 Shell functions which can be reached as %function_name. All magic
91 Shell functions which can be reached as %function_name. All magic
92 functions should accept a string, which they can parse for their own
92 functions should accept a string, which they can parse for their own
93 needs. This can make some functions easier to type, eg `%cd ../`
93 needs. This can make some functions easier to type, eg `%cd ../`
94 vs. `%cd("../")`
94 vs. `%cd("../")`
95
95
96 ALL definitions MUST begin with the prefix magic_. The user won't need it
96 ALL definitions MUST begin with the prefix magic_. The user won't need it
97 at the command line, but it is is needed in the definition. """
97 at the command line, but it is is needed in the definition. """
98
98
99 # class globals
99 # class globals
100 auto_status = ['Automagic is OFF, % prefix IS needed for magic functions.',
100 auto_status = ['Automagic is OFF, % prefix IS needed for magic functions.',
101 'Automagic is ON, % prefix NOT needed for magic functions.']
101 'Automagic is ON, % prefix NOT needed for magic functions.']
102
102
103 #......................................................................
103 #......................................................................
104 # some utility functions
104 # some utility functions
105
105
106 def __init__(self,shell):
106 def __init__(self,shell):
107
107
108 self.options_table = {}
108 self.options_table = {}
109 if profile is None:
109 if profile is None:
110 self.magic_prun = self.profile_missing_notice
110 self.magic_prun = self.profile_missing_notice
111 self.shell = shell
111 self.shell = shell
112
112
113 # namespace for holding state we may need
113 # namespace for holding state we may need
114 self._magic_state = Bunch()
114 self._magic_state = Bunch()
115
115
116 def profile_missing_notice(self, *args, **kwargs):
116 def profile_missing_notice(self, *args, **kwargs):
117 error("""\
117 error("""\
118 The profile module could not be found. If you are a Debian user,
118 The profile module could not be found. If you are a Debian user,
119 it has been removed from the standard Debian package because of its non-free
119 it has been removed from the standard Debian package because of its non-free
120 license. To use profiling, please install"python2.3-profiler" from non-free.""")
120 license. To use profiling, please install"python2.3-profiler" from non-free.""")
121
121
122 def default_option(self,fn,optstr):
122 def default_option(self,fn,optstr):
123 """Make an entry in the options_table for fn, with value optstr"""
123 """Make an entry in the options_table for fn, with value optstr"""
124
124
125 if fn not in self.lsmagic():
125 if fn not in self.lsmagic():
126 error("%s is not a magic function" % fn)
126 error("%s is not a magic function" % fn)
127 self.options_table[fn] = optstr
127 self.options_table[fn] = optstr
128
128
129 def lsmagic(self):
129 def lsmagic(self):
130 """Return a list of currently available magic functions.
130 """Return a list of currently available magic functions.
131
131
132 Gives a list of the bare names after mangling (['ls','cd', ...], not
132 Gives a list of the bare names after mangling (['ls','cd', ...], not
133 ['magic_ls','magic_cd',...]"""
133 ['magic_ls','magic_cd',...]"""
134
134
135 # FIXME. This needs a cleanup, in the way the magics list is built.
135 # FIXME. This needs a cleanup, in the way the magics list is built.
136
136
137 # magics in class definition
137 # magics in class definition
138 class_magic = lambda fn: fn.startswith('magic_') and \
138 class_magic = lambda fn: fn.startswith('magic_') and \
139 callable(Magic.__dict__[fn])
139 callable(Magic.__dict__[fn])
140 # in instance namespace (run-time user additions)
140 # in instance namespace (run-time user additions)
141 inst_magic = lambda fn: fn.startswith('magic_') and \
141 inst_magic = lambda fn: fn.startswith('magic_') and \
142 callable(self.__dict__[fn])
142 callable(self.__dict__[fn])
143 # and bound magics by user (so they can access self):
143 # and bound magics by user (so they can access self):
144 inst_bound_magic = lambda fn: fn.startswith('magic_') and \
144 inst_bound_magic = lambda fn: fn.startswith('magic_') and \
145 callable(self.__class__.__dict__[fn])
145 callable(self.__class__.__dict__[fn])
146 magics = filter(class_magic,Magic.__dict__.keys()) + \
146 magics = filter(class_magic,Magic.__dict__.keys()) + \
147 filter(inst_magic,self.__dict__.keys()) + \
147 filter(inst_magic,self.__dict__.keys()) + \
148 filter(inst_bound_magic,self.__class__.__dict__.keys())
148 filter(inst_bound_magic,self.__class__.__dict__.keys())
149 out = []
149 out = []
150 for fn in magics:
150 for fn in magics:
151 out.append(fn.replace('magic_','',1))
151 out.append(fn.replace('magic_','',1))
152 out.sort()
152 out.sort()
153 return out
153 return out
154
154
155 def extract_input_slices(self,slices,raw=False):
155 def extract_input_slices(self,slices,raw=False):
156 """Return as a string a set of input history slices.
156 """Return as a string a set of input history slices.
157
157
158 Inputs:
158 Inputs:
159
159
160 - slices: the set of slices is given as a list of strings (like
160 - slices: the set of slices is given as a list of strings (like
161 ['1','4:8','9'], since this function is for use by magic functions
161 ['1','4:8','9'], since this function is for use by magic functions
162 which get their arguments as strings.
162 which get their arguments as strings.
163
163
164 Optional inputs:
164 Optional inputs:
165
165
166 - raw(False): by default, the processed input is used. If this is
166 - raw(False): by default, the processed input is used. If this is
167 true, the raw input history is used instead.
167 true, the raw input history is used instead.
168
168
169 Note that slices can be called with two notations:
169 Note that slices can be called with two notations:
170
170
171 N:M -> standard python form, means including items N...(M-1).
171 N:M -> standard python form, means including items N...(M-1).
172
172
173 N-M -> include items N..M (closed endpoint)."""
173 N-M -> include items N..M (closed endpoint)."""
174
174
175 if raw:
175 if raw:
176 hist = self.shell.input_hist_raw
176 hist = self.shell.input_hist_raw
177 else:
177 else:
178 hist = self.shell.input_hist
178 hist = self.shell.input_hist
179
179
180 cmds = []
180 cmds = []
181 for chunk in slices:
181 for chunk in slices:
182 if ':' in chunk:
182 if ':' in chunk:
183 ini,fin = map(int,chunk.split(':'))
183 ini,fin = map(int,chunk.split(':'))
184 elif '-' in chunk:
184 elif '-' in chunk:
185 ini,fin = map(int,chunk.split('-'))
185 ini,fin = map(int,chunk.split('-'))
186 fin += 1
186 fin += 1
187 else:
187 else:
188 ini = int(chunk)
188 ini = int(chunk)
189 fin = ini+1
189 fin = ini+1
190 cmds.append(hist[ini:fin])
190 cmds.append(hist[ini:fin])
191 return cmds
191 return cmds
192
192
193 def _ofind(self, oname, namespaces=None):
193 def _ofind(self, oname, namespaces=None):
194 """Find an object in the available namespaces.
194 """Find an object in the available namespaces.
195
195
196 self._ofind(oname) -> dict with keys: found,obj,ospace,ismagic
196 self._ofind(oname) -> dict with keys: found,obj,ospace,ismagic
197
197
198 Has special code to detect magic functions.
198 Has special code to detect magic functions.
199 """
199 """
200
200
201 oname = oname.strip()
201 oname = oname.strip()
202
202
203 alias_ns = None
203 alias_ns = None
204 if namespaces is None:
204 if namespaces is None:
205 # Namespaces to search in:
205 # Namespaces to search in:
206 # Put them in a list. The order is important so that we
206 # Put them in a list. The order is important so that we
207 # find things in the same order that Python finds them.
207 # find things in the same order that Python finds them.
208 namespaces = [ ('Interactive', self.shell.user_ns),
208 namespaces = [ ('Interactive', self.shell.user_ns),
209 ('IPython internal', self.shell.internal_ns),
209 ('IPython internal', self.shell.internal_ns),
210 ('Python builtin', __builtin__.__dict__),
210 ('Python builtin', __builtin__.__dict__),
211 ('Alias', self.shell.alias_table),
211 ('Alias', self.shell.alias_table),
212 ]
212 ]
213 alias_ns = self.shell.alias_table
213 alias_ns = self.shell.alias_table
214
214
215 # initialize results to 'null'
215 # initialize results to 'null'
216 found = 0; obj = None; ospace = None; ds = None;
216 found = 0; obj = None; ospace = None; ds = None;
217 ismagic = 0; isalias = 0; parent = None
217 ismagic = 0; isalias = 0; parent = None
218
218
219 # Look for the given name by splitting it in parts. If the head is
219 # Look for the given name by splitting it in parts. If the head is
220 # found, then we look for all the remaining parts as members, and only
220 # found, then we look for all the remaining parts as members, and only
221 # declare success if we can find them all.
221 # declare success if we can find them all.
222 oname_parts = oname.split('.')
222 oname_parts = oname.split('.')
223 oname_head, oname_rest = oname_parts[0],oname_parts[1:]
223 oname_head, oname_rest = oname_parts[0],oname_parts[1:]
224 for nsname,ns in namespaces:
224 for nsname,ns in namespaces:
225 try:
225 try:
226 obj = ns[oname_head]
226 obj = ns[oname_head]
227 except KeyError:
227 except KeyError:
228 continue
228 continue
229 else:
229 else:
230 #print 'oname_rest:', oname_rest # dbg
230 #print 'oname_rest:', oname_rest # dbg
231 for part in oname_rest:
231 for part in oname_rest:
232 try:
232 try:
233 parent = obj
233 parent = obj
234 obj = getattr(obj,part)
234 obj = getattr(obj,part)
235 except:
235 except:
236 # Blanket except b/c some badly implemented objects
236 # Blanket except b/c some badly implemented objects
237 # allow __getattr__ to raise exceptions other than
237 # allow __getattr__ to raise exceptions other than
238 # AttributeError, which then crashes IPython.
238 # AttributeError, which then crashes IPython.
239 break
239 break
240 else:
240 else:
241 # If we finish the for loop (no break), we got all members
241 # If we finish the for loop (no break), we got all members
242 found = 1
242 found = 1
243 ospace = nsname
243 ospace = nsname
244 if ns == alias_ns:
244 if ns == alias_ns:
245 isalias = 1
245 isalias = 1
246 break # namespace loop
246 break # namespace loop
247
247
248 # Try to see if it's magic
248 # Try to see if it's magic
249 if not found:
249 if not found:
250 if oname.startswith(self.shell.ESC_MAGIC):
250 if oname.startswith(self.shell.ESC_MAGIC):
251 oname = oname[1:]
251 oname = oname[1:]
252 obj = getattr(self,'magic_'+oname,None)
252 obj = getattr(self,'magic_'+oname,None)
253 if obj is not None:
253 if obj is not None:
254 found = 1
254 found = 1
255 ospace = 'IPython internal'
255 ospace = 'IPython internal'
256 ismagic = 1
256 ismagic = 1
257
257
258 # Last try: special-case some literals like '', [], {}, etc:
258 # Last try: special-case some literals like '', [], {}, etc:
259 if not found and oname_head in ["''",'""','[]','{}','()']:
259 if not found and oname_head in ["''",'""','[]','{}','()']:
260 obj = eval(oname_head)
260 obj = eval(oname_head)
261 found = 1
261 found = 1
262 ospace = 'Interactive'
262 ospace = 'Interactive'
263
263
264 return {'found':found, 'obj':obj, 'namespace':ospace,
264 return {'found':found, 'obj':obj, 'namespace':ospace,
265 'ismagic':ismagic, 'isalias':isalias, 'parent':parent}
265 'ismagic':ismagic, 'isalias':isalias, 'parent':parent}
266
266
267 def arg_err(self,func):
267 def arg_err(self,func):
268 """Print docstring if incorrect arguments were passed"""
268 """Print docstring if incorrect arguments were passed"""
269 print 'Error in arguments:'
269 print 'Error in arguments:'
270 print OInspect.getdoc(func)
270 print OInspect.getdoc(func)
271
271
272 def format_latex(self,strng):
272 def format_latex(self,strng):
273 """Format a string for latex inclusion."""
273 """Format a string for latex inclusion."""
274
274
275 # Characters that need to be escaped for latex:
275 # Characters that need to be escaped for latex:
276 escape_re = re.compile(r'(%|_|\$|#|&)',re.MULTILINE)
276 escape_re = re.compile(r'(%|_|\$|#|&)',re.MULTILINE)
277 # Magic command names as headers:
277 # Magic command names as headers:
278 cmd_name_re = re.compile(r'^(%s.*?):' % self.shell.ESC_MAGIC,
278 cmd_name_re = re.compile(r'^(%s.*?):' % self.shell.ESC_MAGIC,
279 re.MULTILINE)
279 re.MULTILINE)
280 # Magic commands
280 # Magic commands
281 cmd_re = re.compile(r'(?P<cmd>%s.+?\b)(?!\}\}:)' % self.shell.ESC_MAGIC,
281 cmd_re = re.compile(r'(?P<cmd>%s.+?\b)(?!\}\}:)' % self.shell.ESC_MAGIC,
282 re.MULTILINE)
282 re.MULTILINE)
283 # Paragraph continue
283 # Paragraph continue
284 par_re = re.compile(r'\\$',re.MULTILINE)
284 par_re = re.compile(r'\\$',re.MULTILINE)
285
285
286 # The "\n" symbol
286 # The "\n" symbol
287 newline_re = re.compile(r'\\n')
287 newline_re = re.compile(r'\\n')
288
288
289 # Now build the string for output:
289 # Now build the string for output:
290 #strng = cmd_name_re.sub(r'\n\\texttt{\\textsl{\\large \1}}:',strng)
290 #strng = cmd_name_re.sub(r'\n\\texttt{\\textsl{\\large \1}}:',strng)
291 strng = cmd_name_re.sub(r'\n\\bigskip\n\\texttt{\\textbf{ \1}}:',
291 strng = cmd_name_re.sub(r'\n\\bigskip\n\\texttt{\\textbf{ \1}}:',
292 strng)
292 strng)
293 strng = cmd_re.sub(r'\\texttt{\g<cmd>}',strng)
293 strng = cmd_re.sub(r'\\texttt{\g<cmd>}',strng)
294 strng = par_re.sub(r'\\\\',strng)
294 strng = par_re.sub(r'\\\\',strng)
295 strng = escape_re.sub(r'\\\1',strng)
295 strng = escape_re.sub(r'\\\1',strng)
296 strng = newline_re.sub(r'\\textbackslash{}n',strng)
296 strng = newline_re.sub(r'\\textbackslash{}n',strng)
297 return strng
297 return strng
298
298
299 def format_screen(self,strng):
299 def format_screen(self,strng):
300 """Format a string for screen printing.
300 """Format a string for screen printing.
301
301
302 This removes some latex-type format codes."""
302 This removes some latex-type format codes."""
303 # Paragraph continue
303 # Paragraph continue
304 par_re = re.compile(r'\\$',re.MULTILINE)
304 par_re = re.compile(r'\\$',re.MULTILINE)
305 strng = par_re.sub('',strng)
305 strng = par_re.sub('',strng)
306 return strng
306 return strng
307
307
308 def parse_options(self,arg_str,opt_str,*long_opts,**kw):
308 def parse_options(self,arg_str,opt_str,*long_opts,**kw):
309 """Parse options passed to an argument string.
309 """Parse options passed to an argument string.
310
310
311 The interface is similar to that of getopt(), but it returns back a
311 The interface is similar to that of getopt(), but it returns back a
312 Struct with the options as keys and the stripped argument string still
312 Struct with the options as keys and the stripped argument string still
313 as a string.
313 as a string.
314
314
315 arg_str is quoted as a true sys.argv vector by using shlex.split.
315 arg_str is quoted as a true sys.argv vector by using shlex.split.
316 This allows us to easily expand variables, glob files, quote
316 This allows us to easily expand variables, glob files, quote
317 arguments, etc.
317 arguments, etc.
318
318
319 Options:
319 Options:
320 -mode: default 'string'. If given as 'list', the argument string is
320 -mode: default 'string'. If given as 'list', the argument string is
321 returned as a list (split on whitespace) instead of a string.
321 returned as a list (split on whitespace) instead of a string.
322
322
323 -list_all: put all option values in lists. Normally only options
323 -list_all: put all option values in lists. Normally only options
324 appearing more than once are put in a list.
324 appearing more than once are put in a list.
325
325
326 -posix (True): whether to split the input line in POSIX mode or not,
326 -posix (True): whether to split the input line in POSIX mode or not,
327 as per the conventions outlined in the shlex module from the
327 as per the conventions outlined in the shlex module from the
328 standard library."""
328 standard library."""
329
329
330 # inject default options at the beginning of the input line
330 # inject default options at the beginning of the input line
331 caller = sys._getframe(1).f_code.co_name.replace('magic_','')
331 caller = sys._getframe(1).f_code.co_name.replace('magic_','')
332 arg_str = '%s %s' % (self.options_table.get(caller,''),arg_str)
332 arg_str = '%s %s' % (self.options_table.get(caller,''),arg_str)
333
333
334 mode = kw.get('mode','string')
334 mode = kw.get('mode','string')
335 if mode not in ['string','list']:
335 if mode not in ['string','list']:
336 raise ValueError,'incorrect mode given: %s' % mode
336 raise ValueError,'incorrect mode given: %s' % mode
337 # Get options
337 # Get options
338 list_all = kw.get('list_all',0)
338 list_all = kw.get('list_all',0)
339 posix = kw.get('posix',True)
339 posix = kw.get('posix',True)
340
340
341 # Check if we have more than one argument to warrant extra processing:
341 # Check if we have more than one argument to warrant extra processing:
342 odict = {} # Dictionary with options
342 odict = {} # Dictionary with options
343 args = arg_str.split()
343 args = arg_str.split()
344 if len(args) >= 1:
344 if len(args) >= 1:
345 # If the list of inputs only has 0 or 1 thing in it, there's no
345 # If the list of inputs only has 0 or 1 thing in it, there's no
346 # need to look for options
346 # need to look for options
347 argv = arg_split(arg_str,posix)
347 argv = arg_split(arg_str,posix)
348 # Do regular option processing
348 # Do regular option processing
349 try:
349 try:
350 opts,args = getopt(argv,opt_str,*long_opts)
350 opts,args = getopt(argv,opt_str,*long_opts)
351 except GetoptError,e:
351 except GetoptError,e:
352 raise GetoptError('%s ( allowed: "%s" %s)' % (e.msg,opt_str,
352 raise GetoptError('%s ( allowed: "%s" %s)' % (e.msg,opt_str,
353 " ".join(long_opts)))
353 " ".join(long_opts)))
354 for o,a in opts:
354 for o,a in opts:
355 if o.startswith('--'):
355 if o.startswith('--'):
356 o = o[2:]
356 o = o[2:]
357 else:
357 else:
358 o = o[1:]
358 o = o[1:]
359 try:
359 try:
360 odict[o].append(a)
360 odict[o].append(a)
361 except AttributeError:
361 except AttributeError:
362 odict[o] = [odict[o],a]
362 odict[o] = [odict[o],a]
363 except KeyError:
363 except KeyError:
364 if list_all:
364 if list_all:
365 odict[o] = [a]
365 odict[o] = [a]
366 else:
366 else:
367 odict[o] = a
367 odict[o] = a
368
368
369 # Prepare opts,args for return
369 # Prepare opts,args for return
370 opts = Struct(odict)
370 opts = Struct(odict)
371 if mode == 'string':
371 if mode == 'string':
372 args = ' '.join(args)
372 args = ' '.join(args)
373
373
374 return opts,args
374 return opts,args
375
375
376 #......................................................................
376 #......................................................................
377 # And now the actual magic functions
377 # And now the actual magic functions
378
378
379 # Functions for IPython shell work (vars,funcs, config, etc)
379 # Functions for IPython shell work (vars,funcs, config, etc)
380 def magic_lsmagic(self, parameter_s = ''):
380 def magic_lsmagic(self, parameter_s = ''):
381 """List currently available magic functions."""
381 """List currently available magic functions."""
382 mesc = self.shell.ESC_MAGIC
382 mesc = self.shell.ESC_MAGIC
383 print 'Available magic functions:\n'+mesc+\
383 print 'Available magic functions:\n'+mesc+\
384 (' '+mesc).join(self.lsmagic())
384 (' '+mesc).join(self.lsmagic())
385 print '\n' + Magic.auto_status[self.shell.rc.automagic]
385 print '\n' + Magic.auto_status[self.shell.rc.automagic]
386 return None
386 return None
387
387
388 def magic_magic(self, parameter_s = ''):
388 def magic_magic(self, parameter_s = ''):
389 """Print information about the magic function system."""
389 """Print information about the magic function system."""
390
390
391 mode = ''
391 mode = ''
392 try:
392 try:
393 if parameter_s.split()[0] == '-latex':
393 if parameter_s.split()[0] == '-latex':
394 mode = 'latex'
394 mode = 'latex'
395 if parameter_s.split()[0] == '-brief':
395 if parameter_s.split()[0] == '-brief':
396 mode = 'brief'
396 mode = 'brief'
397 except:
397 except:
398 pass
398 pass
399
399
400 magic_docs = []
400 magic_docs = []
401 for fname in self.lsmagic():
401 for fname in self.lsmagic():
402 mname = 'magic_' + fname
402 mname = 'magic_' + fname
403 for space in (Magic,self,self.__class__):
403 for space in (Magic,self,self.__class__):
404 try:
404 try:
405 fn = space.__dict__[mname]
405 fn = space.__dict__[mname]
406 except KeyError:
406 except KeyError:
407 pass
407 pass
408 else:
408 else:
409 break
409 break
410 if mode == 'brief':
410 if mode == 'brief':
411 # only first line
411 # only first line
412 fndoc = fn.__doc__.split('\n',1)[0]
412 fndoc = fn.__doc__.split('\n',1)[0]
413 else:
413 else:
414 fndoc = fn.__doc__
414 fndoc = fn.__doc__
415
415
416 magic_docs.append('%s%s:\n\t%s\n' %(self.shell.ESC_MAGIC,
416 magic_docs.append('%s%s:\n\t%s\n' %(self.shell.ESC_MAGIC,
417 fname,fndoc))
417 fname,fndoc))
418 magic_docs = ''.join(magic_docs)
418 magic_docs = ''.join(magic_docs)
419
419
420 if mode == 'latex':
420 if mode == 'latex':
421 print self.format_latex(magic_docs)
421 print self.format_latex(magic_docs)
422 return
422 return
423 else:
423 else:
424 magic_docs = self.format_screen(magic_docs)
424 magic_docs = self.format_screen(magic_docs)
425 if mode == 'brief':
425 if mode == 'brief':
426 return magic_docs
426 return magic_docs
427
427
428 outmsg = """
428 outmsg = """
429 IPython's 'magic' functions
429 IPython's 'magic' functions
430 ===========================
430 ===========================
431
431
432 The magic function system provides a series of functions which allow you to
432 The magic function system provides a series of functions which allow you to
433 control the behavior of IPython itself, plus a lot of system-type
433 control the behavior of IPython itself, plus a lot of system-type
434 features. All these functions are prefixed with a % character, but parameters
434 features. All these functions are prefixed with a % character, but parameters
435 are given without parentheses or quotes.
435 are given without parentheses or quotes.
436
436
437 NOTE: If you have 'automagic' enabled (via the command line option or with the
437 NOTE: If you have 'automagic' enabled (via the command line option or with the
438 %automagic function), you don't need to type in the % explicitly. By default,
438 %automagic function), you don't need to type in the % explicitly. By default,
439 IPython ships with automagic on, so you should only rarely need the % escape.
439 IPython ships with automagic on, so you should only rarely need the % escape.
440
440
441 Example: typing '%cd mydir' (without the quotes) changes you working directory
441 Example: typing '%cd mydir' (without the quotes) changes you working directory
442 to 'mydir', if it exists.
442 to 'mydir', if it exists.
443
443
444 You can define your own magic functions to extend the system. See the supplied
444 You can define your own magic functions to extend the system. See the supplied
445 ipythonrc and example-magic.py files for details (in your ipython
445 ipythonrc and example-magic.py files for details (in your ipython
446 configuration directory, typically $HOME/.ipython/).
446 configuration directory, typically $HOME/.ipython/).
447
447
448 You can also define your own aliased names for magic functions. In your
448 You can also define your own aliased names for magic functions. In your
449 ipythonrc file, placing a line like:
449 ipythonrc file, placing a line like:
450
450
451 execute __IPYTHON__.magic_pf = __IPYTHON__.magic_profile
451 execute __IPYTHON__.magic_pf = __IPYTHON__.magic_profile
452
452
453 will define %pf as a new name for %profile.
453 will define %pf as a new name for %profile.
454
454
455 You can also call magics in code using the ipmagic() function, which IPython
455 You can also call magics in code using the ipmagic() function, which IPython
456 automatically adds to the builtin namespace. Type 'ipmagic?' for details.
456 automatically adds to the builtin namespace. Type 'ipmagic?' for details.
457
457
458 For a list of the available magic functions, use %lsmagic. For a description
458 For a list of the available magic functions, use %lsmagic. For a description
459 of any of them, type %magic_name?, e.g. '%cd?'.
459 of any of them, type %magic_name?, e.g. '%cd?'.
460
460
461 Currently the magic system has the following functions:\n"""
461 Currently the magic system has the following functions:\n"""
462
462
463 mesc = self.shell.ESC_MAGIC
463 mesc = self.shell.ESC_MAGIC
464 outmsg = ("%s\n%s\n\nSummary of magic functions (from %slsmagic):"
464 outmsg = ("%s\n%s\n\nSummary of magic functions (from %slsmagic):"
465 "\n\n%s%s\n\n%s" % (outmsg,
465 "\n\n%s%s\n\n%s" % (outmsg,
466 magic_docs,mesc,mesc,
466 magic_docs,mesc,mesc,
467 (' '+mesc).join(self.lsmagic()),
467 (' '+mesc).join(self.lsmagic()),
468 Magic.auto_status[self.shell.rc.automagic] ) )
468 Magic.auto_status[self.shell.rc.automagic] ) )
469
469
470 page(outmsg,screen_lines=self.shell.rc.screen_length)
470 page(outmsg,screen_lines=self.shell.rc.screen_length)
471
471
472
472
473 def magic_autoindent(self, parameter_s = ''):
473 def magic_autoindent(self, parameter_s = ''):
474 """Toggle autoindent on/off (if available)."""
474 """Toggle autoindent on/off (if available)."""
475
475
476 self.shell.set_autoindent()
476 self.shell.set_autoindent()
477 print "Automatic indentation is:",['OFF','ON'][self.shell.autoindent]
477 print "Automatic indentation is:",['OFF','ON'][self.shell.autoindent]
478
478
479 def magic_system_verbose(self, parameter_s = ''):
479 def magic_system_verbose(self, parameter_s = ''):
480 """Set verbose printing of system calls.
480 """Set verbose printing of system calls.
481
481
482 If called without an argument, act as a toggle"""
482 If called without an argument, act as a toggle"""
483
483
484 if parameter_s:
484 if parameter_s:
485 val = bool(eval(parameter_s))
485 val = bool(eval(parameter_s))
486 else:
486 else:
487 val = None
487 val = None
488
488
489 self.shell.rc_set_toggle('system_verbose',val)
489 self.shell.rc_set_toggle('system_verbose',val)
490 print "System verbose printing is:",\
490 print "System verbose printing is:",\
491 ['OFF','ON'][self.shell.rc.system_verbose]
491 ['OFF','ON'][self.shell.rc.system_verbose]
492
492
493
493
494 def magic_page(self, parameter_s=''):
494 def magic_page(self, parameter_s=''):
495 """Pretty print the object and display it through a pager.
495 """Pretty print the object and display it through a pager.
496
496
497 %page [options] OBJECT
497 %page [options] OBJECT
498
498
499 If no object is given, use _ (last output).
499 If no object is given, use _ (last output).
500
500
501 Options:
501 Options:
502
502
503 -r: page str(object), don't pretty-print it."""
503 -r: page str(object), don't pretty-print it."""
504
504
505 # After a function contributed by Olivier Aubert, slightly modified.
505 # After a function contributed by Olivier Aubert, slightly modified.
506
506
507 # Process options/args
507 # Process options/args
508 opts,args = self.parse_options(parameter_s,'r')
508 opts,args = self.parse_options(parameter_s,'r')
509 raw = 'r' in opts
509 raw = 'r' in opts
510
510
511 oname = args and args or '_'
511 oname = args and args or '_'
512 info = self._ofind(oname)
512 info = self._ofind(oname)
513 if info['found']:
513 if info['found']:
514 txt = (raw and str or pformat)( info['obj'] )
514 txt = (raw and str or pformat)( info['obj'] )
515 page(txt)
515 page(txt)
516 else:
516 else:
517 print 'Object `%s` not found' % oname
517 print 'Object `%s` not found' % oname
518
518
519 def magic_profile(self, parameter_s=''):
519 def magic_profile(self, parameter_s=''):
520 """Print your currently active IPyhton profile."""
520 """Print your currently active IPyhton profile."""
521 if self.shell.rc.profile:
521 if self.shell.rc.profile:
522 printpl('Current IPython profile: $self.shell.rc.profile.')
522 printpl('Current IPython profile: $self.shell.rc.profile.')
523 else:
523 else:
524 print 'No profile active.'
524 print 'No profile active.'
525
525
526 def magic_pinfo(self, parameter_s='', namespaces=None):
526 def magic_pinfo(self, parameter_s='', namespaces=None):
527 """Provide detailed information about an object.
527 """Provide detailed information about an object.
528
528
529 '%pinfo object' is just a synonym for object? or ?object."""
529 '%pinfo object' is just a synonym for object? or ?object."""
530
530
531 #print 'pinfo par: <%s>' % parameter_s # dbg
531 #print 'pinfo par: <%s>' % parameter_s # dbg
532
532
533
533
534 # detail_level: 0 -> obj? , 1 -> obj??
534 # detail_level: 0 -> obj? , 1 -> obj??
535 detail_level = 0
535 detail_level = 0
536 # We need to detect if we got called as 'pinfo pinfo foo', which can
536 # We need to detect if we got called as 'pinfo pinfo foo', which can
537 # happen if the user types 'pinfo foo?' at the cmd line.
537 # happen if the user types 'pinfo foo?' at the cmd line.
538 pinfo,qmark1,oname,qmark2 = \
538 pinfo,qmark1,oname,qmark2 = \
539 re.match('(pinfo )?(\?*)(.*?)(\??$)',parameter_s).groups()
539 re.match('(pinfo )?(\?*)(.*?)(\??$)',parameter_s).groups()
540 if pinfo or qmark1 or qmark2:
540 if pinfo or qmark1 or qmark2:
541 detail_level = 1
541 detail_level = 1
542 if "*" in oname:
542 if "*" in oname:
543 self.magic_psearch(oname)
543 self.magic_psearch(oname)
544 else:
544 else:
545 self._inspect('pinfo', oname, detail_level=detail_level,
545 self._inspect('pinfo', oname, detail_level=detail_level,
546 namespaces=namespaces)
546 namespaces=namespaces)
547
547
548 def _inspect(self,meth,oname,namespaces=None,**kw):
548 def _inspect(self,meth,oname,namespaces=None,**kw):
549 """Generic interface to the inspector system.
549 """Generic interface to the inspector system.
550
550
551 This function is meant to be called by pdef, pdoc & friends."""
551 This function is meant to be called by pdef, pdoc & friends."""
552
552
553 #oname = oname.strip()
553 #oname = oname.strip()
554 #print '1- oname: <%r>' % oname # dbg
554 #print '1- oname: <%r>' % oname # dbg
555 try:
555 try:
556 oname = oname.strip().encode('ascii')
556 oname = oname.strip().encode('ascii')
557 #print '2- oname: <%r>' % oname # dbg
557 #print '2- oname: <%r>' % oname # dbg
558 except UnicodeEncodeError:
558 except UnicodeEncodeError:
559 print 'Python identifiers can only contain ascii characters.'
559 print 'Python identifiers can only contain ascii characters.'
560 return 'not found'
560 return 'not found'
561
561
562 info = Struct(self._ofind(oname, namespaces))
562 info = Struct(self._ofind(oname, namespaces))
563
563
564 if info.found:
564 if info.found:
565 try:
565 try:
566 IPython.generics.inspect_object(info.obj)
566 IPython.generics.inspect_object(info.obj)
567 return
567 return
568 except IPython.ipapi.TryNext:
568 except IPython.ipapi.TryNext:
569 pass
569 pass
570 # Get the docstring of the class property if it exists.
570 # Get the docstring of the class property if it exists.
571 path = oname.split('.')
571 path = oname.split('.')
572 root = '.'.join(path[:-1])
572 root = '.'.join(path[:-1])
573 if info.parent is not None:
573 if info.parent is not None:
574 try:
574 try:
575 target = getattr(info.parent, '__class__')
575 target = getattr(info.parent, '__class__')
576 # The object belongs to a class instance.
576 # The object belongs to a class instance.
577 try:
577 try:
578 target = getattr(target, path[-1])
578 target = getattr(target, path[-1])
579 # The class defines the object.
579 # The class defines the object.
580 if isinstance(target, property):
580 if isinstance(target, property):
581 oname = root + '.__class__.' + path[-1]
581 oname = root + '.__class__.' + path[-1]
582 info = Struct(self._ofind(oname))
582 info = Struct(self._ofind(oname))
583 except AttributeError: pass
583 except AttributeError: pass
584 except AttributeError: pass
584 except AttributeError: pass
585
585
586 pmethod = getattr(self.shell.inspector,meth)
586 pmethod = getattr(self.shell.inspector,meth)
587 formatter = info.ismagic and self.format_screen or None
587 formatter = info.ismagic and self.format_screen or None
588 if meth == 'pdoc':
588 if meth == 'pdoc':
589 pmethod(info.obj,oname,formatter)
589 pmethod(info.obj,oname,formatter)
590 elif meth == 'pinfo':
590 elif meth == 'pinfo':
591 pmethod(info.obj,oname,formatter,info,**kw)
591 pmethod(info.obj,oname,formatter,info,**kw)
592 else:
592 else:
593 pmethod(info.obj,oname)
593 pmethod(info.obj,oname)
594 else:
594 else:
595 print 'Object `%s` not found.' % oname
595 print 'Object `%s` not found.' % oname
596 return 'not found' # so callers can take other action
596 return 'not found' # so callers can take other action
597
597
598 def magic_psearch(self, parameter_s=''):
598 def magic_psearch(self, parameter_s=''):
599 """Search for object in namespaces by wildcard.
599 """Search for object in namespaces by wildcard.
600
600
601 %psearch [options] PATTERN [OBJECT TYPE]
601 %psearch [options] PATTERN [OBJECT TYPE]
602
602
603 Note: ? can be used as a synonym for %psearch, at the beginning or at
603 Note: ? can be used as a synonym for %psearch, at the beginning or at
604 the end: both a*? and ?a* are equivalent to '%psearch a*'. Still, the
604 the end: both a*? and ?a* are equivalent to '%psearch a*'. Still, the
605 rest of the command line must be unchanged (options come first), so
605 rest of the command line must be unchanged (options come first), so
606 for example the following forms are equivalent
606 for example the following forms are equivalent
607
607
608 %psearch -i a* function
608 %psearch -i a* function
609 -i a* function?
609 -i a* function?
610 ?-i a* function
610 ?-i a* function
611
611
612 Arguments:
612 Arguments:
613
613
614 PATTERN
614 PATTERN
615
615
616 where PATTERN is a string containing * as a wildcard similar to its
616 where PATTERN is a string containing * as a wildcard similar to its
617 use in a shell. The pattern is matched in all namespaces on the
617 use in a shell. The pattern is matched in all namespaces on the
618 search path. By default objects starting with a single _ are not
618 search path. By default objects starting with a single _ are not
619 matched, many IPython generated objects have a single
619 matched, many IPython generated objects have a single
620 underscore. The default is case insensitive matching. Matching is
620 underscore. The default is case insensitive matching. Matching is
621 also done on the attributes of objects and not only on the objects
621 also done on the attributes of objects and not only on the objects
622 in a module.
622 in a module.
623
623
624 [OBJECT TYPE]
624 [OBJECT TYPE]
625
625
626 Is the name of a python type from the types module. The name is
626 Is the name of a python type from the types module. The name is
627 given in lowercase without the ending type, ex. StringType is
627 given in lowercase without the ending type, ex. StringType is
628 written string. By adding a type here only objects matching the
628 written string. By adding a type here only objects matching the
629 given type are matched. Using all here makes the pattern match all
629 given type are matched. Using all here makes the pattern match all
630 types (this is the default).
630 types (this is the default).
631
631
632 Options:
632 Options:
633
633
634 -a: makes the pattern match even objects whose names start with a
634 -a: makes the pattern match even objects whose names start with a
635 single underscore. These names are normally ommitted from the
635 single underscore. These names are normally ommitted from the
636 search.
636 search.
637
637
638 -i/-c: make the pattern case insensitive/sensitive. If neither of
638 -i/-c: make the pattern case insensitive/sensitive. If neither of
639 these options is given, the default is read from your ipythonrc
639 these options is given, the default is read from your ipythonrc
640 file. The option name which sets this value is
640 file. The option name which sets this value is
641 'wildcards_case_sensitive'. If this option is not specified in your
641 'wildcards_case_sensitive'. If this option is not specified in your
642 ipythonrc file, IPython's internal default is to do a case sensitive
642 ipythonrc file, IPython's internal default is to do a case sensitive
643 search.
643 search.
644
644
645 -e/-s NAMESPACE: exclude/search a given namespace. The pattern you
645 -e/-s NAMESPACE: exclude/search a given namespace. The pattern you
646 specifiy can be searched in any of the following namespaces:
646 specifiy can be searched in any of the following namespaces:
647 'builtin', 'user', 'user_global','internal', 'alias', where
647 'builtin', 'user', 'user_global','internal', 'alias', where
648 'builtin' and 'user' are the search defaults. Note that you should
648 'builtin' and 'user' are the search defaults. Note that you should
649 not use quotes when specifying namespaces.
649 not use quotes when specifying namespaces.
650
650
651 'Builtin' contains the python module builtin, 'user' contains all
651 'Builtin' contains the python module builtin, 'user' contains all
652 user data, 'alias' only contain the shell aliases and no python
652 user data, 'alias' only contain the shell aliases and no python
653 objects, 'internal' contains objects used by IPython. The
653 objects, 'internal' contains objects used by IPython. The
654 'user_global' namespace is only used by embedded IPython instances,
654 'user_global' namespace is only used by embedded IPython instances,
655 and it contains module-level globals. You can add namespaces to the
655 and it contains module-level globals. You can add namespaces to the
656 search with -s or exclude them with -e (these options can be given
656 search with -s or exclude them with -e (these options can be given
657 more than once).
657 more than once).
658
658
659 Examples:
659 Examples:
660
660
661 %psearch a* -> objects beginning with an a
661 %psearch a* -> objects beginning with an a
662 %psearch -e builtin a* -> objects NOT in the builtin space starting in a
662 %psearch -e builtin a* -> objects NOT in the builtin space starting in a
663 %psearch a* function -> all functions beginning with an a
663 %psearch a* function -> all functions beginning with an a
664 %psearch re.e* -> objects beginning with an e in module re
664 %psearch re.e* -> objects beginning with an e in module re
665 %psearch r*.e* -> objects that start with e in modules starting in r
665 %psearch r*.e* -> objects that start with e in modules starting in r
666 %psearch r*.* string -> all strings in modules beginning with r
666 %psearch r*.* string -> all strings in modules beginning with r
667
667
668 Case sensitve search:
668 Case sensitve search:
669
669
670 %psearch -c a* list all object beginning with lower case a
670 %psearch -c a* list all object beginning with lower case a
671
671
672 Show objects beginning with a single _:
672 Show objects beginning with a single _:
673
673
674 %psearch -a _* list objects beginning with a single underscore"""
674 %psearch -a _* list objects beginning with a single underscore"""
675 try:
675 try:
676 parameter_s = parameter_s.encode('ascii')
676 parameter_s = parameter_s.encode('ascii')
677 except UnicodeEncodeError:
677 except UnicodeEncodeError:
678 print 'Python identifiers can only contain ascii characters.'
678 print 'Python identifiers can only contain ascii characters.'
679 return
679 return
680
680
681 # default namespaces to be searched
681 # default namespaces to be searched
682 def_search = ['user','builtin']
682 def_search = ['user','builtin']
683
683
684 # Process options/args
684 # Process options/args
685 opts,args = self.parse_options(parameter_s,'cias:e:',list_all=True)
685 opts,args = self.parse_options(parameter_s,'cias:e:',list_all=True)
686 opt = opts.get
686 opt = opts.get
687 shell = self.shell
687 shell = self.shell
688 psearch = shell.inspector.psearch
688 psearch = shell.inspector.psearch
689
689
690 # select case options
690 # select case options
691 if opts.has_key('i'):
691 if opts.has_key('i'):
692 ignore_case = True
692 ignore_case = True
693 elif opts.has_key('c'):
693 elif opts.has_key('c'):
694 ignore_case = False
694 ignore_case = False
695 else:
695 else:
696 ignore_case = not shell.rc.wildcards_case_sensitive
696 ignore_case = not shell.rc.wildcards_case_sensitive
697
697
698 # Build list of namespaces to search from user options
698 # Build list of namespaces to search from user options
699 def_search.extend(opt('s',[]))
699 def_search.extend(opt('s',[]))
700 ns_exclude = ns_exclude=opt('e',[])
700 ns_exclude = ns_exclude=opt('e',[])
701 ns_search = [nm for nm in def_search if nm not in ns_exclude]
701 ns_search = [nm for nm in def_search if nm not in ns_exclude]
702
702
703 # Call the actual search
703 # Call the actual search
704 try:
704 try:
705 psearch(args,shell.ns_table,ns_search,
705 psearch(args,shell.ns_table,ns_search,
706 show_all=opt('a'),ignore_case=ignore_case)
706 show_all=opt('a'),ignore_case=ignore_case)
707 except:
707 except:
708 shell.showtraceback()
708 shell.showtraceback()
709
709
710 def magic_who_ls(self, parameter_s=''):
710 def magic_who_ls(self, parameter_s=''):
711 """Return a sorted list of all interactive variables.
711 """Return a sorted list of all interactive variables.
712
712
713 If arguments are given, only variables of types matching these
713 If arguments are given, only variables of types matching these
714 arguments are returned."""
714 arguments are returned."""
715
715
716 user_ns = self.shell.user_ns
716 user_ns = self.shell.user_ns
717 internal_ns = self.shell.internal_ns
717 internal_ns = self.shell.internal_ns
718 user_config_ns = self.shell.user_config_ns
718 user_config_ns = self.shell.user_config_ns
719 out = []
719 out = []
720 typelist = parameter_s.split()
720 typelist = parameter_s.split()
721
721
722 for i in user_ns:
722 for i in user_ns:
723 if not (i.startswith('_') or i.startswith('_i')) \
723 if not (i.startswith('_') or i.startswith('_i')) \
724 and not (i in internal_ns or i in user_config_ns):
724 and not (i in internal_ns or i in user_config_ns):
725 if typelist:
725 if typelist:
726 if type(user_ns[i]).__name__ in typelist:
726 if type(user_ns[i]).__name__ in typelist:
727 out.append(i)
727 out.append(i)
728 else:
728 else:
729 out.append(i)
729 out.append(i)
730 out.sort()
730 out.sort()
731 return out
731 return out
732
732
733 def magic_who(self, parameter_s=''):
733 def magic_who(self, parameter_s=''):
734 """Print all interactive variables, with some minimal formatting.
734 """Print all interactive variables, with some minimal formatting.
735
735
736 If any arguments are given, only variables whose type matches one of
736 If any arguments are given, only variables whose type matches one of
737 these are printed. For example:
737 these are printed. For example:
738
738
739 %who function str
739 %who function str
740
740
741 will only list functions and strings, excluding all other types of
741 will only list functions and strings, excluding all other types of
742 variables. To find the proper type names, simply use type(var) at a
742 variables. To find the proper type names, simply use type(var) at a
743 command line to see how python prints type names. For example:
743 command line to see how python prints type names. For example:
744
744
745 In [1]: type('hello')\\
745 In [1]: type('hello')\\
746 Out[1]: <type 'str'>
746 Out[1]: <type 'str'>
747
747
748 indicates that the type name for strings is 'str'.
748 indicates that the type name for strings is 'str'.
749
749
750 %who always excludes executed names loaded through your configuration
750 %who always excludes executed names loaded through your configuration
751 file and things which are internal to IPython.
751 file and things which are internal to IPython.
752
752
753 This is deliberate, as typically you may load many modules and the
753 This is deliberate, as typically you may load many modules and the
754 purpose of %who is to show you only what you've manually defined."""
754 purpose of %who is to show you only what you've manually defined."""
755
755
756 varlist = self.magic_who_ls(parameter_s)
756 varlist = self.magic_who_ls(parameter_s)
757 if not varlist:
757 if not varlist:
758 if parameter_s:
758 if parameter_s:
759 print 'No variables match your requested type.'
759 print 'No variables match your requested type.'
760 else:
760 else:
761 print 'Interactive namespace is empty.'
761 print 'Interactive namespace is empty.'
762 return
762 return
763
763
764 # if we have variables, move on...
764 # if we have variables, move on...
765 count = 0
765 count = 0
766 for i in varlist:
766 for i in varlist:
767 print i+'\t',
767 print i+'\t',
768 count += 1
768 count += 1
769 if count > 8:
769 if count > 8:
770 count = 0
770 count = 0
771 print
771 print
772 print
772 print
773
773
774 def magic_whos(self, parameter_s=''):
774 def magic_whos(self, parameter_s=''):
775 """Like %who, but gives some extra information about each variable.
775 """Like %who, but gives some extra information about each variable.
776
776
777 The same type filtering of %who can be applied here.
777 The same type filtering of %who can be applied here.
778
778
779 For all variables, the type is printed. Additionally it prints:
779 For all variables, the type is printed. Additionally it prints:
780
780
781 - For {},[],(): their length.
781 - For {},[],(): their length.
782
782
783 - For numpy and Numeric arrays, a summary with shape, number of
783 - For numpy and Numeric arrays, a summary with shape, number of
784 elements, typecode and size in memory.
784 elements, typecode and size in memory.
785
785
786 - Everything else: a string representation, snipping their middle if
786 - Everything else: a string representation, snipping their middle if
787 too long."""
787 too long."""
788
788
789 varnames = self.magic_who_ls(parameter_s)
789 varnames = self.magic_who_ls(parameter_s)
790 if not varnames:
790 if not varnames:
791 if parameter_s:
791 if parameter_s:
792 print 'No variables match your requested type.'
792 print 'No variables match your requested type.'
793 else:
793 else:
794 print 'Interactive namespace is empty.'
794 print 'Interactive namespace is empty.'
795 return
795 return
796
796
797 # if we have variables, move on...
797 # if we have variables, move on...
798
798
799 # for these types, show len() instead of data:
799 # for these types, show len() instead of data:
800 seq_types = [types.DictType,types.ListType,types.TupleType]
800 seq_types = [types.DictType,types.ListType,types.TupleType]
801
801
802 # for numpy/Numeric arrays, display summary info
802 # for numpy/Numeric arrays, display summary info
803 try:
803 try:
804 import numpy
804 import numpy
805 except ImportError:
805 except ImportError:
806 ndarray_type = None
806 ndarray_type = None
807 else:
807 else:
808 ndarray_type = numpy.ndarray.__name__
808 ndarray_type = numpy.ndarray.__name__
809 try:
809 try:
810 import Numeric
810 import Numeric
811 except ImportError:
811 except ImportError:
812 array_type = None
812 array_type = None
813 else:
813 else:
814 array_type = Numeric.ArrayType.__name__
814 array_type = Numeric.ArrayType.__name__
815
815
816 # Find all variable names and types so we can figure out column sizes
816 # Find all variable names and types so we can figure out column sizes
817 def get_vars(i):
817 def get_vars(i):
818 return self.shell.user_ns[i]
818 return self.shell.user_ns[i]
819
819
820 # some types are well known and can be shorter
820 # some types are well known and can be shorter
821 abbrevs = {'IPython.macro.Macro' : 'Macro'}
821 abbrevs = {'IPython.macro.Macro' : 'Macro'}
822 def type_name(v):
822 def type_name(v):
823 tn = type(v).__name__
823 tn = type(v).__name__
824 return abbrevs.get(tn,tn)
824 return abbrevs.get(tn,tn)
825
825
826 varlist = map(get_vars,varnames)
826 varlist = map(get_vars,varnames)
827
827
828 typelist = []
828 typelist = []
829 for vv in varlist:
829 for vv in varlist:
830 tt = type_name(vv)
830 tt = type_name(vv)
831
831
832 if tt=='instance':
832 if tt=='instance':
833 typelist.append( abbrevs.get(str(vv.__class__),
833 typelist.append( abbrevs.get(str(vv.__class__),
834 str(vv.__class__)))
834 str(vv.__class__)))
835 else:
835 else:
836 typelist.append(tt)
836 typelist.append(tt)
837
837
838 # column labels and # of spaces as separator
838 # column labels and # of spaces as separator
839 varlabel = 'Variable'
839 varlabel = 'Variable'
840 typelabel = 'Type'
840 typelabel = 'Type'
841 datalabel = 'Data/Info'
841 datalabel = 'Data/Info'
842 colsep = 3
842 colsep = 3
843 # variable format strings
843 # variable format strings
844 vformat = "$vname.ljust(varwidth)$vtype.ljust(typewidth)"
844 vformat = "$vname.ljust(varwidth)$vtype.ljust(typewidth)"
845 vfmt_short = '$vstr[:25]<...>$vstr[-25:]'
845 vfmt_short = '$vstr[:25]<...>$vstr[-25:]'
846 aformat = "%s: %s elems, type `%s`, %s bytes"
846 aformat = "%s: %s elems, type `%s`, %s bytes"
847 # find the size of the columns to format the output nicely
847 # find the size of the columns to format the output nicely
848 varwidth = max(max(map(len,varnames)), len(varlabel)) + colsep
848 varwidth = max(max(map(len,varnames)), len(varlabel)) + colsep
849 typewidth = max(max(map(len,typelist)), len(typelabel)) + colsep
849 typewidth = max(max(map(len,typelist)), len(typelabel)) + colsep
850 # table header
850 # table header
851 print varlabel.ljust(varwidth) + typelabel.ljust(typewidth) + \
851 print varlabel.ljust(varwidth) + typelabel.ljust(typewidth) + \
852 ' '+datalabel+'\n' + '-'*(varwidth+typewidth+len(datalabel)+1)
852 ' '+datalabel+'\n' + '-'*(varwidth+typewidth+len(datalabel)+1)
853 # and the table itself
853 # and the table itself
854 kb = 1024
854 kb = 1024
855 Mb = 1048576 # kb**2
855 Mb = 1048576 # kb**2
856 for vname,var,vtype in zip(varnames,varlist,typelist):
856 for vname,var,vtype in zip(varnames,varlist,typelist):
857 print itpl(vformat),
857 print itpl(vformat),
858 if vtype in seq_types:
858 if vtype in seq_types:
859 print len(var)
859 print len(var)
860 elif vtype in [array_type,ndarray_type]:
860 elif vtype in [array_type,ndarray_type]:
861 vshape = str(var.shape).replace(',','').replace(' ','x')[1:-1]
861 vshape = str(var.shape).replace(',','').replace(' ','x')[1:-1]
862 if vtype==ndarray_type:
862 if vtype==ndarray_type:
863 # numpy
863 # numpy
864 vsize = var.size
864 vsize = var.size
865 vbytes = vsize*var.itemsize
865 vbytes = vsize*var.itemsize
866 vdtype = var.dtype
866 vdtype = var.dtype
867 else:
867 else:
868 # Numeric
868 # Numeric
869 vsize = Numeric.size(var)
869 vsize = Numeric.size(var)
870 vbytes = vsize*var.itemsize()
870 vbytes = vsize*var.itemsize()
871 vdtype = var.typecode()
871 vdtype = var.typecode()
872
872
873 if vbytes < 100000:
873 if vbytes < 100000:
874 print aformat % (vshape,vsize,vdtype,vbytes)
874 print aformat % (vshape,vsize,vdtype,vbytes)
875 else:
875 else:
876 print aformat % (vshape,vsize,vdtype,vbytes),
876 print aformat % (vshape,vsize,vdtype,vbytes),
877 if vbytes < Mb:
877 if vbytes < Mb:
878 print '(%s kb)' % (vbytes/kb,)
878 print '(%s kb)' % (vbytes/kb,)
879 else:
879 else:
880 print '(%s Mb)' % (vbytes/Mb,)
880 print '(%s Mb)' % (vbytes/Mb,)
881 else:
881 else:
882 try:
882 try:
883 vstr = str(var)
883 vstr = str(var)
884 except UnicodeEncodeError:
884 except UnicodeEncodeError:
885 vstr = unicode(var).encode(sys.getdefaultencoding(),
885 vstr = unicode(var).encode(sys.getdefaultencoding(),
886 'backslashreplace')
886 'backslashreplace')
887 vstr = vstr.replace('\n','\\n')
887 vstr = vstr.replace('\n','\\n')
888 if len(vstr) < 50:
888 if len(vstr) < 50:
889 print vstr
889 print vstr
890 else:
890 else:
891 printpl(vfmt_short)
891 printpl(vfmt_short)
892
892
893 def magic_reset(self, parameter_s=''):
893 def magic_reset(self, parameter_s=''):
894 """Resets the namespace by removing all names defined by the user.
894 """Resets the namespace by removing all names defined by the user.
895
895
896 Input/Output history are left around in case you need them."""
896 Input/Output history are left around in case you need them."""
897
897
898 ans = self.shell.ask_yes_no(
898 ans = self.shell.ask_yes_no(
899 "Once deleted, variables cannot be recovered. Proceed (y/[n])? ")
899 "Once deleted, variables cannot be recovered. Proceed (y/[n])? ")
900 if not ans:
900 if not ans:
901 print 'Nothing done.'
901 print 'Nothing done.'
902 return
902 return
903 user_ns = self.shell.user_ns
903 user_ns = self.shell.user_ns
904 for i in self.magic_who_ls():
904 for i in self.magic_who_ls():
905 del(user_ns[i])
905 del(user_ns[i])
906
906
907 def magic_logstart(self,parameter_s=''):
907 def magic_logstart(self,parameter_s=''):
908 """Start logging anywhere in a session.
908 """Start logging anywhere in a session.
909
909
910 %logstart [-o|-r|-t] [log_name [log_mode]]
910 %logstart [-o|-r|-t] [log_name [log_mode]]
911
911
912 If no name is given, it defaults to a file named 'ipython_log.py' in your
912 If no name is given, it defaults to a file named 'ipython_log.py' in your
913 current directory, in 'rotate' mode (see below).
913 current directory, in 'rotate' mode (see below).
914
914
915 '%logstart name' saves to file 'name' in 'backup' mode. It saves your
915 '%logstart name' saves to file 'name' in 'backup' mode. It saves your
916 history up to that point and then continues logging.
916 history up to that point and then continues logging.
917
917
918 %logstart takes a second optional parameter: logging mode. This can be one
918 %logstart takes a second optional parameter: logging mode. This can be one
919 of (note that the modes are given unquoted):\\
919 of (note that the modes are given unquoted):\\
920 append: well, that says it.\\
920 append: well, that says it.\\
921 backup: rename (if exists) to name~ and start name.\\
921 backup: rename (if exists) to name~ and start name.\\
922 global: single logfile in your home dir, appended to.\\
922 global: single logfile in your home dir, appended to.\\
923 over : overwrite existing log.\\
923 over : overwrite existing log.\\
924 rotate: create rotating logs name.1~, name.2~, etc.
924 rotate: create rotating logs name.1~, name.2~, etc.
925
925
926 Options:
926 Options:
927
927
928 -o: log also IPython's output. In this mode, all commands which
928 -o: log also IPython's output. In this mode, all commands which
929 generate an Out[NN] prompt are recorded to the logfile, right after
929 generate an Out[NN] prompt are recorded to the logfile, right after
930 their corresponding input line. The output lines are always
930 their corresponding input line. The output lines are always
931 prepended with a '#[Out]# ' marker, so that the log remains valid
931 prepended with a '#[Out]# ' marker, so that the log remains valid
932 Python code.
932 Python code.
933
933
934 Since this marker is always the same, filtering only the output from
934 Since this marker is always the same, filtering only the output from
935 a log is very easy, using for example a simple awk call:
935 a log is very easy, using for example a simple awk call:
936
936
937 awk -F'#\\[Out\\]# ' '{if($2) {print $2}}' ipython_log.py
937 awk -F'#\\[Out\\]# ' '{if($2) {print $2}}' ipython_log.py
938
938
939 -r: log 'raw' input. Normally, IPython's logs contain the processed
939 -r: log 'raw' input. Normally, IPython's logs contain the processed
940 input, so that user lines are logged in their final form, converted
940 input, so that user lines are logged in their final form, converted
941 into valid Python. For example, %Exit is logged as
941 into valid Python. For example, %Exit is logged as
942 '_ip.magic("Exit"). If the -r flag is given, all input is logged
942 '_ip.magic("Exit"). If the -r flag is given, all input is logged
943 exactly as typed, with no transformations applied.
943 exactly as typed, with no transformations applied.
944
944
945 -t: put timestamps before each input line logged (these are put in
945 -t: put timestamps before each input line logged (these are put in
946 comments)."""
946 comments)."""
947
947
948 opts,par = self.parse_options(parameter_s,'ort')
948 opts,par = self.parse_options(parameter_s,'ort')
949 log_output = 'o' in opts
949 log_output = 'o' in opts
950 log_raw_input = 'r' in opts
950 log_raw_input = 'r' in opts
951 timestamp = 't' in opts
951 timestamp = 't' in opts
952
952
953 rc = self.shell.rc
953 rc = self.shell.rc
954 logger = self.shell.logger
954 logger = self.shell.logger
955
955
956 # if no args are given, the defaults set in the logger constructor by
956 # if no args are given, the defaults set in the logger constructor by
957 # ipytohn remain valid
957 # ipytohn remain valid
958 if par:
958 if par:
959 try:
959 try:
960 logfname,logmode = par.split()
960 logfname,logmode = par.split()
961 except:
961 except:
962 logfname = par
962 logfname = par
963 logmode = 'backup'
963 logmode = 'backup'
964 else:
964 else:
965 logfname = logger.logfname
965 logfname = logger.logfname
966 logmode = logger.logmode
966 logmode = logger.logmode
967 # put logfname into rc struct as if it had been called on the command
967 # put logfname into rc struct as if it had been called on the command
968 # line, so it ends up saved in the log header Save it in case we need
968 # line, so it ends up saved in the log header Save it in case we need
969 # to restore it...
969 # to restore it...
970 old_logfile = rc.opts.get('logfile','')
970 old_logfile = rc.opts.get('logfile','')
971 if logfname:
971 if logfname:
972 logfname = os.path.expanduser(logfname)
972 logfname = os.path.expanduser(logfname)
973 rc.opts.logfile = logfname
973 rc.opts.logfile = logfname
974 loghead = self.shell.loghead_tpl % (rc.opts,rc.args)
974 loghead = self.shell.loghead_tpl % (rc.opts,rc.args)
975 try:
975 try:
976 started = logger.logstart(logfname,loghead,logmode,
976 started = logger.logstart(logfname,loghead,logmode,
977 log_output,timestamp,log_raw_input)
977 log_output,timestamp,log_raw_input)
978 except:
978 except:
979 rc.opts.logfile = old_logfile
979 rc.opts.logfile = old_logfile
980 warn("Couldn't start log: %s" % sys.exc_info()[1])
980 warn("Couldn't start log: %s" % sys.exc_info()[1])
981 else:
981 else:
982 # log input history up to this point, optionally interleaving
982 # log input history up to this point, optionally interleaving
983 # output if requested
983 # output if requested
984
984
985 if timestamp:
985 if timestamp:
986 # disable timestamping for the previous history, since we've
986 # disable timestamping for the previous history, since we've
987 # lost those already (no time machine here).
987 # lost those already (no time machine here).
988 logger.timestamp = False
988 logger.timestamp = False
989
989
990 if log_raw_input:
990 if log_raw_input:
991 input_hist = self.shell.input_hist_raw
991 input_hist = self.shell.input_hist_raw
992 else:
992 else:
993 input_hist = self.shell.input_hist
993 input_hist = self.shell.input_hist
994
994
995 if log_output:
995 if log_output:
996 log_write = logger.log_write
996 log_write = logger.log_write
997 output_hist = self.shell.output_hist
997 output_hist = self.shell.output_hist
998 for n in range(1,len(input_hist)-1):
998 for n in range(1,len(input_hist)-1):
999 log_write(input_hist[n].rstrip())
999 log_write(input_hist[n].rstrip())
1000 if n in output_hist:
1000 if n in output_hist:
1001 log_write(repr(output_hist[n]),'output')
1001 log_write(repr(output_hist[n]),'output')
1002 else:
1002 else:
1003 logger.log_write(input_hist[1:])
1003 logger.log_write(input_hist[1:])
1004 if timestamp:
1004 if timestamp:
1005 # re-enable timestamping
1005 # re-enable timestamping
1006 logger.timestamp = True
1006 logger.timestamp = True
1007
1007
1008 print ('Activating auto-logging. '
1008 print ('Activating auto-logging. '
1009 'Current session state plus future input saved.')
1009 'Current session state plus future input saved.')
1010 logger.logstate()
1010 logger.logstate()
1011
1011
1012 def magic_logoff(self,parameter_s=''):
1012 def magic_logoff(self,parameter_s=''):
1013 """Temporarily stop logging.
1013 """Temporarily stop logging.
1014
1014
1015 You must have previously started logging."""
1015 You must have previously started logging."""
1016 self.shell.logger.switch_log(0)
1016 self.shell.logger.switch_log(0)
1017
1017
1018 def magic_logon(self,parameter_s=''):
1018 def magic_logon(self,parameter_s=''):
1019 """Restart logging.
1019 """Restart logging.
1020
1020
1021 This function is for restarting logging which you've temporarily
1021 This function is for restarting logging which you've temporarily
1022 stopped with %logoff. For starting logging for the first time, you
1022 stopped with %logoff. For starting logging for the first time, you
1023 must use the %logstart function, which allows you to specify an
1023 must use the %logstart function, which allows you to specify an
1024 optional log filename."""
1024 optional log filename."""
1025
1025
1026 self.shell.logger.switch_log(1)
1026 self.shell.logger.switch_log(1)
1027
1027
1028 def magic_logstate(self,parameter_s=''):
1028 def magic_logstate(self,parameter_s=''):
1029 """Print the status of the logging system."""
1029 """Print the status of the logging system."""
1030
1030
1031 self.shell.logger.logstate()
1031 self.shell.logger.logstate()
1032
1032
1033 def magic_pdb(self, parameter_s=''):
1033 def magic_pdb(self, parameter_s=''):
1034 """Control the automatic calling of the pdb interactive debugger.
1034 """Control the automatic calling of the pdb interactive debugger.
1035
1035
1036 Call as '%pdb on', '%pdb 1', '%pdb off' or '%pdb 0'. If called without
1036 Call as '%pdb on', '%pdb 1', '%pdb off' or '%pdb 0'. If called without
1037 argument it works as a toggle.
1037 argument it works as a toggle.
1038
1038
1039 When an exception is triggered, IPython can optionally call the
1039 When an exception is triggered, IPython can optionally call the
1040 interactive pdb debugger after the traceback printout. %pdb toggles
1040 interactive pdb debugger after the traceback printout. %pdb toggles
1041 this feature on and off.
1041 this feature on and off.
1042
1042
1043 The initial state of this feature is set in your ipythonrc
1043 The initial state of this feature is set in your ipythonrc
1044 configuration file (the variable is called 'pdb').
1044 configuration file (the variable is called 'pdb').
1045
1045
1046 If you want to just activate the debugger AFTER an exception has fired,
1046 If you want to just activate the debugger AFTER an exception has fired,
1047 without having to type '%pdb on' and rerunning your code, you can use
1047 without having to type '%pdb on' and rerunning your code, you can use
1048 the %debug magic."""
1048 the %debug magic."""
1049
1049
1050 par = parameter_s.strip().lower()
1050 par = parameter_s.strip().lower()
1051
1051
1052 if par:
1052 if par:
1053 try:
1053 try:
1054 new_pdb = {'off':0,'0':0,'on':1,'1':1}[par]
1054 new_pdb = {'off':0,'0':0,'on':1,'1':1}[par]
1055 except KeyError:
1055 except KeyError:
1056 print ('Incorrect argument. Use on/1, off/0, '
1056 print ('Incorrect argument. Use on/1, off/0, '
1057 'or nothing for a toggle.')
1057 'or nothing for a toggle.')
1058 return
1058 return
1059 else:
1059 else:
1060 # toggle
1060 # toggle
1061 new_pdb = not self.shell.call_pdb
1061 new_pdb = not self.shell.call_pdb
1062
1062
1063 # set on the shell
1063 # set on the shell
1064 self.shell.call_pdb = new_pdb
1064 self.shell.call_pdb = new_pdb
1065 print 'Automatic pdb calling has been turned',on_off(new_pdb)
1065 print 'Automatic pdb calling has been turned',on_off(new_pdb)
1066
1066
1067 def magic_debug(self, parameter_s=''):
1067 def magic_debug(self, parameter_s=''):
1068 """Activate the interactive debugger in post-mortem mode.
1068 """Activate the interactive debugger in post-mortem mode.
1069
1069
1070 If an exception has just occurred, this lets you inspect its stack
1070 If an exception has just occurred, this lets you inspect its stack
1071 frames interactively. Note that this will always work only on the last
1071 frames interactively. Note that this will always work only on the last
1072 traceback that occurred, so you must call this quickly after an
1072 traceback that occurred, so you must call this quickly after an
1073 exception that you wish to inspect has fired, because if another one
1073 exception that you wish to inspect has fired, because if another one
1074 occurs, it clobbers the previous one.
1074 occurs, it clobbers the previous one.
1075
1075
1076 If you want IPython to automatically do this on every exception, see
1076 If you want IPython to automatically do this on every exception, see
1077 the %pdb magic for more details.
1077 the %pdb magic for more details.
1078 """
1078 """
1079
1079
1080 self.shell.debugger(force=True)
1080 self.shell.debugger(force=True)
1081
1081
1082 def magic_prun(self, parameter_s ='',user_mode=1,
1082 def magic_prun(self, parameter_s ='',user_mode=1,
1083 opts=None,arg_lst=None,prog_ns=None):
1083 opts=None,arg_lst=None,prog_ns=None):
1084
1084
1085 """Run a statement through the python code profiler.
1085 """Run a statement through the python code profiler.
1086
1086
1087 Usage:\\
1087 Usage:\\
1088 %prun [options] statement
1088 %prun [options] statement
1089
1089
1090 The given statement (which doesn't require quote marks) is run via the
1090 The given statement (which doesn't require quote marks) is run via the
1091 python profiler in a manner similar to the profile.run() function.
1091 python profiler in a manner similar to the profile.run() function.
1092 Namespaces are internally managed to work correctly; profile.run
1092 Namespaces are internally managed to work correctly; profile.run
1093 cannot be used in IPython because it makes certain assumptions about
1093 cannot be used in IPython because it makes certain assumptions about
1094 namespaces which do not hold under IPython.
1094 namespaces which do not hold under IPython.
1095
1095
1096 Options:
1096 Options:
1097
1097
1098 -l <limit>: you can place restrictions on what or how much of the
1098 -l <limit>: you can place restrictions on what or how much of the
1099 profile gets printed. The limit value can be:
1099 profile gets printed. The limit value can be:
1100
1100
1101 * A string: only information for function names containing this string
1101 * A string: only information for function names containing this string
1102 is printed.
1102 is printed.
1103
1103
1104 * An integer: only these many lines are printed.
1104 * An integer: only these many lines are printed.
1105
1105
1106 * A float (between 0 and 1): this fraction of the report is printed
1106 * A float (between 0 and 1): this fraction of the report is printed
1107 (for example, use a limit of 0.4 to see the topmost 40% only).
1107 (for example, use a limit of 0.4 to see the topmost 40% only).
1108
1108
1109 You can combine several limits with repeated use of the option. For
1109 You can combine several limits with repeated use of the option. For
1110 example, '-l __init__ -l 5' will print only the topmost 5 lines of
1110 example, '-l __init__ -l 5' will print only the topmost 5 lines of
1111 information about class constructors.
1111 information about class constructors.
1112
1112
1113 -r: return the pstats.Stats object generated by the profiling. This
1113 -r: return the pstats.Stats object generated by the profiling. This
1114 object has all the information about the profile in it, and you can
1114 object has all the information about the profile in it, and you can
1115 later use it for further analysis or in other functions.
1115 later use it for further analysis or in other functions.
1116
1116
1117 -s <key>: sort profile by given key. You can provide more than one key
1117 -s <key>: sort profile by given key. You can provide more than one key
1118 by using the option several times: '-s key1 -s key2 -s key3...'. The
1118 by using the option several times: '-s key1 -s key2 -s key3...'. The
1119 default sorting key is 'time'.
1119 default sorting key is 'time'.
1120
1120
1121 The following is copied verbatim from the profile documentation
1121 The following is copied verbatim from the profile documentation
1122 referenced below:
1122 referenced below:
1123
1123
1124 When more than one key is provided, additional keys are used as
1124 When more than one key is provided, additional keys are used as
1125 secondary criteria when the there is equality in all keys selected
1125 secondary criteria when the there is equality in all keys selected
1126 before them.
1126 before them.
1127
1127
1128 Abbreviations can be used for any key names, as long as the
1128 Abbreviations can be used for any key names, as long as the
1129 abbreviation is unambiguous. The following are the keys currently
1129 abbreviation is unambiguous. The following are the keys currently
1130 defined:
1130 defined:
1131
1131
1132 Valid Arg Meaning\\
1132 Valid Arg Meaning\\
1133 "calls" call count\\
1133 "calls" call count\\
1134 "cumulative" cumulative time\\
1134 "cumulative" cumulative time\\
1135 "file" file name\\
1135 "file" file name\\
1136 "module" file name\\
1136 "module" file name\\
1137 "pcalls" primitive call count\\
1137 "pcalls" primitive call count\\
1138 "line" line number\\
1138 "line" line number\\
1139 "name" function name\\
1139 "name" function name\\
1140 "nfl" name/file/line\\
1140 "nfl" name/file/line\\
1141 "stdname" standard name\\
1141 "stdname" standard name\\
1142 "time" internal time
1142 "time" internal time
1143
1143
1144 Note that all sorts on statistics are in descending order (placing
1144 Note that all sorts on statistics are in descending order (placing
1145 most time consuming items first), where as name, file, and line number
1145 most time consuming items first), where as name, file, and line number
1146 searches are in ascending order (i.e., alphabetical). The subtle
1146 searches are in ascending order (i.e., alphabetical). The subtle
1147 distinction between "nfl" and "stdname" is that the standard name is a
1147 distinction between "nfl" and "stdname" is that the standard name is a
1148 sort of the name as printed, which means that the embedded line
1148 sort of the name as printed, which means that the embedded line
1149 numbers get compared in an odd way. For example, lines 3, 20, and 40
1149 numbers get compared in an odd way. For example, lines 3, 20, and 40
1150 would (if the file names were the same) appear in the string order
1150 would (if the file names were the same) appear in the string order
1151 "20" "3" and "40". In contrast, "nfl" does a numeric compare of the
1151 "20" "3" and "40". In contrast, "nfl" does a numeric compare of the
1152 line numbers. In fact, sort_stats("nfl") is the same as
1152 line numbers. In fact, sort_stats("nfl") is the same as
1153 sort_stats("name", "file", "line").
1153 sort_stats("name", "file", "line").
1154
1154
1155 -T <filename>: save profile results as shown on screen to a text
1155 -T <filename>: save profile results as shown on screen to a text
1156 file. The profile is still shown on screen.
1156 file. The profile is still shown on screen.
1157
1157
1158 -D <filename>: save (via dump_stats) profile statistics to given
1158 -D <filename>: save (via dump_stats) profile statistics to given
1159 filename. This data is in a format understod by the pstats module, and
1159 filename. This data is in a format understod by the pstats module, and
1160 is generated by a call to the dump_stats() method of profile
1160 is generated by a call to the dump_stats() method of profile
1161 objects. The profile is still shown on screen.
1161 objects. The profile is still shown on screen.
1162
1162
1163 If you want to run complete programs under the profiler's control, use
1163 If you want to run complete programs under the profiler's control, use
1164 '%run -p [prof_opts] filename.py [args to program]' where prof_opts
1164 '%run -p [prof_opts] filename.py [args to program]' where prof_opts
1165 contains profiler specific options as described here.
1165 contains profiler specific options as described here.
1166
1166
1167 You can read the complete documentation for the profile module with:\\
1167 You can read the complete documentation for the profile module with:\\
1168 In [1]: import profile; profile.help() """
1168 In [1]: import profile; profile.help() """
1169
1169
1170 opts_def = Struct(D=[''],l=[],s=['time'],T=[''])
1170 opts_def = Struct(D=[''],l=[],s=['time'],T=[''])
1171 # protect user quote marks
1171 # protect user quote marks
1172 parameter_s = parameter_s.replace('"',r'\"').replace("'",r"\'")
1172 parameter_s = parameter_s.replace('"',r'\"').replace("'",r"\'")
1173
1173
1174 if user_mode: # regular user call
1174 if user_mode: # regular user call
1175 opts,arg_str = self.parse_options(parameter_s,'D:l:rs:T:',
1175 opts,arg_str = self.parse_options(parameter_s,'D:l:rs:T:',
1176 list_all=1)
1176 list_all=1)
1177 namespace = self.shell.user_ns
1177 namespace = self.shell.user_ns
1178 else: # called to run a program by %run -p
1178 else: # called to run a program by %run -p
1179 try:
1179 try:
1180 filename = get_py_filename(arg_lst[0])
1180 filename = get_py_filename(arg_lst[0])
1181 except IOError,msg:
1181 except IOError,msg:
1182 error(msg)
1182 error(msg)
1183 return
1183 return
1184
1184
1185 arg_str = 'execfile(filename,prog_ns)'
1185 arg_str = 'execfile(filename,prog_ns)'
1186 namespace = locals()
1186 namespace = locals()
1187
1187
1188 opts.merge(opts_def)
1188 opts.merge(opts_def)
1189
1189
1190 prof = profile.Profile()
1190 prof = profile.Profile()
1191 try:
1191 try:
1192 prof = prof.runctx(arg_str,namespace,namespace)
1192 prof = prof.runctx(arg_str,namespace,namespace)
1193 sys_exit = ''
1193 sys_exit = ''
1194 except SystemExit:
1194 except SystemExit:
1195 sys_exit = """*** SystemExit exception caught in code being profiled."""
1195 sys_exit = """*** SystemExit exception caught in code being profiled."""
1196
1196
1197 stats = pstats.Stats(prof).strip_dirs().sort_stats(*opts.s)
1197 stats = pstats.Stats(prof).strip_dirs().sort_stats(*opts.s)
1198
1198
1199 lims = opts.l
1199 lims = opts.l
1200 if lims:
1200 if lims:
1201 lims = [] # rebuild lims with ints/floats/strings
1201 lims = [] # rebuild lims with ints/floats/strings
1202 for lim in opts.l:
1202 for lim in opts.l:
1203 try:
1203 try:
1204 lims.append(int(lim))
1204 lims.append(int(lim))
1205 except ValueError:
1205 except ValueError:
1206 try:
1206 try:
1207 lims.append(float(lim))
1207 lims.append(float(lim))
1208 except ValueError:
1208 except ValueError:
1209 lims.append(lim)
1209 lims.append(lim)
1210
1210
1211 # Trap output.
1211 # Trap output.
1212 stdout_trap = StringIO()
1212 stdout_trap = StringIO()
1213
1213
1214 if hasattr(stats,'stream'):
1214 if hasattr(stats,'stream'):
1215 # In newer versions of python, the stats object has a 'stream'
1215 # In newer versions of python, the stats object has a 'stream'
1216 # attribute to write into.
1216 # attribute to write into.
1217 stats.stream = stdout_trap
1217 stats.stream = stdout_trap
1218 stats.print_stats(*lims)
1218 stats.print_stats(*lims)
1219 else:
1219 else:
1220 # For older versions, we manually redirect stdout during printing
1220 # For older versions, we manually redirect stdout during printing
1221 sys_stdout = sys.stdout
1221 sys_stdout = sys.stdout
1222 try:
1222 try:
1223 sys.stdout = stdout_trap
1223 sys.stdout = stdout_trap
1224 stats.print_stats(*lims)
1224 stats.print_stats(*lims)
1225 finally:
1225 finally:
1226 sys.stdout = sys_stdout
1226 sys.stdout = sys_stdout
1227
1227
1228 output = stdout_trap.getvalue()
1228 output = stdout_trap.getvalue()
1229 output = output.rstrip()
1229 output = output.rstrip()
1230
1230
1231 page(output,screen_lines=self.shell.rc.screen_length)
1231 page(output,screen_lines=self.shell.rc.screen_length)
1232 print sys_exit,
1232 print sys_exit,
1233
1233
1234 dump_file = opts.D[0]
1234 dump_file = opts.D[0]
1235 text_file = opts.T[0]
1235 text_file = opts.T[0]
1236 if dump_file:
1236 if dump_file:
1237 prof.dump_stats(dump_file)
1237 prof.dump_stats(dump_file)
1238 print '\n*** Profile stats marshalled to file',\
1238 print '\n*** Profile stats marshalled to file',\
1239 `dump_file`+'.',sys_exit
1239 `dump_file`+'.',sys_exit
1240 if text_file:
1240 if text_file:
1241 pfile = file(text_file,'w')
1241 pfile = file(text_file,'w')
1242 pfile.write(output)
1242 pfile.write(output)
1243 pfile.close()
1243 pfile.close()
1244 print '\n*** Profile printout saved to text file',\
1244 print '\n*** Profile printout saved to text file',\
1245 `text_file`+'.',sys_exit
1245 `text_file`+'.',sys_exit
1246
1246
1247 if opts.has_key('r'):
1247 if opts.has_key('r'):
1248 return stats
1248 return stats
1249 else:
1249 else:
1250 return None
1250 return None
1251
1251
1252 def magic_run(self, parameter_s ='',runner=None):
1252 def magic_run(self, parameter_s ='',runner=None):
1253 """Run the named file inside IPython as a program.
1253 """Run the named file inside IPython as a program.
1254
1254
1255 Usage:\\
1255 Usage:\\
1256 %run [-n -i -t [-N<N>] -d [-b<N>] -p [profile options]] file [args]
1256 %run [-n -i -t [-N<N>] -d [-b<N>] -p [profile options]] file [args]
1257
1257
1258 Parameters after the filename are passed as command-line arguments to
1258 Parameters after the filename are passed as command-line arguments to
1259 the program (put in sys.argv). Then, control returns to IPython's
1259 the program (put in sys.argv). Then, control returns to IPython's
1260 prompt.
1260 prompt.
1261
1261
1262 This is similar to running at a system prompt:\\
1262 This is similar to running at a system prompt:\\
1263 $ python file args\\
1263 $ python file args\\
1264 but with the advantage of giving you IPython's tracebacks, and of
1264 but with the advantage of giving you IPython's tracebacks, and of
1265 loading all variables into your interactive namespace for further use
1265 loading all variables into your interactive namespace for further use
1266 (unless -p is used, see below).
1266 (unless -p is used, see below).
1267
1267
1268 The file is executed in a namespace initially consisting only of
1268 The file is executed in a namespace initially consisting only of
1269 __name__=='__main__' and sys.argv constructed as indicated. It thus
1269 __name__=='__main__' and sys.argv constructed as indicated. It thus
1270 sees its environment as if it were being run as a stand-alone
1270 sees its environment as if it were being run as a stand-alone
1271 program. But after execution, the IPython interactive namespace gets
1271 program. But after execution, the IPython interactive namespace gets
1272 updated with all variables defined in the program (except for __name__
1272 updated with all variables defined in the program (except for __name__
1273 and sys.argv). This allows for very convenient loading of code for
1273 and sys.argv). This allows for very convenient loading of code for
1274 interactive work, while giving each program a 'clean sheet' to run in.
1274 interactive work, while giving each program a 'clean sheet' to run in.
1275
1275
1276 Options:
1276 Options:
1277
1277
1278 -n: __name__ is NOT set to '__main__', but to the running file's name
1278 -n: __name__ is NOT set to '__main__', but to the running file's name
1279 without extension (as python does under import). This allows running
1279 without extension (as python does under import). This allows running
1280 scripts and reloading the definitions in them without calling code
1280 scripts and reloading the definitions in them without calling code
1281 protected by an ' if __name__ == "__main__" ' clause.
1281 protected by an ' if __name__ == "__main__" ' clause.
1282
1282
1283 -i: run the file in IPython's namespace instead of an empty one. This
1283 -i: run the file in IPython's namespace instead of an empty one. This
1284 is useful if you are experimenting with code written in a text editor
1284 is useful if you are experimenting with code written in a text editor
1285 which depends on variables defined interactively.
1285 which depends on variables defined interactively.
1286
1286
1287 -e: ignore sys.exit() calls or SystemExit exceptions in the script
1287 -e: ignore sys.exit() calls or SystemExit exceptions in the script
1288 being run. This is particularly useful if IPython is being used to
1288 being run. This is particularly useful if IPython is being used to
1289 run unittests, which always exit with a sys.exit() call. In such
1289 run unittests, which always exit with a sys.exit() call. In such
1290 cases you are interested in the output of the test results, not in
1290 cases you are interested in the output of the test results, not in
1291 seeing a traceback of the unittest module.
1291 seeing a traceback of the unittest module.
1292
1292
1293 -t: print timing information at the end of the run. IPython will give
1293 -t: print timing information at the end of the run. IPython will give
1294 you an estimated CPU time consumption for your script, which under
1294 you an estimated CPU time consumption for your script, which under
1295 Unix uses the resource module to avoid the wraparound problems of
1295 Unix uses the resource module to avoid the wraparound problems of
1296 time.clock(). Under Unix, an estimate of time spent on system tasks
1296 time.clock(). Under Unix, an estimate of time spent on system tasks
1297 is also given (for Windows platforms this is reported as 0.0).
1297 is also given (for Windows platforms this is reported as 0.0).
1298
1298
1299 If -t is given, an additional -N<N> option can be given, where <N>
1299 If -t is given, an additional -N<N> option can be given, where <N>
1300 must be an integer indicating how many times you want the script to
1300 must be an integer indicating how many times you want the script to
1301 run. The final timing report will include total and per run results.
1301 run. The final timing report will include total and per run results.
1302
1302
1303 For example (testing the script uniq_stable.py):
1303 For example (testing the script uniq_stable.py):
1304
1304
1305 In [1]: run -t uniq_stable
1305 In [1]: run -t uniq_stable
1306
1306
1307 IPython CPU timings (estimated):\\
1307 IPython CPU timings (estimated):\\
1308 User : 0.19597 s.\\
1308 User : 0.19597 s.\\
1309 System: 0.0 s.\\
1309 System: 0.0 s.\\
1310
1310
1311 In [2]: run -t -N5 uniq_stable
1311 In [2]: run -t -N5 uniq_stable
1312
1312
1313 IPython CPU timings (estimated):\\
1313 IPython CPU timings (estimated):\\
1314 Total runs performed: 5\\
1314 Total runs performed: 5\\
1315 Times : Total Per run\\
1315 Times : Total Per run\\
1316 User : 0.910862 s, 0.1821724 s.\\
1316 User : 0.910862 s, 0.1821724 s.\\
1317 System: 0.0 s, 0.0 s.
1317 System: 0.0 s, 0.0 s.
1318
1318
1319 -d: run your program under the control of pdb, the Python debugger.
1319 -d: run your program under the control of pdb, the Python debugger.
1320 This allows you to execute your program step by step, watch variables,
1320 This allows you to execute your program step by step, watch variables,
1321 etc. Internally, what IPython does is similar to calling:
1321 etc. Internally, what IPython does is similar to calling:
1322
1322
1323 pdb.run('execfile("YOURFILENAME")')
1323 pdb.run('execfile("YOURFILENAME")')
1324
1324
1325 with a breakpoint set on line 1 of your file. You can change the line
1325 with a breakpoint set on line 1 of your file. You can change the line
1326 number for this automatic breakpoint to be <N> by using the -bN option
1326 number for this automatic breakpoint to be <N> by using the -bN option
1327 (where N must be an integer). For example:
1327 (where N must be an integer). For example:
1328
1328
1329 %run -d -b40 myscript
1329 %run -d -b40 myscript
1330
1330
1331 will set the first breakpoint at line 40 in myscript.py. Note that
1331 will set the first breakpoint at line 40 in myscript.py. Note that
1332 the first breakpoint must be set on a line which actually does
1332 the first breakpoint must be set on a line which actually does
1333 something (not a comment or docstring) for it to stop execution.
1333 something (not a comment or docstring) for it to stop execution.
1334
1334
1335 When the pdb debugger starts, you will see a (Pdb) prompt. You must
1335 When the pdb debugger starts, you will see a (Pdb) prompt. You must
1336 first enter 'c' (without qoutes) to start execution up to the first
1336 first enter 'c' (without qoutes) to start execution up to the first
1337 breakpoint.
1337 breakpoint.
1338
1338
1339 Entering 'help' gives information about the use of the debugger. You
1339 Entering 'help' gives information about the use of the debugger. You
1340 can easily see pdb's full documentation with "import pdb;pdb.help()"
1340 can easily see pdb's full documentation with "import pdb;pdb.help()"
1341 at a prompt.
1341 at a prompt.
1342
1342
1343 -p: run program under the control of the Python profiler module (which
1343 -p: run program under the control of the Python profiler module (which
1344 prints a detailed report of execution times, function calls, etc).
1344 prints a detailed report of execution times, function calls, etc).
1345
1345
1346 You can pass other options after -p which affect the behavior of the
1346 You can pass other options after -p which affect the behavior of the
1347 profiler itself. See the docs for %prun for details.
1347 profiler itself. See the docs for %prun for details.
1348
1348
1349 In this mode, the program's variables do NOT propagate back to the
1349 In this mode, the program's variables do NOT propagate back to the
1350 IPython interactive namespace (because they remain in the namespace
1350 IPython interactive namespace (because they remain in the namespace
1351 where the profiler executes them).
1351 where the profiler executes them).
1352
1352
1353 Internally this triggers a call to %prun, see its documentation for
1353 Internally this triggers a call to %prun, see its documentation for
1354 details on the options available specifically for profiling.
1354 details on the options available specifically for profiling.
1355
1355
1356 There is one special usage for which the text above doesn't apply:
1356 There is one special usage for which the text above doesn't apply:
1357 if the filename ends with .ipy, the file is run as ipython script,
1357 if the filename ends with .ipy, the file is run as ipython script,
1358 just as if the commands were written on IPython prompt.
1358 just as if the commands were written on IPython prompt.
1359 """
1359 """
1360
1360
1361 # get arguments and set sys.argv for program to be run.
1361 # get arguments and set sys.argv for program to be run.
1362 opts,arg_lst = self.parse_options(parameter_s,'nidtN:b:pD:l:rs:T:e',
1362 opts,arg_lst = self.parse_options(parameter_s,'nidtN:b:pD:l:rs:T:e',
1363 mode='list',list_all=1)
1363 mode='list',list_all=1)
1364
1364
1365 try:
1365 try:
1366 filename = get_py_filename(arg_lst[0])
1366 filename = get_py_filename(arg_lst[0])
1367 except IndexError:
1367 except IndexError:
1368 warn('you must provide at least a filename.')
1368 warn('you must provide at least a filename.')
1369 print '\n%run:\n',OInspect.getdoc(self.magic_run)
1369 print '\n%run:\n',OInspect.getdoc(self.magic_run)
1370 return
1370 return
1371 except IOError,msg:
1371 except IOError,msg:
1372 error(msg)
1372 error(msg)
1373 return
1373 return
1374
1374
1375 if filename.lower().endswith('.ipy'):
1375 if filename.lower().endswith('.ipy'):
1376 self.api.runlines(open(filename).read())
1376 self.api.runlines(open(filename).read())
1377 return
1377 return
1378
1378
1379 # Control the response to exit() calls made by the script being run
1379 # Control the response to exit() calls made by the script being run
1380 exit_ignore = opts.has_key('e')
1380 exit_ignore = opts.has_key('e')
1381
1381
1382 # Make sure that the running script gets a proper sys.argv as if it
1382 # Make sure that the running script gets a proper sys.argv as if it
1383 # were run from a system shell.
1383 # were run from a system shell.
1384 save_argv = sys.argv # save it for later restoring
1384 save_argv = sys.argv # save it for later restoring
1385 sys.argv = [filename]+ arg_lst[1:] # put in the proper filename
1385 sys.argv = [filename]+ arg_lst[1:] # put in the proper filename
1386
1386
1387 if opts.has_key('i'):
1387 if opts.has_key('i'):
1388 prog_ns = self.shell.user_ns
1388 prog_ns = self.shell.user_ns
1389 __name__save = self.shell.user_ns['__name__']
1389 __name__save = self.shell.user_ns['__name__']
1390 prog_ns['__name__'] = '__main__'
1390 prog_ns['__name__'] = '__main__'
1391 else:
1391 else:
1392 if opts.has_key('n'):
1392 if opts.has_key('n'):
1393 name = os.path.splitext(os.path.basename(filename))[0]
1393 name = os.path.splitext(os.path.basename(filename))[0]
1394 else:
1394 else:
1395 name = '__main__'
1395 name = '__main__'
1396 prog_ns = {'__name__':name}
1396 prog_ns = {'__name__':name}
1397
1397
1398 # Since '%run foo' emulates 'python foo.py' at the cmd line, we must
1398 # Since '%run foo' emulates 'python foo.py' at the cmd line, we must
1399 # set the __file__ global in the script's namespace
1399 # set the __file__ global in the script's namespace
1400 prog_ns['__file__'] = filename
1400 prog_ns['__file__'] = filename
1401
1401
1402 # pickle fix. See iplib for an explanation. But we need to make sure
1402 # pickle fix. See iplib for an explanation. But we need to make sure
1403 # that, if we overwrite __main__, we replace it at the end
1403 # that, if we overwrite __main__, we replace it at the end
1404 if prog_ns['__name__'] == '__main__':
1404 if prog_ns['__name__'] == '__main__':
1405 restore_main = sys.modules['__main__']
1405 restore_main = sys.modules['__main__']
1406 else:
1406 else:
1407 restore_main = False
1407 restore_main = False
1408
1408
1409 sys.modules[prog_ns['__name__']] = FakeModule(prog_ns)
1409 sys.modules[prog_ns['__name__']] = FakeModule(prog_ns)
1410
1410
1411 stats = None
1411 stats = None
1412 try:
1412 try:
1413 if self.shell.has_readline:
1413 if self.shell.has_readline:
1414 self.shell.savehist()
1414 self.shell.savehist()
1415
1415
1416 if opts.has_key('p'):
1416 if opts.has_key('p'):
1417 stats = self.magic_prun('',0,opts,arg_lst,prog_ns)
1417 stats = self.magic_prun('',0,opts,arg_lst,prog_ns)
1418 else:
1418 else:
1419 if opts.has_key('d'):
1419 if opts.has_key('d'):
1420 deb = Debugger.Pdb(self.shell.rc.colors)
1420 deb = Debugger.Pdb(self.shell.rc.colors)
1421 # reset Breakpoint state, which is moronically kept
1421 # reset Breakpoint state, which is moronically kept
1422 # in a class
1422 # in a class
1423 bdb.Breakpoint.next = 1
1423 bdb.Breakpoint.next = 1
1424 bdb.Breakpoint.bplist = {}
1424 bdb.Breakpoint.bplist = {}
1425 bdb.Breakpoint.bpbynumber = [None]
1425 bdb.Breakpoint.bpbynumber = [None]
1426 # Set an initial breakpoint to stop execution
1426 # Set an initial breakpoint to stop execution
1427 maxtries = 10
1427 maxtries = 10
1428 bp = int(opts.get('b',[1])[0])
1428 bp = int(opts.get('b',[1])[0])
1429 checkline = deb.checkline(filename,bp)
1429 checkline = deb.checkline(filename,bp)
1430 if not checkline:
1430 if not checkline:
1431 for bp in range(bp+1,bp+maxtries+1):
1431 for bp in range(bp+1,bp+maxtries+1):
1432 if deb.checkline(filename,bp):
1432 if deb.checkline(filename,bp):
1433 break
1433 break
1434 else:
1434 else:
1435 msg = ("\nI failed to find a valid line to set "
1435 msg = ("\nI failed to find a valid line to set "
1436 "a breakpoint\n"
1436 "a breakpoint\n"
1437 "after trying up to line: %s.\n"
1437 "after trying up to line: %s.\n"
1438 "Please set a valid breakpoint manually "
1438 "Please set a valid breakpoint manually "
1439 "with the -b option." % bp)
1439 "with the -b option." % bp)
1440 error(msg)
1440 error(msg)
1441 return
1441 return
1442 # if we find a good linenumber, set the breakpoint
1442 # if we find a good linenumber, set the breakpoint
1443 deb.do_break('%s:%s' % (filename,bp))
1443 deb.do_break('%s:%s' % (filename,bp))
1444 # Start file run
1444 # Start file run
1445 print "NOTE: Enter 'c' at the",
1445 print "NOTE: Enter 'c' at the",
1446 print "%s prompt to start your script." % deb.prompt
1446 print "%s prompt to start your script." % deb.prompt
1447 try:
1447 try:
1448 deb.run('execfile("%s")' % filename,prog_ns)
1448 deb.run('execfile("%s")' % filename,prog_ns)
1449
1449
1450 except:
1450 except:
1451 etype, value, tb = sys.exc_info()
1451 etype, value, tb = sys.exc_info()
1452 # Skip three frames in the traceback: the %run one,
1452 # Skip three frames in the traceback: the %run one,
1453 # one inside bdb.py, and the command-line typed by the
1453 # one inside bdb.py, and the command-line typed by the
1454 # user (run by exec in pdb itself).
1454 # user (run by exec in pdb itself).
1455 self.shell.InteractiveTB(etype,value,tb,tb_offset=3)
1455 self.shell.InteractiveTB(etype,value,tb,tb_offset=3)
1456 else:
1456 else:
1457 if runner is None:
1457 if runner is None:
1458 runner = self.shell.safe_execfile
1458 runner = self.shell.safe_execfile
1459 if opts.has_key('t'):
1459 if opts.has_key('t'):
1460 try:
1460 try:
1461 nruns = int(opts['N'][0])
1461 nruns = int(opts['N'][0])
1462 if nruns < 1:
1462 if nruns < 1:
1463 error('Number of runs must be >=1')
1463 error('Number of runs must be >=1')
1464 return
1464 return
1465 except (KeyError):
1465 except (KeyError):
1466 nruns = 1
1466 nruns = 1
1467 if nruns == 1:
1467 if nruns == 1:
1468 t0 = clock2()
1468 t0 = clock2()
1469 runner(filename,prog_ns,prog_ns,
1469 runner(filename,prog_ns,prog_ns,
1470 exit_ignore=exit_ignore)
1470 exit_ignore=exit_ignore)
1471 t1 = clock2()
1471 t1 = clock2()
1472 t_usr = t1[0]-t0[0]
1472 t_usr = t1[0]-t0[0]
1473 t_sys = t1[1]-t1[1]
1473 t_sys = t1[1]-t1[1]
1474 print "\nIPython CPU timings (estimated):"
1474 print "\nIPython CPU timings (estimated):"
1475 print " User : %10s s." % t_usr
1475 print " User : %10s s." % t_usr
1476 print " System: %10s s." % t_sys
1476 print " System: %10s s." % t_sys
1477 else:
1477 else:
1478 runs = range(nruns)
1478 runs = range(nruns)
1479 t0 = clock2()
1479 t0 = clock2()
1480 for nr in runs:
1480 for nr in runs:
1481 runner(filename,prog_ns,prog_ns,
1481 runner(filename,prog_ns,prog_ns,
1482 exit_ignore=exit_ignore)
1482 exit_ignore=exit_ignore)
1483 t1 = clock2()
1483 t1 = clock2()
1484 t_usr = t1[0]-t0[0]
1484 t_usr = t1[0]-t0[0]
1485 t_sys = t1[1]-t1[1]
1485 t_sys = t1[1]-t1[1]
1486 print "\nIPython CPU timings (estimated):"
1486 print "\nIPython CPU timings (estimated):"
1487 print "Total runs performed:",nruns
1487 print "Total runs performed:",nruns
1488 print " Times : %10s %10s" % ('Total','Per run')
1488 print " Times : %10s %10s" % ('Total','Per run')
1489 print " User : %10s s, %10s s." % (t_usr,t_usr/nruns)
1489 print " User : %10s s, %10s s." % (t_usr,t_usr/nruns)
1490 print " System: %10s s, %10s s." % (t_sys,t_sys/nruns)
1490 print " System: %10s s, %10s s." % (t_sys,t_sys/nruns)
1491
1491
1492 else:
1492 else:
1493 runner(filename,prog_ns,prog_ns,exit_ignore=exit_ignore)
1493 runner(filename,prog_ns,prog_ns,exit_ignore=exit_ignore)
1494 if opts.has_key('i'):
1494 if opts.has_key('i'):
1495 self.shell.user_ns['__name__'] = __name__save
1495 self.shell.user_ns['__name__'] = __name__save
1496 else:
1496 else:
1497 # update IPython interactive namespace
1497 # update IPython interactive namespace
1498 del prog_ns['__name__']
1498 del prog_ns['__name__']
1499 self.shell.user_ns.update(prog_ns)
1499 self.shell.user_ns.update(prog_ns)
1500 finally:
1500 finally:
1501 sys.argv = save_argv
1501 sys.argv = save_argv
1502 if restore_main:
1502 if restore_main:
1503 sys.modules['__main__'] = restore_main
1503 sys.modules['__main__'] = restore_main
1504 self.shell.reloadhist()
1504 self.shell.reloadhist()
1505
1505
1506 return stats
1506 return stats
1507
1507
1508 def magic_runlog(self, parameter_s =''):
1508 def magic_runlog(self, parameter_s =''):
1509 """Run files as logs.
1509 """Run files as logs.
1510
1510
1511 Usage:\\
1511 Usage:\\
1512 %runlog file1 file2 ...
1512 %runlog file1 file2 ...
1513
1513
1514 Run the named files (treating them as log files) in sequence inside
1514 Run the named files (treating them as log files) in sequence inside
1515 the interpreter, and return to the prompt. This is much slower than
1515 the interpreter, and return to the prompt. This is much slower than
1516 %run because each line is executed in a try/except block, but it
1516 %run because each line is executed in a try/except block, but it
1517 allows running files with syntax errors in them.
1517 allows running files with syntax errors in them.
1518
1518
1519 Normally IPython will guess when a file is one of its own logfiles, so
1519 Normally IPython will guess when a file is one of its own logfiles, so
1520 you can typically use %run even for logs. This shorthand allows you to
1520 you can typically use %run even for logs. This shorthand allows you to
1521 force any file to be treated as a log file."""
1521 force any file to be treated as a log file."""
1522
1522
1523 for f in parameter_s.split():
1523 for f in parameter_s.split():
1524 self.shell.safe_execfile(f,self.shell.user_ns,
1524 self.shell.safe_execfile(f,self.shell.user_ns,
1525 self.shell.user_ns,islog=1)
1525 self.shell.user_ns,islog=1)
1526
1526
1527 def magic_timeit(self, parameter_s =''):
1527 def magic_timeit(self, parameter_s =''):
1528 """Time execution of a Python statement or expression
1528 """Time execution of a Python statement or expression
1529
1529
1530 Usage:\\
1530 Usage:\\
1531 %timeit [-n<N> -r<R> [-t|-c]] statement
1531 %timeit [-n<N> -r<R> [-t|-c]] statement
1532
1532
1533 Time execution of a Python statement or expression using the timeit
1533 Time execution of a Python statement or expression using the timeit
1534 module.
1534 module.
1535
1535
1536 Options:
1536 Options:
1537 -n<N>: execute the given statement <N> times in a loop. If this value
1537 -n<N>: execute the given statement <N> times in a loop. If this value
1538 is not given, a fitting value is chosen.
1538 is not given, a fitting value is chosen.
1539
1539
1540 -r<R>: repeat the loop iteration <R> times and take the best result.
1540 -r<R>: repeat the loop iteration <R> times and take the best result.
1541 Default: 3
1541 Default: 3
1542
1542
1543 -t: use time.time to measure the time, which is the default on Unix.
1543 -t: use time.time to measure the time, which is the default on Unix.
1544 This function measures wall time.
1544 This function measures wall time.
1545
1545
1546 -c: use time.clock to measure the time, which is the default on
1546 -c: use time.clock to measure the time, which is the default on
1547 Windows and measures wall time. On Unix, resource.getrusage is used
1547 Windows and measures wall time. On Unix, resource.getrusage is used
1548 instead and returns the CPU user time.
1548 instead and returns the CPU user time.
1549
1549
1550 -p<P>: use a precision of <P> digits to display the timing result.
1550 -p<P>: use a precision of <P> digits to display the timing result.
1551 Default: 3
1551 Default: 3
1552
1552
1553
1553
1554 Examples:\\
1554 Examples:\\
1555 In [1]: %timeit pass
1555 In [1]: %timeit pass
1556 10000000 loops, best of 3: 53.3 ns per loop
1556 10000000 loops, best of 3: 53.3 ns per loop
1557
1557
1558 In [2]: u = None
1558 In [2]: u = None
1559
1559
1560 In [3]: %timeit u is None
1560 In [3]: %timeit u is None
1561 10000000 loops, best of 3: 184 ns per loop
1561 10000000 loops, best of 3: 184 ns per loop
1562
1562
1563 In [4]: %timeit -r 4 u == None
1563 In [4]: %timeit -r 4 u == None
1564 1000000 loops, best of 4: 242 ns per loop
1564 1000000 loops, best of 4: 242 ns per loop
1565
1565
1566 In [5]: import time
1566 In [5]: import time
1567
1567
1568 In [6]: %timeit -n1 time.sleep(2)
1568 In [6]: %timeit -n1 time.sleep(2)
1569 1 loops, best of 3: 2 s per loop
1569 1 loops, best of 3: 2 s per loop
1570
1570
1571
1571
1572 The times reported by %timeit will be slightly higher than those
1572 The times reported by %timeit will be slightly higher than those
1573 reported by the timeit.py script when variables are accessed. This is
1573 reported by the timeit.py script when variables are accessed. This is
1574 due to the fact that %timeit executes the statement in the namespace
1574 due to the fact that %timeit executes the statement in the namespace
1575 of the shell, compared with timeit.py, which uses a single setup
1575 of the shell, compared with timeit.py, which uses a single setup
1576 statement to import function or create variables. Generally, the bias
1576 statement to import function or create variables. Generally, the bias
1577 does not matter as long as results from timeit.py are not mixed with
1577 does not matter as long as results from timeit.py are not mixed with
1578 those from %timeit."""
1578 those from %timeit."""
1579
1579
1580 import timeit
1580 import timeit
1581 import math
1581 import math
1582
1582
1583 units = ["s", "ms", "\xc2\xb5s", "ns"]
1583 units = ["s", "ms", "\xc2\xb5s", "ns"]
1584 scaling = [1, 1e3, 1e6, 1e9]
1584 scaling = [1, 1e3, 1e6, 1e9]
1585
1585
1586 opts, stmt = self.parse_options(parameter_s,'n:r:tcp:',
1586 opts, stmt = self.parse_options(parameter_s,'n:r:tcp:',
1587 posix=False)
1587 posix=False)
1588 if stmt == "":
1588 if stmt == "":
1589 return
1589 return
1590 timefunc = timeit.default_timer
1590 timefunc = timeit.default_timer
1591 number = int(getattr(opts, "n", 0))
1591 number = int(getattr(opts, "n", 0))
1592 repeat = int(getattr(opts, "r", timeit.default_repeat))
1592 repeat = int(getattr(opts, "r", timeit.default_repeat))
1593 precision = int(getattr(opts, "p", 3))
1593 precision = int(getattr(opts, "p", 3))
1594 if hasattr(opts, "t"):
1594 if hasattr(opts, "t"):
1595 timefunc = time.time
1595 timefunc = time.time
1596 if hasattr(opts, "c"):
1596 if hasattr(opts, "c"):
1597 timefunc = clock
1597 timefunc = clock
1598
1598
1599 timer = timeit.Timer(timer=timefunc)
1599 timer = timeit.Timer(timer=timefunc)
1600 # this code has tight coupling to the inner workings of timeit.Timer,
1600 # this code has tight coupling to the inner workings of timeit.Timer,
1601 # but is there a better way to achieve that the code stmt has access
1601 # but is there a better way to achieve that the code stmt has access
1602 # to the shell namespace?
1602 # to the shell namespace?
1603
1603
1604 src = timeit.template % {'stmt': timeit.reindent(stmt, 8),
1604 src = timeit.template % {'stmt': timeit.reindent(stmt, 8),
1605 'setup': "pass"}
1605 'setup': "pass"}
1606 code = compile(src, "<magic-timeit>", "exec")
1606 code = compile(src, "<magic-timeit>", "exec")
1607 ns = {}
1607 ns = {}
1608 exec code in self.shell.user_ns, ns
1608 exec code in self.shell.user_ns, ns
1609 timer.inner = ns["inner"]
1609 timer.inner = ns["inner"]
1610
1610
1611 if number == 0:
1611 if number == 0:
1612 # determine number so that 0.2 <= total time < 2.0
1612 # determine number so that 0.2 <= total time < 2.0
1613 number = 1
1613 number = 1
1614 for i in range(1, 10):
1614 for i in range(1, 10):
1615 number *= 10
1615 number *= 10
1616 if timer.timeit(number) >= 0.2:
1616 if timer.timeit(number) >= 0.2:
1617 break
1617 break
1618
1618
1619 best = min(timer.repeat(repeat, number)) / number
1619 best = min(timer.repeat(repeat, number)) / number
1620
1620
1621 if best > 0.0:
1621 if best > 0.0:
1622 order = min(-int(math.floor(math.log10(best)) // 3), 3)
1622 order = min(-int(math.floor(math.log10(best)) // 3), 3)
1623 else:
1623 else:
1624 order = 3
1624 order = 3
1625 print "%d loops, best of %d: %.*g %s per loop" % (number, repeat,
1625 print "%d loops, best of %d: %.*g %s per loop" % (number, repeat,
1626 precision,
1626 precision,
1627 best * scaling[order],
1627 best * scaling[order],
1628 units[order])
1628 units[order])
1629
1629
1630 def magic_time(self,parameter_s = ''):
1630 def magic_time(self,parameter_s = ''):
1631 """Time execution of a Python statement or expression.
1631 """Time execution of a Python statement or expression.
1632
1632
1633 The CPU and wall clock times are printed, and the value of the
1633 The CPU and wall clock times are printed, and the value of the
1634 expression (if any) is returned. Note that under Win32, system time
1634 expression (if any) is returned. Note that under Win32, system time
1635 is always reported as 0, since it can not be measured.
1635 is always reported as 0, since it can not be measured.
1636
1636
1637 This function provides very basic timing functionality. In Python
1637 This function provides very basic timing functionality. In Python
1638 2.3, the timeit module offers more control and sophistication, so this
1638 2.3, the timeit module offers more control and sophistication, so this
1639 could be rewritten to use it (patches welcome).
1639 could be rewritten to use it (patches welcome).
1640
1640
1641 Some examples:
1641 Some examples:
1642
1642
1643 In [1]: time 2**128
1643 In [1]: time 2**128
1644 CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s
1644 CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s
1645 Wall time: 0.00
1645 Wall time: 0.00
1646 Out[1]: 340282366920938463463374607431768211456L
1646 Out[1]: 340282366920938463463374607431768211456L
1647
1647
1648 In [2]: n = 1000000
1648 In [2]: n = 1000000
1649
1649
1650 In [3]: time sum(range(n))
1650 In [3]: time sum(range(n))
1651 CPU times: user 1.20 s, sys: 0.05 s, total: 1.25 s
1651 CPU times: user 1.20 s, sys: 0.05 s, total: 1.25 s
1652 Wall time: 1.37
1652 Wall time: 1.37
1653 Out[3]: 499999500000L
1653 Out[3]: 499999500000L
1654
1654
1655 In [4]: time print 'hello world'
1655 In [4]: time print 'hello world'
1656 hello world
1656 hello world
1657 CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s
1657 CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s
1658 Wall time: 0.00
1658 Wall time: 0.00
1659 """
1659 """
1660
1660
1661 # fail immediately if the given expression can't be compiled
1661 # fail immediately if the given expression can't be compiled
1662 try:
1662 try:
1663 mode = 'eval'
1663 mode = 'eval'
1664 code = compile(parameter_s,'<timed eval>',mode)
1664 code = compile(parameter_s,'<timed eval>',mode)
1665 except SyntaxError:
1665 except SyntaxError:
1666 mode = 'exec'
1666 mode = 'exec'
1667 code = compile(parameter_s,'<timed exec>',mode)
1667 code = compile(parameter_s,'<timed exec>',mode)
1668 # skew measurement as little as possible
1668 # skew measurement as little as possible
1669 glob = self.shell.user_ns
1669 glob = self.shell.user_ns
1670 clk = clock2
1670 clk = clock2
1671 wtime = time.time
1671 wtime = time.time
1672 # time execution
1672 # time execution
1673 wall_st = wtime()
1673 wall_st = wtime()
1674 if mode=='eval':
1674 if mode=='eval':
1675 st = clk()
1675 st = clk()
1676 out = eval(code,glob)
1676 out = eval(code,glob)
1677 end = clk()
1677 end = clk()
1678 else:
1678 else:
1679 st = clk()
1679 st = clk()
1680 exec code in glob
1680 exec code in glob
1681 end = clk()
1681 end = clk()
1682 out = None
1682 out = None
1683 wall_end = wtime()
1683 wall_end = wtime()
1684 # Compute actual times and report
1684 # Compute actual times and report
1685 wall_time = wall_end-wall_st
1685 wall_time = wall_end-wall_st
1686 cpu_user = end[0]-st[0]
1686 cpu_user = end[0]-st[0]
1687 cpu_sys = end[1]-st[1]
1687 cpu_sys = end[1]-st[1]
1688 cpu_tot = cpu_user+cpu_sys
1688 cpu_tot = cpu_user+cpu_sys
1689 print "CPU times: user %.2f s, sys: %.2f s, total: %.2f s" % \
1689 print "CPU times: user %.2f s, sys: %.2f s, total: %.2f s" % \
1690 (cpu_user,cpu_sys,cpu_tot)
1690 (cpu_user,cpu_sys,cpu_tot)
1691 print "Wall time: %.2f" % wall_time
1691 print "Wall time: %.2f" % wall_time
1692 return out
1692 return out
1693
1693
1694 def magic_macro(self,parameter_s = ''):
1694 def magic_macro(self,parameter_s = ''):
1695 """Define a set of input lines as a macro for future re-execution.
1695 """Define a set of input lines as a macro for future re-execution.
1696
1696
1697 Usage:\\
1697 Usage:\\
1698 %macro [options] name n1-n2 n3-n4 ... n5 .. n6 ...
1698 %macro [options] name n1-n2 n3-n4 ... n5 .. n6 ...
1699
1699
1700 Options:
1700 Options:
1701
1701
1702 -r: use 'raw' input. By default, the 'processed' history is used,
1702 -r: use 'raw' input. By default, the 'processed' history is used,
1703 so that magics are loaded in their transformed version to valid
1703 so that magics are loaded in their transformed version to valid
1704 Python. If this option is given, the raw input as typed as the
1704 Python. If this option is given, the raw input as typed as the
1705 command line is used instead.
1705 command line is used instead.
1706
1706
1707 This will define a global variable called `name` which is a string
1707 This will define a global variable called `name` which is a string
1708 made of joining the slices and lines you specify (n1,n2,... numbers
1708 made of joining the slices and lines you specify (n1,n2,... numbers
1709 above) from your input history into a single string. This variable
1709 above) from your input history into a single string. This variable
1710 acts like an automatic function which re-executes those lines as if
1710 acts like an automatic function which re-executes those lines as if
1711 you had typed them. You just type 'name' at the prompt and the code
1711 you had typed them. You just type 'name' at the prompt and the code
1712 executes.
1712 executes.
1713
1713
1714 The notation for indicating number ranges is: n1-n2 means 'use line
1714 The notation for indicating number ranges is: n1-n2 means 'use line
1715 numbers n1,...n2' (the endpoint is included). That is, '5-7' means
1715 numbers n1,...n2' (the endpoint is included). That is, '5-7' means
1716 using the lines numbered 5,6 and 7.
1716 using the lines numbered 5,6 and 7.
1717
1717
1718 Note: as a 'hidden' feature, you can also use traditional python slice
1718 Note: as a 'hidden' feature, you can also use traditional python slice
1719 notation, where N:M means numbers N through M-1.
1719 notation, where N:M means numbers N through M-1.
1720
1720
1721 For example, if your history contains (%hist prints it):
1721 For example, if your history contains (%hist prints it):
1722
1722
1723 44: x=1\\
1723 44: x=1\\
1724 45: y=3\\
1724 45: y=3\\
1725 46: z=x+y\\
1725 46: z=x+y\\
1726 47: print x\\
1726 47: print x\\
1727 48: a=5\\
1727 48: a=5\\
1728 49: print 'x',x,'y',y\\
1728 49: print 'x',x,'y',y\\
1729
1729
1730 you can create a macro with lines 44 through 47 (included) and line 49
1730 you can create a macro with lines 44 through 47 (included) and line 49
1731 called my_macro with:
1731 called my_macro with:
1732
1732
1733 In [51]: %macro my_macro 44-47 49
1733 In [51]: %macro my_macro 44-47 49
1734
1734
1735 Now, typing `my_macro` (without quotes) will re-execute all this code
1735 Now, typing `my_macro` (without quotes) will re-execute all this code
1736 in one pass.
1736 in one pass.
1737
1737
1738 You don't need to give the line-numbers in order, and any given line
1738 You don't need to give the line-numbers in order, and any given line
1739 number can appear multiple times. You can assemble macros with any
1739 number can appear multiple times. You can assemble macros with any
1740 lines from your input history in any order.
1740 lines from your input history in any order.
1741
1741
1742 The macro is a simple object which holds its value in an attribute,
1742 The macro is a simple object which holds its value in an attribute,
1743 but IPython's display system checks for macros and executes them as
1743 but IPython's display system checks for macros and executes them as
1744 code instead of printing them when you type their name.
1744 code instead of printing them when you type their name.
1745
1745
1746 You can view a macro's contents by explicitly printing it with:
1746 You can view a macro's contents by explicitly printing it with:
1747
1747
1748 'print macro_name'.
1748 'print macro_name'.
1749
1749
1750 For one-off cases which DON'T contain magic function calls in them you
1750 For one-off cases which DON'T contain magic function calls in them you
1751 can obtain similar results by explicitly executing slices from your
1751 can obtain similar results by explicitly executing slices from your
1752 input history with:
1752 input history with:
1753
1753
1754 In [60]: exec In[44:48]+In[49]"""
1754 In [60]: exec In[44:48]+In[49]"""
1755
1755
1756 opts,args = self.parse_options(parameter_s,'r',mode='list')
1756 opts,args = self.parse_options(parameter_s,'r',mode='list')
1757 if not args:
1757 if not args:
1758 macs = [k for k,v in self.shell.user_ns.items() if isinstance(v, Macro)]
1758 macs = [k for k,v in self.shell.user_ns.items() if isinstance(v, Macro)]
1759 macs.sort()
1759 macs.sort()
1760 return macs
1760 return macs
1761 name,ranges = args[0], args[1:]
1761 name,ranges = args[0], args[1:]
1762 #print 'rng',ranges # dbg
1762 #print 'rng',ranges # dbg
1763 lines = self.extract_input_slices(ranges,opts.has_key('r'))
1763 lines = self.extract_input_slices(ranges,opts.has_key('r'))
1764 macro = Macro(lines)
1764 macro = Macro(lines)
1765 self.shell.user_ns.update({name:macro})
1765 self.shell.user_ns.update({name:macro})
1766 print 'Macro `%s` created. To execute, type its name (without quotes).' % name
1766 print 'Macro `%s` created. To execute, type its name (without quotes).' % name
1767 print 'Macro contents:'
1767 print 'Macro contents:'
1768 print macro,
1768 print macro,
1769
1769
1770 def magic_save(self,parameter_s = ''):
1770 def magic_save(self,parameter_s = ''):
1771 """Save a set of lines to a given filename.
1771 """Save a set of lines to a given filename.
1772
1772
1773 Usage:\\
1773 Usage:\\
1774 %save [options] filename n1-n2 n3-n4 ... n5 .. n6 ...
1774 %save [options] filename n1-n2 n3-n4 ... n5 .. n6 ...
1775
1775
1776 Options:
1776 Options:
1777
1777
1778 -r: use 'raw' input. By default, the 'processed' history is used,
1778 -r: use 'raw' input. By default, the 'processed' history is used,
1779 so that magics are loaded in their transformed version to valid
1779 so that magics are loaded in their transformed version to valid
1780 Python. If this option is given, the raw input as typed as the
1780 Python. If this option is given, the raw input as typed as the
1781 command line is used instead.
1781 command line is used instead.
1782
1782
1783 This function uses the same syntax as %macro for line extraction, but
1783 This function uses the same syntax as %macro for line extraction, but
1784 instead of creating a macro it saves the resulting string to the
1784 instead of creating a macro it saves the resulting string to the
1785 filename you specify.
1785 filename you specify.
1786
1786
1787 It adds a '.py' extension to the file if you don't do so yourself, and
1787 It adds a '.py' extension to the file if you don't do so yourself, and
1788 it asks for confirmation before overwriting existing files."""
1788 it asks for confirmation before overwriting existing files."""
1789
1789
1790 opts,args = self.parse_options(parameter_s,'r',mode='list')
1790 opts,args = self.parse_options(parameter_s,'r',mode='list')
1791 fname,ranges = args[0], args[1:]
1791 fname,ranges = args[0], args[1:]
1792 if not fname.endswith('.py'):
1792 if not fname.endswith('.py'):
1793 fname += '.py'
1793 fname += '.py'
1794 if os.path.isfile(fname):
1794 if os.path.isfile(fname):
1795 ans = raw_input('File `%s` exists. Overwrite (y/[N])? ' % fname)
1795 ans = raw_input('File `%s` exists. Overwrite (y/[N])? ' % fname)
1796 if ans.lower() not in ['y','yes']:
1796 if ans.lower() not in ['y','yes']:
1797 print 'Operation cancelled.'
1797 print 'Operation cancelled.'
1798 return
1798 return
1799 cmds = ''.join(self.extract_input_slices(ranges,opts.has_key('r')))
1799 cmds = ''.join(self.extract_input_slices(ranges,opts.has_key('r')))
1800 f = file(fname,'w')
1800 f = file(fname,'w')
1801 f.write(cmds)
1801 f.write(cmds)
1802 f.close()
1802 f.close()
1803 print 'The following commands were written to file `%s`:' % fname
1803 print 'The following commands were written to file `%s`:' % fname
1804 print cmds
1804 print cmds
1805
1805
1806 def _edit_macro(self,mname,macro):
1806 def _edit_macro(self,mname,macro):
1807 """open an editor with the macro data in a file"""
1807 """open an editor with the macro data in a file"""
1808 filename = self.shell.mktempfile(macro.value)
1808 filename = self.shell.mktempfile(macro.value)
1809 self.shell.hooks.editor(filename)
1809 self.shell.hooks.editor(filename)
1810
1810
1811 # and make a new macro object, to replace the old one
1811 # and make a new macro object, to replace the old one
1812 mfile = open(filename)
1812 mfile = open(filename)
1813 mvalue = mfile.read()
1813 mvalue = mfile.read()
1814 mfile.close()
1814 mfile.close()
1815 self.shell.user_ns[mname] = Macro(mvalue)
1815 self.shell.user_ns[mname] = Macro(mvalue)
1816
1816
1817 def magic_ed(self,parameter_s=''):
1817 def magic_ed(self,parameter_s=''):
1818 """Alias to %edit."""
1818 """Alias to %edit."""
1819 return self.magic_edit(parameter_s)
1819 return self.magic_edit(parameter_s)
1820
1820
1821 def magic_edit(self,parameter_s='',last_call=['','']):
1821 def magic_edit(self,parameter_s='',last_call=['','']):
1822 """Bring up an editor and execute the resulting code.
1822 """Bring up an editor and execute the resulting code.
1823
1823
1824 Usage:
1824 Usage:
1825 %edit [options] [args]
1825 %edit [options] [args]
1826
1826
1827 %edit runs IPython's editor hook. The default version of this hook is
1827 %edit runs IPython's editor hook. The default version of this hook is
1828 set to call the __IPYTHON__.rc.editor command. This is read from your
1828 set to call the __IPYTHON__.rc.editor command. This is read from your
1829 environment variable $EDITOR. If this isn't found, it will default to
1829 environment variable $EDITOR. If this isn't found, it will default to
1830 vi under Linux/Unix and to notepad under Windows. See the end of this
1830 vi under Linux/Unix and to notepad under Windows. See the end of this
1831 docstring for how to change the editor hook.
1831 docstring for how to change the editor hook.
1832
1832
1833 You can also set the value of this editor via the command line option
1833 You can also set the value of this editor via the command line option
1834 '-editor' or in your ipythonrc file. This is useful if you wish to use
1834 '-editor' or in your ipythonrc file. This is useful if you wish to use
1835 specifically for IPython an editor different from your typical default
1835 specifically for IPython an editor different from your typical default
1836 (and for Windows users who typically don't set environment variables).
1836 (and for Windows users who typically don't set environment variables).
1837
1837
1838 This command allows you to conveniently edit multi-line code right in
1838 This command allows you to conveniently edit multi-line code right in
1839 your IPython session.
1839 your IPython session.
1840
1840
1841 If called without arguments, %edit opens up an empty editor with a
1841 If called without arguments, %edit opens up an empty editor with a
1842 temporary file and will execute the contents of this file when you
1842 temporary file and will execute the contents of this file when you
1843 close it (don't forget to save it!).
1843 close it (don't forget to save it!).
1844
1844
1845
1845
1846 Options:
1846 Options:
1847
1847
1848 -n <number>: open the editor at a specified line number. By default,
1848 -n <number>: open the editor at a specified line number. By default,
1849 the IPython editor hook uses the unix syntax 'editor +N filename', but
1849 the IPython editor hook uses the unix syntax 'editor +N filename', but
1850 you can configure this by providing your own modified hook if your
1850 you can configure this by providing your own modified hook if your
1851 favorite editor supports line-number specifications with a different
1851 favorite editor supports line-number specifications with a different
1852 syntax.
1852 syntax.
1853
1853
1854 -p: this will call the editor with the same data as the previous time
1854 -p: this will call the editor with the same data as the previous time
1855 it was used, regardless of how long ago (in your current session) it
1855 it was used, regardless of how long ago (in your current session) it
1856 was.
1856 was.
1857
1857
1858 -r: use 'raw' input. This option only applies to input taken from the
1858 -r: use 'raw' input. This option only applies to input taken from the
1859 user's history. By default, the 'processed' history is used, so that
1859 user's history. By default, the 'processed' history is used, so that
1860 magics are loaded in their transformed version to valid Python. If
1860 magics are loaded in their transformed version to valid Python. If
1861 this option is given, the raw input as typed as the command line is
1861 this option is given, the raw input as typed as the command line is
1862 used instead. When you exit the editor, it will be executed by
1862 used instead. When you exit the editor, it will be executed by
1863 IPython's own processor.
1863 IPython's own processor.
1864
1864
1865 -x: do not execute the edited code immediately upon exit. This is
1865 -x: do not execute the edited code immediately upon exit. This is
1866 mainly useful if you are editing programs which need to be called with
1866 mainly useful if you are editing programs which need to be called with
1867 command line arguments, which you can then do using %run.
1867 command line arguments, which you can then do using %run.
1868
1868
1869
1869
1870 Arguments:
1870 Arguments:
1871
1871
1872 If arguments are given, the following possibilites exist:
1872 If arguments are given, the following possibilites exist:
1873
1873
1874 - The arguments are numbers or pairs of colon-separated numbers (like
1874 - The arguments are numbers or pairs of colon-separated numbers (like
1875 1 4:8 9). These are interpreted as lines of previous input to be
1875 1 4:8 9). These are interpreted as lines of previous input to be
1876 loaded into the editor. The syntax is the same of the %macro command.
1876 loaded into the editor. The syntax is the same of the %macro command.
1877
1877
1878 - If the argument doesn't start with a number, it is evaluated as a
1878 - If the argument doesn't start with a number, it is evaluated as a
1879 variable and its contents loaded into the editor. You can thus edit
1879 variable and its contents loaded into the editor. You can thus edit
1880 any string which contains python code (including the result of
1880 any string which contains python code (including the result of
1881 previous edits).
1881 previous edits).
1882
1882
1883 - If the argument is the name of an object (other than a string),
1883 - If the argument is the name of an object (other than a string),
1884 IPython will try to locate the file where it was defined and open the
1884 IPython will try to locate the file where it was defined and open the
1885 editor at the point where it is defined. You can use `%edit function`
1885 editor at the point where it is defined. You can use `%edit function`
1886 to load an editor exactly at the point where 'function' is defined,
1886 to load an editor exactly at the point where 'function' is defined,
1887 edit it and have the file be executed automatically.
1887 edit it and have the file be executed automatically.
1888
1888
1889 If the object is a macro (see %macro for details), this opens up your
1889 If the object is a macro (see %macro for details), this opens up your
1890 specified editor with a temporary file containing the macro's data.
1890 specified editor with a temporary file containing the macro's data.
1891 Upon exit, the macro is reloaded with the contents of the file.
1891 Upon exit, the macro is reloaded with the contents of the file.
1892
1892
1893 Note: opening at an exact line is only supported under Unix, and some
1893 Note: opening at an exact line is only supported under Unix, and some
1894 editors (like kedit and gedit up to Gnome 2.8) do not understand the
1894 editors (like kedit and gedit up to Gnome 2.8) do not understand the
1895 '+NUMBER' parameter necessary for this feature. Good editors like
1895 '+NUMBER' parameter necessary for this feature. Good editors like
1896 (X)Emacs, vi, jed, pico and joe all do.
1896 (X)Emacs, vi, jed, pico and joe all do.
1897
1897
1898 - If the argument is not found as a variable, IPython will look for a
1898 - If the argument is not found as a variable, IPython will look for a
1899 file with that name (adding .py if necessary) and load it into the
1899 file with that name (adding .py if necessary) and load it into the
1900 editor. It will execute its contents with execfile() when you exit,
1900 editor. It will execute its contents with execfile() when you exit,
1901 loading any code in the file into your interactive namespace.
1901 loading any code in the file into your interactive namespace.
1902
1902
1903 After executing your code, %edit will return as output the code you
1903 After executing your code, %edit will return as output the code you
1904 typed in the editor (except when it was an existing file). This way
1904 typed in the editor (except when it was an existing file). This way
1905 you can reload the code in further invocations of %edit as a variable,
1905 you can reload the code in further invocations of %edit as a variable,
1906 via _<NUMBER> or Out[<NUMBER>], where <NUMBER> is the prompt number of
1906 via _<NUMBER> or Out[<NUMBER>], where <NUMBER> is the prompt number of
1907 the output.
1907 the output.
1908
1908
1909 Note that %edit is also available through the alias %ed.
1909 Note that %edit is also available through the alias %ed.
1910
1910
1911 This is an example of creating a simple function inside the editor and
1911 This is an example of creating a simple function inside the editor and
1912 then modifying it. First, start up the editor:
1912 then modifying it. First, start up the editor:
1913
1913
1914 In [1]: ed\\
1914 In [1]: ed\\
1915 Editing... done. Executing edited code...\\
1915 Editing... done. Executing edited code...\\
1916 Out[1]: 'def foo():\\n print "foo() was defined in an editing session"\\n'
1916 Out[1]: 'def foo():\\n print "foo() was defined in an editing session"\\n'
1917
1917
1918 We can then call the function foo():
1918 We can then call the function foo():
1919
1919
1920 In [2]: foo()\\
1920 In [2]: foo()\\
1921 foo() was defined in an editing session
1921 foo() was defined in an editing session
1922
1922
1923 Now we edit foo. IPython automatically loads the editor with the
1923 Now we edit foo. IPython automatically loads the editor with the
1924 (temporary) file where foo() was previously defined:
1924 (temporary) file where foo() was previously defined:
1925
1925
1926 In [3]: ed foo\\
1926 In [3]: ed foo\\
1927 Editing... done. Executing edited code...
1927 Editing... done. Executing edited code...
1928
1928
1929 And if we call foo() again we get the modified version:
1929 And if we call foo() again we get the modified version:
1930
1930
1931 In [4]: foo()\\
1931 In [4]: foo()\\
1932 foo() has now been changed!
1932 foo() has now been changed!
1933
1933
1934 Here is an example of how to edit a code snippet successive
1934 Here is an example of how to edit a code snippet successive
1935 times. First we call the editor:
1935 times. First we call the editor:
1936
1936
1937 In [8]: ed\\
1937 In [8]: ed\\
1938 Editing... done. Executing edited code...\\
1938 Editing... done. Executing edited code...\\
1939 hello\\
1939 hello\\
1940 Out[8]: "print 'hello'\\n"
1940 Out[8]: "print 'hello'\\n"
1941
1941
1942 Now we call it again with the previous output (stored in _):
1942 Now we call it again with the previous output (stored in _):
1943
1943
1944 In [9]: ed _\\
1944 In [9]: ed _\\
1945 Editing... done. Executing edited code...\\
1945 Editing... done. Executing edited code...\\
1946 hello world\\
1946 hello world\\
1947 Out[9]: "print 'hello world'\\n"
1947 Out[9]: "print 'hello world'\\n"
1948
1948
1949 Now we call it with the output #8 (stored in _8, also as Out[8]):
1949 Now we call it with the output #8 (stored in _8, also as Out[8]):
1950
1950
1951 In [10]: ed _8\\
1951 In [10]: ed _8\\
1952 Editing... done. Executing edited code...\\
1952 Editing... done. Executing edited code...\\
1953 hello again\\
1953 hello again\\
1954 Out[10]: "print 'hello again'\\n"
1954 Out[10]: "print 'hello again'\\n"
1955
1955
1956
1956
1957 Changing the default editor hook:
1957 Changing the default editor hook:
1958
1958
1959 If you wish to write your own editor hook, you can put it in a
1959 If you wish to write your own editor hook, you can put it in a
1960 configuration file which you load at startup time. The default hook
1960 configuration file which you load at startup time. The default hook
1961 is defined in the IPython.hooks module, and you can use that as a
1961 is defined in the IPython.hooks module, and you can use that as a
1962 starting example for further modifications. That file also has
1962 starting example for further modifications. That file also has
1963 general instructions on how to set a new hook for use once you've
1963 general instructions on how to set a new hook for use once you've
1964 defined it."""
1964 defined it."""
1965
1965
1966 # FIXME: This function has become a convoluted mess. It needs a
1966 # FIXME: This function has become a convoluted mess. It needs a
1967 # ground-up rewrite with clean, simple logic.
1967 # ground-up rewrite with clean, simple logic.
1968
1968
1969 def make_filename(arg):
1969 def make_filename(arg):
1970 "Make a filename from the given args"
1970 "Make a filename from the given args"
1971 try:
1971 try:
1972 filename = get_py_filename(arg)
1972 filename = get_py_filename(arg)
1973 except IOError:
1973 except IOError:
1974 if args.endswith('.py'):
1974 if args.endswith('.py'):
1975 filename = arg
1975 filename = arg
1976 else:
1976 else:
1977 filename = None
1977 filename = None
1978 return filename
1978 return filename
1979
1979
1980 # custom exceptions
1980 # custom exceptions
1981 class DataIsObject(Exception): pass
1981 class DataIsObject(Exception): pass
1982
1982
1983 opts,args = self.parse_options(parameter_s,'prxn:')
1983 opts,args = self.parse_options(parameter_s,'prxn:')
1984 # Set a few locals from the options for convenience:
1984 # Set a few locals from the options for convenience:
1985 opts_p = opts.has_key('p')
1985 opts_p = opts.has_key('p')
1986 opts_r = opts.has_key('r')
1986 opts_r = opts.has_key('r')
1987
1987
1988 # Default line number value
1988 # Default line number value
1989 lineno = opts.get('n',None)
1989 lineno = opts.get('n',None)
1990
1990
1991 if opts_p:
1991 if opts_p:
1992 args = '_%s' % last_call[0]
1992 args = '_%s' % last_call[0]
1993 if not self.shell.user_ns.has_key(args):
1993 if not self.shell.user_ns.has_key(args):
1994 args = last_call[1]
1994 args = last_call[1]
1995
1995
1996 # use last_call to remember the state of the previous call, but don't
1996 # use last_call to remember the state of the previous call, but don't
1997 # let it be clobbered by successive '-p' calls.
1997 # let it be clobbered by successive '-p' calls.
1998 try:
1998 try:
1999 last_call[0] = self.shell.outputcache.prompt_count
1999 last_call[0] = self.shell.outputcache.prompt_count
2000 if not opts_p:
2000 if not opts_p:
2001 last_call[1] = parameter_s
2001 last_call[1] = parameter_s
2002 except:
2002 except:
2003 pass
2003 pass
2004
2004
2005 # by default this is done with temp files, except when the given
2005 # by default this is done with temp files, except when the given
2006 # arg is a filename
2006 # arg is a filename
2007 use_temp = 1
2007 use_temp = 1
2008
2008
2009 if re.match(r'\d',args):
2009 if re.match(r'\d',args):
2010 # Mode where user specifies ranges of lines, like in %macro.
2010 # Mode where user specifies ranges of lines, like in %macro.
2011 # This means that you can't edit files whose names begin with
2011 # This means that you can't edit files whose names begin with
2012 # numbers this way. Tough.
2012 # numbers this way. Tough.
2013 ranges = args.split()
2013 ranges = args.split()
2014 data = ''.join(self.extract_input_slices(ranges,opts_r))
2014 data = ''.join(self.extract_input_slices(ranges,opts_r))
2015 elif args.endswith('.py'):
2015 elif args.endswith('.py'):
2016 filename = make_filename(args)
2016 filename = make_filename(args)
2017 data = ''
2017 data = ''
2018 use_temp = 0
2018 use_temp = 0
2019 elif args:
2019 elif args:
2020 try:
2020 try:
2021 # Load the parameter given as a variable. If not a string,
2021 # Load the parameter given as a variable. If not a string,
2022 # process it as an object instead (below)
2022 # process it as an object instead (below)
2023
2023
2024 #print '*** args',args,'type',type(args) # dbg
2024 #print '*** args',args,'type',type(args) # dbg
2025 data = eval(args,self.shell.user_ns)
2025 data = eval(args,self.shell.user_ns)
2026 if not type(data) in StringTypes:
2026 if not type(data) in StringTypes:
2027 raise DataIsObject
2027 raise DataIsObject
2028
2028
2029 except (NameError,SyntaxError):
2029 except (NameError,SyntaxError):
2030 # given argument is not a variable, try as a filename
2030 # given argument is not a variable, try as a filename
2031 filename = make_filename(args)
2031 filename = make_filename(args)
2032 if filename is None:
2032 if filename is None:
2033 warn("Argument given (%s) can't be found as a variable "
2033 warn("Argument given (%s) can't be found as a variable "
2034 "or as a filename." % args)
2034 "or as a filename." % args)
2035 return
2035 return
2036
2036
2037 data = ''
2037 data = ''
2038 use_temp = 0
2038 use_temp = 0
2039 except DataIsObject:
2039 except DataIsObject:
2040
2040
2041 # macros have a special edit function
2041 # macros have a special edit function
2042 if isinstance(data,Macro):
2042 if isinstance(data,Macro):
2043 self._edit_macro(args,data)
2043 self._edit_macro(args,data)
2044 return
2044 return
2045
2045
2046 # For objects, try to edit the file where they are defined
2046 # For objects, try to edit the file where they are defined
2047 try:
2047 try:
2048 filename = inspect.getabsfile(data)
2048 filename = inspect.getabsfile(data)
2049 datafile = 1
2049 datafile = 1
2050 except TypeError:
2050 except TypeError:
2051 filename = make_filename(args)
2051 filename = make_filename(args)
2052 datafile = 1
2052 datafile = 1
2053 warn('Could not find file where `%s` is defined.\n'
2053 warn('Could not find file where `%s` is defined.\n'
2054 'Opening a file named `%s`' % (args,filename))
2054 'Opening a file named `%s`' % (args,filename))
2055 # Now, make sure we can actually read the source (if it was in
2055 # Now, make sure we can actually read the source (if it was in
2056 # a temp file it's gone by now).
2056 # a temp file it's gone by now).
2057 if datafile:
2057 if datafile:
2058 try:
2058 try:
2059 if lineno is None:
2059 if lineno is None:
2060 lineno = inspect.getsourcelines(data)[1]
2060 lineno = inspect.getsourcelines(data)[1]
2061 except IOError:
2061 except IOError:
2062 filename = make_filename(args)
2062 filename = make_filename(args)
2063 if filename is None:
2063 if filename is None:
2064 warn('The file `%s` where `%s` was defined cannot '
2064 warn('The file `%s` where `%s` was defined cannot '
2065 'be read.' % (filename,data))
2065 'be read.' % (filename,data))
2066 return
2066 return
2067 use_temp = 0
2067 use_temp = 0
2068 else:
2068 else:
2069 data = ''
2069 data = ''
2070
2070
2071 if use_temp:
2071 if use_temp:
2072 filename = self.shell.mktempfile(data)
2072 filename = self.shell.mktempfile(data)
2073 print 'IPython will make a temporary file named:',filename
2073 print 'IPython will make a temporary file named:',filename
2074
2074
2075 # do actual editing here
2075 # do actual editing here
2076 print 'Editing...',
2076 print 'Editing...',
2077 sys.stdout.flush()
2077 sys.stdout.flush()
2078 self.shell.hooks.editor(filename,lineno)
2078 self.shell.hooks.editor(filename,lineno)
2079 if opts.has_key('x'): # -x prevents actual execution
2079 if opts.has_key('x'): # -x prevents actual execution
2080 print
2080 print
2081 else:
2081 else:
2082 print 'done. Executing edited code...'
2082 print 'done. Executing edited code...'
2083 if opts_r:
2083 if opts_r:
2084 self.shell.runlines(file_read(filename))
2084 self.shell.runlines(file_read(filename))
2085 else:
2085 else:
2086 self.shell.safe_execfile(filename,self.shell.user_ns,
2086 self.shell.safe_execfile(filename,self.shell.user_ns,
2087 self.shell.user_ns)
2087 self.shell.user_ns)
2088 if use_temp:
2088 if use_temp:
2089 try:
2089 try:
2090 return open(filename).read()
2090 return open(filename).read()
2091 except IOError,msg:
2091 except IOError,msg:
2092 if msg.filename == filename:
2092 if msg.filename == filename:
2093 warn('File not found. Did you forget to save?')
2093 warn('File not found. Did you forget to save?')
2094 return
2094 return
2095 else:
2095 else:
2096 self.shell.showtraceback()
2096 self.shell.showtraceback()
2097
2097
2098 def magic_xmode(self,parameter_s = ''):
2098 def magic_xmode(self,parameter_s = ''):
2099 """Switch modes for the exception handlers.
2099 """Switch modes for the exception handlers.
2100
2100
2101 Valid modes: Plain, Context and Verbose.
2101 Valid modes: Plain, Context and Verbose.
2102
2102
2103 If called without arguments, acts as a toggle."""
2103 If called without arguments, acts as a toggle."""
2104
2104
2105 def xmode_switch_err(name):
2105 def xmode_switch_err(name):
2106 warn('Error changing %s exception modes.\n%s' %
2106 warn('Error changing %s exception modes.\n%s' %
2107 (name,sys.exc_info()[1]))
2107 (name,sys.exc_info()[1]))
2108
2108
2109 shell = self.shell
2109 shell = self.shell
2110 new_mode = parameter_s.strip().capitalize()
2110 new_mode = parameter_s.strip().capitalize()
2111 try:
2111 try:
2112 shell.InteractiveTB.set_mode(mode=new_mode)
2112 shell.InteractiveTB.set_mode(mode=new_mode)
2113 print 'Exception reporting mode:',shell.InteractiveTB.mode
2113 print 'Exception reporting mode:',shell.InteractiveTB.mode
2114 except:
2114 except:
2115 xmode_switch_err('user')
2115 xmode_switch_err('user')
2116
2116
2117 # threaded shells use a special handler in sys.excepthook
2117 # threaded shells use a special handler in sys.excepthook
2118 if shell.isthreaded:
2118 if shell.isthreaded:
2119 try:
2119 try:
2120 shell.sys_excepthook.set_mode(mode=new_mode)
2120 shell.sys_excepthook.set_mode(mode=new_mode)
2121 except:
2121 except:
2122 xmode_switch_err('threaded')
2122 xmode_switch_err('threaded')
2123
2123
2124 def magic_colors(self,parameter_s = ''):
2124 def magic_colors(self,parameter_s = ''):
2125 """Switch color scheme for prompts, info system and exception handlers.
2125 """Switch color scheme for prompts, info system and exception handlers.
2126
2126
2127 Currently implemented schemes: NoColor, Linux, LightBG.
2127 Currently implemented schemes: NoColor, Linux, LightBG.
2128
2128
2129 Color scheme names are not case-sensitive."""
2129 Color scheme names are not case-sensitive."""
2130
2130
2131 def color_switch_err(name):
2131 def color_switch_err(name):
2132 warn('Error changing %s color schemes.\n%s' %
2132 warn('Error changing %s color schemes.\n%s' %
2133 (name,sys.exc_info()[1]))
2133 (name,sys.exc_info()[1]))
2134
2134
2135
2135
2136 new_scheme = parameter_s.strip()
2136 new_scheme = parameter_s.strip()
2137 if not new_scheme:
2137 if not new_scheme:
2138 print 'You must specify a color scheme.'
2138 print 'You must specify a color scheme.'
2139 return
2139 return
2140 import IPython.rlineimpl as readline
2140 import IPython.rlineimpl as readline
2141 if not readline.have_readline and sys.platform == "win32":
2141 if not readline.have_readline and sys.platform == "win32":
2142 msg = """\
2142 msg = """\
2143 Proper color support under MS Windows requires the pyreadline library.
2143 Proper color support under MS Windows requires the pyreadline library.
2144 You can find it at:
2144 You can find it at:
2145 http://ipython.scipy.org/moin/PyReadline/Intro
2145 http://ipython.scipy.org/moin/PyReadline/Intro
2146 Gary's readline needs the ctypes module, from:
2146 Gary's readline needs the ctypes module, from:
2147 http://starship.python.net/crew/theller/ctypes
2147 http://starship.python.net/crew/theller/ctypes
2148 (Note that ctypes is already part of Python versions 2.5 and newer).
2148 (Note that ctypes is already part of Python versions 2.5 and newer).
2149
2149
2150 Defaulting color scheme to 'NoColor'"""
2150 Defaulting color scheme to 'NoColor'"""
2151 new_scheme = 'NoColor'
2151 new_scheme = 'NoColor'
2152 warn(msg)
2152 warn(msg)
2153 # local shortcut
2153 # local shortcut
2154 shell = self.shell
2154 shell = self.shell
2155
2155
2156 # Set prompt colors
2156 # Set prompt colors
2157 try:
2157 try:
2158 shell.outputcache.set_colors(new_scheme)
2158 shell.outputcache.set_colors(new_scheme)
2159 except:
2159 except:
2160 color_switch_err('prompt')
2160 color_switch_err('prompt')
2161 else:
2161 else:
2162 shell.rc.colors = \
2162 shell.rc.colors = \
2163 shell.outputcache.color_table.active_scheme_name
2163 shell.outputcache.color_table.active_scheme_name
2164 # Set exception colors
2164 # Set exception colors
2165 try:
2165 try:
2166 shell.InteractiveTB.set_colors(scheme = new_scheme)
2166 shell.InteractiveTB.set_colors(scheme = new_scheme)
2167 shell.SyntaxTB.set_colors(scheme = new_scheme)
2167 shell.SyntaxTB.set_colors(scheme = new_scheme)
2168 except:
2168 except:
2169 color_switch_err('exception')
2169 color_switch_err('exception')
2170
2170
2171 # threaded shells use a verbose traceback in sys.excepthook
2171 # threaded shells use a verbose traceback in sys.excepthook
2172 if shell.isthreaded:
2172 if shell.isthreaded:
2173 try:
2173 try:
2174 shell.sys_excepthook.set_colors(scheme=new_scheme)
2174 shell.sys_excepthook.set_colors(scheme=new_scheme)
2175 except:
2175 except:
2176 color_switch_err('system exception handler')
2176 color_switch_err('system exception handler')
2177
2177
2178 # Set info (for 'object?') colors
2178 # Set info (for 'object?') colors
2179 if shell.rc.color_info:
2179 if shell.rc.color_info:
2180 try:
2180 try:
2181 shell.inspector.set_active_scheme(new_scheme)
2181 shell.inspector.set_active_scheme(new_scheme)
2182 except:
2182 except:
2183 color_switch_err('object inspector')
2183 color_switch_err('object inspector')
2184 else:
2184 else:
2185 shell.inspector.set_active_scheme('NoColor')
2185 shell.inspector.set_active_scheme('NoColor')
2186
2186
2187 def magic_color_info(self,parameter_s = ''):
2187 def magic_color_info(self,parameter_s = ''):
2188 """Toggle color_info.
2188 """Toggle color_info.
2189
2189
2190 The color_info configuration parameter controls whether colors are
2190 The color_info configuration parameter controls whether colors are
2191 used for displaying object details (by things like %psource, %pfile or
2191 used for displaying object details (by things like %psource, %pfile or
2192 the '?' system). This function toggles this value with each call.
2192 the '?' system). This function toggles this value with each call.
2193
2193
2194 Note that unless you have a fairly recent pager (less works better
2194 Note that unless you have a fairly recent pager (less works better
2195 than more) in your system, using colored object information displays
2195 than more) in your system, using colored object information displays
2196 will not work properly. Test it and see."""
2196 will not work properly. Test it and see."""
2197
2197
2198 self.shell.rc.color_info = 1 - self.shell.rc.color_info
2198 self.shell.rc.color_info = 1 - self.shell.rc.color_info
2199 self.magic_colors(self.shell.rc.colors)
2199 self.magic_colors(self.shell.rc.colors)
2200 print 'Object introspection functions have now coloring:',
2200 print 'Object introspection functions have now coloring:',
2201 print ['OFF','ON'][self.shell.rc.color_info]
2201 print ['OFF','ON'][self.shell.rc.color_info]
2202
2202
2203 def magic_Pprint(self, parameter_s=''):
2203 def magic_Pprint(self, parameter_s=''):
2204 """Toggle pretty printing on/off."""
2204 """Toggle pretty printing on/off."""
2205
2205
2206 self.shell.rc.pprint = 1 - self.shell.rc.pprint
2206 self.shell.rc.pprint = 1 - self.shell.rc.pprint
2207 print 'Pretty printing has been turned', \
2207 print 'Pretty printing has been turned', \
2208 ['OFF','ON'][self.shell.rc.pprint]
2208 ['OFF','ON'][self.shell.rc.pprint]
2209
2209
2210 def magic_exit(self, parameter_s=''):
2210 def magic_exit(self, parameter_s=''):
2211 """Exit IPython, confirming if configured to do so.
2211 """Exit IPython, confirming if configured to do so.
2212
2212
2213 You can configure whether IPython asks for confirmation upon exit by
2213 You can configure whether IPython asks for confirmation upon exit by
2214 setting the confirm_exit flag in the ipythonrc file."""
2214 setting the confirm_exit flag in the ipythonrc file."""
2215
2215
2216 self.shell.exit()
2216 self.shell.exit()
2217
2217
2218 def magic_quit(self, parameter_s=''):
2218 def magic_quit(self, parameter_s=''):
2219 """Exit IPython, confirming if configured to do so (like %exit)"""
2219 """Exit IPython, confirming if configured to do so (like %exit)"""
2220
2220
2221 self.shell.exit()
2221 self.shell.exit()
2222
2222
2223 def magic_Exit(self, parameter_s=''):
2223 def magic_Exit(self, parameter_s=''):
2224 """Exit IPython without confirmation."""
2224 """Exit IPython without confirmation."""
2225
2225
2226 self.shell.exit_now = True
2226 self.shell.exit_now = True
2227
2227
2228 #......................................................................
2228 #......................................................................
2229 # Functions to implement unix shell-type things
2229 # Functions to implement unix shell-type things
2230
2230
2231 def magic_alias(self, parameter_s = ''):
2231 def magic_alias(self, parameter_s = ''):
2232 """Define an alias for a system command.
2232 """Define an alias for a system command.
2233
2233
2234 '%alias alias_name cmd' defines 'alias_name' as an alias for 'cmd'
2234 '%alias alias_name cmd' defines 'alias_name' as an alias for 'cmd'
2235
2235
2236 Then, typing 'alias_name params' will execute the system command 'cmd
2236 Then, typing 'alias_name params' will execute the system command 'cmd
2237 params' (from your underlying operating system).
2237 params' (from your underlying operating system).
2238
2238
2239 Aliases have lower precedence than magic functions and Python normal
2239 Aliases have lower precedence than magic functions and Python normal
2240 variables, so if 'foo' is both a Python variable and an alias, the
2240 variables, so if 'foo' is both a Python variable and an alias, the
2241 alias can not be executed until 'del foo' removes the Python variable.
2241 alias can not be executed until 'del foo' removes the Python variable.
2242
2242
2243 You can use the %l specifier in an alias definition to represent the
2243 You can use the %l specifier in an alias definition to represent the
2244 whole line when the alias is called. For example:
2244 whole line when the alias is called. For example:
2245
2245
2246 In [2]: alias all echo "Input in brackets: <%l>"\\
2246 In [2]: alias all echo "Input in brackets: <%l>"\\
2247 In [3]: all hello world\\
2247 In [3]: all hello world\\
2248 Input in brackets: <hello world>
2248 Input in brackets: <hello world>
2249
2249
2250 You can also define aliases with parameters using %s specifiers (one
2250 You can also define aliases with parameters using %s specifiers (one
2251 per parameter):
2251 per parameter):
2252
2252
2253 In [1]: alias parts echo first %s second %s\\
2253 In [1]: alias parts echo first %s second %s\\
2254 In [2]: %parts A B\\
2254 In [2]: %parts A B\\
2255 first A second B\\
2255 first A second B\\
2256 In [3]: %parts A\\
2256 In [3]: %parts A\\
2257 Incorrect number of arguments: 2 expected.\\
2257 Incorrect number of arguments: 2 expected.\\
2258 parts is an alias to: 'echo first %s second %s'
2258 parts is an alias to: 'echo first %s second %s'
2259
2259
2260 Note that %l and %s are mutually exclusive. You can only use one or
2260 Note that %l and %s are mutually exclusive. You can only use one or
2261 the other in your aliases.
2261 the other in your aliases.
2262
2262
2263 Aliases expand Python variables just like system calls using ! or !!
2263 Aliases expand Python variables just like system calls using ! or !!
2264 do: all expressions prefixed with '$' get expanded. For details of
2264 do: all expressions prefixed with '$' get expanded. For details of
2265 the semantic rules, see PEP-215:
2265 the semantic rules, see PEP-215:
2266 http://www.python.org/peps/pep-0215.html. This is the library used by
2266 http://www.python.org/peps/pep-0215.html. This is the library used by
2267 IPython for variable expansion. If you want to access a true shell
2267 IPython for variable expansion. If you want to access a true shell
2268 variable, an extra $ is necessary to prevent its expansion by IPython:
2268 variable, an extra $ is necessary to prevent its expansion by IPython:
2269
2269
2270 In [6]: alias show echo\\
2270 In [6]: alias show echo\\
2271 In [7]: PATH='A Python string'\\
2271 In [7]: PATH='A Python string'\\
2272 In [8]: show $PATH\\
2272 In [8]: show $PATH\\
2273 A Python string\\
2273 A Python string\\
2274 In [9]: show $$PATH\\
2274 In [9]: show $$PATH\\
2275 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
2275 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
2276
2276
2277 You can use the alias facility to acess all of $PATH. See the %rehash
2277 You can use the alias facility to acess all of $PATH. See the %rehash
2278 and %rehashx functions, which automatically create aliases for the
2278 and %rehashx functions, which automatically create aliases for the
2279 contents of your $PATH.
2279 contents of your $PATH.
2280
2280
2281 If called with no parameters, %alias prints the current alias table."""
2281 If called with no parameters, %alias prints the current alias table."""
2282
2282
2283 par = parameter_s.strip()
2283 par = parameter_s.strip()
2284 if not par:
2284 if not par:
2285 stored = self.db.get('stored_aliases', {} )
2285 stored = self.db.get('stored_aliases', {} )
2286 atab = self.shell.alias_table
2286 atab = self.shell.alias_table
2287 aliases = atab.keys()
2287 aliases = atab.keys()
2288 aliases.sort()
2288 aliases.sort()
2289 res = []
2289 res = []
2290 showlast = []
2290 showlast = []
2291 for alias in aliases:
2291 for alias in aliases:
2292 tgt = atab[alias][1]
2292 tgt = atab[alias][1]
2293 # 'interesting' aliases
2293 # 'interesting' aliases
2294 if (alias in stored or
2294 if (alias in stored or
2295 alias.lower() != os.path.splitext(tgt)[0].lower() or
2295 alias.lower() != os.path.splitext(tgt)[0].lower() or
2296 ' ' in tgt):
2296 ' ' in tgt):
2297 showlast.append((alias, tgt))
2297 showlast.append((alias, tgt))
2298 else:
2298 else:
2299 res.append((alias, tgt ))
2299 res.append((alias, tgt ))
2300
2300
2301 # show most interesting aliases last
2301 # show most interesting aliases last
2302 res.extend(showlast)
2302 res.extend(showlast)
2303 print "Total number of aliases:",len(aliases)
2303 print "Total number of aliases:",len(aliases)
2304 return res
2304 return res
2305 try:
2305 try:
2306 alias,cmd = par.split(None,1)
2306 alias,cmd = par.split(None,1)
2307 except:
2307 except:
2308 print OInspect.getdoc(self.magic_alias)
2308 print OInspect.getdoc(self.magic_alias)
2309 else:
2309 else:
2310 nargs = cmd.count('%s')
2310 nargs = cmd.count('%s')
2311 if nargs>0 and cmd.find('%l')>=0:
2311 if nargs>0 and cmd.find('%l')>=0:
2312 error('The %s and %l specifiers are mutually exclusive '
2312 error('The %s and %l specifiers are mutually exclusive '
2313 'in alias definitions.')
2313 'in alias definitions.')
2314 else: # all looks OK
2314 else: # all looks OK
2315 self.shell.alias_table[alias] = (nargs,cmd)
2315 self.shell.alias_table[alias] = (nargs,cmd)
2316 self.shell.alias_table_validate(verbose=0)
2316 self.shell.alias_table_validate(verbose=0)
2317 # end magic_alias
2317 # end magic_alias
2318
2318
2319 def magic_unalias(self, parameter_s = ''):
2319 def magic_unalias(self, parameter_s = ''):
2320 """Remove an alias"""
2320 """Remove an alias"""
2321
2321
2322 aname = parameter_s.strip()
2322 aname = parameter_s.strip()
2323 if aname in self.shell.alias_table:
2323 if aname in self.shell.alias_table:
2324 del self.shell.alias_table[aname]
2324 del self.shell.alias_table[aname]
2325 stored = self.db.get('stored_aliases', {} )
2325 stored = self.db.get('stored_aliases', {} )
2326 if aname in stored:
2326 if aname in stored:
2327 print "Removing %stored alias",aname
2327 print "Removing %stored alias",aname
2328 del stored[aname]
2328 del stored[aname]
2329 self.db['stored_aliases'] = stored
2329 self.db['stored_aliases'] = stored
2330
2330
2331
2331
2332 def magic_rehashx(self, parameter_s = ''):
2332 def magic_rehashx(self, parameter_s = ''):
2333 """Update the alias table with all executable files in $PATH.
2333 """Update the alias table with all executable files in $PATH.
2334
2334
2335 This version explicitly checks that every entry in $PATH is a file
2335 This version explicitly checks that every entry in $PATH is a file
2336 with execute access (os.X_OK), so it is much slower than %rehash.
2336 with execute access (os.X_OK), so it is much slower than %rehash.
2337
2337
2338 Under Windows, it checks executability as a match agains a
2338 Under Windows, it checks executability as a match agains a
2339 '|'-separated string of extensions, stored in the IPython config
2339 '|'-separated string of extensions, stored in the IPython config
2340 variable win_exec_ext. This defaults to 'exe|com|bat'.
2340 variable win_exec_ext. This defaults to 'exe|com|bat'.
2341
2341
2342 This function also resets the root module cache of module completer,
2342 This function also resets the root module cache of module completer,
2343 used on slow filesystems.
2343 used on slow filesystems.
2344 """
2344 """
2345
2345
2346
2346
2347 ip = self.api
2347 ip = self.api
2348
2348
2349 # for the benefit of module completer in ipy_completers.py
2349 # for the benefit of module completer in ipy_completers.py
2350 del ip.db['rootmodules']
2350 del ip.db['rootmodules']
2351
2351
2352 path = [os.path.abspath(os.path.expanduser(p)) for p in
2352 path = [os.path.abspath(os.path.expanduser(p)) for p in
2353 os.environ.get('PATH','').split(os.pathsep)]
2353 os.environ.get('PATH','').split(os.pathsep)]
2354 path = filter(os.path.isdir,path)
2354 path = filter(os.path.isdir,path)
2355
2355
2356 alias_table = self.shell.alias_table
2356 alias_table = self.shell.alias_table
2357 syscmdlist = []
2357 syscmdlist = []
2358 if os.name == 'posix':
2358 if os.name == 'posix':
2359 isexec = lambda fname:os.path.isfile(fname) and \
2359 isexec = lambda fname:os.path.isfile(fname) and \
2360 os.access(fname,os.X_OK)
2360 os.access(fname,os.X_OK)
2361 else:
2361 else:
2362
2362
2363 try:
2363 try:
2364 winext = os.environ['pathext'].replace(';','|').replace('.','')
2364 winext = os.environ['pathext'].replace(';','|').replace('.','')
2365 except KeyError:
2365 except KeyError:
2366 winext = 'exe|com|bat|py'
2366 winext = 'exe|com|bat|py'
2367 if 'py' not in winext:
2367 if 'py' not in winext:
2368 winext += '|py'
2368 winext += '|py'
2369 execre = re.compile(r'(.*)\.(%s)$' % winext,re.IGNORECASE)
2369 execre = re.compile(r'(.*)\.(%s)$' % winext,re.IGNORECASE)
2370 isexec = lambda fname:os.path.isfile(fname) and execre.match(fname)
2370 isexec = lambda fname:os.path.isfile(fname) and execre.match(fname)
2371 savedir = os.getcwd()
2371 savedir = os.getcwd()
2372 try:
2372 try:
2373 # write the whole loop for posix/Windows so we don't have an if in
2373 # write the whole loop for posix/Windows so we don't have an if in
2374 # the innermost part
2374 # the innermost part
2375 if os.name == 'posix':
2375 if os.name == 'posix':
2376 for pdir in path:
2376 for pdir in path:
2377 os.chdir(pdir)
2377 os.chdir(pdir)
2378 for ff in os.listdir(pdir):
2378 for ff in os.listdir(pdir):
2379 if isexec(ff) and ff not in self.shell.no_alias:
2379 if isexec(ff) and ff not in self.shell.no_alias:
2380 # each entry in the alias table must be (N,name),
2380 # each entry in the alias table must be (N,name),
2381 # where N is the number of positional arguments of the
2381 # where N is the number of positional arguments of the
2382 # alias.
2382 # alias.
2383 alias_table[ff] = (0,ff)
2383 alias_table[ff] = (0,ff)
2384 syscmdlist.append(ff)
2384 syscmdlist.append(ff)
2385 else:
2385 else:
2386 for pdir in path:
2386 for pdir in path:
2387 os.chdir(pdir)
2387 os.chdir(pdir)
2388 for ff in os.listdir(pdir):
2388 for ff in os.listdir(pdir):
2389 base, ext = os.path.splitext(ff)
2389 base, ext = os.path.splitext(ff)
2390 if isexec(ff) and base not in self.shell.no_alias:
2390 if isexec(ff) and base not in self.shell.no_alias:
2391 if ext.lower() == '.exe':
2391 if ext.lower() == '.exe':
2392 ff = base
2392 ff = base
2393 alias_table[base.lower()] = (0,ff)
2393 alias_table[base.lower()] = (0,ff)
2394 syscmdlist.append(ff)
2394 syscmdlist.append(ff)
2395 # Make sure the alias table doesn't contain keywords or builtins
2395 # Make sure the alias table doesn't contain keywords or builtins
2396 self.shell.alias_table_validate()
2396 self.shell.alias_table_validate()
2397 # Call again init_auto_alias() so we get 'rm -i' and other
2397 # Call again init_auto_alias() so we get 'rm -i' and other
2398 # modified aliases since %rehashx will probably clobber them
2398 # modified aliases since %rehashx will probably clobber them
2399
2399
2400 # no, we don't want them. if %rehashx clobbers them, good,
2400 # no, we don't want them. if %rehashx clobbers them, good,
2401 # we'll probably get better versions
2401 # we'll probably get better versions
2402 # self.shell.init_auto_alias()
2402 # self.shell.init_auto_alias()
2403 db = ip.db
2403 db = ip.db
2404 db['syscmdlist'] = syscmdlist
2404 db['syscmdlist'] = syscmdlist
2405 finally:
2405 finally:
2406 os.chdir(savedir)
2406 os.chdir(savedir)
2407
2407
2408 def magic_pwd(self, parameter_s = ''):
2408 def magic_pwd(self, parameter_s = ''):
2409 """Return the current working directory path."""
2409 """Return the current working directory path."""
2410 return os.getcwd()
2410 return os.getcwd()
2411
2411
2412 def magic_cd(self, parameter_s=''):
2412 def magic_cd(self, parameter_s=''):
2413 """Change the current working directory.
2413 """Change the current working directory.
2414
2414
2415 This command automatically maintains an internal list of directories
2415 This command automatically maintains an internal list of directories
2416 you visit during your IPython session, in the variable _dh. The
2416 you visit during your IPython session, in the variable _dh. The
2417 command %dhist shows this history nicely formatted. You can also
2417 command %dhist shows this history nicely formatted. You can also
2418 do 'cd -<tab>' to see directory history conveniently.
2418 do 'cd -<tab>' to see directory history conveniently.
2419
2419
2420 Usage:
2420 Usage:
2421
2421
2422 cd 'dir': changes to directory 'dir'.
2422 cd 'dir': changes to directory 'dir'.
2423
2423
2424 cd -: changes to the last visited directory.
2424 cd -: changes to the last visited directory.
2425
2425
2426 cd -<n>: changes to the n-th directory in the directory history.
2426 cd -<n>: changes to the n-th directory in the directory history.
2427
2427
2428 cd -b <bookmark_name>: jump to a bookmark set by %bookmark
2428 cd -b <bookmark_name>: jump to a bookmark set by %bookmark
2429 (note: cd <bookmark_name> is enough if there is no
2429 (note: cd <bookmark_name> is enough if there is no
2430 directory <bookmark_name>, but a bookmark with the name exists.)
2430 directory <bookmark_name>, but a bookmark with the name exists.)
2431 'cd -b <tab>' allows you to tab-complete bookmark names.
2431 'cd -b <tab>' allows you to tab-complete bookmark names.
2432
2432
2433 Options:
2433 Options:
2434
2434
2435 -q: quiet. Do not print the working directory after the cd command is
2435 -q: quiet. Do not print the working directory after the cd command is
2436 executed. By default IPython's cd command does print this directory,
2436 executed. By default IPython's cd command does print this directory,
2437 since the default prompts do not display path information.
2437 since the default prompts do not display path information.
2438
2438
2439 Note that !cd doesn't work for this purpose because the shell where
2439 Note that !cd doesn't work for this purpose because the shell where
2440 !command runs is immediately discarded after executing 'command'."""
2440 !command runs is immediately discarded after executing 'command'."""
2441
2441
2442 parameter_s = parameter_s.strip()
2442 parameter_s = parameter_s.strip()
2443 #bkms = self.shell.persist.get("bookmarks",{})
2443 #bkms = self.shell.persist.get("bookmarks",{})
2444
2444
2445 numcd = re.match(r'(-)(\d+)$',parameter_s)
2445 numcd = re.match(r'(-)(\d+)$',parameter_s)
2446 # jump in directory history by number
2446 # jump in directory history by number
2447 if numcd:
2447 if numcd:
2448 nn = int(numcd.group(2))
2448 nn = int(numcd.group(2))
2449 try:
2449 try:
2450 ps = self.shell.user_ns['_dh'][nn]
2450 ps = self.shell.user_ns['_dh'][nn]
2451 except IndexError:
2451 except IndexError:
2452 print 'The requested directory does not exist in history.'
2452 print 'The requested directory does not exist in history.'
2453 return
2453 return
2454 else:
2454 else:
2455 opts = {}
2455 opts = {}
2456 else:
2456 else:
2457 #turn all non-space-escaping backslashes to slashes,
2457 #turn all non-space-escaping backslashes to slashes,
2458 # for c:\windows\directory\names\
2458 # for c:\windows\directory\names\
2459 parameter_s = re.sub(r'\\(?! )','/', parameter_s)
2459 parameter_s = re.sub(r'\\(?! )','/', parameter_s)
2460 opts,ps = self.parse_options(parameter_s,'qb',mode='string')
2460 opts,ps = self.parse_options(parameter_s,'qb',mode='string')
2461 # jump to previous
2461 # jump to previous
2462 if ps == '-':
2462 if ps == '-':
2463 try:
2463 try:
2464 ps = self.shell.user_ns['_dh'][-2]
2464 ps = self.shell.user_ns['_dh'][-2]
2465 except IndexError:
2465 except IndexError:
2466 print 'No previous directory to change to.'
2466 print 'No previous directory to change to.'
2467 return
2467 return
2468 # jump to bookmark if needed
2468 # jump to bookmark if needed
2469 else:
2469 else:
2470 if not os.path.isdir(ps) or opts.has_key('b'):
2470 if not os.path.isdir(ps) or opts.has_key('b'):
2471 bkms = self.db.get('bookmarks', {})
2471 bkms = self.db.get('bookmarks', {})
2472
2472
2473 if bkms.has_key(ps):
2473 if bkms.has_key(ps):
2474 target = bkms[ps]
2474 target = bkms[ps]
2475 print '(bookmark:%s) -> %s' % (ps,target)
2475 print '(bookmark:%s) -> %s' % (ps,target)
2476 ps = target
2476 ps = target
2477 else:
2477 else:
2478 if opts.has_key('b'):
2478 if opts.has_key('b'):
2479 error("Bookmark '%s' not found. "
2479 error("Bookmark '%s' not found. "
2480 "Use '%%bookmark -l' to see your bookmarks." % ps)
2480 "Use '%%bookmark -l' to see your bookmarks." % ps)
2481 return
2481 return
2482
2482
2483 # at this point ps should point to the target dir
2483 # at this point ps should point to the target dir
2484 if ps:
2484 if ps:
2485 try:
2485 try:
2486 os.chdir(os.path.expanduser(ps))
2486 os.chdir(os.path.expanduser(ps))
2487 if self.shell.rc.term_title:
2487 if self.shell.rc.term_title:
2488 #print 'set term title:',self.shell.rc.term_title # dbg
2488 #print 'set term title:',self.shell.rc.term_title # dbg
2489 ttitle = ("IPy:" + (
2489 ttitle = ("IPy:" + (
2490 os.getcwd() == '/' and '/' or \
2490 os.getcwd() == '/' and '/' or \
2491 os.path.basename(os.getcwd())))
2491 os.path.basename(os.getcwd())))
2492 platutils.set_term_title(ttitle)
2492 platutils.set_term_title(ttitle)
2493 except OSError:
2493 except OSError:
2494 print sys.exc_info()[1]
2494 print sys.exc_info()[1]
2495 else:
2495 else:
2496 cwd = os.getcwd()
2496 cwd = os.getcwd()
2497 dhist = self.shell.user_ns['_dh']
2497 dhist = self.shell.user_ns['_dh']
2498 dhist.append(cwd)
2498 dhist.append(cwd)
2499 self.db['dhist'] = compress_dhist(dhist)[-100:]
2499 self.db['dhist'] = compress_dhist(dhist)[-100:]
2500
2500
2501 else:
2501 else:
2502 os.chdir(self.shell.home_dir)
2502 os.chdir(self.shell.home_dir)
2503 if self.shell.rc.term_title:
2503 if self.shell.rc.term_title:
2504 platutils.set_term_title("IPy:~")
2504 platutils.set_term_title("IPy:~")
2505 cwd = os.getcwd()
2505 cwd = os.getcwd()
2506 dhist = self.shell.user_ns['_dh']
2506 dhist = self.shell.user_ns['_dh']
2507 dhist.append(cwd)
2507 dhist.append(cwd)
2508 self.db['dhist'] = compress_dhist(dhist)[-100:]
2508 self.db['dhist'] = compress_dhist(dhist)[-100:]
2509 if not 'q' in opts:
2509 if not 'q' in opts:
2510 print self.shell.user_ns['_dh'][-1]
2510 print self.shell.user_ns['_dh'][-1]
2511
2511
2512
2512
2513 def magic_env(self, parameter_s=''):
2513 def magic_env(self, parameter_s=''):
2514 """List environment variables."""
2514 """List environment variables."""
2515
2515
2516 return os.environ.data
2516 return os.environ.data
2517
2517
2518 def magic_pushd(self, parameter_s=''):
2518 def magic_pushd(self, parameter_s=''):
2519 """Place the current dir on stack and change directory.
2519 """Place the current dir on stack and change directory.
2520
2520
2521 Usage:\\
2521 Usage:\\
2522 %pushd ['dirname']
2522 %pushd ['dirname']
2523
2523
2524 %pushd with no arguments does a %pushd to your home directory.
2524 %pushd with no arguments does a %pushd to your home directory.
2525 """
2525 """
2526 if parameter_s == '': parameter_s = '~'
2526 if parameter_s == '': parameter_s = '~'
2527 dir_s = self.shell.dir_stack
2527 dir_s = self.shell.dir_stack
2528 if len(dir_s)>0 and os.path.expanduser(parameter_s) != \
2528 if len(dir_s)>0 and os.path.expanduser(parameter_s) != \
2529 os.path.expanduser(self.shell.dir_stack[0]):
2529 os.path.expanduser(self.shell.dir_stack[0]):
2530 try:
2530 try:
2531 self.magic_cd(parameter_s)
2531 self.magic_cd(parameter_s)
2532 dir_s.insert(0,os.getcwd().replace(self.home_dir,'~'))
2532 dir_s.insert(0,os.getcwd().replace(self.home_dir,'~'))
2533 self.magic_dirs()
2533 self.magic_dirs()
2534 except:
2534 except:
2535 print 'Invalid directory'
2535 print 'Invalid directory'
2536 else:
2536 else:
2537 print 'You are already there!'
2537 print 'You are already there!'
2538
2538
2539 def magic_popd(self, parameter_s=''):
2539 def magic_popd(self, parameter_s=''):
2540 """Change to directory popped off the top of the stack.
2540 """Change to directory popped off the top of the stack.
2541 """
2541 """
2542 if len (self.shell.dir_stack) > 1:
2542 if len (self.shell.dir_stack) > 1:
2543 self.shell.dir_stack.pop(0)
2543 self.shell.dir_stack.pop(0)
2544 self.magic_cd(self.shell.dir_stack[0])
2544 self.magic_cd(self.shell.dir_stack[0])
2545 print self.shell.dir_stack[0]
2545 print self.shell.dir_stack[0]
2546 else:
2546 else:
2547 print "You can't remove the starting directory from the stack:",\
2547 print "You can't remove the starting directory from the stack:",\
2548 self.shell.dir_stack
2548 self.shell.dir_stack
2549
2549
2550 def magic_dirs(self, parameter_s=''):
2550 def magic_dirs(self, parameter_s=''):
2551 """Return the current directory stack."""
2551 """Return the current directory stack."""
2552
2552
2553 return self.shell.dir_stack[:]
2553 return self.shell.dir_stack[:]
2554
2554
2555 def magic_sc(self, parameter_s=''):
2555 def magic_sc(self, parameter_s=''):
2556 """Shell capture - execute a shell command and capture its output.
2556 """Shell capture - execute a shell command and capture its output.
2557
2557
2558 DEPRECATED. Suboptimal, retained for backwards compatibility.
2558 DEPRECATED. Suboptimal, retained for backwards compatibility.
2559
2559
2560 You should use the form 'var = !command' instead. Example:
2560 You should use the form 'var = !command' instead. Example:
2561
2561
2562 "%sc -l myfiles = ls ~" should now be written as
2562 "%sc -l myfiles = ls ~" should now be written as
2563
2563
2564 "myfiles = !ls ~"
2564 "myfiles = !ls ~"
2565
2565
2566 myfiles.s, myfiles.l and myfiles.n still apply as documented
2566 myfiles.s, myfiles.l and myfiles.n still apply as documented
2567 below.
2567 below.
2568
2568
2569 --
2569 --
2570 %sc [options] varname=command
2570 %sc [options] varname=command
2571
2571
2572 IPython will run the given command using commands.getoutput(), and
2572 IPython will run the given command using commands.getoutput(), and
2573 will then update the user's interactive namespace with a variable
2573 will then update the user's interactive namespace with a variable
2574 called varname, containing the value of the call. Your command can
2574 called varname, containing the value of the call. Your command can
2575 contain shell wildcards, pipes, etc.
2575 contain shell wildcards, pipes, etc.
2576
2576
2577 The '=' sign in the syntax is mandatory, and the variable name you
2577 The '=' sign in the syntax is mandatory, and the variable name you
2578 supply must follow Python's standard conventions for valid names.
2578 supply must follow Python's standard conventions for valid names.
2579
2579
2580 (A special format without variable name exists for internal use)
2580 (A special format without variable name exists for internal use)
2581
2581
2582 Options:
2582 Options:
2583
2583
2584 -l: list output. Split the output on newlines into a list before
2584 -l: list output. Split the output on newlines into a list before
2585 assigning it to the given variable. By default the output is stored
2585 assigning it to the given variable. By default the output is stored
2586 as a single string.
2586 as a single string.
2587
2587
2588 -v: verbose. Print the contents of the variable.
2588 -v: verbose. Print the contents of the variable.
2589
2589
2590 In most cases you should not need to split as a list, because the
2590 In most cases you should not need to split as a list, because the
2591 returned value is a special type of string which can automatically
2591 returned value is a special type of string which can automatically
2592 provide its contents either as a list (split on newlines) or as a
2592 provide its contents either as a list (split on newlines) or as a
2593 space-separated string. These are convenient, respectively, either
2593 space-separated string. These are convenient, respectively, either
2594 for sequential processing or to be passed to a shell command.
2594 for sequential processing or to be passed to a shell command.
2595
2595
2596 For example:
2596 For example:
2597
2597
2598 # Capture into variable a
2598 # Capture into variable a
2599 In [9]: sc a=ls *py
2599 In [9]: sc a=ls *py
2600
2600
2601 # a is a string with embedded newlines
2601 # a is a string with embedded newlines
2602 In [10]: a
2602 In [10]: a
2603 Out[10]: 'setup.py\nwin32_manual_post_install.py'
2603 Out[10]: 'setup.py\nwin32_manual_post_install.py'
2604
2604
2605 # which can be seen as a list:
2605 # which can be seen as a list:
2606 In [11]: a.l
2606 In [11]: a.l
2607 Out[11]: ['setup.py', 'win32_manual_post_install.py']
2607 Out[11]: ['setup.py', 'win32_manual_post_install.py']
2608
2608
2609 # or as a whitespace-separated string:
2609 # or as a whitespace-separated string:
2610 In [12]: a.s
2610 In [12]: a.s
2611 Out[12]: 'setup.py win32_manual_post_install.py'
2611 Out[12]: 'setup.py win32_manual_post_install.py'
2612
2612
2613 # a.s is useful to pass as a single command line:
2613 # a.s is useful to pass as a single command line:
2614 In [13]: !wc -l $a.s
2614 In [13]: !wc -l $a.s
2615 146 setup.py
2615 146 setup.py
2616 130 win32_manual_post_install.py
2616 130 win32_manual_post_install.py
2617 276 total
2617 276 total
2618
2618
2619 # while the list form is useful to loop over:
2619 # while the list form is useful to loop over:
2620 In [14]: for f in a.l:
2620 In [14]: for f in a.l:
2621 ....: !wc -l $f
2621 ....: !wc -l $f
2622 ....:
2622 ....:
2623 146 setup.py
2623 146 setup.py
2624 130 win32_manual_post_install.py
2624 130 win32_manual_post_install.py
2625
2625
2626 Similiarly, the lists returned by the -l option are also special, in
2626 Similiarly, the lists returned by the -l option are also special, in
2627 the sense that you can equally invoke the .s attribute on them to
2627 the sense that you can equally invoke the .s attribute on them to
2628 automatically get a whitespace-separated string from their contents:
2628 automatically get a whitespace-separated string from their contents:
2629
2629
2630 In [1]: sc -l b=ls *py
2630 In [1]: sc -l b=ls *py
2631
2631
2632 In [2]: b
2632 In [2]: b
2633 Out[2]: ['setup.py', 'win32_manual_post_install.py']
2633 Out[2]: ['setup.py', 'win32_manual_post_install.py']
2634
2634
2635 In [3]: b.s
2635 In [3]: b.s
2636 Out[3]: 'setup.py win32_manual_post_install.py'
2636 Out[3]: 'setup.py win32_manual_post_install.py'
2637
2637
2638 In summary, both the lists and strings used for ouptut capture have
2638 In summary, both the lists and strings used for ouptut capture have
2639 the following special attributes:
2639 the following special attributes:
2640
2640
2641 .l (or .list) : value as list.
2641 .l (or .list) : value as list.
2642 .n (or .nlstr): value as newline-separated string.
2642 .n (or .nlstr): value as newline-separated string.
2643 .s (or .spstr): value as space-separated string.
2643 .s (or .spstr): value as space-separated string.
2644 """
2644 """
2645
2645
2646 opts,args = self.parse_options(parameter_s,'lv')
2646 opts,args = self.parse_options(parameter_s,'lv')
2647 # Try to get a variable name and command to run
2647 # Try to get a variable name and command to run
2648 try:
2648 try:
2649 # the variable name must be obtained from the parse_options
2649 # the variable name must be obtained from the parse_options
2650 # output, which uses shlex.split to strip options out.
2650 # output, which uses shlex.split to strip options out.
2651 var,_ = args.split('=',1)
2651 var,_ = args.split('=',1)
2652 var = var.strip()
2652 var = var.strip()
2653 # But the the command has to be extracted from the original input
2653 # But the the command has to be extracted from the original input
2654 # parameter_s, not on what parse_options returns, to avoid the
2654 # parameter_s, not on what parse_options returns, to avoid the
2655 # quote stripping which shlex.split performs on it.
2655 # quote stripping which shlex.split performs on it.
2656 _,cmd = parameter_s.split('=',1)
2656 _,cmd = parameter_s.split('=',1)
2657 except ValueError:
2657 except ValueError:
2658 var,cmd = '',''
2658 var,cmd = '',''
2659 # If all looks ok, proceed
2659 # If all looks ok, proceed
2660 out,err = self.shell.getoutputerror(cmd)
2660 out,err = self.shell.getoutputerror(cmd)
2661 if err:
2661 if err:
2662 print >> Term.cerr,err
2662 print >> Term.cerr,err
2663 if opts.has_key('l'):
2663 if opts.has_key('l'):
2664 out = SList(out.split('\n'))
2664 out = SList(out.split('\n'))
2665 else:
2665 else:
2666 out = LSString(out)
2666 out = LSString(out)
2667 if opts.has_key('v'):
2667 if opts.has_key('v'):
2668 print '%s ==\n%s' % (var,pformat(out))
2668 print '%s ==\n%s' % (var,pformat(out))
2669 if var:
2669 if var:
2670 self.shell.user_ns.update({var:out})
2670 self.shell.user_ns.update({var:out})
2671 else:
2671 else:
2672 return out
2672 return out
2673
2673
2674 def magic_sx(self, parameter_s=''):
2674 def magic_sx(self, parameter_s=''):
2675 """Shell execute - run a shell command and capture its output.
2675 """Shell execute - run a shell command and capture its output.
2676
2676
2677 %sx command
2677 %sx command
2678
2678
2679 IPython will run the given command using commands.getoutput(), and
2679 IPython will run the given command using commands.getoutput(), and
2680 return the result formatted as a list (split on '\\n'). Since the
2680 return the result formatted as a list (split on '\\n'). Since the
2681 output is _returned_, it will be stored in ipython's regular output
2681 output is _returned_, it will be stored in ipython's regular output
2682 cache Out[N] and in the '_N' automatic variables.
2682 cache Out[N] and in the '_N' automatic variables.
2683
2683
2684 Notes:
2684 Notes:
2685
2685
2686 1) If an input line begins with '!!', then %sx is automatically
2686 1) If an input line begins with '!!', then %sx is automatically
2687 invoked. That is, while:
2687 invoked. That is, while:
2688 !ls
2688 !ls
2689 causes ipython to simply issue system('ls'), typing
2689 causes ipython to simply issue system('ls'), typing
2690 !!ls
2690 !!ls
2691 is a shorthand equivalent to:
2691 is a shorthand equivalent to:
2692 %sx ls
2692 %sx ls
2693
2693
2694 2) %sx differs from %sc in that %sx automatically splits into a list,
2694 2) %sx differs from %sc in that %sx automatically splits into a list,
2695 like '%sc -l'. The reason for this is to make it as easy as possible
2695 like '%sc -l'. The reason for this is to make it as easy as possible
2696 to process line-oriented shell output via further python commands.
2696 to process line-oriented shell output via further python commands.
2697 %sc is meant to provide much finer control, but requires more
2697 %sc is meant to provide much finer control, but requires more
2698 typing.
2698 typing.
2699
2699
2700 3) Just like %sc -l, this is a list with special attributes:
2700 3) Just like %sc -l, this is a list with special attributes:
2701
2701
2702 .l (or .list) : value as list.
2702 .l (or .list) : value as list.
2703 .n (or .nlstr): value as newline-separated string.
2703 .n (or .nlstr): value as newline-separated string.
2704 .s (or .spstr): value as whitespace-separated string.
2704 .s (or .spstr): value as whitespace-separated string.
2705
2705
2706 This is very useful when trying to use such lists as arguments to
2706 This is very useful when trying to use such lists as arguments to
2707 system commands."""
2707 system commands."""
2708
2708
2709 if parameter_s:
2709 if parameter_s:
2710 out,err = self.shell.getoutputerror(parameter_s)
2710 out,err = self.shell.getoutputerror(parameter_s)
2711 if err:
2711 if err:
2712 print >> Term.cerr,err
2712 print >> Term.cerr,err
2713 return SList(out.split('\n'))
2713 return SList(out.split('\n'))
2714
2714
2715 def magic_bg(self, parameter_s=''):
2715 def magic_bg(self, parameter_s=''):
2716 """Run a job in the background, in a separate thread.
2716 """Run a job in the background, in a separate thread.
2717
2717
2718 For example,
2718 For example,
2719
2719
2720 %bg myfunc(x,y,z=1)
2720 %bg myfunc(x,y,z=1)
2721
2721
2722 will execute 'myfunc(x,y,z=1)' in a background thread. As soon as the
2722 will execute 'myfunc(x,y,z=1)' in a background thread. As soon as the
2723 execution starts, a message will be printed indicating the job
2723 execution starts, a message will be printed indicating the job
2724 number. If your job number is 5, you can use
2724 number. If your job number is 5, you can use
2725
2725
2726 myvar = jobs.result(5) or myvar = jobs[5].result
2726 myvar = jobs.result(5) or myvar = jobs[5].result
2727
2727
2728 to assign this result to variable 'myvar'.
2728 to assign this result to variable 'myvar'.
2729
2729
2730 IPython has a job manager, accessible via the 'jobs' object. You can
2730 IPython has a job manager, accessible via the 'jobs' object. You can
2731 type jobs? to get more information about it, and use jobs.<TAB> to see
2731 type jobs? to get more information about it, and use jobs.<TAB> to see
2732 its attributes. All attributes not starting with an underscore are
2732 its attributes. All attributes not starting with an underscore are
2733 meant for public use.
2733 meant for public use.
2734
2734
2735 In particular, look at the jobs.new() method, which is used to create
2735 In particular, look at the jobs.new() method, which is used to create
2736 new jobs. This magic %bg function is just a convenience wrapper
2736 new jobs. This magic %bg function is just a convenience wrapper
2737 around jobs.new(), for expression-based jobs. If you want to create a
2737 around jobs.new(), for expression-based jobs. If you want to create a
2738 new job with an explicit function object and arguments, you must call
2738 new job with an explicit function object and arguments, you must call
2739 jobs.new() directly.
2739 jobs.new() directly.
2740
2740
2741 The jobs.new docstring also describes in detail several important
2741 The jobs.new docstring also describes in detail several important
2742 caveats associated with a thread-based model for background job
2742 caveats associated with a thread-based model for background job
2743 execution. Type jobs.new? for details.
2743 execution. Type jobs.new? for details.
2744
2744
2745 You can check the status of all jobs with jobs.status().
2745 You can check the status of all jobs with jobs.status().
2746
2746
2747 The jobs variable is set by IPython into the Python builtin namespace.
2747 The jobs variable is set by IPython into the Python builtin namespace.
2748 If you ever declare a variable named 'jobs', you will shadow this
2748 If you ever declare a variable named 'jobs', you will shadow this
2749 name. You can either delete your global jobs variable to regain
2749 name. You can either delete your global jobs variable to regain
2750 access to the job manager, or make a new name and assign it manually
2750 access to the job manager, or make a new name and assign it manually
2751 to the manager (stored in IPython's namespace). For example, to
2751 to the manager (stored in IPython's namespace). For example, to
2752 assign the job manager to the Jobs name, use:
2752 assign the job manager to the Jobs name, use:
2753
2753
2754 Jobs = __builtins__.jobs"""
2754 Jobs = __builtins__.jobs"""
2755
2755
2756 self.shell.jobs.new(parameter_s,self.shell.user_ns)
2756 self.shell.jobs.new(parameter_s,self.shell.user_ns)
2757
2757
2758
2758
2759 def magic_bookmark(self, parameter_s=''):
2759 def magic_bookmark(self, parameter_s=''):
2760 """Manage IPython's bookmark system.
2760 """Manage IPython's bookmark system.
2761
2761
2762 %bookmark <name> - set bookmark to current dir
2762 %bookmark <name> - set bookmark to current dir
2763 %bookmark <name> <dir> - set bookmark to <dir>
2763 %bookmark <name> <dir> - set bookmark to <dir>
2764 %bookmark -l - list all bookmarks
2764 %bookmark -l - list all bookmarks
2765 %bookmark -d <name> - remove bookmark
2765 %bookmark -d <name> - remove bookmark
2766 %bookmark -r - remove all bookmarks
2766 %bookmark -r - remove all bookmarks
2767
2767
2768 You can later on access a bookmarked folder with:
2768 You can later on access a bookmarked folder with:
2769 %cd -b <name>
2769 %cd -b <name>
2770 or simply '%cd <name>' if there is no directory called <name> AND
2770 or simply '%cd <name>' if there is no directory called <name> AND
2771 there is such a bookmark defined.
2771 there is such a bookmark defined.
2772
2772
2773 Your bookmarks persist through IPython sessions, but they are
2773 Your bookmarks persist through IPython sessions, but they are
2774 associated with each profile."""
2774 associated with each profile."""
2775
2775
2776 opts,args = self.parse_options(parameter_s,'drl',mode='list')
2776 opts,args = self.parse_options(parameter_s,'drl',mode='list')
2777 if len(args) > 2:
2777 if len(args) > 2:
2778 error('You can only give at most two arguments')
2778 error('You can only give at most two arguments')
2779 return
2779 return
2780
2780
2781 bkms = self.db.get('bookmarks',{})
2781 bkms = self.db.get('bookmarks',{})
2782
2782
2783 if opts.has_key('d'):
2783 if opts.has_key('d'):
2784 try:
2784 try:
2785 todel = args[0]
2785 todel = args[0]
2786 except IndexError:
2786 except IndexError:
2787 error('You must provide a bookmark to delete')
2787 error('You must provide a bookmark to delete')
2788 else:
2788 else:
2789 try:
2789 try:
2790 del bkms[todel]
2790 del bkms[todel]
2791 except:
2791 except:
2792 error("Can't delete bookmark '%s'" % todel)
2792 error("Can't delete bookmark '%s'" % todel)
2793 elif opts.has_key('r'):
2793 elif opts.has_key('r'):
2794 bkms = {}
2794 bkms = {}
2795 elif opts.has_key('l'):
2795 elif opts.has_key('l'):
2796 bks = bkms.keys()
2796 bks = bkms.keys()
2797 bks.sort()
2797 bks.sort()
2798 if bks:
2798 if bks:
2799 size = max(map(len,bks))
2799 size = max(map(len,bks))
2800 else:
2800 else:
2801 size = 0
2801 size = 0
2802 fmt = '%-'+str(size)+'s -> %s'
2802 fmt = '%-'+str(size)+'s -> %s'
2803 print 'Current bookmarks:'
2803 print 'Current bookmarks:'
2804 for bk in bks:
2804 for bk in bks:
2805 print fmt % (bk,bkms[bk])
2805 print fmt % (bk,bkms[bk])
2806 else:
2806 else:
2807 if not args:
2807 if not args:
2808 error("You must specify the bookmark name")
2808 error("You must specify the bookmark name")
2809 elif len(args)==1:
2809 elif len(args)==1:
2810 bkms[args[0]] = os.getcwd()
2810 bkms[args[0]] = os.getcwd()
2811 elif len(args)==2:
2811 elif len(args)==2:
2812 bkms[args[0]] = args[1]
2812 bkms[args[0]] = args[1]
2813 self.db['bookmarks'] = bkms
2813 self.db['bookmarks'] = bkms
2814
2814
2815 def magic_pycat(self, parameter_s=''):
2815 def magic_pycat(self, parameter_s=''):
2816 """Show a syntax-highlighted file through a pager.
2816 """Show a syntax-highlighted file through a pager.
2817
2817
2818 This magic is similar to the cat utility, but it will assume the file
2818 This magic is similar to the cat utility, but it will assume the file
2819 to be Python source and will show it with syntax highlighting. """
2819 to be Python source and will show it with syntax highlighting. """
2820
2820
2821 try:
2821 try:
2822 filename = get_py_filename(parameter_s)
2822 filename = get_py_filename(parameter_s)
2823 cont = file_read(filename)
2823 cont = file_read(filename)
2824 except IOError:
2824 except IOError:
2825 try:
2825 try:
2826 cont = eval(parameter_s,self.user_ns)
2826 cont = eval(parameter_s,self.user_ns)
2827 except NameError:
2827 except NameError:
2828 cont = None
2828 cont = None
2829 if cont is None:
2829 if cont is None:
2830 print "Error: no such file or variable"
2830 print "Error: no such file or variable"
2831 return
2831 return
2832
2832
2833 page(self.shell.pycolorize(cont),
2833 page(self.shell.pycolorize(cont),
2834 screen_lines=self.shell.rc.screen_length)
2834 screen_lines=self.shell.rc.screen_length)
2835
2835
2836 def magic_cpaste(self, parameter_s=''):
2836 def magic_cpaste(self, parameter_s=''):
2837 """Allows you to paste & execute a pre-formatted code block from clipboard
2837 """Allows you to paste & execute a pre-formatted code block from clipboard
2838
2838
2839 You must terminate the block with '--' (two minus-signs) alone on the
2839 You must terminate the block with '--' (two minus-signs) alone on the
2840 line. You can also provide your own sentinel with '%paste -s %%' ('%%'
2840 line. You can also provide your own sentinel with '%paste -s %%' ('%%'
2841 is the new sentinel for this operation)
2841 is the new sentinel for this operation)
2842
2842
2843 The block is dedented prior to execution to enable execution of method
2843 The block is dedented prior to execution to enable execution of method
2844 definitions. '>' and '+' characters at the beginning of a line are
2844 definitions. '>' and '+' characters at the beginning of a line are
2845 ignored, to allow pasting directly from e-mails or diff files. The
2845 ignored, to allow pasting directly from e-mails or diff files. The
2846 executed block is also assigned to variable named 'pasted_block' for
2846 executed block is also assigned to variable named 'pasted_block' for
2847 later editing with '%edit pasted_block'.
2847 later editing with '%edit pasted_block'.
2848
2848
2849 You can also pass a variable name as an argument, e.g. '%cpaste foo'.
2849 You can also pass a variable name as an argument, e.g. '%cpaste foo'.
2850 This assigns the pasted block to variable 'foo' as string, without
2850 This assigns the pasted block to variable 'foo' as string, without
2851 dedenting or executing it.
2851 dedenting or executing it.
2852
2852
2853 Do not be alarmed by garbled output on Windows (it's a readline bug).
2853 Do not be alarmed by garbled output on Windows (it's a readline bug).
2854 Just press enter and type -- (and press enter again) and the block
2854 Just press enter and type -- (and press enter again) and the block
2855 will be what was just pasted.
2855 will be what was just pasted.
2856
2856
2857 IPython statements (magics, shell escapes) are not supported (yet).
2857 IPython statements (magics, shell escapes) are not supported (yet).
2858 """
2858 """
2859 opts,args = self.parse_options(parameter_s,'s:',mode='string')
2859 opts,args = self.parse_options(parameter_s,'s:',mode='string')
2860 par = args.strip()
2860 par = args.strip()
2861 sentinel = opts.get('s','--')
2861 sentinel = opts.get('s','--')
2862
2862
2863 from IPython import iplib
2863 from IPython import iplib
2864 lines = []
2864 lines = []
2865 print "Pasting code; enter '%s' alone on the line to stop." % sentinel
2865 print "Pasting code; enter '%s' alone on the line to stop." % sentinel
2866 while 1:
2866 while 1:
2867 l = iplib.raw_input_original(':')
2867 l = iplib.raw_input_original(':')
2868 if l ==sentinel:
2868 if l ==sentinel:
2869 break
2869 break
2870 lines.append(l.lstrip('>').lstrip('+'))
2870 lines.append(l.lstrip('>').lstrip('+'))
2871 block = "\n".join(lines) + '\n'
2871 block = "\n".join(lines) + '\n'
2872 #print "block:\n",block
2872 #print "block:\n",block
2873 if not par:
2873 if not par:
2874 b = textwrap.dedent(block)
2874 b = textwrap.dedent(block)
2875 exec b in self.user_ns
2875 exec b in self.user_ns
2876 self.user_ns['pasted_block'] = b
2876 self.user_ns['pasted_block'] = b
2877 else:
2877 else:
2878 self.user_ns[par] = block
2878 self.user_ns[par] = block
2879 print "Block assigned to '%s'" % par
2879 print "Block assigned to '%s'" % par
2880
2880
2881 def magic_quickref(self,arg):
2881 def magic_quickref(self,arg):
2882 """ Show a quick reference sheet """
2882 """ Show a quick reference sheet """
2883 import IPython.usage
2883 import IPython.usage
2884 qr = IPython.usage.quick_reference + self.magic_magic('-brief')
2884 qr = IPython.usage.quick_reference + self.magic_magic('-brief')
2885
2885
2886 page(qr)
2886 page(qr)
2887
2887
2888 def magic_upgrade(self,arg):
2888 def magic_upgrade(self,arg):
2889 """ Upgrade your IPython installation
2889 """ Upgrade your IPython installation
2890
2890
2891 This will copy the config files that don't yet exist in your
2891 This will copy the config files that don't yet exist in your
2892 ipython dir from the system config dir. Use this after upgrading
2892 ipython dir from the system config dir. Use this after upgrading
2893 IPython if you don't wish to delete your .ipython dir.
2893 IPython if you don't wish to delete your .ipython dir.
2894
2894
2895 Call with -nolegacy to get rid of ipythonrc* files (recommended for
2895 Call with -nolegacy to get rid of ipythonrc* files (recommended for
2896 new users)
2896 new users)
2897
2897
2898 """
2898 """
2899 ip = self.getapi()
2899 ip = self.getapi()
2900 ipinstallation = path(IPython.__file__).dirname()
2900 ipinstallation = path(IPython.__file__).dirname()
2901 upgrade_script = '%s "%s"' % (sys.executable,ipinstallation / 'upgrade_dir.py')
2901 upgrade_script = '%s "%s"' % (sys.executable,ipinstallation / 'upgrade_dir.py')
2902 src_config = ipinstallation / 'UserConfig'
2902 src_config = ipinstallation / 'UserConfig'
2903 userdir = path(ip.options.ipythondir)
2903 userdir = path(ip.options.ipythondir)
2904 cmd = '%s "%s" "%s"' % (upgrade_script, src_config, userdir)
2904 cmd = '%s "%s" "%s"' % (upgrade_script, src_config, userdir)
2905 print ">",cmd
2905 print ">",cmd
2906 shell(cmd)
2906 shell(cmd)
2907 if arg == '-nolegacy':
2907 if arg == '-nolegacy':
2908 legacy = userdir.files('ipythonrc*')
2908 legacy = userdir.files('ipythonrc*')
2909 print "Nuking legacy files:",legacy
2909 print "Nuking legacy files:",legacy
2910
2910
2911 [p.remove() for p in legacy]
2911 [p.remove() for p in legacy]
2912 suffix = (sys.platform == 'win32' and '.ini' or '')
2912 suffix = (sys.platform == 'win32' and '.ini' or '')
2913 (userdir / ('ipythonrc' + suffix)).write_text('# Empty, see ipy_user_conf.py\n')
2913 (userdir / ('ipythonrc' + suffix)).write_text('# Empty, see ipy_user_conf.py\n')
2914
2914
2915
2916 def magic_doctest_mode(self,parameter_s=''):
2917 """Toggle doctest mode on and off.
2918
2919 This mode allows you to toggle the prompt behavior between normal
2920 IPython prompts and ones that are as similar to the default IPython
2921 interpreter as possible.
2922
2923 It also supports the pasting of code snippets that have leading '>>>'
2924 and '...' prompts in them. This means that you can paste doctests from
2925 files or docstrings (even if they have leading whitespace), and the
2926 code will execute correctly. You can then use '%history -tn' to see
2927 the translated history without line numbers; this will give you the
2928 input after removal of all the leading prompts and whitespace, which
2929 can be pasted back into an editor.
2930
2931 With these features, you can switch into this mode easily whenever you
2932 need to do testing and changes to doctests, without having to leave
2933 your existing IPython session.
2934 """
2935
2936 # XXX - Fix this to have cleaner activate/deactivate calls.
2937 from IPython.Extensions import InterpreterPasteInput as ipaste
2938 from IPython.ipstruct import Struct
2939
2940 # Shorthands
2941 shell = self.shell
2942 oc = shell.outputcache
2943 rc = shell.rc
2944 meta = shell.meta
2945 # dstore is a data store kept in the instance metadata bag to track any
2946 # changes we make, so we can undo them later.
2947 dstore = meta.setdefault('doctest_mode',Struct())
2948 save_dstore = dstore.setdefault
2949
2950 # save a few values we'll need to recover later
2951 mode = save_dstore('mode',False)
2952 save_dstore('rc_pprint',rc.pprint)
2953 save_dstore('xmode',shell.InteractiveTB.mode)
2954 save_dstore('rc_separate_in',rc.separate_in)
2955 save_dstore('rc_separate_out',rc.separate_out)
2956 save_dstore('rc_separate_out2',rc.separate_out2)
2957 save_dstore('rc_prompts_pad_left',rc.prompts_pad_left)
2958
2959 if mode == False:
2960 # turn on
2961 ipaste.activate_prefilter()
2962
2963 oc.prompt1.p_template = '>>> '
2964 oc.prompt2.p_template = '... '
2965 oc.prompt_out.p_template = ''
2966
2967 oc.prompt1.sep = ''
2968 oc.prompt_out.output_sep = ''
2969 oc.prompt_out.output_sep2 = '\n'
2970
2971 oc.prompt1.pad_left = oc.prompt2.pad_left = \
2972 oc.prompt_out.pad_left = False
2973
2974 shell.magic_xmode('Plain')
2975
2976 rc.pprint = False
2977
2978 else:
2979 # turn off
2980 ipaste.deactivate_prefilter()
2981
2982 oc.prompt1.p_template = rc.prompt_in1
2983 oc.prompt2.p_template = rc.prompt_in2
2984 oc.prompt_out.p_template = rc.prompt_out
2985
2986 oc.prompt1.sep = dstore.rc_separate_in
2987 oc.prompt_out.output_sep = dstore.rc_separate_out
2988 oc.prompt_out.output_sep2 = dstore.rc_separate_out2
2989
2990 oc.prompt1.pad_left = oc.prompt2.pad_left = \
2991 oc.prompt_out.pad_left = dstore.rc_prompts_pad_left
2992 shell.magic_xmode(dstore.xmode)
2993
2994 rc.pprint = dstore.rc_pprint
2995
2996 # Store new mode and inform
2997 dstore.mode = bool(1-int(mode))
2998 print 'Doctest mode is:',
2999 print ['OFF','ON'][dstore.mode]
3000
2915 # end Magic
3001 # end Magic
@@ -1,591 +1,604 b''
1 # -*- coding: utf-8 -*-
1 # -*- coding: utf-8 -*-
2 """
2 """
3 Classes for handling input/output prompts.
3 Classes for handling input/output prompts.
4
4
5 $Id: Prompts.py 2397 2007-05-26 10:06:26Z vivainio $"""
5 $Id: Prompts.py 2601 2007-08-10 07:01:29Z fperez $"""
6
6
7 #*****************************************************************************
7 #*****************************************************************************
8 # Copyright (C) 2001-2006 Fernando Perez <fperez@colorado.edu>
8 # Copyright (C) 2001-2006 Fernando Perez <fperez@colorado.edu>
9 #
9 #
10 # Distributed under the terms of the BSD License. The full license is in
10 # Distributed under the terms of the BSD License. The full license is in
11 # the file COPYING, distributed as part of this software.
11 # the file COPYING, distributed as part of this software.
12 #*****************************************************************************
12 #*****************************************************************************
13
13
14 from IPython import Release
14 from IPython import Release
15 __author__ = '%s <%s>' % Release.authors['Fernando']
15 __author__ = '%s <%s>' % Release.authors['Fernando']
16 __license__ = Release.license
16 __license__ = Release.license
17 __version__ = Release.version
17 __version__ = Release.version
18
18
19 #****************************************************************************
19 #****************************************************************************
20 # Required modules
20 # Required modules
21 import __builtin__
21 import __builtin__
22 import os
22 import os
23 import socket
23 import socket
24 import sys
24 import sys
25 import time
25 import time
26
26
27 # IPython's own
27 # IPython's own
28 from IPython import ColorANSI
28 from IPython import ColorANSI
29 from IPython.Itpl import ItplNS
29 from IPython.Itpl import ItplNS
30 from IPython.ipstruct import Struct
30 from IPython.ipstruct import Struct
31 from IPython.macro import Macro
31 from IPython.macro import Macro
32 from IPython.genutils import *
32 from IPython.genutils import *
33 from IPython.ipapi import TryNext
33 from IPython.ipapi import TryNext
34
34
35 #****************************************************************************
35 #****************************************************************************
36 #Color schemes for Prompts.
36 #Color schemes for Prompts.
37
37
38 PromptColors = ColorANSI.ColorSchemeTable()
38 PromptColors = ColorANSI.ColorSchemeTable()
39 InputColors = ColorANSI.InputTermColors # just a shorthand
39 InputColors = ColorANSI.InputTermColors # just a shorthand
40 Colors = ColorANSI.TermColors # just a shorthand
40 Colors = ColorANSI.TermColors # just a shorthand
41
41
42 PromptColors.add_scheme(ColorANSI.ColorScheme(
42 PromptColors.add_scheme(ColorANSI.ColorScheme(
43 'NoColor',
43 'NoColor',
44 in_prompt = InputColors.NoColor, # Input prompt
44 in_prompt = InputColors.NoColor, # Input prompt
45 in_number = InputColors.NoColor, # Input prompt number
45 in_number = InputColors.NoColor, # Input prompt number
46 in_prompt2 = InputColors.NoColor, # Continuation prompt
46 in_prompt2 = InputColors.NoColor, # Continuation prompt
47 in_normal = InputColors.NoColor, # color off (usu. Colors.Normal)
47 in_normal = InputColors.NoColor, # color off (usu. Colors.Normal)
48
48
49 out_prompt = Colors.NoColor, # Output prompt
49 out_prompt = Colors.NoColor, # Output prompt
50 out_number = Colors.NoColor, # Output prompt number
50 out_number = Colors.NoColor, # Output prompt number
51
51
52 normal = Colors.NoColor # color off (usu. Colors.Normal)
52 normal = Colors.NoColor # color off (usu. Colors.Normal)
53 ))
53 ))
54
54
55 # make some schemes as instances so we can copy them for modification easily:
55 # make some schemes as instances so we can copy them for modification easily:
56 __PColLinux = ColorANSI.ColorScheme(
56 __PColLinux = ColorANSI.ColorScheme(
57 'Linux',
57 'Linux',
58 in_prompt = InputColors.Green,
58 in_prompt = InputColors.Green,
59 in_number = InputColors.LightGreen,
59 in_number = InputColors.LightGreen,
60 in_prompt2 = InputColors.Green,
60 in_prompt2 = InputColors.Green,
61 in_normal = InputColors.Normal, # color off (usu. Colors.Normal)
61 in_normal = InputColors.Normal, # color off (usu. Colors.Normal)
62
62
63 out_prompt = Colors.Red,
63 out_prompt = Colors.Red,
64 out_number = Colors.LightRed,
64 out_number = Colors.LightRed,
65
65
66 normal = Colors.Normal
66 normal = Colors.Normal
67 )
67 )
68 # Don't forget to enter it into the table!
68 # Don't forget to enter it into the table!
69 PromptColors.add_scheme(__PColLinux)
69 PromptColors.add_scheme(__PColLinux)
70
70
71 # Slightly modified Linux for light backgrounds
71 # Slightly modified Linux for light backgrounds
72 __PColLightBG = __PColLinux.copy('LightBG')
72 __PColLightBG = __PColLinux.copy('LightBG')
73
73
74 __PColLightBG.colors.update(
74 __PColLightBG.colors.update(
75 in_prompt = InputColors.Blue,
75 in_prompt = InputColors.Blue,
76 in_number = InputColors.LightBlue,
76 in_number = InputColors.LightBlue,
77 in_prompt2 = InputColors.Blue
77 in_prompt2 = InputColors.Blue
78 )
78 )
79 PromptColors.add_scheme(__PColLightBG)
79 PromptColors.add_scheme(__PColLightBG)
80
80
81 del Colors,InputColors
81 del Colors,InputColors
82
82
83 #-----------------------------------------------------------------------------
83 #-----------------------------------------------------------------------------
84 def multiple_replace(dict, text):
84 def multiple_replace(dict, text):
85 """ Replace in 'text' all occurences of any key in the given
85 """ Replace in 'text' all occurences of any key in the given
86 dictionary by its corresponding value. Returns the new string."""
86 dictionary by its corresponding value. Returns the new string."""
87
87
88 # Function by Xavier Defrang, originally found at:
88 # Function by Xavier Defrang, originally found at:
89 # http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/81330
89 # http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/81330
90
90
91 # Create a regular expression from the dictionary keys
91 # Create a regular expression from the dictionary keys
92 regex = re.compile("(%s)" % "|".join(map(re.escape, dict.keys())))
92 regex = re.compile("(%s)" % "|".join(map(re.escape, dict.keys())))
93 # For each match, look-up corresponding value in dictionary
93 # For each match, look-up corresponding value in dictionary
94 return regex.sub(lambda mo: dict[mo.string[mo.start():mo.end()]], text)
94 return regex.sub(lambda mo: dict[mo.string[mo.start():mo.end()]], text)
95
95
96 #-----------------------------------------------------------------------------
96 #-----------------------------------------------------------------------------
97 # Special characters that can be used in prompt templates, mainly bash-like
97 # Special characters that can be used in prompt templates, mainly bash-like
98
98
99 # If $HOME isn't defined (Windows), make it an absurd string so that it can
99 # If $HOME isn't defined (Windows), make it an absurd string so that it can
100 # never be expanded out into '~'. Basically anything which can never be a
100 # never be expanded out into '~'. Basically anything which can never be a
101 # reasonable directory name will do, we just want the $HOME -> '~' operation
101 # reasonable directory name will do, we just want the $HOME -> '~' operation
102 # to become a no-op. We pre-compute $HOME here so it's not done on every
102 # to become a no-op. We pre-compute $HOME here so it's not done on every
103 # prompt call.
103 # prompt call.
104
104
105 # FIXME:
105 # FIXME:
106
106
107 # - This should be turned into a class which does proper namespace management,
107 # - This should be turned into a class which does proper namespace management,
108 # since the prompt specials need to be evaluated in a certain namespace.
108 # since the prompt specials need to be evaluated in a certain namespace.
109 # Currently it's just globals, which need to be managed manually by code
109 # Currently it's just globals, which need to be managed manually by code
110 # below.
110 # below.
111
111
112 # - I also need to split up the color schemes from the prompt specials
112 # - I also need to split up the color schemes from the prompt specials
113 # somehow. I don't have a clean design for that quite yet.
113 # somehow. I don't have a clean design for that quite yet.
114
114
115 HOME = os.environ.get("HOME","//////:::::ZZZZZ,,,~~~")
115 HOME = os.environ.get("HOME","//////:::::ZZZZZ,,,~~~")
116
116
117 # We precompute a few more strings here for the prompt_specials, which are
117 # We precompute a few more strings here for the prompt_specials, which are
118 # fixed once ipython starts. This reduces the runtime overhead of computing
118 # fixed once ipython starts. This reduces the runtime overhead of computing
119 # prompt strings.
119 # prompt strings.
120 USER = os.environ.get("USER")
120 USER = os.environ.get("USER")
121 HOSTNAME = socket.gethostname()
121 HOSTNAME = socket.gethostname()
122 HOSTNAME_SHORT = HOSTNAME.split(".")[0]
122 HOSTNAME_SHORT = HOSTNAME.split(".")[0]
123 ROOT_SYMBOL = "$#"[os.name=='nt' or os.getuid()==0]
123 ROOT_SYMBOL = "$#"[os.name=='nt' or os.getuid()==0]
124
124
125 prompt_specials_color = {
125 prompt_specials_color = {
126 # Prompt/history count
126 # Prompt/history count
127 '%n' : '${self.col_num}' '${self.cache.prompt_count}' '${self.col_p}',
127 '%n' : '${self.col_num}' '${self.cache.prompt_count}' '${self.col_p}',
128 r'\#': '${self.col_num}' '${self.cache.prompt_count}' '${self.col_p}',
128 r'\#': '${self.col_num}' '${self.cache.prompt_count}' '${self.col_p}',
129 # Just the prompt counter number, WITHOUT any coloring wrappers, so users
129 # Just the prompt counter number, WITHOUT any coloring wrappers, so users
130 # can get numbers displayed in whatever color they want.
130 # can get numbers displayed in whatever color they want.
131 r'\N': '${self.cache.prompt_count}',
131 r'\N': '${self.cache.prompt_count}',
132 # Prompt/history count, with the actual digits replaced by dots. Used
132 # Prompt/history count, with the actual digits replaced by dots. Used
133 # mainly in continuation prompts (prompt_in2)
133 # mainly in continuation prompts (prompt_in2)
134 r'\D': '${"."*len(str(self.cache.prompt_count))}',
134 r'\D': '${"."*len(str(self.cache.prompt_count))}',
135 # Current working directory
135 # Current working directory
136 r'\w': '${os.getcwd()}',
136 r'\w': '${os.getcwd()}',
137 # Current time
137 # Current time
138 r'\t' : '${time.strftime("%H:%M:%S")}',
138 r'\t' : '${time.strftime("%H:%M:%S")}',
139 # Basename of current working directory.
139 # Basename of current working directory.
140 # (use os.sep to make this portable across OSes)
140 # (use os.sep to make this portable across OSes)
141 r'\W' : '${os.getcwd().split("%s")[-1]}' % os.sep,
141 r'\W' : '${os.getcwd().split("%s")[-1]}' % os.sep,
142 # These X<N> are an extension to the normal bash prompts. They return
142 # These X<N> are an extension to the normal bash prompts. They return
143 # N terms of the path, after replacing $HOME with '~'
143 # N terms of the path, after replacing $HOME with '~'
144 r'\X0': '${os.getcwd().replace("%s","~")}' % HOME,
144 r'\X0': '${os.getcwd().replace("%s","~")}' % HOME,
145 r'\X1': '${self.cwd_filt(1)}',
145 r'\X1': '${self.cwd_filt(1)}',
146 r'\X2': '${self.cwd_filt(2)}',
146 r'\X2': '${self.cwd_filt(2)}',
147 r'\X3': '${self.cwd_filt(3)}',
147 r'\X3': '${self.cwd_filt(3)}',
148 r'\X4': '${self.cwd_filt(4)}',
148 r'\X4': '${self.cwd_filt(4)}',
149 r'\X5': '${self.cwd_filt(5)}',
149 r'\X5': '${self.cwd_filt(5)}',
150 # Y<N> are similar to X<N>, but they show '~' if it's the directory
150 # Y<N> are similar to X<N>, but they show '~' if it's the directory
151 # N+1 in the list. Somewhat like %cN in tcsh.
151 # N+1 in the list. Somewhat like %cN in tcsh.
152 r'\Y0': '${self.cwd_filt2(0)}',
152 r'\Y0': '${self.cwd_filt2(0)}',
153 r'\Y1': '${self.cwd_filt2(1)}',
153 r'\Y1': '${self.cwd_filt2(1)}',
154 r'\Y2': '${self.cwd_filt2(2)}',
154 r'\Y2': '${self.cwd_filt2(2)}',
155 r'\Y3': '${self.cwd_filt2(3)}',
155 r'\Y3': '${self.cwd_filt2(3)}',
156 r'\Y4': '${self.cwd_filt2(4)}',
156 r'\Y4': '${self.cwd_filt2(4)}',
157 r'\Y5': '${self.cwd_filt2(5)}',
157 r'\Y5': '${self.cwd_filt2(5)}',
158 # Hostname up to first .
158 # Hostname up to first .
159 r'\h': HOSTNAME_SHORT,
159 r'\h': HOSTNAME_SHORT,
160 # Full hostname
160 # Full hostname
161 r'\H': HOSTNAME,
161 r'\H': HOSTNAME,
162 # Username of current user
162 # Username of current user
163 r'\u': USER,
163 r'\u': USER,
164 # Escaped '\'
164 # Escaped '\'
165 '\\\\': '\\',
165 '\\\\': '\\',
166 # Newline
166 # Newline
167 r'\n': '\n',
167 r'\n': '\n',
168 # Carriage return
168 # Carriage return
169 r'\r': '\r',
169 r'\r': '\r',
170 # Release version
170 # Release version
171 r'\v': __version__,
171 r'\v': __version__,
172 # Root symbol ($ or #)
172 # Root symbol ($ or #)
173 r'\$': ROOT_SYMBOL,
173 r'\$': ROOT_SYMBOL,
174 }
174 }
175
175
176 # A copy of the prompt_specials dictionary but with all color escapes removed,
176 # A copy of the prompt_specials dictionary but with all color escapes removed,
177 # so we can correctly compute the prompt length for the auto_rewrite method.
177 # so we can correctly compute the prompt length for the auto_rewrite method.
178 prompt_specials_nocolor = prompt_specials_color.copy()
178 prompt_specials_nocolor = prompt_specials_color.copy()
179 prompt_specials_nocolor['%n'] = '${self.cache.prompt_count}'
179 prompt_specials_nocolor['%n'] = '${self.cache.prompt_count}'
180 prompt_specials_nocolor[r'\#'] = '${self.cache.prompt_count}'
180 prompt_specials_nocolor[r'\#'] = '${self.cache.prompt_count}'
181
181
182 # Add in all the InputTermColors color escapes as valid prompt characters.
182 # Add in all the InputTermColors color escapes as valid prompt characters.
183 # They all get added as \\C_COLORNAME, so that we don't have any conflicts
183 # They all get added as \\C_COLORNAME, so that we don't have any conflicts
184 # with a color name which may begin with a letter used by any other of the
184 # with a color name which may begin with a letter used by any other of the
185 # allowed specials. This of course means that \\C will never be allowed for
185 # allowed specials. This of course means that \\C will never be allowed for
186 # anything else.
186 # anything else.
187 input_colors = ColorANSI.InputTermColors
187 input_colors = ColorANSI.InputTermColors
188 for _color in dir(input_colors):
188 for _color in dir(input_colors):
189 if _color[0] != '_':
189 if _color[0] != '_':
190 c_name = r'\C_'+_color
190 c_name = r'\C_'+_color
191 prompt_specials_color[c_name] = getattr(input_colors,_color)
191 prompt_specials_color[c_name] = getattr(input_colors,_color)
192 prompt_specials_nocolor[c_name] = ''
192 prompt_specials_nocolor[c_name] = ''
193
193
194 # we default to no color for safety. Note that prompt_specials is a global
194 # we default to no color for safety. Note that prompt_specials is a global
195 # variable used by all prompt objects.
195 # variable used by all prompt objects.
196 prompt_specials = prompt_specials_nocolor
196 prompt_specials = prompt_specials_nocolor
197
197
198 #-----------------------------------------------------------------------------
198 #-----------------------------------------------------------------------------
199 def str_safe(arg):
199 def str_safe(arg):
200 """Convert to a string, without ever raising an exception.
200 """Convert to a string, without ever raising an exception.
201
201
202 If str(arg) fails, <ERROR: ... > is returned, where ... is the exception
202 If str(arg) fails, <ERROR: ... > is returned, where ... is the exception
203 error message."""
203 error message."""
204
204
205 try:
205 try:
206 out = str(arg)
206 out = str(arg)
207 except UnicodeError:
207 except UnicodeError:
208 try:
208 try:
209 out = arg.encode('utf_8','replace')
209 out = arg.encode('utf_8','replace')
210 except Exception,msg:
210 except Exception,msg:
211 # let's keep this little duplication here, so that the most common
211 # let's keep this little duplication here, so that the most common
212 # case doesn't suffer from a double try wrapping.
212 # case doesn't suffer from a double try wrapping.
213 out = '<ERROR: %s>' % msg
213 out = '<ERROR: %s>' % msg
214 except Exception,msg:
214 except Exception,msg:
215 out = '<ERROR: %s>' % msg
215 out = '<ERROR: %s>' % msg
216 return out
216 return out
217
217
218 class BasePrompt:
218 class BasePrompt(object):
219 """Interactive prompt similar to Mathematica's."""
219 """Interactive prompt similar to Mathematica's."""
220
221 def _get_p_template(self):
222 return self._p_template
223
224 def _set_p_template(self,val):
225 self._p_template = val
226 self.set_p_str()
227
228 p_template = property(_get_p_template,_set_p_template,
229 doc='Template for prompt string creation')
230
220 def __init__(self,cache,sep,prompt,pad_left=False):
231 def __init__(self,cache,sep,prompt,pad_left=False):
221
232
222 # Hack: we access information about the primary prompt through the
233 # Hack: we access information about the primary prompt through the
223 # cache argument. We need this, because we want the secondary prompt
234 # cache argument. We need this, because we want the secondary prompt
224 # to be aligned with the primary one. Color table info is also shared
235 # to be aligned with the primary one. Color table info is also shared
225 # by all prompt classes through the cache. Nice OO spaghetti code!
236 # by all prompt classes through the cache. Nice OO spaghetti code!
226 self.cache = cache
237 self.cache = cache
227 self.sep = sep
238 self.sep = sep
228
239
229 # regexp to count the number of spaces at the end of a prompt
240 # regexp to count the number of spaces at the end of a prompt
230 # expression, useful for prompt auto-rewriting
241 # expression, useful for prompt auto-rewriting
231 self.rspace = re.compile(r'(\s*)$')
242 self.rspace = re.compile(r'(\s*)$')
232 # Flag to left-pad prompt strings to match the length of the primary
243 # Flag to left-pad prompt strings to match the length of the primary
233 # prompt
244 # prompt
234 self.pad_left = pad_left
245 self.pad_left = pad_left
235 # Set template to create each actual prompt (where numbers change)
246
247 # Set template to create each actual prompt (where numbers change).
248 # Use a property
236 self.p_template = prompt
249 self.p_template = prompt
237 self.set_p_str()
250 self.set_p_str()
238
251
239 def set_p_str(self):
252 def set_p_str(self):
240 """ Set the interpolating prompt strings.
253 """ Set the interpolating prompt strings.
241
254
242 This must be called every time the color settings change, because the
255 This must be called every time the color settings change, because the
243 prompt_specials global may have changed."""
256 prompt_specials global may have changed."""
244
257
245 import os,time # needed in locals for prompt string handling
258 import os,time # needed in locals for prompt string handling
246 loc = locals()
259 loc = locals()
247 self.p_str = ItplNS('%s%s%s' %
260 self.p_str = ItplNS('%s%s%s' %
248 ('${self.sep}${self.col_p}',
261 ('${self.sep}${self.col_p}',
249 multiple_replace(prompt_specials, self.p_template),
262 multiple_replace(prompt_specials, self.p_template),
250 '${self.col_norm}'),self.cache.user_ns,loc)
263 '${self.col_norm}'),self.cache.user_ns,loc)
251
264
252 self.p_str_nocolor = ItplNS(multiple_replace(prompt_specials_nocolor,
265 self.p_str_nocolor = ItplNS(multiple_replace(prompt_specials_nocolor,
253 self.p_template),
266 self.p_template),
254 self.cache.user_ns,loc)
267 self.cache.user_ns,loc)
255
268
256 def write(self,msg): # dbg
269 def write(self,msg): # dbg
257 sys.stdout.write(msg)
270 sys.stdout.write(msg)
258 return ''
271 return ''
259
272
260 def __str__(self):
273 def __str__(self):
261 """Return a string form of the prompt.
274 """Return a string form of the prompt.
262
275
263 This for is useful for continuation and output prompts, since it is
276 This for is useful for continuation and output prompts, since it is
264 left-padded to match lengths with the primary one (if the
277 left-padded to match lengths with the primary one (if the
265 self.pad_left attribute is set)."""
278 self.pad_left attribute is set)."""
266
279
267 out_str = str_safe(self.p_str)
280 out_str = str_safe(self.p_str)
268 if self.pad_left:
281 if self.pad_left:
269 # We must find the amount of padding required to match lengths,
282 # We must find the amount of padding required to match lengths,
270 # taking the color escapes (which are invisible on-screen) into
283 # taking the color escapes (which are invisible on-screen) into
271 # account.
284 # account.
272 esc_pad = len(out_str) - len(str_safe(self.p_str_nocolor))
285 esc_pad = len(out_str) - len(str_safe(self.p_str_nocolor))
273 format = '%%%ss' % (len(str(self.cache.last_prompt))+esc_pad)
286 format = '%%%ss' % (len(str(self.cache.last_prompt))+esc_pad)
274 return format % out_str
287 return format % out_str
275 else:
288 else:
276 return out_str
289 return out_str
277
290
278 # these path filters are put in as methods so that we can control the
291 # these path filters are put in as methods so that we can control the
279 # namespace where the prompt strings get evaluated
292 # namespace where the prompt strings get evaluated
280 def cwd_filt(self,depth):
293 def cwd_filt(self,depth):
281 """Return the last depth elements of the current working directory.
294 """Return the last depth elements of the current working directory.
282
295
283 $HOME is always replaced with '~'.
296 $HOME is always replaced with '~'.
284 If depth==0, the full path is returned."""
297 If depth==0, the full path is returned."""
285
298
286 cwd = os.getcwd().replace(HOME,"~")
299 cwd = os.getcwd().replace(HOME,"~")
287 out = os.sep.join(cwd.split(os.sep)[-depth:])
300 out = os.sep.join(cwd.split(os.sep)[-depth:])
288 if out:
301 if out:
289 return out
302 return out
290 else:
303 else:
291 return os.sep
304 return os.sep
292
305
293 def cwd_filt2(self,depth):
306 def cwd_filt2(self,depth):
294 """Return the last depth elements of the current working directory.
307 """Return the last depth elements of the current working directory.
295
308
296 $HOME is always replaced with '~'.
309 $HOME is always replaced with '~'.
297 If depth==0, the full path is returned."""
310 If depth==0, the full path is returned."""
298
311
299 cwd = os.getcwd().replace(HOME,"~").split(os.sep)
312 cwd = os.getcwd().replace(HOME,"~").split(os.sep)
300 if '~' in cwd and len(cwd) == depth+1:
313 if '~' in cwd and len(cwd) == depth+1:
301 depth += 1
314 depth += 1
302 out = os.sep.join(cwd[-depth:])
315 out = os.sep.join(cwd[-depth:])
303 if out:
316 if out:
304 return out
317 return out
305 else:
318 else:
306 return os.sep
319 return os.sep
307
320
308 class Prompt1(BasePrompt):
321 class Prompt1(BasePrompt):
309 """Input interactive prompt similar to Mathematica's."""
322 """Input interactive prompt similar to Mathematica's."""
310
323
311 def __init__(self,cache,sep='\n',prompt='In [\\#]: ',pad_left=True):
324 def __init__(self,cache,sep='\n',prompt='In [\\#]: ',pad_left=True):
312 BasePrompt.__init__(self,cache,sep,prompt,pad_left)
325 BasePrompt.__init__(self,cache,sep,prompt,pad_left)
313
326
314 def set_colors(self):
327 def set_colors(self):
315 self.set_p_str()
328 self.set_p_str()
316 Colors = self.cache.color_table.active_colors # shorthand
329 Colors = self.cache.color_table.active_colors # shorthand
317 self.col_p = Colors.in_prompt
330 self.col_p = Colors.in_prompt
318 self.col_num = Colors.in_number
331 self.col_num = Colors.in_number
319 self.col_norm = Colors.in_normal
332 self.col_norm = Colors.in_normal
320 # We need a non-input version of these escapes for the '--->'
333 # We need a non-input version of these escapes for the '--->'
321 # auto-call prompts used in the auto_rewrite() method.
334 # auto-call prompts used in the auto_rewrite() method.
322 self.col_p_ni = self.col_p.replace('\001','').replace('\002','')
335 self.col_p_ni = self.col_p.replace('\001','').replace('\002','')
323 self.col_norm_ni = Colors.normal
336 self.col_norm_ni = Colors.normal
324
337
325 def __str__(self):
338 def __str__(self):
326 self.cache.prompt_count += 1
339 self.cache.prompt_count += 1
327 self.cache.last_prompt = str_safe(self.p_str_nocolor).split('\n')[-1]
340 self.cache.last_prompt = str_safe(self.p_str_nocolor).split('\n')[-1]
328 return str_safe(self.p_str)
341 return str_safe(self.p_str)
329
342
330 def auto_rewrite(self):
343 def auto_rewrite(self):
331 """Print a string of the form '--->' which lines up with the previous
344 """Print a string of the form '--->' which lines up with the previous
332 input string. Useful for systems which re-write the user input when
345 input string. Useful for systems which re-write the user input when
333 handling automatically special syntaxes."""
346 handling automatically special syntaxes."""
334
347
335 curr = str(self.cache.last_prompt)
348 curr = str(self.cache.last_prompt)
336 nrspaces = len(self.rspace.search(curr).group())
349 nrspaces = len(self.rspace.search(curr).group())
337 return '%s%s>%s%s' % (self.col_p_ni,'-'*(len(curr)-nrspaces-1),
350 return '%s%s>%s%s' % (self.col_p_ni,'-'*(len(curr)-nrspaces-1),
338 ' '*nrspaces,self.col_norm_ni)
351 ' '*nrspaces,self.col_norm_ni)
339
352
340 class PromptOut(BasePrompt):
353 class PromptOut(BasePrompt):
341 """Output interactive prompt similar to Mathematica's."""
354 """Output interactive prompt similar to Mathematica's."""
342
355
343 def __init__(self,cache,sep='',prompt='Out[\\#]: ',pad_left=True):
356 def __init__(self,cache,sep='',prompt='Out[\\#]: ',pad_left=True):
344 BasePrompt.__init__(self,cache,sep,prompt,pad_left)
357 BasePrompt.__init__(self,cache,sep,prompt,pad_left)
345 if not self.p_template:
358 if not self.p_template:
346 self.__str__ = lambda: ''
359 self.__str__ = lambda: ''
347
360
348 def set_colors(self):
361 def set_colors(self):
349 self.set_p_str()
362 self.set_p_str()
350 Colors = self.cache.color_table.active_colors # shorthand
363 Colors = self.cache.color_table.active_colors # shorthand
351 self.col_p = Colors.out_prompt
364 self.col_p = Colors.out_prompt
352 self.col_num = Colors.out_number
365 self.col_num = Colors.out_number
353 self.col_norm = Colors.normal
366 self.col_norm = Colors.normal
354
367
355 class Prompt2(BasePrompt):
368 class Prompt2(BasePrompt):
356 """Interactive continuation prompt."""
369 """Interactive continuation prompt."""
357
370
358 def __init__(self,cache,prompt=' .\\D.: ',pad_left=True):
371 def __init__(self,cache,prompt=' .\\D.: ',pad_left=True):
359 self.cache = cache
372 self.cache = cache
360 self.p_template = prompt
373 self.p_template = prompt
361 self.pad_left = pad_left
374 self.pad_left = pad_left
362 self.set_p_str()
375 self.set_p_str()
363
376
364 def set_p_str(self):
377 def set_p_str(self):
365 import os,time # needed in locals for prompt string handling
378 import os,time # needed in locals for prompt string handling
366 loc = locals()
379 loc = locals()
367 self.p_str = ItplNS('%s%s%s' %
380 self.p_str = ItplNS('%s%s%s' %
368 ('${self.col_p2}',
381 ('${self.col_p2}',
369 multiple_replace(prompt_specials, self.p_template),
382 multiple_replace(prompt_specials, self.p_template),
370 '$self.col_norm'),
383 '$self.col_norm'),
371 self.cache.user_ns,loc)
384 self.cache.user_ns,loc)
372 self.p_str_nocolor = ItplNS(multiple_replace(prompt_specials_nocolor,
385 self.p_str_nocolor = ItplNS(multiple_replace(prompt_specials_nocolor,
373 self.p_template),
386 self.p_template),
374 self.cache.user_ns,loc)
387 self.cache.user_ns,loc)
375
388
376 def set_colors(self):
389 def set_colors(self):
377 self.set_p_str()
390 self.set_p_str()
378 Colors = self.cache.color_table.active_colors
391 Colors = self.cache.color_table.active_colors
379 self.col_p2 = Colors.in_prompt2
392 self.col_p2 = Colors.in_prompt2
380 self.col_norm = Colors.in_normal
393 self.col_norm = Colors.in_normal
381 # FIXME (2004-06-16) HACK: prevent crashes for users who haven't
394 # FIXME (2004-06-16) HACK: prevent crashes for users who haven't
382 # updated their prompt_in2 definitions. Remove eventually.
395 # updated their prompt_in2 definitions. Remove eventually.
383 self.col_p = Colors.out_prompt
396 self.col_p = Colors.out_prompt
384 self.col_num = Colors.out_number
397 self.col_num = Colors.out_number
385
398
386
399
387 #-----------------------------------------------------------------------------
400 #-----------------------------------------------------------------------------
388 class CachedOutput:
401 class CachedOutput:
389 """Class for printing output from calculations while keeping a cache of
402 """Class for printing output from calculations while keeping a cache of
390 reults. It dynamically creates global variables prefixed with _ which
403 reults. It dynamically creates global variables prefixed with _ which
391 contain these results.
404 contain these results.
392
405
393 Meant to be used as a sys.displayhook replacement, providing numbered
406 Meant to be used as a sys.displayhook replacement, providing numbered
394 prompts and cache services.
407 prompts and cache services.
395
408
396 Initialize with initial and final values for cache counter (this defines
409 Initialize with initial and final values for cache counter (this defines
397 the maximum size of the cache."""
410 the maximum size of the cache."""
398
411
399 def __init__(self,shell,cache_size,Pprint,
412 def __init__(self,shell,cache_size,Pprint,
400 colors='NoColor',input_sep='\n',
413 colors='NoColor',input_sep='\n',
401 output_sep='\n',output_sep2='',
414 output_sep='\n',output_sep2='',
402 ps1 = None, ps2 = None,ps_out = None,pad_left=True):
415 ps1 = None, ps2 = None,ps_out = None,pad_left=True):
403
416
404 cache_size_min = 3
417 cache_size_min = 3
405 if cache_size <= 0:
418 if cache_size <= 0:
406 self.do_full_cache = 0
419 self.do_full_cache = 0
407 cache_size = 0
420 cache_size = 0
408 elif cache_size < cache_size_min:
421 elif cache_size < cache_size_min:
409 self.do_full_cache = 0
422 self.do_full_cache = 0
410 cache_size = 0
423 cache_size = 0
411 warn('caching was disabled (min value for cache size is %s).' %
424 warn('caching was disabled (min value for cache size is %s).' %
412 cache_size_min,level=3)
425 cache_size_min,level=3)
413 else:
426 else:
414 self.do_full_cache = 1
427 self.do_full_cache = 1
415
428
416 self.cache_size = cache_size
429 self.cache_size = cache_size
417 self.input_sep = input_sep
430 self.input_sep = input_sep
418
431
419 # we need a reference to the user-level namespace
432 # we need a reference to the user-level namespace
420 self.shell = shell
433 self.shell = shell
421 self.user_ns = shell.user_ns
434 self.user_ns = shell.user_ns
422 # and to the user's input
435 # and to the user's input
423 self.input_hist = shell.input_hist
436 self.input_hist = shell.input_hist
424 # and to the user's logger, for logging output
437 # and to the user's logger, for logging output
425 self.logger = shell.logger
438 self.logger = shell.logger
426
439
427 # Set input prompt strings and colors
440 # Set input prompt strings and colors
428 if cache_size == 0:
441 if cache_size == 0:
429 if ps1.find('%n') > -1 or ps1.find(r'\#') > -1 \
442 if ps1.find('%n') > -1 or ps1.find(r'\#') > -1 \
430 or ps1.find(r'\N') > -1:
443 or ps1.find(r'\N') > -1:
431 ps1 = '>>> '
444 ps1 = '>>> '
432 if ps2.find('%n') > -1 or ps2.find(r'\#') > -1 \
445 if ps2.find('%n') > -1 or ps2.find(r'\#') > -1 \
433 or ps2.find(r'\N') > -1:
446 or ps2.find(r'\N') > -1:
434 ps2 = '... '
447 ps2 = '... '
435 self.ps1_str = self._set_prompt_str(ps1,'In [\\#]: ','>>> ')
448 self.ps1_str = self._set_prompt_str(ps1,'In [\\#]: ','>>> ')
436 self.ps2_str = self._set_prompt_str(ps2,' .\\D.: ','... ')
449 self.ps2_str = self._set_prompt_str(ps2,' .\\D.: ','... ')
437 self.ps_out_str = self._set_prompt_str(ps_out,'Out[\\#]: ','')
450 self.ps_out_str = self._set_prompt_str(ps_out,'Out[\\#]: ','')
438
451
439 self.color_table = PromptColors
452 self.color_table = PromptColors
440 self.prompt1 = Prompt1(self,sep=input_sep,prompt=self.ps1_str,
453 self.prompt1 = Prompt1(self,sep=input_sep,prompt=self.ps1_str,
441 pad_left=pad_left)
454 pad_left=pad_left)
442 self.prompt2 = Prompt2(self,prompt=self.ps2_str,pad_left=pad_left)
455 self.prompt2 = Prompt2(self,prompt=self.ps2_str,pad_left=pad_left)
443 self.prompt_out = PromptOut(self,sep='',prompt=self.ps_out_str,
456 self.prompt_out = PromptOut(self,sep='',prompt=self.ps_out_str,
444 pad_left=pad_left)
457 pad_left=pad_left)
445 self.set_colors(colors)
458 self.set_colors(colors)
446
459
447 # other more normal stuff
460 # other more normal stuff
448 # b/c each call to the In[] prompt raises it by 1, even the first.
461 # b/c each call to the In[] prompt raises it by 1, even the first.
449 self.prompt_count = 0
462 self.prompt_count = 0
450 # Store the last prompt string each time, we need it for aligning
463 # Store the last prompt string each time, we need it for aligning
451 # continuation and auto-rewrite prompts
464 # continuation and auto-rewrite prompts
452 self.last_prompt = ''
465 self.last_prompt = ''
453 self.Pprint = Pprint
466 self.Pprint = Pprint
454 self.output_sep = output_sep
467 self.output_sep = output_sep
455 self.output_sep2 = output_sep2
468 self.output_sep2 = output_sep2
456 self._,self.__,self.___ = '','',''
469 self._,self.__,self.___ = '','',''
457 self.pprint_types = map(type,[(),[],{}])
470 self.pprint_types = map(type,[(),[],{}])
458
471
459 # these are deliberately global:
472 # these are deliberately global:
460 to_user_ns = {'_':self._,'__':self.__,'___':self.___}
473 to_user_ns = {'_':self._,'__':self.__,'___':self.___}
461 self.user_ns.update(to_user_ns)
474 self.user_ns.update(to_user_ns)
462
475
463 def _set_prompt_str(self,p_str,cache_def,no_cache_def):
476 def _set_prompt_str(self,p_str,cache_def,no_cache_def):
464 if p_str is None:
477 if p_str is None:
465 if self.do_full_cache:
478 if self.do_full_cache:
466 return cache_def
479 return cache_def
467 else:
480 else:
468 return no_cache_def
481 return no_cache_def
469 else:
482 else:
470 return p_str
483 return p_str
471
484
472 def set_colors(self,colors):
485 def set_colors(self,colors):
473 """Set the active color scheme and configure colors for the three
486 """Set the active color scheme and configure colors for the three
474 prompt subsystems."""
487 prompt subsystems."""
475
488
476 # FIXME: the prompt_specials global should be gobbled inside this
489 # FIXME: the prompt_specials global should be gobbled inside this
477 # class instead. Do it when cleaning up the whole 3-prompt system.
490 # class instead. Do it when cleaning up the whole 3-prompt system.
478 global prompt_specials
491 global prompt_specials
479 if colors.lower()=='nocolor':
492 if colors.lower()=='nocolor':
480 prompt_specials = prompt_specials_nocolor
493 prompt_specials = prompt_specials_nocolor
481 else:
494 else:
482 prompt_specials = prompt_specials_color
495 prompt_specials = prompt_specials_color
483
496
484 self.color_table.set_active_scheme(colors)
497 self.color_table.set_active_scheme(colors)
485 self.prompt1.set_colors()
498 self.prompt1.set_colors()
486 self.prompt2.set_colors()
499 self.prompt2.set_colors()
487 self.prompt_out.set_colors()
500 self.prompt_out.set_colors()
488
501
489 def __call__(self,arg=None):
502 def __call__(self,arg=None):
490 """Printing with history cache management.
503 """Printing with history cache management.
491
504
492 This is invoked everytime the interpreter needs to print, and is
505 This is invoked everytime the interpreter needs to print, and is
493 activated by setting the variable sys.displayhook to it."""
506 activated by setting the variable sys.displayhook to it."""
494
507
495 # If something injected a '_' variable in __builtin__, delete
508 # If something injected a '_' variable in __builtin__, delete
496 # ipython's automatic one so we don't clobber that. gettext() in
509 # ipython's automatic one so we don't clobber that. gettext() in
497 # particular uses _, so we need to stay away from it.
510 # particular uses _, so we need to stay away from it.
498 if '_' in __builtin__.__dict__:
511 if '_' in __builtin__.__dict__:
499 try:
512 try:
500 del self.user_ns['_']
513 del self.user_ns['_']
501 except KeyError:
514 except KeyError:
502 pass
515 pass
503 if arg is not None:
516 if arg is not None:
504 cout_write = Term.cout.write # fast lookup
517 cout_write = Term.cout.write # fast lookup
505 # first handle the cache and counters
518 # first handle the cache and counters
506
519
507 # do not print output if input ends in ';'
520 # do not print output if input ends in ';'
508 if self.input_hist[self.prompt_count].endswith(';\n'):
521 if self.input_hist[self.prompt_count].endswith(';\n'):
509 return
522 return
510 # don't use print, puts an extra space
523 # don't use print, puts an extra space
511 cout_write(self.output_sep)
524 cout_write(self.output_sep)
512 outprompt = self.shell.hooks.generate_output_prompt()
525 outprompt = self.shell.hooks.generate_output_prompt()
513 if self.do_full_cache:
526 if self.do_full_cache:
514 cout_write(outprompt)
527 cout_write(outprompt)
515
528
516 # and now call a possibly user-defined print mechanism
529 # and now call a possibly user-defined print mechanism
517 manipulated_val = self.display(arg)
530 manipulated_val = self.display(arg)
518
531
519 # user display hooks can change the variable to be stored in
532 # user display hooks can change the variable to be stored in
520 # output history
533 # output history
521
534
522 if manipulated_val is not None:
535 if manipulated_val is not None:
523 arg = manipulated_val
536 arg = manipulated_val
524
537
525 # avoid recursive reference when displaying _oh/Out
538 # avoid recursive reference when displaying _oh/Out
526 if arg is not self.user_ns['_oh']:
539 if arg is not self.user_ns['_oh']:
527 self.update(arg)
540 self.update(arg)
528
541
529 if self.logger.log_output:
542 if self.logger.log_output:
530 self.logger.log_write(repr(arg),'output')
543 self.logger.log_write(repr(arg),'output')
531 cout_write(self.output_sep2)
544 cout_write(self.output_sep2)
532 Term.cout.flush()
545 Term.cout.flush()
533
546
534 def _display(self,arg):
547 def _display(self,arg):
535 """Default printer method, uses pprint.
548 """Default printer method, uses pprint.
536
549
537 Do ip.set_hook("result_display", my_displayhook) for custom result
550 Do ip.set_hook("result_display", my_displayhook) for custom result
538 display, e.g. when your own objects need special formatting.
551 display, e.g. when your own objects need special formatting.
539 """
552 """
540 try:
553 try:
541 return IPython.generics.result_display(arg)
554 return IPython.generics.result_display(arg)
542 except TryNext:
555 except TryNext:
543 return self.shell.hooks.result_display(arg)
556 return self.shell.hooks.result_display(arg)
544
557
545 # Assign the default display method:
558 # Assign the default display method:
546 display = _display
559 display = _display
547
560
548 def update(self,arg):
561 def update(self,arg):
549 #print '***cache_count', self.cache_count # dbg
562 #print '***cache_count', self.cache_count # dbg
550 if len(self.user_ns['_oh']) >= self.cache_size and self.do_full_cache:
563 if len(self.user_ns['_oh']) >= self.cache_size and self.do_full_cache:
551 warn('Output cache limit (currently '+
564 warn('Output cache limit (currently '+
552 `self.cache_size`+' entries) hit.\n'
565 `self.cache_size`+' entries) hit.\n'
553 'Flushing cache and resetting history counter...\n'
566 'Flushing cache and resetting history counter...\n'
554 'The only history variables available will be _,__,___ and _1\n'
567 'The only history variables available will be _,__,___ and _1\n'
555 'with the current result.')
568 'with the current result.')
556
569
557 self.flush()
570 self.flush()
558 # Don't overwrite '_' and friends if '_' is in __builtin__ (otherwise
571 # Don't overwrite '_' and friends if '_' is in __builtin__ (otherwise
559 # we cause buggy behavior for things like gettext).
572 # we cause buggy behavior for things like gettext).
560 if '_' not in __builtin__.__dict__:
573 if '_' not in __builtin__.__dict__:
561 self.___ = self.__
574 self.___ = self.__
562 self.__ = self._
575 self.__ = self._
563 self._ = arg
576 self._ = arg
564 self.user_ns.update({'_':self._,'__':self.__,'___':self.___})
577 self.user_ns.update({'_':self._,'__':self.__,'___':self.___})
565
578
566 # hackish access to top-level namespace to create _1,_2... dynamically
579 # hackish access to top-level namespace to create _1,_2... dynamically
567 to_main = {}
580 to_main = {}
568 if self.do_full_cache:
581 if self.do_full_cache:
569 new_result = '_'+`self.prompt_count`
582 new_result = '_'+`self.prompt_count`
570 to_main[new_result] = arg
583 to_main[new_result] = arg
571 self.user_ns.update(to_main)
584 self.user_ns.update(to_main)
572 self.user_ns['_oh'][self.prompt_count] = arg
585 self.user_ns['_oh'][self.prompt_count] = arg
573
586
574 def flush(self):
587 def flush(self):
575 if not self.do_full_cache:
588 if not self.do_full_cache:
576 raise ValueError,"You shouldn't have reached the cache flush "\
589 raise ValueError,"You shouldn't have reached the cache flush "\
577 "if full caching is not enabled!"
590 "if full caching is not enabled!"
578 # delete auto-generated vars from global namespace
591 # delete auto-generated vars from global namespace
579
592
580 for n in range(1,self.prompt_count + 1):
593 for n in range(1,self.prompt_count + 1):
581 key = '_'+`n`
594 key = '_'+`n`
582 try:
595 try:
583 del self.user_ns[key]
596 del self.user_ns[key]
584 except: pass
597 except: pass
585 self.user_ns['_oh'].clear()
598 self.user_ns['_oh'].clear()
586
599
587 if '_' not in __builtin__.__dict__:
600 if '_' not in __builtin__.__dict__:
588 self.user_ns.update({'_':None,'__':None, '___':None})
601 self.user_ns.update({'_':None,'__':None, '___':None})
589 import gc
602 import gc
590 gc.collect() # xxx needed?
603 gc.collect() # xxx needed?
591
604
@@ -1,463 +1,484 b''
1 ''' IPython customization API
1 ''' IPython customization API
2
2
3 Your one-stop module for configuring & extending ipython
3 Your one-stop module for configuring & extending ipython
4
4
5 The API will probably break when ipython 1.0 is released, but so
5 The API will probably break when ipython 1.0 is released, but so
6 will the other configuration method (rc files).
6 will the other configuration method (rc files).
7
7
8 All names prefixed by underscores are for internal use, not part
8 All names prefixed by underscores are for internal use, not part
9 of the public api.
9 of the public api.
10
10
11 Below is an example that you can just put to a module and import from ipython.
11 Below is an example that you can just put to a module and import from ipython.
12
12
13 A good practice is to install the config script below as e.g.
13 A good practice is to install the config script below as e.g.
14
14
15 ~/.ipython/my_private_conf.py
15 ~/.ipython/my_private_conf.py
16
16
17 And do
17 And do
18
18
19 import_mod my_private_conf
19 import_mod my_private_conf
20
20
21 in ~/.ipython/ipythonrc
21 in ~/.ipython/ipythonrc
22
22
23 That way the module is imported at startup and you can have all your
23 That way the module is imported at startup and you can have all your
24 personal configuration (as opposed to boilerplate ipythonrc-PROFILENAME
24 personal configuration (as opposed to boilerplate ipythonrc-PROFILENAME
25 stuff) in there.
25 stuff) in there.
26
26
27 -----------------------------------------------
27 -----------------------------------------------
28 import IPython.ipapi
28 import IPython.ipapi
29 ip = IPython.ipapi.get()
29 ip = IPython.ipapi.get()
30
30
31 def ankka_f(self, arg):
31 def ankka_f(self, arg):
32 print "Ankka",self,"says uppercase:",arg.upper()
32 print "Ankka",self,"says uppercase:",arg.upper()
33
33
34 ip.expose_magic("ankka",ankka_f)
34 ip.expose_magic("ankka",ankka_f)
35
35
36 ip.magic('alias sayhi echo "Testing, hi ok"')
36 ip.magic('alias sayhi echo "Testing, hi ok"')
37 ip.magic('alias helloworld echo "Hello world"')
37 ip.magic('alias helloworld echo "Hello world"')
38 ip.system('pwd')
38 ip.system('pwd')
39
39
40 ip.ex('import re')
40 ip.ex('import re')
41 ip.ex("""
41 ip.ex("""
42 def funcci(a,b):
42 def funcci(a,b):
43 print a+b
43 print a+b
44 print funcci(3,4)
44 print funcci(3,4)
45 """)
45 """)
46 ip.ex("funcci(348,9)")
46 ip.ex("funcci(348,9)")
47
47
48 def jed_editor(self,filename, linenum=None):
48 def jed_editor(self,filename, linenum=None):
49 print "Calling my own editor, jed ... via hook!"
49 print "Calling my own editor, jed ... via hook!"
50 import os
50 import os
51 if linenum is None: linenum = 0
51 if linenum is None: linenum = 0
52 os.system('jed +%d %s' % (linenum, filename))
52 os.system('jed +%d %s' % (linenum, filename))
53 print "exiting jed"
53 print "exiting jed"
54
54
55 ip.set_hook('editor',jed_editor)
55 ip.set_hook('editor',jed_editor)
56
56
57 o = ip.options
57 o = ip.options
58 o.autocall = 2 # FULL autocall mode
58 o.autocall = 2 # FULL autocall mode
59
59
60 print "done!"
60 print "done!"
61 '''
61 '''
62
62
63 # stdlib imports
63 # stdlib imports
64 import __builtin__
64 import __builtin__
65 import sys
65 import sys
66
66
67 # our own
67 # our own
68 #from IPython.genutils import warn,error
68 #from IPython.genutils import warn,error
69
69
70 class TryNext(Exception):
70 class TryNext(Exception):
71 """Try next hook exception.
71 """Try next hook exception.
72
72
73 Raise this in your hook function to indicate that the next hook handler
73 Raise this in your hook function to indicate that the next hook handler
74 should be used to handle the operation. If you pass arguments to the
74 should be used to handle the operation. If you pass arguments to the
75 constructor those arguments will be used by the next hook instead of the
75 constructor those arguments will be used by the next hook instead of the
76 original ones.
76 original ones.
77 """
77 """
78
78
79 def __init__(self, *args, **kwargs):
79 def __init__(self, *args, **kwargs):
80 self.args = args
80 self.args = args
81 self.kwargs = kwargs
81 self.kwargs = kwargs
82
82
83 class IPyAutocall:
83 class IPyAutocall:
84 """ Instances of this class are always autocalled
84 """ Instances of this class are always autocalled
85
85
86 This happens regardless of 'autocall' variable state. Use this to
86 This happens regardless of 'autocall' variable state. Use this to
87 develop macro-like mechanisms.
87 develop macro-like mechanisms.
88 """
88 """
89
89
90 def set_ip(self,ip):
90 def set_ip(self,ip):
91 """ Will be used to set _ip point to current ipython instance b/f call
91 """ Will be used to set _ip point to current ipython instance b/f call
92
92
93 Override this method if you don't want this to happen.
93 Override this method if you don't want this to happen.
94
94
95 """
95 """
96 self._ip = ip
96 self._ip = ip
97
97
98
98
99 # contains the most recently instantiated IPApi
99 # contains the most recently instantiated IPApi
100
100
101 class IPythonNotRunning:
101 class IPythonNotRunning:
102 """Dummy do-nothing class.
102 """Dummy do-nothing class.
103
103
104 Instances of this class return a dummy attribute on all accesses, which
104 Instances of this class return a dummy attribute on all accesses, which
105 can be called and warns. This makes it easier to write scripts which use
105 can be called and warns. This makes it easier to write scripts which use
106 the ipapi.get() object for informational purposes to operate both with and
106 the ipapi.get() object for informational purposes to operate both with and
107 without ipython. Obviously code which uses the ipython object for
107 without ipython. Obviously code which uses the ipython object for
108 computations will not work, but this allows a wider range of code to
108 computations will not work, but this allows a wider range of code to
109 transparently work whether ipython is being used or not."""
109 transparently work whether ipython is being used or not."""
110
110
111 def __init__(self,warn=True):
111 def __init__(self,warn=True):
112 if warn:
112 if warn:
113 self.dummy = self._dummy_warn
113 self.dummy = self._dummy_warn
114 else:
114 else:
115 self.dummy = self._dummy_silent
115 self.dummy = self._dummy_silent
116
116
117 def __str__(self):
117 def __str__(self):
118 return "<IPythonNotRunning>"
118 return "<IPythonNotRunning>"
119
119
120 __repr__ = __str__
120 __repr__ = __str__
121
121
122 def __getattr__(self,name):
122 def __getattr__(self,name):
123 return self.dummy
123 return self.dummy
124
124
125 def _dummy_warn(self,*args,**kw):
125 def _dummy_warn(self,*args,**kw):
126 """Dummy function, which doesn't do anything but warn."""
126 """Dummy function, which doesn't do anything but warn."""
127
127
128 print ("IPython is not running, this is a dummy no-op function")
128 print ("IPython is not running, this is a dummy no-op function")
129
129
130 def _dummy_silent(self,*args,**kw):
130 def _dummy_silent(self,*args,**kw):
131 """Dummy function, which doesn't do anything and emits no warnings."""
131 """Dummy function, which doesn't do anything and emits no warnings."""
132 pass
132 pass
133
133
134 _recent = None
134 _recent = None
135
135
136
136
137 def get(allow_dummy=False,dummy_warn=True):
137 def get(allow_dummy=False,dummy_warn=True):
138 """Get an IPApi object.
138 """Get an IPApi object.
139
139
140 If allow_dummy is true, returns an instance of IPythonNotRunning
140 If allow_dummy is true, returns an instance of IPythonNotRunning
141 instead of None if not running under IPython.
141 instead of None if not running under IPython.
142
142
143 If dummy_warn is false, the dummy instance will be completely silent.
143 If dummy_warn is false, the dummy instance will be completely silent.
144
144
145 Running this should be the first thing you do when writing extensions that
145 Running this should be the first thing you do when writing extensions that
146 can be imported as normal modules. You can then direct all the
146 can be imported as normal modules. You can then direct all the
147 configuration operations against the returned object.
147 configuration operations against the returned object.
148 """
148 """
149 global _recent
149 global _recent
150 if allow_dummy and not _recent:
150 if allow_dummy and not _recent:
151 _recent = IPythonNotRunning(dummy_warn)
151 _recent = IPythonNotRunning(dummy_warn)
152 return _recent
152 return _recent
153
153
154 class IPApi:
154 class IPApi:
155 """ The actual API class for configuring IPython
155 """ The actual API class for configuring IPython
156
156
157 You should do all of the IPython configuration by getting an IPApi object
157 You should do all of the IPython configuration by getting an IPApi object
158 with IPython.ipapi.get() and using the attributes and methods of the
158 with IPython.ipapi.get() and using the attributes and methods of the
159 returned object."""
159 returned object."""
160
160
161 def __init__(self,ip):
161 def __init__(self,ip):
162
162
163 # All attributes exposed here are considered to be the public API of
163 # All attributes exposed here are considered to be the public API of
164 # IPython. As needs dictate, some of these may be wrapped as
164 # IPython. As needs dictate, some of these may be wrapped as
165 # properties.
165 # properties.
166
166
167 self.magic = ip.ipmagic
167 self.magic = ip.ipmagic
168
168
169 self.system = ip.system
169 self.system = ip.system
170
170
171 self.set_hook = ip.set_hook
171 self.set_hook = ip.set_hook
172
172
173 self.set_custom_exc = ip.set_custom_exc
173 self.set_custom_exc = ip.set_custom_exc
174
174
175 self.user_ns = ip.user_ns
175 self.user_ns = ip.user_ns
176
176
177 self.set_crash_handler = ip.set_crash_handler
177 self.set_crash_handler = ip.set_crash_handler
178
178
179 # Session-specific data store, which can be used to store
179 # Session-specific data store, which can be used to store
180 # data that should persist through the ipython session.
180 # data that should persist through the ipython session.
181 self.meta = ip.meta
181 self.meta = ip.meta
182
182
183 # The ipython instance provided
183 # The ipython instance provided
184 self.IP = ip
184 self.IP = ip
185
185
186 self.extensions = {}
186 self.extensions = {}
187 global _recent
187 global _recent
188 _recent = self
188 _recent = self
189
189
190 # Use a property for some things which are added to the instance very
190 # Use a property for some things which are added to the instance very
191 # late. I don't have time right now to disentangle the initialization
191 # late. I don't have time right now to disentangle the initialization
192 # order issues, so a property lets us delay item extraction while
192 # order issues, so a property lets us delay item extraction while
193 # providing a normal attribute API.
193 # providing a normal attribute API.
194 def get_db(self):
194 def get_db(self):
195 """A handle to persistent dict-like database (a PickleShareDB object)"""
195 """A handle to persistent dict-like database (a PickleShareDB object)"""
196 return self.IP.db
196 return self.IP.db
197
197
198 db = property(get_db,None,None,get_db.__doc__)
198 db = property(get_db,None,None,get_db.__doc__)
199
199
200 def get_options(self):
200 def get_options(self):
201 """All configurable variables."""
201 """All configurable variables."""
202
202
203 # catch typos by disabling new attribute creation. If new attr creation
203 # catch typos by disabling new attribute creation. If new attr creation
204 # is in fact wanted (e.g. when exposing new options), do allow_new_attr(True)
204 # is in fact wanted (e.g. when exposing new options), do allow_new_attr(True)
205 # for the received rc struct.
205 # for the received rc struct.
206
206
207 self.IP.rc.allow_new_attr(False)
207 self.IP.rc.allow_new_attr(False)
208 return self.IP.rc
208 return self.IP.rc
209
209
210 options = property(get_options,None,None,get_options.__doc__)
210 options = property(get_options,None,None,get_options.__doc__)
211
211
212 def expose_magic(self,magicname, func):
212 def expose_magic(self,magicname, func):
213 ''' Expose own function as magic function for ipython
213 ''' Expose own function as magic function for ipython
214
214
215 def foo_impl(self,parameter_s=''):
215 def foo_impl(self,parameter_s=''):
216 """My very own magic!. (Use docstrings, IPython reads them)."""
216 """My very own magic!. (Use docstrings, IPython reads them)."""
217 print 'Magic function. Passed parameter is between < >: <'+parameter_s+'>'
217 print 'Magic function. Passed parameter is between < >: <'+parameter_s+'>'
218 print 'The self object is:',self
218 print 'The self object is:',self
219
219
220 ipapi.expose_magic("foo",foo_impl)
220 ipapi.expose_magic("foo",foo_impl)
221 '''
221 '''
222
222
223 import new
223 import new
224 im = new.instancemethod(func,self.IP, self.IP.__class__)
224 im = new.instancemethod(func,self.IP, self.IP.__class__)
225 setattr(self.IP, "magic_" + magicname, im)
225 setattr(self.IP, "magic_" + magicname, im)
226
226
227 def ex(self,cmd):
227 def ex(self,cmd):
228 """ Execute a normal python statement in user namespace """
228 """ Execute a normal python statement in user namespace """
229 exec cmd in self.user_ns
229 exec cmd in self.user_ns
230
230
231 def ev(self,expr):
231 def ev(self,expr):
232 """ Evaluate python expression expr in user namespace
232 """ Evaluate python expression expr in user namespace
233
233
234 Returns the result of evaluation"""
234 Returns the result of evaluation"""
235 return eval(expr,self.user_ns)
235 return eval(expr,self.user_ns)
236
236
237 def runlines(self,lines):
237 def runlines(self,lines):
238 """ Run the specified lines in interpreter, honoring ipython directives.
238 """ Run the specified lines in interpreter, honoring ipython directives.
239
239
240 This allows %magic and !shell escape notations.
240 This allows %magic and !shell escape notations.
241
241
242 Takes either all lines in one string or list of lines.
242 Takes either all lines in one string or list of lines.
243 """
243 """
244 if isinstance(lines,basestring):
244 if isinstance(lines,basestring):
245 self.IP.runlines(lines)
245 self.IP.runlines(lines)
246 else:
246 else:
247 self.IP.runlines('\n'.join(lines))
247 self.IP.runlines('\n'.join(lines))
248
248
249 def to_user_ns(self,vars, interactive = True):
249 def to_user_ns(self,vars, interactive = True):
250 """Inject a group of variables into the IPython user namespace.
250 """Inject a group of variables into the IPython user namespace.
251
251
252 Inputs:
252 Inputs:
253
253
254 - vars: string with variable names separated by whitespace
254 - vars: string with variable names separated by whitespace, or a
255 dict with name/value pairs.
255
256
256 - interactive: if True (default), the var will be listed with
257 - interactive: if True (default), the var will be listed with
257 %whos et. al.
258 %whos et. al.
258
259
259 This utility routine is meant to ease interactive debugging work,
260 This utility routine is meant to ease interactive debugging work,
260 where you want to easily propagate some internal variable in your code
261 where you want to easily propagate some internal variable in your code
261 up to the interactive namespace for further exploration.
262 up to the interactive namespace for further exploration.
262
263
263 When you run code via %run, globals in your script become visible at
264 When you run code via %run, globals in your script become visible at
264 the interactive prompt, but this doesn't happen for locals inside your
265 the interactive prompt, but this doesn't happen for locals inside your
265 own functions and methods. Yet when debugging, it is common to want
266 own functions and methods. Yet when debugging, it is common to want
266 to explore some internal variables further at the interactive propmt.
267 to explore some internal variables further at the interactive propmt.
267
268
268 Examples:
269 Examples:
269
270
270 To use this, you first must obtain a handle on the ipython object as
271 To use this, you first must obtain a handle on the ipython object as
271 indicated above, via:
272 indicated above, via:
272
273
273 import IPython.ipapi
274 import IPython.ipapi
274 ip = IPython.ipapi.get()
275 ip = IPython.ipapi.get()
275
276
276 Once this is done, inside a routine foo() where you want to expose
277 Once this is done, inside a routine foo() where you want to expose
277 variables x and y, you do the following:
278 variables x and y, you do the following:
278
279
279 def foo():
280 def foo():
280 ...
281 ...
281 x = your_computation()
282 x = your_computation()
282 y = something_else()
283 y = something_else()
283
284
284 # This pushes x and y to the interactive prompt immediately, even
285 # This pushes x and y to the interactive prompt immediately, even
285 # if this routine crashes on the next line after:
286 # if this routine crashes on the next line after:
286 ip.to_user_ns('x y')
287 ip.to_user_ns('x y')
287 ...
288 ...
289
290 # To expose *ALL* the local variables from the function, use:
291 ip.to_user_ns(locals())
292
293 ...
288 # return
294 # return
289
295
290 If you need to rename variables, just use ip.user_ns with dict
291 and update:
292
296
293 # exposes variables 'foo' as 'x' and 'bar' as 'y' in IPython
297 If you need to rename variables, the dict input makes it easy. For
294 # user namespace
298 example, this call exposes variables 'foo' as 'x' and 'bar' as 'y'
295 ip.user_ns.update(dict(x=foo,y=bar))
299 in IPython user namespace:
300
301 ip.to_user_ns(dict(x=foo,y=bar))
296 """
302 """
297
303
298 # print 'vars given:',vars # dbg
304 # print 'vars given:',vars # dbg
299 # Get the caller's frame to evaluate the given names in
300 cf = sys._getframe(1)
301
305
302 user_ns = self.user_ns
306 # We need a dict of name/value pairs to do namespace updates.
303 config_ns = self.IP.user_config_ns
307 if isinstance(vars,dict):
308 # If a dict was given, no need to change anything.
309 vdict = vars
310 elif isinstance(vars,basestring):
311 # If a string with names was given, get the caller's frame to
312 # evaluate the given names in
313 cf = sys._getframe(1)
314 vdict = {}
304 for name in vars.split():
315 for name in vars.split():
305 try:
316 try:
306 val = eval(name,cf.f_globals,cf.f_locals)
317 vdict[name] = eval(name,cf.f_globals,cf.f_locals)
307 user_ns[name] = val
308 if not interactive:
309 config_ns[name] = val
310 else:
311 config_ns.pop(name,None)
312 except:
318 except:
313 print ('could not get var. %s from %s' %
319 print ('could not get var. %s from %s' %
314 (name,cf.f_code.co_name))
320 (name,cf.f_code.co_name))
321 else:
322 raise ValueError('vars must be a string or a dict')
323
324 # Propagate variables to user namespace
325 self.user_ns.update(vdict)
326
327 # And configure interactive visibility
328 config_ns = self.IP.user_config_ns
329 if interactive:
330 for name,val in vdict.iteritems():
331 config_ns.pop(name,None)
332 else:
333 for name,val in vdict.iteritems():
334 config_ns[name] = val
335
315
336
316 def expand_alias(self,line):
337 def expand_alias(self,line):
317 """ Expand an alias in the command line
338 """ Expand an alias in the command line
318
339
319 Returns the provided command line, possibly with the first word
340 Returns the provided command line, possibly with the first word
320 (command) translated according to alias expansion rules.
341 (command) translated according to alias expansion rules.
321
342
322 [ipython]|16> _ip.expand_aliases("np myfile.txt")
343 [ipython]|16> _ip.expand_aliases("np myfile.txt")
323 <16> 'q:/opt/np/notepad++.exe myfile.txt'
344 <16> 'q:/opt/np/notepad++.exe myfile.txt'
324 """
345 """
325
346
326 pre,fn,rest = self.IP.split_user_input(line)
347 pre,fn,rest = self.IP.split_user_input(line)
327 res = pre + self.IP.expand_aliases(fn,rest)
348 res = pre + self.IP.expand_aliases(fn,rest)
328 return res
349 return res
329
350
330 def defalias(self, name, cmd):
351 def defalias(self, name, cmd):
331 """ Define a new alias
352 """ Define a new alias
332
353
333 _ip.defalias('bb','bldmake bldfiles')
354 _ip.defalias('bb','bldmake bldfiles')
334
355
335 Creates a new alias named 'bb' in ipython user namespace
356 Creates a new alias named 'bb' in ipython user namespace
336 """
357 """
337
358
338 if callable(cmd):
359 if callable(cmd):
339 self.IP.alias_table[name] = cmd
360 self.IP.alias_table[name] = cmd
340 import IPython.shawodns
361 import IPython.shawodns
341 setattr(IPython.shadowns, name,cmd)
362 setattr(IPython.shadowns, name,cmd)
342 return
363 return
343
364
344
365
345 nargs = cmd.count('%s')
366 nargs = cmd.count('%s')
346 if nargs>0 and cmd.find('%l')>=0:
367 if nargs>0 and cmd.find('%l')>=0:
347 raise Exception('The %s and %l specifiers are mutually exclusive '
368 raise Exception('The %s and %l specifiers are mutually exclusive '
348 'in alias definitions.')
369 'in alias definitions.')
349
370
350 else: # all looks OK
371 else: # all looks OK
351 self.IP.alias_table[name] = (nargs,cmd)
372 self.IP.alias_table[name] = (nargs,cmd)
352
373
353 def defmacro(self, *args):
374 def defmacro(self, *args):
354 """ Define a new macro
375 """ Define a new macro
355
376
356 2 forms of calling:
377 2 forms of calling:
357
378
358 mac = _ip.defmacro('print "hello"\nprint "world"')
379 mac = _ip.defmacro('print "hello"\nprint "world"')
359
380
360 (doesn't put the created macro on user namespace)
381 (doesn't put the created macro on user namespace)
361
382
362 _ip.defmacro('build', 'bldmake bldfiles\nabld build winscw udeb')
383 _ip.defmacro('build', 'bldmake bldfiles\nabld build winscw udeb')
363
384
364 (creates a macro named 'build' in user namespace)
385 (creates a macro named 'build' in user namespace)
365 """
386 """
366
387
367 import IPython.macro
388 import IPython.macro
368
389
369 if len(args) == 1:
390 if len(args) == 1:
370 return IPython.macro.Macro(args[0])
391 return IPython.macro.Macro(args[0])
371 elif len(args) == 2:
392 elif len(args) == 2:
372 self.user_ns[args[0]] = IPython.macro.Macro(args[1])
393 self.user_ns[args[0]] = IPython.macro.Macro(args[1])
373 else:
394 else:
374 return Exception("_ip.defmacro must be called with 1 or 2 arguments")
395 return Exception("_ip.defmacro must be called with 1 or 2 arguments")
375
396
376 def set_next_input(self, s):
397 def set_next_input(self, s):
377 """ Sets the 'default' input string for the next command line.
398 """ Sets the 'default' input string for the next command line.
378
399
379 Requires readline.
400 Requires readline.
380
401
381 Example:
402 Example:
382
403
383 [D:\ipython]|1> _ip.set_next_input("Hello Word")
404 [D:\ipython]|1> _ip.set_next_input("Hello Word")
384 [D:\ipython]|2> Hello Word_ # cursor is here
405 [D:\ipython]|2> Hello Word_ # cursor is here
385 """
406 """
386
407
387 self.IP.rl_next_input = s
408 self.IP.rl_next_input = s
388
409
389 def load(self, mod):
410 def load(self, mod):
390 if mod in self.extensions:
411 if mod in self.extensions:
391 # just to make sure we don't init it twice
412 # just to make sure we don't init it twice
392 # note that if you 'load' a module that has already been
413 # note that if you 'load' a module that has already been
393 # imported, init_ipython gets run anyway
414 # imported, init_ipython gets run anyway
394
415
395 return self.extensions[mod]
416 return self.extensions[mod]
396 __import__(mod)
417 __import__(mod)
397 m = sys.modules[mod]
418 m = sys.modules[mod]
398 if hasattr(m,'init_ipython'):
419 if hasattr(m,'init_ipython'):
399 m.init_ipython(self)
420 m.init_ipython(self)
400 self.extensions[mod] = m
421 self.extensions[mod] = m
401 return m
422 return m
402
423
403
424
404 def launch_new_instance(user_ns = None):
425 def launch_new_instance(user_ns = None):
405 """ Make and start a new ipython instance.
426 """ Make and start a new ipython instance.
406
427
407 This can be called even without having an already initialized
428 This can be called even without having an already initialized
408 ipython session running.
429 ipython session running.
409
430
410 This is also used as the egg entry point for the 'ipython' script.
431 This is also used as the egg entry point for the 'ipython' script.
411
432
412 """
433 """
413 ses = make_session(user_ns)
434 ses = make_session(user_ns)
414 ses.mainloop()
435 ses.mainloop()
415
436
416
437
417 def make_user_ns(user_ns = None):
438 def make_user_ns(user_ns = None):
418 """Return a valid user interactive namespace.
439 """Return a valid user interactive namespace.
419
440
420 This builds a dict with the minimal information needed to operate as a
441 This builds a dict with the minimal information needed to operate as a
421 valid IPython user namespace, which you can pass to the various embedding
442 valid IPython user namespace, which you can pass to the various embedding
422 classes in ipython.
443 classes in ipython.
423 """
444 """
424
445
425 if user_ns is None:
446 if user_ns is None:
426 # Set __name__ to __main__ to better match the behavior of the
447 # Set __name__ to __main__ to better match the behavior of the
427 # normal interpreter.
448 # normal interpreter.
428 user_ns = {'__name__' :'__main__',
449 user_ns = {'__name__' :'__main__',
429 '__builtins__' : __builtin__,
450 '__builtins__' : __builtin__,
430 }
451 }
431 else:
452 else:
432 user_ns.setdefault('__name__','__main__')
453 user_ns.setdefault('__name__','__main__')
433 user_ns.setdefault('__builtins__',__builtin__)
454 user_ns.setdefault('__builtins__',__builtin__)
434
455
435 return user_ns
456 return user_ns
436
457
437
458
438 def make_user_global_ns(ns = None):
459 def make_user_global_ns(ns = None):
439 """Return a valid user global namespace.
460 """Return a valid user global namespace.
440
461
441 Similar to make_user_ns(), but global namespaces are really only needed in
462 Similar to make_user_ns(), but global namespaces are really only needed in
442 embedded applications, where there is a distinction between the user's
463 embedded applications, where there is a distinction between the user's
443 interactive namespace and the global one where ipython is running."""
464 interactive namespace and the global one where ipython is running."""
444
465
445 if ns is None: ns = {}
466 if ns is None: ns = {}
446 return ns
467 return ns
447
468
448
469
449 def make_session(user_ns = None):
470 def make_session(user_ns = None):
450 """Makes, but does not launch an IPython session.
471 """Makes, but does not launch an IPython session.
451
472
452 Later on you can call obj.mainloop() on the returned object.
473 Later on you can call obj.mainloop() on the returned object.
453
474
454 Inputs:
475 Inputs:
455
476
456 - user_ns(None): a dict to be used as the user's namespace with initial
477 - user_ns(None): a dict to be used as the user's namespace with initial
457 data.
478 data.
458
479
459 WARNING: This should *not* be run when a session exists already."""
480 WARNING: This should *not* be run when a session exists already."""
460
481
461 import IPython
482 import IPython
462 return IPython.Shell.start(user_ns)
483 return IPython.Shell.start(user_ns)
463
484
@@ -1,6954 +1,6965 b''
1 2007-8-9 Fernando Perez <fperez@planck.colorado.edu>
2
3 * IPython/ipapi.py (to_user_ns): update to accept a dict as well as
4 a string with names.
5
6 2007-08-09 Fernando Perez <Fernando.Perez@colorado.edu>
7
8 * IPython/Magic.py (magic_doctest_mode): added new %doctest_mode
9 magic to toggle on/off the doctest pasting support without having
10 to leave a session to switch to a separate profile.
11
1 2007-08-08 Fernando Perez <Fernando.Perez@colorado.edu>
12 2007-08-08 Fernando Perez <Fernando.Perez@colorado.edu>
2
13
3 * IPython/Extensions/ipy_profile_doctest.py (main): fix prompt to
14 * IPython/Extensions/ipy_profile_doctest.py (main): fix prompt to
4 introduce a blank line between inputs, to conform to doctest
15 introduce a blank line between inputs, to conform to doctest
5 requirements.
16 requirements.
6
17
7 * IPython/OInspect.py (Inspector.pinfo): fix another part where
18 * IPython/OInspect.py (Inspector.pinfo): fix another part where
8 auto-generated docstrings for new-style classes were showing up.
19 auto-generated docstrings for new-style classes were showing up.
9
20
10 2007-08-07 Fernando Perez <Fernando.Perez@colorado.edu>
21 2007-08-07 Fernando Perez <Fernando.Perez@colorado.edu>
11
22
12 * api_changes: Add new file to track backward-incompatible
23 * api_changes: Add new file to track backward-incompatible
13 user-visible changes.
24 user-visible changes.
14
25
15 2007-08-06 Ville Vainio <vivainio@gmail.com>
26 2007-08-06 Ville Vainio <vivainio@gmail.com>
16
27
17 * ipmaker.py: fix bug where user_config_ns didn't exist at all
28 * ipmaker.py: fix bug where user_config_ns didn't exist at all
18 before all the config files were handled.
29 before all the config files were handled.
19
30
20 2007-08-04 Fernando Perez <Fernando.Perez@colorado.edu>
31 2007-08-04 Fernando Perez <Fernando.Perez@colorado.edu>
21
32
22 * IPython/irunner.py (RunnerFactory): Add new factory class for
33 * IPython/irunner.py (RunnerFactory): Add new factory class for
23 creating reusable runners based on filenames.
34 creating reusable runners based on filenames.
24
35
25 * IPython/Extensions/ipy_profile_doctest.py: New profile for
36 * IPython/Extensions/ipy_profile_doctest.py: New profile for
26 doctest support. It sets prompts/exceptions as similar to
37 doctest support. It sets prompts/exceptions as similar to
27 standard Python as possible, so that ipython sessions in this
38 standard Python as possible, so that ipython sessions in this
28 profile can be easily pasted as doctests with minimal
39 profile can be easily pasted as doctests with minimal
29 modifications. It also enables pasting of doctests from external
40 modifications. It also enables pasting of doctests from external
30 sources (even if they have leading whitespace), so that you can
41 sources (even if they have leading whitespace), so that you can
31 rerun doctests from existing sources.
42 rerun doctests from existing sources.
32
43
33 * IPython/iplib.py (_prefilter): fix a buglet where after entering
44 * IPython/iplib.py (_prefilter): fix a buglet where after entering
34 some whitespace, the prompt would become a continuation prompt
45 some whitespace, the prompt would become a continuation prompt
35 with no way of exiting it other than Ctrl-C. This fix brings us
46 with no way of exiting it other than Ctrl-C. This fix brings us
36 into conformity with how the default python prompt works.
47 into conformity with how the default python prompt works.
37
48
38 * IPython/Extensions/InterpreterPasteInput.py (prefilter_paste):
49 * IPython/Extensions/InterpreterPasteInput.py (prefilter_paste):
39 Add support for pasting not only lines that start with '>>>', but
50 Add support for pasting not only lines that start with '>>>', but
40 also with ' >>>'. That is, arbitrary whitespace can now precede
51 also with ' >>>'. That is, arbitrary whitespace can now precede
41 the prompts. This makes the system useful for pasting doctests
52 the prompts. This makes the system useful for pasting doctests
42 from docstrings back into a normal session.
53 from docstrings back into a normal session.
43
54
44 2007-08-02 Fernando Perez <Fernando.Perez@colorado.edu>
55 2007-08-02 Fernando Perez <Fernando.Perez@colorado.edu>
45
56
46 * IPython/Shell.py (IPShellEmbed.__call__): fix bug introduced in
57 * IPython/Shell.py (IPShellEmbed.__call__): fix bug introduced in
47 r1357, which had killed multiple invocations of an embedded
58 r1357, which had killed multiple invocations of an embedded
48 ipython (this means that example-embed has been broken for over 1
59 ipython (this means that example-embed has been broken for over 1
49 year!!!). Rather than possibly breaking the batch stuff for which
60 year!!!). Rather than possibly breaking the batch stuff for which
50 the code in iplib.py/interact was introduced, I worked around the
61 the code in iplib.py/interact was introduced, I worked around the
51 problem in the embedding class in Shell.py. We really need a
62 problem in the embedding class in Shell.py. We really need a
52 bloody test suite for this code, I'm sick of finding stuff that
63 bloody test suite for this code, I'm sick of finding stuff that
53 used to work breaking left and right every time I use an old
64 used to work breaking left and right every time I use an old
54 feature I hadn't touched in a few months.
65 feature I hadn't touched in a few months.
55 (kill_embedded): Add a new magic that only shows up in embedded
66 (kill_embedded): Add a new magic that only shows up in embedded
56 mode, to allow users to permanently deactivate an embedded instance.
67 mode, to allow users to permanently deactivate an embedded instance.
57
68
58 2007-08-01 Ville Vainio <vivainio@gmail.com>
69 2007-08-01 Ville Vainio <vivainio@gmail.com>
59
70
60 * iplib.py, ipy_profile_sh.py (runlines): Fix the bug where raw
71 * iplib.py, ipy_profile_sh.py (runlines): Fix the bug where raw
61 history gets out of sync on runlines (e.g. when running macros).
72 history gets out of sync on runlines (e.g. when running macros).
62
73
63 2007-07-31 Fernando Perez <Fernando.Perez@colorado.edu>
74 2007-07-31 Fernando Perez <Fernando.Perez@colorado.edu>
64
75
65 * IPython/Magic.py (magic_colors): fix win32-related error message
76 * IPython/Magic.py (magic_colors): fix win32-related error message
66 that could appear under *nix when readline was missing. Patch by
77 that could appear under *nix when readline was missing. Patch by
67 Scott Jackson, closes #175.
78 Scott Jackson, closes #175.
68
79
69 2007-07-29 Fernando Perez <Fernando.Perez@colorado.edu>
80 2007-07-29 Fernando Perez <Fernando.Perez@colorado.edu>
70
81
71 * IPython/Extensions/ipy_traits_completer.py: Add a new custom
82 * IPython/Extensions/ipy_traits_completer.py: Add a new custom
72 completer that it traits-aware, so that traits objects don't show
83 completer that it traits-aware, so that traits objects don't show
73 all of their internal attributes all the time.
84 all of their internal attributes all the time.
74
85
75 * IPython/genutils.py (dir2): moved this code from inside
86 * IPython/genutils.py (dir2): moved this code from inside
76 completer.py to expose it publicly, so I could use it in the
87 completer.py to expose it publicly, so I could use it in the
77 wildcards bugfix.
88 wildcards bugfix.
78
89
79 * IPython/wildcard.py (NameSpace.__init__): fix a bug reported by
90 * IPython/wildcard.py (NameSpace.__init__): fix a bug reported by
80 Stefan with Traits.
91 Stefan with Traits.
81
92
82 * IPython/completer.py (Completer.attr_matches): change internal
93 * IPython/completer.py (Completer.attr_matches): change internal
83 var name from 'object' to 'obj', since 'object' is now a builtin
94 var name from 'object' to 'obj', since 'object' is now a builtin
84 and this can lead to weird bugs if reusing this code elsewhere.
95 and this can lead to weird bugs if reusing this code elsewhere.
85
96
86 2007-07-25 Fernando Perez <Fernando.Perez@colorado.edu>
97 2007-07-25 Fernando Perez <Fernando.Perez@colorado.edu>
87
98
88 * IPython/OInspect.py (Inspector.pinfo): fix small glitches in
99 * IPython/OInspect.py (Inspector.pinfo): fix small glitches in
89 'foo?' and update the code to prevent printing of default
100 'foo?' and update the code to prevent printing of default
90 docstrings that started appearing after I added support for
101 docstrings that started appearing after I added support for
91 new-style classes. The approach I'm using isn't ideal (I just
102 new-style classes. The approach I'm using isn't ideal (I just
92 special-case those strings) but I'm not sure how to more robustly
103 special-case those strings) but I'm not sure how to more robustly
93 differentiate between truly user-written strings and Python's
104 differentiate between truly user-written strings and Python's
94 automatic ones.
105 automatic ones.
95
106
96 2007-07-09 Ville Vainio <vivainio@gmail.com>
107 2007-07-09 Ville Vainio <vivainio@gmail.com>
97
108
98 * completer.py: Applied Matthew Neeley's patch:
109 * completer.py: Applied Matthew Neeley's patch:
99 Dynamic attributes from trait_names and _getAttributeNames are added
110 Dynamic attributes from trait_names and _getAttributeNames are added
100 to the list of tab completions, but when this happens, the attribute
111 to the list of tab completions, but when this happens, the attribute
101 list is turned into a set, so the attributes are unordered when
112 list is turned into a set, so the attributes are unordered when
102 printed, which makes it hard to find the right completion. This patch
113 printed, which makes it hard to find the right completion. This patch
103 turns this set back into a list and sort it.
114 turns this set back into a list and sort it.
104
115
105 2007-07-06 Fernando Perez <Fernando.Perez@colorado.edu>
116 2007-07-06 Fernando Perez <Fernando.Perez@colorado.edu>
106
117
107 * IPython/OInspect.py (Inspector.pinfo): Add support for new-style
118 * IPython/OInspect.py (Inspector.pinfo): Add support for new-style
108 classes in various inspector functions.
119 classes in various inspector functions.
109
120
110 2007-06-28 Ville Vainio <vivainio@gmail.com>
121 2007-06-28 Ville Vainio <vivainio@gmail.com>
111
122
112 * shadowns.py, iplib.py, ipapi.py, OInspect.py:
123 * shadowns.py, iplib.py, ipapi.py, OInspect.py:
113 Implement "shadow" namespace, and callable aliases that reside there.
124 Implement "shadow" namespace, and callable aliases that reside there.
114 Use them by:
125 Use them by:
115
126
116 _ip.defalias('foo',myfunc) # creates _sh.foo that points to myfunc
127 _ip.defalias('foo',myfunc) # creates _sh.foo that points to myfunc
117
128
118 foo hello world
129 foo hello world
119 (gets translated to:)
130 (gets translated to:)
120 _sh.foo(r"""hello world""")
131 _sh.foo(r"""hello world""")
121
132
122 In practice, this kind of alias can take the role of a magic function
133 In practice, this kind of alias can take the role of a magic function
123
134
124 * New generic inspect_object, called on obj? and obj??
135 * New generic inspect_object, called on obj? and obj??
125
136
126 2007-06-15 Fernando Perez <Fernando.Perez@colorado.edu>
137 2007-06-15 Fernando Perez <Fernando.Perez@colorado.edu>
127
138
128 * IPython/ultraTB.py (findsource): fix a problem with
139 * IPython/ultraTB.py (findsource): fix a problem with
129 inspect.getfile that can cause crashes during traceback construction.
140 inspect.getfile that can cause crashes during traceback construction.
130
141
131 2007-06-14 Ville Vainio <vivainio@gmail.com>
142 2007-06-14 Ville Vainio <vivainio@gmail.com>
132
143
133 * iplib.py (handle_auto): Try to use ascii for printing "--->"
144 * iplib.py (handle_auto): Try to use ascii for printing "--->"
134 autocall rewrite indication, becausesometimes unicode fails to print
145 autocall rewrite indication, becausesometimes unicode fails to print
135 properly (and you get ' - - - '). Use plain uncoloured ---> for
146 properly (and you get ' - - - '). Use plain uncoloured ---> for
136 unicode.
147 unicode.
137
148
138 * shadow history. Usable through "%hist -g <pat>" and "%rep 0123".
149 * shadow history. Usable through "%hist -g <pat>" and "%rep 0123".
139
150
140 . pickleshare 'hash' commands (hget, hset, hcompress,
151 . pickleshare 'hash' commands (hget, hset, hcompress,
141 hdict) for efficient shadow history storage.
152 hdict) for efficient shadow history storage.
142
153
143 2007-06-13 Ville Vainio <vivainio@gmail.com>
154 2007-06-13 Ville Vainio <vivainio@gmail.com>
144
155
145 * ipapi.py: _ip.to_user_ns(vars, interactive = True).
156 * ipapi.py: _ip.to_user_ns(vars, interactive = True).
146 Added kw arg 'interactive', tell whether vars should be visible
157 Added kw arg 'interactive', tell whether vars should be visible
147 with %whos.
158 with %whos.
148
159
149 2007-06-11 Ville Vainio <vivainio@gmail.com>
160 2007-06-11 Ville Vainio <vivainio@gmail.com>
150
161
151 * pspersistence.py, Magic.py, iplib.py: directory history now saved
162 * pspersistence.py, Magic.py, iplib.py: directory history now saved
152 to db
163 to db
153
164
154 * iplib.py: "ipython -c <cmd>" now passes the command through prefilter.
165 * iplib.py: "ipython -c <cmd>" now passes the command through prefilter.
155 Also, it exits IPython immediately after evaluating the command (just like
166 Also, it exits IPython immediately after evaluating the command (just like
156 std python)
167 std python)
157
168
158 2007-06-05 Walter Doerwald <walter@livinglogic.de>
169 2007-06-05 Walter Doerwald <walter@livinglogic.de>
159
170
160 * IPython/Extensions/ipipe.py: Added a new table icap, which executes a
171 * IPython/Extensions/ipipe.py: Added a new table icap, which executes a
161 Python string and captures the output. (Idea and original patch by
172 Python string and captures the output. (Idea and original patch by
162 StοΏ½fan van der Walt)
173 StοΏ½fan van der Walt)
163
174
164 2007-06-01 Fernando Perez <Fernando.Perez@colorado.edu>
175 2007-06-01 Fernando Perez <Fernando.Perez@colorado.edu>
165
176
166 * IPython/ultraTB.py (VerboseTB.text): update printing of
177 * IPython/ultraTB.py (VerboseTB.text): update printing of
167 exception types for Python 2.5 (now all exceptions in the stdlib
178 exception types for Python 2.5 (now all exceptions in the stdlib
168 are new-style classes).
179 are new-style classes).
169
180
170 2007-05-31 Walter Doerwald <walter@livinglogic.de>
181 2007-05-31 Walter Doerwald <walter@livinglogic.de>
171
182
172 * IPython/Extensions/igrid.py: Add new commands refresh and
183 * IPython/Extensions/igrid.py: Add new commands refresh and
173 refresh_timer (mapped to "R"/"F5" and to the menu) which restarts
184 refresh_timer (mapped to "R"/"F5" and to the menu) which restarts
174 the iterator once (refresh) or after every x seconds (refresh_timer).
185 the iterator once (refresh) or after every x seconds (refresh_timer).
175 Add a working implementation of "searchexpression", where the text
186 Add a working implementation of "searchexpression", where the text
176 entered is not the text to search for, but an expression that must
187 entered is not the text to search for, but an expression that must
177 be true. Added display of shortcuts to the menu. Added commands "pickinput"
188 be true. Added display of shortcuts to the menu. Added commands "pickinput"
178 and "pickinputattr" that put the object or attribute under the cursor
189 and "pickinputattr" that put the object or attribute under the cursor
179 in the input line. Split the statusbar to be able to display the currently
190 in the input line. Split the statusbar to be able to display the currently
180 active refresh interval. (Patch by Nik Tautenhahn)
191 active refresh interval. (Patch by Nik Tautenhahn)
181
192
182 2007-05-29 JοΏ½rgen Stenarson <jorgen.stenarson@bostream.nu>
193 2007-05-29 JοΏ½rgen Stenarson <jorgen.stenarson@bostream.nu>
183
194
184 * fixing set_term_title to use ctypes as default
195 * fixing set_term_title to use ctypes as default
185
196
186 * fixing set_term_title fallback to work when curent dir
197 * fixing set_term_title fallback to work when curent dir
187 is on a windows network share
198 is on a windows network share
188
199
189 2007-05-28 Ville Vainio <vivainio@gmail.com>
200 2007-05-28 Ville Vainio <vivainio@gmail.com>
190
201
191 * %cpaste: strip + with > from left (diffs).
202 * %cpaste: strip + with > from left (diffs).
192
203
193 * iplib.py: Fix crash when readline not installed
204 * iplib.py: Fix crash when readline not installed
194
205
195 2007-05-26 Ville Vainio <vivainio@gmail.com>
206 2007-05-26 Ville Vainio <vivainio@gmail.com>
196
207
197 * generics.py: intruduce easy to extend result_display generic
208 * generics.py: intruduce easy to extend result_display generic
198 function (using simplegeneric.py).
209 function (using simplegeneric.py).
199
210
200 * Fixed the append functionality of %set.
211 * Fixed the append functionality of %set.
201
212
202 2007-05-25 Ville Vainio <vivainio@gmail.com>
213 2007-05-25 Ville Vainio <vivainio@gmail.com>
203
214
204 * New magic: %rep (fetch / run old commands from history)
215 * New magic: %rep (fetch / run old commands from history)
205
216
206 * New extension: mglob (%mglob magic), for powerful glob / find /filter
217 * New extension: mglob (%mglob magic), for powerful glob / find /filter
207 like functionality
218 like functionality
208
219
209 % maghistory.py: %hist -g PATTERM greps the history for pattern
220 % maghistory.py: %hist -g PATTERM greps the history for pattern
210
221
211 2007-05-24 Walter Doerwald <walter@livinglogic.de>
222 2007-05-24 Walter Doerwald <walter@livinglogic.de>
212
223
213 * IPython/Extensions/ipipe.py: Added a Table ihist that can be used to
224 * IPython/Extensions/ipipe.py: Added a Table ihist that can be used to
214 browse the IPython input history
225 browse the IPython input history
215
226
216 * IPython/Extensions/ibrowse.py: Added two command to ibrowse: pickinput
227 * IPython/Extensions/ibrowse.py: Added two command to ibrowse: pickinput
217 (mapped to "i") can be used to put the object under the curser in the input
228 (mapped to "i") can be used to put the object under the curser in the input
218 line. pickinputattr (mapped to "I") does the same for the attribute under
229 line. pickinputattr (mapped to "I") does the same for the attribute under
219 the cursor.
230 the cursor.
220
231
221 2007-05-24 Ville Vainio <vivainio@gmail.com>
232 2007-05-24 Ville Vainio <vivainio@gmail.com>
222
233
223 * Grand magic cleansing (changeset [2380]):
234 * Grand magic cleansing (changeset [2380]):
224
235
225 * Introduce ipy_legacy.py where the following magics were
236 * Introduce ipy_legacy.py where the following magics were
226 moved:
237 moved:
227
238
228 pdef pdoc psource pfile rehash dhist Quit p r automagic autocall
239 pdef pdoc psource pfile rehash dhist Quit p r automagic autocall
229
240
230 If you need them, either use default profile or "import ipy_legacy"
241 If you need them, either use default profile or "import ipy_legacy"
231 in your ipy_user_conf.py
242 in your ipy_user_conf.py
232
243
233 * Move sh and scipy profile to Extensions from UserConfig. this implies
244 * Move sh and scipy profile to Extensions from UserConfig. this implies
234 you should not edit them, but you don't need to run %upgrade when
245 you should not edit them, but you don't need to run %upgrade when
235 upgrading IPython anymore.
246 upgrading IPython anymore.
236
247
237 * %hist/%history now operates in "raw" mode by default. To get the old
248 * %hist/%history now operates in "raw" mode by default. To get the old
238 behaviour, run '%hist -n' (native mode).
249 behaviour, run '%hist -n' (native mode).
239
250
240 * split ipy_stock_completers.py to ipy_stock_completers.py and
251 * split ipy_stock_completers.py to ipy_stock_completers.py and
241 ipy_app_completers.py. Stock completers (%cd, import, %run) are now
252 ipy_app_completers.py. Stock completers (%cd, import, %run) are now
242 installed as default.
253 installed as default.
243
254
244 * sh profile now installs ipy_signals.py, for (hopefully) better ctrl+c
255 * sh profile now installs ipy_signals.py, for (hopefully) better ctrl+c
245 handling.
256 handling.
246
257
247 * iplib.py, ipapi.py: _ip.set_next_input(s) sets the next ("default")
258 * iplib.py, ipapi.py: _ip.set_next_input(s) sets the next ("default")
248 input if readline is available.
259 input if readline is available.
249
260
250 2007-05-23 Ville Vainio <vivainio@gmail.com>
261 2007-05-23 Ville Vainio <vivainio@gmail.com>
251
262
252 * macro.py: %store uses __getstate__ properly
263 * macro.py: %store uses __getstate__ properly
253
264
254 * exesetup.py: added new setup script for creating
265 * exesetup.py: added new setup script for creating
255 standalone IPython executables with py2exe (i.e.
266 standalone IPython executables with py2exe (i.e.
256 no python installation required).
267 no python installation required).
257
268
258 * Removed ipythonrc-scipy, ipy_profile_scipy.py takes
269 * Removed ipythonrc-scipy, ipy_profile_scipy.py takes
259 its place.
270 its place.
260
271
261 * rlineimpl.py, genutils.py (get_home_dir): py2exe support
272 * rlineimpl.py, genutils.py (get_home_dir): py2exe support
262
273
263 2007-05-21 Ville Vainio <vivainio@gmail.com>
274 2007-05-21 Ville Vainio <vivainio@gmail.com>
264
275
265 * platutil_win32.py (set_term_title): handle
276 * platutil_win32.py (set_term_title): handle
266 failure of 'title' system call properly.
277 failure of 'title' system call properly.
267
278
268 2007-05-17 Walter Doerwald <walter@livinglogic.de>
279 2007-05-17 Walter Doerwald <walter@livinglogic.de>
269
280
270 * IPython/Extensions/ipipe.py: Fix xrepr for ifiles.
281 * IPython/Extensions/ipipe.py: Fix xrepr for ifiles.
271 (Bug detected by Paul Mueller).
282 (Bug detected by Paul Mueller).
272
283
273 2007-05-16 Ville Vainio <vivainio@gmail.com>
284 2007-05-16 Ville Vainio <vivainio@gmail.com>
274
285
275 * ipy_profile_sci.py, ipython_win_post_install.py: Create
286 * ipy_profile_sci.py, ipython_win_post_install.py: Create
276 new "sci" profile, effectively a modern version of the old
287 new "sci" profile, effectively a modern version of the old
277 "scipy" profile (which is now slated for deprecation).
288 "scipy" profile (which is now slated for deprecation).
278
289
279 2007-05-15 Ville Vainio <vivainio@gmail.com>
290 2007-05-15 Ville Vainio <vivainio@gmail.com>
280
291
281 * pycolorize.py, pycolor.1: Paul Mueller's patches that
292 * pycolorize.py, pycolor.1: Paul Mueller's patches that
282 make pycolorize read input from stdin when run without arguments.
293 make pycolorize read input from stdin when run without arguments.
283
294
284 * Magic.py: do not require 'PATH' in %rehash/%rehashx. Closes #155
295 * Magic.py: do not require 'PATH' in %rehash/%rehashx. Closes #155
285
296
286 * ipy_rehashdir.py: rename ext_rehashdir to ipy_rehashdir, import
297 * ipy_rehashdir.py: rename ext_rehashdir to ipy_rehashdir, import
287 it in sh profile (instead of ipy_system_conf.py).
298 it in sh profile (instead of ipy_system_conf.py).
288
299
289 * Magic.py, ipy_rehashdir.py, ipy_profile_sh.py: System command
300 * Magic.py, ipy_rehashdir.py, ipy_profile_sh.py: System command
290 aliases are now lower case on windows (MyCommand.exe => mycommand).
301 aliases are now lower case on windows (MyCommand.exe => mycommand).
291
302
292 * macro.py, ipapi.py, iplib.py, Prompts.py: Macro system rehaul.
303 * macro.py, ipapi.py, iplib.py, Prompts.py: Macro system rehaul.
293 Macros are now callable objects that inherit from ipapi.IPyAutocall,
304 Macros are now callable objects that inherit from ipapi.IPyAutocall,
294 i.e. get autocalled regardless of system autocall setting.
305 i.e. get autocalled regardless of system autocall setting.
295
306
296 2007-05-10 Fernando Perez <Fernando.Perez@colorado.edu>
307 2007-05-10 Fernando Perez <Fernando.Perez@colorado.edu>
297
308
298 * IPython/rlineimpl.py: check for clear_history in readline and
309 * IPython/rlineimpl.py: check for clear_history in readline and
299 make it a dummy no-op if not available. This function isn't
310 make it a dummy no-op if not available. This function isn't
300 guaranteed to be in the API and appeared in Python 2.4, so we need
311 guaranteed to be in the API and appeared in Python 2.4, so we need
301 to check it ourselves. Also, clean up this file quite a bit.
312 to check it ourselves. Also, clean up this file quite a bit.
302
313
303 * ipython.1: update man page and full manual with information
314 * ipython.1: update man page and full manual with information
304 about threads (remove outdated warning). Closes #151.
315 about threads (remove outdated warning). Closes #151.
305
316
306 2007-05-09 Fernando Perez <Fernando.Perez@colorado.edu>
317 2007-05-09 Fernando Perez <Fernando.Perez@colorado.edu>
307
318
308 * IPython/Extensions/ipy_constants.py: Add Gael's constants module
319 * IPython/Extensions/ipy_constants.py: Add Gael's constants module
309 in trunk (note that this made it into the 0.8.1 release already,
320 in trunk (note that this made it into the 0.8.1 release already,
310 but the changelogs didn't get coordinated). Many thanks to Gael
321 but the changelogs didn't get coordinated). Many thanks to Gael
311 Varoquaux <gael.varoquaux-AT-normalesup.org>
322 Varoquaux <gael.varoquaux-AT-normalesup.org>
312
323
313 2007-05-09 *** Released version 0.8.1
324 2007-05-09 *** Released version 0.8.1
314
325
315 2007-05-10 Walter Doerwald <walter@livinglogic.de>
326 2007-05-10 Walter Doerwald <walter@livinglogic.de>
316
327
317 * IPython/Extensions/igrid.py: Incorporate html help into
328 * IPython/Extensions/igrid.py: Incorporate html help into
318 the module, so we don't have to search for the file.
329 the module, so we don't have to search for the file.
319
330
320 2007-05-02 Fernando Perez <Fernando.Perez@colorado.edu>
331 2007-05-02 Fernando Perez <Fernando.Perez@colorado.edu>
321
332
322 * test/test_irunner.py (RunnerTestCase._test_runner): Close #147.
333 * test/test_irunner.py (RunnerTestCase._test_runner): Close #147.
323
334
324 2007-04-30 Ville Vainio <vivainio@gmail.com>
335 2007-04-30 Ville Vainio <vivainio@gmail.com>
325
336
326 * iplib.py: (pre_config_initialization) Catch UnicodeDecodeError if the
337 * iplib.py: (pre_config_initialization) Catch UnicodeDecodeError if the
327 user has illegal (non-ascii) home directory name
338 user has illegal (non-ascii) home directory name
328
339
329 2007-04-27 Ville Vainio <vivainio@gmail.com>
340 2007-04-27 Ville Vainio <vivainio@gmail.com>
330
341
331 * platutils_win32.py: implement set_term_title for windows
342 * platutils_win32.py: implement set_term_title for windows
332
343
333 * Update version number
344 * Update version number
334
345
335 * ipy_profile_sh.py: more informative prompt (2 dir levels)
346 * ipy_profile_sh.py: more informative prompt (2 dir levels)
336
347
337 2007-04-26 Walter Doerwald <walter@livinglogic.de>
348 2007-04-26 Walter Doerwald <walter@livinglogic.de>
338
349
339 * IPython/Extensions/igrid.py: (igrid) Fix bug that surfaced
350 * IPython/Extensions/igrid.py: (igrid) Fix bug that surfaced
340 when the igrid input raised an exception. (Patch by Nik Tautenhahn,
351 when the igrid input raised an exception. (Patch by Nik Tautenhahn,
341 bug discovered by Ville).
352 bug discovered by Ville).
342
353
343 2007-04-26 Ville Vainio <vivainio@gmail.com>
354 2007-04-26 Ville Vainio <vivainio@gmail.com>
344
355
345 * Extensions/ipy_completers.py: Olivier's module completer now
356 * Extensions/ipy_completers.py: Olivier's module completer now
346 saves the list of root modules if it takes > 4 secs on the first run.
357 saves the list of root modules if it takes > 4 secs on the first run.
347
358
348 * Magic.py (%rehashx): %rehashx now clears the completer cache
359 * Magic.py (%rehashx): %rehashx now clears the completer cache
349
360
350
361
351 2007-04-26 Fernando Perez <Fernando.Perez@colorado.edu>
362 2007-04-26 Fernando Perez <Fernando.Perez@colorado.edu>
352
363
353 * ipython.el: fix incorrect color scheme, reported by Stefan.
364 * ipython.el: fix incorrect color scheme, reported by Stefan.
354 Closes #149.
365 Closes #149.
355
366
356 * IPython/PyColorize.py (Parser.format2): fix state-handling
367 * IPython/PyColorize.py (Parser.format2): fix state-handling
357 logic. I still don't like how that code handles state, but at
368 logic. I still don't like how that code handles state, but at
358 least now it should be correct, if inelegant. Closes #146.
369 least now it should be correct, if inelegant. Closes #146.
359
370
360 2007-04-25 Ville Vainio <vivainio@gmail.com>
371 2007-04-25 Ville Vainio <vivainio@gmail.com>
361
372
362 * Extensions/ipy_which.py: added extension for %which magic, works
373 * Extensions/ipy_which.py: added extension for %which magic, works
363 a lot like unix 'which' but also finds and expands aliases, and
374 a lot like unix 'which' but also finds and expands aliases, and
364 allows wildcards.
375 allows wildcards.
365
376
366 * ipapi.py (expand_alias): Now actually *return* the expanded alias,
377 * ipapi.py (expand_alias): Now actually *return* the expanded alias,
367 as opposed to returning nothing.
378 as opposed to returning nothing.
368
379
369 * UserConfig/ipy_user_conf.py, ipy_profile_sh.py: do not import
380 * UserConfig/ipy_user_conf.py, ipy_profile_sh.py: do not import
370 ipy_stock_completers on default profile, do import on sh profile.
381 ipy_stock_completers on default profile, do import on sh profile.
371
382
372 2007-04-22 JοΏ½rgen Stenarson <jorgen.stenarson@bostream.nu>
383 2007-04-22 JοΏ½rgen Stenarson <jorgen.stenarson@bostream.nu>
373
384
374 * Fix bug in iplib.py/safe_execfile when launching ipython with a script
385 * Fix bug in iplib.py/safe_execfile when launching ipython with a script
375 like ipython.py foo.py which raised a IndexError.
386 like ipython.py foo.py which raised a IndexError.
376
387
377 2007-04-21 Ville Vainio <vivainio@gmail.com>
388 2007-04-21 Ville Vainio <vivainio@gmail.com>
378
389
379 * Extensions/ipy_extutil.py: added extension to manage other ipython
390 * Extensions/ipy_extutil.py: added extension to manage other ipython
380 extensions. Now only supports 'ls' == list extensions.
391 extensions. Now only supports 'ls' == list extensions.
381
392
382 2007-04-20 Fernando Perez <Fernando.Perez@colorado.edu>
393 2007-04-20 Fernando Perez <Fernando.Perez@colorado.edu>
383
394
384 * IPython/Debugger.py (BdbQuit_excepthook): fix small bug that
395 * IPython/Debugger.py (BdbQuit_excepthook): fix small bug that
385 would prevent use of the exception system outside of a running
396 would prevent use of the exception system outside of a running
386 IPython instance.
397 IPython instance.
387
398
388 2007-04-20 Ville Vainio <vivainio@gmail.com>
399 2007-04-20 Ville Vainio <vivainio@gmail.com>
389
400
390 * Extensions/ipy_render.py: added extension for easy
401 * Extensions/ipy_render.py: added extension for easy
391 interactive text template rendering (to clipboard). Uses Ka-Ping Yee's
402 interactive text template rendering (to clipboard). Uses Ka-Ping Yee's
392 'Iptl' template notation,
403 'Iptl' template notation,
393
404
394 * Extensions/ipy_completers.py: introduced Olivier Lauzanne's
405 * Extensions/ipy_completers.py: introduced Olivier Lauzanne's
395 safer & faster 'import' completer.
406 safer & faster 'import' completer.
396
407
397 * ipapi.py: Introduced new ipapi methods, _ip.defmacro(name, value)
408 * ipapi.py: Introduced new ipapi methods, _ip.defmacro(name, value)
398 and _ip.defalias(name, command).
409 and _ip.defalias(name, command).
399
410
400 * Extensions/ipy_exportdb.py: New extension for exporting all the
411 * Extensions/ipy_exportdb.py: New extension for exporting all the
401 %store'd data in a portable format (normal ipapi calls like
412 %store'd data in a portable format (normal ipapi calls like
402 defmacro() etc.)
413 defmacro() etc.)
403
414
404 2007-04-19 Ville Vainio <vivainio@gmail.com>
415 2007-04-19 Ville Vainio <vivainio@gmail.com>
405
416
406 * upgrade_dir.py: skip junk files like *.pyc
417 * upgrade_dir.py: skip junk files like *.pyc
407
418
408 * Release.py: version number to 0.8.1
419 * Release.py: version number to 0.8.1
409
420
410 2007-04-18 Ville Vainio <vivainio@gmail.com>
421 2007-04-18 Ville Vainio <vivainio@gmail.com>
411
422
412 * iplib.py (safe_execfile): make "ipython foo.py" work with 2.5.1c1
423 * iplib.py (safe_execfile): make "ipython foo.py" work with 2.5.1c1
413 and later on win32.
424 and later on win32.
414
425
415 2007-04-16 Ville Vainio <vivainio@gmail.com>
426 2007-04-16 Ville Vainio <vivainio@gmail.com>
416
427
417 * iplib.py (showtraceback): Do not crash when running w/o readline.
428 * iplib.py (showtraceback): Do not crash when running w/o readline.
418
429
419 2007-04-12 Walter Doerwald <walter@livinglogic.de>
430 2007-04-12 Walter Doerwald <walter@livinglogic.de>
420
431
421 * IPython/Extensions/ipipe.py: (ils) Directoy listings are now
432 * IPython/Extensions/ipipe.py: (ils) Directoy listings are now
422 sorted (case sensitive with files and dirs mixed).
433 sorted (case sensitive with files and dirs mixed).
423
434
424 2007-04-10 Fernando Perez <Fernando.Perez@colorado.edu>
435 2007-04-10 Fernando Perez <Fernando.Perez@colorado.edu>
425
436
426 * IPython/Release.py (version): Open trunk for 0.8.1 development.
437 * IPython/Release.py (version): Open trunk for 0.8.1 development.
427
438
428 2007-04-10 *** Released version 0.8.0
439 2007-04-10 *** Released version 0.8.0
429
440
430 2007-04-07 Fernando Perez <Fernando.Perez@colorado.edu>
441 2007-04-07 Fernando Perez <Fernando.Perez@colorado.edu>
431
442
432 * Tag 0.8.0 for release.
443 * Tag 0.8.0 for release.
433
444
434 * IPython/iplib.py (reloadhist): add API function to cleanly
445 * IPython/iplib.py (reloadhist): add API function to cleanly
435 reload the readline history, which was growing inappropriately on
446 reload the readline history, which was growing inappropriately on
436 every %run call.
447 every %run call.
437
448
438 * win32_manual_post_install.py (run): apply last part of Nicolas
449 * win32_manual_post_install.py (run): apply last part of Nicolas
439 Pernetty's patch (I'd accidentally applied it in a different
450 Pernetty's patch (I'd accidentally applied it in a different
440 directory and this particular file didn't get patched).
451 directory and this particular file didn't get patched).
441
452
442 2007-04-05 Fernando Perez <Fernando.Perez@colorado.edu>
453 2007-04-05 Fernando Perez <Fernando.Perez@colorado.edu>
443
454
444 * IPython/Shell.py (MAIN_THREAD_ID): get rid of my stupid hack to
455 * IPython/Shell.py (MAIN_THREAD_ID): get rid of my stupid hack to
445 find the main thread id and use the proper API call. Thanks to
456 find the main thread id and use the proper API call. Thanks to
446 Stefan for the fix.
457 Stefan for the fix.
447
458
448 * test/test_prefilter.py (esc_handler_tests): udpate one of Dan's
459 * test/test_prefilter.py (esc_handler_tests): udpate one of Dan's
449 unit tests to reflect fixed ticket #52, and add more tests sent by
460 unit tests to reflect fixed ticket #52, and add more tests sent by
450 him.
461 him.
451
462
452 * IPython/iplib.py (raw_input): restore the readline completer
463 * IPython/iplib.py (raw_input): restore the readline completer
453 state on every input, in case third-party code messed it up.
464 state on every input, in case third-party code messed it up.
454 (_prefilter): revert recent addition of early-escape checks which
465 (_prefilter): revert recent addition of early-escape checks which
455 prevent many valid alias calls from working.
466 prevent many valid alias calls from working.
456
467
457 * IPython/Shell.py (MTInteractiveShell.runcode): add a tracking
468 * IPython/Shell.py (MTInteractiveShell.runcode): add a tracking
458 flag for sigint handler so we don't run a full signal() call on
469 flag for sigint handler so we don't run a full signal() call on
459 each runcode access.
470 each runcode access.
460
471
461 * IPython/Magic.py (magic_whos): small improvement to diagnostic
472 * IPython/Magic.py (magic_whos): small improvement to diagnostic
462 message.
473 message.
463
474
464 2007-04-04 Fernando Perez <Fernando.Perez@colorado.edu>
475 2007-04-04 Fernando Perez <Fernando.Perez@colorado.edu>
465
476
466 * IPython/Shell.py (sigint_handler): I *THINK* I finally got
477 * IPython/Shell.py (sigint_handler): I *THINK* I finally got
467 asynchronous exceptions working, i.e., Ctrl-C can actually
478 asynchronous exceptions working, i.e., Ctrl-C can actually
468 interrupt long-running code in the multithreaded shells.
479 interrupt long-running code in the multithreaded shells.
469
480
470 This is using Tomer Filiba's great ctypes-based trick:
481 This is using Tomer Filiba's great ctypes-based trick:
471 http://sebulba.wikispaces.com/recipe+thread2. I'd already tried
482 http://sebulba.wikispaces.com/recipe+thread2. I'd already tried
472 this in the past, but hadn't been able to make it work before. So
483 this in the past, but hadn't been able to make it work before. So
473 far it looks like it's actually running, but this needs more
484 far it looks like it's actually running, but this needs more
474 testing. If it really works, I'll be *very* happy, and we'll owe
485 testing. If it really works, I'll be *very* happy, and we'll owe
475 a huge thank you to Tomer. My current implementation is ugly,
486 a huge thank you to Tomer. My current implementation is ugly,
476 hackish and uses nasty globals, but I don't want to try and clean
487 hackish and uses nasty globals, but I don't want to try and clean
477 anything up until we know if it actually works.
488 anything up until we know if it actually works.
478
489
479 NOTE: this feature needs ctypes to work. ctypes is included in
490 NOTE: this feature needs ctypes to work. ctypes is included in
480 Python2.5, but 2.4 users will need to manually install it. This
491 Python2.5, but 2.4 users will need to manually install it. This
481 feature makes multi-threaded shells so much more usable that it's
492 feature makes multi-threaded shells so much more usable that it's
482 a minor price to pay (ctypes is very easy to install, already a
493 a minor price to pay (ctypes is very easy to install, already a
483 requirement for win32 and available in major linux distros).
494 requirement for win32 and available in major linux distros).
484
495
485 2007-04-04 Ville Vainio <vivainio@gmail.com>
496 2007-04-04 Ville Vainio <vivainio@gmail.com>
486
497
487 * Extensions/ipy_completers.py, ipy_stock_completers.py:
498 * Extensions/ipy_completers.py, ipy_stock_completers.py:
488 Moved implementations of 'bundled' completers to ipy_completers.py,
499 Moved implementations of 'bundled' completers to ipy_completers.py,
489 they are only enabled in ipy_stock_completers.py.
500 they are only enabled in ipy_stock_completers.py.
490
501
491 2007-04-04 Fernando Perez <Fernando.Perez@colorado.edu>
502 2007-04-04 Fernando Perez <Fernando.Perez@colorado.edu>
492
503
493 * IPython/PyColorize.py (Parser.format2): Fix identation of
504 * IPython/PyColorize.py (Parser.format2): Fix identation of
494 colorzied output and return early if color scheme is NoColor, to
505 colorzied output and return early if color scheme is NoColor, to
495 avoid unnecessary and expensive tokenization. Closes #131.
506 avoid unnecessary and expensive tokenization. Closes #131.
496
507
497 2007-04-03 Fernando Perez <Fernando.Perez@colorado.edu>
508 2007-04-03 Fernando Perez <Fernando.Perez@colorado.edu>
498
509
499 * IPython/Debugger.py: disable the use of pydb version 1.17. It
510 * IPython/Debugger.py: disable the use of pydb version 1.17. It
500 has a critical bug (a missing import that makes post-mortem not
511 has a critical bug (a missing import that makes post-mortem not
501 work at all). Unfortunately as of this time, this is the version
512 work at all). Unfortunately as of this time, this is the version
502 shipped with Ubuntu Edgy, so quite a few people have this one. I
513 shipped with Ubuntu Edgy, so quite a few people have this one. I
503 hope Edgy will update to a more recent package.
514 hope Edgy will update to a more recent package.
504
515
505 2007-04-02 Fernando Perez <Fernando.Perez@colorado.edu>
516 2007-04-02 Fernando Perez <Fernando.Perez@colorado.edu>
506
517
507 * IPython/iplib.py (_prefilter): close #52, second part of a patch
518 * IPython/iplib.py (_prefilter): close #52, second part of a patch
508 set by Stefan (only the first part had been applied before).
519 set by Stefan (only the first part had been applied before).
509
520
510 * IPython/Extensions/ipy_stock_completers.py (module_completer):
521 * IPython/Extensions/ipy_stock_completers.py (module_completer):
511 remove usage of the dangerous pkgutil.walk_packages(). See
522 remove usage of the dangerous pkgutil.walk_packages(). See
512 details in comments left in the code.
523 details in comments left in the code.
513
524
514 * IPython/Magic.py (magic_whos): add support for numpy arrays
525 * IPython/Magic.py (magic_whos): add support for numpy arrays
515 similar to what we had for Numeric.
526 similar to what we had for Numeric.
516
527
517 * IPython/completer.py (IPCompleter.complete): extend the
528 * IPython/completer.py (IPCompleter.complete): extend the
518 complete() call API to support completions by other mechanisms
529 complete() call API to support completions by other mechanisms
519 than readline. Closes #109.
530 than readline. Closes #109.
520
531
521 * IPython/iplib.py (safe_execfile): add a safeguard under Win32 to
532 * IPython/iplib.py (safe_execfile): add a safeguard under Win32 to
522 protect against a bug in Python's execfile(). Closes #123.
533 protect against a bug in Python's execfile(). Closes #123.
523
534
524 2007-04-01 Fernando Perez <Fernando.Perez@colorado.edu>
535 2007-04-01 Fernando Perez <Fernando.Perez@colorado.edu>
525
536
526 * IPython/iplib.py (split_user_input): ensure that when splitting
537 * IPython/iplib.py (split_user_input): ensure that when splitting
527 user input, the part that can be treated as a python name is pure
538 user input, the part that can be treated as a python name is pure
528 ascii (Python identifiers MUST be pure ascii). Part of the
539 ascii (Python identifiers MUST be pure ascii). Part of the
529 ongoing Unicode support work.
540 ongoing Unicode support work.
530
541
531 * IPython/Prompts.py (prompt_specials_color): Add \N for the
542 * IPython/Prompts.py (prompt_specials_color): Add \N for the
532 actual prompt number, without any coloring. This allows users to
543 actual prompt number, without any coloring. This allows users to
533 produce numbered prompts with their own colors. Added after a
544 produce numbered prompts with their own colors. Added after a
534 report/request by Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
545 report/request by Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
535
546
536 2007-03-31 Walter Doerwald <walter@livinglogic.de>
547 2007-03-31 Walter Doerwald <walter@livinglogic.de>
537
548
538 * IPython/Extensions/igrid.py: Map the return key
549 * IPython/Extensions/igrid.py: Map the return key
539 to enter() and shift-return to enterattr().
550 to enter() and shift-return to enterattr().
540
551
541 2007-03-30 Fernando Perez <Fernando.Perez@colorado.edu>
552 2007-03-30 Fernando Perez <Fernando.Perez@colorado.edu>
542
553
543 * IPython/Magic.py (magic_psearch): add unicode support by
554 * IPython/Magic.py (magic_psearch): add unicode support by
544 encoding to ascii the input, since this routine also only deals
555 encoding to ascii the input, since this routine also only deals
545 with valid Python names. Fixes a bug reported by Stefan.
556 with valid Python names. Fixes a bug reported by Stefan.
546
557
547 2007-03-29 Fernando Perez <Fernando.Perez@colorado.edu>
558 2007-03-29 Fernando Perez <Fernando.Perez@colorado.edu>
548
559
549 * IPython/Magic.py (_inspect): convert unicode input into ascii
560 * IPython/Magic.py (_inspect): convert unicode input into ascii
550 before trying to evaluate it as a Python identifier. This fixes a
561 before trying to evaluate it as a Python identifier. This fixes a
551 problem that the new unicode support had introduced when analyzing
562 problem that the new unicode support had introduced when analyzing
552 long definition lines for functions.
563 long definition lines for functions.
553
564
554 2007-03-24 Walter Doerwald <walter@livinglogic.de>
565 2007-03-24 Walter Doerwald <walter@livinglogic.de>
555
566
556 * IPython/Extensions/igrid.py: Fix picking. Using
567 * IPython/Extensions/igrid.py: Fix picking. Using
557 igrid with wxPython 2.6 and -wthread should work now.
568 igrid with wxPython 2.6 and -wthread should work now.
558 igrid.display() simply tries to create a frame without
569 igrid.display() simply tries to create a frame without
559 an application. Only if this fails an application is created.
570 an application. Only if this fails an application is created.
560
571
561 2007-03-23 Walter Doerwald <walter@livinglogic.de>
572 2007-03-23 Walter Doerwald <walter@livinglogic.de>
562
573
563 * IPython/Extensions/path.py: Updated to version 2.2.
574 * IPython/Extensions/path.py: Updated to version 2.2.
564
575
565 2007-03-23 Ville Vainio <vivainio@gmail.com>
576 2007-03-23 Ville Vainio <vivainio@gmail.com>
566
577
567 * iplib.py: recursive alias expansion now works better, so that
578 * iplib.py: recursive alias expansion now works better, so that
568 cases like 'top' -> 'd:/cygwin/top' -> 'ls :/cygwin/top'
579 cases like 'top' -> 'd:/cygwin/top' -> 'ls :/cygwin/top'
569 doesn't trip up the process, if 'd' has been aliased to 'ls'.
580 doesn't trip up the process, if 'd' has been aliased to 'ls'.
570
581
571 * Extensions/ipy_gnuglobal.py added, provides %global magic
582 * Extensions/ipy_gnuglobal.py added, provides %global magic
572 for users of http://www.gnu.org/software/global
583 for users of http://www.gnu.org/software/global
573
584
574 * iplib.py: '!command /?' now doesn't invoke IPython's help system.
585 * iplib.py: '!command /?' now doesn't invoke IPython's help system.
575 Closes #52. Patch by Stefan van der Walt.
586 Closes #52. Patch by Stefan van der Walt.
576
587
577 2007-03-23 Fernando Perez <Fernando.Perez@colorado.edu>
588 2007-03-23 Fernando Perez <Fernando.Perez@colorado.edu>
578
589
579 * IPython/FakeModule.py (FakeModule.__init__): Small fix to
590 * IPython/FakeModule.py (FakeModule.__init__): Small fix to
580 respect the __file__ attribute when using %run. Thanks to a bug
591 respect the __file__ attribute when using %run. Thanks to a bug
581 report by Sebastian Rooks <sebastian.rooks-AT-free.fr>.
592 report by Sebastian Rooks <sebastian.rooks-AT-free.fr>.
582
593
583 2007-03-22 Fernando Perez <Fernando.Perez@colorado.edu>
594 2007-03-22 Fernando Perez <Fernando.Perez@colorado.edu>
584
595
585 * IPython/iplib.py (raw_input): Fix mishandling of unicode at
596 * IPython/iplib.py (raw_input): Fix mishandling of unicode at
586 input. Patch sent by Stefan.
597 input. Patch sent by Stefan.
587
598
588 2007-03-20 JοΏ½rgen Stenarson <jorgen.stenarson@bostream.nu>
599 2007-03-20 JοΏ½rgen Stenarson <jorgen.stenarson@bostream.nu>
589 * IPython/Extensions/ipy_stock_completer.py
600 * IPython/Extensions/ipy_stock_completer.py
590 shlex_split, fix bug in shlex_split. len function
601 shlex_split, fix bug in shlex_split. len function
591 call was missing an if statement. Caused shlex_split to
602 call was missing an if statement. Caused shlex_split to
592 sometimes return "" as last element.
603 sometimes return "" as last element.
593
604
594 2007-03-18 Fernando Perez <Fernando.Perez@colorado.edu>
605 2007-03-18 Fernando Perez <Fernando.Perez@colorado.edu>
595
606
596 * IPython/completer.py
607 * IPython/completer.py
597 (IPCompleter.file_matches.single_dir_expand): fix a problem
608 (IPCompleter.file_matches.single_dir_expand): fix a problem
598 reported by Stefan, where directories containign a single subdir
609 reported by Stefan, where directories containign a single subdir
599 would be completed too early.
610 would be completed too early.
600
611
601 * IPython/Shell.py (_load_pylab): Make the execution of 'from
612 * IPython/Shell.py (_load_pylab): Make the execution of 'from
602 pylab import *' when -pylab is given be optional. A new flag,
613 pylab import *' when -pylab is given be optional. A new flag,
603 pylab_import_all controls this behavior, the default is True for
614 pylab_import_all controls this behavior, the default is True for
604 backwards compatibility.
615 backwards compatibility.
605
616
606 * IPython/ultraTB.py (_formatTracebackLines): Added (slightly
617 * IPython/ultraTB.py (_formatTracebackLines): Added (slightly
607 modified) R. Bernstein's patch for fully syntax highlighted
618 modified) R. Bernstein's patch for fully syntax highlighted
608 tracebacks. The functionality is also available under ultraTB for
619 tracebacks. The functionality is also available under ultraTB for
609 non-ipython users (someone using ultraTB but outside an ipython
620 non-ipython users (someone using ultraTB but outside an ipython
610 session). They can select the color scheme by setting the
621 session). They can select the color scheme by setting the
611 module-level global DEFAULT_SCHEME. The highlight functionality
622 module-level global DEFAULT_SCHEME. The highlight functionality
612 also works when debugging.
623 also works when debugging.
613
624
614 * IPython/genutils.py (IOStream.close): small patch by
625 * IPython/genutils.py (IOStream.close): small patch by
615 R. Bernstein for improved pydb support.
626 R. Bernstein for improved pydb support.
616
627
617 * IPython/Debugger.py (Pdb.format_stack_entry): Added patch by
628 * IPython/Debugger.py (Pdb.format_stack_entry): Added patch by
618 DaveS <davls@telus.net> to improve support of debugging under
629 DaveS <davls@telus.net> to improve support of debugging under
619 NTEmacs, including improved pydb behavior.
630 NTEmacs, including improved pydb behavior.
620
631
621 * IPython/Magic.py (magic_prun): Fix saving of profile info for
632 * IPython/Magic.py (magic_prun): Fix saving of profile info for
622 Python 2.5, where the stats object API changed a little. Thanks
633 Python 2.5, where the stats object API changed a little. Thanks
623 to a bug report by Paul Smith <paul.smith-AT-catugmt.com>.
634 to a bug report by Paul Smith <paul.smith-AT-catugmt.com>.
624
635
625 * IPython/ColorANSI.py (InputTermColors.Normal): applied Nicolas
636 * IPython/ColorANSI.py (InputTermColors.Normal): applied Nicolas
626 Pernetty's patch to improve support for (X)Emacs under Win32.
637 Pernetty's patch to improve support for (X)Emacs under Win32.
627
638
628 2007-03-17 Fernando Perez <Fernando.Perez@colorado.edu>
639 2007-03-17 Fernando Perez <Fernando.Perez@colorado.edu>
629
640
630 * IPython/Shell.py (hijack_wx): ipmort WX with current semantics
641 * IPython/Shell.py (hijack_wx): ipmort WX with current semantics
631 to quiet a deprecation warning that fires with Wx 2.8. Thanks to
642 to quiet a deprecation warning that fires with Wx 2.8. Thanks to
632 a report by Nik Tautenhahn.
643 a report by Nik Tautenhahn.
633
644
634 2007-03-16 Walter Doerwald <walter@livinglogic.de>
645 2007-03-16 Walter Doerwald <walter@livinglogic.de>
635
646
636 * setup.py: Add the igrid help files to the list of data files
647 * setup.py: Add the igrid help files to the list of data files
637 to be installed alongside igrid.
648 to be installed alongside igrid.
638 * IPython/Extensions/igrid.py: (Patch by Nik Tautenhahn)
649 * IPython/Extensions/igrid.py: (Patch by Nik Tautenhahn)
639 Show the input object of the igrid browser as the window tile.
650 Show the input object of the igrid browser as the window tile.
640 Show the object the cursor is on in the statusbar.
651 Show the object the cursor is on in the statusbar.
641
652
642 2007-03-15 Ville Vainio <vivainio@gmail.com>
653 2007-03-15 Ville Vainio <vivainio@gmail.com>
643
654
644 * Extensions/ipy_stock_completers.py: Fixed exception
655 * Extensions/ipy_stock_completers.py: Fixed exception
645 on mismatching quotes in %run completer. Patch by
656 on mismatching quotes in %run completer. Patch by
646 JοΏ½rgen Stenarson. Closes #127.
657 JοΏ½rgen Stenarson. Closes #127.
647
658
648 2007-03-14 Ville Vainio <vivainio@gmail.com>
659 2007-03-14 Ville Vainio <vivainio@gmail.com>
649
660
650 * Extensions/ext_rehashdir.py: Do not do auto_alias
661 * Extensions/ext_rehashdir.py: Do not do auto_alias
651 in %rehashdir, it clobbers %store'd aliases.
662 in %rehashdir, it clobbers %store'd aliases.
652
663
653 * UserConfig/ipy_profile_sh.py: envpersist.py extension
664 * UserConfig/ipy_profile_sh.py: envpersist.py extension
654 (beefed up %env) imported for sh profile.
665 (beefed up %env) imported for sh profile.
655
666
656 2007-03-10 Walter Doerwald <walter@livinglogic.de>
667 2007-03-10 Walter Doerwald <walter@livinglogic.de>
657
668
658 * IPython/Extensions/ipipe.py: Prefer ibrowse over igrid
669 * IPython/Extensions/ipipe.py: Prefer ibrowse over igrid
659 as the default browser.
670 as the default browser.
660 * IPython/Extensions/igrid.py: Make a few igrid attributes private.
671 * IPython/Extensions/igrid.py: Make a few igrid attributes private.
661 As igrid displays all attributes it ever encounters, fetch() (which has
672 As igrid displays all attributes it ever encounters, fetch() (which has
662 been renamed to _fetch()) doesn't have to recalculate the display attributes
673 been renamed to _fetch()) doesn't have to recalculate the display attributes
663 every time a new item is fetched. This should speed up scrolling.
674 every time a new item is fetched. This should speed up scrolling.
664
675
665 2007-03-10 Fernando Perez <Fernando.Perez@colorado.edu>
676 2007-03-10 Fernando Perez <Fernando.Perez@colorado.edu>
666
677
667 * IPython/iplib.py (InteractiveShell.__init__): fix for Alex
678 * IPython/iplib.py (InteractiveShell.__init__): fix for Alex
668 Schmolck's recently reported tab-completion bug (my previous one
679 Schmolck's recently reported tab-completion bug (my previous one
669 had a problem). Patch by Dan Milstein <danmil-AT-comcast.net>.
680 had a problem). Patch by Dan Milstein <danmil-AT-comcast.net>.
670
681
671 2007-03-09 Walter Doerwald <walter@livinglogic.de>
682 2007-03-09 Walter Doerwald <walter@livinglogic.de>
672
683
673 * IPython/Extensions/igrid.py: Patch by Nik Tautenhahn:
684 * IPython/Extensions/igrid.py: Patch by Nik Tautenhahn:
674 Close help window if exiting igrid.
685 Close help window if exiting igrid.
675
686
676 2007-03-02 JοΏ½rgen Stenarson <jorgen.stenarson@bostream.nu>
687 2007-03-02 JοΏ½rgen Stenarson <jorgen.stenarson@bostream.nu>
677
688
678 * IPython/Extensions/ipy_defaults.py: Check if readline is available
689 * IPython/Extensions/ipy_defaults.py: Check if readline is available
679 before calling functions from readline.
690 before calling functions from readline.
680
691
681 2007-03-02 Walter Doerwald <walter@livinglogic.de>
692 2007-03-02 Walter Doerwald <walter@livinglogic.de>
682
693
683 * IPython/Extensions/igrid.py: Add Nik Tautenhahns igrid extension.
694 * IPython/Extensions/igrid.py: Add Nik Tautenhahns igrid extension.
684 igrid is a wxPython-based display object for ipipe. If your system has
695 igrid is a wxPython-based display object for ipipe. If your system has
685 wx installed igrid will be the default display. Without wx ipipe falls
696 wx installed igrid will be the default display. Without wx ipipe falls
686 back to ibrowse (which needs curses). If no curses is installed ipipe
697 back to ibrowse (which needs curses). If no curses is installed ipipe
687 falls back to idump.
698 falls back to idump.
688
699
689 2007-03-01 Fernando Perez <Fernando.Perez@colorado.edu>
700 2007-03-01 Fernando Perez <Fernando.Perez@colorado.edu>
690
701
691 * IPython/iplib.py (split_user_inputBROKEN): temporarily disable
702 * IPython/iplib.py (split_user_inputBROKEN): temporarily disable
692 my changes from yesterday, they introduced bugs. Will reactivate
703 my changes from yesterday, they introduced bugs. Will reactivate
693 once I get a correct solution, which will be much easier thanks to
704 once I get a correct solution, which will be much easier thanks to
694 Dan Milstein's new prefilter test suite.
705 Dan Milstein's new prefilter test suite.
695
706
696 2007-02-28 Fernando Perez <Fernando.Perez@colorado.edu>
707 2007-02-28 Fernando Perez <Fernando.Perez@colorado.edu>
697
708
698 * IPython/iplib.py (split_user_input): fix input splitting so we
709 * IPython/iplib.py (split_user_input): fix input splitting so we
699 don't attempt attribute accesses on things that can't possibly be
710 don't attempt attribute accesses on things that can't possibly be
700 valid Python attributes. After a bug report by Alex Schmolck.
711 valid Python attributes. After a bug report by Alex Schmolck.
701 (InteractiveShell.__init__): brown-paper bag fix; regexp broke
712 (InteractiveShell.__init__): brown-paper bag fix; regexp broke
702 %magic with explicit % prefix.
713 %magic with explicit % prefix.
703
714
704 2007-02-27 Fernando Perez <Fernando.Perez@colorado.edu>
715 2007-02-27 Fernando Perez <Fernando.Perez@colorado.edu>
705
716
706 * IPython/Shell.py (IPShellGTK.mainloop): update threads calls to
717 * IPython/Shell.py (IPShellGTK.mainloop): update threads calls to
707 avoid a DeprecationWarning from GTK.
718 avoid a DeprecationWarning from GTK.
708
719
709 2007-02-22 Fernando Perez <Fernando.Perez@colorado.edu>
720 2007-02-22 Fernando Perez <Fernando.Perez@colorado.edu>
710
721
711 * IPython/genutils.py (clock): I modified clock() to return total
722 * IPython/genutils.py (clock): I modified clock() to return total
712 time, user+system. This is a more commonly needed metric. I also
723 time, user+system. This is a more commonly needed metric. I also
713 introduced the new clocku/clocks to get only user/system time if
724 introduced the new clocku/clocks to get only user/system time if
714 one wants those instead.
725 one wants those instead.
715
726
716 ***WARNING: API CHANGE*** clock() used to return only user time,
727 ***WARNING: API CHANGE*** clock() used to return only user time,
717 so if you want exactly the same results as before, use clocku
728 so if you want exactly the same results as before, use clocku
718 instead.
729 instead.
719
730
720 2007-02-22 Ville Vainio <vivainio@gmail.com>
731 2007-02-22 Ville Vainio <vivainio@gmail.com>
721
732
722 * IPython/Extensions/ipy_p4.py: Extension for improved
733 * IPython/Extensions/ipy_p4.py: Extension for improved
723 p4 (perforce version control system) experience.
734 p4 (perforce version control system) experience.
724 Adds %p4 magic with p4 command completion and
735 Adds %p4 magic with p4 command completion and
725 automatic -G argument (marshall output as python dict)
736 automatic -G argument (marshall output as python dict)
726
737
727 2007-02-19 Fernando Perez <Fernando.Perez@colorado.edu>
738 2007-02-19 Fernando Perez <Fernando.Perez@colorado.edu>
728
739
729 * IPython/demo.py (Demo.re_stop): make dashes optional in demo
740 * IPython/demo.py (Demo.re_stop): make dashes optional in demo
730 stop marks.
741 stop marks.
731 (ClearingMixin): a simple mixin to easily make a Demo class clear
742 (ClearingMixin): a simple mixin to easily make a Demo class clear
732 the screen in between blocks and have empty marquees. The
743 the screen in between blocks and have empty marquees. The
733 ClearDemo and ClearIPDemo classes that use it are included.
744 ClearDemo and ClearIPDemo classes that use it are included.
734
745
735 2007-02-18 Fernando Perez <Fernando.Perez@colorado.edu>
746 2007-02-18 Fernando Perez <Fernando.Perez@colorado.edu>
736
747
737 * IPython/irunner.py (pexpect_monkeypatch): patch pexpect to
748 * IPython/irunner.py (pexpect_monkeypatch): patch pexpect to
738 protect against exceptions at Python shutdown time. Patch
749 protect against exceptions at Python shutdown time. Patch
739 sumbmitted to upstream.
750 sumbmitted to upstream.
740
751
741 2007-02-14 Walter Doerwald <walter@livinglogic.de>
752 2007-02-14 Walter Doerwald <walter@livinglogic.de>
742
753
743 * IPython/Extensions/ibrowse.py: If entering the first object level
754 * IPython/Extensions/ibrowse.py: If entering the first object level
744 (i.e. the object for which the browser has been started) fails,
755 (i.e. the object for which the browser has been started) fails,
745 now the error is raised directly (aborting the browser) instead of
756 now the error is raised directly (aborting the browser) instead of
746 running into an empty levels list later.
757 running into an empty levels list later.
747
758
748 2007-02-03 Walter Doerwald <walter@livinglogic.de>
759 2007-02-03 Walter Doerwald <walter@livinglogic.de>
749
760
750 * IPython/Extensions/ipipe.py: Add an xrepr implementation
761 * IPython/Extensions/ipipe.py: Add an xrepr implementation
751 for the noitem object.
762 for the noitem object.
752
763
753 2007-01-31 Fernando Perez <Fernando.Perez@colorado.edu>
764 2007-01-31 Fernando Perez <Fernando.Perez@colorado.edu>
754
765
755 * IPython/completer.py (Completer.attr_matches): Fix small
766 * IPython/completer.py (Completer.attr_matches): Fix small
756 tab-completion bug with Enthought Traits objects with units.
767 tab-completion bug with Enthought Traits objects with units.
757 Thanks to a bug report by Tom Denniston
768 Thanks to a bug report by Tom Denniston
758 <tom.denniston-AT-alum.dartmouth.org>.
769 <tom.denniston-AT-alum.dartmouth.org>.
759
770
760 2007-01-27 Fernando Perez <Fernando.Perez@colorado.edu>
771 2007-01-27 Fernando Perez <Fernando.Perez@colorado.edu>
761
772
762 * IPython/Extensions/ipy_stock_completers.py (runlistpy): fix a
773 * IPython/Extensions/ipy_stock_completers.py (runlistpy): fix a
763 bug where only .ipy or .py would be completed. Once the first
774 bug where only .ipy or .py would be completed. Once the first
764 argument to %run has been given, all completions are valid because
775 argument to %run has been given, all completions are valid because
765 they are the arguments to the script, which may well be non-python
776 they are the arguments to the script, which may well be non-python
766 filenames.
777 filenames.
767
778
768 * IPython/irunner.py (InteractiveRunner.run_source): major updates
779 * IPython/irunner.py (InteractiveRunner.run_source): major updates
769 to irunner to allow it to correctly support real doctesting of
780 to irunner to allow it to correctly support real doctesting of
770 out-of-process ipython code.
781 out-of-process ipython code.
771
782
772 * IPython/Magic.py (magic_cd): Make the setting of the terminal
783 * IPython/Magic.py (magic_cd): Make the setting of the terminal
773 title an option (-noterm_title) because it completely breaks
784 title an option (-noterm_title) because it completely breaks
774 doctesting.
785 doctesting.
775
786
776 * IPython/demo.py: fix IPythonDemo class that was not actually working.
787 * IPython/demo.py: fix IPythonDemo class that was not actually working.
777
788
778 2007-01-24 Fernando Perez <Fernando.Perez@colorado.edu>
789 2007-01-24 Fernando Perez <Fernando.Perez@colorado.edu>
779
790
780 * IPython/irunner.py (main): fix small bug where extensions were
791 * IPython/irunner.py (main): fix small bug where extensions were
781 not being correctly recognized.
792 not being correctly recognized.
782
793
783 2007-01-23 Walter Doerwald <walter@livinglogic.de>
794 2007-01-23 Walter Doerwald <walter@livinglogic.de>
784
795
785 * IPython/Extensions/ipipe.py (xiter): Make sure that iterating
796 * IPython/Extensions/ipipe.py (xiter): Make sure that iterating
786 a string containing a single line yields the string itself as the
797 a string containing a single line yields the string itself as the
787 only item.
798 only item.
788
799
789 * IPython/Extensions/ibrowse.py (ibrowse): Avoid entering an
800 * IPython/Extensions/ibrowse.py (ibrowse): Avoid entering an
790 object if it's the same as the one on the last level (This avoids
801 object if it's the same as the one on the last level (This avoids
791 infinite recursion for one line strings).
802 infinite recursion for one line strings).
792
803
793 2007-01-17 Fernando Perez <Fernando.Perez@colorado.edu>
804 2007-01-17 Fernando Perez <Fernando.Perez@colorado.edu>
794
805
795 * IPython/ultraTB.py (AutoFormattedTB.__call__): properly flush
806 * IPython/ultraTB.py (AutoFormattedTB.__call__): properly flush
796 all output streams before printing tracebacks. This ensures that
807 all output streams before printing tracebacks. This ensures that
797 user output doesn't end up interleaved with traceback output.
808 user output doesn't end up interleaved with traceback output.
798
809
799 2007-01-10 Ville Vainio <vivainio@gmail.com>
810 2007-01-10 Ville Vainio <vivainio@gmail.com>
800
811
801 * Extensions/envpersist.py: Turbocharged %env that remembers
812 * Extensions/envpersist.py: Turbocharged %env that remembers
802 env vars across sessions; e.g. "%env PATH+=;/opt/scripts" or
813 env vars across sessions; e.g. "%env PATH+=;/opt/scripts" or
803 "%env VISUAL=jed".
814 "%env VISUAL=jed".
804
815
805 2007-01-05 Fernando Perez <Fernando.Perez@colorado.edu>
816 2007-01-05 Fernando Perez <Fernando.Perez@colorado.edu>
806
817
807 * IPython/iplib.py (showtraceback): ensure that we correctly call
818 * IPython/iplib.py (showtraceback): ensure that we correctly call
808 custom handlers in all cases (some with pdb were slipping through,
819 custom handlers in all cases (some with pdb were slipping through,
809 but I'm not exactly sure why).
820 but I'm not exactly sure why).
810
821
811 * IPython/Debugger.py (Tracer.__init__): added new class to
822 * IPython/Debugger.py (Tracer.__init__): added new class to
812 support set_trace-like usage of IPython's enhanced debugger.
823 support set_trace-like usage of IPython's enhanced debugger.
813
824
814 2006-12-24 Ville Vainio <vivainio@gmail.com>
825 2006-12-24 Ville Vainio <vivainio@gmail.com>
815
826
816 * ipmaker.py: more informative message when ipy_user_conf
827 * ipmaker.py: more informative message when ipy_user_conf
817 import fails (suggest running %upgrade).
828 import fails (suggest running %upgrade).
818
829
819 * tools/run_ipy_in_profiler.py: Utility to see where
830 * tools/run_ipy_in_profiler.py: Utility to see where
820 the time during IPython startup is spent.
831 the time during IPython startup is spent.
821
832
822 2006-12-20 Ville Vainio <vivainio@gmail.com>
833 2006-12-20 Ville Vainio <vivainio@gmail.com>
823
834
824 * 0.7.3 is out - merge all from 0.7.3 branch to trunk
835 * 0.7.3 is out - merge all from 0.7.3 branch to trunk
825
836
826 * ipapi.py: Add new ipapi method, expand_alias.
837 * ipapi.py: Add new ipapi method, expand_alias.
827
838
828 * Release.py: Bump up version to 0.7.4.svn
839 * Release.py: Bump up version to 0.7.4.svn
829
840
830 2006-12-17 Ville Vainio <vivainio@gmail.com>
841 2006-12-17 Ville Vainio <vivainio@gmail.com>
831
842
832 * Extensions/jobctrl.py: Fixed &cmd arg arg...
843 * Extensions/jobctrl.py: Fixed &cmd arg arg...
833 to work properly on posix too
844 to work properly on posix too
834
845
835 * Release.py: Update revnum (version is still just 0.7.3).
846 * Release.py: Update revnum (version is still just 0.7.3).
836
847
837 2006-12-15 Ville Vainio <vivainio@gmail.com>
848 2006-12-15 Ville Vainio <vivainio@gmail.com>
838
849
839 * scripts/ipython_win_post_install: create ipython.py in
850 * scripts/ipython_win_post_install: create ipython.py in
840 prefix + "/scripts".
851 prefix + "/scripts".
841
852
842 * Release.py: Update version to 0.7.3.
853 * Release.py: Update version to 0.7.3.
843
854
844 2006-12-14 Ville Vainio <vivainio@gmail.com>
855 2006-12-14 Ville Vainio <vivainio@gmail.com>
845
856
846 * scripts/ipython_win_post_install: Overwrite old shortcuts
857 * scripts/ipython_win_post_install: Overwrite old shortcuts
847 if they already exist
858 if they already exist
848
859
849 * Release.py: release 0.7.3rc2
860 * Release.py: release 0.7.3rc2
850
861
851 2006-12-13 Ville Vainio <vivainio@gmail.com>
862 2006-12-13 Ville Vainio <vivainio@gmail.com>
852
863
853 * Branch and update Release.py for 0.7.3rc1
864 * Branch and update Release.py for 0.7.3rc1
854
865
855 2006-12-13 Fernando Perez <Fernando.Perez@colorado.edu>
866 2006-12-13 Fernando Perez <Fernando.Perez@colorado.edu>
856
867
857 * IPython/Shell.py (IPShellWX): update for current WX naming
868 * IPython/Shell.py (IPShellWX): update for current WX naming
858 conventions, to avoid a deprecation warning with current WX
869 conventions, to avoid a deprecation warning with current WX
859 versions. Thanks to a report by Danny Shevitz.
870 versions. Thanks to a report by Danny Shevitz.
860
871
861 2006-12-12 Ville Vainio <vivainio@gmail.com>
872 2006-12-12 Ville Vainio <vivainio@gmail.com>
862
873
863 * ipmaker.py: apply david cournapeau's patch to make
874 * ipmaker.py: apply david cournapeau's patch to make
864 import_some work properly even when ipythonrc does
875 import_some work properly even when ipythonrc does
865 import_some on empty list (it was an old bug!).
876 import_some on empty list (it was an old bug!).
866
877
867 * UserConfig/ipy_user_conf.py, UserConfig/ipythonrc:
878 * UserConfig/ipy_user_conf.py, UserConfig/ipythonrc:
868 Add deprecation note to ipythonrc and a url to wiki
879 Add deprecation note to ipythonrc and a url to wiki
869 in ipy_user_conf.py
880 in ipy_user_conf.py
870
881
871
882
872 * Magic.py (%run): %run myscript.ipy now runs myscript.ipy
883 * Magic.py (%run): %run myscript.ipy now runs myscript.ipy
873 as if it was typed on IPython command prompt, i.e.
884 as if it was typed on IPython command prompt, i.e.
874 as IPython script.
885 as IPython script.
875
886
876 * example-magic.py, magic_grepl.py: remove outdated examples
887 * example-magic.py, magic_grepl.py: remove outdated examples
877
888
878 2006-12-11 Fernando Perez <Fernando.Perez@colorado.edu>
889 2006-12-11 Fernando Perez <Fernando.Perez@colorado.edu>
879
890
880 * IPython/iplib.py (debugger): prevent a nasty traceback if %debug
891 * IPython/iplib.py (debugger): prevent a nasty traceback if %debug
881 is called before any exception has occurred.
892 is called before any exception has occurred.
882
893
883 2006-12-08 Ville Vainio <vivainio@gmail.com>
894 2006-12-08 Ville Vainio <vivainio@gmail.com>
884
895
885 * Extensions/ipy_stock_completers.py: fix cd completer
896 * Extensions/ipy_stock_completers.py: fix cd completer
886 to translate /'s to \'s again.
897 to translate /'s to \'s again.
887
898
888 * completer.py: prevent traceback on file completions w/
899 * completer.py: prevent traceback on file completions w/
889 backslash.
900 backslash.
890
901
891 * Release.py: Update release number to 0.7.3b3 for release
902 * Release.py: Update release number to 0.7.3b3 for release
892
903
893 2006-12-07 Ville Vainio <vivainio@gmail.com>
904 2006-12-07 Ville Vainio <vivainio@gmail.com>
894
905
895 * Extensions/ipy_signals.py: Ignore ctrl+C in IPython process
906 * Extensions/ipy_signals.py: Ignore ctrl+C in IPython process
896 while executing external code. Provides more shell-like behaviour
907 while executing external code. Provides more shell-like behaviour
897 and overall better response to ctrl + C / ctrl + break.
908 and overall better response to ctrl + C / ctrl + break.
898
909
899 * tools/make_tarball.py: new script to create tarball straight from svn
910 * tools/make_tarball.py: new script to create tarball straight from svn
900 (setup.py sdist doesn't work on win32).
911 (setup.py sdist doesn't work on win32).
901
912
902 * Extensions/ipy_stock_completers.py: fix cd completer to give up
913 * Extensions/ipy_stock_completers.py: fix cd completer to give up
903 on dirnames with spaces and use the default completer instead.
914 on dirnames with spaces and use the default completer instead.
904
915
905 * Revision.py: Change version to 0.7.3b2 for release.
916 * Revision.py: Change version to 0.7.3b2 for release.
906
917
907 2006-12-05 Ville Vainio <vivainio@gmail.com>
918 2006-12-05 Ville Vainio <vivainio@gmail.com>
908
919
909 * Magic.py, iplib.py, completer.py: Apply R. Bernstein's
920 * Magic.py, iplib.py, completer.py: Apply R. Bernstein's
910 pydb patch 4 (rm debug printing, py 2.5 checking)
921 pydb patch 4 (rm debug printing, py 2.5 checking)
911
922
912 2006-11-30 Walter Doerwald <walter@livinglogic.de>
923 2006-11-30 Walter Doerwald <walter@livinglogic.de>
913 * IPython/Extensions/ibrowse.py: Add two new commands to ibrowse:
924 * IPython/Extensions/ibrowse.py: Add two new commands to ibrowse:
914 "refresh" (mapped to "r") refreshes the screen by restarting the iterator.
925 "refresh" (mapped to "r") refreshes the screen by restarting the iterator.
915 "refreshfind" (mapped to "R") does the same but tries to go back to the same
926 "refreshfind" (mapped to "R") does the same but tries to go back to the same
916 object the cursor was on before the refresh. The command "markrange" is
927 object the cursor was on before the refresh. The command "markrange" is
917 mapped to "%" now.
928 mapped to "%" now.
918 * IPython/Extensions/ibrowse.py: Make igrpentry and ipwdentry comparable.
929 * IPython/Extensions/ibrowse.py: Make igrpentry and ipwdentry comparable.
919
930
920 2006-11-29 Fernando Perez <Fernando.Perez@colorado.edu>
931 2006-11-29 Fernando Perez <Fernando.Perez@colorado.edu>
921
932
922 * IPython/Magic.py (magic_debug): new %debug magic to activate the
933 * IPython/Magic.py (magic_debug): new %debug magic to activate the
923 interactive debugger on the last traceback, without having to call
934 interactive debugger on the last traceback, without having to call
924 %pdb and rerun your code. Made minor changes in various modules,
935 %pdb and rerun your code. Made minor changes in various modules,
925 should automatically recognize pydb if available.
936 should automatically recognize pydb if available.
926
937
927 2006-11-28 Ville Vainio <vivainio@gmail.com>
938 2006-11-28 Ville Vainio <vivainio@gmail.com>
928
939
929 * completer.py: If the text start with !, show file completions
940 * completer.py: If the text start with !, show file completions
930 properly. This helps when trying to complete command name
941 properly. This helps when trying to complete command name
931 for shell escapes.
942 for shell escapes.
932
943
933 2006-11-27 Ville Vainio <vivainio@gmail.com>
944 2006-11-27 Ville Vainio <vivainio@gmail.com>
934
945
935 * ipy_stock_completers.py: bzr completer submitted by Stefan van
946 * ipy_stock_completers.py: bzr completer submitted by Stefan van
936 der Walt. Clean up svn and hg completers by using a common
947 der Walt. Clean up svn and hg completers by using a common
937 vcs_completer.
948 vcs_completer.
938
949
939 2006-11-26 Ville Vainio <vivainio@gmail.com>
950 2006-11-26 Ville Vainio <vivainio@gmail.com>
940
951
941 * Remove ipconfig and %config; you should use _ip.options structure
952 * Remove ipconfig and %config; you should use _ip.options structure
942 directly instead!
953 directly instead!
943
954
944 * genutils.py: add wrap_deprecated function for deprecating callables
955 * genutils.py: add wrap_deprecated function for deprecating callables
945
956
946 * iplib.py: deprecate ipmagic, ipsystem, ipalias. Use _ip.magic and
957 * iplib.py: deprecate ipmagic, ipsystem, ipalias. Use _ip.magic and
947 _ip.system instead. ipalias is redundant.
958 _ip.system instead. ipalias is redundant.
948
959
949 * Magic.py: %rehashdir no longer aliases 'cmdname' to 'cmdname.exe' on
960 * Magic.py: %rehashdir no longer aliases 'cmdname' to 'cmdname.exe' on
950 win32, but just 'cmdname'. Other extensions (non-'exe') are still made
961 win32, but just 'cmdname'. Other extensions (non-'exe') are still made
951 explicit.
962 explicit.
952
963
953 * ipy_stock_completers.py: 'hg' (mercurial VCS) now has a custom
964 * ipy_stock_completers.py: 'hg' (mercurial VCS) now has a custom
954 completer. Try it by entering 'hg ' and pressing tab.
965 completer. Try it by entering 'hg ' and pressing tab.
955
966
956 * macro.py: Give Macro a useful __repr__ method
967 * macro.py: Give Macro a useful __repr__ method
957
968
958 * Magic.py: %whos abbreviates the typename of Macro for brevity.
969 * Magic.py: %whos abbreviates the typename of Macro for brevity.
959
970
960 2006-11-24 Walter Doerwald <walter@livinglogic.de>
971 2006-11-24 Walter Doerwald <walter@livinglogic.de>
961 * IPython/Extensions/astyle.py: Do a relative import of ipipe, so that
972 * IPython/Extensions/astyle.py: Do a relative import of ipipe, so that
962 we don't get a duplicate ipipe module, where registration of the xrepr
973 we don't get a duplicate ipipe module, where registration of the xrepr
963 implementation for Text is useless.
974 implementation for Text is useless.
964
975
965 * IPython/Extensions/ipipe.py: Fix __xrepr__() implementation for ils.
976 * IPython/Extensions/ipipe.py: Fix __xrepr__() implementation for ils.
966
977
967 * IPython/Extensions/ibrowse.py: Fix keymapping for the enter command.
978 * IPython/Extensions/ibrowse.py: Fix keymapping for the enter command.
968
979
969 2006-11-24 Ville Vainio <vivainio@gmail.com>
980 2006-11-24 Ville Vainio <vivainio@gmail.com>
970
981
971 * Magic.py, manual_base.lyx: Kirill Smelkov patch:
982 * Magic.py, manual_base.lyx: Kirill Smelkov patch:
972 try to use "cProfile" instead of the slower pure python
983 try to use "cProfile" instead of the slower pure python
973 "profile"
984 "profile"
974
985
975 2006-11-23 Ville Vainio <vivainio@gmail.com>
986 2006-11-23 Ville Vainio <vivainio@gmail.com>
976
987
977 * manual_base.lyx: Kirill Smelkov patch: Fix wrong
988 * manual_base.lyx: Kirill Smelkov patch: Fix wrong
978 Qt+IPython+Designer link in documentation.
989 Qt+IPython+Designer link in documentation.
979
990
980 * Extensions/ipy_pydb.py: R. Bernstein's patch for passing
991 * Extensions/ipy_pydb.py: R. Bernstein's patch for passing
981 correct Pdb object to %pydb.
992 correct Pdb object to %pydb.
982
993
983
994
984 2006-11-22 Walter Doerwald <walter@livinglogic.de>
995 2006-11-22 Walter Doerwald <walter@livinglogic.de>
985 * IPython/Extensions/astyle.py: Text needs it's own implemenation of the
996 * IPython/Extensions/astyle.py: Text needs it's own implemenation of the
986 generic xrepr(), otherwise the list implementation would kick in.
997 generic xrepr(), otherwise the list implementation would kick in.
987
998
988 2006-11-21 Ville Vainio <vivainio@gmail.com>
999 2006-11-21 Ville Vainio <vivainio@gmail.com>
989
1000
990 * upgrade_dir.py: Now actually overwrites a nonmodified user file
1001 * upgrade_dir.py: Now actually overwrites a nonmodified user file
991 with one from UserConfig.
1002 with one from UserConfig.
992
1003
993 * ipy_profile_sh.py: Add dummy "depth" to var_expand lambda,
1004 * ipy_profile_sh.py: Add dummy "depth" to var_expand lambda,
994 it was missing which broke the sh profile.
1005 it was missing which broke the sh profile.
995
1006
996 * completer.py: file completer now uses explicit '/' instead
1007 * completer.py: file completer now uses explicit '/' instead
997 of os.path.join, expansion of 'foo' was broken on win32
1008 of os.path.join, expansion of 'foo' was broken on win32
998 if there was one directory with name 'foobar'.
1009 if there was one directory with name 'foobar'.
999
1010
1000 * A bunch of patches from Kirill Smelkov:
1011 * A bunch of patches from Kirill Smelkov:
1001
1012
1002 * [patch 9/9] doc: point bug-tracker URL to IPythons trac-tickets.
1013 * [patch 9/9] doc: point bug-tracker URL to IPythons trac-tickets.
1003
1014
1004 * [patch 7/9] Implement %page -r (page in raw mode) -
1015 * [patch 7/9] Implement %page -r (page in raw mode) -
1005
1016
1006 * [patch 5/9] ScientificPython webpage has moved
1017 * [patch 5/9] ScientificPython webpage has moved
1007
1018
1008 * [patch 4/9] The manual mentions %ds, should be %dhist
1019 * [patch 4/9] The manual mentions %ds, should be %dhist
1009
1020
1010 * [patch 3/9] Kill old bits from %prun doc.
1021 * [patch 3/9] Kill old bits from %prun doc.
1011
1022
1012 * [patch 1/9] Fix typos here and there.
1023 * [patch 1/9] Fix typos here and there.
1013
1024
1014 2006-11-08 Ville Vainio <vivainio@gmail.com>
1025 2006-11-08 Ville Vainio <vivainio@gmail.com>
1015
1026
1016 * completer.py (attr_matches): catch all exceptions raised
1027 * completer.py (attr_matches): catch all exceptions raised
1017 by eval of expr with dots.
1028 by eval of expr with dots.
1018
1029
1019 2006-11-07 Fernando Perez <Fernando.Perez@colorado.edu>
1030 2006-11-07 Fernando Perez <Fernando.Perez@colorado.edu>
1020
1031
1021 * IPython/iplib.py (runsource): Prepend an 'if 1:' to the user
1032 * IPython/iplib.py (runsource): Prepend an 'if 1:' to the user
1022 input if it starts with whitespace. This allows you to paste
1033 input if it starts with whitespace. This allows you to paste
1023 indented input from any editor without manually having to type in
1034 indented input from any editor without manually having to type in
1024 the 'if 1:', which is convenient when working interactively.
1035 the 'if 1:', which is convenient when working interactively.
1025 Slightly modifed version of a patch by Bo Peng
1036 Slightly modifed version of a patch by Bo Peng
1026 <bpeng-AT-rice.edu>.
1037 <bpeng-AT-rice.edu>.
1027
1038
1028 2006-11-03 Fernando Perez <Fernando.Perez@colorado.edu>
1039 2006-11-03 Fernando Perez <Fernando.Perez@colorado.edu>
1029
1040
1030 * IPython/irunner.py (main): modified irunner so it automatically
1041 * IPython/irunner.py (main): modified irunner so it automatically
1031 recognizes the right runner to use based on the extension (.py for
1042 recognizes the right runner to use based on the extension (.py for
1032 python, .ipy for ipython and .sage for sage).
1043 python, .ipy for ipython and .sage for sage).
1033
1044
1034 * IPython/iplib.py (InteractiveShell.ipconfig): new builtin, also
1045 * IPython/iplib.py (InteractiveShell.ipconfig): new builtin, also
1035 visible in ipapi as ip.config(), to programatically control the
1046 visible in ipapi as ip.config(), to programatically control the
1036 internal rc object. There's an accompanying %config magic for
1047 internal rc object. There's an accompanying %config magic for
1037 interactive use, which has been enhanced to match the
1048 interactive use, which has been enhanced to match the
1038 funtionality in ipconfig.
1049 funtionality in ipconfig.
1039
1050
1040 * IPython/Magic.py (magic_system_verbose): Change %system_verbose
1051 * IPython/Magic.py (magic_system_verbose): Change %system_verbose
1041 so it's not just a toggle, it now takes an argument. Add support
1052 so it's not just a toggle, it now takes an argument. Add support
1042 for a customizable header when making system calls, as the new
1053 for a customizable header when making system calls, as the new
1043 system_header variable in the ipythonrc file.
1054 system_header variable in the ipythonrc file.
1044
1055
1045 2006-11-03 Walter Doerwald <walter@livinglogic.de>
1056 2006-11-03 Walter Doerwald <walter@livinglogic.de>
1046
1057
1047 * IPython/Extensions/ipipe.py: xrepr(), xiter() and xattrs() are now
1058 * IPython/Extensions/ipipe.py: xrepr(), xiter() and xattrs() are now
1048 generic functions (using Philip J. Eby's simplegeneric package).
1059 generic functions (using Philip J. Eby's simplegeneric package).
1049 This makes it possible to customize the display of third-party classes
1060 This makes it possible to customize the display of third-party classes
1050 without having to monkeypatch them. xiter() no longer supports a mode
1061 without having to monkeypatch them. xiter() no longer supports a mode
1051 argument and the XMode class has been removed. The same functionality can
1062 argument and the XMode class has been removed. The same functionality can
1052 be implemented via IterAttributeDescriptor and IterMethodDescriptor.
1063 be implemented via IterAttributeDescriptor and IterMethodDescriptor.
1053 One consequence of the switch to generic functions is that xrepr() and
1064 One consequence of the switch to generic functions is that xrepr() and
1054 xattrs() implementation must define the default value for the mode
1065 xattrs() implementation must define the default value for the mode
1055 argument themselves and xattrs() implementations must return real
1066 argument themselves and xattrs() implementations must return real
1056 descriptors.
1067 descriptors.
1057
1068
1058 * IPython/external: This new subpackage will contain all third-party
1069 * IPython/external: This new subpackage will contain all third-party
1059 packages that are bundled with IPython. (The first one is simplegeneric).
1070 packages that are bundled with IPython. (The first one is simplegeneric).
1060
1071
1061 * IPython/Extensions/ipipe.py (ifile/ils): Readd output of the parent
1072 * IPython/Extensions/ipipe.py (ifile/ils): Readd output of the parent
1062 directory which as been dropped in r1703.
1073 directory which as been dropped in r1703.
1063
1074
1064 * IPython/Extensions/ipipe.py (iless): Fixed.
1075 * IPython/Extensions/ipipe.py (iless): Fixed.
1065
1076
1066 * IPython/Extensions/ibrowse: Fixed sorting under Python 2.3.
1077 * IPython/Extensions/ibrowse: Fixed sorting under Python 2.3.
1067
1078
1068 2006-11-03 Fernando Perez <Fernando.Perez@colorado.edu>
1079 2006-11-03 Fernando Perez <Fernando.Perez@colorado.edu>
1069
1080
1070 * IPython/iplib.py (InteractiveShell.var_expand): fix stack
1081 * IPython/iplib.py (InteractiveShell.var_expand): fix stack
1071 handling in variable expansion so that shells and magics recognize
1082 handling in variable expansion so that shells and magics recognize
1072 function local scopes correctly. Bug reported by Brian.
1083 function local scopes correctly. Bug reported by Brian.
1073
1084
1074 * scripts/ipython: remove the very first entry in sys.path which
1085 * scripts/ipython: remove the very first entry in sys.path which
1075 Python auto-inserts for scripts, so that sys.path under IPython is
1086 Python auto-inserts for scripts, so that sys.path under IPython is
1076 as similar as possible to that under plain Python.
1087 as similar as possible to that under plain Python.
1077
1088
1078 * IPython/completer.py (IPCompleter.file_matches): Fix
1089 * IPython/completer.py (IPCompleter.file_matches): Fix
1079 tab-completion so that quotes are not closed unless the completion
1090 tab-completion so that quotes are not closed unless the completion
1080 is unambiguous. After a request by Stefan. Minor cleanups in
1091 is unambiguous. After a request by Stefan. Minor cleanups in
1081 ipy_stock_completers.
1092 ipy_stock_completers.
1082
1093
1083 2006-11-02 Ville Vainio <vivainio@gmail.com>
1094 2006-11-02 Ville Vainio <vivainio@gmail.com>
1084
1095
1085 * ipy_stock_completers.py: Add %run and %cd completers.
1096 * ipy_stock_completers.py: Add %run and %cd completers.
1086
1097
1087 * completer.py: Try running custom completer for both
1098 * completer.py: Try running custom completer for both
1088 "foo" and "%foo" if the command is just "foo". Ignore case
1099 "foo" and "%foo" if the command is just "foo". Ignore case
1089 when filtering possible completions.
1100 when filtering possible completions.
1090
1101
1091 * UserConfig/ipy_user_conf.py: install stock completers as default
1102 * UserConfig/ipy_user_conf.py: install stock completers as default
1092
1103
1093 * iplib.py (history_saving_wrapper), debugger(), ipy_pydb.py:
1104 * iplib.py (history_saving_wrapper), debugger(), ipy_pydb.py:
1094 simplified readline history save / restore through a wrapper
1105 simplified readline history save / restore through a wrapper
1095 function
1106 function
1096
1107
1097
1108
1098 2006-10-31 Ville Vainio <vivainio@gmail.com>
1109 2006-10-31 Ville Vainio <vivainio@gmail.com>
1099
1110
1100 * strdispatch.py, completer.py, ipy_stock_completers.py:
1111 * strdispatch.py, completer.py, ipy_stock_completers.py:
1101 Allow str_key ("command") in completer hooks. Implement
1112 Allow str_key ("command") in completer hooks. Implement
1102 trivial completer for 'import' (stdlib modules only). Rename
1113 trivial completer for 'import' (stdlib modules only). Rename
1103 ipy_linux_package_managers.py to ipy_stock_completers.py.
1114 ipy_linux_package_managers.py to ipy_stock_completers.py.
1104 SVN completer.
1115 SVN completer.
1105
1116
1106 * Extensions/ledit.py: %magic line editor for easily and
1117 * Extensions/ledit.py: %magic line editor for easily and
1107 incrementally manipulating lists of strings. The magic command
1118 incrementally manipulating lists of strings. The magic command
1108 name is %led.
1119 name is %led.
1109
1120
1110 2006-10-30 Ville Vainio <vivainio@gmail.com>
1121 2006-10-30 Ville Vainio <vivainio@gmail.com>
1111
1122
1112 * Debugger.py, iplib.py (debugger()): Add last set of Rocky
1123 * Debugger.py, iplib.py (debugger()): Add last set of Rocky
1113 Bernsteins's patches for pydb integration.
1124 Bernsteins's patches for pydb integration.
1114 http://bashdb.sourceforge.net/pydb/
1125 http://bashdb.sourceforge.net/pydb/
1115
1126
1116 * strdispatch.py, iplib.py, completer.py, IPython/__init__.py,
1127 * strdispatch.py, iplib.py, completer.py, IPython/__init__.py,
1117 Extensions/ipy_linux_package_managers.py, hooks.py: Implement
1128 Extensions/ipy_linux_package_managers.py, hooks.py: Implement
1118 custom completer hook to allow the users to implement their own
1129 custom completer hook to allow the users to implement their own
1119 completers. See ipy_linux_package_managers.py for example. The
1130 completers. See ipy_linux_package_managers.py for example. The
1120 hook name is 'complete_command'.
1131 hook name is 'complete_command'.
1121
1132
1122 2006-10-28 Fernando Perez <Fernando.Perez@colorado.edu>
1133 2006-10-28 Fernando Perez <Fernando.Perez@colorado.edu>
1123
1134
1124 * IPython/UserConfig/ipythonrc-scipy: minor cleanups to remove old
1135 * IPython/UserConfig/ipythonrc-scipy: minor cleanups to remove old
1125 Numeric leftovers.
1136 Numeric leftovers.
1126
1137
1127 * ipython.el (py-execute-region): apply Stefan's patch to fix
1138 * ipython.el (py-execute-region): apply Stefan's patch to fix
1128 garbled results if the python shell hasn't been previously started.
1139 garbled results if the python shell hasn't been previously started.
1129
1140
1130 * IPython/genutils.py (arg_split): moved to genutils, since it's a
1141 * IPython/genutils.py (arg_split): moved to genutils, since it's a
1131 pretty generic function and useful for other things.
1142 pretty generic function and useful for other things.
1132
1143
1133 * IPython/OInspect.py (getsource): Add customizable source
1144 * IPython/OInspect.py (getsource): Add customizable source
1134 extractor. After a request/patch form W. Stein (SAGE).
1145 extractor. After a request/patch form W. Stein (SAGE).
1135
1146
1136 * IPython/irunner.py (InteractiveRunner.run_source): reset tty
1147 * IPython/irunner.py (InteractiveRunner.run_source): reset tty
1137 window size to a more reasonable value from what pexpect does,
1148 window size to a more reasonable value from what pexpect does,
1138 since their choice causes wrapping bugs with long input lines.
1149 since their choice causes wrapping bugs with long input lines.
1139
1150
1140 2006-10-28 Ville Vainio <vivainio@gmail.com>
1151 2006-10-28 Ville Vainio <vivainio@gmail.com>
1141
1152
1142 * Magic.py (%run): Save and restore the readline history from
1153 * Magic.py (%run): Save and restore the readline history from
1143 file around %run commands to prevent side effects from
1154 file around %run commands to prevent side effects from
1144 %runned programs that might use readline (e.g. pydb).
1155 %runned programs that might use readline (e.g. pydb).
1145
1156
1146 * extensions/ipy_pydb.py: Adds %pydb magic when imported, for
1157 * extensions/ipy_pydb.py: Adds %pydb magic when imported, for
1147 invoking the pydb enhanced debugger.
1158 invoking the pydb enhanced debugger.
1148
1159
1149 2006-10-23 Walter Doerwald <walter@livinglogic.de>
1160 2006-10-23 Walter Doerwald <walter@livinglogic.de>
1150
1161
1151 * IPython/Extensions/ipipe.py (ifile): Remove all methods that
1162 * IPython/Extensions/ipipe.py (ifile): Remove all methods that
1152 call the base class method and propagate the return value to
1163 call the base class method and propagate the return value to
1153 ifile. This is now done by path itself.
1164 ifile. This is now done by path itself.
1154
1165
1155 2006-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
1166 2006-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
1156
1167
1157 * IPython/ipapi.py (IPApi.__init__): Added new entry to public
1168 * IPython/ipapi.py (IPApi.__init__): Added new entry to public
1158 api: set_crash_handler(), to expose the ability to change the
1169 api: set_crash_handler(), to expose the ability to change the
1159 internal crash handler.
1170 internal crash handler.
1160
1171
1161 * IPython/CrashHandler.py (CrashHandler.__init__): abstract out
1172 * IPython/CrashHandler.py (CrashHandler.__init__): abstract out
1162 the various parameters of the crash handler so that apps using
1173 the various parameters of the crash handler so that apps using
1163 IPython as their engine can customize crash handling. Ipmlemented
1174 IPython as their engine can customize crash handling. Ipmlemented
1164 at the request of SAGE.
1175 at the request of SAGE.
1165
1176
1166 2006-10-14 Ville Vainio <vivainio@gmail.com>
1177 2006-10-14 Ville Vainio <vivainio@gmail.com>
1167
1178
1168 * Magic.py, ipython.el: applied first "safe" part of Rocky
1179 * Magic.py, ipython.el: applied first "safe" part of Rocky
1169 Bernstein's patch set for pydb integration.
1180 Bernstein's patch set for pydb integration.
1170
1181
1171 * Magic.py (%unalias, %alias): %store'd aliases can now be
1182 * Magic.py (%unalias, %alias): %store'd aliases can now be
1172 removed with '%unalias'. %alias w/o args now shows most
1183 removed with '%unalias'. %alias w/o args now shows most
1173 interesting (stored / manually defined) aliases last
1184 interesting (stored / manually defined) aliases last
1174 where they catch the eye w/o scrolling.
1185 where they catch the eye w/o scrolling.
1175
1186
1176 * Magic.py (%rehashx), ext_rehashdir.py: files with
1187 * Magic.py (%rehashx), ext_rehashdir.py: files with
1177 'py' extension are always considered executable, even
1188 'py' extension are always considered executable, even
1178 when not in PATHEXT environment variable.
1189 when not in PATHEXT environment variable.
1179
1190
1180 2006-10-12 Ville Vainio <vivainio@gmail.com>
1191 2006-10-12 Ville Vainio <vivainio@gmail.com>
1181
1192
1182 * jobctrl.py: Add new "jobctrl" extension for spawning background
1193 * jobctrl.py: Add new "jobctrl" extension for spawning background
1183 processes with "&find /". 'import jobctrl' to try it out. Requires
1194 processes with "&find /". 'import jobctrl' to try it out. Requires
1184 'subprocess' module, standard in python 2.4+.
1195 'subprocess' module, standard in python 2.4+.
1185
1196
1186 * iplib.py (expand_aliases, handle_alias): Aliases expand transitively,
1197 * iplib.py (expand_aliases, handle_alias): Aliases expand transitively,
1187 so if foo -> bar and bar -> baz, then foo -> baz.
1198 so if foo -> bar and bar -> baz, then foo -> baz.
1188
1199
1189 2006-10-09 Fernando Perez <Fernando.Perez@colorado.edu>
1200 2006-10-09 Fernando Perez <Fernando.Perez@colorado.edu>
1190
1201
1191 * IPython/Magic.py (Magic.parse_options): add a new posix option
1202 * IPython/Magic.py (Magic.parse_options): add a new posix option
1192 to allow parsing of input args in magics that doesn't strip quotes
1203 to allow parsing of input args in magics that doesn't strip quotes
1193 (if posix=False). This also closes %timeit bug reported by
1204 (if posix=False). This also closes %timeit bug reported by
1194 Stefan.
1205 Stefan.
1195
1206
1196 2006-10-03 Ville Vainio <vivainio@gmail.com>
1207 2006-10-03 Ville Vainio <vivainio@gmail.com>
1197
1208
1198 * iplib.py (raw_input, interact): Return ValueError catching for
1209 * iplib.py (raw_input, interact): Return ValueError catching for
1199 raw_input. Fixes infinite loop for sys.stdin.close() or
1210 raw_input. Fixes infinite loop for sys.stdin.close() or
1200 sys.stdout.close().
1211 sys.stdout.close().
1201
1212
1202 2006-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
1213 2006-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
1203
1214
1204 * IPython/irunner.py (InteractiveRunner.run_source): small fixes
1215 * IPython/irunner.py (InteractiveRunner.run_source): small fixes
1205 to help in handling doctests. irunner is now pretty useful for
1216 to help in handling doctests. irunner is now pretty useful for
1206 running standalone scripts and simulate a full interactive session
1217 running standalone scripts and simulate a full interactive session
1207 in a format that can be then pasted as a doctest.
1218 in a format that can be then pasted as a doctest.
1208
1219
1209 * IPython/iplib.py (InteractiveShell.__init__): Install exit/quit
1220 * IPython/iplib.py (InteractiveShell.__init__): Install exit/quit
1210 on top of the default (useless) ones. This also fixes the nasty
1221 on top of the default (useless) ones. This also fixes the nasty
1211 way in which 2.5's Quitter() exits (reverted [1785]).
1222 way in which 2.5's Quitter() exits (reverted [1785]).
1212
1223
1213 * IPython/Debugger.py (Pdb.__init__): Fix ipdb to work with python
1224 * IPython/Debugger.py (Pdb.__init__): Fix ipdb to work with python
1214 2.5.
1225 2.5.
1215
1226
1216 * IPython/ultraTB.py (TBTools.set_colors): Make sure that ipdb
1227 * IPython/ultraTB.py (TBTools.set_colors): Make sure that ipdb
1217 color scheme is updated as well when color scheme is changed
1228 color scheme is updated as well when color scheme is changed
1218 interactively.
1229 interactively.
1219
1230
1220 2006-09-27 Ville Vainio <vivainio@gmail.com>
1231 2006-09-27 Ville Vainio <vivainio@gmail.com>
1221
1232
1222 * iplib.py (raw_input): python 2.5 closes stdin on quit -> avoid
1233 * iplib.py (raw_input): python 2.5 closes stdin on quit -> avoid
1223 infinite loop and just exit. It's a hack, but will do for a while.
1234 infinite loop and just exit. It's a hack, but will do for a while.
1224
1235
1225 2006-08-25 Walter Doerwald <walter@livinglogic.de>
1236 2006-08-25 Walter Doerwald <walter@livinglogic.de>
1226
1237
1227 * IPython/Extensions/ipipe.py (ils): Add arguments dirs and files to
1238 * IPython/Extensions/ipipe.py (ils): Add arguments dirs and files to
1228 the constructor, this makes it possible to get a list of only directories
1239 the constructor, this makes it possible to get a list of only directories
1229 or only files.
1240 or only files.
1230
1241
1231 2006-08-12 Ville Vainio <vivainio@gmail.com>
1242 2006-08-12 Ville Vainio <vivainio@gmail.com>
1232
1243
1233 * Fakemodule.py, OInspect.py: Reverted 2006-08-11 mods,
1244 * Fakemodule.py, OInspect.py: Reverted 2006-08-11 mods,
1234 they broke unittest
1245 they broke unittest
1235
1246
1236 2006-08-11 Ville Vainio <vivainio@gmail.com>
1247 2006-08-11 Ville Vainio <vivainio@gmail.com>
1237
1248
1238 * Fakemodule.py, OInspect.py: remove 2006-08-09 monkepatch
1249 * Fakemodule.py, OInspect.py: remove 2006-08-09 monkepatch
1239 by resolving issue properly, i.e. by inheriting FakeModule
1250 by resolving issue properly, i.e. by inheriting FakeModule
1240 from types.ModuleType. Pickling ipython interactive data
1251 from types.ModuleType. Pickling ipython interactive data
1241 should still work as usual (testing appreciated).
1252 should still work as usual (testing appreciated).
1242
1253
1243 2006-08-09 Fernando Perez <Fernando.Perez@colorado.edu>
1254 2006-08-09 Fernando Perez <Fernando.Perez@colorado.edu>
1244
1255
1245 * IPython/OInspect.py: monkeypatch inspect from the stdlib if
1256 * IPython/OInspect.py: monkeypatch inspect from the stdlib if
1246 running under python 2.3 with code from 2.4 to fix a bug with
1257 running under python 2.3 with code from 2.4 to fix a bug with
1247 help(). Reported by the Debian maintainers, Norbert Tretkowski
1258 help(). Reported by the Debian maintainers, Norbert Tretkowski
1248 <norbert-AT-tretkowski.de> and Alexandre Fayolle
1259 <norbert-AT-tretkowski.de> and Alexandre Fayolle
1249 <afayolle-AT-debian.org>.
1260 <afayolle-AT-debian.org>.
1250
1261
1251 2006-08-04 Walter Doerwald <walter@livinglogic.de>
1262 2006-08-04 Walter Doerwald <walter@livinglogic.de>
1252
1263
1253 * IPython/Extensions/ibrowse.py: Fixed the help message in the footer
1264 * IPython/Extensions/ibrowse.py: Fixed the help message in the footer
1254 (which was displaying "quit" twice).
1265 (which was displaying "quit" twice).
1255
1266
1256 2006-07-28 Walter Doerwald <walter@livinglogic.de>
1267 2006-07-28 Walter Doerwald <walter@livinglogic.de>
1257
1268
1258 * IPython/Extensions/ipipe.py: Fix isort.__iter__() (was still using
1269 * IPython/Extensions/ipipe.py: Fix isort.__iter__() (was still using
1259 the mode argument).
1270 the mode argument).
1260
1271
1261 2006-07-27 Walter Doerwald <walter@livinglogic.de>
1272 2006-07-27 Walter Doerwald <walter@livinglogic.de>
1262
1273
1263 * IPython/Extensions/ipipe.py: Fix getglobals() if we're
1274 * IPython/Extensions/ipipe.py: Fix getglobals() if we're
1264 not running under IPython.
1275 not running under IPython.
1265
1276
1266 * IPython/Extensions/ipipe.py: Rename XAttr to AttributeDetail
1277 * IPython/Extensions/ipipe.py: Rename XAttr to AttributeDetail
1267 and make it iterable (iterating over the attribute itself). Add two new
1278 and make it iterable (iterating over the attribute itself). Add two new
1268 magic strings for __xattrs__(): If the string starts with "-", the attribute
1279 magic strings for __xattrs__(): If the string starts with "-", the attribute
1269 will not be displayed in ibrowse's detail view (but it can still be
1280 will not be displayed in ibrowse's detail view (but it can still be
1270 iterated over). This makes it possible to add attributes that are large
1281 iterated over). This makes it possible to add attributes that are large
1271 lists or generator methods to the detail view. Replace magic attribute names
1282 lists or generator methods to the detail view. Replace magic attribute names
1272 and _attrname() and _getattr() with "descriptors": For each type of magic
1283 and _attrname() and _getattr() with "descriptors": For each type of magic
1273 attribute name there's a subclass of Descriptor: None -> SelfDescriptor();
1284 attribute name there's a subclass of Descriptor: None -> SelfDescriptor();
1274 "foo" -> AttributeDescriptor("foo"); "foo()" -> MethodDescriptor("foo");
1285 "foo" -> AttributeDescriptor("foo"); "foo()" -> MethodDescriptor("foo");
1275 "-foo" -> IterAttributeDescriptor("foo"); "-foo()" -> IterMethodDescriptor("foo");
1286 "-foo" -> IterAttributeDescriptor("foo"); "-foo()" -> IterMethodDescriptor("foo");
1276 foo() -> FunctionDescriptor(foo). Magic strings returned from __xattrs__()
1287 foo() -> FunctionDescriptor(foo). Magic strings returned from __xattrs__()
1277 are still supported.
1288 are still supported.
1278
1289
1279 * IPython/Extensions/ibrowse.py: If fetching the next row from the input
1290 * IPython/Extensions/ibrowse.py: If fetching the next row from the input
1280 fails in ibrowse.fetch(), the exception object is added as the last item
1291 fails in ibrowse.fetch(), the exception object is added as the last item
1281 and item fetching is canceled. This prevents ibrowse from aborting if e.g.
1292 and item fetching is canceled. This prevents ibrowse from aborting if e.g.
1282 a generator throws an exception midway through execution.
1293 a generator throws an exception midway through execution.
1283
1294
1284 * IPython/Extensions/ipipe.py: Turn ifile's properties mimetype and
1295 * IPython/Extensions/ipipe.py: Turn ifile's properties mimetype and
1285 encoding into methods.
1296 encoding into methods.
1286
1297
1287 2006-07-26 Ville Vainio <vivainio@gmail.com>
1298 2006-07-26 Ville Vainio <vivainio@gmail.com>
1288
1299
1289 * iplib.py: history now stores multiline input as single
1300 * iplib.py: history now stores multiline input as single
1290 history entries. Patch by Jorgen Cederlof.
1301 history entries. Patch by Jorgen Cederlof.
1291
1302
1292 2006-07-18 Walter Doerwald <walter@livinglogic.de>
1303 2006-07-18 Walter Doerwald <walter@livinglogic.de>
1293
1304
1294 * IPython/Extensions/ibrowse.py: Make cursor visible over
1305 * IPython/Extensions/ibrowse.py: Make cursor visible over
1295 non existing attributes.
1306 non existing attributes.
1296
1307
1297 2006-07-14 Walter Doerwald <walter@livinglogic.de>
1308 2006-07-14 Walter Doerwald <walter@livinglogic.de>
1298
1309
1299 * IPython/Extensions/ipipe.py (ix): Use os.popen4() so that the
1310 * IPython/Extensions/ipipe.py (ix): Use os.popen4() so that the
1300 error output of the running command doesn't mess up the screen.
1311 error output of the running command doesn't mess up the screen.
1301
1312
1302 2006-07-13 Walter Doerwald <walter@livinglogic.de>
1313 2006-07-13 Walter Doerwald <walter@livinglogic.de>
1303
1314
1304 * IPython/Extensions/ipipe.py (isort): Make isort usable without
1315 * IPython/Extensions/ipipe.py (isort): Make isort usable without
1305 argument. This sorts the items themselves.
1316 argument. This sorts the items themselves.
1306
1317
1307 2006-07-12 Walter Doerwald <walter@livinglogic.de>
1318 2006-07-12 Walter Doerwald <walter@livinglogic.de>
1308
1319
1309 * IPython/Extensions/ipipe.py (eval, ifilter, isort, ieval):
1320 * IPython/Extensions/ipipe.py (eval, ifilter, isort, ieval):
1310 Compile expression strings into code objects. This should speed
1321 Compile expression strings into code objects. This should speed
1311 up ifilter and friends somewhat.
1322 up ifilter and friends somewhat.
1312
1323
1313 2006-07-08 Ville Vainio <vivainio@gmail.com>
1324 2006-07-08 Ville Vainio <vivainio@gmail.com>
1314
1325
1315 * Magic.py: %cpaste now strips > from the beginning of lines
1326 * Magic.py: %cpaste now strips > from the beginning of lines
1316 to ease pasting quoted code from emails. Contributed by
1327 to ease pasting quoted code from emails. Contributed by
1317 Stefan van der Walt.
1328 Stefan van der Walt.
1318
1329
1319 2006-06-29 Ville Vainio <vivainio@gmail.com>
1330 2006-06-29 Ville Vainio <vivainio@gmail.com>
1320
1331
1321 * ipmaker.py, Shell.py: qt4agg matplotlib backend support for pylab
1332 * ipmaker.py, Shell.py: qt4agg matplotlib backend support for pylab
1322 mode, patch contributed by Darren Dale. NEEDS TESTING!
1333 mode, patch contributed by Darren Dale. NEEDS TESTING!
1323
1334
1324 2006-06-28 Walter Doerwald <walter@livinglogic.de>
1335 2006-06-28 Walter Doerwald <walter@livinglogic.de>
1325
1336
1326 * IPython/Extensions/ibrowse.py: Give the ibrowse cursor row
1337 * IPython/Extensions/ibrowse.py: Give the ibrowse cursor row
1327 a blue background. Fix fetching new display rows when the browser
1338 a blue background. Fix fetching new display rows when the browser
1328 scrolls more than a screenful (e.g. by using the goto command).
1339 scrolls more than a screenful (e.g. by using the goto command).
1329
1340
1330 2006-06-27 Ville Vainio <vivainio@gmail.com>
1341 2006-06-27 Ville Vainio <vivainio@gmail.com>
1331
1342
1332 * Magic.py (_inspect, _ofind) Apply David Huard's
1343 * Magic.py (_inspect, _ofind) Apply David Huard's
1333 patch for displaying the correct docstring for 'property'
1344 patch for displaying the correct docstring for 'property'
1334 attributes.
1345 attributes.
1335
1346
1336 2006-06-23 Walter Doerwald <walter@livinglogic.de>
1347 2006-06-23 Walter Doerwald <walter@livinglogic.de>
1337
1348
1338 * IPython/Extensions/ibrowse.py: Put the documentation of the keyboard
1349 * IPython/Extensions/ibrowse.py: Put the documentation of the keyboard
1339 commands into the methods implementing them.
1350 commands into the methods implementing them.
1340
1351
1341 2006-06-22 Fernando Perez <Fernando.Perez@colorado.edu>
1352 2006-06-22 Fernando Perez <Fernando.Perez@colorado.edu>
1342
1353
1343 * ipython.el (ipython-indentation-hook): cleanup patch, submitted
1354 * ipython.el (ipython-indentation-hook): cleanup patch, submitted
1344 by Kov Chai <tchaikov-AT-gmail.com>. He notes that the original
1355 by Kov Chai <tchaikov-AT-gmail.com>. He notes that the original
1345 autoindent support was authored by Jin Liu.
1356 autoindent support was authored by Jin Liu.
1346
1357
1347 2006-06-22 Walter Doerwald <walter@livinglogic.de>
1358 2006-06-22 Walter Doerwald <walter@livinglogic.de>
1348
1359
1349 * IPython/Extensions/ibrowse.py: Replace the plain dictionaries used
1360 * IPython/Extensions/ibrowse.py: Replace the plain dictionaries used
1350 for keymaps with a custom class that simplifies handling.
1361 for keymaps with a custom class that simplifies handling.
1351
1362
1352 2006-06-19 Walter Doerwald <walter@livinglogic.de>
1363 2006-06-19 Walter Doerwald <walter@livinglogic.de>
1353
1364
1354 * IPython/Extensions/ibrowse.py: ibrowse now properly handles terminal
1365 * IPython/Extensions/ibrowse.py: ibrowse now properly handles terminal
1355 resizing. This requires Python 2.5 to work.
1366 resizing. This requires Python 2.5 to work.
1356
1367
1357 2006-06-16 Walter Doerwald <walter@livinglogic.de>
1368 2006-06-16 Walter Doerwald <walter@livinglogic.de>
1358
1369
1359 * IPython/Extensions/ibrowse.py: Add two new commands to
1370 * IPython/Extensions/ibrowse.py: Add two new commands to
1360 ibrowse: "hideattr" (mapped to "h") hides the attribute under
1371 ibrowse: "hideattr" (mapped to "h") hides the attribute under
1361 the cursor. "unhiderattrs" (mapped to "H") reveals all hidden
1372 the cursor. "unhiderattrs" (mapped to "H") reveals all hidden
1362 attributes again. Remapped the help command to "?". Display
1373 attributes again. Remapped the help command to "?". Display
1363 keycodes in the range 0x01-0x1F as CTRL-xx. Add CTRL-a and CTRL-e
1374 keycodes in the range 0x01-0x1F as CTRL-xx. Add CTRL-a and CTRL-e
1364 as keys for the "home" and "end" commands. Add three new commands
1375 as keys for the "home" and "end" commands. Add three new commands
1365 to the input mode for "find" and friends: "delend" (CTRL-K)
1376 to the input mode for "find" and friends: "delend" (CTRL-K)
1366 deletes to the end of line. "incsearchup" searches upwards in the
1377 deletes to the end of line. "incsearchup" searches upwards in the
1367 command history for an input that starts with the text before the cursor.
1378 command history for an input that starts with the text before the cursor.
1368 "incsearchdown" does the same downwards. Removed a bogus mapping of
1379 "incsearchdown" does the same downwards. Removed a bogus mapping of
1369 the x key to "delete".
1380 the x key to "delete".
1370
1381
1371 2006-06-15 Ville Vainio <vivainio@gmail.com>
1382 2006-06-15 Ville Vainio <vivainio@gmail.com>
1372
1383
1373 * iplib.py, hooks.py: Added new generate_prompt hook that can be
1384 * iplib.py, hooks.py: Added new generate_prompt hook that can be
1374 used to create prompts dynamically, instead of the "old" way of
1385 used to create prompts dynamically, instead of the "old" way of
1375 assigning "magic" strings to prompt_in1 and prompt_in2. The old
1386 assigning "magic" strings to prompt_in1 and prompt_in2. The old
1376 way still works (it's invoked by the default hook), of course.
1387 way still works (it's invoked by the default hook), of course.
1377
1388
1378 * Prompts.py: added generate_output_prompt hook for altering output
1389 * Prompts.py: added generate_output_prompt hook for altering output
1379 prompt
1390 prompt
1380
1391
1381 * Release.py: Changed version string to 0.7.3.svn.
1392 * Release.py: Changed version string to 0.7.3.svn.
1382
1393
1383 2006-06-15 Walter Doerwald <walter@livinglogic.de>
1394 2006-06-15 Walter Doerwald <walter@livinglogic.de>
1384
1395
1385 * IPython/Extensions/ibrowse.py: Change _BrowserLevel.moveto() so that
1396 * IPython/Extensions/ibrowse.py: Change _BrowserLevel.moveto() so that
1386 the call to fetch() always tries to fetch enough data for at least one
1397 the call to fetch() always tries to fetch enough data for at least one
1387 full screen. This makes it possible to simply call moveto(0,0,True) in
1398 full screen. This makes it possible to simply call moveto(0,0,True) in
1388 the constructor. Fix typos and removed the obsolete goto attribute.
1399 the constructor. Fix typos and removed the obsolete goto attribute.
1389
1400
1390 2006-06-12 Ville Vainio <vivainio@gmail.com>
1401 2006-06-12 Ville Vainio <vivainio@gmail.com>
1391
1402
1392 * ipy_profile_sh.py: applied Krisha Mohan Gundu's patch for
1403 * ipy_profile_sh.py: applied Krisha Mohan Gundu's patch for
1393 allowing $variable interpolation within multiline statements,
1404 allowing $variable interpolation within multiline statements,
1394 though so far only with "sh" profile for a testing period.
1405 though so far only with "sh" profile for a testing period.
1395 The patch also enables splitting long commands with \ but it
1406 The patch also enables splitting long commands with \ but it
1396 doesn't work properly yet.
1407 doesn't work properly yet.
1397
1408
1398 2006-06-12 Walter Doerwald <walter@livinglogic.de>
1409 2006-06-12 Walter Doerwald <walter@livinglogic.de>
1399
1410
1400 * IPython/Extensions/ibrowse.py (_dodisplay): Display the length of the
1411 * IPython/Extensions/ibrowse.py (_dodisplay): Display the length of the
1401 input history and the position of the cursor in the input history for
1412 input history and the position of the cursor in the input history for
1402 the find, findbackwards and goto command.
1413 the find, findbackwards and goto command.
1403
1414
1404 2006-06-10 Walter Doerwald <walter@livinglogic.de>
1415 2006-06-10 Walter Doerwald <walter@livinglogic.de>
1405
1416
1406 * IPython/Extensions/ibrowse.py: Add a class _CommandInput that
1417 * IPython/Extensions/ibrowse.py: Add a class _CommandInput that
1407 implements the basic functionality of browser commands that require
1418 implements the basic functionality of browser commands that require
1408 input. Reimplement the goto, find and findbackwards commands as
1419 input. Reimplement the goto, find and findbackwards commands as
1409 subclasses of _CommandInput. Add an input history and keymaps to those
1420 subclasses of _CommandInput. Add an input history and keymaps to those
1410 commands. Add "\r" as a keyboard shortcut for the enterdefault and
1421 commands. Add "\r" as a keyboard shortcut for the enterdefault and
1411 execute commands.
1422 execute commands.
1412
1423
1413 2006-06-07 Ville Vainio <vivainio@gmail.com>
1424 2006-06-07 Ville Vainio <vivainio@gmail.com>
1414
1425
1415 * iplib.py: ipython mybatch.ipy exits ipython immediately after
1426 * iplib.py: ipython mybatch.ipy exits ipython immediately after
1416 running the batch files instead of leaving the session open.
1427 running the batch files instead of leaving the session open.
1417
1428
1418 2006-06-07 Fernando Perez <Fernando.Perez@colorado.edu>
1429 2006-06-07 Fernando Perez <Fernando.Perez@colorado.edu>
1419
1430
1420 * IPython/iplib.py (InteractiveShell.__init__): update BSD fix, as
1431 * IPython/iplib.py (InteractiveShell.__init__): update BSD fix, as
1421 the original fix was incomplete. Patch submitted by W. Maier.
1432 the original fix was incomplete. Patch submitted by W. Maier.
1422
1433
1423 2006-06-07 Ville Vainio <vivainio@gmail.com>
1434 2006-06-07 Ville Vainio <vivainio@gmail.com>
1424
1435
1425 * iplib.py,Magic.py, ipmaker.py (magic_rehashx):
1436 * iplib.py,Magic.py, ipmaker.py (magic_rehashx):
1426 Confirmation prompts can be supressed by 'quiet' option.
1437 Confirmation prompts can be supressed by 'quiet' option.
1427 _ip.options.quiet = 1 means "assume yes for all yes/no queries".
1438 _ip.options.quiet = 1 means "assume yes for all yes/no queries".
1428
1439
1429 2006-06-06 *** Released version 0.7.2
1440 2006-06-06 *** Released version 0.7.2
1430
1441
1431 2006-06-06 Fernando Perez <Fernando.Perez@colorado.edu>
1442 2006-06-06 Fernando Perez <Fernando.Perez@colorado.edu>
1432
1443
1433 * IPython/Release.py (version): Made 0.7.2 final for release.
1444 * IPython/Release.py (version): Made 0.7.2 final for release.
1434 Repo tagged and release cut.
1445 Repo tagged and release cut.
1435
1446
1436 2006-06-05 Ville Vainio <vivainio@gmail.com>
1447 2006-06-05 Ville Vainio <vivainio@gmail.com>
1437
1448
1438 * Magic.py (magic_rehashx): Honor no_alias list earlier in
1449 * Magic.py (magic_rehashx): Honor no_alias list earlier in
1439 %rehashx, to avoid clobbering builtins in ipy_profile_sh.py
1450 %rehashx, to avoid clobbering builtins in ipy_profile_sh.py
1440
1451
1441 * upgrade_dir.py: try import 'path' module a bit harder
1452 * upgrade_dir.py: try import 'path' module a bit harder
1442 (for %upgrade)
1453 (for %upgrade)
1443
1454
1444 2006-06-03 Fernando Perez <Fernando.Perez@colorado.edu>
1455 2006-06-03 Fernando Perez <Fernando.Perez@colorado.edu>
1445
1456
1446 * IPython/genutils.py (ask_yes_no): treat EOF as a default answer
1457 * IPython/genutils.py (ask_yes_no): treat EOF as a default answer
1447 instead of looping 20 times.
1458 instead of looping 20 times.
1448
1459
1449 * IPython/ipmaker.py (make_IPython): honor -ipythondir flag
1460 * IPython/ipmaker.py (make_IPython): honor -ipythondir flag
1450 correctly at initialization time. Bug reported by Krishna Mohan
1461 correctly at initialization time. Bug reported by Krishna Mohan
1451 Gundu <gkmohan-AT-gmail.com> on the user list.
1462 Gundu <gkmohan-AT-gmail.com> on the user list.
1452
1463
1453 * IPython/Release.py (version): Mark 0.7.2 version to start
1464 * IPython/Release.py (version): Mark 0.7.2 version to start
1454 testing for release on 06/06.
1465 testing for release on 06/06.
1455
1466
1456 2006-05-31 Fernando Perez <Fernando.Perez@colorado.edu>
1467 2006-05-31 Fernando Perez <Fernando.Perez@colorado.edu>
1457
1468
1458 * scripts/irunner: thin script interface so users don't have to
1469 * scripts/irunner: thin script interface so users don't have to
1459 find the module and call it as an executable, since modules rarely
1470 find the module and call it as an executable, since modules rarely
1460 live in people's PATH.
1471 live in people's PATH.
1461
1472
1462 * IPython/irunner.py (InteractiveRunner.__init__): added
1473 * IPython/irunner.py (InteractiveRunner.__init__): added
1463 delaybeforesend attribute to control delays with newer versions of
1474 delaybeforesend attribute to control delays with newer versions of
1464 pexpect. Thanks to detailed help from pexpect's author, Noah
1475 pexpect. Thanks to detailed help from pexpect's author, Noah
1465 Spurrier <noah-AT-noah.org>. Noted how to use the SAGE runner
1476 Spurrier <noah-AT-noah.org>. Noted how to use the SAGE runner
1466 correctly (it works in NoColor mode).
1477 correctly (it works in NoColor mode).
1467
1478
1468 * IPython/iplib.py (handle_normal): fix nasty crash reported on
1479 * IPython/iplib.py (handle_normal): fix nasty crash reported on
1469 SAGE list, from improper log() calls.
1480 SAGE list, from improper log() calls.
1470
1481
1471 2006-05-31 Ville Vainio <vivainio@gmail.com>
1482 2006-05-31 Ville Vainio <vivainio@gmail.com>
1472
1483
1473 * upgrade_dir.py, Magic.py (magic_upgrade): call upgrade_dir
1484 * upgrade_dir.py, Magic.py (magic_upgrade): call upgrade_dir
1474 with args in parens to work correctly with dirs that have spaces.
1485 with args in parens to work correctly with dirs that have spaces.
1475
1486
1476 2006-05-30 Fernando Perez <Fernando.Perez@colorado.edu>
1487 2006-05-30 Fernando Perez <Fernando.Perez@colorado.edu>
1477
1488
1478 * IPython/Logger.py (Logger.logstart): add option to log raw input
1489 * IPython/Logger.py (Logger.logstart): add option to log raw input
1479 instead of the processed one. A -r flag was added to the
1490 instead of the processed one. A -r flag was added to the
1480 %logstart magic used for controlling logging.
1491 %logstart magic used for controlling logging.
1481
1492
1482 2006-05-29 Fernando Perez <Fernando.Perez@colorado.edu>
1493 2006-05-29 Fernando Perez <Fernando.Perez@colorado.edu>
1483
1494
1484 * IPython/iplib.py (InteractiveShell.__init__): add check for the
1495 * IPython/iplib.py (InteractiveShell.__init__): add check for the
1485 *BSDs to omit --color from all 'ls' aliases, since *BSD ls doesn't
1496 *BSDs to omit --color from all 'ls' aliases, since *BSD ls doesn't
1486 recognize the option. After a bug report by Will Maier. This
1497 recognize the option. After a bug report by Will Maier. This
1487 closes #64 (will do it after confirmation from W. Maier).
1498 closes #64 (will do it after confirmation from W. Maier).
1488
1499
1489 * IPython/irunner.py: New module to run scripts as if manually
1500 * IPython/irunner.py: New module to run scripts as if manually
1490 typed into an interactive environment, based on pexpect. After a
1501 typed into an interactive environment, based on pexpect. After a
1491 submission by Ken Schutte <kschutte-AT-csail.mit.edu> on the
1502 submission by Ken Schutte <kschutte-AT-csail.mit.edu> on the
1492 ipython-user list. Simple unittests in the tests/ directory.
1503 ipython-user list. Simple unittests in the tests/ directory.
1493
1504
1494 * tools/release: add Will Maier, OpenBSD port maintainer, to
1505 * tools/release: add Will Maier, OpenBSD port maintainer, to
1495 recepients list. We are now officially part of the OpenBSD ports:
1506 recepients list. We are now officially part of the OpenBSD ports:
1496 http://www.openbsd.org/ports.html ! Many thanks to Will for the
1507 http://www.openbsd.org/ports.html ! Many thanks to Will for the
1497 work.
1508 work.
1498
1509
1499 2006-05-26 Fernando Perez <Fernando.Perez@colorado.edu>
1510 2006-05-26 Fernando Perez <Fernando.Perez@colorado.edu>
1500
1511
1501 * IPython/ipmaker.py (make_IPython): modify sys.argv fix (below)
1512 * IPython/ipmaker.py (make_IPython): modify sys.argv fix (below)
1502 so that it doesn't break tkinter apps.
1513 so that it doesn't break tkinter apps.
1503
1514
1504 * IPython/iplib.py (_prefilter): fix bug where aliases would
1515 * IPython/iplib.py (_prefilter): fix bug where aliases would
1505 shadow variables when autocall was fully off. Reported by SAGE
1516 shadow variables when autocall was fully off. Reported by SAGE
1506 author William Stein.
1517 author William Stein.
1507
1518
1508 * IPython/OInspect.py (Inspector.__init__): add a flag to control
1519 * IPython/OInspect.py (Inspector.__init__): add a flag to control
1509 at what detail level strings are computed when foo? is requested.
1520 at what detail level strings are computed when foo? is requested.
1510 This allows users to ask for example that the string form of an
1521 This allows users to ask for example that the string form of an
1511 object is only computed when foo?? is called, or even never, by
1522 object is only computed when foo?? is called, or even never, by
1512 setting the object_info_string_level >= 2 in the configuration
1523 setting the object_info_string_level >= 2 in the configuration
1513 file. This new option has been added and documented. After a
1524 file. This new option has been added and documented. After a
1514 request by SAGE to be able to control the printing of very large
1525 request by SAGE to be able to control the printing of very large
1515 objects more easily.
1526 objects more easily.
1516
1527
1517 2006-05-25 Fernando Perez <Fernando.Perez@colorado.edu>
1528 2006-05-25 Fernando Perez <Fernando.Perez@colorado.edu>
1518
1529
1519 * IPython/ipmaker.py (make_IPython): remove the ipython call path
1530 * IPython/ipmaker.py (make_IPython): remove the ipython call path
1520 from sys.argv, to be 100% consistent with how Python itself works
1531 from sys.argv, to be 100% consistent with how Python itself works
1521 (as seen for example with python -i file.py). After a bug report
1532 (as seen for example with python -i file.py). After a bug report
1522 by Jeffrey Collins.
1533 by Jeffrey Collins.
1523
1534
1524 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix
1535 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix
1525 nasty bug which was preventing custom namespaces with -pylab,
1536 nasty bug which was preventing custom namespaces with -pylab,
1526 reported by M. Foord. Minor cleanup, remove old matplotlib.matlab
1537 reported by M. Foord. Minor cleanup, remove old matplotlib.matlab
1527 compatibility (long gone from mpl).
1538 compatibility (long gone from mpl).
1528
1539
1529 * IPython/ipapi.py (make_session): name change: create->make. We
1540 * IPython/ipapi.py (make_session): name change: create->make. We
1530 use make in other places (ipmaker,...), it's shorter and easier to
1541 use make in other places (ipmaker,...), it's shorter and easier to
1531 type and say, etc. I'm trying to clean things before 0.7.2 so
1542 type and say, etc. I'm trying to clean things before 0.7.2 so
1532 that I can keep things stable wrt to ipapi in the chainsaw branch.
1543 that I can keep things stable wrt to ipapi in the chainsaw branch.
1533
1544
1534 * ipython.el: fix the py-pdbtrack-input-prompt variable so that
1545 * ipython.el: fix the py-pdbtrack-input-prompt variable so that
1535 python-mode recognizes our debugger mode. Add support for
1546 python-mode recognizes our debugger mode. Add support for
1536 autoindent inside (X)emacs. After a patch sent in by Jin Liu
1547 autoindent inside (X)emacs. After a patch sent in by Jin Liu
1537 <m.liu.jin-AT-gmail.com> originally written by
1548 <m.liu.jin-AT-gmail.com> originally written by
1538 doxgen-AT-newsmth.net (with minor modifications for xemacs
1549 doxgen-AT-newsmth.net (with minor modifications for xemacs
1539 compatibility)
1550 compatibility)
1540
1551
1541 * IPython/Debugger.py (Pdb.format_stack_entry): fix formatting of
1552 * IPython/Debugger.py (Pdb.format_stack_entry): fix formatting of
1542 tracebacks when walking the stack so that the stack tracking system
1553 tracebacks when walking the stack so that the stack tracking system
1543 in emacs' python-mode can identify the frames correctly.
1554 in emacs' python-mode can identify the frames correctly.
1544
1555
1545 * IPython/ipmaker.py (make_IPython): make the internal (and
1556 * IPython/ipmaker.py (make_IPython): make the internal (and
1546 default config) autoedit_syntax value false by default. Too many
1557 default config) autoedit_syntax value false by default. Too many
1547 users have complained to me (both on and off-list) about problems
1558 users have complained to me (both on and off-list) about problems
1548 with this option being on by default, so I'm making it default to
1559 with this option being on by default, so I'm making it default to
1549 off. It can still be enabled by anyone via the usual mechanisms.
1560 off. It can still be enabled by anyone via the usual mechanisms.
1550
1561
1551 * IPython/completer.py (Completer.attr_matches): add support for
1562 * IPython/completer.py (Completer.attr_matches): add support for
1552 PyCrust-style _getAttributeNames magic method. Patch contributed
1563 PyCrust-style _getAttributeNames magic method. Patch contributed
1553 by <mscott-AT-goldenspud.com>. Closes #50.
1564 by <mscott-AT-goldenspud.com>. Closes #50.
1554
1565
1555 * IPython/iplib.py (InteractiveShell.__init__): remove the
1566 * IPython/iplib.py (InteractiveShell.__init__): remove the
1556 deletion of exit/quit from __builtin__, which can break
1567 deletion of exit/quit from __builtin__, which can break
1557 third-party tools like the Zope debugging console. The
1568 third-party tools like the Zope debugging console. The
1558 %exit/%quit magics remain. In general, it's probably a good idea
1569 %exit/%quit magics remain. In general, it's probably a good idea
1559 not to delete anything from __builtin__, since we never know what
1570 not to delete anything from __builtin__, since we never know what
1560 that will break. In any case, python now (for 2.5) will support
1571 that will break. In any case, python now (for 2.5) will support
1561 'real' exit/quit, so this issue is moot. Closes #55.
1572 'real' exit/quit, so this issue is moot. Closes #55.
1562
1573
1563 * IPython/genutils.py (with_obj): rename the 'with' function to
1574 * IPython/genutils.py (with_obj): rename the 'with' function to
1564 'withobj' to avoid incompatibilities with Python 2.5, where 'with'
1575 'withobj' to avoid incompatibilities with Python 2.5, where 'with'
1565 becomes a language keyword. Closes #53.
1576 becomes a language keyword. Closes #53.
1566
1577
1567 * IPython/FakeModule.py (FakeModule.__init__): add a proper
1578 * IPython/FakeModule.py (FakeModule.__init__): add a proper
1568 __file__ attribute to this so it fools more things into thinking
1579 __file__ attribute to this so it fools more things into thinking
1569 it is a real module. Closes #59.
1580 it is a real module. Closes #59.
1570
1581
1571 * IPython/Magic.py (magic_edit): add -n option to open the editor
1582 * IPython/Magic.py (magic_edit): add -n option to open the editor
1572 at a specific line number. After a patch by Stefan van der Walt.
1583 at a specific line number. After a patch by Stefan van der Walt.
1573
1584
1574 2006-05-23 Fernando Perez <Fernando.Perez@colorado.edu>
1585 2006-05-23 Fernando Perez <Fernando.Perez@colorado.edu>
1575
1586
1576 * IPython/iplib.py (edit_syntax_error): fix crash when for some
1587 * IPython/iplib.py (edit_syntax_error): fix crash when for some
1577 reason the file could not be opened. After automatic crash
1588 reason the file could not be opened. After automatic crash
1578 reports sent by James Graham <jgraham-AT-ast.cam.ac.uk> and
1589 reports sent by James Graham <jgraham-AT-ast.cam.ac.uk> and
1579 Charles Dolan <charlespatrickdolan-AT-yahoo.com>.
1590 Charles Dolan <charlespatrickdolan-AT-yahoo.com>.
1580 (_should_recompile): Don't fire editor if using %bg, since there
1591 (_should_recompile): Don't fire editor if using %bg, since there
1581 is no file in the first place. From the same report as above.
1592 is no file in the first place. From the same report as above.
1582 (raw_input): protect against faulty third-party prefilters. After
1593 (raw_input): protect against faulty third-party prefilters. After
1583 an automatic crash report sent by Dirk Laurie <dirk-AT-sun.ac.za>
1594 an automatic crash report sent by Dirk Laurie <dirk-AT-sun.ac.za>
1584 while running under SAGE.
1595 while running under SAGE.
1585
1596
1586 2006-05-23 Ville Vainio <vivainio@gmail.com>
1597 2006-05-23 Ville Vainio <vivainio@gmail.com>
1587
1598
1588 * ipapi.py: Stripped down ip.to_user_ns() to work only as
1599 * ipapi.py: Stripped down ip.to_user_ns() to work only as
1589 ip.to_user_ns("x1 y1"), which exposes vars x1 and y1. ipapi.get()
1600 ip.to_user_ns("x1 y1"), which exposes vars x1 and y1. ipapi.get()
1590 now returns None (again), unless dummy is specifically allowed by
1601 now returns None (again), unless dummy is specifically allowed by
1591 ipapi.get(allow_dummy=True).
1602 ipapi.get(allow_dummy=True).
1592
1603
1593 2006-05-18 Fernando Perez <Fernando.Perez@colorado.edu>
1604 2006-05-18 Fernando Perez <Fernando.Perez@colorado.edu>
1594
1605
1595 * IPython: remove all 2.2-compatibility objects and hacks from
1606 * IPython: remove all 2.2-compatibility objects and hacks from
1596 everywhere, since we only support 2.3 at this point. Docs
1607 everywhere, since we only support 2.3 at this point. Docs
1597 updated.
1608 updated.
1598
1609
1599 * IPython/ipapi.py (IPApi.__init__): Cleanup of all getters.
1610 * IPython/ipapi.py (IPApi.__init__): Cleanup of all getters.
1600 Anything requiring extra validation can be turned into a Python
1611 Anything requiring extra validation can be turned into a Python
1601 property in the future. I used a property for the db one b/c
1612 property in the future. I used a property for the db one b/c
1602 there was a nasty circularity problem with the initialization
1613 there was a nasty circularity problem with the initialization
1603 order, which right now I don't have time to clean up.
1614 order, which right now I don't have time to clean up.
1604
1615
1605 * IPython/Shell.py (MTInteractiveShell.runcode): Fix, I think,
1616 * IPython/Shell.py (MTInteractiveShell.runcode): Fix, I think,
1606 another locking bug reported by Jorgen. I'm not 100% sure though,
1617 another locking bug reported by Jorgen. I'm not 100% sure though,
1607 so more testing is needed...
1618 so more testing is needed...
1608
1619
1609 2006-05-17 Fernando Perez <Fernando.Perez@colorado.edu>
1620 2006-05-17 Fernando Perez <Fernando.Perez@colorado.edu>
1610
1621
1611 * IPython/ipapi.py (IPApi.to_user_ns): New function to inject
1622 * IPython/ipapi.py (IPApi.to_user_ns): New function to inject
1612 local variables from any routine in user code (typically executed
1623 local variables from any routine in user code (typically executed
1613 with %run) directly into the interactive namespace. Very useful
1624 with %run) directly into the interactive namespace. Very useful
1614 when doing complex debugging.
1625 when doing complex debugging.
1615 (IPythonNotRunning): Changed the default None object to a dummy
1626 (IPythonNotRunning): Changed the default None object to a dummy
1616 whose attributes can be queried as well as called without
1627 whose attributes can be queried as well as called without
1617 exploding, to ease writing code which works transparently both in
1628 exploding, to ease writing code which works transparently both in
1618 and out of ipython and uses some of this API.
1629 and out of ipython and uses some of this API.
1619
1630
1620 2006-05-16 Fernando Perez <Fernando.Perez@colorado.edu>
1631 2006-05-16 Fernando Perez <Fernando.Perez@colorado.edu>
1621
1632
1622 * IPython/hooks.py (result_display): Fix the fact that our display
1633 * IPython/hooks.py (result_display): Fix the fact that our display
1623 hook was using str() instead of repr(), as the default python
1634 hook was using str() instead of repr(), as the default python
1624 console does. This had gone unnoticed b/c it only happened if
1635 console does. This had gone unnoticed b/c it only happened if
1625 %Pprint was off, but the inconsistency was there.
1636 %Pprint was off, but the inconsistency was there.
1626
1637
1627 2006-05-15 Ville Vainio <vivainio@gmail.com>
1638 2006-05-15 Ville Vainio <vivainio@gmail.com>
1628
1639
1629 * Oinspect.py: Only show docstring for nonexisting/binary files
1640 * Oinspect.py: Only show docstring for nonexisting/binary files
1630 when doing object??, closing ticket #62
1641 when doing object??, closing ticket #62
1631
1642
1632 2006-05-13 Fernando Perez <Fernando.Perez@colorado.edu>
1643 2006-05-13 Fernando Perez <Fernando.Perez@colorado.edu>
1633
1644
1634 * IPython/Shell.py (MTInteractiveShell.runsource): Fix threading
1645 * IPython/Shell.py (MTInteractiveShell.runsource): Fix threading
1635 bug, closes http://www.scipy.net/roundup/ipython/issue55. A lock
1646 bug, closes http://www.scipy.net/roundup/ipython/issue55. A lock
1636 was being released in a routine which hadn't checked if it had
1647 was being released in a routine which hadn't checked if it had
1637 been the one to acquire it.
1648 been the one to acquire it.
1638
1649
1639 2006-05-07 Fernando Perez <Fernando.Perez@colorado.edu>
1650 2006-05-07 Fernando Perez <Fernando.Perez@colorado.edu>
1640
1651
1641 * IPython/Release.py (version): put out 0.7.2.rc1 for testing.
1652 * IPython/Release.py (version): put out 0.7.2.rc1 for testing.
1642
1653
1643 2006-04-11 Ville Vainio <vivainio@gmail.com>
1654 2006-04-11 Ville Vainio <vivainio@gmail.com>
1644
1655
1645 * iplib.py, ipmaker.py: .ipy extension now means "ipython batch file"
1656 * iplib.py, ipmaker.py: .ipy extension now means "ipython batch file"
1646 in command line. E.g. "ipython test.ipy" runs test.ipy with ipython
1657 in command line. E.g. "ipython test.ipy" runs test.ipy with ipython
1647 prefilters, allowing stuff like magics and aliases in the file.
1658 prefilters, allowing stuff like magics and aliases in the file.
1648
1659
1649 * Prompts.py, Extensions/clearcmd.py, ipy_system_conf.py: %clear magic
1660 * Prompts.py, Extensions/clearcmd.py, ipy_system_conf.py: %clear magic
1650 added. Supported now are "%clear in" and "%clear out" (clear input and
1661 added. Supported now are "%clear in" and "%clear out" (clear input and
1651 output history, respectively). Also fixed CachedOutput.flush to
1662 output history, respectively). Also fixed CachedOutput.flush to
1652 properly flush the output cache.
1663 properly flush the output cache.
1653
1664
1654 * Extensions/pspersistence.py: Fix %store to avoid "%store obj.attr"
1665 * Extensions/pspersistence.py: Fix %store to avoid "%store obj.attr"
1655 half-success (and fail explicitly).
1666 half-success (and fail explicitly).
1656
1667
1657 2006-03-28 Ville Vainio <vivainio@gmail.com>
1668 2006-03-28 Ville Vainio <vivainio@gmail.com>
1658
1669
1659 * iplib.py: Fix quoting of aliases so that only argless ones
1670 * iplib.py: Fix quoting of aliases so that only argless ones
1660 are quoted
1671 are quoted
1661
1672
1662 2006-03-28 Ville Vainio <vivainio@gmail.com>
1673 2006-03-28 Ville Vainio <vivainio@gmail.com>
1663
1674
1664 * iplib.py: Quote aliases with spaces in the name.
1675 * iplib.py: Quote aliases with spaces in the name.
1665 "c:\program files\blah\bin" is now legal alias target.
1676 "c:\program files\blah\bin" is now legal alias target.
1666
1677
1667 * ext_rehashdir.py: Space no longer allowed as arg
1678 * ext_rehashdir.py: Space no longer allowed as arg
1668 separator, since space is legal in path names.
1679 separator, since space is legal in path names.
1669
1680
1670 2006-03-16 Ville Vainio <vivainio@gmail.com>
1681 2006-03-16 Ville Vainio <vivainio@gmail.com>
1671
1682
1672 * upgrade_dir.py: Take path.py from Extensions, correcting
1683 * upgrade_dir.py: Take path.py from Extensions, correcting
1673 %upgrade magic
1684 %upgrade magic
1674
1685
1675 * ipmaker.py: Suggest using %upgrade if ipy_user_conf.py isn't found.
1686 * ipmaker.py: Suggest using %upgrade if ipy_user_conf.py isn't found.
1676
1687
1677 * hooks.py: Only enclose editor binary in quotes if legal and
1688 * hooks.py: Only enclose editor binary in quotes if legal and
1678 necessary (space in the name, and is an existing file). Fixes a bug
1689 necessary (space in the name, and is an existing file). Fixes a bug
1679 reported by Zachary Pincus.
1690 reported by Zachary Pincus.
1680
1691
1681 2006-03-13 Fernando Perez <Fernando.Perez@colorado.edu>
1692 2006-03-13 Fernando Perez <Fernando.Perez@colorado.edu>
1682
1693
1683 * Manual: thanks to a tip on proper color handling for Emacs, by
1694 * Manual: thanks to a tip on proper color handling for Emacs, by
1684 Eric J Haywiser <ejh1-AT-MIT.EDU>.
1695 Eric J Haywiser <ejh1-AT-MIT.EDU>.
1685
1696
1686 * ipython.el: close http://www.scipy.net/roundup/ipython/issue57
1697 * ipython.el: close http://www.scipy.net/roundup/ipython/issue57
1687 by applying the provided patch. Thanks to Liu Jin
1698 by applying the provided patch. Thanks to Liu Jin
1688 <m.liu.jin-AT-gmail.com> for the contribution. No problems under
1699 <m.liu.jin-AT-gmail.com> for the contribution. No problems under
1689 XEmacs/Linux, I'm trusting the submitter that it actually helps
1700 XEmacs/Linux, I'm trusting the submitter that it actually helps
1690 under win32/GNU Emacs. Will revisit if any problems are reported.
1701 under win32/GNU Emacs. Will revisit if any problems are reported.
1691
1702
1692 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
1703 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
1693
1704
1694 * IPython/Gnuplot2.py (_FileClass): update for current Gnuplot.py
1705 * IPython/Gnuplot2.py (_FileClass): update for current Gnuplot.py
1695 from SVN, thanks to a patch by Ryan Woodard <rywo@bas.ac.uk>.
1706 from SVN, thanks to a patch by Ryan Woodard <rywo@bas.ac.uk>.
1696
1707
1697 2006-03-12 Ville Vainio <vivainio@gmail.com>
1708 2006-03-12 Ville Vainio <vivainio@gmail.com>
1698
1709
1699 * Magic.py (magic_timeit): Added %timeit magic, contributed by
1710 * Magic.py (magic_timeit): Added %timeit magic, contributed by
1700 Torsten Marek.
1711 Torsten Marek.
1701
1712
1702 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
1713 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
1703
1714
1704 * IPython/Magic.py (magic_macro): fix so that the n1-n2 syntax for
1715 * IPython/Magic.py (magic_macro): fix so that the n1-n2 syntax for
1705 line ranges works again.
1716 line ranges works again.
1706
1717
1707 2006-03-11 Fernando Perez <Fernando.Perez@colorado.edu>
1718 2006-03-11 Fernando Perez <Fernando.Perez@colorado.edu>
1708
1719
1709 * IPython/iplib.py (showtraceback): add back sys.last_traceback
1720 * IPython/iplib.py (showtraceback): add back sys.last_traceback
1710 and friends, after a discussion with Zach Pincus on ipython-user.
1721 and friends, after a discussion with Zach Pincus on ipython-user.
1711 I'm not 100% sure, but after thinking about it quite a bit, it may
1722 I'm not 100% sure, but after thinking about it quite a bit, it may
1712 be OK. Testing with the multithreaded shells didn't reveal any
1723 be OK. Testing with the multithreaded shells didn't reveal any
1713 problems, but let's keep an eye out.
1724 problems, but let's keep an eye out.
1714
1725
1715 In the process, I fixed a few things which were calling
1726 In the process, I fixed a few things which were calling
1716 self.InteractiveTB() directly (like safe_execfile), which is a
1727 self.InteractiveTB() directly (like safe_execfile), which is a
1717 mistake: ALL exception reporting should be done by calling
1728 mistake: ALL exception reporting should be done by calling
1718 self.showtraceback(), which handles state and tab-completion and
1729 self.showtraceback(), which handles state and tab-completion and
1719 more.
1730 more.
1720
1731
1721 2006-03-01 Ville Vainio <vivainio@gmail.com>
1732 2006-03-01 Ville Vainio <vivainio@gmail.com>
1722
1733
1723 * Extensions/ipipe.py: Added Walter Doerwald's "ipipe" module.
1734 * Extensions/ipipe.py: Added Walter Doerwald's "ipipe" module.
1724 To use, do "from ipipe import *".
1735 To use, do "from ipipe import *".
1725
1736
1726 2006-02-24 Ville Vainio <vivainio@gmail.com>
1737 2006-02-24 Ville Vainio <vivainio@gmail.com>
1727
1738
1728 * Magic.py, upgrade_dir.py: %upgrade magic added. Does things more
1739 * Magic.py, upgrade_dir.py: %upgrade magic added. Does things more
1729 "cleanly" and safely than the older upgrade mechanism.
1740 "cleanly" and safely than the older upgrade mechanism.
1730
1741
1731 2006-02-21 Ville Vainio <vivainio@gmail.com>
1742 2006-02-21 Ville Vainio <vivainio@gmail.com>
1732
1743
1733 * Magic.py: %save works again.
1744 * Magic.py: %save works again.
1734
1745
1735 2006-02-15 Ville Vainio <vivainio@gmail.com>
1746 2006-02-15 Ville Vainio <vivainio@gmail.com>
1736
1747
1737 * Magic.py: %Pprint works again
1748 * Magic.py: %Pprint works again
1738
1749
1739 * Extensions/ipy_sane_defaults.py: Provide everything provided
1750 * Extensions/ipy_sane_defaults.py: Provide everything provided
1740 in default ipythonrc, to make it possible to have a completely empty
1751 in default ipythonrc, to make it possible to have a completely empty
1741 ipythonrc (and thus completely rc-file free configuration)
1752 ipythonrc (and thus completely rc-file free configuration)
1742
1753
1743 2006-02-11 Fernando Perez <Fernando.Perez@colorado.edu>
1754 2006-02-11 Fernando Perez <Fernando.Perez@colorado.edu>
1744
1755
1745 * IPython/hooks.py (editor): quote the call to the editor command,
1756 * IPython/hooks.py (editor): quote the call to the editor command,
1746 to allow commands with spaces in them. Problem noted by watching
1757 to allow commands with spaces in them. Problem noted by watching
1747 Ian Oswald's video about textpad under win32 at
1758 Ian Oswald's video about textpad under win32 at
1748 http://showmedo.com/videoListPage?listKey=PythonIPythonSeries
1759 http://showmedo.com/videoListPage?listKey=PythonIPythonSeries
1749
1760
1750 * IPython/UserConfig/ipythonrc: Replace @ signs with % when
1761 * IPython/UserConfig/ipythonrc: Replace @ signs with % when
1751 describing magics (we haven't used @ for a loong time).
1762 describing magics (we haven't used @ for a loong time).
1752
1763
1753 * IPython/ultraTB.py (VerboseTB.text.text_repr): Added patch
1764 * IPython/ultraTB.py (VerboseTB.text.text_repr): Added patch
1754 contributed by marienz to close
1765 contributed by marienz to close
1755 http://www.scipy.net/roundup/ipython/issue53.
1766 http://www.scipy.net/roundup/ipython/issue53.
1756
1767
1757 2006-02-10 Ville Vainio <vivainio@gmail.com>
1768 2006-02-10 Ville Vainio <vivainio@gmail.com>
1758
1769
1759 * genutils.py: getoutput now works in win32 too
1770 * genutils.py: getoutput now works in win32 too
1760
1771
1761 * completer.py: alias and magic completion only invoked
1772 * completer.py: alias and magic completion only invoked
1762 at the first "item" in the line, to avoid "cd %store"
1773 at the first "item" in the line, to avoid "cd %store"
1763 nonsense.
1774 nonsense.
1764
1775
1765 2006-02-09 Ville Vainio <vivainio@gmail.com>
1776 2006-02-09 Ville Vainio <vivainio@gmail.com>
1766
1777
1767 * test/*: Added a unit testing framework (finally).
1778 * test/*: Added a unit testing framework (finally).
1768 '%run runtests.py' to run test_*.
1779 '%run runtests.py' to run test_*.
1769
1780
1770 * ipapi.py: Exposed runlines and set_custom_exc
1781 * ipapi.py: Exposed runlines and set_custom_exc
1771
1782
1772 2006-02-07 Ville Vainio <vivainio@gmail.com>
1783 2006-02-07 Ville Vainio <vivainio@gmail.com>
1773
1784
1774 * iplib.py: don't split "f 1 2" to "f(1,2)" in autocall,
1785 * iplib.py: don't split "f 1 2" to "f(1,2)" in autocall,
1775 instead use "f(1 2)" as before.
1786 instead use "f(1 2)" as before.
1776
1787
1777 2006-02-05 Fernando Perez <Fernando.Perez@colorado.edu>
1788 2006-02-05 Fernando Perez <Fernando.Perez@colorado.edu>
1778
1789
1779 * IPython/demo.py (IPythonDemo): Add new classes to the demo
1790 * IPython/demo.py (IPythonDemo): Add new classes to the demo
1780 facilities, for demos processed by the IPython input filter
1791 facilities, for demos processed by the IPython input filter
1781 (IPythonDemo), and for running a script one-line-at-a-time as a
1792 (IPythonDemo), and for running a script one-line-at-a-time as a
1782 demo, both for pure Python (LineDemo) and for IPython-processed
1793 demo, both for pure Python (LineDemo) and for IPython-processed
1783 input (IPythonLineDemo). After a request by Dave Kohel, from the
1794 input (IPythonLineDemo). After a request by Dave Kohel, from the
1784 SAGE team.
1795 SAGE team.
1785 (Demo.edit): added an edit() method to the demo objects, to edit
1796 (Demo.edit): added an edit() method to the demo objects, to edit
1786 the in-memory copy of the last executed block.
1797 the in-memory copy of the last executed block.
1787
1798
1788 * IPython/Magic.py (magic_edit): add '-r' option for 'raw'
1799 * IPython/Magic.py (magic_edit): add '-r' option for 'raw'
1789 processing to %edit, %macro and %save. These commands can now be
1800 processing to %edit, %macro and %save. These commands can now be
1790 invoked on the unprocessed input as it was typed by the user
1801 invoked on the unprocessed input as it was typed by the user
1791 (without any prefilters applied). After requests by the SAGE team
1802 (without any prefilters applied). After requests by the SAGE team
1792 at SAGE days 2006: http://modular.ucsd.edu/sage/days1/schedule.html.
1803 at SAGE days 2006: http://modular.ucsd.edu/sage/days1/schedule.html.
1793
1804
1794 2006-02-01 Ville Vainio <vivainio@gmail.com>
1805 2006-02-01 Ville Vainio <vivainio@gmail.com>
1795
1806
1796 * setup.py, eggsetup.py: easy_install ipython==dev works
1807 * setup.py, eggsetup.py: easy_install ipython==dev works
1797 correctly now (on Linux)
1808 correctly now (on Linux)
1798
1809
1799 * ipy_user_conf,ipmaker: user config changes, removed spurious
1810 * ipy_user_conf,ipmaker: user config changes, removed spurious
1800 warnings
1811 warnings
1801
1812
1802 * iplib: if rc.banner is string, use it as is.
1813 * iplib: if rc.banner is string, use it as is.
1803
1814
1804 * Magic: %pycat accepts a string argument and pages it's contents.
1815 * Magic: %pycat accepts a string argument and pages it's contents.
1805
1816
1806
1817
1807 2006-01-30 Ville Vainio <vivainio@gmail.com>
1818 2006-01-30 Ville Vainio <vivainio@gmail.com>
1808
1819
1809 * pickleshare,pspersistence,ipapi,Magic: persistence overhaul.
1820 * pickleshare,pspersistence,ipapi,Magic: persistence overhaul.
1810 Now %store and bookmarks work through PickleShare, meaning that
1821 Now %store and bookmarks work through PickleShare, meaning that
1811 concurrent access is possible and all ipython sessions see the
1822 concurrent access is possible and all ipython sessions see the
1812 same database situation all the time, instead of snapshot of
1823 same database situation all the time, instead of snapshot of
1813 the situation when the session was started. Hence, %bookmark
1824 the situation when the session was started. Hence, %bookmark
1814 results are immediately accessible from othes sessions. The database
1825 results are immediately accessible from othes sessions. The database
1815 is also available for use by user extensions. See:
1826 is also available for use by user extensions. See:
1816 http://www.python.org/pypi/pickleshare
1827 http://www.python.org/pypi/pickleshare
1817
1828
1818 * hooks.py: Two new hooks, 'shutdown_hook' and 'late_startup_hook'.
1829 * hooks.py: Two new hooks, 'shutdown_hook' and 'late_startup_hook'.
1819
1830
1820 * aliases can now be %store'd
1831 * aliases can now be %store'd
1821
1832
1822 * path.py moved to Extensions so that pickleshare does not need
1833 * path.py moved to Extensions so that pickleshare does not need
1823 IPython-specific import. Extensions added to pythonpath right
1834 IPython-specific import. Extensions added to pythonpath right
1824 at __init__.
1835 at __init__.
1825
1836
1826 * iplib.py: ipalias deprecated/redundant; aliases are converted and
1837 * iplib.py: ipalias deprecated/redundant; aliases are converted and
1827 called with _ip.system and the pre-transformed command string.
1838 called with _ip.system and the pre-transformed command string.
1828
1839
1829 2006-01-29 Fernando Perez <Fernando.Perez@colorado.edu>
1840 2006-01-29 Fernando Perez <Fernando.Perez@colorado.edu>
1830
1841
1831 * IPython/iplib.py (interact): Fix that we were not catching
1842 * IPython/iplib.py (interact): Fix that we were not catching
1832 KeyboardInterrupt exceptions properly. I'm not quite sure why the
1843 KeyboardInterrupt exceptions properly. I'm not quite sure why the
1833 logic here had to change, but it's fixed now.
1844 logic here had to change, but it's fixed now.
1834
1845
1835 2006-01-29 Ville Vainio <vivainio@gmail.com>
1846 2006-01-29 Ville Vainio <vivainio@gmail.com>
1836
1847
1837 * iplib.py: Try to import pyreadline on Windows.
1848 * iplib.py: Try to import pyreadline on Windows.
1838
1849
1839 2006-01-27 Ville Vainio <vivainio@gmail.com>
1850 2006-01-27 Ville Vainio <vivainio@gmail.com>
1840
1851
1841 * iplib.py: Expose ipapi as _ip in builtin namespace.
1852 * iplib.py: Expose ipapi as _ip in builtin namespace.
1842 Makes ipmagic (-> _ip.magic), ipsystem (-> _ip.system)
1853 Makes ipmagic (-> _ip.magic), ipsystem (-> _ip.system)
1843 and ip_set_hook (-> _ip.set_hook) redundant. % and !
1854 and ip_set_hook (-> _ip.set_hook) redundant. % and !
1844 syntax now produce _ip.* variant of the commands.
1855 syntax now produce _ip.* variant of the commands.
1845
1856
1846 * "_ip.options().autoedit_syntax = 2" automatically throws
1857 * "_ip.options().autoedit_syntax = 2" automatically throws
1847 user to editor for syntax error correction without prompting.
1858 user to editor for syntax error correction without prompting.
1848
1859
1849 2006-01-27 Ville Vainio <vivainio@gmail.com>
1860 2006-01-27 Ville Vainio <vivainio@gmail.com>
1850
1861
1851 * ipmaker.py: Give "realistic" sys.argv for scripts (without
1862 * ipmaker.py: Give "realistic" sys.argv for scripts (without
1852 'ipython' at argv[0]) executed through command line.
1863 'ipython' at argv[0]) executed through command line.
1853 NOTE: this DEPRECATES calling ipython with multiple scripts
1864 NOTE: this DEPRECATES calling ipython with multiple scripts
1854 ("ipython a.py b.py c.py")
1865 ("ipython a.py b.py c.py")
1855
1866
1856 * iplib.py, hooks.py: Added configurable input prefilter,
1867 * iplib.py, hooks.py: Added configurable input prefilter,
1857 named 'input_prefilter'. See ext_rescapture.py for example
1868 named 'input_prefilter'. See ext_rescapture.py for example
1858 usage.
1869 usage.
1859
1870
1860 * ext_rescapture.py, Magic.py: Better system command output capture
1871 * ext_rescapture.py, Magic.py: Better system command output capture
1861 through 'var = !ls' (deprecates user-visible %sc). Same notation
1872 through 'var = !ls' (deprecates user-visible %sc). Same notation
1862 applies for magics, 'var = %alias' assigns alias list to var.
1873 applies for magics, 'var = %alias' assigns alias list to var.
1863
1874
1864 * ipapi.py: added meta() for accessing extension-usable data store.
1875 * ipapi.py: added meta() for accessing extension-usable data store.
1865
1876
1866 * iplib.py: added InteractiveShell.getapi(). New magics should be
1877 * iplib.py: added InteractiveShell.getapi(). New magics should be
1867 written doing self.getapi() instead of using the shell directly.
1878 written doing self.getapi() instead of using the shell directly.
1868
1879
1869 * Magic.py: %store now allows doing %store foo > ~/myfoo.txt and
1880 * Magic.py: %store now allows doing %store foo > ~/myfoo.txt and
1870 %store foo >> ~/myfoo.txt to store variables to files (in clean
1881 %store foo >> ~/myfoo.txt to store variables to files (in clean
1871 textual form, not a restorable pickle).
1882 textual form, not a restorable pickle).
1872
1883
1873 * ipmaker.py: now import ipy_profile_PROFILENAME automatically
1884 * ipmaker.py: now import ipy_profile_PROFILENAME automatically
1874
1885
1875 * usage.py, Magic.py: added %quickref
1886 * usage.py, Magic.py: added %quickref
1876
1887
1877 * iplib.py: ESC_PAREN fixes: /f 1 2 -> f(1,2), not f(1 2).
1888 * iplib.py: ESC_PAREN fixes: /f 1 2 -> f(1,2), not f(1 2).
1878
1889
1879 * GetoptErrors when invoking magics etc. with wrong args
1890 * GetoptErrors when invoking magics etc. with wrong args
1880 are now more helpful:
1891 are now more helpful:
1881 GetoptError: option -l not recognized (allowed: "qb" )
1892 GetoptError: option -l not recognized (allowed: "qb" )
1882
1893
1883 2006-01-25 Fernando Perez <Fernando.Perez@colorado.edu>
1894 2006-01-25 Fernando Perez <Fernando.Perez@colorado.edu>
1884
1895
1885 * IPython/demo.py (Demo.show): Flush stdout after each block, so
1896 * IPython/demo.py (Demo.show): Flush stdout after each block, so
1886 computationally intensive blocks don't appear to stall the demo.
1897 computationally intensive blocks don't appear to stall the demo.
1887
1898
1888 2006-01-24 Ville Vainio <vivainio@gmail.com>
1899 2006-01-24 Ville Vainio <vivainio@gmail.com>
1889
1900
1890 * iplib.py, hooks.py: 'result_display' hook can return a non-None
1901 * iplib.py, hooks.py: 'result_display' hook can return a non-None
1891 value to manipulate resulting history entry.
1902 value to manipulate resulting history entry.
1892
1903
1893 * ipapi.py: Moved TryNext here from hooks.py. Moved functions
1904 * ipapi.py: Moved TryNext here from hooks.py. Moved functions
1894 to instance methods of IPApi class, to make extending an embedded
1905 to instance methods of IPApi class, to make extending an embedded
1895 IPython feasible. See ext_rehashdir.py for example usage.
1906 IPython feasible. See ext_rehashdir.py for example usage.
1896
1907
1897 * Merged 1071-1076 from branches/0.7.1
1908 * Merged 1071-1076 from branches/0.7.1
1898
1909
1899
1910
1900 2006-01-23 Fernando Perez <Fernando.Perez@colorado.edu>
1911 2006-01-23 Fernando Perez <Fernando.Perez@colorado.edu>
1901
1912
1902 * tools/release (daystamp): Fix build tools to use the new
1913 * tools/release (daystamp): Fix build tools to use the new
1903 eggsetup.py script to build lightweight eggs.
1914 eggsetup.py script to build lightweight eggs.
1904
1915
1905 * Applied changesets 1062 and 1064 before 0.7.1 release.
1916 * Applied changesets 1062 and 1064 before 0.7.1 release.
1906
1917
1907 * IPython/Magic.py (magic_history): Add '-r' option to %hist, to
1918 * IPython/Magic.py (magic_history): Add '-r' option to %hist, to
1908 see the raw input history (without conversions like %ls ->
1919 see the raw input history (without conversions like %ls ->
1909 ipmagic("ls")). After a request from W. Stein, SAGE
1920 ipmagic("ls")). After a request from W. Stein, SAGE
1910 (http://modular.ucsd.edu/sage) developer. This information is
1921 (http://modular.ucsd.edu/sage) developer. This information is
1911 stored in the input_hist_raw attribute of the IPython instance, so
1922 stored in the input_hist_raw attribute of the IPython instance, so
1912 developers can access it if needed (it's an InputList instance).
1923 developers can access it if needed (it's an InputList instance).
1913
1924
1914 * Versionstring = 0.7.2.svn
1925 * Versionstring = 0.7.2.svn
1915
1926
1916 * eggsetup.py: A separate script for constructing eggs, creates
1927 * eggsetup.py: A separate script for constructing eggs, creates
1917 proper launch scripts even on Windows (an .exe file in
1928 proper launch scripts even on Windows (an .exe file in
1918 \python24\scripts).
1929 \python24\scripts).
1919
1930
1920 * ipapi.py: launch_new_instance, launch entry point needed for the
1931 * ipapi.py: launch_new_instance, launch entry point needed for the
1921 egg.
1932 egg.
1922
1933
1923 2006-01-23 Ville Vainio <vivainio@gmail.com>
1934 2006-01-23 Ville Vainio <vivainio@gmail.com>
1924
1935
1925 * Added %cpaste magic for pasting python code
1936 * Added %cpaste magic for pasting python code
1926
1937
1927 2006-01-22 Ville Vainio <vivainio@gmail.com>
1938 2006-01-22 Ville Vainio <vivainio@gmail.com>
1928
1939
1929 * Merge from branches/0.7.1 into trunk, revs 1052-1057
1940 * Merge from branches/0.7.1 into trunk, revs 1052-1057
1930
1941
1931 * Versionstring = 0.7.2.svn
1942 * Versionstring = 0.7.2.svn
1932
1943
1933 * eggsetup.py: A separate script for constructing eggs, creates
1944 * eggsetup.py: A separate script for constructing eggs, creates
1934 proper launch scripts even on Windows (an .exe file in
1945 proper launch scripts even on Windows (an .exe file in
1935 \python24\scripts).
1946 \python24\scripts).
1936
1947
1937 * ipapi.py: launch_new_instance, launch entry point needed for the
1948 * ipapi.py: launch_new_instance, launch entry point needed for the
1938 egg.
1949 egg.
1939
1950
1940 2006-01-22 Fernando Perez <Fernando.Perez@colorado.edu>
1951 2006-01-22 Fernando Perez <Fernando.Perez@colorado.edu>
1941
1952
1942 * IPython/OInspect.py (Inspector.pinfo): fix bug where foo?? or
1953 * IPython/OInspect.py (Inspector.pinfo): fix bug where foo?? or
1943 %pfile foo would print the file for foo even if it was a binary.
1954 %pfile foo would print the file for foo even if it was a binary.
1944 Now, extensions '.so' and '.dll' are skipped.
1955 Now, extensions '.so' and '.dll' are skipped.
1945
1956
1946 * IPython/Shell.py (MTInteractiveShell.__init__): Fix threading
1957 * IPython/Shell.py (MTInteractiveShell.__init__): Fix threading
1947 bug, where macros would fail in all threaded modes. I'm not 100%
1958 bug, where macros would fail in all threaded modes. I'm not 100%
1948 sure, so I'm going to put out an rc instead of making a release
1959 sure, so I'm going to put out an rc instead of making a release
1949 today, and wait for feedback for at least a few days.
1960 today, and wait for feedback for at least a few days.
1950
1961
1951 * IPython/iplib.py (handle_normal): fix (finally? somehow I doubt
1962 * IPython/iplib.py (handle_normal): fix (finally? somehow I doubt
1952 it...) the handling of pasting external code with autoindent on.
1963 it...) the handling of pasting external code with autoindent on.
1953 To get out of a multiline input, the rule will appear for most
1964 To get out of a multiline input, the rule will appear for most
1954 users unchanged: two blank lines or change the indent level
1965 users unchanged: two blank lines or change the indent level
1955 proposed by IPython. But there is a twist now: you can
1966 proposed by IPython. But there is a twist now: you can
1956 add/subtract only *one or two spaces*. If you add/subtract three
1967 add/subtract only *one or two spaces*. If you add/subtract three
1957 or more (unless you completely delete the line), IPython will
1968 or more (unless you completely delete the line), IPython will
1958 accept that line, and you'll need to enter a second one of pure
1969 accept that line, and you'll need to enter a second one of pure
1959 whitespace. I know it sounds complicated, but I can't find a
1970 whitespace. I know it sounds complicated, but I can't find a
1960 different solution that covers all the cases, with the right
1971 different solution that covers all the cases, with the right
1961 heuristics. Hopefully in actual use, nobody will really notice
1972 heuristics. Hopefully in actual use, nobody will really notice
1962 all these strange rules and things will 'just work'.
1973 all these strange rules and things will 'just work'.
1963
1974
1964 2006-01-21 Fernando Perez <Fernando.Perez@colorado.edu>
1975 2006-01-21 Fernando Perez <Fernando.Perez@colorado.edu>
1965
1976
1966 * IPython/iplib.py (interact): catch exceptions which can be
1977 * IPython/iplib.py (interact): catch exceptions which can be
1967 triggered asynchronously by signal handlers. Thanks to an
1978 triggered asynchronously by signal handlers. Thanks to an
1968 automatic crash report, submitted by Colin Kingsley
1979 automatic crash report, submitted by Colin Kingsley
1969 <tercel-AT-gentoo.org>.
1980 <tercel-AT-gentoo.org>.
1970
1981
1971 2006-01-20 Ville Vainio <vivainio@gmail.com>
1982 2006-01-20 Ville Vainio <vivainio@gmail.com>
1972
1983
1973 * Ipython/Extensions/ext_rehashdir.py: Created a usable example
1984 * Ipython/Extensions/ext_rehashdir.py: Created a usable example
1974 (%rehashdir, very useful, try it out) of how to extend ipython
1985 (%rehashdir, very useful, try it out) of how to extend ipython
1975 with new magics. Also added Extensions dir to pythonpath to make
1986 with new magics. Also added Extensions dir to pythonpath to make
1976 importing extensions easy.
1987 importing extensions easy.
1977
1988
1978 * %store now complains when trying to store interactively declared
1989 * %store now complains when trying to store interactively declared
1979 classes / instances of those classes.
1990 classes / instances of those classes.
1980
1991
1981 * Extensions/ipy_system_conf.py, UserConfig/ipy_user_conf.py,
1992 * Extensions/ipy_system_conf.py, UserConfig/ipy_user_conf.py,
1982 ipmaker.py: Config rehaul. Now ipy_..._conf.py are always imported
1993 ipmaker.py: Config rehaul. Now ipy_..._conf.py are always imported
1983 if they exist, and ipy_user_conf.py with some defaults is created for
1994 if they exist, and ipy_user_conf.py with some defaults is created for
1984 the user.
1995 the user.
1985
1996
1986 * Startup rehashing done by the config file, not InterpreterExec.
1997 * Startup rehashing done by the config file, not InterpreterExec.
1987 This means system commands are available even without selecting the
1998 This means system commands are available even without selecting the
1988 pysh profile. It's the sensible default after all.
1999 pysh profile. It's the sensible default after all.
1989
2000
1990 2006-01-20 Fernando Perez <Fernando.Perez@colorado.edu>
2001 2006-01-20 Fernando Perez <Fernando.Perez@colorado.edu>
1991
2002
1992 * IPython/iplib.py (raw_input): I _think_ I got the pasting of
2003 * IPython/iplib.py (raw_input): I _think_ I got the pasting of
1993 multiline code with autoindent on working. But I am really not
2004 multiline code with autoindent on working. But I am really not
1994 sure, so this needs more testing. Will commit a debug-enabled
2005 sure, so this needs more testing. Will commit a debug-enabled
1995 version for now, while I test it some more, so that Ville and
2006 version for now, while I test it some more, so that Ville and
1996 others may also catch any problems. Also made
2007 others may also catch any problems. Also made
1997 self.indent_current_str() a method, to ensure that there's no
2008 self.indent_current_str() a method, to ensure that there's no
1998 chance of the indent space count and the corresponding string
2009 chance of the indent space count and the corresponding string
1999 falling out of sync. All code needing the string should just call
2010 falling out of sync. All code needing the string should just call
2000 the method.
2011 the method.
2001
2012
2002 2006-01-18 Fernando Perez <Fernando.Perez@colorado.edu>
2013 2006-01-18 Fernando Perez <Fernando.Perez@colorado.edu>
2003
2014
2004 * IPython/Magic.py (magic_edit): fix check for when users don't
2015 * IPython/Magic.py (magic_edit): fix check for when users don't
2005 save their output files, the try/except was in the wrong section.
2016 save their output files, the try/except was in the wrong section.
2006
2017
2007 2006-01-17 Fernando Perez <Fernando.Perez@colorado.edu>
2018 2006-01-17 Fernando Perez <Fernando.Perez@colorado.edu>
2008
2019
2009 * IPython/Magic.py (magic_run): fix __file__ global missing from
2020 * IPython/Magic.py (magic_run): fix __file__ global missing from
2010 script's namespace when executed via %run. After a report by
2021 script's namespace when executed via %run. After a report by
2011 Vivian.
2022 Vivian.
2012
2023
2013 * IPython/Debugger.py (Pdb.__init__): Fix breakage with '%run -d'
2024 * IPython/Debugger.py (Pdb.__init__): Fix breakage with '%run -d'
2014 when using python 2.4. The parent constructor changed in 2.4, and
2025 when using python 2.4. The parent constructor changed in 2.4, and
2015 we need to track it directly (we can't call it, as it messes up
2026 we need to track it directly (we can't call it, as it messes up
2016 readline and tab-completion inside our pdb would stop working).
2027 readline and tab-completion inside our pdb would stop working).
2017 After a bug report by R. Bernstein <rocky-AT-panix.com>.
2028 After a bug report by R. Bernstein <rocky-AT-panix.com>.
2018
2029
2019 2006-01-16 Ville Vainio <vivainio@gmail.com>
2030 2006-01-16 Ville Vainio <vivainio@gmail.com>
2020
2031
2021 * Ipython/magic.py: Reverted back to old %edit functionality
2032 * Ipython/magic.py: Reverted back to old %edit functionality
2022 that returns file contents on exit.
2033 that returns file contents on exit.
2023
2034
2024 * IPython/path.py: Added Jason Orendorff's "path" module to
2035 * IPython/path.py: Added Jason Orendorff's "path" module to
2025 IPython tree, http://www.jorendorff.com/articles/python/path/.
2036 IPython tree, http://www.jorendorff.com/articles/python/path/.
2026 You can get path objects conveniently through %sc, and !!, e.g.:
2037 You can get path objects conveniently through %sc, and !!, e.g.:
2027 sc files=ls
2038 sc files=ls
2028 for p in files.paths: # or files.p
2039 for p in files.paths: # or files.p
2029 print p,p.mtime
2040 print p,p.mtime
2030
2041
2031 * Ipython/iplib.py:"," and ";" autoquoting-upon-autocall
2042 * Ipython/iplib.py:"," and ";" autoquoting-upon-autocall
2032 now work again without considering the exclusion regexp -
2043 now work again without considering the exclusion regexp -
2033 hence, things like ',foo my/path' turn to 'foo("my/path")'
2044 hence, things like ',foo my/path' turn to 'foo("my/path")'
2034 instead of syntax error.
2045 instead of syntax error.
2035
2046
2036
2047
2037 2006-01-14 Ville Vainio <vivainio@gmail.com>
2048 2006-01-14 Ville Vainio <vivainio@gmail.com>
2038
2049
2039 * IPython/ipapi.py (ashook, asmagic, options): Added convenience
2050 * IPython/ipapi.py (ashook, asmagic, options): Added convenience
2040 ipapi decorators for python 2.4 users, options() provides access to rc
2051 ipapi decorators for python 2.4 users, options() provides access to rc
2041 data.
2052 data.
2042
2053
2043 * IPython/Magic.py (magic_cd): %cd now accepts backslashes
2054 * IPython/Magic.py (magic_cd): %cd now accepts backslashes
2044 as path separators (even on Linux ;-). Space character after
2055 as path separators (even on Linux ;-). Space character after
2045 backslash (as yielded by tab completer) is still space;
2056 backslash (as yielded by tab completer) is still space;
2046 "%cd long\ name" works as expected.
2057 "%cd long\ name" works as expected.
2047
2058
2048 * IPython/ipapi.py,hooks.py,iplib.py: Hooks now implemented
2059 * IPython/ipapi.py,hooks.py,iplib.py: Hooks now implemented
2049 as "chain of command", with priority. API stays the same,
2060 as "chain of command", with priority. API stays the same,
2050 TryNext exception raised by a hook function signals that
2061 TryNext exception raised by a hook function signals that
2051 current hook failed and next hook should try handling it, as
2062 current hook failed and next hook should try handling it, as
2052 suggested by Walter DΓΆrwald <walter@livinglogic.de>. Walter also
2063 suggested by Walter DΓΆrwald <walter@livinglogic.de>. Walter also
2053 requested configurable display hook, which is now implemented.
2064 requested configurable display hook, which is now implemented.
2054
2065
2055 2006-01-13 Ville Vainio <vivainio@gmail.com>
2066 2006-01-13 Ville Vainio <vivainio@gmail.com>
2056
2067
2057 * IPython/platutils*.py: platform specific utility functions,
2068 * IPython/platutils*.py: platform specific utility functions,
2058 so far only set_term_title is implemented (change terminal
2069 so far only set_term_title is implemented (change terminal
2059 label in windowing systems). %cd now changes the title to
2070 label in windowing systems). %cd now changes the title to
2060 current dir.
2071 current dir.
2061
2072
2062 * IPython/Release.py: Added myself to "authors" list,
2073 * IPython/Release.py: Added myself to "authors" list,
2063 had to create new files.
2074 had to create new files.
2064
2075
2065 * IPython/iplib.py (handle_shell_escape): fixed logical flaw in
2076 * IPython/iplib.py (handle_shell_escape): fixed logical flaw in
2066 shell escape; not a known bug but had potential to be one in the
2077 shell escape; not a known bug but had potential to be one in the
2067 future.
2078 future.
2068
2079
2069 * IPython/ipapi.py (added),OInspect.py,iplib.py: "Public"
2080 * IPython/ipapi.py (added),OInspect.py,iplib.py: "Public"
2070 extension API for IPython! See the module for usage example. Fix
2081 extension API for IPython! See the module for usage example. Fix
2071 OInspect for docstring-less magic functions.
2082 OInspect for docstring-less magic functions.
2072
2083
2073
2084
2074 2006-01-13 Fernando Perez <Fernando.Perez@colorado.edu>
2085 2006-01-13 Fernando Perez <Fernando.Perez@colorado.edu>
2075
2086
2076 * IPython/iplib.py (raw_input): temporarily deactivate all
2087 * IPython/iplib.py (raw_input): temporarily deactivate all
2077 attempts at allowing pasting of code with autoindent on. It
2088 attempts at allowing pasting of code with autoindent on. It
2078 introduced bugs (reported by Prabhu) and I can't seem to find a
2089 introduced bugs (reported by Prabhu) and I can't seem to find a
2079 robust combination which works in all cases. Will have to revisit
2090 robust combination which works in all cases. Will have to revisit
2080 later.
2091 later.
2081
2092
2082 * IPython/genutils.py: remove isspace() function. We've dropped
2093 * IPython/genutils.py: remove isspace() function. We've dropped
2083 2.2 compatibility, so it's OK to use the string method.
2094 2.2 compatibility, so it's OK to use the string method.
2084
2095
2085 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
2096 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
2086
2097
2087 * IPython/iplib.py (InteractiveShell.__init__): fix regexp
2098 * IPython/iplib.py (InteractiveShell.__init__): fix regexp
2088 matching what NOT to autocall on, to include all python binary
2099 matching what NOT to autocall on, to include all python binary
2089 operators (including things like 'and', 'or', 'is' and 'in').
2100 operators (including things like 'and', 'or', 'is' and 'in').
2090 Prompted by a bug report on 'foo & bar', but I realized we had
2101 Prompted by a bug report on 'foo & bar', but I realized we had
2091 many more potential bug cases with other operators. The regexp is
2102 many more potential bug cases with other operators. The regexp is
2092 self.re_exclude_auto, it's fairly commented.
2103 self.re_exclude_auto, it's fairly commented.
2093
2104
2094 2006-01-12 Ville Vainio <vivainio@gmail.com>
2105 2006-01-12 Ville Vainio <vivainio@gmail.com>
2095
2106
2096 * IPython/iplib.py (make_quoted_expr,handle_shell_escape):
2107 * IPython/iplib.py (make_quoted_expr,handle_shell_escape):
2097 Prettified and hardened string/backslash quoting with ipsystem(),
2108 Prettified and hardened string/backslash quoting with ipsystem(),
2098 ipalias() and ipmagic(). Now even \ characters are passed to
2109 ipalias() and ipmagic(). Now even \ characters are passed to
2099 %magics, !shell escapes and aliases exactly as they are in the
2110 %magics, !shell escapes and aliases exactly as they are in the
2100 ipython command line. Should improve backslash experience,
2111 ipython command line. Should improve backslash experience,
2101 particularly in Windows (path delimiter for some commands that
2112 particularly in Windows (path delimiter for some commands that
2102 won't understand '/'), but Unix benefits as well (regexps). %cd
2113 won't understand '/'), but Unix benefits as well (regexps). %cd
2103 magic still doesn't support backslash path delimiters, though. Also
2114 magic still doesn't support backslash path delimiters, though. Also
2104 deleted all pretense of supporting multiline command strings in
2115 deleted all pretense of supporting multiline command strings in
2105 !system or %magic commands. Thanks to Jerry McRae for suggestions.
2116 !system or %magic commands. Thanks to Jerry McRae for suggestions.
2106
2117
2107 * doc/build_doc_instructions.txt added. Documentation on how to
2118 * doc/build_doc_instructions.txt added. Documentation on how to
2108 use doc/update_manual.py, added yesterday. Both files contributed
2119 use doc/update_manual.py, added yesterday. Both files contributed
2109 by JΓΆrgen Stenarson <jorgen.stenarson-AT-bostream.nu>. This slates
2120 by JΓΆrgen Stenarson <jorgen.stenarson-AT-bostream.nu>. This slates
2110 doc/*.sh for deprecation at a later date.
2121 doc/*.sh for deprecation at a later date.
2111
2122
2112 * /ipython.py Added ipython.py to root directory for
2123 * /ipython.py Added ipython.py to root directory for
2113 zero-installation (tar xzvf ipython.tgz; cd ipython; python
2124 zero-installation (tar xzvf ipython.tgz; cd ipython; python
2114 ipython.py) and development convenience (no need to keep doing
2125 ipython.py) and development convenience (no need to keep doing
2115 "setup.py install" between changes).
2126 "setup.py install" between changes).
2116
2127
2117 * Made ! and !! shell escapes work (again) in multiline expressions:
2128 * Made ! and !! shell escapes work (again) in multiline expressions:
2118 if 1:
2129 if 1:
2119 !ls
2130 !ls
2120 !!ls
2131 !!ls
2121
2132
2122 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
2133 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
2123
2134
2124 * IPython/ipstruct.py (Struct): Rename IPython.Struct to
2135 * IPython/ipstruct.py (Struct): Rename IPython.Struct to
2125 IPython.ipstruct, to avoid local shadowing of the stdlib 'struct'
2136 IPython.ipstruct, to avoid local shadowing of the stdlib 'struct'
2126 module in case-insensitive installation. Was causing crashes
2137 module in case-insensitive installation. Was causing crashes
2127 under win32. Closes http://www.scipy.net/roundup/ipython/issue49.
2138 under win32. Closes http://www.scipy.net/roundup/ipython/issue49.
2128
2139
2129 * IPython/Magic.py (magic_pycat): Fix pycat, patch by Marien Zwart
2140 * IPython/Magic.py (magic_pycat): Fix pycat, patch by Marien Zwart
2130 <marienz-AT-gentoo.org>, closes
2141 <marienz-AT-gentoo.org>, closes
2131 http://www.scipy.net/roundup/ipython/issue51.
2142 http://www.scipy.net/roundup/ipython/issue51.
2132
2143
2133 2006-01-11 Fernando Perez <Fernando.Perez@colorado.edu>
2144 2006-01-11 Fernando Perez <Fernando.Perez@colorado.edu>
2134
2145
2135 * IPython/Shell.py (IPShellGTK.on_timer): Finally fix the
2146 * IPython/Shell.py (IPShellGTK.on_timer): Finally fix the
2136 problem of excessive CPU usage under *nix and keyboard lag under
2147 problem of excessive CPU usage under *nix and keyboard lag under
2137 win32.
2148 win32.
2138
2149
2139 2006-01-10 *** Released version 0.7.0
2150 2006-01-10 *** Released version 0.7.0
2140
2151
2141 2006-01-10 Fernando Perez <Fernando.Perez@colorado.edu>
2152 2006-01-10 Fernando Perez <Fernando.Perez@colorado.edu>
2142
2153
2143 * IPython/Release.py (revision): tag version number to 0.7.0,
2154 * IPython/Release.py (revision): tag version number to 0.7.0,
2144 ready for release.
2155 ready for release.
2145
2156
2146 * IPython/Magic.py (magic_edit): Add print statement to %edit so
2157 * IPython/Magic.py (magic_edit): Add print statement to %edit so
2147 it informs the user of the name of the temp. file used. This can
2158 it informs the user of the name of the temp. file used. This can
2148 help if you decide later to reuse that same file, so you know
2159 help if you decide later to reuse that same file, so you know
2149 where to copy the info from.
2160 where to copy the info from.
2150
2161
2151 2006-01-09 Fernando Perez <Fernando.Perez@colorado.edu>
2162 2006-01-09 Fernando Perez <Fernando.Perez@colorado.edu>
2152
2163
2153 * setup_bdist_egg.py: little script to build an egg. Added
2164 * setup_bdist_egg.py: little script to build an egg. Added
2154 support in the release tools as well.
2165 support in the release tools as well.
2155
2166
2156 2006-01-08 Fernando Perez <Fernando.Perez@colorado.edu>
2167 2006-01-08 Fernando Perez <Fernando.Perez@colorado.edu>
2157
2168
2158 * IPython/Shell.py (IPShellWX.__init__): add support for WXPython
2169 * IPython/Shell.py (IPShellWX.__init__): add support for WXPython
2159 version selection (new -wxversion command line and ipythonrc
2170 version selection (new -wxversion command line and ipythonrc
2160 parameter). Patch contributed by Arnd Baecker
2171 parameter). Patch contributed by Arnd Baecker
2161 <arnd.baecker-AT-web.de>.
2172 <arnd.baecker-AT-web.de>.
2162
2173
2163 * IPython/iplib.py (embed_mainloop): fix tab-completion in
2174 * IPython/iplib.py (embed_mainloop): fix tab-completion in
2164 embedded instances, for variables defined at the interactive
2175 embedded instances, for variables defined at the interactive
2165 prompt of the embedded ipython. Reported by Arnd.
2176 prompt of the embedded ipython. Reported by Arnd.
2166
2177
2167 * IPython/Magic.py (magic_autocall): Fix %autocall magic. Now
2178 * IPython/Magic.py (magic_autocall): Fix %autocall magic. Now
2168 it can be used as a (stateful) toggle, or with a direct parameter.
2179 it can be used as a (stateful) toggle, or with a direct parameter.
2169
2180
2170 * IPython/ultraTB.py (_fixed_getinnerframes): remove debug assert which
2181 * IPython/ultraTB.py (_fixed_getinnerframes): remove debug assert which
2171 could be triggered in certain cases and cause the traceback
2182 could be triggered in certain cases and cause the traceback
2172 printer not to work.
2183 printer not to work.
2173
2184
2174 2006-01-07 Fernando Perez <Fernando.Perez@colorado.edu>
2185 2006-01-07 Fernando Perez <Fernando.Perez@colorado.edu>
2175
2186
2176 * IPython/iplib.py (_should_recompile): Small fix, closes
2187 * IPython/iplib.py (_should_recompile): Small fix, closes
2177 http://www.scipy.net/roundup/ipython/issue48. Patch by Scott.
2188 http://www.scipy.net/roundup/ipython/issue48. Patch by Scott.
2178
2189
2179 2006-01-04 Fernando Perez <Fernando.Perez@colorado.edu>
2190 2006-01-04 Fernando Perez <Fernando.Perez@colorado.edu>
2180
2191
2181 * IPython/Shell.py (IPShellGTK.mainloop): fix bug in the GTK
2192 * IPython/Shell.py (IPShellGTK.mainloop): fix bug in the GTK
2182 backend for matplotlib (100% cpu utiliziation). Thanks to Charlie
2193 backend for matplotlib (100% cpu utiliziation). Thanks to Charlie
2183 Moad for help with tracking it down.
2194 Moad for help with tracking it down.
2184
2195
2185 * IPython/iplib.py (handle_auto): fix autocall handling for
2196 * IPython/iplib.py (handle_auto): fix autocall handling for
2186 objects which support BOTH __getitem__ and __call__ (so that f [x]
2197 objects which support BOTH __getitem__ and __call__ (so that f [x]
2187 is left alone, instead of becoming f([x]) automatically).
2198 is left alone, instead of becoming f([x]) automatically).
2188
2199
2189 * IPython/Magic.py (magic_cd): fix crash when cd -b was used.
2200 * IPython/Magic.py (magic_cd): fix crash when cd -b was used.
2190 Ville's patch.
2201 Ville's patch.
2191
2202
2192 2006-01-03 Fernando Perez <Fernando.Perez@colorado.edu>
2203 2006-01-03 Fernando Perez <Fernando.Perez@colorado.edu>
2193
2204
2194 * IPython/iplib.py (handle_auto): changed autocall semantics to
2205 * IPython/iplib.py (handle_auto): changed autocall semantics to
2195 include 'smart' mode, where the autocall transformation is NOT
2206 include 'smart' mode, where the autocall transformation is NOT
2196 applied if there are no arguments on the line. This allows you to
2207 applied if there are no arguments on the line. This allows you to
2197 just type 'foo' if foo is a callable to see its internal form,
2208 just type 'foo' if foo is a callable to see its internal form,
2198 instead of having it called with no arguments (typically a
2209 instead of having it called with no arguments (typically a
2199 mistake). The old 'full' autocall still exists: for that, you
2210 mistake). The old 'full' autocall still exists: for that, you
2200 need to set the 'autocall' parameter to 2 in your ipythonrc file.
2211 need to set the 'autocall' parameter to 2 in your ipythonrc file.
2201
2212
2202 * IPython/completer.py (Completer.attr_matches): add
2213 * IPython/completer.py (Completer.attr_matches): add
2203 tab-completion support for Enthoughts' traits. After a report by
2214 tab-completion support for Enthoughts' traits. After a report by
2204 Arnd and a patch by Prabhu.
2215 Arnd and a patch by Prabhu.
2205
2216
2206 2006-01-02 Fernando Perez <Fernando.Perez@colorado.edu>
2217 2006-01-02 Fernando Perez <Fernando.Perez@colorado.edu>
2207
2218
2208 * IPython/ultraTB.py (_fixed_getinnerframes): added Alex
2219 * IPython/ultraTB.py (_fixed_getinnerframes): added Alex
2209 Schmolck's patch to fix inspect.getinnerframes().
2220 Schmolck's patch to fix inspect.getinnerframes().
2210
2221
2211 * IPython/iplib.py (InteractiveShell.__init__): significant fixes
2222 * IPython/iplib.py (InteractiveShell.__init__): significant fixes
2212 for embedded instances, regarding handling of namespaces and items
2223 for embedded instances, regarding handling of namespaces and items
2213 added to the __builtin__ one. Multiple embedded instances and
2224 added to the __builtin__ one. Multiple embedded instances and
2214 recursive embeddings should work better now (though I'm not sure
2225 recursive embeddings should work better now (though I'm not sure
2215 I've got all the corner cases fixed, that code is a bit of a brain
2226 I've got all the corner cases fixed, that code is a bit of a brain
2216 twister).
2227 twister).
2217
2228
2218 * IPython/Magic.py (magic_edit): added support to edit in-memory
2229 * IPython/Magic.py (magic_edit): added support to edit in-memory
2219 macros (automatically creates the necessary temp files). %edit
2230 macros (automatically creates the necessary temp files). %edit
2220 also doesn't return the file contents anymore, it's just noise.
2231 also doesn't return the file contents anymore, it's just noise.
2221
2232
2222 * IPython/completer.py (Completer.attr_matches): revert change to
2233 * IPython/completer.py (Completer.attr_matches): revert change to
2223 complete only on attributes listed in __all__. I realized it
2234 complete only on attributes listed in __all__. I realized it
2224 cripples the tab-completion system as a tool for exploring the
2235 cripples the tab-completion system as a tool for exploring the
2225 internals of unknown libraries (it renders any non-__all__
2236 internals of unknown libraries (it renders any non-__all__
2226 attribute off-limits). I got bit by this when trying to see
2237 attribute off-limits). I got bit by this when trying to see
2227 something inside the dis module.
2238 something inside the dis module.
2228
2239
2229 2005-12-31 Fernando Perez <Fernando.Perez@colorado.edu>
2240 2005-12-31 Fernando Perez <Fernando.Perez@colorado.edu>
2230
2241
2231 * IPython/iplib.py (InteractiveShell.__init__): add .meta
2242 * IPython/iplib.py (InteractiveShell.__init__): add .meta
2232 namespace for users and extension writers to hold data in. This
2243 namespace for users and extension writers to hold data in. This
2233 follows the discussion in
2244 follows the discussion in
2234 http://projects.scipy.org/ipython/ipython/wiki/RefactoringIPython.
2245 http://projects.scipy.org/ipython/ipython/wiki/RefactoringIPython.
2235
2246
2236 * IPython/completer.py (IPCompleter.complete): small patch to help
2247 * IPython/completer.py (IPCompleter.complete): small patch to help
2237 tab-completion under Emacs, after a suggestion by John Barnard
2248 tab-completion under Emacs, after a suggestion by John Barnard
2238 <barnarj-AT-ccf.org>.
2249 <barnarj-AT-ccf.org>.
2239
2250
2240 * IPython/Magic.py (Magic.extract_input_slices): added support for
2251 * IPython/Magic.py (Magic.extract_input_slices): added support for
2241 the slice notation in magics to use N-M to represent numbers N...M
2252 the slice notation in magics to use N-M to represent numbers N...M
2242 (closed endpoints). This is used by %macro and %save.
2253 (closed endpoints). This is used by %macro and %save.
2243
2254
2244 * IPython/completer.py (Completer.attr_matches): for modules which
2255 * IPython/completer.py (Completer.attr_matches): for modules which
2245 define __all__, complete only on those. After a patch by Jeffrey
2256 define __all__, complete only on those. After a patch by Jeffrey
2246 Collins <jcollins_boulder-AT-earthlink.net>. Also, clean up and
2257 Collins <jcollins_boulder-AT-earthlink.net>. Also, clean up and
2247 speed up this routine.
2258 speed up this routine.
2248
2259
2249 * IPython/Logger.py (Logger.log): fix a history handling bug. I
2260 * IPython/Logger.py (Logger.log): fix a history handling bug. I
2250 don't know if this is the end of it, but the behavior now is
2261 don't know if this is the end of it, but the behavior now is
2251 certainly much more correct. Note that coupled with macros,
2262 certainly much more correct. Note that coupled with macros,
2252 slightly surprising (at first) behavior may occur: a macro will in
2263 slightly surprising (at first) behavior may occur: a macro will in
2253 general expand to multiple lines of input, so upon exiting, the
2264 general expand to multiple lines of input, so upon exiting, the
2254 in/out counters will both be bumped by the corresponding amount
2265 in/out counters will both be bumped by the corresponding amount
2255 (as if the macro's contents had been typed interactively). Typing
2266 (as if the macro's contents had been typed interactively). Typing
2256 %hist will reveal the intermediate (silently processed) lines.
2267 %hist will reveal the intermediate (silently processed) lines.
2257
2268
2258 * IPython/Magic.py (magic_run): fix a subtle bug which could cause
2269 * IPython/Magic.py (magic_run): fix a subtle bug which could cause
2259 pickle to fail (%run was overwriting __main__ and not restoring
2270 pickle to fail (%run was overwriting __main__ and not restoring
2260 it, but pickle relies on __main__ to operate).
2271 it, but pickle relies on __main__ to operate).
2261
2272
2262 * IPython/iplib.py (InteractiveShell): fix pdb calling: I'm now
2273 * IPython/iplib.py (InteractiveShell): fix pdb calling: I'm now
2263 using properties, but forgot to make the main InteractiveShell
2274 using properties, but forgot to make the main InteractiveShell
2264 class a new-style class. Properties fail silently, and
2275 class a new-style class. Properties fail silently, and
2265 mysteriously, with old-style class (getters work, but
2276 mysteriously, with old-style class (getters work, but
2266 setters don't do anything).
2277 setters don't do anything).
2267
2278
2268 2005-12-30 Fernando Perez <Fernando.Perez@colorado.edu>
2279 2005-12-30 Fernando Perez <Fernando.Perez@colorado.edu>
2269
2280
2270 * IPython/Magic.py (magic_history): fix history reporting bug (I
2281 * IPython/Magic.py (magic_history): fix history reporting bug (I
2271 know some nasties are still there, I just can't seem to find a
2282 know some nasties are still there, I just can't seem to find a
2272 reproducible test case to track them down; the input history is
2283 reproducible test case to track them down; the input history is
2273 falling out of sync...)
2284 falling out of sync...)
2274
2285
2275 * IPython/iplib.py (handle_shell_escape): fix bug where both
2286 * IPython/iplib.py (handle_shell_escape): fix bug where both
2276 aliases and system accesses where broken for indented code (such
2287 aliases and system accesses where broken for indented code (such
2277 as loops).
2288 as loops).
2278
2289
2279 * IPython/genutils.py (shell): fix small but critical bug for
2290 * IPython/genutils.py (shell): fix small but critical bug for
2280 win32 system access.
2291 win32 system access.
2281
2292
2282 2005-12-29 Fernando Perez <Fernando.Perez@colorado.edu>
2293 2005-12-29 Fernando Perez <Fernando.Perez@colorado.edu>
2283
2294
2284 * IPython/iplib.py (showtraceback): remove use of the
2295 * IPython/iplib.py (showtraceback): remove use of the
2285 sys.last_{type/value/traceback} structures, which are non
2296 sys.last_{type/value/traceback} structures, which are non
2286 thread-safe.
2297 thread-safe.
2287 (_prefilter): change control flow to ensure that we NEVER
2298 (_prefilter): change control flow to ensure that we NEVER
2288 introspect objects when autocall is off. This will guarantee that
2299 introspect objects when autocall is off. This will guarantee that
2289 having an input line of the form 'x.y', where access to attribute
2300 having an input line of the form 'x.y', where access to attribute
2290 'y' has side effects, doesn't trigger the side effect TWICE. It
2301 'y' has side effects, doesn't trigger the side effect TWICE. It
2291 is important to note that, with autocall on, these side effects
2302 is important to note that, with autocall on, these side effects
2292 can still happen.
2303 can still happen.
2293 (ipsystem): new builtin, to complete the ip{magic/alias/system}
2304 (ipsystem): new builtin, to complete the ip{magic/alias/system}
2294 trio. IPython offers these three kinds of special calls which are
2305 trio. IPython offers these three kinds of special calls which are
2295 not python code, and it's a good thing to have their call method
2306 not python code, and it's a good thing to have their call method
2296 be accessible as pure python functions (not just special syntax at
2307 be accessible as pure python functions (not just special syntax at
2297 the command line). It gives us a better internal implementation
2308 the command line). It gives us a better internal implementation
2298 structure, as well as exposing these for user scripting more
2309 structure, as well as exposing these for user scripting more
2299 cleanly.
2310 cleanly.
2300
2311
2301 * IPython/macro.py (Macro.__init__): moved macros to a standalone
2312 * IPython/macro.py (Macro.__init__): moved macros to a standalone
2302 file. Now that they'll be more likely to be used with the
2313 file. Now that they'll be more likely to be used with the
2303 persistance system (%store), I want to make sure their module path
2314 persistance system (%store), I want to make sure their module path
2304 doesn't change in the future, so that we don't break things for
2315 doesn't change in the future, so that we don't break things for
2305 users' persisted data.
2316 users' persisted data.
2306
2317
2307 * IPython/iplib.py (autoindent_update): move indentation
2318 * IPython/iplib.py (autoindent_update): move indentation
2308 management into the _text_ processing loop, not the keyboard
2319 management into the _text_ processing loop, not the keyboard
2309 interactive one. This is necessary to correctly process non-typed
2320 interactive one. This is necessary to correctly process non-typed
2310 multiline input (such as macros).
2321 multiline input (such as macros).
2311
2322
2312 * IPython/Magic.py (Magic.format_latex): patch by Stefan van der
2323 * IPython/Magic.py (Magic.format_latex): patch by Stefan van der
2313 Walt <stefan-AT-sun.ac.za> to fix latex formatting of docstrings,
2324 Walt <stefan-AT-sun.ac.za> to fix latex formatting of docstrings,
2314 which was producing problems in the resulting manual.
2325 which was producing problems in the resulting manual.
2315 (magic_whos): improve reporting of instances (show their class,
2326 (magic_whos): improve reporting of instances (show their class,
2316 instead of simply printing 'instance' which isn't terribly
2327 instead of simply printing 'instance' which isn't terribly
2317 informative).
2328 informative).
2318
2329
2319 * IPython/genutils.py (shell): commit Jorgen Stenarson's patch
2330 * IPython/genutils.py (shell): commit Jorgen Stenarson's patch
2320 (minor mods) to support network shares under win32.
2331 (minor mods) to support network shares under win32.
2321
2332
2322 * IPython/winconsole.py (get_console_size): add new winconsole
2333 * IPython/winconsole.py (get_console_size): add new winconsole
2323 module and fixes to page_dumb() to improve its behavior under
2334 module and fixes to page_dumb() to improve its behavior under
2324 win32. Contributed by Alexander Belchenko <bialix-AT-ukr.net>.
2335 win32. Contributed by Alexander Belchenko <bialix-AT-ukr.net>.
2325
2336
2326 * IPython/Magic.py (Macro): simplified Macro class to just
2337 * IPython/Magic.py (Macro): simplified Macro class to just
2327 subclass list. We've had only 2.2 compatibility for a very long
2338 subclass list. We've had only 2.2 compatibility for a very long
2328 time, yet I was still avoiding subclassing the builtin types. No
2339 time, yet I was still avoiding subclassing the builtin types. No
2329 more (I'm also starting to use properties, though I won't shift to
2340 more (I'm also starting to use properties, though I won't shift to
2330 2.3-specific features quite yet).
2341 2.3-specific features quite yet).
2331 (magic_store): added Ville's patch for lightweight variable
2342 (magic_store): added Ville's patch for lightweight variable
2332 persistence, after a request on the user list by Matt Wilkie
2343 persistence, after a request on the user list by Matt Wilkie
2333 <maphew-AT-gmail.com>. The new %store magic's docstring has full
2344 <maphew-AT-gmail.com>. The new %store magic's docstring has full
2334 details.
2345 details.
2335
2346
2336 * IPython/iplib.py (InteractiveShell.post_config_initialization):
2347 * IPython/iplib.py (InteractiveShell.post_config_initialization):
2337 changed the default logfile name from 'ipython.log' to
2348 changed the default logfile name from 'ipython.log' to
2338 'ipython_log.py'. These logs are real python files, and now that
2349 'ipython_log.py'. These logs are real python files, and now that
2339 we have much better multiline support, people are more likely to
2350 we have much better multiline support, people are more likely to
2340 want to use them as such. Might as well name them correctly.
2351 want to use them as such. Might as well name them correctly.
2341
2352
2342 * IPython/Magic.py: substantial cleanup. While we can't stop
2353 * IPython/Magic.py: substantial cleanup. While we can't stop
2343 using magics as mixins, due to the existing customizations 'out
2354 using magics as mixins, due to the existing customizations 'out
2344 there' which rely on the mixin naming conventions, at least I
2355 there' which rely on the mixin naming conventions, at least I
2345 cleaned out all cross-class name usage. So once we are OK with
2356 cleaned out all cross-class name usage. So once we are OK with
2346 breaking compatibility, the two systems can be separated.
2357 breaking compatibility, the two systems can be separated.
2347
2358
2348 * IPython/Logger.py: major cleanup. This one is NOT a mixin
2359 * IPython/Logger.py: major cleanup. This one is NOT a mixin
2349 anymore, and the class is a fair bit less hideous as well. New
2360 anymore, and the class is a fair bit less hideous as well. New
2350 features were also introduced: timestamping of input, and logging
2361 features were also introduced: timestamping of input, and logging
2351 of output results. These are user-visible with the -t and -o
2362 of output results. These are user-visible with the -t and -o
2352 options to %logstart. Closes
2363 options to %logstart. Closes
2353 http://www.scipy.net/roundup/ipython/issue11 and a request by
2364 http://www.scipy.net/roundup/ipython/issue11 and a request by
2354 William Stein (SAGE developer - http://modular.ucsd.edu/sage).
2365 William Stein (SAGE developer - http://modular.ucsd.edu/sage).
2355
2366
2356 2005-12-28 Fernando Perez <Fernando.Perez@colorado.edu>
2367 2005-12-28 Fernando Perez <Fernando.Perez@colorado.edu>
2357
2368
2358 * IPython/iplib.py (handle_shell_escape): add Ville's patch to
2369 * IPython/iplib.py (handle_shell_escape): add Ville's patch to
2359 better handle backslashes in paths. See the thread 'More Windows
2370 better handle backslashes in paths. See the thread 'More Windows
2360 questions part 2 - \/ characters revisited' on the iypthon user
2371 questions part 2 - \/ characters revisited' on the iypthon user
2361 list:
2372 list:
2362 http://scipy.net/pipermail/ipython-user/2005-June/000907.html
2373 http://scipy.net/pipermail/ipython-user/2005-June/000907.html
2363
2374
2364 (InteractiveShell.__init__): fix tab-completion bug in threaded shells.
2375 (InteractiveShell.__init__): fix tab-completion bug in threaded shells.
2365
2376
2366 (InteractiveShell.__init__): change threaded shells to not use the
2377 (InteractiveShell.__init__): change threaded shells to not use the
2367 ipython crash handler. This was causing more problems than not,
2378 ipython crash handler. This was causing more problems than not,
2368 as exceptions in the main thread (GUI code, typically) would
2379 as exceptions in the main thread (GUI code, typically) would
2369 always show up as a 'crash', when they really weren't.
2380 always show up as a 'crash', when they really weren't.
2370
2381
2371 The colors and exception mode commands (%colors/%xmode) have been
2382 The colors and exception mode commands (%colors/%xmode) have been
2372 synchronized to also take this into account, so users can get
2383 synchronized to also take this into account, so users can get
2373 verbose exceptions for their threaded code as well. I also added
2384 verbose exceptions for their threaded code as well. I also added
2374 support for activating pdb inside this exception handler as well,
2385 support for activating pdb inside this exception handler as well,
2375 so now GUI authors can use IPython's enhanced pdb at runtime.
2386 so now GUI authors can use IPython's enhanced pdb at runtime.
2376
2387
2377 * IPython/ipmaker.py (make_IPython): make the autoedit_syntax flag
2388 * IPython/ipmaker.py (make_IPython): make the autoedit_syntax flag
2378 true by default, and add it to the shipped ipythonrc file. Since
2389 true by default, and add it to the shipped ipythonrc file. Since
2379 this asks the user before proceeding, I think it's OK to make it
2390 this asks the user before proceeding, I think it's OK to make it
2380 true by default.
2391 true by default.
2381
2392
2382 * IPython/Magic.py (magic_exit): make new exit/quit magics instead
2393 * IPython/Magic.py (magic_exit): make new exit/quit magics instead
2383 of the previous special-casing of input in the eval loop. I think
2394 of the previous special-casing of input in the eval loop. I think
2384 this is cleaner, as they really are commands and shouldn't have
2395 this is cleaner, as they really are commands and shouldn't have
2385 a special role in the middle of the core code.
2396 a special role in the middle of the core code.
2386
2397
2387 2005-12-27 Fernando Perez <Fernando.Perez@colorado.edu>
2398 2005-12-27 Fernando Perez <Fernando.Perez@colorado.edu>
2388
2399
2389 * IPython/iplib.py (edit_syntax_error): added support for
2400 * IPython/iplib.py (edit_syntax_error): added support for
2390 automatically reopening the editor if the file had a syntax error
2401 automatically reopening the editor if the file had a syntax error
2391 in it. Thanks to scottt who provided the patch at:
2402 in it. Thanks to scottt who provided the patch at:
2392 http://www.scipy.net/roundup/ipython/issue36 (slightly modified
2403 http://www.scipy.net/roundup/ipython/issue36 (slightly modified
2393 version committed).
2404 version committed).
2394
2405
2395 * IPython/iplib.py (handle_normal): add suport for multi-line
2406 * IPython/iplib.py (handle_normal): add suport for multi-line
2396 input with emtpy lines. This fixes
2407 input with emtpy lines. This fixes
2397 http://www.scipy.net/roundup/ipython/issue43 and a similar
2408 http://www.scipy.net/roundup/ipython/issue43 and a similar
2398 discussion on the user list.
2409 discussion on the user list.
2399
2410
2400 WARNING: a behavior change is necessarily introduced to support
2411 WARNING: a behavior change is necessarily introduced to support
2401 blank lines: now a single blank line with whitespace does NOT
2412 blank lines: now a single blank line with whitespace does NOT
2402 break the input loop, which means that when autoindent is on, by
2413 break the input loop, which means that when autoindent is on, by
2403 default hitting return on the next (indented) line does NOT exit.
2414 default hitting return on the next (indented) line does NOT exit.
2404
2415
2405 Instead, to exit a multiline input you can either have:
2416 Instead, to exit a multiline input you can either have:
2406
2417
2407 - TWO whitespace lines (just hit return again), or
2418 - TWO whitespace lines (just hit return again), or
2408 - a single whitespace line of a different length than provided
2419 - a single whitespace line of a different length than provided
2409 by the autoindent (add or remove a space).
2420 by the autoindent (add or remove a space).
2410
2421
2411 * IPython/completer.py (MagicCompleter.__init__): new 'completer'
2422 * IPython/completer.py (MagicCompleter.__init__): new 'completer'
2412 module to better organize all readline-related functionality.
2423 module to better organize all readline-related functionality.
2413 I've deleted FlexCompleter and put all completion clases here.
2424 I've deleted FlexCompleter and put all completion clases here.
2414
2425
2415 * IPython/iplib.py (raw_input): improve indentation management.
2426 * IPython/iplib.py (raw_input): improve indentation management.
2416 It is now possible to paste indented code with autoindent on, and
2427 It is now possible to paste indented code with autoindent on, and
2417 the code is interpreted correctly (though it still looks bad on
2428 the code is interpreted correctly (though it still looks bad on
2418 screen, due to the line-oriented nature of ipython).
2429 screen, due to the line-oriented nature of ipython).
2419 (MagicCompleter.complete): change behavior so that a TAB key on an
2430 (MagicCompleter.complete): change behavior so that a TAB key on an
2420 otherwise empty line actually inserts a tab, instead of completing
2431 otherwise empty line actually inserts a tab, instead of completing
2421 on the entire global namespace. This makes it easier to use the
2432 on the entire global namespace. This makes it easier to use the
2422 TAB key for indentation. After a request by Hans Meine
2433 TAB key for indentation. After a request by Hans Meine
2423 <hans_meine-AT-gmx.net>
2434 <hans_meine-AT-gmx.net>
2424 (_prefilter): add support so that typing plain 'exit' or 'quit'
2435 (_prefilter): add support so that typing plain 'exit' or 'quit'
2425 does a sensible thing. Originally I tried to deviate as little as
2436 does a sensible thing. Originally I tried to deviate as little as
2426 possible from the default python behavior, but even that one may
2437 possible from the default python behavior, but even that one may
2427 change in this direction (thread on python-dev to that effect).
2438 change in this direction (thread on python-dev to that effect).
2428 Regardless, ipython should do the right thing even if CPython's
2439 Regardless, ipython should do the right thing even if CPython's
2429 '>>>' prompt doesn't.
2440 '>>>' prompt doesn't.
2430 (InteractiveShell): removed subclassing code.InteractiveConsole
2441 (InteractiveShell): removed subclassing code.InteractiveConsole
2431 class. By now we'd overridden just about all of its methods: I've
2442 class. By now we'd overridden just about all of its methods: I've
2432 copied the remaining two over, and now ipython is a standalone
2443 copied the remaining two over, and now ipython is a standalone
2433 class. This will provide a clearer picture for the chainsaw
2444 class. This will provide a clearer picture for the chainsaw
2434 branch refactoring.
2445 branch refactoring.
2435
2446
2436 2005-12-26 Fernando Perez <Fernando.Perez@colorado.edu>
2447 2005-12-26 Fernando Perez <Fernando.Perez@colorado.edu>
2437
2448
2438 * IPython/ultraTB.py (VerboseTB.text): harden reporting against
2449 * IPython/ultraTB.py (VerboseTB.text): harden reporting against
2439 failures for objects which break when dir() is called on them.
2450 failures for objects which break when dir() is called on them.
2440
2451
2441 * IPython/FlexCompleter.py (Completer.__init__): Added support for
2452 * IPython/FlexCompleter.py (Completer.__init__): Added support for
2442 distinct local and global namespaces in the completer API. This
2453 distinct local and global namespaces in the completer API. This
2443 change allows us to properly handle completion with distinct
2454 change allows us to properly handle completion with distinct
2444 scopes, including in embedded instances (this had never really
2455 scopes, including in embedded instances (this had never really
2445 worked correctly).
2456 worked correctly).
2446
2457
2447 Note: this introduces a change in the constructor for
2458 Note: this introduces a change in the constructor for
2448 MagicCompleter, as a new global_namespace parameter is now the
2459 MagicCompleter, as a new global_namespace parameter is now the
2449 second argument (the others were bumped one position).
2460 second argument (the others were bumped one position).
2450
2461
2451 2005-12-25 Fernando Perez <Fernando.Perez@colorado.edu>
2462 2005-12-25 Fernando Perez <Fernando.Perez@colorado.edu>
2452
2463
2453 * IPython/iplib.py (embed_mainloop): fix tab-completion in
2464 * IPython/iplib.py (embed_mainloop): fix tab-completion in
2454 embedded instances (which can be done now thanks to Vivian's
2465 embedded instances (which can be done now thanks to Vivian's
2455 frame-handling fixes for pdb).
2466 frame-handling fixes for pdb).
2456 (InteractiveShell.__init__): Fix namespace handling problem in
2467 (InteractiveShell.__init__): Fix namespace handling problem in
2457 embedded instances. We were overwriting __main__ unconditionally,
2468 embedded instances. We were overwriting __main__ unconditionally,
2458 and this should only be done for 'full' (non-embedded) IPython;
2469 and this should only be done for 'full' (non-embedded) IPython;
2459 embedded instances must respect the caller's __main__. Thanks to
2470 embedded instances must respect the caller's __main__. Thanks to
2460 a bug report by Yaroslav Bulatov <yaroslavvb-AT-gmail.com>
2471 a bug report by Yaroslav Bulatov <yaroslavvb-AT-gmail.com>
2461
2472
2462 2005-12-24 Fernando Perez <Fernando.Perez@colorado.edu>
2473 2005-12-24 Fernando Perez <Fernando.Perez@colorado.edu>
2463
2474
2464 * setup.py: added download_url to setup(). This registers the
2475 * setup.py: added download_url to setup(). This registers the
2465 download address at PyPI, which is not only useful to humans
2476 download address at PyPI, which is not only useful to humans
2466 browsing the site, but is also picked up by setuptools (the Eggs
2477 browsing the site, but is also picked up by setuptools (the Eggs
2467 machinery). Thanks to Ville and R. Kern for the info/discussion
2478 machinery). Thanks to Ville and R. Kern for the info/discussion
2468 on this.
2479 on this.
2469
2480
2470 2005-12-23 Fernando Perez <Fernando.Perez@colorado.edu>
2481 2005-12-23 Fernando Perez <Fernando.Perez@colorado.edu>
2471
2482
2472 * IPython/Debugger.py (Pdb.__init__): Major pdb mode enhancements.
2483 * IPython/Debugger.py (Pdb.__init__): Major pdb mode enhancements.
2473 This brings a lot of nice functionality to the pdb mode, which now
2484 This brings a lot of nice functionality to the pdb mode, which now
2474 has tab-completion, syntax highlighting, and better stack handling
2485 has tab-completion, syntax highlighting, and better stack handling
2475 than before. Many thanks to Vivian De Smedt
2486 than before. Many thanks to Vivian De Smedt
2476 <vivian-AT-vdesmedt.com> for the original patches.
2487 <vivian-AT-vdesmedt.com> for the original patches.
2477
2488
2478 2005-12-08 Fernando Perez <Fernando.Perez@colorado.edu>
2489 2005-12-08 Fernando Perez <Fernando.Perez@colorado.edu>
2479
2490
2480 * IPython/Shell.py (IPShellGTK.mainloop): fix mainloop() calling
2491 * IPython/Shell.py (IPShellGTK.mainloop): fix mainloop() calling
2481 sequence to consistently accept the banner argument. The
2492 sequence to consistently accept the banner argument. The
2482 inconsistency was tripping SAGE, thanks to Gary Zablackis
2493 inconsistency was tripping SAGE, thanks to Gary Zablackis
2483 <gzabl-AT-yahoo.com> for the report.
2494 <gzabl-AT-yahoo.com> for the report.
2484
2495
2485 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
2496 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
2486
2497
2487 * IPython/iplib.py (InteractiveShell.post_config_initialization):
2498 * IPython/iplib.py (InteractiveShell.post_config_initialization):
2488 Fix bug where a naked 'alias' call in the ipythonrc file would
2499 Fix bug where a naked 'alias' call in the ipythonrc file would
2489 cause a crash. Bug reported by Jorgen Stenarson.
2500 cause a crash. Bug reported by Jorgen Stenarson.
2490
2501
2491 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
2502 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
2492
2503
2493 * IPython/ipmaker.py (make_IPython): cleanups which should improve
2504 * IPython/ipmaker.py (make_IPython): cleanups which should improve
2494 startup time.
2505 startup time.
2495
2506
2496 * IPython/iplib.py (runcode): my globals 'fix' for embedded
2507 * IPython/iplib.py (runcode): my globals 'fix' for embedded
2497 instances had introduced a bug with globals in normal code. Now
2508 instances had introduced a bug with globals in normal code. Now
2498 it's working in all cases.
2509 it's working in all cases.
2499
2510
2500 * IPython/Magic.py (magic_psearch): Finish wildcard cleanup and
2511 * IPython/Magic.py (magic_psearch): Finish wildcard cleanup and
2501 API changes. A new ipytonrc option, 'wildcards_case_sensitive'
2512 API changes. A new ipytonrc option, 'wildcards_case_sensitive'
2502 has been introduced to set the default case sensitivity of the
2513 has been introduced to set the default case sensitivity of the
2503 searches. Users can still select either mode at runtime on a
2514 searches. Users can still select either mode at runtime on a
2504 per-search basis.
2515 per-search basis.
2505
2516
2506 2005-11-13 Fernando Perez <Fernando.Perez@colorado.edu>
2517 2005-11-13 Fernando Perez <Fernando.Perez@colorado.edu>
2507
2518
2508 * IPython/wildcard.py (NameSpace.__init__): fix resolution of
2519 * IPython/wildcard.py (NameSpace.__init__): fix resolution of
2509 attributes in wildcard searches for subclasses. Modified version
2520 attributes in wildcard searches for subclasses. Modified version
2510 of a patch by Jorgen.
2521 of a patch by Jorgen.
2511
2522
2512 2005-11-12 Fernando Perez <Fernando.Perez@colorado.edu>
2523 2005-11-12 Fernando Perez <Fernando.Perez@colorado.edu>
2513
2524
2514 * IPython/iplib.py (embed_mainloop): Fix handling of globals for
2525 * IPython/iplib.py (embed_mainloop): Fix handling of globals for
2515 embedded instances. I added a user_global_ns attribute to the
2526 embedded instances. I added a user_global_ns attribute to the
2516 InteractiveShell class to handle this.
2527 InteractiveShell class to handle this.
2517
2528
2518 2005-10-31 Fernando Perez <Fernando.Perez@colorado.edu>
2529 2005-10-31 Fernando Perez <Fernando.Perez@colorado.edu>
2519
2530
2520 * IPython/Shell.py (IPShellGTK.mainloop): Change timeout_add to
2531 * IPython/Shell.py (IPShellGTK.mainloop): Change timeout_add to
2521 idle_add, which fixes horrible keyboard lag problems under gtk 2.6
2532 idle_add, which fixes horrible keyboard lag problems under gtk 2.6
2522 (reported under win32, but may happen also in other platforms).
2533 (reported under win32, but may happen also in other platforms).
2523 Bug report and fix courtesy of Sean Moore <smm-AT-logic.bm>
2534 Bug report and fix courtesy of Sean Moore <smm-AT-logic.bm>
2524
2535
2525 2005-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
2536 2005-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
2526
2537
2527 * IPython/Magic.py (magic_psearch): new support for wildcard
2538 * IPython/Magic.py (magic_psearch): new support for wildcard
2528 patterns. Now, typing ?a*b will list all names which begin with a
2539 patterns. Now, typing ?a*b will list all names which begin with a
2529 and end in b, for example. The %psearch magic has full
2540 and end in b, for example. The %psearch magic has full
2530 docstrings. Many thanks to JΓΆrgen Stenarson
2541 docstrings. Many thanks to JΓΆrgen Stenarson
2531 <jorgen.stenarson-AT-bostream.nu>, author of the patches
2542 <jorgen.stenarson-AT-bostream.nu>, author of the patches
2532 implementing this functionality.
2543 implementing this functionality.
2533
2544
2534 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
2545 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
2535
2546
2536 * Manual: fixed long-standing annoyance of double-dashes (as in
2547 * Manual: fixed long-standing annoyance of double-dashes (as in
2537 --prefix=~, for example) being stripped in the HTML version. This
2548 --prefix=~, for example) being stripped in the HTML version. This
2538 is a latex2html bug, but a workaround was provided. Many thanks
2549 is a latex2html bug, but a workaround was provided. Many thanks
2539 to George K. Thiruvathukal <gthiruv-AT-luc.edu> for the detailed
2550 to George K. Thiruvathukal <gthiruv-AT-luc.edu> for the detailed
2540 help, and Michael Tobis <mtobis-AT-gmail.com> for getting the ball
2551 help, and Michael Tobis <mtobis-AT-gmail.com> for getting the ball
2541 rolling. This seemingly small issue had tripped a number of users
2552 rolling. This seemingly small issue had tripped a number of users
2542 when first installing, so I'm glad to see it gone.
2553 when first installing, so I'm glad to see it gone.
2543
2554
2544 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
2555 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
2545
2556
2546 * IPython/Extensions/numeric_formats.py: fix missing import,
2557 * IPython/Extensions/numeric_formats.py: fix missing import,
2547 reported by Stephen Walton.
2558 reported by Stephen Walton.
2548
2559
2549 2005-09-24 Fernando Perez <Fernando.Perez@colorado.edu>
2560 2005-09-24 Fernando Perez <Fernando.Perez@colorado.edu>
2550
2561
2551 * IPython/demo.py: finish demo module, fully documented now.
2562 * IPython/demo.py: finish demo module, fully documented now.
2552
2563
2553 * IPython/genutils.py (file_read): simple little utility to read a
2564 * IPython/genutils.py (file_read): simple little utility to read a
2554 file and ensure it's closed afterwards.
2565 file and ensure it's closed afterwards.
2555
2566
2556 2005-09-23 Fernando Perez <Fernando.Perez@colorado.edu>
2567 2005-09-23 Fernando Perez <Fernando.Perez@colorado.edu>
2557
2568
2558 * IPython/demo.py (Demo.__init__): added support for individually
2569 * IPython/demo.py (Demo.__init__): added support for individually
2559 tagging blocks for automatic execution.
2570 tagging blocks for automatic execution.
2560
2571
2561 * IPython/Magic.py (magic_pycat): new %pycat magic for showing
2572 * IPython/Magic.py (magic_pycat): new %pycat magic for showing
2562 syntax-highlighted python sources, requested by John.
2573 syntax-highlighted python sources, requested by John.
2563
2574
2564 2005-09-22 Fernando Perez <Fernando.Perez@colorado.edu>
2575 2005-09-22 Fernando Perez <Fernando.Perez@colorado.edu>
2565
2576
2566 * IPython/demo.py (Demo.again): fix bug where again() blocks after
2577 * IPython/demo.py (Demo.again): fix bug where again() blocks after
2567 finishing.
2578 finishing.
2568
2579
2569 * IPython/genutils.py (shlex_split): moved from Magic to here,
2580 * IPython/genutils.py (shlex_split): moved from Magic to here,
2570 where all 2.2 compatibility stuff lives. I needed it for demo.py.
2581 where all 2.2 compatibility stuff lives. I needed it for demo.py.
2571
2582
2572 * IPython/demo.py (Demo.__init__): added support for silent
2583 * IPython/demo.py (Demo.__init__): added support for silent
2573 blocks, improved marks as regexps, docstrings written.
2584 blocks, improved marks as regexps, docstrings written.
2574 (Demo.__init__): better docstring, added support for sys.argv.
2585 (Demo.__init__): better docstring, added support for sys.argv.
2575
2586
2576 * IPython/genutils.py (marquee): little utility used by the demo
2587 * IPython/genutils.py (marquee): little utility used by the demo
2577 code, handy in general.
2588 code, handy in general.
2578
2589
2579 * IPython/demo.py (Demo.__init__): new class for interactive
2590 * IPython/demo.py (Demo.__init__): new class for interactive
2580 demos. Not documented yet, I just wrote it in a hurry for
2591 demos. Not documented yet, I just wrote it in a hurry for
2581 scipy'05. Will docstring later.
2592 scipy'05. Will docstring later.
2582
2593
2583 2005-09-20 Fernando Perez <Fernando.Perez@colorado.edu>
2594 2005-09-20 Fernando Perez <Fernando.Perez@colorado.edu>
2584
2595
2585 * IPython/Shell.py (sigint_handler): Drastic simplification which
2596 * IPython/Shell.py (sigint_handler): Drastic simplification which
2586 also seems to make Ctrl-C work correctly across threads! This is
2597 also seems to make Ctrl-C work correctly across threads! This is
2587 so simple, that I can't beleive I'd missed it before. Needs more
2598 so simple, that I can't beleive I'd missed it before. Needs more
2588 testing, though.
2599 testing, though.
2589 (KBINT): Never mind, revert changes. I'm sure I'd tried something
2600 (KBINT): Never mind, revert changes. I'm sure I'd tried something
2590 like this before...
2601 like this before...
2591
2602
2592 * IPython/genutils.py (get_home_dir): add protection against
2603 * IPython/genutils.py (get_home_dir): add protection against
2593 non-dirs in win32 registry.
2604 non-dirs in win32 registry.
2594
2605
2595 * IPython/iplib.py (InteractiveShell.alias_table_validate): fix
2606 * IPython/iplib.py (InteractiveShell.alias_table_validate): fix
2596 bug where dict was mutated while iterating (pysh crash).
2607 bug where dict was mutated while iterating (pysh crash).
2597
2608
2598 2005-09-06 Fernando Perez <Fernando.Perez@colorado.edu>
2609 2005-09-06 Fernando Perez <Fernando.Perez@colorado.edu>
2599
2610
2600 * IPython/iplib.py (handle_auto): Fix inconsistency arising from
2611 * IPython/iplib.py (handle_auto): Fix inconsistency arising from
2601 spurious newlines added by this routine. After a report by
2612 spurious newlines added by this routine. After a report by
2602 F. Mantegazza.
2613 F. Mantegazza.
2603
2614
2604 2005-09-05 Fernando Perez <Fernando.Perez@colorado.edu>
2615 2005-09-05 Fernando Perez <Fernando.Perez@colorado.edu>
2605
2616
2606 * IPython/Shell.py (hijack_gtk): remove pygtk.require("2.0")
2617 * IPython/Shell.py (hijack_gtk): remove pygtk.require("2.0")
2607 calls. These were a leftover from the GTK 1.x days, and can cause
2618 calls. These were a leftover from the GTK 1.x days, and can cause
2608 problems in certain cases (after a report by John Hunter).
2619 problems in certain cases (after a report by John Hunter).
2609
2620
2610 * IPython/iplib.py (InteractiveShell.__init__): Trap exception if
2621 * IPython/iplib.py (InteractiveShell.__init__): Trap exception if
2611 os.getcwd() fails at init time. Thanks to patch from David Remahl
2622 os.getcwd() fails at init time. Thanks to patch from David Remahl
2612 <chmod007-AT-mac.com>.
2623 <chmod007-AT-mac.com>.
2613 (InteractiveShell.__init__): prevent certain special magics from
2624 (InteractiveShell.__init__): prevent certain special magics from
2614 being shadowed by aliases. Closes
2625 being shadowed by aliases. Closes
2615 http://www.scipy.net/roundup/ipython/issue41.
2626 http://www.scipy.net/roundup/ipython/issue41.
2616
2627
2617 2005-08-31 Fernando Perez <Fernando.Perez@colorado.edu>
2628 2005-08-31 Fernando Perez <Fernando.Perez@colorado.edu>
2618
2629
2619 * IPython/iplib.py (InteractiveShell.complete): Added new
2630 * IPython/iplib.py (InteractiveShell.complete): Added new
2620 top-level completion method to expose the completion mechanism
2631 top-level completion method to expose the completion mechanism
2621 beyond readline-based environments.
2632 beyond readline-based environments.
2622
2633
2623 2005-08-19 Fernando Perez <Fernando.Perez@colorado.edu>
2634 2005-08-19 Fernando Perez <Fernando.Perez@colorado.edu>
2624
2635
2625 * tools/ipsvnc (svnversion): fix svnversion capture.
2636 * tools/ipsvnc (svnversion): fix svnversion capture.
2626
2637
2627 * IPython/iplib.py (InteractiveShell.__init__): Add has_readline
2638 * IPython/iplib.py (InteractiveShell.__init__): Add has_readline
2628 attribute to self, which was missing. Before, it was set by a
2639 attribute to self, which was missing. Before, it was set by a
2629 routine which in certain cases wasn't being called, so the
2640 routine which in certain cases wasn't being called, so the
2630 instance could end up missing the attribute. This caused a crash.
2641 instance could end up missing the attribute. This caused a crash.
2631 Closes http://www.scipy.net/roundup/ipython/issue40.
2642 Closes http://www.scipy.net/roundup/ipython/issue40.
2632
2643
2633 2005-08-16 Fernando Perez <fperez@colorado.edu>
2644 2005-08-16 Fernando Perez <fperez@colorado.edu>
2634
2645
2635 * IPython/ultraTB.py (VerboseTB.text): don't crash if object
2646 * IPython/ultraTB.py (VerboseTB.text): don't crash if object
2636 contains non-string attribute. Closes
2647 contains non-string attribute. Closes
2637 http://www.scipy.net/roundup/ipython/issue38.
2648 http://www.scipy.net/roundup/ipython/issue38.
2638
2649
2639 2005-08-14 Fernando Perez <fperez@colorado.edu>
2650 2005-08-14 Fernando Perez <fperez@colorado.edu>
2640
2651
2641 * tools/ipsvnc: Minor improvements, to add changeset info.
2652 * tools/ipsvnc: Minor improvements, to add changeset info.
2642
2653
2643 2005-08-12 Fernando Perez <fperez@colorado.edu>
2654 2005-08-12 Fernando Perez <fperez@colorado.edu>
2644
2655
2645 * IPython/iplib.py (runsource): remove self.code_to_run_src
2656 * IPython/iplib.py (runsource): remove self.code_to_run_src
2646 attribute. I realized this is nothing more than
2657 attribute. I realized this is nothing more than
2647 '\n'.join(self.buffer), and having the same data in two different
2658 '\n'.join(self.buffer), and having the same data in two different
2648 places is just asking for synchronization bugs. This may impact
2659 places is just asking for synchronization bugs. This may impact
2649 people who have custom exception handlers, so I need to warn
2660 people who have custom exception handlers, so I need to warn
2650 ipython-dev about it (F. Mantegazza may use them).
2661 ipython-dev about it (F. Mantegazza may use them).
2651
2662
2652 2005-07-29 Fernando Perez <Fernando.Perez@colorado.edu>
2663 2005-07-29 Fernando Perez <Fernando.Perez@colorado.edu>
2653
2664
2654 * IPython/genutils.py: fix 2.2 compatibility (generators)
2665 * IPython/genutils.py: fix 2.2 compatibility (generators)
2655
2666
2656 2005-07-18 Fernando Perez <fperez@colorado.edu>
2667 2005-07-18 Fernando Perez <fperez@colorado.edu>
2657
2668
2658 * IPython/genutils.py (get_home_dir): fix to help users with
2669 * IPython/genutils.py (get_home_dir): fix to help users with
2659 invalid $HOME under win32.
2670 invalid $HOME under win32.
2660
2671
2661 2005-07-17 Fernando Perez <fperez@colorado.edu>
2672 2005-07-17 Fernando Perez <fperez@colorado.edu>
2662
2673
2663 * IPython/Prompts.py (str_safe): Make unicode-safe. Also remove
2674 * IPython/Prompts.py (str_safe): Make unicode-safe. Also remove
2664 some old hacks and clean up a bit other routines; code should be
2675 some old hacks and clean up a bit other routines; code should be
2665 simpler and a bit faster.
2676 simpler and a bit faster.
2666
2677
2667 * IPython/iplib.py (interact): removed some last-resort attempts
2678 * IPython/iplib.py (interact): removed some last-resort attempts
2668 to survive broken stdout/stderr. That code was only making it
2679 to survive broken stdout/stderr. That code was only making it
2669 harder to abstract out the i/o (necessary for gui integration),
2680 harder to abstract out the i/o (necessary for gui integration),
2670 and the crashes it could prevent were extremely rare in practice
2681 and the crashes it could prevent were extremely rare in practice
2671 (besides being fully user-induced in a pretty violent manner).
2682 (besides being fully user-induced in a pretty violent manner).
2672
2683
2673 * IPython/genutils.py (IOStream.__init__): Simplify the i/o stuff.
2684 * IPython/genutils.py (IOStream.__init__): Simplify the i/o stuff.
2674 Nothing major yet, but the code is simpler to read; this should
2685 Nothing major yet, but the code is simpler to read; this should
2675 make it easier to do more serious modifications in the future.
2686 make it easier to do more serious modifications in the future.
2676
2687
2677 * IPython/Extensions/InterpreterExec.py: Fix auto-quoting in pysh,
2688 * IPython/Extensions/InterpreterExec.py: Fix auto-quoting in pysh,
2678 which broke in .15 (thanks to a report by Ville).
2689 which broke in .15 (thanks to a report by Ville).
2679
2690
2680 * IPython/Itpl.py (Itpl.__init__): add unicode support (it may not
2691 * IPython/Itpl.py (Itpl.__init__): add unicode support (it may not
2681 be quite correct, I know next to nothing about unicode). This
2692 be quite correct, I know next to nothing about unicode). This
2682 will allow unicode strings to be used in prompts, amongst other
2693 will allow unicode strings to be used in prompts, amongst other
2683 cases. It also will prevent ipython from crashing when unicode
2694 cases. It also will prevent ipython from crashing when unicode
2684 shows up unexpectedly in many places. If ascii encoding fails, we
2695 shows up unexpectedly in many places. If ascii encoding fails, we
2685 assume utf_8. Currently the encoding is not a user-visible
2696 assume utf_8. Currently the encoding is not a user-visible
2686 setting, though it could be made so if there is demand for it.
2697 setting, though it could be made so if there is demand for it.
2687
2698
2688 * IPython/ipmaker.py (make_IPython): remove old 2.1-specific hack.
2699 * IPython/ipmaker.py (make_IPython): remove old 2.1-specific hack.
2689
2700
2690 * IPython/Struct.py (Struct.merge): switch keys() to iterator.
2701 * IPython/Struct.py (Struct.merge): switch keys() to iterator.
2691
2702
2692 * IPython/background_jobs.py: moved 2.2 compatibility to genutils.
2703 * IPython/background_jobs.py: moved 2.2 compatibility to genutils.
2693
2704
2694 * IPython/genutils.py: Add 2.2 compatibility here, so all other
2705 * IPython/genutils.py: Add 2.2 compatibility here, so all other
2695 code can work transparently for 2.2/2.3.
2706 code can work transparently for 2.2/2.3.
2696
2707
2697 2005-07-16 Fernando Perez <fperez@colorado.edu>
2708 2005-07-16 Fernando Perez <fperez@colorado.edu>
2698
2709
2699 * IPython/ultraTB.py (ExceptionColors): Make a global variable
2710 * IPython/ultraTB.py (ExceptionColors): Make a global variable
2700 out of the color scheme table used for coloring exception
2711 out of the color scheme table used for coloring exception
2701 tracebacks. This allows user code to add new schemes at runtime.
2712 tracebacks. This allows user code to add new schemes at runtime.
2702 This is a minimally modified version of the patch at
2713 This is a minimally modified version of the patch at
2703 http://www.scipy.net/roundup/ipython/issue35, many thanks to pabw
2714 http://www.scipy.net/roundup/ipython/issue35, many thanks to pabw
2704 for the contribution.
2715 for the contribution.
2705
2716
2706 * IPython/FlexCompleter.py (Completer.attr_matches): Add a
2717 * IPython/FlexCompleter.py (Completer.attr_matches): Add a
2707 slightly modified version of the patch in
2718 slightly modified version of the patch in
2708 http://www.scipy.net/roundup/ipython/issue34, which also allows me
2719 http://www.scipy.net/roundup/ipython/issue34, which also allows me
2709 to remove the previous try/except solution (which was costlier).
2720 to remove the previous try/except solution (which was costlier).
2710 Thanks to Gaetan Lehmann <gaetan.lehmann-AT-jouy.inra.fr> for the fix.
2721 Thanks to Gaetan Lehmann <gaetan.lehmann-AT-jouy.inra.fr> for the fix.
2711
2722
2712 2005-06-08 Fernando Perez <fperez@colorado.edu>
2723 2005-06-08 Fernando Perez <fperez@colorado.edu>
2713
2724
2714 * IPython/iplib.py (write/write_err): Add methods to abstract all
2725 * IPython/iplib.py (write/write_err): Add methods to abstract all
2715 I/O a bit more.
2726 I/O a bit more.
2716
2727
2717 * IPython/Shell.py (IPShellGTK.mainloop): Fix GTK deprecation
2728 * IPython/Shell.py (IPShellGTK.mainloop): Fix GTK deprecation
2718 warning, reported by Aric Hagberg, fix by JD Hunter.
2729 warning, reported by Aric Hagberg, fix by JD Hunter.
2719
2730
2720 2005-06-02 *** Released version 0.6.15
2731 2005-06-02 *** Released version 0.6.15
2721
2732
2722 2005-06-01 Fernando Perez <fperez@colorado.edu>
2733 2005-06-01 Fernando Perez <fperez@colorado.edu>
2723
2734
2724 * IPython/iplib.py (MagicCompleter.file_matches): Fix
2735 * IPython/iplib.py (MagicCompleter.file_matches): Fix
2725 tab-completion of filenames within open-quoted strings. Note that
2736 tab-completion of filenames within open-quoted strings. Note that
2726 this requires that in ~/.ipython/ipythonrc, users change the
2737 this requires that in ~/.ipython/ipythonrc, users change the
2727 readline delimiters configuration to read:
2738 readline delimiters configuration to read:
2728
2739
2729 readline_remove_delims -/~
2740 readline_remove_delims -/~
2730
2741
2731
2742
2732 2005-05-31 *** Released version 0.6.14
2743 2005-05-31 *** Released version 0.6.14
2733
2744
2734 2005-05-29 Fernando Perez <fperez@colorado.edu>
2745 2005-05-29 Fernando Perez <fperez@colorado.edu>
2735
2746
2736 * IPython/ultraTB.py (VerboseTB.text): Fix crash for tracebacks
2747 * IPython/ultraTB.py (VerboseTB.text): Fix crash for tracebacks
2737 with files not on the filesystem. Reported by Eliyahu Sandler
2748 with files not on the filesystem. Reported by Eliyahu Sandler
2738 <eli@gondolin.net>
2749 <eli@gondolin.net>
2739
2750
2740 2005-05-22 Fernando Perez <fperez@colorado.edu>
2751 2005-05-22 Fernando Perez <fperez@colorado.edu>
2741
2752
2742 * IPython/iplib.py: Fix a few crashes in the --upgrade option.
2753 * IPython/iplib.py: Fix a few crashes in the --upgrade option.
2743 After an initial report by LUK ShunTim <shuntim.luk@polyu.edu.hk>.
2754 After an initial report by LUK ShunTim <shuntim.luk@polyu.edu.hk>.
2744
2755
2745 2005-05-19 Fernando Perez <fperez@colorado.edu>
2756 2005-05-19 Fernando Perez <fperez@colorado.edu>
2746
2757
2747 * IPython/iplib.py (safe_execfile): close a file which could be
2758 * IPython/iplib.py (safe_execfile): close a file which could be
2748 left open (causing problems in win32, which locks open files).
2759 left open (causing problems in win32, which locks open files).
2749 Thanks to a bug report by D Brown <dbrown2@yahoo.com>.
2760 Thanks to a bug report by D Brown <dbrown2@yahoo.com>.
2750
2761
2751 2005-05-18 Fernando Perez <fperez@colorado.edu>
2762 2005-05-18 Fernando Perez <fperez@colorado.edu>
2752
2763
2753 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): pass all
2764 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): pass all
2754 keyword arguments correctly to safe_execfile().
2765 keyword arguments correctly to safe_execfile().
2755
2766
2756 2005-05-13 Fernando Perez <fperez@colorado.edu>
2767 2005-05-13 Fernando Perez <fperez@colorado.edu>
2757
2768
2758 * ipython.1: Added info about Qt to manpage, and threads warning
2769 * ipython.1: Added info about Qt to manpage, and threads warning
2759 to usage page (invoked with --help).
2770 to usage page (invoked with --help).
2760
2771
2761 * IPython/iplib.py (MagicCompleter.python_func_kw_matches): Added
2772 * IPython/iplib.py (MagicCompleter.python_func_kw_matches): Added
2762 new matcher (it goes at the end of the priority list) to do
2773 new matcher (it goes at the end of the priority list) to do
2763 tab-completion on named function arguments. Submitted by George
2774 tab-completion on named function arguments. Submitted by George
2764 Sakkis <gsakkis-AT-eden.rutgers.edu>. See the thread at
2775 Sakkis <gsakkis-AT-eden.rutgers.edu>. See the thread at
2765 http://www.scipy.net/pipermail/ipython-dev/2005-April/000436.html
2776 http://www.scipy.net/pipermail/ipython-dev/2005-April/000436.html
2766 for more details.
2777 for more details.
2767
2778
2768 * IPython/Magic.py (magic_run): Added new -e flag to ignore
2779 * IPython/Magic.py (magic_run): Added new -e flag to ignore
2769 SystemExit exceptions in the script being run. Thanks to a report
2780 SystemExit exceptions in the script being run. Thanks to a report
2770 by danny shevitz <danny_shevitz-AT-yahoo.com>, about this
2781 by danny shevitz <danny_shevitz-AT-yahoo.com>, about this
2771 producing very annoying behavior when running unit tests.
2782 producing very annoying behavior when running unit tests.
2772
2783
2773 2005-05-12 Fernando Perez <fperez@colorado.edu>
2784 2005-05-12 Fernando Perez <fperez@colorado.edu>
2774
2785
2775 * IPython/iplib.py (handle_auto): fixed auto-quoting and parens,
2786 * IPython/iplib.py (handle_auto): fixed auto-quoting and parens,
2776 which I'd broken (again) due to a changed regexp. In the process,
2787 which I'd broken (again) due to a changed regexp. In the process,
2777 added ';' as an escape to auto-quote the whole line without
2788 added ';' as an escape to auto-quote the whole line without
2778 splitting its arguments. Thanks to a report by Jerry McRae
2789 splitting its arguments. Thanks to a report by Jerry McRae
2779 <qrs0xyc02-AT-sneakemail.com>.
2790 <qrs0xyc02-AT-sneakemail.com>.
2780
2791
2781 * IPython/ultraTB.py (VerboseTB.text): protect against rare but
2792 * IPython/ultraTB.py (VerboseTB.text): protect against rare but
2782 possible crashes caused by a TokenError. Reported by Ed Schofield
2793 possible crashes caused by a TokenError. Reported by Ed Schofield
2783 <schofield-AT-ftw.at>.
2794 <schofield-AT-ftw.at>.
2784
2795
2785 2005-05-06 Fernando Perez <fperez@colorado.edu>
2796 2005-05-06 Fernando Perez <fperez@colorado.edu>
2786
2797
2787 * IPython/Shell.py (hijack_wx): Fix to work with WX v.2.6.
2798 * IPython/Shell.py (hijack_wx): Fix to work with WX v.2.6.
2788
2799
2789 2005-04-29 Fernando Perez <fperez@colorado.edu>
2800 2005-04-29 Fernando Perez <fperez@colorado.edu>
2790
2801
2791 * IPython/Shell.py (IPShellQt): Thanks to Denis Rivière
2802 * IPython/Shell.py (IPShellQt): Thanks to Denis Rivière
2792 <nudz-AT-free.fr>, Yann Cointepas <yann-AT-sapetnioc.org> and Benjamin
2803 <nudz-AT-free.fr>, Yann Cointepas <yann-AT-sapetnioc.org> and Benjamin
2793 Thyreau <Benji2-AT-decideur.info>, we now have a -qthread option
2804 Thyreau <Benji2-AT-decideur.info>, we now have a -qthread option
2794 which provides support for Qt interactive usage (similar to the
2805 which provides support for Qt interactive usage (similar to the
2795 existing one for WX and GTK). This had been often requested.
2806 existing one for WX and GTK). This had been often requested.
2796
2807
2797 2005-04-14 *** Released version 0.6.13
2808 2005-04-14 *** Released version 0.6.13
2798
2809
2799 2005-04-08 Fernando Perez <fperez@colorado.edu>
2810 2005-04-08 Fernando Perez <fperez@colorado.edu>
2800
2811
2801 * IPython/Magic.py (Magic._ofind): remove docstring evaluation
2812 * IPython/Magic.py (Magic._ofind): remove docstring evaluation
2802 from _ofind, which gets called on almost every input line. Now,
2813 from _ofind, which gets called on almost every input line. Now,
2803 we only try to get docstrings if they are actually going to be
2814 we only try to get docstrings if they are actually going to be
2804 used (the overhead of fetching unnecessary docstrings can be
2815 used (the overhead of fetching unnecessary docstrings can be
2805 noticeable for certain objects, such as Pyro proxies).
2816 noticeable for certain objects, such as Pyro proxies).
2806
2817
2807 * IPython/iplib.py (MagicCompleter.python_matches): Change the API
2818 * IPython/iplib.py (MagicCompleter.python_matches): Change the API
2808 for completers. For some reason I had been passing them the state
2819 for completers. For some reason I had been passing them the state
2809 variable, which completers never actually need, and was in
2820 variable, which completers never actually need, and was in
2810 conflict with the rlcompleter API. Custom completers ONLY need to
2821 conflict with the rlcompleter API. Custom completers ONLY need to
2811 take the text parameter.
2822 take the text parameter.
2812
2823
2813 * IPython/Extensions/InterpreterExec.py: Fix regexp so that magics
2824 * IPython/Extensions/InterpreterExec.py: Fix regexp so that magics
2814 work correctly in pysh. I've also moved all the logic which used
2825 work correctly in pysh. I've also moved all the logic which used
2815 to be in pysh.py here, which will prevent problems with future
2826 to be in pysh.py here, which will prevent problems with future
2816 upgrades. However, this time I must warn users to update their
2827 upgrades. However, this time I must warn users to update their
2817 pysh profile to include the line
2828 pysh profile to include the line
2818
2829
2819 import_all IPython.Extensions.InterpreterExec
2830 import_all IPython.Extensions.InterpreterExec
2820
2831
2821 because otherwise things won't work for them. They MUST also
2832 because otherwise things won't work for them. They MUST also
2822 delete pysh.py and the line
2833 delete pysh.py and the line
2823
2834
2824 execfile pysh.py
2835 execfile pysh.py
2825
2836
2826 from their ipythonrc-pysh.
2837 from their ipythonrc-pysh.
2827
2838
2828 * IPython/FlexCompleter.py (Completer.attr_matches): Make more
2839 * IPython/FlexCompleter.py (Completer.attr_matches): Make more
2829 robust in the face of objects whose dir() returns non-strings
2840 robust in the face of objects whose dir() returns non-strings
2830 (which it shouldn't, but some broken libs like ITK do). Thanks to
2841 (which it shouldn't, but some broken libs like ITK do). Thanks to
2831 a patch by John Hunter (implemented differently, though). Also
2842 a patch by John Hunter (implemented differently, though). Also
2832 minor improvements by using .extend instead of + on lists.
2843 minor improvements by using .extend instead of + on lists.
2833
2844
2834 * pysh.py:
2845 * pysh.py:
2835
2846
2836 2005-04-06 Fernando Perez <fperez@colorado.edu>
2847 2005-04-06 Fernando Perez <fperez@colorado.edu>
2837
2848
2838 * IPython/ipmaker.py (make_IPython): Make multi_line_specials on
2849 * IPython/ipmaker.py (make_IPython): Make multi_line_specials on
2839 by default, so that all users benefit from it. Those who don't
2850 by default, so that all users benefit from it. Those who don't
2840 want it can still turn it off.
2851 want it can still turn it off.
2841
2852
2842 * IPython/UserConfig/ipythonrc: Add multi_line_specials to the
2853 * IPython/UserConfig/ipythonrc: Add multi_line_specials to the
2843 config file, I'd forgotten about this, so users were getting it
2854 config file, I'd forgotten about this, so users were getting it
2844 off by default.
2855 off by default.
2845
2856
2846 * IPython/iplib.py (ipmagic): big overhaul of the magic system for
2857 * IPython/iplib.py (ipmagic): big overhaul of the magic system for
2847 consistency. Now magics can be called in multiline statements,
2858 consistency. Now magics can be called in multiline statements,
2848 and python variables can be expanded in magic calls via $var.
2859 and python variables can be expanded in magic calls via $var.
2849 This makes the magic system behave just like aliases or !system
2860 This makes the magic system behave just like aliases or !system
2850 calls.
2861 calls.
2851
2862
2852 2005-03-28 Fernando Perez <fperez@colorado.edu>
2863 2005-03-28 Fernando Perez <fperez@colorado.edu>
2853
2864
2854 * IPython/iplib.py (handle_auto): cleanup to use %s instead of
2865 * IPython/iplib.py (handle_auto): cleanup to use %s instead of
2855 expensive string additions for building command. Add support for
2866 expensive string additions for building command. Add support for
2856 trailing ';' when autocall is used.
2867 trailing ';' when autocall is used.
2857
2868
2858 2005-03-26 Fernando Perez <fperez@colorado.edu>
2869 2005-03-26 Fernando Perez <fperez@colorado.edu>
2859
2870
2860 * ipython.el: Fix http://www.scipy.net/roundup/ipython/issue31.
2871 * ipython.el: Fix http://www.scipy.net/roundup/ipython/issue31.
2861 Bugfix by A. Schmolck, the ipython.el maintainer. Also make
2872 Bugfix by A. Schmolck, the ipython.el maintainer. Also make
2862 ipython.el robust against prompts with any number of spaces
2873 ipython.el robust against prompts with any number of spaces
2863 (including 0) after the ':' character.
2874 (including 0) after the ':' character.
2864
2875
2865 * IPython/Prompts.py (Prompt2.set_p_str): Fix spurious space in
2876 * IPython/Prompts.py (Prompt2.set_p_str): Fix spurious space in
2866 continuation prompt, which misled users to think the line was
2877 continuation prompt, which misled users to think the line was
2867 already indented. Closes debian Bug#300847, reported to me by
2878 already indented. Closes debian Bug#300847, reported to me by
2868 Norbert Tretkowski <tretkowski-AT-inittab.de>.
2879 Norbert Tretkowski <tretkowski-AT-inittab.de>.
2869
2880
2870 2005-03-23 Fernando Perez <fperez@colorado.edu>
2881 2005-03-23 Fernando Perez <fperez@colorado.edu>
2871
2882
2872 * IPython/Prompts.py (Prompt1.__str__): Make sure that prompts are
2883 * IPython/Prompts.py (Prompt1.__str__): Make sure that prompts are
2873 properly aligned if they have embedded newlines.
2884 properly aligned if they have embedded newlines.
2874
2885
2875 * IPython/iplib.py (runlines): Add a public method to expose
2886 * IPython/iplib.py (runlines): Add a public method to expose
2876 IPython's code execution machinery, so that users can run strings
2887 IPython's code execution machinery, so that users can run strings
2877 as if they had been typed at the prompt interactively.
2888 as if they had been typed at the prompt interactively.
2878 (InteractiveShell.__init__): Added getoutput() to the __IPYTHON__
2889 (InteractiveShell.__init__): Added getoutput() to the __IPYTHON__
2879 methods which can call the system shell, but with python variable
2890 methods which can call the system shell, but with python variable
2880 expansion. The three such methods are: __IPYTHON__.system,
2891 expansion. The three such methods are: __IPYTHON__.system,
2881 .getoutput and .getoutputerror. These need to be documented in a
2892 .getoutput and .getoutputerror. These need to be documented in a
2882 'public API' section (to be written) of the manual.
2893 'public API' section (to be written) of the manual.
2883
2894
2884 2005-03-20 Fernando Perez <fperez@colorado.edu>
2895 2005-03-20 Fernando Perez <fperez@colorado.edu>
2885
2896
2886 * IPython/iplib.py (InteractiveShell.set_custom_exc): new system
2897 * IPython/iplib.py (InteractiveShell.set_custom_exc): new system
2887 for custom exception handling. This is quite powerful, and it
2898 for custom exception handling. This is quite powerful, and it
2888 allows for user-installable exception handlers which can trap
2899 allows for user-installable exception handlers which can trap
2889 custom exceptions at runtime and treat them separately from
2900 custom exceptions at runtime and treat them separately from
2890 IPython's default mechanisms. At the request of FrΓ©dΓ©ric
2901 IPython's default mechanisms. At the request of FrΓ©dΓ©ric
2891 Mantegazza <mantegazza-AT-ill.fr>.
2902 Mantegazza <mantegazza-AT-ill.fr>.
2892 (InteractiveShell.set_custom_completer): public API function to
2903 (InteractiveShell.set_custom_completer): public API function to
2893 add new completers at runtime.
2904 add new completers at runtime.
2894
2905
2895 2005-03-19 Fernando Perez <fperez@colorado.edu>
2906 2005-03-19 Fernando Perez <fperez@colorado.edu>
2896
2907
2897 * IPython/OInspect.py (getdoc): Add a call to obj.getdoc(), to
2908 * IPython/OInspect.py (getdoc): Add a call to obj.getdoc(), to
2898 allow objects which provide their docstrings via non-standard
2909 allow objects which provide their docstrings via non-standard
2899 mechanisms (like Pyro proxies) to still be inspected by ipython's
2910 mechanisms (like Pyro proxies) to still be inspected by ipython's
2900 ? system.
2911 ? system.
2901
2912
2902 * IPython/iplib.py (InteractiveShell.__init__): back off the _o/_e
2913 * IPython/iplib.py (InteractiveShell.__init__): back off the _o/_e
2903 automatic capture system. I tried quite hard to make it work
2914 automatic capture system. I tried quite hard to make it work
2904 reliably, and simply failed. I tried many combinations with the
2915 reliably, and simply failed. I tried many combinations with the
2905 subprocess module, but eventually nothing worked in all needed
2916 subprocess module, but eventually nothing worked in all needed
2906 cases (not blocking stdin for the child, duplicating stdout
2917 cases (not blocking stdin for the child, duplicating stdout
2907 without blocking, etc). The new %sc/%sx still do capture to these
2918 without blocking, etc). The new %sc/%sx still do capture to these
2908 magical list/string objects which make shell use much more
2919 magical list/string objects which make shell use much more
2909 conveninent, so not all is lost.
2920 conveninent, so not all is lost.
2910
2921
2911 XXX - FIX MANUAL for the change above!
2922 XXX - FIX MANUAL for the change above!
2912
2923
2913 (runsource): I copied code.py's runsource() into ipython to modify
2924 (runsource): I copied code.py's runsource() into ipython to modify
2914 it a bit. Now the code object and source to be executed are
2925 it a bit. Now the code object and source to be executed are
2915 stored in ipython. This makes this info accessible to third-party
2926 stored in ipython. This makes this info accessible to third-party
2916 tools, like custom exception handlers. After a request by FrΓ©dΓ©ric
2927 tools, like custom exception handlers. After a request by FrΓ©dΓ©ric
2917 Mantegazza <mantegazza-AT-ill.fr>.
2928 Mantegazza <mantegazza-AT-ill.fr>.
2918
2929
2919 * IPython/UserConfig/ipythonrc: Add up/down arrow keys to
2930 * IPython/UserConfig/ipythonrc: Add up/down arrow keys to
2920 history-search via readline (like C-p/C-n). I'd wanted this for a
2931 history-search via readline (like C-p/C-n). I'd wanted this for a
2921 long time, but only recently found out how to do it. For users
2932 long time, but only recently found out how to do it. For users
2922 who already have their ipythonrc files made and want this, just
2933 who already have their ipythonrc files made and want this, just
2923 add:
2934 add:
2924
2935
2925 readline_parse_and_bind "\e[A": history-search-backward
2936 readline_parse_and_bind "\e[A": history-search-backward
2926 readline_parse_and_bind "\e[B": history-search-forward
2937 readline_parse_and_bind "\e[B": history-search-forward
2927
2938
2928 2005-03-18 Fernando Perez <fperez@colorado.edu>
2939 2005-03-18 Fernando Perez <fperez@colorado.edu>
2929
2940
2930 * IPython/Magic.py (magic_sc): %sc and %sx now use the fancy
2941 * IPython/Magic.py (magic_sc): %sc and %sx now use the fancy
2931 LSString and SList classes which allow transparent conversions
2942 LSString and SList classes which allow transparent conversions
2932 between list mode and whitespace-separated string.
2943 between list mode and whitespace-separated string.
2933 (magic_r): Fix recursion problem in %r.
2944 (magic_r): Fix recursion problem in %r.
2934
2945
2935 * IPython/genutils.py (LSString): New class to be used for
2946 * IPython/genutils.py (LSString): New class to be used for
2936 automatic storage of the results of all alias/system calls in _o
2947 automatic storage of the results of all alias/system calls in _o
2937 and _e (stdout/err). These provide a .l/.list attribute which
2948 and _e (stdout/err). These provide a .l/.list attribute which
2938 does automatic splitting on newlines. This means that for most
2949 does automatic splitting on newlines. This means that for most
2939 uses, you'll never need to do capturing of output with %sc/%sx
2950 uses, you'll never need to do capturing of output with %sc/%sx
2940 anymore, since ipython keeps this always done for you. Note that
2951 anymore, since ipython keeps this always done for you. Note that
2941 only the LAST results are stored, the _o/e variables are
2952 only the LAST results are stored, the _o/e variables are
2942 overwritten on each call. If you need to save their contents
2953 overwritten on each call. If you need to save their contents
2943 further, simply bind them to any other name.
2954 further, simply bind them to any other name.
2944
2955
2945 2005-03-17 Fernando Perez <fperez@colorado.edu>
2956 2005-03-17 Fernando Perez <fperez@colorado.edu>
2946
2957
2947 * IPython/Prompts.py (BasePrompt.cwd_filt): a few more fixes for
2958 * IPython/Prompts.py (BasePrompt.cwd_filt): a few more fixes for
2948 prompt namespace handling.
2959 prompt namespace handling.
2949
2960
2950 2005-03-16 Fernando Perez <fperez@colorado.edu>
2961 2005-03-16 Fernando Perez <fperez@colorado.edu>
2951
2962
2952 * IPython/Prompts.py (CachedOutput.__init__): Fix default and
2963 * IPython/Prompts.py (CachedOutput.__init__): Fix default and
2953 classic prompts to be '>>> ' (final space was missing, and it
2964 classic prompts to be '>>> ' (final space was missing, and it
2954 trips the emacs python mode).
2965 trips the emacs python mode).
2955 (BasePrompt.__str__): Added safe support for dynamic prompt
2966 (BasePrompt.__str__): Added safe support for dynamic prompt
2956 strings. Now you can set your prompt string to be '$x', and the
2967 strings. Now you can set your prompt string to be '$x', and the
2957 value of x will be printed from your interactive namespace. The
2968 value of x will be printed from your interactive namespace. The
2958 interpolation syntax includes the full Itpl support, so
2969 interpolation syntax includes the full Itpl support, so
2959 ${foo()+x+bar()} is a valid prompt string now, and the function
2970 ${foo()+x+bar()} is a valid prompt string now, and the function
2960 calls will be made at runtime.
2971 calls will be made at runtime.
2961
2972
2962 2005-03-15 Fernando Perez <fperez@colorado.edu>
2973 2005-03-15 Fernando Perez <fperez@colorado.edu>
2963
2974
2964 * IPython/Magic.py (magic_history): renamed %hist to %history, to
2975 * IPython/Magic.py (magic_history): renamed %hist to %history, to
2965 avoid name clashes in pylab. %hist still works, it just forwards
2976 avoid name clashes in pylab. %hist still works, it just forwards
2966 the call to %history.
2977 the call to %history.
2967
2978
2968 2005-03-02 *** Released version 0.6.12
2979 2005-03-02 *** Released version 0.6.12
2969
2980
2970 2005-03-02 Fernando Perez <fperez@colorado.edu>
2981 2005-03-02 Fernando Perez <fperez@colorado.edu>
2971
2982
2972 * IPython/iplib.py (handle_magic): log magic calls properly as
2983 * IPython/iplib.py (handle_magic): log magic calls properly as
2973 ipmagic() function calls.
2984 ipmagic() function calls.
2974
2985
2975 * IPython/Magic.py (magic_time): Improved %time to support
2986 * IPython/Magic.py (magic_time): Improved %time to support
2976 statements and provide wall-clock as well as CPU time.
2987 statements and provide wall-clock as well as CPU time.
2977
2988
2978 2005-02-27 Fernando Perez <fperez@colorado.edu>
2989 2005-02-27 Fernando Perez <fperez@colorado.edu>
2979
2990
2980 * IPython/hooks.py: New hooks module, to expose user-modifiable
2991 * IPython/hooks.py: New hooks module, to expose user-modifiable
2981 IPython functionality in a clean manner. For now only the editor
2992 IPython functionality in a clean manner. For now only the editor
2982 hook is actually written, and other thigns which I intend to turn
2993 hook is actually written, and other thigns which I intend to turn
2983 into proper hooks aren't yet there. The display and prefilter
2994 into proper hooks aren't yet there. The display and prefilter
2984 stuff, for example, should be hooks. But at least now the
2995 stuff, for example, should be hooks. But at least now the
2985 framework is in place, and the rest can be moved here with more
2996 framework is in place, and the rest can be moved here with more
2986 time later. IPython had had a .hooks variable for a long time for
2997 time later. IPython had had a .hooks variable for a long time for
2987 this purpose, but I'd never actually used it for anything.
2998 this purpose, but I'd never actually used it for anything.
2988
2999
2989 2005-02-26 Fernando Perez <fperez@colorado.edu>
3000 2005-02-26 Fernando Perez <fperez@colorado.edu>
2990
3001
2991 * IPython/ipmaker.py (make_IPython): make the default ipython
3002 * IPython/ipmaker.py (make_IPython): make the default ipython
2992 directory be called _ipython under win32, to follow more the
3003 directory be called _ipython under win32, to follow more the
2993 naming peculiarities of that platform (where buggy software like
3004 naming peculiarities of that platform (where buggy software like
2994 Visual Sourcesafe breaks with .named directories). Reported by
3005 Visual Sourcesafe breaks with .named directories). Reported by
2995 Ville Vainio.
3006 Ville Vainio.
2996
3007
2997 2005-02-23 Fernando Perez <fperez@colorado.edu>
3008 2005-02-23 Fernando Perez <fperez@colorado.edu>
2998
3009
2999 * IPython/iplib.py (InteractiveShell.__init__): removed a few
3010 * IPython/iplib.py (InteractiveShell.__init__): removed a few
3000 auto_aliases for win32 which were causing problems. Users can
3011 auto_aliases for win32 which were causing problems. Users can
3001 define the ones they personally like.
3012 define the ones they personally like.
3002
3013
3003 2005-02-21 Fernando Perez <fperez@colorado.edu>
3014 2005-02-21 Fernando Perez <fperez@colorado.edu>
3004
3015
3005 * IPython/Magic.py (magic_time): new magic to time execution of
3016 * IPython/Magic.py (magic_time): new magic to time execution of
3006 expressions. After a request by Charles Moad <cmoad-AT-indiana.edu>.
3017 expressions. After a request by Charles Moad <cmoad-AT-indiana.edu>.
3007
3018
3008 2005-02-19 Fernando Perez <fperez@colorado.edu>
3019 2005-02-19 Fernando Perez <fperez@colorado.edu>
3009
3020
3010 * IPython/ConfigLoader.py (ConfigLoader.load): Allow empty strings
3021 * IPython/ConfigLoader.py (ConfigLoader.load): Allow empty strings
3011 into keys (for prompts, for example).
3022 into keys (for prompts, for example).
3012
3023
3013 * IPython/Prompts.py (BasePrompt.set_p_str): Fix to allow empty
3024 * IPython/Prompts.py (BasePrompt.set_p_str): Fix to allow empty
3014 prompts in case users want them. This introduces a small behavior
3025 prompts in case users want them. This introduces a small behavior
3015 change: ipython does not automatically add a space to all prompts
3026 change: ipython does not automatically add a space to all prompts
3016 anymore. To get the old prompts with a space, users should add it
3027 anymore. To get the old prompts with a space, users should add it
3017 manually to their ipythonrc file, so for example prompt_in1 should
3028 manually to their ipythonrc file, so for example prompt_in1 should
3018 now read 'In [\#]: ' instead of 'In [\#]:'.
3029 now read 'In [\#]: ' instead of 'In [\#]:'.
3019 (BasePrompt.__init__): New option prompts_pad_left (only in rc
3030 (BasePrompt.__init__): New option prompts_pad_left (only in rc
3020 file) to control left-padding of secondary prompts.
3031 file) to control left-padding of secondary prompts.
3021
3032
3022 * IPython/Magic.py (Magic.profile_missing_notice): Don't crash if
3033 * IPython/Magic.py (Magic.profile_missing_notice): Don't crash if
3023 the profiler can't be imported. Fix for Debian, which removed
3034 the profiler can't be imported. Fix for Debian, which removed
3024 profile.py because of License issues. I applied a slightly
3035 profile.py because of License issues. I applied a slightly
3025 modified version of the original Debian patch at
3036 modified version of the original Debian patch at
3026 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=294500.
3037 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=294500.
3027
3038
3028 2005-02-17 Fernando Perez <fperez@colorado.edu>
3039 2005-02-17 Fernando Perez <fperez@colorado.edu>
3029
3040
3030 * IPython/genutils.py (native_line_ends): Fix bug which would
3041 * IPython/genutils.py (native_line_ends): Fix bug which would
3031 cause improper line-ends under win32 b/c I was not opening files
3042 cause improper line-ends under win32 b/c I was not opening files
3032 in binary mode. Bug report and fix thanks to Ville.
3043 in binary mode. Bug report and fix thanks to Ville.
3033
3044
3034 * IPython/iplib.py (handle_auto): Fix bug which I introduced when
3045 * IPython/iplib.py (handle_auto): Fix bug which I introduced when
3035 trying to catch spurious foo[1] autocalls. My fix actually broke
3046 trying to catch spurious foo[1] autocalls. My fix actually broke
3036 ',/' autoquote/call with explicit escape (bad regexp).
3047 ',/' autoquote/call with explicit escape (bad regexp).
3037
3048
3038 2005-02-15 *** Released version 0.6.11
3049 2005-02-15 *** Released version 0.6.11
3039
3050
3040 2005-02-14 Fernando Perez <fperez@colorado.edu>
3051 2005-02-14 Fernando Perez <fperez@colorado.edu>
3041
3052
3042 * IPython/background_jobs.py: New background job management
3053 * IPython/background_jobs.py: New background job management
3043 subsystem. This is implemented via a new set of classes, and
3054 subsystem. This is implemented via a new set of classes, and
3044 IPython now provides a builtin 'jobs' object for background job
3055 IPython now provides a builtin 'jobs' object for background job
3045 execution. A convenience %bg magic serves as a lightweight
3056 execution. A convenience %bg magic serves as a lightweight
3046 frontend for starting the more common type of calls. This was
3057 frontend for starting the more common type of calls. This was
3047 inspired by discussions with B. Granger and the BackgroundCommand
3058 inspired by discussions with B. Granger and the BackgroundCommand
3048 class described in the book Python Scripting for Computational
3059 class described in the book Python Scripting for Computational
3049 Science, by H. P. Langtangen: http://folk.uio.no/hpl/scripting
3060 Science, by H. P. Langtangen: http://folk.uio.no/hpl/scripting
3050 (although ultimately no code from this text was used, as IPython's
3061 (although ultimately no code from this text was used, as IPython's
3051 system is a separate implementation).
3062 system is a separate implementation).
3052
3063
3053 * IPython/iplib.py (MagicCompleter.python_matches): add new option
3064 * IPython/iplib.py (MagicCompleter.python_matches): add new option
3054 to control the completion of single/double underscore names
3065 to control the completion of single/double underscore names
3055 separately. As documented in the example ipytonrc file, the
3066 separately. As documented in the example ipytonrc file, the
3056 readline_omit__names variable can now be set to 2, to omit even
3067 readline_omit__names variable can now be set to 2, to omit even
3057 single underscore names. Thanks to a patch by Brian Wong
3068 single underscore names. Thanks to a patch by Brian Wong
3058 <BrianWong-AT-AirgoNetworks.Com>.
3069 <BrianWong-AT-AirgoNetworks.Com>.
3059 (InteractiveShell.__init__): Fix bug which would cause foo[1] to
3070 (InteractiveShell.__init__): Fix bug which would cause foo[1] to
3060 be autocalled as foo([1]) if foo were callable. A problem for
3071 be autocalled as foo([1]) if foo were callable. A problem for
3061 things which are both callable and implement __getitem__.
3072 things which are both callable and implement __getitem__.
3062 (init_readline): Fix autoindentation for win32. Thanks to a patch
3073 (init_readline): Fix autoindentation for win32. Thanks to a patch
3063 by Vivian De Smedt <vivian-AT-vdesmedt.com>.
3074 by Vivian De Smedt <vivian-AT-vdesmedt.com>.
3064
3075
3065 2005-02-12 Fernando Perez <fperez@colorado.edu>
3076 2005-02-12 Fernando Perez <fperez@colorado.edu>
3066
3077
3067 * IPython/ipmaker.py (make_IPython): Disabled the stout traps
3078 * IPython/ipmaker.py (make_IPython): Disabled the stout traps
3068 which I had written long ago to sort out user error messages which
3079 which I had written long ago to sort out user error messages which
3069 may occur during startup. This seemed like a good idea initially,
3080 may occur during startup. This seemed like a good idea initially,
3070 but it has proven a disaster in retrospect. I don't want to
3081 but it has proven a disaster in retrospect. I don't want to
3071 change much code for now, so my fix is to set the internal 'debug'
3082 change much code for now, so my fix is to set the internal 'debug'
3072 flag to true everywhere, whose only job was precisely to control
3083 flag to true everywhere, whose only job was precisely to control
3073 this subsystem. This closes issue 28 (as well as avoiding all
3084 this subsystem. This closes issue 28 (as well as avoiding all
3074 sorts of strange hangups which occur from time to time).
3085 sorts of strange hangups which occur from time to time).
3075
3086
3076 2005-02-07 Fernando Perez <fperez@colorado.edu>
3087 2005-02-07 Fernando Perez <fperez@colorado.edu>
3077
3088
3078 * IPython/Magic.py (magic_edit): Fix 'ed -p' not working when the
3089 * IPython/Magic.py (magic_edit): Fix 'ed -p' not working when the
3079 previous call produced a syntax error.
3090 previous call produced a syntax error.
3080
3091
3081 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
3092 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
3082 classes without constructor.
3093 classes without constructor.
3083
3094
3084 2005-02-06 Fernando Perez <fperez@colorado.edu>
3095 2005-02-06 Fernando Perez <fperez@colorado.edu>
3085
3096
3086 * IPython/iplib.py (MagicCompleter.complete): Extend the list of
3097 * IPython/iplib.py (MagicCompleter.complete): Extend the list of
3087 completions with the results of each matcher, so we return results
3098 completions with the results of each matcher, so we return results
3088 to the user from all namespaces. This breaks with ipython
3099 to the user from all namespaces. This breaks with ipython
3089 tradition, but I think it's a nicer behavior. Now you get all
3100 tradition, but I think it's a nicer behavior. Now you get all
3090 possible completions listed, from all possible namespaces (python,
3101 possible completions listed, from all possible namespaces (python,
3091 filesystem, magics...) After a request by John Hunter
3102 filesystem, magics...) After a request by John Hunter
3092 <jdhunter-AT-nitace.bsd.uchicago.edu>.
3103 <jdhunter-AT-nitace.bsd.uchicago.edu>.
3093
3104
3094 2005-02-05 Fernando Perez <fperez@colorado.edu>
3105 2005-02-05 Fernando Perez <fperez@colorado.edu>
3095
3106
3096 * IPython/Magic.py (magic_prun): Fix bug where prun would fail if
3107 * IPython/Magic.py (magic_prun): Fix bug where prun would fail if
3097 the call had quote characters in it (the quotes were stripped).
3108 the call had quote characters in it (the quotes were stripped).
3098
3109
3099 2005-01-31 Fernando Perez <fperez@colorado.edu>
3110 2005-01-31 Fernando Perez <fperez@colorado.edu>
3100
3111
3101 * IPython/iplib.py (InteractiveShell.__init__): reduce reliance on
3112 * IPython/iplib.py (InteractiveShell.__init__): reduce reliance on
3102 Itpl.itpl() to make the code more robust against psyco
3113 Itpl.itpl() to make the code more robust against psyco
3103 optimizations.
3114 optimizations.
3104
3115
3105 * IPython/Itpl.py (Itpl.__str__): Use a _getframe() call instead
3116 * IPython/Itpl.py (Itpl.__str__): Use a _getframe() call instead
3106 of causing an exception. Quicker, cleaner.
3117 of causing an exception. Quicker, cleaner.
3107
3118
3108 2005-01-28 Fernando Perez <fperez@colorado.edu>
3119 2005-01-28 Fernando Perez <fperez@colorado.edu>
3109
3120
3110 * scripts/ipython_win_post_install.py (install): hardcode
3121 * scripts/ipython_win_post_install.py (install): hardcode
3111 sys.prefix+'python.exe' as the executable path. It turns out that
3122 sys.prefix+'python.exe' as the executable path. It turns out that
3112 during the post-installation run, sys.executable resolves to the
3123 during the post-installation run, sys.executable resolves to the
3113 name of the binary installer! I should report this as a distutils
3124 name of the binary installer! I should report this as a distutils
3114 bug, I think. I updated the .10 release with this tiny fix, to
3125 bug, I think. I updated the .10 release with this tiny fix, to
3115 avoid annoying the lists further.
3126 avoid annoying the lists further.
3116
3127
3117 2005-01-27 *** Released version 0.6.10
3128 2005-01-27 *** Released version 0.6.10
3118
3129
3119 2005-01-27 Fernando Perez <fperez@colorado.edu>
3130 2005-01-27 Fernando Perez <fperez@colorado.edu>
3120
3131
3121 * IPython/numutils.py (norm): Added 'inf' as optional name for
3132 * IPython/numutils.py (norm): Added 'inf' as optional name for
3122 L-infinity norm, included references to mathworld.com for vector
3133 L-infinity norm, included references to mathworld.com for vector
3123 norm definitions.
3134 norm definitions.
3124 (amin/amax): added amin/amax for array min/max. Similar to what
3135 (amin/amax): added amin/amax for array min/max. Similar to what
3125 pylab ships with after the recent reorganization of names.
3136 pylab ships with after the recent reorganization of names.
3126 (spike/spike_odd): removed deprecated spike/spike_odd functions.
3137 (spike/spike_odd): removed deprecated spike/spike_odd functions.
3127
3138
3128 * ipython.el: committed Alex's recent fixes and improvements.
3139 * ipython.el: committed Alex's recent fixes and improvements.
3129 Tested with python-mode from CVS, and it looks excellent. Since
3140 Tested with python-mode from CVS, and it looks excellent. Since
3130 python-mode hasn't released anything in a while, I'm temporarily
3141 python-mode hasn't released anything in a while, I'm temporarily
3131 putting a copy of today's CVS (v 4.70) of python-mode in:
3142 putting a copy of today's CVS (v 4.70) of python-mode in:
3132 http://ipython.scipy.org/tmp/python-mode.el
3143 http://ipython.scipy.org/tmp/python-mode.el
3133
3144
3134 * scripts/ipython_win_post_install.py (install): Win32 fix to use
3145 * scripts/ipython_win_post_install.py (install): Win32 fix to use
3135 sys.executable for the executable name, instead of assuming it's
3146 sys.executable for the executable name, instead of assuming it's
3136 called 'python.exe' (the post-installer would have produced broken
3147 called 'python.exe' (the post-installer would have produced broken
3137 setups on systems with a differently named python binary).
3148 setups on systems with a differently named python binary).
3138
3149
3139 * IPython/PyColorize.py (Parser.__call__): change explicit '\n'
3150 * IPython/PyColorize.py (Parser.__call__): change explicit '\n'
3140 references to os.linesep, to make the code more
3151 references to os.linesep, to make the code more
3141 platform-independent. This is also part of the win32 coloring
3152 platform-independent. This is also part of the win32 coloring
3142 fixes.
3153 fixes.
3143
3154
3144 * IPython/genutils.py (page_dumb): Remove attempts to chop long
3155 * IPython/genutils.py (page_dumb): Remove attempts to chop long
3145 lines, which actually cause coloring bugs because the length of
3156 lines, which actually cause coloring bugs because the length of
3146 the line is very difficult to correctly compute with embedded
3157 the line is very difficult to correctly compute with embedded
3147 escapes. This was the source of all the coloring problems under
3158 escapes. This was the source of all the coloring problems under
3148 Win32. I think that _finally_, Win32 users have a properly
3159 Win32. I think that _finally_, Win32 users have a properly
3149 working ipython in all respects. This would never have happened
3160 working ipython in all respects. This would never have happened
3150 if not for Gary Bishop and Viktor Ransmayr's great help and work.
3161 if not for Gary Bishop and Viktor Ransmayr's great help and work.
3151
3162
3152 2005-01-26 *** Released version 0.6.9
3163 2005-01-26 *** Released version 0.6.9
3153
3164
3154 2005-01-25 Fernando Perez <fperez@colorado.edu>
3165 2005-01-25 Fernando Perez <fperez@colorado.edu>
3155
3166
3156 * setup.py: finally, we have a true Windows installer, thanks to
3167 * setup.py: finally, we have a true Windows installer, thanks to
3157 the excellent work of Viktor Ransmayr
3168 the excellent work of Viktor Ransmayr
3158 <viktor.ransmayr-AT-t-online.de>. The docs have been updated for
3169 <viktor.ransmayr-AT-t-online.de>. The docs have been updated for
3159 Windows users. The setup routine is quite a bit cleaner thanks to
3170 Windows users. The setup routine is quite a bit cleaner thanks to
3160 this, and the post-install script uses the proper functions to
3171 this, and the post-install script uses the proper functions to
3161 allow a clean de-installation using the standard Windows Control
3172 allow a clean de-installation using the standard Windows Control
3162 Panel.
3173 Panel.
3163
3174
3164 * IPython/genutils.py (get_home_dir): changed to use the $HOME
3175 * IPython/genutils.py (get_home_dir): changed to use the $HOME
3165 environment variable under all OSes (including win32) if
3176 environment variable under all OSes (including win32) if
3166 available. This will give consistency to win32 users who have set
3177 available. This will give consistency to win32 users who have set
3167 this variable for any reason. If os.environ['HOME'] fails, the
3178 this variable for any reason. If os.environ['HOME'] fails, the
3168 previous policy of using HOMEDRIVE\HOMEPATH kicks in.
3179 previous policy of using HOMEDRIVE\HOMEPATH kicks in.
3169
3180
3170 2005-01-24 Fernando Perez <fperez@colorado.edu>
3181 2005-01-24 Fernando Perez <fperez@colorado.edu>
3171
3182
3172 * IPython/numutils.py (empty_like): add empty_like(), similar to
3183 * IPython/numutils.py (empty_like): add empty_like(), similar to
3173 zeros_like() but taking advantage of the new empty() Numeric routine.
3184 zeros_like() but taking advantage of the new empty() Numeric routine.
3174
3185
3175 2005-01-23 *** Released version 0.6.8
3186 2005-01-23 *** Released version 0.6.8
3176
3187
3177 2005-01-22 Fernando Perez <fperez@colorado.edu>
3188 2005-01-22 Fernando Perez <fperez@colorado.edu>
3178
3189
3179 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): I removed the
3190 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): I removed the
3180 automatic show() calls. After discussing things with JDH, it
3191 automatic show() calls. After discussing things with JDH, it
3181 turns out there are too many corner cases where this can go wrong.
3192 turns out there are too many corner cases where this can go wrong.
3182 It's best not to try to be 'too smart', and simply have ipython
3193 It's best not to try to be 'too smart', and simply have ipython
3183 reproduce as much as possible the default behavior of a normal
3194 reproduce as much as possible the default behavior of a normal
3184 python shell.
3195 python shell.
3185
3196
3186 * IPython/iplib.py (InteractiveShell.__init__): Modified the
3197 * IPython/iplib.py (InteractiveShell.__init__): Modified the
3187 line-splitting regexp and _prefilter() to avoid calling getattr()
3198 line-splitting regexp and _prefilter() to avoid calling getattr()
3188 on assignments. This closes
3199 on assignments. This closes
3189 http://www.scipy.net/roundup/ipython/issue24. Note that Python's
3200 http://www.scipy.net/roundup/ipython/issue24. Note that Python's
3190 readline uses getattr(), so a simple <TAB> keypress is still
3201 readline uses getattr(), so a simple <TAB> keypress is still
3191 enough to trigger getattr() calls on an object.
3202 enough to trigger getattr() calls on an object.
3192
3203
3193 2005-01-21 Fernando Perez <fperez@colorado.edu>
3204 2005-01-21 Fernando Perez <fperez@colorado.edu>
3194
3205
3195 * IPython/Shell.py (MatplotlibShellBase.magic_run): Fix the %run
3206 * IPython/Shell.py (MatplotlibShellBase.magic_run): Fix the %run
3196 docstring under pylab so it doesn't mask the original.
3207 docstring under pylab so it doesn't mask the original.
3197
3208
3198 2005-01-21 *** Released version 0.6.7
3209 2005-01-21 *** Released version 0.6.7
3199
3210
3200 2005-01-21 Fernando Perez <fperez@colorado.edu>
3211 2005-01-21 Fernando Perez <fperez@colorado.edu>
3201
3212
3202 * IPython/Shell.py (MTInteractiveShell.runcode): Trap a crash with
3213 * IPython/Shell.py (MTInteractiveShell.runcode): Trap a crash with
3203 signal handling for win32 users in multithreaded mode.
3214 signal handling for win32 users in multithreaded mode.
3204
3215
3205 2005-01-17 Fernando Perez <fperez@colorado.edu>
3216 2005-01-17 Fernando Perez <fperez@colorado.edu>
3206
3217
3207 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
3218 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
3208 instances with no __init__. After a crash report by Norbert Nemec
3219 instances with no __init__. After a crash report by Norbert Nemec
3209 <Norbert-AT-nemec-online.de>.
3220 <Norbert-AT-nemec-online.de>.
3210
3221
3211 2005-01-14 Fernando Perez <fperez@colorado.edu>
3222 2005-01-14 Fernando Perez <fperez@colorado.edu>
3212
3223
3213 * IPython/ultraTB.py (VerboseTB.text): Fix bug in reporting of
3224 * IPython/ultraTB.py (VerboseTB.text): Fix bug in reporting of
3214 names for verbose exceptions, when multiple dotted names and the
3225 names for verbose exceptions, when multiple dotted names and the
3215 'parent' object were present on the same line.
3226 'parent' object were present on the same line.
3216
3227
3217 2005-01-11 Fernando Perez <fperez@colorado.edu>
3228 2005-01-11 Fernando Perez <fperez@colorado.edu>
3218
3229
3219 * IPython/genutils.py (flag_calls): new utility to trap and flag
3230 * IPython/genutils.py (flag_calls): new utility to trap and flag
3220 calls in functions. I need it to clean up matplotlib support.
3231 calls in functions. I need it to clean up matplotlib support.
3221 Also removed some deprecated code in genutils.
3232 Also removed some deprecated code in genutils.
3222
3233
3223 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): small fix so
3234 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): small fix so
3224 that matplotlib scripts called with %run, which don't call show()
3235 that matplotlib scripts called with %run, which don't call show()
3225 themselves, still have their plotting windows open.
3236 themselves, still have their plotting windows open.
3226
3237
3227 2005-01-05 Fernando Perez <fperez@colorado.edu>
3238 2005-01-05 Fernando Perez <fperez@colorado.edu>
3228
3239
3229 * IPython/Shell.py (IPShellGTK.__init__): Patch by Andrew Straw
3240 * IPython/Shell.py (IPShellGTK.__init__): Patch by Andrew Straw
3230 <astraw-AT-caltech.edu>, to fix gtk deprecation warnings.
3241 <astraw-AT-caltech.edu>, to fix gtk deprecation warnings.
3231
3242
3232 2004-12-19 Fernando Perez <fperez@colorado.edu>
3243 2004-12-19 Fernando Perez <fperez@colorado.edu>
3233
3244
3234 * IPython/Shell.py (MTInteractiveShell.runcode): Get rid of
3245 * IPython/Shell.py (MTInteractiveShell.runcode): Get rid of
3235 parent_runcode, which was an eyesore. The same result can be
3246 parent_runcode, which was an eyesore. The same result can be
3236 obtained with Python's regular superclass mechanisms.
3247 obtained with Python's regular superclass mechanisms.
3237
3248
3238 2004-12-17 Fernando Perez <fperez@colorado.edu>
3249 2004-12-17 Fernando Perez <fperez@colorado.edu>
3239
3250
3240 * IPython/Magic.py (Magic.magic_sc): Fix quote stripping problem
3251 * IPython/Magic.py (Magic.magic_sc): Fix quote stripping problem
3241 reported by Prabhu.
3252 reported by Prabhu.
3242 (Magic.magic_sx): direct all errors to Term.cerr (defaults to
3253 (Magic.magic_sx): direct all errors to Term.cerr (defaults to
3243 sys.stderr) instead of explicitly calling sys.stderr. This helps
3254 sys.stderr) instead of explicitly calling sys.stderr. This helps
3244 maintain our I/O abstractions clean, for future GUI embeddings.
3255 maintain our I/O abstractions clean, for future GUI embeddings.
3245
3256
3246 * IPython/genutils.py (info): added new utility for sys.stderr
3257 * IPython/genutils.py (info): added new utility for sys.stderr
3247 unified info message handling (thin wrapper around warn()).
3258 unified info message handling (thin wrapper around warn()).
3248
3259
3249 * IPython/ultraTB.py (VerboseTB.text): Fix misreported global
3260 * IPython/ultraTB.py (VerboseTB.text): Fix misreported global
3250 composite (dotted) names on verbose exceptions.
3261 composite (dotted) names on verbose exceptions.
3251 (VerboseTB.nullrepr): harden against another kind of errors which
3262 (VerboseTB.nullrepr): harden against another kind of errors which
3252 Python's inspect module can trigger, and which were crashing
3263 Python's inspect module can trigger, and which were crashing
3253 IPython. Thanks to a report by Marco Lombardi
3264 IPython. Thanks to a report by Marco Lombardi
3254 <mlombard-AT-ma010192.hq.eso.org>.
3265 <mlombard-AT-ma010192.hq.eso.org>.
3255
3266
3256 2004-12-13 *** Released version 0.6.6
3267 2004-12-13 *** Released version 0.6.6
3257
3268
3258 2004-12-12 Fernando Perez <fperez@colorado.edu>
3269 2004-12-12 Fernando Perez <fperez@colorado.edu>
3259
3270
3260 * IPython/Shell.py (IPShellGTK.mainloop): catch RuntimeErrors
3271 * IPython/Shell.py (IPShellGTK.mainloop): catch RuntimeErrors
3261 generated by pygtk upon initialization if it was built without
3272 generated by pygtk upon initialization if it was built without
3262 threads (for matplotlib users). After a crash reported by
3273 threads (for matplotlib users). After a crash reported by
3263 Leguijt, Jaap J SIEP-EPT-RES <Jaap.Leguijt-AT-shell.com>.
3274 Leguijt, Jaap J SIEP-EPT-RES <Jaap.Leguijt-AT-shell.com>.
3264
3275
3265 * IPython/ipmaker.py (make_IPython): fix small bug in the
3276 * IPython/ipmaker.py (make_IPython): fix small bug in the
3266 import_some parameter for multiple imports.
3277 import_some parameter for multiple imports.
3267
3278
3268 * IPython/iplib.py (ipmagic): simplified the interface of
3279 * IPython/iplib.py (ipmagic): simplified the interface of
3269 ipmagic() to take a single string argument, just as it would be
3280 ipmagic() to take a single string argument, just as it would be
3270 typed at the IPython cmd line.
3281 typed at the IPython cmd line.
3271 (ipalias): Added new ipalias() with an interface identical to
3282 (ipalias): Added new ipalias() with an interface identical to
3272 ipmagic(). This completes exposing a pure python interface to the
3283 ipmagic(). This completes exposing a pure python interface to the
3273 alias and magic system, which can be used in loops or more complex
3284 alias and magic system, which can be used in loops or more complex
3274 code where IPython's automatic line mangling is not active.
3285 code where IPython's automatic line mangling is not active.
3275
3286
3276 * IPython/genutils.py (timing): changed interface of timing to
3287 * IPython/genutils.py (timing): changed interface of timing to
3277 simply run code once, which is the most common case. timings()
3288 simply run code once, which is the most common case. timings()
3278 remains unchanged, for the cases where you want multiple runs.
3289 remains unchanged, for the cases where you want multiple runs.
3279
3290
3280 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix a
3291 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix a
3281 bug where Python2.2 crashes with exec'ing code which does not end
3292 bug where Python2.2 crashes with exec'ing code which does not end
3282 in a single newline. Python 2.3 is OK, so I hadn't noticed this
3293 in a single newline. Python 2.3 is OK, so I hadn't noticed this
3283 before.
3294 before.
3284
3295
3285 2004-12-10 Fernando Perez <fperez@colorado.edu>
3296 2004-12-10 Fernando Perez <fperez@colorado.edu>
3286
3297
3287 * IPython/Magic.py (Magic.magic_prun): changed name of option from
3298 * IPython/Magic.py (Magic.magic_prun): changed name of option from
3288 -t to -T, to accomodate the new -t flag in %run (the %run and
3299 -t to -T, to accomodate the new -t flag in %run (the %run and
3289 %prun options are kind of intermixed, and it's not easy to change
3300 %prun options are kind of intermixed, and it's not easy to change
3290 this with the limitations of python's getopt).
3301 this with the limitations of python's getopt).
3291
3302
3292 * IPython/Magic.py (Magic.magic_run): Added new -t option to time
3303 * IPython/Magic.py (Magic.magic_run): Added new -t option to time
3293 the execution of scripts. It's not as fine-tuned as timeit.py,
3304 the execution of scripts. It's not as fine-tuned as timeit.py,
3294 but it works from inside ipython (and under 2.2, which lacks
3305 but it works from inside ipython (and under 2.2, which lacks
3295 timeit.py). Optionally a number of runs > 1 can be given for
3306 timeit.py). Optionally a number of runs > 1 can be given for
3296 timing very short-running code.
3307 timing very short-running code.
3297
3308
3298 * IPython/genutils.py (uniq_stable): new routine which returns a
3309 * IPython/genutils.py (uniq_stable): new routine which returns a
3299 list of unique elements in any iterable, but in stable order of
3310 list of unique elements in any iterable, but in stable order of
3300 appearance. I needed this for the ultraTB fixes, and it's a handy
3311 appearance. I needed this for the ultraTB fixes, and it's a handy
3301 utility.
3312 utility.
3302
3313
3303 * IPython/ultraTB.py (VerboseTB.text): Fix proper reporting of
3314 * IPython/ultraTB.py (VerboseTB.text): Fix proper reporting of
3304 dotted names in Verbose exceptions. This had been broken since
3315 dotted names in Verbose exceptions. This had been broken since
3305 the very start, now x.y will properly be printed in a Verbose
3316 the very start, now x.y will properly be printed in a Verbose
3306 traceback, instead of x being shown and y appearing always as an
3317 traceback, instead of x being shown and y appearing always as an
3307 'undefined global'. Getting this to work was a bit tricky,
3318 'undefined global'. Getting this to work was a bit tricky,
3308 because by default python tokenizers are stateless. Saved by
3319 because by default python tokenizers are stateless. Saved by
3309 python's ability to easily add a bit of state to an arbitrary
3320 python's ability to easily add a bit of state to an arbitrary
3310 function (without needing to build a full-blown callable object).
3321 function (without needing to build a full-blown callable object).
3311
3322
3312 Also big cleanup of this code, which had horrendous runtime
3323 Also big cleanup of this code, which had horrendous runtime
3313 lookups of zillions of attributes for colorization. Moved all
3324 lookups of zillions of attributes for colorization. Moved all
3314 this code into a few templates, which make it cleaner and quicker.
3325 this code into a few templates, which make it cleaner and quicker.
3315
3326
3316 Printout quality was also improved for Verbose exceptions: one
3327 Printout quality was also improved for Verbose exceptions: one
3317 variable per line, and memory addresses are printed (this can be
3328 variable per line, and memory addresses are printed (this can be
3318 quite handy in nasty debugging situations, which is what Verbose
3329 quite handy in nasty debugging situations, which is what Verbose
3319 is for).
3330 is for).
3320
3331
3321 * IPython/ipmaker.py (make_IPython): Do NOT execute files named in
3332 * IPython/ipmaker.py (make_IPython): Do NOT execute files named in
3322 the command line as scripts to be loaded by embedded instances.
3333 the command line as scripts to be loaded by embedded instances.
3323 Doing so has the potential for an infinite recursion if there are
3334 Doing so has the potential for an infinite recursion if there are
3324 exceptions thrown in the process. This fixes a strange crash
3335 exceptions thrown in the process. This fixes a strange crash
3325 reported by Philippe MULLER <muller-AT-irit.fr>.
3336 reported by Philippe MULLER <muller-AT-irit.fr>.
3326
3337
3327 2004-12-09 Fernando Perez <fperez@colorado.edu>
3338 2004-12-09 Fernando Perez <fperez@colorado.edu>
3328
3339
3329 * IPython/Shell.py (MatplotlibShellBase.use): Change pylab support
3340 * IPython/Shell.py (MatplotlibShellBase.use): Change pylab support
3330 to reflect new names in matplotlib, which now expose the
3341 to reflect new names in matplotlib, which now expose the
3331 matlab-compatible interface via a pylab module instead of the
3342 matlab-compatible interface via a pylab module instead of the
3332 'matlab' name. The new code is backwards compatible, so users of
3343 'matlab' name. The new code is backwards compatible, so users of
3333 all matplotlib versions are OK. Patch by J. Hunter.
3344 all matplotlib versions are OK. Patch by J. Hunter.
3334
3345
3335 * IPython/OInspect.py (Inspector.pinfo): Add to object? printing
3346 * IPython/OInspect.py (Inspector.pinfo): Add to object? printing
3336 of __init__ docstrings for instances (class docstrings are already
3347 of __init__ docstrings for instances (class docstrings are already
3337 automatically printed). Instances with customized docstrings
3348 automatically printed). Instances with customized docstrings
3338 (indep. of the class) are also recognized and all 3 separate
3349 (indep. of the class) are also recognized and all 3 separate
3339 docstrings are printed (instance, class, constructor). After some
3350 docstrings are printed (instance, class, constructor). After some
3340 comments/suggestions by J. Hunter.
3351 comments/suggestions by J. Hunter.
3341
3352
3342 2004-12-05 Fernando Perez <fperez@colorado.edu>
3353 2004-12-05 Fernando Perez <fperez@colorado.edu>
3343
3354
3344 * IPython/iplib.py (MagicCompleter.complete): Remove annoying
3355 * IPython/iplib.py (MagicCompleter.complete): Remove annoying
3345 warnings when tab-completion fails and triggers an exception.
3356 warnings when tab-completion fails and triggers an exception.
3346
3357
3347 2004-12-03 Fernando Perez <fperez@colorado.edu>
3358 2004-12-03 Fernando Perez <fperez@colorado.edu>
3348
3359
3349 * IPython/Magic.py (magic_prun): Fix bug where an exception would
3360 * IPython/Magic.py (magic_prun): Fix bug where an exception would
3350 be triggered when using 'run -p'. An incorrect option flag was
3361 be triggered when using 'run -p'. An incorrect option flag was
3351 being set ('d' instead of 'D').
3362 being set ('d' instead of 'D').
3352 (manpage): fix missing escaped \- sign.
3363 (manpage): fix missing escaped \- sign.
3353
3364
3354 2004-11-30 *** Released version 0.6.5
3365 2004-11-30 *** Released version 0.6.5
3355
3366
3356 2004-11-30 Fernando Perez <fperez@colorado.edu>
3367 2004-11-30 Fernando Perez <fperez@colorado.edu>
3357
3368
3358 * IPython/Magic.py (Magic.magic_run): Fix bug in breakpoint
3369 * IPython/Magic.py (Magic.magic_run): Fix bug in breakpoint
3359 setting with -d option.
3370 setting with -d option.
3360
3371
3361 * setup.py (docfiles): Fix problem where the doc glob I was using
3372 * setup.py (docfiles): Fix problem where the doc glob I was using
3362 was COMPLETELY BROKEN. It was giving the right files by pure
3373 was COMPLETELY BROKEN. It was giving the right files by pure
3363 accident, but failed once I tried to include ipython.el. Note:
3374 accident, but failed once I tried to include ipython.el. Note:
3364 glob() does NOT allow you to do exclusion on multiple endings!
3375 glob() does NOT allow you to do exclusion on multiple endings!
3365
3376
3366 2004-11-29 Fernando Perez <fperez@colorado.edu>
3377 2004-11-29 Fernando Perez <fperez@colorado.edu>
3367
3378
3368 * IPython/usage.py (__doc__): cleaned up usage docstring, by using
3379 * IPython/usage.py (__doc__): cleaned up usage docstring, by using
3369 the manpage as the source. Better formatting & consistency.
3380 the manpage as the source. Better formatting & consistency.
3370
3381
3371 * IPython/Magic.py (magic_run): Added new -d option, to run
3382 * IPython/Magic.py (magic_run): Added new -d option, to run
3372 scripts under the control of the python pdb debugger. Note that
3383 scripts under the control of the python pdb debugger. Note that
3373 this required changing the %prun option -d to -D, to avoid a clash
3384 this required changing the %prun option -d to -D, to avoid a clash
3374 (since %run must pass options to %prun, and getopt is too dumb to
3385 (since %run must pass options to %prun, and getopt is too dumb to
3375 handle options with string values with embedded spaces). Thanks
3386 handle options with string values with embedded spaces). Thanks
3376 to a suggestion by Matthew Arnison <maffew-AT-cat.org.au>.
3387 to a suggestion by Matthew Arnison <maffew-AT-cat.org.au>.
3377 (magic_who_ls): added type matching to %who and %whos, so that one
3388 (magic_who_ls): added type matching to %who and %whos, so that one
3378 can filter their output to only include variables of certain
3389 can filter their output to only include variables of certain
3379 types. Another suggestion by Matthew.
3390 types. Another suggestion by Matthew.
3380 (magic_whos): Added memory summaries in kb and Mb for arrays.
3391 (magic_whos): Added memory summaries in kb and Mb for arrays.
3381 (magic_who): Improve formatting (break lines every 9 vars).
3392 (magic_who): Improve formatting (break lines every 9 vars).
3382
3393
3383 2004-11-28 Fernando Perez <fperez@colorado.edu>
3394 2004-11-28 Fernando Perez <fperez@colorado.edu>
3384
3395
3385 * IPython/Logger.py (Logger.log): Fix bug in syncing the input
3396 * IPython/Logger.py (Logger.log): Fix bug in syncing the input
3386 cache when empty lines were present.
3397 cache when empty lines were present.
3387
3398
3388 2004-11-24 Fernando Perez <fperez@colorado.edu>
3399 2004-11-24 Fernando Perez <fperez@colorado.edu>
3389
3400
3390 * IPython/usage.py (__doc__): document the re-activated threading
3401 * IPython/usage.py (__doc__): document the re-activated threading
3391 options for WX and GTK.
3402 options for WX and GTK.
3392
3403
3393 2004-11-23 Fernando Perez <fperez@colorado.edu>
3404 2004-11-23 Fernando Perez <fperez@colorado.edu>
3394
3405
3395 * IPython/Shell.py (start): Added Prabhu's big patch to reactivate
3406 * IPython/Shell.py (start): Added Prabhu's big patch to reactivate
3396 the -wthread and -gthread options, along with a new -tk one to try
3407 the -wthread and -gthread options, along with a new -tk one to try
3397 and coordinate Tk threading with wx/gtk. The tk support is very
3408 and coordinate Tk threading with wx/gtk. The tk support is very
3398 platform dependent, since it seems to require Tcl and Tk to be
3409 platform dependent, since it seems to require Tcl and Tk to be
3399 built with threads (Fedora1/2 appears NOT to have it, but in
3410 built with threads (Fedora1/2 appears NOT to have it, but in
3400 Prabhu's Debian boxes it works OK). But even with some Tk
3411 Prabhu's Debian boxes it works OK). But even with some Tk
3401 limitations, this is a great improvement.
3412 limitations, this is a great improvement.
3402
3413
3403 * IPython/Prompts.py (prompt_specials_color): Added \t for time
3414 * IPython/Prompts.py (prompt_specials_color): Added \t for time
3404 info in user prompts. Patch by Prabhu.
3415 info in user prompts. Patch by Prabhu.
3405
3416
3406 2004-11-18 Fernando Perez <fperez@colorado.edu>
3417 2004-11-18 Fernando Perez <fperez@colorado.edu>
3407
3418
3408 * IPython/genutils.py (ask_yes_no): Add check for a max of 20
3419 * IPython/genutils.py (ask_yes_no): Add check for a max of 20
3409 EOFErrors and bail, to avoid infinite loops if a non-terminating
3420 EOFErrors and bail, to avoid infinite loops if a non-terminating
3410 file is fed into ipython. Patch submitted in issue 19 by user,
3421 file is fed into ipython. Patch submitted in issue 19 by user,
3411 many thanks.
3422 many thanks.
3412
3423
3413 * IPython/iplib.py (InteractiveShell.handle_auto): do NOT trigger
3424 * IPython/iplib.py (InteractiveShell.handle_auto): do NOT trigger
3414 autoquote/parens in continuation prompts, which can cause lots of
3425 autoquote/parens in continuation prompts, which can cause lots of
3415 problems. Closes roundup issue 20.
3426 problems. Closes roundup issue 20.
3416
3427
3417 2004-11-17 Fernando Perez <fperez@colorado.edu>
3428 2004-11-17 Fernando Perez <fperez@colorado.edu>
3418
3429
3419 * debian/control (Build-Depends-Indep): Fix dpatch dependency,
3430 * debian/control (Build-Depends-Indep): Fix dpatch dependency,
3420 reported as debian bug #280505. I'm not sure my local changelog
3431 reported as debian bug #280505. I'm not sure my local changelog
3421 entry has the proper debian format (Jack?).
3432 entry has the proper debian format (Jack?).
3422
3433
3423 2004-11-08 *** Released version 0.6.4
3434 2004-11-08 *** Released version 0.6.4
3424
3435
3425 2004-11-08 Fernando Perez <fperez@colorado.edu>
3436 2004-11-08 Fernando Perez <fperez@colorado.edu>
3426
3437
3427 * IPython/iplib.py (init_readline): Fix exit message for Windows
3438 * IPython/iplib.py (init_readline): Fix exit message for Windows
3428 when readline is active. Thanks to a report by Eric Jones
3439 when readline is active. Thanks to a report by Eric Jones
3429 <eric-AT-enthought.com>.
3440 <eric-AT-enthought.com>.
3430
3441
3431 2004-11-07 Fernando Perez <fperez@colorado.edu>
3442 2004-11-07 Fernando Perez <fperez@colorado.edu>
3432
3443
3433 * IPython/genutils.py (page): Add a trap for OSError exceptions,
3444 * IPython/genutils.py (page): Add a trap for OSError exceptions,
3434 sometimes seen by win2k/cygwin users.
3445 sometimes seen by win2k/cygwin users.
3435
3446
3436 2004-11-06 Fernando Perez <fperez@colorado.edu>
3447 2004-11-06 Fernando Perez <fperez@colorado.edu>
3437
3448
3438 * IPython/iplib.py (interact): Change the handling of %Exit from
3449 * IPython/iplib.py (interact): Change the handling of %Exit from
3439 trying to propagate a SystemExit to an internal ipython flag.
3450 trying to propagate a SystemExit to an internal ipython flag.
3440 This is less elegant than using Python's exception mechanism, but
3451 This is less elegant than using Python's exception mechanism, but
3441 I can't get that to work reliably with threads, so under -pylab
3452 I can't get that to work reliably with threads, so under -pylab
3442 %Exit was hanging IPython. Cross-thread exception handling is
3453 %Exit was hanging IPython. Cross-thread exception handling is
3443 really a bitch. Thaks to a bug report by Stephen Walton
3454 really a bitch. Thaks to a bug report by Stephen Walton
3444 <stephen.walton-AT-csun.edu>.
3455 <stephen.walton-AT-csun.edu>.
3445
3456
3446 2004-11-04 Fernando Perez <fperez@colorado.edu>
3457 2004-11-04 Fernando Perez <fperez@colorado.edu>
3447
3458
3448 * IPython/iplib.py (raw_input_original): store a pointer to the
3459 * IPython/iplib.py (raw_input_original): store a pointer to the
3449 true raw_input to harden against code which can modify it
3460 true raw_input to harden against code which can modify it
3450 (wx.py.PyShell does this and would otherwise crash ipython).
3461 (wx.py.PyShell does this and would otherwise crash ipython).
3451 Thanks to a bug report by Jim Flowers <james.flowers-AT-lgx.com>.
3462 Thanks to a bug report by Jim Flowers <james.flowers-AT-lgx.com>.
3452
3463
3453 * IPython/Shell.py (MTInteractiveShell.runsource): Cleaner fix for
3464 * IPython/Shell.py (MTInteractiveShell.runsource): Cleaner fix for
3454 Ctrl-C problem, which does not mess up the input line.
3465 Ctrl-C problem, which does not mess up the input line.
3455
3466
3456 2004-11-03 Fernando Perez <fperez@colorado.edu>
3467 2004-11-03 Fernando Perez <fperez@colorado.edu>
3457
3468
3458 * IPython/Release.py: Changed licensing to BSD, in all files.
3469 * IPython/Release.py: Changed licensing to BSD, in all files.
3459 (name): lowercase name for tarball/RPM release.
3470 (name): lowercase name for tarball/RPM release.
3460
3471
3461 * IPython/OInspect.py (getdoc): wrap inspect.getdoc() safely for
3472 * IPython/OInspect.py (getdoc): wrap inspect.getdoc() safely for
3462 use throughout ipython.
3473 use throughout ipython.
3463
3474
3464 * IPython/Magic.py (Magic._ofind): Switch to using the new
3475 * IPython/Magic.py (Magic._ofind): Switch to using the new
3465 OInspect.getdoc() function.
3476 OInspect.getdoc() function.
3466
3477
3467 * IPython/Shell.py (sigint_handler): Hack to ignore the execution
3478 * IPython/Shell.py (sigint_handler): Hack to ignore the execution
3468 of the line currently being canceled via Ctrl-C. It's extremely
3479 of the line currently being canceled via Ctrl-C. It's extremely
3469 ugly, but I don't know how to do it better (the problem is one of
3480 ugly, but I don't know how to do it better (the problem is one of
3470 handling cross-thread exceptions).
3481 handling cross-thread exceptions).
3471
3482
3472 2004-10-28 Fernando Perez <fperez@colorado.edu>
3483 2004-10-28 Fernando Perez <fperez@colorado.edu>
3473
3484
3474 * IPython/Shell.py (signal_handler): add signal handlers to trap
3485 * IPython/Shell.py (signal_handler): add signal handlers to trap
3475 SIGINT and SIGSEGV in threaded code properly. Thanks to a bug
3486 SIGINT and SIGSEGV in threaded code properly. Thanks to a bug
3476 report by Francesc Alted.
3487 report by Francesc Alted.
3477
3488
3478 2004-10-21 Fernando Perez <fperez@colorado.edu>
3489 2004-10-21 Fernando Perez <fperez@colorado.edu>
3479
3490
3480 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Fix @
3491 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Fix @
3481 to % for pysh syntax extensions.
3492 to % for pysh syntax extensions.
3482
3493
3483 2004-10-09 Fernando Perez <fperez@colorado.edu>
3494 2004-10-09 Fernando Perez <fperez@colorado.edu>
3484
3495
3485 * IPython/Magic.py (Magic.magic_whos): modify output of Numeric
3496 * IPython/Magic.py (Magic.magic_whos): modify output of Numeric
3486 arrays to print a more useful summary, without calling str(arr).
3497 arrays to print a more useful summary, without calling str(arr).
3487 This avoids the problem of extremely lengthy computations which
3498 This avoids the problem of extremely lengthy computations which
3488 occur if arr is large, and appear to the user as a system lockup
3499 occur if arr is large, and appear to the user as a system lockup
3489 with 100% cpu activity. After a suggestion by Kristian Sandberg
3500 with 100% cpu activity. After a suggestion by Kristian Sandberg
3490 <Kristian.Sandberg@colorado.edu>.
3501 <Kristian.Sandberg@colorado.edu>.
3491 (Magic.__init__): fix bug in global magic escapes not being
3502 (Magic.__init__): fix bug in global magic escapes not being
3492 correctly set.
3503 correctly set.
3493
3504
3494 2004-10-08 Fernando Perez <fperez@colorado.edu>
3505 2004-10-08 Fernando Perez <fperez@colorado.edu>
3495
3506
3496 * IPython/Magic.py (__license__): change to absolute imports of
3507 * IPython/Magic.py (__license__): change to absolute imports of
3497 ipython's own internal packages, to start adapting to the absolute
3508 ipython's own internal packages, to start adapting to the absolute
3498 import requirement of PEP-328.
3509 import requirement of PEP-328.
3499
3510
3500 * IPython/genutils.py (__author__): Fix coding to utf-8 on all
3511 * IPython/genutils.py (__author__): Fix coding to utf-8 on all
3501 files, and standardize author/license marks through the Release
3512 files, and standardize author/license marks through the Release
3502 module instead of having per/file stuff (except for files with
3513 module instead of having per/file stuff (except for files with
3503 particular licenses, like the MIT/PSF-licensed codes).
3514 particular licenses, like the MIT/PSF-licensed codes).
3504
3515
3505 * IPython/Debugger.py: remove dead code for python 2.1
3516 * IPython/Debugger.py: remove dead code for python 2.1
3506
3517
3507 2004-10-04 Fernando Perez <fperez@colorado.edu>
3518 2004-10-04 Fernando Perez <fperez@colorado.edu>
3508
3519
3509 * IPython/iplib.py (ipmagic): New function for accessing magics
3520 * IPython/iplib.py (ipmagic): New function for accessing magics
3510 via a normal python function call.
3521 via a normal python function call.
3511
3522
3512 * IPython/Magic.py (Magic.magic_magic): Change the magic escape
3523 * IPython/Magic.py (Magic.magic_magic): Change the magic escape
3513 from '@' to '%', to accomodate the new @decorator syntax of python
3524 from '@' to '%', to accomodate the new @decorator syntax of python
3514 2.4.
3525 2.4.
3515
3526
3516 2004-09-29 Fernando Perez <fperez@colorado.edu>
3527 2004-09-29 Fernando Perez <fperez@colorado.edu>
3517
3528
3518 * IPython/Shell.py (MatplotlibShellBase.use): Added a wrapper to
3529 * IPython/Shell.py (MatplotlibShellBase.use): Added a wrapper to
3519 matplotlib.use to prevent running scripts which try to switch
3530 matplotlib.use to prevent running scripts which try to switch
3520 interactive backends from within ipython. This will just crash
3531 interactive backends from within ipython. This will just crash
3521 the python interpreter, so we can't allow it (but a detailed error
3532 the python interpreter, so we can't allow it (but a detailed error
3522 is given to the user).
3533 is given to the user).
3523
3534
3524 2004-09-28 Fernando Perez <fperez@colorado.edu>
3535 2004-09-28 Fernando Perez <fperez@colorado.edu>
3525
3536
3526 * IPython/Shell.py (MatplotlibShellBase.mplot_exec):
3537 * IPython/Shell.py (MatplotlibShellBase.mplot_exec):
3527 matplotlib-related fixes so that using @run with non-matplotlib
3538 matplotlib-related fixes so that using @run with non-matplotlib
3528 scripts doesn't pop up spurious plot windows. This requires
3539 scripts doesn't pop up spurious plot windows. This requires
3529 matplotlib >= 0.63, where I had to make some changes as well.
3540 matplotlib >= 0.63, where I had to make some changes as well.
3530
3541
3531 * IPython/ipmaker.py (make_IPython): update version requirement to
3542 * IPython/ipmaker.py (make_IPython): update version requirement to
3532 python 2.2.
3543 python 2.2.
3533
3544
3534 * IPython/iplib.py (InteractiveShell.mainloop): Add an optional
3545 * IPython/iplib.py (InteractiveShell.mainloop): Add an optional
3535 banner arg for embedded customization.
3546 banner arg for embedded customization.
3536
3547
3537 * IPython/Magic.py (Magic.__init__): big cleanup to remove all
3548 * IPython/Magic.py (Magic.__init__): big cleanup to remove all
3538 explicit uses of __IP as the IPython's instance name. Now things
3549 explicit uses of __IP as the IPython's instance name. Now things
3539 are properly handled via the shell.name value. The actual code
3550 are properly handled via the shell.name value. The actual code
3540 is a bit ugly b/c I'm doing it via a global in Magic.py, but this
3551 is a bit ugly b/c I'm doing it via a global in Magic.py, but this
3541 is much better than before. I'll clean things completely when the
3552 is much better than before. I'll clean things completely when the
3542 magic stuff gets a real overhaul.
3553 magic stuff gets a real overhaul.
3543
3554
3544 * ipython.1: small fixes, sent in by Jack Moffit. He also sent in
3555 * ipython.1: small fixes, sent in by Jack Moffit. He also sent in
3545 minor changes to debian dir.
3556 minor changes to debian dir.
3546
3557
3547 * IPython/iplib.py (InteractiveShell.__init__): Fix adding a
3558 * IPython/iplib.py (InteractiveShell.__init__): Fix adding a
3548 pointer to the shell itself in the interactive namespace even when
3559 pointer to the shell itself in the interactive namespace even when
3549 a user-supplied dict is provided. This is needed for embedding
3560 a user-supplied dict is provided. This is needed for embedding
3550 purposes (found by tests with Michel Sanner).
3561 purposes (found by tests with Michel Sanner).
3551
3562
3552 2004-09-27 Fernando Perez <fperez@colorado.edu>
3563 2004-09-27 Fernando Perez <fperez@colorado.edu>
3553
3564
3554 * IPython/UserConfig/ipythonrc: remove []{} from
3565 * IPython/UserConfig/ipythonrc: remove []{} from
3555 readline_remove_delims, so that things like [modname.<TAB> do
3566 readline_remove_delims, so that things like [modname.<TAB> do
3556 proper completion. This disables [].TAB, but that's a less common
3567 proper completion. This disables [].TAB, but that's a less common
3557 case than module names in list comprehensions, for example.
3568 case than module names in list comprehensions, for example.
3558 Thanks to a report by Andrea Riciputi.
3569 Thanks to a report by Andrea Riciputi.
3559
3570
3560 2004-09-09 Fernando Perez <fperez@colorado.edu>
3571 2004-09-09 Fernando Perez <fperez@colorado.edu>
3561
3572
3562 * IPython/Shell.py (IPShellGTK.mainloop): reorder to avoid
3573 * IPython/Shell.py (IPShellGTK.mainloop): reorder to avoid
3563 blocking problems in win32 and osx. Fix by John.
3574 blocking problems in win32 and osx. Fix by John.
3564
3575
3565 2004-09-08 Fernando Perez <fperez@colorado.edu>
3576 2004-09-08 Fernando Perez <fperez@colorado.edu>
3566
3577
3567 * IPython/Shell.py (IPShellWX.OnInit): Fix output redirection bug
3578 * IPython/Shell.py (IPShellWX.OnInit): Fix output redirection bug
3568 for Win32 and OSX. Fix by John Hunter.
3579 for Win32 and OSX. Fix by John Hunter.
3569
3580
3570 2004-08-30 *** Released version 0.6.3
3581 2004-08-30 *** Released version 0.6.3
3571
3582
3572 2004-08-30 Fernando Perez <fperez@colorado.edu>
3583 2004-08-30 Fernando Perez <fperez@colorado.edu>
3573
3584
3574 * setup.py (isfile): Add manpages to list of dependent files to be
3585 * setup.py (isfile): Add manpages to list of dependent files to be
3575 updated.
3586 updated.
3576
3587
3577 2004-08-27 Fernando Perez <fperez@colorado.edu>
3588 2004-08-27 Fernando Perez <fperez@colorado.edu>
3578
3589
3579 * IPython/Shell.py (start): I've disabled -wthread and -gthread
3590 * IPython/Shell.py (start): I've disabled -wthread and -gthread
3580 for now. They don't really work with standalone WX/GTK code
3591 for now. They don't really work with standalone WX/GTK code
3581 (though matplotlib IS working fine with both of those backends).
3592 (though matplotlib IS working fine with both of those backends).
3582 This will neeed much more testing. I disabled most things with
3593 This will neeed much more testing. I disabled most things with
3583 comments, so turning it back on later should be pretty easy.
3594 comments, so turning it back on later should be pretty easy.
3584
3595
3585 * IPython/iplib.py (InteractiveShell.__init__): Fix accidental
3596 * IPython/iplib.py (InteractiveShell.__init__): Fix accidental
3586 autocalling of expressions like r'foo', by modifying the line
3597 autocalling of expressions like r'foo', by modifying the line
3587 split regexp. Closes
3598 split regexp. Closes
3588 http://www.scipy.net/roundup/ipython/issue18, reported by Nicholas
3599 http://www.scipy.net/roundup/ipython/issue18, reported by Nicholas
3589 Riley <ipythonbugs-AT-sabi.net>.
3600 Riley <ipythonbugs-AT-sabi.net>.
3590 (InteractiveShell.mainloop): honor --nobanner with banner
3601 (InteractiveShell.mainloop): honor --nobanner with banner
3591 extensions.
3602 extensions.
3592
3603
3593 * IPython/Shell.py: Significant refactoring of all classes, so
3604 * IPython/Shell.py: Significant refactoring of all classes, so
3594 that we can really support ALL matplotlib backends and threading
3605 that we can really support ALL matplotlib backends and threading
3595 models (John spotted a bug with Tk which required this). Now we
3606 models (John spotted a bug with Tk which required this). Now we
3596 should support single-threaded, WX-threads and GTK-threads, both
3607 should support single-threaded, WX-threads and GTK-threads, both
3597 for generic code and for matplotlib.
3608 for generic code and for matplotlib.
3598
3609
3599 * IPython/ipmaker.py (__call__): Changed -mpthread option to
3610 * IPython/ipmaker.py (__call__): Changed -mpthread option to
3600 -pylab, to simplify things for users. Will also remove the pylab
3611 -pylab, to simplify things for users. Will also remove the pylab
3601 profile, since now all of matplotlib configuration is directly
3612 profile, since now all of matplotlib configuration is directly
3602 handled here. This also reduces startup time.
3613 handled here. This also reduces startup time.
3603
3614
3604 * IPython/Shell.py (IPShellGTK.run): Fixed bug where mainloop() of
3615 * IPython/Shell.py (IPShellGTK.run): Fixed bug where mainloop() of
3605 shell wasn't being correctly called. Also in IPShellWX.
3616 shell wasn't being correctly called. Also in IPShellWX.
3606
3617
3607 * IPython/iplib.py (InteractiveShell.__init__): Added option to
3618 * IPython/iplib.py (InteractiveShell.__init__): Added option to
3608 fine-tune banner.
3619 fine-tune banner.
3609
3620
3610 * IPython/numutils.py (spike): Deprecate these spike functions,
3621 * IPython/numutils.py (spike): Deprecate these spike functions,
3611 delete (long deprecated) gnuplot_exec handler.
3622 delete (long deprecated) gnuplot_exec handler.
3612
3623
3613 2004-08-26 Fernando Perez <fperez@colorado.edu>
3624 2004-08-26 Fernando Perez <fperez@colorado.edu>
3614
3625
3615 * ipython.1: Update for threading options, plus some others which
3626 * ipython.1: Update for threading options, plus some others which
3616 were missing.
3627 were missing.
3617
3628
3618 * IPython/ipmaker.py (__call__): Added -wthread option for
3629 * IPython/ipmaker.py (__call__): Added -wthread option for
3619 wxpython thread handling. Make sure threading options are only
3630 wxpython thread handling. Make sure threading options are only
3620 valid at the command line.
3631 valid at the command line.
3621
3632
3622 * scripts/ipython: moved shell selection into a factory function
3633 * scripts/ipython: moved shell selection into a factory function
3623 in Shell.py, to keep the starter script to a minimum.
3634 in Shell.py, to keep the starter script to a minimum.
3624
3635
3625 2004-08-25 Fernando Perez <fperez@colorado.edu>
3636 2004-08-25 Fernando Perez <fperez@colorado.edu>
3626
3637
3627 * IPython/Shell.py (IPShellWX.wxexit): fixes to WX threading, by
3638 * IPython/Shell.py (IPShellWX.wxexit): fixes to WX threading, by
3628 John. Along with some recent changes he made to matplotlib, the
3639 John. Along with some recent changes he made to matplotlib, the
3629 next versions of both systems should work very well together.
3640 next versions of both systems should work very well together.
3630
3641
3631 2004-08-24 Fernando Perez <fperez@colorado.edu>
3642 2004-08-24 Fernando Perez <fperez@colorado.edu>
3632
3643
3633 * IPython/Magic.py (Magic.magic_prun): cleanup some dead code. I
3644 * IPython/Magic.py (Magic.magic_prun): cleanup some dead code. I
3634 tried to switch the profiling to using hotshot, but I'm getting
3645 tried to switch the profiling to using hotshot, but I'm getting
3635 strange errors from prof.runctx() there. I may be misreading the
3646 strange errors from prof.runctx() there. I may be misreading the
3636 docs, but it looks weird. For now the profiling code will
3647 docs, but it looks weird. For now the profiling code will
3637 continue to use the standard profiler.
3648 continue to use the standard profiler.
3638
3649
3639 2004-08-23 Fernando Perez <fperez@colorado.edu>
3650 2004-08-23 Fernando Perez <fperez@colorado.edu>
3640
3651
3641 * IPython/Shell.py (IPShellWX.__init__): Improvements to the WX
3652 * IPython/Shell.py (IPShellWX.__init__): Improvements to the WX
3642 threaded shell, by John Hunter. It's not quite ready yet, but
3653 threaded shell, by John Hunter. It's not quite ready yet, but
3643 close.
3654 close.
3644
3655
3645 2004-08-22 Fernando Perez <fperez@colorado.edu>
3656 2004-08-22 Fernando Perez <fperez@colorado.edu>
3646
3657
3647 * IPython/iplib.py (InteractiveShell.interact): tab cleanups, also
3658 * IPython/iplib.py (InteractiveShell.interact): tab cleanups, also
3648 in Magic and ultraTB.
3659 in Magic and ultraTB.
3649
3660
3650 * ipython.1: document threading options in manpage.
3661 * ipython.1: document threading options in manpage.
3651
3662
3652 * scripts/ipython: Changed name of -thread option to -gthread,
3663 * scripts/ipython: Changed name of -thread option to -gthread,
3653 since this is GTK specific. I want to leave the door open for a
3664 since this is GTK specific. I want to leave the door open for a
3654 -wthread option for WX, which will most likely be necessary. This
3665 -wthread option for WX, which will most likely be necessary. This
3655 change affects usage and ipmaker as well.
3666 change affects usage and ipmaker as well.
3656
3667
3657 * IPython/Shell.py (matplotlib_shell): Add a factory function to
3668 * IPython/Shell.py (matplotlib_shell): Add a factory function to
3658 handle the matplotlib shell issues. Code by John Hunter
3669 handle the matplotlib shell issues. Code by John Hunter
3659 <jdhunter-AT-nitace.bsd.uchicago.edu>.
3670 <jdhunter-AT-nitace.bsd.uchicago.edu>.
3660 (IPShellMatplotlibWX.__init__): Rudimentary WX support. It's
3671 (IPShellMatplotlibWX.__init__): Rudimentary WX support. It's
3661 broken (and disabled for end users) for now, but it puts the
3672 broken (and disabled for end users) for now, but it puts the
3662 infrastructure in place.
3673 infrastructure in place.
3663
3674
3664 2004-08-21 Fernando Perez <fperez@colorado.edu>
3675 2004-08-21 Fernando Perez <fperez@colorado.edu>
3665
3676
3666 * ipythonrc-pylab: Add matplotlib support.
3677 * ipythonrc-pylab: Add matplotlib support.
3667
3678
3668 * matplotlib_config.py: new files for matplotlib support, part of
3679 * matplotlib_config.py: new files for matplotlib support, part of
3669 the pylab profile.
3680 the pylab profile.
3670
3681
3671 * IPython/usage.py (__doc__): documented the threading options.
3682 * IPython/usage.py (__doc__): documented the threading options.
3672
3683
3673 2004-08-20 Fernando Perez <fperez@colorado.edu>
3684 2004-08-20 Fernando Perez <fperez@colorado.edu>
3674
3685
3675 * ipython: Modified the main calling routine to handle the -thread
3686 * ipython: Modified the main calling routine to handle the -thread
3676 and -mpthread options. This needs to be done as a top-level hack,
3687 and -mpthread options. This needs to be done as a top-level hack,
3677 because it determines which class to instantiate for IPython
3688 because it determines which class to instantiate for IPython
3678 itself.
3689 itself.
3679
3690
3680 * IPython/Shell.py (MTInteractiveShell.__init__): New set of
3691 * IPython/Shell.py (MTInteractiveShell.__init__): New set of
3681 classes to support multithreaded GTK operation without blocking,
3692 classes to support multithreaded GTK operation without blocking,
3682 and matplotlib with all backends. This is a lot of still very
3693 and matplotlib with all backends. This is a lot of still very
3683 experimental code, and threads are tricky. So it may still have a
3694 experimental code, and threads are tricky. So it may still have a
3684 few rough edges... This code owes a lot to
3695 few rough edges... This code owes a lot to
3685 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65109, by
3696 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65109, by
3686 Brian # McErlean and John Finlay, to Antoon Pardon for fixes, and
3697 Brian # McErlean and John Finlay, to Antoon Pardon for fixes, and
3687 to John Hunter for all the matplotlib work.
3698 to John Hunter for all the matplotlib work.
3688
3699
3689 * IPython/ipmaker.py (__call__): Added -thread and -mpthread
3700 * IPython/ipmaker.py (__call__): Added -thread and -mpthread
3690 options for gtk thread and matplotlib support.
3701 options for gtk thread and matplotlib support.
3691
3702
3692 2004-08-16 Fernando Perez <fperez@colorado.edu>
3703 2004-08-16 Fernando Perez <fperez@colorado.edu>
3693
3704
3694 * IPython/iplib.py (InteractiveShell.__init__): don't trigger
3705 * IPython/iplib.py (InteractiveShell.__init__): don't trigger
3695 autocall for things like p*q,p/q,p+q,p-q, when p is callable. Bug
3706 autocall for things like p*q,p/q,p+q,p-q, when p is callable. Bug
3696 reported by Stephen Walton <stephen.walton-AT-csun.edu>.
3707 reported by Stephen Walton <stephen.walton-AT-csun.edu>.
3697
3708
3698 2004-08-11 Fernando Perez <fperez@colorado.edu>
3709 2004-08-11 Fernando Perez <fperez@colorado.edu>
3699
3710
3700 * setup.py (isfile): Fix build so documentation gets updated for
3711 * setup.py (isfile): Fix build so documentation gets updated for
3701 rpms (it was only done for .tgz builds).
3712 rpms (it was only done for .tgz builds).
3702
3713
3703 2004-08-10 Fernando Perez <fperez@colorado.edu>
3714 2004-08-10 Fernando Perez <fperez@colorado.edu>
3704
3715
3705 * genutils.py (Term): Fix misspell of stdin stream (sin->cin).
3716 * genutils.py (Term): Fix misspell of stdin stream (sin->cin).
3706
3717
3707 * iplib.py : Silence syntax error exceptions in tab-completion.
3718 * iplib.py : Silence syntax error exceptions in tab-completion.
3708
3719
3709 2004-08-05 Fernando Perez <fperez@colorado.edu>
3720 2004-08-05 Fernando Perez <fperez@colorado.edu>
3710
3721
3711 * IPython/Prompts.py (Prompt2.set_colors): Fix incorrectly set
3722 * IPython/Prompts.py (Prompt2.set_colors): Fix incorrectly set
3712 'color off' mark for continuation prompts. This was causing long
3723 'color off' mark for continuation prompts. This was causing long
3713 continuation lines to mis-wrap.
3724 continuation lines to mis-wrap.
3714
3725
3715 2004-08-01 Fernando Perez <fperez@colorado.edu>
3726 2004-08-01 Fernando Perez <fperez@colorado.edu>
3716
3727
3717 * IPython/ipmaker.py (make_IPython): Allow the shell class used
3728 * IPython/ipmaker.py (make_IPython): Allow the shell class used
3718 for building ipython to be a parameter. All this is necessary
3729 for building ipython to be a parameter. All this is necessary
3719 right now to have a multithreaded version, but this insane
3730 right now to have a multithreaded version, but this insane
3720 non-design will be cleaned up soon. For now, it's a hack that
3731 non-design will be cleaned up soon. For now, it's a hack that
3721 works.
3732 works.
3722
3733
3723 * IPython/Shell.py (IPShell.__init__): Stop using mutable default
3734 * IPython/Shell.py (IPShell.__init__): Stop using mutable default
3724 args in various places. No bugs so far, but it's a dangerous
3735 args in various places. No bugs so far, but it's a dangerous
3725 practice.
3736 practice.
3726
3737
3727 2004-07-31 Fernando Perez <fperez@colorado.edu>
3738 2004-07-31 Fernando Perez <fperez@colorado.edu>
3728
3739
3729 * IPython/iplib.py (complete): ignore SyntaxError exceptions to
3740 * IPython/iplib.py (complete): ignore SyntaxError exceptions to
3730 fix completion of files with dots in their names under most
3741 fix completion of files with dots in their names under most
3731 profiles (pysh was OK because the completion order is different).
3742 profiles (pysh was OK because the completion order is different).
3732
3743
3733 2004-07-27 Fernando Perez <fperez@colorado.edu>
3744 2004-07-27 Fernando Perez <fperez@colorado.edu>
3734
3745
3735 * IPython/iplib.py (InteractiveShell.__init__): build dict of
3746 * IPython/iplib.py (InteractiveShell.__init__): build dict of
3736 keywords manually, b/c the one in keyword.py was removed in python
3747 keywords manually, b/c the one in keyword.py was removed in python
3737 2.4. Patch by Anakim Border <aborder-AT-users.sourceforge.net>.
3748 2.4. Patch by Anakim Border <aborder-AT-users.sourceforge.net>.
3738 This is NOT a bug under python 2.3 and earlier.
3749 This is NOT a bug under python 2.3 and earlier.
3739
3750
3740 2004-07-26 Fernando Perez <fperez@colorado.edu>
3751 2004-07-26 Fernando Perez <fperez@colorado.edu>
3741
3752
3742 * IPython/ultraTB.py (VerboseTB.text): Add another
3753 * IPython/ultraTB.py (VerboseTB.text): Add another
3743 linecache.checkcache() call to try to prevent inspect.py from
3754 linecache.checkcache() call to try to prevent inspect.py from
3744 crashing under python 2.3. I think this fixes
3755 crashing under python 2.3. I think this fixes
3745 http://www.scipy.net/roundup/ipython/issue17.
3756 http://www.scipy.net/roundup/ipython/issue17.
3746
3757
3747 2004-07-26 *** Released version 0.6.2
3758 2004-07-26 *** Released version 0.6.2
3748
3759
3749 2004-07-26 Fernando Perez <fperez@colorado.edu>
3760 2004-07-26 Fernando Perez <fperez@colorado.edu>
3750
3761
3751 * IPython/Magic.py (Magic.magic_cd): Fix bug where 'cd -N' would
3762 * IPython/Magic.py (Magic.magic_cd): Fix bug where 'cd -N' would
3752 fail for any number.
3763 fail for any number.
3753 (Magic.magic_bookmark): Fix bug where 'bookmark -l' would fail for
3764 (Magic.magic_bookmark): Fix bug where 'bookmark -l' would fail for
3754 empty bookmarks.
3765 empty bookmarks.
3755
3766
3756 2004-07-26 *** Released version 0.6.1
3767 2004-07-26 *** Released version 0.6.1
3757
3768
3758 2004-07-26 Fernando Perez <fperez@colorado.edu>
3769 2004-07-26 Fernando Perez <fperez@colorado.edu>
3759
3770
3760 * ipython_win_post_install.py (run): Added pysh shortcut for Windows.
3771 * ipython_win_post_install.py (run): Added pysh shortcut for Windows.
3761
3772
3762 * IPython/iplib.py (protect_filename): Applied Ville's patch for
3773 * IPython/iplib.py (protect_filename): Applied Ville's patch for
3763 escaping '()[]{}' in filenames.
3774 escaping '()[]{}' in filenames.
3764
3775
3765 * IPython/Magic.py (shlex_split): Fix handling of '*' and '?' for
3776 * IPython/Magic.py (shlex_split): Fix handling of '*' and '?' for
3766 Python 2.2 users who lack a proper shlex.split.
3777 Python 2.2 users who lack a proper shlex.split.
3767
3778
3768 2004-07-19 Fernando Perez <fperez@colorado.edu>
3779 2004-07-19 Fernando Perez <fperez@colorado.edu>
3769
3780
3770 * IPython/iplib.py (InteractiveShell.init_readline): Add support
3781 * IPython/iplib.py (InteractiveShell.init_readline): Add support
3771 for reading readline's init file. I follow the normal chain:
3782 for reading readline's init file. I follow the normal chain:
3772 $INPUTRC is honored, otherwise ~/.inputrc is used. Thanks to a
3783 $INPUTRC is honored, otherwise ~/.inputrc is used. Thanks to a
3773 report by Mike Heeter. This closes
3784 report by Mike Heeter. This closes
3774 http://www.scipy.net/roundup/ipython/issue16.
3785 http://www.scipy.net/roundup/ipython/issue16.
3775
3786
3776 2004-07-18 Fernando Perez <fperez@colorado.edu>
3787 2004-07-18 Fernando Perez <fperez@colorado.edu>
3777
3788
3778 * IPython/iplib.py (__init__): Add better handling of '\' under
3789 * IPython/iplib.py (__init__): Add better handling of '\' under
3779 Win32 for filenames. After a patch by Ville.
3790 Win32 for filenames. After a patch by Ville.
3780
3791
3781 2004-07-17 Fernando Perez <fperez@colorado.edu>
3792 2004-07-17 Fernando Perez <fperez@colorado.edu>
3782
3793
3783 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
3794 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
3784 autocalling would be triggered for 'foo is bar' if foo is
3795 autocalling would be triggered for 'foo is bar' if foo is
3785 callable. I also cleaned up the autocall detection code to use a
3796 callable. I also cleaned up the autocall detection code to use a
3786 regexp, which is faster. Bug reported by Alexander Schmolck.
3797 regexp, which is faster. Bug reported by Alexander Schmolck.
3787
3798
3788 * IPython/Magic.py (Magic.magic_pinfo): Fix bug where strings with
3799 * IPython/Magic.py (Magic.magic_pinfo): Fix bug where strings with
3789 '?' in them would confuse the help system. Reported by Alex
3800 '?' in them would confuse the help system. Reported by Alex
3790 Schmolck.
3801 Schmolck.
3791
3802
3792 2004-07-16 Fernando Perez <fperez@colorado.edu>
3803 2004-07-16 Fernando Perez <fperez@colorado.edu>
3793
3804
3794 * IPython/GnuplotInteractive.py (__all__): added plot2.
3805 * IPython/GnuplotInteractive.py (__all__): added plot2.
3795
3806
3796 * IPython/Gnuplot2.py (Gnuplot.plot2): added new function for
3807 * IPython/Gnuplot2.py (Gnuplot.plot2): added new function for
3797 plotting dictionaries, lists or tuples of 1d arrays.
3808 plotting dictionaries, lists or tuples of 1d arrays.
3798
3809
3799 * IPython/Magic.py (Magic.magic_hist): small clenaups and
3810 * IPython/Magic.py (Magic.magic_hist): small clenaups and
3800 optimizations.
3811 optimizations.
3801
3812
3802 * IPython/iplib.py:Remove old Changelog info for cleanup. This is
3813 * IPython/iplib.py:Remove old Changelog info for cleanup. This is
3803 the information which was there from Janko's original IPP code:
3814 the information which was there from Janko's original IPP code:
3804
3815
3805 03.05.99 20:53 porto.ifm.uni-kiel.de
3816 03.05.99 20:53 porto.ifm.uni-kiel.de
3806 --Started changelog.
3817 --Started changelog.
3807 --make clear do what it say it does
3818 --make clear do what it say it does
3808 --added pretty output of lines from inputcache
3819 --added pretty output of lines from inputcache
3809 --Made Logger a mixin class, simplifies handling of switches
3820 --Made Logger a mixin class, simplifies handling of switches
3810 --Added own completer class. .string<TAB> expands to last history
3821 --Added own completer class. .string<TAB> expands to last history
3811 line which starts with string. The new expansion is also present
3822 line which starts with string. The new expansion is also present
3812 with Ctrl-r from the readline library. But this shows, who this
3823 with Ctrl-r from the readline library. But this shows, who this
3813 can be done for other cases.
3824 can be done for other cases.
3814 --Added convention that all shell functions should accept a
3825 --Added convention that all shell functions should accept a
3815 parameter_string This opens the door for different behaviour for
3826 parameter_string This opens the door for different behaviour for
3816 each function. @cd is a good example of this.
3827 each function. @cd is a good example of this.
3817
3828
3818 04.05.99 12:12 porto.ifm.uni-kiel.de
3829 04.05.99 12:12 porto.ifm.uni-kiel.de
3819 --added logfile rotation
3830 --added logfile rotation
3820 --added new mainloop method which freezes first the namespace
3831 --added new mainloop method which freezes first the namespace
3821
3832
3822 07.05.99 21:24 porto.ifm.uni-kiel.de
3833 07.05.99 21:24 porto.ifm.uni-kiel.de
3823 --added the docreader classes. Now there is a help system.
3834 --added the docreader classes. Now there is a help system.
3824 -This is only a first try. Currently it's not easy to put new
3835 -This is only a first try. Currently it's not easy to put new
3825 stuff in the indices. But this is the way to go. Info would be
3836 stuff in the indices. But this is the way to go. Info would be
3826 better, but HTML is every where and not everybody has an info
3837 better, but HTML is every where and not everybody has an info
3827 system installed and it's not so easy to change html-docs to info.
3838 system installed and it's not so easy to change html-docs to info.
3828 --added global logfile option
3839 --added global logfile option
3829 --there is now a hook for object inspection method pinfo needs to
3840 --there is now a hook for object inspection method pinfo needs to
3830 be provided for this. Can be reached by two '??'.
3841 be provided for this. Can be reached by two '??'.
3831
3842
3832 08.05.99 20:51 porto.ifm.uni-kiel.de
3843 08.05.99 20:51 porto.ifm.uni-kiel.de
3833 --added a README
3844 --added a README
3834 --bug in rc file. Something has changed so functions in the rc
3845 --bug in rc file. Something has changed so functions in the rc
3835 file need to reference the shell and not self. Not clear if it's a
3846 file need to reference the shell and not self. Not clear if it's a
3836 bug or feature.
3847 bug or feature.
3837 --changed rc file for new behavior
3848 --changed rc file for new behavior
3838
3849
3839 2004-07-15 Fernando Perez <fperez@colorado.edu>
3850 2004-07-15 Fernando Perez <fperez@colorado.edu>
3840
3851
3841 * IPython/Logger.py (Logger.log): fixed recent bug where the input
3852 * IPython/Logger.py (Logger.log): fixed recent bug where the input
3842 cache was falling out of sync in bizarre manners when multi-line
3853 cache was falling out of sync in bizarre manners when multi-line
3843 input was present. Minor optimizations and cleanup.
3854 input was present. Minor optimizations and cleanup.
3844
3855
3845 (Logger): Remove old Changelog info for cleanup. This is the
3856 (Logger): Remove old Changelog info for cleanup. This is the
3846 information which was there from Janko's original code:
3857 information which was there from Janko's original code:
3847
3858
3848 Changes to Logger: - made the default log filename a parameter
3859 Changes to Logger: - made the default log filename a parameter
3849
3860
3850 - put a check for lines beginning with !@? in log(). Needed
3861 - put a check for lines beginning with !@? in log(). Needed
3851 (even if the handlers properly log their lines) for mid-session
3862 (even if the handlers properly log their lines) for mid-session
3852 logging activation to work properly. Without this, lines logged
3863 logging activation to work properly. Without this, lines logged
3853 in mid session, which get read from the cache, would end up
3864 in mid session, which get read from the cache, would end up
3854 'bare' (with !@? in the open) in the log. Now they are caught
3865 'bare' (with !@? in the open) in the log. Now they are caught
3855 and prepended with a #.
3866 and prepended with a #.
3856
3867
3857 * IPython/iplib.py (InteractiveShell.init_readline): added check
3868 * IPython/iplib.py (InteractiveShell.init_readline): added check
3858 in case MagicCompleter fails to be defined, so we don't crash.
3869 in case MagicCompleter fails to be defined, so we don't crash.
3859
3870
3860 2004-07-13 Fernando Perez <fperez@colorado.edu>
3871 2004-07-13 Fernando Perez <fperez@colorado.edu>
3861
3872
3862 * IPython/Gnuplot2.py (Gnuplot.hardcopy): add automatic generation
3873 * IPython/Gnuplot2.py (Gnuplot.hardcopy): add automatic generation
3863 of EPS if the requested filename ends in '.eps'.
3874 of EPS if the requested filename ends in '.eps'.
3864
3875
3865 2004-07-04 Fernando Perez <fperez@colorado.edu>
3876 2004-07-04 Fernando Perez <fperez@colorado.edu>
3866
3877
3867 * IPython/iplib.py (InteractiveShell.handle_shell_escape): Fix
3878 * IPython/iplib.py (InteractiveShell.handle_shell_escape): Fix
3868 escaping of quotes when calling the shell.
3879 escaping of quotes when calling the shell.
3869
3880
3870 2004-07-02 Fernando Perez <fperez@colorado.edu>
3881 2004-07-02 Fernando Perez <fperez@colorado.edu>
3871
3882
3872 * IPython/Prompts.py (CachedOutput.update): Fix problem with
3883 * IPython/Prompts.py (CachedOutput.update): Fix problem with
3873 gettext not working because we were clobbering '_'. Fixes
3884 gettext not working because we were clobbering '_'. Fixes
3874 http://www.scipy.net/roundup/ipython/issue6.
3885 http://www.scipy.net/roundup/ipython/issue6.
3875
3886
3876 2004-07-01 Fernando Perez <fperez@colorado.edu>
3887 2004-07-01 Fernando Perez <fperez@colorado.edu>
3877
3888
3878 * IPython/Magic.py (Magic.magic_cd): integrated bookmark handling
3889 * IPython/Magic.py (Magic.magic_cd): integrated bookmark handling
3879 into @cd. Patch by Ville.
3890 into @cd. Patch by Ville.
3880
3891
3881 * IPython/iplib.py (InteractiveShell.post_config_initialization):
3892 * IPython/iplib.py (InteractiveShell.post_config_initialization):
3882 new function to store things after ipmaker runs. Patch by Ville.
3893 new function to store things after ipmaker runs. Patch by Ville.
3883 Eventually this will go away once ipmaker is removed and the class
3894 Eventually this will go away once ipmaker is removed and the class
3884 gets cleaned up, but for now it's ok. Key functionality here is
3895 gets cleaned up, but for now it's ok. Key functionality here is
3885 the addition of the persistent storage mechanism, a dict for
3896 the addition of the persistent storage mechanism, a dict for
3886 keeping data across sessions (for now just bookmarks, but more can
3897 keeping data across sessions (for now just bookmarks, but more can
3887 be implemented later).
3898 be implemented later).
3888
3899
3889 * IPython/Magic.py (Magic.magic_bookmark): New bookmark system,
3900 * IPython/Magic.py (Magic.magic_bookmark): New bookmark system,
3890 persistent across sections. Patch by Ville, I modified it
3901 persistent across sections. Patch by Ville, I modified it
3891 soemwhat to allow bookmarking arbitrary dirs other than CWD. Also
3902 soemwhat to allow bookmarking arbitrary dirs other than CWD. Also
3892 added a '-l' option to list all bookmarks.
3903 added a '-l' option to list all bookmarks.
3893
3904
3894 * IPython/iplib.py (InteractiveShell.atexit_operations): new
3905 * IPython/iplib.py (InteractiveShell.atexit_operations): new
3895 center for cleanup. Registered with atexit.register(). I moved
3906 center for cleanup. Registered with atexit.register(). I moved
3896 here the old exit_cleanup(). After a patch by Ville.
3907 here the old exit_cleanup(). After a patch by Ville.
3897
3908
3898 * IPython/Magic.py (get_py_filename): added '~' to the accepted
3909 * IPython/Magic.py (get_py_filename): added '~' to the accepted
3899 characters in the hacked shlex_split for python 2.2.
3910 characters in the hacked shlex_split for python 2.2.
3900
3911
3901 * IPython/iplib.py (file_matches): more fixes to filenames with
3912 * IPython/iplib.py (file_matches): more fixes to filenames with
3902 whitespace in them. It's not perfect, but limitations in python's
3913 whitespace in them. It's not perfect, but limitations in python's
3903 readline make it impossible to go further.
3914 readline make it impossible to go further.
3904
3915
3905 2004-06-29 Fernando Perez <fperez@colorado.edu>
3916 2004-06-29 Fernando Perez <fperez@colorado.edu>
3906
3917
3907 * IPython/iplib.py (file_matches): escape whitespace correctly in
3918 * IPython/iplib.py (file_matches): escape whitespace correctly in
3908 filename completions. Bug reported by Ville.
3919 filename completions. Bug reported by Ville.
3909
3920
3910 2004-06-28 Fernando Perez <fperez@colorado.edu>
3921 2004-06-28 Fernando Perez <fperez@colorado.edu>
3911
3922
3912 * IPython/ipmaker.py (__call__): Added per-profile histories. Now
3923 * IPython/ipmaker.py (__call__): Added per-profile histories. Now
3913 the history file will be called 'history-PROFNAME' (or just
3924 the history file will be called 'history-PROFNAME' (or just
3914 'history' if no profile is loaded). I was getting annoyed at
3925 'history' if no profile is loaded). I was getting annoyed at
3915 getting my Numerical work history clobbered by pysh sessions.
3926 getting my Numerical work history clobbered by pysh sessions.
3916
3927
3917 * IPython/iplib.py (InteractiveShell.__init__): Internal
3928 * IPython/iplib.py (InteractiveShell.__init__): Internal
3918 getoutputerror() function so that we can honor the system_verbose
3929 getoutputerror() function so that we can honor the system_verbose
3919 flag for _all_ system calls. I also added escaping of #
3930 flag for _all_ system calls. I also added escaping of #
3920 characters here to avoid confusing Itpl.
3931 characters here to avoid confusing Itpl.
3921
3932
3922 * IPython/Magic.py (shlex_split): removed call to shell in
3933 * IPython/Magic.py (shlex_split): removed call to shell in
3923 parse_options and replaced it with shlex.split(). The annoying
3934 parse_options and replaced it with shlex.split(). The annoying
3924 part was that in Python 2.2, shlex.split() doesn't exist, so I had
3935 part was that in Python 2.2, shlex.split() doesn't exist, so I had
3925 to backport it from 2.3, with several frail hacks (the shlex
3936 to backport it from 2.3, with several frail hacks (the shlex
3926 module is rather limited in 2.2). Thanks to a suggestion by Ville
3937 module is rather limited in 2.2). Thanks to a suggestion by Ville
3927 Vainio <vivainio@kolumbus.fi>. For Python 2.3 there should be no
3938 Vainio <vivainio@kolumbus.fi>. For Python 2.3 there should be no
3928 problem.
3939 problem.
3929
3940
3930 (Magic.magic_system_verbose): new toggle to print the actual
3941 (Magic.magic_system_verbose): new toggle to print the actual
3931 system calls made by ipython. Mainly for debugging purposes.
3942 system calls made by ipython. Mainly for debugging purposes.
3932
3943
3933 * IPython/GnuplotRuntime.py (gnu_out): fix bug for cygwin, which
3944 * IPython/GnuplotRuntime.py (gnu_out): fix bug for cygwin, which
3934 doesn't support persistence. Reported (and fix suggested) by
3945 doesn't support persistence. Reported (and fix suggested) by
3935 Travis Caldwell <travis_caldwell2000@yahoo.com>.
3946 Travis Caldwell <travis_caldwell2000@yahoo.com>.
3936
3947
3937 2004-06-26 Fernando Perez <fperez@colorado.edu>
3948 2004-06-26 Fernando Perez <fperez@colorado.edu>
3938
3949
3939 * IPython/Logger.py (Logger.log): fix to handle correctly empty
3950 * IPython/Logger.py (Logger.log): fix to handle correctly empty
3940 continue prompts.
3951 continue prompts.
3941
3952
3942 * IPython/Extensions/InterpreterExec.py (pysh): moved the pysh()
3953 * IPython/Extensions/InterpreterExec.py (pysh): moved the pysh()
3943 function (basically a big docstring) and a few more things here to
3954 function (basically a big docstring) and a few more things here to
3944 speedup startup. pysh.py is now very lightweight. We want because
3955 speedup startup. pysh.py is now very lightweight. We want because
3945 it gets execfile'd, while InterpreterExec gets imported, so
3956 it gets execfile'd, while InterpreterExec gets imported, so
3946 byte-compilation saves time.
3957 byte-compilation saves time.
3947
3958
3948 2004-06-25 Fernando Perez <fperez@colorado.edu>
3959 2004-06-25 Fernando Perez <fperez@colorado.edu>
3949
3960
3950 * IPython/Magic.py (Magic.magic_cd): Fixed to restore usage of 'cd
3961 * IPython/Magic.py (Magic.magic_cd): Fixed to restore usage of 'cd
3951 -NUM', which was recently broken.
3962 -NUM', which was recently broken.
3952
3963
3953 * IPython/iplib.py (InteractiveShell.handle_shell_escape): allow !
3964 * IPython/iplib.py (InteractiveShell.handle_shell_escape): allow !
3954 in multi-line input (but not !!, which doesn't make sense there).
3965 in multi-line input (but not !!, which doesn't make sense there).
3955
3966
3956 * IPython/UserConfig/ipythonrc: made autoindent on by default.
3967 * IPython/UserConfig/ipythonrc: made autoindent on by default.
3957 It's just too useful, and people can turn it off in the less
3968 It's just too useful, and people can turn it off in the less
3958 common cases where it's a problem.
3969 common cases where it's a problem.
3959
3970
3960 2004-06-24 Fernando Perez <fperez@colorado.edu>
3971 2004-06-24 Fernando Perez <fperez@colorado.edu>
3961
3972
3962 * IPython/iplib.py (InteractiveShell._prefilter): big change -
3973 * IPython/iplib.py (InteractiveShell._prefilter): big change -
3963 special syntaxes (like alias calling) is now allied in multi-line
3974 special syntaxes (like alias calling) is now allied in multi-line
3964 input. This is still _very_ experimental, but it's necessary for
3975 input. This is still _very_ experimental, but it's necessary for
3965 efficient shell usage combining python looping syntax with system
3976 efficient shell usage combining python looping syntax with system
3966 calls. For now it's restricted to aliases, I don't think it
3977 calls. For now it's restricted to aliases, I don't think it
3967 really even makes sense to have this for magics.
3978 really even makes sense to have this for magics.
3968
3979
3969 2004-06-23 Fernando Perez <fperez@colorado.edu>
3980 2004-06-23 Fernando Perez <fperez@colorado.edu>
3970
3981
3971 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Added
3982 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Added
3972 $var=cmd <=> @sc var=cmd and $$var=cmd <=> @sc -l var=cmd.
3983 $var=cmd <=> @sc var=cmd and $$var=cmd <=> @sc -l var=cmd.
3973
3984
3974 * IPython/Magic.py (Magic.magic_rehashx): modified to handle
3985 * IPython/Magic.py (Magic.magic_rehashx): modified to handle
3975 extensions under Windows (after code sent by Gary Bishop). The
3986 extensions under Windows (after code sent by Gary Bishop). The
3976 extensions considered 'executable' are stored in IPython's rc
3987 extensions considered 'executable' are stored in IPython's rc
3977 structure as win_exec_ext.
3988 structure as win_exec_ext.
3978
3989
3979 * IPython/genutils.py (shell): new function, like system() but
3990 * IPython/genutils.py (shell): new function, like system() but
3980 without return value. Very useful for interactive shell work.
3991 without return value. Very useful for interactive shell work.
3981
3992
3982 * IPython/Magic.py (Magic.magic_unalias): New @unalias function to
3993 * IPython/Magic.py (Magic.magic_unalias): New @unalias function to
3983 delete aliases.
3994 delete aliases.
3984
3995
3985 * IPython/iplib.py (InteractiveShell.alias_table_update): make
3996 * IPython/iplib.py (InteractiveShell.alias_table_update): make
3986 sure that the alias table doesn't contain python keywords.
3997 sure that the alias table doesn't contain python keywords.
3987
3998
3988 2004-06-21 Fernando Perez <fperez@colorado.edu>
3999 2004-06-21 Fernando Perez <fperez@colorado.edu>
3989
4000
3990 * IPython/Magic.py (Magic.magic_rehash): Fix crash when
4001 * IPython/Magic.py (Magic.magic_rehash): Fix crash when
3991 non-existent items are found in $PATH. Reported by Thorsten.
4002 non-existent items are found in $PATH. Reported by Thorsten.
3992
4003
3993 2004-06-20 Fernando Perez <fperez@colorado.edu>
4004 2004-06-20 Fernando Perez <fperez@colorado.edu>
3994
4005
3995 * IPython/iplib.py (complete): modified the completer so that the
4006 * IPython/iplib.py (complete): modified the completer so that the
3996 order of priorities can be easily changed at runtime.
4007 order of priorities can be easily changed at runtime.
3997
4008
3998 * IPython/Extensions/InterpreterExec.py (prefilter_shell):
4009 * IPython/Extensions/InterpreterExec.py (prefilter_shell):
3999 Modified to auto-execute all lines beginning with '~', '/' or '.'.
4010 Modified to auto-execute all lines beginning with '~', '/' or '.'.
4000
4011
4001 * IPython/Magic.py (Magic.magic_sx): modified @sc and @sx to
4012 * IPython/Magic.py (Magic.magic_sx): modified @sc and @sx to
4002 expand Python variables prepended with $ in all system calls. The
4013 expand Python variables prepended with $ in all system calls. The
4003 same was done to InteractiveShell.handle_shell_escape. Now all
4014 same was done to InteractiveShell.handle_shell_escape. Now all
4004 system access mechanisms (!, !!, @sc, @sx and aliases) allow the
4015 system access mechanisms (!, !!, @sc, @sx and aliases) allow the
4005 expansion of python variables and expressions according to the
4016 expansion of python variables and expressions according to the
4006 syntax of PEP-215 - http://www.python.org/peps/pep-0215.html.
4017 syntax of PEP-215 - http://www.python.org/peps/pep-0215.html.
4007
4018
4008 Though PEP-215 has been rejected, a similar (but simpler) one
4019 Though PEP-215 has been rejected, a similar (but simpler) one
4009 seems like it will go into Python 2.4, PEP-292 -
4020 seems like it will go into Python 2.4, PEP-292 -
4010 http://www.python.org/peps/pep-0292.html.
4021 http://www.python.org/peps/pep-0292.html.
4011
4022
4012 I'll keep the full syntax of PEP-215, since IPython has since the
4023 I'll keep the full syntax of PEP-215, since IPython has since the
4013 start used Ka-Ping Yee's reference implementation discussed there
4024 start used Ka-Ping Yee's reference implementation discussed there
4014 (Itpl), and I actually like the powerful semantics it offers.
4025 (Itpl), and I actually like the powerful semantics it offers.
4015
4026
4016 In order to access normal shell variables, the $ has to be escaped
4027 In order to access normal shell variables, the $ has to be escaped
4017 via an extra $. For example:
4028 via an extra $. For example:
4018
4029
4019 In [7]: PATH='a python variable'
4030 In [7]: PATH='a python variable'
4020
4031
4021 In [8]: !echo $PATH
4032 In [8]: !echo $PATH
4022 a python variable
4033 a python variable
4023
4034
4024 In [9]: !echo $$PATH
4035 In [9]: !echo $$PATH
4025 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
4036 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
4026
4037
4027 (Magic.parse_options): escape $ so the shell doesn't evaluate
4038 (Magic.parse_options): escape $ so the shell doesn't evaluate
4028 things prematurely.
4039 things prematurely.
4029
4040
4030 * IPython/iplib.py (InteractiveShell.call_alias): added the
4041 * IPython/iplib.py (InteractiveShell.call_alias): added the
4031 ability for aliases to expand python variables via $.
4042 ability for aliases to expand python variables via $.
4032
4043
4033 * IPython/Magic.py (Magic.magic_rehash): based on the new alias
4044 * IPython/Magic.py (Magic.magic_rehash): based on the new alias
4034 system, now there's a @rehash/@rehashx pair of magics. These work
4045 system, now there's a @rehash/@rehashx pair of magics. These work
4035 like the csh rehash command, and can be invoked at any time. They
4046 like the csh rehash command, and can be invoked at any time. They
4036 build a table of aliases to everything in the user's $PATH
4047 build a table of aliases to everything in the user's $PATH
4037 (@rehash uses everything, @rehashx is slower but only adds
4048 (@rehash uses everything, @rehashx is slower but only adds
4038 executable files). With this, the pysh.py-based shell profile can
4049 executable files). With this, the pysh.py-based shell profile can
4039 now simply call rehash upon startup, and full access to all
4050 now simply call rehash upon startup, and full access to all
4040 programs in the user's path is obtained.
4051 programs in the user's path is obtained.
4041
4052
4042 * IPython/iplib.py (InteractiveShell.call_alias): The new alias
4053 * IPython/iplib.py (InteractiveShell.call_alias): The new alias
4043 functionality is now fully in place. I removed the old dynamic
4054 functionality is now fully in place. I removed the old dynamic
4044 code generation based approach, in favor of a much lighter one
4055 code generation based approach, in favor of a much lighter one
4045 based on a simple dict. The advantage is that this allows me to
4056 based on a simple dict. The advantage is that this allows me to
4046 now have thousands of aliases with negligible cost (unthinkable
4057 now have thousands of aliases with negligible cost (unthinkable
4047 with the old system).
4058 with the old system).
4048
4059
4049 2004-06-19 Fernando Perez <fperez@colorado.edu>
4060 2004-06-19 Fernando Perez <fperez@colorado.edu>
4050
4061
4051 * IPython/iplib.py (__init__): extended MagicCompleter class to
4062 * IPython/iplib.py (__init__): extended MagicCompleter class to
4052 also complete (last in priority) on user aliases.
4063 also complete (last in priority) on user aliases.
4053
4064
4054 * IPython/Itpl.py (Itpl.__str__): fixed order of globals/locals in
4065 * IPython/Itpl.py (Itpl.__str__): fixed order of globals/locals in
4055 call to eval.
4066 call to eval.
4056 (ItplNS.__init__): Added a new class which functions like Itpl,
4067 (ItplNS.__init__): Added a new class which functions like Itpl,
4057 but allows configuring the namespace for the evaluation to occur
4068 but allows configuring the namespace for the evaluation to occur
4058 in.
4069 in.
4059
4070
4060 2004-06-18 Fernando Perez <fperez@colorado.edu>
4071 2004-06-18 Fernando Perez <fperez@colorado.edu>
4061
4072
4062 * IPython/iplib.py (InteractiveShell.runcode): modify to print a
4073 * IPython/iplib.py (InteractiveShell.runcode): modify to print a
4063 better message when 'exit' or 'quit' are typed (a common newbie
4074 better message when 'exit' or 'quit' are typed (a common newbie
4064 confusion).
4075 confusion).
4065
4076
4066 * IPython/Magic.py (Magic.magic_colors): Added the runtime color
4077 * IPython/Magic.py (Magic.magic_colors): Added the runtime color
4067 check for Windows users.
4078 check for Windows users.
4068
4079
4069 * IPython/iplib.py (InteractiveShell.user_setup): removed
4080 * IPython/iplib.py (InteractiveShell.user_setup): removed
4070 disabling of colors for Windows. I'll test at runtime and issue a
4081 disabling of colors for Windows. I'll test at runtime and issue a
4071 warning if Gary's readline isn't found, as to nudge users to
4082 warning if Gary's readline isn't found, as to nudge users to
4072 download it.
4083 download it.
4073
4084
4074 2004-06-16 Fernando Perez <fperez@colorado.edu>
4085 2004-06-16 Fernando Perez <fperez@colorado.edu>
4075
4086
4076 * IPython/genutils.py (Stream.__init__): changed to print errors
4087 * IPython/genutils.py (Stream.__init__): changed to print errors
4077 to sys.stderr. I had a circular dependency here. Now it's
4088 to sys.stderr. I had a circular dependency here. Now it's
4078 possible to run ipython as IDLE's shell (consider this pre-alpha,
4089 possible to run ipython as IDLE's shell (consider this pre-alpha,
4079 since true stdout things end up in the starting terminal instead
4090 since true stdout things end up in the starting terminal instead
4080 of IDLE's out).
4091 of IDLE's out).
4081
4092
4082 * IPython/Prompts.py (Prompt2.set_colors): prevent crashes for
4093 * IPython/Prompts.py (Prompt2.set_colors): prevent crashes for
4083 users who haven't # updated their prompt_in2 definitions. Remove
4094 users who haven't # updated their prompt_in2 definitions. Remove
4084 eventually.
4095 eventually.
4085 (multiple_replace): added credit to original ASPN recipe.
4096 (multiple_replace): added credit to original ASPN recipe.
4086
4097
4087 2004-06-15 Fernando Perez <fperez@colorado.edu>
4098 2004-06-15 Fernando Perez <fperez@colorado.edu>
4088
4099
4089 * IPython/iplib.py (InteractiveShell.__init__): add 'cp' to the
4100 * IPython/iplib.py (InteractiveShell.__init__): add 'cp' to the
4090 list of auto-defined aliases.
4101 list of auto-defined aliases.
4091
4102
4092 2004-06-13 Fernando Perez <fperez@colorado.edu>
4103 2004-06-13 Fernando Perez <fperez@colorado.edu>
4093
4104
4094 * setup.py (scriptfiles): Don't trigger win_post_install unless an
4105 * setup.py (scriptfiles): Don't trigger win_post_install unless an
4095 install was really requested (so setup.py can be used for other
4106 install was really requested (so setup.py can be used for other
4096 things under Windows).
4107 things under Windows).
4097
4108
4098 2004-06-10 Fernando Perez <fperez@colorado.edu>
4109 2004-06-10 Fernando Perez <fperez@colorado.edu>
4099
4110
4100 * IPython/Logger.py (Logger.create_log): Manually remove any old
4111 * IPython/Logger.py (Logger.create_log): Manually remove any old
4101 backup, since os.remove may fail under Windows. Fixes bug
4112 backup, since os.remove may fail under Windows. Fixes bug
4102 reported by Thorsten.
4113 reported by Thorsten.
4103
4114
4104 2004-06-09 Fernando Perez <fperez@colorado.edu>
4115 2004-06-09 Fernando Perez <fperez@colorado.edu>
4105
4116
4106 * examples/example-embed.py: fixed all references to %n (replaced
4117 * examples/example-embed.py: fixed all references to %n (replaced
4107 with \\# for ps1/out prompts and with \\D for ps2 prompts). Done
4118 with \\# for ps1/out prompts and with \\D for ps2 prompts). Done
4108 for all examples and the manual as well.
4119 for all examples and the manual as well.
4109
4120
4110 2004-06-08 Fernando Perez <fperez@colorado.edu>
4121 2004-06-08 Fernando Perez <fperez@colorado.edu>
4111
4122
4112 * IPython/Prompts.py (Prompt2.set_p_str): fixed all prompt
4123 * IPython/Prompts.py (Prompt2.set_p_str): fixed all prompt
4113 alignment and color management. All 3 prompt subsystems now
4124 alignment and color management. All 3 prompt subsystems now
4114 inherit from BasePrompt.
4125 inherit from BasePrompt.
4115
4126
4116 * tools/release: updates for windows installer build and tag rpms
4127 * tools/release: updates for windows installer build and tag rpms
4117 with python version (since paths are fixed).
4128 with python version (since paths are fixed).
4118
4129
4119 * IPython/UserConfig/ipythonrc: modified to use \# instead of %n,
4130 * IPython/UserConfig/ipythonrc: modified to use \# instead of %n,
4120 which will become eventually obsolete. Also fixed the default
4131 which will become eventually obsolete. Also fixed the default
4121 prompt_in2 to use \D, so at least new users start with the correct
4132 prompt_in2 to use \D, so at least new users start with the correct
4122 defaults.
4133 defaults.
4123 WARNING: Users with existing ipythonrc files will need to apply
4134 WARNING: Users with existing ipythonrc files will need to apply
4124 this fix manually!
4135 this fix manually!
4125
4136
4126 * setup.py: make windows installer (.exe). This is finally the
4137 * setup.py: make windows installer (.exe). This is finally the
4127 integration of an old patch by Cory Dodt <dodt-AT-fcoe.k12.ca.us>,
4138 integration of an old patch by Cory Dodt <dodt-AT-fcoe.k12.ca.us>,
4128 which I hadn't included because it required Python 2.3 (or recent
4139 which I hadn't included because it required Python 2.3 (or recent
4129 distutils).
4140 distutils).
4130
4141
4131 * IPython/usage.py (__doc__): update docs (and manpage) to reflect
4142 * IPython/usage.py (__doc__): update docs (and manpage) to reflect
4132 usage of new '\D' escape.
4143 usage of new '\D' escape.
4133
4144
4134 * IPython/Prompts.py (ROOT_SYMBOL): Small fix for Windows (which
4145 * IPython/Prompts.py (ROOT_SYMBOL): Small fix for Windows (which
4135 lacks os.getuid())
4146 lacks os.getuid())
4136 (CachedOutput.set_colors): Added the ability to turn coloring
4147 (CachedOutput.set_colors): Added the ability to turn coloring
4137 on/off with @colors even for manually defined prompt colors. It
4148 on/off with @colors even for manually defined prompt colors. It
4138 uses a nasty global, but it works safely and via the generic color
4149 uses a nasty global, but it works safely and via the generic color
4139 handling mechanism.
4150 handling mechanism.
4140 (Prompt2.__init__): Introduced new escape '\D' for continuation
4151 (Prompt2.__init__): Introduced new escape '\D' for continuation
4141 prompts. It represents the counter ('\#') as dots.
4152 prompts. It represents the counter ('\#') as dots.
4142 *** NOTE *** THIS IS A BACKWARDS-INCOMPATIBLE CHANGE. Users will
4153 *** NOTE *** THIS IS A BACKWARDS-INCOMPATIBLE CHANGE. Users will
4143 need to update their ipythonrc files and replace '%n' with '\D' in
4154 need to update their ipythonrc files and replace '%n' with '\D' in
4144 their prompt_in2 settings everywhere. Sorry, but there's
4155 their prompt_in2 settings everywhere. Sorry, but there's
4145 otherwise no clean way to get all prompts to properly align. The
4156 otherwise no clean way to get all prompts to properly align. The
4146 ipythonrc shipped with IPython has been updated.
4157 ipythonrc shipped with IPython has been updated.
4147
4158
4148 2004-06-07 Fernando Perez <fperez@colorado.edu>
4159 2004-06-07 Fernando Perez <fperez@colorado.edu>
4149
4160
4150 * setup.py (isfile): Pass local_icons option to latex2html, so the
4161 * setup.py (isfile): Pass local_icons option to latex2html, so the
4151 resulting HTML file is self-contained. Thanks to
4162 resulting HTML file is self-contained. Thanks to
4152 dryice-AT-liu.com.cn for the tip.
4163 dryice-AT-liu.com.cn for the tip.
4153
4164
4154 * pysh.py: I created a new profile 'shell', which implements a
4165 * pysh.py: I created a new profile 'shell', which implements a
4155 _rudimentary_ IPython-based shell. This is in NO WAY a realy
4166 _rudimentary_ IPython-based shell. This is in NO WAY a realy
4156 system shell, nor will it become one anytime soon. It's mainly
4167 system shell, nor will it become one anytime soon. It's mainly
4157 meant to illustrate the use of the new flexible bash-like prompts.
4168 meant to illustrate the use of the new flexible bash-like prompts.
4158 I guess it could be used by hardy souls for true shell management,
4169 I guess it could be used by hardy souls for true shell management,
4159 but it's no tcsh/bash... pysh.py is loaded by the 'shell'
4170 but it's no tcsh/bash... pysh.py is loaded by the 'shell'
4160 profile. This uses the InterpreterExec extension provided by
4171 profile. This uses the InterpreterExec extension provided by
4161 W.J. van der Laan <gnufnork-AT-hetdigitalegat.nl>
4172 W.J. van der Laan <gnufnork-AT-hetdigitalegat.nl>
4162
4173
4163 * IPython/Prompts.py (PromptOut.__str__): now it will correctly
4174 * IPython/Prompts.py (PromptOut.__str__): now it will correctly
4164 auto-align itself with the length of the previous input prompt
4175 auto-align itself with the length of the previous input prompt
4165 (taking into account the invisible color escapes).
4176 (taking into account the invisible color escapes).
4166 (CachedOutput.__init__): Large restructuring of this class. Now
4177 (CachedOutput.__init__): Large restructuring of this class. Now
4167 all three prompts (primary1, primary2, output) are proper objects,
4178 all three prompts (primary1, primary2, output) are proper objects,
4168 managed by the 'parent' CachedOutput class. The code is still a
4179 managed by the 'parent' CachedOutput class. The code is still a
4169 bit hackish (all prompts share state via a pointer to the cache),
4180 bit hackish (all prompts share state via a pointer to the cache),
4170 but it's overall far cleaner than before.
4181 but it's overall far cleaner than before.
4171
4182
4172 * IPython/genutils.py (getoutputerror): modified to add verbose,
4183 * IPython/genutils.py (getoutputerror): modified to add verbose,
4173 debug and header options. This makes the interface of all getout*
4184 debug and header options. This makes the interface of all getout*
4174 functions uniform.
4185 functions uniform.
4175 (SystemExec.getoutputerror): added getoutputerror to SystemExec.
4186 (SystemExec.getoutputerror): added getoutputerror to SystemExec.
4176
4187
4177 * IPython/Magic.py (Magic.default_option): added a function to
4188 * IPython/Magic.py (Magic.default_option): added a function to
4178 allow registering default options for any magic command. This
4189 allow registering default options for any magic command. This
4179 makes it easy to have profiles which customize the magics globally
4190 makes it easy to have profiles which customize the magics globally
4180 for a certain use. The values set through this function are
4191 for a certain use. The values set through this function are
4181 picked up by the parse_options() method, which all magics should
4192 picked up by the parse_options() method, which all magics should
4182 use to parse their options.
4193 use to parse their options.
4183
4194
4184 * IPython/genutils.py (warn): modified the warnings framework to
4195 * IPython/genutils.py (warn): modified the warnings framework to
4185 use the Term I/O class. I'm trying to slowly unify all of
4196 use the Term I/O class. I'm trying to slowly unify all of
4186 IPython's I/O operations to pass through Term.
4197 IPython's I/O operations to pass through Term.
4187
4198
4188 * IPython/Prompts.py (Prompt2._str_other): Added functionality in
4199 * IPython/Prompts.py (Prompt2._str_other): Added functionality in
4189 the secondary prompt to correctly match the length of the primary
4200 the secondary prompt to correctly match the length of the primary
4190 one for any prompt. Now multi-line code will properly line up
4201 one for any prompt. Now multi-line code will properly line up
4191 even for path dependent prompts, such as the new ones available
4202 even for path dependent prompts, such as the new ones available
4192 via the prompt_specials.
4203 via the prompt_specials.
4193
4204
4194 2004-06-06 Fernando Perez <fperez@colorado.edu>
4205 2004-06-06 Fernando Perez <fperez@colorado.edu>
4195
4206
4196 * IPython/Prompts.py (prompt_specials): Added the ability to have
4207 * IPython/Prompts.py (prompt_specials): Added the ability to have
4197 bash-like special sequences in the prompts, which get
4208 bash-like special sequences in the prompts, which get
4198 automatically expanded. Things like hostname, current working
4209 automatically expanded. Things like hostname, current working
4199 directory and username are implemented already, but it's easy to
4210 directory and username are implemented already, but it's easy to
4200 add more in the future. Thanks to a patch by W.J. van der Laan
4211 add more in the future. Thanks to a patch by W.J. van der Laan
4201 <gnufnork-AT-hetdigitalegat.nl>
4212 <gnufnork-AT-hetdigitalegat.nl>
4202 (prompt_specials): Added color support for prompt strings, so
4213 (prompt_specials): Added color support for prompt strings, so
4203 users can define arbitrary color setups for their prompts.
4214 users can define arbitrary color setups for their prompts.
4204
4215
4205 2004-06-05 Fernando Perez <fperez@colorado.edu>
4216 2004-06-05 Fernando Perez <fperez@colorado.edu>
4206
4217
4207 * IPython/genutils.py (Term.reopen_all): Added Windows-specific
4218 * IPython/genutils.py (Term.reopen_all): Added Windows-specific
4208 code to load Gary Bishop's readline and configure it
4219 code to load Gary Bishop's readline and configure it
4209 automatically. Thanks to Gary for help on this.
4220 automatically. Thanks to Gary for help on this.
4210
4221
4211 2004-06-01 Fernando Perez <fperez@colorado.edu>
4222 2004-06-01 Fernando Perez <fperez@colorado.edu>
4212
4223
4213 * IPython/Logger.py (Logger.create_log): fix bug for logging
4224 * IPython/Logger.py (Logger.create_log): fix bug for logging
4214 with no filename (previous fix was incomplete).
4225 with no filename (previous fix was incomplete).
4215
4226
4216 2004-05-25 Fernando Perez <fperez@colorado.edu>
4227 2004-05-25 Fernando Perez <fperez@colorado.edu>
4217
4228
4218 * IPython/Magic.py (Magic.parse_options): fix bug where naked
4229 * IPython/Magic.py (Magic.parse_options): fix bug where naked
4219 parens would get passed to the shell.
4230 parens would get passed to the shell.
4220
4231
4221 2004-05-20 Fernando Perez <fperez@colorado.edu>
4232 2004-05-20 Fernando Perez <fperez@colorado.edu>
4222
4233
4223 * IPython/Magic.py (Magic.magic_prun): changed default profile
4234 * IPython/Magic.py (Magic.magic_prun): changed default profile
4224 sort order to 'time' (the more common profiling need).
4235 sort order to 'time' (the more common profiling need).
4225
4236
4226 * IPython/OInspect.py (Inspector.pinfo): flush the inspect cache
4237 * IPython/OInspect.py (Inspector.pinfo): flush the inspect cache
4227 so that source code shown is guaranteed in sync with the file on
4238 so that source code shown is guaranteed in sync with the file on
4228 disk (also changed in psource). Similar fix to the one for
4239 disk (also changed in psource). Similar fix to the one for
4229 ultraTB on 2004-05-06. Thanks to a bug report by Yann Le Du
4240 ultraTB on 2004-05-06. Thanks to a bug report by Yann Le Du
4230 <yann.ledu-AT-noos.fr>.
4241 <yann.ledu-AT-noos.fr>.
4231
4242
4232 * IPython/Magic.py (Magic.parse_options): Fixed bug where commands
4243 * IPython/Magic.py (Magic.parse_options): Fixed bug where commands
4233 with a single option would not be correctly parsed. Closes
4244 with a single option would not be correctly parsed. Closes
4234 http://www.scipy.net/roundup/ipython/issue14. This bug had been
4245 http://www.scipy.net/roundup/ipython/issue14. This bug had been
4235 introduced in 0.6.0 (on 2004-05-06).
4246 introduced in 0.6.0 (on 2004-05-06).
4236
4247
4237 2004-05-13 *** Released version 0.6.0
4248 2004-05-13 *** Released version 0.6.0
4238
4249
4239 2004-05-13 Fernando Perez <fperez@colorado.edu>
4250 2004-05-13 Fernando Perez <fperez@colorado.edu>
4240
4251
4241 * debian/: Added debian/ directory to CVS, so that debian support
4252 * debian/: Added debian/ directory to CVS, so that debian support
4242 is publicly accessible. The debian package is maintained by Jack
4253 is publicly accessible. The debian package is maintained by Jack
4243 Moffit <jack-AT-xiph.org>.
4254 Moffit <jack-AT-xiph.org>.
4244
4255
4245 * Documentation: included the notes about an ipython-based system
4256 * Documentation: included the notes about an ipython-based system
4246 shell (the hypothetical 'pysh') into the new_design.pdf document,
4257 shell (the hypothetical 'pysh') into the new_design.pdf document,
4247 so that these ideas get distributed to users along with the
4258 so that these ideas get distributed to users along with the
4248 official documentation.
4259 official documentation.
4249
4260
4250 2004-05-10 Fernando Perez <fperez@colorado.edu>
4261 2004-05-10 Fernando Perez <fperez@colorado.edu>
4251
4262
4252 * IPython/Logger.py (Logger.create_log): fix recently introduced
4263 * IPython/Logger.py (Logger.create_log): fix recently introduced
4253 bug (misindented line) where logstart would fail when not given an
4264 bug (misindented line) where logstart would fail when not given an
4254 explicit filename.
4265 explicit filename.
4255
4266
4256 2004-05-09 Fernando Perez <fperez@colorado.edu>
4267 2004-05-09 Fernando Perez <fperez@colorado.edu>
4257
4268
4258 * IPython/Magic.py (Magic.parse_options): skip system call when
4269 * IPython/Magic.py (Magic.parse_options): skip system call when
4259 there are no options to look for. Faster, cleaner for the common
4270 there are no options to look for. Faster, cleaner for the common
4260 case.
4271 case.
4261
4272
4262 * Documentation: many updates to the manual: describing Windows
4273 * Documentation: many updates to the manual: describing Windows
4263 support better, Gnuplot updates, credits, misc small stuff. Also
4274 support better, Gnuplot updates, credits, misc small stuff. Also
4264 updated the new_design doc a bit.
4275 updated the new_design doc a bit.
4265
4276
4266 2004-05-06 *** Released version 0.6.0.rc1
4277 2004-05-06 *** Released version 0.6.0.rc1
4267
4278
4268 2004-05-06 Fernando Perez <fperez@colorado.edu>
4279 2004-05-06 Fernando Perez <fperez@colorado.edu>
4269
4280
4270 * IPython/ultraTB.py (ListTB.text): modified a ton of string +=
4281 * IPython/ultraTB.py (ListTB.text): modified a ton of string +=
4271 operations to use the vastly more efficient list/''.join() method.
4282 operations to use the vastly more efficient list/''.join() method.
4272 (FormattedTB.text): Fix
4283 (FormattedTB.text): Fix
4273 http://www.scipy.net/roundup/ipython/issue12 - exception source
4284 http://www.scipy.net/roundup/ipython/issue12 - exception source
4274 extract not updated after reload. Thanks to Mike Salib
4285 extract not updated after reload. Thanks to Mike Salib
4275 <msalib-AT-mit.edu> for pinning the source of the problem.
4286 <msalib-AT-mit.edu> for pinning the source of the problem.
4276 Fortunately, the solution works inside ipython and doesn't require
4287 Fortunately, the solution works inside ipython and doesn't require
4277 any changes to python proper.
4288 any changes to python proper.
4278
4289
4279 * IPython/Magic.py (Magic.parse_options): Improved to process the
4290 * IPython/Magic.py (Magic.parse_options): Improved to process the
4280 argument list as a true shell would (by actually using the
4291 argument list as a true shell would (by actually using the
4281 underlying system shell). This way, all @magics automatically get
4292 underlying system shell). This way, all @magics automatically get
4282 shell expansion for variables. Thanks to a comment by Alex
4293 shell expansion for variables. Thanks to a comment by Alex
4283 Schmolck.
4294 Schmolck.
4284
4295
4285 2004-04-04 Fernando Perez <fperez@colorado.edu>
4296 2004-04-04 Fernando Perez <fperez@colorado.edu>
4286
4297
4287 * IPython/iplib.py (InteractiveShell.interact): Added a special
4298 * IPython/iplib.py (InteractiveShell.interact): Added a special
4288 trap for a debugger quit exception, which is basically impossible
4299 trap for a debugger quit exception, which is basically impossible
4289 to handle by normal mechanisms, given what pdb does to the stack.
4300 to handle by normal mechanisms, given what pdb does to the stack.
4290 This fixes a crash reported by <fgibbons-AT-llama.med.harvard.edu>.
4301 This fixes a crash reported by <fgibbons-AT-llama.med.harvard.edu>.
4291
4302
4292 2004-04-03 Fernando Perez <fperez@colorado.edu>
4303 2004-04-03 Fernando Perez <fperez@colorado.edu>
4293
4304
4294 * IPython/genutils.py (Term): Standardized the names of the Term
4305 * IPython/genutils.py (Term): Standardized the names of the Term
4295 class streams to cin/cout/cerr, following C++ naming conventions
4306 class streams to cin/cout/cerr, following C++ naming conventions
4296 (I can't use in/out/err because 'in' is not a valid attribute
4307 (I can't use in/out/err because 'in' is not a valid attribute
4297 name).
4308 name).
4298
4309
4299 * IPython/iplib.py (InteractiveShell.interact): don't increment
4310 * IPython/iplib.py (InteractiveShell.interact): don't increment
4300 the prompt if there's no user input. By Daniel 'Dang' Griffith
4311 the prompt if there's no user input. By Daniel 'Dang' Griffith
4301 <pythondev-dang-AT-lazytwinacres.net>, after a suggestion from
4312 <pythondev-dang-AT-lazytwinacres.net>, after a suggestion from
4302 Francois Pinard.
4313 Francois Pinard.
4303
4314
4304 2004-04-02 Fernando Perez <fperez@colorado.edu>
4315 2004-04-02 Fernando Perez <fperez@colorado.edu>
4305
4316
4306 * IPython/genutils.py (Stream.__init__): Modified to survive at
4317 * IPython/genutils.py (Stream.__init__): Modified to survive at
4307 least importing in contexts where stdin/out/err aren't true file
4318 least importing in contexts where stdin/out/err aren't true file
4308 objects, such as PyCrust (they lack fileno() and mode). However,
4319 objects, such as PyCrust (they lack fileno() and mode). However,
4309 the recovery facilities which rely on these things existing will
4320 the recovery facilities which rely on these things existing will
4310 not work.
4321 not work.
4311
4322
4312 2004-04-01 Fernando Perez <fperez@colorado.edu>
4323 2004-04-01 Fernando Perez <fperez@colorado.edu>
4313
4324
4314 * IPython/Magic.py (Magic.magic_sx): modified (as well as @sc) to
4325 * IPython/Magic.py (Magic.magic_sx): modified (as well as @sc) to
4315 use the new getoutputerror() function, so it properly
4326 use the new getoutputerror() function, so it properly
4316 distinguishes stdout/err.
4327 distinguishes stdout/err.
4317
4328
4318 * IPython/genutils.py (getoutputerror): added a function to
4329 * IPython/genutils.py (getoutputerror): added a function to
4319 capture separately the standard output and error of a command.
4330 capture separately the standard output and error of a command.
4320 After a comment from dang on the mailing lists. This code is
4331 After a comment from dang on the mailing lists. This code is
4321 basically a modified version of commands.getstatusoutput(), from
4332 basically a modified version of commands.getstatusoutput(), from
4322 the standard library.
4333 the standard library.
4323
4334
4324 * IPython/iplib.py (InteractiveShell.handle_shell_escape): added
4335 * IPython/iplib.py (InteractiveShell.handle_shell_escape): added
4325 '!!' as a special syntax (shorthand) to access @sx.
4336 '!!' as a special syntax (shorthand) to access @sx.
4326
4337
4327 * IPython/Magic.py (Magic.magic_sx): new magic, to execute a shell
4338 * IPython/Magic.py (Magic.magic_sx): new magic, to execute a shell
4328 command and return its output as a list split on '\n'.
4339 command and return its output as a list split on '\n'.
4329
4340
4330 2004-03-31 Fernando Perez <fperez@colorado.edu>
4341 2004-03-31 Fernando Perez <fperez@colorado.edu>
4331
4342
4332 * IPython/FakeModule.py (FakeModule.__init__): added __nonzero__
4343 * IPython/FakeModule.py (FakeModule.__init__): added __nonzero__
4333 method to dictionaries used as FakeModule instances if they lack
4344 method to dictionaries used as FakeModule instances if they lack
4334 it. At least pydoc in python2.3 breaks for runtime-defined
4345 it. At least pydoc in python2.3 breaks for runtime-defined
4335 functions without this hack. At some point I need to _really_
4346 functions without this hack. At some point I need to _really_
4336 understand what FakeModule is doing, because it's a gross hack.
4347 understand what FakeModule is doing, because it's a gross hack.
4337 But it solves Arnd's problem for now...
4348 But it solves Arnd's problem for now...
4338
4349
4339 2004-02-27 Fernando Perez <fperez@colorado.edu>
4350 2004-02-27 Fernando Perez <fperez@colorado.edu>
4340
4351
4341 * IPython/Logger.py (Logger.create_log): Fix bug where 'rotate'
4352 * IPython/Logger.py (Logger.create_log): Fix bug where 'rotate'
4342 mode would behave erratically. Also increased the number of
4353 mode would behave erratically. Also increased the number of
4343 possible logs in rotate mod to 999. Thanks to Rod Holland
4354 possible logs in rotate mod to 999. Thanks to Rod Holland
4344 <rhh@StructureLABS.com> for the report and fixes.
4355 <rhh@StructureLABS.com> for the report and fixes.
4345
4356
4346 2004-02-26 Fernando Perez <fperez@colorado.edu>
4357 2004-02-26 Fernando Perez <fperez@colorado.edu>
4347
4358
4348 * IPython/genutils.py (page): Check that the curses module really
4359 * IPython/genutils.py (page): Check that the curses module really
4349 has the initscr attribute before trying to use it. For some
4360 has the initscr attribute before trying to use it. For some
4350 reason, the Solaris curses module is missing this. I think this
4361 reason, the Solaris curses module is missing this. I think this
4351 should be considered a Solaris python bug, but I'm not sure.
4362 should be considered a Solaris python bug, but I'm not sure.
4352
4363
4353 2004-01-17 Fernando Perez <fperez@colorado.edu>
4364 2004-01-17 Fernando Perez <fperez@colorado.edu>
4354
4365
4355 * IPython/genutils.py (Stream.__init__): Changes to try to make
4366 * IPython/genutils.py (Stream.__init__): Changes to try to make
4356 ipython robust against stdin/out/err being closed by the user.
4367 ipython robust against stdin/out/err being closed by the user.
4357 This is 'user error' (and blocks a normal python session, at least
4368 This is 'user error' (and blocks a normal python session, at least
4358 the stdout case). However, Ipython should be able to survive such
4369 the stdout case). However, Ipython should be able to survive such
4359 instances of abuse as gracefully as possible. To simplify the
4370 instances of abuse as gracefully as possible. To simplify the
4360 coding and maintain compatibility with Gary Bishop's Term
4371 coding and maintain compatibility with Gary Bishop's Term
4361 contributions, I've made use of classmethods for this. I think
4372 contributions, I've made use of classmethods for this. I think
4362 this introduces a dependency on python 2.2.
4373 this introduces a dependency on python 2.2.
4363
4374
4364 2004-01-13 Fernando Perez <fperez@colorado.edu>
4375 2004-01-13 Fernando Perez <fperez@colorado.edu>
4365
4376
4366 * IPython/numutils.py (exp_safe): simplified the code a bit and
4377 * IPython/numutils.py (exp_safe): simplified the code a bit and
4367 removed the need for importing the kinds module altogether.
4378 removed the need for importing the kinds module altogether.
4368
4379
4369 2004-01-06 Fernando Perez <fperez@colorado.edu>
4380 2004-01-06 Fernando Perez <fperez@colorado.edu>
4370
4381
4371 * IPython/Magic.py (Magic.magic_sc): Made the shell capture system
4382 * IPython/Magic.py (Magic.magic_sc): Made the shell capture system
4372 a magic function instead, after some community feedback. No
4383 a magic function instead, after some community feedback. No
4373 special syntax will exist for it, but its name is deliberately
4384 special syntax will exist for it, but its name is deliberately
4374 very short.
4385 very short.
4375
4386
4376 2003-12-20 Fernando Perez <fperez@colorado.edu>
4387 2003-12-20 Fernando Perez <fperez@colorado.edu>
4377
4388
4378 * IPython/iplib.py (InteractiveShell.handle_shell_assign): Added
4389 * IPython/iplib.py (InteractiveShell.handle_shell_assign): Added
4379 new functionality, to automagically assign the result of a shell
4390 new functionality, to automagically assign the result of a shell
4380 command to a variable. I'll solicit some community feedback on
4391 command to a variable. I'll solicit some community feedback on
4381 this before making it permanent.
4392 this before making it permanent.
4382
4393
4383 * IPython/OInspect.py (Inspector.pinfo): Fix crash when info was
4394 * IPython/OInspect.py (Inspector.pinfo): Fix crash when info was
4384 requested about callables for which inspect couldn't obtain a
4395 requested about callables for which inspect couldn't obtain a
4385 proper argspec. Thanks to a crash report sent by Etienne
4396 proper argspec. Thanks to a crash report sent by Etienne
4386 Posthumus <etienne-AT-apple01.cs.vu.nl>.
4397 Posthumus <etienne-AT-apple01.cs.vu.nl>.
4387
4398
4388 2003-12-09 Fernando Perez <fperez@colorado.edu>
4399 2003-12-09 Fernando Perez <fperez@colorado.edu>
4389
4400
4390 * IPython/genutils.py (page): patch for the pager to work across
4401 * IPython/genutils.py (page): patch for the pager to work across
4391 various versions of Windows. By Gary Bishop.
4402 various versions of Windows. By Gary Bishop.
4392
4403
4393 2003-12-04 Fernando Perez <fperez@colorado.edu>
4404 2003-12-04 Fernando Perez <fperez@colorado.edu>
4394
4405
4395 * IPython/Gnuplot2.py (PlotItems): Fixes for working with
4406 * IPython/Gnuplot2.py (PlotItems): Fixes for working with
4396 Gnuplot.py version 1.7, whose internal names changed quite a bit.
4407 Gnuplot.py version 1.7, whose internal names changed quite a bit.
4397 While I tested this and it looks ok, there may still be corner
4408 While I tested this and it looks ok, there may still be corner
4398 cases I've missed.
4409 cases I've missed.
4399
4410
4400 2003-12-01 Fernando Perez <fperez@colorado.edu>
4411 2003-12-01 Fernando Perez <fperez@colorado.edu>
4401
4412
4402 * IPython/iplib.py (InteractiveShell._prefilter): Fixed a bug
4413 * IPython/iplib.py (InteractiveShell._prefilter): Fixed a bug
4403 where a line like 'p,q=1,2' would fail because the automagic
4414 where a line like 'p,q=1,2' would fail because the automagic
4404 system would be triggered for @p.
4415 system would be triggered for @p.
4405
4416
4406 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): Tab-related
4417 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): Tab-related
4407 cleanups, code unmodified.
4418 cleanups, code unmodified.
4408
4419
4409 * IPython/genutils.py (Term): added a class for IPython to handle
4420 * IPython/genutils.py (Term): added a class for IPython to handle
4410 output. In most cases it will just be a proxy for stdout/err, but
4421 output. In most cases it will just be a proxy for stdout/err, but
4411 having this allows modifications to be made for some platforms,
4422 having this allows modifications to be made for some platforms,
4412 such as handling color escapes under Windows. All of this code
4423 such as handling color escapes under Windows. All of this code
4413 was contributed by Gary Bishop, with minor modifications by me.
4424 was contributed by Gary Bishop, with minor modifications by me.
4414 The actual changes affect many files.
4425 The actual changes affect many files.
4415
4426
4416 2003-11-30 Fernando Perez <fperez@colorado.edu>
4427 2003-11-30 Fernando Perez <fperez@colorado.edu>
4417
4428
4418 * IPython/iplib.py (file_matches): new completion code, courtesy
4429 * IPython/iplib.py (file_matches): new completion code, courtesy
4419 of Jeff Collins. This enables filename completion again under
4430 of Jeff Collins. This enables filename completion again under
4420 python 2.3, which disabled it at the C level.
4431 python 2.3, which disabled it at the C level.
4421
4432
4422 2003-11-11 Fernando Perez <fperez@colorado.edu>
4433 2003-11-11 Fernando Perez <fperez@colorado.edu>
4423
4434
4424 * IPython/numutils.py (amap): Added amap() fn. Simple shorthand
4435 * IPython/numutils.py (amap): Added amap() fn. Simple shorthand
4425 for Numeric.array(map(...)), but often convenient.
4436 for Numeric.array(map(...)), but often convenient.
4426
4437
4427 2003-11-05 Fernando Perez <fperez@colorado.edu>
4438 2003-11-05 Fernando Perez <fperez@colorado.edu>
4428
4439
4429 * IPython/numutils.py (frange): Changed a call from int() to
4440 * IPython/numutils.py (frange): Changed a call from int() to
4430 int(round()) to prevent a problem reported with arange() in the
4441 int(round()) to prevent a problem reported with arange() in the
4431 numpy list.
4442 numpy list.
4432
4443
4433 2003-10-06 Fernando Perez <fperez@colorado.edu>
4444 2003-10-06 Fernando Perez <fperez@colorado.edu>
4434
4445
4435 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): changed to
4446 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): changed to
4436 prevent crashes if sys lacks an argv attribute (it happens with
4447 prevent crashes if sys lacks an argv attribute (it happens with
4437 embedded interpreters which build a bare-bones sys module).
4448 embedded interpreters which build a bare-bones sys module).
4438 Thanks to a report/bugfix by Adam Hupp <hupp-AT-cs.wisc.edu>.
4449 Thanks to a report/bugfix by Adam Hupp <hupp-AT-cs.wisc.edu>.
4439
4450
4440 2003-09-24 Fernando Perez <fperez@colorado.edu>
4451 2003-09-24 Fernando Perez <fperez@colorado.edu>
4441
4452
4442 * IPython/Magic.py (Magic._ofind): blanket except around getattr()
4453 * IPython/Magic.py (Magic._ofind): blanket except around getattr()
4443 to protect against poorly written user objects where __getattr__
4454 to protect against poorly written user objects where __getattr__
4444 raises exceptions other than AttributeError. Thanks to a bug
4455 raises exceptions other than AttributeError. Thanks to a bug
4445 report by Oliver Sander <osander-AT-gmx.de>.
4456 report by Oliver Sander <osander-AT-gmx.de>.
4446
4457
4447 * IPython/FakeModule.py (FakeModule.__repr__): this method was
4458 * IPython/FakeModule.py (FakeModule.__repr__): this method was
4448 missing. Thanks to bug report by Ralf Schmitt <ralf-AT-brainbot.com>.
4459 missing. Thanks to bug report by Ralf Schmitt <ralf-AT-brainbot.com>.
4449
4460
4450 2003-09-09 Fernando Perez <fperez@colorado.edu>
4461 2003-09-09 Fernando Perez <fperez@colorado.edu>
4451
4462
4452 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
4463 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
4453 unpacking a list whith a callable as first element would
4464 unpacking a list whith a callable as first element would
4454 mistakenly trigger autocalling. Thanks to a bug report by Jeffery
4465 mistakenly trigger autocalling. Thanks to a bug report by Jeffery
4455 Collins.
4466 Collins.
4456
4467
4457 2003-08-25 *** Released version 0.5.0
4468 2003-08-25 *** Released version 0.5.0
4458
4469
4459 2003-08-22 Fernando Perez <fperez@colorado.edu>
4470 2003-08-22 Fernando Perez <fperez@colorado.edu>
4460
4471
4461 * IPython/ultraTB.py (VerboseTB.linereader): Improved handling of
4472 * IPython/ultraTB.py (VerboseTB.linereader): Improved handling of
4462 improperly defined user exceptions. Thanks to feedback from Mark
4473 improperly defined user exceptions. Thanks to feedback from Mark
4463 Russell <mrussell-AT-verio.net>.
4474 Russell <mrussell-AT-verio.net>.
4464
4475
4465 2003-08-20 Fernando Perez <fperez@colorado.edu>
4476 2003-08-20 Fernando Perez <fperez@colorado.edu>
4466
4477
4467 * IPython/OInspect.py (Inspector.pinfo): changed String Form
4478 * IPython/OInspect.py (Inspector.pinfo): changed String Form
4468 printing so that it would print multi-line string forms starting
4479 printing so that it would print multi-line string forms starting
4469 with a new line. This way the formatting is better respected for
4480 with a new line. This way the formatting is better respected for
4470 objects which work hard to make nice string forms.
4481 objects which work hard to make nice string forms.
4471
4482
4472 * IPython/iplib.py (InteractiveShell.handle_auto): Fix bug where
4483 * IPython/iplib.py (InteractiveShell.handle_auto): Fix bug where
4473 autocall would overtake data access for objects with both
4484 autocall would overtake data access for objects with both
4474 __getitem__ and __call__.
4485 __getitem__ and __call__.
4475
4486
4476 2003-08-19 *** Released version 0.5.0-rc1
4487 2003-08-19 *** Released version 0.5.0-rc1
4477
4488
4478 2003-08-19 Fernando Perez <fperez@colorado.edu>
4489 2003-08-19 Fernando Perez <fperez@colorado.edu>
4479
4490
4480 * IPython/deep_reload.py (load_tail): single tiny change here
4491 * IPython/deep_reload.py (load_tail): single tiny change here
4481 seems to fix the long-standing bug of dreload() failing to work
4492 seems to fix the long-standing bug of dreload() failing to work
4482 for dotted names. But this module is pretty tricky, so I may have
4493 for dotted names. But this module is pretty tricky, so I may have
4483 missed some subtlety. Needs more testing!.
4494 missed some subtlety. Needs more testing!.
4484
4495
4485 * IPython/ultraTB.py (VerboseTB.linereader): harden against user
4496 * IPython/ultraTB.py (VerboseTB.linereader): harden against user
4486 exceptions which have badly implemented __str__ methods.
4497 exceptions which have badly implemented __str__ methods.
4487 (VerboseTB.text): harden against inspect.getinnerframes crashing,
4498 (VerboseTB.text): harden against inspect.getinnerframes crashing,
4488 which I've been getting reports about from Python 2.3 users. I
4499 which I've been getting reports about from Python 2.3 users. I
4489 wish I had a simple test case to reproduce the problem, so I could
4500 wish I had a simple test case to reproduce the problem, so I could
4490 either write a cleaner workaround or file a bug report if
4501 either write a cleaner workaround or file a bug report if
4491 necessary.
4502 necessary.
4492
4503
4493 * IPython/Magic.py (Magic.magic_edit): fixed bug where after
4504 * IPython/Magic.py (Magic.magic_edit): fixed bug where after
4494 making a class 'foo', file 'foo.py' couldn't be edited. Thanks to
4505 making a class 'foo', file 'foo.py' couldn't be edited. Thanks to
4495 a bug report by Tjabo Kloppenburg.
4506 a bug report by Tjabo Kloppenburg.
4496
4507
4497 * IPython/ultraTB.py (VerboseTB.debugger): hardened against pdb
4508 * IPython/ultraTB.py (VerboseTB.debugger): hardened against pdb
4498 crashes. Wrapped the pdb call in a blanket try/except, since pdb
4509 crashes. Wrapped the pdb call in a blanket try/except, since pdb
4499 seems rather unstable. Thanks to a bug report by Tjabo
4510 seems rather unstable. Thanks to a bug report by Tjabo
4500 Kloppenburg <tjabo.kloppenburg-AT-unix-ag.uni-siegen.de>.
4511 Kloppenburg <tjabo.kloppenburg-AT-unix-ag.uni-siegen.de>.
4501
4512
4502 * IPython/Release.py (version): release 0.5.0-rc1. I want to put
4513 * IPython/Release.py (version): release 0.5.0-rc1. I want to put
4503 this out soon because of the critical fixes in the inner loop for
4514 this out soon because of the critical fixes in the inner loop for
4504 generators.
4515 generators.
4505
4516
4506 * IPython/Magic.py (Magic.getargspec): removed. This (and
4517 * IPython/Magic.py (Magic.getargspec): removed. This (and
4507 _get_def) have been obsoleted by OInspect for a long time, I
4518 _get_def) have been obsoleted by OInspect for a long time, I
4508 hadn't noticed that they were dead code.
4519 hadn't noticed that they were dead code.
4509 (Magic._ofind): restored _ofind functionality for a few literals
4520 (Magic._ofind): restored _ofind functionality for a few literals
4510 (those in ["''",'""','[]','{}','()']). But it won't work anymore
4521 (those in ["''",'""','[]','{}','()']). But it won't work anymore
4511 for things like "hello".capitalize?, since that would require a
4522 for things like "hello".capitalize?, since that would require a
4512 potentially dangerous eval() again.
4523 potentially dangerous eval() again.
4513
4524
4514 * IPython/iplib.py (InteractiveShell._prefilter): reorganized the
4525 * IPython/iplib.py (InteractiveShell._prefilter): reorganized the
4515 logic a bit more to clean up the escapes handling and minimize the
4526 logic a bit more to clean up the escapes handling and minimize the
4516 use of _ofind to only necessary cases. The interactive 'feel' of
4527 use of _ofind to only necessary cases. The interactive 'feel' of
4517 IPython should have improved quite a bit with the changes in
4528 IPython should have improved quite a bit with the changes in
4518 _prefilter and _ofind (besides being far safer than before).
4529 _prefilter and _ofind (besides being far safer than before).
4519
4530
4520 * IPython/Magic.py (Magic.magic_edit): Fixed old bug (but rather
4531 * IPython/Magic.py (Magic.magic_edit): Fixed old bug (but rather
4521 obscure, never reported). Edit would fail to find the object to
4532 obscure, never reported). Edit would fail to find the object to
4522 edit under some circumstances.
4533 edit under some circumstances.
4523 (Magic._ofind): CRITICAL FIX. Finally removed the eval() calls
4534 (Magic._ofind): CRITICAL FIX. Finally removed the eval() calls
4524 which were causing double-calling of generators. Those eval calls
4535 which were causing double-calling of generators. Those eval calls
4525 were _very_ dangerous, since code with side effects could be
4536 were _very_ dangerous, since code with side effects could be
4526 triggered. As they say, 'eval is evil'... These were the
4537 triggered. As they say, 'eval is evil'... These were the
4527 nastiest evals in IPython. Besides, _ofind is now far simpler,
4538 nastiest evals in IPython. Besides, _ofind is now far simpler,
4528 and it should also be quite a bit faster. Its use of inspect is
4539 and it should also be quite a bit faster. Its use of inspect is
4529 also safer, so perhaps some of the inspect-related crashes I've
4540 also safer, so perhaps some of the inspect-related crashes I've
4530 seen lately with Python 2.3 might be taken care of. That will
4541 seen lately with Python 2.3 might be taken care of. That will
4531 need more testing.
4542 need more testing.
4532
4543
4533 2003-08-17 Fernando Perez <fperez@colorado.edu>
4544 2003-08-17 Fernando Perez <fperez@colorado.edu>
4534
4545
4535 * IPython/iplib.py (InteractiveShell._prefilter): significant
4546 * IPython/iplib.py (InteractiveShell._prefilter): significant
4536 simplifications to the logic for handling user escapes. Faster
4547 simplifications to the logic for handling user escapes. Faster
4537 and simpler code.
4548 and simpler code.
4538
4549
4539 2003-08-14 Fernando Perez <fperez@colorado.edu>
4550 2003-08-14 Fernando Perez <fperez@colorado.edu>
4540
4551
4541 * IPython/numutils.py (sum_flat): rewrote to be non-recursive.
4552 * IPython/numutils.py (sum_flat): rewrote to be non-recursive.
4542 Now it requires O(N) storage (N=size(a)) for non-contiguous input,
4553 Now it requires O(N) storage (N=size(a)) for non-contiguous input,
4543 but it should be quite a bit faster. And the recursive version
4554 but it should be quite a bit faster. And the recursive version
4544 generated O(log N) intermediate storage for all rank>1 arrays,
4555 generated O(log N) intermediate storage for all rank>1 arrays,
4545 even if they were contiguous.
4556 even if they were contiguous.
4546 (l1norm): Added this function.
4557 (l1norm): Added this function.
4547 (norm): Added this function for arbitrary norms (including
4558 (norm): Added this function for arbitrary norms (including
4548 l-infinity). l1 and l2 are still special cases for convenience
4559 l-infinity). l1 and l2 are still special cases for convenience
4549 and speed.
4560 and speed.
4550
4561
4551 2003-08-03 Fernando Perez <fperez@colorado.edu>
4562 2003-08-03 Fernando Perez <fperez@colorado.edu>
4552
4563
4553 * IPython/Magic.py (Magic.magic_edit): Removed all remaining string
4564 * IPython/Magic.py (Magic.magic_edit): Removed all remaining string
4554 exceptions, which now raise PendingDeprecationWarnings in Python
4565 exceptions, which now raise PendingDeprecationWarnings in Python
4555 2.3. There were some in Magic and some in Gnuplot2.
4566 2.3. There were some in Magic and some in Gnuplot2.
4556
4567
4557 2003-06-30 Fernando Perez <fperez@colorado.edu>
4568 2003-06-30 Fernando Perez <fperez@colorado.edu>
4558
4569
4559 * IPython/genutils.py (page): modified to call curses only for
4570 * IPython/genutils.py (page): modified to call curses only for
4560 terminals where TERM=='xterm'. After problems under many other
4571 terminals where TERM=='xterm'. After problems under many other
4561 terminals were reported by Keith Beattie <KSBeattie-AT-lbl.gov>.
4572 terminals were reported by Keith Beattie <KSBeattie-AT-lbl.gov>.
4562
4573
4563 * IPython/iplib.py (complete): removed spurious 'print "IE"' which
4574 * IPython/iplib.py (complete): removed spurious 'print "IE"' which
4564 would be triggered when readline was absent. This was just an old
4575 would be triggered when readline was absent. This was just an old
4565 debugging statement I'd forgotten to take out.
4576 debugging statement I'd forgotten to take out.
4566
4577
4567 2003-06-20 Fernando Perez <fperez@colorado.edu>
4578 2003-06-20 Fernando Perez <fperez@colorado.edu>
4568
4579
4569 * IPython/genutils.py (clock): modified to return only user time
4580 * IPython/genutils.py (clock): modified to return only user time
4570 (not counting system time), after a discussion on scipy. While
4581 (not counting system time), after a discussion on scipy. While
4571 system time may be a useful quantity occasionally, it may much
4582 system time may be a useful quantity occasionally, it may much
4572 more easily be skewed by occasional swapping or other similar
4583 more easily be skewed by occasional swapping or other similar
4573 activity.
4584 activity.
4574
4585
4575 2003-06-05 Fernando Perez <fperez@colorado.edu>
4586 2003-06-05 Fernando Perez <fperez@colorado.edu>
4576
4587
4577 * IPython/numutils.py (identity): new function, for building
4588 * IPython/numutils.py (identity): new function, for building
4578 arbitrary rank Kronecker deltas (mostly backwards compatible with
4589 arbitrary rank Kronecker deltas (mostly backwards compatible with
4579 Numeric.identity)
4590 Numeric.identity)
4580
4591
4581 2003-06-03 Fernando Perez <fperez@colorado.edu>
4592 2003-06-03 Fernando Perez <fperez@colorado.edu>
4582
4593
4583 * IPython/iplib.py (InteractiveShell.handle_magic): protect
4594 * IPython/iplib.py (InteractiveShell.handle_magic): protect
4584 arguments passed to magics with spaces, to allow trailing '\' to
4595 arguments passed to magics with spaces, to allow trailing '\' to
4585 work normally (mainly for Windows users).
4596 work normally (mainly for Windows users).
4586
4597
4587 2003-05-29 Fernando Perez <fperez@colorado.edu>
4598 2003-05-29 Fernando Perez <fperez@colorado.edu>
4588
4599
4589 * IPython/ipmaker.py (make_IPython): Load site._Helper() as help
4600 * IPython/ipmaker.py (make_IPython): Load site._Helper() as help
4590 instead of pydoc.help. This fixes a bizarre behavior where
4601 instead of pydoc.help. This fixes a bizarre behavior where
4591 printing '%s' % locals() would trigger the help system. Now
4602 printing '%s' % locals() would trigger the help system. Now
4592 ipython behaves like normal python does.
4603 ipython behaves like normal python does.
4593
4604
4594 Note that if one does 'from pydoc import help', the bizarre
4605 Note that if one does 'from pydoc import help', the bizarre
4595 behavior returns, but this will also happen in normal python, so
4606 behavior returns, but this will also happen in normal python, so
4596 it's not an ipython bug anymore (it has to do with how pydoc.help
4607 it's not an ipython bug anymore (it has to do with how pydoc.help
4597 is implemented).
4608 is implemented).
4598
4609
4599 2003-05-22 Fernando Perez <fperez@colorado.edu>
4610 2003-05-22 Fernando Perez <fperez@colorado.edu>
4600
4611
4601 * IPython/FlexCompleter.py (Completer.attr_matches): fixed to
4612 * IPython/FlexCompleter.py (Completer.attr_matches): fixed to
4602 return [] instead of None when nothing matches, also match to end
4613 return [] instead of None when nothing matches, also match to end
4603 of line. Patch by Gary Bishop.
4614 of line. Patch by Gary Bishop.
4604
4615
4605 * IPython/ipmaker.py (make_IPython): Added same sys.excepthook
4616 * IPython/ipmaker.py (make_IPython): Added same sys.excepthook
4606 protection as before, for files passed on the command line. This
4617 protection as before, for files passed on the command line. This
4607 prevents the CrashHandler from kicking in if user files call into
4618 prevents the CrashHandler from kicking in if user files call into
4608 sys.excepthook (such as PyQt and WxWindows have a nasty habit of
4619 sys.excepthook (such as PyQt and WxWindows have a nasty habit of
4609 doing). After a report by Kasper Souren <Kasper.Souren-AT-ircam.fr>
4620 doing). After a report by Kasper Souren <Kasper.Souren-AT-ircam.fr>
4610
4621
4611 2003-05-20 *** Released version 0.4.0
4622 2003-05-20 *** Released version 0.4.0
4612
4623
4613 2003-05-20 Fernando Perez <fperez@colorado.edu>
4624 2003-05-20 Fernando Perez <fperez@colorado.edu>
4614
4625
4615 * setup.py: added support for manpages. It's a bit hackish b/c of
4626 * setup.py: added support for manpages. It's a bit hackish b/c of
4616 a bug in the way the bdist_rpm distutils target handles gzipped
4627 a bug in the way the bdist_rpm distutils target handles gzipped
4617 manpages, but it works. After a patch by Jack.
4628 manpages, but it works. After a patch by Jack.
4618
4629
4619 2003-05-19 Fernando Perez <fperez@colorado.edu>
4630 2003-05-19 Fernando Perez <fperez@colorado.edu>
4620
4631
4621 * IPython/numutils.py: added a mockup of the kinds module, since
4632 * IPython/numutils.py: added a mockup of the kinds module, since
4622 it was recently removed from Numeric. This way, numutils will
4633 it was recently removed from Numeric. This way, numutils will
4623 work for all users even if they are missing kinds.
4634 work for all users even if they are missing kinds.
4624
4635
4625 * IPython/Magic.py (Magic._ofind): Harden against an inspect
4636 * IPython/Magic.py (Magic._ofind): Harden against an inspect
4626 failure, which can occur with SWIG-wrapped extensions. After a
4637 failure, which can occur with SWIG-wrapped extensions. After a
4627 crash report from Prabhu.
4638 crash report from Prabhu.
4628
4639
4629 2003-05-16 Fernando Perez <fperez@colorado.edu>
4640 2003-05-16 Fernando Perez <fperez@colorado.edu>
4630
4641
4631 * IPython/iplib.py (InteractiveShell.excepthook): New method to
4642 * IPython/iplib.py (InteractiveShell.excepthook): New method to
4632 protect ipython from user code which may call directly
4643 protect ipython from user code which may call directly
4633 sys.excepthook (this looks like an ipython crash to the user, even
4644 sys.excepthook (this looks like an ipython crash to the user, even
4634 when it isn't). After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
4645 when it isn't). After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
4635 This is especially important to help users of WxWindows, but may
4646 This is especially important to help users of WxWindows, but may
4636 also be useful in other cases.
4647 also be useful in other cases.
4637
4648
4638 * IPython/ultraTB.py (AutoFormattedTB.__call__): Changed to allow
4649 * IPython/ultraTB.py (AutoFormattedTB.__call__): Changed to allow
4639 an optional tb_offset to be specified, and to preserve exception
4650 an optional tb_offset to be specified, and to preserve exception
4640 info if given. After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
4651 info if given. After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
4641
4652
4642 * ipython.1 (Default): Thanks to Jack's work, we now have manpages!
4653 * ipython.1 (Default): Thanks to Jack's work, we now have manpages!
4643
4654
4644 2003-05-15 Fernando Perez <fperez@colorado.edu>
4655 2003-05-15 Fernando Perez <fperez@colorado.edu>
4645
4656
4646 * IPython/iplib.py (InteractiveShell.user_setup): Fix crash when
4657 * IPython/iplib.py (InteractiveShell.user_setup): Fix crash when
4647 installing for a new user under Windows.
4658 installing for a new user under Windows.
4648
4659
4649 2003-05-12 Fernando Perez <fperez@colorado.edu>
4660 2003-05-12 Fernando Perez <fperez@colorado.edu>
4650
4661
4651 * IPython/iplib.py (InteractiveShell.handle_emacs): New line
4662 * IPython/iplib.py (InteractiveShell.handle_emacs): New line
4652 handler for Emacs comint-based lines. Currently it doesn't do
4663 handler for Emacs comint-based lines. Currently it doesn't do
4653 much (but importantly, it doesn't update the history cache). In
4664 much (but importantly, it doesn't update the history cache). In
4654 the future it may be expanded if Alex needs more functionality
4665 the future it may be expanded if Alex needs more functionality
4655 there.
4666 there.
4656
4667
4657 * IPython/CrashHandler.py (CrashHandler.__call__): Added platform
4668 * IPython/CrashHandler.py (CrashHandler.__call__): Added platform
4658 info to crash reports.
4669 info to crash reports.
4659
4670
4660 * IPython/iplib.py (InteractiveShell.mainloop): Added -c option,
4671 * IPython/iplib.py (InteractiveShell.mainloop): Added -c option,
4661 just like Python's -c. Also fixed crash with invalid -color
4672 just like Python's -c. Also fixed crash with invalid -color
4662 option value at startup. Thanks to Will French
4673 option value at startup. Thanks to Will French
4663 <wfrench-AT-bestweb.net> for the bug report.
4674 <wfrench-AT-bestweb.net> for the bug report.
4664
4675
4665 2003-05-09 Fernando Perez <fperez@colorado.edu>
4676 2003-05-09 Fernando Perez <fperez@colorado.edu>
4666
4677
4667 * IPython/genutils.py (EvalDict.__getitem__): Renamed EvalString
4678 * IPython/genutils.py (EvalDict.__getitem__): Renamed EvalString
4668 to EvalDict (it's a mapping, after all) and simplified its code
4679 to EvalDict (it's a mapping, after all) and simplified its code
4669 quite a bit, after a nice discussion on c.l.py where Gustavo
4680 quite a bit, after a nice discussion on c.l.py where Gustavo
4670 CΓ³rdova <gcordova-AT-sismex.com> suggested the new version.
4681 CΓ³rdova <gcordova-AT-sismex.com> suggested the new version.
4671
4682
4672 2003-04-30 Fernando Perez <fperez@colorado.edu>
4683 2003-04-30 Fernando Perez <fperez@colorado.edu>
4673
4684
4674 * IPython/genutils.py (timings_out): modified it to reduce its
4685 * IPython/genutils.py (timings_out): modified it to reduce its
4675 overhead in the common reps==1 case.
4686 overhead in the common reps==1 case.
4676
4687
4677 2003-04-29 Fernando Perez <fperez@colorado.edu>
4688 2003-04-29 Fernando Perez <fperez@colorado.edu>
4678
4689
4679 * IPython/genutils.py (timings_out): Modified to use the resource
4690 * IPython/genutils.py (timings_out): Modified to use the resource
4680 module, which avoids the wraparound problems of time.clock().
4691 module, which avoids the wraparound problems of time.clock().
4681
4692
4682 2003-04-17 *** Released version 0.2.15pre4
4693 2003-04-17 *** Released version 0.2.15pre4
4683
4694
4684 2003-04-17 Fernando Perez <fperez@colorado.edu>
4695 2003-04-17 Fernando Perez <fperez@colorado.edu>
4685
4696
4686 * setup.py (scriptfiles): Split windows-specific stuff over to a
4697 * setup.py (scriptfiles): Split windows-specific stuff over to a
4687 separate file, in an attempt to have a Windows GUI installer.
4698 separate file, in an attempt to have a Windows GUI installer.
4688 That didn't work, but part of the groundwork is done.
4699 That didn't work, but part of the groundwork is done.
4689
4700
4690 * IPython/UserConfig/ipythonrc: Added M-i, M-o and M-I for
4701 * IPython/UserConfig/ipythonrc: Added M-i, M-o and M-I for
4691 indent/unindent with 4 spaces. Particularly useful in combination
4702 indent/unindent with 4 spaces. Particularly useful in combination
4692 with the new auto-indent option.
4703 with the new auto-indent option.
4693
4704
4694 2003-04-16 Fernando Perez <fperez@colorado.edu>
4705 2003-04-16 Fernando Perez <fperez@colorado.edu>
4695
4706
4696 * IPython/Magic.py: various replacements of self.rc for
4707 * IPython/Magic.py: various replacements of self.rc for
4697 self.shell.rc. A lot more remains to be done to fully disentangle
4708 self.shell.rc. A lot more remains to be done to fully disentangle
4698 this class from the main Shell class.
4709 this class from the main Shell class.
4699
4710
4700 * IPython/GnuplotRuntime.py: added checks for mouse support so
4711 * IPython/GnuplotRuntime.py: added checks for mouse support so
4701 that we don't try to enable it if the current gnuplot doesn't
4712 that we don't try to enable it if the current gnuplot doesn't
4702 really support it. Also added checks so that we don't try to
4713 really support it. Also added checks so that we don't try to
4703 enable persist under Windows (where Gnuplot doesn't recognize the
4714 enable persist under Windows (where Gnuplot doesn't recognize the
4704 option).
4715 option).
4705
4716
4706 * IPython/iplib.py (InteractiveShell.interact): Added optional
4717 * IPython/iplib.py (InteractiveShell.interact): Added optional
4707 auto-indenting code, after a patch by King C. Shu
4718 auto-indenting code, after a patch by King C. Shu
4708 <kingshu-AT-myrealbox.com>. It's off by default because it doesn't
4719 <kingshu-AT-myrealbox.com>. It's off by default because it doesn't
4709 get along well with pasting indented code. If I ever figure out
4720 get along well with pasting indented code. If I ever figure out
4710 how to make that part go well, it will become on by default.
4721 how to make that part go well, it will become on by default.
4711
4722
4712 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixed bug which would
4723 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixed bug which would
4713 crash ipython if there was an unmatched '%' in the user's prompt
4724 crash ipython if there was an unmatched '%' in the user's prompt
4714 string. Reported by Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
4725 string. Reported by Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
4715
4726
4716 * IPython/iplib.py (InteractiveShell.interact): removed the
4727 * IPython/iplib.py (InteractiveShell.interact): removed the
4717 ability to ask the user whether he wants to crash or not at the
4728 ability to ask the user whether he wants to crash or not at the
4718 'last line' exception handler. Calling functions at that point
4729 'last line' exception handler. Calling functions at that point
4719 changes the stack, and the error reports would have incorrect
4730 changes the stack, and the error reports would have incorrect
4720 tracebacks.
4731 tracebacks.
4721
4732
4722 * IPython/Magic.py (Magic.magic_page): Added new @page magic, to
4733 * IPython/Magic.py (Magic.magic_page): Added new @page magic, to
4723 pass through a peger a pretty-printed form of any object. After a
4734 pass through a peger a pretty-printed form of any object. After a
4724 contribution by Olivier Aubert <oaubert-AT-bat710.univ-lyon1.fr>
4735 contribution by Olivier Aubert <oaubert-AT-bat710.univ-lyon1.fr>
4725
4736
4726 2003-04-14 Fernando Perez <fperez@colorado.edu>
4737 2003-04-14 Fernando Perez <fperez@colorado.edu>
4727
4738
4728 * IPython/iplib.py (InteractiveShell.user_setup): Fixed bug where
4739 * IPython/iplib.py (InteractiveShell.user_setup): Fixed bug where
4729 all files in ~ would be modified at first install (instead of
4740 all files in ~ would be modified at first install (instead of
4730 ~/.ipython). This could be potentially disastrous, as the
4741 ~/.ipython). This could be potentially disastrous, as the
4731 modification (make line-endings native) could damage binary files.
4742 modification (make line-endings native) could damage binary files.
4732
4743
4733 2003-04-10 Fernando Perez <fperez@colorado.edu>
4744 2003-04-10 Fernando Perez <fperez@colorado.edu>
4734
4745
4735 * IPython/iplib.py (InteractiveShell.handle_help): Modified to
4746 * IPython/iplib.py (InteractiveShell.handle_help): Modified to
4736 handle only lines which are invalid python. This now means that
4747 handle only lines which are invalid python. This now means that
4737 lines like 'x=1 #?' execute properly. Thanks to Jeffery Collins
4748 lines like 'x=1 #?' execute properly. Thanks to Jeffery Collins
4738 for the bug report.
4749 for the bug report.
4739
4750
4740 2003-04-01 Fernando Perez <fperez@colorado.edu>
4751 2003-04-01 Fernando Perez <fperez@colorado.edu>
4741
4752
4742 * IPython/iplib.py (InteractiveShell.showtraceback): Fixed bug
4753 * IPython/iplib.py (InteractiveShell.showtraceback): Fixed bug
4743 where failing to set sys.last_traceback would crash pdb.pm().
4754 where failing to set sys.last_traceback would crash pdb.pm().
4744 Thanks to Jeffery D. Collins <Jeff.Collins-AT-vexcel.com> for the bug
4755 Thanks to Jeffery D. Collins <Jeff.Collins-AT-vexcel.com> for the bug
4745 report.
4756 report.
4746
4757
4747 2003-03-25 Fernando Perez <fperez@colorado.edu>
4758 2003-03-25 Fernando Perez <fperez@colorado.edu>
4748
4759
4749 * IPython/Magic.py (Magic.magic_prun): rstrip() output of profiler
4760 * IPython/Magic.py (Magic.magic_prun): rstrip() output of profiler
4750 before printing it (it had a lot of spurious blank lines at the
4761 before printing it (it had a lot of spurious blank lines at the
4751 end).
4762 end).
4752
4763
4753 * IPython/Gnuplot2.py (Gnuplot.hardcopy): fixed bug where lpr
4764 * IPython/Gnuplot2.py (Gnuplot.hardcopy): fixed bug where lpr
4754 output would be sent 21 times! Obviously people don't use this
4765 output would be sent 21 times! Obviously people don't use this
4755 too often, or I would have heard about it.
4766 too often, or I would have heard about it.
4756
4767
4757 2003-03-24 Fernando Perez <fperez@colorado.edu>
4768 2003-03-24 Fernando Perez <fperez@colorado.edu>
4758
4769
4759 * setup.py (scriptfiles): renamed the data_files parameter from
4770 * setup.py (scriptfiles): renamed the data_files parameter from
4760 'base' to 'data' to fix rpm build issues. Thanks to Ralf Ahlbrink
4771 'base' to 'data' to fix rpm build issues. Thanks to Ralf Ahlbrink
4761 for the patch.
4772 for the patch.
4762
4773
4763 2003-03-20 Fernando Perez <fperez@colorado.edu>
4774 2003-03-20 Fernando Perez <fperez@colorado.edu>
4764
4775
4765 * IPython/genutils.py (error): added error() and fatal()
4776 * IPython/genutils.py (error): added error() and fatal()
4766 functions.
4777 functions.
4767
4778
4768 2003-03-18 *** Released version 0.2.15pre3
4779 2003-03-18 *** Released version 0.2.15pre3
4769
4780
4770 2003-03-18 Fernando Perez <fperez@colorado.edu>
4781 2003-03-18 Fernando Perez <fperez@colorado.edu>
4771
4782
4772 * setupext/install_data_ext.py
4783 * setupext/install_data_ext.py
4773 (install_data_ext.initialize_options): Class contributed by Jack
4784 (install_data_ext.initialize_options): Class contributed by Jack
4774 Moffit for fixing the old distutils hack. He is sending this to
4785 Moffit for fixing the old distutils hack. He is sending this to
4775 the distutils folks so in the future we may not need it as a
4786 the distutils folks so in the future we may not need it as a
4776 private fix.
4787 private fix.
4777
4788
4778 * MANIFEST.in: Extensive reorganization, based on Jack Moffit's
4789 * MANIFEST.in: Extensive reorganization, based on Jack Moffit's
4779 changes for Debian packaging. See his patch for full details.
4790 changes for Debian packaging. See his patch for full details.
4780 The old distutils hack of making the ipythonrc* files carry a
4791 The old distutils hack of making the ipythonrc* files carry a
4781 bogus .py extension is gone, at last. Examples were moved to a
4792 bogus .py extension is gone, at last. Examples were moved to a
4782 separate subdir under doc/, and the separate executable scripts
4793 separate subdir under doc/, and the separate executable scripts
4783 now live in their own directory. Overall a great cleanup. The
4794 now live in their own directory. Overall a great cleanup. The
4784 manual was updated to use the new files, and setup.py has been
4795 manual was updated to use the new files, and setup.py has been
4785 fixed for this setup.
4796 fixed for this setup.
4786
4797
4787 * IPython/PyColorize.py (Parser.usage): made non-executable and
4798 * IPython/PyColorize.py (Parser.usage): made non-executable and
4788 created a pycolor wrapper around it to be included as a script.
4799 created a pycolor wrapper around it to be included as a script.
4789
4800
4790 2003-03-12 *** Released version 0.2.15pre2
4801 2003-03-12 *** Released version 0.2.15pre2
4791
4802
4792 2003-03-12 Fernando Perez <fperez@colorado.edu>
4803 2003-03-12 Fernando Perez <fperez@colorado.edu>
4793
4804
4794 * IPython/ColorANSI.py (make_color_table): Finally fixed the
4805 * IPython/ColorANSI.py (make_color_table): Finally fixed the
4795 long-standing problem with garbage characters in some terminals.
4806 long-standing problem with garbage characters in some terminals.
4796 The issue was really that the \001 and \002 escapes must _only_ be
4807 The issue was really that the \001 and \002 escapes must _only_ be
4797 passed to input prompts (which call readline), but _never_ to
4808 passed to input prompts (which call readline), but _never_ to
4798 normal text to be printed on screen. I changed ColorANSI to have
4809 normal text to be printed on screen. I changed ColorANSI to have
4799 two classes: TermColors and InputTermColors, each with the
4810 two classes: TermColors and InputTermColors, each with the
4800 appropriate escapes for input prompts or normal text. The code in
4811 appropriate escapes for input prompts or normal text. The code in
4801 Prompts.py got slightly more complicated, but this very old and
4812 Prompts.py got slightly more complicated, but this very old and
4802 annoying bug is finally fixed.
4813 annoying bug is finally fixed.
4803
4814
4804 All the credit for nailing down the real origin of this problem
4815 All the credit for nailing down the real origin of this problem
4805 and the correct solution goes to Jack Moffit <jack-AT-xiph.org>.
4816 and the correct solution goes to Jack Moffit <jack-AT-xiph.org>.
4806 *Many* thanks to him for spending quite a bit of effort on this.
4817 *Many* thanks to him for spending quite a bit of effort on this.
4807
4818
4808 2003-03-05 *** Released version 0.2.15pre1
4819 2003-03-05 *** Released version 0.2.15pre1
4809
4820
4810 2003-03-03 Fernando Perez <fperez@colorado.edu>
4821 2003-03-03 Fernando Perez <fperez@colorado.edu>
4811
4822
4812 * IPython/FakeModule.py: Moved the former _FakeModule to a
4823 * IPython/FakeModule.py: Moved the former _FakeModule to a
4813 separate file, because it's also needed by Magic (to fix a similar
4824 separate file, because it's also needed by Magic (to fix a similar
4814 pickle-related issue in @run).
4825 pickle-related issue in @run).
4815
4826
4816 2003-03-02 Fernando Perez <fperez@colorado.edu>
4827 2003-03-02 Fernando Perez <fperez@colorado.edu>
4817
4828
4818 * IPython/Magic.py (Magic.magic_autocall): new magic to control
4829 * IPython/Magic.py (Magic.magic_autocall): new magic to control
4819 the autocall option at runtime.
4830 the autocall option at runtime.
4820 (Magic.magic_dhist): changed self.user_ns to self.shell.user_ns
4831 (Magic.magic_dhist): changed self.user_ns to self.shell.user_ns
4821 across Magic.py to start separating Magic from InteractiveShell.
4832 across Magic.py to start separating Magic from InteractiveShell.
4822 (Magic._ofind): Fixed to return proper namespace for dotted
4833 (Magic._ofind): Fixed to return proper namespace for dotted
4823 names. Before, a dotted name would always return 'not currently
4834 names. Before, a dotted name would always return 'not currently
4824 defined', because it would find the 'parent'. s.x would be found,
4835 defined', because it would find the 'parent'. s.x would be found,
4825 but since 'x' isn't defined by itself, it would get confused.
4836 but since 'x' isn't defined by itself, it would get confused.
4826 (Magic.magic_run): Fixed pickling problems reported by Ralf
4837 (Magic.magic_run): Fixed pickling problems reported by Ralf
4827 Ahlbrink <RAhlbrink-AT-RosenInspection.net>. The fix was similar to
4838 Ahlbrink <RAhlbrink-AT-RosenInspection.net>. The fix was similar to
4828 that I'd used when Mike Heeter reported similar issues at the
4839 that I'd used when Mike Heeter reported similar issues at the
4829 top-level, but now for @run. It boils down to injecting the
4840 top-level, but now for @run. It boils down to injecting the
4830 namespace where code is being executed with something that looks
4841 namespace where code is being executed with something that looks
4831 enough like a module to fool pickle.dump(). Since a pickle stores
4842 enough like a module to fool pickle.dump(). Since a pickle stores
4832 a named reference to the importing module, we need this for
4843 a named reference to the importing module, we need this for
4833 pickles to save something sensible.
4844 pickles to save something sensible.
4834
4845
4835 * IPython/ipmaker.py (make_IPython): added an autocall option.
4846 * IPython/ipmaker.py (make_IPython): added an autocall option.
4836
4847
4837 * IPython/iplib.py (InteractiveShell._prefilter): reordered all of
4848 * IPython/iplib.py (InteractiveShell._prefilter): reordered all of
4838 the auto-eval code. Now autocalling is an option, and the code is
4849 the auto-eval code. Now autocalling is an option, and the code is
4839 also vastly safer. There is no more eval() involved at all.
4850 also vastly safer. There is no more eval() involved at all.
4840
4851
4841 2003-03-01 Fernando Perez <fperez@colorado.edu>
4852 2003-03-01 Fernando Perez <fperez@colorado.edu>
4842
4853
4843 * IPython/Magic.py (Magic._ofind): Changed interface to return a
4854 * IPython/Magic.py (Magic._ofind): Changed interface to return a
4844 dict with named keys instead of a tuple.
4855 dict with named keys instead of a tuple.
4845
4856
4846 * IPython: Started using CVS for IPython as of 0.2.15pre1.
4857 * IPython: Started using CVS for IPython as of 0.2.15pre1.
4847
4858
4848 * setup.py (make_shortcut): Fixed message about directories
4859 * setup.py (make_shortcut): Fixed message about directories
4849 created during Windows installation (the directories were ok, just
4860 created during Windows installation (the directories were ok, just
4850 the printed message was misleading). Thanks to Chris Liechti
4861 the printed message was misleading). Thanks to Chris Liechti
4851 <cliechti-AT-gmx.net> for the heads up.
4862 <cliechti-AT-gmx.net> for the heads up.
4852
4863
4853 2003-02-21 Fernando Perez <fperez@colorado.edu>
4864 2003-02-21 Fernando Perez <fperez@colorado.edu>
4854
4865
4855 * IPython/iplib.py (InteractiveShell._prefilter): Fixed catching
4866 * IPython/iplib.py (InteractiveShell._prefilter): Fixed catching
4856 of ValueError exception when checking for auto-execution. This
4867 of ValueError exception when checking for auto-execution. This
4857 one is raised by things like Numeric arrays arr.flat when the
4868 one is raised by things like Numeric arrays arr.flat when the
4858 array is non-contiguous.
4869 array is non-contiguous.
4859
4870
4860 2003-01-31 Fernando Perez <fperez@colorado.edu>
4871 2003-01-31 Fernando Perez <fperez@colorado.edu>
4861
4872
4862 * IPython/genutils.py (SystemExec.bq): Fixed bug where bq would
4873 * IPython/genutils.py (SystemExec.bq): Fixed bug where bq would
4863 not return any value at all (even though the command would get
4874 not return any value at all (even though the command would get
4864 executed).
4875 executed).
4865 (xsys): Flush stdout right after printing the command to ensure
4876 (xsys): Flush stdout right after printing the command to ensure
4866 proper ordering of commands and command output in the total
4877 proper ordering of commands and command output in the total
4867 output.
4878 output.
4868 (SystemExec/xsys/bq): Switched the names of xsys/bq and
4879 (SystemExec/xsys/bq): Switched the names of xsys/bq and
4869 system/getoutput as defaults. The old ones are kept for
4880 system/getoutput as defaults. The old ones are kept for
4870 compatibility reasons, so no code which uses this library needs
4881 compatibility reasons, so no code which uses this library needs
4871 changing.
4882 changing.
4872
4883
4873 2003-01-27 *** Released version 0.2.14
4884 2003-01-27 *** Released version 0.2.14
4874
4885
4875 2003-01-25 Fernando Perez <fperez@colorado.edu>
4886 2003-01-25 Fernando Perez <fperez@colorado.edu>
4876
4887
4877 * IPython/Magic.py (Magic.magic_edit): Fixed problem where
4888 * IPython/Magic.py (Magic.magic_edit): Fixed problem where
4878 functions defined in previous edit sessions could not be re-edited
4889 functions defined in previous edit sessions could not be re-edited
4879 (because the temp files were immediately removed). Now temp files
4890 (because the temp files were immediately removed). Now temp files
4880 are removed only at IPython's exit.
4891 are removed only at IPython's exit.
4881 (Magic.magic_run): Improved @run to perform shell-like expansions
4892 (Magic.magic_run): Improved @run to perform shell-like expansions
4882 on its arguments (~users and $VARS). With this, @run becomes more
4893 on its arguments (~users and $VARS). With this, @run becomes more
4883 like a normal command-line.
4894 like a normal command-line.
4884
4895
4885 * IPython/Shell.py (IPShellEmbed.__call__): Fixed a bunch of small
4896 * IPython/Shell.py (IPShellEmbed.__call__): Fixed a bunch of small
4886 bugs related to embedding and cleaned up that code. A fairly
4897 bugs related to embedding and cleaned up that code. A fairly
4887 important one was the impossibility to access the global namespace
4898 important one was the impossibility to access the global namespace
4888 through the embedded IPython (only local variables were visible).
4899 through the embedded IPython (only local variables were visible).
4889
4900
4890 2003-01-14 Fernando Perez <fperez@colorado.edu>
4901 2003-01-14 Fernando Perez <fperez@colorado.edu>
4891
4902
4892 * IPython/iplib.py (InteractiveShell._prefilter): Fixed
4903 * IPython/iplib.py (InteractiveShell._prefilter): Fixed
4893 auto-calling to be a bit more conservative. Now it doesn't get
4904 auto-calling to be a bit more conservative. Now it doesn't get
4894 triggered if any of '!=()<>' are in the rest of the input line, to
4905 triggered if any of '!=()<>' are in the rest of the input line, to
4895 allow comparing callables. Thanks to Alex for the heads up.
4906 allow comparing callables. Thanks to Alex for the heads up.
4896
4907
4897 2003-01-07 Fernando Perez <fperez@colorado.edu>
4908 2003-01-07 Fernando Perez <fperez@colorado.edu>
4898
4909
4899 * IPython/genutils.py (page): fixed estimation of the number of
4910 * IPython/genutils.py (page): fixed estimation of the number of
4900 lines in a string to be paged to simply count newlines. This
4911 lines in a string to be paged to simply count newlines. This
4901 prevents over-guessing due to embedded escape sequences. A better
4912 prevents over-guessing due to embedded escape sequences. A better
4902 long-term solution would involve stripping out the control chars
4913 long-term solution would involve stripping out the control chars
4903 for the count, but it's potentially so expensive I just don't
4914 for the count, but it's potentially so expensive I just don't
4904 think it's worth doing.
4915 think it's worth doing.
4905
4916
4906 2002-12-19 *** Released version 0.2.14pre50
4917 2002-12-19 *** Released version 0.2.14pre50
4907
4918
4908 2002-12-19 Fernando Perez <fperez@colorado.edu>
4919 2002-12-19 Fernando Perez <fperez@colorado.edu>
4909
4920
4910 * tools/release (version): Changed release scripts to inform
4921 * tools/release (version): Changed release scripts to inform
4911 Andrea and build a NEWS file with a list of recent changes.
4922 Andrea and build a NEWS file with a list of recent changes.
4912
4923
4913 * IPython/ColorANSI.py (__all__): changed terminal detection
4924 * IPython/ColorANSI.py (__all__): changed terminal detection
4914 code. Seems to work better for xterms without breaking
4925 code. Seems to work better for xterms without breaking
4915 konsole. Will need more testing to determine if WinXP and Mac OSX
4926 konsole. Will need more testing to determine if WinXP and Mac OSX
4916 also work ok.
4927 also work ok.
4917
4928
4918 2002-12-18 *** Released version 0.2.14pre49
4929 2002-12-18 *** Released version 0.2.14pre49
4919
4930
4920 2002-12-18 Fernando Perez <fperez@colorado.edu>
4931 2002-12-18 Fernando Perez <fperez@colorado.edu>
4921
4932
4922 * Docs: added new info about Mac OSX, from Andrea.
4933 * Docs: added new info about Mac OSX, from Andrea.
4923
4934
4924 * IPython/Gnuplot2.py (String): Added a String PlotItem class to
4935 * IPython/Gnuplot2.py (String): Added a String PlotItem class to
4925 allow direct plotting of python strings whose format is the same
4936 allow direct plotting of python strings whose format is the same
4926 of gnuplot data files.
4937 of gnuplot data files.
4927
4938
4928 2002-12-16 Fernando Perez <fperez@colorado.edu>
4939 2002-12-16 Fernando Perez <fperez@colorado.edu>
4929
4940
4930 * IPython/iplib.py (InteractiveShell.interact): fixed default (y)
4941 * IPython/iplib.py (InteractiveShell.interact): fixed default (y)
4931 value of exit question to be acknowledged.
4942 value of exit question to be acknowledged.
4932
4943
4933 2002-12-03 Fernando Perez <fperez@colorado.edu>
4944 2002-12-03 Fernando Perez <fperez@colorado.edu>
4934
4945
4935 * IPython/ipmaker.py: removed generators, which had been added
4946 * IPython/ipmaker.py: removed generators, which had been added
4936 by mistake in an earlier debugging run. This was causing trouble
4947 by mistake in an earlier debugging run. This was causing trouble
4937 to users of python 2.1.x. Thanks to Abel Daniel <abli-AT-freemail.hu>
4948 to users of python 2.1.x. Thanks to Abel Daniel <abli-AT-freemail.hu>
4938 for pointing this out.
4949 for pointing this out.
4939
4950
4940 2002-11-17 Fernando Perez <fperez@colorado.edu>
4951 2002-11-17 Fernando Perez <fperez@colorado.edu>
4941
4952
4942 * Manual: updated the Gnuplot section.
4953 * Manual: updated the Gnuplot section.
4943
4954
4944 * IPython/GnuplotRuntime.py: refactored a lot all this code, with
4955 * IPython/GnuplotRuntime.py: refactored a lot all this code, with
4945 a much better split of what goes in Runtime and what goes in
4956 a much better split of what goes in Runtime and what goes in
4946 Interactive.
4957 Interactive.
4947
4958
4948 * IPython/ipmaker.py: fixed bug where import_fail_info wasn't
4959 * IPython/ipmaker.py: fixed bug where import_fail_info wasn't
4949 being imported from iplib.
4960 being imported from iplib.
4950
4961
4951 * IPython/GnuplotInteractive.py (magic_gpc): renamed @gp to @gpc
4962 * IPython/GnuplotInteractive.py (magic_gpc): renamed @gp to @gpc
4952 for command-passing. Now the global Gnuplot instance is called
4963 for command-passing. Now the global Gnuplot instance is called
4953 'gp' instead of 'g', which was really a far too fragile and
4964 'gp' instead of 'g', which was really a far too fragile and
4954 common name.
4965 common name.
4955
4966
4956 * IPython/Gnuplot2.py (eps_fix_bbox): added this to fix broken
4967 * IPython/Gnuplot2.py (eps_fix_bbox): added this to fix broken
4957 bounding boxes generated by Gnuplot for square plots.
4968 bounding boxes generated by Gnuplot for square plots.
4958
4969
4959 * IPython/genutils.py (popkey): new function added. I should
4970 * IPython/genutils.py (popkey): new function added. I should
4960 suggest this on c.l.py as a dict method, it seems useful.
4971 suggest this on c.l.py as a dict method, it seems useful.
4961
4972
4962 * IPython/Gnuplot2.py (Gnuplot.plot): Overhauled plot and replot
4973 * IPython/Gnuplot2.py (Gnuplot.plot): Overhauled plot and replot
4963 to transparently handle PostScript generation. MUCH better than
4974 to transparently handle PostScript generation. MUCH better than
4964 the previous plot_eps/replot_eps (which I removed now). The code
4975 the previous plot_eps/replot_eps (which I removed now). The code
4965 is also fairly clean and well documented now (including
4976 is also fairly clean and well documented now (including
4966 docstrings).
4977 docstrings).
4967
4978
4968 2002-11-13 Fernando Perez <fperez@colorado.edu>
4979 2002-11-13 Fernando Perez <fperez@colorado.edu>
4969
4980
4970 * IPython/Magic.py (Magic.magic_edit): fixed docstring
4981 * IPython/Magic.py (Magic.magic_edit): fixed docstring
4971 (inconsistent with options).
4982 (inconsistent with options).
4972
4983
4973 * IPython/Gnuplot2.py (Gnuplot.hardcopy): hardcopy had been
4984 * IPython/Gnuplot2.py (Gnuplot.hardcopy): hardcopy had been
4974 manually disabled, I don't know why. Fixed it.
4985 manually disabled, I don't know why. Fixed it.
4975 (Gnuplot._plot_eps): added new plot_eps/replot_eps to get directly
4986 (Gnuplot._plot_eps): added new plot_eps/replot_eps to get directly
4976 eps output.
4987 eps output.
4977
4988
4978 2002-11-12 Fernando Perez <fperez@colorado.edu>
4989 2002-11-12 Fernando Perez <fperez@colorado.edu>
4979
4990
4980 * IPython/genutils.py (ask_yes_no): trap EOF and ^C so that they
4991 * IPython/genutils.py (ask_yes_no): trap EOF and ^C so that they
4981 don't propagate up to caller. Fixes crash reported by François
4992 don't propagate up to caller. Fixes crash reported by François
4982 Pinard.
4993 Pinard.
4983
4994
4984 2002-11-09 Fernando Perez <fperez@colorado.edu>
4995 2002-11-09 Fernando Perez <fperez@colorado.edu>
4985
4996
4986 * IPython/ipmaker.py (make_IPython): fixed problem with writing
4997 * IPython/ipmaker.py (make_IPython): fixed problem with writing
4987 history file for new users.
4998 history file for new users.
4988 (make_IPython): fixed bug where initial install would leave the
4999 (make_IPython): fixed bug where initial install would leave the
4989 user running in the .ipython dir.
5000 user running in the .ipython dir.
4990 (make_IPython): fixed bug where config dir .ipython would be
5001 (make_IPython): fixed bug where config dir .ipython would be
4991 created regardless of the given -ipythondir option. Thanks to Cory
5002 created regardless of the given -ipythondir option. Thanks to Cory
4992 Dodt <cdodt-AT-fcoe.k12.ca.us> for the bug report.
5003 Dodt <cdodt-AT-fcoe.k12.ca.us> for the bug report.
4993
5004
4994 * IPython/genutils.py (ask_yes_no): new function for asking yes/no
5005 * IPython/genutils.py (ask_yes_no): new function for asking yes/no
4995 type confirmations. Will need to use it in all of IPython's code
5006 type confirmations. Will need to use it in all of IPython's code
4996 consistently.
5007 consistently.
4997
5008
4998 * IPython/CrashHandler.py (CrashHandler.__call__): changed the
5009 * IPython/CrashHandler.py (CrashHandler.__call__): changed the
4999 context to print 31 lines instead of the default 5. This will make
5010 context to print 31 lines instead of the default 5. This will make
5000 the crash reports extremely detailed in case the problem is in
5011 the crash reports extremely detailed in case the problem is in
5001 libraries I don't have access to.
5012 libraries I don't have access to.
5002
5013
5003 * IPython/iplib.py (InteractiveShell.interact): changed the 'last
5014 * IPython/iplib.py (InteractiveShell.interact): changed the 'last
5004 line of defense' code to still crash, but giving users fair
5015 line of defense' code to still crash, but giving users fair
5005 warning. I don't want internal errors to go unreported: if there's
5016 warning. I don't want internal errors to go unreported: if there's
5006 an internal problem, IPython should crash and generate a full
5017 an internal problem, IPython should crash and generate a full
5007 report.
5018 report.
5008
5019
5009 2002-11-08 Fernando Perez <fperez@colorado.edu>
5020 2002-11-08 Fernando Perez <fperez@colorado.edu>
5010
5021
5011 * IPython/iplib.py (InteractiveShell.interact): added code to trap
5022 * IPython/iplib.py (InteractiveShell.interact): added code to trap
5012 otherwise uncaught exceptions which can appear if people set
5023 otherwise uncaught exceptions which can appear if people set
5013 sys.stdout to something badly broken. Thanks to a crash report
5024 sys.stdout to something badly broken. Thanks to a crash report
5014 from henni-AT-mail.brainbot.com.
5025 from henni-AT-mail.brainbot.com.
5015
5026
5016 2002-11-04 Fernando Perez <fperez@colorado.edu>
5027 2002-11-04 Fernando Perez <fperez@colorado.edu>
5017
5028
5018 * IPython/iplib.py (InteractiveShell.interact): added
5029 * IPython/iplib.py (InteractiveShell.interact): added
5019 __IPYTHON__active to the builtins. It's a flag which goes on when
5030 __IPYTHON__active to the builtins. It's a flag which goes on when
5020 the interaction starts and goes off again when it stops. This
5031 the interaction starts and goes off again when it stops. This
5021 allows embedding code to detect being inside IPython. Before this
5032 allows embedding code to detect being inside IPython. Before this
5022 was done via __IPYTHON__, but that only shows that an IPython
5033 was done via __IPYTHON__, but that only shows that an IPython
5023 instance has been created.
5034 instance has been created.
5024
5035
5025 * IPython/Magic.py (Magic.magic_env): I realized that in a
5036 * IPython/Magic.py (Magic.magic_env): I realized that in a
5026 UserDict, instance.data holds the data as a normal dict. So I
5037 UserDict, instance.data holds the data as a normal dict. So I
5027 modified @env to return os.environ.data instead of rebuilding a
5038 modified @env to return os.environ.data instead of rebuilding a
5028 dict by hand.
5039 dict by hand.
5029
5040
5030 2002-11-02 Fernando Perez <fperez@colorado.edu>
5041 2002-11-02 Fernando Perez <fperez@colorado.edu>
5031
5042
5032 * IPython/genutils.py (warn): changed so that level 1 prints no
5043 * IPython/genutils.py (warn): changed so that level 1 prints no
5033 header. Level 2 is now the default (with 'WARNING' header, as
5044 header. Level 2 is now the default (with 'WARNING' header, as
5034 before). I think I tracked all places where changes were needed in
5045 before). I think I tracked all places where changes were needed in
5035 IPython, but outside code using the old level numbering may have
5046 IPython, but outside code using the old level numbering may have
5036 broken.
5047 broken.
5037
5048
5038 * IPython/iplib.py (InteractiveShell.runcode): added this to
5049 * IPython/iplib.py (InteractiveShell.runcode): added this to
5039 handle the tracebacks in SystemExit traps correctly. The previous
5050 handle the tracebacks in SystemExit traps correctly. The previous
5040 code (through interact) was printing more of the stack than
5051 code (through interact) was printing more of the stack than
5041 necessary, showing IPython internal code to the user.
5052 necessary, showing IPython internal code to the user.
5042
5053
5043 * IPython/UserConfig/ipythonrc.py: Made confirm_exit 1 by
5054 * IPython/UserConfig/ipythonrc.py: Made confirm_exit 1 by
5044 default. Now that the default at the confirmation prompt is yes,
5055 default. Now that the default at the confirmation prompt is yes,
5045 it's not so intrusive. François' argument that ipython sessions
5056 it's not so intrusive. François' argument that ipython sessions
5046 tend to be complex enough not to lose them from an accidental C-d,
5057 tend to be complex enough not to lose them from an accidental C-d,
5047 is a valid one.
5058 is a valid one.
5048
5059
5049 * IPython/iplib.py (InteractiveShell.interact): added a
5060 * IPython/iplib.py (InteractiveShell.interact): added a
5050 showtraceback() call to the SystemExit trap, and modified the exit
5061 showtraceback() call to the SystemExit trap, and modified the exit
5051 confirmation to have yes as the default.
5062 confirmation to have yes as the default.
5052
5063
5053 * IPython/UserConfig/ipythonrc.py: removed 'session' option from
5064 * IPython/UserConfig/ipythonrc.py: removed 'session' option from
5054 this file. It's been gone from the code for a long time, this was
5065 this file. It's been gone from the code for a long time, this was
5055 simply leftover junk.
5066 simply leftover junk.
5056
5067
5057 2002-11-01 Fernando Perez <fperez@colorado.edu>
5068 2002-11-01 Fernando Perez <fperez@colorado.edu>
5058
5069
5059 * IPython/UserConfig/ipythonrc.py: new confirm_exit option
5070 * IPython/UserConfig/ipythonrc.py: new confirm_exit option
5060 added. If set, IPython now traps EOF and asks for
5071 added. If set, IPython now traps EOF and asks for
5061 confirmation. After a request by François Pinard.
5072 confirmation. After a request by François Pinard.
5062
5073
5063 * IPython/Magic.py (Magic.magic_Exit): New @Exit and @Quit instead
5074 * IPython/Magic.py (Magic.magic_Exit): New @Exit and @Quit instead
5064 of @abort, and with a new (better) mechanism for handling the
5075 of @abort, and with a new (better) mechanism for handling the
5065 exceptions.
5076 exceptions.
5066
5077
5067 2002-10-27 Fernando Perez <fperez@colorado.edu>
5078 2002-10-27 Fernando Perez <fperez@colorado.edu>
5068
5079
5069 * IPython/usage.py (__doc__): updated the --help information and
5080 * IPython/usage.py (__doc__): updated the --help information and
5070 the ipythonrc file to indicate that -log generates
5081 the ipythonrc file to indicate that -log generates
5071 ./ipython.log. Also fixed the corresponding info in @logstart.
5082 ./ipython.log. Also fixed the corresponding info in @logstart.
5072 This and several other fixes in the manuals thanks to reports by
5083 This and several other fixes in the manuals thanks to reports by
5073 François Pinard <pinard-AT-iro.umontreal.ca>.
5084 François Pinard <pinard-AT-iro.umontreal.ca>.
5074
5085
5075 * IPython/Logger.py (Logger.switch_log): Fixed error message to
5086 * IPython/Logger.py (Logger.switch_log): Fixed error message to
5076 refer to @logstart (instead of @log, which doesn't exist).
5087 refer to @logstart (instead of @log, which doesn't exist).
5077
5088
5078 * IPython/iplib.py (InteractiveShell._prefilter): fixed
5089 * IPython/iplib.py (InteractiveShell._prefilter): fixed
5079 AttributeError crash. Thanks to Christopher Armstrong
5090 AttributeError crash. Thanks to Christopher Armstrong
5080 <radix-AT-twistedmatrix.com> for the report/fix. This bug had been
5091 <radix-AT-twistedmatrix.com> for the report/fix. This bug had been
5081 introduced recently (in 0.2.14pre37) with the fix to the eval
5092 introduced recently (in 0.2.14pre37) with the fix to the eval
5082 problem mentioned below.
5093 problem mentioned below.
5083
5094
5084 2002-10-17 Fernando Perez <fperez@colorado.edu>
5095 2002-10-17 Fernando Perez <fperez@colorado.edu>
5085
5096
5086 * IPython/ConfigLoader.py (ConfigLoader.load): Fixes for Windows
5097 * IPython/ConfigLoader.py (ConfigLoader.load): Fixes for Windows
5087 installation. Thanks to Leonardo Santagada <retype-AT-terra.com.br>.
5098 installation. Thanks to Leonardo Santagada <retype-AT-terra.com.br>.
5088
5099
5089 * IPython/iplib.py (InteractiveShell._prefilter): Many changes to
5100 * IPython/iplib.py (InteractiveShell._prefilter): Many changes to
5090 this function to fix a problem reported by Alex Schmolck. He saw
5101 this function to fix a problem reported by Alex Schmolck. He saw
5091 it with list comprehensions and generators, which were getting
5102 it with list comprehensions and generators, which were getting
5092 called twice. The real problem was an 'eval' call in testing for
5103 called twice. The real problem was an 'eval' call in testing for
5093 automagic which was evaluating the input line silently.
5104 automagic which was evaluating the input line silently.
5094
5105
5095 This is a potentially very nasty bug, if the input has side
5106 This is a potentially very nasty bug, if the input has side
5096 effects which must not be repeated. The code is much cleaner now,
5107 effects which must not be repeated. The code is much cleaner now,
5097 without any blanket 'except' left and with a regexp test for
5108 without any blanket 'except' left and with a regexp test for
5098 actual function names.
5109 actual function names.
5099
5110
5100 But an eval remains, which I'm not fully comfortable with. I just
5111 But an eval remains, which I'm not fully comfortable with. I just
5101 don't know how to find out if an expression could be a callable in
5112 don't know how to find out if an expression could be a callable in
5102 the user's namespace without doing an eval on the string. However
5113 the user's namespace without doing an eval on the string. However
5103 that string is now much more strictly checked so that no code
5114 that string is now much more strictly checked so that no code
5104 slips by, so the eval should only happen for things that can
5115 slips by, so the eval should only happen for things that can
5105 really be only function/method names.
5116 really be only function/method names.
5106
5117
5107 2002-10-15 Fernando Perez <fperez@colorado.edu>
5118 2002-10-15 Fernando Perez <fperez@colorado.edu>
5108
5119
5109 * Updated LyX to 1.2.1 so I can work on the docs again. Added Mac
5120 * Updated LyX to 1.2.1 so I can work on the docs again. Added Mac
5110 OSX information to main manual, removed README_Mac_OSX file from
5121 OSX information to main manual, removed README_Mac_OSX file from
5111 distribution. Also updated credits for recent additions.
5122 distribution. Also updated credits for recent additions.
5112
5123
5113 2002-10-10 Fernando Perez <fperez@colorado.edu>
5124 2002-10-10 Fernando Perez <fperez@colorado.edu>
5114
5125
5115 * README_Mac_OSX: Added a README for Mac OSX users for fixing
5126 * README_Mac_OSX: Added a README for Mac OSX users for fixing
5116 terminal-related issues. Many thanks to Andrea Riciputi
5127 terminal-related issues. Many thanks to Andrea Riciputi
5117 <andrea.riciputi-AT-libero.it> for writing it.
5128 <andrea.riciputi-AT-libero.it> for writing it.
5118
5129
5119 * IPython/UserConfig/ipythonrc.py: Fixes to various small issues,
5130 * IPython/UserConfig/ipythonrc.py: Fixes to various small issues,
5120 thanks to Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
5131 thanks to Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
5121
5132
5122 * setup.py (make_shortcut): Fixes for Windows installation. Thanks
5133 * setup.py (make_shortcut): Fixes for Windows installation. Thanks
5123 to Fredrik Kant <fredrik.kant-AT-front.com> and Syver Enstad
5134 to Fredrik Kant <fredrik.kant-AT-front.com> and Syver Enstad
5124 <syver-en-AT-online.no> who both submitted patches for this problem.
5135 <syver-en-AT-online.no> who both submitted patches for this problem.
5125
5136
5126 * IPython/iplib.py (InteractiveShell.embed_mainloop): Patch for
5137 * IPython/iplib.py (InteractiveShell.embed_mainloop): Patch for
5127 global embedding to make sure that things don't overwrite user
5138 global embedding to make sure that things don't overwrite user
5128 globals accidentally. Thanks to Richard <rxe-AT-renre-europe.com>
5139 globals accidentally. Thanks to Richard <rxe-AT-renre-europe.com>
5129
5140
5130 * IPython/Gnuplot2.py (gp): Patch for Gnuplot.py 1.6
5141 * IPython/Gnuplot2.py (gp): Patch for Gnuplot.py 1.6
5131 compatibility. Thanks to Hayden Callow
5142 compatibility. Thanks to Hayden Callow
5132 <h.callow-AT-elec.canterbury.ac.nz>
5143 <h.callow-AT-elec.canterbury.ac.nz>
5133
5144
5134 2002-10-04 Fernando Perez <fperez@colorado.edu>
5145 2002-10-04 Fernando Perez <fperez@colorado.edu>
5135
5146
5136 * IPython/Gnuplot2.py (PlotItem): Added 'index' option for
5147 * IPython/Gnuplot2.py (PlotItem): Added 'index' option for
5137 Gnuplot.File objects.
5148 Gnuplot.File objects.
5138
5149
5139 2002-07-23 Fernando Perez <fperez@colorado.edu>
5150 2002-07-23 Fernando Perez <fperez@colorado.edu>
5140
5151
5141 * IPython/genutils.py (timing): Added timings() and timing() for
5152 * IPython/genutils.py (timing): Added timings() and timing() for
5142 quick access to the most commonly needed data, the execution
5153 quick access to the most commonly needed data, the execution
5143 times. Old timing() renamed to timings_out().
5154 times. Old timing() renamed to timings_out().
5144
5155
5145 2002-07-18 Fernando Perez <fperez@colorado.edu>
5156 2002-07-18 Fernando Perez <fperez@colorado.edu>
5146
5157
5147 * IPython/Shell.py (IPShellEmbed.restore_system_completer): fixed
5158 * IPython/Shell.py (IPShellEmbed.restore_system_completer): fixed
5148 bug with nested instances disrupting the parent's tab completion.
5159 bug with nested instances disrupting the parent's tab completion.
5149
5160
5150 * IPython/iplib.py (all_completions): Added Alex Schmolck's
5161 * IPython/iplib.py (all_completions): Added Alex Schmolck's
5151 all_completions code to begin the emacs integration.
5162 all_completions code to begin the emacs integration.
5152
5163
5153 * IPython/Gnuplot2.py (zip_items): Added optional 'titles'
5164 * IPython/Gnuplot2.py (zip_items): Added optional 'titles'
5154 argument to allow titling individual arrays when plotting.
5165 argument to allow titling individual arrays when plotting.
5155
5166
5156 2002-07-15 Fernando Perez <fperez@colorado.edu>
5167 2002-07-15 Fernando Perez <fperez@colorado.edu>
5157
5168
5158 * setup.py (make_shortcut): changed to retrieve the value of
5169 * setup.py (make_shortcut): changed to retrieve the value of
5159 'Program Files' directory from the registry (this value changes in
5170 'Program Files' directory from the registry (this value changes in
5160 non-english versions of Windows). Thanks to Thomas Fanslau
5171 non-english versions of Windows). Thanks to Thomas Fanslau
5161 <tfanslau-AT-gmx.de> for the report.
5172 <tfanslau-AT-gmx.de> for the report.
5162
5173
5163 2002-07-10 Fernando Perez <fperez@colorado.edu>
5174 2002-07-10 Fernando Perez <fperez@colorado.edu>
5164
5175
5165 * IPython/ultraTB.py (VerboseTB.debugger): enabled workaround for
5176 * IPython/ultraTB.py (VerboseTB.debugger): enabled workaround for
5166 a bug in pdb, which crashes if a line with only whitespace is
5177 a bug in pdb, which crashes if a line with only whitespace is
5167 entered. Bug report submitted to sourceforge.
5178 entered. Bug report submitted to sourceforge.
5168
5179
5169 2002-07-09 Fernando Perez <fperez@colorado.edu>
5180 2002-07-09 Fernando Perez <fperez@colorado.edu>
5170
5181
5171 * IPython/ultraTB.py (VerboseTB.nullrepr): fixed rare crash when
5182 * IPython/ultraTB.py (VerboseTB.nullrepr): fixed rare crash when
5172 reporting exceptions (it's a bug in inspect.py, I just set a
5183 reporting exceptions (it's a bug in inspect.py, I just set a
5173 workaround).
5184 workaround).
5174
5185
5175 2002-07-08 Fernando Perez <fperez@colorado.edu>
5186 2002-07-08 Fernando Perez <fperez@colorado.edu>
5176
5187
5177 * IPython/iplib.py (InteractiveShell.__init__): fixed reference to
5188 * IPython/iplib.py (InteractiveShell.__init__): fixed reference to
5178 __IPYTHON__ in __builtins__ to show up in user_ns.
5189 __IPYTHON__ in __builtins__ to show up in user_ns.
5179
5190
5180 2002-07-03 Fernando Perez <fperez@colorado.edu>
5191 2002-07-03 Fernando Perez <fperez@colorado.edu>
5181
5192
5182 * IPython/GnuplotInteractive.py (magic_gp_set_default): changed
5193 * IPython/GnuplotInteractive.py (magic_gp_set_default): changed
5183 name from @gp_set_instance to @gp_set_default.
5194 name from @gp_set_instance to @gp_set_default.
5184
5195
5185 * IPython/ipmaker.py (make_IPython): default editor value set to
5196 * IPython/ipmaker.py (make_IPython): default editor value set to
5186 '0' (a string), to match the rc file. Otherwise will crash when
5197 '0' (a string), to match the rc file. Otherwise will crash when
5187 .strip() is called on it.
5198 .strip() is called on it.
5188
5199
5189
5200
5190 2002-06-28 Fernando Perez <fperez@colorado.edu>
5201 2002-06-28 Fernando Perez <fperez@colorado.edu>
5191
5202
5192 * IPython/iplib.py (InteractiveShell.safe_execfile): fix importing
5203 * IPython/iplib.py (InteractiveShell.safe_execfile): fix importing
5193 of files in current directory when a file is executed via
5204 of files in current directory when a file is executed via
5194 @run. Patch also by RA <ralf_ahlbrink-AT-web.de>.
5205 @run. Patch also by RA <ralf_ahlbrink-AT-web.de>.
5195
5206
5196 * setup.py (manfiles): fix for rpm builds, submitted by RA
5207 * setup.py (manfiles): fix for rpm builds, submitted by RA
5197 <ralf_ahlbrink-AT-web.de>. Now we have RPMs!
5208 <ralf_ahlbrink-AT-web.de>. Now we have RPMs!
5198
5209
5199 * IPython/ipmaker.py (make_IPython): fixed lookup of default
5210 * IPython/ipmaker.py (make_IPython): fixed lookup of default
5200 editor when set to '0'. Problem was, '0' evaluates to True (it's a
5211 editor when set to '0'. Problem was, '0' evaluates to True (it's a
5201 string!). A. Schmolck caught this one.
5212 string!). A. Schmolck caught this one.
5202
5213
5203 2002-06-27 Fernando Perez <fperez@colorado.edu>
5214 2002-06-27 Fernando Perez <fperez@colorado.edu>
5204
5215
5205 * IPython/ipmaker.py (make_IPython): fixed bug when running user
5216 * IPython/ipmaker.py (make_IPython): fixed bug when running user
5206 defined files at the cmd line. __name__ wasn't being set to
5217 defined files at the cmd line. __name__ wasn't being set to
5207 __main__.
5218 __main__.
5208
5219
5209 * IPython/Gnuplot2.py (zip_items): improved it so it can plot also
5220 * IPython/Gnuplot2.py (zip_items): improved it so it can plot also
5210 regular lists and tuples besides Numeric arrays.
5221 regular lists and tuples besides Numeric arrays.
5211
5222
5212 * IPython/Prompts.py (CachedOutput.__call__): Added output
5223 * IPython/Prompts.py (CachedOutput.__call__): Added output
5213 supression for input ending with ';'. Similar to Mathematica and
5224 supression for input ending with ';'. Similar to Mathematica and
5214 Matlab. The _* vars and Out[] list are still updated, just like
5225 Matlab. The _* vars and Out[] list are still updated, just like
5215 Mathematica behaves.
5226 Mathematica behaves.
5216
5227
5217 2002-06-25 Fernando Perez <fperez@colorado.edu>
5228 2002-06-25 Fernando Perez <fperez@colorado.edu>
5218
5229
5219 * IPython/ConfigLoader.py (ConfigLoader.load): fixed checking of
5230 * IPython/ConfigLoader.py (ConfigLoader.load): fixed checking of
5220 .ini extensions for profiels under Windows.
5231 .ini extensions for profiels under Windows.
5221
5232
5222 * IPython/OInspect.py (Inspector.pinfo): improved alignment of
5233 * IPython/OInspect.py (Inspector.pinfo): improved alignment of
5223 string form. Fix contributed by Alexander Schmolck
5234 string form. Fix contributed by Alexander Schmolck
5224 <a.schmolck-AT-gmx.net>
5235 <a.schmolck-AT-gmx.net>
5225
5236
5226 * IPython/GnuplotRuntime.py (gp_new): new function. Returns a
5237 * IPython/GnuplotRuntime.py (gp_new): new function. Returns a
5227 pre-configured Gnuplot instance.
5238 pre-configured Gnuplot instance.
5228
5239
5229 2002-06-21 Fernando Perez <fperez@colorado.edu>
5240 2002-06-21 Fernando Perez <fperez@colorado.edu>
5230
5241
5231 * IPython/numutils.py (exp_safe): new function, works around the
5242 * IPython/numutils.py (exp_safe): new function, works around the
5232 underflow problems in Numeric.
5243 underflow problems in Numeric.
5233 (log2): New fn. Safe log in base 2: returns exact integer answer
5244 (log2): New fn. Safe log in base 2: returns exact integer answer
5234 for exact integer powers of 2.
5245 for exact integer powers of 2.
5235
5246
5236 * IPython/Magic.py (get_py_filename): fixed it not expanding '~'
5247 * IPython/Magic.py (get_py_filename): fixed it not expanding '~'
5237 properly.
5248 properly.
5238
5249
5239 2002-06-20 Fernando Perez <fperez@colorado.edu>
5250 2002-06-20 Fernando Perez <fperez@colorado.edu>
5240
5251
5241 * IPython/genutils.py (timing): new function like
5252 * IPython/genutils.py (timing): new function like
5242 Mathematica's. Similar to time_test, but returns more info.
5253 Mathematica's. Similar to time_test, but returns more info.
5243
5254
5244 2002-06-18 Fernando Perez <fperez@colorado.edu>
5255 2002-06-18 Fernando Perez <fperez@colorado.edu>
5245
5256
5246 * IPython/Magic.py (Magic.magic_save): modified @save and @r
5257 * IPython/Magic.py (Magic.magic_save): modified @save and @r
5247 according to Mike Heeter's suggestions.
5258 according to Mike Heeter's suggestions.
5248
5259
5249 2002-06-16 Fernando Perez <fperez@colorado.edu>
5260 2002-06-16 Fernando Perez <fperez@colorado.edu>
5250
5261
5251 * IPython/GnuplotRuntime.py: Massive overhaul to the Gnuplot
5262 * IPython/GnuplotRuntime.py: Massive overhaul to the Gnuplot
5252 system. GnuplotMagic is gone as a user-directory option. New files
5263 system. GnuplotMagic is gone as a user-directory option. New files
5253 make it easier to use all the gnuplot stuff both from external
5264 make it easier to use all the gnuplot stuff both from external
5254 programs as well as from IPython. Had to rewrite part of
5265 programs as well as from IPython. Had to rewrite part of
5255 hardcopy() b/c of a strange bug: often the ps files simply don't
5266 hardcopy() b/c of a strange bug: often the ps files simply don't
5256 get created, and require a repeat of the command (often several
5267 get created, and require a repeat of the command (often several
5257 times).
5268 times).
5258
5269
5259 * IPython/ultraTB.py (AutoFormattedTB.__call__): changed to
5270 * IPython/ultraTB.py (AutoFormattedTB.__call__): changed to
5260 resolve output channel at call time, so that if sys.stderr has
5271 resolve output channel at call time, so that if sys.stderr has
5261 been redirected by user this gets honored.
5272 been redirected by user this gets honored.
5262
5273
5263 2002-06-13 Fernando Perez <fperez@colorado.edu>
5274 2002-06-13 Fernando Perez <fperez@colorado.edu>
5264
5275
5265 * IPython/Shell.py (IPShell.__init__): Changed IPythonShell to
5276 * IPython/Shell.py (IPShell.__init__): Changed IPythonShell to
5266 IPShell. Kept a copy with the old names to avoid breaking people's
5277 IPShell. Kept a copy with the old names to avoid breaking people's
5267 embedded code.
5278 embedded code.
5268
5279
5269 * IPython/ipython: simplified it to the bare minimum after
5280 * IPython/ipython: simplified it to the bare minimum after
5270 Holger's suggestions. Added info about how to use it in
5281 Holger's suggestions. Added info about how to use it in
5271 PYTHONSTARTUP.
5282 PYTHONSTARTUP.
5272
5283
5273 * IPython/Shell.py (IPythonShell): changed the options passing
5284 * IPython/Shell.py (IPythonShell): changed the options passing
5274 from a string with funky %s replacements to a straight list. Maybe
5285 from a string with funky %s replacements to a straight list. Maybe
5275 a bit more typing, but it follows sys.argv conventions, so there's
5286 a bit more typing, but it follows sys.argv conventions, so there's
5276 less special-casing to remember.
5287 less special-casing to remember.
5277
5288
5278 2002-06-12 Fernando Perez <fperez@colorado.edu>
5289 2002-06-12 Fernando Perez <fperez@colorado.edu>
5279
5290
5280 * IPython/Magic.py (Magic.magic_r): new magic auto-repeat
5291 * IPython/Magic.py (Magic.magic_r): new magic auto-repeat
5281 command. Thanks to a suggestion by Mike Heeter.
5292 command. Thanks to a suggestion by Mike Heeter.
5282 (Magic.magic_pfile): added behavior to look at filenames if given
5293 (Magic.magic_pfile): added behavior to look at filenames if given
5283 arg is not a defined object.
5294 arg is not a defined object.
5284 (Magic.magic_save): New @save function to save code snippets. Also
5295 (Magic.magic_save): New @save function to save code snippets. Also
5285 a Mike Heeter idea.
5296 a Mike Heeter idea.
5286
5297
5287 * IPython/UserConfig/GnuplotMagic.py (plot): Improvements to
5298 * IPython/UserConfig/GnuplotMagic.py (plot): Improvements to
5288 plot() and replot(). Much more convenient now, especially for
5299 plot() and replot(). Much more convenient now, especially for
5289 interactive use.
5300 interactive use.
5290
5301
5291 * IPython/Magic.py (Magic.magic_run): Added .py automatically to
5302 * IPython/Magic.py (Magic.magic_run): Added .py automatically to
5292 filenames.
5303 filenames.
5293
5304
5294 2002-06-02 Fernando Perez <fperez@colorado.edu>
5305 2002-06-02 Fernando Perez <fperez@colorado.edu>
5295
5306
5296 * IPython/Struct.py (Struct.__init__): modified to admit
5307 * IPython/Struct.py (Struct.__init__): modified to admit
5297 initialization via another struct.
5308 initialization via another struct.
5298
5309
5299 * IPython/genutils.py (SystemExec.__init__): New stateful
5310 * IPython/genutils.py (SystemExec.__init__): New stateful
5300 interface to xsys and bq. Useful for writing system scripts.
5311 interface to xsys and bq. Useful for writing system scripts.
5301
5312
5302 2002-05-30 Fernando Perez <fperez@colorado.edu>
5313 2002-05-30 Fernando Perez <fperez@colorado.edu>
5303
5314
5304 * MANIFEST.in: Changed docfile selection to exclude all the lyx
5315 * MANIFEST.in: Changed docfile selection to exclude all the lyx
5305 documents. This will make the user download smaller (it's getting
5316 documents. This will make the user download smaller (it's getting
5306 too big).
5317 too big).
5307
5318
5308 2002-05-29 Fernando Perez <fperez@colorado.edu>
5319 2002-05-29 Fernando Perez <fperez@colorado.edu>
5309
5320
5310 * IPython/iplib.py (_FakeModule.__init__): New class introduced to
5321 * IPython/iplib.py (_FakeModule.__init__): New class introduced to
5311 fix problems with shelve and pickle. Seems to work, but I don't
5322 fix problems with shelve and pickle. Seems to work, but I don't
5312 know if corner cases break it. Thanks to Mike Heeter
5323 know if corner cases break it. Thanks to Mike Heeter
5313 <korora-AT-SDF.LONESTAR.ORG> for the bug reports and test cases.
5324 <korora-AT-SDF.LONESTAR.ORG> for the bug reports and test cases.
5314
5325
5315 2002-05-24 Fernando Perez <fperez@colorado.edu>
5326 2002-05-24 Fernando Perez <fperez@colorado.edu>
5316
5327
5317 * IPython/Magic.py (Macro.__init__): fixed magics embedded in
5328 * IPython/Magic.py (Macro.__init__): fixed magics embedded in
5318 macros having broken.
5329 macros having broken.
5319
5330
5320 2002-05-21 Fernando Perez <fperez@colorado.edu>
5331 2002-05-21 Fernando Perez <fperez@colorado.edu>
5321
5332
5322 * IPython/Magic.py (Magic.magic_logstart): fixed recently
5333 * IPython/Magic.py (Magic.magic_logstart): fixed recently
5323 introduced logging bug: all history before logging started was
5334 introduced logging bug: all history before logging started was
5324 being written one character per line! This came from the redesign
5335 being written one character per line! This came from the redesign
5325 of the input history as a special list which slices to strings,
5336 of the input history as a special list which slices to strings,
5326 not to lists.
5337 not to lists.
5327
5338
5328 2002-05-20 Fernando Perez <fperez@colorado.edu>
5339 2002-05-20 Fernando Perez <fperez@colorado.edu>
5329
5340
5330 * IPython/Prompts.py (CachedOutput.__init__): made the color table
5341 * IPython/Prompts.py (CachedOutput.__init__): made the color table
5331 be an attribute of all classes in this module. The design of these
5342 be an attribute of all classes in this module. The design of these
5332 classes needs some serious overhauling.
5343 classes needs some serious overhauling.
5333
5344
5334 * IPython/DPyGetOpt.py (DPyGetOpt.setPosixCompliance): fixed bug
5345 * IPython/DPyGetOpt.py (DPyGetOpt.setPosixCompliance): fixed bug
5335 which was ignoring '_' in option names.
5346 which was ignoring '_' in option names.
5336
5347
5337 * IPython/ultraTB.py (FormattedTB.__init__): Changed
5348 * IPython/ultraTB.py (FormattedTB.__init__): Changed
5338 'Verbose_novars' to 'Context' and made it the new default. It's a
5349 'Verbose_novars' to 'Context' and made it the new default. It's a
5339 bit more readable and also safer than verbose.
5350 bit more readable and also safer than verbose.
5340
5351
5341 * IPython/PyColorize.py (Parser.__call__): Fixed coloring of
5352 * IPython/PyColorize.py (Parser.__call__): Fixed coloring of
5342 triple-quoted strings.
5353 triple-quoted strings.
5343
5354
5344 * IPython/OInspect.py (__all__): new module exposing the object
5355 * IPython/OInspect.py (__all__): new module exposing the object
5345 introspection facilities. Now the corresponding magics are dummy
5356 introspection facilities. Now the corresponding magics are dummy
5346 wrappers around this. Having this module will make it much easier
5357 wrappers around this. Having this module will make it much easier
5347 to put these functions into our modified pdb.
5358 to put these functions into our modified pdb.
5348 This new object inspector system uses the new colorizing module,
5359 This new object inspector system uses the new colorizing module,
5349 so source code and other things are nicely syntax highlighted.
5360 so source code and other things are nicely syntax highlighted.
5350
5361
5351 2002-05-18 Fernando Perez <fperez@colorado.edu>
5362 2002-05-18 Fernando Perez <fperez@colorado.edu>
5352
5363
5353 * IPython/ColorANSI.py: Split the coloring tools into a separate
5364 * IPython/ColorANSI.py: Split the coloring tools into a separate
5354 module so I can use them in other code easier (they were part of
5365 module so I can use them in other code easier (they were part of
5355 ultraTB).
5366 ultraTB).
5356
5367
5357 2002-05-17 Fernando Perez <fperez@colorado.edu>
5368 2002-05-17 Fernando Perez <fperez@colorado.edu>
5358
5369
5359 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
5370 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
5360 fixed it to set the global 'g' also to the called instance, as
5371 fixed it to set the global 'g' also to the called instance, as
5361 long as 'g' was still a gnuplot instance (so it doesn't overwrite
5372 long as 'g' was still a gnuplot instance (so it doesn't overwrite
5362 user's 'g' variables).
5373 user's 'g' variables).
5363
5374
5364 * IPython/iplib.py (InteractiveShell.__init__): Added In/Out
5375 * IPython/iplib.py (InteractiveShell.__init__): Added In/Out
5365 global variables (aliases to _ih,_oh) so that users which expect
5376 global variables (aliases to _ih,_oh) so that users which expect
5366 In[5] or Out[7] to work aren't unpleasantly surprised.
5377 In[5] or Out[7] to work aren't unpleasantly surprised.
5367 (InputList.__getslice__): new class to allow executing slices of
5378 (InputList.__getslice__): new class to allow executing slices of
5368 input history directly. Very simple class, complements the use of
5379 input history directly. Very simple class, complements the use of
5369 macros.
5380 macros.
5370
5381
5371 2002-05-16 Fernando Perez <fperez@colorado.edu>
5382 2002-05-16 Fernando Perez <fperez@colorado.edu>
5372
5383
5373 * setup.py (docdirbase): make doc directory be just doc/IPython
5384 * setup.py (docdirbase): make doc directory be just doc/IPython
5374 without version numbers, it will reduce clutter for users.
5385 without version numbers, it will reduce clutter for users.
5375
5386
5376 * IPython/Magic.py (Magic.magic_run): Add explicit local dict to
5387 * IPython/Magic.py (Magic.magic_run): Add explicit local dict to
5377 execfile call to prevent possible memory leak. See for details:
5388 execfile call to prevent possible memory leak. See for details:
5378 http://mail.python.org/pipermail/python-list/2002-February/088476.html
5389 http://mail.python.org/pipermail/python-list/2002-February/088476.html
5379
5390
5380 2002-05-15 Fernando Perez <fperez@colorado.edu>
5391 2002-05-15 Fernando Perez <fperez@colorado.edu>
5381
5392
5382 * IPython/Magic.py (Magic.magic_psource): made the object
5393 * IPython/Magic.py (Magic.magic_psource): made the object
5383 introspection names be more standard: pdoc, pdef, pfile and
5394 introspection names be more standard: pdoc, pdef, pfile and
5384 psource. They all print/page their output, and it makes
5395 psource. They all print/page their output, and it makes
5385 remembering them easier. Kept old names for compatibility as
5396 remembering them easier. Kept old names for compatibility as
5386 aliases.
5397 aliases.
5387
5398
5388 2002-05-14 Fernando Perez <fperez@colorado.edu>
5399 2002-05-14 Fernando Perez <fperez@colorado.edu>
5389
5400
5390 * IPython/UserConfig/GnuplotMagic.py: I think I finally understood
5401 * IPython/UserConfig/GnuplotMagic.py: I think I finally understood
5391 what the mouse problem was. The trick is to use gnuplot with temp
5402 what the mouse problem was. The trick is to use gnuplot with temp
5392 files and NOT with pipes (for data communication), because having
5403 files and NOT with pipes (for data communication), because having
5393 both pipes and the mouse on is bad news.
5404 both pipes and the mouse on is bad news.
5394
5405
5395 2002-05-13 Fernando Perez <fperez@colorado.edu>
5406 2002-05-13 Fernando Perez <fperez@colorado.edu>
5396
5407
5397 * IPython/Magic.py (Magic._ofind): fixed namespace order search
5408 * IPython/Magic.py (Magic._ofind): fixed namespace order search
5398 bug. Information would be reported about builtins even when
5409 bug. Information would be reported about builtins even when
5399 user-defined functions overrode them.
5410 user-defined functions overrode them.
5400
5411
5401 2002-05-11 Fernando Perez <fperez@colorado.edu>
5412 2002-05-11 Fernando Perez <fperez@colorado.edu>
5402
5413
5403 * IPython/__init__.py (__all__): removed FlexCompleter from
5414 * IPython/__init__.py (__all__): removed FlexCompleter from
5404 __all__ so that things don't fail in platforms without readline.
5415 __all__ so that things don't fail in platforms without readline.
5405
5416
5406 2002-05-10 Fernando Perez <fperez@colorado.edu>
5417 2002-05-10 Fernando Perez <fperez@colorado.edu>
5407
5418
5408 * IPython/__init__.py (__all__): removed numutils from __all__ b/c
5419 * IPython/__init__.py (__all__): removed numutils from __all__ b/c
5409 it requires Numeric, effectively making Numeric a dependency for
5420 it requires Numeric, effectively making Numeric a dependency for
5410 IPython.
5421 IPython.
5411
5422
5412 * Released 0.2.13
5423 * Released 0.2.13
5413
5424
5414 * IPython/Magic.py (Magic.magic_prun): big overhaul to the
5425 * IPython/Magic.py (Magic.magic_prun): big overhaul to the
5415 profiler interface. Now all the major options from the profiler
5426 profiler interface. Now all the major options from the profiler
5416 module are directly supported in IPython, both for single
5427 module are directly supported in IPython, both for single
5417 expressions (@prun) and for full programs (@run -p).
5428 expressions (@prun) and for full programs (@run -p).
5418
5429
5419 2002-05-09 Fernando Perez <fperez@colorado.edu>
5430 2002-05-09 Fernando Perez <fperez@colorado.edu>
5420
5431
5421 * IPython/Magic.py (Magic.magic_doc): fixed to show docstrings of
5432 * IPython/Magic.py (Magic.magic_doc): fixed to show docstrings of
5422 magic properly formatted for screen.
5433 magic properly formatted for screen.
5423
5434
5424 * setup.py (make_shortcut): Changed things to put pdf version in
5435 * setup.py (make_shortcut): Changed things to put pdf version in
5425 doc/ instead of doc/manual (had to change lyxport a bit).
5436 doc/ instead of doc/manual (had to change lyxport a bit).
5426
5437
5427 * IPython/Magic.py (Profile.string_stats): made profile runs go
5438 * IPython/Magic.py (Profile.string_stats): made profile runs go
5428 through pager (they are long and a pager allows searching, saving,
5439 through pager (they are long and a pager allows searching, saving,
5429 etc.)
5440 etc.)
5430
5441
5431 2002-05-08 Fernando Perez <fperez@colorado.edu>
5442 2002-05-08 Fernando Perez <fperez@colorado.edu>
5432
5443
5433 * Released 0.2.12
5444 * Released 0.2.12
5434
5445
5435 2002-05-06 Fernando Perez <fperez@colorado.edu>
5446 2002-05-06 Fernando Perez <fperez@colorado.edu>
5436
5447
5437 * IPython/Magic.py (Magic.magic_hist): small bug fixed (recently
5448 * IPython/Magic.py (Magic.magic_hist): small bug fixed (recently
5438 introduced); 'hist n1 n2' was broken.
5449 introduced); 'hist n1 n2' was broken.
5439 (Magic.magic_pdb): added optional on/off arguments to @pdb
5450 (Magic.magic_pdb): added optional on/off arguments to @pdb
5440 (Magic.magic_run): added option -i to @run, which executes code in
5451 (Magic.magic_run): added option -i to @run, which executes code in
5441 the IPython namespace instead of a clean one. Also added @irun as
5452 the IPython namespace instead of a clean one. Also added @irun as
5442 an alias to @run -i.
5453 an alias to @run -i.
5443
5454
5444 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
5455 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
5445 fixed (it didn't really do anything, the namespaces were wrong).
5456 fixed (it didn't really do anything, the namespaces were wrong).
5446
5457
5447 * IPython/Debugger.py (__init__): Added workaround for python 2.1
5458 * IPython/Debugger.py (__init__): Added workaround for python 2.1
5448
5459
5449 * IPython/__init__.py (__all__): Fixed package namespace, now
5460 * IPython/__init__.py (__all__): Fixed package namespace, now
5450 'import IPython' does give access to IPython.<all> as
5461 'import IPython' does give access to IPython.<all> as
5451 expected. Also renamed __release__ to Release.
5462 expected. Also renamed __release__ to Release.
5452
5463
5453 * IPython/Debugger.py (__license__): created new Pdb class which
5464 * IPython/Debugger.py (__license__): created new Pdb class which
5454 functions like a drop-in for the normal pdb.Pdb but does NOT
5465 functions like a drop-in for the normal pdb.Pdb but does NOT
5455 import readline by default. This way it doesn't muck up IPython's
5466 import readline by default. This way it doesn't muck up IPython's
5456 readline handling, and now tab-completion finally works in the
5467 readline handling, and now tab-completion finally works in the
5457 debugger -- sort of. It completes things globally visible, but the
5468 debugger -- sort of. It completes things globally visible, but the
5458 completer doesn't track the stack as pdb walks it. That's a bit
5469 completer doesn't track the stack as pdb walks it. That's a bit
5459 tricky, and I'll have to implement it later.
5470 tricky, and I'll have to implement it later.
5460
5471
5461 2002-05-05 Fernando Perez <fperez@colorado.edu>
5472 2002-05-05 Fernando Perez <fperez@colorado.edu>
5462
5473
5463 * IPython/Magic.py (Magic.magic_oinfo): fixed formatting bug for
5474 * IPython/Magic.py (Magic.magic_oinfo): fixed formatting bug for
5464 magic docstrings when printed via ? (explicit \'s were being
5475 magic docstrings when printed via ? (explicit \'s were being
5465 printed).
5476 printed).
5466
5477
5467 * IPython/ipmaker.py (make_IPython): fixed namespace
5478 * IPython/ipmaker.py (make_IPython): fixed namespace
5468 identification bug. Now variables loaded via logs or command-line
5479 identification bug. Now variables loaded via logs or command-line
5469 files are recognized in the interactive namespace by @who.
5480 files are recognized in the interactive namespace by @who.
5470
5481
5471 * IPython/iplib.py (InteractiveShell.safe_execfile): Fixed bug in
5482 * IPython/iplib.py (InteractiveShell.safe_execfile): Fixed bug in
5472 log replay system stemming from the string form of Structs.
5483 log replay system stemming from the string form of Structs.
5473
5484
5474 * IPython/Magic.py (Macro.__init__): improved macros to properly
5485 * IPython/Magic.py (Macro.__init__): improved macros to properly
5475 handle magic commands in them.
5486 handle magic commands in them.
5476 (Magic.magic_logstart): usernames are now expanded so 'logstart
5487 (Magic.magic_logstart): usernames are now expanded so 'logstart
5477 ~/mylog' now works.
5488 ~/mylog' now works.
5478
5489
5479 * IPython/iplib.py (complete): fixed bug where paths starting with
5490 * IPython/iplib.py (complete): fixed bug where paths starting with
5480 '/' would be completed as magic names.
5491 '/' would be completed as magic names.
5481
5492
5482 2002-05-04 Fernando Perez <fperez@colorado.edu>
5493 2002-05-04 Fernando Perez <fperez@colorado.edu>
5483
5494
5484 * IPython/Magic.py (Magic.magic_run): added options -p and -f to
5495 * IPython/Magic.py (Magic.magic_run): added options -p and -f to
5485 allow running full programs under the profiler's control.
5496 allow running full programs under the profiler's control.
5486
5497
5487 * IPython/ultraTB.py (FormattedTB.__init__): Added Verbose_novars
5498 * IPython/ultraTB.py (FormattedTB.__init__): Added Verbose_novars
5488 mode to report exceptions verbosely but without formatting
5499 mode to report exceptions verbosely but without formatting
5489 variables. This addresses the issue of ipython 'freezing' (it's
5500 variables. This addresses the issue of ipython 'freezing' (it's
5490 not frozen, but caught in an expensive formatting loop) when huge
5501 not frozen, but caught in an expensive formatting loop) when huge
5491 variables are in the context of an exception.
5502 variables are in the context of an exception.
5492 (VerboseTB.text): Added '--->' markers at line where exception was
5503 (VerboseTB.text): Added '--->' markers at line where exception was
5493 triggered. Much clearer to read, especially in NoColor modes.
5504 triggered. Much clearer to read, especially in NoColor modes.
5494
5505
5495 * IPython/Magic.py (Magic.magic_run): bugfix: -n option had been
5506 * IPython/Magic.py (Magic.magic_run): bugfix: -n option had been
5496 implemented in reverse when changing to the new parse_options().
5507 implemented in reverse when changing to the new parse_options().
5497
5508
5498 2002-05-03 Fernando Perez <fperez@colorado.edu>
5509 2002-05-03 Fernando Perez <fperez@colorado.edu>
5499
5510
5500 * IPython/Magic.py (Magic.parse_options): new function so that
5511 * IPython/Magic.py (Magic.parse_options): new function so that
5501 magics can parse options easier.
5512 magics can parse options easier.
5502 (Magic.magic_prun): new function similar to profile.run(),
5513 (Magic.magic_prun): new function similar to profile.run(),
5503 suggested by Chris Hart.
5514 suggested by Chris Hart.
5504 (Magic.magic_cd): fixed behavior so that it only changes if
5515 (Magic.magic_cd): fixed behavior so that it only changes if
5505 directory actually is in history.
5516 directory actually is in history.
5506
5517
5507 * IPython/usage.py (__doc__): added information about potential
5518 * IPython/usage.py (__doc__): added information about potential
5508 slowness of Verbose exception mode when there are huge data
5519 slowness of Verbose exception mode when there are huge data
5509 structures to be formatted (thanks to Archie Paulson).
5520 structures to be formatted (thanks to Archie Paulson).
5510
5521
5511 * IPython/ipmaker.py (make_IPython): Changed default logging
5522 * IPython/ipmaker.py (make_IPython): Changed default logging
5512 (when simply called with -log) to use curr_dir/ipython.log in
5523 (when simply called with -log) to use curr_dir/ipython.log in
5513 rotate mode. Fixed crash which was occuring with -log before
5524 rotate mode. Fixed crash which was occuring with -log before
5514 (thanks to Jim Boyle).
5525 (thanks to Jim Boyle).
5515
5526
5516 2002-05-01 Fernando Perez <fperez@colorado.edu>
5527 2002-05-01 Fernando Perez <fperez@colorado.edu>
5517
5528
5518 * Released 0.2.11 for these fixes (mainly the ultraTB one which
5529 * Released 0.2.11 for these fixes (mainly the ultraTB one which
5519 was nasty -- though somewhat of a corner case).
5530 was nasty -- though somewhat of a corner case).
5520
5531
5521 * IPython/ultraTB.py (AutoFormattedTB.text): renamed __text to
5532 * IPython/ultraTB.py (AutoFormattedTB.text): renamed __text to
5522 text (was a bug).
5533 text (was a bug).
5523
5534
5524 2002-04-30 Fernando Perez <fperez@colorado.edu>
5535 2002-04-30 Fernando Perez <fperez@colorado.edu>
5525
5536
5526 * IPython/UserConfig/GnuplotMagic.py (magic_gp): Minor fix to add
5537 * IPython/UserConfig/GnuplotMagic.py (magic_gp): Minor fix to add
5527 a print after ^D or ^C from the user so that the In[] prompt
5538 a print after ^D or ^C from the user so that the In[] prompt
5528 doesn't over-run the gnuplot one.
5539 doesn't over-run the gnuplot one.
5529
5540
5530 2002-04-29 Fernando Perez <fperez@colorado.edu>
5541 2002-04-29 Fernando Perez <fperez@colorado.edu>
5531
5542
5532 * Released 0.2.10
5543 * Released 0.2.10
5533
5544
5534 * IPython/__release__.py (version): get date dynamically.
5545 * IPython/__release__.py (version): get date dynamically.
5535
5546
5536 * Misc. documentation updates thanks to Arnd's comments. Also ran
5547 * Misc. documentation updates thanks to Arnd's comments. Also ran
5537 a full spellcheck on the manual (hadn't been done in a while).
5548 a full spellcheck on the manual (hadn't been done in a while).
5538
5549
5539 2002-04-27 Fernando Perez <fperez@colorado.edu>
5550 2002-04-27 Fernando Perez <fperez@colorado.edu>
5540
5551
5541 * IPython/Magic.py (Magic.magic_logstart): Fixed bug where
5552 * IPython/Magic.py (Magic.magic_logstart): Fixed bug where
5542 starting a log in mid-session would reset the input history list.
5553 starting a log in mid-session would reset the input history list.
5543
5554
5544 2002-04-26 Fernando Perez <fperez@colorado.edu>
5555 2002-04-26 Fernando Perez <fperez@colorado.edu>
5545
5556
5546 * IPython/iplib.py (InteractiveShell.wait): Fixed bug where not
5557 * IPython/iplib.py (InteractiveShell.wait): Fixed bug where not
5547 all files were being included in an update. Now anything in
5558 all files were being included in an update. Now anything in
5548 UserConfig that matches [A-Za-z]*.py will go (this excludes
5559 UserConfig that matches [A-Za-z]*.py will go (this excludes
5549 __init__.py)
5560 __init__.py)
5550
5561
5551 2002-04-25 Fernando Perez <fperez@colorado.edu>
5562 2002-04-25 Fernando Perez <fperez@colorado.edu>
5552
5563
5553 * IPython/iplib.py (InteractiveShell.__init__): Added __IPYTHON__
5564 * IPython/iplib.py (InteractiveShell.__init__): Added __IPYTHON__
5554 to __builtins__ so that any form of embedded or imported code can
5565 to __builtins__ so that any form of embedded or imported code can
5555 test for being inside IPython.
5566 test for being inside IPython.
5556
5567
5557 * IPython/UserConfig/GnuplotMagic.py: (magic_gp_set_instance):
5568 * IPython/UserConfig/GnuplotMagic.py: (magic_gp_set_instance):
5558 changed to GnuplotMagic because it's now an importable module,
5569 changed to GnuplotMagic because it's now an importable module,
5559 this makes the name follow that of the standard Gnuplot module.
5570 this makes the name follow that of the standard Gnuplot module.
5560 GnuplotMagic can now be loaded at any time in mid-session.
5571 GnuplotMagic can now be loaded at any time in mid-session.
5561
5572
5562 2002-04-24 Fernando Perez <fperez@colorado.edu>
5573 2002-04-24 Fernando Perez <fperez@colorado.edu>
5563
5574
5564 * IPython/numutils.py: removed SIUnits. It doesn't properly set
5575 * IPython/numutils.py: removed SIUnits. It doesn't properly set
5565 the globals (IPython has its own namespace) and the
5576 the globals (IPython has its own namespace) and the
5566 PhysicalQuantity stuff is much better anyway.
5577 PhysicalQuantity stuff is much better anyway.
5567
5578
5568 * IPython/UserConfig/example-gnuplot.py (g2): Added gnuplot
5579 * IPython/UserConfig/example-gnuplot.py (g2): Added gnuplot
5569 embedding example to standard user directory for
5580 embedding example to standard user directory for
5570 distribution. Also put it in the manual.
5581 distribution. Also put it in the manual.
5571
5582
5572 * IPython/numutils.py (gnuplot_exec): Changed to take a gnuplot
5583 * IPython/numutils.py (gnuplot_exec): Changed to take a gnuplot
5573 instance as first argument (so it doesn't rely on some obscure
5584 instance as first argument (so it doesn't rely on some obscure
5574 hidden global).
5585 hidden global).
5575
5586
5576 * IPython/UserConfig/ipythonrc.py: put () back in accepted
5587 * IPython/UserConfig/ipythonrc.py: put () back in accepted
5577 delimiters. While it prevents ().TAB from working, it allows
5588 delimiters. While it prevents ().TAB from working, it allows
5578 completions in open (... expressions. This is by far a more common
5589 completions in open (... expressions. This is by far a more common
5579 case.
5590 case.
5580
5591
5581 2002-04-23 Fernando Perez <fperez@colorado.edu>
5592 2002-04-23 Fernando Perez <fperez@colorado.edu>
5582
5593
5583 * IPython/Extensions/InterpreterPasteInput.py: new
5594 * IPython/Extensions/InterpreterPasteInput.py: new
5584 syntax-processing module for pasting lines with >>> or ... at the
5595 syntax-processing module for pasting lines with >>> or ... at the
5585 start.
5596 start.
5586
5597
5587 * IPython/Extensions/PhysicalQ_Interactive.py
5598 * IPython/Extensions/PhysicalQ_Interactive.py
5588 (PhysicalQuantityInteractive.__int__): fixed to work with either
5599 (PhysicalQuantityInteractive.__int__): fixed to work with either
5589 Numeric or math.
5600 Numeric or math.
5590
5601
5591 * IPython/UserConfig/ipythonrc-numeric.py: reorganized the
5602 * IPython/UserConfig/ipythonrc-numeric.py: reorganized the
5592 provided profiles. Now we have:
5603 provided profiles. Now we have:
5593 -math -> math module as * and cmath with its own namespace.
5604 -math -> math module as * and cmath with its own namespace.
5594 -numeric -> Numeric as *, plus gnuplot & grace
5605 -numeric -> Numeric as *, plus gnuplot & grace
5595 -physics -> same as before
5606 -physics -> same as before
5596
5607
5597 * IPython/Magic.py (Magic.magic_magic): Fixed bug where
5608 * IPython/Magic.py (Magic.magic_magic): Fixed bug where
5598 user-defined magics wouldn't be found by @magic if they were
5609 user-defined magics wouldn't be found by @magic if they were
5599 defined as class methods. Also cleaned up the namespace search
5610 defined as class methods. Also cleaned up the namespace search
5600 logic and the string building (to use %s instead of many repeated
5611 logic and the string building (to use %s instead of many repeated
5601 string adds).
5612 string adds).
5602
5613
5603 * IPython/UserConfig/example-magic.py (magic_foo): updated example
5614 * IPython/UserConfig/example-magic.py (magic_foo): updated example
5604 of user-defined magics to operate with class methods (cleaner, in
5615 of user-defined magics to operate with class methods (cleaner, in
5605 line with the gnuplot code).
5616 line with the gnuplot code).
5606
5617
5607 2002-04-22 Fernando Perez <fperez@colorado.edu>
5618 2002-04-22 Fernando Perez <fperez@colorado.edu>
5608
5619
5609 * setup.py: updated dependency list so that manual is updated when
5620 * setup.py: updated dependency list so that manual is updated when
5610 all included files change.
5621 all included files change.
5611
5622
5612 * IPython/ipmaker.py (make_IPython): Fixed bug which was ignoring
5623 * IPython/ipmaker.py (make_IPython): Fixed bug which was ignoring
5613 the delimiter removal option (the fix is ugly right now).
5624 the delimiter removal option (the fix is ugly right now).
5614
5625
5615 * IPython/UserConfig/ipythonrc-physics.py: simplified not to load
5626 * IPython/UserConfig/ipythonrc-physics.py: simplified not to load
5616 all of the math profile (quicker loading, no conflict between
5627 all of the math profile (quicker loading, no conflict between
5617 g-9.8 and g-gnuplot).
5628 g-9.8 and g-gnuplot).
5618
5629
5619 * IPython/CrashHandler.py (CrashHandler.__call__): changed default
5630 * IPython/CrashHandler.py (CrashHandler.__call__): changed default
5620 name of post-mortem files to IPython_crash_report.txt.
5631 name of post-mortem files to IPython_crash_report.txt.
5621
5632
5622 * Cleanup/update of the docs. Added all the new readline info and
5633 * Cleanup/update of the docs. Added all the new readline info and
5623 formatted all lists as 'real lists'.
5634 formatted all lists as 'real lists'.
5624
5635
5625 * IPython/ipmaker.py (make_IPython): removed now-obsolete
5636 * IPython/ipmaker.py (make_IPython): removed now-obsolete
5626 tab-completion options, since the full readline parse_and_bind is
5637 tab-completion options, since the full readline parse_and_bind is
5627 now accessible.
5638 now accessible.
5628
5639
5629 * IPython/iplib.py (InteractiveShell.init_readline): Changed
5640 * IPython/iplib.py (InteractiveShell.init_readline): Changed
5630 handling of readline options. Now users can specify any string to
5641 handling of readline options. Now users can specify any string to
5631 be passed to parse_and_bind(), as well as the delimiters to be
5642 be passed to parse_and_bind(), as well as the delimiters to be
5632 removed.
5643 removed.
5633 (InteractiveShell.__init__): Added __name__ to the global
5644 (InteractiveShell.__init__): Added __name__ to the global
5634 namespace so that things like Itpl which rely on its existence
5645 namespace so that things like Itpl which rely on its existence
5635 don't crash.
5646 don't crash.
5636 (InteractiveShell._prefilter): Defined the default with a _ so
5647 (InteractiveShell._prefilter): Defined the default with a _ so
5637 that prefilter() is easier to override, while the default one
5648 that prefilter() is easier to override, while the default one
5638 remains available.
5649 remains available.
5639
5650
5640 2002-04-18 Fernando Perez <fperez@colorado.edu>
5651 2002-04-18 Fernando Perez <fperez@colorado.edu>
5641
5652
5642 * Added information about pdb in the docs.
5653 * Added information about pdb in the docs.
5643
5654
5644 2002-04-17 Fernando Perez <fperez@colorado.edu>
5655 2002-04-17 Fernando Perez <fperez@colorado.edu>
5645
5656
5646 * IPython/ipmaker.py (make_IPython): added rc_override option to
5657 * IPython/ipmaker.py (make_IPython): added rc_override option to
5647 allow passing config options at creation time which may override
5658 allow passing config options at creation time which may override
5648 anything set in the config files or command line. This is
5659 anything set in the config files or command line. This is
5649 particularly useful for configuring embedded instances.
5660 particularly useful for configuring embedded instances.
5650
5661
5651 2002-04-15 Fernando Perez <fperez@colorado.edu>
5662 2002-04-15 Fernando Perez <fperez@colorado.edu>
5652
5663
5653 * IPython/Logger.py (Logger.log): Fixed a nasty bug which could
5664 * IPython/Logger.py (Logger.log): Fixed a nasty bug which could
5654 crash embedded instances because of the input cache falling out of
5665 crash embedded instances because of the input cache falling out of
5655 sync with the output counter.
5666 sync with the output counter.
5656
5667
5657 * IPython/Shell.py (IPythonShellEmbed.__init__): added a debug
5668 * IPython/Shell.py (IPythonShellEmbed.__init__): added a debug
5658 mode which calls pdb after an uncaught exception in IPython itself.
5669 mode which calls pdb after an uncaught exception in IPython itself.
5659
5670
5660 2002-04-14 Fernando Perez <fperez@colorado.edu>
5671 2002-04-14 Fernando Perez <fperez@colorado.edu>
5661
5672
5662 * IPython/iplib.py (InteractiveShell.showtraceback): pdb mucks up
5673 * IPython/iplib.py (InteractiveShell.showtraceback): pdb mucks up
5663 readline, fix it back after each call.
5674 readline, fix it back after each call.
5664
5675
5665 * IPython/ultraTB.py (AutoFormattedTB.__text): made text a private
5676 * IPython/ultraTB.py (AutoFormattedTB.__text): made text a private
5666 method to force all access via __call__(), which guarantees that
5677 method to force all access via __call__(), which guarantees that
5667 traceback references are properly deleted.
5678 traceback references are properly deleted.
5668
5679
5669 * IPython/Prompts.py (CachedOutput._display): minor fixes to
5680 * IPython/Prompts.py (CachedOutput._display): minor fixes to
5670 improve printing when pprint is in use.
5681 improve printing when pprint is in use.
5671
5682
5672 2002-04-13 Fernando Perez <fperez@colorado.edu>
5683 2002-04-13 Fernando Perez <fperez@colorado.edu>
5673
5684
5674 * IPython/Shell.py (IPythonShellEmbed.__call__): SystemExit
5685 * IPython/Shell.py (IPythonShellEmbed.__call__): SystemExit
5675 exceptions aren't caught anymore. If the user triggers one, he
5686 exceptions aren't caught anymore. If the user triggers one, he
5676 should know why he's doing it and it should go all the way up,
5687 should know why he's doing it and it should go all the way up,
5677 just like any other exception. So now @abort will fully kill the
5688 just like any other exception. So now @abort will fully kill the
5678 embedded interpreter and the embedding code (unless that happens
5689 embedded interpreter and the embedding code (unless that happens
5679 to catch SystemExit).
5690 to catch SystemExit).
5680
5691
5681 * IPython/ultraTB.py (VerboseTB.__init__): added a call_pdb flag
5692 * IPython/ultraTB.py (VerboseTB.__init__): added a call_pdb flag
5682 and a debugger() method to invoke the interactive pdb debugger
5693 and a debugger() method to invoke the interactive pdb debugger
5683 after printing exception information. Also added the corresponding
5694 after printing exception information. Also added the corresponding
5684 -pdb option and @pdb magic to control this feature, and updated
5695 -pdb option and @pdb magic to control this feature, and updated
5685 the docs. After a suggestion from Christopher Hart
5696 the docs. After a suggestion from Christopher Hart
5686 (hart-AT-caltech.edu).
5697 (hart-AT-caltech.edu).
5687
5698
5688 2002-04-12 Fernando Perez <fperez@colorado.edu>
5699 2002-04-12 Fernando Perez <fperez@colorado.edu>
5689
5700
5690 * IPython/Shell.py (IPythonShellEmbed.__init__): modified to use
5701 * IPython/Shell.py (IPythonShellEmbed.__init__): modified to use
5691 the exception handlers defined by the user (not the CrashHandler)
5702 the exception handlers defined by the user (not the CrashHandler)
5692 so that user exceptions don't trigger an ipython bug report.
5703 so that user exceptions don't trigger an ipython bug report.
5693
5704
5694 * IPython/ultraTB.py (ColorTB.__init__): made the color scheme
5705 * IPython/ultraTB.py (ColorTB.__init__): made the color scheme
5695 configurable (it should have always been so).
5706 configurable (it should have always been so).
5696
5707
5697 2002-03-26 Fernando Perez <fperez@colorado.edu>
5708 2002-03-26 Fernando Perez <fperez@colorado.edu>
5698
5709
5699 * IPython/Shell.py (IPythonShellEmbed.__call__): many changes here
5710 * IPython/Shell.py (IPythonShellEmbed.__call__): many changes here
5700 and there to fix embedding namespace issues. This should all be
5711 and there to fix embedding namespace issues. This should all be
5701 done in a more elegant way.
5712 done in a more elegant way.
5702
5713
5703 2002-03-25 Fernando Perez <fperez@colorado.edu>
5714 2002-03-25 Fernando Perez <fperez@colorado.edu>
5704
5715
5705 * IPython/genutils.py (get_home_dir): Try to make it work under
5716 * IPython/genutils.py (get_home_dir): Try to make it work under
5706 win9x also.
5717 win9x also.
5707
5718
5708 2002-03-20 Fernando Perez <fperez@colorado.edu>
5719 2002-03-20 Fernando Perez <fperez@colorado.edu>
5709
5720
5710 * IPython/Shell.py (IPythonShellEmbed.__init__): leave
5721 * IPython/Shell.py (IPythonShellEmbed.__init__): leave
5711 sys.displayhook untouched upon __init__.
5722 sys.displayhook untouched upon __init__.
5712
5723
5713 2002-03-19 Fernando Perez <fperez@colorado.edu>
5724 2002-03-19 Fernando Perez <fperez@colorado.edu>
5714
5725
5715 * Released 0.2.9 (for embedding bug, basically).
5726 * Released 0.2.9 (for embedding bug, basically).
5716
5727
5717 * IPython/Shell.py (IPythonShellEmbed.__call__): Trap SystemExit
5728 * IPython/Shell.py (IPythonShellEmbed.__call__): Trap SystemExit
5718 exceptions so that enclosing shell's state can be restored.
5729 exceptions so that enclosing shell's state can be restored.
5719
5730
5720 * Changed magic_gnuplot.py to magic-gnuplot.py to standardize
5731 * Changed magic_gnuplot.py to magic-gnuplot.py to standardize
5721 naming conventions in the .ipython/ dir.
5732 naming conventions in the .ipython/ dir.
5722
5733
5723 * IPython/iplib.py (InteractiveShell.init_readline): removed '-'
5734 * IPython/iplib.py (InteractiveShell.init_readline): removed '-'
5724 from delimiters list so filenames with - in them get expanded.
5735 from delimiters list so filenames with - in them get expanded.
5725
5736
5726 * IPython/Shell.py (IPythonShellEmbed.__call__): fixed bug with
5737 * IPython/Shell.py (IPythonShellEmbed.__call__): fixed bug with
5727 sys.displayhook not being properly restored after an embedded call.
5738 sys.displayhook not being properly restored after an embedded call.
5728
5739
5729 2002-03-18 Fernando Perez <fperez@colorado.edu>
5740 2002-03-18 Fernando Perez <fperez@colorado.edu>
5730
5741
5731 * Released 0.2.8
5742 * Released 0.2.8
5732
5743
5733 * IPython/iplib.py (InteractiveShell.user_setup): fixed bug where
5744 * IPython/iplib.py (InteractiveShell.user_setup): fixed bug where
5734 some files weren't being included in a -upgrade.
5745 some files weren't being included in a -upgrade.
5735 (InteractiveShell.init_readline): Added 'set show-all-if-ambiguous
5746 (InteractiveShell.init_readline): Added 'set show-all-if-ambiguous
5736 on' so that the first tab completes.
5747 on' so that the first tab completes.
5737 (InteractiveShell.handle_magic): fixed bug with spaces around
5748 (InteractiveShell.handle_magic): fixed bug with spaces around
5738 quotes breaking many magic commands.
5749 quotes breaking many magic commands.
5739
5750
5740 * setup.py: added note about ignoring the syntax error messages at
5751 * setup.py: added note about ignoring the syntax error messages at
5741 installation.
5752 installation.
5742
5753
5743 * IPython/UserConfig/magic_gnuplot.py (magic_gp): finished
5754 * IPython/UserConfig/magic_gnuplot.py (magic_gp): finished
5744 streamlining the gnuplot interface, now there's only one magic @gp.
5755 streamlining the gnuplot interface, now there's only one magic @gp.
5745
5756
5746 2002-03-17 Fernando Perez <fperez@colorado.edu>
5757 2002-03-17 Fernando Perez <fperez@colorado.edu>
5747
5758
5748 * IPython/UserConfig/magic_gnuplot.py: new name for the
5759 * IPython/UserConfig/magic_gnuplot.py: new name for the
5749 example-magic_pm.py file. Much enhanced system, now with a shell
5760 example-magic_pm.py file. Much enhanced system, now with a shell
5750 for communicating directly with gnuplot, one command at a time.
5761 for communicating directly with gnuplot, one command at a time.
5751
5762
5752 * IPython/Magic.py (Magic.magic_run): added option -n to prevent
5763 * IPython/Magic.py (Magic.magic_run): added option -n to prevent
5753 setting __name__=='__main__'.
5764 setting __name__=='__main__'.
5754
5765
5755 * IPython/UserConfig/example-magic_pm.py (magic_pm): Added
5766 * IPython/UserConfig/example-magic_pm.py (magic_pm): Added
5756 mini-shell for accessing gnuplot from inside ipython. Should
5767 mini-shell for accessing gnuplot from inside ipython. Should
5757 extend it later for grace access too. Inspired by Arnd's
5768 extend it later for grace access too. Inspired by Arnd's
5758 suggestion.
5769 suggestion.
5759
5770
5760 * IPython/iplib.py (InteractiveShell.handle_magic): fixed bug when
5771 * IPython/iplib.py (InteractiveShell.handle_magic): fixed bug when
5761 calling magic functions with () in their arguments. Thanks to Arnd
5772 calling magic functions with () in their arguments. Thanks to Arnd
5762 Baecker for pointing this to me.
5773 Baecker for pointing this to me.
5763
5774
5764 * IPython/numutils.py (sum_flat): fixed bug. Would recurse
5775 * IPython/numutils.py (sum_flat): fixed bug. Would recurse
5765 infinitely for integer or complex arrays (only worked with floats).
5776 infinitely for integer or complex arrays (only worked with floats).
5766
5777
5767 2002-03-16 Fernando Perez <fperez@colorado.edu>
5778 2002-03-16 Fernando Perez <fperez@colorado.edu>
5768
5779
5769 * setup.py: Merged setup and setup_windows into a single script
5780 * setup.py: Merged setup and setup_windows into a single script
5770 which properly handles things for windows users.
5781 which properly handles things for windows users.
5771
5782
5772 2002-03-15 Fernando Perez <fperez@colorado.edu>
5783 2002-03-15 Fernando Perez <fperez@colorado.edu>
5773
5784
5774 * Big change to the manual: now the magics are all automatically
5785 * Big change to the manual: now the magics are all automatically
5775 documented. This information is generated from their docstrings
5786 documented. This information is generated from their docstrings
5776 and put in a latex file included by the manual lyx file. This way
5787 and put in a latex file included by the manual lyx file. This way
5777 we get always up to date information for the magics. The manual
5788 we get always up to date information for the magics. The manual
5778 now also has proper version information, also auto-synced.
5789 now also has proper version information, also auto-synced.
5779
5790
5780 For this to work, an undocumented --magic_docstrings option was added.
5791 For this to work, an undocumented --magic_docstrings option was added.
5781
5792
5782 2002-03-13 Fernando Perez <fperez@colorado.edu>
5793 2002-03-13 Fernando Perez <fperez@colorado.edu>
5783
5794
5784 * IPython/ultraTB.py (TermColors): fixed problem with dark colors
5795 * IPython/ultraTB.py (TermColors): fixed problem with dark colors
5785 under CDE terminals. An explicit ;2 color reset is needed in the escapes.
5796 under CDE terminals. An explicit ;2 color reset is needed in the escapes.
5786
5797
5787 2002-03-12 Fernando Perez <fperez@colorado.edu>
5798 2002-03-12 Fernando Perez <fperez@colorado.edu>
5788
5799
5789 * IPython/ultraTB.py (TermColors): changed color escapes again to
5800 * IPython/ultraTB.py (TermColors): changed color escapes again to
5790 fix the (old, reintroduced) line-wrapping bug. Basically, if
5801 fix the (old, reintroduced) line-wrapping bug. Basically, if
5791 \001..\002 aren't given in the color escapes, lines get wrapped
5802 \001..\002 aren't given in the color escapes, lines get wrapped
5792 weirdly. But giving those screws up old xterms and emacs terms. So
5803 weirdly. But giving those screws up old xterms and emacs terms. So
5793 I added some logic for emacs terms to be ok, but I can't identify old
5804 I added some logic for emacs terms to be ok, but I can't identify old
5794 xterms separately ($TERM=='xterm' for many terminals, like konsole).
5805 xterms separately ($TERM=='xterm' for many terminals, like konsole).
5795
5806
5796 2002-03-10 Fernando Perez <fperez@colorado.edu>
5807 2002-03-10 Fernando Perez <fperez@colorado.edu>
5797
5808
5798 * IPython/usage.py (__doc__): Various documentation cleanups and
5809 * IPython/usage.py (__doc__): Various documentation cleanups and
5799 updates, both in usage docstrings and in the manual.
5810 updates, both in usage docstrings and in the manual.
5800
5811
5801 * IPython/Prompts.py (CachedOutput.set_colors): cleanups for
5812 * IPython/Prompts.py (CachedOutput.set_colors): cleanups for
5802 handling of caching. Set minimum acceptabe value for having a
5813 handling of caching. Set minimum acceptabe value for having a
5803 cache at 20 values.
5814 cache at 20 values.
5804
5815
5805 * IPython/iplib.py (InteractiveShell.user_setup): moved the
5816 * IPython/iplib.py (InteractiveShell.user_setup): moved the
5806 install_first_time function to a method, renamed it and added an
5817 install_first_time function to a method, renamed it and added an
5807 'upgrade' mode. Now people can update their config directory with
5818 'upgrade' mode. Now people can update their config directory with
5808 a simple command line switch (-upgrade, also new).
5819 a simple command line switch (-upgrade, also new).
5809
5820
5810 * IPython/Magic.py (Magic.magic_pfile): Made @pfile an alias to
5821 * IPython/Magic.py (Magic.magic_pfile): Made @pfile an alias to
5811 @file (convenient for automagic users under Python >= 2.2).
5822 @file (convenient for automagic users under Python >= 2.2).
5812 Removed @files (it seemed more like a plural than an abbrev. of
5823 Removed @files (it seemed more like a plural than an abbrev. of
5813 'file show').
5824 'file show').
5814
5825
5815 * IPython/iplib.py (install_first_time): Fixed crash if there were
5826 * IPython/iplib.py (install_first_time): Fixed crash if there were
5816 backup files ('~') in .ipython/ install directory.
5827 backup files ('~') in .ipython/ install directory.
5817
5828
5818 * IPython/ipmaker.py (make_IPython): fixes for new prompt
5829 * IPython/ipmaker.py (make_IPython): fixes for new prompt
5819 system. Things look fine, but these changes are fairly
5830 system. Things look fine, but these changes are fairly
5820 intrusive. Test them for a few days.
5831 intrusive. Test them for a few days.
5821
5832
5822 * IPython/Prompts.py (CachedOutput.__init__): Massive rewrite of
5833 * IPython/Prompts.py (CachedOutput.__init__): Massive rewrite of
5823 the prompts system. Now all in/out prompt strings are user
5834 the prompts system. Now all in/out prompt strings are user
5824 controllable. This is particularly useful for embedding, as one
5835 controllable. This is particularly useful for embedding, as one
5825 can tag embedded instances with particular prompts.
5836 can tag embedded instances with particular prompts.
5826
5837
5827 Also removed global use of sys.ps1/2, which now allows nested
5838 Also removed global use of sys.ps1/2, which now allows nested
5828 embeddings without any problems. Added command-line options for
5839 embeddings without any problems. Added command-line options for
5829 the prompt strings.
5840 the prompt strings.
5830
5841
5831 2002-03-08 Fernando Perez <fperez@colorado.edu>
5842 2002-03-08 Fernando Perez <fperez@colorado.edu>
5832
5843
5833 * IPython/UserConfig/example-embed-short.py (ipshell): added
5844 * IPython/UserConfig/example-embed-short.py (ipshell): added
5834 example file with the bare minimum code for embedding.
5845 example file with the bare minimum code for embedding.
5835
5846
5836 * IPython/Shell.py (IPythonShellEmbed.set_dummy_mode): added
5847 * IPython/Shell.py (IPythonShellEmbed.set_dummy_mode): added
5837 functionality for the embeddable shell to be activated/deactivated
5848 functionality for the embeddable shell to be activated/deactivated
5838 either globally or at each call.
5849 either globally or at each call.
5839
5850
5840 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixes the problem of
5851 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixes the problem of
5841 rewriting the prompt with '--->' for auto-inputs with proper
5852 rewriting the prompt with '--->' for auto-inputs with proper
5842 coloring. Now the previous UGLY hack in handle_auto() is gone, and
5853 coloring. Now the previous UGLY hack in handle_auto() is gone, and
5843 this is handled by the prompts class itself, as it should.
5854 this is handled by the prompts class itself, as it should.
5844
5855
5845 2002-03-05 Fernando Perez <fperez@colorado.edu>
5856 2002-03-05 Fernando Perez <fperez@colorado.edu>
5846
5857
5847 * IPython/Magic.py (Magic.magic_logstart): Changed @log to
5858 * IPython/Magic.py (Magic.magic_logstart): Changed @log to
5848 @logstart to avoid name clashes with the math log function.
5859 @logstart to avoid name clashes with the math log function.
5849
5860
5850 * Big updates to X/Emacs section of the manual.
5861 * Big updates to X/Emacs section of the manual.
5851
5862
5852 * Removed ipython_emacs. Milan explained to me how to pass
5863 * Removed ipython_emacs. Milan explained to me how to pass
5853 arguments to ipython through Emacs. Some day I'm going to end up
5864 arguments to ipython through Emacs. Some day I'm going to end up
5854 learning some lisp...
5865 learning some lisp...
5855
5866
5856 2002-03-04 Fernando Perez <fperez@colorado.edu>
5867 2002-03-04 Fernando Perez <fperez@colorado.edu>
5857
5868
5858 * IPython/ipython_emacs: Created script to be used as the
5869 * IPython/ipython_emacs: Created script to be used as the
5859 py-python-command Emacs variable so we can pass IPython
5870 py-python-command Emacs variable so we can pass IPython
5860 parameters. I can't figure out how to tell Emacs directly to pass
5871 parameters. I can't figure out how to tell Emacs directly to pass
5861 parameters to IPython, so a dummy shell script will do it.
5872 parameters to IPython, so a dummy shell script will do it.
5862
5873
5863 Other enhancements made for things to work better under Emacs'
5874 Other enhancements made for things to work better under Emacs'
5864 various types of terminals. Many thanks to Milan Zamazal
5875 various types of terminals. Many thanks to Milan Zamazal
5865 <pdm-AT-zamazal.org> for all the suggestions and pointers.
5876 <pdm-AT-zamazal.org> for all the suggestions and pointers.
5866
5877
5867 2002-03-01 Fernando Perez <fperez@colorado.edu>
5878 2002-03-01 Fernando Perez <fperez@colorado.edu>
5868
5879
5869 * IPython/ipmaker.py (make_IPython): added a --readline! option so
5880 * IPython/ipmaker.py (make_IPython): added a --readline! option so
5870 that loading of readline is now optional. This gives better
5881 that loading of readline is now optional. This gives better
5871 control to emacs users.
5882 control to emacs users.
5872
5883
5873 * IPython/ultraTB.py (__date__): Modified color escape sequences
5884 * IPython/ultraTB.py (__date__): Modified color escape sequences
5874 and now things work fine under xterm and in Emacs' term buffers
5885 and now things work fine under xterm and in Emacs' term buffers
5875 (though not shell ones). Well, in emacs you get colors, but all
5886 (though not shell ones). Well, in emacs you get colors, but all
5876 seem to be 'light' colors (no difference between dark and light
5887 seem to be 'light' colors (no difference between dark and light
5877 ones). But the garbage chars are gone, and also in xterms. It
5888 ones). But the garbage chars are gone, and also in xterms. It
5878 seems that now I'm using 'cleaner' ansi sequences.
5889 seems that now I'm using 'cleaner' ansi sequences.
5879
5890
5880 2002-02-21 Fernando Perez <fperez@colorado.edu>
5891 2002-02-21 Fernando Perez <fperez@colorado.edu>
5881
5892
5882 * Released 0.2.7 (mainly to publish the scoping fix).
5893 * Released 0.2.7 (mainly to publish the scoping fix).
5883
5894
5884 * IPython/Logger.py (Logger.logstate): added. A corresponding
5895 * IPython/Logger.py (Logger.logstate): added. A corresponding
5885 @logstate magic was created.
5896 @logstate magic was created.
5886
5897
5887 * IPython/Magic.py: fixed nested scoping problem under Python
5898 * IPython/Magic.py: fixed nested scoping problem under Python
5888 2.1.x (automagic wasn't working).
5899 2.1.x (automagic wasn't working).
5889
5900
5890 2002-02-20 Fernando Perez <fperez@colorado.edu>
5901 2002-02-20 Fernando Perez <fperez@colorado.edu>
5891
5902
5892 * Released 0.2.6.
5903 * Released 0.2.6.
5893
5904
5894 * IPython/OutputTrap.py (OutputTrap.__init__): added a 'quiet'
5905 * IPython/OutputTrap.py (OutputTrap.__init__): added a 'quiet'
5895 option so that logs can come out without any headers at all.
5906 option so that logs can come out without any headers at all.
5896
5907
5897 * IPython/UserConfig/ipythonrc-scipy.py: created a profile for
5908 * IPython/UserConfig/ipythonrc-scipy.py: created a profile for
5898 SciPy.
5909 SciPy.
5899
5910
5900 * IPython/iplib.py (InteractiveShell.embed_mainloop): Changed so
5911 * IPython/iplib.py (InteractiveShell.embed_mainloop): Changed so
5901 that embedded IPython calls don't require vars() to be explicitly
5912 that embedded IPython calls don't require vars() to be explicitly
5902 passed. Now they are extracted from the caller's frame (code
5913 passed. Now they are extracted from the caller's frame (code
5903 snatched from Eric Jones' weave). Added better documentation to
5914 snatched from Eric Jones' weave). Added better documentation to
5904 the section on embedding and the example file.
5915 the section on embedding and the example file.
5905
5916
5906 * IPython/genutils.py (page): Changed so that under emacs, it just
5917 * IPython/genutils.py (page): Changed so that under emacs, it just
5907 prints the string. You can then page up and down in the emacs
5918 prints the string. You can then page up and down in the emacs
5908 buffer itself. This is how the builtin help() works.
5919 buffer itself. This is how the builtin help() works.
5909
5920
5910 * IPython/Prompts.py (CachedOutput.__call__): Fixed issue with
5921 * IPython/Prompts.py (CachedOutput.__call__): Fixed issue with
5911 macro scoping: macros need to be executed in the user's namespace
5922 macro scoping: macros need to be executed in the user's namespace
5912 to work as if they had been typed by the user.
5923 to work as if they had been typed by the user.
5913
5924
5914 * IPython/Magic.py (Magic.magic_macro): Changed macros so they
5925 * IPython/Magic.py (Magic.magic_macro): Changed macros so they
5915 execute automatically (no need to type 'exec...'). They then
5926 execute automatically (no need to type 'exec...'). They then
5916 behave like 'true macros'. The printing system was also modified
5927 behave like 'true macros'. The printing system was also modified
5917 for this to work.
5928 for this to work.
5918
5929
5919 2002-02-19 Fernando Perez <fperez@colorado.edu>
5930 2002-02-19 Fernando Perez <fperez@colorado.edu>
5920
5931
5921 * IPython/genutils.py (page_file): new function for paging files
5932 * IPython/genutils.py (page_file): new function for paging files
5922 in an OS-independent way. Also necessary for file viewing to work
5933 in an OS-independent way. Also necessary for file viewing to work
5923 well inside Emacs buffers.
5934 well inside Emacs buffers.
5924 (page): Added checks for being in an emacs buffer.
5935 (page): Added checks for being in an emacs buffer.
5925 (page): fixed bug for Windows ($TERM isn't set in Windows). Fixed
5936 (page): fixed bug for Windows ($TERM isn't set in Windows). Fixed
5926 same bug in iplib.
5937 same bug in iplib.
5927
5938
5928 2002-02-18 Fernando Perez <fperez@colorado.edu>
5939 2002-02-18 Fernando Perez <fperez@colorado.edu>
5929
5940
5930 * IPython/iplib.py (InteractiveShell.init_readline): modified use
5941 * IPython/iplib.py (InteractiveShell.init_readline): modified use
5931 of readline so that IPython can work inside an Emacs buffer.
5942 of readline so that IPython can work inside an Emacs buffer.
5932
5943
5933 * IPython/ultraTB.py (AutoFormattedTB.__call__): some fixes to
5944 * IPython/ultraTB.py (AutoFormattedTB.__call__): some fixes to
5934 method signatures (they weren't really bugs, but it looks cleaner
5945 method signatures (they weren't really bugs, but it looks cleaner
5935 and keeps PyChecker happy).
5946 and keeps PyChecker happy).
5936
5947
5937 * IPython/ipmaker.py (make_IPython): added hooks Struct to __IP
5948 * IPython/ipmaker.py (make_IPython): added hooks Struct to __IP
5938 for implementing various user-defined hooks. Currently only
5949 for implementing various user-defined hooks. Currently only
5939 display is done.
5950 display is done.
5940
5951
5941 * IPython/Prompts.py (CachedOutput._display): changed display
5952 * IPython/Prompts.py (CachedOutput._display): changed display
5942 functions so that they can be dynamically changed by users easily.
5953 functions so that they can be dynamically changed by users easily.
5943
5954
5944 * IPython/Extensions/numeric_formats.py (num_display): added an
5955 * IPython/Extensions/numeric_formats.py (num_display): added an
5945 extension for printing NumPy arrays in flexible manners. It
5956 extension for printing NumPy arrays in flexible manners. It
5946 doesn't do anything yet, but all the structure is in
5957 doesn't do anything yet, but all the structure is in
5947 place. Ultimately the plan is to implement output format control
5958 place. Ultimately the plan is to implement output format control
5948 like in Octave.
5959 like in Octave.
5949
5960
5950 * IPython/Magic.py (Magic.lsmagic): changed so that bound magic
5961 * IPython/Magic.py (Magic.lsmagic): changed so that bound magic
5951 methods are found at run-time by all the automatic machinery.
5962 methods are found at run-time by all the automatic machinery.
5952
5963
5953 2002-02-17 Fernando Perez <fperez@colorado.edu>
5964 2002-02-17 Fernando Perez <fperez@colorado.edu>
5954
5965
5955 * setup_Windows.py (make_shortcut): documented. Cleaned up the
5966 * setup_Windows.py (make_shortcut): documented. Cleaned up the
5956 whole file a little.
5967 whole file a little.
5957
5968
5958 * ToDo: closed this document. Now there's a new_design.lyx
5969 * ToDo: closed this document. Now there's a new_design.lyx
5959 document for all new ideas. Added making a pdf of it for the
5970 document for all new ideas. Added making a pdf of it for the
5960 end-user distro.
5971 end-user distro.
5961
5972
5962 * IPython/Logger.py (Logger.switch_log): Created this to replace
5973 * IPython/Logger.py (Logger.switch_log): Created this to replace
5963 logon() and logoff(). It also fixes a nasty crash reported by
5974 logon() and logoff(). It also fixes a nasty crash reported by
5964 Philip Hisley <compsys-AT-starpower.net>. Many thanks to him.
5975 Philip Hisley <compsys-AT-starpower.net>. Many thanks to him.
5965
5976
5966 * IPython/iplib.py (complete): got auto-completion to work with
5977 * IPython/iplib.py (complete): got auto-completion to work with
5967 automagic (I had wanted this for a long time).
5978 automagic (I had wanted this for a long time).
5968
5979
5969 * IPython/Magic.py (Magic.magic_files): Added @files as an alias
5980 * IPython/Magic.py (Magic.magic_files): Added @files as an alias
5970 to @file, since file() is now a builtin and clashes with automagic
5981 to @file, since file() is now a builtin and clashes with automagic
5971 for @file.
5982 for @file.
5972
5983
5973 * Made some new files: Prompts, CrashHandler, Magic, Logger. All
5984 * Made some new files: Prompts, CrashHandler, Magic, Logger. All
5974 of this was previously in iplib, which had grown to more than 2000
5985 of this was previously in iplib, which had grown to more than 2000
5975 lines, way too long. No new functionality, but it makes managing
5986 lines, way too long. No new functionality, but it makes managing
5976 the code a bit easier.
5987 the code a bit easier.
5977
5988
5978 * IPython/iplib.py (IPythonCrashHandler.__call__): Added version
5989 * IPython/iplib.py (IPythonCrashHandler.__call__): Added version
5979 information to crash reports.
5990 information to crash reports.
5980
5991
5981 2002-02-12 Fernando Perez <fperez@colorado.edu>
5992 2002-02-12 Fernando Perez <fperez@colorado.edu>
5982
5993
5983 * Released 0.2.5.
5994 * Released 0.2.5.
5984
5995
5985 2002-02-11 Fernando Perez <fperez@colorado.edu>
5996 2002-02-11 Fernando Perez <fperez@colorado.edu>
5986
5997
5987 * Wrote a relatively complete Windows installer. It puts
5998 * Wrote a relatively complete Windows installer. It puts
5988 everything in place, creates Start Menu entries and fixes the
5999 everything in place, creates Start Menu entries and fixes the
5989 color issues. Nothing fancy, but it works.
6000 color issues. Nothing fancy, but it works.
5990
6001
5991 2002-02-10 Fernando Perez <fperez@colorado.edu>
6002 2002-02-10 Fernando Perez <fperez@colorado.edu>
5992
6003
5993 * IPython/iplib.py (InteractiveShell.safe_execfile): added an
6004 * IPython/iplib.py (InteractiveShell.safe_execfile): added an
5994 os.path.expanduser() call so that we can type @run ~/myfile.py and
6005 os.path.expanduser() call so that we can type @run ~/myfile.py and
5995 have thigs work as expected.
6006 have thigs work as expected.
5996
6007
5997 * IPython/genutils.py (page): fixed exception handling so things
6008 * IPython/genutils.py (page): fixed exception handling so things
5998 work both in Unix and Windows correctly. Quitting a pager triggers
6009 work both in Unix and Windows correctly. Quitting a pager triggers
5999 an IOError/broken pipe in Unix, and in windows not finding a pager
6010 an IOError/broken pipe in Unix, and in windows not finding a pager
6000 is also an IOError, so I had to actually look at the return value
6011 is also an IOError, so I had to actually look at the return value
6001 of the exception, not just the exception itself. Should be ok now.
6012 of the exception, not just the exception itself. Should be ok now.
6002
6013
6003 * IPython/ultraTB.py (ColorSchemeTable.set_active_scheme):
6014 * IPython/ultraTB.py (ColorSchemeTable.set_active_scheme):
6004 modified to allow case-insensitive color scheme changes.
6015 modified to allow case-insensitive color scheme changes.
6005
6016
6006 2002-02-09 Fernando Perez <fperez@colorado.edu>
6017 2002-02-09 Fernando Perez <fperez@colorado.edu>
6007
6018
6008 * IPython/genutils.py (native_line_ends): new function to leave
6019 * IPython/genutils.py (native_line_ends): new function to leave
6009 user config files with os-native line-endings.
6020 user config files with os-native line-endings.
6010
6021
6011 * README and manual updates.
6022 * README and manual updates.
6012
6023
6013 * IPython/genutils.py: fixed unicode bug: use types.StringTypes
6024 * IPython/genutils.py: fixed unicode bug: use types.StringTypes
6014 instead of StringType to catch Unicode strings.
6025 instead of StringType to catch Unicode strings.
6015
6026
6016 * IPython/genutils.py (filefind): fixed bug for paths with
6027 * IPython/genutils.py (filefind): fixed bug for paths with
6017 embedded spaces (very common in Windows).
6028 embedded spaces (very common in Windows).
6018
6029
6019 * IPython/ipmaker.py (make_IPython): added a '.ini' to the rc
6030 * IPython/ipmaker.py (make_IPython): added a '.ini' to the rc
6020 files under Windows, so that they get automatically associated
6031 files under Windows, so that they get automatically associated
6021 with a text editor. Windows makes it a pain to handle
6032 with a text editor. Windows makes it a pain to handle
6022 extension-less files.
6033 extension-less files.
6023
6034
6024 * IPython/iplib.py (InteractiveShell.init_readline): Made the
6035 * IPython/iplib.py (InteractiveShell.init_readline): Made the
6025 warning about readline only occur for Posix. In Windows there's no
6036 warning about readline only occur for Posix. In Windows there's no
6026 way to get readline, so why bother with the warning.
6037 way to get readline, so why bother with the warning.
6027
6038
6028 * IPython/Struct.py (Struct.__str__): fixed to use self.__dict__
6039 * IPython/Struct.py (Struct.__str__): fixed to use self.__dict__
6029 for __str__ instead of dir(self), since dir() changed in 2.2.
6040 for __str__ instead of dir(self), since dir() changed in 2.2.
6030
6041
6031 * Ported to Windows! Tested on XP, I suspect it should work fine
6042 * Ported to Windows! Tested on XP, I suspect it should work fine
6032 on NT/2000, but I don't think it will work on 98 et al. That
6043 on NT/2000, but I don't think it will work on 98 et al. That
6033 series of Windows is such a piece of junk anyway that I won't try
6044 series of Windows is such a piece of junk anyway that I won't try
6034 porting it there. The XP port was straightforward, showed a few
6045 porting it there. The XP port was straightforward, showed a few
6035 bugs here and there (fixed all), in particular some string
6046 bugs here and there (fixed all), in particular some string
6036 handling stuff which required considering Unicode strings (which
6047 handling stuff which required considering Unicode strings (which
6037 Windows uses). This is good, but hasn't been too tested :) No
6048 Windows uses). This is good, but hasn't been too tested :) No
6038 fancy installer yet, I'll put a note in the manual so people at
6049 fancy installer yet, I'll put a note in the manual so people at
6039 least make manually a shortcut.
6050 least make manually a shortcut.
6040
6051
6041 * IPython/iplib.py (Magic.magic_colors): Unified the color options
6052 * IPython/iplib.py (Magic.magic_colors): Unified the color options
6042 into a single one, "colors". This now controls both prompt and
6053 into a single one, "colors". This now controls both prompt and
6043 exception color schemes, and can be changed both at startup
6054 exception color schemes, and can be changed both at startup
6044 (either via command-line switches or via ipythonrc files) and at
6055 (either via command-line switches or via ipythonrc files) and at
6045 runtime, with @colors.
6056 runtime, with @colors.
6046 (Magic.magic_run): renamed @prun to @run and removed the old
6057 (Magic.magic_run): renamed @prun to @run and removed the old
6047 @run. The two were too similar to warrant keeping both.
6058 @run. The two were too similar to warrant keeping both.
6048
6059
6049 2002-02-03 Fernando Perez <fperez@colorado.edu>
6060 2002-02-03 Fernando Perez <fperez@colorado.edu>
6050
6061
6051 * IPython/iplib.py (install_first_time): Added comment on how to
6062 * IPython/iplib.py (install_first_time): Added comment on how to
6052 configure the color options for first-time users. Put a <return>
6063 configure the color options for first-time users. Put a <return>
6053 request at the end so that small-terminal users get a chance to
6064 request at the end so that small-terminal users get a chance to
6054 read the startup info.
6065 read the startup info.
6055
6066
6056 2002-01-23 Fernando Perez <fperez@colorado.edu>
6067 2002-01-23 Fernando Perez <fperez@colorado.edu>
6057
6068
6058 * IPython/iplib.py (CachedOutput.update): Changed output memory
6069 * IPython/iplib.py (CachedOutput.update): Changed output memory
6059 variable names from _o,_oo,_ooo,_o<n> to simply _,__,___,_<n>. For
6070 variable names from _o,_oo,_ooo,_o<n> to simply _,__,___,_<n>. For
6060 input history we still use _i. Did this b/c these variable are
6071 input history we still use _i. Did this b/c these variable are
6061 very commonly used in interactive work, so the less we need to
6072 very commonly used in interactive work, so the less we need to
6062 type the better off we are.
6073 type the better off we are.
6063 (Magic.magic_prun): updated @prun to better handle the namespaces
6074 (Magic.magic_prun): updated @prun to better handle the namespaces
6064 the file will run in, including a fix for __name__ not being set
6075 the file will run in, including a fix for __name__ not being set
6065 before.
6076 before.
6066
6077
6067 2002-01-20 Fernando Perez <fperez@colorado.edu>
6078 2002-01-20 Fernando Perez <fperez@colorado.edu>
6068
6079
6069 * IPython/ultraTB.py (VerboseTB.linereader): Fixed printing of
6080 * IPython/ultraTB.py (VerboseTB.linereader): Fixed printing of
6070 extra garbage for Python 2.2. Need to look more carefully into
6081 extra garbage for Python 2.2. Need to look more carefully into
6071 this later.
6082 this later.
6072
6083
6073 2002-01-19 Fernando Perez <fperez@colorado.edu>
6084 2002-01-19 Fernando Perez <fperez@colorado.edu>
6074
6085
6075 * IPython/iplib.py (InteractiveShell.showtraceback): fixed to
6086 * IPython/iplib.py (InteractiveShell.showtraceback): fixed to
6076 display SyntaxError exceptions properly formatted when they occur
6087 display SyntaxError exceptions properly formatted when they occur
6077 (they can be triggered by imported code).
6088 (they can be triggered by imported code).
6078
6089
6079 2002-01-18 Fernando Perez <fperez@colorado.edu>
6090 2002-01-18 Fernando Perez <fperez@colorado.edu>
6080
6091
6081 * IPython/iplib.py (InteractiveShell.safe_execfile): now
6092 * IPython/iplib.py (InteractiveShell.safe_execfile): now
6082 SyntaxError exceptions are reported nicely formatted, instead of
6093 SyntaxError exceptions are reported nicely formatted, instead of
6083 spitting out only offset information as before.
6094 spitting out only offset information as before.
6084 (Magic.magic_prun): Added the @prun function for executing
6095 (Magic.magic_prun): Added the @prun function for executing
6085 programs with command line args inside IPython.
6096 programs with command line args inside IPython.
6086
6097
6087 2002-01-16 Fernando Perez <fperez@colorado.edu>
6098 2002-01-16 Fernando Perez <fperez@colorado.edu>
6088
6099
6089 * IPython/iplib.py (Magic.magic_hist): Changed @hist and @dhist
6100 * IPython/iplib.py (Magic.magic_hist): Changed @hist and @dhist
6090 to *not* include the last item given in a range. This brings their
6101 to *not* include the last item given in a range. This brings their
6091 behavior in line with Python's slicing:
6102 behavior in line with Python's slicing:
6092 a[n1:n2] -> a[n1]...a[n2-1]
6103 a[n1:n2] -> a[n1]...a[n2-1]
6093 It may be a bit less convenient, but I prefer to stick to Python's
6104 It may be a bit less convenient, but I prefer to stick to Python's
6094 conventions *everywhere*, so users never have to wonder.
6105 conventions *everywhere*, so users never have to wonder.
6095 (Magic.magic_macro): Added @macro function to ease the creation of
6106 (Magic.magic_macro): Added @macro function to ease the creation of
6096 macros.
6107 macros.
6097
6108
6098 2002-01-05 Fernando Perez <fperez@colorado.edu>
6109 2002-01-05 Fernando Perez <fperez@colorado.edu>
6099
6110
6100 * Released 0.2.4.
6111 * Released 0.2.4.
6101
6112
6102 * IPython/iplib.py (Magic.magic_pdef):
6113 * IPython/iplib.py (Magic.magic_pdef):
6103 (InteractiveShell.safe_execfile): report magic lines and error
6114 (InteractiveShell.safe_execfile): report magic lines and error
6104 lines without line numbers so one can easily copy/paste them for
6115 lines without line numbers so one can easily copy/paste them for
6105 re-execution.
6116 re-execution.
6106
6117
6107 * Updated manual with recent changes.
6118 * Updated manual with recent changes.
6108
6119
6109 * IPython/iplib.py (Magic.magic_oinfo): added constructor
6120 * IPython/iplib.py (Magic.magic_oinfo): added constructor
6110 docstring printing when class? is called. Very handy for knowing
6121 docstring printing when class? is called. Very handy for knowing
6111 how to create class instances (as long as __init__ is well
6122 how to create class instances (as long as __init__ is well
6112 documented, of course :)
6123 documented, of course :)
6113 (Magic.magic_doc): print both class and constructor docstrings.
6124 (Magic.magic_doc): print both class and constructor docstrings.
6114 (Magic.magic_pdef): give constructor info if passed a class and
6125 (Magic.magic_pdef): give constructor info if passed a class and
6115 __call__ info for callable object instances.
6126 __call__ info for callable object instances.
6116
6127
6117 2002-01-04 Fernando Perez <fperez@colorado.edu>
6128 2002-01-04 Fernando Perez <fperez@colorado.edu>
6118
6129
6119 * Made deep_reload() off by default. It doesn't always work
6130 * Made deep_reload() off by default. It doesn't always work
6120 exactly as intended, so it's probably safer to have it off. It's
6131 exactly as intended, so it's probably safer to have it off. It's
6121 still available as dreload() anyway, so nothing is lost.
6132 still available as dreload() anyway, so nothing is lost.
6122
6133
6123 2002-01-02 Fernando Perez <fperez@colorado.edu>
6134 2002-01-02 Fernando Perez <fperez@colorado.edu>
6124
6135
6125 * Released 0.2.3 (contacted R.Singh at CU about biopython course,
6136 * Released 0.2.3 (contacted R.Singh at CU about biopython course,
6126 so I wanted an updated release).
6137 so I wanted an updated release).
6127
6138
6128 2001-12-27 Fernando Perez <fperez@colorado.edu>
6139 2001-12-27 Fernando Perez <fperez@colorado.edu>
6129
6140
6130 * IPython/iplib.py (InteractiveShell.interact): Added the original
6141 * IPython/iplib.py (InteractiveShell.interact): Added the original
6131 code from 'code.py' for this module in order to change the
6142 code from 'code.py' for this module in order to change the
6132 handling of a KeyboardInterrupt. This was necessary b/c otherwise
6143 handling of a KeyboardInterrupt. This was necessary b/c otherwise
6133 the history cache would break when the user hit Ctrl-C, and
6144 the history cache would break when the user hit Ctrl-C, and
6134 interact() offers no way to add any hooks to it.
6145 interact() offers no way to add any hooks to it.
6135
6146
6136 2001-12-23 Fernando Perez <fperez@colorado.edu>
6147 2001-12-23 Fernando Perez <fperez@colorado.edu>
6137
6148
6138 * setup.py: added check for 'MANIFEST' before trying to remove
6149 * setup.py: added check for 'MANIFEST' before trying to remove
6139 it. Thanks to Sean Reifschneider.
6150 it. Thanks to Sean Reifschneider.
6140
6151
6141 2001-12-22 Fernando Perez <fperez@colorado.edu>
6152 2001-12-22 Fernando Perez <fperez@colorado.edu>
6142
6153
6143 * Released 0.2.2.
6154 * Released 0.2.2.
6144
6155
6145 * Finished (reasonably) writing the manual. Later will add the
6156 * Finished (reasonably) writing the manual. Later will add the
6146 python-standard navigation stylesheets, but for the time being
6157 python-standard navigation stylesheets, but for the time being
6147 it's fairly complete. Distribution will include html and pdf
6158 it's fairly complete. Distribution will include html and pdf
6148 versions.
6159 versions.
6149
6160
6150 * Bugfix: '.' wasn't being added to sys.path. Thanks to Prabhu
6161 * Bugfix: '.' wasn't being added to sys.path. Thanks to Prabhu
6151 (MayaVi author).
6162 (MayaVi author).
6152
6163
6153 2001-12-21 Fernando Perez <fperez@colorado.edu>
6164 2001-12-21 Fernando Perez <fperez@colorado.edu>
6154
6165
6155 * Released 0.2.1. Barring any nasty bugs, this is it as far as a
6166 * Released 0.2.1. Barring any nasty bugs, this is it as far as a
6156 good public release, I think (with the manual and the distutils
6167 good public release, I think (with the manual and the distutils
6157 installer). The manual can use some work, but that can go
6168 installer). The manual can use some work, but that can go
6158 slowly. Otherwise I think it's quite nice for end users. Next
6169 slowly. Otherwise I think it's quite nice for end users. Next
6159 summer, rewrite the guts of it...
6170 summer, rewrite the guts of it...
6160
6171
6161 * Changed format of ipythonrc files to use whitespace as the
6172 * Changed format of ipythonrc files to use whitespace as the
6162 separator instead of an explicit '='. Cleaner.
6173 separator instead of an explicit '='. Cleaner.
6163
6174
6164 2001-12-20 Fernando Perez <fperez@colorado.edu>
6175 2001-12-20 Fernando Perez <fperez@colorado.edu>
6165
6176
6166 * Started a manual in LyX. For now it's just a quick merge of the
6177 * Started a manual in LyX. For now it's just a quick merge of the
6167 various internal docstrings and READMEs. Later it may grow into a
6178 various internal docstrings and READMEs. Later it may grow into a
6168 nice, full-blown manual.
6179 nice, full-blown manual.
6169
6180
6170 * Set up a distutils based installer. Installation should now be
6181 * Set up a distutils based installer. Installation should now be
6171 trivially simple for end-users.
6182 trivially simple for end-users.
6172
6183
6173 2001-12-11 Fernando Perez <fperez@colorado.edu>
6184 2001-12-11 Fernando Perez <fperez@colorado.edu>
6174
6185
6175 * Released 0.2.0. First public release, announced it at
6186 * Released 0.2.0. First public release, announced it at
6176 comp.lang.python. From now on, just bugfixes...
6187 comp.lang.python. From now on, just bugfixes...
6177
6188
6178 * Went through all the files, set copyright/license notices and
6189 * Went through all the files, set copyright/license notices and
6179 cleaned up things. Ready for release.
6190 cleaned up things. Ready for release.
6180
6191
6181 2001-12-10 Fernando Perez <fperez@colorado.edu>
6192 2001-12-10 Fernando Perez <fperez@colorado.edu>
6182
6193
6183 * Changed the first-time installer not to use tarfiles. It's more
6194 * Changed the first-time installer not to use tarfiles. It's more
6184 robust now and less unix-dependent. Also makes it easier for
6195 robust now and less unix-dependent. Also makes it easier for
6185 people to later upgrade versions.
6196 people to later upgrade versions.
6186
6197
6187 * Changed @exit to @abort to reflect the fact that it's pretty
6198 * Changed @exit to @abort to reflect the fact that it's pretty
6188 brutal (a sys.exit()). The difference between @abort and Ctrl-D
6199 brutal (a sys.exit()). The difference between @abort and Ctrl-D
6189 becomes significant only when IPyhton is embedded: in that case,
6200 becomes significant only when IPyhton is embedded: in that case,
6190 C-D closes IPython only, but @abort kills the enclosing program
6201 C-D closes IPython only, but @abort kills the enclosing program
6191 too (unless it had called IPython inside a try catching
6202 too (unless it had called IPython inside a try catching
6192 SystemExit).
6203 SystemExit).
6193
6204
6194 * Created Shell module which exposes the actuall IPython Shell
6205 * Created Shell module which exposes the actuall IPython Shell
6195 classes, currently the normal and the embeddable one. This at
6206 classes, currently the normal and the embeddable one. This at
6196 least offers a stable interface we won't need to change when
6207 least offers a stable interface we won't need to change when
6197 (later) the internals are rewritten. That rewrite will be confined
6208 (later) the internals are rewritten. That rewrite will be confined
6198 to iplib and ipmaker, but the Shell interface should remain as is.
6209 to iplib and ipmaker, but the Shell interface should remain as is.
6199
6210
6200 * Added embed module which offers an embeddable IPShell object,
6211 * Added embed module which offers an embeddable IPShell object,
6201 useful to fire up IPython *inside* a running program. Great for
6212 useful to fire up IPython *inside* a running program. Great for
6202 debugging or dynamical data analysis.
6213 debugging or dynamical data analysis.
6203
6214
6204 2001-12-08 Fernando Perez <fperez@colorado.edu>
6215 2001-12-08 Fernando Perez <fperez@colorado.edu>
6205
6216
6206 * Fixed small bug preventing seeing info from methods of defined
6217 * Fixed small bug preventing seeing info from methods of defined
6207 objects (incorrect namespace in _ofind()).
6218 objects (incorrect namespace in _ofind()).
6208
6219
6209 * Documentation cleanup. Moved the main usage docstrings to a
6220 * Documentation cleanup. Moved the main usage docstrings to a
6210 separate file, usage.py (cleaner to maintain, and hopefully in the
6221 separate file, usage.py (cleaner to maintain, and hopefully in the
6211 future some perlpod-like way of producing interactive, man and
6222 future some perlpod-like way of producing interactive, man and
6212 html docs out of it will be found).
6223 html docs out of it will be found).
6213
6224
6214 * Added @profile to see your profile at any time.
6225 * Added @profile to see your profile at any time.
6215
6226
6216 * Added @p as an alias for 'print'. It's especially convenient if
6227 * Added @p as an alias for 'print'. It's especially convenient if
6217 using automagic ('p x' prints x).
6228 using automagic ('p x' prints x).
6218
6229
6219 * Small cleanups and fixes after a pychecker run.
6230 * Small cleanups and fixes after a pychecker run.
6220
6231
6221 * Changed the @cd command to handle @cd - and @cd -<n> for
6232 * Changed the @cd command to handle @cd - and @cd -<n> for
6222 visiting any directory in _dh.
6233 visiting any directory in _dh.
6223
6234
6224 * Introduced _dh, a history of visited directories. @dhist prints
6235 * Introduced _dh, a history of visited directories. @dhist prints
6225 it out with numbers.
6236 it out with numbers.
6226
6237
6227 2001-12-07 Fernando Perez <fperez@colorado.edu>
6238 2001-12-07 Fernando Perez <fperez@colorado.edu>
6228
6239
6229 * Released 0.1.22
6240 * Released 0.1.22
6230
6241
6231 * Made initialization a bit more robust against invalid color
6242 * Made initialization a bit more robust against invalid color
6232 options in user input (exit, not traceback-crash).
6243 options in user input (exit, not traceback-crash).
6233
6244
6234 * Changed the bug crash reporter to write the report only in the
6245 * Changed the bug crash reporter to write the report only in the
6235 user's .ipython directory. That way IPython won't litter people's
6246 user's .ipython directory. That way IPython won't litter people's
6236 hard disks with crash files all over the place. Also print on
6247 hard disks with crash files all over the place. Also print on
6237 screen the necessary mail command.
6248 screen the necessary mail command.
6238
6249
6239 * With the new ultraTB, implemented LightBG color scheme for light
6250 * With the new ultraTB, implemented LightBG color scheme for light
6240 background terminals. A lot of people like white backgrounds, so I
6251 background terminals. A lot of people like white backgrounds, so I
6241 guess we should at least give them something readable.
6252 guess we should at least give them something readable.
6242
6253
6243 2001-12-06 Fernando Perez <fperez@colorado.edu>
6254 2001-12-06 Fernando Perez <fperez@colorado.edu>
6244
6255
6245 * Modified the structure of ultraTB. Now there's a proper class
6256 * Modified the structure of ultraTB. Now there's a proper class
6246 for tables of color schemes which allow adding schemes easily and
6257 for tables of color schemes which allow adding schemes easily and
6247 switching the active scheme without creating a new instance every
6258 switching the active scheme without creating a new instance every
6248 time (which was ridiculous). The syntax for creating new schemes
6259 time (which was ridiculous). The syntax for creating new schemes
6249 is also cleaner. I think ultraTB is finally done, with a clean
6260 is also cleaner. I think ultraTB is finally done, with a clean
6250 class structure. Names are also much cleaner (now there's proper
6261 class structure. Names are also much cleaner (now there's proper
6251 color tables, no need for every variable to also have 'color' in
6262 color tables, no need for every variable to also have 'color' in
6252 its name).
6263 its name).
6253
6264
6254 * Broke down genutils into separate files. Now genutils only
6265 * Broke down genutils into separate files. Now genutils only
6255 contains utility functions, and classes have been moved to their
6266 contains utility functions, and classes have been moved to their
6256 own files (they had enough independent functionality to warrant
6267 own files (they had enough independent functionality to warrant
6257 it): ConfigLoader, OutputTrap, Struct.
6268 it): ConfigLoader, OutputTrap, Struct.
6258
6269
6259 2001-12-05 Fernando Perez <fperez@colorado.edu>
6270 2001-12-05 Fernando Perez <fperez@colorado.edu>
6260
6271
6261 * IPython turns 21! Released version 0.1.21, as a candidate for
6272 * IPython turns 21! Released version 0.1.21, as a candidate for
6262 public consumption. If all goes well, release in a few days.
6273 public consumption. If all goes well, release in a few days.
6263
6274
6264 * Fixed path bug (files in Extensions/ directory wouldn't be found
6275 * Fixed path bug (files in Extensions/ directory wouldn't be found
6265 unless IPython/ was explicitly in sys.path).
6276 unless IPython/ was explicitly in sys.path).
6266
6277
6267 * Extended the FlexCompleter class as MagicCompleter to allow
6278 * Extended the FlexCompleter class as MagicCompleter to allow
6268 completion of @-starting lines.
6279 completion of @-starting lines.
6269
6280
6270 * Created __release__.py file as a central repository for release
6281 * Created __release__.py file as a central repository for release
6271 info that other files can read from.
6282 info that other files can read from.
6272
6283
6273 * Fixed small bug in logging: when logging was turned on in
6284 * Fixed small bug in logging: when logging was turned on in
6274 mid-session, old lines with special meanings (!@?) were being
6285 mid-session, old lines with special meanings (!@?) were being
6275 logged without the prepended comment, which is necessary since
6286 logged without the prepended comment, which is necessary since
6276 they are not truly valid python syntax. This should make session
6287 they are not truly valid python syntax. This should make session
6277 restores produce less errors.
6288 restores produce less errors.
6278
6289
6279 * The namespace cleanup forced me to make a FlexCompleter class
6290 * The namespace cleanup forced me to make a FlexCompleter class
6280 which is nothing but a ripoff of rlcompleter, but with selectable
6291 which is nothing but a ripoff of rlcompleter, but with selectable
6281 namespace (rlcompleter only works in __main__.__dict__). I'll try
6292 namespace (rlcompleter only works in __main__.__dict__). I'll try
6282 to submit a note to the authors to see if this change can be
6293 to submit a note to the authors to see if this change can be
6283 incorporated in future rlcompleter releases (Dec.6: done)
6294 incorporated in future rlcompleter releases (Dec.6: done)
6284
6295
6285 * More fixes to namespace handling. It was a mess! Now all
6296 * More fixes to namespace handling. It was a mess! Now all
6286 explicit references to __main__.__dict__ are gone (except when
6297 explicit references to __main__.__dict__ are gone (except when
6287 really needed) and everything is handled through the namespace
6298 really needed) and everything is handled through the namespace
6288 dicts in the IPython instance. We seem to be getting somewhere
6299 dicts in the IPython instance. We seem to be getting somewhere
6289 with this, finally...
6300 with this, finally...
6290
6301
6291 * Small documentation updates.
6302 * Small documentation updates.
6292
6303
6293 * Created the Extensions directory under IPython (with an
6304 * Created the Extensions directory under IPython (with an
6294 __init__.py). Put the PhysicalQ stuff there. This directory should
6305 __init__.py). Put the PhysicalQ stuff there. This directory should
6295 be used for all special-purpose extensions.
6306 be used for all special-purpose extensions.
6296
6307
6297 * File renaming:
6308 * File renaming:
6298 ipythonlib --> ipmaker
6309 ipythonlib --> ipmaker
6299 ipplib --> iplib
6310 ipplib --> iplib
6300 This makes a bit more sense in terms of what these files actually do.
6311 This makes a bit more sense in terms of what these files actually do.
6301
6312
6302 * Moved all the classes and functions in ipythonlib to ipplib, so
6313 * Moved all the classes and functions in ipythonlib to ipplib, so
6303 now ipythonlib only has make_IPython(). This will ease up its
6314 now ipythonlib only has make_IPython(). This will ease up its
6304 splitting in smaller functional chunks later.
6315 splitting in smaller functional chunks later.
6305
6316
6306 * Cleaned up (done, I think) output of @whos. Better column
6317 * Cleaned up (done, I think) output of @whos. Better column
6307 formatting, and now shows str(var) for as much as it can, which is
6318 formatting, and now shows str(var) for as much as it can, which is
6308 typically what one gets with a 'print var'.
6319 typically what one gets with a 'print var'.
6309
6320
6310 2001-12-04 Fernando Perez <fperez@colorado.edu>
6321 2001-12-04 Fernando Perez <fperez@colorado.edu>
6311
6322
6312 * Fixed namespace problems. Now builtin/IPyhton/user names get
6323 * Fixed namespace problems. Now builtin/IPyhton/user names get
6313 properly reported in their namespace. Internal namespace handling
6324 properly reported in their namespace. Internal namespace handling
6314 is finally getting decent (not perfect yet, but much better than
6325 is finally getting decent (not perfect yet, but much better than
6315 the ad-hoc mess we had).
6326 the ad-hoc mess we had).
6316
6327
6317 * Removed -exit option. If people just want to run a python
6328 * Removed -exit option. If people just want to run a python
6318 script, that's what the normal interpreter is for. Less
6329 script, that's what the normal interpreter is for. Less
6319 unnecessary options, less chances for bugs.
6330 unnecessary options, less chances for bugs.
6320
6331
6321 * Added a crash handler which generates a complete post-mortem if
6332 * Added a crash handler which generates a complete post-mortem if
6322 IPython crashes. This will help a lot in tracking bugs down the
6333 IPython crashes. This will help a lot in tracking bugs down the
6323 road.
6334 road.
6324
6335
6325 * Fixed nasty bug in auto-evaluation part of prefilter(). Names
6336 * Fixed nasty bug in auto-evaluation part of prefilter(). Names
6326 which were boud to functions being reassigned would bypass the
6337 which were boud to functions being reassigned would bypass the
6327 logger, breaking the sync of _il with the prompt counter. This
6338 logger, breaking the sync of _il with the prompt counter. This
6328 would then crash IPython later when a new line was logged.
6339 would then crash IPython later when a new line was logged.
6329
6340
6330 2001-12-02 Fernando Perez <fperez@colorado.edu>
6341 2001-12-02 Fernando Perez <fperez@colorado.edu>
6331
6342
6332 * Made IPython a package. This means people don't have to clutter
6343 * Made IPython a package. This means people don't have to clutter
6333 their sys.path with yet another directory. Changed the INSTALL
6344 their sys.path with yet another directory. Changed the INSTALL
6334 file accordingly.
6345 file accordingly.
6335
6346
6336 * Cleaned up the output of @who_ls, @who and @whos. @who_ls now
6347 * Cleaned up the output of @who_ls, @who and @whos. @who_ls now
6337 sorts its output (so @who shows it sorted) and @whos formats the
6348 sorts its output (so @who shows it sorted) and @whos formats the
6338 table according to the width of the first column. Nicer, easier to
6349 table according to the width of the first column. Nicer, easier to
6339 read. Todo: write a generic table_format() which takes a list of
6350 read. Todo: write a generic table_format() which takes a list of
6340 lists and prints it nicely formatted, with optional row/column
6351 lists and prints it nicely formatted, with optional row/column
6341 separators and proper padding and justification.
6352 separators and proper padding and justification.
6342
6353
6343 * Released 0.1.20
6354 * Released 0.1.20
6344
6355
6345 * Fixed bug in @log which would reverse the inputcache list (a
6356 * Fixed bug in @log which would reverse the inputcache list (a
6346 copy operation was missing).
6357 copy operation was missing).
6347
6358
6348 * Code cleanup. @config was changed to use page(). Better, since
6359 * Code cleanup. @config was changed to use page(). Better, since
6349 its output is always quite long.
6360 its output is always quite long.
6350
6361
6351 * Itpl is back as a dependency. I was having too many problems
6362 * Itpl is back as a dependency. I was having too many problems
6352 getting the parametric aliases to work reliably, and it's just
6363 getting the parametric aliases to work reliably, and it's just
6353 easier to code weird string operations with it than playing %()s
6364 easier to code weird string operations with it than playing %()s
6354 games. It's only ~6k, so I don't think it's too big a deal.
6365 games. It's only ~6k, so I don't think it's too big a deal.
6355
6366
6356 * Found (and fixed) a very nasty bug with history. !lines weren't
6367 * Found (and fixed) a very nasty bug with history. !lines weren't
6357 getting cached, and the out of sync caches would crash
6368 getting cached, and the out of sync caches would crash
6358 IPython. Fixed it by reorganizing the prefilter/handlers/logger
6369 IPython. Fixed it by reorganizing the prefilter/handlers/logger
6359 division of labor a bit better. Bug fixed, cleaner structure.
6370 division of labor a bit better. Bug fixed, cleaner structure.
6360
6371
6361 2001-12-01 Fernando Perez <fperez@colorado.edu>
6372 2001-12-01 Fernando Perez <fperez@colorado.edu>
6362
6373
6363 * Released 0.1.19
6374 * Released 0.1.19
6364
6375
6365 * Added option -n to @hist to prevent line number printing. Much
6376 * Added option -n to @hist to prevent line number printing. Much
6366 easier to copy/paste code this way.
6377 easier to copy/paste code this way.
6367
6378
6368 * Created global _il to hold the input list. Allows easy
6379 * Created global _il to hold the input list. Allows easy
6369 re-execution of blocks of code by slicing it (inspired by Janko's
6380 re-execution of blocks of code by slicing it (inspired by Janko's
6370 comment on 'macros').
6381 comment on 'macros').
6371
6382
6372 * Small fixes and doc updates.
6383 * Small fixes and doc updates.
6373
6384
6374 * Rewrote @history function (was @h). Renamed it to @hist, @h is
6385 * Rewrote @history function (was @h). Renamed it to @hist, @h is
6375 much too fragile with automagic. Handles properly multi-line
6386 much too fragile with automagic. Handles properly multi-line
6376 statements and takes parameters.
6387 statements and takes parameters.
6377
6388
6378 2001-11-30 Fernando Perez <fperez@colorado.edu>
6389 2001-11-30 Fernando Perez <fperez@colorado.edu>
6379
6390
6380 * Version 0.1.18 released.
6391 * Version 0.1.18 released.
6381
6392
6382 * Fixed nasty namespace bug in initial module imports.
6393 * Fixed nasty namespace bug in initial module imports.
6383
6394
6384 * Added copyright/license notes to all code files (except
6395 * Added copyright/license notes to all code files (except
6385 DPyGetOpt). For the time being, LGPL. That could change.
6396 DPyGetOpt). For the time being, LGPL. That could change.
6386
6397
6387 * Rewrote a much nicer README, updated INSTALL, cleaned up
6398 * Rewrote a much nicer README, updated INSTALL, cleaned up
6388 ipythonrc-* samples.
6399 ipythonrc-* samples.
6389
6400
6390 * Overall code/documentation cleanup. Basically ready for
6401 * Overall code/documentation cleanup. Basically ready for
6391 release. Only remaining thing: licence decision (LGPL?).
6402 release. Only remaining thing: licence decision (LGPL?).
6392
6403
6393 * Converted load_config to a class, ConfigLoader. Now recursion
6404 * Converted load_config to a class, ConfigLoader. Now recursion
6394 control is better organized. Doesn't include the same file twice.
6405 control is better organized. Doesn't include the same file twice.
6395
6406
6396 2001-11-29 Fernando Perez <fperez@colorado.edu>
6407 2001-11-29 Fernando Perez <fperez@colorado.edu>
6397
6408
6398 * Got input history working. Changed output history variables from
6409 * Got input history working. Changed output history variables from
6399 _p to _o so that _i is for input and _o for output. Just cleaner
6410 _p to _o so that _i is for input and _o for output. Just cleaner
6400 convention.
6411 convention.
6401
6412
6402 * Implemented parametric aliases. This pretty much allows the
6413 * Implemented parametric aliases. This pretty much allows the
6403 alias system to offer full-blown shell convenience, I think.
6414 alias system to offer full-blown shell convenience, I think.
6404
6415
6405 * Version 0.1.17 released, 0.1.18 opened.
6416 * Version 0.1.17 released, 0.1.18 opened.
6406
6417
6407 * dot_ipython/ipythonrc (alias): added documentation.
6418 * dot_ipython/ipythonrc (alias): added documentation.
6408 (xcolor): Fixed small bug (xcolors -> xcolor)
6419 (xcolor): Fixed small bug (xcolors -> xcolor)
6409
6420
6410 * Changed the alias system. Now alias is a magic command to define
6421 * Changed the alias system. Now alias is a magic command to define
6411 aliases just like the shell. Rationale: the builtin magics should
6422 aliases just like the shell. Rationale: the builtin magics should
6412 be there for things deeply connected to IPython's
6423 be there for things deeply connected to IPython's
6413 architecture. And this is a much lighter system for what I think
6424 architecture. And this is a much lighter system for what I think
6414 is the really important feature: allowing users to define quickly
6425 is the really important feature: allowing users to define quickly
6415 magics that will do shell things for them, so they can customize
6426 magics that will do shell things for them, so they can customize
6416 IPython easily to match their work habits. If someone is really
6427 IPython easily to match their work habits. If someone is really
6417 desperate to have another name for a builtin alias, they can
6428 desperate to have another name for a builtin alias, they can
6418 always use __IP.magic_newname = __IP.magic_oldname. Hackish but
6429 always use __IP.magic_newname = __IP.magic_oldname. Hackish but
6419 works.
6430 works.
6420
6431
6421 2001-11-28 Fernando Perez <fperez@colorado.edu>
6432 2001-11-28 Fernando Perez <fperez@colorado.edu>
6422
6433
6423 * Changed @file so that it opens the source file at the proper
6434 * Changed @file so that it opens the source file at the proper
6424 line. Since it uses less, if your EDITOR environment is
6435 line. Since it uses less, if your EDITOR environment is
6425 configured, typing v will immediately open your editor of choice
6436 configured, typing v will immediately open your editor of choice
6426 right at the line where the object is defined. Not as quick as
6437 right at the line where the object is defined. Not as quick as
6427 having a direct @edit command, but for all intents and purposes it
6438 having a direct @edit command, but for all intents and purposes it
6428 works. And I don't have to worry about writing @edit to deal with
6439 works. And I don't have to worry about writing @edit to deal with
6429 all the editors, less does that.
6440 all the editors, less does that.
6430
6441
6431 * Version 0.1.16 released, 0.1.17 opened.
6442 * Version 0.1.16 released, 0.1.17 opened.
6432
6443
6433 * Fixed some nasty bugs in the page/page_dumb combo that could
6444 * Fixed some nasty bugs in the page/page_dumb combo that could
6434 crash IPython.
6445 crash IPython.
6435
6446
6436 2001-11-27 Fernando Perez <fperez@colorado.edu>
6447 2001-11-27 Fernando Perez <fperez@colorado.edu>
6437
6448
6438 * Version 0.1.15 released, 0.1.16 opened.
6449 * Version 0.1.15 released, 0.1.16 opened.
6439
6450
6440 * Finally got ? and ?? to work for undefined things: now it's
6451 * Finally got ? and ?? to work for undefined things: now it's
6441 possible to type {}.get? and get information about the get method
6452 possible to type {}.get? and get information about the get method
6442 of dicts, or os.path? even if only os is defined (so technically
6453 of dicts, or os.path? even if only os is defined (so technically
6443 os.path isn't). Works at any level. For example, after import os,
6454 os.path isn't). Works at any level. For example, after import os,
6444 os?, os.path?, os.path.abspath? all work. This is great, took some
6455 os?, os.path?, os.path.abspath? all work. This is great, took some
6445 work in _ofind.
6456 work in _ofind.
6446
6457
6447 * Fixed more bugs with logging. The sanest way to do it was to add
6458 * Fixed more bugs with logging. The sanest way to do it was to add
6448 to @log a 'mode' parameter. Killed two in one shot (this mode
6459 to @log a 'mode' parameter. Killed two in one shot (this mode
6449 option was a request of Janko's). I think it's finally clean
6460 option was a request of Janko's). I think it's finally clean
6450 (famous last words).
6461 (famous last words).
6451
6462
6452 * Added a page_dumb() pager which does a decent job of paging on
6463 * Added a page_dumb() pager which does a decent job of paging on
6453 screen, if better things (like less) aren't available. One less
6464 screen, if better things (like less) aren't available. One less
6454 unix dependency (someday maybe somebody will port this to
6465 unix dependency (someday maybe somebody will port this to
6455 windows).
6466 windows).
6456
6467
6457 * Fixed problem in magic_log: would lock of logging out if log
6468 * Fixed problem in magic_log: would lock of logging out if log
6458 creation failed (because it would still think it had succeeded).
6469 creation failed (because it would still think it had succeeded).
6459
6470
6460 * Improved the page() function using curses to auto-detect screen
6471 * Improved the page() function using curses to auto-detect screen
6461 size. Now it can make a much better decision on whether to print
6472 size. Now it can make a much better decision on whether to print
6462 or page a string. Option screen_length was modified: a value 0
6473 or page a string. Option screen_length was modified: a value 0
6463 means auto-detect, and that's the default now.
6474 means auto-detect, and that's the default now.
6464
6475
6465 * Version 0.1.14 released, 0.1.15 opened. I think this is ready to
6476 * Version 0.1.14 released, 0.1.15 opened. I think this is ready to
6466 go out. I'll test it for a few days, then talk to Janko about
6477 go out. I'll test it for a few days, then talk to Janko about
6467 licences and announce it.
6478 licences and announce it.
6468
6479
6469 * Fixed the length of the auto-generated ---> prompt which appears
6480 * Fixed the length of the auto-generated ---> prompt which appears
6470 for auto-parens and auto-quotes. Getting this right isn't trivial,
6481 for auto-parens and auto-quotes. Getting this right isn't trivial,
6471 with all the color escapes, different prompt types and optional
6482 with all the color escapes, different prompt types and optional
6472 separators. But it seems to be working in all the combinations.
6483 separators. But it seems to be working in all the combinations.
6473
6484
6474 2001-11-26 Fernando Perez <fperez@colorado.edu>
6485 2001-11-26 Fernando Perez <fperez@colorado.edu>
6475
6486
6476 * Wrote a regexp filter to get option types from the option names
6487 * Wrote a regexp filter to get option types from the option names
6477 string. This eliminates the need to manually keep two duplicate
6488 string. This eliminates the need to manually keep two duplicate
6478 lists.
6489 lists.
6479
6490
6480 * Removed the unneeded check_option_names. Now options are handled
6491 * Removed the unneeded check_option_names. Now options are handled
6481 in a much saner manner and it's easy to visually check that things
6492 in a much saner manner and it's easy to visually check that things
6482 are ok.
6493 are ok.
6483
6494
6484 * Updated version numbers on all files I modified to carry a
6495 * Updated version numbers on all files I modified to carry a
6485 notice so Janko and Nathan have clear version markers.
6496 notice so Janko and Nathan have clear version markers.
6486
6497
6487 * Updated docstring for ultraTB with my changes. I should send
6498 * Updated docstring for ultraTB with my changes. I should send
6488 this to Nathan.
6499 this to Nathan.
6489
6500
6490 * Lots of small fixes. Ran everything through pychecker again.
6501 * Lots of small fixes. Ran everything through pychecker again.
6491
6502
6492 * Made loading of deep_reload an cmd line option. If it's not too
6503 * Made loading of deep_reload an cmd line option. If it's not too
6493 kosher, now people can just disable it. With -nodeep_reload it's
6504 kosher, now people can just disable it. With -nodeep_reload it's
6494 still available as dreload(), it just won't overwrite reload().
6505 still available as dreload(), it just won't overwrite reload().
6495
6506
6496 * Moved many options to the no| form (-opt and -noopt
6507 * Moved many options to the no| form (-opt and -noopt
6497 accepted). Cleaner.
6508 accepted). Cleaner.
6498
6509
6499 * Changed magic_log so that if called with no parameters, it uses
6510 * Changed magic_log so that if called with no parameters, it uses
6500 'rotate' mode. That way auto-generated logs aren't automatically
6511 'rotate' mode. That way auto-generated logs aren't automatically
6501 over-written. For normal logs, now a backup is made if it exists
6512 over-written. For normal logs, now a backup is made if it exists
6502 (only 1 level of backups). A new 'backup' mode was added to the
6513 (only 1 level of backups). A new 'backup' mode was added to the
6503 Logger class to support this. This was a request by Janko.
6514 Logger class to support this. This was a request by Janko.
6504
6515
6505 * Added @logoff/@logon to stop/restart an active log.
6516 * Added @logoff/@logon to stop/restart an active log.
6506
6517
6507 * Fixed a lot of bugs in log saving/replay. It was pretty
6518 * Fixed a lot of bugs in log saving/replay. It was pretty
6508 broken. Now special lines (!@,/) appear properly in the command
6519 broken. Now special lines (!@,/) appear properly in the command
6509 history after a log replay.
6520 history after a log replay.
6510
6521
6511 * Tried and failed to implement full session saving via pickle. My
6522 * Tried and failed to implement full session saving via pickle. My
6512 idea was to pickle __main__.__dict__, but modules can't be
6523 idea was to pickle __main__.__dict__, but modules can't be
6513 pickled. This would be a better alternative to replaying logs, but
6524 pickled. This would be a better alternative to replaying logs, but
6514 seems quite tricky to get to work. Changed -session to be called
6525 seems quite tricky to get to work. Changed -session to be called
6515 -logplay, which more accurately reflects what it does. And if we
6526 -logplay, which more accurately reflects what it does. And if we
6516 ever get real session saving working, -session is now available.
6527 ever get real session saving working, -session is now available.
6517
6528
6518 * Implemented color schemes for prompts also. As for tracebacks,
6529 * Implemented color schemes for prompts also. As for tracebacks,
6519 currently only NoColor and Linux are supported. But now the
6530 currently only NoColor and Linux are supported. But now the
6520 infrastructure is in place, based on a generic ColorScheme
6531 infrastructure is in place, based on a generic ColorScheme
6521 class. So writing and activating new schemes both for the prompts
6532 class. So writing and activating new schemes both for the prompts
6522 and the tracebacks should be straightforward.
6533 and the tracebacks should be straightforward.
6523
6534
6524 * Version 0.1.13 released, 0.1.14 opened.
6535 * Version 0.1.13 released, 0.1.14 opened.
6525
6536
6526 * Changed handling of options for output cache. Now counter is
6537 * Changed handling of options for output cache. Now counter is
6527 hardwired starting at 1 and one specifies the maximum number of
6538 hardwired starting at 1 and one specifies the maximum number of
6528 entries *in the outcache* (not the max prompt counter). This is
6539 entries *in the outcache* (not the max prompt counter). This is
6529 much better, since many statements won't increase the cache
6540 much better, since many statements won't increase the cache
6530 count. It also eliminated some confusing options, now there's only
6541 count. It also eliminated some confusing options, now there's only
6531 one: cache_size.
6542 one: cache_size.
6532
6543
6533 * Added 'alias' magic function and magic_alias option in the
6544 * Added 'alias' magic function and magic_alias option in the
6534 ipythonrc file. Now the user can easily define whatever names he
6545 ipythonrc file. Now the user can easily define whatever names he
6535 wants for the magic functions without having to play weird
6546 wants for the magic functions without having to play weird
6536 namespace games. This gives IPython a real shell-like feel.
6547 namespace games. This gives IPython a real shell-like feel.
6537
6548
6538 * Fixed doc/?/?? for magics. Now all work, in all forms (explicit
6549 * Fixed doc/?/?? for magics. Now all work, in all forms (explicit
6539 @ or not).
6550 @ or not).
6540
6551
6541 This was one of the last remaining 'visible' bugs (that I know
6552 This was one of the last remaining 'visible' bugs (that I know
6542 of). I think if I can clean up the session loading so it works
6553 of). I think if I can clean up the session loading so it works
6543 100% I'll release a 0.2.0 version on c.p.l (talk to Janko first
6554 100% I'll release a 0.2.0 version on c.p.l (talk to Janko first
6544 about licensing).
6555 about licensing).
6545
6556
6546 2001-11-25 Fernando Perez <fperez@colorado.edu>
6557 2001-11-25 Fernando Perez <fperez@colorado.edu>
6547
6558
6548 * Rewrote somewhat oinfo (?/??). Nicer, now uses page() and
6559 * Rewrote somewhat oinfo (?/??). Nicer, now uses page() and
6549 there's a cleaner distinction between what ? and ?? show.
6560 there's a cleaner distinction between what ? and ?? show.
6550
6561
6551 * Added screen_length option. Now the user can define his own
6562 * Added screen_length option. Now the user can define his own
6552 screen size for page() operations.
6563 screen size for page() operations.
6553
6564
6554 * Implemented magic shell-like functions with automatic code
6565 * Implemented magic shell-like functions with automatic code
6555 generation. Now adding another function is just a matter of adding
6566 generation. Now adding another function is just a matter of adding
6556 an entry to a dict, and the function is dynamically generated at
6567 an entry to a dict, and the function is dynamically generated at
6557 run-time. Python has some really cool features!
6568 run-time. Python has some really cool features!
6558
6569
6559 * Renamed many options to cleanup conventions a little. Now all
6570 * Renamed many options to cleanup conventions a little. Now all
6560 are lowercase, and only underscores where needed. Also in the code
6571 are lowercase, and only underscores where needed. Also in the code
6561 option name tables are clearer.
6572 option name tables are clearer.
6562
6573
6563 * Changed prompts a little. Now input is 'In [n]:' instead of
6574 * Changed prompts a little. Now input is 'In [n]:' instead of
6564 'In[n]:='. This allows it the numbers to be aligned with the
6575 'In[n]:='. This allows it the numbers to be aligned with the
6565 Out[n] numbers, and removes usage of ':=' which doesn't exist in
6576 Out[n] numbers, and removes usage of ':=' which doesn't exist in
6566 Python (it was a Mathematica thing). The '...' continuation prompt
6577 Python (it was a Mathematica thing). The '...' continuation prompt
6567 was also changed a little to align better.
6578 was also changed a little to align better.
6568
6579
6569 * Fixed bug when flushing output cache. Not all _p<n> variables
6580 * Fixed bug when flushing output cache. Not all _p<n> variables
6570 exist, so their deletion needs to be wrapped in a try:
6581 exist, so their deletion needs to be wrapped in a try:
6571
6582
6572 * Figured out how to properly use inspect.formatargspec() (it
6583 * Figured out how to properly use inspect.formatargspec() (it
6573 requires the args preceded by *). So I removed all the code from
6584 requires the args preceded by *). So I removed all the code from
6574 _get_pdef in Magic, which was just replicating that.
6585 _get_pdef in Magic, which was just replicating that.
6575
6586
6576 * Added test to prefilter to allow redefining magic function names
6587 * Added test to prefilter to allow redefining magic function names
6577 as variables. This is ok, since the @ form is always available,
6588 as variables. This is ok, since the @ form is always available,
6578 but whe should allow the user to define a variable called 'ls' if
6589 but whe should allow the user to define a variable called 'ls' if
6579 he needs it.
6590 he needs it.
6580
6591
6581 * Moved the ToDo information from README into a separate ToDo.
6592 * Moved the ToDo information from README into a separate ToDo.
6582
6593
6583 * General code cleanup and small bugfixes. I think it's close to a
6594 * General code cleanup and small bugfixes. I think it's close to a
6584 state where it can be released, obviously with a big 'beta'
6595 state where it can be released, obviously with a big 'beta'
6585 warning on it.
6596 warning on it.
6586
6597
6587 * Got the magic function split to work. Now all magics are defined
6598 * Got the magic function split to work. Now all magics are defined
6588 in a separate class. It just organizes things a bit, and now
6599 in a separate class. It just organizes things a bit, and now
6589 Xemacs behaves nicer (it was choking on InteractiveShell b/c it
6600 Xemacs behaves nicer (it was choking on InteractiveShell b/c it
6590 was too long).
6601 was too long).
6591
6602
6592 * Changed @clear to @reset to avoid potential confusions with
6603 * Changed @clear to @reset to avoid potential confusions with
6593 the shell command clear. Also renamed @cl to @clear, which does
6604 the shell command clear. Also renamed @cl to @clear, which does
6594 exactly what people expect it to from their shell experience.
6605 exactly what people expect it to from their shell experience.
6595
6606
6596 Added a check to the @reset command (since it's so
6607 Added a check to the @reset command (since it's so
6597 destructive, it's probably a good idea to ask for confirmation).
6608 destructive, it's probably a good idea to ask for confirmation).
6598 But now reset only works for full namespace resetting. Since the
6609 But now reset only works for full namespace resetting. Since the
6599 del keyword is already there for deleting a few specific
6610 del keyword is already there for deleting a few specific
6600 variables, I don't see the point of having a redundant magic
6611 variables, I don't see the point of having a redundant magic
6601 function for the same task.
6612 function for the same task.
6602
6613
6603 2001-11-24 Fernando Perez <fperez@colorado.edu>
6614 2001-11-24 Fernando Perez <fperez@colorado.edu>
6604
6615
6605 * Updated the builtin docs (esp. the ? ones).
6616 * Updated the builtin docs (esp. the ? ones).
6606
6617
6607 * Ran all the code through pychecker. Not terribly impressed with
6618 * Ran all the code through pychecker. Not terribly impressed with
6608 it: lots of spurious warnings and didn't really find anything of
6619 it: lots of spurious warnings and didn't really find anything of
6609 substance (just a few modules being imported and not used).
6620 substance (just a few modules being imported and not used).
6610
6621
6611 * Implemented the new ultraTB functionality into IPython. New
6622 * Implemented the new ultraTB functionality into IPython. New
6612 option: xcolors. This chooses color scheme. xmode now only selects
6623 option: xcolors. This chooses color scheme. xmode now only selects
6613 between Plain and Verbose. Better orthogonality.
6624 between Plain and Verbose. Better orthogonality.
6614
6625
6615 * Large rewrite of ultraTB. Much cleaner now, with a separation of
6626 * Large rewrite of ultraTB. Much cleaner now, with a separation of
6616 mode and color scheme for the exception handlers. Now it's
6627 mode and color scheme for the exception handlers. Now it's
6617 possible to have the verbose traceback with no coloring.
6628 possible to have the verbose traceback with no coloring.
6618
6629
6619 2001-11-23 Fernando Perez <fperez@colorado.edu>
6630 2001-11-23 Fernando Perez <fperez@colorado.edu>
6620
6631
6621 * Version 0.1.12 released, 0.1.13 opened.
6632 * Version 0.1.12 released, 0.1.13 opened.
6622
6633
6623 * Removed option to set auto-quote and auto-paren escapes by
6634 * Removed option to set auto-quote and auto-paren escapes by
6624 user. The chances of breaking valid syntax are just too high. If
6635 user. The chances of breaking valid syntax are just too high. If
6625 someone *really* wants, they can always dig into the code.
6636 someone *really* wants, they can always dig into the code.
6626
6637
6627 * Made prompt separators configurable.
6638 * Made prompt separators configurable.
6628
6639
6629 2001-11-22 Fernando Perez <fperez@colorado.edu>
6640 2001-11-22 Fernando Perez <fperez@colorado.edu>
6630
6641
6631 * Small bugfixes in many places.
6642 * Small bugfixes in many places.
6632
6643
6633 * Removed the MyCompleter class from ipplib. It seemed redundant
6644 * Removed the MyCompleter class from ipplib. It seemed redundant
6634 with the C-p,C-n history search functionality. Less code to
6645 with the C-p,C-n history search functionality. Less code to
6635 maintain.
6646 maintain.
6636
6647
6637 * Moved all the original ipython.py code into ipythonlib.py. Right
6648 * Moved all the original ipython.py code into ipythonlib.py. Right
6638 now it's just one big dump into a function called make_IPython, so
6649 now it's just one big dump into a function called make_IPython, so
6639 no real modularity has been gained. But at least it makes the
6650 no real modularity has been gained. But at least it makes the
6640 wrapper script tiny, and since ipythonlib is a module, it gets
6651 wrapper script tiny, and since ipythonlib is a module, it gets
6641 compiled and startup is much faster.
6652 compiled and startup is much faster.
6642
6653
6643 This is a reasobably 'deep' change, so we should test it for a
6654 This is a reasobably 'deep' change, so we should test it for a
6644 while without messing too much more with the code.
6655 while without messing too much more with the code.
6645
6656
6646 2001-11-21 Fernando Perez <fperez@colorado.edu>
6657 2001-11-21 Fernando Perez <fperez@colorado.edu>
6647
6658
6648 * Version 0.1.11 released, 0.1.12 opened for further work.
6659 * Version 0.1.11 released, 0.1.12 opened for further work.
6649
6660
6650 * Removed dependency on Itpl. It was only needed in one place. It
6661 * Removed dependency on Itpl. It was only needed in one place. It
6651 would be nice if this became part of python, though. It makes life
6662 would be nice if this became part of python, though. It makes life
6652 *a lot* easier in some cases.
6663 *a lot* easier in some cases.
6653
6664
6654 * Simplified the prefilter code a bit. Now all handlers are
6665 * Simplified the prefilter code a bit. Now all handlers are
6655 expected to explicitly return a value (at least a blank string).
6666 expected to explicitly return a value (at least a blank string).
6656
6667
6657 * Heavy edits in ipplib. Removed the help system altogether. Now
6668 * Heavy edits in ipplib. Removed the help system altogether. Now
6658 obj?/?? is used for inspecting objects, a magic @doc prints
6669 obj?/?? is used for inspecting objects, a magic @doc prints
6659 docstrings, and full-blown Python help is accessed via the 'help'
6670 docstrings, and full-blown Python help is accessed via the 'help'
6660 keyword. This cleans up a lot of code (less to maintain) and does
6671 keyword. This cleans up a lot of code (less to maintain) and does
6661 the job. Since 'help' is now a standard Python component, might as
6672 the job. Since 'help' is now a standard Python component, might as
6662 well use it and remove duplicate functionality.
6673 well use it and remove duplicate functionality.
6663
6674
6664 Also removed the option to use ipplib as a standalone program. By
6675 Also removed the option to use ipplib as a standalone program. By
6665 now it's too dependent on other parts of IPython to function alone.
6676 now it's too dependent on other parts of IPython to function alone.
6666
6677
6667 * Fixed bug in genutils.pager. It would crash if the pager was
6678 * Fixed bug in genutils.pager. It would crash if the pager was
6668 exited immediately after opening (broken pipe).
6679 exited immediately after opening (broken pipe).
6669
6680
6670 * Trimmed down the VerboseTB reporting a little. The header is
6681 * Trimmed down the VerboseTB reporting a little. The header is
6671 much shorter now and the repeated exception arguments at the end
6682 much shorter now and the repeated exception arguments at the end
6672 have been removed. For interactive use the old header seemed a bit
6683 have been removed. For interactive use the old header seemed a bit
6673 excessive.
6684 excessive.
6674
6685
6675 * Fixed small bug in output of @whos for variables with multi-word
6686 * Fixed small bug in output of @whos for variables with multi-word
6676 types (only first word was displayed).
6687 types (only first word was displayed).
6677
6688
6678 2001-11-17 Fernando Perez <fperez@colorado.edu>
6689 2001-11-17 Fernando Perez <fperez@colorado.edu>
6679
6690
6680 * Version 0.1.10 released, 0.1.11 opened for further work.
6691 * Version 0.1.10 released, 0.1.11 opened for further work.
6681
6692
6682 * Modified dirs and friends. dirs now *returns* the stack (not
6693 * Modified dirs and friends. dirs now *returns* the stack (not
6683 prints), so one can manipulate it as a variable. Convenient to
6694 prints), so one can manipulate it as a variable. Convenient to
6684 travel along many directories.
6695 travel along many directories.
6685
6696
6686 * Fixed bug in magic_pdef: would only work with functions with
6697 * Fixed bug in magic_pdef: would only work with functions with
6687 arguments with default values.
6698 arguments with default values.
6688
6699
6689 2001-11-14 Fernando Perez <fperez@colorado.edu>
6700 2001-11-14 Fernando Perez <fperez@colorado.edu>
6690
6701
6691 * Added the PhysicsInput stuff to dot_ipython so it ships as an
6702 * Added the PhysicsInput stuff to dot_ipython so it ships as an
6692 example with IPython. Various other minor fixes and cleanups.
6703 example with IPython. Various other minor fixes and cleanups.
6693
6704
6694 * Version 0.1.9 released, 0.1.10 opened for further work.
6705 * Version 0.1.9 released, 0.1.10 opened for further work.
6695
6706
6696 * Added sys.path to the list of directories searched in the
6707 * Added sys.path to the list of directories searched in the
6697 execfile= option. It used to be the current directory and the
6708 execfile= option. It used to be the current directory and the
6698 user's IPYTHONDIR only.
6709 user's IPYTHONDIR only.
6699
6710
6700 2001-11-13 Fernando Perez <fperez@colorado.edu>
6711 2001-11-13 Fernando Perez <fperez@colorado.edu>
6701
6712
6702 * Reinstated the raw_input/prefilter separation that Janko had
6713 * Reinstated the raw_input/prefilter separation that Janko had
6703 initially. This gives a more convenient setup for extending the
6714 initially. This gives a more convenient setup for extending the
6704 pre-processor from the outside: raw_input always gets a string,
6715 pre-processor from the outside: raw_input always gets a string,
6705 and prefilter has to process it. We can then redefine prefilter
6716 and prefilter has to process it. We can then redefine prefilter
6706 from the outside and implement extensions for special
6717 from the outside and implement extensions for special
6707 purposes.
6718 purposes.
6708
6719
6709 Today I got one for inputting PhysicalQuantity objects
6720 Today I got one for inputting PhysicalQuantity objects
6710 (from Scientific) without needing any function calls at
6721 (from Scientific) without needing any function calls at
6711 all. Extremely convenient, and it's all done as a user-level
6722 all. Extremely convenient, and it's all done as a user-level
6712 extension (no IPython code was touched). Now instead of:
6723 extension (no IPython code was touched). Now instead of:
6713 a = PhysicalQuantity(4.2,'m/s**2')
6724 a = PhysicalQuantity(4.2,'m/s**2')
6714 one can simply say
6725 one can simply say
6715 a = 4.2 m/s**2
6726 a = 4.2 m/s**2
6716 or even
6727 or even
6717 a = 4.2 m/s^2
6728 a = 4.2 m/s^2
6718
6729
6719 I use this, but it's also a proof of concept: IPython really is
6730 I use this, but it's also a proof of concept: IPython really is
6720 fully user-extensible, even at the level of the parsing of the
6731 fully user-extensible, even at the level of the parsing of the
6721 command line. It's not trivial, but it's perfectly doable.
6732 command line. It's not trivial, but it's perfectly doable.
6722
6733
6723 * Added 'add_flip' method to inclusion conflict resolver. Fixes
6734 * Added 'add_flip' method to inclusion conflict resolver. Fixes
6724 the problem of modules being loaded in the inverse order in which
6735 the problem of modules being loaded in the inverse order in which
6725 they were defined in
6736 they were defined in
6726
6737
6727 * Version 0.1.8 released, 0.1.9 opened for further work.
6738 * Version 0.1.8 released, 0.1.9 opened for further work.
6728
6739
6729 * Added magics pdef, source and file. They respectively show the
6740 * Added magics pdef, source and file. They respectively show the
6730 definition line ('prototype' in C), source code and full python
6741 definition line ('prototype' in C), source code and full python
6731 file for any callable object. The object inspector oinfo uses
6742 file for any callable object. The object inspector oinfo uses
6732 these to show the same information.
6743 these to show the same information.
6733
6744
6734 * Version 0.1.7 released, 0.1.8 opened for further work.
6745 * Version 0.1.7 released, 0.1.8 opened for further work.
6735
6746
6736 * Separated all the magic functions into a class called Magic. The
6747 * Separated all the magic functions into a class called Magic. The
6737 InteractiveShell class was becoming too big for Xemacs to handle
6748 InteractiveShell class was becoming too big for Xemacs to handle
6738 (de-indenting a line would lock it up for 10 seconds while it
6749 (de-indenting a line would lock it up for 10 seconds while it
6739 backtracked on the whole class!)
6750 backtracked on the whole class!)
6740
6751
6741 FIXME: didn't work. It can be done, but right now namespaces are
6752 FIXME: didn't work. It can be done, but right now namespaces are
6742 all messed up. Do it later (reverted it for now, so at least
6753 all messed up. Do it later (reverted it for now, so at least
6743 everything works as before).
6754 everything works as before).
6744
6755
6745 * Got the object introspection system (magic_oinfo) working! I
6756 * Got the object introspection system (magic_oinfo) working! I
6746 think this is pretty much ready for release to Janko, so he can
6757 think this is pretty much ready for release to Janko, so he can
6747 test it for a while and then announce it. Pretty much 100% of what
6758 test it for a while and then announce it. Pretty much 100% of what
6748 I wanted for the 'phase 1' release is ready. Happy, tired.
6759 I wanted for the 'phase 1' release is ready. Happy, tired.
6749
6760
6750 2001-11-12 Fernando Perez <fperez@colorado.edu>
6761 2001-11-12 Fernando Perez <fperez@colorado.edu>
6751
6762
6752 * Version 0.1.6 released, 0.1.7 opened for further work.
6763 * Version 0.1.6 released, 0.1.7 opened for further work.
6753
6764
6754 * Fixed bug in printing: it used to test for truth before
6765 * Fixed bug in printing: it used to test for truth before
6755 printing, so 0 wouldn't print. Now checks for None.
6766 printing, so 0 wouldn't print. Now checks for None.
6756
6767
6757 * Fixed bug where auto-execs increase the prompt counter by 2 (b/c
6768 * Fixed bug where auto-execs increase the prompt counter by 2 (b/c
6758 they have to call len(str(sys.ps1)) ). But the fix is ugly, it
6769 they have to call len(str(sys.ps1)) ). But the fix is ugly, it
6759 reaches by hand into the outputcache. Think of a better way to do
6770 reaches by hand into the outputcache. Think of a better way to do
6760 this later.
6771 this later.
6761
6772
6762 * Various small fixes thanks to Nathan's comments.
6773 * Various small fixes thanks to Nathan's comments.
6763
6774
6764 * Changed magic_pprint to magic_Pprint. This way it doesn't
6775 * Changed magic_pprint to magic_Pprint. This way it doesn't
6765 collide with pprint() and the name is consistent with the command
6776 collide with pprint() and the name is consistent with the command
6766 line option.
6777 line option.
6767
6778
6768 * Changed prompt counter behavior to be fully like
6779 * Changed prompt counter behavior to be fully like
6769 Mathematica's. That is, even input that doesn't return a result
6780 Mathematica's. That is, even input that doesn't return a result
6770 raises the prompt counter. The old behavior was kind of confusing
6781 raises the prompt counter. The old behavior was kind of confusing
6771 (getting the same prompt number several times if the operation
6782 (getting the same prompt number several times if the operation
6772 didn't return a result).
6783 didn't return a result).
6773
6784
6774 * Fixed Nathan's last name in a couple of places (Gray, not Graham).
6785 * Fixed Nathan's last name in a couple of places (Gray, not Graham).
6775
6786
6776 * Fixed -Classic mode (wasn't working anymore).
6787 * Fixed -Classic mode (wasn't working anymore).
6777
6788
6778 * Added colored prompts using Nathan's new code. Colors are
6789 * Added colored prompts using Nathan's new code. Colors are
6779 currently hardwired, they can be user-configurable. For
6790 currently hardwired, they can be user-configurable. For
6780 developers, they can be chosen in file ipythonlib.py, at the
6791 developers, they can be chosen in file ipythonlib.py, at the
6781 beginning of the CachedOutput class def.
6792 beginning of the CachedOutput class def.
6782
6793
6783 2001-11-11 Fernando Perez <fperez@colorado.edu>
6794 2001-11-11 Fernando Perez <fperez@colorado.edu>
6784
6795
6785 * Version 0.1.5 released, 0.1.6 opened for further work.
6796 * Version 0.1.5 released, 0.1.6 opened for further work.
6786
6797
6787 * Changed magic_env to *return* the environment as a dict (not to
6798 * Changed magic_env to *return* the environment as a dict (not to
6788 print it). This way it prints, but it can also be processed.
6799 print it). This way it prints, but it can also be processed.
6789
6800
6790 * Added Verbose exception reporting to interactive
6801 * Added Verbose exception reporting to interactive
6791 exceptions. Very nice, now even 1/0 at the prompt gives a verbose
6802 exceptions. Very nice, now even 1/0 at the prompt gives a verbose
6792 traceback. Had to make some changes to the ultraTB file. This is
6803 traceback. Had to make some changes to the ultraTB file. This is
6793 probably the last 'big' thing in my mental todo list. This ties
6804 probably the last 'big' thing in my mental todo list. This ties
6794 in with the next entry:
6805 in with the next entry:
6795
6806
6796 * Changed -Xi and -Xf to a single -xmode option. Now all the user
6807 * Changed -Xi and -Xf to a single -xmode option. Now all the user
6797 has to specify is Plain, Color or Verbose for all exception
6808 has to specify is Plain, Color or Verbose for all exception
6798 handling.
6809 handling.
6799
6810
6800 * Removed ShellServices option. All this can really be done via
6811 * Removed ShellServices option. All this can really be done via
6801 the magic system. It's easier to extend, cleaner and has automatic
6812 the magic system. It's easier to extend, cleaner and has automatic
6802 namespace protection and documentation.
6813 namespace protection and documentation.
6803
6814
6804 2001-11-09 Fernando Perez <fperez@colorado.edu>
6815 2001-11-09 Fernando Perez <fperez@colorado.edu>
6805
6816
6806 * Fixed bug in output cache flushing (missing parameter to
6817 * Fixed bug in output cache flushing (missing parameter to
6807 __init__). Other small bugs fixed (found using pychecker).
6818 __init__). Other small bugs fixed (found using pychecker).
6808
6819
6809 * Version 0.1.4 opened for bugfixing.
6820 * Version 0.1.4 opened for bugfixing.
6810
6821
6811 2001-11-07 Fernando Perez <fperez@colorado.edu>
6822 2001-11-07 Fernando Perez <fperez@colorado.edu>
6812
6823
6813 * Version 0.1.3 released, mainly because of the raw_input bug.
6824 * Version 0.1.3 released, mainly because of the raw_input bug.
6814
6825
6815 * Fixed NASTY bug in raw_input: input line wasn't properly parsed
6826 * Fixed NASTY bug in raw_input: input line wasn't properly parsed
6816 and when testing for whether things were callable, a call could
6827 and when testing for whether things were callable, a call could
6817 actually be made to certain functions. They would get called again
6828 actually be made to certain functions. They would get called again
6818 once 'really' executed, with a resulting double call. A disaster
6829 once 'really' executed, with a resulting double call. A disaster
6819 in many cases (list.reverse() would never work!).
6830 in many cases (list.reverse() would never work!).
6820
6831
6821 * Removed prefilter() function, moved its code to raw_input (which
6832 * Removed prefilter() function, moved its code to raw_input (which
6822 after all was just a near-empty caller for prefilter). This saves
6833 after all was just a near-empty caller for prefilter). This saves
6823 a function call on every prompt, and simplifies the class a tiny bit.
6834 a function call on every prompt, and simplifies the class a tiny bit.
6824
6835
6825 * Fix _ip to __ip name in magic example file.
6836 * Fix _ip to __ip name in magic example file.
6826
6837
6827 * Changed 'tar -x -f' to 'tar xvf' in auto-installer. This should
6838 * Changed 'tar -x -f' to 'tar xvf' in auto-installer. This should
6828 work with non-gnu versions of tar.
6839 work with non-gnu versions of tar.
6829
6840
6830 2001-11-06 Fernando Perez <fperez@colorado.edu>
6841 2001-11-06 Fernando Perez <fperez@colorado.edu>
6831
6842
6832 * Version 0.1.2. Just to keep track of the recent changes.
6843 * Version 0.1.2. Just to keep track of the recent changes.
6833
6844
6834 * Fixed nasty bug in output prompt routine. It used to check 'if
6845 * Fixed nasty bug in output prompt routine. It used to check 'if
6835 arg != None...'. Problem is, this fails if arg implements a
6846 arg != None...'. Problem is, this fails if arg implements a
6836 special comparison (__cmp__) which disallows comparing to
6847 special comparison (__cmp__) which disallows comparing to
6837 None. Found it when trying to use the PhysicalQuantity module from
6848 None. Found it when trying to use the PhysicalQuantity module from
6838 ScientificPython.
6849 ScientificPython.
6839
6850
6840 2001-11-05 Fernando Perez <fperez@colorado.edu>
6851 2001-11-05 Fernando Perez <fperez@colorado.edu>
6841
6852
6842 * Also added dirs. Now the pushd/popd/dirs family functions
6853 * Also added dirs. Now the pushd/popd/dirs family functions
6843 basically like the shell, with the added convenience of going home
6854 basically like the shell, with the added convenience of going home
6844 when called with no args.
6855 when called with no args.
6845
6856
6846 * pushd/popd slightly modified to mimic shell behavior more
6857 * pushd/popd slightly modified to mimic shell behavior more
6847 closely.
6858 closely.
6848
6859
6849 * Added env,pushd,popd from ShellServices as magic functions. I
6860 * Added env,pushd,popd from ShellServices as magic functions. I
6850 think the cleanest will be to port all desired functions from
6861 think the cleanest will be to port all desired functions from
6851 ShellServices as magics and remove ShellServices altogether. This
6862 ShellServices as magics and remove ShellServices altogether. This
6852 will provide a single, clean way of adding functionality
6863 will provide a single, clean way of adding functionality
6853 (shell-type or otherwise) to IP.
6864 (shell-type or otherwise) to IP.
6854
6865
6855 2001-11-04 Fernando Perez <fperez@colorado.edu>
6866 2001-11-04 Fernando Perez <fperez@colorado.edu>
6856
6867
6857 * Added .ipython/ directory to sys.path. This way users can keep
6868 * Added .ipython/ directory to sys.path. This way users can keep
6858 customizations there and access them via import.
6869 customizations there and access them via import.
6859
6870
6860 2001-11-03 Fernando Perez <fperez@colorado.edu>
6871 2001-11-03 Fernando Perez <fperez@colorado.edu>
6861
6872
6862 * Opened version 0.1.1 for new changes.
6873 * Opened version 0.1.1 for new changes.
6863
6874
6864 * Changed version number to 0.1.0: first 'public' release, sent to
6875 * Changed version number to 0.1.0: first 'public' release, sent to
6865 Nathan and Janko.
6876 Nathan and Janko.
6866
6877
6867 * Lots of small fixes and tweaks.
6878 * Lots of small fixes and tweaks.
6868
6879
6869 * Minor changes to whos format. Now strings are shown, snipped if
6880 * Minor changes to whos format. Now strings are shown, snipped if
6870 too long.
6881 too long.
6871
6882
6872 * Changed ShellServices to work on __main__ so they show up in @who
6883 * Changed ShellServices to work on __main__ so they show up in @who
6873
6884
6874 * Help also works with ? at the end of a line:
6885 * Help also works with ? at the end of a line:
6875 ?sin and sin?
6886 ?sin and sin?
6876 both produce the same effect. This is nice, as often I use the
6887 both produce the same effect. This is nice, as often I use the
6877 tab-complete to find the name of a method, but I used to then have
6888 tab-complete to find the name of a method, but I used to then have
6878 to go to the beginning of the line to put a ? if I wanted more
6889 to go to the beginning of the line to put a ? if I wanted more
6879 info. Now I can just add the ? and hit return. Convenient.
6890 info. Now I can just add the ? and hit return. Convenient.
6880
6891
6881 2001-11-02 Fernando Perez <fperez@colorado.edu>
6892 2001-11-02 Fernando Perez <fperez@colorado.edu>
6882
6893
6883 * Python version check (>=2.1) added.
6894 * Python version check (>=2.1) added.
6884
6895
6885 * Added LazyPython documentation. At this point the docs are quite
6896 * Added LazyPython documentation. At this point the docs are quite
6886 a mess. A cleanup is in order.
6897 a mess. A cleanup is in order.
6887
6898
6888 * Auto-installer created. For some bizarre reason, the zipfiles
6899 * Auto-installer created. For some bizarre reason, the zipfiles
6889 module isn't working on my system. So I made a tar version
6900 module isn't working on my system. So I made a tar version
6890 (hopefully the command line options in various systems won't kill
6901 (hopefully the command line options in various systems won't kill
6891 me).
6902 me).
6892
6903
6893 * Fixes to Struct in genutils. Now all dictionary-like methods are
6904 * Fixes to Struct in genutils. Now all dictionary-like methods are
6894 protected (reasonably).
6905 protected (reasonably).
6895
6906
6896 * Added pager function to genutils and changed ? to print usage
6907 * Added pager function to genutils and changed ? to print usage
6897 note through it (it was too long).
6908 note through it (it was too long).
6898
6909
6899 * Added the LazyPython functionality. Works great! I changed the
6910 * Added the LazyPython functionality. Works great! I changed the
6900 auto-quote escape to ';', it's on home row and next to '. But
6911 auto-quote escape to ';', it's on home row and next to '. But
6901 both auto-quote and auto-paren (still /) escapes are command-line
6912 both auto-quote and auto-paren (still /) escapes are command-line
6902 parameters.
6913 parameters.
6903
6914
6904
6915
6905 2001-11-01 Fernando Perez <fperez@colorado.edu>
6916 2001-11-01 Fernando Perez <fperez@colorado.edu>
6906
6917
6907 * Version changed to 0.0.7. Fairly large change: configuration now
6918 * Version changed to 0.0.7. Fairly large change: configuration now
6908 is all stored in a directory, by default .ipython. There, all
6919 is all stored in a directory, by default .ipython. There, all
6909 config files have normal looking names (not .names)
6920 config files have normal looking names (not .names)
6910
6921
6911 * Version 0.0.6 Released first to Lucas and Archie as a test
6922 * Version 0.0.6 Released first to Lucas and Archie as a test
6912 run. Since it's the first 'semi-public' release, change version to
6923 run. Since it's the first 'semi-public' release, change version to
6913 > 0.0.6 for any changes now.
6924 > 0.0.6 for any changes now.
6914
6925
6915 * Stuff I had put in the ipplib.py changelog:
6926 * Stuff I had put in the ipplib.py changelog:
6916
6927
6917 Changes to InteractiveShell:
6928 Changes to InteractiveShell:
6918
6929
6919 - Made the usage message a parameter.
6930 - Made the usage message a parameter.
6920
6931
6921 - Require the name of the shell variable to be given. It's a bit
6932 - Require the name of the shell variable to be given. It's a bit
6922 of a hack, but allows the name 'shell' not to be hardwired in the
6933 of a hack, but allows the name 'shell' not to be hardwired in the
6923 magic (@) handler, which is problematic b/c it requires
6934 magic (@) handler, which is problematic b/c it requires
6924 polluting the global namespace with 'shell'. This in turn is
6935 polluting the global namespace with 'shell'. This in turn is
6925 fragile: if a user redefines a variable called shell, things
6936 fragile: if a user redefines a variable called shell, things
6926 break.
6937 break.
6927
6938
6928 - magic @: all functions available through @ need to be defined
6939 - magic @: all functions available through @ need to be defined
6929 as magic_<name>, even though they can be called simply as
6940 as magic_<name>, even though they can be called simply as
6930 @<name>. This allows the special command @magic to gather
6941 @<name>. This allows the special command @magic to gather
6931 information automatically about all existing magic functions,
6942 information automatically about all existing magic functions,
6932 even if they are run-time user extensions, by parsing the shell
6943 even if they are run-time user extensions, by parsing the shell
6933 instance __dict__ looking for special magic_ names.
6944 instance __dict__ looking for special magic_ names.
6934
6945
6935 - mainloop: added *two* local namespace parameters. This allows
6946 - mainloop: added *two* local namespace parameters. This allows
6936 the class to differentiate between parameters which were there
6947 the class to differentiate between parameters which were there
6937 before and after command line initialization was processed. This
6948 before and after command line initialization was processed. This
6938 way, later @who can show things loaded at startup by the
6949 way, later @who can show things loaded at startup by the
6939 user. This trick was necessary to make session saving/reloading
6950 user. This trick was necessary to make session saving/reloading
6940 really work: ideally after saving/exiting/reloading a session,
6951 really work: ideally after saving/exiting/reloading a session,
6941 *everything* should look the same, including the output of @who. I
6952 *everything* should look the same, including the output of @who. I
6942 was only able to make this work with this double namespace
6953 was only able to make this work with this double namespace
6943 trick.
6954 trick.
6944
6955
6945 - added a header to the logfile which allows (almost) full
6956 - added a header to the logfile which allows (almost) full
6946 session restoring.
6957 session restoring.
6947
6958
6948 - prepend lines beginning with @ or !, with a and log
6959 - prepend lines beginning with @ or !, with a and log
6949 them. Why? !lines: may be useful to know what you did @lines:
6960 them. Why? !lines: may be useful to know what you did @lines:
6950 they may affect session state. So when restoring a session, at
6961 they may affect session state. So when restoring a session, at
6951 least inform the user of their presence. I couldn't quite get
6962 least inform the user of their presence. I couldn't quite get
6952 them to properly re-execute, but at least the user is warned.
6963 them to properly re-execute, but at least the user is warned.
6953
6964
6954 * Started ChangeLog.
6965 * Started ChangeLog.
General Comments 0
You need to be logged in to leave comments. Login now