Show More
@@ -1,2594 +1,2669 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 96 |
|
4 | $Id: Magic.py 968 2005-12-29 17:15:38Z 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-2004 Fernando Perez <fperez@colorado.edu> |
|
8 | # Copyright (C) 2001-2004 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 | from cStringIO import StringIO |
|
34 | from cStringIO import StringIO | |
34 | from getopt import getopt |
|
35 | from getopt import getopt | |
35 | from pprint import pprint, pformat |
|
36 | from pprint import pprint, pformat | |
36 |
|
37 | |||
37 | # profile isn't bundled by default in Debian for license reasons |
|
38 | # profile isn't bundled by default in Debian for license reasons | |
38 | try: |
|
39 | try: | |
39 | import profile,pstats |
|
40 | import profile,pstats | |
40 | except ImportError: |
|
41 | except ImportError: | |
41 | profile = pstats = None |
|
42 | profile = pstats = None | |
42 |
|
43 | |||
43 | # Homebrewed |
|
44 | # Homebrewed | |
44 | from IPython import Debugger, OInspect, wildcard |
|
45 | from IPython import Debugger, OInspect, wildcard | |
45 | from IPython.FakeModule import FakeModule |
|
46 | from IPython.FakeModule import FakeModule | |
46 | from IPython.Itpl import Itpl, itpl, printpl,itplns |
|
47 | from IPython.Itpl import Itpl, itpl, printpl,itplns | |
47 | from IPython.PyColorize import Parser |
|
48 | from IPython.PyColorize import Parser | |
48 | from IPython.Struct import Struct |
|
49 | from IPython.Struct import Struct | |
49 | from IPython.genutils import * |
|
50 | from IPython.genutils import * | |
50 |
|
51 | |||
51 | #*************************************************************************** |
|
52 | #*************************************************************************** | |
52 | # Utility functions |
|
53 | # Utility functions | |
53 | def on_off(tag): |
|
54 | def on_off(tag): | |
54 | """Return an ON/OFF string for a 1/0 input. Simple utility function.""" |
|
55 | """Return an ON/OFF string for a 1/0 input. Simple utility function.""" | |
55 | return ['OFF','ON'][tag] |
|
56 | return ['OFF','ON'][tag] | |
56 |
|
57 | |||
57 |
|
58 | |||
58 | #**************************************************************************** |
|
59 | #**************************************************************************** | |
59 | # Utility classes |
|
60 | # Utility classes | |
60 | class Macro(list): |
|
61 | class Macro(list): | |
61 | """Simple class to store the value of macros as strings. |
|
62 | """Simple class to store the value of macros as strings. | |
62 |
|
63 | |||
63 | This allows us to later exec them by checking when something is an |
|
64 | This allows us to later exec them by checking when something is an | |
64 | instance of this class.""" |
|
65 | instance of this class.""" | |
65 |
|
66 | |||
66 | def __init__(self,data): |
|
67 | def __init__(self,data): | |
67 | list.__init__(self,data) |
|
68 | list.__init__(self,data) | |
68 | self.value = ''.join(data) |
|
69 | self.value = ''.join(data) | |
69 |
|
70 | |||
70 | #*************************************************************************** |
|
71 | #*************************************************************************** | |
71 | # Main class implementing Magic functionality |
|
72 | # Main class implementing Magic functionality | |
72 | class Magic: |
|
73 | class Magic: | |
73 | """Magic functions for InteractiveShell. |
|
74 | """Magic functions for InteractiveShell. | |
74 |
|
75 | |||
75 | Shell functions which can be reached as %function_name. All magic |
|
76 | Shell functions which can be reached as %function_name. All magic | |
76 | functions should accept a string, which they can parse for their own |
|
77 | functions should accept a string, which they can parse for their own | |
77 | needs. This can make some functions easier to type, eg `%cd ../` |
|
78 | needs. This can make some functions easier to type, eg `%cd ../` | |
78 | vs. `%cd("../")` |
|
79 | vs. `%cd("../")` | |
79 |
|
80 | |||
80 | ALL definitions MUST begin with the prefix magic_. The user won't need it |
|
81 | ALL definitions MUST begin with the prefix magic_. The user won't need it | |
81 | at the command line, but it is is needed in the definition. """ |
|
82 | at the command line, but it is is needed in the definition. """ | |
82 |
|
83 | |||
83 | # class globals |
|
84 | # class globals | |
84 | auto_status = ['Automagic is OFF, % prefix IS needed for magic functions.', |
|
85 | auto_status = ['Automagic is OFF, % prefix IS needed for magic functions.', | |
85 | 'Automagic is ON, % prefix NOT needed for magic functions.'] |
|
86 | 'Automagic is ON, % prefix NOT needed for magic functions.'] | |
86 |
|
87 | |||
87 | #...................................................................... |
|
88 | #...................................................................... | |
88 | # some utility functions |
|
89 | # some utility functions | |
89 |
|
90 | |||
90 | def __init__(self,shell): |
|
91 | def __init__(self,shell): | |
91 |
|
92 | |||
92 | self.options_table = {} |
|
93 | self.options_table = {} | |
93 | if profile is None: |
|
94 | if profile is None: | |
94 | self.magic_prun = self.profile_missing_notice |
|
95 | self.magic_prun = self.profile_missing_notice | |
95 | self.shell = shell |
|
96 | self.shell = shell | |
96 |
|
97 | |||
97 | def profile_missing_notice(self, *args, **kwargs): |
|
98 | def profile_missing_notice(self, *args, **kwargs): | |
98 | error("""\ |
|
99 | error("""\ | |
99 | The profile module could not be found. If you are a Debian user, |
|
100 | The profile module could not be found. If you are a Debian user, | |
100 | it has been removed from the standard Debian package because of its non-free |
|
101 | it has been removed from the standard Debian package because of its non-free | |
101 | license. To use profiling, please install"python2.3-profiler" from non-free.""") |
|
102 | license. To use profiling, please install"python2.3-profiler" from non-free.""") | |
102 |
|
103 | |||
103 | def default_option(self,fn,optstr): |
|
104 | def default_option(self,fn,optstr): | |
104 | """Make an entry in the options_table for fn, with value optstr""" |
|
105 | """Make an entry in the options_table for fn, with value optstr""" | |
105 |
|
106 | |||
106 | if fn not in self.lsmagic(): |
|
107 | if fn not in self.lsmagic(): | |
107 | error("%s is not a magic function" % fn) |
|
108 | error("%s is not a magic function" % fn) | |
108 | self.options_table[fn] = optstr |
|
109 | self.options_table[fn] = optstr | |
109 |
|
110 | |||
110 | def lsmagic(self): |
|
111 | def lsmagic(self): | |
111 | """Return a list of currently available magic functions. |
|
112 | """Return a list of currently available magic functions. | |
112 |
|
113 | |||
113 | Gives a list of the bare names after mangling (['ls','cd', ...], not |
|
114 | Gives a list of the bare names after mangling (['ls','cd', ...], not | |
114 | ['magic_ls','magic_cd',...]""" |
|
115 | ['magic_ls','magic_cd',...]""" | |
115 |
|
116 | |||
116 | # FIXME. This needs a cleanup, in the way the magics list is built. |
|
117 | # FIXME. This needs a cleanup, in the way the magics list is built. | |
117 |
|
118 | |||
118 | # magics in class definition |
|
119 | # magics in class definition | |
119 | class_magic = lambda fn: fn.startswith('magic_') and \ |
|
120 | class_magic = lambda fn: fn.startswith('magic_') and \ | |
120 | callable(Magic.__dict__[fn]) |
|
121 | callable(Magic.__dict__[fn]) | |
121 | # in instance namespace (run-time user additions) |
|
122 | # in instance namespace (run-time user additions) | |
122 | inst_magic = lambda fn: fn.startswith('magic_') and \ |
|
123 | inst_magic = lambda fn: fn.startswith('magic_') and \ | |
123 | callable(self.__dict__[fn]) |
|
124 | callable(self.__dict__[fn]) | |
124 | # and bound magics by user (so they can access self): |
|
125 | # and bound magics by user (so they can access self): | |
125 | inst_bound_magic = lambda fn: fn.startswith('magic_') and \ |
|
126 | inst_bound_magic = lambda fn: fn.startswith('magic_') and \ | |
126 | callable(self.__class__.__dict__[fn]) |
|
127 | callable(self.__class__.__dict__[fn]) | |
127 | magics = filter(class_magic,Magic.__dict__.keys()) + \ |
|
128 | magics = filter(class_magic,Magic.__dict__.keys()) + \ | |
128 | filter(inst_magic,self.__dict__.keys()) + \ |
|
129 | filter(inst_magic,self.__dict__.keys()) + \ | |
129 | filter(inst_bound_magic,self.__class__.__dict__.keys()) |
|
130 | filter(inst_bound_magic,self.__class__.__dict__.keys()) | |
130 | out = [] |
|
131 | out = [] | |
131 | for fn in magics: |
|
132 | for fn in magics: | |
132 | out.append(fn.replace('magic_','',1)) |
|
133 | out.append(fn.replace('magic_','',1)) | |
133 | out.sort() |
|
134 | out.sort() | |
134 | return out |
|
135 | return out | |
135 |
|
136 | |||
136 | def extract_input_slices(self,slices): |
|
137 | def extract_input_slices(self,slices): | |
137 | """Return as a string a set of input history slices. |
|
138 | """Return as a string a set of input history slices. | |
138 |
|
139 | |||
139 | The set of slices is given as a list of strings (like ['1','4:8','9'], |
|
140 | The set of slices is given as a list of strings (like ['1','4:8','9'], | |
140 | since this function is for use by magic functions which get their |
|
141 | since this function is for use by magic functions which get their | |
141 | arguments as strings.""" |
|
142 | arguments as strings.""" | |
142 |
|
143 | |||
143 | cmds = [] |
|
144 | cmds = [] | |
144 | for chunk in slices: |
|
145 | for chunk in slices: | |
145 | if ':' in chunk: |
|
146 | if ':' in chunk: | |
146 | ini,fin = map(int,chunk.split(':')) |
|
147 | ini,fin = map(int,chunk.split(':')) | |
147 | else: |
|
148 | else: | |
148 | ini = int(chunk) |
|
149 | ini = int(chunk) | |
149 | fin = ini+1 |
|
150 | fin = ini+1 | |
150 | cmds.append(self.shell.input_hist[ini:fin]) |
|
151 | cmds.append(self.shell.input_hist[ini:fin]) | |
151 | return cmds |
|
152 | return cmds | |
152 |
|
153 | |||
153 | def _ofind(self,oname): |
|
154 | def _ofind(self,oname): | |
154 | """Find an object in the available namespaces. |
|
155 | """Find an object in the available namespaces. | |
155 |
|
156 | |||
156 | self._ofind(oname) -> dict with keys: found,obj,ospace,ismagic |
|
157 | self._ofind(oname) -> dict with keys: found,obj,ospace,ismagic | |
157 |
|
158 | |||
158 | Has special code to detect magic functions. |
|
159 | Has special code to detect magic functions. | |
159 | """ |
|
160 | """ | |
160 |
|
161 | |||
161 | oname = oname.strip() |
|
162 | oname = oname.strip() | |
162 |
|
163 | |||
163 | # Namespaces to search in: |
|
164 | # Namespaces to search in: | |
164 | user_ns = self.shell.user_ns |
|
165 | user_ns = self.shell.user_ns | |
165 | internal_ns = self.shell.internal_ns |
|
166 | internal_ns = self.shell.internal_ns | |
166 | builtin_ns = __builtin__.__dict__ |
|
167 | builtin_ns = __builtin__.__dict__ | |
167 | alias_ns = self.shell.alias_table |
|
168 | alias_ns = self.shell.alias_table | |
168 |
|
169 | |||
169 | # Put them in a list. The order is important so that we find things in |
|
170 | # Put them in a list. The order is important so that we find things in | |
170 | # the same order that Python finds them. |
|
171 | # the same order that Python finds them. | |
171 | namespaces = [ ('Interactive',user_ns), |
|
172 | namespaces = [ ('Interactive',user_ns), | |
172 | ('IPython internal',internal_ns), |
|
173 | ('IPython internal',internal_ns), | |
173 | ('Python builtin',builtin_ns), |
|
174 | ('Python builtin',builtin_ns), | |
174 | ('Alias',alias_ns), |
|
175 | ('Alias',alias_ns), | |
175 | ] |
|
176 | ] | |
176 |
|
177 | |||
177 | # initialize results to 'null' |
|
178 | # initialize results to 'null' | |
178 | found = 0; obj = None; ospace = None; ds = None; |
|
179 | found = 0; obj = None; ospace = None; ds = None; | |
179 | ismagic = 0; isalias = 0 |
|
180 | ismagic = 0; isalias = 0 | |
180 |
|
181 | |||
181 | # Look for the given name by splitting it in parts. If the head is |
|
182 | # Look for the given name by splitting it in parts. If the head is | |
182 | # found, then we look for all the remaining parts as members, and only |
|
183 | # found, then we look for all the remaining parts as members, and only | |
183 | # declare success if we can find them all. |
|
184 | # declare success if we can find them all. | |
184 | oname_parts = oname.split('.') |
|
185 | oname_parts = oname.split('.') | |
185 | oname_head, oname_rest = oname_parts[0],oname_parts[1:] |
|
186 | oname_head, oname_rest = oname_parts[0],oname_parts[1:] | |
186 | for nsname,ns in namespaces: |
|
187 | for nsname,ns in namespaces: | |
187 | try: |
|
188 | try: | |
188 | obj = ns[oname_head] |
|
189 | obj = ns[oname_head] | |
189 | except KeyError: |
|
190 | except KeyError: | |
190 | continue |
|
191 | continue | |
191 | else: |
|
192 | else: | |
192 | for part in oname_rest: |
|
193 | for part in oname_rest: | |
193 | try: |
|
194 | try: | |
194 | obj = getattr(obj,part) |
|
195 | obj = getattr(obj,part) | |
195 | except: |
|
196 | except: | |
196 | # Blanket except b/c some badly implemented objects |
|
197 | # Blanket except b/c some badly implemented objects | |
197 | # allow __getattr__ to raise exceptions other than |
|
198 | # allow __getattr__ to raise exceptions other than | |
198 | # AttributeError, which then crashes IPython. |
|
199 | # AttributeError, which then crashes IPython. | |
199 | break |
|
200 | break | |
200 | else: |
|
201 | else: | |
201 | # If we finish the for loop (no break), we got all members |
|
202 | # If we finish the for loop (no break), we got all members | |
202 | found = 1 |
|
203 | found = 1 | |
203 | ospace = nsname |
|
204 | ospace = nsname | |
204 | if ns == alias_ns: |
|
205 | if ns == alias_ns: | |
205 | isalias = 1 |
|
206 | isalias = 1 | |
206 | break # namespace loop |
|
207 | break # namespace loop | |
207 |
|
208 | |||
208 | # Try to see if it's magic |
|
209 | # Try to see if it's magic | |
209 | if not found: |
|
210 | if not found: | |
210 | if oname.startswith(self.shell.ESC_MAGIC): |
|
211 | if oname.startswith(self.shell.ESC_MAGIC): | |
211 | oname = oname[1:] |
|
212 | oname = oname[1:] | |
212 | obj = getattr(self,'magic_'+oname,None) |
|
213 | obj = getattr(self,'magic_'+oname,None) | |
213 | if obj is not None: |
|
214 | if obj is not None: | |
214 | found = 1 |
|
215 | found = 1 | |
215 | ospace = 'IPython internal' |
|
216 | ospace = 'IPython internal' | |
216 | ismagic = 1 |
|
217 | ismagic = 1 | |
217 |
|
218 | |||
218 | # Last try: special-case some literals like '', [], {}, etc: |
|
219 | # Last try: special-case some literals like '', [], {}, etc: | |
219 | if not found and oname_head in ["''",'""','[]','{}','()']: |
|
220 | if not found and oname_head in ["''",'""','[]','{}','()']: | |
220 | obj = eval(oname_head) |
|
221 | obj = eval(oname_head) | |
221 | found = 1 |
|
222 | found = 1 | |
222 | ospace = 'Interactive' |
|
223 | ospace = 'Interactive' | |
223 |
|
224 | |||
224 | return {'found':found, 'obj':obj, 'namespace':ospace, |
|
225 | return {'found':found, 'obj':obj, 'namespace':ospace, | |
225 | 'ismagic':ismagic, 'isalias':isalias} |
|
226 | 'ismagic':ismagic, 'isalias':isalias} | |
226 |
|
227 | |||
227 | def arg_err(self,func): |
|
228 | def arg_err(self,func): | |
228 | """Print docstring if incorrect arguments were passed""" |
|
229 | """Print docstring if incorrect arguments were passed""" | |
229 | print 'Error in arguments:' |
|
230 | print 'Error in arguments:' | |
230 | print OInspect.getdoc(func) |
|
231 | print OInspect.getdoc(func) | |
231 |
|
232 | |||
232 |
|
233 | |||
233 | def format_latex(self,str): |
|
234 | def format_latex(self,str): | |
234 | """Format a string for latex inclusion.""" |
|
235 | """Format a string for latex inclusion.""" | |
235 |
|
236 | |||
236 | # Characters that need to be escaped for latex: |
|
237 | # Characters that need to be escaped for latex: | |
237 | escape_re = re.compile(r'(%|_|\$)',re.MULTILINE) |
|
238 | escape_re = re.compile(r'(%|_|\$)',re.MULTILINE) | |
238 | # Magic command names as headers: |
|
239 | # Magic command names as headers: | |
239 | cmd_name_re = re.compile(r'^(%s.*?):' % self.shell.ESC_MAGIC, |
|
240 | cmd_name_re = re.compile(r'^(%s.*?):' % self.shell.ESC_MAGIC, | |
240 | re.MULTILINE) |
|
241 | re.MULTILINE) | |
241 | # Magic commands |
|
242 | # Magic commands | |
242 | cmd_re = re.compile(r'(?P<cmd>%s.+?\b)(?!\}\}:)' % self.shell.ESC_MAGIC, |
|
243 | cmd_re = re.compile(r'(?P<cmd>%s.+?\b)(?!\}\}:)' % self.shell.ESC_MAGIC, | |
243 | re.MULTILINE) |
|
244 | re.MULTILINE) | |
244 | # Paragraph continue |
|
245 | # Paragraph continue | |
245 | par_re = re.compile(r'\\$',re.MULTILINE) |
|
246 | par_re = re.compile(r'\\$',re.MULTILINE) | |
246 |
|
247 | |||
247 | str = cmd_name_re.sub(r'\n\\texttt{\\textsl{\\large \1}}:',str) |
|
248 | str = cmd_name_re.sub(r'\n\\texttt{\\textsl{\\large \1}}:',str) | |
248 | str = cmd_re.sub(r'\\texttt{\g<cmd>}',str) |
|
249 | str = cmd_re.sub(r'\\texttt{\g<cmd>}',str) | |
249 | str = par_re.sub(r'\\\\',str) |
|
250 | str = par_re.sub(r'\\\\',str) | |
250 | str = escape_re.sub(r'\\\1',str) |
|
251 | str = escape_re.sub(r'\\\1',str) | |
251 | return str |
|
252 | return str | |
252 |
|
253 | |||
253 | def format_screen(self,str): |
|
254 | def format_screen(self,str): | |
254 | """Format a string for screen printing. |
|
255 | """Format a string for screen printing. | |
255 |
|
256 | |||
256 | This removes some latex-type format codes.""" |
|
257 | This removes some latex-type format codes.""" | |
257 | # Paragraph continue |
|
258 | # Paragraph continue | |
258 | par_re = re.compile(r'\\$',re.MULTILINE) |
|
259 | par_re = re.compile(r'\\$',re.MULTILINE) | |
259 | str = par_re.sub('',str) |
|
260 | str = par_re.sub('',str) | |
260 | return str |
|
261 | return str | |
261 |
|
262 | |||
262 | def parse_options(self,arg_str,opt_str,*long_opts,**kw): |
|
263 | def parse_options(self,arg_str,opt_str,*long_opts,**kw): | |
263 | """Parse options passed to an argument string. |
|
264 | """Parse options passed to an argument string. | |
264 |
|
265 | |||
265 | The interface is similar to that of getopt(), but it returns back a |
|
266 | The interface is similar to that of getopt(), but it returns back a | |
266 | Struct with the options as keys and the stripped argument string still |
|
267 | Struct with the options as keys and the stripped argument string still | |
267 | as a string. |
|
268 | as a string. | |
268 |
|
269 | |||
269 | arg_str is quoted as a true sys.argv vector by using shlex.split. |
|
270 | arg_str is quoted as a true sys.argv vector by using shlex.split. | |
270 | This allows us to easily expand variables, glob files, quote |
|
271 | This allows us to easily expand variables, glob files, quote | |
271 | arguments, etc. |
|
272 | arguments, etc. | |
272 |
|
273 | |||
273 | Options: |
|
274 | Options: | |
274 | -mode: default 'string'. If given as 'list', the argument string is |
|
275 | -mode: default 'string'. If given as 'list', the argument string is | |
275 | returned as a list (split on whitespace) instead of a string. |
|
276 | returned as a list (split on whitespace) instead of a string. | |
276 |
|
277 | |||
277 | -list_all: put all option values in lists. Normally only options |
|
278 | -list_all: put all option values in lists. Normally only options | |
278 | appearing more than once are put in a list.""" |
|
279 | appearing more than once are put in a list.""" | |
279 |
|
280 | |||
280 | # inject default options at the beginning of the input line |
|
281 | # inject default options at the beginning of the input line | |
281 | caller = sys._getframe(1).f_code.co_name.replace('magic_','') |
|
282 | caller = sys._getframe(1).f_code.co_name.replace('magic_','') | |
282 | arg_str = '%s %s' % (self.options_table.get(caller,''),arg_str) |
|
283 | arg_str = '%s %s' % (self.options_table.get(caller,''),arg_str) | |
283 |
|
284 | |||
284 | mode = kw.get('mode','string') |
|
285 | mode = kw.get('mode','string') | |
285 | if mode not in ['string','list']: |
|
286 | if mode not in ['string','list']: | |
286 | raise ValueError,'incorrect mode given: %s' % mode |
|
287 | raise ValueError,'incorrect mode given: %s' % mode | |
287 | # Get options |
|
288 | # Get options | |
288 | list_all = kw.get('list_all',0) |
|
289 | list_all = kw.get('list_all',0) | |
289 |
|
290 | |||
290 | # Check if we have more than one argument to warrant extra processing: |
|
291 | # Check if we have more than one argument to warrant extra processing: | |
291 | odict = {} # Dictionary with options |
|
292 | odict = {} # Dictionary with options | |
292 | args = arg_str.split() |
|
293 | args = arg_str.split() | |
293 | if len(args) >= 1: |
|
294 | if len(args) >= 1: | |
294 | # If the list of inputs only has 0 or 1 thing in it, there's no |
|
295 | # If the list of inputs only has 0 or 1 thing in it, there's no | |
295 | # need to look for options |
|
296 | # need to look for options | |
296 | argv = shlex_split(arg_str) |
|
297 | argv = shlex_split(arg_str) | |
297 | # Do regular option processing |
|
298 | # Do regular option processing | |
298 | opts,args = getopt(argv,opt_str,*long_opts) |
|
299 | opts,args = getopt(argv,opt_str,*long_opts) | |
299 | for o,a in opts: |
|
300 | for o,a in opts: | |
300 | if o.startswith('--'): |
|
301 | if o.startswith('--'): | |
301 | o = o[2:] |
|
302 | o = o[2:] | |
302 | else: |
|
303 | else: | |
303 | o = o[1:] |
|
304 | o = o[1:] | |
304 | try: |
|
305 | try: | |
305 | odict[o].append(a) |
|
306 | odict[o].append(a) | |
306 | except AttributeError: |
|
307 | except AttributeError: | |
307 | odict[o] = [odict[o],a] |
|
308 | odict[o] = [odict[o],a] | |
308 | except KeyError: |
|
309 | except KeyError: | |
309 | if list_all: |
|
310 | if list_all: | |
310 | odict[o] = [a] |
|
311 | odict[o] = [a] | |
311 | else: |
|
312 | else: | |
312 | odict[o] = a |
|
313 | odict[o] = a | |
313 |
|
314 | |||
314 | # Prepare opts,args for return |
|
315 | # Prepare opts,args for return | |
315 | opts = Struct(odict) |
|
316 | opts = Struct(odict) | |
316 | if mode == 'string': |
|
317 | if mode == 'string': | |
317 | args = ' '.join(args) |
|
318 | args = ' '.join(args) | |
318 |
|
319 | |||
319 | return opts,args |
|
320 | return opts,args | |
320 |
|
321 | |||
321 | #...................................................................... |
|
322 | #...................................................................... | |
322 | # And now the actual magic functions |
|
323 | # And now the actual magic functions | |
323 |
|
324 | |||
324 | # Functions for IPython shell work (vars,funcs, config, etc) |
|
325 | # Functions for IPython shell work (vars,funcs, config, etc) | |
325 | def magic_lsmagic(self, parameter_s = ''): |
|
326 | def magic_lsmagic(self, parameter_s = ''): | |
326 | """List currently available magic functions.""" |
|
327 | """List currently available magic functions.""" | |
327 | mesc = self.shell.ESC_MAGIC |
|
328 | mesc = self.shell.ESC_MAGIC | |
328 | print 'Available magic functions:\n'+mesc+\ |
|
329 | print 'Available magic functions:\n'+mesc+\ | |
329 | (' '+mesc).join(self.lsmagic()) |
|
330 | (' '+mesc).join(self.lsmagic()) | |
330 | print '\n' + Magic.auto_status[self.shell.rc.automagic] |
|
331 | print '\n' + Magic.auto_status[self.shell.rc.automagic] | |
331 | return None |
|
332 | return None | |
332 |
|
333 | |||
333 | def magic_magic(self, parameter_s = ''): |
|
334 | def magic_magic(self, parameter_s = ''): | |
334 | """Print information about the magic function system.""" |
|
335 | """Print information about the magic function system.""" | |
335 |
|
336 | |||
336 | mode = '' |
|
337 | mode = '' | |
337 | try: |
|
338 | try: | |
338 | if parameter_s.split()[0] == '-latex': |
|
339 | if parameter_s.split()[0] == '-latex': | |
339 | mode = 'latex' |
|
340 | mode = 'latex' | |
340 | except: |
|
341 | except: | |
341 | pass |
|
342 | pass | |
342 |
|
343 | |||
343 | magic_docs = [] |
|
344 | magic_docs = [] | |
344 | for fname in self.lsmagic(): |
|
345 | for fname in self.lsmagic(): | |
345 | mname = 'magic_' + fname |
|
346 | mname = 'magic_' + fname | |
346 | for space in (Magic,self,self.__class__): |
|
347 | for space in (Magic,self,self.__class__): | |
347 | try: |
|
348 | try: | |
348 | fn = space.__dict__[mname] |
|
349 | fn = space.__dict__[mname] | |
349 | except KeyError: |
|
350 | except KeyError: | |
350 | pass |
|
351 | pass | |
351 | else: |
|
352 | else: | |
352 | break |
|
353 | break | |
353 | magic_docs.append('%s%s:\n\t%s\n' %(self.shell.ESC_MAGIC, |
|
354 | magic_docs.append('%s%s:\n\t%s\n' %(self.shell.ESC_MAGIC, | |
354 | fname,fn.__doc__)) |
|
355 | fname,fn.__doc__)) | |
355 | magic_docs = ''.join(magic_docs) |
|
356 | magic_docs = ''.join(magic_docs) | |
356 |
|
357 | |||
357 | if mode == 'latex': |
|
358 | if mode == 'latex': | |
358 | print self.format_latex(magic_docs) |
|
359 | print self.format_latex(magic_docs) | |
359 | return |
|
360 | return | |
360 | else: |
|
361 | else: | |
361 | magic_docs = self.format_screen(magic_docs) |
|
362 | magic_docs = self.format_screen(magic_docs) | |
362 |
|
363 | |||
363 | outmsg = """ |
|
364 | outmsg = """ | |
364 | IPython's 'magic' functions |
|
365 | IPython's 'magic' functions | |
365 | =========================== |
|
366 | =========================== | |
366 |
|
367 | |||
367 | The magic function system provides a series of functions which allow you to |
|
368 | The magic function system provides a series of functions which allow you to | |
368 | control the behavior of IPython itself, plus a lot of system-type |
|
369 | control the behavior of IPython itself, plus a lot of system-type | |
369 | features. All these functions are prefixed with a % character, but parameters |
|
370 | features. All these functions are prefixed with a % character, but parameters | |
370 | are given without parentheses or quotes. |
|
371 | are given without parentheses or quotes. | |
371 |
|
372 | |||
372 | NOTE: If you have 'automagic' enabled (via the command line option or with the |
|
373 | NOTE: If you have 'automagic' enabled (via the command line option or with the | |
373 | %automagic function), you don't need to type in the % explicitly. By default, |
|
374 | %automagic function), you don't need to type in the % explicitly. By default, | |
374 | IPython ships with automagic on, so you should only rarely need the % escape. |
|
375 | IPython ships with automagic on, so you should only rarely need the % escape. | |
375 |
|
376 | |||
376 | Example: typing '%cd mydir' (without the quotes) changes you working directory |
|
377 | Example: typing '%cd mydir' (without the quotes) changes you working directory | |
377 | to 'mydir', if it exists. |
|
378 | to 'mydir', if it exists. | |
378 |
|
379 | |||
379 | You can define your own magic functions to extend the system. See the supplied |
|
380 | You can define your own magic functions to extend the system. See the supplied | |
380 | ipythonrc and example-magic.py files for details (in your ipython |
|
381 | ipythonrc and example-magic.py files for details (in your ipython | |
381 | configuration directory, typically $HOME/.ipython/). |
|
382 | configuration directory, typically $HOME/.ipython/). | |
382 |
|
383 | |||
383 | You can also define your own aliased names for magic functions. In your |
|
384 | You can also define your own aliased names for magic functions. In your | |
384 | ipythonrc file, placing a line like: |
|
385 | ipythonrc file, placing a line like: | |
385 |
|
386 | |||
386 | execute __IPYTHON__.magic_pf = __IPYTHON__.magic_profile |
|
387 | execute __IPYTHON__.magic_pf = __IPYTHON__.magic_profile | |
387 |
|
388 | |||
388 | will define %pf as a new name for %profile. |
|
389 | will define %pf as a new name for %profile. | |
389 |
|
390 | |||
390 | You can also call magics in code using the ipmagic() function, which IPython |
|
391 | You can also call magics in code using the ipmagic() function, which IPython | |
391 | automatically adds to the builtin namespace. Type 'ipmagic?' for details. |
|
392 | automatically adds to the builtin namespace. Type 'ipmagic?' for details. | |
392 |
|
393 | |||
393 | For a list of the available magic functions, use %lsmagic. For a description |
|
394 | For a list of the available magic functions, use %lsmagic. For a description | |
394 | of any of them, type %magic_name?, e.g. '%cd?'. |
|
395 | of any of them, type %magic_name?, e.g. '%cd?'. | |
395 |
|
396 | |||
396 | Currently the magic system has the following functions:\n""" |
|
397 | Currently the magic system has the following functions:\n""" | |
397 |
|
398 | |||
398 | mesc = self.shell.ESC_MAGIC |
|
399 | mesc = self.shell.ESC_MAGIC | |
399 | outmsg = ("%s\n%s\n\nSummary of magic functions (from %slsmagic):" |
|
400 | outmsg = ("%s\n%s\n\nSummary of magic functions (from %slsmagic):" | |
400 | "\n\n%s%s\n\n%s" % (outmsg, |
|
401 | "\n\n%s%s\n\n%s" % (outmsg, | |
401 | magic_docs,mesc,mesc, |
|
402 | magic_docs,mesc,mesc, | |
402 | (' '+mesc).join(self.lsmagic()), |
|
403 | (' '+mesc).join(self.lsmagic()), | |
403 | Magic.auto_status[self.shell.rc.automagic] ) ) |
|
404 | Magic.auto_status[self.shell.rc.automagic] ) ) | |
404 |
|
405 | |||
405 | page(outmsg,screen_lines=self.shell.rc.screen_length) |
|
406 | page(outmsg,screen_lines=self.shell.rc.screen_length) | |
406 |
|
407 | |||
407 | def magic_automagic(self, parameter_s = ''): |
|
408 | def magic_automagic(self, parameter_s = ''): | |
408 | """Make magic functions callable without having to type the initial %. |
|
409 | """Make magic functions callable without having to type the initial %. | |
409 |
|
410 | |||
410 | Toggles on/off (when off, you must call it as %automagic, of |
|
411 | Toggles on/off (when off, you must call it as %automagic, of | |
411 | course). Note that magic functions have lowest priority, so if there's |
|
412 | course). Note that magic functions have lowest priority, so if there's | |
412 | a variable whose name collides with that of a magic fn, automagic |
|
413 | a variable whose name collides with that of a magic fn, automagic | |
413 | won't work for that function (you get the variable instead). However, |
|
414 | won't work for that function (you get the variable instead). However, | |
414 | if you delete the variable (del var), the previously shadowed magic |
|
415 | if you delete the variable (del var), the previously shadowed magic | |
415 | function becomes visible to automagic again.""" |
|
416 | function becomes visible to automagic again.""" | |
416 |
|
417 | |||
417 | rc = self.shell.rc |
|
418 | rc = self.shell.rc | |
418 | rc.automagic = not rc.automagic |
|
419 | rc.automagic = not rc.automagic | |
419 | print '\n' + Magic.auto_status[rc.automagic] |
|
420 | print '\n' + Magic.auto_status[rc.automagic] | |
420 |
|
421 | |||
421 | def magic_autocall(self, parameter_s = ''): |
|
422 | def magic_autocall(self, parameter_s = ''): | |
422 | """Make functions callable without having to type parentheses. |
|
423 | """Make functions callable without having to type parentheses. | |
423 |
|
424 | |||
424 | This toggles the autocall command line option on and off.""" |
|
425 | This toggles the autocall command line option on and off.""" | |
425 |
|
426 | |||
426 | rc = self.shell.rc |
|
427 | rc = self.shell.rc | |
427 | rc.autocall = not rc.autocall |
|
428 | rc.autocall = not rc.autocall | |
428 | print "Automatic calling is:",['OFF','ON'][rc.autocall] |
|
429 | print "Automatic calling is:",['OFF','ON'][rc.autocall] | |
429 |
|
430 | |||
430 | def magic_autoindent(self, parameter_s = ''): |
|
431 | def magic_autoindent(self, parameter_s = ''): | |
431 | """Toggle autoindent on/off (if available).""" |
|
432 | """Toggle autoindent on/off (if available).""" | |
432 |
|
433 | |||
433 | self.shell.set_autoindent() |
|
434 | self.shell.set_autoindent() | |
434 | print "Automatic indentation is:",['OFF','ON'][self.shell.autoindent] |
|
435 | print "Automatic indentation is:",['OFF','ON'][self.shell.autoindent] | |
435 |
|
436 | |||
436 | def magic_system_verbose(self, parameter_s = ''): |
|
437 | def magic_system_verbose(self, parameter_s = ''): | |
437 | """Toggle verbose printing of system calls on/off.""" |
|
438 | """Toggle verbose printing of system calls on/off.""" | |
438 |
|
439 | |||
439 | self.shell.rc_set_toggle('system_verbose') |
|
440 | self.shell.rc_set_toggle('system_verbose') | |
440 | print "System verbose printing is:",\ |
|
441 | print "System verbose printing is:",\ | |
441 | ['OFF','ON'][self.shell.rc.system_verbose] |
|
442 | ['OFF','ON'][self.shell.rc.system_verbose] | |
442 |
|
443 | |||
443 | def magic_history(self, parameter_s = ''): |
|
444 | def magic_history(self, parameter_s = ''): | |
444 | """Print input history (_i<n> variables), with most recent last. |
|
445 | """Print input history (_i<n> variables), with most recent last. | |
445 |
|
446 | |||
446 | %history [-n] -> print at most 40 inputs (some may be multi-line)\\ |
|
447 | %history [-n] -> print at most 40 inputs (some may be multi-line)\\ | |
447 | %history [-n] n -> print at most n inputs\\ |
|
448 | %history [-n] n -> print at most n inputs\\ | |
448 | %history [-n] n1 n2 -> print inputs between n1 and n2 (n2 not included)\\ |
|
449 | %history [-n] n1 n2 -> print inputs between n1 and n2 (n2 not included)\\ | |
449 |
|
450 | |||
450 | Each input's number <n> is shown, and is accessible as the |
|
451 | Each input's number <n> is shown, and is accessible as the | |
451 | automatically generated variable _i<n>. Multi-line statements are |
|
452 | automatically generated variable _i<n>. Multi-line statements are | |
452 | printed starting at a new line for easy copy/paste. |
|
453 | printed starting at a new line for easy copy/paste. | |
453 |
|
454 | |||
454 | If option -n is used, input numbers are not printed. This is useful if |
|
455 | If option -n is used, input numbers are not printed. This is useful if | |
455 | you want to get a printout of many lines which can be directly pasted |
|
456 | you want to get a printout of many lines which can be directly pasted | |
456 | into a text editor. |
|
457 | into a text editor. | |
457 |
|
458 | |||
458 | This feature is only available if numbered prompts are in use.""" |
|
459 | This feature is only available if numbered prompts are in use.""" | |
459 |
|
460 | |||
460 | if not self.shell.outputcache.do_full_cache: |
|
461 | if not self.shell.outputcache.do_full_cache: | |
461 | print 'This feature is only available if numbered prompts are in use.' |
|
462 | print 'This feature is only available if numbered prompts are in use.' | |
462 | return |
|
463 | return | |
463 | opts,args = self.parse_options(parameter_s,'n',mode='list') |
|
464 | opts,args = self.parse_options(parameter_s,'n',mode='list') | |
464 |
|
465 | |||
465 | default_length = 40 |
|
466 | default_length = 40 | |
466 | if len(args) == 0: |
|
467 | if len(args) == 0: | |
467 | final = self.shell.outputcache.prompt_count |
|
468 | final = self.shell.outputcache.prompt_count | |
468 | init = max(1,final-default_length) |
|
469 | init = max(1,final-default_length) | |
469 | elif len(args) == 1: |
|
470 | elif len(args) == 1: | |
470 | final = self.shell.outputcache.prompt_count |
|
471 | final = self.shell.outputcache.prompt_count | |
471 | init = max(1,final-int(args[0])) |
|
472 | init = max(1,final-int(args[0])) | |
472 | elif len(args) == 2: |
|
473 | elif len(args) == 2: | |
473 | init,final = map(int,args) |
|
474 | init,final = map(int,args) | |
474 | else: |
|
475 | else: | |
475 | warn('%hist takes 0, 1 or 2 arguments separated by spaces.') |
|
476 | warn('%hist takes 0, 1 or 2 arguments separated by spaces.') | |
476 | print self.magic_hist.__doc__ |
|
477 | print self.magic_hist.__doc__ | |
477 | return |
|
478 | return | |
478 | width = len(str(final)) |
|
479 | width = len(str(final)) | |
479 | line_sep = ['','\n'] |
|
480 | line_sep = ['','\n'] | |
480 | input_hist = self.shell.input_hist |
|
481 | input_hist = self.shell.input_hist | |
481 | print_nums = not opts.has_key('n') |
|
482 | print_nums = not opts.has_key('n') | |
482 | for in_num in range(init,final): |
|
483 | for in_num in range(init,final): | |
483 | inline = input_hist[in_num] |
|
484 | inline = input_hist[in_num] | |
484 | multiline = inline.count('\n') > 1 |
|
485 | multiline = inline.count('\n') > 1 | |
485 | if print_nums: |
|
486 | if print_nums: | |
486 | print str(in_num).ljust(width)+':'+ line_sep[multiline], |
|
487 | print str(in_num).ljust(width)+':'+ line_sep[multiline], | |
487 | if inline.startswith('#'+self.shell.ESC_MAGIC) or \ |
|
488 | if inline.startswith('#'+self.shell.ESC_MAGIC) or \ | |
488 | inline.startswith('#!'): |
|
489 | inline.startswith('#!'): | |
489 | print inline[1:], |
|
490 | print inline[1:], | |
490 | else: |
|
491 | else: | |
491 | print inline, |
|
492 | print inline, | |
492 |
|
493 | |||
493 | def magic_hist(self, parameter_s=''): |
|
494 | def magic_hist(self, parameter_s=''): | |
494 | """Alternate name for %history.""" |
|
495 | """Alternate name for %history.""" | |
495 | return self.magic_history(parameter_s) |
|
496 | return self.magic_history(parameter_s) | |
496 |
|
497 | |||
497 | def magic_p(self, parameter_s=''): |
|
498 | def magic_p(self, parameter_s=''): | |
498 | """Just a short alias for Python's 'print'.""" |
|
499 | """Just a short alias for Python's 'print'.""" | |
499 | exec 'print ' + parameter_s in self.shell.user_ns |
|
500 | exec 'print ' + parameter_s in self.shell.user_ns | |
500 |
|
501 | |||
501 | def magic_r(self, parameter_s=''): |
|
502 | def magic_r(self, parameter_s=''): | |
502 | """Repeat previous input. |
|
503 | """Repeat previous input. | |
503 |
|
504 | |||
504 | If given an argument, repeats the previous command which starts with |
|
505 | If given an argument, repeats the previous command which starts with | |
505 | the same string, otherwise it just repeats the previous input. |
|
506 | the same string, otherwise it just repeats the previous input. | |
506 |
|
507 | |||
507 | Shell escaped commands (with ! as first character) are not recognized |
|
508 | Shell escaped commands (with ! as first character) are not recognized | |
508 | by this system, only pure python code and magic commands. |
|
509 | by this system, only pure python code and magic commands. | |
509 | """ |
|
510 | """ | |
510 |
|
511 | |||
511 | start = parameter_s.strip() |
|
512 | start = parameter_s.strip() | |
512 | esc_magic = self.shell.ESC_MAGIC |
|
513 | esc_magic = self.shell.ESC_MAGIC | |
513 | # Identify magic commands even if automagic is on (which means |
|
514 | # Identify magic commands even if automagic is on (which means | |
514 | # the in-memory version is different from that typed by the user). |
|
515 | # the in-memory version is different from that typed by the user). | |
515 | if self.shell.rc.automagic: |
|
516 | if self.shell.rc.automagic: | |
516 | start_magic = esc_magic+start |
|
517 | start_magic = esc_magic+start | |
517 | else: |
|
518 | else: | |
518 | start_magic = start |
|
519 | start_magic = start | |
519 | # Look through the input history in reverse |
|
520 | # Look through the input history in reverse | |
520 | for n in range(len(self.shell.input_hist)-2,0,-1): |
|
521 | for n in range(len(self.shell.input_hist)-2,0,-1): | |
521 | input = self.shell.input_hist[n] |
|
522 | input = self.shell.input_hist[n] | |
522 | # skip plain 'r' lines so we don't recurse to infinity |
|
523 | # skip plain 'r' lines so we don't recurse to infinity | |
523 | if input != 'ipmagic("r")\n' and \ |
|
524 | if input != 'ipmagic("r")\n' and \ | |
524 | (input.startswith(start) or input.startswith(start_magic)): |
|
525 | (input.startswith(start) or input.startswith(start_magic)): | |
525 | #print 'match',`input` # dbg |
|
526 | #print 'match',`input` # dbg | |
526 | print 'Executing:',input, |
|
527 | print 'Executing:',input, | |
527 | self.shell.runlines(input) |
|
528 | self.shell.runlines(input) | |
528 | return |
|
529 | return | |
529 | print 'No previous input matching `%s` found.' % start |
|
530 | print 'No previous input matching `%s` found.' % start | |
530 |
|
531 | |||
531 | def magic_page(self, parameter_s=''): |
|
532 | def magic_page(self, parameter_s=''): | |
532 | """Pretty print the object and display it through a pager. |
|
533 | """Pretty print the object and display it through a pager. | |
533 |
|
534 | |||
534 | If no parameter is given, use _ (last output).""" |
|
535 | If no parameter is given, use _ (last output).""" | |
535 | # After a function contributed by Olivier Aubert, slightly modified. |
|
536 | # After a function contributed by Olivier Aubert, slightly modified. | |
536 |
|
537 | |||
537 | oname = parameter_s and parameter_s or '_' |
|
538 | oname = parameter_s and parameter_s or '_' | |
538 | info = self._ofind(oname) |
|
539 | info = self._ofind(oname) | |
539 | if info['found']: |
|
540 | if info['found']: | |
540 | page(pformat(info['obj'])) |
|
541 | page(pformat(info['obj'])) | |
541 | else: |
|
542 | else: | |
542 | print 'Object `%s` not found' % oname |
|
543 | print 'Object `%s` not found' % oname | |
543 |
|
544 | |||
544 | def magic_profile(self, parameter_s=''): |
|
545 | def magic_profile(self, parameter_s=''): | |
545 | """Print your currently active IPyhton profile.""" |
|
546 | """Print your currently active IPyhton profile.""" | |
546 | if self.shell.rc.profile: |
|
547 | if self.shell.rc.profile: | |
547 | printpl('Current IPython profile: $self.shell.rc.profile.') |
|
548 | printpl('Current IPython profile: $self.shell.rc.profile.') | |
548 | else: |
|
549 | else: | |
549 | print 'No profile active.' |
|
550 | print 'No profile active.' | |
550 |
|
551 | |||
551 | def _inspect(self,meth,oname,**kw): |
|
552 | def _inspect(self,meth,oname,**kw): | |
552 | """Generic interface to the inspector system. |
|
553 | """Generic interface to the inspector system. | |
553 |
|
554 | |||
554 | This function is meant to be called by pdef, pdoc & friends.""" |
|
555 | This function is meant to be called by pdef, pdoc & friends.""" | |
555 |
|
556 | |||
556 | oname = oname.strip() |
|
557 | oname = oname.strip() | |
557 | info = Struct(self._ofind(oname)) |
|
558 | info = Struct(self._ofind(oname)) | |
558 | if info.found: |
|
559 | if info.found: | |
559 | pmethod = getattr(self.shell.inspector,meth) |
|
560 | pmethod = getattr(self.shell.inspector,meth) | |
560 | formatter = info.ismagic and self.format_screen or None |
|
561 | formatter = info.ismagic and self.format_screen or None | |
561 | if meth == 'pdoc': |
|
562 | if meth == 'pdoc': | |
562 | pmethod(info.obj,oname,formatter) |
|
563 | pmethod(info.obj,oname,formatter) | |
563 | elif meth == 'pinfo': |
|
564 | elif meth == 'pinfo': | |
564 | pmethod(info.obj,oname,formatter,info,**kw) |
|
565 | pmethod(info.obj,oname,formatter,info,**kw) | |
565 | else: |
|
566 | else: | |
566 | pmethod(info.obj,oname) |
|
567 | pmethod(info.obj,oname) | |
567 | else: |
|
568 | else: | |
568 | print 'Object `%s` not found.' % oname |
|
569 | print 'Object `%s` not found.' % oname | |
569 | return 'not found' # so callers can take other action |
|
570 | return 'not found' # so callers can take other action | |
570 |
|
571 | |||
571 | def magic_pdef(self, parameter_s=''): |
|
572 | def magic_pdef(self, parameter_s=''): | |
572 | """Print the definition header for any callable object. |
|
573 | """Print the definition header for any callable object. | |
573 |
|
574 | |||
574 | If the object is a class, print the constructor information.""" |
|
575 | If the object is a class, print the constructor information.""" | |
575 | self._inspect('pdef',parameter_s) |
|
576 | self._inspect('pdef',parameter_s) | |
576 |
|
577 | |||
577 | def magic_pdoc(self, parameter_s=''): |
|
578 | def magic_pdoc(self, parameter_s=''): | |
578 | """Print the docstring for an object. |
|
579 | """Print the docstring for an object. | |
579 |
|
580 | |||
580 | If the given object is a class, it will print both the class and the |
|
581 | If the given object is a class, it will print both the class and the | |
581 | constructor docstrings.""" |
|
582 | constructor docstrings.""" | |
582 | self._inspect('pdoc',parameter_s) |
|
583 | self._inspect('pdoc',parameter_s) | |
583 |
|
584 | |||
584 | def magic_psource(self, parameter_s=''): |
|
585 | def magic_psource(self, parameter_s=''): | |
585 | """Print (or run through pager) the source code for an object.""" |
|
586 | """Print (or run through pager) the source code for an object.""" | |
586 | self._inspect('psource',parameter_s) |
|
587 | self._inspect('psource',parameter_s) | |
587 |
|
588 | |||
588 | def magic_pfile(self, parameter_s=''): |
|
589 | def magic_pfile(self, parameter_s=''): | |
589 | """Print (or run through pager) the file where an object is defined. |
|
590 | """Print (or run through pager) the file where an object is defined. | |
590 |
|
591 | |||
591 | The file opens at the line where the object definition begins. IPython |
|
592 | The file opens at the line where the object definition begins. IPython | |
592 | will honor the environment variable PAGER if set, and otherwise will |
|
593 | will honor the environment variable PAGER if set, and otherwise will | |
593 | do its best to print the file in a convenient form. |
|
594 | do its best to print the file in a convenient form. | |
594 |
|
595 | |||
595 | If the given argument is not an object currently defined, IPython will |
|
596 | If the given argument is not an object currently defined, IPython will | |
596 | try to interpret it as a filename (automatically adding a .py extension |
|
597 | try to interpret it as a filename (automatically adding a .py extension | |
597 | if needed). You can thus use %pfile as a syntax highlighting code |
|
598 | if needed). You can thus use %pfile as a syntax highlighting code | |
598 | viewer.""" |
|
599 | viewer.""" | |
599 |
|
600 | |||
600 | # first interpret argument as an object name |
|
601 | # first interpret argument as an object name | |
601 | out = self._inspect('pfile',parameter_s) |
|
602 | out = self._inspect('pfile',parameter_s) | |
602 | # if not, try the input as a filename |
|
603 | # if not, try the input as a filename | |
603 | if out == 'not found': |
|
604 | if out == 'not found': | |
604 | try: |
|
605 | try: | |
605 | filename = get_py_filename(parameter_s) |
|
606 | filename = get_py_filename(parameter_s) | |
606 | except IOError,msg: |
|
607 | except IOError,msg: | |
607 | print msg |
|
608 | print msg | |
608 | return |
|
609 | return | |
609 | page(self.shell.inspector.format(file(filename).read())) |
|
610 | page(self.shell.inspector.format(file(filename).read())) | |
610 |
|
611 | |||
611 | def magic_pinfo(self, parameter_s=''): |
|
612 | def magic_pinfo(self, parameter_s=''): | |
612 | """Provide detailed information about an object. |
|
613 | """Provide detailed information about an object. | |
613 |
|
614 | |||
614 | '%pinfo object' is just a synonym for object? or ?object.""" |
|
615 | '%pinfo object' is just a synonym for object? or ?object.""" | |
615 |
|
616 | |||
616 | #print 'pinfo par: <%s>' % parameter_s # dbg |
|
617 | #print 'pinfo par: <%s>' % parameter_s # dbg | |
617 |
|
618 | |||
618 | # detail_level: 0 -> obj? , 1 -> obj?? |
|
619 | # detail_level: 0 -> obj? , 1 -> obj?? | |
619 | detail_level = 0 |
|
620 | detail_level = 0 | |
620 | # We need to detect if we got called as 'pinfo pinfo foo', which can |
|
621 | # We need to detect if we got called as 'pinfo pinfo foo', which can | |
621 | # happen if the user types 'pinfo foo?' at the cmd line. |
|
622 | # happen if the user types 'pinfo foo?' at the cmd line. | |
622 | pinfo,qmark1,oname,qmark2 = \ |
|
623 | pinfo,qmark1,oname,qmark2 = \ | |
623 | re.match('(pinfo )?(\?*)(.*?)(\??$)',parameter_s).groups() |
|
624 | re.match('(pinfo )?(\?*)(.*?)(\??$)',parameter_s).groups() | |
624 | if pinfo or qmark1 or qmark2: |
|
625 | if pinfo or qmark1 or qmark2: | |
625 | detail_level = 1 |
|
626 | detail_level = 1 | |
626 | if "*" in oname: |
|
627 | if "*" in oname: | |
627 | self.magic_psearch(oname) |
|
628 | self.magic_psearch(oname) | |
628 | else: |
|
629 | else: | |
629 | self._inspect('pinfo',oname,detail_level=detail_level) |
|
630 | self._inspect('pinfo',oname,detail_level=detail_level) | |
630 |
|
631 | |||
631 | def magic_psearch(self, parameter_s=''): |
|
632 | def magic_psearch(self, parameter_s=''): | |
632 | """Search for object in namespaces by wildcard. |
|
633 | """Search for object in namespaces by wildcard. | |
633 |
|
634 | |||
634 | %psearch [options] PATTERN [OBJECT TYPE] |
|
635 | %psearch [options] PATTERN [OBJECT TYPE] | |
635 |
|
636 | |||
636 | Note: ? can be used as a synonym for %psearch, at the beginning or at |
|
637 | Note: ? can be used as a synonym for %psearch, at the beginning or at | |
637 | the end: both a*? and ?a* are equivalent to '%psearch a*'. Still, the |
|
638 | the end: both a*? and ?a* are equivalent to '%psearch a*'. Still, the | |
638 | rest of the command line must be unchanged (options come first), so |
|
639 | rest of the command line must be unchanged (options come first), so | |
639 | for example the following forms are equivalent |
|
640 | for example the following forms are equivalent | |
640 |
|
641 | |||
641 | %psearch -i a* function |
|
642 | %psearch -i a* function | |
642 | -i a* function? |
|
643 | -i a* function? | |
643 | ?-i a* function |
|
644 | ?-i a* function | |
644 |
|
645 | |||
645 | Arguments: |
|
646 | Arguments: | |
646 |
|
647 | |||
647 | PATTERN |
|
648 | PATTERN | |
648 |
|
649 | |||
649 | where PATTERN is a string containing * as a wildcard similar to its |
|
650 | where PATTERN is a string containing * as a wildcard similar to its | |
650 | use in a shell. The pattern is matched in all namespaces on the |
|
651 | use in a shell. The pattern is matched in all namespaces on the | |
651 | search path. By default objects starting with a single _ are not |
|
652 | search path. By default objects starting with a single _ are not | |
652 | matched, many IPython generated objects have a single |
|
653 | matched, many IPython generated objects have a single | |
653 | underscore. The default is case insensitive matching. Matching is |
|
654 | underscore. The default is case insensitive matching. Matching is | |
654 | also done on the attributes of objects and not only on the objects |
|
655 | also done on the attributes of objects and not only on the objects | |
655 | in a module. |
|
656 | in a module. | |
656 |
|
657 | |||
657 | [OBJECT TYPE] |
|
658 | [OBJECT TYPE] | |
658 |
|
659 | |||
659 | Is the name of a python type from the types module. The name is |
|
660 | Is the name of a python type from the types module. The name is | |
660 | given in lowercase without the ending type, ex. StringType is |
|
661 | given in lowercase without the ending type, ex. StringType is | |
661 | written string. By adding a type here only objects matching the |
|
662 | written string. By adding a type here only objects matching the | |
662 | given type are matched. Using all here makes the pattern match all |
|
663 | given type are matched. Using all here makes the pattern match all | |
663 | types (this is the default). |
|
664 | types (this is the default). | |
664 |
|
665 | |||
665 | Options: |
|
666 | Options: | |
666 |
|
667 | |||
667 | -a: makes the pattern match even objects whose names start with a |
|
668 | -a: makes the pattern match even objects whose names start with a | |
668 | single underscore. These names are normally ommitted from the |
|
669 | single underscore. These names are normally ommitted from the | |
669 | search. |
|
670 | search. | |
670 |
|
671 | |||
671 | -i/-c: make the pattern case insensitive/sensitive. If neither of |
|
672 | -i/-c: make the pattern case insensitive/sensitive. If neither of | |
672 | these options is given, the default is read from your ipythonrc |
|
673 | these options is given, the default is read from your ipythonrc | |
673 | file. The option name which sets this value is |
|
674 | file. The option name which sets this value is | |
674 | 'wildcards_case_sensitive'. If this option is not specified in your |
|
675 | 'wildcards_case_sensitive'. If this option is not specified in your | |
675 | ipythonrc file, IPython's internal default is to do a case sensitive |
|
676 | ipythonrc file, IPython's internal default is to do a case sensitive | |
676 | search. |
|
677 | search. | |
677 |
|
678 | |||
678 | -e/-s NAMESPACE: exclude/search a given namespace. The pattern you |
|
679 | -e/-s NAMESPACE: exclude/search a given namespace. The pattern you | |
679 | specifiy can be searched in any of the following namespaces: |
|
680 | specifiy can be searched in any of the following namespaces: | |
680 | 'builtin', 'user', 'user_global','internal', 'alias', where |
|
681 | 'builtin', 'user', 'user_global','internal', 'alias', where | |
681 | 'builtin' and 'user' are the search defaults. Note that you should |
|
682 | 'builtin' and 'user' are the search defaults. Note that you should | |
682 | not use quotes when specifying namespaces. |
|
683 | not use quotes when specifying namespaces. | |
683 |
|
684 | |||
684 | 'Builtin' contains the python module builtin, 'user' contains all |
|
685 | 'Builtin' contains the python module builtin, 'user' contains all | |
685 | user data, 'alias' only contain the shell aliases and no python |
|
686 | user data, 'alias' only contain the shell aliases and no python | |
686 | objects, 'internal' contains objects used by IPython. The |
|
687 | objects, 'internal' contains objects used by IPython. The | |
687 | 'user_global' namespace is only used by embedded IPython instances, |
|
688 | 'user_global' namespace is only used by embedded IPython instances, | |
688 | and it contains module-level globals. You can add namespaces to the |
|
689 | and it contains module-level globals. You can add namespaces to the | |
689 | search with -s or exclude them with -e (these options can be given |
|
690 | search with -s or exclude them with -e (these options can be given | |
690 | more than once). |
|
691 | more than once). | |
691 |
|
692 | |||
692 | Examples: |
|
693 | Examples: | |
693 |
|
694 | |||
694 | %psearch a* -> objects beginning with an a |
|
695 | %psearch a* -> objects beginning with an a | |
695 | %psearch -e builtin a* -> objects NOT in the builtin space starting in a |
|
696 | %psearch -e builtin a* -> objects NOT in the builtin space starting in a | |
696 | %psearch a* function -> all functions beginning with an a |
|
697 | %psearch a* function -> all functions beginning with an a | |
697 | %psearch re.e* -> objects beginning with an e in module re |
|
698 | %psearch re.e* -> objects beginning with an e in module re | |
698 | %psearch r*.e* -> objects that start with e in modules starting in r |
|
699 | %psearch r*.e* -> objects that start with e in modules starting in r | |
699 | %psearch r*.* string -> all strings in modules beginning with r |
|
700 | %psearch r*.* string -> all strings in modules beginning with r | |
700 |
|
701 | |||
701 | Case sensitve search: |
|
702 | Case sensitve search: | |
702 |
|
703 | |||
703 | %psearch -c a* list all object beginning with lower case a |
|
704 | %psearch -c a* list all object beginning with lower case a | |
704 |
|
705 | |||
705 | Show objects beginning with a single _: |
|
706 | Show objects beginning with a single _: | |
706 |
|
707 | |||
707 | %psearch -a _* list objects beginning with a single underscore""" |
|
708 | %psearch -a _* list objects beginning with a single underscore""" | |
708 |
|
709 | |||
709 | # default namespaces to be searched |
|
710 | # default namespaces to be searched | |
710 | def_search = ['user','builtin'] |
|
711 | def_search = ['user','builtin'] | |
711 |
|
712 | |||
712 | # Process options/args |
|
713 | # Process options/args | |
713 | opts,args = self.parse_options(parameter_s,'cias:e:',list_all=True) |
|
714 | opts,args = self.parse_options(parameter_s,'cias:e:',list_all=True) | |
714 | opt = opts.get |
|
715 | opt = opts.get | |
715 | shell = self.shell |
|
716 | shell = self.shell | |
716 | psearch = shell.inspector.psearch |
|
717 | psearch = shell.inspector.psearch | |
717 |
|
718 | |||
718 | # select case options |
|
719 | # select case options | |
719 | if opts.has_key('i'): |
|
720 | if opts.has_key('i'): | |
720 | ignore_case = True |
|
721 | ignore_case = True | |
721 | elif opts.has_key('c'): |
|
722 | elif opts.has_key('c'): | |
722 | ignore_case = False |
|
723 | ignore_case = False | |
723 | else: |
|
724 | else: | |
724 | ignore_case = not shell.rc.wildcards_case_sensitive |
|
725 | ignore_case = not shell.rc.wildcards_case_sensitive | |
725 |
|
726 | |||
726 | # Build list of namespaces to search from user options |
|
727 | # Build list of namespaces to search from user options | |
727 | def_search.extend(opt('s',[])) |
|
728 | def_search.extend(opt('s',[])) | |
728 | ns_exclude = ns_exclude=opt('e',[]) |
|
729 | ns_exclude = ns_exclude=opt('e',[]) | |
729 | ns_search = [nm for nm in def_search if nm not in ns_exclude] |
|
730 | ns_search = [nm for nm in def_search if nm not in ns_exclude] | |
730 |
|
731 | |||
731 | # Call the actual search |
|
732 | # Call the actual search | |
732 | try: |
|
733 | try: | |
733 | psearch(args,shell.ns_table,ns_search, |
|
734 | psearch(args,shell.ns_table,ns_search, | |
734 | show_all=opt('a'),ignore_case=ignore_case) |
|
735 | show_all=opt('a'),ignore_case=ignore_case) | |
735 | except: |
|
736 | except: | |
736 | shell.showtraceback() |
|
737 | shell.showtraceback() | |
737 |
|
738 | |||
738 | def magic_who_ls(self, parameter_s=''): |
|
739 | def magic_who_ls(self, parameter_s=''): | |
739 | """Return a sorted list of all interactive variables. |
|
740 | """Return a sorted list of all interactive variables. | |
740 |
|
741 | |||
741 | If arguments are given, only variables of types matching these |
|
742 | If arguments are given, only variables of types matching these | |
742 | arguments are returned.""" |
|
743 | arguments are returned.""" | |
743 |
|
744 | |||
744 | user_ns = self.shell.user_ns |
|
745 | user_ns = self.shell.user_ns | |
745 | out = [] |
|
746 | out = [] | |
746 | typelist = parameter_s.split() |
|
747 | typelist = parameter_s.split() | |
747 | for i in self.shell.user_ns.keys(): |
|
748 | for i in self.shell.user_ns.keys(): | |
748 | if not (i.startswith('_') or i.startswith('_i')) \ |
|
749 | if not (i.startswith('_') or i.startswith('_i')) \ | |
749 | and not (self.shell.internal_ns.has_key(i) or |
|
750 | and not (self.shell.internal_ns.has_key(i) or | |
750 | self.shell.user_config_ns.has_key(i)): |
|
751 | self.shell.user_config_ns.has_key(i)): | |
751 | if typelist: |
|
752 | if typelist: | |
752 | if type(user_ns[i]).__name__ in typelist: |
|
753 | if type(user_ns[i]).__name__ in typelist: | |
753 | out.append(i) |
|
754 | out.append(i) | |
754 | else: |
|
755 | else: | |
755 | out.append(i) |
|
756 | out.append(i) | |
756 | out.sort() |
|
757 | out.sort() | |
757 | return out |
|
758 | return out | |
758 |
|
759 | |||
759 | def magic_who(self, parameter_s=''): |
|
760 | def magic_who(self, parameter_s=''): | |
760 | """Print all interactive variables, with some minimal formatting. |
|
761 | """Print all interactive variables, with some minimal formatting. | |
761 |
|
762 | |||
762 | If any arguments are given, only variables whose type matches one of |
|
763 | If any arguments are given, only variables whose type matches one of | |
763 | these are printed. For example: |
|
764 | these are printed. For example: | |
764 |
|
765 | |||
765 | %who function str |
|
766 | %who function str | |
766 |
|
767 | |||
767 | will only list functions and strings, excluding all other types of |
|
768 | will only list functions and strings, excluding all other types of | |
768 | variables. To find the proper type names, simply use type(var) at a |
|
769 | variables. To find the proper type names, simply use type(var) at a | |
769 | command line to see how python prints type names. For example: |
|
770 | command line to see how python prints type names. For example: | |
770 |
|
771 | |||
771 | In [1]: type('hello')\\ |
|
772 | In [1]: type('hello')\\ | |
772 | Out[1]: <type 'str'> |
|
773 | Out[1]: <type 'str'> | |
773 |
|
774 | |||
774 | indicates that the type name for strings is 'str'. |
|
775 | indicates that the type name for strings is 'str'. | |
775 |
|
776 | |||
776 | %who always excludes executed names loaded through your configuration |
|
777 | %who always excludes executed names loaded through your configuration | |
777 | file and things which are internal to IPython. |
|
778 | file and things which are internal to IPython. | |
778 |
|
779 | |||
779 | This is deliberate, as typically you may load many modules and the |
|
780 | This is deliberate, as typically you may load many modules and the | |
780 | purpose of %who is to show you only what you've manually defined.""" |
|
781 | purpose of %who is to show you only what you've manually defined.""" | |
781 |
|
782 | |||
782 | varlist = self.magic_who_ls(parameter_s) |
|
783 | varlist = self.magic_who_ls(parameter_s) | |
783 | if not varlist: |
|
784 | if not varlist: | |
784 | print 'Interactive namespace is empty.' |
|
785 | print 'Interactive namespace is empty.' | |
785 | return |
|
786 | return | |
786 |
|
787 | |||
787 | # if we have variables, move on... |
|
788 | # if we have variables, move on... | |
788 |
|
789 | |||
789 | # stupid flushing problem: when prompts have no separators, stdout is |
|
790 | # stupid flushing problem: when prompts have no separators, stdout is | |
790 | # getting lost. I'm starting to think this is a python bug. I'm having |
|
791 | # getting lost. I'm starting to think this is a python bug. I'm having | |
791 | # to force a flush with a print because even a sys.stdout.flush |
|
792 | # to force a flush with a print because even a sys.stdout.flush | |
792 | # doesn't seem to do anything! |
|
793 | # doesn't seem to do anything! | |
793 |
|
794 | |||
794 | count = 0 |
|
795 | count = 0 | |
795 | for i in varlist: |
|
796 | for i in varlist: | |
796 | print i+'\t', |
|
797 | print i+'\t', | |
797 | count += 1 |
|
798 | count += 1 | |
798 | if count > 8: |
|
799 | if count > 8: | |
799 | count = 0 |
|
800 | count = 0 | |
800 |
|
801 | |||
801 | sys.stdout.flush() # FIXME. Why the hell isn't this flushing??? |
|
802 | sys.stdout.flush() # FIXME. Why the hell isn't this flushing??? | |
802 |
|
803 | |||
803 | print # well, this does force a flush at the expense of an extra \n |
|
804 | print # well, this does force a flush at the expense of an extra \n | |
804 |
|
805 | |||
805 | def magic_whos(self, parameter_s=''): |
|
806 | def magic_whos(self, parameter_s=''): | |
806 | """Like %who, but gives some extra information about each variable. |
|
807 | """Like %who, but gives some extra information about each variable. | |
807 |
|
808 | |||
808 | The same type filtering of %who can be applied here. |
|
809 | The same type filtering of %who can be applied here. | |
809 |
|
810 | |||
810 | For all variables, the type is printed. Additionally it prints: |
|
811 | For all variables, the type is printed. Additionally it prints: | |
811 |
|
812 | |||
812 | - For {},[],(): their length. |
|
813 | - For {},[],(): their length. | |
813 |
|
814 | |||
814 | - For Numeric arrays, a summary with shape, number of elements, |
|
815 | - For Numeric arrays, a summary with shape, number of elements, | |
815 | typecode and size in memory. |
|
816 | typecode and size in memory. | |
816 |
|
817 | |||
817 | - Everything else: a string representation, snipping their middle if |
|
818 | - Everything else: a string representation, snipping their middle if | |
818 | too long.""" |
|
819 | too long.""" | |
819 |
|
820 | |||
820 | varnames = self.magic_who_ls(parameter_s) |
|
821 | varnames = self.magic_who_ls(parameter_s) | |
821 | if not varnames: |
|
822 | if not varnames: | |
822 | print 'Interactive namespace is empty.' |
|
823 | print 'Interactive namespace is empty.' | |
823 | return |
|
824 | return | |
824 |
|
825 | |||
825 | # if we have variables, move on... |
|
826 | # if we have variables, move on... | |
826 |
|
827 | |||
827 | # for these types, show len() instead of data: |
|
828 | # for these types, show len() instead of data: | |
828 | seq_types = [types.DictType,types.ListType,types.TupleType] |
|
829 | seq_types = [types.DictType,types.ListType,types.TupleType] | |
829 |
|
830 | |||
830 | # for Numeric arrays, display summary info |
|
831 | # for Numeric arrays, display summary info | |
831 | try: |
|
832 | try: | |
832 | import Numeric |
|
833 | import Numeric | |
833 | except ImportError: |
|
834 | except ImportError: | |
834 | array_type = None |
|
835 | array_type = None | |
835 | else: |
|
836 | else: | |
836 | array_type = Numeric.ArrayType.__name__ |
|
837 | array_type = Numeric.ArrayType.__name__ | |
837 |
|
838 | |||
838 | # Find all variable names and types so we can figure out column sizes |
|
839 | # Find all variable names and types so we can figure out column sizes | |
839 | get_vars = lambda i: self.shell.user_ns[i] |
|
840 | get_vars = lambda i: self.shell.user_ns[i] | |
840 | type_name = lambda v: type(v).__name__ |
|
841 | type_name = lambda v: type(v).__name__ | |
841 | varlist = map(get_vars,varnames) |
|
842 | varlist = map(get_vars,varnames) | |
842 | typelist = map(type_name,varlist) |
|
843 | typelist = map(type_name,varlist) | |
843 | # column labels and # of spaces as separator |
|
844 | # column labels and # of spaces as separator | |
844 | varlabel = 'Variable' |
|
845 | varlabel = 'Variable' | |
845 | typelabel = 'Type' |
|
846 | typelabel = 'Type' | |
846 | datalabel = 'Data/Info' |
|
847 | datalabel = 'Data/Info' | |
847 | colsep = 3 |
|
848 | colsep = 3 | |
848 | # variable format strings |
|
849 | # variable format strings | |
849 | vformat = "$vname.ljust(varwidth)$vtype.ljust(typewidth)" |
|
850 | vformat = "$vname.ljust(varwidth)$vtype.ljust(typewidth)" | |
850 | vfmt_short = '$vstr[:25]<...>$vstr[-25:]' |
|
851 | vfmt_short = '$vstr[:25]<...>$vstr[-25:]' | |
851 | aformat = "%s: %s elems, type `%s`, %s bytes" |
|
852 | aformat = "%s: %s elems, type `%s`, %s bytes" | |
852 | # find the size of the columns to format the output nicely |
|
853 | # find the size of the columns to format the output nicely | |
853 | varwidth = max(max(map(len,varnames)), len(varlabel)) + colsep |
|
854 | varwidth = max(max(map(len,varnames)), len(varlabel)) + colsep | |
854 | typewidth = max(max(map(len,typelist)), len(typelabel)) + colsep |
|
855 | typewidth = max(max(map(len,typelist)), len(typelabel)) + colsep | |
855 | # table header |
|
856 | # table header | |
856 | print varlabel.ljust(varwidth) + typelabel.ljust(typewidth) + \ |
|
857 | print varlabel.ljust(varwidth) + typelabel.ljust(typewidth) + \ | |
857 | ' '+datalabel+'\n' + '-'*(varwidth+typewidth+len(datalabel)+1) |
|
858 | ' '+datalabel+'\n' + '-'*(varwidth+typewidth+len(datalabel)+1) | |
858 | # and the table itself |
|
859 | # and the table itself | |
859 | kb = 1024 |
|
860 | kb = 1024 | |
860 | Mb = 1048576 # kb**2 |
|
861 | Mb = 1048576 # kb**2 | |
861 | for vname,var,vtype in zip(varnames,varlist,typelist): |
|
862 | for vname,var,vtype in zip(varnames,varlist,typelist): | |
862 | print itpl(vformat), |
|
863 | print itpl(vformat), | |
863 | if vtype in seq_types: |
|
864 | if vtype in seq_types: | |
864 | print len(var) |
|
865 | print len(var) | |
865 | elif vtype==array_type: |
|
866 | elif vtype==array_type: | |
866 | vshape = str(var.shape).replace(',','').replace(' ','x')[1:-1] |
|
867 | vshape = str(var.shape).replace(',','').replace(' ','x')[1:-1] | |
867 | vsize = Numeric.size(var) |
|
868 | vsize = Numeric.size(var) | |
868 | vbytes = vsize*var.itemsize() |
|
869 | vbytes = vsize*var.itemsize() | |
869 | if vbytes < 100000: |
|
870 | if vbytes < 100000: | |
870 | print aformat % (vshape,vsize,var.typecode(),vbytes) |
|
871 | print aformat % (vshape,vsize,var.typecode(),vbytes) | |
871 | else: |
|
872 | else: | |
872 | print aformat % (vshape,vsize,var.typecode(),vbytes), |
|
873 | print aformat % (vshape,vsize,var.typecode(),vbytes), | |
873 | if vbytes < Mb: |
|
874 | if vbytes < Mb: | |
874 | print '(%s kb)' % (vbytes/kb,) |
|
875 | print '(%s kb)' % (vbytes/kb,) | |
875 | else: |
|
876 | else: | |
876 | print '(%s Mb)' % (vbytes/Mb,) |
|
877 | print '(%s Mb)' % (vbytes/Mb,) | |
877 | else: |
|
878 | else: | |
878 | vstr = str(var) |
|
879 | vstr = str(var) | |
879 | if len(vstr) < 50: |
|
880 | if len(vstr) < 50: | |
880 | print vstr |
|
881 | print vstr | |
881 | else: |
|
882 | else: | |
882 | printpl(vfmt_short) |
|
883 | printpl(vfmt_short) | |
883 |
|
884 | |||
884 | def magic_reset(self, parameter_s=''): |
|
885 | def magic_reset(self, parameter_s=''): | |
885 | """Resets the namespace by removing all names defined by the user. |
|
886 | """Resets the namespace by removing all names defined by the user. | |
886 |
|
887 | |||
887 | Input/Output history are left around in case you need them.""" |
|
888 | Input/Output history are left around in case you need them.""" | |
888 |
|
889 | |||
889 | ans = raw_input( |
|
890 | ans = raw_input( | |
890 | "Once deleted, variables cannot be recovered. Proceed (y/n)? ") |
|
891 | "Once deleted, variables cannot be recovered. Proceed (y/n)? ") | |
891 | if not ans.lower() == 'y': |
|
892 | if not ans.lower() == 'y': | |
892 | print 'Nothing done.' |
|
893 | print 'Nothing done.' | |
893 | return |
|
894 | return | |
894 | user_ns = self.shell.user_ns |
|
895 | user_ns = self.shell.user_ns | |
895 | for i in self.magic_who_ls(): |
|
896 | for i in self.magic_who_ls(): | |
896 | del(user_ns[i]) |
|
897 | del(user_ns[i]) | |
897 |
|
898 | |||
898 | def magic_config(self,parameter_s=''): |
|
899 | def magic_config(self,parameter_s=''): | |
899 | """Show IPython's internal configuration.""" |
|
900 | """Show IPython's internal configuration.""" | |
900 |
|
901 | |||
901 | page('Current configuration structure:\n'+ |
|
902 | page('Current configuration structure:\n'+ | |
902 | pformat(self.shell.rc.dict())) |
|
903 | pformat(self.shell.rc.dict())) | |
903 |
|
904 | |||
904 | def magic_logstart(self,parameter_s=''): |
|
905 | def magic_logstart(self,parameter_s=''): | |
905 | """Start logging anywhere in a session. |
|
906 | """Start logging anywhere in a session. | |
906 |
|
907 | |||
907 | %logstart [-o|-t] [log_name [log_mode]] |
|
908 | %logstart [-o|-t] [log_name [log_mode]] | |
908 |
|
909 | |||
909 | If no name is given, it defaults to a file named 'ipython_log.py' in your |
|
910 | If no name is given, it defaults to a file named 'ipython_log.py' in your | |
910 | current directory, in 'rotate' mode (see below). |
|
911 | current directory, in 'rotate' mode (see below). | |
911 |
|
912 | |||
912 | '%logstart name' saves to file 'name' in 'backup' mode. It saves your |
|
913 | '%logstart name' saves to file 'name' in 'backup' mode. It saves your | |
913 | history up to that point and then continues logging. |
|
914 | history up to that point and then continues logging. | |
914 |
|
915 | |||
915 | %logstart takes a second optional parameter: logging mode. This can be one |
|
916 | %logstart takes a second optional parameter: logging mode. This can be one | |
916 | of (note that the modes are given unquoted):\\ |
|
917 | of (note that the modes are given unquoted):\\ | |
917 | append: well, that says it.\\ |
|
918 | append: well, that says it.\\ | |
918 | backup: rename (if exists) to name~ and start name.\\ |
|
919 | backup: rename (if exists) to name~ and start name.\\ | |
919 | global: single logfile in your home dir, appended to.\\ |
|
920 | global: single logfile in your home dir, appended to.\\ | |
920 | over : overwrite existing log.\\ |
|
921 | over : overwrite existing log.\\ | |
921 | rotate: create rotating logs name.1~, name.2~, etc. |
|
922 | rotate: create rotating logs name.1~, name.2~, etc. | |
922 |
|
923 | |||
923 | Options: |
|
924 | Options: | |
924 |
|
925 | |||
925 | -o: log also IPython's output. In this mode, all commands which |
|
926 | -o: log also IPython's output. In this mode, all commands which | |
926 | generate an Out[NN] prompt are recorded to the logfile, right after |
|
927 | generate an Out[NN] prompt are recorded to the logfile, right after | |
927 | their corresponding input line. The output lines are always |
|
928 | their corresponding input line. The output lines are always | |
928 | prepended with a #[Out]# marker, so that the log remains valid |
|
929 | prepended with a #[Out]# marker, so that the log remains valid | |
929 | Python code. |
|
930 | Python code. | |
930 |
|
931 | |||
931 | -t: put timestamps before each input line logged (these are put in |
|
932 | -t: put timestamps before each input line logged (these are put in | |
932 | comments).""" |
|
933 | comments).""" | |
933 |
|
934 | |||
934 | opts,par = self.parse_options(parameter_s,'ot') |
|
935 | opts,par = self.parse_options(parameter_s,'ot') | |
935 | log_output = 'o' in opts |
|
936 | log_output = 'o' in opts | |
936 | timestamp = 't' in opts |
|
937 | timestamp = 't' in opts | |
937 |
|
938 | |||
938 | rc = self.shell.rc |
|
939 | rc = self.shell.rc | |
939 | logger = self.shell.logger |
|
940 | logger = self.shell.logger | |
940 |
|
941 | |||
941 | # if no args are given, the defaults set in the logger constructor by |
|
942 | # if no args are given, the defaults set in the logger constructor by | |
942 | # ipytohn remain valid |
|
943 | # ipytohn remain valid | |
943 | if par: |
|
944 | if par: | |
944 | try: |
|
945 | try: | |
945 | logfname,logmode = par.split() |
|
946 | logfname,logmode = par.split() | |
946 | except: |
|
947 | except: | |
947 | logfname = par |
|
948 | logfname = par | |
948 | logmode = 'backup' |
|
949 | logmode = 'backup' | |
949 | else: |
|
950 | else: | |
950 | logfname = logger.logfname |
|
951 | logfname = logger.logfname | |
951 | logmode = logger.logmode |
|
952 | logmode = logger.logmode | |
952 | # put logfname into rc struct as if it had been called on the command |
|
953 | # put logfname into rc struct as if it had been called on the command | |
953 | # line, so it ends up saved in the log header Save it in case we need |
|
954 | # line, so it ends up saved in the log header Save it in case we need | |
954 | # to restore it... |
|
955 | # to restore it... | |
955 | old_logfile = rc.opts.get('logfile','') |
|
956 | old_logfile = rc.opts.get('logfile','') | |
956 | if logfname: |
|
957 | if logfname: | |
957 | logfname = os.path.expanduser(logfname) |
|
958 | logfname = os.path.expanduser(logfname) | |
958 | rc.opts.logfile = logfname |
|
959 | rc.opts.logfile = logfname | |
959 | loghead = self.shell.loghead_tpl % (rc.opts,rc.args) |
|
960 | loghead = self.shell.loghead_tpl % (rc.opts,rc.args) | |
960 | try: |
|
961 | try: | |
961 | started = logger.logstart(logfname,loghead,logmode, |
|
962 | started = logger.logstart(logfname,loghead,logmode, | |
962 | log_output,timestamp) |
|
963 | log_output,timestamp) | |
963 | except: |
|
964 | except: | |
964 | rc.opts.logfile = old_logfile |
|
965 | rc.opts.logfile = old_logfile | |
965 | warn("Couldn't start log: %s" % sys.exc_info()[1]) |
|
966 | warn("Couldn't start log: %s" % sys.exc_info()[1]) | |
966 | else: |
|
967 | else: | |
967 | # log input history up to this point, optionally interleaving |
|
968 | # log input history up to this point, optionally interleaving | |
968 | # output if requested |
|
969 | # output if requested | |
969 |
|
970 | |||
970 | if timestamp: |
|
971 | if timestamp: | |
971 | # disable timestamping for the previous history, since we've |
|
972 | # disable timestamping for the previous history, since we've | |
972 | # lost those already (no time machine here). |
|
973 | # lost those already (no time machine here). | |
973 | logger.timestamp = False |
|
974 | logger.timestamp = False | |
974 | if log_output: |
|
975 | if log_output: | |
975 | log_write = logger.log_write |
|
976 | log_write = logger.log_write | |
976 | input_hist = self.shell.input_hist |
|
977 | input_hist = self.shell.input_hist | |
977 | output_hist = self.shell.output_hist |
|
978 | output_hist = self.shell.output_hist | |
978 | for n in range(1,len(input_hist)-1): |
|
979 | for n in range(1,len(input_hist)-1): | |
979 | log_write(input_hist[n].rstrip()) |
|
980 | log_write(input_hist[n].rstrip()) | |
980 | if n in output_hist: |
|
981 | if n in output_hist: | |
981 | log_write(repr(output_hist[n]),'output') |
|
982 | log_write(repr(output_hist[n]),'output') | |
982 | else: |
|
983 | else: | |
983 | logger.log_write(self.shell.input_hist[1:]) |
|
984 | logger.log_write(self.shell.input_hist[1:]) | |
984 | if timestamp: |
|
985 | if timestamp: | |
985 | # re-enable timestamping |
|
986 | # re-enable timestamping | |
986 | logger.timestamp = True |
|
987 | logger.timestamp = True | |
987 |
|
988 | |||
988 | print ('Activating auto-logging. ' |
|
989 | print ('Activating auto-logging. ' | |
989 | 'Current session state plus future input saved.') |
|
990 | 'Current session state plus future input saved.') | |
990 | logger.logstate() |
|
991 | logger.logstate() | |
991 |
|
992 | |||
992 | def magic_logoff(self,parameter_s=''): |
|
993 | def magic_logoff(self,parameter_s=''): | |
993 | """Temporarily stop logging. |
|
994 | """Temporarily stop logging. | |
994 |
|
995 | |||
995 | You must have previously started logging.""" |
|
996 | You must have previously started logging.""" | |
996 | self.shell.logger.switch_log(0) |
|
997 | self.shell.logger.switch_log(0) | |
997 |
|
998 | |||
998 | def magic_logon(self,parameter_s=''): |
|
999 | def magic_logon(self,parameter_s=''): | |
999 | """Restart logging. |
|
1000 | """Restart logging. | |
1000 |
|
1001 | |||
1001 | This function is for restarting logging which you've temporarily |
|
1002 | This function is for restarting logging which you've temporarily | |
1002 | stopped with %logoff. For starting logging for the first time, you |
|
1003 | stopped with %logoff. For starting logging for the first time, you | |
1003 | must use the %logstart function, which allows you to specify an |
|
1004 | must use the %logstart function, which allows you to specify an | |
1004 | optional log filename.""" |
|
1005 | optional log filename.""" | |
1005 |
|
1006 | |||
1006 | self.shell.logger.switch_log(1) |
|
1007 | self.shell.logger.switch_log(1) | |
1007 |
|
1008 | |||
1008 | def magic_logstate(self,parameter_s=''): |
|
1009 | def magic_logstate(self,parameter_s=''): | |
1009 | """Print the status of the logging system.""" |
|
1010 | """Print the status of the logging system.""" | |
1010 |
|
1011 | |||
1011 | self.shell.logger.logstate() |
|
1012 | self.shell.logger.logstate() | |
1012 |
|
1013 | |||
1013 | def magic_pdb(self, parameter_s=''): |
|
1014 | def magic_pdb(self, parameter_s=''): | |
1014 | """Control the calling of the pdb interactive debugger. |
|
1015 | """Control the calling of the pdb interactive debugger. | |
1015 |
|
1016 | |||
1016 | Call as '%pdb on', '%pdb 1', '%pdb off' or '%pdb 0'. If called without |
|
1017 | Call as '%pdb on', '%pdb 1', '%pdb off' or '%pdb 0'. If called without | |
1017 | argument it works as a toggle. |
|
1018 | argument it works as a toggle. | |
1018 |
|
1019 | |||
1019 | When an exception is triggered, IPython can optionally call the |
|
1020 | When an exception is triggered, IPython can optionally call the | |
1020 | interactive pdb debugger after the traceback printout. %pdb toggles |
|
1021 | interactive pdb debugger after the traceback printout. %pdb toggles | |
1021 | this feature on and off.""" |
|
1022 | this feature on and off.""" | |
1022 |
|
1023 | |||
1023 | par = parameter_s.strip().lower() |
|
1024 | par = parameter_s.strip().lower() | |
1024 |
|
1025 | |||
1025 | if par: |
|
1026 | if par: | |
1026 | try: |
|
1027 | try: | |
1027 | new_pdb = {'off':0,'0':0,'on':1,'1':1}[par] |
|
1028 | new_pdb = {'off':0,'0':0,'on':1,'1':1}[par] | |
1028 | except KeyError: |
|
1029 | except KeyError: | |
1029 | print ('Incorrect argument. Use on/1, off/0, ' |
|
1030 | print ('Incorrect argument. Use on/1, off/0, ' | |
1030 | 'or nothing for a toggle.') |
|
1031 | 'or nothing for a toggle.') | |
1031 | return |
|
1032 | return | |
1032 | else: |
|
1033 | else: | |
1033 | # toggle |
|
1034 | # toggle | |
1034 | new_pdb = not self.shell.InteractiveTB.call_pdb |
|
1035 | new_pdb = not self.shell.InteractiveTB.call_pdb | |
1035 |
|
1036 | |||
1036 | # set on the shell |
|
1037 | # set on the shell | |
1037 | self.shell.call_pdb = new_pdb |
|
1038 | self.shell.call_pdb = new_pdb | |
1038 | print 'Automatic pdb calling has been turned',on_off(new_pdb) |
|
1039 | print 'Automatic pdb calling has been turned',on_off(new_pdb) | |
1039 |
|
1040 | |||
1040 | def magic_prun(self, parameter_s ='',user_mode=1, |
|
1041 | def magic_prun(self, parameter_s ='',user_mode=1, | |
1041 | opts=None,arg_lst=None,prog_ns=None): |
|
1042 | opts=None,arg_lst=None,prog_ns=None): | |
1042 |
|
1043 | |||
1043 | """Run a statement through the python code profiler. |
|
1044 | """Run a statement through the python code profiler. | |
1044 |
|
1045 | |||
1045 | Usage:\\ |
|
1046 | Usage:\\ | |
1046 | %prun [options] statement |
|
1047 | %prun [options] statement | |
1047 |
|
1048 | |||
1048 | The given statement (which doesn't require quote marks) is run via the |
|
1049 | The given statement (which doesn't require quote marks) is run via the | |
1049 | python profiler in a manner similar to the profile.run() function. |
|
1050 | python profiler in a manner similar to the profile.run() function. | |
1050 | Namespaces are internally managed to work correctly; profile.run |
|
1051 | Namespaces are internally managed to work correctly; profile.run | |
1051 | cannot be used in IPython because it makes certain assumptions about |
|
1052 | cannot be used in IPython because it makes certain assumptions about | |
1052 | namespaces which do not hold under IPython. |
|
1053 | namespaces which do not hold under IPython. | |
1053 |
|
1054 | |||
1054 | Options: |
|
1055 | Options: | |
1055 |
|
1056 | |||
1056 | -l <limit>: you can place restrictions on what or how much of the |
|
1057 | -l <limit>: you can place restrictions on what or how much of the | |
1057 | profile gets printed. The limit value can be: |
|
1058 | profile gets printed. The limit value can be: | |
1058 |
|
1059 | |||
1059 | * A string: only information for function names containing this string |
|
1060 | * A string: only information for function names containing this string | |
1060 | is printed. |
|
1061 | is printed. | |
1061 |
|
1062 | |||
1062 | * An integer: only these many lines are printed. |
|
1063 | * An integer: only these many lines are printed. | |
1063 |
|
1064 | |||
1064 | * A float (between 0 and 1): this fraction of the report is printed |
|
1065 | * A float (between 0 and 1): this fraction of the report is printed | |
1065 | (for example, use a limit of 0.4 to see the topmost 40% only). |
|
1066 | (for example, use a limit of 0.4 to see the topmost 40% only). | |
1066 |
|
1067 | |||
1067 | You can combine several limits with repeated use of the option. For |
|
1068 | You can combine several limits with repeated use of the option. For | |
1068 | example, '-l __init__ -l 5' will print only the topmost 5 lines of |
|
1069 | example, '-l __init__ -l 5' will print only the topmost 5 lines of | |
1069 | information about class constructors. |
|
1070 | information about class constructors. | |
1070 |
|
1071 | |||
1071 | -r: return the pstats.Stats object generated by the profiling. This |
|
1072 | -r: return the pstats.Stats object generated by the profiling. This | |
1072 | object has all the information about the profile in it, and you can |
|
1073 | object has all the information about the profile in it, and you can | |
1073 | later use it for further analysis or in other functions. |
|
1074 | later use it for further analysis or in other functions. | |
1074 |
|
1075 | |||
1075 | Since magic functions have a particular form of calling which prevents |
|
1076 | Since magic functions have a particular form of calling which prevents | |
1076 | you from writing something like:\\ |
|
1077 | you from writing something like:\\ | |
1077 | In [1]: p = %prun -r print 4 # invalid!\\ |
|
1078 | In [1]: p = %prun -r print 4 # invalid!\\ | |
1078 | you must instead use IPython's automatic variables to assign this:\\ |
|
1079 | you must instead use IPython's automatic variables to assign this:\\ | |
1079 | In [1]: %prun -r print 4 \\ |
|
1080 | In [1]: %prun -r print 4 \\ | |
1080 | Out[1]: <pstats.Stats instance at 0x8222cec>\\ |
|
1081 | Out[1]: <pstats.Stats instance at 0x8222cec>\\ | |
1081 | In [2]: stats = _ |
|
1082 | In [2]: stats = _ | |
1082 |
|
1083 | |||
1083 | If you really need to assign this value via an explicit function call, |
|
1084 | If you really need to assign this value via an explicit function call, | |
1084 | you can always tap directly into the true name of the magic function |
|
1085 | you can always tap directly into the true name of the magic function | |
1085 | by using the ipmagic function (which IPython automatically adds to the |
|
1086 | by using the ipmagic function (which IPython automatically adds to the | |
1086 | builtins):\\ |
|
1087 | builtins):\\ | |
1087 | In [3]: stats = ipmagic('prun','-r print 4') |
|
1088 | In [3]: stats = ipmagic('prun','-r print 4') | |
1088 |
|
1089 | |||
1089 | You can type ipmagic? for more details on ipmagic. |
|
1090 | You can type ipmagic? for more details on ipmagic. | |
1090 |
|
1091 | |||
1091 | -s <key>: sort profile by given key. You can provide more than one key |
|
1092 | -s <key>: sort profile by given key. You can provide more than one key | |
1092 | by using the option several times: '-s key1 -s key2 -s key3...'. The |
|
1093 | by using the option several times: '-s key1 -s key2 -s key3...'. The | |
1093 | default sorting key is 'time'. |
|
1094 | default sorting key is 'time'. | |
1094 |
|
1095 | |||
1095 | The following is copied verbatim from the profile documentation |
|
1096 | The following is copied verbatim from the profile documentation | |
1096 | referenced below: |
|
1097 | referenced below: | |
1097 |
|
1098 | |||
1098 | When more than one key is provided, additional keys are used as |
|
1099 | When more than one key is provided, additional keys are used as | |
1099 | secondary criteria when the there is equality in all keys selected |
|
1100 | secondary criteria when the there is equality in all keys selected | |
1100 | before them. |
|
1101 | before them. | |
1101 |
|
1102 | |||
1102 | Abbreviations can be used for any key names, as long as the |
|
1103 | Abbreviations can be used for any key names, as long as the | |
1103 | abbreviation is unambiguous. The following are the keys currently |
|
1104 | abbreviation is unambiguous. The following are the keys currently | |
1104 | defined: |
|
1105 | defined: | |
1105 |
|
1106 | |||
1106 | Valid Arg Meaning\\ |
|
1107 | Valid Arg Meaning\\ | |
1107 | "calls" call count\\ |
|
1108 | "calls" call count\\ | |
1108 | "cumulative" cumulative time\\ |
|
1109 | "cumulative" cumulative time\\ | |
1109 | "file" file name\\ |
|
1110 | "file" file name\\ | |
1110 | "module" file name\\ |
|
1111 | "module" file name\\ | |
1111 | "pcalls" primitive call count\\ |
|
1112 | "pcalls" primitive call count\\ | |
1112 | "line" line number\\ |
|
1113 | "line" line number\\ | |
1113 | "name" function name\\ |
|
1114 | "name" function name\\ | |
1114 | "nfl" name/file/line\\ |
|
1115 | "nfl" name/file/line\\ | |
1115 | "stdname" standard name\\ |
|
1116 | "stdname" standard name\\ | |
1116 | "time" internal time |
|
1117 | "time" internal time | |
1117 |
|
1118 | |||
1118 | Note that all sorts on statistics are in descending order (placing |
|
1119 | Note that all sorts on statistics are in descending order (placing | |
1119 | most time consuming items first), where as name, file, and line number |
|
1120 | most time consuming items first), where as name, file, and line number | |
1120 | searches are in ascending order (i.e., alphabetical). The subtle |
|
1121 | searches are in ascending order (i.e., alphabetical). The subtle | |
1121 | distinction between "nfl" and "stdname" is that the standard name is a |
|
1122 | distinction between "nfl" and "stdname" is that the standard name is a | |
1122 | sort of the name as printed, which means that the embedded line |
|
1123 | sort of the name as printed, which means that the embedded line | |
1123 | numbers get compared in an odd way. For example, lines 3, 20, and 40 |
|
1124 | numbers get compared in an odd way. For example, lines 3, 20, and 40 | |
1124 | would (if the file names were the same) appear in the string order |
|
1125 | would (if the file names were the same) appear in the string order | |
1125 | "20" "3" and "40". In contrast, "nfl" does a numeric compare of the |
|
1126 | "20" "3" and "40". In contrast, "nfl" does a numeric compare of the | |
1126 | line numbers. In fact, sort_stats("nfl") is the same as |
|
1127 | line numbers. In fact, sort_stats("nfl") is the same as | |
1127 | sort_stats("name", "file", "line"). |
|
1128 | sort_stats("name", "file", "line"). | |
1128 |
|
1129 | |||
1129 | -T <filename>: save profile results as shown on screen to a text |
|
1130 | -T <filename>: save profile results as shown on screen to a text | |
1130 | file. The profile is still shown on screen. |
|
1131 | file. The profile is still shown on screen. | |
1131 |
|
1132 | |||
1132 | -D <filename>: save (via dump_stats) profile statistics to given |
|
1133 | -D <filename>: save (via dump_stats) profile statistics to given | |
1133 | filename. This data is in a format understod by the pstats module, and |
|
1134 | filename. This data is in a format understod by the pstats module, and | |
1134 | is generated by a call to the dump_stats() method of profile |
|
1135 | is generated by a call to the dump_stats() method of profile | |
1135 | objects. The profile is still shown on screen. |
|
1136 | objects. The profile is still shown on screen. | |
1136 |
|
1137 | |||
1137 | If you want to run complete programs under the profiler's control, use |
|
1138 | If you want to run complete programs under the profiler's control, use | |
1138 | '%run -p [prof_opts] filename.py [args to program]' where prof_opts |
|
1139 | '%run -p [prof_opts] filename.py [args to program]' where prof_opts | |
1139 | contains profiler specific options as described here. |
|
1140 | contains profiler specific options as described here. | |
1140 |
|
1141 | |||
1141 | You can read the complete documentation for the profile module with:\\ |
|
1142 | You can read the complete documentation for the profile module with:\\ | |
1142 | In [1]: import profile; profile.help() """ |
|
1143 | In [1]: import profile; profile.help() """ | |
1143 |
|
1144 | |||
1144 | opts_def = Struct(D=[''],l=[],s=['time'],T=['']) |
|
1145 | opts_def = Struct(D=[''],l=[],s=['time'],T=['']) | |
1145 | # protect user quote marks |
|
1146 | # protect user quote marks | |
1146 | parameter_s = parameter_s.replace('"',r'\"').replace("'",r"\'") |
|
1147 | parameter_s = parameter_s.replace('"',r'\"').replace("'",r"\'") | |
1147 |
|
1148 | |||
1148 | if user_mode: # regular user call |
|
1149 | if user_mode: # regular user call | |
1149 | opts,arg_str = self.parse_options(parameter_s,'D:l:rs:T:', |
|
1150 | opts,arg_str = self.parse_options(parameter_s,'D:l:rs:T:', | |
1150 | list_all=1) |
|
1151 | list_all=1) | |
1151 | namespace = self.shell.user_ns |
|
1152 | namespace = self.shell.user_ns | |
1152 | else: # called to run a program by %run -p |
|
1153 | else: # called to run a program by %run -p | |
1153 | try: |
|
1154 | try: | |
1154 | filename = get_py_filename(arg_lst[0]) |
|
1155 | filename = get_py_filename(arg_lst[0]) | |
1155 | except IOError,msg: |
|
1156 | except IOError,msg: | |
1156 | error(msg) |
|
1157 | error(msg) | |
1157 | return |
|
1158 | return | |
1158 |
|
1159 | |||
1159 | arg_str = 'execfile(filename,prog_ns)' |
|
1160 | arg_str = 'execfile(filename,prog_ns)' | |
1160 | namespace = locals() |
|
1161 | namespace = locals() | |
1161 |
|
1162 | |||
1162 | opts.merge(opts_def) |
|
1163 | opts.merge(opts_def) | |
1163 |
|
1164 | |||
1164 | prof = profile.Profile() |
|
1165 | prof = profile.Profile() | |
1165 | try: |
|
1166 | try: | |
1166 | prof = prof.runctx(arg_str,namespace,namespace) |
|
1167 | prof = prof.runctx(arg_str,namespace,namespace) | |
1167 | sys_exit = '' |
|
1168 | sys_exit = '' | |
1168 | except SystemExit: |
|
1169 | except SystemExit: | |
1169 | sys_exit = """*** SystemExit exception caught in code being profiled.""" |
|
1170 | sys_exit = """*** SystemExit exception caught in code being profiled.""" | |
1170 |
|
1171 | |||
1171 | stats = pstats.Stats(prof).strip_dirs().sort_stats(*opts.s) |
|
1172 | stats = pstats.Stats(prof).strip_dirs().sort_stats(*opts.s) | |
1172 |
|
1173 | |||
1173 | lims = opts.l |
|
1174 | lims = opts.l | |
1174 | if lims: |
|
1175 | if lims: | |
1175 | lims = [] # rebuild lims with ints/floats/strings |
|
1176 | lims = [] # rebuild lims with ints/floats/strings | |
1176 | for lim in opts.l: |
|
1177 | for lim in opts.l: | |
1177 | try: |
|
1178 | try: | |
1178 | lims.append(int(lim)) |
|
1179 | lims.append(int(lim)) | |
1179 | except ValueError: |
|
1180 | except ValueError: | |
1180 | try: |
|
1181 | try: | |
1181 | lims.append(float(lim)) |
|
1182 | lims.append(float(lim)) | |
1182 | except ValueError: |
|
1183 | except ValueError: | |
1183 | lims.append(lim) |
|
1184 | lims.append(lim) | |
1184 |
|
1185 | |||
1185 | # trap output |
|
1186 | # trap output | |
1186 | sys_stdout = sys.stdout |
|
1187 | sys_stdout = sys.stdout | |
1187 | stdout_trap = StringIO() |
|
1188 | stdout_trap = StringIO() | |
1188 | try: |
|
1189 | try: | |
1189 | sys.stdout = stdout_trap |
|
1190 | sys.stdout = stdout_trap | |
1190 | stats.print_stats(*lims) |
|
1191 | stats.print_stats(*lims) | |
1191 | finally: |
|
1192 | finally: | |
1192 | sys.stdout = sys_stdout |
|
1193 | sys.stdout = sys_stdout | |
1193 | output = stdout_trap.getvalue() |
|
1194 | output = stdout_trap.getvalue() | |
1194 | output = output.rstrip() |
|
1195 | output = output.rstrip() | |
1195 |
|
1196 | |||
1196 | page(output,screen_lines=self.shell.rc.screen_length) |
|
1197 | page(output,screen_lines=self.shell.rc.screen_length) | |
1197 | print sys_exit, |
|
1198 | print sys_exit, | |
1198 |
|
1199 | |||
1199 | dump_file = opts.D[0] |
|
1200 | dump_file = opts.D[0] | |
1200 | text_file = opts.T[0] |
|
1201 | text_file = opts.T[0] | |
1201 | if dump_file: |
|
1202 | if dump_file: | |
1202 | prof.dump_stats(dump_file) |
|
1203 | prof.dump_stats(dump_file) | |
1203 | print '\n*** Profile stats marshalled to file',\ |
|
1204 | print '\n*** Profile stats marshalled to file',\ | |
1204 | `dump_file`+'.',sys_exit |
|
1205 | `dump_file`+'.',sys_exit | |
1205 | if text_file: |
|
1206 | if text_file: | |
1206 | file(text_file,'w').write(output) |
|
1207 | file(text_file,'w').write(output) | |
1207 | print '\n*** Profile printout saved to text file',\ |
|
1208 | print '\n*** Profile printout saved to text file',\ | |
1208 | `text_file`+'.',sys_exit |
|
1209 | `text_file`+'.',sys_exit | |
1209 |
|
1210 | |||
1210 | if opts.has_key('r'): |
|
1211 | if opts.has_key('r'): | |
1211 | return stats |
|
1212 | return stats | |
1212 | else: |
|
1213 | else: | |
1213 | return None |
|
1214 | return None | |
1214 |
|
1215 | |||
1215 | def magic_run(self, parameter_s ='',runner=None): |
|
1216 | def magic_run(self, parameter_s ='',runner=None): | |
1216 | """Run the named file inside IPython as a program. |
|
1217 | """Run the named file inside IPython as a program. | |
1217 |
|
1218 | |||
1218 | Usage:\\ |
|
1219 | Usage:\\ | |
1219 | %run [-n -i -t [-N<N>] -d [-b<N>] -p [profile options]] file [args] |
|
1220 | %run [-n -i -t [-N<N>] -d [-b<N>] -p [profile options]] file [args] | |
1220 |
|
1221 | |||
1221 | Parameters after the filename are passed as command-line arguments to |
|
1222 | Parameters after the filename are passed as command-line arguments to | |
1222 | the program (put in sys.argv). Then, control returns to IPython's |
|
1223 | the program (put in sys.argv). Then, control returns to IPython's | |
1223 | prompt. |
|
1224 | prompt. | |
1224 |
|
1225 | |||
1225 | This is similar to running at a system prompt:\\ |
|
1226 | This is similar to running at a system prompt:\\ | |
1226 | $ python file args\\ |
|
1227 | $ python file args\\ | |
1227 | but with the advantage of giving you IPython's tracebacks, and of |
|
1228 | but with the advantage of giving you IPython's tracebacks, and of | |
1228 | loading all variables into your interactive namespace for further use |
|
1229 | loading all variables into your interactive namespace for further use | |
1229 | (unless -p is used, see below). |
|
1230 | (unless -p is used, see below). | |
1230 |
|
1231 | |||
1231 | The file is executed in a namespace initially consisting only of |
|
1232 | The file is executed in a namespace initially consisting only of | |
1232 | __name__=='__main__' and sys.argv constructed as indicated. It thus |
|
1233 | __name__=='__main__' and sys.argv constructed as indicated. It thus | |
1233 | sees its environment as if it were being run as a stand-alone |
|
1234 | sees its environment as if it were being run as a stand-alone | |
1234 | program. But after execution, the IPython interactive namespace gets |
|
1235 | program. But after execution, the IPython interactive namespace gets | |
1235 | updated with all variables defined in the program (except for __name__ |
|
1236 | updated with all variables defined in the program (except for __name__ | |
1236 | and sys.argv). This allows for very convenient loading of code for |
|
1237 | and sys.argv). This allows for very convenient loading of code for | |
1237 | interactive work, while giving each program a 'clean sheet' to run in. |
|
1238 | interactive work, while giving each program a 'clean sheet' to run in. | |
1238 |
|
1239 | |||
1239 | Options: |
|
1240 | Options: | |
1240 |
|
1241 | |||
1241 | -n: __name__ is NOT set to '__main__', but to the running file's name |
|
1242 | -n: __name__ is NOT set to '__main__', but to the running file's name | |
1242 | without extension (as python does under import). This allows running |
|
1243 | without extension (as python does under import). This allows running | |
1243 | scripts and reloading the definitions in them without calling code |
|
1244 | scripts and reloading the definitions in them without calling code | |
1244 | protected by an ' if __name__ == "__main__" ' clause. |
|
1245 | protected by an ' if __name__ == "__main__" ' clause. | |
1245 |
|
1246 | |||
1246 | -i: run the file in IPython's namespace instead of an empty one. This |
|
1247 | -i: run the file in IPython's namespace instead of an empty one. This | |
1247 | is useful if you are experimenting with code written in a text editor |
|
1248 | is useful if you are experimenting with code written in a text editor | |
1248 | which depends on variables defined interactively. |
|
1249 | which depends on variables defined interactively. | |
1249 |
|
1250 | |||
1250 | -e: ignore sys.exit() calls or SystemExit exceptions in the script |
|
1251 | -e: ignore sys.exit() calls or SystemExit exceptions in the script | |
1251 | being run. This is particularly useful if IPython is being used to |
|
1252 | being run. This is particularly useful if IPython is being used to | |
1252 | run unittests, which always exit with a sys.exit() call. In such |
|
1253 | run unittests, which always exit with a sys.exit() call. In such | |
1253 | cases you are interested in the output of the test results, not in |
|
1254 | cases you are interested in the output of the test results, not in | |
1254 | seeing a traceback of the unittest module. |
|
1255 | seeing a traceback of the unittest module. | |
1255 |
|
1256 | |||
1256 | -t: print timing information at the end of the run. IPython will give |
|
1257 | -t: print timing information at the end of the run. IPython will give | |
1257 | you an estimated CPU time consumption for your script, which under |
|
1258 | you an estimated CPU time consumption for your script, which under | |
1258 | Unix uses the resource module to avoid the wraparound problems of |
|
1259 | Unix uses the resource module to avoid the wraparound problems of | |
1259 | time.clock(). Under Unix, an estimate of time spent on system tasks |
|
1260 | time.clock(). Under Unix, an estimate of time spent on system tasks | |
1260 | is also given (for Windows platforms this is reported as 0.0). |
|
1261 | is also given (for Windows platforms this is reported as 0.0). | |
1261 |
|
1262 | |||
1262 | If -t is given, an additional -N<N> option can be given, where <N> |
|
1263 | If -t is given, an additional -N<N> option can be given, where <N> | |
1263 | must be an integer indicating how many times you want the script to |
|
1264 | must be an integer indicating how many times you want the script to | |
1264 | run. The final timing report will include total and per run results. |
|
1265 | run. The final timing report will include total and per run results. | |
1265 |
|
1266 | |||
1266 | For example (testing the script uniq_stable.py): |
|
1267 | For example (testing the script uniq_stable.py): | |
1267 |
|
1268 | |||
1268 | In [1]: run -t uniq_stable |
|
1269 | In [1]: run -t uniq_stable | |
1269 |
|
1270 | |||
1270 | IPython CPU timings (estimated):\\ |
|
1271 | IPython CPU timings (estimated):\\ | |
1271 | User : 0.19597 s.\\ |
|
1272 | User : 0.19597 s.\\ | |
1272 | System: 0.0 s.\\ |
|
1273 | System: 0.0 s.\\ | |
1273 |
|
1274 | |||
1274 | In [2]: run -t -N5 uniq_stable |
|
1275 | In [2]: run -t -N5 uniq_stable | |
1275 |
|
1276 | |||
1276 | IPython CPU timings (estimated):\\ |
|
1277 | IPython CPU timings (estimated):\\ | |
1277 | Total runs performed: 5\\ |
|
1278 | Total runs performed: 5\\ | |
1278 | Times : Total Per run\\ |
|
1279 | Times : Total Per run\\ | |
1279 | User : 0.910862 s, 0.1821724 s.\\ |
|
1280 | User : 0.910862 s, 0.1821724 s.\\ | |
1280 | System: 0.0 s, 0.0 s. |
|
1281 | System: 0.0 s, 0.0 s. | |
1281 |
|
1282 | |||
1282 | -d: run your program under the control of pdb, the Python debugger. |
|
1283 | -d: run your program under the control of pdb, the Python debugger. | |
1283 | This allows you to execute your program step by step, watch variables, |
|
1284 | This allows you to execute your program step by step, watch variables, | |
1284 | etc. Internally, what IPython does is similar to calling: |
|
1285 | etc. Internally, what IPython does is similar to calling: | |
1285 |
|
1286 | |||
1286 | pdb.run('execfile("YOURFILENAME")') |
|
1287 | pdb.run('execfile("YOURFILENAME")') | |
1287 |
|
1288 | |||
1288 | with a breakpoint set on line 1 of your file. You can change the line |
|
1289 | with a breakpoint set on line 1 of your file. You can change the line | |
1289 | number for this automatic breakpoint to be <N> by using the -bN option |
|
1290 | number for this automatic breakpoint to be <N> by using the -bN option | |
1290 | (where N must be an integer). For example: |
|
1291 | (where N must be an integer). For example: | |
1291 |
|
1292 | |||
1292 | %run -d -b40 myscript |
|
1293 | %run -d -b40 myscript | |
1293 |
|
1294 | |||
1294 | will set the first breakpoint at line 40 in myscript.py. Note that |
|
1295 | will set the first breakpoint at line 40 in myscript.py. Note that | |
1295 | the first breakpoint must be set on a line which actually does |
|
1296 | the first breakpoint must be set on a line which actually does | |
1296 | something (not a comment or docstring) for it to stop execution. |
|
1297 | something (not a comment or docstring) for it to stop execution. | |
1297 |
|
1298 | |||
1298 | When the pdb debugger starts, you will see a (Pdb) prompt. You must |
|
1299 | When the pdb debugger starts, you will see a (Pdb) prompt. You must | |
1299 | first enter 'c' (without qoutes) to start execution up to the first |
|
1300 | first enter 'c' (without qoutes) to start execution up to the first | |
1300 | breakpoint. |
|
1301 | breakpoint. | |
1301 |
|
1302 | |||
1302 | Entering 'help' gives information about the use of the debugger. You |
|
1303 | Entering 'help' gives information about the use of the debugger. You | |
1303 | can easily see pdb's full documentation with "import pdb;pdb.help()" |
|
1304 | can easily see pdb's full documentation with "import pdb;pdb.help()" | |
1304 | at a prompt. |
|
1305 | at a prompt. | |
1305 |
|
1306 | |||
1306 | -p: run program under the control of the Python profiler module (which |
|
1307 | -p: run program under the control of the Python profiler module (which | |
1307 | prints a detailed report of execution times, function calls, etc). |
|
1308 | prints a detailed report of execution times, function calls, etc). | |
1308 |
|
1309 | |||
1309 | You can pass other options after -p which affect the behavior of the |
|
1310 | You can pass other options after -p which affect the behavior of the | |
1310 | profiler itself. See the docs for %prun for details. |
|
1311 | profiler itself. See the docs for %prun for details. | |
1311 |
|
1312 | |||
1312 | In this mode, the program's variables do NOT propagate back to the |
|
1313 | In this mode, the program's variables do NOT propagate back to the | |
1313 | IPython interactive namespace (because they remain in the namespace |
|
1314 | IPython interactive namespace (because they remain in the namespace | |
1314 | where the profiler executes them). |
|
1315 | where the profiler executes them). | |
1315 |
|
1316 | |||
1316 | Internally this triggers a call to %prun, see its documentation for |
|
1317 | Internally this triggers a call to %prun, see its documentation for | |
1317 | details on the options available specifically for profiling.""" |
|
1318 | details on the options available specifically for profiling.""" | |
1318 |
|
1319 | |||
1319 | # get arguments and set sys.argv for program to be run. |
|
1320 | # get arguments and set sys.argv for program to be run. | |
1320 | opts,arg_lst = self.parse_options(parameter_s,'nidtN:b:pD:l:rs:T:e', |
|
1321 | opts,arg_lst = self.parse_options(parameter_s,'nidtN:b:pD:l:rs:T:e', | |
1321 | mode='list',list_all=1) |
|
1322 | mode='list',list_all=1) | |
1322 |
|
1323 | |||
1323 | try: |
|
1324 | try: | |
1324 | filename = get_py_filename(arg_lst[0]) |
|
1325 | filename = get_py_filename(arg_lst[0]) | |
1325 | except IndexError: |
|
1326 | except IndexError: | |
1326 | warn('you must provide at least a filename.') |
|
1327 | warn('you must provide at least a filename.') | |
1327 | print '\n%run:\n',OInspect.getdoc(self.magic_run) |
|
1328 | print '\n%run:\n',OInspect.getdoc(self.magic_run) | |
1328 | return |
|
1329 | return | |
1329 | except IOError,msg: |
|
1330 | except IOError,msg: | |
1330 | error(msg) |
|
1331 | error(msg) | |
1331 | return |
|
1332 | return | |
1332 |
|
1333 | |||
1333 | # Control the response to exit() calls made by the script being run |
|
1334 | # Control the response to exit() calls made by the script being run | |
1334 | exit_ignore = opts.has_key('e') |
|
1335 | exit_ignore = opts.has_key('e') | |
1335 |
|
1336 | |||
1336 | # Make sure that the running script gets a proper sys.argv as if it |
|
1337 | # Make sure that the running script gets a proper sys.argv as if it | |
1337 | # were run from a system shell. |
|
1338 | # were run from a system shell. | |
1338 | save_argv = sys.argv # save it for later restoring |
|
1339 | save_argv = sys.argv # save it for later restoring | |
1339 | sys.argv = [filename]+ arg_lst[1:] # put in the proper filename |
|
1340 | sys.argv = [filename]+ arg_lst[1:] # put in the proper filename | |
1340 |
|
1341 | |||
1341 | if opts.has_key('i'): |
|
1342 | if opts.has_key('i'): | |
1342 | prog_ns = self.shell.user_ns |
|
1343 | prog_ns = self.shell.user_ns | |
1343 | __name__save = self.shell.user_ns['__name__'] |
|
1344 | __name__save = self.shell.user_ns['__name__'] | |
1344 | prog_ns['__name__'] = '__main__' |
|
1345 | prog_ns['__name__'] = '__main__' | |
1345 | else: |
|
1346 | else: | |
1346 | if opts.has_key('n'): |
|
1347 | if opts.has_key('n'): | |
1347 | name = os.path.splitext(os.path.basename(filename))[0] |
|
1348 | name = os.path.splitext(os.path.basename(filename))[0] | |
1348 | else: |
|
1349 | else: | |
1349 | name = '__main__' |
|
1350 | name = '__main__' | |
1350 | prog_ns = {'__name__':name} |
|
1351 | prog_ns = {'__name__':name} | |
1351 |
|
1352 | |||
1352 | # pickle fix. See iplib for an explanation |
|
1353 | # pickle fix. See iplib for an explanation | |
1353 | sys.modules[prog_ns['__name__']] = FakeModule(prog_ns) |
|
1354 | sys.modules[prog_ns['__name__']] = FakeModule(prog_ns) | |
1354 |
|
1355 | |||
1355 | stats = None |
|
1356 | stats = None | |
1356 | try: |
|
1357 | try: | |
1357 | if opts.has_key('p'): |
|
1358 | if opts.has_key('p'): | |
1358 | stats = self.magic_prun('',0,opts,arg_lst,prog_ns) |
|
1359 | stats = self.magic_prun('',0,opts,arg_lst,prog_ns) | |
1359 | else: |
|
1360 | else: | |
1360 | if opts.has_key('d'): |
|
1361 | if opts.has_key('d'): | |
1361 | deb = Debugger.Pdb(self.shell.rc.colors) |
|
1362 | deb = Debugger.Pdb(self.shell.rc.colors) | |
1362 | # reset Breakpoint state, which is moronically kept |
|
1363 | # reset Breakpoint state, which is moronically kept | |
1363 | # in a class |
|
1364 | # in a class | |
1364 | bdb.Breakpoint.next = 1 |
|
1365 | bdb.Breakpoint.next = 1 | |
1365 | bdb.Breakpoint.bplist = {} |
|
1366 | bdb.Breakpoint.bplist = {} | |
1366 | bdb.Breakpoint.bpbynumber = [None] |
|
1367 | bdb.Breakpoint.bpbynumber = [None] | |
1367 | # Set an initial breakpoint to stop execution |
|
1368 | # Set an initial breakpoint to stop execution | |
1368 | maxtries = 10 |
|
1369 | maxtries = 10 | |
1369 | bp = int(opts.get('b',[1])[0]) |
|
1370 | bp = int(opts.get('b',[1])[0]) | |
1370 | checkline = deb.checkline(filename,bp) |
|
1371 | checkline = deb.checkline(filename,bp) | |
1371 | if not checkline: |
|
1372 | if not checkline: | |
1372 | for bp in range(bp+1,bp+maxtries+1): |
|
1373 | for bp in range(bp+1,bp+maxtries+1): | |
1373 | if deb.checkline(filename,bp): |
|
1374 | if deb.checkline(filename,bp): | |
1374 | break |
|
1375 | break | |
1375 | else: |
|
1376 | else: | |
1376 | msg = ("\nI failed to find a valid line to set " |
|
1377 | msg = ("\nI failed to find a valid line to set " | |
1377 | "a breakpoint\n" |
|
1378 | "a breakpoint\n" | |
1378 | "after trying up to line: %s.\n" |
|
1379 | "after trying up to line: %s.\n" | |
1379 | "Please set a valid breakpoint manually " |
|
1380 | "Please set a valid breakpoint manually " | |
1380 | "with the -b option." % bp) |
|
1381 | "with the -b option." % bp) | |
1381 | error(msg) |
|
1382 | error(msg) | |
1382 | return |
|
1383 | return | |
1383 | # if we find a good linenumber, set the breakpoint |
|
1384 | # if we find a good linenumber, set the breakpoint | |
1384 | deb.do_break('%s:%s' % (filename,bp)) |
|
1385 | deb.do_break('%s:%s' % (filename,bp)) | |
1385 | # Start file run |
|
1386 | # Start file run | |
1386 | print "NOTE: Enter 'c' at the", |
|
1387 | print "NOTE: Enter 'c' at the", | |
1387 | print "ipdb> prompt to start your script." |
|
1388 | print "ipdb> prompt to start your script." | |
1388 | try: |
|
1389 | try: | |
1389 | deb.run('execfile("%s")' % filename,prog_ns) |
|
1390 | deb.run('execfile("%s")' % filename,prog_ns) | |
1390 | except: |
|
1391 | except: | |
1391 | etype, value, tb = sys.exc_info() |
|
1392 | etype, value, tb = sys.exc_info() | |
1392 | # Skip three frames in the traceback: the %run one, |
|
1393 | # Skip three frames in the traceback: the %run one, | |
1393 | # one inside bdb.py, and the command-line typed by the |
|
1394 | # one inside bdb.py, and the command-line typed by the | |
1394 | # user (run by exec in pdb itself). |
|
1395 | # user (run by exec in pdb itself). | |
1395 | self.shell.InteractiveTB(etype,value,tb,tb_offset=3) |
|
1396 | self.shell.InteractiveTB(etype,value,tb,tb_offset=3) | |
1396 | else: |
|
1397 | else: | |
1397 | if runner is None: |
|
1398 | if runner is None: | |
1398 | runner = self.shell.safe_execfile |
|
1399 | runner = self.shell.safe_execfile | |
1399 | if opts.has_key('t'): |
|
1400 | if opts.has_key('t'): | |
1400 | try: |
|
1401 | try: | |
1401 | nruns = int(opts['N'][0]) |
|
1402 | nruns = int(opts['N'][0]) | |
1402 | if nruns < 1: |
|
1403 | if nruns < 1: | |
1403 | error('Number of runs must be >=1') |
|
1404 | error('Number of runs must be >=1') | |
1404 | return |
|
1405 | return | |
1405 | except (KeyError): |
|
1406 | except (KeyError): | |
1406 | nruns = 1 |
|
1407 | nruns = 1 | |
1407 | if nruns == 1: |
|
1408 | if nruns == 1: | |
1408 | t0 = clock2() |
|
1409 | t0 = clock2() | |
1409 | runner(filename,prog_ns,prog_ns,exit_ignore=exit_ignore) |
|
1410 | runner(filename,prog_ns,prog_ns,exit_ignore=exit_ignore) | |
1410 | t1 = clock2() |
|
1411 | t1 = clock2() | |
1411 | t_usr = t1[0]-t0[0] |
|
1412 | t_usr = t1[0]-t0[0] | |
1412 | t_sys = t1[1]-t1[1] |
|
1413 | t_sys = t1[1]-t1[1] | |
1413 | print "\nIPython CPU timings (estimated):" |
|
1414 | print "\nIPython CPU timings (estimated):" | |
1414 | print " User : %10s s." % t_usr |
|
1415 | print " User : %10s s." % t_usr | |
1415 | print " System: %10s s." % t_sys |
|
1416 | print " System: %10s s." % t_sys | |
1416 | else: |
|
1417 | else: | |
1417 | runs = range(nruns) |
|
1418 | runs = range(nruns) | |
1418 | t0 = clock2() |
|
1419 | t0 = clock2() | |
1419 | for nr in runs: |
|
1420 | for nr in runs: | |
1420 | runner(filename,prog_ns,prog_ns,exit_ignore=exit_ignore) |
|
1421 | runner(filename,prog_ns,prog_ns,exit_ignore=exit_ignore) | |
1421 | t1 = clock2() |
|
1422 | t1 = clock2() | |
1422 | t_usr = t1[0]-t0[0] |
|
1423 | t_usr = t1[0]-t0[0] | |
1423 | t_sys = t1[1]-t1[1] |
|
1424 | t_sys = t1[1]-t1[1] | |
1424 | print "\nIPython CPU timings (estimated):" |
|
1425 | print "\nIPython CPU timings (estimated):" | |
1425 | print "Total runs performed:",nruns |
|
1426 | print "Total runs performed:",nruns | |
1426 | print " Times : %10s %10s" % ('Total','Per run') |
|
1427 | print " Times : %10s %10s" % ('Total','Per run') | |
1427 | print " User : %10s s, %10s s." % (t_usr,t_usr/nruns) |
|
1428 | print " User : %10s s, %10s s." % (t_usr,t_usr/nruns) | |
1428 | print " System: %10s s, %10s s." % (t_sys,t_sys/nruns) |
|
1429 | print " System: %10s s, %10s s." % (t_sys,t_sys/nruns) | |
1429 |
|
1430 | |||
1430 | else: |
|
1431 | else: | |
1431 | runner(filename,prog_ns,prog_ns,exit_ignore=exit_ignore) |
|
1432 | runner(filename,prog_ns,prog_ns,exit_ignore=exit_ignore) | |
1432 | if opts.has_key('i'): |
|
1433 | if opts.has_key('i'): | |
1433 | self.shell.user_ns['__name__'] = __name__save |
|
1434 | self.shell.user_ns['__name__'] = __name__save | |
1434 | else: |
|
1435 | else: | |
1435 | # update IPython interactive namespace |
|
1436 | # update IPython interactive namespace | |
1436 | del prog_ns['__name__'] |
|
1437 | del prog_ns['__name__'] | |
1437 | self.shell.user_ns.update(prog_ns) |
|
1438 | self.shell.user_ns.update(prog_ns) | |
1438 | finally: |
|
1439 | finally: | |
1439 | sys.argv = save_argv |
|
1440 | sys.argv = save_argv | |
1440 | return stats |
|
1441 | return stats | |
1441 |
|
1442 | |||
1442 | def magic_runlog(self, parameter_s =''): |
|
1443 | def magic_runlog(self, parameter_s =''): | |
1443 | """Run files as logs. |
|
1444 | """Run files as logs. | |
1444 |
|
1445 | |||
1445 | Usage:\\ |
|
1446 | Usage:\\ | |
1446 | %runlog file1 file2 ... |
|
1447 | %runlog file1 file2 ... | |
1447 |
|
1448 | |||
1448 | Run the named files (treating them as log files) in sequence inside |
|
1449 | Run the named files (treating them as log files) in sequence inside | |
1449 | the interpreter, and return to the prompt. This is much slower than |
|
1450 | the interpreter, and return to the prompt. This is much slower than | |
1450 | %run because each line is executed in a try/except block, but it |
|
1451 | %run because each line is executed in a try/except block, but it | |
1451 | allows running files with syntax errors in them. |
|
1452 | allows running files with syntax errors in them. | |
1452 |
|
1453 | |||
1453 | Normally IPython will guess when a file is one of its own logfiles, so |
|
1454 | Normally IPython will guess when a file is one of its own logfiles, so | |
1454 | you can typically use %run even for logs. This shorthand allows you to |
|
1455 | you can typically use %run even for logs. This shorthand allows you to | |
1455 | force any file to be treated as a log file.""" |
|
1456 | force any file to be treated as a log file.""" | |
1456 |
|
1457 | |||
1457 | for f in parameter_s.split(): |
|
1458 | for f in parameter_s.split(): | |
1458 | self.shell.safe_execfile(f,self.shell.user_ns, |
|
1459 | self.shell.safe_execfile(f,self.shell.user_ns, | |
1459 | self.shell.user_ns,islog=1) |
|
1460 | self.shell.user_ns,islog=1) | |
1460 |
|
1461 | |||
1461 | def magic_time(self,parameter_s = ''): |
|
1462 | def magic_time(self,parameter_s = ''): | |
1462 | """Time execution of a Python statement or expression. |
|
1463 | """Time execution of a Python statement or expression. | |
1463 |
|
1464 | |||
1464 | The CPU and wall clock times are printed, and the value of the |
|
1465 | The CPU and wall clock times are printed, and the value of the | |
1465 | expression (if any) is returned. Note that under Win32, system time |
|
1466 | expression (if any) is returned. Note that under Win32, system time | |
1466 | is always reported as 0, since it can not be measured. |
|
1467 | is always reported as 0, since it can not be measured. | |
1467 |
|
1468 | |||
1468 | This function provides very basic timing functionality. In Python |
|
1469 | This function provides very basic timing functionality. In Python | |
1469 | 2.3, the timeit module offers more control and sophistication, but for |
|
1470 | 2.3, the timeit module offers more control and sophistication, but for | |
1470 | now IPython supports Python 2.2, so we can not rely on timeit being |
|
1471 | now IPython supports Python 2.2, so we can not rely on timeit being | |
1471 | present. |
|
1472 | present. | |
1472 |
|
1473 | |||
1473 | Some examples: |
|
1474 | Some examples: | |
1474 |
|
1475 | |||
1475 | In [1]: time 2**128 |
|
1476 | In [1]: time 2**128 | |
1476 | CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s |
|
1477 | CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s | |
1477 | Wall time: 0.00 |
|
1478 | Wall time: 0.00 | |
1478 | Out[1]: 340282366920938463463374607431768211456L |
|
1479 | Out[1]: 340282366920938463463374607431768211456L | |
1479 |
|
1480 | |||
1480 | In [2]: n = 1000000 |
|
1481 | In [2]: n = 1000000 | |
1481 |
|
1482 | |||
1482 | In [3]: time sum(range(n)) |
|
1483 | In [3]: time sum(range(n)) | |
1483 | CPU times: user 1.20 s, sys: 0.05 s, total: 1.25 s |
|
1484 | CPU times: user 1.20 s, sys: 0.05 s, total: 1.25 s | |
1484 | Wall time: 1.37 |
|
1485 | Wall time: 1.37 | |
1485 | Out[3]: 499999500000L |
|
1486 | Out[3]: 499999500000L | |
1486 |
|
1487 | |||
1487 | In [4]: time print 'hello world' |
|
1488 | In [4]: time print 'hello world' | |
1488 | hello world |
|
1489 | hello world | |
1489 | CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s |
|
1490 | CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s | |
1490 | Wall time: 0.00 |
|
1491 | Wall time: 0.00 | |
1491 | """ |
|
1492 | """ | |
1492 |
|
1493 | |||
1493 | # fail immediately if the given expression can't be compiled |
|
1494 | # fail immediately if the given expression can't be compiled | |
1494 | try: |
|
1495 | try: | |
1495 | mode = 'eval' |
|
1496 | mode = 'eval' | |
1496 | code = compile(parameter_s,'<timed eval>',mode) |
|
1497 | code = compile(parameter_s,'<timed eval>',mode) | |
1497 | except SyntaxError: |
|
1498 | except SyntaxError: | |
1498 | mode = 'exec' |
|
1499 | mode = 'exec' | |
1499 | code = compile(parameter_s,'<timed exec>',mode) |
|
1500 | code = compile(parameter_s,'<timed exec>',mode) | |
1500 | # skew measurement as little as possible |
|
1501 | # skew measurement as little as possible | |
1501 | glob = self.shell.user_ns |
|
1502 | glob = self.shell.user_ns | |
1502 | clk = clock2 |
|
1503 | clk = clock2 | |
1503 | wtime = time.time |
|
1504 | wtime = time.time | |
1504 | # time execution |
|
1505 | # time execution | |
1505 | wall_st = wtime() |
|
1506 | wall_st = wtime() | |
1506 | if mode=='eval': |
|
1507 | if mode=='eval': | |
1507 | st = clk() |
|
1508 | st = clk() | |
1508 | out = eval(code,glob) |
|
1509 | out = eval(code,glob) | |
1509 | end = clk() |
|
1510 | end = clk() | |
1510 | else: |
|
1511 | else: | |
1511 | st = clk() |
|
1512 | st = clk() | |
1512 | exec code in glob |
|
1513 | exec code in glob | |
1513 | end = clk() |
|
1514 | end = clk() | |
1514 | out = None |
|
1515 | out = None | |
1515 | wall_end = wtime() |
|
1516 | wall_end = wtime() | |
1516 | # Compute actual times and report |
|
1517 | # Compute actual times and report | |
1517 | wall_time = wall_end-wall_st |
|
1518 | wall_time = wall_end-wall_st | |
1518 | cpu_user = end[0]-st[0] |
|
1519 | cpu_user = end[0]-st[0] | |
1519 | cpu_sys = end[1]-st[1] |
|
1520 | cpu_sys = end[1]-st[1] | |
1520 | cpu_tot = cpu_user+cpu_sys |
|
1521 | cpu_tot = cpu_user+cpu_sys | |
1521 | print "CPU times: user %.2f s, sys: %.2f s, total: %.2f s" % \ |
|
1522 | print "CPU times: user %.2f s, sys: %.2f s, total: %.2f s" % \ | |
1522 | (cpu_user,cpu_sys,cpu_tot) |
|
1523 | (cpu_user,cpu_sys,cpu_tot) | |
1523 | print "Wall time: %.2f" % wall_time |
|
1524 | print "Wall time: %.2f" % wall_time | |
1524 | return out |
|
1525 | return out | |
1525 |
|
1526 | |||
1526 | def magic_macro(self,parameter_s = ''): |
|
1527 | def magic_macro(self,parameter_s = ''): | |
1527 | """Define a set of input lines as a macro for future re-execution. |
|
1528 | """Define a set of input lines as a macro for future re-execution. | |
1528 |
|
1529 | |||
1529 | Usage:\\ |
|
1530 | Usage:\\ | |
1530 | %macro name n1:n2 n3:n4 ... n5 .. n6 ... |
|
1531 | %macro name n1:n2 n3:n4 ... n5 .. n6 ... | |
1531 |
|
1532 | |||
1532 | This will define a global variable called `name` which is a string |
|
1533 | This will define a global variable called `name` which is a string | |
1533 | made of joining the slices and lines you specify (n1,n2,... numbers |
|
1534 | made of joining the slices and lines you specify (n1,n2,... numbers | |
1534 | above) from your input history into a single string. This variable |
|
1535 | above) from your input history into a single string. This variable | |
1535 | acts like an automatic function which re-executes those lines as if |
|
1536 | acts like an automatic function which re-executes those lines as if | |
1536 | you had typed them. You just type 'name' at the prompt and the code |
|
1537 | you had typed them. You just type 'name' at the prompt and the code | |
1537 | executes. |
|
1538 | executes. | |
1538 |
|
1539 | |||
1539 | Note that the slices use the standard Python slicing notation (5:8 |
|
1540 | Note that the slices use the standard Python slicing notation (5:8 | |
1540 | means include lines numbered 5,6,7). |
|
1541 | means include lines numbered 5,6,7). | |
1541 |
|
1542 | |||
1542 | For example, if your history contains (%hist prints it): |
|
1543 | For example, if your history contains (%hist prints it): | |
1543 |
|
1544 | |||
1544 | 44: x=1\\ |
|
1545 | 44: x=1\\ | |
1545 | 45: y=3\\ |
|
1546 | 45: y=3\\ | |
1546 | 46: z=x+y\\ |
|
1547 | 46: z=x+y\\ | |
1547 | 47: print x\\ |
|
1548 | 47: print x\\ | |
1548 | 48: a=5\\ |
|
1549 | 48: a=5\\ | |
1549 | 49: print 'x',x,'y',y\\ |
|
1550 | 49: print 'x',x,'y',y\\ | |
1550 |
|
1551 | |||
1551 | you can create a macro with lines 44 through 47 (included) and line 49 |
|
1552 | you can create a macro with lines 44 through 47 (included) and line 49 | |
1552 | called my_macro with: |
|
1553 | called my_macro with: | |
1553 |
|
1554 | |||
1554 | In [51]: %macro my_macro 44:48 49 |
|
1555 | In [51]: %macro my_macro 44:48 49 | |
1555 |
|
1556 | |||
1556 | Now, typing `my_macro` (without quotes) will re-execute all this code |
|
1557 | Now, typing `my_macro` (without quotes) will re-execute all this code | |
1557 | in one pass. |
|
1558 | in one pass. | |
1558 |
|
1559 | |||
1559 | You don't need to give the line-numbers in order, and any given line |
|
1560 | You don't need to give the line-numbers in order, and any given line | |
1560 | number can appear multiple times. You can assemble macros with any |
|
1561 | number can appear multiple times. You can assemble macros with any | |
1561 | lines from your input history in any order. |
|
1562 | lines from your input history in any order. | |
1562 |
|
1563 | |||
1563 | The macro is a simple object which holds its value in an attribute, |
|
1564 | The macro is a simple object which holds its value in an attribute, | |
1564 | but IPython's display system checks for macros and executes them as |
|
1565 | but IPython's display system checks for macros and executes them as | |
1565 | code instead of printing them when you type their name. |
|
1566 | code instead of printing them when you type their name. | |
1566 |
|
1567 | |||
1567 | You can view a macro's contents by explicitly printing it with: |
|
1568 | You can view a macro's contents by explicitly printing it with: | |
1568 |
|
1569 | |||
1569 | 'print macro_name'. |
|
1570 | 'print macro_name'. | |
1570 |
|
1571 | |||
1571 | For one-off cases which DON'T contain magic function calls in them you |
|
1572 | For one-off cases which DON'T contain magic function calls in them you | |
1572 | can obtain similar results by explicitly executing slices from your |
|
1573 | can obtain similar results by explicitly executing slices from your | |
1573 | input history with: |
|
1574 | input history with: | |
1574 |
|
1575 | |||
1575 | In [60]: exec In[44:48]+In[49]""" |
|
1576 | In [60]: exec In[44:48]+In[49]""" | |
1576 |
|
1577 | |||
1577 | args = parameter_s.split() |
|
1578 | args = parameter_s.split() | |
1578 | name,ranges = args[0], args[1:] |
|
1579 | name,ranges = args[0], args[1:] | |
1579 | #print 'rng',ranges # dbg |
|
1580 | #print 'rng',ranges # dbg | |
1580 | lines = self.extract_input_slices(ranges) |
|
1581 | lines = self.extract_input_slices(ranges) | |
1581 | macro = Macro(lines) |
|
1582 | macro = Macro(lines) | |
1582 | self.shell.user_ns.update({name:macro}) |
|
1583 | self.shell.user_ns.update({name:macro}) | |
1583 | print 'Macro `%s` created. To execute, type its name (without quotes).' % name |
|
1584 | print 'Macro `%s` created. To execute, type its name (without quotes).' % name | |
1584 | print 'Macro contents:' |
|
1585 | print 'Macro contents:' | |
1585 | print macro |
|
1586 | print macro | |
1586 |
|
1587 | |||
1587 | def magic_save(self,parameter_s = ''): |
|
1588 | def magic_save(self,parameter_s = ''): | |
1588 | """Save a set of lines to a given filename. |
|
1589 | """Save a set of lines to a given filename. | |
1589 |
|
1590 | |||
1590 | Usage:\\ |
|
1591 | Usage:\\ | |
1591 | %save filename n1:n2 n3:n4 ... n5 .. n6 ... |
|
1592 | %save filename n1:n2 n3:n4 ... n5 .. n6 ... | |
1592 |
|
1593 | |||
1593 | This function uses the same syntax as %macro for line extraction, but |
|
1594 | This function uses the same syntax as %macro for line extraction, but | |
1594 | instead of creating a macro it saves the resulting string to the |
|
1595 | instead of creating a macro it saves the resulting string to the | |
1595 | filename you specify. |
|
1596 | filename you specify. | |
1596 |
|
1597 | |||
1597 | It adds a '.py' extension to the file if you don't do so yourself, and |
|
1598 | It adds a '.py' extension to the file if you don't do so yourself, and | |
1598 | it asks for confirmation before overwriting existing files.""" |
|
1599 | it asks for confirmation before overwriting existing files.""" | |
1599 |
|
1600 | |||
1600 | args = parameter_s.split() |
|
1601 | args = parameter_s.split() | |
1601 | fname,ranges = args[0], args[1:] |
|
1602 | fname,ranges = args[0], args[1:] | |
1602 | if not fname.endswith('.py'): |
|
1603 | if not fname.endswith('.py'): | |
1603 | fname += '.py' |
|
1604 | fname += '.py' | |
1604 | if os.path.isfile(fname): |
|
1605 | if os.path.isfile(fname): | |
1605 | ans = raw_input('File `%s` exists. Overwrite (y/[N])? ' % fname) |
|
1606 | ans = raw_input('File `%s` exists. Overwrite (y/[N])? ' % fname) | |
1606 | if ans.lower() not in ['y','yes']: |
|
1607 | if ans.lower() not in ['y','yes']: | |
1607 | print 'Operation cancelled.' |
|
1608 | print 'Operation cancelled.' | |
1608 | return |
|
1609 | return | |
1609 | cmds = ''.join(self.extract_input_slices(ranges)) |
|
1610 | cmds = ''.join(self.extract_input_slices(ranges)) | |
1610 | f = file(fname,'w') |
|
1611 | f = file(fname,'w') | |
1611 | f.write(cmds) |
|
1612 | f.write(cmds) | |
1612 | f.close() |
|
1613 | f.close() | |
1613 | print 'The following commands were written to file `%s`:' % fname |
|
1614 | print 'The following commands were written to file `%s`:' % fname | |
1614 | print cmds |
|
1615 | print cmds | |
1615 |
|
1616 | |||
1616 | def magic_ed(self,parameter_s = ''): |
|
1617 | def magic_ed(self,parameter_s = ''): | |
1617 | """Alias to %edit.""" |
|
1618 | """Alias to %edit.""" | |
1618 | return self.magic_edit(parameter_s) |
|
1619 | return self.magic_edit(parameter_s) | |
1619 |
|
1620 | |||
1620 | def magic_edit(self,parameter_s = '',last_call=['','']): |
|
1621 | def magic_edit(self,parameter_s = '',last_call=['','']): | |
1621 | """Bring up an editor and execute the resulting code. |
|
1622 | """Bring up an editor and execute the resulting code. | |
1622 |
|
1623 | |||
1623 | Usage: |
|
1624 | Usage: | |
1624 | %edit [options] [args] |
|
1625 | %edit [options] [args] | |
1625 |
|
1626 | |||
1626 | %edit runs IPython's editor hook. The default version of this hook is |
|
1627 | %edit runs IPython's editor hook. The default version of this hook is | |
1627 | set to call the __IPYTHON__.rc.editor command. This is read from your |
|
1628 | set to call the __IPYTHON__.rc.editor command. This is read from your | |
1628 | environment variable $EDITOR. If this isn't found, it will default to |
|
1629 | environment variable $EDITOR. If this isn't found, it will default to | |
1629 | vi under Linux/Unix and to notepad under Windows. See the end of this |
|
1630 | vi under Linux/Unix and to notepad under Windows. See the end of this | |
1630 | docstring for how to change the editor hook. |
|
1631 | docstring for how to change the editor hook. | |
1631 |
|
1632 | |||
1632 | You can also set the value of this editor via the command line option |
|
1633 | You can also set the value of this editor via the command line option | |
1633 | '-editor' or in your ipythonrc file. This is useful if you wish to use |
|
1634 | '-editor' or in your ipythonrc file. This is useful if you wish to use | |
1634 | specifically for IPython an editor different from your typical default |
|
1635 | specifically for IPython an editor different from your typical default | |
1635 | (and for Windows users who typically don't set environment variables). |
|
1636 | (and for Windows users who typically don't set environment variables). | |
1636 |
|
1637 | |||
1637 | This command allows you to conveniently edit multi-line code right in |
|
1638 | This command allows you to conveniently edit multi-line code right in | |
1638 | your IPython session. |
|
1639 | your IPython session. | |
1639 |
|
1640 | |||
1640 | If called without arguments, %edit opens up an empty editor with a |
|
1641 | If called without arguments, %edit opens up an empty editor with a | |
1641 | temporary file and will execute the contents of this file when you |
|
1642 | temporary file and will execute the contents of this file when you | |
1642 | close it (don't forget to save it!). |
|
1643 | close it (don't forget to save it!). | |
1643 |
|
1644 | |||
1644 | Options: |
|
1645 | Options: | |
1645 |
|
1646 | |||
1646 | -p: this will call the editor with the same data as the previous time |
|
1647 | -p: this will call the editor with the same data as the previous time | |
1647 | it was used, regardless of how long ago (in your current session) it |
|
1648 | it was used, regardless of how long ago (in your current session) it | |
1648 | was. |
|
1649 | was. | |
1649 |
|
1650 | |||
1650 | -x: do not execute the edited code immediately upon exit. This is |
|
1651 | -x: do not execute the edited code immediately upon exit. This is | |
1651 | mainly useful if you are editing programs which need to be called with |
|
1652 | mainly useful if you are editing programs which need to be called with | |
1652 | command line arguments, which you can then do using %run. |
|
1653 | command line arguments, which you can then do using %run. | |
1653 |
|
1654 | |||
1654 | Arguments: |
|
1655 | Arguments: | |
1655 |
|
1656 | |||
1656 | If arguments are given, the following possibilites exist: |
|
1657 | If arguments are given, the following possibilites exist: | |
1657 |
|
1658 | |||
1658 | - The arguments are numbers or pairs of colon-separated numbers (like |
|
1659 | - The arguments are numbers or pairs of colon-separated numbers (like | |
1659 | 1 4:8 9). These are interpreted as lines of previous input to be |
|
1660 | 1 4:8 9). These are interpreted as lines of previous input to be | |
1660 | loaded into the editor. The syntax is the same of the %macro command. |
|
1661 | loaded into the editor. The syntax is the same of the %macro command. | |
1661 |
|
1662 | |||
1662 | - If the argument doesn't start with a number, it is evaluated as a |
|
1663 | - If the argument doesn't start with a number, it is evaluated as a | |
1663 | variable and its contents loaded into the editor. You can thus edit |
|
1664 | variable and its contents loaded into the editor. You can thus edit | |
1664 | any string which contains python code (including the result of |
|
1665 | any string which contains python code (including the result of | |
1665 | previous edits). |
|
1666 | previous edits). | |
1666 |
|
1667 | |||
1667 | - If the argument is the name of an object (other than a string), |
|
1668 | - If the argument is the name of an object (other than a string), | |
1668 | IPython will try to locate the file where it was defined and open the |
|
1669 | IPython will try to locate the file where it was defined and open the | |
1669 | editor at the point where it is defined. You can use `%edit function` |
|
1670 | editor at the point where it is defined. You can use `%edit function` | |
1670 | to load an editor exactly at the point where 'function' is defined, |
|
1671 | to load an editor exactly at the point where 'function' is defined, | |
1671 | edit it and have the file be executed automatically. |
|
1672 | edit it and have the file be executed automatically. | |
1672 |
|
1673 | |||
1673 | Note: opening at an exact line is only supported under Unix, and some |
|
1674 | Note: opening at an exact line is only supported under Unix, and some | |
1674 | editors (like kedit and gedit up to Gnome 2.8) do not understand the |
|
1675 | editors (like kedit and gedit up to Gnome 2.8) do not understand the | |
1675 | '+NUMBER' parameter necessary for this feature. Good editors like |
|
1676 | '+NUMBER' parameter necessary for this feature. Good editors like | |
1676 | (X)Emacs, vi, jed, pico and joe all do. |
|
1677 | (X)Emacs, vi, jed, pico and joe all do. | |
1677 |
|
1678 | |||
1678 | - If the argument is not found as a variable, IPython will look for a |
|
1679 | - If the argument is not found as a variable, IPython will look for a | |
1679 | file with that name (adding .py if necessary) and load it into the |
|
1680 | file with that name (adding .py if necessary) and load it into the | |
1680 | editor. It will execute its contents with execfile() when you exit, |
|
1681 | editor. It will execute its contents with execfile() when you exit, | |
1681 | loading any code in the file into your interactive namespace. |
|
1682 | loading any code in the file into your interactive namespace. | |
1682 |
|
1683 | |||
1683 | After executing your code, %edit will return as output the code you |
|
1684 | After executing your code, %edit will return as output the code you | |
1684 | typed in the editor (except when it was an existing file). This way |
|
1685 | typed in the editor (except when it was an existing file). This way | |
1685 | you can reload the code in further invocations of %edit as a variable, |
|
1686 | you can reload the code in further invocations of %edit as a variable, | |
1686 | via _<NUMBER> or Out[<NUMBER>], where <NUMBER> is the prompt number of |
|
1687 | via _<NUMBER> or Out[<NUMBER>], where <NUMBER> is the prompt number of | |
1687 | the output. |
|
1688 | the output. | |
1688 |
|
1689 | |||
1689 | Note that %edit is also available through the alias %ed. |
|
1690 | Note that %edit is also available through the alias %ed. | |
1690 |
|
1691 | |||
1691 | This is an example of creating a simple function inside the editor and |
|
1692 | This is an example of creating a simple function inside the editor and | |
1692 | then modifying it. First, start up the editor: |
|
1693 | then modifying it. First, start up the editor: | |
1693 |
|
1694 | |||
1694 | In [1]: ed\\ |
|
1695 | In [1]: ed\\ | |
1695 | Editing... done. Executing edited code...\\ |
|
1696 | Editing... done. Executing edited code...\\ | |
1696 | Out[1]: 'def foo():\\n print "foo() was defined in an editing session"\\n' |
|
1697 | Out[1]: 'def foo():\\n print "foo() was defined in an editing session"\\n' | |
1697 |
|
1698 | |||
1698 | We can then call the function foo(): |
|
1699 | We can then call the function foo(): | |
1699 |
|
1700 | |||
1700 | In [2]: foo()\\ |
|
1701 | In [2]: foo()\\ | |
1701 | foo() was defined in an editing session |
|
1702 | foo() was defined in an editing session | |
1702 |
|
1703 | |||
1703 | Now we edit foo. IPython automatically loads the editor with the |
|
1704 | Now we edit foo. IPython automatically loads the editor with the | |
1704 | (temporary) file where foo() was previously defined: |
|
1705 | (temporary) file where foo() was previously defined: | |
1705 |
|
1706 | |||
1706 | In [3]: ed foo\\ |
|
1707 | In [3]: ed foo\\ | |
1707 | Editing... done. Executing edited code... |
|
1708 | Editing... done. Executing edited code... | |
1708 |
|
1709 | |||
1709 | And if we call foo() again we get the modified version: |
|
1710 | And if we call foo() again we get the modified version: | |
1710 |
|
1711 | |||
1711 | In [4]: foo()\\ |
|
1712 | In [4]: foo()\\ | |
1712 | foo() has now been changed! |
|
1713 | foo() has now been changed! | |
1713 |
|
1714 | |||
1714 | Here is an example of how to edit a code snippet successive |
|
1715 | Here is an example of how to edit a code snippet successive | |
1715 | times. First we call the editor: |
|
1716 | times. First we call the editor: | |
1716 |
|
1717 | |||
1717 | In [8]: ed\\ |
|
1718 | In [8]: ed\\ | |
1718 | Editing... done. Executing edited code...\\ |
|
1719 | Editing... done. Executing edited code...\\ | |
1719 | hello\\ |
|
1720 | hello\\ | |
1720 | Out[8]: "print 'hello'\\n" |
|
1721 | Out[8]: "print 'hello'\\n" | |
1721 |
|
1722 | |||
1722 | Now we call it again with the previous output (stored in _): |
|
1723 | Now we call it again with the previous output (stored in _): | |
1723 |
|
1724 | |||
1724 | In [9]: ed _\\ |
|
1725 | In [9]: ed _\\ | |
1725 | Editing... done. Executing edited code...\\ |
|
1726 | Editing... done. Executing edited code...\\ | |
1726 | hello world\\ |
|
1727 | hello world\\ | |
1727 | Out[9]: "print 'hello world'\\n" |
|
1728 | Out[9]: "print 'hello world'\\n" | |
1728 |
|
1729 | |||
1729 | Now we call it with the output #8 (stored in _8, also as Out[8]): |
|
1730 | Now we call it with the output #8 (stored in _8, also as Out[8]): | |
1730 |
|
1731 | |||
1731 | In [10]: ed _8\\ |
|
1732 | In [10]: ed _8\\ | |
1732 | Editing... done. Executing edited code...\\ |
|
1733 | Editing... done. Executing edited code...\\ | |
1733 | hello again\\ |
|
1734 | hello again\\ | |
1734 | Out[10]: "print 'hello again'\\n" |
|
1735 | Out[10]: "print 'hello again'\\n" | |
1735 |
|
1736 | |||
1736 |
|
1737 | |||
1737 | Changing the default editor hook: |
|
1738 | Changing the default editor hook: | |
1738 |
|
1739 | |||
1739 | If you wish to write your own editor hook, you can put it in a |
|
1740 | If you wish to write your own editor hook, you can put it in a | |
1740 | configuration file which you load at startup time. The default hook |
|
1741 | configuration file which you load at startup time. The default hook | |
1741 | is defined in the IPython.hooks module, and you can use that as a |
|
1742 | is defined in the IPython.hooks module, and you can use that as a | |
1742 | starting example for further modifications. That file also has |
|
1743 | starting example for further modifications. That file also has | |
1743 | general instructions on how to set a new hook for use once you've |
|
1744 | general instructions on how to set a new hook for use once you've | |
1744 | defined it.""" |
|
1745 | defined it.""" | |
1745 |
|
1746 | |||
1746 | # FIXME: This function has become a convoluted mess. It needs a |
|
1747 | # FIXME: This function has become a convoluted mess. It needs a | |
1747 | # ground-up rewrite with clean, simple logic. |
|
1748 | # ground-up rewrite with clean, simple logic. | |
1748 |
|
1749 | |||
1749 | def make_filename(arg): |
|
1750 | def make_filename(arg): | |
1750 | "Make a filename from the given args" |
|
1751 | "Make a filename from the given args" | |
1751 | try: |
|
1752 | try: | |
1752 | filename = get_py_filename(arg) |
|
1753 | filename = get_py_filename(arg) | |
1753 | except IOError: |
|
1754 | except IOError: | |
1754 | if args.endswith('.py'): |
|
1755 | if args.endswith('.py'): | |
1755 | filename = arg |
|
1756 | filename = arg | |
1756 | else: |
|
1757 | else: | |
1757 | filename = None |
|
1758 | filename = None | |
1758 | return filename |
|
1759 | return filename | |
1759 |
|
1760 | |||
1760 | # custom exceptions |
|
1761 | # custom exceptions | |
1761 | class DataIsObject(Exception): pass |
|
1762 | class DataIsObject(Exception): pass | |
1762 |
|
1763 | |||
1763 | opts,args = self.parse_options(parameter_s,'px') |
|
1764 | opts,args = self.parse_options(parameter_s,'px') | |
1764 |
|
1765 | |||
1765 | # Default line number value |
|
1766 | # Default line number value | |
1766 | lineno = None |
|
1767 | lineno = None | |
1767 | if opts.has_key('p'): |
|
1768 | if opts.has_key('p'): | |
1768 | args = '_%s' % last_call[0] |
|
1769 | args = '_%s' % last_call[0] | |
1769 | if not self.shell.user_ns.has_key(args): |
|
1770 | if not self.shell.user_ns.has_key(args): | |
1770 | args = last_call[1] |
|
1771 | args = last_call[1] | |
1771 |
|
1772 | |||
1772 | # use last_call to remember the state of the previous call, but don't |
|
1773 | # use last_call to remember the state of the previous call, but don't | |
1773 | # let it be clobbered by successive '-p' calls. |
|
1774 | # let it be clobbered by successive '-p' calls. | |
1774 | try: |
|
1775 | try: | |
1775 | last_call[0] = self.shell.outputcache.prompt_count |
|
1776 | last_call[0] = self.shell.outputcache.prompt_count | |
1776 | if not opts.has_key('p'): |
|
1777 | if not opts.has_key('p'): | |
1777 | last_call[1] = parameter_s |
|
1778 | last_call[1] = parameter_s | |
1778 | except: |
|
1779 | except: | |
1779 | pass |
|
1780 | pass | |
1780 |
|
1781 | |||
1781 | # by default this is done with temp files, except when the given |
|
1782 | # by default this is done with temp files, except when the given | |
1782 | # arg is a filename |
|
1783 | # arg is a filename | |
1783 | use_temp = 1 |
|
1784 | use_temp = 1 | |
1784 |
|
1785 | |||
1785 | if re.match(r'\d',args): |
|
1786 | if re.match(r'\d',args): | |
1786 | # Mode where user specifies ranges of lines, like in %macro. |
|
1787 | # Mode where user specifies ranges of lines, like in %macro. | |
1787 | # This means that you can't edit files whose names begin with |
|
1788 | # This means that you can't edit files whose names begin with | |
1788 | # numbers this way. Tough. |
|
1789 | # numbers this way. Tough. | |
1789 | ranges = args.split() |
|
1790 | ranges = args.split() | |
1790 | data = ''.join(self.extract_input_slices(ranges)) |
|
1791 | data = ''.join(self.extract_input_slices(ranges)) | |
1791 | elif args.endswith('.py'): |
|
1792 | elif args.endswith('.py'): | |
1792 | filename = make_filename(args) |
|
1793 | filename = make_filename(args) | |
1793 | data = '' |
|
1794 | data = '' | |
1794 | use_temp = 0 |
|
1795 | use_temp = 0 | |
1795 | elif args: |
|
1796 | elif args: | |
1796 | try: |
|
1797 | try: | |
1797 | # Load the parameter given as a variable. If not a string, |
|
1798 | # Load the parameter given as a variable. If not a string, | |
1798 | # process it as an object instead (below) |
|
1799 | # process it as an object instead (below) | |
1799 |
|
1800 | |||
1800 | #print '*** args',args,'type',type(args) # dbg |
|
1801 | #print '*** args',args,'type',type(args) # dbg | |
1801 | data = eval(args,self.shell.user_ns) |
|
1802 | data = eval(args,self.shell.user_ns) | |
1802 | if not type(data) in StringTypes: |
|
1803 | if not type(data) in StringTypes: | |
1803 | raise DataIsObject |
|
1804 | raise DataIsObject | |
1804 | except (NameError,SyntaxError): |
|
1805 | except (NameError,SyntaxError): | |
1805 | # given argument is not a variable, try as a filename |
|
1806 | # given argument is not a variable, try as a filename | |
1806 | filename = make_filename(args) |
|
1807 | filename = make_filename(args) | |
1807 | if filename is None: |
|
1808 | if filename is None: | |
1808 | warn("Argument given (%s) can't be found as a variable " |
|
1809 | warn("Argument given (%s) can't be found as a variable " | |
1809 | "or as a filename." % args) |
|
1810 | "or as a filename." % args) | |
1810 | return |
|
1811 | return | |
1811 | data = '' |
|
1812 | data = '' | |
1812 | use_temp = 0 |
|
1813 | use_temp = 0 | |
1813 | except DataIsObject: |
|
1814 | except DataIsObject: | |
1814 | # For objects, try to edit the file where they are defined |
|
1815 | # For objects, try to edit the file where they are defined | |
1815 | try: |
|
1816 | try: | |
1816 | filename = inspect.getabsfile(data) |
|
1817 | filename = inspect.getabsfile(data) | |
1817 | datafile = 1 |
|
1818 | datafile = 1 | |
1818 | except TypeError: |
|
1819 | except TypeError: | |
1819 | filename = make_filename(args) |
|
1820 | filename = make_filename(args) | |
1820 | datafile = 1 |
|
1821 | datafile = 1 | |
1821 | warn('Could not find file where `%s` is defined.\n' |
|
1822 | warn('Could not find file where `%s` is defined.\n' | |
1822 | 'Opening a file named `%s`' % (args,filename)) |
|
1823 | 'Opening a file named `%s`' % (args,filename)) | |
1823 | # Now, make sure we can actually read the source (if it was in |
|
1824 | # Now, make sure we can actually read the source (if it was in | |
1824 | # a temp file it's gone by now). |
|
1825 | # a temp file it's gone by now). | |
1825 | if datafile: |
|
1826 | if datafile: | |
1826 | try: |
|
1827 | try: | |
1827 | lineno = inspect.getsourcelines(data)[1] |
|
1828 | lineno = inspect.getsourcelines(data)[1] | |
1828 | except IOError: |
|
1829 | except IOError: | |
1829 | filename = make_filename(args) |
|
1830 | filename = make_filename(args) | |
1830 | if filename is None: |
|
1831 | if filename is None: | |
1831 | warn('The file `%s` where `%s` was defined cannot ' |
|
1832 | warn('The file `%s` where `%s` was defined cannot ' | |
1832 | 'be read.' % (filename,data)) |
|
1833 | 'be read.' % (filename,data)) | |
1833 | return |
|
1834 | return | |
1834 | use_temp = 0 |
|
1835 | use_temp = 0 | |
1835 | else: |
|
1836 | else: | |
1836 | data = '' |
|
1837 | data = '' | |
1837 |
|
1838 | |||
1838 | if use_temp: |
|
1839 | if use_temp: | |
1839 | filename = tempfile.mktemp('.py') |
|
1840 | filename = tempfile.mktemp('.py') | |
1840 | self.shell.tempfiles.append(filename) |
|
1841 | self.shell.tempfiles.append(filename) | |
1841 |
|
1842 | |||
1842 | if data and use_temp: |
|
1843 | if data and use_temp: | |
1843 | tmp_file = open(filename,'w') |
|
1844 | tmp_file = open(filename,'w') | |
1844 | tmp_file.write(data) |
|
1845 | tmp_file.write(data) | |
1845 | tmp_file.close() |
|
1846 | tmp_file.close() | |
1846 |
|
1847 | |||
1847 | # do actual editing here |
|
1848 | # do actual editing here | |
1848 | print 'Editing...', |
|
1849 | print 'Editing...', | |
1849 | sys.stdout.flush() |
|
1850 | sys.stdout.flush() | |
1850 | self.shell.hooks.editor(filename,lineno) |
|
1851 | self.shell.hooks.editor(filename,lineno) | |
1851 | if opts.has_key('x'): # -x prevents actual execution |
|
1852 | if opts.has_key('x'): # -x prevents actual execution | |
1852 |
|
1853 | |||
1853 | else: |
|
1854 | else: | |
1854 | print 'done. Executing edited code...' |
|
1855 | print 'done. Executing edited code...' | |
1855 | try: |
|
1856 | try: | |
1856 | self.shell.safe_execfile(filename,self.shell.user_ns) |
|
1857 | self.shell.safe_execfile(filename,self.shell.user_ns) | |
1857 | except IOError,msg: |
|
1858 | except IOError,msg: | |
1858 | if msg.filename == filename: |
|
1859 | if msg.filename == filename: | |
1859 | warn('File not found. Did you forget to save?') |
|
1860 | warn('File not found. Did you forget to save?') | |
1860 | return |
|
1861 | return | |
1861 | else: |
|
1862 | else: | |
1862 | self.shell.showtraceback() |
|
1863 | self.shell.showtraceback() | |
1863 | except: |
|
1864 | except: | |
1864 | self.shell.showtraceback() |
|
1865 | self.shell.showtraceback() | |
1865 | if use_temp: |
|
1866 | if use_temp: | |
1866 | contents = open(filename).read() |
|
1867 | contents = open(filename).read() | |
1867 | return contents |
|
1868 | return contents | |
1868 |
|
1869 | |||
1869 | def magic_xmode(self,parameter_s = ''): |
|
1870 | def magic_xmode(self,parameter_s = ''): | |
1870 | """Switch modes for the exception handlers. |
|
1871 | """Switch modes for the exception handlers. | |
1871 |
|
1872 | |||
1872 | Valid modes: Plain, Context and Verbose. |
|
1873 | Valid modes: Plain, Context and Verbose. | |
1873 |
|
1874 | |||
1874 | If called without arguments, acts as a toggle.""" |
|
1875 | If called without arguments, acts as a toggle.""" | |
1875 |
|
1876 | |||
1876 | def xmode_switch_err(name): |
|
1877 | def xmode_switch_err(name): | |
1877 | warn('Error changing %s exception modes.\n%s' % |
|
1878 | warn('Error changing %s exception modes.\n%s' % | |
1878 | (name,sys.exc_info()[1])) |
|
1879 | (name,sys.exc_info()[1])) | |
1879 |
|
1880 | |||
1880 | shell = self.shell |
|
1881 | shell = self.shell | |
1881 | new_mode = parameter_s.strip().capitalize() |
|
1882 | new_mode = parameter_s.strip().capitalize() | |
1882 | try: |
|
1883 | try: | |
1883 | shell.InteractiveTB.set_mode(mode=new_mode) |
|
1884 | shell.InteractiveTB.set_mode(mode=new_mode) | |
1884 | print 'Exception reporting mode:',shell.InteractiveTB.mode |
|
1885 | print 'Exception reporting mode:',shell.InteractiveTB.mode | |
1885 | except: |
|
1886 | except: | |
1886 | xmode_switch_err('user') |
|
1887 | xmode_switch_err('user') | |
1887 |
|
1888 | |||
1888 | # threaded shells use a special handler in sys.excepthook |
|
1889 | # threaded shells use a special handler in sys.excepthook | |
1889 | if shell.isthreaded: |
|
1890 | if shell.isthreaded: | |
1890 | try: |
|
1891 | try: | |
1891 | shell.sys_excepthook.set_mode(mode=new_mode) |
|
1892 | shell.sys_excepthook.set_mode(mode=new_mode) | |
1892 | except: |
|
1893 | except: | |
1893 | xmode_switch_err('threaded') |
|
1894 | xmode_switch_err('threaded') | |
1894 |
|
1895 | |||
1895 | def magic_colors(self,parameter_s = ''): |
|
1896 | def magic_colors(self,parameter_s = ''): | |
1896 | """Switch color scheme for prompts, info system and exception handlers. |
|
1897 | """Switch color scheme for prompts, info system and exception handlers. | |
1897 |
|
1898 | |||
1898 | Currently implemented schemes: NoColor, Linux, LightBG. |
|
1899 | Currently implemented schemes: NoColor, Linux, LightBG. | |
1899 |
|
1900 | |||
1900 | Color scheme names are not case-sensitive.""" |
|
1901 | Color scheme names are not case-sensitive.""" | |
1901 |
|
1902 | |||
1902 | def color_switch_err(name): |
|
1903 | def color_switch_err(name): | |
1903 | warn('Error changing %s color schemes.\n%s' % |
|
1904 | warn('Error changing %s color schemes.\n%s' % | |
1904 | (name,sys.exc_info()[1])) |
|
1905 | (name,sys.exc_info()[1])) | |
1905 |
|
1906 | |||
1906 |
|
1907 | |||
1907 | new_scheme = parameter_s.strip() |
|
1908 | new_scheme = parameter_s.strip() | |
1908 | if not new_scheme: |
|
1909 | if not new_scheme: | |
1909 | print 'You must specify a color scheme.' |
|
1910 | print 'You must specify a color scheme.' | |
1910 | return |
|
1911 | return | |
1911 | # Under Windows, check for Gary Bishop's readline, which is necessary |
|
1912 | # Under Windows, check for Gary Bishop's readline, which is necessary | |
1912 | # for ANSI coloring |
|
1913 | # for ANSI coloring | |
1913 | if os.name in ['nt','dos']: |
|
1914 | if os.name in ['nt','dos']: | |
1914 | try: |
|
1915 | try: | |
1915 | import readline |
|
1916 | import readline | |
1916 | except ImportError: |
|
1917 | except ImportError: | |
1917 | has_readline = 0 |
|
1918 | has_readline = 0 | |
1918 | else: |
|
1919 | else: | |
1919 | try: |
|
1920 | try: | |
1920 | readline.GetOutputFile() |
|
1921 | readline.GetOutputFile() | |
1921 | except AttributeError: |
|
1922 | except AttributeError: | |
1922 | has_readline = 0 |
|
1923 | has_readline = 0 | |
1923 | else: |
|
1924 | else: | |
1924 | has_readline = 1 |
|
1925 | has_readline = 1 | |
1925 | if not has_readline: |
|
1926 | if not has_readline: | |
1926 | msg = """\ |
|
1927 | msg = """\ | |
1927 | Proper color support under MS Windows requires Gary Bishop's readline library. |
|
1928 | Proper color support under MS Windows requires Gary Bishop's readline library. | |
1928 | You can find it at: |
|
1929 | You can find it at: | |
1929 | http://sourceforge.net/projects/uncpythontools |
|
1930 | http://sourceforge.net/projects/uncpythontools | |
1930 | Gary's readline needs the ctypes module, from: |
|
1931 | Gary's readline needs the ctypes module, from: | |
1931 | http://starship.python.net/crew/theller/ctypes |
|
1932 | http://starship.python.net/crew/theller/ctypes | |
1932 |
|
1933 | |||
1933 | Defaulting color scheme to 'NoColor'""" |
|
1934 | Defaulting color scheme to 'NoColor'""" | |
1934 | new_scheme = 'NoColor' |
|
1935 | new_scheme = 'NoColor' | |
1935 | warn(msg) |
|
1936 | warn(msg) | |
1936 | # local shortcut |
|
1937 | # local shortcut | |
1937 | shell = self.shell |
|
1938 | shell = self.shell | |
1938 |
|
1939 | |||
1939 | # Set prompt colors |
|
1940 | # Set prompt colors | |
1940 | try: |
|
1941 | try: | |
1941 | shell.outputcache.set_colors(new_scheme) |
|
1942 | shell.outputcache.set_colors(new_scheme) | |
1942 | except: |
|
1943 | except: | |
1943 | color_switch_err('prompt') |
|
1944 | color_switch_err('prompt') | |
1944 | else: |
|
1945 | else: | |
1945 | shell.rc.colors = \ |
|
1946 | shell.rc.colors = \ | |
1946 | shell.outputcache.color_table.active_scheme_name |
|
1947 | shell.outputcache.color_table.active_scheme_name | |
1947 | # Set exception colors |
|
1948 | # Set exception colors | |
1948 | try: |
|
1949 | try: | |
1949 | shell.InteractiveTB.set_colors(scheme = new_scheme) |
|
1950 | shell.InteractiveTB.set_colors(scheme = new_scheme) | |
1950 | shell.SyntaxTB.set_colors(scheme = new_scheme) |
|
1951 | shell.SyntaxTB.set_colors(scheme = new_scheme) | |
1951 | except: |
|
1952 | except: | |
1952 | color_switch_err('exception') |
|
1953 | color_switch_err('exception') | |
1953 |
|
1954 | |||
1954 | # threaded shells use a verbose traceback in sys.excepthook |
|
1955 | # threaded shells use a verbose traceback in sys.excepthook | |
1955 | if shell.isthreaded: |
|
1956 | if shell.isthreaded: | |
1956 | try: |
|
1957 | try: | |
1957 | shell.sys_excepthook.set_colors(scheme=new_scheme) |
|
1958 | shell.sys_excepthook.set_colors(scheme=new_scheme) | |
1958 | except: |
|
1959 | except: | |
1959 | color_switch_err('system exception handler') |
|
1960 | color_switch_err('system exception handler') | |
1960 |
|
1961 | |||
1961 | # Set info (for 'object?') colors |
|
1962 | # Set info (for 'object?') colors | |
1962 | if shell.rc.color_info: |
|
1963 | if shell.rc.color_info: | |
1963 | try: |
|
1964 | try: | |
1964 | shell.inspector.set_active_scheme(new_scheme) |
|
1965 | shell.inspector.set_active_scheme(new_scheme) | |
1965 | except: |
|
1966 | except: | |
1966 | color_switch_err('object inspector') |
|
1967 | color_switch_err('object inspector') | |
1967 | else: |
|
1968 | else: | |
1968 | shell.inspector.set_active_scheme('NoColor') |
|
1969 | shell.inspector.set_active_scheme('NoColor') | |
1969 |
|
1970 | |||
1970 | def magic_color_info(self,parameter_s = ''): |
|
1971 | def magic_color_info(self,parameter_s = ''): | |
1971 | """Toggle color_info. |
|
1972 | """Toggle color_info. | |
1972 |
|
1973 | |||
1973 | The color_info configuration parameter controls whether colors are |
|
1974 | The color_info configuration parameter controls whether colors are | |
1974 | used for displaying object details (by things like %psource, %pfile or |
|
1975 | used for displaying object details (by things like %psource, %pfile or | |
1975 | the '?' system). This function toggles this value with each call. |
|
1976 | the '?' system). This function toggles this value with each call. | |
1976 |
|
1977 | |||
1977 | Note that unless you have a fairly recent pager (less works better |
|
1978 | Note that unless you have a fairly recent pager (less works better | |
1978 | than more) in your system, using colored object information displays |
|
1979 | than more) in your system, using colored object information displays | |
1979 | will not work properly. Test it and see.""" |
|
1980 | will not work properly. Test it and see.""" | |
1980 |
|
1981 | |||
1981 | self.shell.rc.color_info = 1 - self.shell.rc.color_info |
|
1982 | self.shell.rc.color_info = 1 - self.shell.rc.color_info | |
1982 | self.magic_colors(self.shell.rc.colors) |
|
1983 | self.magic_colors(self.shell.rc.colors) | |
1983 | print 'Object introspection functions have now coloring:', |
|
1984 | print 'Object introspection functions have now coloring:', | |
1984 | print ['OFF','ON'][self.shell.rc.color_info] |
|
1985 | print ['OFF','ON'][self.shell.rc.color_info] | |
1985 |
|
1986 | |||
1986 | def magic_Pprint(self, parameter_s=''): |
|
1987 | def magic_Pprint(self, parameter_s=''): | |
1987 | """Toggle pretty printing on/off.""" |
|
1988 | """Toggle pretty printing on/off.""" | |
1988 |
|
1989 | |||
1989 | self.shell.outputcache.Pprint = 1 - self.shell.outputcache.Pprint |
|
1990 | self.shell.outputcache.Pprint = 1 - self.shell.outputcache.Pprint | |
1990 | print 'Pretty printing has been turned', \ |
|
1991 | print 'Pretty printing has been turned', \ | |
1991 | ['OFF','ON'][self.shell.outputcache.Pprint] |
|
1992 | ['OFF','ON'][self.shell.outputcache.Pprint] | |
1992 |
|
1993 | |||
1993 | def magic_exit(self, parameter_s=''): |
|
1994 | def magic_exit(self, parameter_s=''): | |
1994 | """Exit IPython, confirming if configured to do so. |
|
1995 | """Exit IPython, confirming if configured to do so. | |
1995 |
|
1996 | |||
1996 | You can configure whether IPython asks for confirmation upon exit by |
|
1997 | You can configure whether IPython asks for confirmation upon exit by | |
1997 | setting the confirm_exit flag in the ipythonrc file.""" |
|
1998 | setting the confirm_exit flag in the ipythonrc file.""" | |
1998 |
|
1999 | |||
1999 | self.shell.exit() |
|
2000 | self.shell.exit() | |
2000 |
|
2001 | |||
2001 | def magic_quit(self, parameter_s=''): |
|
2002 | def magic_quit(self, parameter_s=''): | |
2002 | """Exit IPython, confirming if configured to do so (like %exit)""" |
|
2003 | """Exit IPython, confirming if configured to do so (like %exit)""" | |
2003 |
|
2004 | |||
2004 | self.shell.exit() |
|
2005 | self.shell.exit() | |
2005 |
|
2006 | |||
2006 | def magic_Exit(self, parameter_s=''): |
|
2007 | def magic_Exit(self, parameter_s=''): | |
2007 | """Exit IPython without confirmation.""" |
|
2008 | """Exit IPython without confirmation.""" | |
2008 |
|
2009 | |||
2009 | self.shell.exit_now = True |
|
2010 | self.shell.exit_now = True | |
2010 |
|
2011 | |||
2011 | def magic_Quit(self, parameter_s=''): |
|
2012 | def magic_Quit(self, parameter_s=''): | |
2012 | """Exit IPython without confirmation (like %Exit).""" |
|
2013 | """Exit IPython without confirmation (like %Exit).""" | |
2013 |
|
2014 | |||
2014 | self.shell.exit_now = True |
|
2015 | self.shell.exit_now = True | |
2015 |
|
2016 | |||
2016 | #...................................................................... |
|
2017 | #...................................................................... | |
2017 | # Functions to implement unix shell-type things |
|
2018 | # Functions to implement unix shell-type things | |
2018 |
|
2019 | |||
2019 | def magic_alias(self, parameter_s = ''): |
|
2020 | def magic_alias(self, parameter_s = ''): | |
2020 | """Define an alias for a system command. |
|
2021 | """Define an alias for a system command. | |
2021 |
|
2022 | |||
2022 | '%alias alias_name cmd' defines 'alias_name' as an alias for 'cmd' |
|
2023 | '%alias alias_name cmd' defines 'alias_name' as an alias for 'cmd' | |
2023 |
|
2024 | |||
2024 | Then, typing 'alias_name params' will execute the system command 'cmd |
|
2025 | Then, typing 'alias_name params' will execute the system command 'cmd | |
2025 | params' (from your underlying operating system). |
|
2026 | params' (from your underlying operating system). | |
2026 |
|
2027 | |||
2027 | Aliases have lower precedence than magic functions and Python normal |
|
2028 | Aliases have lower precedence than magic functions and Python normal | |
2028 | variables, so if 'foo' is both a Python variable and an alias, the |
|
2029 | variables, so if 'foo' is both a Python variable and an alias, the | |
2029 | alias can not be executed until 'del foo' removes the Python variable. |
|
2030 | alias can not be executed until 'del foo' removes the Python variable. | |
2030 |
|
2031 | |||
2031 | You can use the %l specifier in an alias definition to represent the |
|
2032 | You can use the %l specifier in an alias definition to represent the | |
2032 | whole line when the alias is called. For example: |
|
2033 | whole line when the alias is called. For example: | |
2033 |
|
2034 | |||
2034 | In [2]: alias all echo "Input in brackets: <%l>"\\ |
|
2035 | In [2]: alias all echo "Input in brackets: <%l>"\\ | |
2035 | In [3]: all hello world\\ |
|
2036 | In [3]: all hello world\\ | |
2036 | Input in brackets: <hello world> |
|
2037 | Input in brackets: <hello world> | |
2037 |
|
2038 | |||
2038 | You can also define aliases with parameters using %s specifiers (one |
|
2039 | You can also define aliases with parameters using %s specifiers (one | |
2039 | per parameter): |
|
2040 | per parameter): | |
2040 |
|
2041 | |||
2041 | In [1]: alias parts echo first %s second %s\\ |
|
2042 | In [1]: alias parts echo first %s second %s\\ | |
2042 | In [2]: %parts A B\\ |
|
2043 | In [2]: %parts A B\\ | |
2043 | first A second B\\ |
|
2044 | first A second B\\ | |
2044 | In [3]: %parts A\\ |
|
2045 | In [3]: %parts A\\ | |
2045 | Incorrect number of arguments: 2 expected.\\ |
|
2046 | Incorrect number of arguments: 2 expected.\\ | |
2046 | parts is an alias to: 'echo first %s second %s' |
|
2047 | parts is an alias to: 'echo first %s second %s' | |
2047 |
|
2048 | |||
2048 | Note that %l and %s are mutually exclusive. You can only use one or |
|
2049 | Note that %l and %s are mutually exclusive. You can only use one or | |
2049 | the other in your aliases. |
|
2050 | the other in your aliases. | |
2050 |
|
2051 | |||
2051 | Aliases expand Python variables just like system calls using ! or !! |
|
2052 | Aliases expand Python variables just like system calls using ! or !! | |
2052 | do: all expressions prefixed with '$' get expanded. For details of |
|
2053 | do: all expressions prefixed with '$' get expanded. For details of | |
2053 | the semantic rules, see PEP-215: |
|
2054 | the semantic rules, see PEP-215: | |
2054 | http://www.python.org/peps/pep-0215.html. This is the library used by |
|
2055 | http://www.python.org/peps/pep-0215.html. This is the library used by | |
2055 | IPython for variable expansion. If you want to access a true shell |
|
2056 | IPython for variable expansion. If you want to access a true shell | |
2056 | variable, an extra $ is necessary to prevent its expansion by IPython: |
|
2057 | variable, an extra $ is necessary to prevent its expansion by IPython: | |
2057 |
|
2058 | |||
2058 | In [6]: alias show echo\\ |
|
2059 | In [6]: alias show echo\\ | |
2059 | In [7]: PATH='A Python string'\\ |
|
2060 | In [7]: PATH='A Python string'\\ | |
2060 | In [8]: show $PATH\\ |
|
2061 | In [8]: show $PATH\\ | |
2061 | A Python string\\ |
|
2062 | A Python string\\ | |
2062 | In [9]: show $$PATH\\ |
|
2063 | In [9]: show $$PATH\\ | |
2063 | /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:... |
|
2064 | /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:... | |
2064 |
|
2065 | |||
2065 | You can use the alias facility to acess all of $PATH. See the %rehash |
|
2066 | You can use the alias facility to acess all of $PATH. See the %rehash | |
2066 | and %rehashx functions, which automatically create aliases for the |
|
2067 | and %rehashx functions, which automatically create aliases for the | |
2067 | contents of your $PATH. |
|
2068 | contents of your $PATH. | |
2068 |
|
2069 | |||
2069 | If called with no parameters, %alias prints the current alias table.""" |
|
2070 | If called with no parameters, %alias prints the current alias table.""" | |
2070 |
|
2071 | |||
2071 | par = parameter_s.strip() |
|
2072 | par = parameter_s.strip() | |
2072 | if not par: |
|
2073 | if not par: | |
2073 | if self.shell.rc.automagic: |
|
2074 | if self.shell.rc.automagic: | |
2074 | prechar = '' |
|
2075 | prechar = '' | |
2075 | else: |
|
2076 | else: | |
2076 | prechar = self.shell.ESC_MAGIC |
|
2077 | prechar = self.shell.ESC_MAGIC | |
2077 | print 'Alias\t\tSystem Command\n'+'-'*30 |
|
2078 | print 'Alias\t\tSystem Command\n'+'-'*30 | |
2078 | atab = self.shell.alias_table |
|
2079 | atab = self.shell.alias_table | |
2079 | aliases = atab.keys() |
|
2080 | aliases = atab.keys() | |
2080 | aliases.sort() |
|
2081 | aliases.sort() | |
2081 | for alias in aliases: |
|
2082 | for alias in aliases: | |
2082 | print prechar+alias+'\t\t'+atab[alias][1] |
|
2083 | print prechar+alias+'\t\t'+atab[alias][1] | |
2083 | print '-'*30+'\nTotal number of aliases:',len(aliases) |
|
2084 | print '-'*30+'\nTotal number of aliases:',len(aliases) | |
2084 | return |
|
2085 | return | |
2085 | try: |
|
2086 | try: | |
2086 | alias,cmd = par.split(None,1) |
|
2087 | alias,cmd = par.split(None,1) | |
2087 | except: |
|
2088 | except: | |
2088 | print OInspect.getdoc(self.magic_alias) |
|
2089 | print OInspect.getdoc(self.magic_alias) | |
2089 | else: |
|
2090 | else: | |
2090 | nargs = cmd.count('%s') |
|
2091 | nargs = cmd.count('%s') | |
2091 | if nargs>0 and cmd.find('%l')>=0: |
|
2092 | if nargs>0 and cmd.find('%l')>=0: | |
2092 | error('The %s and %l specifiers are mutually exclusive ' |
|
2093 | error('The %s and %l specifiers are mutually exclusive ' | |
2093 | 'in alias definitions.') |
|
2094 | 'in alias definitions.') | |
2094 | else: # all looks OK |
|
2095 | else: # all looks OK | |
2095 | self.shell.alias_table[alias] = (nargs,cmd) |
|
2096 | self.shell.alias_table[alias] = (nargs,cmd) | |
2096 | self.shell.alias_table_validate(verbose=1) |
|
2097 | self.shell.alias_table_validate(verbose=1) | |
2097 | # end magic_alias |
|
2098 | # end magic_alias | |
2098 |
|
2099 | |||
2099 | def magic_unalias(self, parameter_s = ''): |
|
2100 | def magic_unalias(self, parameter_s = ''): | |
2100 | """Remove an alias""" |
|
2101 | """Remove an alias""" | |
2101 |
|
2102 | |||
2102 | aname = parameter_s.strip() |
|
2103 | aname = parameter_s.strip() | |
2103 | if aname in self.shell.alias_table: |
|
2104 | if aname in self.shell.alias_table: | |
2104 | del self.shell.alias_table[aname] |
|
2105 | del self.shell.alias_table[aname] | |
2105 |
|
2106 | |||
2106 | def magic_rehash(self, parameter_s = ''): |
|
2107 | def magic_rehash(self, parameter_s = ''): | |
2107 | """Update the alias table with all entries in $PATH. |
|
2108 | """Update the alias table with all entries in $PATH. | |
2108 |
|
2109 | |||
2109 | This version does no checks on execute permissions or whether the |
|
2110 | This version does no checks on execute permissions or whether the | |
2110 | contents of $PATH are truly files (instead of directories or something |
|
2111 | contents of $PATH are truly files (instead of directories or something | |
2111 | else). For such a safer (but slower) version, use %rehashx.""" |
|
2112 | else). For such a safer (but slower) version, use %rehashx.""" | |
2112 |
|
2113 | |||
2113 | # This function (and rehashx) manipulate the alias_table directly |
|
2114 | # This function (and rehashx) manipulate the alias_table directly | |
2114 | # rather than calling magic_alias, for speed reasons. A rehash on a |
|
2115 | # rather than calling magic_alias, for speed reasons. A rehash on a | |
2115 | # typical Linux box involves several thousand entries, so efficiency |
|
2116 | # typical Linux box involves several thousand entries, so efficiency | |
2116 | # here is a top concern. |
|
2117 | # here is a top concern. | |
2117 |
|
2118 | |||
2118 | path = filter(os.path.isdir,os.environ['PATH'].split(os.pathsep)) |
|
2119 | path = filter(os.path.isdir,os.environ['PATH'].split(os.pathsep)) | |
2119 | alias_table = self.shell.alias_table |
|
2120 | alias_table = self.shell.alias_table | |
2120 | for pdir in path: |
|
2121 | for pdir in path: | |
2121 | for ff in os.listdir(pdir): |
|
2122 | for ff in os.listdir(pdir): | |
2122 | # each entry in the alias table must be (N,name), where |
|
2123 | # each entry in the alias table must be (N,name), where | |
2123 | # N is the number of positional arguments of the alias. |
|
2124 | # N is the number of positional arguments of the alias. | |
2124 | alias_table[ff] = (0,ff) |
|
2125 | alias_table[ff] = (0,ff) | |
2125 | # Make sure the alias table doesn't contain keywords or builtins |
|
2126 | # Make sure the alias table doesn't contain keywords or builtins | |
2126 | self.shell.alias_table_validate() |
|
2127 | self.shell.alias_table_validate() | |
2127 | # Call again init_auto_alias() so we get 'rm -i' and other modified |
|
2128 | # Call again init_auto_alias() so we get 'rm -i' and other modified | |
2128 | # aliases since %rehash will probably clobber them |
|
2129 | # aliases since %rehash will probably clobber them | |
2129 | self.shell.init_auto_alias() |
|
2130 | self.shell.init_auto_alias() | |
2130 |
|
2131 | |||
2131 | def magic_rehashx(self, parameter_s = ''): |
|
2132 | def magic_rehashx(self, parameter_s = ''): | |
2132 | """Update the alias table with all executable files in $PATH. |
|
2133 | """Update the alias table with all executable files in $PATH. | |
2133 |
|
2134 | |||
2134 | This version explicitly checks that every entry in $PATH is a file |
|
2135 | This version explicitly checks that every entry in $PATH is a file | |
2135 | with execute access (os.X_OK), so it is much slower than %rehash. |
|
2136 | with execute access (os.X_OK), so it is much slower than %rehash. | |
2136 |
|
2137 | |||
2137 | Under Windows, it checks executability as a match agains a |
|
2138 | Under Windows, it checks executability as a match agains a | |
2138 | '|'-separated string of extensions, stored in the IPython config |
|
2139 | '|'-separated string of extensions, stored in the IPython config | |
2139 | variable win_exec_ext. This defaults to 'exe|com|bat'. """ |
|
2140 | variable win_exec_ext. This defaults to 'exe|com|bat'. """ | |
2140 |
|
2141 | |||
2141 | path = filter(os.path.isdir,os.environ['PATH'].split(os.pathsep)) |
|
2142 | path = filter(os.path.isdir,os.environ['PATH'].split(os.pathsep)) | |
2142 | alias_table = self.shell.alias_table |
|
2143 | alias_table = self.shell.alias_table | |
2143 |
|
2144 | |||
2144 | if os.name == 'posix': |
|
2145 | if os.name == 'posix': | |
2145 | isexec = lambda fname:os.path.isfile(fname) and \ |
|
2146 | isexec = lambda fname:os.path.isfile(fname) and \ | |
2146 | os.access(fname,os.X_OK) |
|
2147 | os.access(fname,os.X_OK) | |
2147 | else: |
|
2148 | else: | |
2148 |
|
2149 | |||
2149 | try: |
|
2150 | try: | |
2150 | winext = os.environ['pathext'].replace(';','|').replace('.','') |
|
2151 | winext = os.environ['pathext'].replace(';','|').replace('.','') | |
2151 | except KeyError: |
|
2152 | except KeyError: | |
2152 | winext = 'exe|com|bat' |
|
2153 | winext = 'exe|com|bat' | |
2153 |
|
2154 | |||
2154 | execre = re.compile(r'(.*)\.(%s)$' % winext,re.IGNORECASE) |
|
2155 | execre = re.compile(r'(.*)\.(%s)$' % winext,re.IGNORECASE) | |
2155 | isexec = lambda fname:os.path.isfile(fname) and execre.match(fname) |
|
2156 | isexec = lambda fname:os.path.isfile(fname) and execre.match(fname) | |
2156 | savedir = os.getcwd() |
|
2157 | savedir = os.getcwd() | |
2157 | try: |
|
2158 | try: | |
2158 | # write the whole loop for posix/Windows so we don't have an if in |
|
2159 | # write the whole loop for posix/Windows so we don't have an if in | |
2159 | # the innermost part |
|
2160 | # the innermost part | |
2160 | if os.name == 'posix': |
|
2161 | if os.name == 'posix': | |
2161 | for pdir in path: |
|
2162 | for pdir in path: | |
2162 | os.chdir(pdir) |
|
2163 | os.chdir(pdir) | |
2163 | for ff in os.listdir(pdir): |
|
2164 | for ff in os.listdir(pdir): | |
2164 | if isexec(ff): |
|
2165 | if isexec(ff): | |
2165 | # each entry in the alias table must be (N,name), |
|
2166 | # each entry in the alias table must be (N,name), | |
2166 | # where N is the number of positional arguments of the |
|
2167 | # where N is the number of positional arguments of the | |
2167 | # alias. |
|
2168 | # alias. | |
2168 | alias_table[ff] = (0,ff) |
|
2169 | alias_table[ff] = (0,ff) | |
2169 | else: |
|
2170 | else: | |
2170 | for pdir in path: |
|
2171 | for pdir in path: | |
2171 | os.chdir(pdir) |
|
2172 | os.chdir(pdir) | |
2172 | for ff in os.listdir(pdir): |
|
2173 | for ff in os.listdir(pdir): | |
2173 | if isexec(ff): |
|
2174 | if isexec(ff): | |
2174 | alias_table[execre.sub(r'\1',ff)] = (0,ff) |
|
2175 | alias_table[execre.sub(r'\1',ff)] = (0,ff) | |
2175 | # Make sure the alias table doesn't contain keywords or builtins |
|
2176 | # Make sure the alias table doesn't contain keywords or builtins | |
2176 | self.shell.alias_table_validate() |
|
2177 | self.shell.alias_table_validate() | |
2177 | # Call again init_auto_alias() so we get 'rm -i' and other |
|
2178 | # Call again init_auto_alias() so we get 'rm -i' and other | |
2178 | # modified aliases since %rehashx will probably clobber them |
|
2179 | # modified aliases since %rehashx will probably clobber them | |
2179 | self.shell.init_auto_alias() |
|
2180 | self.shell.init_auto_alias() | |
2180 | finally: |
|
2181 | finally: | |
2181 | os.chdir(savedir) |
|
2182 | os.chdir(savedir) | |
2182 |
|
2183 | |||
2183 | def magic_pwd(self, parameter_s = ''): |
|
2184 | def magic_pwd(self, parameter_s = ''): | |
2184 | """Return the current working directory path.""" |
|
2185 | """Return the current working directory path.""" | |
2185 | return os.getcwd() |
|
2186 | return os.getcwd() | |
2186 |
|
2187 | |||
2187 | def magic_cd(self, parameter_s=''): |
|
2188 | def magic_cd(self, parameter_s=''): | |
2188 | """Change the current working directory. |
|
2189 | """Change the current working directory. | |
2189 |
|
2190 | |||
2190 | This command automatically maintains an internal list of directories |
|
2191 | This command automatically maintains an internal list of directories | |
2191 | you visit during your IPython session, in the variable _dh. The |
|
2192 | you visit during your IPython session, in the variable _dh. The | |
2192 | command %dhist shows this history nicely formatted. |
|
2193 | command %dhist shows this history nicely formatted. | |
2193 |
|
2194 | |||
2194 | Usage: |
|
2195 | Usage: | |
2195 |
|
2196 | |||
2196 | cd 'dir': changes to directory 'dir'. |
|
2197 | cd 'dir': changes to directory 'dir'. | |
2197 |
|
2198 | |||
2198 | cd -: changes to the last visited directory. |
|
2199 | cd -: changes to the last visited directory. | |
2199 |
|
2200 | |||
2200 | cd -<n>: changes to the n-th directory in the directory history. |
|
2201 | cd -<n>: changes to the n-th directory in the directory history. | |
2201 |
|
2202 | |||
2202 | cd -b <bookmark_name>: jump to a bookmark set by %bookmark |
|
2203 | cd -b <bookmark_name>: jump to a bookmark set by %bookmark | |
2203 | (note: cd <bookmark_name> is enough if there is no |
|
2204 | (note: cd <bookmark_name> is enough if there is no | |
2204 | directory <bookmark_name>, but a bookmark with the name exists.) |
|
2205 | directory <bookmark_name>, but a bookmark with the name exists.) | |
2205 |
|
2206 | |||
2206 | Options: |
|
2207 | Options: | |
2207 |
|
2208 | |||
2208 | -q: quiet. Do not print the working directory after the cd command is |
|
2209 | -q: quiet. Do not print the working directory after the cd command is | |
2209 | executed. By default IPython's cd command does print this directory, |
|
2210 | executed. By default IPython's cd command does print this directory, | |
2210 | since the default prompts do not display path information. |
|
2211 | since the default prompts do not display path information. | |
2211 |
|
2212 | |||
2212 | Note that !cd doesn't work for this purpose because the shell where |
|
2213 | Note that !cd doesn't work for this purpose because the shell where | |
2213 | !command runs is immediately discarded after executing 'command'.""" |
|
2214 | !command runs is immediately discarded after executing 'command'.""" | |
2214 |
|
2215 | |||
2215 | parameter_s = parameter_s.strip() |
|
2216 | parameter_s = parameter_s.strip() | |
2216 | bkms = self.shell.persist.get("bookmarks",{}) |
|
2217 | bkms = self.shell.persist.get("bookmarks",{}) | |
2217 |
|
2218 | |||
2218 | numcd = re.match(r'(-)(\d+)$',parameter_s) |
|
2219 | numcd = re.match(r'(-)(\d+)$',parameter_s) | |
2219 | # jump in directory history by number |
|
2220 | # jump in directory history by number | |
2220 | if numcd: |
|
2221 | if numcd: | |
2221 | nn = int(numcd.group(2)) |
|
2222 | nn = int(numcd.group(2)) | |
2222 | try: |
|
2223 | try: | |
2223 | ps = self.shell.user_ns['_dh'][nn] |
|
2224 | ps = self.shell.user_ns['_dh'][nn] | |
2224 | except IndexError: |
|
2225 | except IndexError: | |
2225 | print 'The requested directory does not exist in history.' |
|
2226 | print 'The requested directory does not exist in history.' | |
2226 | return |
|
2227 | return | |
2227 | else: |
|
2228 | else: | |
2228 | opts = {} |
|
2229 | opts = {} | |
2229 | else: |
|
2230 | else: | |
2230 | opts,ps = self.parse_options(parameter_s,'qb',mode='string') |
|
2231 | opts,ps = self.parse_options(parameter_s,'qb',mode='string') | |
2231 | # jump to previous |
|
2232 | # jump to previous | |
2232 | if ps == '-': |
|
2233 | if ps == '-': | |
2233 | try: |
|
2234 | try: | |
2234 | ps = self.shell.user_ns['_dh'][-2] |
|
2235 | ps = self.shell.user_ns['_dh'][-2] | |
2235 | except IndexError: |
|
2236 | except IndexError: | |
2236 | print 'No previous directory to change to.' |
|
2237 | print 'No previous directory to change to.' | |
2237 | return |
|
2238 | return | |
2238 | # jump to bookmark |
|
2239 | # jump to bookmark | |
2239 | elif opts.has_key('b') or (bkms.has_key(ps) and not os.path.isdir(ps)): |
|
2240 | elif opts.has_key('b') or (bkms.has_key(ps) and not os.path.isdir(ps)): | |
2240 | if bkms.has_key(ps): |
|
2241 | if bkms.has_key(ps): | |
2241 | target = bkms[ps] |
|
2242 | target = bkms[ps] | |
2242 | print '(bookmark:%s) -> %s' % (ps,target) |
|
2243 | print '(bookmark:%s) -> %s' % (ps,target) | |
2243 | ps = target |
|
2244 | ps = target | |
2244 | else: |
|
2245 | else: | |
2245 | if bkms: |
|
2246 | if bkms: | |
2246 | error("Bookmark '%s' not found. " |
|
2247 | error("Bookmark '%s' not found. " | |
2247 | "Use '%bookmark -l' to see your bookmarks." % ps) |
|
2248 | "Use '%bookmark -l' to see your bookmarks." % ps) | |
2248 | else: |
|
2249 | else: | |
2249 | print "Bookmarks not set - use %bookmark <bookmarkname>" |
|
2250 | print "Bookmarks not set - use %bookmark <bookmarkname>" | |
2250 | return |
|
2251 | return | |
2251 |
|
2252 | |||
2252 | # at this point ps should point to the target dir |
|
2253 | # at this point ps should point to the target dir | |
2253 | if ps: |
|
2254 | if ps: | |
2254 | try: |
|
2255 | try: | |
2255 | os.chdir(os.path.expanduser(ps)) |
|
2256 | os.chdir(os.path.expanduser(ps)) | |
2256 | except OSError: |
|
2257 | except OSError: | |
2257 | print sys.exc_info()[1] |
|
2258 | print sys.exc_info()[1] | |
2258 | else: |
|
2259 | else: | |
2259 | self.shell.user_ns['_dh'].append(os.getcwd()) |
|
2260 | self.shell.user_ns['_dh'].append(os.getcwd()) | |
2260 | else: |
|
2261 | else: | |
2261 | os.chdir(self.shell.home_dir) |
|
2262 | os.chdir(self.shell.home_dir) | |
2262 | self.shell.user_ns['_dh'].append(os.getcwd()) |
|
2263 | self.shell.user_ns['_dh'].append(os.getcwd()) | |
2263 | if not 'q' in opts: |
|
2264 | if not 'q' in opts: | |
2264 | print self.shell.user_ns['_dh'][-1] |
|
2265 | print self.shell.user_ns['_dh'][-1] | |
2265 |
|
2266 | |||
2266 | def magic_dhist(self, parameter_s=''): |
|
2267 | def magic_dhist(self, parameter_s=''): | |
2267 | """Print your history of visited directories. |
|
2268 | """Print your history of visited directories. | |
2268 |
|
2269 | |||
2269 | %dhist -> print full history\\ |
|
2270 | %dhist -> print full history\\ | |
2270 | %dhist n -> print last n entries only\\ |
|
2271 | %dhist n -> print last n entries only\\ | |
2271 | %dhist n1 n2 -> print entries between n1 and n2 (n1 not included)\\ |
|
2272 | %dhist n1 n2 -> print entries between n1 and n2 (n1 not included)\\ | |
2272 |
|
2273 | |||
2273 | This history is automatically maintained by the %cd command, and |
|
2274 | This history is automatically maintained by the %cd command, and | |
2274 | always available as the global list variable _dh. You can use %cd -<n> |
|
2275 | always available as the global list variable _dh. You can use %cd -<n> | |
2275 | to go to directory number <n>.""" |
|
2276 | to go to directory number <n>.""" | |
2276 |
|
2277 | |||
2277 | dh = self.shell.user_ns['_dh'] |
|
2278 | dh = self.shell.user_ns['_dh'] | |
2278 | if parameter_s: |
|
2279 | if parameter_s: | |
2279 | try: |
|
2280 | try: | |
2280 | args = map(int,parameter_s.split()) |
|
2281 | args = map(int,parameter_s.split()) | |
2281 | except: |
|
2282 | except: | |
2282 | self.arg_err(Magic.magic_dhist) |
|
2283 | self.arg_err(Magic.magic_dhist) | |
2283 | return |
|
2284 | return | |
2284 | if len(args) == 1: |
|
2285 | if len(args) == 1: | |
2285 | ini,fin = max(len(dh)-(args[0]),0),len(dh) |
|
2286 | ini,fin = max(len(dh)-(args[0]),0),len(dh) | |
2286 | elif len(args) == 2: |
|
2287 | elif len(args) == 2: | |
2287 | ini,fin = args |
|
2288 | ini,fin = args | |
2288 | else: |
|
2289 | else: | |
2289 | self.arg_err(Magic.magic_dhist) |
|
2290 | self.arg_err(Magic.magic_dhist) | |
2290 | return |
|
2291 | return | |
2291 | else: |
|
2292 | else: | |
2292 | ini,fin = 0,len(dh) |
|
2293 | ini,fin = 0,len(dh) | |
2293 | nlprint(dh, |
|
2294 | nlprint(dh, | |
2294 | header = 'Directory history (kept in _dh)', |
|
2295 | header = 'Directory history (kept in _dh)', | |
2295 | start=ini,stop=fin) |
|
2296 | start=ini,stop=fin) | |
2296 |
|
2297 | |||
2297 | def magic_env(self, parameter_s=''): |
|
2298 | def magic_env(self, parameter_s=''): | |
2298 | """List environment variables.""" |
|
2299 | """List environment variables.""" | |
2299 |
|
2300 | |||
2300 | return os.environ.data |
|
2301 | return os.environ.data | |
2301 |
|
2302 | |||
2302 | def magic_pushd(self, parameter_s=''): |
|
2303 | def magic_pushd(self, parameter_s=''): | |
2303 | """Place the current dir on stack and change directory. |
|
2304 | """Place the current dir on stack and change directory. | |
2304 |
|
2305 | |||
2305 | Usage:\\ |
|
2306 | Usage:\\ | |
2306 | %pushd ['dirname'] |
|
2307 | %pushd ['dirname'] | |
2307 |
|
2308 | |||
2308 | %pushd with no arguments does a %pushd to your home directory. |
|
2309 | %pushd with no arguments does a %pushd to your home directory. | |
2309 | """ |
|
2310 | """ | |
2310 | if parameter_s == '': parameter_s = '~' |
|
2311 | if parameter_s == '': parameter_s = '~' | |
2311 | dir_s = self.shell.dir_stack |
|
2312 | dir_s = self.shell.dir_stack | |
2312 | if len(dir_s)>0 and os.path.expanduser(parameter_s) != \ |
|
2313 | if len(dir_s)>0 and os.path.expanduser(parameter_s) != \ | |
2313 | os.path.expanduser(self.shell.dir_stack[0]): |
|
2314 | os.path.expanduser(self.shell.dir_stack[0]): | |
2314 | try: |
|
2315 | try: | |
2315 | self.magic_cd(parameter_s) |
|
2316 | self.magic_cd(parameter_s) | |
2316 | dir_s.insert(0,os.getcwd().replace(self.home_dir,'~')) |
|
2317 | dir_s.insert(0,os.getcwd().replace(self.home_dir,'~')) | |
2317 | self.magic_dirs() |
|
2318 | self.magic_dirs() | |
2318 | except: |
|
2319 | except: | |
2319 | print 'Invalid directory' |
|
2320 | print 'Invalid directory' | |
2320 | else: |
|
2321 | else: | |
2321 | print 'You are already there!' |
|
2322 | print 'You are already there!' | |
2322 |
|
2323 | |||
2323 | def magic_popd(self, parameter_s=''): |
|
2324 | def magic_popd(self, parameter_s=''): | |
2324 | """Change to directory popped off the top of the stack. |
|
2325 | """Change to directory popped off the top of the stack. | |
2325 | """ |
|
2326 | """ | |
2326 | if len (self.shell.dir_stack) > 1: |
|
2327 | if len (self.shell.dir_stack) > 1: | |
2327 | self.shell.dir_stack.pop(0) |
|
2328 | self.shell.dir_stack.pop(0) | |
2328 | self.magic_cd(self.shell.dir_stack[0]) |
|
2329 | self.magic_cd(self.shell.dir_stack[0]) | |
2329 | print self.shell.dir_stack[0] |
|
2330 | print self.shell.dir_stack[0] | |
2330 | else: |
|
2331 | else: | |
2331 | print "You can't remove the starting directory from the stack:",\ |
|
2332 | print "You can't remove the starting directory from the stack:",\ | |
2332 | self.shell.dir_stack |
|
2333 | self.shell.dir_stack | |
2333 |
|
2334 | |||
2334 | def magic_dirs(self, parameter_s=''): |
|
2335 | def magic_dirs(self, parameter_s=''): | |
2335 | """Return the current directory stack.""" |
|
2336 | """Return the current directory stack.""" | |
2336 |
|
2337 | |||
2337 | return self.shell.dir_stack[:] |
|
2338 | return self.shell.dir_stack[:] | |
2338 |
|
2339 | |||
2339 | def magic_sc(self, parameter_s=''): |
|
2340 | def magic_sc(self, parameter_s=''): | |
2340 | """Shell capture - execute a shell command and capture its output. |
|
2341 | """Shell capture - execute a shell command and capture its output. | |
2341 |
|
2342 | |||
2342 | %sc [options] varname=command |
|
2343 | %sc [options] varname=command | |
2343 |
|
2344 | |||
2344 | IPython will run the given command using commands.getoutput(), and |
|
2345 | IPython will run the given command using commands.getoutput(), and | |
2345 | will then update the user's interactive namespace with a variable |
|
2346 | will then update the user's interactive namespace with a variable | |
2346 | called varname, containing the value of the call. Your command can |
|
2347 | called varname, containing the value of the call. Your command can | |
2347 | contain shell wildcards, pipes, etc. |
|
2348 | contain shell wildcards, pipes, etc. | |
2348 |
|
2349 | |||
2349 | The '=' sign in the syntax is mandatory, and the variable name you |
|
2350 | The '=' sign in the syntax is mandatory, and the variable name you | |
2350 | supply must follow Python's standard conventions for valid names. |
|
2351 | supply must follow Python's standard conventions for valid names. | |
2351 |
|
2352 | |||
2352 | Options: |
|
2353 | Options: | |
2353 |
|
2354 | |||
2354 | -l: list output. Split the output on newlines into a list before |
|
2355 | -l: list output. Split the output on newlines into a list before | |
2355 | assigning it to the given variable. By default the output is stored |
|
2356 | assigning it to the given variable. By default the output is stored | |
2356 | as a single string. |
|
2357 | as a single string. | |
2357 |
|
2358 | |||
2358 | -v: verbose. Print the contents of the variable. |
|
2359 | -v: verbose. Print the contents of the variable. | |
2359 |
|
2360 | |||
2360 | In most cases you should not need to split as a list, because the |
|
2361 | In most cases you should not need to split as a list, because the | |
2361 | returned value is a special type of string which can automatically |
|
2362 | returned value is a special type of string which can automatically | |
2362 | provide its contents either as a list (split on newlines) or as a |
|
2363 | provide its contents either as a list (split on newlines) or as a | |
2363 | space-separated string. These are convenient, respectively, either |
|
2364 | space-separated string. These are convenient, respectively, either | |
2364 | for sequential processing or to be passed to a shell command. |
|
2365 | for sequential processing or to be passed to a shell command. | |
2365 |
|
2366 | |||
2366 | For example: |
|
2367 | For example: | |
2367 |
|
2368 | |||
2368 | # Capture into variable a |
|
2369 | # Capture into variable a | |
2369 | In [9]: sc a=ls *py |
|
2370 | In [9]: sc a=ls *py | |
2370 |
|
2371 | |||
2371 | # a is a string with embedded newlines |
|
2372 | # a is a string with embedded newlines | |
2372 | In [10]: a |
|
2373 | In [10]: a | |
2373 | Out[10]: 'setup.py\nwin32_manual_post_install.py' |
|
2374 | Out[10]: 'setup.py\nwin32_manual_post_install.py' | |
2374 |
|
2375 | |||
2375 | # which can be seen as a list: |
|
2376 | # which can be seen as a list: | |
2376 | In [11]: a.l |
|
2377 | In [11]: a.l | |
2377 | Out[11]: ['setup.py', 'win32_manual_post_install.py'] |
|
2378 | Out[11]: ['setup.py', 'win32_manual_post_install.py'] | |
2378 |
|
2379 | |||
2379 | # or as a whitespace-separated string: |
|
2380 | # or as a whitespace-separated string: | |
2380 | In [12]: a.s |
|
2381 | In [12]: a.s | |
2381 | Out[12]: 'setup.py win32_manual_post_install.py' |
|
2382 | Out[12]: 'setup.py win32_manual_post_install.py' | |
2382 |
|
2383 | |||
2383 | # a.s is useful to pass as a single command line: |
|
2384 | # a.s is useful to pass as a single command line: | |
2384 | In [13]: !wc -l $a.s |
|
2385 | In [13]: !wc -l $a.s | |
2385 | 146 setup.py |
|
2386 | 146 setup.py | |
2386 | 130 win32_manual_post_install.py |
|
2387 | 130 win32_manual_post_install.py | |
2387 | 276 total |
|
2388 | 276 total | |
2388 |
|
2389 | |||
2389 | # while the list form is useful to loop over: |
|
2390 | # while the list form is useful to loop over: | |
2390 | In [14]: for f in a.l: |
|
2391 | In [14]: for f in a.l: | |
2391 | ....: !wc -l $f |
|
2392 | ....: !wc -l $f | |
2392 | ....: |
|
2393 | ....: | |
2393 | 146 setup.py |
|
2394 | 146 setup.py | |
2394 | 130 win32_manual_post_install.py |
|
2395 | 130 win32_manual_post_install.py | |
2395 |
|
2396 | |||
2396 | Similiarly, the lists returned by the -l option are also special, in |
|
2397 | Similiarly, the lists returned by the -l option are also special, in | |
2397 | the sense that you can equally invoke the .s attribute on them to |
|
2398 | the sense that you can equally invoke the .s attribute on them to | |
2398 | automatically get a whitespace-separated string from their contents: |
|
2399 | automatically get a whitespace-separated string from their contents: | |
2399 |
|
2400 | |||
2400 | In [1]: sc -l b=ls *py |
|
2401 | In [1]: sc -l b=ls *py | |
2401 |
|
2402 | |||
2402 | In [2]: b |
|
2403 | In [2]: b | |
2403 | Out[2]: ['setup.py', 'win32_manual_post_install.py'] |
|
2404 | Out[2]: ['setup.py', 'win32_manual_post_install.py'] | |
2404 |
|
2405 | |||
2405 | In [3]: b.s |
|
2406 | In [3]: b.s | |
2406 | Out[3]: 'setup.py win32_manual_post_install.py' |
|
2407 | Out[3]: 'setup.py win32_manual_post_install.py' | |
2407 |
|
2408 | |||
2408 | In summary, both the lists and strings used for ouptut capture have |
|
2409 | In summary, both the lists and strings used for ouptut capture have | |
2409 | the following special attributes: |
|
2410 | the following special attributes: | |
2410 |
|
2411 | |||
2411 | .l (or .list) : value as list. |
|
2412 | .l (or .list) : value as list. | |
2412 | .n (or .nlstr): value as newline-separated string. |
|
2413 | .n (or .nlstr): value as newline-separated string. | |
2413 | .s (or .spstr): value as space-separated string. |
|
2414 | .s (or .spstr): value as space-separated string. | |
2414 | """ |
|
2415 | """ | |
2415 |
|
2416 | |||
2416 | opts,args = self.parse_options(parameter_s,'lv') |
|
2417 | opts,args = self.parse_options(parameter_s,'lv') | |
2417 | # Try to get a variable name and command to run |
|
2418 | # Try to get a variable name and command to run | |
2418 | try: |
|
2419 | try: | |
2419 | # the variable name must be obtained from the parse_options |
|
2420 | # the variable name must be obtained from the parse_options | |
2420 | # output, which uses shlex.split to strip options out. |
|
2421 | # output, which uses shlex.split to strip options out. | |
2421 | var,_ = args.split('=',1) |
|
2422 | var,_ = args.split('=',1) | |
2422 | var = var.strip() |
|
2423 | var = var.strip() | |
2423 | # But the the command has to be extracted from the original input |
|
2424 | # But the the command has to be extracted from the original input | |
2424 | # parameter_s, not on what parse_options returns, to avoid the |
|
2425 | # parameter_s, not on what parse_options returns, to avoid the | |
2425 | # quote stripping which shlex.split performs on it. |
|
2426 | # quote stripping which shlex.split performs on it. | |
2426 | _,cmd = parameter_s.split('=',1) |
|
2427 | _,cmd = parameter_s.split('=',1) | |
2427 | except ValueError: |
|
2428 | except ValueError: | |
2428 | var,cmd = '','' |
|
2429 | var,cmd = '','' | |
2429 | if not var: |
|
2430 | if not var: | |
2430 | error('you must specify a variable to assign the command to.') |
|
2431 | error('you must specify a variable to assign the command to.') | |
2431 | return |
|
2432 | return | |
2432 | # If all looks ok, proceed |
|
2433 | # If all looks ok, proceed | |
2433 | out,err = self.shell.getoutputerror(cmd) |
|
2434 | out,err = self.shell.getoutputerror(cmd) | |
2434 | if err: |
|
2435 | if err: | |
2435 | print >> Term.cerr,err |
|
2436 | print >> Term.cerr,err | |
2436 | if opts.has_key('l'): |
|
2437 | if opts.has_key('l'): | |
2437 | out = SList(out.split('\n')) |
|
2438 | out = SList(out.split('\n')) | |
2438 | else: |
|
2439 | else: | |
2439 | out = LSString(out) |
|
2440 | out = LSString(out) | |
2440 | if opts.has_key('v'): |
|
2441 | if opts.has_key('v'): | |
2441 | print '%s ==\n%s' % (var,pformat(out)) |
|
2442 | print '%s ==\n%s' % (var,pformat(out)) | |
2442 | self.shell.user_ns.update({var:out}) |
|
2443 | self.shell.user_ns.update({var:out}) | |
2443 |
|
2444 | |||
2444 | def magic_sx(self, parameter_s=''): |
|
2445 | def magic_sx(self, parameter_s=''): | |
2445 | """Shell execute - run a shell command and capture its output. |
|
2446 | """Shell execute - run a shell command and capture its output. | |
2446 |
|
2447 | |||
2447 | %sx command |
|
2448 | %sx command | |
2448 |
|
2449 | |||
2449 | IPython will run the given command using commands.getoutput(), and |
|
2450 | IPython will run the given command using commands.getoutput(), and | |
2450 | return the result formatted as a list (split on '\\n'). Since the |
|
2451 | return the result formatted as a list (split on '\\n'). Since the | |
2451 | output is _returned_, it will be stored in ipython's regular output |
|
2452 | output is _returned_, it will be stored in ipython's regular output | |
2452 | cache Out[N] and in the '_N' automatic variables. |
|
2453 | cache Out[N] and in the '_N' automatic variables. | |
2453 |
|
2454 | |||
2454 | Notes: |
|
2455 | Notes: | |
2455 |
|
2456 | |||
2456 | 1) If an input line begins with '!!', then %sx is automatically |
|
2457 | 1) If an input line begins with '!!', then %sx is automatically | |
2457 | invoked. That is, while: |
|
2458 | invoked. That is, while: | |
2458 | !ls |
|
2459 | !ls | |
2459 | causes ipython to simply issue system('ls'), typing |
|
2460 | causes ipython to simply issue system('ls'), typing | |
2460 | !!ls |
|
2461 | !!ls | |
2461 | is a shorthand equivalent to: |
|
2462 | is a shorthand equivalent to: | |
2462 | %sx ls |
|
2463 | %sx ls | |
2463 |
|
2464 | |||
2464 | 2) %sx differs from %sc in that %sx automatically splits into a list, |
|
2465 | 2) %sx differs from %sc in that %sx automatically splits into a list, | |
2465 | like '%sc -l'. The reason for this is to make it as easy as possible |
|
2466 | like '%sc -l'. The reason for this is to make it as easy as possible | |
2466 | to process line-oriented shell output via further python commands. |
|
2467 | to process line-oriented shell output via further python commands. | |
2467 | %sc is meant to provide much finer control, but requires more |
|
2468 | %sc is meant to provide much finer control, but requires more | |
2468 | typing. |
|
2469 | typing. | |
2469 |
|
2470 | |||
2470 | 3) Just like %sc -l, this is a list with special attributes: |
|
2471 | 3) Just like %sc -l, this is a list with special attributes: | |
2471 |
|
2472 | |||
2472 | .l (or .list) : value as list. |
|
2473 | .l (or .list) : value as list. | |
2473 | .n (or .nlstr): value as newline-separated string. |
|
2474 | .n (or .nlstr): value as newline-separated string. | |
2474 | .s (or .spstr): value as whitespace-separated string. |
|
2475 | .s (or .spstr): value as whitespace-separated string. | |
2475 |
|
2476 | |||
2476 | This is very useful when trying to use such lists as arguments to |
|
2477 | This is very useful when trying to use such lists as arguments to | |
2477 | system commands.""" |
|
2478 | system commands.""" | |
2478 |
|
2479 | |||
2479 | if parameter_s: |
|
2480 | if parameter_s: | |
2480 | out,err = self.shell.getoutputerror(parameter_s) |
|
2481 | out,err = self.shell.getoutputerror(parameter_s) | |
2481 | if err: |
|
2482 | if err: | |
2482 | print >> Term.cerr,err |
|
2483 | print >> Term.cerr,err | |
2483 | return SList(out.split('\n')) |
|
2484 | return SList(out.split('\n')) | |
2484 |
|
2485 | |||
2485 | def magic_bg(self, parameter_s=''): |
|
2486 | def magic_bg(self, parameter_s=''): | |
2486 | """Run a job in the background, in a separate thread. |
|
2487 | """Run a job in the background, in a separate thread. | |
2487 |
|
2488 | |||
2488 | For example, |
|
2489 | For example, | |
2489 |
|
2490 | |||
2490 | %bg myfunc(x,y,z=1) |
|
2491 | %bg myfunc(x,y,z=1) | |
2491 |
|
2492 | |||
2492 | will execute 'myfunc(x,y,z=1)' in a background thread. As soon as the |
|
2493 | will execute 'myfunc(x,y,z=1)' in a background thread. As soon as the | |
2493 | execution starts, a message will be printed indicating the job |
|
2494 | execution starts, a message will be printed indicating the job | |
2494 | number. If your job number is 5, you can use |
|
2495 | number. If your job number is 5, you can use | |
2495 |
|
2496 | |||
2496 | myvar = jobs.result(5) or myvar = jobs[5].result |
|
2497 | myvar = jobs.result(5) or myvar = jobs[5].result | |
2497 |
|
2498 | |||
2498 | to assign this result to variable 'myvar'. |
|
2499 | to assign this result to variable 'myvar'. | |
2499 |
|
2500 | |||
2500 | IPython has a job manager, accessible via the 'jobs' object. You can |
|
2501 | IPython has a job manager, accessible via the 'jobs' object. You can | |
2501 | type jobs? to get more information about it, and use jobs.<TAB> to see |
|
2502 | type jobs? to get more information about it, and use jobs.<TAB> to see | |
2502 | its attributes. All attributes not starting with an underscore are |
|
2503 | its attributes. All attributes not starting with an underscore are | |
2503 | meant for public use. |
|
2504 | meant for public use. | |
2504 |
|
2505 | |||
2505 | In particular, look at the jobs.new() method, which is used to create |
|
2506 | In particular, look at the jobs.new() method, which is used to create | |
2506 | new jobs. This magic %bg function is just a convenience wrapper |
|
2507 | new jobs. This magic %bg function is just a convenience wrapper | |
2507 | around jobs.new(), for expression-based jobs. If you want to create a |
|
2508 | around jobs.new(), for expression-based jobs. If you want to create a | |
2508 | new job with an explicit function object and arguments, you must call |
|
2509 | new job with an explicit function object and arguments, you must call | |
2509 | jobs.new() directly. |
|
2510 | jobs.new() directly. | |
2510 |
|
2511 | |||
2511 | The jobs.new docstring also describes in detail several important |
|
2512 | The jobs.new docstring also describes in detail several important | |
2512 | caveats associated with a thread-based model for background job |
|
2513 | caveats associated with a thread-based model for background job | |
2513 | execution. Type jobs.new? for details. |
|
2514 | execution. Type jobs.new? for details. | |
2514 |
|
2515 | |||
2515 | You can check the status of all jobs with jobs.status(). |
|
2516 | You can check the status of all jobs with jobs.status(). | |
2516 |
|
2517 | |||
2517 | The jobs variable is set by IPython into the Python builtin namespace. |
|
2518 | The jobs variable is set by IPython into the Python builtin namespace. | |
2518 | If you ever declare a variable named 'jobs', you will shadow this |
|
2519 | If you ever declare a variable named 'jobs', you will shadow this | |
2519 | name. You can either delete your global jobs variable to regain |
|
2520 | name. You can either delete your global jobs variable to regain | |
2520 | access to the job manager, or make a new name and assign it manually |
|
2521 | access to the job manager, or make a new name and assign it manually | |
2521 | to the manager (stored in IPython's namespace). For example, to |
|
2522 | to the manager (stored in IPython's namespace). For example, to | |
2522 | assign the job manager to the Jobs name, use: |
|
2523 | assign the job manager to the Jobs name, use: | |
2523 |
|
2524 | |||
2524 | Jobs = __builtins__.jobs""" |
|
2525 | Jobs = __builtins__.jobs""" | |
2525 |
|
2526 | |||
2526 | self.shell.jobs.new(parameter_s,self.shell.user_ns) |
|
2527 | self.shell.jobs.new(parameter_s,self.shell.user_ns) | |
2527 |
|
2528 | |||
|
2529 | def magic_store(self, parameter_s=''): | |||
|
2530 | """Lightweight persistence for ipython variables | |||
|
2531 | ||||
|
2532 | Example: | |||
|
2533 | ||||
|
2534 | ville@badger[~]|1> A = ['hello',10,'world'] | |||
|
2535 | ville@badger[~]|2> %store A | |||
|
2536 | ville@badger[~]|3> Exit | |||
|
2537 | ||||
|
2538 | (IPython session is closed and started again...) | |||
|
2539 | ||||
|
2540 | ville@badger:~$ ipython -p pysh | |||
|
2541 | ville@badger[~]|1> print A | |||
|
2542 | ||||
|
2543 | ['hello', 10, 'world'] | |||
|
2544 | ||||
|
2545 | Usage: | |||
|
2546 | ||||
|
2547 | %store - Show list of all variables and their current values\\ | |||
|
2548 | %store <var> - Store the *current* value of the variable to disk\\ | |||
|
2549 | %store -d - Remove the variable and its value from storage\\ | |||
|
2550 | %store -r - Remove all variables from storage | |||
|
2551 | ||||
|
2552 | It should be noted that if you change the value of a variable, you | |||
|
2553 | need to %store it again if you want to persist the new value. | |||
|
2554 | ||||
|
2555 | Note also that the variables will need to be pickleable; most basic | |||
|
2556 | python types can be safely %stored. | |||
|
2557 | """ | |||
|
2558 | ||||
|
2559 | opts,args = self.parse_options(parameter_s,'dr',mode='list') | |||
|
2560 | # delete | |||
|
2561 | if opts.has_key('d'): | |||
|
2562 | try: | |||
|
2563 | todel = args[0] | |||
|
2564 | except IndexError: | |||
|
2565 | error('You must provide the variable to forget') | |||
|
2566 | else: | |||
|
2567 | try: | |||
|
2568 | del self.shell.persist['S:' + todel] | |||
|
2569 | except: | |||
|
2570 | error("Can't delete variable '%s'" % todel) | |||
|
2571 | # reset | |||
|
2572 | elif opts.has_key('r'): | |||
|
2573 | for k in self.shell.persist.keys(): | |||
|
2574 | if k.startswith('S:'): | |||
|
2575 | del self.shell.persist[k] | |||
|
2576 | ||||
|
2577 | # run without arguments -> list variables & values | |||
|
2578 | elif not args: | |||
|
2579 | vars = [v[2:] for v in self.shell.persist.keys() if v.startswith('S:')] | |||
|
2580 | vars.sort() | |||
|
2581 | if vars: | |||
|
2582 | size = max(map(len,vars)) | |||
|
2583 | else: | |||
|
2584 | size = 0 | |||
|
2585 | ||||
|
2586 | fmt = '%-'+str(size)+'s -> %s' | |||
|
2587 | print 'Stored variables and their in-memory values:' | |||
|
2588 | for var in vars: | |||
|
2589 | # print 30 first characters from every var | |||
|
2590 | print fmt % (var,repr(self.shell.user_ns.get(var, '<unavailable>'))[:50]) | |||
|
2591 | ||||
|
2592 | # default action - store the variable | |||
|
2593 | else: | |||
|
2594 | pickled = pickle.dumps(self.shell.user_ns[args[0] ]) | |||
|
2595 | self.shell.persist[ 'S:' + args[0] ] = pickled | |||
|
2596 | print "Stored '%s' (%d bytes)" % (args[0], len(pickled)) | |||
|
2597 | ||||
|
2598 | ||||
|
2599 | ||||
|
2600 | ||||
|
2601 | ||||
|
2602 | ||||
2528 | def magic_bookmark(self, parameter_s=''): |
|
2603 | def magic_bookmark(self, parameter_s=''): | |
2529 | """Manage IPython's bookmark system. |
|
2604 | """Manage IPython's bookmark system. | |
2530 |
|
2605 | |||
2531 | %bookmark <name> - set bookmark to current dir |
|
2606 | %bookmark <name> - set bookmark to current dir | |
2532 | %bookmark <name> <dir> - set bookmark to <dir> |
|
2607 | %bookmark <name> <dir> - set bookmark to <dir> | |
2533 | %bookmark -l - list all bookmarks |
|
2608 | %bookmark -l - list all bookmarks | |
2534 | %bookmark -d <name> - remove bookmark |
|
2609 | %bookmark -d <name> - remove bookmark | |
2535 | %bookmark -r - remove all bookmarks |
|
2610 | %bookmark -r - remove all bookmarks | |
2536 |
|
2611 | |||
2537 | You can later on access a bookmarked folder with: |
|
2612 | You can later on access a bookmarked folder with: | |
2538 | %cd -b <name> |
|
2613 | %cd -b <name> | |
2539 | or simply '%cd <name>' if there is no directory called <name> AND |
|
2614 | or simply '%cd <name>' if there is no directory called <name> AND | |
2540 | there is such a bookmark defined. |
|
2615 | there is such a bookmark defined. | |
2541 |
|
2616 | |||
2542 | Your bookmarks persist through IPython sessions, but they are |
|
2617 | Your bookmarks persist through IPython sessions, but they are | |
2543 | associated with each profile.""" |
|
2618 | associated with each profile.""" | |
2544 |
|
2619 | |||
2545 | opts,args = self.parse_options(parameter_s,'drl',mode='list') |
|
2620 | opts,args = self.parse_options(parameter_s,'drl',mode='list') | |
2546 | if len(args) > 2: |
|
2621 | if len(args) > 2: | |
2547 | error('You can only give at most two arguments') |
|
2622 | error('You can only give at most two arguments') | |
2548 | return |
|
2623 | return | |
2549 |
|
2624 | |||
2550 | bkms = self.shell.persist.get('bookmarks',{}) |
|
2625 | bkms = self.shell.persist.get('bookmarks',{}) | |
2551 |
|
2626 | |||
2552 | if opts.has_key('d'): |
|
2627 | if opts.has_key('d'): | |
2553 | try: |
|
2628 | try: | |
2554 | todel = args[0] |
|
2629 | todel = args[0] | |
2555 | except IndexError: |
|
2630 | except IndexError: | |
2556 | error('You must provide a bookmark to delete') |
|
2631 | error('You must provide a bookmark to delete') | |
2557 | else: |
|
2632 | else: | |
2558 | try: |
|
2633 | try: | |
2559 | del bkms[todel] |
|
2634 | del bkms[todel] | |
2560 | except: |
|
2635 | except: | |
2561 | error("Can't delete bookmark '%s'" % todel) |
|
2636 | error("Can't delete bookmark '%s'" % todel) | |
2562 | elif opts.has_key('r'): |
|
2637 | elif opts.has_key('r'): | |
2563 | bkms = {} |
|
2638 | bkms = {} | |
2564 | elif opts.has_key('l'): |
|
2639 | elif opts.has_key('l'): | |
2565 | bks = bkms.keys() |
|
2640 | bks = bkms.keys() | |
2566 | bks.sort() |
|
2641 | bks.sort() | |
2567 | if bks: |
|
2642 | if bks: | |
2568 | size = max(map(len,bks)) |
|
2643 | size = max(map(len,bks)) | |
2569 | else: |
|
2644 | else: | |
2570 | size = 0 |
|
2645 | size = 0 | |
2571 | fmt = '%-'+str(size)+'s -> %s' |
|
2646 | fmt = '%-'+str(size)+'s -> %s' | |
2572 | print 'Current bookmarks:' |
|
2647 | print 'Current bookmarks:' | |
2573 | for bk in bks: |
|
2648 | for bk in bks: | |
2574 | print fmt % (bk,bkms[bk]) |
|
2649 | print fmt % (bk,bkms[bk]) | |
2575 | else: |
|
2650 | else: | |
2576 | if not args: |
|
2651 | if not args: | |
2577 | error("You must specify the bookmark name") |
|
2652 | error("You must specify the bookmark name") | |
2578 | elif len(args)==1: |
|
2653 | elif len(args)==1: | |
2579 | bkms[args[0]] = os.getcwd() |
|
2654 | bkms[args[0]] = os.getcwd() | |
2580 | elif len(args)==2: |
|
2655 | elif len(args)==2: | |
2581 | bkms[args[0]] = args[1] |
|
2656 | bkms[args[0]] = args[1] | |
2582 | self.shell.persist['bookmarks'] = bkms |
|
2657 | self.shell.persist['bookmarks'] = bkms | |
2583 |
|
2658 | |||
2584 | def magic_pycat(self, parameter_s=''): |
|
2659 | def magic_pycat(self, parameter_s=''): | |
2585 | """Show a syntax-highlighted file through a pager. |
|
2660 | """Show a syntax-highlighted file through a pager. | |
2586 |
|
2661 | |||
2587 | This magic is similar to the cat utility, but it will assume the file |
|
2662 | This magic is similar to the cat utility, but it will assume the file | |
2588 | to be Python source and will show it with syntax highlighting. """ |
|
2663 | to be Python source and will show it with syntax highlighting. """ | |
2589 |
|
2664 | |||
2590 | filename = get_py_filename(parameter_s) |
|
2665 | filename = get_py_filename(parameter_s) | |
2591 | page(self.shell.colorize(file_read(filename)), |
|
2666 | page(self.shell.colorize(file_read(filename)), | |
2592 | screen_lines=self.shell.rc.screen_length) |
|
2667 | screen_lines=self.shell.rc.screen_length) | |
2593 |
|
2668 | |||
2594 | # end Magic |
|
2669 | # end Magic |
@@ -1,2035 +1,2051 b'' | |||||
1 | # -*- coding: utf-8 -*- |
|
1 | # -*- coding: utf-8 -*- | |
2 | """ |
|
2 | """ | |
3 | IPython -- An enhanced Interactive Python |
|
3 | IPython -- An enhanced Interactive Python | |
4 |
|
4 | |||
5 | Requires Python 2.1 or newer. |
|
5 | Requires Python 2.1 or newer. | |
6 |
|
6 | |||
7 | This file contains all the classes and helper functions specific to IPython. |
|
7 | This file contains all the classes and helper functions specific to IPython. | |
8 |
|
8 | |||
9 |
$Id: iplib.py 96 |
|
9 | $Id: iplib.py 968 2005-12-29 17:15:38Z fperez $ | |
10 | """ |
|
10 | """ | |
11 |
|
11 | |||
12 | #***************************************************************************** |
|
12 | #***************************************************************************** | |
13 | # Copyright (C) 2001 Janko Hauser <jhauser@zscout.de> and |
|
13 | # Copyright (C) 2001 Janko Hauser <jhauser@zscout.de> and | |
14 | # Copyright (C) 2001-2005 Fernando Perez. <fperez@colorado.edu> |
|
14 | # Copyright (C) 2001-2005 Fernando Perez. <fperez@colorado.edu> | |
15 | # |
|
15 | # | |
16 | # Distributed under the terms of the BSD License. The full license is in |
|
16 | # Distributed under the terms of the BSD License. The full license is in | |
17 | # the file COPYING, distributed as part of this software. |
|
17 | # the file COPYING, distributed as part of this software. | |
18 | # |
|
18 | # | |
19 | # Note: this code originally subclassed code.InteractiveConsole from the |
|
19 | # Note: this code originally subclassed code.InteractiveConsole from the | |
20 | # Python standard library. Over time, all of that class has been copied |
|
20 | # Python standard library. Over time, all of that class has been copied | |
21 | # verbatim here for modifications which could not be accomplished by |
|
21 | # verbatim here for modifications which could not be accomplished by | |
22 | # subclassing. At this point, there are no dependencies at all on the code |
|
22 | # subclassing. At this point, there are no dependencies at all on the code | |
23 | # module anymore (it is not even imported). The Python License (sec. 2) |
|
23 | # module anymore (it is not even imported). The Python License (sec. 2) | |
24 | # allows for this, but it's always nice to acknowledge credit where credit is |
|
24 | # allows for this, but it's always nice to acknowledge credit where credit is | |
25 | # due. |
|
25 | # due. | |
26 | #***************************************************************************** |
|
26 | #***************************************************************************** | |
27 |
|
27 | |||
28 | #**************************************************************************** |
|
28 | #**************************************************************************** | |
29 | # Modules and globals |
|
29 | # Modules and globals | |
30 |
|
30 | |||
31 | from __future__ import generators # for 2.2 backwards-compatibility |
|
31 | from __future__ import generators # for 2.2 backwards-compatibility | |
32 |
|
32 | |||
33 | from IPython import Release |
|
33 | from IPython import Release | |
34 | __author__ = '%s <%s>\n%s <%s>' % \ |
|
34 | __author__ = '%s <%s>\n%s <%s>' % \ | |
35 | ( Release.authors['Janko'] + Release.authors['Fernando'] ) |
|
35 | ( Release.authors['Janko'] + Release.authors['Fernando'] ) | |
36 | __license__ = Release.license |
|
36 | __license__ = Release.license | |
37 | __version__ = Release.version |
|
37 | __version__ = Release.version | |
38 |
|
38 | |||
39 | # Python standard modules |
|
39 | # Python standard modules | |
40 | import __main__ |
|
40 | import __main__ | |
41 | import __builtin__ |
|
41 | import __builtin__ | |
42 | import StringIO |
|
42 | import StringIO | |
43 | import bdb |
|
43 | import bdb | |
44 | import cPickle as pickle |
|
44 | import cPickle as pickle | |
45 | import codeop |
|
45 | import codeop | |
46 | import exceptions |
|
46 | import exceptions | |
47 | import glob |
|
47 | import glob | |
48 | import inspect |
|
48 | import inspect | |
49 | import keyword |
|
49 | import keyword | |
50 | import new |
|
50 | import new | |
51 | import os |
|
51 | import os | |
52 | import pdb |
|
52 | import pdb | |
53 | import pydoc |
|
53 | import pydoc | |
54 | import re |
|
54 | import re | |
55 | import shutil |
|
55 | import shutil | |
56 | import string |
|
56 | import string | |
57 | import sys |
|
57 | import sys | |
58 | import traceback |
|
58 | import traceback | |
59 | import types |
|
59 | import types | |
60 |
|
60 | |||
61 | from pprint import pprint, pformat |
|
61 | from pprint import pprint, pformat | |
62 |
|
62 | |||
63 | # IPython's own modules |
|
63 | # IPython's own modules | |
64 | import IPython |
|
64 | import IPython | |
65 | from IPython import OInspect,PyColorize,ultraTB |
|
65 | from IPython import OInspect,PyColorize,ultraTB | |
66 | from IPython.ColorANSI import ColorScheme,ColorSchemeTable # too long names |
|
66 | from IPython.ColorANSI import ColorScheme,ColorSchemeTable # too long names | |
67 | from IPython.FakeModule import FakeModule |
|
67 | from IPython.FakeModule import FakeModule | |
68 | from IPython.Itpl import Itpl,itpl,printpl,ItplNS,itplns |
|
68 | from IPython.Itpl import Itpl,itpl,printpl,ItplNS,itplns | |
69 | from IPython.Logger import Logger |
|
69 | from IPython.Logger import Logger | |
70 | from IPython.Magic import Magic |
|
70 | from IPython.Magic import Magic | |
71 | from IPython.Prompts import CachedOutput |
|
71 | from IPython.Prompts import CachedOutput | |
72 | from IPython.Struct import Struct |
|
72 | from IPython.Struct import Struct | |
73 | from IPython.background_jobs import BackgroundJobManager |
|
73 | from IPython.background_jobs import BackgroundJobManager | |
74 | from IPython.usage import cmd_line_usage,interactive_usage |
|
74 | from IPython.usage import cmd_line_usage,interactive_usage | |
75 | from IPython.genutils import * |
|
75 | from IPython.genutils import * | |
76 |
|
76 | |||
77 | # store the builtin raw_input globally, and use this always, in case user code |
|
77 | # store the builtin raw_input globally, and use this always, in case user code | |
78 | # overwrites it (like wx.py.PyShell does) |
|
78 | # overwrites it (like wx.py.PyShell does) | |
79 | raw_input_original = raw_input |
|
79 | raw_input_original = raw_input | |
80 |
|
80 | |||
81 | #**************************************************************************** |
|
81 | #**************************************************************************** | |
82 | # Some utility function definitions |
|
82 | # Some utility function definitions | |
83 |
|
83 | |||
84 | def softspace(file, newvalue): |
|
84 | def softspace(file, newvalue): | |
85 | """Copied from code.py, to remove the dependency""" |
|
85 | """Copied from code.py, to remove the dependency""" | |
86 | oldvalue = 0 |
|
86 | oldvalue = 0 | |
87 | try: |
|
87 | try: | |
88 | oldvalue = file.softspace |
|
88 | oldvalue = file.softspace | |
89 | except AttributeError: |
|
89 | except AttributeError: | |
90 | pass |
|
90 | pass | |
91 | try: |
|
91 | try: | |
92 | file.softspace = newvalue |
|
92 | file.softspace = newvalue | |
93 | except (AttributeError, TypeError): |
|
93 | except (AttributeError, TypeError): | |
94 | # "attribute-less object" or "read-only attributes" |
|
94 | # "attribute-less object" or "read-only attributes" | |
95 | pass |
|
95 | pass | |
96 | return oldvalue |
|
96 | return oldvalue | |
97 |
|
97 | |||
98 | #**************************************************************************** |
|
98 | #**************************************************************************** | |
99 | # These special functions get installed in the builtin namespace, to provide |
|
99 | # These special functions get installed in the builtin namespace, to provide | |
100 | # programmatic (pure python) access to magics and aliases. This is important |
|
100 | # programmatic (pure python) access to magics and aliases. This is important | |
101 | # for logging, user scripting, and more. |
|
101 | # for logging, user scripting, and more. | |
102 |
|
102 | |||
103 | def ipmagic(arg_s): |
|
103 | def ipmagic(arg_s): | |
104 | """Call a magic function by name. |
|
104 | """Call a magic function by name. | |
105 |
|
105 | |||
106 | Input: a string containing the name of the magic function to call and any |
|
106 | Input: a string containing the name of the magic function to call and any | |
107 | additional arguments to be passed to the magic. |
|
107 | additional arguments to be passed to the magic. | |
108 |
|
108 | |||
109 | ipmagic('name -opt foo bar') is equivalent to typing at the ipython |
|
109 | ipmagic('name -opt foo bar') is equivalent to typing at the ipython | |
110 | prompt: |
|
110 | prompt: | |
111 |
|
111 | |||
112 | In[1]: %name -opt foo bar |
|
112 | In[1]: %name -opt foo bar | |
113 |
|
113 | |||
114 | To call a magic without arguments, simply use ipmagic('name'). |
|
114 | To call a magic without arguments, simply use ipmagic('name'). | |
115 |
|
115 | |||
116 | This provides a proper Python function to call IPython's magics in any |
|
116 | This provides a proper Python function to call IPython's magics in any | |
117 | valid Python code you can type at the interpreter, including loops and |
|
117 | valid Python code you can type at the interpreter, including loops and | |
118 | compound statements. It is added by IPython to the Python builtin |
|
118 | compound statements. It is added by IPython to the Python builtin | |
119 | namespace upon initialization.""" |
|
119 | namespace upon initialization.""" | |
120 |
|
120 | |||
121 | args = arg_s.split(' ',1) |
|
121 | args = arg_s.split(' ',1) | |
122 | magic_name = args[0] |
|
122 | magic_name = args[0] | |
123 | if magic_name.startswith(__IPYTHON__.ESC_MAGIC): |
|
123 | if magic_name.startswith(__IPYTHON__.ESC_MAGIC): | |
124 | magic_name = magic_name[1:] |
|
124 | magic_name = magic_name[1:] | |
125 | try: |
|
125 | try: | |
126 | magic_args = args[1] |
|
126 | magic_args = args[1] | |
127 | except IndexError: |
|
127 | except IndexError: | |
128 | magic_args = '' |
|
128 | magic_args = '' | |
129 | fn = getattr(__IPYTHON__,'magic_'+magic_name,None) |
|
129 | fn = getattr(__IPYTHON__,'magic_'+magic_name,None) | |
130 | if fn is None: |
|
130 | if fn is None: | |
131 | error("Magic function `%s` not found." % magic_name) |
|
131 | error("Magic function `%s` not found." % magic_name) | |
132 | else: |
|
132 | else: | |
133 | magic_args = __IPYTHON__.var_expand(magic_args) |
|
133 | magic_args = __IPYTHON__.var_expand(magic_args) | |
134 | return fn(magic_args) |
|
134 | return fn(magic_args) | |
135 |
|
135 | |||
136 | def ipalias(arg_s): |
|
136 | def ipalias(arg_s): | |
137 | """Call an alias by name. |
|
137 | """Call an alias by name. | |
138 |
|
138 | |||
139 | Input: a string containing the name of the alias to call and any |
|
139 | Input: a string containing the name of the alias to call and any | |
140 | additional arguments to be passed to the magic. |
|
140 | additional arguments to be passed to the magic. | |
141 |
|
141 | |||
142 | ipalias('name -opt foo bar') is equivalent to typing at the ipython |
|
142 | ipalias('name -opt foo bar') is equivalent to typing at the ipython | |
143 | prompt: |
|
143 | prompt: | |
144 |
|
144 | |||
145 | In[1]: name -opt foo bar |
|
145 | In[1]: name -opt foo bar | |
146 |
|
146 | |||
147 | To call an alias without arguments, simply use ipalias('name'). |
|
147 | To call an alias without arguments, simply use ipalias('name'). | |
148 |
|
148 | |||
149 | This provides a proper Python function to call IPython's aliases in any |
|
149 | This provides a proper Python function to call IPython's aliases in any | |
150 | valid Python code you can type at the interpreter, including loops and |
|
150 | valid Python code you can type at the interpreter, including loops and | |
151 | compound statements. It is added by IPython to the Python builtin |
|
151 | compound statements. It is added by IPython to the Python builtin | |
152 | namespace upon initialization.""" |
|
152 | namespace upon initialization.""" | |
153 |
|
153 | |||
154 | args = arg_s.split(' ',1) |
|
154 | args = arg_s.split(' ',1) | |
155 | alias_name = args[0] |
|
155 | alias_name = args[0] | |
156 | try: |
|
156 | try: | |
157 | alias_args = args[1] |
|
157 | alias_args = args[1] | |
158 | except IndexError: |
|
158 | except IndexError: | |
159 | alias_args = '' |
|
159 | alias_args = '' | |
160 | if alias_name in __IPYTHON__.alias_table: |
|
160 | if alias_name in __IPYTHON__.alias_table: | |
161 | __IPYTHON__.call_alias(alias_name,alias_args) |
|
161 | __IPYTHON__.call_alias(alias_name,alias_args) | |
162 | else: |
|
162 | else: | |
163 | error("Alias `%s` not found." % alias_name) |
|
163 | error("Alias `%s` not found." % alias_name) | |
164 |
|
164 | |||
165 | #**************************************************************************** |
|
165 | #**************************************************************************** | |
166 | # Local use exceptions |
|
166 | # Local use exceptions | |
167 | class SpaceInInput(exceptions.Exception): pass |
|
167 | class SpaceInInput(exceptions.Exception): pass | |
168 |
|
168 | |||
169 | #**************************************************************************** |
|
169 | #**************************************************************************** | |
170 | # Local use classes |
|
170 | # Local use classes | |
171 | class Bunch: pass |
|
171 | class Bunch: pass | |
172 |
|
172 | |||
173 | class InputList(list): |
|
173 | class InputList(list): | |
174 | """Class to store user input. |
|
174 | """Class to store user input. | |
175 |
|
175 | |||
176 | It's basically a list, but slices return a string instead of a list, thus |
|
176 | It's basically a list, but slices return a string instead of a list, thus | |
177 | allowing things like (assuming 'In' is an instance): |
|
177 | allowing things like (assuming 'In' is an instance): | |
178 |
|
178 | |||
179 | exec In[4:7] |
|
179 | exec In[4:7] | |
180 |
|
180 | |||
181 | or |
|
181 | or | |
182 |
|
182 | |||
183 | exec In[5:9] + In[14] + In[21:25]""" |
|
183 | exec In[5:9] + In[14] + In[21:25]""" | |
184 |
|
184 | |||
185 | def __getslice__(self,i,j): |
|
185 | def __getslice__(self,i,j): | |
186 | return ''.join(list.__getslice__(self,i,j)) |
|
186 | return ''.join(list.__getslice__(self,i,j)) | |
187 |
|
187 | |||
188 | class SyntaxTB(ultraTB.ListTB): |
|
188 | class SyntaxTB(ultraTB.ListTB): | |
189 | """Extension which holds some state: the last exception value""" |
|
189 | """Extension which holds some state: the last exception value""" | |
190 |
|
190 | |||
191 | def __init__(self,color_scheme = 'NoColor'): |
|
191 | def __init__(self,color_scheme = 'NoColor'): | |
192 | ultraTB.ListTB.__init__(self,color_scheme) |
|
192 | ultraTB.ListTB.__init__(self,color_scheme) | |
193 | self.last_syntax_error = None |
|
193 | self.last_syntax_error = None | |
194 |
|
194 | |||
195 | def __call__(self, etype, value, elist): |
|
195 | def __call__(self, etype, value, elist): | |
196 | self.last_syntax_error = value |
|
196 | self.last_syntax_error = value | |
197 | ultraTB.ListTB.__call__(self,etype,value,elist) |
|
197 | ultraTB.ListTB.__call__(self,etype,value,elist) | |
198 |
|
198 | |||
199 | def clear_err_state(self): |
|
199 | def clear_err_state(self): | |
200 | """Return the current error state and clear it""" |
|
200 | """Return the current error state and clear it""" | |
201 | e = self.last_syntax_error |
|
201 | e = self.last_syntax_error | |
202 | self.last_syntax_error = None |
|
202 | self.last_syntax_error = None | |
203 | return e |
|
203 | return e | |
204 |
|
204 | |||
205 | #**************************************************************************** |
|
205 | #**************************************************************************** | |
206 | # Main IPython class |
|
206 | # Main IPython class | |
207 |
|
207 | |||
208 | # FIXME: the Magic class is a mixin for now, and will unfortunately remain so |
|
208 | # FIXME: the Magic class is a mixin for now, and will unfortunately remain so | |
209 | # until a full rewrite is made. I've cleaned all cross-class uses of |
|
209 | # until a full rewrite is made. I've cleaned all cross-class uses of | |
210 | # attributes and methods, but too much user code out there relies on the |
|
210 | # attributes and methods, but too much user code out there relies on the | |
211 | # equlity %foo == __IP.magic_foo, so I can't actually remove the mixin usage. |
|
211 | # equlity %foo == __IP.magic_foo, so I can't actually remove the mixin usage. | |
212 | # |
|
212 | # | |
213 | # But at least now, all the pieces have been separated and we could, in |
|
213 | # But at least now, all the pieces have been separated and we could, in | |
214 | # principle, stop using the mixin. This will ease the transition to the |
|
214 | # principle, stop using the mixin. This will ease the transition to the | |
215 | # chainsaw branch. |
|
215 | # chainsaw branch. | |
216 |
|
216 | |||
217 | # For reference, the following is the list of 'self.foo' uses in the Magic |
|
217 | # For reference, the following is the list of 'self.foo' uses in the Magic | |
218 | # class as of 2005-12-28. These are names we CAN'T use in the main ipython |
|
218 | # class as of 2005-12-28. These are names we CAN'T use in the main ipython | |
219 | # class, to prevent clashes. |
|
219 | # class, to prevent clashes. | |
220 |
|
220 | |||
221 | # ['self.__class__', 'self.__dict__', 'self._inspect', 'self._ofind', |
|
221 | # ['self.__class__', 'self.__dict__', 'self._inspect', 'self._ofind', | |
222 | # 'self.arg_err', 'self.extract_input', 'self.format_', 'self.lsmagic', |
|
222 | # 'self.arg_err', 'self.extract_input', 'self.format_', 'self.lsmagic', | |
223 | # 'self.magic_', 'self.options_table', 'self.parse', 'self.shell', |
|
223 | # 'self.magic_', 'self.options_table', 'self.parse', 'self.shell', | |
224 | # 'self.value'] |
|
224 | # 'self.value'] | |
225 |
|
225 | |||
226 | class InteractiveShell(Magic): |
|
226 | class InteractiveShell(Magic): | |
227 | """An enhanced console for Python.""" |
|
227 | """An enhanced console for Python.""" | |
228 |
|
228 | |||
229 | # class attribute to indicate whether the class supports threads or not. |
|
229 | # class attribute to indicate whether the class supports threads or not. | |
230 | # Subclasses with thread support should override this as needed. |
|
230 | # Subclasses with thread support should override this as needed. | |
231 | isthreaded = False |
|
231 | isthreaded = False | |
232 |
|
232 | |||
233 | def __init__(self,name,usage=None,rc=Struct(opts=None,args=None), |
|
233 | def __init__(self,name,usage=None,rc=Struct(opts=None,args=None), | |
234 | user_ns = None,user_global_ns=None,banner2='', |
|
234 | user_ns = None,user_global_ns=None,banner2='', | |
235 | custom_exceptions=((),None),embedded=False): |
|
235 | custom_exceptions=((),None),embedded=False): | |
236 |
|
236 | |||
237 | # some minimal strict typechecks. For some core data structures, I |
|
237 | # some minimal strict typechecks. For some core data structures, I | |
238 | # want actual basic python types, not just anything that looks like |
|
238 | # want actual basic python types, not just anything that looks like | |
239 | # one. This is especially true for namespaces. |
|
239 | # one. This is especially true for namespaces. | |
240 | for ns in (user_ns,user_global_ns): |
|
240 | for ns in (user_ns,user_global_ns): | |
241 | if ns is not None and type(ns) != types.DictType: |
|
241 | if ns is not None and type(ns) != types.DictType: | |
242 | raise TypeError,'namespace must be a dictionary' |
|
242 | raise TypeError,'namespace must be a dictionary' | |
243 |
|
243 | |||
244 | # Put a reference to self in builtins so that any form of embedded or |
|
244 | # Put a reference to self in builtins so that any form of embedded or | |
245 | # imported code can test for being inside IPython. |
|
245 | # imported code can test for being inside IPython. | |
246 | __builtin__.__IPYTHON__ = self |
|
246 | __builtin__.__IPYTHON__ = self | |
247 |
|
247 | |||
248 | # And load into builtins ipmagic/ipalias as well |
|
248 | # And load into builtins ipmagic/ipalias as well | |
249 | __builtin__.ipmagic = ipmagic |
|
249 | __builtin__.ipmagic = ipmagic | |
250 | __builtin__.ipalias = ipalias |
|
250 | __builtin__.ipalias = ipalias | |
251 |
|
251 | |||
252 | # Add to __builtin__ other parts of IPython's public API |
|
252 | # Add to __builtin__ other parts of IPython's public API | |
253 | __builtin__.ip_set_hook = self.set_hook |
|
253 | __builtin__.ip_set_hook = self.set_hook | |
254 |
|
254 | |||
255 | # Keep in the builtins a flag for when IPython is active. We set it |
|
255 | # Keep in the builtins a flag for when IPython is active. We set it | |
256 | # with setdefault so that multiple nested IPythons don't clobber one |
|
256 | # with setdefault so that multiple nested IPythons don't clobber one | |
257 | # another. Each will increase its value by one upon being activated, |
|
257 | # another. Each will increase its value by one upon being activated, | |
258 | # which also gives us a way to determine the nesting level. |
|
258 | # which also gives us a way to determine the nesting level. | |
259 | __builtin__.__dict__.setdefault('__IPYTHON__active',0) |
|
259 | __builtin__.__dict__.setdefault('__IPYTHON__active',0) | |
260 |
|
260 | |||
261 | # Do the intuitively correct thing for quit/exit: we remove the |
|
261 | # Do the intuitively correct thing for quit/exit: we remove the | |
262 | # builtins if they exist, and our own prefilter routine will handle |
|
262 | # builtins if they exist, and our own prefilter routine will handle | |
263 | # these special cases |
|
263 | # these special cases | |
264 | try: |
|
264 | try: | |
265 | del __builtin__.exit, __builtin__.quit |
|
265 | del __builtin__.exit, __builtin__.quit | |
266 | except AttributeError: |
|
266 | except AttributeError: | |
267 | pass |
|
267 | pass | |
268 |
|
268 | |||
269 | # Store the actual shell's name |
|
269 | # Store the actual shell's name | |
270 | self.name = name |
|
270 | self.name = name | |
271 |
|
271 | |||
272 | # We need to know whether the instance is meant for embedding, since |
|
272 | # We need to know whether the instance is meant for embedding, since | |
273 | # global/local namespaces need to be handled differently in that case |
|
273 | # global/local namespaces need to be handled differently in that case | |
274 | self.embedded = embedded |
|
274 | self.embedded = embedded | |
275 |
|
275 | |||
276 | # command compiler |
|
276 | # command compiler | |
277 | self.compile = codeop.CommandCompiler() |
|
277 | self.compile = codeop.CommandCompiler() | |
278 |
|
278 | |||
279 | # User input buffer |
|
279 | # User input buffer | |
280 | self.buffer = [] |
|
280 | self.buffer = [] | |
281 |
|
281 | |||
282 | # Default name given in compilation of code |
|
282 | # Default name given in compilation of code | |
283 | self.filename = '<ipython console>' |
|
283 | self.filename = '<ipython console>' | |
284 |
|
284 | |||
285 | # Create the namespace where the user will operate. user_ns is |
|
285 | # Create the namespace where the user will operate. user_ns is | |
286 | # normally the only one used, and it is passed to the exec calls as |
|
286 | # normally the only one used, and it is passed to the exec calls as | |
287 | # the locals argument. But we do carry a user_global_ns namespace |
|
287 | # the locals argument. But we do carry a user_global_ns namespace | |
288 | # given as the exec 'globals' argument, This is useful in embedding |
|
288 | # given as the exec 'globals' argument, This is useful in embedding | |
289 | # situations where the ipython shell opens in a context where the |
|
289 | # situations where the ipython shell opens in a context where the | |
290 | # distinction between locals and globals is meaningful. |
|
290 | # distinction between locals and globals is meaningful. | |
291 |
|
291 | |||
292 | # FIXME. For some strange reason, __builtins__ is showing up at user |
|
292 | # FIXME. For some strange reason, __builtins__ is showing up at user | |
293 | # level as a dict instead of a module. This is a manual fix, but I |
|
293 | # level as a dict instead of a module. This is a manual fix, but I | |
294 | # should really track down where the problem is coming from. Alex |
|
294 | # should really track down where the problem is coming from. Alex | |
295 | # Schmolck reported this problem first. |
|
295 | # Schmolck reported this problem first. | |
296 |
|
296 | |||
297 | # A useful post by Alex Martelli on this topic: |
|
297 | # A useful post by Alex Martelli on this topic: | |
298 | # Re: inconsistent value from __builtins__ |
|
298 | # Re: inconsistent value from __builtins__ | |
299 | # Von: Alex Martelli <aleaxit@yahoo.com> |
|
299 | # Von: Alex Martelli <aleaxit@yahoo.com> | |
300 | # Datum: Freitag 01 Oktober 2004 04:45:34 nachmittags/abends |
|
300 | # Datum: Freitag 01 Oktober 2004 04:45:34 nachmittags/abends | |
301 | # Gruppen: comp.lang.python |
|
301 | # Gruppen: comp.lang.python | |
302 |
|
302 | |||
303 | # Michael Hohn <hohn@hooknose.lbl.gov> wrote: |
|
303 | # Michael Hohn <hohn@hooknose.lbl.gov> wrote: | |
304 | # > >>> print type(builtin_check.get_global_binding('__builtins__')) |
|
304 | # > >>> print type(builtin_check.get_global_binding('__builtins__')) | |
305 | # > <type 'dict'> |
|
305 | # > <type 'dict'> | |
306 | # > >>> print type(__builtins__) |
|
306 | # > >>> print type(__builtins__) | |
307 | # > <type 'module'> |
|
307 | # > <type 'module'> | |
308 | # > Is this difference in return value intentional? |
|
308 | # > Is this difference in return value intentional? | |
309 |
|
309 | |||
310 | # Well, it's documented that '__builtins__' can be either a dictionary |
|
310 | # Well, it's documented that '__builtins__' can be either a dictionary | |
311 | # or a module, and it's been that way for a long time. Whether it's |
|
311 | # or a module, and it's been that way for a long time. Whether it's | |
312 | # intentional (or sensible), I don't know. In any case, the idea is |
|
312 | # intentional (or sensible), I don't know. In any case, the idea is | |
313 | # that if you need to access the built-in namespace directly, you |
|
313 | # that if you need to access the built-in namespace directly, you | |
314 | # should start with "import __builtin__" (note, no 's') which will |
|
314 | # should start with "import __builtin__" (note, no 's') which will | |
315 | # definitely give you a module. Yeah, it's somewhatΒ confusing:-(. |
|
315 | # definitely give you a module. Yeah, it's somewhatΒ confusing:-(. | |
316 |
|
316 | |||
317 | if user_ns is None: |
|
317 | if user_ns is None: | |
318 | # Set __name__ to __main__ to better match the behavior of the |
|
318 | # Set __name__ to __main__ to better match the behavior of the | |
319 | # normal interpreter. |
|
319 | # normal interpreter. | |
320 | user_ns = {'__name__' :'__main__', |
|
320 | user_ns = {'__name__' :'__main__', | |
321 | '__builtins__' : __builtin__, |
|
321 | '__builtins__' : __builtin__, | |
322 | } |
|
322 | } | |
323 |
|
323 | |||
324 | if user_global_ns is None: |
|
324 | if user_global_ns is None: | |
325 | user_global_ns = {} |
|
325 | user_global_ns = {} | |
326 |
|
326 | |||
327 | # Assign namespaces |
|
327 | # Assign namespaces | |
328 | # This is the namespace where all normal user variables live |
|
328 | # This is the namespace where all normal user variables live | |
329 | self.user_ns = user_ns |
|
329 | self.user_ns = user_ns | |
330 | # Embedded instances require a separate namespace for globals. |
|
330 | # Embedded instances require a separate namespace for globals. | |
331 | # Normally this one is unused by non-embedded instances. |
|
331 | # Normally this one is unused by non-embedded instances. | |
332 | self.user_global_ns = user_global_ns |
|
332 | self.user_global_ns = user_global_ns | |
333 | # A namespace to keep track of internal data structures to prevent |
|
333 | # A namespace to keep track of internal data structures to prevent | |
334 | # them from cluttering user-visible stuff. Will be updated later |
|
334 | # them from cluttering user-visible stuff. Will be updated later | |
335 | self.internal_ns = {} |
|
335 | self.internal_ns = {} | |
336 |
|
336 | |||
337 | # Namespace of system aliases. Each entry in the alias |
|
337 | # Namespace of system aliases. Each entry in the alias | |
338 | # table must be a 2-tuple of the form (N,name), where N is the number |
|
338 | # table must be a 2-tuple of the form (N,name), where N is the number | |
339 | # of positional arguments of the alias. |
|
339 | # of positional arguments of the alias. | |
340 | self.alias_table = {} |
|
340 | self.alias_table = {} | |
341 |
|
341 | |||
342 | # A table holding all the namespaces IPython deals with, so that |
|
342 | # A table holding all the namespaces IPython deals with, so that | |
343 | # introspection facilities can search easily. |
|
343 | # introspection facilities can search easily. | |
344 | self.ns_table = {'user':user_ns, |
|
344 | self.ns_table = {'user':user_ns, | |
345 | 'user_global':user_global_ns, |
|
345 | 'user_global':user_global_ns, | |
346 | 'alias':self.alias_table, |
|
346 | 'alias':self.alias_table, | |
347 | 'internal':self.internal_ns, |
|
347 | 'internal':self.internal_ns, | |
348 | 'builtin':__builtin__.__dict__ |
|
348 | 'builtin':__builtin__.__dict__ | |
349 | } |
|
349 | } | |
350 |
|
350 | |||
351 | # The user namespace MUST have a pointer to the shell itself. |
|
351 | # The user namespace MUST have a pointer to the shell itself. | |
352 | self.user_ns[name] = self |
|
352 | self.user_ns[name] = self | |
353 |
|
353 | |||
354 | # We need to insert into sys.modules something that looks like a |
|
354 | # We need to insert into sys.modules something that looks like a | |
355 | # module but which accesses the IPython namespace, for shelve and |
|
355 | # module but which accesses the IPython namespace, for shelve and | |
356 | # pickle to work interactively. Normally they rely on getting |
|
356 | # pickle to work interactively. Normally they rely on getting | |
357 | # everything out of __main__, but for embedding purposes each IPython |
|
357 | # everything out of __main__, but for embedding purposes each IPython | |
358 | # instance has its own private namespace, so we can't go shoving |
|
358 | # instance has its own private namespace, so we can't go shoving | |
359 | # everything into __main__. |
|
359 | # everything into __main__. | |
360 |
|
360 | |||
361 | # note, however, that we should only do this for non-embedded |
|
361 | # note, however, that we should only do this for non-embedded | |
362 | # ipythons, which really mimic the __main__.__dict__ with their own |
|
362 | # ipythons, which really mimic the __main__.__dict__ with their own | |
363 | # namespace. Embedded instances, on the other hand, should not do |
|
363 | # namespace. Embedded instances, on the other hand, should not do | |
364 | # this because they need to manage the user local/global namespaces |
|
364 | # this because they need to manage the user local/global namespaces | |
365 | # only, but they live within a 'normal' __main__ (meaning, they |
|
365 | # only, but they live within a 'normal' __main__ (meaning, they | |
366 | # shouldn't overtake the execution environment of the script they're |
|
366 | # shouldn't overtake the execution environment of the script they're | |
367 | # embedded in). |
|
367 | # embedded in). | |
368 |
|
368 | |||
369 | if not embedded: |
|
369 | if not embedded: | |
370 | try: |
|
370 | try: | |
371 | main_name = self.user_ns['__name__'] |
|
371 | main_name = self.user_ns['__name__'] | |
372 | except KeyError: |
|
372 | except KeyError: | |
373 | raise KeyError,'user_ns dictionary MUST have a "__name__" key' |
|
373 | raise KeyError,'user_ns dictionary MUST have a "__name__" key' | |
374 | else: |
|
374 | else: | |
375 | #print "pickle hack in place" # dbg |
|
375 | #print "pickle hack in place" # dbg | |
376 | sys.modules[main_name] = FakeModule(self.user_ns) |
|
376 | sys.modules[main_name] = FakeModule(self.user_ns) | |
377 |
|
377 | |||
378 | # List of input with multi-line handling. |
|
378 | # List of input with multi-line handling. | |
379 | # Fill its zero entry, user counter starts at 1 |
|
379 | # Fill its zero entry, user counter starts at 1 | |
380 | self.input_hist = InputList(['\n']) |
|
380 | self.input_hist = InputList(['\n']) | |
381 |
|
381 | |||
382 | # list of visited directories |
|
382 | # list of visited directories | |
383 | try: |
|
383 | try: | |
384 | self.dir_hist = [os.getcwd()] |
|
384 | self.dir_hist = [os.getcwd()] | |
385 | except IOError, e: |
|
385 | except IOError, e: | |
386 | self.dir_hist = [] |
|
386 | self.dir_hist = [] | |
387 |
|
387 | |||
388 | # dict of output history |
|
388 | # dict of output history | |
389 | self.output_hist = {} |
|
389 | self.output_hist = {} | |
390 |
|
390 | |||
391 | # dict of things NOT to alias (keywords, builtins and some magics) |
|
391 | # dict of things NOT to alias (keywords, builtins and some magics) | |
392 | no_alias = {} |
|
392 | no_alias = {} | |
393 | no_alias_magics = ['cd','popd','pushd','dhist','alias','unalias'] |
|
393 | no_alias_magics = ['cd','popd','pushd','dhist','alias','unalias'] | |
394 | for key in keyword.kwlist + no_alias_magics: |
|
394 | for key in keyword.kwlist + no_alias_magics: | |
395 | no_alias[key] = 1 |
|
395 | no_alias[key] = 1 | |
396 | no_alias.update(__builtin__.__dict__) |
|
396 | no_alias.update(__builtin__.__dict__) | |
397 | self.no_alias = no_alias |
|
397 | self.no_alias = no_alias | |
398 |
|
398 | |||
399 | # make global variables for user access to these |
|
399 | # make global variables for user access to these | |
400 | self.user_ns['_ih'] = self.input_hist |
|
400 | self.user_ns['_ih'] = self.input_hist | |
401 | self.user_ns['_oh'] = self.output_hist |
|
401 | self.user_ns['_oh'] = self.output_hist | |
402 | self.user_ns['_dh'] = self.dir_hist |
|
402 | self.user_ns['_dh'] = self.dir_hist | |
403 |
|
403 | |||
404 | # user aliases to input and output histories |
|
404 | # user aliases to input and output histories | |
405 | self.user_ns['In'] = self.input_hist |
|
405 | self.user_ns['In'] = self.input_hist | |
406 | self.user_ns['Out'] = self.output_hist |
|
406 | self.user_ns['Out'] = self.output_hist | |
407 |
|
407 | |||
408 | # Object variable to store code object waiting execution. This is |
|
408 | # Object variable to store code object waiting execution. This is | |
409 | # used mainly by the multithreaded shells, but it can come in handy in |
|
409 | # used mainly by the multithreaded shells, but it can come in handy in | |
410 | # other situations. No need to use a Queue here, since it's a single |
|
410 | # other situations. No need to use a Queue here, since it's a single | |
411 | # item which gets cleared once run. |
|
411 | # item which gets cleared once run. | |
412 | self.code_to_run = None |
|
412 | self.code_to_run = None | |
413 |
|
413 | |||
414 | # Job manager (for jobs run as background threads) |
|
414 | # Job manager (for jobs run as background threads) | |
415 | self.jobs = BackgroundJobManager() |
|
415 | self.jobs = BackgroundJobManager() | |
416 | # Put the job manager into builtins so it's always there. |
|
416 | # Put the job manager into builtins so it's always there. | |
417 | __builtin__.jobs = self.jobs |
|
417 | __builtin__.jobs = self.jobs | |
418 |
|
418 | |||
419 | # escapes for automatic behavior on the command line |
|
419 | # escapes for automatic behavior on the command line | |
420 | self.ESC_SHELL = '!' |
|
420 | self.ESC_SHELL = '!' | |
421 | self.ESC_HELP = '?' |
|
421 | self.ESC_HELP = '?' | |
422 | self.ESC_MAGIC = '%' |
|
422 | self.ESC_MAGIC = '%' | |
423 | self.ESC_QUOTE = ',' |
|
423 | self.ESC_QUOTE = ',' | |
424 | self.ESC_QUOTE2 = ';' |
|
424 | self.ESC_QUOTE2 = ';' | |
425 | self.ESC_PAREN = '/' |
|
425 | self.ESC_PAREN = '/' | |
426 |
|
426 | |||
427 | # And their associated handlers |
|
427 | # And their associated handlers | |
428 | self.esc_handlers = {self.ESC_PAREN : self.handle_auto, |
|
428 | self.esc_handlers = {self.ESC_PAREN : self.handle_auto, | |
429 | self.ESC_QUOTE : self.handle_auto, |
|
429 | self.ESC_QUOTE : self.handle_auto, | |
430 | self.ESC_QUOTE2 : self.handle_auto, |
|
430 | self.ESC_QUOTE2 : self.handle_auto, | |
431 | self.ESC_MAGIC : self.handle_magic, |
|
431 | self.ESC_MAGIC : self.handle_magic, | |
432 | self.ESC_HELP : self.handle_help, |
|
432 | self.ESC_HELP : self.handle_help, | |
433 | self.ESC_SHELL : self.handle_shell_escape, |
|
433 | self.ESC_SHELL : self.handle_shell_escape, | |
434 | } |
|
434 | } | |
435 |
|
435 | |||
436 | # class initializations |
|
436 | # class initializations | |
437 | Magic.__init__(self,self) |
|
437 | Magic.__init__(self,self) | |
438 |
|
438 | |||
439 | # Python source parser/formatter for syntax highlighting |
|
439 | # Python source parser/formatter for syntax highlighting | |
440 | pyformat = PyColorize.Parser().format |
|
440 | pyformat = PyColorize.Parser().format | |
441 | self.pycolorize = lambda src: pyformat(src,'str',self.rc['colors']) |
|
441 | self.pycolorize = lambda src: pyformat(src,'str',self.rc['colors']) | |
442 |
|
442 | |||
443 | # hooks holds pointers used for user-side customizations |
|
443 | # hooks holds pointers used for user-side customizations | |
444 | self.hooks = Struct() |
|
444 | self.hooks = Struct() | |
445 |
|
445 | |||
446 | # Set all default hooks, defined in the IPython.hooks module. |
|
446 | # Set all default hooks, defined in the IPython.hooks module. | |
447 | hooks = IPython.hooks |
|
447 | hooks = IPython.hooks | |
448 | for hook_name in hooks.__all__: |
|
448 | for hook_name in hooks.__all__: | |
449 | self.set_hook(hook_name,getattr(hooks,hook_name)) |
|
449 | self.set_hook(hook_name,getattr(hooks,hook_name)) | |
450 |
|
450 | |||
451 | # Flag to mark unconditional exit |
|
451 | # Flag to mark unconditional exit | |
452 | self.exit_now = False |
|
452 | self.exit_now = False | |
453 |
|
453 | |||
454 | self.usage_min = """\ |
|
454 | self.usage_min = """\ | |
455 | An enhanced console for Python. |
|
455 | An enhanced console for Python. | |
456 | Some of its features are: |
|
456 | Some of its features are: | |
457 | - Readline support if the readline library is present. |
|
457 | - Readline support if the readline library is present. | |
458 | - Tab completion in the local namespace. |
|
458 | - Tab completion in the local namespace. | |
459 | - Logging of input, see command-line options. |
|
459 | - Logging of input, see command-line options. | |
460 | - System shell escape via ! , eg !ls. |
|
460 | - System shell escape via ! , eg !ls. | |
461 | - Magic commands, starting with a % (like %ls, %pwd, %cd, etc.) |
|
461 | - Magic commands, starting with a % (like %ls, %pwd, %cd, etc.) | |
462 | - Keeps track of locally defined variables via %who, %whos. |
|
462 | - Keeps track of locally defined variables via %who, %whos. | |
463 | - Show object information with a ? eg ?x or x? (use ?? for more info). |
|
463 | - Show object information with a ? eg ?x or x? (use ?? for more info). | |
464 | """ |
|
464 | """ | |
465 | if usage: self.usage = usage |
|
465 | if usage: self.usage = usage | |
466 | else: self.usage = self.usage_min |
|
466 | else: self.usage = self.usage_min | |
467 |
|
467 | |||
468 | # Storage |
|
468 | # Storage | |
469 | self.rc = rc # This will hold all configuration information |
|
469 | self.rc = rc # This will hold all configuration information | |
470 | self.inputcache = [] |
|
470 | self.inputcache = [] | |
471 | self._boundcache = [] |
|
471 | self._boundcache = [] | |
472 | self.pager = 'less' |
|
472 | self.pager = 'less' | |
473 | # temporary files used for various purposes. Deleted at exit. |
|
473 | # temporary files used for various purposes. Deleted at exit. | |
474 | self.tempfiles = [] |
|
474 | self.tempfiles = [] | |
475 |
|
475 | |||
476 | # Keep track of readline usage (later set by init_readline) |
|
476 | # Keep track of readline usage (later set by init_readline) | |
477 | self.has_readline = False |
|
477 | self.has_readline = False | |
478 |
|
478 | |||
479 | # template for logfile headers. It gets resolved at runtime by the |
|
479 | # template for logfile headers. It gets resolved at runtime by the | |
480 | # logstart method. |
|
480 | # logstart method. | |
481 | self.loghead_tpl = \ |
|
481 | self.loghead_tpl = \ | |
482 | """#log# Automatic Logger file. *** THIS MUST BE THE FIRST LINE *** |
|
482 | """#log# Automatic Logger file. *** THIS MUST BE THE FIRST LINE *** | |
483 | #log# DO NOT CHANGE THIS LINE OR THE TWO BELOW |
|
483 | #log# DO NOT CHANGE THIS LINE OR THE TWO BELOW | |
484 | #log# opts = %s |
|
484 | #log# opts = %s | |
485 | #log# args = %s |
|
485 | #log# args = %s | |
486 | #log# It is safe to make manual edits below here. |
|
486 | #log# It is safe to make manual edits below here. | |
487 | #log#----------------------------------------------------------------------- |
|
487 | #log#----------------------------------------------------------------------- | |
488 | """ |
|
488 | """ | |
489 | # for pushd/popd management |
|
489 | # for pushd/popd management | |
490 | try: |
|
490 | try: | |
491 | self.home_dir = get_home_dir() |
|
491 | self.home_dir = get_home_dir() | |
492 | except HomeDirError,msg: |
|
492 | except HomeDirError,msg: | |
493 | fatal(msg) |
|
493 | fatal(msg) | |
494 |
|
494 | |||
495 | self.dir_stack = [os.getcwd().replace(self.home_dir,'~')] |
|
495 | self.dir_stack = [os.getcwd().replace(self.home_dir,'~')] | |
496 |
|
496 | |||
497 | # Functions to call the underlying shell. |
|
497 | # Functions to call the underlying shell. | |
498 |
|
498 | |||
499 | # utility to expand user variables via Itpl |
|
499 | # utility to expand user variables via Itpl | |
500 | self.var_expand = lambda cmd: str(ItplNS(cmd.replace('#','\#'), |
|
500 | self.var_expand = lambda cmd: str(ItplNS(cmd.replace('#','\#'), | |
501 | self.user_ns)) |
|
501 | self.user_ns)) | |
502 | # The first is similar to os.system, but it doesn't return a value, |
|
502 | # The first is similar to os.system, but it doesn't return a value, | |
503 | # and it allows interpolation of variables in the user's namespace. |
|
503 | # and it allows interpolation of variables in the user's namespace. | |
504 | self.system = lambda cmd: shell(self.var_expand(cmd), |
|
504 | self.system = lambda cmd: shell(self.var_expand(cmd), | |
505 | header='IPython system call: ', |
|
505 | header='IPython system call: ', | |
506 | verbose=self.rc.system_verbose) |
|
506 | verbose=self.rc.system_verbose) | |
507 | # These are for getoutput and getoutputerror: |
|
507 | # These are for getoutput and getoutputerror: | |
508 | self.getoutput = lambda cmd: \ |
|
508 | self.getoutput = lambda cmd: \ | |
509 | getoutput(self.var_expand(cmd), |
|
509 | getoutput(self.var_expand(cmd), | |
510 | header='IPython system call: ', |
|
510 | header='IPython system call: ', | |
511 | verbose=self.rc.system_verbose) |
|
511 | verbose=self.rc.system_verbose) | |
512 | self.getoutputerror = lambda cmd: \ |
|
512 | self.getoutputerror = lambda cmd: \ | |
513 | getoutputerror(str(ItplNS(cmd.replace('#','\#'), |
|
513 | getoutputerror(str(ItplNS(cmd.replace('#','\#'), | |
514 | self.user_ns)), |
|
514 | self.user_ns)), | |
515 | header='IPython system call: ', |
|
515 | header='IPython system call: ', | |
516 | verbose=self.rc.system_verbose) |
|
516 | verbose=self.rc.system_verbose) | |
517 |
|
517 | |||
518 | # RegExp for splitting line contents into pre-char//first |
|
518 | # RegExp for splitting line contents into pre-char//first | |
519 | # word-method//rest. For clarity, each group in on one line. |
|
519 | # word-method//rest. For clarity, each group in on one line. | |
520 |
|
520 | |||
521 | # WARNING: update the regexp if the above escapes are changed, as they |
|
521 | # WARNING: update the regexp if the above escapes are changed, as they | |
522 | # are hardwired in. |
|
522 | # are hardwired in. | |
523 |
|
523 | |||
524 | # Don't get carried away with trying to make the autocalling catch too |
|
524 | # Don't get carried away with trying to make the autocalling catch too | |
525 | # much: it's better to be conservative rather than to trigger hidden |
|
525 | # much: it's better to be conservative rather than to trigger hidden | |
526 | # evals() somewhere and end up causing side effects. |
|
526 | # evals() somewhere and end up causing side effects. | |
527 |
|
527 | |||
528 | self.line_split = re.compile(r'^([\s*,;/])' |
|
528 | self.line_split = re.compile(r'^([\s*,;/])' | |
529 | r'([\?\w\.]+\w*\s*)' |
|
529 | r'([\?\w\.]+\w*\s*)' | |
530 | r'(\(?.*$)') |
|
530 | r'(\(?.*$)') | |
531 |
|
531 | |||
532 | # Original re, keep around for a while in case changes break something |
|
532 | # Original re, keep around for a while in case changes break something | |
533 | #self.line_split = re.compile(r'(^[\s*!\?%,/]?)' |
|
533 | #self.line_split = re.compile(r'(^[\s*!\?%,/]?)' | |
534 | # r'(\s*[\?\w\.]+\w*\s*)' |
|
534 | # r'(\s*[\?\w\.]+\w*\s*)' | |
535 | # r'(\(?.*$)') |
|
535 | # r'(\(?.*$)') | |
536 |
|
536 | |||
537 | # RegExp to identify potential function names |
|
537 | # RegExp to identify potential function names | |
538 | self.re_fun_name = re.compile(r'[a-zA-Z_]([a-zA-Z0-9_.]*) *$') |
|
538 | self.re_fun_name = re.compile(r'[a-zA-Z_]([a-zA-Z0-9_.]*) *$') | |
539 | # RegExp to exclude strings with this start from autocalling |
|
539 | # RegExp to exclude strings with this start from autocalling | |
540 | self.re_exclude_auto = re.compile('^[!=()<>,\*/\+-]|^is ') |
|
540 | self.re_exclude_auto = re.compile('^[!=()<>,\*/\+-]|^is ') | |
541 |
|
541 | |||
542 | # try to catch also methods for stuff in lists/tuples/dicts: off |
|
542 | # try to catch also methods for stuff in lists/tuples/dicts: off | |
543 | # (experimental). For this to work, the line_split regexp would need |
|
543 | # (experimental). For this to work, the line_split regexp would need | |
544 | # to be modified so it wouldn't break things at '['. That line is |
|
544 | # to be modified so it wouldn't break things at '['. That line is | |
545 | # nasty enough that I shouldn't change it until I can test it _well_. |
|
545 | # nasty enough that I shouldn't change it until I can test it _well_. | |
546 | #self.re_fun_name = re.compile (r'[a-zA-Z_]([a-zA-Z0-9_.\[\]]*) ?$') |
|
546 | #self.re_fun_name = re.compile (r'[a-zA-Z_]([a-zA-Z0-9_.\[\]]*) ?$') | |
547 |
|
547 | |||
548 | # keep track of where we started running (mainly for crash post-mortem) |
|
548 | # keep track of where we started running (mainly for crash post-mortem) | |
549 | self.starting_dir = os.getcwd() |
|
549 | self.starting_dir = os.getcwd() | |
550 |
|
550 | |||
551 | # Various switches which can be set |
|
551 | # Various switches which can be set | |
552 | self.CACHELENGTH = 5000 # this is cheap, it's just text |
|
552 | self.CACHELENGTH = 5000 # this is cheap, it's just text | |
553 | self.BANNER = "Python %(version)s on %(platform)s\n" % sys.__dict__ |
|
553 | self.BANNER = "Python %(version)s on %(platform)s\n" % sys.__dict__ | |
554 | self.banner2 = banner2 |
|
554 | self.banner2 = banner2 | |
555 |
|
555 | |||
556 | # TraceBack handlers: |
|
556 | # TraceBack handlers: | |
557 |
|
557 | |||
558 | # Syntax error handler. |
|
558 | # Syntax error handler. | |
559 | self.SyntaxTB = SyntaxTB(color_scheme='NoColor') |
|
559 | self.SyntaxTB = SyntaxTB(color_scheme='NoColor') | |
560 |
|
560 | |||
561 | # The interactive one is initialized with an offset, meaning we always |
|
561 | # The interactive one is initialized with an offset, meaning we always | |
562 | # want to remove the topmost item in the traceback, which is our own |
|
562 | # want to remove the topmost item in the traceback, which is our own | |
563 | # internal code. Valid modes: ['Plain','Context','Verbose'] |
|
563 | # internal code. Valid modes: ['Plain','Context','Verbose'] | |
564 | self.InteractiveTB = ultraTB.AutoFormattedTB(mode = 'Plain', |
|
564 | self.InteractiveTB = ultraTB.AutoFormattedTB(mode = 'Plain', | |
565 | color_scheme='NoColor', |
|
565 | color_scheme='NoColor', | |
566 | tb_offset = 1) |
|
566 | tb_offset = 1) | |
567 |
|
567 | |||
568 | # IPython itself shouldn't crash. This will produce a detailed |
|
568 | # IPython itself shouldn't crash. This will produce a detailed | |
569 | # post-mortem if it does. But we only install the crash handler for |
|
569 | # post-mortem if it does. But we only install the crash handler for | |
570 | # non-threaded shells, the threaded ones use a normal verbose reporter |
|
570 | # non-threaded shells, the threaded ones use a normal verbose reporter | |
571 | # and lose the crash handler. This is because exceptions in the main |
|
571 | # and lose the crash handler. This is because exceptions in the main | |
572 | # thread (such as in GUI code) propagate directly to sys.excepthook, |
|
572 | # thread (such as in GUI code) propagate directly to sys.excepthook, | |
573 | # and there's no point in printing crash dumps for every user exception. |
|
573 | # and there's no point in printing crash dumps for every user exception. | |
574 | if self.isthreaded: |
|
574 | if self.isthreaded: | |
575 | sys.excepthook = ultraTB.FormattedTB() |
|
575 | sys.excepthook = ultraTB.FormattedTB() | |
576 | else: |
|
576 | else: | |
577 | from IPython import CrashHandler |
|
577 | from IPython import CrashHandler | |
578 | sys.excepthook = CrashHandler.CrashHandler(self) |
|
578 | sys.excepthook = CrashHandler.CrashHandler(self) | |
579 |
|
579 | |||
580 | # The instance will store a pointer to this, so that runtime code |
|
580 | # The instance will store a pointer to this, so that runtime code | |
581 | # (such as magics) can access it. This is because during the |
|
581 | # (such as magics) can access it. This is because during the | |
582 | # read-eval loop, it gets temporarily overwritten (to deal with GUI |
|
582 | # read-eval loop, it gets temporarily overwritten (to deal with GUI | |
583 | # frameworks). |
|
583 | # frameworks). | |
584 | self.sys_excepthook = sys.excepthook |
|
584 | self.sys_excepthook = sys.excepthook | |
585 |
|
585 | |||
586 | # and add any custom exception handlers the user may have specified |
|
586 | # and add any custom exception handlers the user may have specified | |
587 | self.set_custom_exc(*custom_exceptions) |
|
587 | self.set_custom_exc(*custom_exceptions) | |
588 |
|
588 | |||
589 | # Object inspector |
|
589 | # Object inspector | |
590 | self.inspector = OInspect.Inspector(OInspect.InspectColors, |
|
590 | self.inspector = OInspect.Inspector(OInspect.InspectColors, | |
591 | PyColorize.ANSICodeColors, |
|
591 | PyColorize.ANSICodeColors, | |
592 | 'NoColor') |
|
592 | 'NoColor') | |
593 | # indentation management |
|
593 | # indentation management | |
594 | self.autoindent = False |
|
594 | self.autoindent = False | |
595 | self.indent_current_nsp = 0 |
|
595 | self.indent_current_nsp = 0 | |
596 | self.indent_current = '' # actual indent string |
|
596 | self.indent_current = '' # actual indent string | |
597 |
|
597 | |||
598 | # Make some aliases automatically |
|
598 | # Make some aliases automatically | |
599 | # Prepare list of shell aliases to auto-define |
|
599 | # Prepare list of shell aliases to auto-define | |
600 | if os.name == 'posix': |
|
600 | if os.name == 'posix': | |
601 | auto_alias = ('mkdir mkdir', 'rmdir rmdir', |
|
601 | auto_alias = ('mkdir mkdir', 'rmdir rmdir', | |
602 | 'mv mv -i','rm rm -i','cp cp -i', |
|
602 | 'mv mv -i','rm rm -i','cp cp -i', | |
603 | 'cat cat','less less','clear clear', |
|
603 | 'cat cat','less less','clear clear', | |
604 | # a better ls |
|
604 | # a better ls | |
605 | 'ls ls -F', |
|
605 | 'ls ls -F', | |
606 | # long ls |
|
606 | # long ls | |
607 | 'll ls -lF', |
|
607 | 'll ls -lF', | |
608 | # color ls |
|
608 | # color ls | |
609 | 'lc ls -F -o --color', |
|
609 | 'lc ls -F -o --color', | |
610 | # ls normal files only |
|
610 | # ls normal files only | |
611 | 'lf ls -F -o --color %l | grep ^-', |
|
611 | 'lf ls -F -o --color %l | grep ^-', | |
612 | # ls symbolic links |
|
612 | # ls symbolic links | |
613 | 'lk ls -F -o --color %l | grep ^l', |
|
613 | 'lk ls -F -o --color %l | grep ^l', | |
614 | # directories or links to directories, |
|
614 | # directories or links to directories, | |
615 | 'ldir ls -F -o --color %l | grep /$', |
|
615 | 'ldir ls -F -o --color %l | grep /$', | |
616 | # things which are executable |
|
616 | # things which are executable | |
617 | 'lx ls -F -o --color %l | grep ^-..x', |
|
617 | 'lx ls -F -o --color %l | grep ^-..x', | |
618 | ) |
|
618 | ) | |
619 | elif os.name in ['nt','dos']: |
|
619 | elif os.name in ['nt','dos']: | |
620 | auto_alias = ('dir dir /on', 'ls dir /on', |
|
620 | auto_alias = ('dir dir /on', 'ls dir /on', | |
621 | 'ddir dir /ad /on', 'ldir dir /ad /on', |
|
621 | 'ddir dir /ad /on', 'ldir dir /ad /on', | |
622 | 'mkdir mkdir','rmdir rmdir','echo echo', |
|
622 | 'mkdir mkdir','rmdir rmdir','echo echo', | |
623 | 'ren ren','cls cls','copy copy') |
|
623 | 'ren ren','cls cls','copy copy') | |
624 | else: |
|
624 | else: | |
625 | auto_alias = () |
|
625 | auto_alias = () | |
626 | self.auto_alias = map(lambda s:s.split(None,1),auto_alias) |
|
626 | self.auto_alias = map(lambda s:s.split(None,1),auto_alias) | |
627 | # Call the actual (public) initializer |
|
627 | # Call the actual (public) initializer | |
628 | self.init_auto_alias() |
|
628 | self.init_auto_alias() | |
629 | # end __init__ |
|
629 | # end __init__ | |
630 |
|
630 | |||
631 | def post_config_initialization(self): |
|
631 | def post_config_initialization(self): | |
632 | """Post configuration init method |
|
632 | """Post configuration init method | |
633 |
|
633 | |||
634 | This is called after the configuration files have been processed to |
|
634 | This is called after the configuration files have been processed to | |
635 | 'finalize' the initialization.""" |
|
635 | 'finalize' the initialization.""" | |
636 |
|
636 | |||
637 | rc = self.rc |
|
637 | rc = self.rc | |
638 |
|
638 | |||
639 | # Load readline proper |
|
639 | # Load readline proper | |
640 | if rc.readline: |
|
640 | if rc.readline: | |
641 | self.init_readline() |
|
641 | self.init_readline() | |
642 |
|
642 | |||
643 | # log system |
|
643 | # log system | |
644 | self.logger = Logger(self,logfname='ipython_log.py',logmode='rotate') |
|
644 | self.logger = Logger(self,logfname='ipython_log.py',logmode='rotate') | |
645 | # local shortcut, this is used a LOT |
|
645 | # local shortcut, this is used a LOT | |
646 | self.log = self.logger.log |
|
646 | self.log = self.logger.log | |
647 |
|
647 | |||
648 | # Initialize cache, set in/out prompts and printing system |
|
648 | # Initialize cache, set in/out prompts and printing system | |
649 | self.outputcache = CachedOutput(self, |
|
649 | self.outputcache = CachedOutput(self, | |
650 | rc.cache_size, |
|
650 | rc.cache_size, | |
651 | rc.pprint, |
|
651 | rc.pprint, | |
652 | input_sep = rc.separate_in, |
|
652 | input_sep = rc.separate_in, | |
653 | output_sep = rc.separate_out, |
|
653 | output_sep = rc.separate_out, | |
654 | output_sep2 = rc.separate_out2, |
|
654 | output_sep2 = rc.separate_out2, | |
655 | ps1 = rc.prompt_in1, |
|
655 | ps1 = rc.prompt_in1, | |
656 | ps2 = rc.prompt_in2, |
|
656 | ps2 = rc.prompt_in2, | |
657 | ps_out = rc.prompt_out, |
|
657 | ps_out = rc.prompt_out, | |
658 | pad_left = rc.prompts_pad_left) |
|
658 | pad_left = rc.prompts_pad_left) | |
659 |
|
659 | |||
660 | # user may have over-ridden the default print hook: |
|
660 | # user may have over-ridden the default print hook: | |
661 | try: |
|
661 | try: | |
662 | self.outputcache.__class__.display = self.hooks.display |
|
662 | self.outputcache.__class__.display = self.hooks.display | |
663 | except AttributeError: |
|
663 | except AttributeError: | |
664 | pass |
|
664 | pass | |
665 |
|
665 | |||
666 | # I don't like assigning globally to sys, because it means when embedding |
|
666 | # I don't like assigning globally to sys, because it means when embedding | |
667 | # instances, each embedded instance overrides the previous choice. But |
|
667 | # instances, each embedded instance overrides the previous choice. But | |
668 | # sys.displayhook seems to be called internally by exec, so I don't see a |
|
668 | # sys.displayhook seems to be called internally by exec, so I don't see a | |
669 | # way around it. |
|
669 | # way around it. | |
670 | sys.displayhook = self.outputcache |
|
670 | sys.displayhook = self.outputcache | |
671 |
|
671 | |||
672 | # Set user colors (don't do it in the constructor above so that it |
|
672 | # Set user colors (don't do it in the constructor above so that it | |
673 | # doesn't crash if colors option is invalid) |
|
673 | # doesn't crash if colors option is invalid) | |
674 | self.magic_colors(rc.colors) |
|
674 | self.magic_colors(rc.colors) | |
675 |
|
675 | |||
676 | # Set calling of pdb on exceptions |
|
676 | # Set calling of pdb on exceptions | |
677 | self.call_pdb = rc.pdb |
|
677 | self.call_pdb = rc.pdb | |
678 |
|
678 | |||
679 | # Load user aliases |
|
679 | # Load user aliases | |
680 | for alias in rc.alias: |
|
680 | for alias in rc.alias: | |
681 | self.magic_alias(alias) |
|
681 | self.magic_alias(alias) | |
682 |
|
682 | |||
683 | # dynamic data that survives through sessions |
|
683 | # dynamic data that survives through sessions | |
684 | # XXX make the filename a config option? |
|
684 | # XXX make the filename a config option? | |
685 | persist_base = 'persist' |
|
685 | persist_base = 'persist' | |
686 | if rc.profile: |
|
686 | if rc.profile: | |
687 | persist_base += '_%s' % rc.profile |
|
687 | persist_base += '_%s' % rc.profile | |
688 | self.persist_fname = os.path.join(rc.ipythondir,persist_base) |
|
688 | self.persist_fname = os.path.join(rc.ipythondir,persist_base) | |
689 |
|
689 | |||
690 | try: |
|
690 | try: | |
691 | self.persist = pickle.load(file(self.persist_fname)) |
|
691 | self.persist = pickle.load(file(self.persist_fname)) | |
692 | except: |
|
692 | except: | |
693 | self.persist = {} |
|
693 | self.persist = {} | |
|
694 | ||||
|
695 | ||||
|
696 | for (key, value) in [(k[2:],v) for (k,v) in self.persist.items() if k.startswith('S:')]: | |||
|
697 | try: | |||
|
698 | obj = pickle.loads(value) | |||
|
699 | except: | |||
|
700 | ||||
|
701 | print "Unable to restore variable '%s', ignoring (use %%store -d to forget!)" % key | |||
|
702 | print "The error was:",sys.exc_info()[0] | |||
|
703 | continue | |||
|
704 | ||||
|
705 | ||||
|
706 | self.user_ns[key] = obj | |||
|
707 | ||||
|
708 | ||||
|
709 | ||||
694 |
|
710 | |||
695 | def set_hook(self,name,hook): |
|
711 | def set_hook(self,name,hook): | |
696 | """set_hook(name,hook) -> sets an internal IPython hook. |
|
712 | """set_hook(name,hook) -> sets an internal IPython hook. | |
697 |
|
713 | |||
698 | IPython exposes some of its internal API as user-modifiable hooks. By |
|
714 | IPython exposes some of its internal API as user-modifiable hooks. By | |
699 | resetting one of these hooks, you can modify IPython's behavior to |
|
715 | resetting one of these hooks, you can modify IPython's behavior to | |
700 | call at runtime your own routines.""" |
|
716 | call at runtime your own routines.""" | |
701 |
|
717 | |||
702 | # At some point in the future, this should validate the hook before it |
|
718 | # At some point in the future, this should validate the hook before it | |
703 | # accepts it. Probably at least check that the hook takes the number |
|
719 | # accepts it. Probably at least check that the hook takes the number | |
704 | # of args it's supposed to. |
|
720 | # of args it's supposed to. | |
705 | setattr(self.hooks,name,new.instancemethod(hook,self,self.__class__)) |
|
721 | setattr(self.hooks,name,new.instancemethod(hook,self,self.__class__)) | |
706 |
|
722 | |||
707 | def set_custom_exc(self,exc_tuple,handler): |
|
723 | def set_custom_exc(self,exc_tuple,handler): | |
708 | """set_custom_exc(exc_tuple,handler) |
|
724 | """set_custom_exc(exc_tuple,handler) | |
709 |
|
725 | |||
710 | Set a custom exception handler, which will be called if any of the |
|
726 | Set a custom exception handler, which will be called if any of the | |
711 | exceptions in exc_tuple occur in the mainloop (specifically, in the |
|
727 | exceptions in exc_tuple occur in the mainloop (specifically, in the | |
712 | runcode() method. |
|
728 | runcode() method. | |
713 |
|
729 | |||
714 | Inputs: |
|
730 | Inputs: | |
715 |
|
731 | |||
716 | - exc_tuple: a *tuple* of valid exceptions to call the defined |
|
732 | - exc_tuple: a *tuple* of valid exceptions to call the defined | |
717 | handler for. It is very important that you use a tuple, and NOT A |
|
733 | handler for. It is very important that you use a tuple, and NOT A | |
718 | LIST here, because of the way Python's except statement works. If |
|
734 | LIST here, because of the way Python's except statement works. If | |
719 | you only want to trap a single exception, use a singleton tuple: |
|
735 | you only want to trap a single exception, use a singleton tuple: | |
720 |
|
736 | |||
721 | exc_tuple == (MyCustomException,) |
|
737 | exc_tuple == (MyCustomException,) | |
722 |
|
738 | |||
723 | - handler: this must be defined as a function with the following |
|
739 | - handler: this must be defined as a function with the following | |
724 | basic interface: def my_handler(self,etype,value,tb). |
|
740 | basic interface: def my_handler(self,etype,value,tb). | |
725 |
|
741 | |||
726 | This will be made into an instance method (via new.instancemethod) |
|
742 | This will be made into an instance method (via new.instancemethod) | |
727 | of IPython itself, and it will be called if any of the exceptions |
|
743 | of IPython itself, and it will be called if any of the exceptions | |
728 | listed in the exc_tuple are caught. If the handler is None, an |
|
744 | listed in the exc_tuple are caught. If the handler is None, an | |
729 | internal basic one is used, which just prints basic info. |
|
745 | internal basic one is used, which just prints basic info. | |
730 |
|
746 | |||
731 | WARNING: by putting in your own exception handler into IPython's main |
|
747 | WARNING: by putting in your own exception handler into IPython's main | |
732 | execution loop, you run a very good chance of nasty crashes. This |
|
748 | execution loop, you run a very good chance of nasty crashes. This | |
733 | facility should only be used if you really know what you are doing.""" |
|
749 | facility should only be used if you really know what you are doing.""" | |
734 |
|
750 | |||
735 | assert type(exc_tuple)==type(()) , \ |
|
751 | assert type(exc_tuple)==type(()) , \ | |
736 | "The custom exceptions must be given AS A TUPLE." |
|
752 | "The custom exceptions must be given AS A TUPLE." | |
737 |
|
753 | |||
738 | def dummy_handler(self,etype,value,tb): |
|
754 | def dummy_handler(self,etype,value,tb): | |
739 | print '*** Simple custom exception handler ***' |
|
755 | print '*** Simple custom exception handler ***' | |
740 | print 'Exception type :',etype |
|
756 | print 'Exception type :',etype | |
741 | print 'Exception value:',value |
|
757 | print 'Exception value:',value | |
742 | print 'Traceback :',tb |
|
758 | print 'Traceback :',tb | |
743 | print 'Source code :','\n'.join(self.buffer) |
|
759 | print 'Source code :','\n'.join(self.buffer) | |
744 |
|
760 | |||
745 | if handler is None: handler = dummy_handler |
|
761 | if handler is None: handler = dummy_handler | |
746 |
|
762 | |||
747 | self.CustomTB = new.instancemethod(handler,self,self.__class__) |
|
763 | self.CustomTB = new.instancemethod(handler,self,self.__class__) | |
748 | self.custom_exceptions = exc_tuple |
|
764 | self.custom_exceptions = exc_tuple | |
749 |
|
765 | |||
750 | def set_custom_completer(self,completer,pos=0): |
|
766 | def set_custom_completer(self,completer,pos=0): | |
751 | """set_custom_completer(completer,pos=0) |
|
767 | """set_custom_completer(completer,pos=0) | |
752 |
|
768 | |||
753 | Adds a new custom completer function. |
|
769 | Adds a new custom completer function. | |
754 |
|
770 | |||
755 | The position argument (defaults to 0) is the index in the completers |
|
771 | The position argument (defaults to 0) is the index in the completers | |
756 | list where you want the completer to be inserted.""" |
|
772 | list where you want the completer to be inserted.""" | |
757 |
|
773 | |||
758 | newcomp = new.instancemethod(completer,self.Completer, |
|
774 | newcomp = new.instancemethod(completer,self.Completer, | |
759 | self.Completer.__class__) |
|
775 | self.Completer.__class__) | |
760 | self.Completer.matchers.insert(pos,newcomp) |
|
776 | self.Completer.matchers.insert(pos,newcomp) | |
761 |
|
777 | |||
762 | def _get_call_pdb(self): |
|
778 | def _get_call_pdb(self): | |
763 | return self._call_pdb |
|
779 | return self._call_pdb | |
764 |
|
780 | |||
765 | def _set_call_pdb(self,val): |
|
781 | def _set_call_pdb(self,val): | |
766 |
|
782 | |||
767 | if val not in (0,1,False,True): |
|
783 | if val not in (0,1,False,True): | |
768 | raise ValueError,'new call_pdb value must be boolean' |
|
784 | raise ValueError,'new call_pdb value must be boolean' | |
769 |
|
785 | |||
770 | # store value in instance |
|
786 | # store value in instance | |
771 | self._call_pdb = val |
|
787 | self._call_pdb = val | |
772 |
|
788 | |||
773 | # notify the actual exception handlers |
|
789 | # notify the actual exception handlers | |
774 | self.InteractiveTB.call_pdb = val |
|
790 | self.InteractiveTB.call_pdb = val | |
775 | if self.isthreaded: |
|
791 | if self.isthreaded: | |
776 | try: |
|
792 | try: | |
777 | self.sys_excepthook.call_pdb = val |
|
793 | self.sys_excepthook.call_pdb = val | |
778 | except: |
|
794 | except: | |
779 | warn('Failed to activate pdb for threaded exception handler') |
|
795 | warn('Failed to activate pdb for threaded exception handler') | |
780 |
|
796 | |||
781 | call_pdb = property(_get_call_pdb,_set_call_pdb,None, |
|
797 | call_pdb = property(_get_call_pdb,_set_call_pdb,None, | |
782 | 'Control auto-activation of pdb at exceptions') |
|
798 | 'Control auto-activation of pdb at exceptions') | |
783 |
|
799 | |||
784 | def complete(self,text): |
|
800 | def complete(self,text): | |
785 | """Return a sorted list of all possible completions on text. |
|
801 | """Return a sorted list of all possible completions on text. | |
786 |
|
802 | |||
787 | Inputs: |
|
803 | Inputs: | |
788 |
|
804 | |||
789 | - text: a string of text to be completed on. |
|
805 | - text: a string of text to be completed on. | |
790 |
|
806 | |||
791 | This is a wrapper around the completion mechanism, similar to what |
|
807 | This is a wrapper around the completion mechanism, similar to what | |
792 | readline does at the command line when the TAB key is hit. By |
|
808 | readline does at the command line when the TAB key is hit. By | |
793 | exposing it as a method, it can be used by other non-readline |
|
809 | exposing it as a method, it can be used by other non-readline | |
794 | environments (such as GUIs) for text completion. |
|
810 | environments (such as GUIs) for text completion. | |
795 |
|
811 | |||
796 | Simple usage example: |
|
812 | Simple usage example: | |
797 |
|
813 | |||
798 | In [1]: x = 'hello' |
|
814 | In [1]: x = 'hello' | |
799 |
|
815 | |||
800 | In [2]: __IP.complete('x.l') |
|
816 | In [2]: __IP.complete('x.l') | |
801 | Out[2]: ['x.ljust', 'x.lower', 'x.lstrip']""" |
|
817 | Out[2]: ['x.ljust', 'x.lower', 'x.lstrip']""" | |
802 |
|
818 | |||
803 | complete = self.Completer.complete |
|
819 | complete = self.Completer.complete | |
804 | state = 0 |
|
820 | state = 0 | |
805 | # use a dict so we get unique keys, since ipyhton's multiple |
|
821 | # use a dict so we get unique keys, since ipyhton's multiple | |
806 | # completers can return duplicates. |
|
822 | # completers can return duplicates. | |
807 | comps = {} |
|
823 | comps = {} | |
808 | while True: |
|
824 | while True: | |
809 | newcomp = complete(text,state) |
|
825 | newcomp = complete(text,state) | |
810 | if newcomp is None: |
|
826 | if newcomp is None: | |
811 | break |
|
827 | break | |
812 | comps[newcomp] = 1 |
|
828 | comps[newcomp] = 1 | |
813 | state += 1 |
|
829 | state += 1 | |
814 | outcomps = comps.keys() |
|
830 | outcomps = comps.keys() | |
815 | outcomps.sort() |
|
831 | outcomps.sort() | |
816 | return outcomps |
|
832 | return outcomps | |
817 |
|
833 | |||
818 | def set_completer_frame(self, frame): |
|
834 | def set_completer_frame(self, frame): | |
819 | if frame: |
|
835 | if frame: | |
820 | self.Completer.namespace = frame.f_locals |
|
836 | self.Completer.namespace = frame.f_locals | |
821 | self.Completer.global_namespace = frame.f_globals |
|
837 | self.Completer.global_namespace = frame.f_globals | |
822 | else: |
|
838 | else: | |
823 | self.Completer.namespace = self.user_ns |
|
839 | self.Completer.namespace = self.user_ns | |
824 | self.Completer.global_namespace = self.user_global_ns |
|
840 | self.Completer.global_namespace = self.user_global_ns | |
825 |
|
841 | |||
826 | def init_auto_alias(self): |
|
842 | def init_auto_alias(self): | |
827 | """Define some aliases automatically. |
|
843 | """Define some aliases automatically. | |
828 |
|
844 | |||
829 | These are ALL parameter-less aliases""" |
|
845 | These are ALL parameter-less aliases""" | |
830 | for alias,cmd in self.auto_alias: |
|
846 | for alias,cmd in self.auto_alias: | |
831 | self.alias_table[alias] = (0,cmd) |
|
847 | self.alias_table[alias] = (0,cmd) | |
832 |
|
848 | |||
833 | def alias_table_validate(self,verbose=0): |
|
849 | def alias_table_validate(self,verbose=0): | |
834 | """Update information about the alias table. |
|
850 | """Update information about the alias table. | |
835 |
|
851 | |||
836 | In particular, make sure no Python keywords/builtins are in it.""" |
|
852 | In particular, make sure no Python keywords/builtins are in it.""" | |
837 |
|
853 | |||
838 | no_alias = self.no_alias |
|
854 | no_alias = self.no_alias | |
839 | for k in self.alias_table.keys(): |
|
855 | for k in self.alias_table.keys(): | |
840 | if k in no_alias: |
|
856 | if k in no_alias: | |
841 | del self.alias_table[k] |
|
857 | del self.alias_table[k] | |
842 | if verbose: |
|
858 | if verbose: | |
843 | print ("Deleting alias <%s>, it's a Python " |
|
859 | print ("Deleting alias <%s>, it's a Python " | |
844 | "keyword or builtin." % k) |
|
860 | "keyword or builtin." % k) | |
845 |
|
861 | |||
846 | def set_autoindent(self,value=None): |
|
862 | def set_autoindent(self,value=None): | |
847 | """Set the autoindent flag, checking for readline support. |
|
863 | """Set the autoindent flag, checking for readline support. | |
848 |
|
864 | |||
849 | If called with no arguments, it acts as a toggle.""" |
|
865 | If called with no arguments, it acts as a toggle.""" | |
850 |
|
866 | |||
851 | if not self.has_readline: |
|
867 | if not self.has_readline: | |
852 | if os.name == 'posix': |
|
868 | if os.name == 'posix': | |
853 | warn("The auto-indent feature requires the readline library") |
|
869 | warn("The auto-indent feature requires the readline library") | |
854 | self.autoindent = 0 |
|
870 | self.autoindent = 0 | |
855 | return |
|
871 | return | |
856 | if value is None: |
|
872 | if value is None: | |
857 | self.autoindent = not self.autoindent |
|
873 | self.autoindent = not self.autoindent | |
858 | else: |
|
874 | else: | |
859 | self.autoindent = value |
|
875 | self.autoindent = value | |
860 |
|
876 | |||
861 | def rc_set_toggle(self,rc_field,value=None): |
|
877 | def rc_set_toggle(self,rc_field,value=None): | |
862 | """Set or toggle a field in IPython's rc config. structure. |
|
878 | """Set or toggle a field in IPython's rc config. structure. | |
863 |
|
879 | |||
864 | If called with no arguments, it acts as a toggle. |
|
880 | If called with no arguments, it acts as a toggle. | |
865 |
|
881 | |||
866 | If called with a non-existent field, the resulting AttributeError |
|
882 | If called with a non-existent field, the resulting AttributeError | |
867 | exception will propagate out.""" |
|
883 | exception will propagate out.""" | |
868 |
|
884 | |||
869 | rc_val = getattr(self.rc,rc_field) |
|
885 | rc_val = getattr(self.rc,rc_field) | |
870 | if value is None: |
|
886 | if value is None: | |
871 | value = not rc_val |
|
887 | value = not rc_val | |
872 | setattr(self.rc,rc_field,value) |
|
888 | setattr(self.rc,rc_field,value) | |
873 |
|
889 | |||
874 | def user_setup(self,ipythondir,rc_suffix,mode='install'): |
|
890 | def user_setup(self,ipythondir,rc_suffix,mode='install'): | |
875 | """Install the user configuration directory. |
|
891 | """Install the user configuration directory. | |
876 |
|
892 | |||
877 | Can be called when running for the first time or to upgrade the user's |
|
893 | Can be called when running for the first time or to upgrade the user's | |
878 | .ipython/ directory with the mode parameter. Valid modes are 'install' |
|
894 | .ipython/ directory with the mode parameter. Valid modes are 'install' | |
879 | and 'upgrade'.""" |
|
895 | and 'upgrade'.""" | |
880 |
|
896 | |||
881 | def wait(): |
|
897 | def wait(): | |
882 | try: |
|
898 | try: | |
883 | raw_input("Please press <RETURN> to start IPython.") |
|
899 | raw_input("Please press <RETURN> to start IPython.") | |
884 | except EOFError: |
|
900 | except EOFError: | |
885 | print >> Term.cout |
|
901 | print >> Term.cout | |
886 | print '*'*70 |
|
902 | print '*'*70 | |
887 |
|
903 | |||
888 | cwd = os.getcwd() # remember where we started |
|
904 | cwd = os.getcwd() # remember where we started | |
889 | glb = glob.glob |
|
905 | glb = glob.glob | |
890 | print '*'*70 |
|
906 | print '*'*70 | |
891 | if mode == 'install': |
|
907 | if mode == 'install': | |
892 | print \ |
|
908 | print \ | |
893 | """Welcome to IPython. I will try to create a personal configuration directory |
|
909 | """Welcome to IPython. I will try to create a personal configuration directory | |
894 | where you can customize many aspects of IPython's functionality in:\n""" |
|
910 | where you can customize many aspects of IPython's functionality in:\n""" | |
895 | else: |
|
911 | else: | |
896 | print 'I am going to upgrade your configuration in:' |
|
912 | print 'I am going to upgrade your configuration in:' | |
897 |
|
913 | |||
898 | print ipythondir |
|
914 | print ipythondir | |
899 |
|
915 | |||
900 | rcdirend = os.path.join('IPython','UserConfig') |
|
916 | rcdirend = os.path.join('IPython','UserConfig') | |
901 | cfg = lambda d: os.path.join(d,rcdirend) |
|
917 | cfg = lambda d: os.path.join(d,rcdirend) | |
902 | try: |
|
918 | try: | |
903 | rcdir = filter(os.path.isdir,map(cfg,sys.path))[0] |
|
919 | rcdir = filter(os.path.isdir,map(cfg,sys.path))[0] | |
904 | except IOError: |
|
920 | except IOError: | |
905 | warning = """ |
|
921 | warning = """ | |
906 | Installation error. IPython's directory was not found. |
|
922 | Installation error. IPython's directory was not found. | |
907 |
|
923 | |||
908 | Check the following: |
|
924 | Check the following: | |
909 |
|
925 | |||
910 | The ipython/IPython directory should be in a directory belonging to your |
|
926 | The ipython/IPython directory should be in a directory belonging to your | |
911 | PYTHONPATH environment variable (that is, it should be in a directory |
|
927 | PYTHONPATH environment variable (that is, it should be in a directory | |
912 | belonging to sys.path). You can copy it explicitly there or just link to it. |
|
928 | belonging to sys.path). You can copy it explicitly there or just link to it. | |
913 |
|
929 | |||
914 | IPython will proceed with builtin defaults. |
|
930 | IPython will proceed with builtin defaults. | |
915 | """ |
|
931 | """ | |
916 | warn(warning) |
|
932 | warn(warning) | |
917 | wait() |
|
933 | wait() | |
918 | return |
|
934 | return | |
919 |
|
935 | |||
920 | if mode == 'install': |
|
936 | if mode == 'install': | |
921 | try: |
|
937 | try: | |
922 | shutil.copytree(rcdir,ipythondir) |
|
938 | shutil.copytree(rcdir,ipythondir) | |
923 | os.chdir(ipythondir) |
|
939 | os.chdir(ipythondir) | |
924 | rc_files = glb("ipythonrc*") |
|
940 | rc_files = glb("ipythonrc*") | |
925 | for rc_file in rc_files: |
|
941 | for rc_file in rc_files: | |
926 | os.rename(rc_file,rc_file+rc_suffix) |
|
942 | os.rename(rc_file,rc_file+rc_suffix) | |
927 | except: |
|
943 | except: | |
928 | warning = """ |
|
944 | warning = """ | |
929 |
|
945 | |||
930 | There was a problem with the installation: |
|
946 | There was a problem with the installation: | |
931 | %s |
|
947 | %s | |
932 | Try to correct it or contact the developers if you think it's a bug. |
|
948 | Try to correct it or contact the developers if you think it's a bug. | |
933 | IPython will proceed with builtin defaults.""" % sys.exc_info()[1] |
|
949 | IPython will proceed with builtin defaults.""" % sys.exc_info()[1] | |
934 | warn(warning) |
|
950 | warn(warning) | |
935 | wait() |
|
951 | wait() | |
936 | return |
|
952 | return | |
937 |
|
953 | |||
938 | elif mode == 'upgrade': |
|
954 | elif mode == 'upgrade': | |
939 | try: |
|
955 | try: | |
940 | os.chdir(ipythondir) |
|
956 | os.chdir(ipythondir) | |
941 | except: |
|
957 | except: | |
942 | print """ |
|
958 | print """ | |
943 | Can not upgrade: changing to directory %s failed. Details: |
|
959 | Can not upgrade: changing to directory %s failed. Details: | |
944 | %s |
|
960 | %s | |
945 | """ % (ipythondir,sys.exc_info()[1]) |
|
961 | """ % (ipythondir,sys.exc_info()[1]) | |
946 | wait() |
|
962 | wait() | |
947 | return |
|
963 | return | |
948 | else: |
|
964 | else: | |
949 | sources = glb(os.path.join(rcdir,'[A-Za-z]*')) |
|
965 | sources = glb(os.path.join(rcdir,'[A-Za-z]*')) | |
950 | for new_full_path in sources: |
|
966 | for new_full_path in sources: | |
951 | new_filename = os.path.basename(new_full_path) |
|
967 | new_filename = os.path.basename(new_full_path) | |
952 | if new_filename.startswith('ipythonrc'): |
|
968 | if new_filename.startswith('ipythonrc'): | |
953 | new_filename = new_filename + rc_suffix |
|
969 | new_filename = new_filename + rc_suffix | |
954 | # The config directory should only contain files, skip any |
|
970 | # The config directory should only contain files, skip any | |
955 | # directories which may be there (like CVS) |
|
971 | # directories which may be there (like CVS) | |
956 | if os.path.isdir(new_full_path): |
|
972 | if os.path.isdir(new_full_path): | |
957 | continue |
|
973 | continue | |
958 | if os.path.exists(new_filename): |
|
974 | if os.path.exists(new_filename): | |
959 | old_file = new_filename+'.old' |
|
975 | old_file = new_filename+'.old' | |
960 | if os.path.exists(old_file): |
|
976 | if os.path.exists(old_file): | |
961 | os.remove(old_file) |
|
977 | os.remove(old_file) | |
962 | os.rename(new_filename,old_file) |
|
978 | os.rename(new_filename,old_file) | |
963 | shutil.copy(new_full_path,new_filename) |
|
979 | shutil.copy(new_full_path,new_filename) | |
964 | else: |
|
980 | else: | |
965 | raise ValueError,'unrecognized mode for install:',`mode` |
|
981 | raise ValueError,'unrecognized mode for install:',`mode` | |
966 |
|
982 | |||
967 | # Fix line-endings to those native to each platform in the config |
|
983 | # Fix line-endings to those native to each platform in the config | |
968 | # directory. |
|
984 | # directory. | |
969 | try: |
|
985 | try: | |
970 | os.chdir(ipythondir) |
|
986 | os.chdir(ipythondir) | |
971 | except: |
|
987 | except: | |
972 | print """ |
|
988 | print """ | |
973 | Problem: changing to directory %s failed. |
|
989 | Problem: changing to directory %s failed. | |
974 | Details: |
|
990 | Details: | |
975 | %s |
|
991 | %s | |
976 |
|
992 | |||
977 | Some configuration files may have incorrect line endings. This should not |
|
993 | Some configuration files may have incorrect line endings. This should not | |
978 | cause any problems during execution. """ % (ipythondir,sys.exc_info()[1]) |
|
994 | cause any problems during execution. """ % (ipythondir,sys.exc_info()[1]) | |
979 | wait() |
|
995 | wait() | |
980 | else: |
|
996 | else: | |
981 | for fname in glb('ipythonrc*'): |
|
997 | for fname in glb('ipythonrc*'): | |
982 | try: |
|
998 | try: | |
983 | native_line_ends(fname,backup=0) |
|
999 | native_line_ends(fname,backup=0) | |
984 | except IOError: |
|
1000 | except IOError: | |
985 | pass |
|
1001 | pass | |
986 |
|
1002 | |||
987 | if mode == 'install': |
|
1003 | if mode == 'install': | |
988 | print """ |
|
1004 | print """ | |
989 | Successful installation! |
|
1005 | Successful installation! | |
990 |
|
1006 | |||
991 | Please read the sections 'Initial Configuration' and 'Quick Tips' in the |
|
1007 | Please read the sections 'Initial Configuration' and 'Quick Tips' in the | |
992 | IPython manual (there are both HTML and PDF versions supplied with the |
|
1008 | IPython manual (there are both HTML and PDF versions supplied with the | |
993 | distribution) to make sure that your system environment is properly configured |
|
1009 | distribution) to make sure that your system environment is properly configured | |
994 | to take advantage of IPython's features.""" |
|
1010 | to take advantage of IPython's features.""" | |
995 | else: |
|
1011 | else: | |
996 | print """ |
|
1012 | print """ | |
997 | Successful upgrade! |
|
1013 | Successful upgrade! | |
998 |
|
1014 | |||
999 | All files in your directory: |
|
1015 | All files in your directory: | |
1000 | %(ipythondir)s |
|
1016 | %(ipythondir)s | |
1001 | which would have been overwritten by the upgrade were backed up with a .old |
|
1017 | which would have been overwritten by the upgrade were backed up with a .old | |
1002 | extension. If you had made particular customizations in those files you may |
|
1018 | extension. If you had made particular customizations in those files you may | |
1003 | want to merge them back into the new files.""" % locals() |
|
1019 | want to merge them back into the new files.""" % locals() | |
1004 | wait() |
|
1020 | wait() | |
1005 | os.chdir(cwd) |
|
1021 | os.chdir(cwd) | |
1006 | # end user_setup() |
|
1022 | # end user_setup() | |
1007 |
|
1023 | |||
1008 | def atexit_operations(self): |
|
1024 | def atexit_operations(self): | |
1009 | """This will be executed at the time of exit. |
|
1025 | """This will be executed at the time of exit. | |
1010 |
|
1026 | |||
1011 | Saving of persistent data should be performed here. """ |
|
1027 | Saving of persistent data should be performed here. """ | |
1012 |
|
1028 | |||
1013 | # input history |
|
1029 | # input history | |
1014 | self.savehist() |
|
1030 | self.savehist() | |
1015 |
|
1031 | |||
1016 | # Cleanup all tempfiles left around |
|
1032 | # Cleanup all tempfiles left around | |
1017 | for tfile in self.tempfiles: |
|
1033 | for tfile in self.tempfiles: | |
1018 | try: |
|
1034 | try: | |
1019 | os.unlink(tfile) |
|
1035 | os.unlink(tfile) | |
1020 | except OSError: |
|
1036 | except OSError: | |
1021 | pass |
|
1037 | pass | |
1022 |
|
1038 | |||
1023 | # save the "persistent data" catch-all dictionary |
|
1039 | # save the "persistent data" catch-all dictionary | |
1024 | try: |
|
1040 | try: | |
1025 | pickle.dump(self.persist, open(self.persist_fname,"w")) |
|
1041 | pickle.dump(self.persist, open(self.persist_fname,"w")) | |
1026 | except: |
|
1042 | except: | |
1027 | print "*** ERROR *** persistent data saving failed." |
|
1043 | print "*** ERROR *** persistent data saving failed." | |
1028 |
|
1044 | |||
1029 | def savehist(self): |
|
1045 | def savehist(self): | |
1030 | """Save input history to a file (via readline library).""" |
|
1046 | """Save input history to a file (via readline library).""" | |
1031 | try: |
|
1047 | try: | |
1032 | self.readline.write_history_file(self.histfile) |
|
1048 | self.readline.write_history_file(self.histfile) | |
1033 | except: |
|
1049 | except: | |
1034 | print 'Unable to save IPython command history to file: ' + \ |
|
1050 | print 'Unable to save IPython command history to file: ' + \ | |
1035 | `self.histfile` |
|
1051 | `self.histfile` | |
1036 |
|
1052 | |||
1037 | def pre_readline(self): |
|
1053 | def pre_readline(self): | |
1038 | """readline hook to be used at the start of each line. |
|
1054 | """readline hook to be used at the start of each line. | |
1039 |
|
1055 | |||
1040 | Currently it handles auto-indent only.""" |
|
1056 | Currently it handles auto-indent only.""" | |
1041 |
|
1057 | |||
1042 | self.readline.insert_text(self.indent_current) |
|
1058 | self.readline.insert_text(self.indent_current) | |
1043 |
|
1059 | |||
1044 | def init_readline(self): |
|
1060 | def init_readline(self): | |
1045 | """Command history completion/saving/reloading.""" |
|
1061 | """Command history completion/saving/reloading.""" | |
1046 | try: |
|
1062 | try: | |
1047 | import readline |
|
1063 | import readline | |
1048 | except ImportError: |
|
1064 | except ImportError: | |
1049 | self.has_readline = 0 |
|
1065 | self.has_readline = 0 | |
1050 | self.readline = None |
|
1066 | self.readline = None | |
1051 | # no point in bugging windows users with this every time: |
|
1067 | # no point in bugging windows users with this every time: | |
1052 | if os.name == 'posix': |
|
1068 | if os.name == 'posix': | |
1053 | warn('Readline services not available on this platform.') |
|
1069 | warn('Readline services not available on this platform.') | |
1054 | else: |
|
1070 | else: | |
1055 | import atexit |
|
1071 | import atexit | |
1056 | from IPython.completer import IPCompleter |
|
1072 | from IPython.completer import IPCompleter | |
1057 | self.Completer = IPCompleter(self, |
|
1073 | self.Completer = IPCompleter(self, | |
1058 | self.user_ns, |
|
1074 | self.user_ns, | |
1059 | self.user_global_ns, |
|
1075 | self.user_global_ns, | |
1060 | self.rc.readline_omit__names, |
|
1076 | self.rc.readline_omit__names, | |
1061 | self.alias_table) |
|
1077 | self.alias_table) | |
1062 |
|
1078 | |||
1063 | # Platform-specific configuration |
|
1079 | # Platform-specific configuration | |
1064 | if os.name == 'nt': |
|
1080 | if os.name == 'nt': | |
1065 | self.readline_startup_hook = readline.set_pre_input_hook |
|
1081 | self.readline_startup_hook = readline.set_pre_input_hook | |
1066 | else: |
|
1082 | else: | |
1067 | self.readline_startup_hook = readline.set_startup_hook |
|
1083 | self.readline_startup_hook = readline.set_startup_hook | |
1068 |
|
1084 | |||
1069 | # Load user's initrc file (readline config) |
|
1085 | # Load user's initrc file (readline config) | |
1070 | inputrc_name = os.environ.get('INPUTRC') |
|
1086 | inputrc_name = os.environ.get('INPUTRC') | |
1071 | if inputrc_name is None: |
|
1087 | if inputrc_name is None: | |
1072 | home_dir = get_home_dir() |
|
1088 | home_dir = get_home_dir() | |
1073 | if home_dir is not None: |
|
1089 | if home_dir is not None: | |
1074 | inputrc_name = os.path.join(home_dir,'.inputrc') |
|
1090 | inputrc_name = os.path.join(home_dir,'.inputrc') | |
1075 | if os.path.isfile(inputrc_name): |
|
1091 | if os.path.isfile(inputrc_name): | |
1076 | try: |
|
1092 | try: | |
1077 | readline.read_init_file(inputrc_name) |
|
1093 | readline.read_init_file(inputrc_name) | |
1078 | except: |
|
1094 | except: | |
1079 | warn('Problems reading readline initialization file <%s>' |
|
1095 | warn('Problems reading readline initialization file <%s>' | |
1080 | % inputrc_name) |
|
1096 | % inputrc_name) | |
1081 |
|
1097 | |||
1082 | self.has_readline = 1 |
|
1098 | self.has_readline = 1 | |
1083 | self.readline = readline |
|
1099 | self.readline = readline | |
1084 | # save this in sys so embedded copies can restore it properly |
|
1100 | # save this in sys so embedded copies can restore it properly | |
1085 | sys.ipcompleter = self.Completer.complete |
|
1101 | sys.ipcompleter = self.Completer.complete | |
1086 | readline.set_completer(self.Completer.complete) |
|
1102 | readline.set_completer(self.Completer.complete) | |
1087 |
|
1103 | |||
1088 | # Configure readline according to user's prefs |
|
1104 | # Configure readline according to user's prefs | |
1089 | for rlcommand in self.rc.readline_parse_and_bind: |
|
1105 | for rlcommand in self.rc.readline_parse_and_bind: | |
1090 | readline.parse_and_bind(rlcommand) |
|
1106 | readline.parse_and_bind(rlcommand) | |
1091 |
|
1107 | |||
1092 | # remove some chars from the delimiters list |
|
1108 | # remove some chars from the delimiters list | |
1093 | delims = readline.get_completer_delims() |
|
1109 | delims = readline.get_completer_delims() | |
1094 | delims = delims.translate(string._idmap, |
|
1110 | delims = delims.translate(string._idmap, | |
1095 | self.rc.readline_remove_delims) |
|
1111 | self.rc.readline_remove_delims) | |
1096 | readline.set_completer_delims(delims) |
|
1112 | readline.set_completer_delims(delims) | |
1097 | # otherwise we end up with a monster history after a while: |
|
1113 | # otherwise we end up with a monster history after a while: | |
1098 | readline.set_history_length(1000) |
|
1114 | readline.set_history_length(1000) | |
1099 | try: |
|
1115 | try: | |
1100 | #print '*** Reading readline history' # dbg |
|
1116 | #print '*** Reading readline history' # dbg | |
1101 | readline.read_history_file(self.histfile) |
|
1117 | readline.read_history_file(self.histfile) | |
1102 | except IOError: |
|
1118 | except IOError: | |
1103 | pass # It doesn't exist yet. |
|
1119 | pass # It doesn't exist yet. | |
1104 |
|
1120 | |||
1105 | atexit.register(self.atexit_operations) |
|
1121 | atexit.register(self.atexit_operations) | |
1106 | del atexit |
|
1122 | del atexit | |
1107 |
|
1123 | |||
1108 | # Configure auto-indent for all platforms |
|
1124 | # Configure auto-indent for all platforms | |
1109 | self.set_autoindent(self.rc.autoindent) |
|
1125 | self.set_autoindent(self.rc.autoindent) | |
1110 |
|
1126 | |||
1111 | def _should_recompile(self,e): |
|
1127 | def _should_recompile(self,e): | |
1112 | """Utility routine for edit_syntax_error""" |
|
1128 | """Utility routine for edit_syntax_error""" | |
1113 |
|
1129 | |||
1114 | if e.filename in ('<ipython console>','<input>','<string>', |
|
1130 | if e.filename in ('<ipython console>','<input>','<string>', | |
1115 | '<console>'): |
|
1131 | '<console>'): | |
1116 | return False |
|
1132 | return False | |
1117 | try: |
|
1133 | try: | |
1118 | if not ask_yes_no('Return to editor to correct syntax error? ' |
|
1134 | if not ask_yes_no('Return to editor to correct syntax error? ' | |
1119 | '[Y/n] ','y'): |
|
1135 | '[Y/n] ','y'): | |
1120 | return False |
|
1136 | return False | |
1121 | except EOFError: |
|
1137 | except EOFError: | |
1122 | return False |
|
1138 | return False | |
1123 | self.hooks.fix_error_editor(e.filename,e.lineno,e.offset,e.msg) |
|
1139 | self.hooks.fix_error_editor(e.filename,e.lineno,e.offset,e.msg) | |
1124 | return True |
|
1140 | return True | |
1125 |
|
1141 | |||
1126 | def edit_syntax_error(self): |
|
1142 | def edit_syntax_error(self): | |
1127 | """The bottom half of the syntax error handler called in the main loop. |
|
1143 | """The bottom half of the syntax error handler called in the main loop. | |
1128 |
|
1144 | |||
1129 | Loop until syntax error is fixed or user cancels. |
|
1145 | Loop until syntax error is fixed or user cancels. | |
1130 | """ |
|
1146 | """ | |
1131 |
|
1147 | |||
1132 | while self.SyntaxTB.last_syntax_error: |
|
1148 | while self.SyntaxTB.last_syntax_error: | |
1133 | # copy and clear last_syntax_error |
|
1149 | # copy and clear last_syntax_error | |
1134 | err = self.SyntaxTB.clear_err_state() |
|
1150 | err = self.SyntaxTB.clear_err_state() | |
1135 | if not self._should_recompile(err): |
|
1151 | if not self._should_recompile(err): | |
1136 | return |
|
1152 | return | |
1137 | try: |
|
1153 | try: | |
1138 | # may set last_syntax_error again if a SyntaxError is raised |
|
1154 | # may set last_syntax_error again if a SyntaxError is raised | |
1139 | self.safe_execfile(err.filename,self.shell.user_ns) |
|
1155 | self.safe_execfile(err.filename,self.shell.user_ns) | |
1140 | except: |
|
1156 | except: | |
1141 | self.showtraceback() |
|
1157 | self.showtraceback() | |
1142 | else: |
|
1158 | else: | |
1143 | f = file(err.filename) |
|
1159 | f = file(err.filename) | |
1144 | try: |
|
1160 | try: | |
1145 | sys.displayhook(f.read()) |
|
1161 | sys.displayhook(f.read()) | |
1146 | finally: |
|
1162 | finally: | |
1147 | f.close() |
|
1163 | f.close() | |
1148 |
|
1164 | |||
1149 | def showsyntaxerror(self, filename=None): |
|
1165 | def showsyntaxerror(self, filename=None): | |
1150 | """Display the syntax error that just occurred. |
|
1166 | """Display the syntax error that just occurred. | |
1151 |
|
1167 | |||
1152 | This doesn't display a stack trace because there isn't one. |
|
1168 | This doesn't display a stack trace because there isn't one. | |
1153 |
|
1169 | |||
1154 | If a filename is given, it is stuffed in the exception instead |
|
1170 | If a filename is given, it is stuffed in the exception instead | |
1155 | of what was there before (because Python's parser always uses |
|
1171 | of what was there before (because Python's parser always uses | |
1156 | "<string>" when reading from a string). |
|
1172 | "<string>" when reading from a string). | |
1157 | """ |
|
1173 | """ | |
1158 | type, value, sys.last_traceback = sys.exc_info() |
|
1174 | type, value, sys.last_traceback = sys.exc_info() | |
1159 | sys.last_type = type |
|
1175 | sys.last_type = type | |
1160 | sys.last_value = value |
|
1176 | sys.last_value = value | |
1161 | if filename and type is SyntaxError: |
|
1177 | if filename and type is SyntaxError: | |
1162 | # Work hard to stuff the correct filename in the exception |
|
1178 | # Work hard to stuff the correct filename in the exception | |
1163 | try: |
|
1179 | try: | |
1164 | msg, (dummy_filename, lineno, offset, line) = value |
|
1180 | msg, (dummy_filename, lineno, offset, line) = value | |
1165 | except: |
|
1181 | except: | |
1166 | # Not the format we expect; leave it alone |
|
1182 | # Not the format we expect; leave it alone | |
1167 | pass |
|
1183 | pass | |
1168 | else: |
|
1184 | else: | |
1169 | # Stuff in the right filename |
|
1185 | # Stuff in the right filename | |
1170 | try: |
|
1186 | try: | |
1171 | # Assume SyntaxError is a class exception |
|
1187 | # Assume SyntaxError is a class exception | |
1172 | value = SyntaxError(msg, (filename, lineno, offset, line)) |
|
1188 | value = SyntaxError(msg, (filename, lineno, offset, line)) | |
1173 | except: |
|
1189 | except: | |
1174 | # If that failed, assume SyntaxError is a string |
|
1190 | # If that failed, assume SyntaxError is a string | |
1175 | value = msg, (filename, lineno, offset, line) |
|
1191 | value = msg, (filename, lineno, offset, line) | |
1176 | self.SyntaxTB(type,value,[]) |
|
1192 | self.SyntaxTB(type,value,[]) | |
1177 |
|
1193 | |||
1178 | def debugger(self): |
|
1194 | def debugger(self): | |
1179 | """Call the pdb debugger.""" |
|
1195 | """Call the pdb debugger.""" | |
1180 |
|
1196 | |||
1181 | if not self.rc.pdb: |
|
1197 | if not self.rc.pdb: | |
1182 | return |
|
1198 | return | |
1183 | pdb.pm() |
|
1199 | pdb.pm() | |
1184 |
|
1200 | |||
1185 | def showtraceback(self,exc_tuple = None,filename=None): |
|
1201 | def showtraceback(self,exc_tuple = None,filename=None): | |
1186 | """Display the exception that just occurred.""" |
|
1202 | """Display the exception that just occurred.""" | |
1187 |
|
1203 | |||
1188 | # Though this won't be called by syntax errors in the input line, |
|
1204 | # Though this won't be called by syntax errors in the input line, | |
1189 | # there may be SyntaxError cases whith imported code. |
|
1205 | # there may be SyntaxError cases whith imported code. | |
1190 | if exc_tuple is None: |
|
1206 | if exc_tuple is None: | |
1191 | type, value, tb = sys.exc_info() |
|
1207 | type, value, tb = sys.exc_info() | |
1192 | else: |
|
1208 | else: | |
1193 | type, value, tb = exc_tuple |
|
1209 | type, value, tb = exc_tuple | |
1194 | if type is SyntaxError: |
|
1210 | if type is SyntaxError: | |
1195 | self.showsyntaxerror(filename) |
|
1211 | self.showsyntaxerror(filename) | |
1196 | else: |
|
1212 | else: | |
1197 | sys.last_type = type |
|
1213 | sys.last_type = type | |
1198 | sys.last_value = value |
|
1214 | sys.last_value = value | |
1199 | sys.last_traceback = tb |
|
1215 | sys.last_traceback = tb | |
1200 | self.InteractiveTB() |
|
1216 | self.InteractiveTB() | |
1201 | if self.InteractiveTB.call_pdb and self.has_readline: |
|
1217 | if self.InteractiveTB.call_pdb and self.has_readline: | |
1202 | # pdb mucks up readline, fix it back |
|
1218 | # pdb mucks up readline, fix it back | |
1203 | self.readline.set_completer(self.Completer.complete) |
|
1219 | self.readline.set_completer(self.Completer.complete) | |
1204 |
|
1220 | |||
1205 | def update_cache(self, line): |
|
1221 | def update_cache(self, line): | |
1206 | """puts line into cache""" |
|
1222 | """puts line into cache""" | |
1207 | self.inputcache.insert(0, line) # This copies the cache every time ... :-( |
|
1223 | self.inputcache.insert(0, line) # This copies the cache every time ... :-( | |
1208 | if len(self.inputcache) >= self.CACHELENGTH: |
|
1224 | if len(self.inputcache) >= self.CACHELENGTH: | |
1209 | self.inputcache.pop() # This doesn't :-) |
|
1225 | self.inputcache.pop() # This doesn't :-) | |
1210 |
|
1226 | |||
1211 | def mainloop(self,banner=None): |
|
1227 | def mainloop(self,banner=None): | |
1212 | """Creates the local namespace and starts the mainloop. |
|
1228 | """Creates the local namespace and starts the mainloop. | |
1213 |
|
1229 | |||
1214 | If an optional banner argument is given, it will override the |
|
1230 | If an optional banner argument is given, it will override the | |
1215 | internally created default banner.""" |
|
1231 | internally created default banner.""" | |
1216 |
|
1232 | |||
1217 | if self.rc.c: # Emulate Python's -c option |
|
1233 | if self.rc.c: # Emulate Python's -c option | |
1218 | self.exec_init_cmd() |
|
1234 | self.exec_init_cmd() | |
1219 | if banner is None: |
|
1235 | if banner is None: | |
1220 | if self.rc.banner: |
|
1236 | if self.rc.banner: | |
1221 | banner = self.BANNER+self.banner2 |
|
1237 | banner = self.BANNER+self.banner2 | |
1222 | else: |
|
1238 | else: | |
1223 | banner = '' |
|
1239 | banner = '' | |
1224 | self.interact(banner) |
|
1240 | self.interact(banner) | |
1225 |
|
1241 | |||
1226 | def exec_init_cmd(self): |
|
1242 | def exec_init_cmd(self): | |
1227 | """Execute a command given at the command line. |
|
1243 | """Execute a command given at the command line. | |
1228 |
|
1244 | |||
1229 | This emulates Python's -c option.""" |
|
1245 | This emulates Python's -c option.""" | |
1230 |
|
1246 | |||
1231 | sys.argv = ['-c'] |
|
1247 | sys.argv = ['-c'] | |
1232 | self.push(self.rc.c) |
|
1248 | self.push(self.rc.c) | |
1233 |
|
1249 | |||
1234 | def embed_mainloop(self,header='',local_ns=None,global_ns=None,stack_depth=0): |
|
1250 | def embed_mainloop(self,header='',local_ns=None,global_ns=None,stack_depth=0): | |
1235 | """Embeds IPython into a running python program. |
|
1251 | """Embeds IPython into a running python program. | |
1236 |
|
1252 | |||
1237 | Input: |
|
1253 | Input: | |
1238 |
|
1254 | |||
1239 | - header: An optional header message can be specified. |
|
1255 | - header: An optional header message can be specified. | |
1240 |
|
1256 | |||
1241 | - local_ns, global_ns: working namespaces. If given as None, the |
|
1257 | - local_ns, global_ns: working namespaces. If given as None, the | |
1242 | IPython-initialized one is updated with __main__.__dict__, so that |
|
1258 | IPython-initialized one is updated with __main__.__dict__, so that | |
1243 | program variables become visible but user-specific configuration |
|
1259 | program variables become visible but user-specific configuration | |
1244 | remains possible. |
|
1260 | remains possible. | |
1245 |
|
1261 | |||
1246 | - stack_depth: specifies how many levels in the stack to go to |
|
1262 | - stack_depth: specifies how many levels in the stack to go to | |
1247 | looking for namespaces (when local_ns and global_ns are None). This |
|
1263 | looking for namespaces (when local_ns and global_ns are None). This | |
1248 | allows an intermediate caller to make sure that this function gets |
|
1264 | allows an intermediate caller to make sure that this function gets | |
1249 | the namespace from the intended level in the stack. By default (0) |
|
1265 | the namespace from the intended level in the stack. By default (0) | |
1250 | it will get its locals and globals from the immediate caller. |
|
1266 | it will get its locals and globals from the immediate caller. | |
1251 |
|
1267 | |||
1252 | Warning: it's possible to use this in a program which is being run by |
|
1268 | Warning: it's possible to use this in a program which is being run by | |
1253 | IPython itself (via %run), but some funny things will happen (a few |
|
1269 | IPython itself (via %run), but some funny things will happen (a few | |
1254 | globals get overwritten). In the future this will be cleaned up, as |
|
1270 | globals get overwritten). In the future this will be cleaned up, as | |
1255 | there is no fundamental reason why it can't work perfectly.""" |
|
1271 | there is no fundamental reason why it can't work perfectly.""" | |
1256 |
|
1272 | |||
1257 | # Get locals and globals from caller |
|
1273 | # Get locals and globals from caller | |
1258 | if local_ns is None or global_ns is None: |
|
1274 | if local_ns is None or global_ns is None: | |
1259 | call_frame = sys._getframe(stack_depth).f_back |
|
1275 | call_frame = sys._getframe(stack_depth).f_back | |
1260 |
|
1276 | |||
1261 | if local_ns is None: |
|
1277 | if local_ns is None: | |
1262 | local_ns = call_frame.f_locals |
|
1278 | local_ns = call_frame.f_locals | |
1263 | if global_ns is None: |
|
1279 | if global_ns is None: | |
1264 | global_ns = call_frame.f_globals |
|
1280 | global_ns = call_frame.f_globals | |
1265 |
|
1281 | |||
1266 | # Update namespaces and fire up interpreter |
|
1282 | # Update namespaces and fire up interpreter | |
1267 | self.user_ns = local_ns |
|
1283 | self.user_ns = local_ns | |
1268 | self.user_global_ns = global_ns |
|
1284 | self.user_global_ns = global_ns | |
1269 |
|
1285 | |||
1270 | # Patch for global embedding to make sure that things don't overwrite |
|
1286 | # Patch for global embedding to make sure that things don't overwrite | |
1271 | # user globals accidentally. Thanks to Richard <rxe@renre-europe.com> |
|
1287 | # user globals accidentally. Thanks to Richard <rxe@renre-europe.com> | |
1272 | # FIXME. Test this a bit more carefully (the if.. is new) |
|
1288 | # FIXME. Test this a bit more carefully (the if.. is new) | |
1273 | if local_ns is None and global_ns is None: |
|
1289 | if local_ns is None and global_ns is None: | |
1274 | self.user_global_ns.update(__main__.__dict__) |
|
1290 | self.user_global_ns.update(__main__.__dict__) | |
1275 |
|
1291 | |||
1276 | # make sure the tab-completer has the correct frame information, so it |
|
1292 | # make sure the tab-completer has the correct frame information, so it | |
1277 | # actually completes using the frame's locals/globals |
|
1293 | # actually completes using the frame's locals/globals | |
1278 | self.set_completer_frame(call_frame) |
|
1294 | self.set_completer_frame(call_frame) | |
1279 |
|
1295 | |||
1280 | self.interact(header) |
|
1296 | self.interact(header) | |
1281 |
|
1297 | |||
1282 | def interact(self, banner=None): |
|
1298 | def interact(self, banner=None): | |
1283 | """Closely emulate the interactive Python console. |
|
1299 | """Closely emulate the interactive Python console. | |
1284 |
|
1300 | |||
1285 | The optional banner argument specify the banner to print |
|
1301 | The optional banner argument specify the banner to print | |
1286 | before the first interaction; by default it prints a banner |
|
1302 | before the first interaction; by default it prints a banner | |
1287 | similar to the one printed by the real Python interpreter, |
|
1303 | similar to the one printed by the real Python interpreter, | |
1288 | followed by the current class name in parentheses (so as not |
|
1304 | followed by the current class name in parentheses (so as not | |
1289 | to confuse this with the real interpreter -- since it's so |
|
1305 | to confuse this with the real interpreter -- since it's so | |
1290 | close!). |
|
1306 | close!). | |
1291 |
|
1307 | |||
1292 | """ |
|
1308 | """ | |
1293 | cprt = 'Type "copyright", "credits" or "license" for more information.' |
|
1309 | cprt = 'Type "copyright", "credits" or "license" for more information.' | |
1294 | if banner is None: |
|
1310 | if banner is None: | |
1295 | self.write("Python %s on %s\n%s\n(%s)\n" % |
|
1311 | self.write("Python %s on %s\n%s\n(%s)\n" % | |
1296 | (sys.version, sys.platform, cprt, |
|
1312 | (sys.version, sys.platform, cprt, | |
1297 | self.__class__.__name__)) |
|
1313 | self.__class__.__name__)) | |
1298 | else: |
|
1314 | else: | |
1299 | self.write(banner) |
|
1315 | self.write(banner) | |
1300 |
|
1316 | |||
1301 | more = 0 |
|
1317 | more = 0 | |
1302 |
|
1318 | |||
1303 | # Mark activity in the builtins |
|
1319 | # Mark activity in the builtins | |
1304 | __builtin__.__dict__['__IPYTHON__active'] += 1 |
|
1320 | __builtin__.__dict__['__IPYTHON__active'] += 1 | |
1305 |
|
1321 | |||
1306 | # compiled regexps for autoindent management |
|
1322 | # compiled regexps for autoindent management | |
1307 | ini_spaces_re = re.compile(r'^(\s+)') |
|
1323 | ini_spaces_re = re.compile(r'^(\s+)') | |
1308 | dedent_re = re.compile(r'^\s+raise|^\s+return|^\s+pass') |
|
1324 | dedent_re = re.compile(r'^\s+raise|^\s+return|^\s+pass') | |
1309 |
|
1325 | |||
1310 | # exit_now is set by a call to %Exit or %Quit |
|
1326 | # exit_now is set by a call to %Exit or %Quit | |
1311 | while not self.exit_now: |
|
1327 | while not self.exit_now: | |
1312 | try: |
|
1328 | try: | |
1313 | if more: |
|
1329 | if more: | |
1314 | prompt = self.outputcache.prompt2 |
|
1330 | prompt = self.outputcache.prompt2 | |
1315 | if self.autoindent: |
|
1331 | if self.autoindent: | |
1316 | self.readline_startup_hook(self.pre_readline) |
|
1332 | self.readline_startup_hook(self.pre_readline) | |
1317 | else: |
|
1333 | else: | |
1318 | prompt = self.outputcache.prompt1 |
|
1334 | prompt = self.outputcache.prompt1 | |
1319 | try: |
|
1335 | try: | |
1320 | line = self.raw_input(prompt,more) |
|
1336 | line = self.raw_input(prompt,more) | |
1321 | if self.autoindent: |
|
1337 | if self.autoindent: | |
1322 | self.readline_startup_hook(None) |
|
1338 | self.readline_startup_hook(None) | |
1323 | except EOFError: |
|
1339 | except EOFError: | |
1324 | if self.autoindent: |
|
1340 | if self.autoindent: | |
1325 | self.readline_startup_hook(None) |
|
1341 | self.readline_startup_hook(None) | |
1326 | self.write("\n") |
|
1342 | self.write("\n") | |
1327 | self.exit() |
|
1343 | self.exit() | |
1328 | else: |
|
1344 | else: | |
1329 | more = self.push(line) |
|
1345 | more = self.push(line) | |
1330 | # Auto-indent management |
|
1346 | # Auto-indent management | |
1331 | if self.autoindent: |
|
1347 | if self.autoindent: | |
1332 | if line: |
|
1348 | if line: | |
1333 | ini_spaces = ini_spaces_re.match(line) |
|
1349 | ini_spaces = ini_spaces_re.match(line) | |
1334 | if ini_spaces: |
|
1350 | if ini_spaces: | |
1335 | nspaces = ini_spaces.end() |
|
1351 | nspaces = ini_spaces.end() | |
1336 | else: |
|
1352 | else: | |
1337 | nspaces = 0 |
|
1353 | nspaces = 0 | |
1338 | self.indent_current_nsp = nspaces |
|
1354 | self.indent_current_nsp = nspaces | |
1339 |
|
1355 | |||
1340 | if line[-1] == ':': |
|
1356 | if line[-1] == ':': | |
1341 | self.indent_current_nsp += 4 |
|
1357 | self.indent_current_nsp += 4 | |
1342 | elif dedent_re.match(line): |
|
1358 | elif dedent_re.match(line): | |
1343 | self.indent_current_nsp -= 4 |
|
1359 | self.indent_current_nsp -= 4 | |
1344 | else: |
|
1360 | else: | |
1345 | self.indent_current_nsp = 0 |
|
1361 | self.indent_current_nsp = 0 | |
1346 |
|
1362 | |||
1347 | # indent_current is the actual string to be inserted |
|
1363 | # indent_current is the actual string to be inserted | |
1348 | # by the readline hooks for indentation |
|
1364 | # by the readline hooks for indentation | |
1349 | self.indent_current = ' '* self.indent_current_nsp |
|
1365 | self.indent_current = ' '* self.indent_current_nsp | |
1350 |
|
1366 | |||
1351 | if (self.SyntaxTB.last_syntax_error and |
|
1367 | if (self.SyntaxTB.last_syntax_error and | |
1352 | self.rc.autoedit_syntax): |
|
1368 | self.rc.autoedit_syntax): | |
1353 | self.edit_syntax_error() |
|
1369 | self.edit_syntax_error() | |
1354 |
|
1370 | |||
1355 | except KeyboardInterrupt: |
|
1371 | except KeyboardInterrupt: | |
1356 | self.write("\nKeyboardInterrupt\n") |
|
1372 | self.write("\nKeyboardInterrupt\n") | |
1357 | self.resetbuffer() |
|
1373 | self.resetbuffer() | |
1358 | more = 0 |
|
1374 | more = 0 | |
1359 | # keep cache in sync with the prompt counter: |
|
1375 | # keep cache in sync with the prompt counter: | |
1360 | self.outputcache.prompt_count -= 1 |
|
1376 | self.outputcache.prompt_count -= 1 | |
1361 |
|
1377 | |||
1362 | if self.autoindent: |
|
1378 | if self.autoindent: | |
1363 | self.indent_current_nsp = 0 |
|
1379 | self.indent_current_nsp = 0 | |
1364 | self.indent_current = ' '* self.indent_current_nsp |
|
1380 | self.indent_current = ' '* self.indent_current_nsp | |
1365 |
|
1381 | |||
1366 | except bdb.BdbQuit: |
|
1382 | except bdb.BdbQuit: | |
1367 | warn("The Python debugger has exited with a BdbQuit exception.\n" |
|
1383 | warn("The Python debugger has exited with a BdbQuit exception.\n" | |
1368 | "Because of how pdb handles the stack, it is impossible\n" |
|
1384 | "Because of how pdb handles the stack, it is impossible\n" | |
1369 | "for IPython to properly format this particular exception.\n" |
|
1385 | "for IPython to properly format this particular exception.\n" | |
1370 | "IPython will resume normal operation.") |
|
1386 | "IPython will resume normal operation.") | |
1371 |
|
1387 | |||
1372 | # We are off again... |
|
1388 | # We are off again... | |
1373 | __builtin__.__dict__['__IPYTHON__active'] -= 1 |
|
1389 | __builtin__.__dict__['__IPYTHON__active'] -= 1 | |
1374 |
|
1390 | |||
1375 | def excepthook(self, type, value, tb): |
|
1391 | def excepthook(self, type, value, tb): | |
1376 | """One more defense for GUI apps that call sys.excepthook. |
|
1392 | """One more defense for GUI apps that call sys.excepthook. | |
1377 |
|
1393 | |||
1378 | GUI frameworks like wxPython trap exceptions and call |
|
1394 | GUI frameworks like wxPython trap exceptions and call | |
1379 | sys.excepthook themselves. I guess this is a feature that |
|
1395 | sys.excepthook themselves. I guess this is a feature that | |
1380 | enables them to keep running after exceptions that would |
|
1396 | enables them to keep running after exceptions that would | |
1381 | otherwise kill their mainloop. This is a bother for IPython |
|
1397 | otherwise kill their mainloop. This is a bother for IPython | |
1382 | which excepts to catch all of the program exceptions with a try: |
|
1398 | which excepts to catch all of the program exceptions with a try: | |
1383 | except: statement. |
|
1399 | except: statement. | |
1384 |
|
1400 | |||
1385 | Normally, IPython sets sys.excepthook to a CrashHandler instance, so if |
|
1401 | Normally, IPython sets sys.excepthook to a CrashHandler instance, so if | |
1386 | any app directly invokes sys.excepthook, it will look to the user like |
|
1402 | any app directly invokes sys.excepthook, it will look to the user like | |
1387 | IPython crashed. In order to work around this, we can disable the |
|
1403 | IPython crashed. In order to work around this, we can disable the | |
1388 | CrashHandler and replace it with this excepthook instead, which prints a |
|
1404 | CrashHandler and replace it with this excepthook instead, which prints a | |
1389 | regular traceback using our InteractiveTB. In this fashion, apps which |
|
1405 | regular traceback using our InteractiveTB. In this fashion, apps which | |
1390 | call sys.excepthook will generate a regular-looking exception from |
|
1406 | call sys.excepthook will generate a regular-looking exception from | |
1391 | IPython, and the CrashHandler will only be triggered by real IPython |
|
1407 | IPython, and the CrashHandler will only be triggered by real IPython | |
1392 | crashes. |
|
1408 | crashes. | |
1393 |
|
1409 | |||
1394 | This hook should be used sparingly, only in places which are not likely |
|
1410 | This hook should be used sparingly, only in places which are not likely | |
1395 | to be true IPython errors. |
|
1411 | to be true IPython errors. | |
1396 | """ |
|
1412 | """ | |
1397 |
|
1413 | |||
1398 | self.InteractiveTB(type, value, tb, tb_offset=0) |
|
1414 | self.InteractiveTB(type, value, tb, tb_offset=0) | |
1399 | if self.InteractiveTB.call_pdb and self.has_readline: |
|
1415 | if self.InteractiveTB.call_pdb and self.has_readline: | |
1400 | self.readline.set_completer(self.Completer.complete) |
|
1416 | self.readline.set_completer(self.Completer.complete) | |
1401 |
|
1417 | |||
1402 | def call_alias(self,alias,rest=''): |
|
1418 | def call_alias(self,alias,rest=''): | |
1403 | """Call an alias given its name and the rest of the line. |
|
1419 | """Call an alias given its name and the rest of the line. | |
1404 |
|
1420 | |||
1405 | This function MUST be given a proper alias, because it doesn't make |
|
1421 | This function MUST be given a proper alias, because it doesn't make | |
1406 | any checks when looking up into the alias table. The caller is |
|
1422 | any checks when looking up into the alias table. The caller is | |
1407 | responsible for invoking it only with a valid alias.""" |
|
1423 | responsible for invoking it only with a valid alias.""" | |
1408 |
|
1424 | |||
1409 | #print 'ALIAS: <%s>+<%s>' % (alias,rest) # dbg |
|
1425 | #print 'ALIAS: <%s>+<%s>' % (alias,rest) # dbg | |
1410 | nargs,cmd = self.alias_table[alias] |
|
1426 | nargs,cmd = self.alias_table[alias] | |
1411 | # Expand the %l special to be the user's input line |
|
1427 | # Expand the %l special to be the user's input line | |
1412 | if cmd.find('%l') >= 0: |
|
1428 | if cmd.find('%l') >= 0: | |
1413 | cmd = cmd.replace('%l',rest) |
|
1429 | cmd = cmd.replace('%l',rest) | |
1414 | rest = '' |
|
1430 | rest = '' | |
1415 | if nargs==0: |
|
1431 | if nargs==0: | |
1416 | # Simple, argument-less aliases |
|
1432 | # Simple, argument-less aliases | |
1417 | cmd = '%s %s' % (cmd,rest) |
|
1433 | cmd = '%s %s' % (cmd,rest) | |
1418 | else: |
|
1434 | else: | |
1419 | # Handle aliases with positional arguments |
|
1435 | # Handle aliases with positional arguments | |
1420 | args = rest.split(None,nargs) |
|
1436 | args = rest.split(None,nargs) | |
1421 | if len(args)< nargs: |
|
1437 | if len(args)< nargs: | |
1422 | error('Alias <%s> requires %s arguments, %s given.' % |
|
1438 | error('Alias <%s> requires %s arguments, %s given.' % | |
1423 | (alias,nargs,len(args))) |
|
1439 | (alias,nargs,len(args))) | |
1424 | return |
|
1440 | return | |
1425 | cmd = '%s %s' % (cmd % tuple(args[:nargs]),' '.join(args[nargs:])) |
|
1441 | cmd = '%s %s' % (cmd % tuple(args[:nargs]),' '.join(args[nargs:])) | |
1426 | # Now call the macro, evaluating in the user's namespace |
|
1442 | # Now call the macro, evaluating in the user's namespace | |
1427 | try: |
|
1443 | try: | |
1428 | self.system(cmd) |
|
1444 | self.system(cmd) | |
1429 | except: |
|
1445 | except: | |
1430 | self.showtraceback() |
|
1446 | self.showtraceback() | |
1431 |
|
1447 | |||
1432 | def runlines(self,lines): |
|
1448 | def runlines(self,lines): | |
1433 | """Run a string of one or more lines of source. |
|
1449 | """Run a string of one or more lines of source. | |
1434 |
|
1450 | |||
1435 | This method is capable of running a string containing multiple source |
|
1451 | This method is capable of running a string containing multiple source | |
1436 | lines, as if they had been entered at the IPython prompt. Since it |
|
1452 | lines, as if they had been entered at the IPython prompt. Since it | |
1437 | exposes IPython's processing machinery, the given strings can contain |
|
1453 | exposes IPython's processing machinery, the given strings can contain | |
1438 | magic calls (%magic), special shell access (!cmd), etc.""" |
|
1454 | magic calls (%magic), special shell access (!cmd), etc.""" | |
1439 |
|
1455 | |||
1440 | # We must start with a clean buffer, in case this is run from an |
|
1456 | # We must start with a clean buffer, in case this is run from an | |
1441 | # interactive IPython session (via a magic, for example). |
|
1457 | # interactive IPython session (via a magic, for example). | |
1442 | self.resetbuffer() |
|
1458 | self.resetbuffer() | |
1443 | lines = lines.split('\n') |
|
1459 | lines = lines.split('\n') | |
1444 | more = 0 |
|
1460 | more = 0 | |
1445 | for line in lines: |
|
1461 | for line in lines: | |
1446 | # skip blank lines so we don't mess up the prompt counter, but do |
|
1462 | # skip blank lines so we don't mess up the prompt counter, but do | |
1447 | # NOT skip even a blank line if we are in a code block (more is |
|
1463 | # NOT skip even a blank line if we are in a code block (more is | |
1448 | # true) |
|
1464 | # true) | |
1449 | if line or more: |
|
1465 | if line or more: | |
1450 | more = self.push((self.prefilter(line,more))) |
|
1466 | more = self.push((self.prefilter(line,more))) | |
1451 | # IPython's runsource returns None if there was an error |
|
1467 | # IPython's runsource returns None if there was an error | |
1452 | # compiling the code. This allows us to stop processing right |
|
1468 | # compiling the code. This allows us to stop processing right | |
1453 | # away, so the user gets the error message at the right place. |
|
1469 | # away, so the user gets the error message at the right place. | |
1454 | if more is None: |
|
1470 | if more is None: | |
1455 | break |
|
1471 | break | |
1456 | # final newline in case the input didn't have it, so that the code |
|
1472 | # final newline in case the input didn't have it, so that the code | |
1457 | # actually does get executed |
|
1473 | # actually does get executed | |
1458 | if more: |
|
1474 | if more: | |
1459 | self.push('\n') |
|
1475 | self.push('\n') | |
1460 |
|
1476 | |||
1461 | def runsource(self, source, filename='<input>', symbol='single'): |
|
1477 | def runsource(self, source, filename='<input>', symbol='single'): | |
1462 | """Compile and run some source in the interpreter. |
|
1478 | """Compile and run some source in the interpreter. | |
1463 |
|
1479 | |||
1464 | Arguments are as for compile_command(). |
|
1480 | Arguments are as for compile_command(). | |
1465 |
|
1481 | |||
1466 | One several things can happen: |
|
1482 | One several things can happen: | |
1467 |
|
1483 | |||
1468 | 1) The input is incorrect; compile_command() raised an |
|
1484 | 1) The input is incorrect; compile_command() raised an | |
1469 | exception (SyntaxError or OverflowError). A syntax traceback |
|
1485 | exception (SyntaxError or OverflowError). A syntax traceback | |
1470 | will be printed by calling the showsyntaxerror() method. |
|
1486 | will be printed by calling the showsyntaxerror() method. | |
1471 |
|
1487 | |||
1472 | 2) The input is incomplete, and more input is required; |
|
1488 | 2) The input is incomplete, and more input is required; | |
1473 | compile_command() returned None. Nothing happens. |
|
1489 | compile_command() returned None. Nothing happens. | |
1474 |
|
1490 | |||
1475 | 3) The input is complete; compile_command() returned a code |
|
1491 | 3) The input is complete; compile_command() returned a code | |
1476 | object. The code is executed by calling self.runcode() (which |
|
1492 | object. The code is executed by calling self.runcode() (which | |
1477 | also handles run-time exceptions, except for SystemExit). |
|
1493 | also handles run-time exceptions, except for SystemExit). | |
1478 |
|
1494 | |||
1479 | The return value is: |
|
1495 | The return value is: | |
1480 |
|
1496 | |||
1481 | - True in case 2 |
|
1497 | - True in case 2 | |
1482 |
|
1498 | |||
1483 | - False in the other cases, unless an exception is raised, where |
|
1499 | - False in the other cases, unless an exception is raised, where | |
1484 | None is returned instead. This can be used by external callers to |
|
1500 | None is returned instead. This can be used by external callers to | |
1485 | know whether to continue feeding input or not. |
|
1501 | know whether to continue feeding input or not. | |
1486 |
|
1502 | |||
1487 | The return value can be used to decide whether to use sys.ps1 or |
|
1503 | The return value can be used to decide whether to use sys.ps1 or | |
1488 | sys.ps2 to prompt the next line.""" |
|
1504 | sys.ps2 to prompt the next line.""" | |
1489 |
|
1505 | |||
1490 | try: |
|
1506 | try: | |
1491 | code = self.compile(source,filename,symbol) |
|
1507 | code = self.compile(source,filename,symbol) | |
1492 | except (OverflowError, SyntaxError, ValueError): |
|
1508 | except (OverflowError, SyntaxError, ValueError): | |
1493 | # Case 1 |
|
1509 | # Case 1 | |
1494 | self.showsyntaxerror(filename) |
|
1510 | self.showsyntaxerror(filename) | |
1495 | return None |
|
1511 | return None | |
1496 |
|
1512 | |||
1497 | if code is None: |
|
1513 | if code is None: | |
1498 | # Case 2 |
|
1514 | # Case 2 | |
1499 | return True |
|
1515 | return True | |
1500 |
|
1516 | |||
1501 | # Case 3 |
|
1517 | # Case 3 | |
1502 | # We store the code object so that threaded shells and |
|
1518 | # We store the code object so that threaded shells and | |
1503 | # custom exception handlers can access all this info if needed. |
|
1519 | # custom exception handlers can access all this info if needed. | |
1504 | # The source corresponding to this can be obtained from the |
|
1520 | # The source corresponding to this can be obtained from the | |
1505 | # buffer attribute as '\n'.join(self.buffer). |
|
1521 | # buffer attribute as '\n'.join(self.buffer). | |
1506 | self.code_to_run = code |
|
1522 | self.code_to_run = code | |
1507 | # now actually execute the code object |
|
1523 | # now actually execute the code object | |
1508 | if self.runcode(code) == 0: |
|
1524 | if self.runcode(code) == 0: | |
1509 | return False |
|
1525 | return False | |
1510 | else: |
|
1526 | else: | |
1511 | return None |
|
1527 | return None | |
1512 |
|
1528 | |||
1513 | def runcode(self,code_obj): |
|
1529 | def runcode(self,code_obj): | |
1514 | """Execute a code object. |
|
1530 | """Execute a code object. | |
1515 |
|
1531 | |||
1516 | When an exception occurs, self.showtraceback() is called to display a |
|
1532 | When an exception occurs, self.showtraceback() is called to display a | |
1517 | traceback. |
|
1533 | traceback. | |
1518 |
|
1534 | |||
1519 | Return value: a flag indicating whether the code to be run completed |
|
1535 | Return value: a flag indicating whether the code to be run completed | |
1520 | successfully: |
|
1536 | successfully: | |
1521 |
|
1537 | |||
1522 | - 0: successful execution. |
|
1538 | - 0: successful execution. | |
1523 | - 1: an error occurred. |
|
1539 | - 1: an error occurred. | |
1524 | """ |
|
1540 | """ | |
1525 |
|
1541 | |||
1526 | # Set our own excepthook in case the user code tries to call it |
|
1542 | # Set our own excepthook in case the user code tries to call it | |
1527 | # directly, so that the IPython crash handler doesn't get triggered |
|
1543 | # directly, so that the IPython crash handler doesn't get triggered | |
1528 | old_excepthook,sys.excepthook = sys.excepthook, self.excepthook |
|
1544 | old_excepthook,sys.excepthook = sys.excepthook, self.excepthook | |
1529 |
|
1545 | |||
1530 | # we save the original sys.excepthook in the instance, in case config |
|
1546 | # we save the original sys.excepthook in the instance, in case config | |
1531 | # code (such as magics) needs access to it. |
|
1547 | # code (such as magics) needs access to it. | |
1532 | self.sys_excepthook = old_excepthook |
|
1548 | self.sys_excepthook = old_excepthook | |
1533 | outflag = 1 # happens in more places, so it's easier as default |
|
1549 | outflag = 1 # happens in more places, so it's easier as default | |
1534 | try: |
|
1550 | try: | |
1535 | try: |
|
1551 | try: | |
1536 | # Embedded instances require separate global/local namespaces |
|
1552 | # Embedded instances require separate global/local namespaces | |
1537 | # so they can see both the surrounding (local) namespace and |
|
1553 | # so they can see both the surrounding (local) namespace and | |
1538 | # the module-level globals when called inside another function. |
|
1554 | # the module-level globals when called inside another function. | |
1539 | if self.embedded: |
|
1555 | if self.embedded: | |
1540 | exec code_obj in self.user_global_ns, self.user_ns |
|
1556 | exec code_obj in self.user_global_ns, self.user_ns | |
1541 | # Normal (non-embedded) instances should only have a single |
|
1557 | # Normal (non-embedded) instances should only have a single | |
1542 | # namespace for user code execution, otherwise functions won't |
|
1558 | # namespace for user code execution, otherwise functions won't | |
1543 | # see interactive top-level globals. |
|
1559 | # see interactive top-level globals. | |
1544 | else: |
|
1560 | else: | |
1545 | exec code_obj in self.user_ns |
|
1561 | exec code_obj in self.user_ns | |
1546 | finally: |
|
1562 | finally: | |
1547 | # Reset our crash handler in place |
|
1563 | # Reset our crash handler in place | |
1548 | sys.excepthook = old_excepthook |
|
1564 | sys.excepthook = old_excepthook | |
1549 | except SystemExit: |
|
1565 | except SystemExit: | |
1550 | self.resetbuffer() |
|
1566 | self.resetbuffer() | |
1551 | self.showtraceback() |
|
1567 | self.showtraceback() | |
1552 | warn("Type exit or quit to exit IPython " |
|
1568 | warn("Type exit or quit to exit IPython " | |
1553 | "(%Exit or %Quit do so unconditionally).",level=1) |
|
1569 | "(%Exit or %Quit do so unconditionally).",level=1) | |
1554 | except self.custom_exceptions: |
|
1570 | except self.custom_exceptions: | |
1555 | etype,value,tb = sys.exc_info() |
|
1571 | etype,value,tb = sys.exc_info() | |
1556 | self.CustomTB(etype,value,tb) |
|
1572 | self.CustomTB(etype,value,tb) | |
1557 | except: |
|
1573 | except: | |
1558 | self.showtraceback() |
|
1574 | self.showtraceback() | |
1559 | else: |
|
1575 | else: | |
1560 | outflag = 0 |
|
1576 | outflag = 0 | |
1561 | if softspace(sys.stdout, 0): |
|
1577 | if softspace(sys.stdout, 0): | |
1562 |
|
1578 | |||
1563 | # Flush out code object which has been run (and source) |
|
1579 | # Flush out code object which has been run (and source) | |
1564 | self.code_to_run = None |
|
1580 | self.code_to_run = None | |
1565 | return outflag |
|
1581 | return outflag | |
1566 |
|
1582 | |||
1567 | def push(self, line): |
|
1583 | def push(self, line): | |
1568 | """Push a line to the interpreter. |
|
1584 | """Push a line to the interpreter. | |
1569 |
|
1585 | |||
1570 | The line should not have a trailing newline; it may have |
|
1586 | The line should not have a trailing newline; it may have | |
1571 | internal newlines. The line is appended to a buffer and the |
|
1587 | internal newlines. The line is appended to a buffer and the | |
1572 | interpreter's runsource() method is called with the |
|
1588 | interpreter's runsource() method is called with the | |
1573 | concatenated contents of the buffer as source. If this |
|
1589 | concatenated contents of the buffer as source. If this | |
1574 | indicates that the command was executed or invalid, the buffer |
|
1590 | indicates that the command was executed or invalid, the buffer | |
1575 | is reset; otherwise, the command is incomplete, and the buffer |
|
1591 | is reset; otherwise, the command is incomplete, and the buffer | |
1576 | is left as it was after the line was appended. The return |
|
1592 | is left as it was after the line was appended. The return | |
1577 | value is 1 if more input is required, 0 if the line was dealt |
|
1593 | value is 1 if more input is required, 0 if the line was dealt | |
1578 | with in some way (this is the same as runsource()). |
|
1594 | with in some way (this is the same as runsource()). | |
1579 |
|
1595 | |||
1580 | """ |
|
1596 | """ | |
1581 | self.buffer.append(line) |
|
1597 | self.buffer.append(line) | |
1582 | more = self.runsource('\n'.join(self.buffer), self.filename) |
|
1598 | more = self.runsource('\n'.join(self.buffer), self.filename) | |
1583 | if not more: |
|
1599 | if not more: | |
1584 | self.resetbuffer() |
|
1600 | self.resetbuffer() | |
1585 | return more |
|
1601 | return more | |
1586 |
|
1602 | |||
1587 | def resetbuffer(self): |
|
1603 | def resetbuffer(self): | |
1588 | """Reset the input buffer.""" |
|
1604 | """Reset the input buffer.""" | |
1589 | self.buffer[:] = [] |
|
1605 | self.buffer[:] = [] | |
1590 |
|
1606 | |||
1591 | def raw_input(self,prompt='',continue_prompt=False): |
|
1607 | def raw_input(self,prompt='',continue_prompt=False): | |
1592 | """Write a prompt and read a line. |
|
1608 | """Write a prompt and read a line. | |
1593 |
|
1609 | |||
1594 | The returned line does not include the trailing newline. |
|
1610 | The returned line does not include the trailing newline. | |
1595 | When the user enters the EOF key sequence, EOFError is raised. |
|
1611 | When the user enters the EOF key sequence, EOFError is raised. | |
1596 |
|
1612 | |||
1597 | Optional inputs: |
|
1613 | Optional inputs: | |
1598 |
|
1614 | |||
1599 | - prompt(''): a string to be printed to prompt the user. |
|
1615 | - prompt(''): a string to be printed to prompt the user. | |
1600 |
|
1616 | |||
1601 | - continue_prompt(False): whether this line is the first one or a |
|
1617 | - continue_prompt(False): whether this line is the first one or a | |
1602 | continuation in a sequence of inputs. |
|
1618 | continuation in a sequence of inputs. | |
1603 | """ |
|
1619 | """ | |
1604 |
|
1620 | |||
1605 | line = raw_input_original(prompt) |
|
1621 | line = raw_input_original(prompt) | |
1606 | # Try to be reasonably smart about not re-indenting pasted input more |
|
1622 | # Try to be reasonably smart about not re-indenting pasted input more | |
1607 | # than necessary. We do this by trimming out the auto-indent initial |
|
1623 | # than necessary. We do this by trimming out the auto-indent initial | |
1608 | # spaces, if the user's actual input started itself with whitespace. |
|
1624 | # spaces, if the user's actual input started itself with whitespace. | |
1609 | if self.autoindent: |
|
1625 | if self.autoindent: | |
1610 | line2 = line[self.indent_current_nsp:] |
|
1626 | line2 = line[self.indent_current_nsp:] | |
1611 | if line2[0:1] in (' ','\t'): |
|
1627 | if line2[0:1] in (' ','\t'): | |
1612 | line = line2 |
|
1628 | line = line2 | |
1613 | return self.prefilter(line,continue_prompt) |
|
1629 | return self.prefilter(line,continue_prompt) | |
1614 |
|
1630 | |||
1615 | def split_user_input(self,line): |
|
1631 | def split_user_input(self,line): | |
1616 | """Split user input into pre-char, function part and rest.""" |
|
1632 | """Split user input into pre-char, function part and rest.""" | |
1617 |
|
1633 | |||
1618 | lsplit = self.line_split.match(line) |
|
1634 | lsplit = self.line_split.match(line) | |
1619 | if lsplit is None: # no regexp match returns None |
|
1635 | if lsplit is None: # no regexp match returns None | |
1620 | try: |
|
1636 | try: | |
1621 | iFun,theRest = line.split(None,1) |
|
1637 | iFun,theRest = line.split(None,1) | |
1622 | except ValueError: |
|
1638 | except ValueError: | |
1623 | iFun,theRest = line,'' |
|
1639 | iFun,theRest = line,'' | |
1624 | pre = re.match('^(\s*)(.*)',line).groups()[0] |
|
1640 | pre = re.match('^(\s*)(.*)',line).groups()[0] | |
1625 | else: |
|
1641 | else: | |
1626 | pre,iFun,theRest = lsplit.groups() |
|
1642 | pre,iFun,theRest = lsplit.groups() | |
1627 |
|
1643 | |||
1628 | #print 'line:<%s>' % line # dbg |
|
1644 | #print 'line:<%s>' % line # dbg | |
1629 | #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun.strip(),theRest) # dbg |
|
1645 | #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun.strip(),theRest) # dbg | |
1630 | return pre,iFun.strip(),theRest |
|
1646 | return pre,iFun.strip(),theRest | |
1631 |
|
1647 | |||
1632 | def _prefilter(self, line, continue_prompt): |
|
1648 | def _prefilter(self, line, continue_prompt): | |
1633 | """Calls different preprocessors, depending on the form of line.""" |
|
1649 | """Calls different preprocessors, depending on the form of line.""" | |
1634 |
|
1650 | |||
1635 | # All handlers *must* return a value, even if it's blank (''). |
|
1651 | # All handlers *must* return a value, even if it's blank (''). | |
1636 |
|
1652 | |||
1637 | # Lines are NOT logged here. Handlers should process the line as |
|
1653 | # Lines are NOT logged here. Handlers should process the line as | |
1638 | # needed, update the cache AND log it (so that the input cache array |
|
1654 | # needed, update the cache AND log it (so that the input cache array | |
1639 | # stays synced). |
|
1655 | # stays synced). | |
1640 |
|
1656 | |||
1641 | # This function is _very_ delicate, and since it's also the one which |
|
1657 | # This function is _very_ delicate, and since it's also the one which | |
1642 | # determines IPython's response to user input, it must be as efficient |
|
1658 | # determines IPython's response to user input, it must be as efficient | |
1643 | # as possible. For this reason it has _many_ returns in it, trying |
|
1659 | # as possible. For this reason it has _many_ returns in it, trying | |
1644 | # always to exit as quickly as it can figure out what it needs to do. |
|
1660 | # always to exit as quickly as it can figure out what it needs to do. | |
1645 |
|
1661 | |||
1646 | # This function is the main responsible for maintaining IPython's |
|
1662 | # This function is the main responsible for maintaining IPython's | |
1647 | # behavior respectful of Python's semantics. So be _very_ careful if |
|
1663 | # behavior respectful of Python's semantics. So be _very_ careful if | |
1648 | # making changes to anything here. |
|
1664 | # making changes to anything here. | |
1649 |
|
1665 | |||
1650 | #..................................................................... |
|
1666 | #..................................................................... | |
1651 | # Code begins |
|
1667 | # Code begins | |
1652 |
|
1668 | |||
1653 | #if line.startswith('%crash'): raise RuntimeError,'Crash now!' # dbg |
|
1669 | #if line.startswith('%crash'): raise RuntimeError,'Crash now!' # dbg | |
1654 |
|
1670 | |||
1655 | # save the line away in case we crash, so the post-mortem handler can |
|
1671 | # save the line away in case we crash, so the post-mortem handler can | |
1656 | # record it |
|
1672 | # record it | |
1657 | self._last_input_line = line |
|
1673 | self._last_input_line = line | |
1658 |
|
1674 | |||
1659 | #print '***line: <%s>' % line # dbg |
|
1675 | #print '***line: <%s>' % line # dbg | |
1660 |
|
1676 | |||
1661 | # the input history needs to track even empty lines |
|
1677 | # the input history needs to track even empty lines | |
1662 | if not line.strip(): |
|
1678 | if not line.strip(): | |
1663 | if not continue_prompt: |
|
1679 | if not continue_prompt: | |
1664 | self.outputcache.prompt_count -= 1 |
|
1680 | self.outputcache.prompt_count -= 1 | |
1665 | return self.handle_normal(line,continue_prompt) |
|
1681 | return self.handle_normal(line,continue_prompt) | |
1666 | #return self.handle_normal('',continue_prompt) |
|
1682 | #return self.handle_normal('',continue_prompt) | |
1667 |
|
1683 | |||
1668 | # print '***cont',continue_prompt # dbg |
|
1684 | # print '***cont',continue_prompt # dbg | |
1669 | # special handlers are only allowed for single line statements |
|
1685 | # special handlers are only allowed for single line statements | |
1670 | if continue_prompt and not self.rc.multi_line_specials: |
|
1686 | if continue_prompt and not self.rc.multi_line_specials: | |
1671 | return self.handle_normal(line,continue_prompt) |
|
1687 | return self.handle_normal(line,continue_prompt) | |
1672 |
|
1688 | |||
1673 | # For the rest, we need the structure of the input |
|
1689 | # For the rest, we need the structure of the input | |
1674 | pre,iFun,theRest = self.split_user_input(line) |
|
1690 | pre,iFun,theRest = self.split_user_input(line) | |
1675 | #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg |
|
1691 | #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg | |
1676 |
|
1692 | |||
1677 | # First check for explicit escapes in the last/first character |
|
1693 | # First check for explicit escapes in the last/first character | |
1678 | handler = None |
|
1694 | handler = None | |
1679 | if line[-1] == self.ESC_HELP: |
|
1695 | if line[-1] == self.ESC_HELP: | |
1680 | handler = self.esc_handlers.get(line[-1]) # the ? can be at the end |
|
1696 | handler = self.esc_handlers.get(line[-1]) # the ? can be at the end | |
1681 | if handler is None: |
|
1697 | if handler is None: | |
1682 | # look at the first character of iFun, NOT of line, so we skip |
|
1698 | # look at the first character of iFun, NOT of line, so we skip | |
1683 | # leading whitespace in multiline input |
|
1699 | # leading whitespace in multiline input | |
1684 | handler = self.esc_handlers.get(iFun[0:1]) |
|
1700 | handler = self.esc_handlers.get(iFun[0:1]) | |
1685 | if handler is not None: |
|
1701 | if handler is not None: | |
1686 | return handler(line,continue_prompt,pre,iFun,theRest) |
|
1702 | return handler(line,continue_prompt,pre,iFun,theRest) | |
1687 | # Emacs ipython-mode tags certain input lines |
|
1703 | # Emacs ipython-mode tags certain input lines | |
1688 | if line.endswith('# PYTHON-MODE'): |
|
1704 | if line.endswith('# PYTHON-MODE'): | |
1689 | return self.handle_emacs(line,continue_prompt) |
|
1705 | return self.handle_emacs(line,continue_prompt) | |
1690 |
|
1706 | |||
1691 | # Next, check if we can automatically execute this thing |
|
1707 | # Next, check if we can automatically execute this thing | |
1692 |
|
1708 | |||
1693 | # Allow ! in multi-line statements if multi_line_specials is on: |
|
1709 | # Allow ! in multi-line statements if multi_line_specials is on: | |
1694 | if continue_prompt and self.rc.multi_line_specials and \ |
|
1710 | if continue_prompt and self.rc.multi_line_specials and \ | |
1695 | iFun.startswith(self.ESC_SHELL): |
|
1711 | iFun.startswith(self.ESC_SHELL): | |
1696 | return self.handle_shell_escape(line,continue_prompt, |
|
1712 | return self.handle_shell_escape(line,continue_prompt, | |
1697 | pre=pre,iFun=iFun, |
|
1713 | pre=pre,iFun=iFun, | |
1698 | theRest=theRest) |
|
1714 | theRest=theRest) | |
1699 |
|
1715 | |||
1700 | # Let's try to find if the input line is a magic fn |
|
1716 | # Let's try to find if the input line is a magic fn | |
1701 | oinfo = None |
|
1717 | oinfo = None | |
1702 | if hasattr(self,'magic_'+iFun): |
|
1718 | if hasattr(self,'magic_'+iFun): | |
1703 | oinfo = self._ofind(iFun) # FIXME - _ofind is part of Magic |
|
1719 | oinfo = self._ofind(iFun) # FIXME - _ofind is part of Magic | |
1704 | if oinfo['ismagic']: |
|
1720 | if oinfo['ismagic']: | |
1705 | # Be careful not to call magics when a variable assignment is |
|
1721 | # Be careful not to call magics when a variable assignment is | |
1706 | # being made (ls='hi', for example) |
|
1722 | # being made (ls='hi', for example) | |
1707 | if self.rc.automagic and \ |
|
1723 | if self.rc.automagic and \ | |
1708 | (len(theRest)==0 or theRest[0] not in '!=()<>,') and \ |
|
1724 | (len(theRest)==0 or theRest[0] not in '!=()<>,') and \ | |
1709 | (self.rc.multi_line_specials or not continue_prompt): |
|
1725 | (self.rc.multi_line_specials or not continue_prompt): | |
1710 | return self.handle_magic(line,continue_prompt, |
|
1726 | return self.handle_magic(line,continue_prompt, | |
1711 | pre,iFun,theRest) |
|
1727 | pre,iFun,theRest) | |
1712 | else: |
|
1728 | else: | |
1713 | return self.handle_normal(line,continue_prompt) |
|
1729 | return self.handle_normal(line,continue_prompt) | |
1714 |
|
1730 | |||
1715 | # If the rest of the line begins with an (in)equality, assginment or |
|
1731 | # If the rest of the line begins with an (in)equality, assginment or | |
1716 | # function call, we should not call _ofind but simply execute it. |
|
1732 | # function call, we should not call _ofind but simply execute it. | |
1717 | # This avoids spurious geattr() accesses on objects upon assignment. |
|
1733 | # This avoids spurious geattr() accesses on objects upon assignment. | |
1718 | # |
|
1734 | # | |
1719 | # It also allows users to assign to either alias or magic names true |
|
1735 | # It also allows users to assign to either alias or magic names true | |
1720 | # python variables (the magic/alias systems always take second seat to |
|
1736 | # python variables (the magic/alias systems always take second seat to | |
1721 | # true python code). |
|
1737 | # true python code). | |
1722 | if theRest and theRest[0] in '!=()': |
|
1738 | if theRest and theRest[0] in '!=()': | |
1723 | return self.handle_normal(line,continue_prompt) |
|
1739 | return self.handle_normal(line,continue_prompt) | |
1724 |
|
1740 | |||
1725 | if oinfo is None: |
|
1741 | if oinfo is None: | |
1726 | oinfo = self._ofind(iFun) # FIXME - _ofind is part of Magic |
|
1742 | oinfo = self._ofind(iFun) # FIXME - _ofind is part of Magic | |
1727 |
|
1743 | |||
1728 | if not oinfo['found']: |
|
1744 | if not oinfo['found']: | |
1729 | return self.handle_normal(line,continue_prompt) |
|
1745 | return self.handle_normal(line,continue_prompt) | |
1730 | else: |
|
1746 | else: | |
1731 | #print 'iFun <%s> rest <%s>' % (iFun,theRest) # dbg |
|
1747 | #print 'iFun <%s> rest <%s>' % (iFun,theRest) # dbg | |
1732 | if oinfo['isalias']: |
|
1748 | if oinfo['isalias']: | |
1733 | return self.handle_alias(line,continue_prompt, |
|
1749 | return self.handle_alias(line,continue_prompt, | |
1734 | pre,iFun,theRest) |
|
1750 | pre,iFun,theRest) | |
1735 |
|
1751 | |||
1736 | if self.rc.autocall and \ |
|
1752 | if self.rc.autocall and \ | |
1737 | not self.re_exclude_auto.match(theRest) and \ |
|
1753 | not self.re_exclude_auto.match(theRest) and \ | |
1738 | self.re_fun_name.match(iFun) and \ |
|
1754 | self.re_fun_name.match(iFun) and \ | |
1739 | callable(oinfo['obj']) : |
|
1755 | callable(oinfo['obj']) : | |
1740 | #print 'going auto' # dbg |
|
1756 | #print 'going auto' # dbg | |
1741 | return self.handle_auto(line,continue_prompt,pre,iFun,theRest) |
|
1757 | return self.handle_auto(line,continue_prompt,pre,iFun,theRest) | |
1742 | else: |
|
1758 | else: | |
1743 | #print 'was callable?', callable(oinfo['obj']) # dbg |
|
1759 | #print 'was callable?', callable(oinfo['obj']) # dbg | |
1744 | return self.handle_normal(line,continue_prompt) |
|
1760 | return self.handle_normal(line,continue_prompt) | |
1745 |
|
1761 | |||
1746 | # If we get here, we have a normal Python line. Log and return. |
|
1762 | # If we get here, we have a normal Python line. Log and return. | |
1747 | return self.handle_normal(line,continue_prompt) |
|
1763 | return self.handle_normal(line,continue_prompt) | |
1748 |
|
1764 | |||
1749 | def _prefilter_dumb(self, line, continue_prompt): |
|
1765 | def _prefilter_dumb(self, line, continue_prompt): | |
1750 | """simple prefilter function, for debugging""" |
|
1766 | """simple prefilter function, for debugging""" | |
1751 | return self.handle_normal(line,continue_prompt) |
|
1767 | return self.handle_normal(line,continue_prompt) | |
1752 |
|
1768 | |||
1753 | # Set the default prefilter() function (this can be user-overridden) |
|
1769 | # Set the default prefilter() function (this can be user-overridden) | |
1754 | prefilter = _prefilter |
|
1770 | prefilter = _prefilter | |
1755 |
|
1771 | |||
1756 | def handle_normal(self,line,continue_prompt=None, |
|
1772 | def handle_normal(self,line,continue_prompt=None, | |
1757 | pre=None,iFun=None,theRest=None): |
|
1773 | pre=None,iFun=None,theRest=None): | |
1758 | """Handle normal input lines. Use as a template for handlers.""" |
|
1774 | """Handle normal input lines. Use as a template for handlers.""" | |
1759 |
|
1775 | |||
1760 | # With autoindent on, we need some way to exit the input loop, and I |
|
1776 | # With autoindent on, we need some way to exit the input loop, and I | |
1761 | # don't want to force the user to have to backspace all the way to |
|
1777 | # don't want to force the user to have to backspace all the way to | |
1762 | # clear the line. The rule will be in this case, that either two |
|
1778 | # clear the line. The rule will be in this case, that either two | |
1763 | # lines of pure whitespace in a row, or a line of pure whitespace but |
|
1779 | # lines of pure whitespace in a row, or a line of pure whitespace but | |
1764 | # of a size different to the indent level, will exit the input loop. |
|
1780 | # of a size different to the indent level, will exit the input loop. | |
1765 | if (continue_prompt and self.autoindent and isspace(line) and |
|
1781 | if (continue_prompt and self.autoindent and isspace(line) and | |
1766 | (line != self.indent_current or isspace(self.buffer[-1]))): |
|
1782 | (line != self.indent_current or isspace(self.buffer[-1]))): | |
1767 | line = '' |
|
1783 | line = '' | |
1768 |
|
1784 | |||
1769 | self.log(line,continue_prompt) |
|
1785 | self.log(line,continue_prompt) | |
1770 | self.update_cache(line) |
|
1786 | self.update_cache(line) | |
1771 | return line |
|
1787 | return line | |
1772 |
|
1788 | |||
1773 | def handle_alias(self,line,continue_prompt=None, |
|
1789 | def handle_alias(self,line,continue_prompt=None, | |
1774 | pre=None,iFun=None,theRest=None): |
|
1790 | pre=None,iFun=None,theRest=None): | |
1775 | """Handle alias input lines. """ |
|
1791 | """Handle alias input lines. """ | |
1776 |
|
1792 | |||
1777 | theRest = esc_quotes(theRest) |
|
1793 | theRest = esc_quotes(theRest) | |
1778 | # log the ipalias form, which doesn't depend on the instance name |
|
1794 | # log the ipalias form, which doesn't depend on the instance name | |
1779 | line_log = 'ipalias("%s %s")' % (iFun,theRest) |
|
1795 | line_log = 'ipalias("%s %s")' % (iFun,theRest) | |
1780 | self.log(line_log,continue_prompt) |
|
1796 | self.log(line_log,continue_prompt) | |
1781 | self.update_cache(line_log) |
|
1797 | self.update_cache(line_log) | |
1782 | # this is what actually gets executed |
|
1798 | # this is what actually gets executed | |
1783 | return "%s%s.call_alias('%s','%s')" % (pre,self.name,iFun,theRest) |
|
1799 | return "%s%s.call_alias('%s','%s')" % (pre,self.name,iFun,theRest) | |
1784 |
|
1800 | |||
1785 | def handle_shell_escape(self, line, continue_prompt=None, |
|
1801 | def handle_shell_escape(self, line, continue_prompt=None, | |
1786 | pre=None,iFun=None,theRest=None): |
|
1802 | pre=None,iFun=None,theRest=None): | |
1787 | """Execute the line in a shell, empty return value""" |
|
1803 | """Execute the line in a shell, empty return value""" | |
1788 |
|
1804 | |||
1789 | #print 'line in :', `line` # dbg |
|
1805 | #print 'line in :', `line` # dbg | |
1790 | # Example of a special handler. Others follow a similar pattern. |
|
1806 | # Example of a special handler. Others follow a similar pattern. | |
1791 | if continue_prompt: # multi-line statements |
|
1807 | if continue_prompt: # multi-line statements | |
1792 | if iFun.startswith('!!'): |
|
1808 | if iFun.startswith('!!'): | |
1793 | print 'SyntaxError: !! is not allowed in multiline statements' |
|
1809 | print 'SyntaxError: !! is not allowed in multiline statements' | |
1794 | return pre |
|
1810 | return pre | |
1795 | else: |
|
1811 | else: | |
1796 | cmd = ("%s %s" % (iFun[1:],theRest)) #.replace('"','\\"') |
|
1812 | cmd = ("%s %s" % (iFun[1:],theRest)) #.replace('"','\\"') | |
1797 | #line_out = '%s%s.system("%s")' % (pre,self.name,cmd) |
|
1813 | #line_out = '%s%s.system("%s")' % (pre,self.name,cmd) | |
1798 | line_out = '%s%s.system(r"""%s"""[:-1])' % (pre,self.name,cmd + "_") |
|
1814 | line_out = '%s%s.system(r"""%s"""[:-1])' % (pre,self.name,cmd + "_") | |
1799 | #line_out = ('%s%s.system(' % (pre,self.name)) + repr(cmd) + ')' |
|
1815 | #line_out = ('%s%s.system(' % (pre,self.name)) + repr(cmd) + ')' | |
1800 | else: # single-line input |
|
1816 | else: # single-line input | |
1801 | if line.startswith('!!'): |
|
1817 | if line.startswith('!!'): | |
1802 | # rewrite iFun/theRest to properly hold the call to %sx and |
|
1818 | # rewrite iFun/theRest to properly hold the call to %sx and | |
1803 | # the actual command to be executed, so handle_magic can work |
|
1819 | # the actual command to be executed, so handle_magic can work | |
1804 | # correctly |
|
1820 | # correctly | |
1805 | theRest = '%s %s' % (iFun[2:],theRest) |
|
1821 | theRest = '%s %s' % (iFun[2:],theRest) | |
1806 | iFun = 'sx' |
|
1822 | iFun = 'sx' | |
1807 | return self.handle_magic('%ssx %s' % (self.ESC_MAGIC,line[2:]), |
|
1823 | return self.handle_magic('%ssx %s' % (self.ESC_MAGIC,line[2:]), | |
1808 | continue_prompt,pre,iFun,theRest) |
|
1824 | continue_prompt,pre,iFun,theRest) | |
1809 | else: |
|
1825 | else: | |
1810 | #cmd = esc_quotes(line[1:]) |
|
1826 | #cmd = esc_quotes(line[1:]) | |
1811 | cmd=line[1:] |
|
1827 | cmd=line[1:] | |
1812 | #line_out = '%s.system("%s")' % (self.name,cmd) |
|
1828 | #line_out = '%s.system("%s")' % (self.name,cmd) | |
1813 | line_out = '%s.system(r"""%s"""[:-1])' % (self.name,cmd +"_") |
|
1829 | line_out = '%s.system(r"""%s"""[:-1])' % (self.name,cmd +"_") | |
1814 | #line_out = ('%s.system(' % self.name) + repr(cmd)+ ')' |
|
1830 | #line_out = ('%s.system(' % self.name) + repr(cmd)+ ')' | |
1815 | # update cache/log and return |
|
1831 | # update cache/log and return | |
1816 | self.log(line_out,continue_prompt) |
|
1832 | self.log(line_out,continue_prompt) | |
1817 | self.update_cache(line_out) # readline cache gets normal line |
|
1833 | self.update_cache(line_out) # readline cache gets normal line | |
1818 | #print 'line out r:', `line_out` # dbg |
|
1834 | #print 'line out r:', `line_out` # dbg | |
1819 | #print 'line out s:', line_out # dbg |
|
1835 | #print 'line out s:', line_out # dbg | |
1820 | return line_out |
|
1836 | return line_out | |
1821 |
|
1837 | |||
1822 | def handle_magic(self, line, continue_prompt=None, |
|
1838 | def handle_magic(self, line, continue_prompt=None, | |
1823 | pre=None,iFun=None,theRest=None): |
|
1839 | pre=None,iFun=None,theRest=None): | |
1824 | """Execute magic functions. |
|
1840 | """Execute magic functions. | |
1825 |
|
1841 | |||
1826 | Also log them with a prepended # so the log is clean Python.""" |
|
1842 | Also log them with a prepended # so the log is clean Python.""" | |
1827 |
|
1843 | |||
1828 | cmd = '%sipmagic("%s")' % (pre,esc_quotes('%s %s' % (iFun,theRest))) |
|
1844 | cmd = '%sipmagic("%s")' % (pre,esc_quotes('%s %s' % (iFun,theRest))) | |
1829 | self.log(cmd,continue_prompt) |
|
1845 | self.log(cmd,continue_prompt) | |
1830 | self.update_cache(line) |
|
1846 | self.update_cache(line) | |
1831 | #print 'in handle_magic, cmd=<%s>' % cmd # dbg |
|
1847 | #print 'in handle_magic, cmd=<%s>' % cmd # dbg | |
1832 | return cmd |
|
1848 | return cmd | |
1833 |
|
1849 | |||
1834 | def handle_auto(self, line, continue_prompt=None, |
|
1850 | def handle_auto(self, line, continue_prompt=None, | |
1835 | pre=None,iFun=None,theRest=None): |
|
1851 | pre=None,iFun=None,theRest=None): | |
1836 | """Hande lines which can be auto-executed, quoting if requested.""" |
|
1852 | """Hande lines which can be auto-executed, quoting if requested.""" | |
1837 |
|
1853 | |||
1838 | #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg |
|
1854 | #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg | |
1839 |
|
1855 | |||
1840 | # This should only be active for single-line input! |
|
1856 | # This should only be active for single-line input! | |
1841 | if continue_prompt: |
|
1857 | if continue_prompt: | |
1842 | return line |
|
1858 | return line | |
1843 |
|
1859 | |||
1844 | if pre == self.ESC_QUOTE: |
|
1860 | if pre == self.ESC_QUOTE: | |
1845 | # Auto-quote splitting on whitespace |
|
1861 | # Auto-quote splitting on whitespace | |
1846 | newcmd = '%s("%s")' % (iFun,'", "'.join(theRest.split()) ) |
|
1862 | newcmd = '%s("%s")' % (iFun,'", "'.join(theRest.split()) ) | |
1847 | elif pre == self.ESC_QUOTE2: |
|
1863 | elif pre == self.ESC_QUOTE2: | |
1848 | # Auto-quote whole string |
|
1864 | # Auto-quote whole string | |
1849 | newcmd = '%s("%s")' % (iFun,theRest) |
|
1865 | newcmd = '%s("%s")' % (iFun,theRest) | |
1850 | else: |
|
1866 | else: | |
1851 | # Auto-paren |
|
1867 | # Auto-paren | |
1852 | if theRest[0:1] in ('=','['): |
|
1868 | if theRest[0:1] in ('=','['): | |
1853 | # Don't autocall in these cases. They can be either |
|
1869 | # Don't autocall in these cases. They can be either | |
1854 | # rebindings of an existing callable's name, or item access |
|
1870 | # rebindings of an existing callable's name, or item access | |
1855 | # for an object which is BOTH callable and implements |
|
1871 | # for an object which is BOTH callable and implements | |
1856 | # __getitem__. |
|
1872 | # __getitem__. | |
1857 | return '%s %s' % (iFun,theRest) |
|
1873 | return '%s %s' % (iFun,theRest) | |
1858 | if theRest.endswith(';'): |
|
1874 | if theRest.endswith(';'): | |
1859 | newcmd = '%s(%s);' % (iFun.rstrip(),theRest[:-1]) |
|
1875 | newcmd = '%s(%s);' % (iFun.rstrip(),theRest[:-1]) | |
1860 | else: |
|
1876 | else: | |
1861 | newcmd = '%s(%s)' % (iFun.rstrip(),theRest) |
|
1877 | newcmd = '%s(%s)' % (iFun.rstrip(),theRest) | |
1862 |
|
1878 | |||
1863 | print >>Term.cout, self.outputcache.prompt1.auto_rewrite() + newcmd |
|
1879 | print >>Term.cout, self.outputcache.prompt1.auto_rewrite() + newcmd | |
1864 | # log what is now valid Python, not the actual user input (without the |
|
1880 | # log what is now valid Python, not the actual user input (without the | |
1865 | # final newline) |
|
1881 | # final newline) | |
1866 | self.log(newcmd,continue_prompt) |
|
1882 | self.log(newcmd,continue_prompt) | |
1867 | return newcmd |
|
1883 | return newcmd | |
1868 |
|
1884 | |||
1869 | def handle_help(self, line, continue_prompt=None, |
|
1885 | def handle_help(self, line, continue_prompt=None, | |
1870 | pre=None,iFun=None,theRest=None): |
|
1886 | pre=None,iFun=None,theRest=None): | |
1871 | """Try to get some help for the object. |
|
1887 | """Try to get some help for the object. | |
1872 |
|
1888 | |||
1873 | obj? or ?obj -> basic information. |
|
1889 | obj? or ?obj -> basic information. | |
1874 | obj?? or ??obj -> more details. |
|
1890 | obj?? or ??obj -> more details. | |
1875 | """ |
|
1891 | """ | |
1876 |
|
1892 | |||
1877 | # We need to make sure that we don't process lines which would be |
|
1893 | # We need to make sure that we don't process lines which would be | |
1878 | # otherwise valid python, such as "x=1 # what?" |
|
1894 | # otherwise valid python, such as "x=1 # what?" | |
1879 | try: |
|
1895 | try: | |
1880 | codeop.compile_command(line) |
|
1896 | codeop.compile_command(line) | |
1881 | except SyntaxError: |
|
1897 | except SyntaxError: | |
1882 | # We should only handle as help stuff which is NOT valid syntax |
|
1898 | # We should only handle as help stuff which is NOT valid syntax | |
1883 | if line[0]==self.ESC_HELP: |
|
1899 | if line[0]==self.ESC_HELP: | |
1884 | line = line[1:] |
|
1900 | line = line[1:] | |
1885 | elif line[-1]==self.ESC_HELP: |
|
1901 | elif line[-1]==self.ESC_HELP: | |
1886 | line = line[:-1] |
|
1902 | line = line[:-1] | |
1887 | self.log('#?'+line) |
|
1903 | self.log('#?'+line) | |
1888 | self.update_cache(line) |
|
1904 | self.update_cache(line) | |
1889 | if line: |
|
1905 | if line: | |
1890 | self.magic_pinfo(line) |
|
1906 | self.magic_pinfo(line) | |
1891 | else: |
|
1907 | else: | |
1892 | page(self.usage,screen_lines=self.rc.screen_length) |
|
1908 | page(self.usage,screen_lines=self.rc.screen_length) | |
1893 | return '' # Empty string is needed here! |
|
1909 | return '' # Empty string is needed here! | |
1894 | except: |
|
1910 | except: | |
1895 | # Pass any other exceptions through to the normal handler |
|
1911 | # Pass any other exceptions through to the normal handler | |
1896 | return self.handle_normal(line,continue_prompt) |
|
1912 | return self.handle_normal(line,continue_prompt) | |
1897 | else: |
|
1913 | else: | |
1898 | # If the code compiles ok, we should handle it normally |
|
1914 | # If the code compiles ok, we should handle it normally | |
1899 | return self.handle_normal(line,continue_prompt) |
|
1915 | return self.handle_normal(line,continue_prompt) | |
1900 |
|
1916 | |||
1901 | def handle_emacs(self,line,continue_prompt=None, |
|
1917 | def handle_emacs(self,line,continue_prompt=None, | |
1902 | pre=None,iFun=None,theRest=None): |
|
1918 | pre=None,iFun=None,theRest=None): | |
1903 | """Handle input lines marked by python-mode.""" |
|
1919 | """Handle input lines marked by python-mode.""" | |
1904 |
|
1920 | |||
1905 | # Currently, nothing is done. Later more functionality can be added |
|
1921 | # Currently, nothing is done. Later more functionality can be added | |
1906 | # here if needed. |
|
1922 | # here if needed. | |
1907 |
|
1923 | |||
1908 | # The input cache shouldn't be updated |
|
1924 | # The input cache shouldn't be updated | |
1909 |
|
1925 | |||
1910 | return line |
|
1926 | return line | |
1911 |
|
1927 | |||
1912 | def write(self,data): |
|
1928 | def write(self,data): | |
1913 | """Write a string to the default output""" |
|
1929 | """Write a string to the default output""" | |
1914 | Term.cout.write(data) |
|
1930 | Term.cout.write(data) | |
1915 |
|
1931 | |||
1916 | def write_err(self,data): |
|
1932 | def write_err(self,data): | |
1917 | """Write a string to the default error output""" |
|
1933 | """Write a string to the default error output""" | |
1918 | Term.cerr.write(data) |
|
1934 | Term.cerr.write(data) | |
1919 |
|
1935 | |||
1920 | def exit(self): |
|
1936 | def exit(self): | |
1921 | """Handle interactive exit. |
|
1937 | """Handle interactive exit. | |
1922 |
|
1938 | |||
1923 | This method sets the exit_now attribute.""" |
|
1939 | This method sets the exit_now attribute.""" | |
1924 |
|
1940 | |||
1925 | if self.rc.confirm_exit: |
|
1941 | if self.rc.confirm_exit: | |
1926 | if ask_yes_no('Do you really want to exit ([y]/n)?','y'): |
|
1942 | if ask_yes_no('Do you really want to exit ([y]/n)?','y'): | |
1927 | self.exit_now = True |
|
1943 | self.exit_now = True | |
1928 | else: |
|
1944 | else: | |
1929 | self.exit_now = True |
|
1945 | self.exit_now = True | |
1930 | return self.exit_now |
|
1946 | return self.exit_now | |
1931 |
|
1947 | |||
1932 | def safe_execfile(self,fname,*where,**kw): |
|
1948 | def safe_execfile(self,fname,*where,**kw): | |
1933 | fname = os.path.expanduser(fname) |
|
1949 | fname = os.path.expanduser(fname) | |
1934 |
|
1950 | |||
1935 | # find things also in current directory |
|
1951 | # find things also in current directory | |
1936 | dname = os.path.dirname(fname) |
|
1952 | dname = os.path.dirname(fname) | |
1937 | if not sys.path.count(dname): |
|
1953 | if not sys.path.count(dname): | |
1938 | sys.path.append(dname) |
|
1954 | sys.path.append(dname) | |
1939 |
|
1955 | |||
1940 | try: |
|
1956 | try: | |
1941 | xfile = open(fname) |
|
1957 | xfile = open(fname) | |
1942 | except: |
|
1958 | except: | |
1943 | print >> Term.cerr, \ |
|
1959 | print >> Term.cerr, \ | |
1944 | 'Could not open file <%s> for safe execution.' % fname |
|
1960 | 'Could not open file <%s> for safe execution.' % fname | |
1945 | return None |
|
1961 | return None | |
1946 |
|
1962 | |||
1947 | kw.setdefault('islog',0) |
|
1963 | kw.setdefault('islog',0) | |
1948 | kw.setdefault('quiet',1) |
|
1964 | kw.setdefault('quiet',1) | |
1949 | kw.setdefault('exit_ignore',0) |
|
1965 | kw.setdefault('exit_ignore',0) | |
1950 | first = xfile.readline() |
|
1966 | first = xfile.readline() | |
1951 | loghead = str(self.loghead_tpl).split('\n',1)[0].strip() |
|
1967 | loghead = str(self.loghead_tpl).split('\n',1)[0].strip() | |
1952 | xfile.close() |
|
1968 | xfile.close() | |
1953 | # line by line execution |
|
1969 | # line by line execution | |
1954 | if first.startswith(loghead) or kw['islog']: |
|
1970 | if first.startswith(loghead) or kw['islog']: | |
1955 | print 'Loading log file <%s> one line at a time...' % fname |
|
1971 | print 'Loading log file <%s> one line at a time...' % fname | |
1956 | if kw['quiet']: |
|
1972 | if kw['quiet']: | |
1957 | stdout_save = sys.stdout |
|
1973 | stdout_save = sys.stdout | |
1958 | sys.stdout = StringIO.StringIO() |
|
1974 | sys.stdout = StringIO.StringIO() | |
1959 | try: |
|
1975 | try: | |
1960 | globs,locs = where[0:2] |
|
1976 | globs,locs = where[0:2] | |
1961 | except: |
|
1977 | except: | |
1962 | try: |
|
1978 | try: | |
1963 | globs = locs = where[0] |
|
1979 | globs = locs = where[0] | |
1964 | except: |
|
1980 | except: | |
1965 | globs = locs = globals() |
|
1981 | globs = locs = globals() | |
1966 | badblocks = [] |
|
1982 | badblocks = [] | |
1967 |
|
1983 | |||
1968 | # we also need to identify indented blocks of code when replaying |
|
1984 | # we also need to identify indented blocks of code when replaying | |
1969 | # logs and put them together before passing them to an exec |
|
1985 | # logs and put them together before passing them to an exec | |
1970 | # statement. This takes a bit of regexp and look-ahead work in the |
|
1986 | # statement. This takes a bit of regexp and look-ahead work in the | |
1971 | # file. It's easiest if we swallow the whole thing in memory |
|
1987 | # file. It's easiest if we swallow the whole thing in memory | |
1972 | # first, and manually walk through the lines list moving the |
|
1988 | # first, and manually walk through the lines list moving the | |
1973 | # counter ourselves. |
|
1989 | # counter ourselves. | |
1974 | indent_re = re.compile('\s+\S') |
|
1990 | indent_re = re.compile('\s+\S') | |
1975 | xfile = open(fname) |
|
1991 | xfile = open(fname) | |
1976 | filelines = xfile.readlines() |
|
1992 | filelines = xfile.readlines() | |
1977 | xfile.close() |
|
1993 | xfile.close() | |
1978 | nlines = len(filelines) |
|
1994 | nlines = len(filelines) | |
1979 | lnum = 0 |
|
1995 | lnum = 0 | |
1980 | while lnum < nlines: |
|
1996 | while lnum < nlines: | |
1981 | line = filelines[lnum] |
|
1997 | line = filelines[lnum] | |
1982 | lnum += 1 |
|
1998 | lnum += 1 | |
1983 | # don't re-insert logger status info into cache |
|
1999 | # don't re-insert logger status info into cache | |
1984 | if line.startswith('#log#'): |
|
2000 | if line.startswith('#log#'): | |
1985 | continue |
|
2001 | continue | |
1986 | elif line.startswith('#!'): |
|
2002 | elif line.startswith('#!'): | |
1987 | self.update_cache(line[1:]) |
|
2003 | self.update_cache(line[1:]) | |
1988 | else: |
|
2004 | else: | |
1989 | # build a block of code (maybe a single line) for execution |
|
2005 | # build a block of code (maybe a single line) for execution | |
1990 | block = line |
|
2006 | block = line | |
1991 | try: |
|
2007 | try: | |
1992 | next = filelines[lnum] # lnum has already incremented |
|
2008 | next = filelines[lnum] # lnum has already incremented | |
1993 | except: |
|
2009 | except: | |
1994 | next = None |
|
2010 | next = None | |
1995 | while next and indent_re.match(next): |
|
2011 | while next and indent_re.match(next): | |
1996 | block += next |
|
2012 | block += next | |
1997 | lnum += 1 |
|
2013 | lnum += 1 | |
1998 | try: |
|
2014 | try: | |
1999 | next = filelines[lnum] |
|
2015 | next = filelines[lnum] | |
2000 | except: |
|
2016 | except: | |
2001 | next = None |
|
2017 | next = None | |
2002 | # now execute the block of one or more lines |
|
2018 | # now execute the block of one or more lines | |
2003 | try: |
|
2019 | try: | |
2004 | exec block in globs,locs |
|
2020 | exec block in globs,locs | |
2005 | self.update_cache(block.rstrip()) |
|
2021 | self.update_cache(block.rstrip()) | |
2006 | except SystemExit: |
|
2022 | except SystemExit: | |
2007 | pass |
|
2023 | pass | |
2008 | except: |
|
2024 | except: | |
2009 | badblocks.append(block.rstrip()) |
|
2025 | badblocks.append(block.rstrip()) | |
2010 | if kw['quiet']: # restore stdout |
|
2026 | if kw['quiet']: # restore stdout | |
2011 | sys.stdout.close() |
|
2027 | sys.stdout.close() | |
2012 | sys.stdout = stdout_save |
|
2028 | sys.stdout = stdout_save | |
2013 | print 'Finished replaying log file <%s>' % fname |
|
2029 | print 'Finished replaying log file <%s>' % fname | |
2014 | if badblocks: |
|
2030 | if badblocks: | |
2015 | print >> sys.stderr, ('\nThe following lines/blocks in file ' |
|
2031 | print >> sys.stderr, ('\nThe following lines/blocks in file ' | |
2016 | '<%s> reported errors:' % fname) |
|
2032 | '<%s> reported errors:' % fname) | |
2017 |
|
2033 | |||
2018 | for badline in badblocks: |
|
2034 | for badline in badblocks: | |
2019 | print >> sys.stderr, badline |
|
2035 | print >> sys.stderr, badline | |
2020 | else: # regular file execution |
|
2036 | else: # regular file execution | |
2021 | try: |
|
2037 | try: | |
2022 | execfile(fname,*where) |
|
2038 | execfile(fname,*where) | |
2023 | except SyntaxError: |
|
2039 | except SyntaxError: | |
2024 | etype,evalue = sys.exc_info()[:2] |
|
2040 | etype,evalue = sys.exc_info()[:2] | |
2025 | self.SyntaxTB(etype,evalue,[]) |
|
2041 | self.SyntaxTB(etype,evalue,[]) | |
2026 | warn('Failure executing file: <%s>' % fname) |
|
2042 | warn('Failure executing file: <%s>' % fname) | |
2027 | except SystemExit,status: |
|
2043 | except SystemExit,status: | |
2028 | if not kw['exit_ignore']: |
|
2044 | if not kw['exit_ignore']: | |
2029 | self.InteractiveTB() |
|
2045 | self.InteractiveTB() | |
2030 | warn('Failure executing file: <%s>' % fname) |
|
2046 | warn('Failure executing file: <%s>' % fname) | |
2031 | except: |
|
2047 | except: | |
2032 | self.InteractiveTB() |
|
2048 | self.InteractiveTB() | |
2033 | warn('Failure executing file: <%s>' % fname) |
|
2049 | warn('Failure executing file: <%s>' % fname) | |
2034 |
|
2050 | |||
2035 | #************************* end of file <iplib.py> ***************************** |
|
2051 | #************************* end of file <iplib.py> ***************************** |
@@ -1,4627 +1,4631 b'' | |||||
1 | 2005-12-29 Fernando Perez <Fernando.Perez@colorado.edu> |
|
1 | 2005-12-29 Fernando Perez <Fernando.Perez@colorado.edu> | |
2 |
|
2 | |||
3 | * IPython/Magic.py (Macro): simplified Macro class to just |
|
3 | * IPython/Magic.py (Macro): simplified Macro class to just | |
4 | subclass list. We've had only 2.2 compatibility for a very long |
|
4 | subclass list. We've had only 2.2 compatibility for a very long | |
5 | time, yet I was still avoiding subclassing the builtin types. No |
|
5 | time, yet I was still avoiding subclassing the builtin types. No | |
6 | more (I'm also starting to use properties, though I won't shift to |
|
6 | more (I'm also starting to use properties, though I won't shift to | |
7 | 2.3-specific features quite yet). |
|
7 | 2.3-specific features quite yet). | |
|
8 | (magic_store): added Ville's patch for lightweight variable | |||
|
9 | persistence, after a request on the user list by Matt Wilkie | |||
|
10 | <maphew at gmail.com>. The new %store magic's docstring has full | |||
|
11 | details. | |||
8 |
|
12 | |||
9 | * IPython/iplib.py (InteractiveShell.post_config_initialization): |
|
13 | * IPython/iplib.py (InteractiveShell.post_config_initialization): | |
10 | changed the default logfile name from 'ipython.log' to |
|
14 | changed the default logfile name from 'ipython.log' to | |
11 | 'ipython_log.py'. These logs are real python files, and now that |
|
15 | 'ipython_log.py'. These logs are real python files, and now that | |
12 | we have much better multiline support, people are more likely to |
|
16 | we have much better multiline support, people are more likely to | |
13 | want to use them as such. Might as well name them correctly. |
|
17 | want to use them as such. Might as well name them correctly. | |
14 |
|
18 | |||
15 | * IPython/Magic.py: substantial cleanup. While we can't stop |
|
19 | * IPython/Magic.py: substantial cleanup. While we can't stop | |
16 | using magics as mixins, due to the existing customizations 'out |
|
20 | using magics as mixins, due to the existing customizations 'out | |
17 | there' which rely on the mixin naming conventions, at least I |
|
21 | there' which rely on the mixin naming conventions, at least I | |
18 | cleaned out all cross-class name usage. So once we are OK with |
|
22 | cleaned out all cross-class name usage. So once we are OK with | |
19 | breaking compatibility, the two systems can be separated. |
|
23 | breaking compatibility, the two systems can be separated. | |
20 |
|
24 | |||
21 | * IPython/Logger.py: major cleanup. This one is NOT a mixin |
|
25 | * IPython/Logger.py: major cleanup. This one is NOT a mixin | |
22 | anymore, and the class is a fair bit less hideous as well. New |
|
26 | anymore, and the class is a fair bit less hideous as well. New | |
23 | features were also introduced: timestamping of input, and logging |
|
27 | features were also introduced: timestamping of input, and logging | |
24 | of output results. These are user-visible with the -t and -o |
|
28 | of output results. These are user-visible with the -t and -o | |
25 | options to %logstart. Closes |
|
29 | options to %logstart. Closes | |
26 | http://www.scipy.net/roundup/ipython/issue11 and a request by |
|
30 | http://www.scipy.net/roundup/ipython/issue11 and a request by | |
27 | William Stein (SAGE developer - http://modular.ucsd.edu/sage). |
|
31 | William Stein (SAGE developer - http://modular.ucsd.edu/sage). | |
28 |
|
32 | |||
29 | 2005-12-28 Fernando Perez <Fernando.Perez@colorado.edu> |
|
33 | 2005-12-28 Fernando Perez <Fernando.Perez@colorado.edu> | |
30 |
|
34 | |||
31 | * IPython/iplib.py (handle_shell_escape): add Ville's patch to |
|
35 | * IPython/iplib.py (handle_shell_escape): add Ville's patch to | |
32 | better hadnle backslashes in paths. See the thread 'More Windows |
|
36 | better hadnle backslashes in paths. See the thread 'More Windows | |
33 | questions part 2 - \/ characters revisited' on the iypthon user |
|
37 | questions part 2 - \/ characters revisited' on the iypthon user | |
34 | list: |
|
38 | list: | |
35 | http://scipy.net/pipermail/ipython-user/2005-June/000907.html |
|
39 | http://scipy.net/pipermail/ipython-user/2005-June/000907.html | |
36 |
|
40 | |||
37 | (InteractiveShell.__init__): fix tab-completion bug in threaded shells. |
|
41 | (InteractiveShell.__init__): fix tab-completion bug in threaded shells. | |
38 |
|
42 | |||
39 | (InteractiveShell.__init__): change threaded shells to not use the |
|
43 | (InteractiveShell.__init__): change threaded shells to not use the | |
40 | ipython crash handler. This was causing more problems than not, |
|
44 | ipython crash handler. This was causing more problems than not, | |
41 | as exceptions in the main thread (GUI code, typically) would |
|
45 | as exceptions in the main thread (GUI code, typically) would | |
42 | always show up as a 'crash', when they really weren't. |
|
46 | always show up as a 'crash', when they really weren't. | |
43 |
|
47 | |||
44 | The colors and exception mode commands (%colors/%xmode) have been |
|
48 | The colors and exception mode commands (%colors/%xmode) have been | |
45 | synchronized to also take this into account, so users can get |
|
49 | synchronized to also take this into account, so users can get | |
46 | verbose exceptions for their threaded code as well. I also added |
|
50 | verbose exceptions for their threaded code as well. I also added | |
47 | support for activating pdb inside this exception handler as well, |
|
51 | support for activating pdb inside this exception handler as well, | |
48 | so now GUI authors can use IPython's enhanced pdb at runtime. |
|
52 | so now GUI authors can use IPython's enhanced pdb at runtime. | |
49 |
|
53 | |||
50 | * IPython/ipmaker.py (make_IPython): make the autoedit_syntax flag |
|
54 | * IPython/ipmaker.py (make_IPython): make the autoedit_syntax flag | |
51 | true by default, and add it to the shipped ipythonrc file. Since |
|
55 | true by default, and add it to the shipped ipythonrc file. Since | |
52 | this asks the user before proceeding, I think it's OK to make it |
|
56 | this asks the user before proceeding, I think it's OK to make it | |
53 | true by default. |
|
57 | true by default. | |
54 |
|
58 | |||
55 | * IPython/Magic.py (magic_exit): make new exit/quit magics instead |
|
59 | * IPython/Magic.py (magic_exit): make new exit/quit magics instead | |
56 | of the previous special-casing of input in the eval loop. I think |
|
60 | of the previous special-casing of input in the eval loop. I think | |
57 | this is cleaner, as they really are commands and shouldn't have |
|
61 | this is cleaner, as they really are commands and shouldn't have | |
58 | a special role in the middle of the core code. |
|
62 | a special role in the middle of the core code. | |
59 |
|
63 | |||
60 | 2005-12-27 Fernando Perez <Fernando.Perez@colorado.edu> |
|
64 | 2005-12-27 Fernando Perez <Fernando.Perez@colorado.edu> | |
61 |
|
65 | |||
62 | * IPython/iplib.py (edit_syntax_error): added support for |
|
66 | * IPython/iplib.py (edit_syntax_error): added support for | |
63 | automatically reopening the editor if the file had a syntax error |
|
67 | automatically reopening the editor if the file had a syntax error | |
64 | in it. Thanks to scottt who provided the patch at: |
|
68 | in it. Thanks to scottt who provided the patch at: | |
65 | http://www.scipy.net/roundup/ipython/issue36 (slightly modified |
|
69 | http://www.scipy.net/roundup/ipython/issue36 (slightly modified | |
66 | version committed). |
|
70 | version committed). | |
67 |
|
71 | |||
68 | * IPython/iplib.py (handle_normal): add suport for multi-line |
|
72 | * IPython/iplib.py (handle_normal): add suport for multi-line | |
69 | input with emtpy lines. This fixes |
|
73 | input with emtpy lines. This fixes | |
70 | http://www.scipy.net/roundup/ipython/issue43 and a similar |
|
74 | http://www.scipy.net/roundup/ipython/issue43 and a similar | |
71 | discussion on the user list. |
|
75 | discussion on the user list. | |
72 |
|
76 | |||
73 | WARNING: a behavior change is necessarily introduced to support |
|
77 | WARNING: a behavior change is necessarily introduced to support | |
74 | blank lines: now a single blank line with whitespace does NOT |
|
78 | blank lines: now a single blank line with whitespace does NOT | |
75 | break the input loop, which means that when autoindent is on, by |
|
79 | break the input loop, which means that when autoindent is on, by | |
76 | default hitting return on the next (indented) line does NOT exit. |
|
80 | default hitting return on the next (indented) line does NOT exit. | |
77 |
|
81 | |||
78 | Instead, to exit a multiline input you can either have: |
|
82 | Instead, to exit a multiline input you can either have: | |
79 |
|
83 | |||
80 | - TWO whitespace lines (just hit return again), or |
|
84 | - TWO whitespace lines (just hit return again), or | |
81 | - a single whitespace line of a different length than provided |
|
85 | - a single whitespace line of a different length than provided | |
82 | by the autoindent (add or remove a space). |
|
86 | by the autoindent (add or remove a space). | |
83 |
|
87 | |||
84 | * IPython/completer.py (MagicCompleter.__init__): new 'completer' |
|
88 | * IPython/completer.py (MagicCompleter.__init__): new 'completer' | |
85 | module to better organize all readline-related functionality. |
|
89 | module to better organize all readline-related functionality. | |
86 | I've deleted FlexCompleter and put all completion clases here. |
|
90 | I've deleted FlexCompleter and put all completion clases here. | |
87 |
|
91 | |||
88 | * IPython/iplib.py (raw_input): improve indentation management. |
|
92 | * IPython/iplib.py (raw_input): improve indentation management. | |
89 | It is now possible to paste indented code with autoindent on, and |
|
93 | It is now possible to paste indented code with autoindent on, and | |
90 | the code is interpreted correctly (though it still looks bad on |
|
94 | the code is interpreted correctly (though it still looks bad on | |
91 | screen, due to the line-oriented nature of ipython). |
|
95 | screen, due to the line-oriented nature of ipython). | |
92 | (MagicCompleter.complete): change behavior so that a TAB key on an |
|
96 | (MagicCompleter.complete): change behavior so that a TAB key on an | |
93 | otherwise empty line actually inserts a tab, instead of completing |
|
97 | otherwise empty line actually inserts a tab, instead of completing | |
94 | on the entire global namespace. This makes it easier to use the |
|
98 | on the entire global namespace. This makes it easier to use the | |
95 | TAB key for indentation. After a request by Hans Meine |
|
99 | TAB key for indentation. After a request by Hans Meine | |
96 | <hans_meine-AT-gmx.net> |
|
100 | <hans_meine-AT-gmx.net> | |
97 | (_prefilter): add support so that typing plain 'exit' or 'quit' |
|
101 | (_prefilter): add support so that typing plain 'exit' or 'quit' | |
98 | does a sensible thing. Originally I tried to deviate as little as |
|
102 | does a sensible thing. Originally I tried to deviate as little as | |
99 | possible from the default python behavior, but even that one may |
|
103 | possible from the default python behavior, but even that one may | |
100 | change in this direction (thread on python-dev to that effect). |
|
104 | change in this direction (thread on python-dev to that effect). | |
101 | Regardless, ipython should do the right thing even if CPython's |
|
105 | Regardless, ipython should do the right thing even if CPython's | |
102 | '>>>' prompt doesn't. |
|
106 | '>>>' prompt doesn't. | |
103 | (InteractiveShell): removed subclassing code.InteractiveConsole |
|
107 | (InteractiveShell): removed subclassing code.InteractiveConsole | |
104 | class. By now we'd overridden just about all of its methods: I've |
|
108 | class. By now we'd overridden just about all of its methods: I've | |
105 | copied the remaining two over, and now ipython is a standalone |
|
109 | copied the remaining two over, and now ipython is a standalone | |
106 | class. This will provide a clearer picture for the chainsaw |
|
110 | class. This will provide a clearer picture for the chainsaw | |
107 | branch refactoring. |
|
111 | branch refactoring. | |
108 |
|
112 | |||
109 | 2005-12-26 Fernando Perez <Fernando.Perez@colorado.edu> |
|
113 | 2005-12-26 Fernando Perez <Fernando.Perez@colorado.edu> | |
110 |
|
114 | |||
111 | * IPython/ultraTB.py (VerboseTB.text): harden reporting against |
|
115 | * IPython/ultraTB.py (VerboseTB.text): harden reporting against | |
112 | failures for objects which break when dir() is called on them. |
|
116 | failures for objects which break when dir() is called on them. | |
113 |
|
117 | |||
114 | * IPython/FlexCompleter.py (Completer.__init__): Added support for |
|
118 | * IPython/FlexCompleter.py (Completer.__init__): Added support for | |
115 | distinct local and global namespaces in the completer API. This |
|
119 | distinct local and global namespaces in the completer API. This | |
116 | change allows us top properly handle completion with distinct |
|
120 | change allows us top properly handle completion with distinct | |
117 | scopes, including in embedded instances (this had never really |
|
121 | scopes, including in embedded instances (this had never really | |
118 | worked correctly). |
|
122 | worked correctly). | |
119 |
|
123 | |||
120 | Note: this introduces a change in the constructor for |
|
124 | Note: this introduces a change in the constructor for | |
121 | MagicCompleter, as a new global_namespace parameter is now the |
|
125 | MagicCompleter, as a new global_namespace parameter is now the | |
122 | second argument (the others were bumped one position). |
|
126 | second argument (the others were bumped one position). | |
123 |
|
127 | |||
124 | 2005-12-25 Fernando Perez <Fernando.Perez@colorado.edu> |
|
128 | 2005-12-25 Fernando Perez <Fernando.Perez@colorado.edu> | |
125 |
|
129 | |||
126 | * IPython/iplib.py (embed_mainloop): fix tab-completion in |
|
130 | * IPython/iplib.py (embed_mainloop): fix tab-completion in | |
127 | embedded instances (which can be done now thanks to Vivian's |
|
131 | embedded instances (which can be done now thanks to Vivian's | |
128 | frame-handling fixes for pdb). |
|
132 | frame-handling fixes for pdb). | |
129 | (InteractiveShell.__init__): Fix namespace handling problem in |
|
133 | (InteractiveShell.__init__): Fix namespace handling problem in | |
130 | embedded instances. We were overwriting __main__ unconditionally, |
|
134 | embedded instances. We were overwriting __main__ unconditionally, | |
131 | and this should only be done for 'full' (non-embedded) IPython; |
|
135 | and this should only be done for 'full' (non-embedded) IPython; | |
132 | embedded instances must respect the caller's __main__. Thanks to |
|
136 | embedded instances must respect the caller's __main__. Thanks to | |
133 | a bug report by Yaroslav Bulatov <yaroslavvb-AT-gmail.com> |
|
137 | a bug report by Yaroslav Bulatov <yaroslavvb-AT-gmail.com> | |
134 |
|
138 | |||
135 | 2005-12-24 Fernando Perez <Fernando.Perez@colorado.edu> |
|
139 | 2005-12-24 Fernando Perez <Fernando.Perez@colorado.edu> | |
136 |
|
140 | |||
137 | * setup.py: added download_url to setup(). This registers the |
|
141 | * setup.py: added download_url to setup(). This registers the | |
138 | download address at PyPI, which is not only useful to humans |
|
142 | download address at PyPI, which is not only useful to humans | |
139 | browsing the site, but is also picked up by setuptools (the Eggs |
|
143 | browsing the site, but is also picked up by setuptools (the Eggs | |
140 | machinery). Thanks to Ville and R. Kern for the info/discussion |
|
144 | machinery). Thanks to Ville and R. Kern for the info/discussion | |
141 | on this. |
|
145 | on this. | |
142 |
|
146 | |||
143 | 2005-12-23 Fernando Perez <Fernando.Perez@colorado.edu> |
|
147 | 2005-12-23 Fernando Perez <Fernando.Perez@colorado.edu> | |
144 |
|
148 | |||
145 | * IPython/Debugger.py (Pdb.__init__): Major pdb mode enhancements. |
|
149 | * IPython/Debugger.py (Pdb.__init__): Major pdb mode enhancements. | |
146 | This brings a lot of nice functionality to the pdb mode, which now |
|
150 | This brings a lot of nice functionality to the pdb mode, which now | |
147 | has tab-completion, syntax highlighting, and better stack handling |
|
151 | has tab-completion, syntax highlighting, and better stack handling | |
148 | than before. Many thanks to Vivian De Smedt |
|
152 | than before. Many thanks to Vivian De Smedt | |
149 | <vivian-AT-vdesmedt.com> for the original patches. |
|
153 | <vivian-AT-vdesmedt.com> for the original patches. | |
150 |
|
154 | |||
151 | 2005-12-08 Fernando Perez <Fernando.Perez@colorado.edu> |
|
155 | 2005-12-08 Fernando Perez <Fernando.Perez@colorado.edu> | |
152 |
|
156 | |||
153 | * IPython/Shell.py (IPShellGTK.mainloop): fix mainloop() calling |
|
157 | * IPython/Shell.py (IPShellGTK.mainloop): fix mainloop() calling | |
154 | sequence to consistently accept the banner argument. The |
|
158 | sequence to consistently accept the banner argument. The | |
155 | inconsistency was tripping SAGE, thanks to Gary Zablackis |
|
159 | inconsistency was tripping SAGE, thanks to Gary Zablackis | |
156 | <gzabl-AT-yahoo.com> for the report. |
|
160 | <gzabl-AT-yahoo.com> for the report. | |
157 |
|
161 | |||
158 | 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu> |
|
162 | 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu> | |
159 |
|
163 | |||
160 | * IPython/iplib.py (InteractiveShell.post_config_initialization): |
|
164 | * IPython/iplib.py (InteractiveShell.post_config_initialization): | |
161 | Fix bug where a naked 'alias' call in the ipythonrc file would |
|
165 | Fix bug where a naked 'alias' call in the ipythonrc file would | |
162 | cause a crash. Bug reported by Jorgen Stenarson. |
|
166 | cause a crash. Bug reported by Jorgen Stenarson. | |
163 |
|
167 | |||
164 | 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu> |
|
168 | 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu> | |
165 |
|
169 | |||
166 | * IPython/ipmaker.py (make_IPython): cleanups which should improve |
|
170 | * IPython/ipmaker.py (make_IPython): cleanups which should improve | |
167 | startup time. |
|
171 | startup time. | |
168 |
|
172 | |||
169 | * IPython/iplib.py (runcode): my globals 'fix' for embedded |
|
173 | * IPython/iplib.py (runcode): my globals 'fix' for embedded | |
170 | instances had introduced a bug with globals in normal code. Now |
|
174 | instances had introduced a bug with globals in normal code. Now | |
171 | it's working in all cases. |
|
175 | it's working in all cases. | |
172 |
|
176 | |||
173 | * IPython/Magic.py (magic_psearch): Finish wildcard cleanup and |
|
177 | * IPython/Magic.py (magic_psearch): Finish wildcard cleanup and | |
174 | API changes. A new ipytonrc option, 'wildcards_case_sensitive' |
|
178 | API changes. A new ipytonrc option, 'wildcards_case_sensitive' | |
175 | has been introduced to set the default case sensitivity of the |
|
179 | has been introduced to set the default case sensitivity of the | |
176 | searches. Users can still select either mode at runtime on a |
|
180 | searches. Users can still select either mode at runtime on a | |
177 | per-search basis. |
|
181 | per-search basis. | |
178 |
|
182 | |||
179 | 2005-11-13 Fernando Perez <Fernando.Perez@colorado.edu> |
|
183 | 2005-11-13 Fernando Perez <Fernando.Perez@colorado.edu> | |
180 |
|
184 | |||
181 | * IPython/wildcard.py (NameSpace.__init__): fix resolution of |
|
185 | * IPython/wildcard.py (NameSpace.__init__): fix resolution of | |
182 | attributes in wildcard searches for subclasses. Modified version |
|
186 | attributes in wildcard searches for subclasses. Modified version | |
183 | of a patch by Jorgen. |
|
187 | of a patch by Jorgen. | |
184 |
|
188 | |||
185 | 2005-11-12 Fernando Perez <Fernando.Perez@colorado.edu> |
|
189 | 2005-11-12 Fernando Perez <Fernando.Perez@colorado.edu> | |
186 |
|
190 | |||
187 | * IPython/iplib.py (embed_mainloop): Fix handling of globals for |
|
191 | * IPython/iplib.py (embed_mainloop): Fix handling of globals for | |
188 | embedded instances. I added a user_global_ns attribute to the |
|
192 | embedded instances. I added a user_global_ns attribute to the | |
189 | InteractiveShell class to handle this. |
|
193 | InteractiveShell class to handle this. | |
190 |
|
194 | |||
191 | 2005-10-31 Fernando Perez <Fernando.Perez@colorado.edu> |
|
195 | 2005-10-31 Fernando Perez <Fernando.Perez@colorado.edu> | |
192 |
|
196 | |||
193 | * IPython/Shell.py (IPShellGTK.mainloop): Change timeout_add to |
|
197 | * IPython/Shell.py (IPShellGTK.mainloop): Change timeout_add to | |
194 | idle_add, which fixes horrible keyboard lag problems under gtk 2.6 |
|
198 | idle_add, which fixes horrible keyboard lag problems under gtk 2.6 | |
195 | (reported under win32, but may happen also in other platforms). |
|
199 | (reported under win32, but may happen also in other platforms). | |
196 | Bug report and fix courtesy of Sean Moore <smm-AT-logic.bm> |
|
200 | Bug report and fix courtesy of Sean Moore <smm-AT-logic.bm> | |
197 |
|
201 | |||
198 | 2005-10-15 Fernando Perez <Fernando.Perez@colorado.edu> |
|
202 | 2005-10-15 Fernando Perez <Fernando.Perez@colorado.edu> | |
199 |
|
203 | |||
200 | * IPython/Magic.py (magic_psearch): new support for wildcard |
|
204 | * IPython/Magic.py (magic_psearch): new support for wildcard | |
201 | patterns. Now, typing ?a*b will list all names which begin with a |
|
205 | patterns. Now, typing ?a*b will list all names which begin with a | |
202 | and end in b, for example. The %psearch magic has full |
|
206 | and end in b, for example. The %psearch magic has full | |
203 | docstrings. Many thanks to JΓΆrgen Stenarson |
|
207 | docstrings. Many thanks to JΓΆrgen Stenarson | |
204 | <jorgen.stenarson-AT-bostream.nu>, author of the patches |
|
208 | <jorgen.stenarson-AT-bostream.nu>, author of the patches | |
205 | implementing this functionality. |
|
209 | implementing this functionality. | |
206 |
|
210 | |||
207 | 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu> |
|
211 | 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu> | |
208 |
|
212 | |||
209 | * Manual: fixed long-standing annoyance of double-dashes (as in |
|
213 | * Manual: fixed long-standing annoyance of double-dashes (as in | |
210 | --prefix=~, for example) being stripped in the HTML version. This |
|
214 | --prefix=~, for example) being stripped in the HTML version. This | |
211 | is a latex2html bug, but a workaround was provided. Many thanks |
|
215 | is a latex2html bug, but a workaround was provided. Many thanks | |
212 | to George K. Thiruvathukal <gthiruv-AT-luc.edu> for the detailed |
|
216 | to George K. Thiruvathukal <gthiruv-AT-luc.edu> for the detailed | |
213 | help, and Michael Tobis <mtobis-AT-gmail.com> for getting the ball |
|
217 | help, and Michael Tobis <mtobis-AT-gmail.com> for getting the ball | |
214 | rolling. This seemingly small issue had tripped a number of users |
|
218 | rolling. This seemingly small issue had tripped a number of users | |
215 | when first installing, so I'm glad to see it gone. |
|
219 | when first installing, so I'm glad to see it gone. | |
216 |
|
220 | |||
217 | 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu> |
|
221 | 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu> | |
218 |
|
222 | |||
219 | * IPython/Extensions/numeric_formats.py: fix missing import, |
|
223 | * IPython/Extensions/numeric_formats.py: fix missing import, | |
220 | reported by Stephen Walton. |
|
224 | reported by Stephen Walton. | |
221 |
|
225 | |||
222 | 2005-09-24 Fernando Perez <Fernando.Perez@colorado.edu> |
|
226 | 2005-09-24 Fernando Perez <Fernando.Perez@colorado.edu> | |
223 |
|
227 | |||
224 | * IPython/demo.py: finish demo module, fully documented now. |
|
228 | * IPython/demo.py: finish demo module, fully documented now. | |
225 |
|
229 | |||
226 | * IPython/genutils.py (file_read): simple little utility to read a |
|
230 | * IPython/genutils.py (file_read): simple little utility to read a | |
227 | file and ensure it's closed afterwards. |
|
231 | file and ensure it's closed afterwards. | |
228 |
|
232 | |||
229 | 2005-09-23 Fernando Perez <Fernando.Perez@colorado.edu> |
|
233 | 2005-09-23 Fernando Perez <Fernando.Perez@colorado.edu> | |
230 |
|
234 | |||
231 | * IPython/demo.py (Demo.__init__): added support for individually |
|
235 | * IPython/demo.py (Demo.__init__): added support for individually | |
232 | tagging blocks for automatic execution. |
|
236 | tagging blocks for automatic execution. | |
233 |
|
237 | |||
234 | * IPython/Magic.py (magic_pycat): new %pycat magic for showing |
|
238 | * IPython/Magic.py (magic_pycat): new %pycat magic for showing | |
235 | syntax-highlighted python sources, requested by John. |
|
239 | syntax-highlighted python sources, requested by John. | |
236 |
|
240 | |||
237 | 2005-09-22 Fernando Perez <Fernando.Perez@colorado.edu> |
|
241 | 2005-09-22 Fernando Perez <Fernando.Perez@colorado.edu> | |
238 |
|
242 | |||
239 | * IPython/demo.py (Demo.again): fix bug where again() blocks after |
|
243 | * IPython/demo.py (Demo.again): fix bug where again() blocks after | |
240 | finishing. |
|
244 | finishing. | |
241 |
|
245 | |||
242 | * IPython/genutils.py (shlex_split): moved from Magic to here, |
|
246 | * IPython/genutils.py (shlex_split): moved from Magic to here, | |
243 | where all 2.2 compatibility stuff lives. I needed it for demo.py. |
|
247 | where all 2.2 compatibility stuff lives. I needed it for demo.py. | |
244 |
|
248 | |||
245 | * IPython/demo.py (Demo.__init__): added support for silent |
|
249 | * IPython/demo.py (Demo.__init__): added support for silent | |
246 | blocks, improved marks as regexps, docstrings written. |
|
250 | blocks, improved marks as regexps, docstrings written. | |
247 | (Demo.__init__): better docstring, added support for sys.argv. |
|
251 | (Demo.__init__): better docstring, added support for sys.argv. | |
248 |
|
252 | |||
249 | * IPython/genutils.py (marquee): little utility used by the demo |
|
253 | * IPython/genutils.py (marquee): little utility used by the demo | |
250 | code, handy in general. |
|
254 | code, handy in general. | |
251 |
|
255 | |||
252 | * IPython/demo.py (Demo.__init__): new class for interactive |
|
256 | * IPython/demo.py (Demo.__init__): new class for interactive | |
253 | demos. Not documented yet, I just wrote it in a hurry for |
|
257 | demos. Not documented yet, I just wrote it in a hurry for | |
254 | scipy'05. Will docstring later. |
|
258 | scipy'05. Will docstring later. | |
255 |
|
259 | |||
256 | 2005-09-20 Fernando Perez <Fernando.Perez@colorado.edu> |
|
260 | 2005-09-20 Fernando Perez <Fernando.Perez@colorado.edu> | |
257 |
|
261 | |||
258 | * IPython/Shell.py (sigint_handler): Drastic simplification which |
|
262 | * IPython/Shell.py (sigint_handler): Drastic simplification which | |
259 | also seems to make Ctrl-C work correctly across threads! This is |
|
263 | also seems to make Ctrl-C work correctly across threads! This is | |
260 | so simple, that I can't beleive I'd missed it before. Needs more |
|
264 | so simple, that I can't beleive I'd missed it before. Needs more | |
261 | testing, though. |
|
265 | testing, though. | |
262 | (KBINT): Never mind, revert changes. I'm sure I'd tried something |
|
266 | (KBINT): Never mind, revert changes. I'm sure I'd tried something | |
263 | like this before... |
|
267 | like this before... | |
264 |
|
268 | |||
265 | * IPython/genutils.py (get_home_dir): add protection against |
|
269 | * IPython/genutils.py (get_home_dir): add protection against | |
266 | non-dirs in win32 registry. |
|
270 | non-dirs in win32 registry. | |
267 |
|
271 | |||
268 | * IPython/iplib.py (InteractiveShell.alias_table_validate): fix |
|
272 | * IPython/iplib.py (InteractiveShell.alias_table_validate): fix | |
269 | bug where dict was mutated while iterating (pysh crash). |
|
273 | bug where dict was mutated while iterating (pysh crash). | |
270 |
|
274 | |||
271 | 2005-09-06 Fernando Perez <Fernando.Perez@colorado.edu> |
|
275 | 2005-09-06 Fernando Perez <Fernando.Perez@colorado.edu> | |
272 |
|
276 | |||
273 | * IPython/iplib.py (handle_auto): Fix inconsistency arising from |
|
277 | * IPython/iplib.py (handle_auto): Fix inconsistency arising from | |
274 | spurious newlines added by this routine. After a report by |
|
278 | spurious newlines added by this routine. After a report by | |
275 | F. Mantegazza. |
|
279 | F. Mantegazza. | |
276 |
|
280 | |||
277 | 2005-09-05 Fernando Perez <Fernando.Perez@colorado.edu> |
|
281 | 2005-09-05 Fernando Perez <Fernando.Perez@colorado.edu> | |
278 |
|
282 | |||
279 | * IPython/Shell.py (hijack_gtk): remove pygtk.require("2.0") |
|
283 | * IPython/Shell.py (hijack_gtk): remove pygtk.require("2.0") | |
280 | calls. These were a leftover from the GTK 1.x days, and can cause |
|
284 | calls. These were a leftover from the GTK 1.x days, and can cause | |
281 | problems in certain cases (after a report by John Hunter). |
|
285 | problems in certain cases (after a report by John Hunter). | |
282 |
|
286 | |||
283 | * IPython/iplib.py (InteractiveShell.__init__): Trap exception if |
|
287 | * IPython/iplib.py (InteractiveShell.__init__): Trap exception if | |
284 | os.getcwd() fails at init time. Thanks to patch from David Remahl |
|
288 | os.getcwd() fails at init time. Thanks to patch from David Remahl | |
285 | <chmod007-AT-mac.com>. |
|
289 | <chmod007-AT-mac.com>. | |
286 | (InteractiveShell.__init__): prevent certain special magics from |
|
290 | (InteractiveShell.__init__): prevent certain special magics from | |
287 | being shadowed by aliases. Closes |
|
291 | being shadowed by aliases. Closes | |
288 | http://www.scipy.net/roundup/ipython/issue41. |
|
292 | http://www.scipy.net/roundup/ipython/issue41. | |
289 |
|
293 | |||
290 | 2005-08-31 Fernando Perez <Fernando.Perez@colorado.edu> |
|
294 | 2005-08-31 Fernando Perez <Fernando.Perez@colorado.edu> | |
291 |
|
295 | |||
292 | * IPython/iplib.py (InteractiveShell.complete): Added new |
|
296 | * IPython/iplib.py (InteractiveShell.complete): Added new | |
293 | top-level completion method to expose the completion mechanism |
|
297 | top-level completion method to expose the completion mechanism | |
294 | beyond readline-based environments. |
|
298 | beyond readline-based environments. | |
295 |
|
299 | |||
296 | 2005-08-19 Fernando Perez <Fernando.Perez@colorado.edu> |
|
300 | 2005-08-19 Fernando Perez <Fernando.Perez@colorado.edu> | |
297 |
|
301 | |||
298 | * tools/ipsvnc (svnversion): fix svnversion capture. |
|
302 | * tools/ipsvnc (svnversion): fix svnversion capture. | |
299 |
|
303 | |||
300 | * IPython/iplib.py (InteractiveShell.__init__): Add has_readline |
|
304 | * IPython/iplib.py (InteractiveShell.__init__): Add has_readline | |
301 | attribute to self, which was missing. Before, it was set by a |
|
305 | attribute to self, which was missing. Before, it was set by a | |
302 | routine which in certain cases wasn't being called, so the |
|
306 | routine which in certain cases wasn't being called, so the | |
303 | instance could end up missing the attribute. This caused a crash. |
|
307 | instance could end up missing the attribute. This caused a crash. | |
304 | Closes http://www.scipy.net/roundup/ipython/issue40. |
|
308 | Closes http://www.scipy.net/roundup/ipython/issue40. | |
305 |
|
309 | |||
306 | 2005-08-16 Fernando Perez <fperez@colorado.edu> |
|
310 | 2005-08-16 Fernando Perez <fperez@colorado.edu> | |
307 |
|
311 | |||
308 | * IPython/ultraTB.py (VerboseTB.text): don't crash if object |
|
312 | * IPython/ultraTB.py (VerboseTB.text): don't crash if object | |
309 | contains non-string attribute. Closes |
|
313 | contains non-string attribute. Closes | |
310 | http://www.scipy.net/roundup/ipython/issue38. |
|
314 | http://www.scipy.net/roundup/ipython/issue38. | |
311 |
|
315 | |||
312 | 2005-08-14 Fernando Perez <fperez@colorado.edu> |
|
316 | 2005-08-14 Fernando Perez <fperez@colorado.edu> | |
313 |
|
317 | |||
314 | * tools/ipsvnc: Minor improvements, to add changeset info. |
|
318 | * tools/ipsvnc: Minor improvements, to add changeset info. | |
315 |
|
319 | |||
316 | 2005-08-12 Fernando Perez <fperez@colorado.edu> |
|
320 | 2005-08-12 Fernando Perez <fperez@colorado.edu> | |
317 |
|
321 | |||
318 | * IPython/iplib.py (runsource): remove self.code_to_run_src |
|
322 | * IPython/iplib.py (runsource): remove self.code_to_run_src | |
319 | attribute. I realized this is nothing more than |
|
323 | attribute. I realized this is nothing more than | |
320 | '\n'.join(self.buffer), and having the same data in two different |
|
324 | '\n'.join(self.buffer), and having the same data in two different | |
321 | places is just asking for synchronization bugs. This may impact |
|
325 | places is just asking for synchronization bugs. This may impact | |
322 | people who have custom exception handlers, so I need to warn |
|
326 | people who have custom exception handlers, so I need to warn | |
323 | ipython-dev about it (F. Mantegazza may use them). |
|
327 | ipython-dev about it (F. Mantegazza may use them). | |
324 |
|
328 | |||
325 | 2005-07-29 Fernando Perez <Fernando.Perez@colorado.edu> |
|
329 | 2005-07-29 Fernando Perez <Fernando.Perez@colorado.edu> | |
326 |
|
330 | |||
327 | * IPython/genutils.py: fix 2.2 compatibility (generators) |
|
331 | * IPython/genutils.py: fix 2.2 compatibility (generators) | |
328 |
|
332 | |||
329 | 2005-07-18 Fernando Perez <fperez@colorado.edu> |
|
333 | 2005-07-18 Fernando Perez <fperez@colorado.edu> | |
330 |
|
334 | |||
331 | * IPython/genutils.py (get_home_dir): fix to help users with |
|
335 | * IPython/genutils.py (get_home_dir): fix to help users with | |
332 | invalid $HOME under win32. |
|
336 | invalid $HOME under win32. | |
333 |
|
337 | |||
334 | 2005-07-17 Fernando Perez <fperez@colorado.edu> |
|
338 | 2005-07-17 Fernando Perez <fperez@colorado.edu> | |
335 |
|
339 | |||
336 | * IPython/Prompts.py (str_safe): Make unicode-safe. Also remove |
|
340 | * IPython/Prompts.py (str_safe): Make unicode-safe. Also remove | |
337 | some old hacks and clean up a bit other routines; code should be |
|
341 | some old hacks and clean up a bit other routines; code should be | |
338 | simpler and a bit faster. |
|
342 | simpler and a bit faster. | |
339 |
|
343 | |||
340 | * IPython/iplib.py (interact): removed some last-resort attempts |
|
344 | * IPython/iplib.py (interact): removed some last-resort attempts | |
341 | to survive broken stdout/stderr. That code was only making it |
|
345 | to survive broken stdout/stderr. That code was only making it | |
342 | harder to abstract out the i/o (necessary for gui integration), |
|
346 | harder to abstract out the i/o (necessary for gui integration), | |
343 | and the crashes it could prevent were extremely rare in practice |
|
347 | and the crashes it could prevent were extremely rare in practice | |
344 | (besides being fully user-induced in a pretty violent manner). |
|
348 | (besides being fully user-induced in a pretty violent manner). | |
345 |
|
349 | |||
346 | * IPython/genutils.py (IOStream.__init__): Simplify the i/o stuff. |
|
350 | * IPython/genutils.py (IOStream.__init__): Simplify the i/o stuff. | |
347 | Nothing major yet, but the code is simpler to read; this should |
|
351 | Nothing major yet, but the code is simpler to read; this should | |
348 | make it easier to do more serious modifications in the future. |
|
352 | make it easier to do more serious modifications in the future. | |
349 |
|
353 | |||
350 | * IPython/Extensions/InterpreterExec.py: Fix auto-quoting in pysh, |
|
354 | * IPython/Extensions/InterpreterExec.py: Fix auto-quoting in pysh, | |
351 | which broke in .15 (thanks to a report by Ville). |
|
355 | which broke in .15 (thanks to a report by Ville). | |
352 |
|
356 | |||
353 | * IPython/Itpl.py (Itpl.__init__): add unicode support (it may not |
|
357 | * IPython/Itpl.py (Itpl.__init__): add unicode support (it may not | |
354 | be quite correct, I know next to nothing about unicode). This |
|
358 | be quite correct, I know next to nothing about unicode). This | |
355 | will allow unicode strings to be used in prompts, amongst other |
|
359 | will allow unicode strings to be used in prompts, amongst other | |
356 | cases. It also will prevent ipython from crashing when unicode |
|
360 | cases. It also will prevent ipython from crashing when unicode | |
357 | shows up unexpectedly in many places. If ascii encoding fails, we |
|
361 | shows up unexpectedly in many places. If ascii encoding fails, we | |
358 | assume utf_8. Currently the encoding is not a user-visible |
|
362 | assume utf_8. Currently the encoding is not a user-visible | |
359 | setting, though it could be made so if there is demand for it. |
|
363 | setting, though it could be made so if there is demand for it. | |
360 |
|
364 | |||
361 | * IPython/ipmaker.py (make_IPython): remove old 2.1-specific hack. |
|
365 | * IPython/ipmaker.py (make_IPython): remove old 2.1-specific hack. | |
362 |
|
366 | |||
363 | * IPython/Struct.py (Struct.merge): switch keys() to iterator. |
|
367 | * IPython/Struct.py (Struct.merge): switch keys() to iterator. | |
364 |
|
368 | |||
365 | * IPython/background_jobs.py: moved 2.2 compatibility to genutils. |
|
369 | * IPython/background_jobs.py: moved 2.2 compatibility to genutils. | |
366 |
|
370 | |||
367 | * IPython/genutils.py: Add 2.2 compatibility here, so all other |
|
371 | * IPython/genutils.py: Add 2.2 compatibility here, so all other | |
368 | code can work transparently for 2.2/2.3. |
|
372 | code can work transparently for 2.2/2.3. | |
369 |
|
373 | |||
370 | 2005-07-16 Fernando Perez <fperez@colorado.edu> |
|
374 | 2005-07-16 Fernando Perez <fperez@colorado.edu> | |
371 |
|
375 | |||
372 | * IPython/ultraTB.py (ExceptionColors): Make a global variable |
|
376 | * IPython/ultraTB.py (ExceptionColors): Make a global variable | |
373 | out of the color scheme table used for coloring exception |
|
377 | out of the color scheme table used for coloring exception | |
374 | tracebacks. This allows user code to add new schemes at runtime. |
|
378 | tracebacks. This allows user code to add new schemes at runtime. | |
375 | This is a minimally modified version of the patch at |
|
379 | This is a minimally modified version of the patch at | |
376 | http://www.scipy.net/roundup/ipython/issue35, many thanks to pabw |
|
380 | http://www.scipy.net/roundup/ipython/issue35, many thanks to pabw | |
377 | for the contribution. |
|
381 | for the contribution. | |
378 |
|
382 | |||
379 | * IPython/FlexCompleter.py (Completer.attr_matches): Add a |
|
383 | * IPython/FlexCompleter.py (Completer.attr_matches): Add a | |
380 | slightly modified version of the patch in |
|
384 | slightly modified version of the patch in | |
381 | http://www.scipy.net/roundup/ipython/issue34, which also allows me |
|
385 | http://www.scipy.net/roundup/ipython/issue34, which also allows me | |
382 | to remove the previous try/except solution (which was costlier). |
|
386 | to remove the previous try/except solution (which was costlier). | |
383 | Thanks to Gaetan Lehmann <gaetan.lehmann-AT-jouy.inra.fr> for the fix. |
|
387 | Thanks to Gaetan Lehmann <gaetan.lehmann-AT-jouy.inra.fr> for the fix. | |
384 |
|
388 | |||
385 | 2005-06-08 Fernando Perez <fperez@colorado.edu> |
|
389 | 2005-06-08 Fernando Perez <fperez@colorado.edu> | |
386 |
|
390 | |||
387 | * IPython/iplib.py (write/write_err): Add methods to abstract all |
|
391 | * IPython/iplib.py (write/write_err): Add methods to abstract all | |
388 | I/O a bit more. |
|
392 | I/O a bit more. | |
389 |
|
393 | |||
390 | * IPython/Shell.py (IPShellGTK.mainloop): Fix GTK deprecation |
|
394 | * IPython/Shell.py (IPShellGTK.mainloop): Fix GTK deprecation | |
391 | warning, reported by Aric Hagberg, fix by JD Hunter. |
|
395 | warning, reported by Aric Hagberg, fix by JD Hunter. | |
392 |
|
396 | |||
393 | 2005-06-02 *** Released version 0.6.15 |
|
397 | 2005-06-02 *** Released version 0.6.15 | |
394 |
|
398 | |||
395 | 2005-06-01 Fernando Perez <fperez@colorado.edu> |
|
399 | 2005-06-01 Fernando Perez <fperez@colorado.edu> | |
396 |
|
400 | |||
397 | * IPython/iplib.py (MagicCompleter.file_matches): Fix |
|
401 | * IPython/iplib.py (MagicCompleter.file_matches): Fix | |
398 | tab-completion of filenames within open-quoted strings. Note that |
|
402 | tab-completion of filenames within open-quoted strings. Note that | |
399 | this requires that in ~/.ipython/ipythonrc, users change the |
|
403 | this requires that in ~/.ipython/ipythonrc, users change the | |
400 | readline delimiters configuration to read: |
|
404 | readline delimiters configuration to read: | |
401 |
|
405 | |||
402 | readline_remove_delims -/~ |
|
406 | readline_remove_delims -/~ | |
403 |
|
407 | |||
404 |
|
408 | |||
405 | 2005-05-31 *** Released version 0.6.14 |
|
409 | 2005-05-31 *** Released version 0.6.14 | |
406 |
|
410 | |||
407 | 2005-05-29 Fernando Perez <fperez@colorado.edu> |
|
411 | 2005-05-29 Fernando Perez <fperez@colorado.edu> | |
408 |
|
412 | |||
409 | * IPython/ultraTB.py (VerboseTB.text): Fix crash for tracebacks |
|
413 | * IPython/ultraTB.py (VerboseTB.text): Fix crash for tracebacks | |
410 | with files not on the filesystem. Reported by Eliyahu Sandler |
|
414 | with files not on the filesystem. Reported by Eliyahu Sandler | |
411 | <eli@gondolin.net> |
|
415 | <eli@gondolin.net> | |
412 |
|
416 | |||
413 | 2005-05-22 Fernando Perez <fperez@colorado.edu> |
|
417 | 2005-05-22 Fernando Perez <fperez@colorado.edu> | |
414 |
|
418 | |||
415 | * IPython/iplib.py: Fix a few crashes in the --upgrade option. |
|
419 | * IPython/iplib.py: Fix a few crashes in the --upgrade option. | |
416 | After an initial report by LUK ShunTim <shuntim.luk@polyu.edu.hk>. |
|
420 | After an initial report by LUK ShunTim <shuntim.luk@polyu.edu.hk>. | |
417 |
|
421 | |||
418 | 2005-05-19 Fernando Perez <fperez@colorado.edu> |
|
422 | 2005-05-19 Fernando Perez <fperez@colorado.edu> | |
419 |
|
423 | |||
420 | * IPython/iplib.py (safe_execfile): close a file which could be |
|
424 | * IPython/iplib.py (safe_execfile): close a file which could be | |
421 | left open (causing problems in win32, which locks open files). |
|
425 | left open (causing problems in win32, which locks open files). | |
422 | Thanks to a bug report by D Brown <dbrown2@yahoo.com>. |
|
426 | Thanks to a bug report by D Brown <dbrown2@yahoo.com>. | |
423 |
|
427 | |||
424 | 2005-05-18 Fernando Perez <fperez@colorado.edu> |
|
428 | 2005-05-18 Fernando Perez <fperez@colorado.edu> | |
425 |
|
429 | |||
426 | * IPython/Shell.py (MatplotlibShellBase.mplot_exec): pass all |
|
430 | * IPython/Shell.py (MatplotlibShellBase.mplot_exec): pass all | |
427 | keyword arguments correctly to safe_execfile(). |
|
431 | keyword arguments correctly to safe_execfile(). | |
428 |
|
432 | |||
429 | 2005-05-13 Fernando Perez <fperez@colorado.edu> |
|
433 | 2005-05-13 Fernando Perez <fperez@colorado.edu> | |
430 |
|
434 | |||
431 | * ipython.1: Added info about Qt to manpage, and threads warning |
|
435 | * ipython.1: Added info about Qt to manpage, and threads warning | |
432 | to usage page (invoked with --help). |
|
436 | to usage page (invoked with --help). | |
433 |
|
437 | |||
434 | * IPython/iplib.py (MagicCompleter.python_func_kw_matches): Added |
|
438 | * IPython/iplib.py (MagicCompleter.python_func_kw_matches): Added | |
435 | new matcher (it goes at the end of the priority list) to do |
|
439 | new matcher (it goes at the end of the priority list) to do | |
436 | tab-completion on named function arguments. Submitted by George |
|
440 | tab-completion on named function arguments. Submitted by George | |
437 | Sakkis <gsakkis-AT-eden.rutgers.edu>. See the thread at |
|
441 | Sakkis <gsakkis-AT-eden.rutgers.edu>. See the thread at | |
438 | http://www.scipy.net/pipermail/ipython-dev/2005-April/000436.html |
|
442 | http://www.scipy.net/pipermail/ipython-dev/2005-April/000436.html | |
439 | for more details. |
|
443 | for more details. | |
440 |
|
444 | |||
441 | * IPython/Magic.py (magic_run): Added new -e flag to ignore |
|
445 | * IPython/Magic.py (magic_run): Added new -e flag to ignore | |
442 | SystemExit exceptions in the script being run. Thanks to a report |
|
446 | SystemExit exceptions in the script being run. Thanks to a report | |
443 | by danny shevitz <danny_shevitz-AT-yahoo.com>, about this |
|
447 | by danny shevitz <danny_shevitz-AT-yahoo.com>, about this | |
444 | producing very annoying behavior when running unit tests. |
|
448 | producing very annoying behavior when running unit tests. | |
445 |
|
449 | |||
446 | 2005-05-12 Fernando Perez <fperez@colorado.edu> |
|
450 | 2005-05-12 Fernando Perez <fperez@colorado.edu> | |
447 |
|
451 | |||
448 | * IPython/iplib.py (handle_auto): fixed auto-quoting and parens, |
|
452 | * IPython/iplib.py (handle_auto): fixed auto-quoting and parens, | |
449 | which I'd broken (again) due to a changed regexp. In the process, |
|
453 | which I'd broken (again) due to a changed regexp. In the process, | |
450 | added ';' as an escape to auto-quote the whole line without |
|
454 | added ';' as an escape to auto-quote the whole line without | |
451 | splitting its arguments. Thanks to a report by Jerry McRae |
|
455 | splitting its arguments. Thanks to a report by Jerry McRae | |
452 | <qrs0xyc02-AT-sneakemail.com>. |
|
456 | <qrs0xyc02-AT-sneakemail.com>. | |
453 |
|
457 | |||
454 | * IPython/ultraTB.py (VerboseTB.text): protect against rare but |
|
458 | * IPython/ultraTB.py (VerboseTB.text): protect against rare but | |
455 | possible crashes caused by a TokenError. Reported by Ed Schofield |
|
459 | possible crashes caused by a TokenError. Reported by Ed Schofield | |
456 | <schofield-AT-ftw.at>. |
|
460 | <schofield-AT-ftw.at>. | |
457 |
|
461 | |||
458 | 2005-05-06 Fernando Perez <fperez@colorado.edu> |
|
462 | 2005-05-06 Fernando Perez <fperez@colorado.edu> | |
459 |
|
463 | |||
460 | * IPython/Shell.py (hijack_wx): Fix to work with WX v.2.6. |
|
464 | * IPython/Shell.py (hijack_wx): Fix to work with WX v.2.6. | |
461 |
|
465 | |||
462 | 2005-04-29 Fernando Perez <fperez@colorado.edu> |
|
466 | 2005-04-29 Fernando Perez <fperez@colorado.edu> | |
463 |
|
467 | |||
464 | * IPython/Shell.py (IPShellQt): Thanks to Denis Rivière |
|
468 | * IPython/Shell.py (IPShellQt): Thanks to Denis Rivière | |
465 | <nudz-AT-free.fr>, Yann Cointepas <yann-AT-sapetnioc.org> and Benjamin |
|
469 | <nudz-AT-free.fr>, Yann Cointepas <yann-AT-sapetnioc.org> and Benjamin | |
466 | Thyreau <Benji2-AT-decideur.info>, we now have a -qthread option |
|
470 | Thyreau <Benji2-AT-decideur.info>, we now have a -qthread option | |
467 | which provides support for Qt interactive usage (similar to the |
|
471 | which provides support for Qt interactive usage (similar to the | |
468 | existing one for WX and GTK). This had been often requested. |
|
472 | existing one for WX and GTK). This had been often requested. | |
469 |
|
473 | |||
470 | 2005-04-14 *** Released version 0.6.13 |
|
474 | 2005-04-14 *** Released version 0.6.13 | |
471 |
|
475 | |||
472 | 2005-04-08 Fernando Perez <fperez@colorado.edu> |
|
476 | 2005-04-08 Fernando Perez <fperez@colorado.edu> | |
473 |
|
477 | |||
474 | * IPython/Magic.py (Magic._ofind): remove docstring evaluation |
|
478 | * IPython/Magic.py (Magic._ofind): remove docstring evaluation | |
475 | from _ofind, which gets called on almost every input line. Now, |
|
479 | from _ofind, which gets called on almost every input line. Now, | |
476 | we only try to get docstrings if they are actually going to be |
|
480 | we only try to get docstrings if they are actually going to be | |
477 | used (the overhead of fetching unnecessary docstrings can be |
|
481 | used (the overhead of fetching unnecessary docstrings can be | |
478 | noticeable for certain objects, such as Pyro proxies). |
|
482 | noticeable for certain objects, such as Pyro proxies). | |
479 |
|
483 | |||
480 | * IPython/iplib.py (MagicCompleter.python_matches): Change the API |
|
484 | * IPython/iplib.py (MagicCompleter.python_matches): Change the API | |
481 | for completers. For some reason I had been passing them the state |
|
485 | for completers. For some reason I had been passing them the state | |
482 | variable, which completers never actually need, and was in |
|
486 | variable, which completers never actually need, and was in | |
483 | conflict with the rlcompleter API. Custom completers ONLY need to |
|
487 | conflict with the rlcompleter API. Custom completers ONLY need to | |
484 | take the text parameter. |
|
488 | take the text parameter. | |
485 |
|
489 | |||
486 | * IPython/Extensions/InterpreterExec.py: Fix regexp so that magics |
|
490 | * IPython/Extensions/InterpreterExec.py: Fix regexp so that magics | |
487 | work correctly in pysh. I've also moved all the logic which used |
|
491 | work correctly in pysh. I've also moved all the logic which used | |
488 | to be in pysh.py here, which will prevent problems with future |
|
492 | to be in pysh.py here, which will prevent problems with future | |
489 | upgrades. However, this time I must warn users to update their |
|
493 | upgrades. However, this time I must warn users to update their | |
490 | pysh profile to include the line |
|
494 | pysh profile to include the line | |
491 |
|
495 | |||
492 | import_all IPython.Extensions.InterpreterExec |
|
496 | import_all IPython.Extensions.InterpreterExec | |
493 |
|
497 | |||
494 | because otherwise things won't work for them. They MUST also |
|
498 | because otherwise things won't work for them. They MUST also | |
495 | delete pysh.py and the line |
|
499 | delete pysh.py and the line | |
496 |
|
500 | |||
497 | execfile pysh.py |
|
501 | execfile pysh.py | |
498 |
|
502 | |||
499 | from their ipythonrc-pysh. |
|
503 | from their ipythonrc-pysh. | |
500 |
|
504 | |||
501 | * IPython/FlexCompleter.py (Completer.attr_matches): Make more |
|
505 | * IPython/FlexCompleter.py (Completer.attr_matches): Make more | |
502 | robust in the face of objects whose dir() returns non-strings |
|
506 | robust in the face of objects whose dir() returns non-strings | |
503 | (which it shouldn't, but some broken libs like ITK do). Thanks to |
|
507 | (which it shouldn't, but some broken libs like ITK do). Thanks to | |
504 | a patch by John Hunter (implemented differently, though). Also |
|
508 | a patch by John Hunter (implemented differently, though). Also | |
505 | minor improvements by using .extend instead of + on lists. |
|
509 | minor improvements by using .extend instead of + on lists. | |
506 |
|
510 | |||
507 | * pysh.py: |
|
511 | * pysh.py: | |
508 |
|
512 | |||
509 | 2005-04-06 Fernando Perez <fperez@colorado.edu> |
|
513 | 2005-04-06 Fernando Perez <fperez@colorado.edu> | |
510 |
|
514 | |||
511 | * IPython/ipmaker.py (make_IPython): Make multi_line_specials on |
|
515 | * IPython/ipmaker.py (make_IPython): Make multi_line_specials on | |
512 | by default, so that all users benefit from it. Those who don't |
|
516 | by default, so that all users benefit from it. Those who don't | |
513 | want it can still turn it off. |
|
517 | want it can still turn it off. | |
514 |
|
518 | |||
515 | * IPython/UserConfig/ipythonrc: Add multi_line_specials to the |
|
519 | * IPython/UserConfig/ipythonrc: Add multi_line_specials to the | |
516 | config file, I'd forgotten about this, so users were getting it |
|
520 | config file, I'd forgotten about this, so users were getting it | |
517 | off by default. |
|
521 | off by default. | |
518 |
|
522 | |||
519 | * IPython/iplib.py (ipmagic): big overhaul of the magic system for |
|
523 | * IPython/iplib.py (ipmagic): big overhaul of the magic system for | |
520 | consistency. Now magics can be called in multiline statements, |
|
524 | consistency. Now magics can be called in multiline statements, | |
521 | and python variables can be expanded in magic calls via $var. |
|
525 | and python variables can be expanded in magic calls via $var. | |
522 | This makes the magic system behave just like aliases or !system |
|
526 | This makes the magic system behave just like aliases or !system | |
523 | calls. |
|
527 | calls. | |
524 |
|
528 | |||
525 | 2005-03-28 Fernando Perez <fperez@colorado.edu> |
|
529 | 2005-03-28 Fernando Perez <fperez@colorado.edu> | |
526 |
|
530 | |||
527 | * IPython/iplib.py (handle_auto): cleanup to use %s instead of |
|
531 | * IPython/iplib.py (handle_auto): cleanup to use %s instead of | |
528 | expensive string additions for building command. Add support for |
|
532 | expensive string additions for building command. Add support for | |
529 | trailing ';' when autocall is used. |
|
533 | trailing ';' when autocall is used. | |
530 |
|
534 | |||
531 | 2005-03-26 Fernando Perez <fperez@colorado.edu> |
|
535 | 2005-03-26 Fernando Perez <fperez@colorado.edu> | |
532 |
|
536 | |||
533 | * ipython.el: Fix http://www.scipy.net/roundup/ipython/issue31. |
|
537 | * ipython.el: Fix http://www.scipy.net/roundup/ipython/issue31. | |
534 | Bugfix by A. Schmolck, the ipython.el maintainer. Also make |
|
538 | Bugfix by A. Schmolck, the ipython.el maintainer. Also make | |
535 | ipython.el robust against prompts with any number of spaces |
|
539 | ipython.el robust against prompts with any number of spaces | |
536 | (including 0) after the ':' character. |
|
540 | (including 0) after the ':' character. | |
537 |
|
541 | |||
538 | * IPython/Prompts.py (Prompt2.set_p_str): Fix spurious space in |
|
542 | * IPython/Prompts.py (Prompt2.set_p_str): Fix spurious space in | |
539 | continuation prompt, which misled users to think the line was |
|
543 | continuation prompt, which misled users to think the line was | |
540 | already indented. Closes debian Bug#300847, reported to me by |
|
544 | already indented. Closes debian Bug#300847, reported to me by | |
541 | Norbert Tretkowski <tretkowski-AT-inittab.de>. |
|
545 | Norbert Tretkowski <tretkowski-AT-inittab.de>. | |
542 |
|
546 | |||
543 | 2005-03-23 Fernando Perez <fperez@colorado.edu> |
|
547 | 2005-03-23 Fernando Perez <fperez@colorado.edu> | |
544 |
|
548 | |||
545 | * IPython/Prompts.py (Prompt1.__str__): Make sure that prompts are |
|
549 | * IPython/Prompts.py (Prompt1.__str__): Make sure that prompts are | |
546 | properly aligned if they have embedded newlines. |
|
550 | properly aligned if they have embedded newlines. | |
547 |
|
551 | |||
548 | * IPython/iplib.py (runlines): Add a public method to expose |
|
552 | * IPython/iplib.py (runlines): Add a public method to expose | |
549 | IPython's code execution machinery, so that users can run strings |
|
553 | IPython's code execution machinery, so that users can run strings | |
550 | as if they had been typed at the prompt interactively. |
|
554 | as if they had been typed at the prompt interactively. | |
551 | (InteractiveShell.__init__): Added getoutput() to the __IPYTHON__ |
|
555 | (InteractiveShell.__init__): Added getoutput() to the __IPYTHON__ | |
552 | methods which can call the system shell, but with python variable |
|
556 | methods which can call the system shell, but with python variable | |
553 | expansion. The three such methods are: __IPYTHON__.system, |
|
557 | expansion. The three such methods are: __IPYTHON__.system, | |
554 | .getoutput and .getoutputerror. These need to be documented in a |
|
558 | .getoutput and .getoutputerror. These need to be documented in a | |
555 | 'public API' section (to be written) of the manual. |
|
559 | 'public API' section (to be written) of the manual. | |
556 |
|
560 | |||
557 | 2005-03-20 Fernando Perez <fperez@colorado.edu> |
|
561 | 2005-03-20 Fernando Perez <fperez@colorado.edu> | |
558 |
|
562 | |||
559 | * IPython/iplib.py (InteractiveShell.set_custom_exc): new system |
|
563 | * IPython/iplib.py (InteractiveShell.set_custom_exc): new system | |
560 | for custom exception handling. This is quite powerful, and it |
|
564 | for custom exception handling. This is quite powerful, and it | |
561 | allows for user-installable exception handlers which can trap |
|
565 | allows for user-installable exception handlers which can trap | |
562 | custom exceptions at runtime and treat them separately from |
|
566 | custom exceptions at runtime and treat them separately from | |
563 | IPython's default mechanisms. At the request of FrΓ©dΓ©ric |
|
567 | IPython's default mechanisms. At the request of FrΓ©dΓ©ric | |
564 | Mantegazza <mantegazza-AT-ill.fr>. |
|
568 | Mantegazza <mantegazza-AT-ill.fr>. | |
565 | (InteractiveShell.set_custom_completer): public API function to |
|
569 | (InteractiveShell.set_custom_completer): public API function to | |
566 | add new completers at runtime. |
|
570 | add new completers at runtime. | |
567 |
|
571 | |||
568 | 2005-03-19 Fernando Perez <fperez@colorado.edu> |
|
572 | 2005-03-19 Fernando Perez <fperez@colorado.edu> | |
569 |
|
573 | |||
570 | * IPython/OInspect.py (getdoc): Add a call to obj.getdoc(), to |
|
574 | * IPython/OInspect.py (getdoc): Add a call to obj.getdoc(), to | |
571 | allow objects which provide their docstrings via non-standard |
|
575 | allow objects which provide their docstrings via non-standard | |
572 | mechanisms (like Pyro proxies) to still be inspected by ipython's |
|
576 | mechanisms (like Pyro proxies) to still be inspected by ipython's | |
573 | ? system. |
|
577 | ? system. | |
574 |
|
578 | |||
575 | * IPython/iplib.py (InteractiveShell.__init__): back off the _o/_e |
|
579 | * IPython/iplib.py (InteractiveShell.__init__): back off the _o/_e | |
576 | automatic capture system. I tried quite hard to make it work |
|
580 | automatic capture system. I tried quite hard to make it work | |
577 | reliably, and simply failed. I tried many combinations with the |
|
581 | reliably, and simply failed. I tried many combinations with the | |
578 | subprocess module, but eventually nothing worked in all needed |
|
582 | subprocess module, but eventually nothing worked in all needed | |
579 | cases (not blocking stdin for the child, duplicating stdout |
|
583 | cases (not blocking stdin for the child, duplicating stdout | |
580 | without blocking, etc). The new %sc/%sx still do capture to these |
|
584 | without blocking, etc). The new %sc/%sx still do capture to these | |
581 | magical list/string objects which make shell use much more |
|
585 | magical list/string objects which make shell use much more | |
582 | conveninent, so not all is lost. |
|
586 | conveninent, so not all is lost. | |
583 |
|
587 | |||
584 | XXX - FIX MANUAL for the change above! |
|
588 | XXX - FIX MANUAL for the change above! | |
585 |
|
589 | |||
586 | (runsource): I copied code.py's runsource() into ipython to modify |
|
590 | (runsource): I copied code.py's runsource() into ipython to modify | |
587 | it a bit. Now the code object and source to be executed are |
|
591 | it a bit. Now the code object and source to be executed are | |
588 | stored in ipython. This makes this info accessible to third-party |
|
592 | stored in ipython. This makes this info accessible to third-party | |
589 | tools, like custom exception handlers. After a request by FrΓ©dΓ©ric |
|
593 | tools, like custom exception handlers. After a request by FrΓ©dΓ©ric | |
590 | Mantegazza <mantegazza-AT-ill.fr>. |
|
594 | Mantegazza <mantegazza-AT-ill.fr>. | |
591 |
|
595 | |||
592 | * IPython/UserConfig/ipythonrc: Add up/down arrow keys to |
|
596 | * IPython/UserConfig/ipythonrc: Add up/down arrow keys to | |
593 | history-search via readline (like C-p/C-n). I'd wanted this for a |
|
597 | history-search via readline (like C-p/C-n). I'd wanted this for a | |
594 | long time, but only recently found out how to do it. For users |
|
598 | long time, but only recently found out how to do it. For users | |
595 | who already have their ipythonrc files made and want this, just |
|
599 | who already have their ipythonrc files made and want this, just | |
596 | add: |
|
600 | add: | |
597 |
|
601 | |||
598 | readline_parse_and_bind "\e[A": history-search-backward |
|
602 | readline_parse_and_bind "\e[A": history-search-backward | |
599 | readline_parse_and_bind "\e[B": history-search-forward |
|
603 | readline_parse_and_bind "\e[B": history-search-forward | |
600 |
|
604 | |||
601 | 2005-03-18 Fernando Perez <fperez@colorado.edu> |
|
605 | 2005-03-18 Fernando Perez <fperez@colorado.edu> | |
602 |
|
606 | |||
603 | * IPython/Magic.py (magic_sc): %sc and %sx now use the fancy |
|
607 | * IPython/Magic.py (magic_sc): %sc and %sx now use the fancy | |
604 | LSString and SList classes which allow transparent conversions |
|
608 | LSString and SList classes which allow transparent conversions | |
605 | between list mode and whitespace-separated string. |
|
609 | between list mode and whitespace-separated string. | |
606 | (magic_r): Fix recursion problem in %r. |
|
610 | (magic_r): Fix recursion problem in %r. | |
607 |
|
611 | |||
608 | * IPython/genutils.py (LSString): New class to be used for |
|
612 | * IPython/genutils.py (LSString): New class to be used for | |
609 | automatic storage of the results of all alias/system calls in _o |
|
613 | automatic storage of the results of all alias/system calls in _o | |
610 | and _e (stdout/err). These provide a .l/.list attribute which |
|
614 | and _e (stdout/err). These provide a .l/.list attribute which | |
611 | does automatic splitting on newlines. This means that for most |
|
615 | does automatic splitting on newlines. This means that for most | |
612 | uses, you'll never need to do capturing of output with %sc/%sx |
|
616 | uses, you'll never need to do capturing of output with %sc/%sx | |
613 | anymore, since ipython keeps this always done for you. Note that |
|
617 | anymore, since ipython keeps this always done for you. Note that | |
614 | only the LAST results are stored, the _o/e variables are |
|
618 | only the LAST results are stored, the _o/e variables are | |
615 | overwritten on each call. If you need to save their contents |
|
619 | overwritten on each call. If you need to save their contents | |
616 | further, simply bind them to any other name. |
|
620 | further, simply bind them to any other name. | |
617 |
|
621 | |||
618 | 2005-03-17 Fernando Perez <fperez@colorado.edu> |
|
622 | 2005-03-17 Fernando Perez <fperez@colorado.edu> | |
619 |
|
623 | |||
620 | * IPython/Prompts.py (BasePrompt.cwd_filt): a few more fixes for |
|
624 | * IPython/Prompts.py (BasePrompt.cwd_filt): a few more fixes for | |
621 | prompt namespace handling. |
|
625 | prompt namespace handling. | |
622 |
|
626 | |||
623 | 2005-03-16 Fernando Perez <fperez@colorado.edu> |
|
627 | 2005-03-16 Fernando Perez <fperez@colorado.edu> | |
624 |
|
628 | |||
625 | * IPython/Prompts.py (CachedOutput.__init__): Fix default and |
|
629 | * IPython/Prompts.py (CachedOutput.__init__): Fix default and | |
626 | classic prompts to be '>>> ' (final space was missing, and it |
|
630 | classic prompts to be '>>> ' (final space was missing, and it | |
627 | trips the emacs python mode). |
|
631 | trips the emacs python mode). | |
628 | (BasePrompt.__str__): Added safe support for dynamic prompt |
|
632 | (BasePrompt.__str__): Added safe support for dynamic prompt | |
629 | strings. Now you can set your prompt string to be '$x', and the |
|
633 | strings. Now you can set your prompt string to be '$x', and the | |
630 | value of x will be printed from your interactive namespace. The |
|
634 | value of x will be printed from your interactive namespace. The | |
631 | interpolation syntax includes the full Itpl support, so |
|
635 | interpolation syntax includes the full Itpl support, so | |
632 | ${foo()+x+bar()} is a valid prompt string now, and the function |
|
636 | ${foo()+x+bar()} is a valid prompt string now, and the function | |
633 | calls will be made at runtime. |
|
637 | calls will be made at runtime. | |
634 |
|
638 | |||
635 | 2005-03-15 Fernando Perez <fperez@colorado.edu> |
|
639 | 2005-03-15 Fernando Perez <fperez@colorado.edu> | |
636 |
|
640 | |||
637 | * IPython/Magic.py (magic_history): renamed %hist to %history, to |
|
641 | * IPython/Magic.py (magic_history): renamed %hist to %history, to | |
638 | avoid name clashes in pylab. %hist still works, it just forwards |
|
642 | avoid name clashes in pylab. %hist still works, it just forwards | |
639 | the call to %history. |
|
643 | the call to %history. | |
640 |
|
644 | |||
641 | 2005-03-02 *** Released version 0.6.12 |
|
645 | 2005-03-02 *** Released version 0.6.12 | |
642 |
|
646 | |||
643 | 2005-03-02 Fernando Perez <fperez@colorado.edu> |
|
647 | 2005-03-02 Fernando Perez <fperez@colorado.edu> | |
644 |
|
648 | |||
645 | * IPython/iplib.py (handle_magic): log magic calls properly as |
|
649 | * IPython/iplib.py (handle_magic): log magic calls properly as | |
646 | ipmagic() function calls. |
|
650 | ipmagic() function calls. | |
647 |
|
651 | |||
648 | * IPython/Magic.py (magic_time): Improved %time to support |
|
652 | * IPython/Magic.py (magic_time): Improved %time to support | |
649 | statements and provide wall-clock as well as CPU time. |
|
653 | statements and provide wall-clock as well as CPU time. | |
650 |
|
654 | |||
651 | 2005-02-27 Fernando Perez <fperez@colorado.edu> |
|
655 | 2005-02-27 Fernando Perez <fperez@colorado.edu> | |
652 |
|
656 | |||
653 | * IPython/hooks.py: New hooks module, to expose user-modifiable |
|
657 | * IPython/hooks.py: New hooks module, to expose user-modifiable | |
654 | IPython functionality in a clean manner. For now only the editor |
|
658 | IPython functionality in a clean manner. For now only the editor | |
655 | hook is actually written, and other thigns which I intend to turn |
|
659 | hook is actually written, and other thigns which I intend to turn | |
656 | into proper hooks aren't yet there. The display and prefilter |
|
660 | into proper hooks aren't yet there. The display and prefilter | |
657 | stuff, for example, should be hooks. But at least now the |
|
661 | stuff, for example, should be hooks. But at least now the | |
658 | framework is in place, and the rest can be moved here with more |
|
662 | framework is in place, and the rest can be moved here with more | |
659 | time later. IPython had had a .hooks variable for a long time for |
|
663 | time later. IPython had had a .hooks variable for a long time for | |
660 | this purpose, but I'd never actually used it for anything. |
|
664 | this purpose, but I'd never actually used it for anything. | |
661 |
|
665 | |||
662 | 2005-02-26 Fernando Perez <fperez@colorado.edu> |
|
666 | 2005-02-26 Fernando Perez <fperez@colorado.edu> | |
663 |
|
667 | |||
664 | * IPython/ipmaker.py (make_IPython): make the default ipython |
|
668 | * IPython/ipmaker.py (make_IPython): make the default ipython | |
665 | directory be called _ipython under win32, to follow more the |
|
669 | directory be called _ipython under win32, to follow more the | |
666 | naming peculiarities of that platform (where buggy software like |
|
670 | naming peculiarities of that platform (where buggy software like | |
667 | Visual Sourcesafe breaks with .named directories). Reported by |
|
671 | Visual Sourcesafe breaks with .named directories). Reported by | |
668 | Ville Vainio. |
|
672 | Ville Vainio. | |
669 |
|
673 | |||
670 | 2005-02-23 Fernando Perez <fperez@colorado.edu> |
|
674 | 2005-02-23 Fernando Perez <fperez@colorado.edu> | |
671 |
|
675 | |||
672 | * IPython/iplib.py (InteractiveShell.__init__): removed a few |
|
676 | * IPython/iplib.py (InteractiveShell.__init__): removed a few | |
673 | auto_aliases for win32 which were causing problems. Users can |
|
677 | auto_aliases for win32 which were causing problems. Users can | |
674 | define the ones they personally like. |
|
678 | define the ones they personally like. | |
675 |
|
679 | |||
676 | 2005-02-21 Fernando Perez <fperez@colorado.edu> |
|
680 | 2005-02-21 Fernando Perez <fperez@colorado.edu> | |
677 |
|
681 | |||
678 | * IPython/Magic.py (magic_time): new magic to time execution of |
|
682 | * IPython/Magic.py (magic_time): new magic to time execution of | |
679 | expressions. After a request by Charles Moad <cmoad-AT-indiana.edu>. |
|
683 | expressions. After a request by Charles Moad <cmoad-AT-indiana.edu>. | |
680 |
|
684 | |||
681 | 2005-02-19 Fernando Perez <fperez@colorado.edu> |
|
685 | 2005-02-19 Fernando Perez <fperez@colorado.edu> | |
682 |
|
686 | |||
683 | * IPython/ConfigLoader.py (ConfigLoader.load): Allow empty strings |
|
687 | * IPython/ConfigLoader.py (ConfigLoader.load): Allow empty strings | |
684 | into keys (for prompts, for example). |
|
688 | into keys (for prompts, for example). | |
685 |
|
689 | |||
686 | * IPython/Prompts.py (BasePrompt.set_p_str): Fix to allow empty |
|
690 | * IPython/Prompts.py (BasePrompt.set_p_str): Fix to allow empty | |
687 | prompts in case users want them. This introduces a small behavior |
|
691 | prompts in case users want them. This introduces a small behavior | |
688 | change: ipython does not automatically add a space to all prompts |
|
692 | change: ipython does not automatically add a space to all prompts | |
689 | anymore. To get the old prompts with a space, users should add it |
|
693 | anymore. To get the old prompts with a space, users should add it | |
690 | manually to their ipythonrc file, so for example prompt_in1 should |
|
694 | manually to their ipythonrc file, so for example prompt_in1 should | |
691 | now read 'In [\#]: ' instead of 'In [\#]:'. |
|
695 | now read 'In [\#]: ' instead of 'In [\#]:'. | |
692 | (BasePrompt.__init__): New option prompts_pad_left (only in rc |
|
696 | (BasePrompt.__init__): New option prompts_pad_left (only in rc | |
693 | file) to control left-padding of secondary prompts. |
|
697 | file) to control left-padding of secondary prompts. | |
694 |
|
698 | |||
695 | * IPython/Magic.py (Magic.profile_missing_notice): Don't crash if |
|
699 | * IPython/Magic.py (Magic.profile_missing_notice): Don't crash if | |
696 | the profiler can't be imported. Fix for Debian, which removed |
|
700 | the profiler can't be imported. Fix for Debian, which removed | |
697 | profile.py because of License issues. I applied a slightly |
|
701 | profile.py because of License issues. I applied a slightly | |
698 | modified version of the original Debian patch at |
|
702 | modified version of the original Debian patch at | |
699 | http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=294500. |
|
703 | http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=294500. | |
700 |
|
704 | |||
701 | 2005-02-17 Fernando Perez <fperez@colorado.edu> |
|
705 | 2005-02-17 Fernando Perez <fperez@colorado.edu> | |
702 |
|
706 | |||
703 | * IPython/genutils.py (native_line_ends): Fix bug which would |
|
707 | * IPython/genutils.py (native_line_ends): Fix bug which would | |
704 | cause improper line-ends under win32 b/c I was not opening files |
|
708 | cause improper line-ends under win32 b/c I was not opening files | |
705 | in binary mode. Bug report and fix thanks to Ville. |
|
709 | in binary mode. Bug report and fix thanks to Ville. | |
706 |
|
710 | |||
707 | * IPython/iplib.py (handle_auto): Fix bug which I introduced when |
|
711 | * IPython/iplib.py (handle_auto): Fix bug which I introduced when | |
708 | trying to catch spurious foo[1] autocalls. My fix actually broke |
|
712 | trying to catch spurious foo[1] autocalls. My fix actually broke | |
709 | ',/' autoquote/call with explicit escape (bad regexp). |
|
713 | ',/' autoquote/call with explicit escape (bad regexp). | |
710 |
|
714 | |||
711 | 2005-02-15 *** Released version 0.6.11 |
|
715 | 2005-02-15 *** Released version 0.6.11 | |
712 |
|
716 | |||
713 | 2005-02-14 Fernando Perez <fperez@colorado.edu> |
|
717 | 2005-02-14 Fernando Perez <fperez@colorado.edu> | |
714 |
|
718 | |||
715 | * IPython/background_jobs.py: New background job management |
|
719 | * IPython/background_jobs.py: New background job management | |
716 | subsystem. This is implemented via a new set of classes, and |
|
720 | subsystem. This is implemented via a new set of classes, and | |
717 | IPython now provides a builtin 'jobs' object for background job |
|
721 | IPython now provides a builtin 'jobs' object for background job | |
718 | execution. A convenience %bg magic serves as a lightweight |
|
722 | execution. A convenience %bg magic serves as a lightweight | |
719 | frontend for starting the more common type of calls. This was |
|
723 | frontend for starting the more common type of calls. This was | |
720 | inspired by discussions with B. Granger and the BackgroundCommand |
|
724 | inspired by discussions with B. Granger and the BackgroundCommand | |
721 | class described in the book Python Scripting for Computational |
|
725 | class described in the book Python Scripting for Computational | |
722 | Science, by H. P. Langtangen: http://folk.uio.no/hpl/scripting |
|
726 | Science, by H. P. Langtangen: http://folk.uio.no/hpl/scripting | |
723 | (although ultimately no code from this text was used, as IPython's |
|
727 | (although ultimately no code from this text was used, as IPython's | |
724 | system is a separate implementation). |
|
728 | system is a separate implementation). | |
725 |
|
729 | |||
726 | * IPython/iplib.py (MagicCompleter.python_matches): add new option |
|
730 | * IPython/iplib.py (MagicCompleter.python_matches): add new option | |
727 | to control the completion of single/double underscore names |
|
731 | to control the completion of single/double underscore names | |
728 | separately. As documented in the example ipytonrc file, the |
|
732 | separately. As documented in the example ipytonrc file, the | |
729 | readline_omit__names variable can now be set to 2, to omit even |
|
733 | readline_omit__names variable can now be set to 2, to omit even | |
730 | single underscore names. Thanks to a patch by Brian Wong |
|
734 | single underscore names. Thanks to a patch by Brian Wong | |
731 | <BrianWong-AT-AirgoNetworks.Com>. |
|
735 | <BrianWong-AT-AirgoNetworks.Com>. | |
732 | (InteractiveShell.__init__): Fix bug which would cause foo[1] to |
|
736 | (InteractiveShell.__init__): Fix bug which would cause foo[1] to | |
733 | be autocalled as foo([1]) if foo were callable. A problem for |
|
737 | be autocalled as foo([1]) if foo were callable. A problem for | |
734 | things which are both callable and implement __getitem__. |
|
738 | things which are both callable and implement __getitem__. | |
735 | (init_readline): Fix autoindentation for win32. Thanks to a patch |
|
739 | (init_readline): Fix autoindentation for win32. Thanks to a patch | |
736 | by Vivian De Smedt <vivian-AT-vdesmedt.com>. |
|
740 | by Vivian De Smedt <vivian-AT-vdesmedt.com>. | |
737 |
|
741 | |||
738 | 2005-02-12 Fernando Perez <fperez@colorado.edu> |
|
742 | 2005-02-12 Fernando Perez <fperez@colorado.edu> | |
739 |
|
743 | |||
740 | * IPython/ipmaker.py (make_IPython): Disabled the stout traps |
|
744 | * IPython/ipmaker.py (make_IPython): Disabled the stout traps | |
741 | which I had written long ago to sort out user error messages which |
|
745 | which I had written long ago to sort out user error messages which | |
742 | may occur during startup. This seemed like a good idea initially, |
|
746 | may occur during startup. This seemed like a good idea initially, | |
743 | but it has proven a disaster in retrospect. I don't want to |
|
747 | but it has proven a disaster in retrospect. I don't want to | |
744 | change much code for now, so my fix is to set the internal 'debug' |
|
748 | change much code for now, so my fix is to set the internal 'debug' | |
745 | flag to true everywhere, whose only job was precisely to control |
|
749 | flag to true everywhere, whose only job was precisely to control | |
746 | this subsystem. This closes issue 28 (as well as avoiding all |
|
750 | this subsystem. This closes issue 28 (as well as avoiding all | |
747 | sorts of strange hangups which occur from time to time). |
|
751 | sorts of strange hangups which occur from time to time). | |
748 |
|
752 | |||
749 | 2005-02-07 Fernando Perez <fperez@colorado.edu> |
|
753 | 2005-02-07 Fernando Perez <fperez@colorado.edu> | |
750 |
|
754 | |||
751 | * IPython/Magic.py (magic_edit): Fix 'ed -p' not working when the |
|
755 | * IPython/Magic.py (magic_edit): Fix 'ed -p' not working when the | |
752 | previous call produced a syntax error. |
|
756 | previous call produced a syntax error. | |
753 |
|
757 | |||
754 | * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting |
|
758 | * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting | |
755 | classes without constructor. |
|
759 | classes without constructor. | |
756 |
|
760 | |||
757 | 2005-02-06 Fernando Perez <fperez@colorado.edu> |
|
761 | 2005-02-06 Fernando Perez <fperez@colorado.edu> | |
758 |
|
762 | |||
759 | * IPython/iplib.py (MagicCompleter.complete): Extend the list of |
|
763 | * IPython/iplib.py (MagicCompleter.complete): Extend the list of | |
760 | completions with the results of each matcher, so we return results |
|
764 | completions with the results of each matcher, so we return results | |
761 | to the user from all namespaces. This breaks with ipython |
|
765 | to the user from all namespaces. This breaks with ipython | |
762 | tradition, but I think it's a nicer behavior. Now you get all |
|
766 | tradition, but I think it's a nicer behavior. Now you get all | |
763 | possible completions listed, from all possible namespaces (python, |
|
767 | possible completions listed, from all possible namespaces (python, | |
764 | filesystem, magics...) After a request by John Hunter |
|
768 | filesystem, magics...) After a request by John Hunter | |
765 | <jdhunter-AT-nitace.bsd.uchicago.edu>. |
|
769 | <jdhunter-AT-nitace.bsd.uchicago.edu>. | |
766 |
|
770 | |||
767 | 2005-02-05 Fernando Perez <fperez@colorado.edu> |
|
771 | 2005-02-05 Fernando Perez <fperez@colorado.edu> | |
768 |
|
772 | |||
769 | * IPython/Magic.py (magic_prun): Fix bug where prun would fail if |
|
773 | * IPython/Magic.py (magic_prun): Fix bug where prun would fail if | |
770 | the call had quote characters in it (the quotes were stripped). |
|
774 | the call had quote characters in it (the quotes were stripped). | |
771 |
|
775 | |||
772 | 2005-01-31 Fernando Perez <fperez@colorado.edu> |
|
776 | 2005-01-31 Fernando Perez <fperez@colorado.edu> | |
773 |
|
777 | |||
774 | * IPython/iplib.py (InteractiveShell.__init__): reduce reliance on |
|
778 | * IPython/iplib.py (InteractiveShell.__init__): reduce reliance on | |
775 | Itpl.itpl() to make the code more robust against psyco |
|
779 | Itpl.itpl() to make the code more robust against psyco | |
776 | optimizations. |
|
780 | optimizations. | |
777 |
|
781 | |||
778 | * IPython/Itpl.py (Itpl.__str__): Use a _getframe() call instead |
|
782 | * IPython/Itpl.py (Itpl.__str__): Use a _getframe() call instead | |
779 | of causing an exception. Quicker, cleaner. |
|
783 | of causing an exception. Quicker, cleaner. | |
780 |
|
784 | |||
781 | 2005-01-28 Fernando Perez <fperez@colorado.edu> |
|
785 | 2005-01-28 Fernando Perez <fperez@colorado.edu> | |
782 |
|
786 | |||
783 | * scripts/ipython_win_post_install.py (install): hardcode |
|
787 | * scripts/ipython_win_post_install.py (install): hardcode | |
784 | sys.prefix+'python.exe' as the executable path. It turns out that |
|
788 | sys.prefix+'python.exe' as the executable path. It turns out that | |
785 | during the post-installation run, sys.executable resolves to the |
|
789 | during the post-installation run, sys.executable resolves to the | |
786 | name of the binary installer! I should report this as a distutils |
|
790 | name of the binary installer! I should report this as a distutils | |
787 | bug, I think. I updated the .10 release with this tiny fix, to |
|
791 | bug, I think. I updated the .10 release with this tiny fix, to | |
788 | avoid annoying the lists further. |
|
792 | avoid annoying the lists further. | |
789 |
|
793 | |||
790 | 2005-01-27 *** Released version 0.6.10 |
|
794 | 2005-01-27 *** Released version 0.6.10 | |
791 |
|
795 | |||
792 | 2005-01-27 Fernando Perez <fperez@colorado.edu> |
|
796 | 2005-01-27 Fernando Perez <fperez@colorado.edu> | |
793 |
|
797 | |||
794 | * IPython/numutils.py (norm): Added 'inf' as optional name for |
|
798 | * IPython/numutils.py (norm): Added 'inf' as optional name for | |
795 | L-infinity norm, included references to mathworld.com for vector |
|
799 | L-infinity norm, included references to mathworld.com for vector | |
796 | norm definitions. |
|
800 | norm definitions. | |
797 | (amin/amax): added amin/amax for array min/max. Similar to what |
|
801 | (amin/amax): added amin/amax for array min/max. Similar to what | |
798 | pylab ships with after the recent reorganization of names. |
|
802 | pylab ships with after the recent reorganization of names. | |
799 | (spike/spike_odd): removed deprecated spike/spike_odd functions. |
|
803 | (spike/spike_odd): removed deprecated spike/spike_odd functions. | |
800 |
|
804 | |||
801 | * ipython.el: committed Alex's recent fixes and improvements. |
|
805 | * ipython.el: committed Alex's recent fixes and improvements. | |
802 | Tested with python-mode from CVS, and it looks excellent. Since |
|
806 | Tested with python-mode from CVS, and it looks excellent. Since | |
803 | python-mode hasn't released anything in a while, I'm temporarily |
|
807 | python-mode hasn't released anything in a while, I'm temporarily | |
804 | putting a copy of today's CVS (v 4.70) of python-mode in: |
|
808 | putting a copy of today's CVS (v 4.70) of python-mode in: | |
805 | http://ipython.scipy.org/tmp/python-mode.el |
|
809 | http://ipython.scipy.org/tmp/python-mode.el | |
806 |
|
810 | |||
807 | * scripts/ipython_win_post_install.py (install): Win32 fix to use |
|
811 | * scripts/ipython_win_post_install.py (install): Win32 fix to use | |
808 | sys.executable for the executable name, instead of assuming it's |
|
812 | sys.executable for the executable name, instead of assuming it's | |
809 | called 'python.exe' (the post-installer would have produced broken |
|
813 | called 'python.exe' (the post-installer would have produced broken | |
810 | setups on systems with a differently named python binary). |
|
814 | setups on systems with a differently named python binary). | |
811 |
|
815 | |||
812 | * IPython/PyColorize.py (Parser.__call__): change explicit '\n' |
|
816 | * IPython/PyColorize.py (Parser.__call__): change explicit '\n' | |
813 | references to os.linesep, to make the code more |
|
817 | references to os.linesep, to make the code more | |
814 | platform-independent. This is also part of the win32 coloring |
|
818 | platform-independent. This is also part of the win32 coloring | |
815 | fixes. |
|
819 | fixes. | |
816 |
|
820 | |||
817 | * IPython/genutils.py (page_dumb): Remove attempts to chop long |
|
821 | * IPython/genutils.py (page_dumb): Remove attempts to chop long | |
818 | lines, which actually cause coloring bugs because the length of |
|
822 | lines, which actually cause coloring bugs because the length of | |
819 | the line is very difficult to correctly compute with embedded |
|
823 | the line is very difficult to correctly compute with embedded | |
820 | escapes. This was the source of all the coloring problems under |
|
824 | escapes. This was the source of all the coloring problems under | |
821 | Win32. I think that _finally_, Win32 users have a properly |
|
825 | Win32. I think that _finally_, Win32 users have a properly | |
822 | working ipython in all respects. This would never have happened |
|
826 | working ipython in all respects. This would never have happened | |
823 | if not for Gary Bishop and Viktor Ransmayr's great help and work. |
|
827 | if not for Gary Bishop and Viktor Ransmayr's great help and work. | |
824 |
|
828 | |||
825 | 2005-01-26 *** Released version 0.6.9 |
|
829 | 2005-01-26 *** Released version 0.6.9 | |
826 |
|
830 | |||
827 | 2005-01-25 Fernando Perez <fperez@colorado.edu> |
|
831 | 2005-01-25 Fernando Perez <fperez@colorado.edu> | |
828 |
|
832 | |||
829 | * setup.py: finally, we have a true Windows installer, thanks to |
|
833 | * setup.py: finally, we have a true Windows installer, thanks to | |
830 | the excellent work of Viktor Ransmayr |
|
834 | the excellent work of Viktor Ransmayr | |
831 | <viktor.ransmayr-AT-t-online.de>. The docs have been updated for |
|
835 | <viktor.ransmayr-AT-t-online.de>. The docs have been updated for | |
832 | Windows users. The setup routine is quite a bit cleaner thanks to |
|
836 | Windows users. The setup routine is quite a bit cleaner thanks to | |
833 | this, and the post-install script uses the proper functions to |
|
837 | this, and the post-install script uses the proper functions to | |
834 | allow a clean de-installation using the standard Windows Control |
|
838 | allow a clean de-installation using the standard Windows Control | |
835 | Panel. |
|
839 | Panel. | |
836 |
|
840 | |||
837 | * IPython/genutils.py (get_home_dir): changed to use the $HOME |
|
841 | * IPython/genutils.py (get_home_dir): changed to use the $HOME | |
838 | environment variable under all OSes (including win32) if |
|
842 | environment variable under all OSes (including win32) if | |
839 | available. This will give consistency to win32 users who have set |
|
843 | available. This will give consistency to win32 users who have set | |
840 | this variable for any reason. If os.environ['HOME'] fails, the |
|
844 | this variable for any reason. If os.environ['HOME'] fails, the | |
841 | previous policy of using HOMEDRIVE\HOMEPATH kicks in. |
|
845 | previous policy of using HOMEDRIVE\HOMEPATH kicks in. | |
842 |
|
846 | |||
843 | 2005-01-24 Fernando Perez <fperez@colorado.edu> |
|
847 | 2005-01-24 Fernando Perez <fperez@colorado.edu> | |
844 |
|
848 | |||
845 | * IPython/numutils.py (empty_like): add empty_like(), similar to |
|
849 | * IPython/numutils.py (empty_like): add empty_like(), similar to | |
846 | zeros_like() but taking advantage of the new empty() Numeric routine. |
|
850 | zeros_like() but taking advantage of the new empty() Numeric routine. | |
847 |
|
851 | |||
848 | 2005-01-23 *** Released version 0.6.8 |
|
852 | 2005-01-23 *** Released version 0.6.8 | |
849 |
|
853 | |||
850 | 2005-01-22 Fernando Perez <fperez@colorado.edu> |
|
854 | 2005-01-22 Fernando Perez <fperez@colorado.edu> | |
851 |
|
855 | |||
852 | * IPython/Shell.py (MatplotlibShellBase.mplot_exec): I removed the |
|
856 | * IPython/Shell.py (MatplotlibShellBase.mplot_exec): I removed the | |
853 | automatic show() calls. After discussing things with JDH, it |
|
857 | automatic show() calls. After discussing things with JDH, it | |
854 | turns out there are too many corner cases where this can go wrong. |
|
858 | turns out there are too many corner cases where this can go wrong. | |
855 | It's best not to try to be 'too smart', and simply have ipython |
|
859 | It's best not to try to be 'too smart', and simply have ipython | |
856 | reproduce as much as possible the default behavior of a normal |
|
860 | reproduce as much as possible the default behavior of a normal | |
857 | python shell. |
|
861 | python shell. | |
858 |
|
862 | |||
859 | * IPython/iplib.py (InteractiveShell.__init__): Modified the |
|
863 | * IPython/iplib.py (InteractiveShell.__init__): Modified the | |
860 | line-splitting regexp and _prefilter() to avoid calling getattr() |
|
864 | line-splitting regexp and _prefilter() to avoid calling getattr() | |
861 | on assignments. This closes |
|
865 | on assignments. This closes | |
862 | http://www.scipy.net/roundup/ipython/issue24. Note that Python's |
|
866 | http://www.scipy.net/roundup/ipython/issue24. Note that Python's | |
863 | readline uses getattr(), so a simple <TAB> keypress is still |
|
867 | readline uses getattr(), so a simple <TAB> keypress is still | |
864 | enough to trigger getattr() calls on an object. |
|
868 | enough to trigger getattr() calls on an object. | |
865 |
|
869 | |||
866 | 2005-01-21 Fernando Perez <fperez@colorado.edu> |
|
870 | 2005-01-21 Fernando Perez <fperez@colorado.edu> | |
867 |
|
871 | |||
868 | * IPython/Shell.py (MatplotlibShellBase.magic_run): Fix the %run |
|
872 | * IPython/Shell.py (MatplotlibShellBase.magic_run): Fix the %run | |
869 | docstring under pylab so it doesn't mask the original. |
|
873 | docstring under pylab so it doesn't mask the original. | |
870 |
|
874 | |||
871 | 2005-01-21 *** Released version 0.6.7 |
|
875 | 2005-01-21 *** Released version 0.6.7 | |
872 |
|
876 | |||
873 | 2005-01-21 Fernando Perez <fperez@colorado.edu> |
|
877 | 2005-01-21 Fernando Perez <fperez@colorado.edu> | |
874 |
|
878 | |||
875 | * IPython/Shell.py (MTInteractiveShell.runcode): Trap a crash with |
|
879 | * IPython/Shell.py (MTInteractiveShell.runcode): Trap a crash with | |
876 | signal handling for win32 users in multithreaded mode. |
|
880 | signal handling for win32 users in multithreaded mode. | |
877 |
|
881 | |||
878 | 2005-01-17 Fernando Perez <fperez@colorado.edu> |
|
882 | 2005-01-17 Fernando Perez <fperez@colorado.edu> | |
879 |
|
883 | |||
880 | * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting |
|
884 | * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting | |
881 | instances with no __init__. After a crash report by Norbert Nemec |
|
885 | instances with no __init__. After a crash report by Norbert Nemec | |
882 | <Norbert-AT-nemec-online.de>. |
|
886 | <Norbert-AT-nemec-online.de>. | |
883 |
|
887 | |||
884 | 2005-01-14 Fernando Perez <fperez@colorado.edu> |
|
888 | 2005-01-14 Fernando Perez <fperez@colorado.edu> | |
885 |
|
889 | |||
886 | * IPython/ultraTB.py (VerboseTB.text): Fix bug in reporting of |
|
890 | * IPython/ultraTB.py (VerboseTB.text): Fix bug in reporting of | |
887 | names for verbose exceptions, when multiple dotted names and the |
|
891 | names for verbose exceptions, when multiple dotted names and the | |
888 | 'parent' object were present on the same line. |
|
892 | 'parent' object were present on the same line. | |
889 |
|
893 | |||
890 | 2005-01-11 Fernando Perez <fperez@colorado.edu> |
|
894 | 2005-01-11 Fernando Perez <fperez@colorado.edu> | |
891 |
|
895 | |||
892 | * IPython/genutils.py (flag_calls): new utility to trap and flag |
|
896 | * IPython/genutils.py (flag_calls): new utility to trap and flag | |
893 | calls in functions. I need it to clean up matplotlib support. |
|
897 | calls in functions. I need it to clean up matplotlib support. | |
894 | Also removed some deprecated code in genutils. |
|
898 | Also removed some deprecated code in genutils. | |
895 |
|
899 | |||
896 | * IPython/Shell.py (MatplotlibShellBase.mplot_exec): small fix so |
|
900 | * IPython/Shell.py (MatplotlibShellBase.mplot_exec): small fix so | |
897 | that matplotlib scripts called with %run, which don't call show() |
|
901 | that matplotlib scripts called with %run, which don't call show() | |
898 | themselves, still have their plotting windows open. |
|
902 | themselves, still have their plotting windows open. | |
899 |
|
903 | |||
900 | 2005-01-05 Fernando Perez <fperez@colorado.edu> |
|
904 | 2005-01-05 Fernando Perez <fperez@colorado.edu> | |
901 |
|
905 | |||
902 | * IPython/Shell.py (IPShellGTK.__init__): Patch by Andrew Straw |
|
906 | * IPython/Shell.py (IPShellGTK.__init__): Patch by Andrew Straw | |
903 | <astraw-AT-caltech.edu>, to fix gtk deprecation warnings. |
|
907 | <astraw-AT-caltech.edu>, to fix gtk deprecation warnings. | |
904 |
|
908 | |||
905 | 2004-12-19 Fernando Perez <fperez@colorado.edu> |
|
909 | 2004-12-19 Fernando Perez <fperez@colorado.edu> | |
906 |
|
910 | |||
907 | * IPython/Shell.py (MTInteractiveShell.runcode): Get rid of |
|
911 | * IPython/Shell.py (MTInteractiveShell.runcode): Get rid of | |
908 | parent_runcode, which was an eyesore. The same result can be |
|
912 | parent_runcode, which was an eyesore. The same result can be | |
909 | obtained with Python's regular superclass mechanisms. |
|
913 | obtained with Python's regular superclass mechanisms. | |
910 |
|
914 | |||
911 | 2004-12-17 Fernando Perez <fperez@colorado.edu> |
|
915 | 2004-12-17 Fernando Perez <fperez@colorado.edu> | |
912 |
|
916 | |||
913 | * IPython/Magic.py (Magic.magic_sc): Fix quote stripping problem |
|
917 | * IPython/Magic.py (Magic.magic_sc): Fix quote stripping problem | |
914 | reported by Prabhu. |
|
918 | reported by Prabhu. | |
915 | (Magic.magic_sx): direct all errors to Term.cerr (defaults to |
|
919 | (Magic.magic_sx): direct all errors to Term.cerr (defaults to | |
916 | sys.stderr) instead of explicitly calling sys.stderr. This helps |
|
920 | sys.stderr) instead of explicitly calling sys.stderr. This helps | |
917 | maintain our I/O abstractions clean, for future GUI embeddings. |
|
921 | maintain our I/O abstractions clean, for future GUI embeddings. | |
918 |
|
922 | |||
919 | * IPython/genutils.py (info): added new utility for sys.stderr |
|
923 | * IPython/genutils.py (info): added new utility for sys.stderr | |
920 | unified info message handling (thin wrapper around warn()). |
|
924 | unified info message handling (thin wrapper around warn()). | |
921 |
|
925 | |||
922 | * IPython/ultraTB.py (VerboseTB.text): Fix misreported global |
|
926 | * IPython/ultraTB.py (VerboseTB.text): Fix misreported global | |
923 | composite (dotted) names on verbose exceptions. |
|
927 | composite (dotted) names on verbose exceptions. | |
924 | (VerboseTB.nullrepr): harden against another kind of errors which |
|
928 | (VerboseTB.nullrepr): harden against another kind of errors which | |
925 | Python's inspect module can trigger, and which were crashing |
|
929 | Python's inspect module can trigger, and which were crashing | |
926 | IPython. Thanks to a report by Marco Lombardi |
|
930 | IPython. Thanks to a report by Marco Lombardi | |
927 | <mlombard-AT-ma010192.hq.eso.org>. |
|
931 | <mlombard-AT-ma010192.hq.eso.org>. | |
928 |
|
932 | |||
929 | 2004-12-13 *** Released version 0.6.6 |
|
933 | 2004-12-13 *** Released version 0.6.6 | |
930 |
|
934 | |||
931 | 2004-12-12 Fernando Perez <fperez@colorado.edu> |
|
935 | 2004-12-12 Fernando Perez <fperez@colorado.edu> | |
932 |
|
936 | |||
933 | * IPython/Shell.py (IPShellGTK.mainloop): catch RuntimeErrors |
|
937 | * IPython/Shell.py (IPShellGTK.mainloop): catch RuntimeErrors | |
934 | generated by pygtk upon initialization if it was built without |
|
938 | generated by pygtk upon initialization if it was built without | |
935 | threads (for matplotlib users). After a crash reported by |
|
939 | threads (for matplotlib users). After a crash reported by | |
936 | Leguijt, Jaap J SIEP-EPT-RES <Jaap.Leguijt-AT-shell.com>. |
|
940 | Leguijt, Jaap J SIEP-EPT-RES <Jaap.Leguijt-AT-shell.com>. | |
937 |
|
941 | |||
938 | * IPython/ipmaker.py (make_IPython): fix small bug in the |
|
942 | * IPython/ipmaker.py (make_IPython): fix small bug in the | |
939 | import_some parameter for multiple imports. |
|
943 | import_some parameter for multiple imports. | |
940 |
|
944 | |||
941 | * IPython/iplib.py (ipmagic): simplified the interface of |
|
945 | * IPython/iplib.py (ipmagic): simplified the interface of | |
942 | ipmagic() to take a single string argument, just as it would be |
|
946 | ipmagic() to take a single string argument, just as it would be | |
943 | typed at the IPython cmd line. |
|
947 | typed at the IPython cmd line. | |
944 | (ipalias): Added new ipalias() with an interface identical to |
|
948 | (ipalias): Added new ipalias() with an interface identical to | |
945 | ipmagic(). This completes exposing a pure python interface to the |
|
949 | ipmagic(). This completes exposing a pure python interface to the | |
946 | alias and magic system, which can be used in loops or more complex |
|
950 | alias and magic system, which can be used in loops or more complex | |
947 | code where IPython's automatic line mangling is not active. |
|
951 | code where IPython's automatic line mangling is not active. | |
948 |
|
952 | |||
949 | * IPython/genutils.py (timing): changed interface of timing to |
|
953 | * IPython/genutils.py (timing): changed interface of timing to | |
950 | simply run code once, which is the most common case. timings() |
|
954 | simply run code once, which is the most common case. timings() | |
951 | remains unchanged, for the cases where you want multiple runs. |
|
955 | remains unchanged, for the cases where you want multiple runs. | |
952 |
|
956 | |||
953 | * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix a |
|
957 | * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix a | |
954 | bug where Python2.2 crashes with exec'ing code which does not end |
|
958 | bug where Python2.2 crashes with exec'ing code which does not end | |
955 | in a single newline. Python 2.3 is OK, so I hadn't noticed this |
|
959 | in a single newline. Python 2.3 is OK, so I hadn't noticed this | |
956 | before. |
|
960 | before. | |
957 |
|
961 | |||
958 | 2004-12-10 Fernando Perez <fperez@colorado.edu> |
|
962 | 2004-12-10 Fernando Perez <fperez@colorado.edu> | |
959 |
|
963 | |||
960 | * IPython/Magic.py (Magic.magic_prun): changed name of option from |
|
964 | * IPython/Magic.py (Magic.magic_prun): changed name of option from | |
961 | -t to -T, to accomodate the new -t flag in %run (the %run and |
|
965 | -t to -T, to accomodate the new -t flag in %run (the %run and | |
962 | %prun options are kind of intermixed, and it's not easy to change |
|
966 | %prun options are kind of intermixed, and it's not easy to change | |
963 | this with the limitations of python's getopt). |
|
967 | this with the limitations of python's getopt). | |
964 |
|
968 | |||
965 | * IPython/Magic.py (Magic.magic_run): Added new -t option to time |
|
969 | * IPython/Magic.py (Magic.magic_run): Added new -t option to time | |
966 | the execution of scripts. It's not as fine-tuned as timeit.py, |
|
970 | the execution of scripts. It's not as fine-tuned as timeit.py, | |
967 | but it works from inside ipython (and under 2.2, which lacks |
|
971 | but it works from inside ipython (and under 2.2, which lacks | |
968 | timeit.py). Optionally a number of runs > 1 can be given for |
|
972 | timeit.py). Optionally a number of runs > 1 can be given for | |
969 | timing very short-running code. |
|
973 | timing very short-running code. | |
970 |
|
974 | |||
971 | * IPython/genutils.py (uniq_stable): new routine which returns a |
|
975 | * IPython/genutils.py (uniq_stable): new routine which returns a | |
972 | list of unique elements in any iterable, but in stable order of |
|
976 | list of unique elements in any iterable, but in stable order of | |
973 | appearance. I needed this for the ultraTB fixes, and it's a handy |
|
977 | appearance. I needed this for the ultraTB fixes, and it's a handy | |
974 | utility. |
|
978 | utility. | |
975 |
|
979 | |||
976 | * IPython/ultraTB.py (VerboseTB.text): Fix proper reporting of |
|
980 | * IPython/ultraTB.py (VerboseTB.text): Fix proper reporting of | |
977 | dotted names in Verbose exceptions. This had been broken since |
|
981 | dotted names in Verbose exceptions. This had been broken since | |
978 | the very start, now x.y will properly be printed in a Verbose |
|
982 | the very start, now x.y will properly be printed in a Verbose | |
979 | traceback, instead of x being shown and y appearing always as an |
|
983 | traceback, instead of x being shown and y appearing always as an | |
980 | 'undefined global'. Getting this to work was a bit tricky, |
|
984 | 'undefined global'. Getting this to work was a bit tricky, | |
981 | because by default python tokenizers are stateless. Saved by |
|
985 | because by default python tokenizers are stateless. Saved by | |
982 | python's ability to easily add a bit of state to an arbitrary |
|
986 | python's ability to easily add a bit of state to an arbitrary | |
983 | function (without needing to build a full-blown callable object). |
|
987 | function (without needing to build a full-blown callable object). | |
984 |
|
988 | |||
985 | Also big cleanup of this code, which had horrendous runtime |
|
989 | Also big cleanup of this code, which had horrendous runtime | |
986 | lookups of zillions of attributes for colorization. Moved all |
|
990 | lookups of zillions of attributes for colorization. Moved all | |
987 | this code into a few templates, which make it cleaner and quicker. |
|
991 | this code into a few templates, which make it cleaner and quicker. | |
988 |
|
992 | |||
989 | Printout quality was also improved for Verbose exceptions: one |
|
993 | Printout quality was also improved for Verbose exceptions: one | |
990 | variable per line, and memory addresses are printed (this can be |
|
994 | variable per line, and memory addresses are printed (this can be | |
991 | quite handy in nasty debugging situations, which is what Verbose |
|
995 | quite handy in nasty debugging situations, which is what Verbose | |
992 | is for). |
|
996 | is for). | |
993 |
|
997 | |||
994 | * IPython/ipmaker.py (make_IPython): Do NOT execute files named in |
|
998 | * IPython/ipmaker.py (make_IPython): Do NOT execute files named in | |
995 | the command line as scripts to be loaded by embedded instances. |
|
999 | the command line as scripts to be loaded by embedded instances. | |
996 | Doing so has the potential for an infinite recursion if there are |
|
1000 | Doing so has the potential for an infinite recursion if there are | |
997 | exceptions thrown in the process. This fixes a strange crash |
|
1001 | exceptions thrown in the process. This fixes a strange crash | |
998 | reported by Philippe MULLER <muller-AT-irit.fr>. |
|
1002 | reported by Philippe MULLER <muller-AT-irit.fr>. | |
999 |
|
1003 | |||
1000 | 2004-12-09 Fernando Perez <fperez@colorado.edu> |
|
1004 | 2004-12-09 Fernando Perez <fperez@colorado.edu> | |
1001 |
|
1005 | |||
1002 | * IPython/Shell.py (MatplotlibShellBase.use): Change pylab support |
|
1006 | * IPython/Shell.py (MatplotlibShellBase.use): Change pylab support | |
1003 | to reflect new names in matplotlib, which now expose the |
|
1007 | to reflect new names in matplotlib, which now expose the | |
1004 | matlab-compatible interface via a pylab module instead of the |
|
1008 | matlab-compatible interface via a pylab module instead of the | |
1005 | 'matlab' name. The new code is backwards compatible, so users of |
|
1009 | 'matlab' name. The new code is backwards compatible, so users of | |
1006 | all matplotlib versions are OK. Patch by J. Hunter. |
|
1010 | all matplotlib versions are OK. Patch by J. Hunter. | |
1007 |
|
1011 | |||
1008 | * IPython/OInspect.py (Inspector.pinfo): Add to object? printing |
|
1012 | * IPython/OInspect.py (Inspector.pinfo): Add to object? printing | |
1009 | of __init__ docstrings for instances (class docstrings are already |
|
1013 | of __init__ docstrings for instances (class docstrings are already | |
1010 | automatically printed). Instances with customized docstrings |
|
1014 | automatically printed). Instances with customized docstrings | |
1011 | (indep. of the class) are also recognized and all 3 separate |
|
1015 | (indep. of the class) are also recognized and all 3 separate | |
1012 | docstrings are printed (instance, class, constructor). After some |
|
1016 | docstrings are printed (instance, class, constructor). After some | |
1013 | comments/suggestions by J. Hunter. |
|
1017 | comments/suggestions by J. Hunter. | |
1014 |
|
1018 | |||
1015 | 2004-12-05 Fernando Perez <fperez@colorado.edu> |
|
1019 | 2004-12-05 Fernando Perez <fperez@colorado.edu> | |
1016 |
|
1020 | |||
1017 | * IPython/iplib.py (MagicCompleter.complete): Remove annoying |
|
1021 | * IPython/iplib.py (MagicCompleter.complete): Remove annoying | |
1018 | warnings when tab-completion fails and triggers an exception. |
|
1022 | warnings when tab-completion fails and triggers an exception. | |
1019 |
|
1023 | |||
1020 | 2004-12-03 Fernando Perez <fperez@colorado.edu> |
|
1024 | 2004-12-03 Fernando Perez <fperez@colorado.edu> | |
1021 |
|
1025 | |||
1022 | * IPython/Magic.py (magic_prun): Fix bug where an exception would |
|
1026 | * IPython/Magic.py (magic_prun): Fix bug where an exception would | |
1023 | be triggered when using 'run -p'. An incorrect option flag was |
|
1027 | be triggered when using 'run -p'. An incorrect option flag was | |
1024 | being set ('d' instead of 'D'). |
|
1028 | being set ('d' instead of 'D'). | |
1025 | (manpage): fix missing escaped \- sign. |
|
1029 | (manpage): fix missing escaped \- sign. | |
1026 |
|
1030 | |||
1027 | 2004-11-30 *** Released version 0.6.5 |
|
1031 | 2004-11-30 *** Released version 0.6.5 | |
1028 |
|
1032 | |||
1029 | 2004-11-30 Fernando Perez <fperez@colorado.edu> |
|
1033 | 2004-11-30 Fernando Perez <fperez@colorado.edu> | |
1030 |
|
1034 | |||
1031 | * IPython/Magic.py (Magic.magic_run): Fix bug in breakpoint |
|
1035 | * IPython/Magic.py (Magic.magic_run): Fix bug in breakpoint | |
1032 | setting with -d option. |
|
1036 | setting with -d option. | |
1033 |
|
1037 | |||
1034 | * setup.py (docfiles): Fix problem where the doc glob I was using |
|
1038 | * setup.py (docfiles): Fix problem where the doc glob I was using | |
1035 | was COMPLETELY BROKEN. It was giving the right files by pure |
|
1039 | was COMPLETELY BROKEN. It was giving the right files by pure | |
1036 | accident, but failed once I tried to include ipython.el. Note: |
|
1040 | accident, but failed once I tried to include ipython.el. Note: | |
1037 | glob() does NOT allow you to do exclusion on multiple endings! |
|
1041 | glob() does NOT allow you to do exclusion on multiple endings! | |
1038 |
|
1042 | |||
1039 | 2004-11-29 Fernando Perez <fperez@colorado.edu> |
|
1043 | 2004-11-29 Fernando Perez <fperez@colorado.edu> | |
1040 |
|
1044 | |||
1041 | * IPython/usage.py (__doc__): cleaned up usage docstring, by using |
|
1045 | * IPython/usage.py (__doc__): cleaned up usage docstring, by using | |
1042 | the manpage as the source. Better formatting & consistency. |
|
1046 | the manpage as the source. Better formatting & consistency. | |
1043 |
|
1047 | |||
1044 | * IPython/Magic.py (magic_run): Added new -d option, to run |
|
1048 | * IPython/Magic.py (magic_run): Added new -d option, to run | |
1045 | scripts under the control of the python pdb debugger. Note that |
|
1049 | scripts under the control of the python pdb debugger. Note that | |
1046 | this required changing the %prun option -d to -D, to avoid a clash |
|
1050 | this required changing the %prun option -d to -D, to avoid a clash | |
1047 | (since %run must pass options to %prun, and getopt is too dumb to |
|
1051 | (since %run must pass options to %prun, and getopt is too dumb to | |
1048 | handle options with string values with embedded spaces). Thanks |
|
1052 | handle options with string values with embedded spaces). Thanks | |
1049 | to a suggestion by Matthew Arnison <maffew-AT-cat.org.au>. |
|
1053 | to a suggestion by Matthew Arnison <maffew-AT-cat.org.au>. | |
1050 | (magic_who_ls): added type matching to %who and %whos, so that one |
|
1054 | (magic_who_ls): added type matching to %who and %whos, so that one | |
1051 | can filter their output to only include variables of certain |
|
1055 | can filter their output to only include variables of certain | |
1052 | types. Another suggestion by Matthew. |
|
1056 | types. Another suggestion by Matthew. | |
1053 | (magic_whos): Added memory summaries in kb and Mb for arrays. |
|
1057 | (magic_whos): Added memory summaries in kb and Mb for arrays. | |
1054 | (magic_who): Improve formatting (break lines every 9 vars). |
|
1058 | (magic_who): Improve formatting (break lines every 9 vars). | |
1055 |
|
1059 | |||
1056 | 2004-11-28 Fernando Perez <fperez@colorado.edu> |
|
1060 | 2004-11-28 Fernando Perez <fperez@colorado.edu> | |
1057 |
|
1061 | |||
1058 | * IPython/Logger.py (Logger.log): Fix bug in syncing the input |
|
1062 | * IPython/Logger.py (Logger.log): Fix bug in syncing the input | |
1059 | cache when empty lines were present. |
|
1063 | cache when empty lines were present. | |
1060 |
|
1064 | |||
1061 | 2004-11-24 Fernando Perez <fperez@colorado.edu> |
|
1065 | 2004-11-24 Fernando Perez <fperez@colorado.edu> | |
1062 |
|
1066 | |||
1063 | * IPython/usage.py (__doc__): document the re-activated threading |
|
1067 | * IPython/usage.py (__doc__): document the re-activated threading | |
1064 | options for WX and GTK. |
|
1068 | options for WX and GTK. | |
1065 |
|
1069 | |||
1066 | 2004-11-23 Fernando Perez <fperez@colorado.edu> |
|
1070 | 2004-11-23 Fernando Perez <fperez@colorado.edu> | |
1067 |
|
1071 | |||
1068 | * IPython/Shell.py (start): Added Prabhu's big patch to reactivate |
|
1072 | * IPython/Shell.py (start): Added Prabhu's big patch to reactivate | |
1069 | the -wthread and -gthread options, along with a new -tk one to try |
|
1073 | the -wthread and -gthread options, along with a new -tk one to try | |
1070 | and coordinate Tk threading with wx/gtk. The tk support is very |
|
1074 | and coordinate Tk threading with wx/gtk. The tk support is very | |
1071 | platform dependent, since it seems to require Tcl and Tk to be |
|
1075 | platform dependent, since it seems to require Tcl and Tk to be | |
1072 | built with threads (Fedora1/2 appears NOT to have it, but in |
|
1076 | built with threads (Fedora1/2 appears NOT to have it, but in | |
1073 | Prabhu's Debian boxes it works OK). But even with some Tk |
|
1077 | Prabhu's Debian boxes it works OK). But even with some Tk | |
1074 | limitations, this is a great improvement. |
|
1078 | limitations, this is a great improvement. | |
1075 |
|
1079 | |||
1076 | * IPython/Prompts.py (prompt_specials_color): Added \t for time |
|
1080 | * IPython/Prompts.py (prompt_specials_color): Added \t for time | |
1077 | info in user prompts. Patch by Prabhu. |
|
1081 | info in user prompts. Patch by Prabhu. | |
1078 |
|
1082 | |||
1079 | 2004-11-18 Fernando Perez <fperez@colorado.edu> |
|
1083 | 2004-11-18 Fernando Perez <fperez@colorado.edu> | |
1080 |
|
1084 | |||
1081 | * IPython/genutils.py (ask_yes_no): Add check for a max of 20 |
|
1085 | * IPython/genutils.py (ask_yes_no): Add check for a max of 20 | |
1082 | EOFErrors and bail, to avoid infinite loops if a non-terminating |
|
1086 | EOFErrors and bail, to avoid infinite loops if a non-terminating | |
1083 | file is fed into ipython. Patch submitted in issue 19 by user, |
|
1087 | file is fed into ipython. Patch submitted in issue 19 by user, | |
1084 | many thanks. |
|
1088 | many thanks. | |
1085 |
|
1089 | |||
1086 | * IPython/iplib.py (InteractiveShell.handle_auto): do NOT trigger |
|
1090 | * IPython/iplib.py (InteractiveShell.handle_auto): do NOT trigger | |
1087 | autoquote/parens in continuation prompts, which can cause lots of |
|
1091 | autoquote/parens in continuation prompts, which can cause lots of | |
1088 | problems. Closes roundup issue 20. |
|
1092 | problems. Closes roundup issue 20. | |
1089 |
|
1093 | |||
1090 | 2004-11-17 Fernando Perez <fperez@colorado.edu> |
|
1094 | 2004-11-17 Fernando Perez <fperez@colorado.edu> | |
1091 |
|
1095 | |||
1092 | * debian/control (Build-Depends-Indep): Fix dpatch dependency, |
|
1096 | * debian/control (Build-Depends-Indep): Fix dpatch dependency, | |
1093 | reported as debian bug #280505. I'm not sure my local changelog |
|
1097 | reported as debian bug #280505. I'm not sure my local changelog | |
1094 | entry has the proper debian format (Jack?). |
|
1098 | entry has the proper debian format (Jack?). | |
1095 |
|
1099 | |||
1096 | 2004-11-08 *** Released version 0.6.4 |
|
1100 | 2004-11-08 *** Released version 0.6.4 | |
1097 |
|
1101 | |||
1098 | 2004-11-08 Fernando Perez <fperez@colorado.edu> |
|
1102 | 2004-11-08 Fernando Perez <fperez@colorado.edu> | |
1099 |
|
1103 | |||
1100 | * IPython/iplib.py (init_readline): Fix exit message for Windows |
|
1104 | * IPython/iplib.py (init_readline): Fix exit message for Windows | |
1101 | when readline is active. Thanks to a report by Eric Jones |
|
1105 | when readline is active. Thanks to a report by Eric Jones | |
1102 | <eric-AT-enthought.com>. |
|
1106 | <eric-AT-enthought.com>. | |
1103 |
|
1107 | |||
1104 | 2004-11-07 Fernando Perez <fperez@colorado.edu> |
|
1108 | 2004-11-07 Fernando Perez <fperez@colorado.edu> | |
1105 |
|
1109 | |||
1106 | * IPython/genutils.py (page): Add a trap for OSError exceptions, |
|
1110 | * IPython/genutils.py (page): Add a trap for OSError exceptions, | |
1107 | sometimes seen by win2k/cygwin users. |
|
1111 | sometimes seen by win2k/cygwin users. | |
1108 |
|
1112 | |||
1109 | 2004-11-06 Fernando Perez <fperez@colorado.edu> |
|
1113 | 2004-11-06 Fernando Perez <fperez@colorado.edu> | |
1110 |
|
1114 | |||
1111 | * IPython/iplib.py (interact): Change the handling of %Exit from |
|
1115 | * IPython/iplib.py (interact): Change the handling of %Exit from | |
1112 | trying to propagate a SystemExit to an internal ipython flag. |
|
1116 | trying to propagate a SystemExit to an internal ipython flag. | |
1113 | This is less elegant than using Python's exception mechanism, but |
|
1117 | This is less elegant than using Python's exception mechanism, but | |
1114 | I can't get that to work reliably with threads, so under -pylab |
|
1118 | I can't get that to work reliably with threads, so under -pylab | |
1115 | %Exit was hanging IPython. Cross-thread exception handling is |
|
1119 | %Exit was hanging IPython. Cross-thread exception handling is | |
1116 | really a bitch. Thaks to a bug report by Stephen Walton |
|
1120 | really a bitch. Thaks to a bug report by Stephen Walton | |
1117 | <stephen.walton-AT-csun.edu>. |
|
1121 | <stephen.walton-AT-csun.edu>. | |
1118 |
|
1122 | |||
1119 | 2004-11-04 Fernando Perez <fperez@colorado.edu> |
|
1123 | 2004-11-04 Fernando Perez <fperez@colorado.edu> | |
1120 |
|
1124 | |||
1121 | * IPython/iplib.py (raw_input_original): store a pointer to the |
|
1125 | * IPython/iplib.py (raw_input_original): store a pointer to the | |
1122 | true raw_input to harden against code which can modify it |
|
1126 | true raw_input to harden against code which can modify it | |
1123 | (wx.py.PyShell does this and would otherwise crash ipython). |
|
1127 | (wx.py.PyShell does this and would otherwise crash ipython). | |
1124 | Thanks to a bug report by Jim Flowers <james.flowers-AT-lgx.com>. |
|
1128 | Thanks to a bug report by Jim Flowers <james.flowers-AT-lgx.com>. | |
1125 |
|
1129 | |||
1126 | * IPython/Shell.py (MTInteractiveShell.runsource): Cleaner fix for |
|
1130 | * IPython/Shell.py (MTInteractiveShell.runsource): Cleaner fix for | |
1127 | Ctrl-C problem, which does not mess up the input line. |
|
1131 | Ctrl-C problem, which does not mess up the input line. | |
1128 |
|
1132 | |||
1129 | 2004-11-03 Fernando Perez <fperez@colorado.edu> |
|
1133 | 2004-11-03 Fernando Perez <fperez@colorado.edu> | |
1130 |
|
1134 | |||
1131 | * IPython/Release.py: Changed licensing to BSD, in all files. |
|
1135 | * IPython/Release.py: Changed licensing to BSD, in all files. | |
1132 | (name): lowercase name for tarball/RPM release. |
|
1136 | (name): lowercase name for tarball/RPM release. | |
1133 |
|
1137 | |||
1134 | * IPython/OInspect.py (getdoc): wrap inspect.getdoc() safely for |
|
1138 | * IPython/OInspect.py (getdoc): wrap inspect.getdoc() safely for | |
1135 | use throughout ipython. |
|
1139 | use throughout ipython. | |
1136 |
|
1140 | |||
1137 | * IPython/Magic.py (Magic._ofind): Switch to using the new |
|
1141 | * IPython/Magic.py (Magic._ofind): Switch to using the new | |
1138 | OInspect.getdoc() function. |
|
1142 | OInspect.getdoc() function. | |
1139 |
|
1143 | |||
1140 | * IPython/Shell.py (sigint_handler): Hack to ignore the execution |
|
1144 | * IPython/Shell.py (sigint_handler): Hack to ignore the execution | |
1141 | of the line currently being canceled via Ctrl-C. It's extremely |
|
1145 | of the line currently being canceled via Ctrl-C. It's extremely | |
1142 | ugly, but I don't know how to do it better (the problem is one of |
|
1146 | ugly, but I don't know how to do it better (the problem is one of | |
1143 | handling cross-thread exceptions). |
|
1147 | handling cross-thread exceptions). | |
1144 |
|
1148 | |||
1145 | 2004-10-28 Fernando Perez <fperez@colorado.edu> |
|
1149 | 2004-10-28 Fernando Perez <fperez@colorado.edu> | |
1146 |
|
1150 | |||
1147 | * IPython/Shell.py (signal_handler): add signal handlers to trap |
|
1151 | * IPython/Shell.py (signal_handler): add signal handlers to trap | |
1148 | SIGINT and SIGSEGV in threaded code properly. Thanks to a bug |
|
1152 | SIGINT and SIGSEGV in threaded code properly. Thanks to a bug | |
1149 | report by Francesc Alted. |
|
1153 | report by Francesc Alted. | |
1150 |
|
1154 | |||
1151 | 2004-10-21 Fernando Perez <fperez@colorado.edu> |
|
1155 | 2004-10-21 Fernando Perez <fperez@colorado.edu> | |
1152 |
|
1156 | |||
1153 | * IPython/Extensions/InterpreterExec.py (prefilter_shell): Fix @ |
|
1157 | * IPython/Extensions/InterpreterExec.py (prefilter_shell): Fix @ | |
1154 | to % for pysh syntax extensions. |
|
1158 | to % for pysh syntax extensions. | |
1155 |
|
1159 | |||
1156 | 2004-10-09 Fernando Perez <fperez@colorado.edu> |
|
1160 | 2004-10-09 Fernando Perez <fperez@colorado.edu> | |
1157 |
|
1161 | |||
1158 | * IPython/Magic.py (Magic.magic_whos): modify output of Numeric |
|
1162 | * IPython/Magic.py (Magic.magic_whos): modify output of Numeric | |
1159 | arrays to print a more useful summary, without calling str(arr). |
|
1163 | arrays to print a more useful summary, without calling str(arr). | |
1160 | This avoids the problem of extremely lengthy computations which |
|
1164 | This avoids the problem of extremely lengthy computations which | |
1161 | occur if arr is large, and appear to the user as a system lockup |
|
1165 | occur if arr is large, and appear to the user as a system lockup | |
1162 | with 100% cpu activity. After a suggestion by Kristian Sandberg |
|
1166 | with 100% cpu activity. After a suggestion by Kristian Sandberg | |
1163 | <Kristian.Sandberg@colorado.edu>. |
|
1167 | <Kristian.Sandberg@colorado.edu>. | |
1164 | (Magic.__init__): fix bug in global magic escapes not being |
|
1168 | (Magic.__init__): fix bug in global magic escapes not being | |
1165 | correctly set. |
|
1169 | correctly set. | |
1166 |
|
1170 | |||
1167 | 2004-10-08 Fernando Perez <fperez@colorado.edu> |
|
1171 | 2004-10-08 Fernando Perez <fperez@colorado.edu> | |
1168 |
|
1172 | |||
1169 | * IPython/Magic.py (__license__): change to absolute imports of |
|
1173 | * IPython/Magic.py (__license__): change to absolute imports of | |
1170 | ipython's own internal packages, to start adapting to the absolute |
|
1174 | ipython's own internal packages, to start adapting to the absolute | |
1171 | import requirement of PEP-328. |
|
1175 | import requirement of PEP-328. | |
1172 |
|
1176 | |||
1173 | * IPython/genutils.py (__author__): Fix coding to utf-8 on all |
|
1177 | * IPython/genutils.py (__author__): Fix coding to utf-8 on all | |
1174 | files, and standardize author/license marks through the Release |
|
1178 | files, and standardize author/license marks through the Release | |
1175 | module instead of having per/file stuff (except for files with |
|
1179 | module instead of having per/file stuff (except for files with | |
1176 | particular licenses, like the MIT/PSF-licensed codes). |
|
1180 | particular licenses, like the MIT/PSF-licensed codes). | |
1177 |
|
1181 | |||
1178 | * IPython/Debugger.py: remove dead code for python 2.1 |
|
1182 | * IPython/Debugger.py: remove dead code for python 2.1 | |
1179 |
|
1183 | |||
1180 | 2004-10-04 Fernando Perez <fperez@colorado.edu> |
|
1184 | 2004-10-04 Fernando Perez <fperez@colorado.edu> | |
1181 |
|
1185 | |||
1182 | * IPython/iplib.py (ipmagic): New function for accessing magics |
|
1186 | * IPython/iplib.py (ipmagic): New function for accessing magics | |
1183 | via a normal python function call. |
|
1187 | via a normal python function call. | |
1184 |
|
1188 | |||
1185 | * IPython/Magic.py (Magic.magic_magic): Change the magic escape |
|
1189 | * IPython/Magic.py (Magic.magic_magic): Change the magic escape | |
1186 | from '@' to '%', to accomodate the new @decorator syntax of python |
|
1190 | from '@' to '%', to accomodate the new @decorator syntax of python | |
1187 | 2.4. |
|
1191 | 2.4. | |
1188 |
|
1192 | |||
1189 | 2004-09-29 Fernando Perez <fperez@colorado.edu> |
|
1193 | 2004-09-29 Fernando Perez <fperez@colorado.edu> | |
1190 |
|
1194 | |||
1191 | * IPython/Shell.py (MatplotlibShellBase.use): Added a wrapper to |
|
1195 | * IPython/Shell.py (MatplotlibShellBase.use): Added a wrapper to | |
1192 | matplotlib.use to prevent running scripts which try to switch |
|
1196 | matplotlib.use to prevent running scripts which try to switch | |
1193 | interactive backends from within ipython. This will just crash |
|
1197 | interactive backends from within ipython. This will just crash | |
1194 | the python interpreter, so we can't allow it (but a detailed error |
|
1198 | the python interpreter, so we can't allow it (but a detailed error | |
1195 | is given to the user). |
|
1199 | is given to the user). | |
1196 |
|
1200 | |||
1197 | 2004-09-28 Fernando Perez <fperez@colorado.edu> |
|
1201 | 2004-09-28 Fernando Perez <fperez@colorado.edu> | |
1198 |
|
1202 | |||
1199 | * IPython/Shell.py (MatplotlibShellBase.mplot_exec): |
|
1203 | * IPython/Shell.py (MatplotlibShellBase.mplot_exec): | |
1200 | matplotlib-related fixes so that using @run with non-matplotlib |
|
1204 | matplotlib-related fixes so that using @run with non-matplotlib | |
1201 | scripts doesn't pop up spurious plot windows. This requires |
|
1205 | scripts doesn't pop up spurious plot windows. This requires | |
1202 | matplotlib >= 0.63, where I had to make some changes as well. |
|
1206 | matplotlib >= 0.63, where I had to make some changes as well. | |
1203 |
|
1207 | |||
1204 | * IPython/ipmaker.py (make_IPython): update version requirement to |
|
1208 | * IPython/ipmaker.py (make_IPython): update version requirement to | |
1205 | python 2.2. |
|
1209 | python 2.2. | |
1206 |
|
1210 | |||
1207 | * IPython/iplib.py (InteractiveShell.mainloop): Add an optional |
|
1211 | * IPython/iplib.py (InteractiveShell.mainloop): Add an optional | |
1208 | banner arg for embedded customization. |
|
1212 | banner arg for embedded customization. | |
1209 |
|
1213 | |||
1210 | * IPython/Magic.py (Magic.__init__): big cleanup to remove all |
|
1214 | * IPython/Magic.py (Magic.__init__): big cleanup to remove all | |
1211 | explicit uses of __IP as the IPython's instance name. Now things |
|
1215 | explicit uses of __IP as the IPython's instance name. Now things | |
1212 | are properly handled via the shell.name value. The actual code |
|
1216 | are properly handled via the shell.name value. The actual code | |
1213 | is a bit ugly b/c I'm doing it via a global in Magic.py, but this |
|
1217 | is a bit ugly b/c I'm doing it via a global in Magic.py, but this | |
1214 | is much better than before. I'll clean things completely when the |
|
1218 | is much better than before. I'll clean things completely when the | |
1215 | magic stuff gets a real overhaul. |
|
1219 | magic stuff gets a real overhaul. | |
1216 |
|
1220 | |||
1217 | * ipython.1: small fixes, sent in by Jack Moffit. He also sent in |
|
1221 | * ipython.1: small fixes, sent in by Jack Moffit. He also sent in | |
1218 | minor changes to debian dir. |
|
1222 | minor changes to debian dir. | |
1219 |
|
1223 | |||
1220 | * IPython/iplib.py (InteractiveShell.__init__): Fix adding a |
|
1224 | * IPython/iplib.py (InteractiveShell.__init__): Fix adding a | |
1221 | pointer to the shell itself in the interactive namespace even when |
|
1225 | pointer to the shell itself in the interactive namespace even when | |
1222 | a user-supplied dict is provided. This is needed for embedding |
|
1226 | a user-supplied dict is provided. This is needed for embedding | |
1223 | purposes (found by tests with Michel Sanner). |
|
1227 | purposes (found by tests with Michel Sanner). | |
1224 |
|
1228 | |||
1225 | 2004-09-27 Fernando Perez <fperez@colorado.edu> |
|
1229 | 2004-09-27 Fernando Perez <fperez@colorado.edu> | |
1226 |
|
1230 | |||
1227 | * IPython/UserConfig/ipythonrc: remove []{} from |
|
1231 | * IPython/UserConfig/ipythonrc: remove []{} from | |
1228 | readline_remove_delims, so that things like [modname.<TAB> do |
|
1232 | readline_remove_delims, so that things like [modname.<TAB> do | |
1229 | proper completion. This disables [].TAB, but that's a less common |
|
1233 | proper completion. This disables [].TAB, but that's a less common | |
1230 | case than module names in list comprehensions, for example. |
|
1234 | case than module names in list comprehensions, for example. | |
1231 | Thanks to a report by Andrea Riciputi. |
|
1235 | Thanks to a report by Andrea Riciputi. | |
1232 |
|
1236 | |||
1233 | 2004-09-09 Fernando Perez <fperez@colorado.edu> |
|
1237 | 2004-09-09 Fernando Perez <fperez@colorado.edu> | |
1234 |
|
1238 | |||
1235 | * IPython/Shell.py (IPShellGTK.mainloop): reorder to avoid |
|
1239 | * IPython/Shell.py (IPShellGTK.mainloop): reorder to avoid | |
1236 | blocking problems in win32 and osx. Fix by John. |
|
1240 | blocking problems in win32 and osx. Fix by John. | |
1237 |
|
1241 | |||
1238 | 2004-09-08 Fernando Perez <fperez@colorado.edu> |
|
1242 | 2004-09-08 Fernando Perez <fperez@colorado.edu> | |
1239 |
|
1243 | |||
1240 | * IPython/Shell.py (IPShellWX.OnInit): Fix output redirection bug |
|
1244 | * IPython/Shell.py (IPShellWX.OnInit): Fix output redirection bug | |
1241 | for Win32 and OSX. Fix by John Hunter. |
|
1245 | for Win32 and OSX. Fix by John Hunter. | |
1242 |
|
1246 | |||
1243 | 2004-08-30 *** Released version 0.6.3 |
|
1247 | 2004-08-30 *** Released version 0.6.3 | |
1244 |
|
1248 | |||
1245 | 2004-08-30 Fernando Perez <fperez@colorado.edu> |
|
1249 | 2004-08-30 Fernando Perez <fperez@colorado.edu> | |
1246 |
|
1250 | |||
1247 | * setup.py (isfile): Add manpages to list of dependent files to be |
|
1251 | * setup.py (isfile): Add manpages to list of dependent files to be | |
1248 | updated. |
|
1252 | updated. | |
1249 |
|
1253 | |||
1250 | 2004-08-27 Fernando Perez <fperez@colorado.edu> |
|
1254 | 2004-08-27 Fernando Perez <fperez@colorado.edu> | |
1251 |
|
1255 | |||
1252 | * IPython/Shell.py (start): I've disabled -wthread and -gthread |
|
1256 | * IPython/Shell.py (start): I've disabled -wthread and -gthread | |
1253 | for now. They don't really work with standalone WX/GTK code |
|
1257 | for now. They don't really work with standalone WX/GTK code | |
1254 | (though matplotlib IS working fine with both of those backends). |
|
1258 | (though matplotlib IS working fine with both of those backends). | |
1255 | This will neeed much more testing. I disabled most things with |
|
1259 | This will neeed much more testing. I disabled most things with | |
1256 | comments, so turning it back on later should be pretty easy. |
|
1260 | comments, so turning it back on later should be pretty easy. | |
1257 |
|
1261 | |||
1258 | * IPython/iplib.py (InteractiveShell.__init__): Fix accidental |
|
1262 | * IPython/iplib.py (InteractiveShell.__init__): Fix accidental | |
1259 | autocalling of expressions like r'foo', by modifying the line |
|
1263 | autocalling of expressions like r'foo', by modifying the line | |
1260 | split regexp. Closes |
|
1264 | split regexp. Closes | |
1261 | http://www.scipy.net/roundup/ipython/issue18, reported by Nicholas |
|
1265 | http://www.scipy.net/roundup/ipython/issue18, reported by Nicholas | |
1262 | Riley <ipythonbugs-AT-sabi.net>. |
|
1266 | Riley <ipythonbugs-AT-sabi.net>. | |
1263 | (InteractiveShell.mainloop): honor --nobanner with banner |
|
1267 | (InteractiveShell.mainloop): honor --nobanner with banner | |
1264 | extensions. |
|
1268 | extensions. | |
1265 |
|
1269 | |||
1266 | * IPython/Shell.py: Significant refactoring of all classes, so |
|
1270 | * IPython/Shell.py: Significant refactoring of all classes, so | |
1267 | that we can really support ALL matplotlib backends and threading |
|
1271 | that we can really support ALL matplotlib backends and threading | |
1268 | models (John spotted a bug with Tk which required this). Now we |
|
1272 | models (John spotted a bug with Tk which required this). Now we | |
1269 | should support single-threaded, WX-threads and GTK-threads, both |
|
1273 | should support single-threaded, WX-threads and GTK-threads, both | |
1270 | for generic code and for matplotlib. |
|
1274 | for generic code and for matplotlib. | |
1271 |
|
1275 | |||
1272 | * IPython/ipmaker.py (__call__): Changed -mpthread option to |
|
1276 | * IPython/ipmaker.py (__call__): Changed -mpthread option to | |
1273 | -pylab, to simplify things for users. Will also remove the pylab |
|
1277 | -pylab, to simplify things for users. Will also remove the pylab | |
1274 | profile, since now all of matplotlib configuration is directly |
|
1278 | profile, since now all of matplotlib configuration is directly | |
1275 | handled here. This also reduces startup time. |
|
1279 | handled here. This also reduces startup time. | |
1276 |
|
1280 | |||
1277 | * IPython/Shell.py (IPShellGTK.run): Fixed bug where mainloop() of |
|
1281 | * IPython/Shell.py (IPShellGTK.run): Fixed bug where mainloop() of | |
1278 | shell wasn't being correctly called. Also in IPShellWX. |
|
1282 | shell wasn't being correctly called. Also in IPShellWX. | |
1279 |
|
1283 | |||
1280 | * IPython/iplib.py (InteractiveShell.__init__): Added option to |
|
1284 | * IPython/iplib.py (InteractiveShell.__init__): Added option to | |
1281 | fine-tune banner. |
|
1285 | fine-tune banner. | |
1282 |
|
1286 | |||
1283 | * IPython/numutils.py (spike): Deprecate these spike functions, |
|
1287 | * IPython/numutils.py (spike): Deprecate these spike functions, | |
1284 | delete (long deprecated) gnuplot_exec handler. |
|
1288 | delete (long deprecated) gnuplot_exec handler. | |
1285 |
|
1289 | |||
1286 | 2004-08-26 Fernando Perez <fperez@colorado.edu> |
|
1290 | 2004-08-26 Fernando Perez <fperez@colorado.edu> | |
1287 |
|
1291 | |||
1288 | * ipython.1: Update for threading options, plus some others which |
|
1292 | * ipython.1: Update for threading options, plus some others which | |
1289 | were missing. |
|
1293 | were missing. | |
1290 |
|
1294 | |||
1291 | * IPython/ipmaker.py (__call__): Added -wthread option for |
|
1295 | * IPython/ipmaker.py (__call__): Added -wthread option for | |
1292 | wxpython thread handling. Make sure threading options are only |
|
1296 | wxpython thread handling. Make sure threading options are only | |
1293 | valid at the command line. |
|
1297 | valid at the command line. | |
1294 |
|
1298 | |||
1295 | * scripts/ipython: moved shell selection into a factory function |
|
1299 | * scripts/ipython: moved shell selection into a factory function | |
1296 | in Shell.py, to keep the starter script to a minimum. |
|
1300 | in Shell.py, to keep the starter script to a minimum. | |
1297 |
|
1301 | |||
1298 | 2004-08-25 Fernando Perez <fperez@colorado.edu> |
|
1302 | 2004-08-25 Fernando Perez <fperez@colorado.edu> | |
1299 |
|
1303 | |||
1300 | * IPython/Shell.py (IPShellWX.wxexit): fixes to WX threading, by |
|
1304 | * IPython/Shell.py (IPShellWX.wxexit): fixes to WX threading, by | |
1301 | John. Along with some recent changes he made to matplotlib, the |
|
1305 | John. Along with some recent changes he made to matplotlib, the | |
1302 | next versions of both systems should work very well together. |
|
1306 | next versions of both systems should work very well together. | |
1303 |
|
1307 | |||
1304 | 2004-08-24 Fernando Perez <fperez@colorado.edu> |
|
1308 | 2004-08-24 Fernando Perez <fperez@colorado.edu> | |
1305 |
|
1309 | |||
1306 | * IPython/Magic.py (Magic.magic_prun): cleanup some dead code. I |
|
1310 | * IPython/Magic.py (Magic.magic_prun): cleanup some dead code. I | |
1307 | tried to switch the profiling to using hotshot, but I'm getting |
|
1311 | tried to switch the profiling to using hotshot, but I'm getting | |
1308 | strange errors from prof.runctx() there. I may be misreading the |
|
1312 | strange errors from prof.runctx() there. I may be misreading the | |
1309 | docs, but it looks weird. For now the profiling code will |
|
1313 | docs, but it looks weird. For now the profiling code will | |
1310 | continue to use the standard profiler. |
|
1314 | continue to use the standard profiler. | |
1311 |
|
1315 | |||
1312 | 2004-08-23 Fernando Perez <fperez@colorado.edu> |
|
1316 | 2004-08-23 Fernando Perez <fperez@colorado.edu> | |
1313 |
|
1317 | |||
1314 | * IPython/Shell.py (IPShellWX.__init__): Improvements to the WX |
|
1318 | * IPython/Shell.py (IPShellWX.__init__): Improvements to the WX | |
1315 | threaded shell, by John Hunter. It's not quite ready yet, but |
|
1319 | threaded shell, by John Hunter. It's not quite ready yet, but | |
1316 | close. |
|
1320 | close. | |
1317 |
|
1321 | |||
1318 | 2004-08-22 Fernando Perez <fperez@colorado.edu> |
|
1322 | 2004-08-22 Fernando Perez <fperez@colorado.edu> | |
1319 |
|
1323 | |||
1320 | * IPython/iplib.py (InteractiveShell.interact): tab cleanups, also |
|
1324 | * IPython/iplib.py (InteractiveShell.interact): tab cleanups, also | |
1321 | in Magic and ultraTB. |
|
1325 | in Magic and ultraTB. | |
1322 |
|
1326 | |||
1323 | * ipython.1: document threading options in manpage. |
|
1327 | * ipython.1: document threading options in manpage. | |
1324 |
|
1328 | |||
1325 | * scripts/ipython: Changed name of -thread option to -gthread, |
|
1329 | * scripts/ipython: Changed name of -thread option to -gthread, | |
1326 | since this is GTK specific. I want to leave the door open for a |
|
1330 | since this is GTK specific. I want to leave the door open for a | |
1327 | -wthread option for WX, which will most likely be necessary. This |
|
1331 | -wthread option for WX, which will most likely be necessary. This | |
1328 | change affects usage and ipmaker as well. |
|
1332 | change affects usage and ipmaker as well. | |
1329 |
|
1333 | |||
1330 | * IPython/Shell.py (matplotlib_shell): Add a factory function to |
|
1334 | * IPython/Shell.py (matplotlib_shell): Add a factory function to | |
1331 | handle the matplotlib shell issues. Code by John Hunter |
|
1335 | handle the matplotlib shell issues. Code by John Hunter | |
1332 | <jdhunter-AT-nitace.bsd.uchicago.edu>. |
|
1336 | <jdhunter-AT-nitace.bsd.uchicago.edu>. | |
1333 | (IPShellMatplotlibWX.__init__): Rudimentary WX support. It's |
|
1337 | (IPShellMatplotlibWX.__init__): Rudimentary WX support. It's | |
1334 | broken (and disabled for end users) for now, but it puts the |
|
1338 | broken (and disabled for end users) for now, but it puts the | |
1335 | infrastructure in place. |
|
1339 | infrastructure in place. | |
1336 |
|
1340 | |||
1337 | 2004-08-21 Fernando Perez <fperez@colorado.edu> |
|
1341 | 2004-08-21 Fernando Perez <fperez@colorado.edu> | |
1338 |
|
1342 | |||
1339 | * ipythonrc-pylab: Add matplotlib support. |
|
1343 | * ipythonrc-pylab: Add matplotlib support. | |
1340 |
|
1344 | |||
1341 | * matplotlib_config.py: new files for matplotlib support, part of |
|
1345 | * matplotlib_config.py: new files for matplotlib support, part of | |
1342 | the pylab profile. |
|
1346 | the pylab profile. | |
1343 |
|
1347 | |||
1344 | * IPython/usage.py (__doc__): documented the threading options. |
|
1348 | * IPython/usage.py (__doc__): documented the threading options. | |
1345 |
|
1349 | |||
1346 | 2004-08-20 Fernando Perez <fperez@colorado.edu> |
|
1350 | 2004-08-20 Fernando Perez <fperez@colorado.edu> | |
1347 |
|
1351 | |||
1348 | * ipython: Modified the main calling routine to handle the -thread |
|
1352 | * ipython: Modified the main calling routine to handle the -thread | |
1349 | and -mpthread options. This needs to be done as a top-level hack, |
|
1353 | and -mpthread options. This needs to be done as a top-level hack, | |
1350 | because it determines which class to instantiate for IPython |
|
1354 | because it determines which class to instantiate for IPython | |
1351 | itself. |
|
1355 | itself. | |
1352 |
|
1356 | |||
1353 | * IPython/Shell.py (MTInteractiveShell.__init__): New set of |
|
1357 | * IPython/Shell.py (MTInteractiveShell.__init__): New set of | |
1354 | classes to support multithreaded GTK operation without blocking, |
|
1358 | classes to support multithreaded GTK operation without blocking, | |
1355 | and matplotlib with all backends. This is a lot of still very |
|
1359 | and matplotlib with all backends. This is a lot of still very | |
1356 | experimental code, and threads are tricky. So it may still have a |
|
1360 | experimental code, and threads are tricky. So it may still have a | |
1357 | few rough edges... This code owes a lot to |
|
1361 | few rough edges... This code owes a lot to | |
1358 | http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65109, by |
|
1362 | http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65109, by | |
1359 | Brian # McErlean and John Finlay, to Antoon Pardon for fixes, and |
|
1363 | Brian # McErlean and John Finlay, to Antoon Pardon for fixes, and | |
1360 | to John Hunter for all the matplotlib work. |
|
1364 | to John Hunter for all the matplotlib work. | |
1361 |
|
1365 | |||
1362 | * IPython/ipmaker.py (__call__): Added -thread and -mpthread |
|
1366 | * IPython/ipmaker.py (__call__): Added -thread and -mpthread | |
1363 | options for gtk thread and matplotlib support. |
|
1367 | options for gtk thread and matplotlib support. | |
1364 |
|
1368 | |||
1365 | 2004-08-16 Fernando Perez <fperez@colorado.edu> |
|
1369 | 2004-08-16 Fernando Perez <fperez@colorado.edu> | |
1366 |
|
1370 | |||
1367 | * IPython/iplib.py (InteractiveShell.__init__): don't trigger |
|
1371 | * IPython/iplib.py (InteractiveShell.__init__): don't trigger | |
1368 | autocall for things like p*q,p/q,p+q,p-q, when p is callable. Bug |
|
1372 | autocall for things like p*q,p/q,p+q,p-q, when p is callable. Bug | |
1369 | reported by Stephen Walton <stephen.walton-AT-csun.edu>. |
|
1373 | reported by Stephen Walton <stephen.walton-AT-csun.edu>. | |
1370 |
|
1374 | |||
1371 | 2004-08-11 Fernando Perez <fperez@colorado.edu> |
|
1375 | 2004-08-11 Fernando Perez <fperez@colorado.edu> | |
1372 |
|
1376 | |||
1373 | * setup.py (isfile): Fix build so documentation gets updated for |
|
1377 | * setup.py (isfile): Fix build so documentation gets updated for | |
1374 | rpms (it was only done for .tgz builds). |
|
1378 | rpms (it was only done for .tgz builds). | |
1375 |
|
1379 | |||
1376 | 2004-08-10 Fernando Perez <fperez@colorado.edu> |
|
1380 | 2004-08-10 Fernando Perez <fperez@colorado.edu> | |
1377 |
|
1381 | |||
1378 | * genutils.py (Term): Fix misspell of stdin stream (sin->cin). |
|
1382 | * genutils.py (Term): Fix misspell of stdin stream (sin->cin). | |
1379 |
|
1383 | |||
1380 | * iplib.py : Silence syntax error exceptions in tab-completion. |
|
1384 | * iplib.py : Silence syntax error exceptions in tab-completion. | |
1381 |
|
1385 | |||
1382 | 2004-08-05 Fernando Perez <fperez@colorado.edu> |
|
1386 | 2004-08-05 Fernando Perez <fperez@colorado.edu> | |
1383 |
|
1387 | |||
1384 | * IPython/Prompts.py (Prompt2.set_colors): Fix incorrectly set |
|
1388 | * IPython/Prompts.py (Prompt2.set_colors): Fix incorrectly set | |
1385 | 'color off' mark for continuation prompts. This was causing long |
|
1389 | 'color off' mark for continuation prompts. This was causing long | |
1386 | continuation lines to mis-wrap. |
|
1390 | continuation lines to mis-wrap. | |
1387 |
|
1391 | |||
1388 | 2004-08-01 Fernando Perez <fperez@colorado.edu> |
|
1392 | 2004-08-01 Fernando Perez <fperez@colorado.edu> | |
1389 |
|
1393 | |||
1390 | * IPython/ipmaker.py (make_IPython): Allow the shell class used |
|
1394 | * IPython/ipmaker.py (make_IPython): Allow the shell class used | |
1391 | for building ipython to be a parameter. All this is necessary |
|
1395 | for building ipython to be a parameter. All this is necessary | |
1392 | right now to have a multithreaded version, but this insane |
|
1396 | right now to have a multithreaded version, but this insane | |
1393 | non-design will be cleaned up soon. For now, it's a hack that |
|
1397 | non-design will be cleaned up soon. For now, it's a hack that | |
1394 | works. |
|
1398 | works. | |
1395 |
|
1399 | |||
1396 | * IPython/Shell.py (IPShell.__init__): Stop using mutable default |
|
1400 | * IPython/Shell.py (IPShell.__init__): Stop using mutable default | |
1397 | args in various places. No bugs so far, but it's a dangerous |
|
1401 | args in various places. No bugs so far, but it's a dangerous | |
1398 | practice. |
|
1402 | practice. | |
1399 |
|
1403 | |||
1400 | 2004-07-31 Fernando Perez <fperez@colorado.edu> |
|
1404 | 2004-07-31 Fernando Perez <fperez@colorado.edu> | |
1401 |
|
1405 | |||
1402 | * IPython/iplib.py (complete): ignore SyntaxError exceptions to |
|
1406 | * IPython/iplib.py (complete): ignore SyntaxError exceptions to | |
1403 | fix completion of files with dots in their names under most |
|
1407 | fix completion of files with dots in their names under most | |
1404 | profiles (pysh was OK because the completion order is different). |
|
1408 | profiles (pysh was OK because the completion order is different). | |
1405 |
|
1409 | |||
1406 | 2004-07-27 Fernando Perez <fperez@colorado.edu> |
|
1410 | 2004-07-27 Fernando Perez <fperez@colorado.edu> | |
1407 |
|
1411 | |||
1408 | * IPython/iplib.py (InteractiveShell.__init__): build dict of |
|
1412 | * IPython/iplib.py (InteractiveShell.__init__): build dict of | |
1409 | keywords manually, b/c the one in keyword.py was removed in python |
|
1413 | keywords manually, b/c the one in keyword.py was removed in python | |
1410 | 2.4. Patch by Anakim Border <aborder-AT-users.sourceforge.net>. |
|
1414 | 2.4. Patch by Anakim Border <aborder-AT-users.sourceforge.net>. | |
1411 | This is NOT a bug under python 2.3 and earlier. |
|
1415 | This is NOT a bug under python 2.3 and earlier. | |
1412 |
|
1416 | |||
1413 | 2004-07-26 Fernando Perez <fperez@colorado.edu> |
|
1417 | 2004-07-26 Fernando Perez <fperez@colorado.edu> | |
1414 |
|
1418 | |||
1415 | * IPython/ultraTB.py (VerboseTB.text): Add another |
|
1419 | * IPython/ultraTB.py (VerboseTB.text): Add another | |
1416 | linecache.checkcache() call to try to prevent inspect.py from |
|
1420 | linecache.checkcache() call to try to prevent inspect.py from | |
1417 | crashing under python 2.3. I think this fixes |
|
1421 | crashing under python 2.3. I think this fixes | |
1418 | http://www.scipy.net/roundup/ipython/issue17. |
|
1422 | http://www.scipy.net/roundup/ipython/issue17. | |
1419 |
|
1423 | |||
1420 | 2004-07-26 *** Released version 0.6.2 |
|
1424 | 2004-07-26 *** Released version 0.6.2 | |
1421 |
|
1425 | |||
1422 | 2004-07-26 Fernando Perez <fperez@colorado.edu> |
|
1426 | 2004-07-26 Fernando Perez <fperez@colorado.edu> | |
1423 |
|
1427 | |||
1424 | * IPython/Magic.py (Magic.magic_cd): Fix bug where 'cd -N' would |
|
1428 | * IPython/Magic.py (Magic.magic_cd): Fix bug where 'cd -N' would | |
1425 | fail for any number. |
|
1429 | fail for any number. | |
1426 | (Magic.magic_bookmark): Fix bug where 'bookmark -l' would fail for |
|
1430 | (Magic.magic_bookmark): Fix bug where 'bookmark -l' would fail for | |
1427 | empty bookmarks. |
|
1431 | empty bookmarks. | |
1428 |
|
1432 | |||
1429 | 2004-07-26 *** Released version 0.6.1 |
|
1433 | 2004-07-26 *** Released version 0.6.1 | |
1430 |
|
1434 | |||
1431 | 2004-07-26 Fernando Perez <fperez@colorado.edu> |
|
1435 | 2004-07-26 Fernando Perez <fperez@colorado.edu> | |
1432 |
|
1436 | |||
1433 | * ipython_win_post_install.py (run): Added pysh shortcut for Windows. |
|
1437 | * ipython_win_post_install.py (run): Added pysh shortcut for Windows. | |
1434 |
|
1438 | |||
1435 | * IPython/iplib.py (protect_filename): Applied Ville's patch for |
|
1439 | * IPython/iplib.py (protect_filename): Applied Ville's patch for | |
1436 | escaping '()[]{}' in filenames. |
|
1440 | escaping '()[]{}' in filenames. | |
1437 |
|
1441 | |||
1438 | * IPython/Magic.py (shlex_split): Fix handling of '*' and '?' for |
|
1442 | * IPython/Magic.py (shlex_split): Fix handling of '*' and '?' for | |
1439 | Python 2.2 users who lack a proper shlex.split. |
|
1443 | Python 2.2 users who lack a proper shlex.split. | |
1440 |
|
1444 | |||
1441 | 2004-07-19 Fernando Perez <fperez@colorado.edu> |
|
1445 | 2004-07-19 Fernando Perez <fperez@colorado.edu> | |
1442 |
|
1446 | |||
1443 | * IPython/iplib.py (InteractiveShell.init_readline): Add support |
|
1447 | * IPython/iplib.py (InteractiveShell.init_readline): Add support | |
1444 | for reading readline's init file. I follow the normal chain: |
|
1448 | for reading readline's init file. I follow the normal chain: | |
1445 | $INPUTRC is honored, otherwise ~/.inputrc is used. Thanks to a |
|
1449 | $INPUTRC is honored, otherwise ~/.inputrc is used. Thanks to a | |
1446 | report by Mike Heeter. This closes |
|
1450 | report by Mike Heeter. This closes | |
1447 | http://www.scipy.net/roundup/ipython/issue16. |
|
1451 | http://www.scipy.net/roundup/ipython/issue16. | |
1448 |
|
1452 | |||
1449 | 2004-07-18 Fernando Perez <fperez@colorado.edu> |
|
1453 | 2004-07-18 Fernando Perez <fperez@colorado.edu> | |
1450 |
|
1454 | |||
1451 | * IPython/iplib.py (__init__): Add better handling of '\' under |
|
1455 | * IPython/iplib.py (__init__): Add better handling of '\' under | |
1452 | Win32 for filenames. After a patch by Ville. |
|
1456 | Win32 for filenames. After a patch by Ville. | |
1453 |
|
1457 | |||
1454 | 2004-07-17 Fernando Perez <fperez@colorado.edu> |
|
1458 | 2004-07-17 Fernando Perez <fperez@colorado.edu> | |
1455 |
|
1459 | |||
1456 | * IPython/iplib.py (InteractiveShell._prefilter): fix bug where |
|
1460 | * IPython/iplib.py (InteractiveShell._prefilter): fix bug where | |
1457 | autocalling would be triggered for 'foo is bar' if foo is |
|
1461 | autocalling would be triggered for 'foo is bar' if foo is | |
1458 | callable. I also cleaned up the autocall detection code to use a |
|
1462 | callable. I also cleaned up the autocall detection code to use a | |
1459 | regexp, which is faster. Bug reported by Alexander Schmolck. |
|
1463 | regexp, which is faster. Bug reported by Alexander Schmolck. | |
1460 |
|
1464 | |||
1461 | * IPython/Magic.py (Magic.magic_pinfo): Fix bug where strings with |
|
1465 | * IPython/Magic.py (Magic.magic_pinfo): Fix bug where strings with | |
1462 | '?' in them would confuse the help system. Reported by Alex |
|
1466 | '?' in them would confuse the help system. Reported by Alex | |
1463 | Schmolck. |
|
1467 | Schmolck. | |
1464 |
|
1468 | |||
1465 | 2004-07-16 Fernando Perez <fperez@colorado.edu> |
|
1469 | 2004-07-16 Fernando Perez <fperez@colorado.edu> | |
1466 |
|
1470 | |||
1467 | * IPython/GnuplotInteractive.py (__all__): added plot2. |
|
1471 | * IPython/GnuplotInteractive.py (__all__): added plot2. | |
1468 |
|
1472 | |||
1469 | * IPython/Gnuplot2.py (Gnuplot.plot2): added new function for |
|
1473 | * IPython/Gnuplot2.py (Gnuplot.plot2): added new function for | |
1470 | plotting dictionaries, lists or tuples of 1d arrays. |
|
1474 | plotting dictionaries, lists or tuples of 1d arrays. | |
1471 |
|
1475 | |||
1472 | * IPython/Magic.py (Magic.magic_hist): small clenaups and |
|
1476 | * IPython/Magic.py (Magic.magic_hist): small clenaups and | |
1473 | optimizations. |
|
1477 | optimizations. | |
1474 |
|
1478 | |||
1475 | * IPython/iplib.py:Remove old Changelog info for cleanup. This is |
|
1479 | * IPython/iplib.py:Remove old Changelog info for cleanup. This is | |
1476 | the information which was there from Janko's original IPP code: |
|
1480 | the information which was there from Janko's original IPP code: | |
1477 |
|
1481 | |||
1478 | 03.05.99 20:53 porto.ifm.uni-kiel.de |
|
1482 | 03.05.99 20:53 porto.ifm.uni-kiel.de | |
1479 | --Started changelog. |
|
1483 | --Started changelog. | |
1480 | --make clear do what it say it does |
|
1484 | --make clear do what it say it does | |
1481 | --added pretty output of lines from inputcache |
|
1485 | --added pretty output of lines from inputcache | |
1482 | --Made Logger a mixin class, simplifies handling of switches |
|
1486 | --Made Logger a mixin class, simplifies handling of switches | |
1483 | --Added own completer class. .string<TAB> expands to last history |
|
1487 | --Added own completer class. .string<TAB> expands to last history | |
1484 | line which starts with string. The new expansion is also present |
|
1488 | line which starts with string. The new expansion is also present | |
1485 | with Ctrl-r from the readline library. But this shows, who this |
|
1489 | with Ctrl-r from the readline library. But this shows, who this | |
1486 | can be done for other cases. |
|
1490 | can be done for other cases. | |
1487 | --Added convention that all shell functions should accept a |
|
1491 | --Added convention that all shell functions should accept a | |
1488 | parameter_string This opens the door for different behaviour for |
|
1492 | parameter_string This opens the door for different behaviour for | |
1489 | each function. @cd is a good example of this. |
|
1493 | each function. @cd is a good example of this. | |
1490 |
|
1494 | |||
1491 | 04.05.99 12:12 porto.ifm.uni-kiel.de |
|
1495 | 04.05.99 12:12 porto.ifm.uni-kiel.de | |
1492 | --added logfile rotation |
|
1496 | --added logfile rotation | |
1493 | --added new mainloop method which freezes first the namespace |
|
1497 | --added new mainloop method which freezes first the namespace | |
1494 |
|
1498 | |||
1495 | 07.05.99 21:24 porto.ifm.uni-kiel.de |
|
1499 | 07.05.99 21:24 porto.ifm.uni-kiel.de | |
1496 | --added the docreader classes. Now there is a help system. |
|
1500 | --added the docreader classes. Now there is a help system. | |
1497 | -This is only a first try. Currently it's not easy to put new |
|
1501 | -This is only a first try. Currently it's not easy to put new | |
1498 | stuff in the indices. But this is the way to go. Info would be |
|
1502 | stuff in the indices. But this is the way to go. Info would be | |
1499 | better, but HTML is every where and not everybody has an info |
|
1503 | better, but HTML is every where and not everybody has an info | |
1500 | system installed and it's not so easy to change html-docs to info. |
|
1504 | system installed and it's not so easy to change html-docs to info. | |
1501 | --added global logfile option |
|
1505 | --added global logfile option | |
1502 | --there is now a hook for object inspection method pinfo needs to |
|
1506 | --there is now a hook for object inspection method pinfo needs to | |
1503 | be provided for this. Can be reached by two '??'. |
|
1507 | be provided for this. Can be reached by two '??'. | |
1504 |
|
1508 | |||
1505 | 08.05.99 20:51 porto.ifm.uni-kiel.de |
|
1509 | 08.05.99 20:51 porto.ifm.uni-kiel.de | |
1506 | --added a README |
|
1510 | --added a README | |
1507 | --bug in rc file. Something has changed so functions in the rc |
|
1511 | --bug in rc file. Something has changed so functions in the rc | |
1508 | file need to reference the shell and not self. Not clear if it's a |
|
1512 | file need to reference the shell and not self. Not clear if it's a | |
1509 | bug or feature. |
|
1513 | bug or feature. | |
1510 | --changed rc file for new behavior |
|
1514 | --changed rc file for new behavior | |
1511 |
|
1515 | |||
1512 | 2004-07-15 Fernando Perez <fperez@colorado.edu> |
|
1516 | 2004-07-15 Fernando Perez <fperez@colorado.edu> | |
1513 |
|
1517 | |||
1514 | * IPython/Logger.py (Logger.log): fixed recent bug where the input |
|
1518 | * IPython/Logger.py (Logger.log): fixed recent bug where the input | |
1515 | cache was falling out of sync in bizarre manners when multi-line |
|
1519 | cache was falling out of sync in bizarre manners when multi-line | |
1516 | input was present. Minor optimizations and cleanup. |
|
1520 | input was present. Minor optimizations and cleanup. | |
1517 |
|
1521 | |||
1518 | (Logger): Remove old Changelog info for cleanup. This is the |
|
1522 | (Logger): Remove old Changelog info for cleanup. This is the | |
1519 | information which was there from Janko's original code: |
|
1523 | information which was there from Janko's original code: | |
1520 |
|
1524 | |||
1521 | Changes to Logger: - made the default log filename a parameter |
|
1525 | Changes to Logger: - made the default log filename a parameter | |
1522 |
|
1526 | |||
1523 | - put a check for lines beginning with !@? in log(). Needed |
|
1527 | - put a check for lines beginning with !@? in log(). Needed | |
1524 | (even if the handlers properly log their lines) for mid-session |
|
1528 | (even if the handlers properly log their lines) for mid-session | |
1525 | logging activation to work properly. Without this, lines logged |
|
1529 | logging activation to work properly. Without this, lines logged | |
1526 | in mid session, which get read from the cache, would end up |
|
1530 | in mid session, which get read from the cache, would end up | |
1527 | 'bare' (with !@? in the open) in the log. Now they are caught |
|
1531 | 'bare' (with !@? in the open) in the log. Now they are caught | |
1528 | and prepended with a #. |
|
1532 | and prepended with a #. | |
1529 |
|
1533 | |||
1530 | * IPython/iplib.py (InteractiveShell.init_readline): added check |
|
1534 | * IPython/iplib.py (InteractiveShell.init_readline): added check | |
1531 | in case MagicCompleter fails to be defined, so we don't crash. |
|
1535 | in case MagicCompleter fails to be defined, so we don't crash. | |
1532 |
|
1536 | |||
1533 | 2004-07-13 Fernando Perez <fperez@colorado.edu> |
|
1537 | 2004-07-13 Fernando Perez <fperez@colorado.edu> | |
1534 |
|
1538 | |||
1535 | * IPython/Gnuplot2.py (Gnuplot.hardcopy): add automatic generation |
|
1539 | * IPython/Gnuplot2.py (Gnuplot.hardcopy): add automatic generation | |
1536 | of EPS if the requested filename ends in '.eps'. |
|
1540 | of EPS if the requested filename ends in '.eps'. | |
1537 |
|
1541 | |||
1538 | 2004-07-04 Fernando Perez <fperez@colorado.edu> |
|
1542 | 2004-07-04 Fernando Perez <fperez@colorado.edu> | |
1539 |
|
1543 | |||
1540 | * IPython/iplib.py (InteractiveShell.handle_shell_escape): Fix |
|
1544 | * IPython/iplib.py (InteractiveShell.handle_shell_escape): Fix | |
1541 | escaping of quotes when calling the shell. |
|
1545 | escaping of quotes when calling the shell. | |
1542 |
|
1546 | |||
1543 | 2004-07-02 Fernando Perez <fperez@colorado.edu> |
|
1547 | 2004-07-02 Fernando Perez <fperez@colorado.edu> | |
1544 |
|
1548 | |||
1545 | * IPython/Prompts.py (CachedOutput.update): Fix problem with |
|
1549 | * IPython/Prompts.py (CachedOutput.update): Fix problem with | |
1546 | gettext not working because we were clobbering '_'. Fixes |
|
1550 | gettext not working because we were clobbering '_'. Fixes | |
1547 | http://www.scipy.net/roundup/ipython/issue6. |
|
1551 | http://www.scipy.net/roundup/ipython/issue6. | |
1548 |
|
1552 | |||
1549 | 2004-07-01 Fernando Perez <fperez@colorado.edu> |
|
1553 | 2004-07-01 Fernando Perez <fperez@colorado.edu> | |
1550 |
|
1554 | |||
1551 | * IPython/Magic.py (Magic.magic_cd): integrated bookmark handling |
|
1555 | * IPython/Magic.py (Magic.magic_cd): integrated bookmark handling | |
1552 | into @cd. Patch by Ville. |
|
1556 | into @cd. Patch by Ville. | |
1553 |
|
1557 | |||
1554 | * IPython/iplib.py (InteractiveShell.post_config_initialization): |
|
1558 | * IPython/iplib.py (InteractiveShell.post_config_initialization): | |
1555 | new function to store things after ipmaker runs. Patch by Ville. |
|
1559 | new function to store things after ipmaker runs. Patch by Ville. | |
1556 | Eventually this will go away once ipmaker is removed and the class |
|
1560 | Eventually this will go away once ipmaker is removed and the class | |
1557 | gets cleaned up, but for now it's ok. Key functionality here is |
|
1561 | gets cleaned up, but for now it's ok. Key functionality here is | |
1558 | the addition of the persistent storage mechanism, a dict for |
|
1562 | the addition of the persistent storage mechanism, a dict for | |
1559 | keeping data across sessions (for now just bookmarks, but more can |
|
1563 | keeping data across sessions (for now just bookmarks, but more can | |
1560 | be implemented later). |
|
1564 | be implemented later). | |
1561 |
|
1565 | |||
1562 | * IPython/Magic.py (Magic.magic_bookmark): New bookmark system, |
|
1566 | * IPython/Magic.py (Magic.magic_bookmark): New bookmark system, | |
1563 | persistent across sections. Patch by Ville, I modified it |
|
1567 | persistent across sections. Patch by Ville, I modified it | |
1564 | soemwhat to allow bookmarking arbitrary dirs other than CWD. Also |
|
1568 | soemwhat to allow bookmarking arbitrary dirs other than CWD. Also | |
1565 | added a '-l' option to list all bookmarks. |
|
1569 | added a '-l' option to list all bookmarks. | |
1566 |
|
1570 | |||
1567 | * IPython/iplib.py (InteractiveShell.atexit_operations): new |
|
1571 | * IPython/iplib.py (InteractiveShell.atexit_operations): new | |
1568 | center for cleanup. Registered with atexit.register(). I moved |
|
1572 | center for cleanup. Registered with atexit.register(). I moved | |
1569 | here the old exit_cleanup(). After a patch by Ville. |
|
1573 | here the old exit_cleanup(). After a patch by Ville. | |
1570 |
|
1574 | |||
1571 | * IPython/Magic.py (get_py_filename): added '~' to the accepted |
|
1575 | * IPython/Magic.py (get_py_filename): added '~' to the accepted | |
1572 | characters in the hacked shlex_split for python 2.2. |
|
1576 | characters in the hacked shlex_split for python 2.2. | |
1573 |
|
1577 | |||
1574 | * IPython/iplib.py (file_matches): more fixes to filenames with |
|
1578 | * IPython/iplib.py (file_matches): more fixes to filenames with | |
1575 | whitespace in them. It's not perfect, but limitations in python's |
|
1579 | whitespace in them. It's not perfect, but limitations in python's | |
1576 | readline make it impossible to go further. |
|
1580 | readline make it impossible to go further. | |
1577 |
|
1581 | |||
1578 | 2004-06-29 Fernando Perez <fperez@colorado.edu> |
|
1582 | 2004-06-29 Fernando Perez <fperez@colorado.edu> | |
1579 |
|
1583 | |||
1580 | * IPython/iplib.py (file_matches): escape whitespace correctly in |
|
1584 | * IPython/iplib.py (file_matches): escape whitespace correctly in | |
1581 | filename completions. Bug reported by Ville. |
|
1585 | filename completions. Bug reported by Ville. | |
1582 |
|
1586 | |||
1583 | 2004-06-28 Fernando Perez <fperez@colorado.edu> |
|
1587 | 2004-06-28 Fernando Perez <fperez@colorado.edu> | |
1584 |
|
1588 | |||
1585 | * IPython/ipmaker.py (__call__): Added per-profile histories. Now |
|
1589 | * IPython/ipmaker.py (__call__): Added per-profile histories. Now | |
1586 | the history file will be called 'history-PROFNAME' (or just |
|
1590 | the history file will be called 'history-PROFNAME' (or just | |
1587 | 'history' if no profile is loaded). I was getting annoyed at |
|
1591 | 'history' if no profile is loaded). I was getting annoyed at | |
1588 | getting my Numerical work history clobbered by pysh sessions. |
|
1592 | getting my Numerical work history clobbered by pysh sessions. | |
1589 |
|
1593 | |||
1590 | * IPython/iplib.py (InteractiveShell.__init__): Internal |
|
1594 | * IPython/iplib.py (InteractiveShell.__init__): Internal | |
1591 | getoutputerror() function so that we can honor the system_verbose |
|
1595 | getoutputerror() function so that we can honor the system_verbose | |
1592 | flag for _all_ system calls. I also added escaping of # |
|
1596 | flag for _all_ system calls. I also added escaping of # | |
1593 | characters here to avoid confusing Itpl. |
|
1597 | characters here to avoid confusing Itpl. | |
1594 |
|
1598 | |||
1595 | * IPython/Magic.py (shlex_split): removed call to shell in |
|
1599 | * IPython/Magic.py (shlex_split): removed call to shell in | |
1596 | parse_options and replaced it with shlex.split(). The annoying |
|
1600 | parse_options and replaced it with shlex.split(). The annoying | |
1597 | part was that in Python 2.2, shlex.split() doesn't exist, so I had |
|
1601 | part was that in Python 2.2, shlex.split() doesn't exist, so I had | |
1598 | to backport it from 2.3, with several frail hacks (the shlex |
|
1602 | to backport it from 2.3, with several frail hacks (the shlex | |
1599 | module is rather limited in 2.2). Thanks to a suggestion by Ville |
|
1603 | module is rather limited in 2.2). Thanks to a suggestion by Ville | |
1600 | Vainio <vivainio@kolumbus.fi>. For Python 2.3 there should be no |
|
1604 | Vainio <vivainio@kolumbus.fi>. For Python 2.3 there should be no | |
1601 | problem. |
|
1605 | problem. | |
1602 |
|
1606 | |||
1603 | (Magic.magic_system_verbose): new toggle to print the actual |
|
1607 | (Magic.magic_system_verbose): new toggle to print the actual | |
1604 | system calls made by ipython. Mainly for debugging purposes. |
|
1608 | system calls made by ipython. Mainly for debugging purposes. | |
1605 |
|
1609 | |||
1606 | * IPython/GnuplotRuntime.py (gnu_out): fix bug for cygwin, which |
|
1610 | * IPython/GnuplotRuntime.py (gnu_out): fix bug for cygwin, which | |
1607 | doesn't support persistence. Reported (and fix suggested) by |
|
1611 | doesn't support persistence. Reported (and fix suggested) by | |
1608 | Travis Caldwell <travis_caldwell2000@yahoo.com>. |
|
1612 | Travis Caldwell <travis_caldwell2000@yahoo.com>. | |
1609 |
|
1613 | |||
1610 | 2004-06-26 Fernando Perez <fperez@colorado.edu> |
|
1614 | 2004-06-26 Fernando Perez <fperez@colorado.edu> | |
1611 |
|
1615 | |||
1612 | * IPython/Logger.py (Logger.log): fix to handle correctly empty |
|
1616 | * IPython/Logger.py (Logger.log): fix to handle correctly empty | |
1613 | continue prompts. |
|
1617 | continue prompts. | |
1614 |
|
1618 | |||
1615 | * IPython/Extensions/InterpreterExec.py (pysh): moved the pysh() |
|
1619 | * IPython/Extensions/InterpreterExec.py (pysh): moved the pysh() | |
1616 | function (basically a big docstring) and a few more things here to |
|
1620 | function (basically a big docstring) and a few more things here to | |
1617 | speedup startup. pysh.py is now very lightweight. We want because |
|
1621 | speedup startup. pysh.py is now very lightweight. We want because | |
1618 | it gets execfile'd, while InterpreterExec gets imported, so |
|
1622 | it gets execfile'd, while InterpreterExec gets imported, so | |
1619 | byte-compilation saves time. |
|
1623 | byte-compilation saves time. | |
1620 |
|
1624 | |||
1621 | 2004-06-25 Fernando Perez <fperez@colorado.edu> |
|
1625 | 2004-06-25 Fernando Perez <fperez@colorado.edu> | |
1622 |
|
1626 | |||
1623 | * IPython/Magic.py (Magic.magic_cd): Fixed to restore usage of 'cd |
|
1627 | * IPython/Magic.py (Magic.magic_cd): Fixed to restore usage of 'cd | |
1624 | -NUM', which was recently broken. |
|
1628 | -NUM', which was recently broken. | |
1625 |
|
1629 | |||
1626 | * IPython/iplib.py (InteractiveShell.handle_shell_escape): allow ! |
|
1630 | * IPython/iplib.py (InteractiveShell.handle_shell_escape): allow ! | |
1627 | in multi-line input (but not !!, which doesn't make sense there). |
|
1631 | in multi-line input (but not !!, which doesn't make sense there). | |
1628 |
|
1632 | |||
1629 | * IPython/UserConfig/ipythonrc: made autoindent on by default. |
|
1633 | * IPython/UserConfig/ipythonrc: made autoindent on by default. | |
1630 | It's just too useful, and people can turn it off in the less |
|
1634 | It's just too useful, and people can turn it off in the less | |
1631 | common cases where it's a problem. |
|
1635 | common cases where it's a problem. | |
1632 |
|
1636 | |||
1633 | 2004-06-24 Fernando Perez <fperez@colorado.edu> |
|
1637 | 2004-06-24 Fernando Perez <fperez@colorado.edu> | |
1634 |
|
1638 | |||
1635 | * IPython/iplib.py (InteractiveShell._prefilter): big change - |
|
1639 | * IPython/iplib.py (InteractiveShell._prefilter): big change - | |
1636 | special syntaxes (like alias calling) is now allied in multi-line |
|
1640 | special syntaxes (like alias calling) is now allied in multi-line | |
1637 | input. This is still _very_ experimental, but it's necessary for |
|
1641 | input. This is still _very_ experimental, but it's necessary for | |
1638 | efficient shell usage combining python looping syntax with system |
|
1642 | efficient shell usage combining python looping syntax with system | |
1639 | calls. For now it's restricted to aliases, I don't think it |
|
1643 | calls. For now it's restricted to aliases, I don't think it | |
1640 | really even makes sense to have this for magics. |
|
1644 | really even makes sense to have this for magics. | |
1641 |
|
1645 | |||
1642 | 2004-06-23 Fernando Perez <fperez@colorado.edu> |
|
1646 | 2004-06-23 Fernando Perez <fperez@colorado.edu> | |
1643 |
|
1647 | |||
1644 | * IPython/Extensions/InterpreterExec.py (prefilter_shell): Added |
|
1648 | * IPython/Extensions/InterpreterExec.py (prefilter_shell): Added | |
1645 | $var=cmd <=> @sc var=cmd and $$var=cmd <=> @sc -l var=cmd. |
|
1649 | $var=cmd <=> @sc var=cmd and $$var=cmd <=> @sc -l var=cmd. | |
1646 |
|
1650 | |||
1647 | * IPython/Magic.py (Magic.magic_rehashx): modified to handle |
|
1651 | * IPython/Magic.py (Magic.magic_rehashx): modified to handle | |
1648 | extensions under Windows (after code sent by Gary Bishop). The |
|
1652 | extensions under Windows (after code sent by Gary Bishop). The | |
1649 | extensions considered 'executable' are stored in IPython's rc |
|
1653 | extensions considered 'executable' are stored in IPython's rc | |
1650 | structure as win_exec_ext. |
|
1654 | structure as win_exec_ext. | |
1651 |
|
1655 | |||
1652 | * IPython/genutils.py (shell): new function, like system() but |
|
1656 | * IPython/genutils.py (shell): new function, like system() but | |
1653 | without return value. Very useful for interactive shell work. |
|
1657 | without return value. Very useful for interactive shell work. | |
1654 |
|
1658 | |||
1655 | * IPython/Magic.py (Magic.magic_unalias): New @unalias function to |
|
1659 | * IPython/Magic.py (Magic.magic_unalias): New @unalias function to | |
1656 | delete aliases. |
|
1660 | delete aliases. | |
1657 |
|
1661 | |||
1658 | * IPython/iplib.py (InteractiveShell.alias_table_update): make |
|
1662 | * IPython/iplib.py (InteractiveShell.alias_table_update): make | |
1659 | sure that the alias table doesn't contain python keywords. |
|
1663 | sure that the alias table doesn't contain python keywords. | |
1660 |
|
1664 | |||
1661 | 2004-06-21 Fernando Perez <fperez@colorado.edu> |
|
1665 | 2004-06-21 Fernando Perez <fperez@colorado.edu> | |
1662 |
|
1666 | |||
1663 | * IPython/Magic.py (Magic.magic_rehash): Fix crash when |
|
1667 | * IPython/Magic.py (Magic.magic_rehash): Fix crash when | |
1664 | non-existent items are found in $PATH. Reported by Thorsten. |
|
1668 | non-existent items are found in $PATH. Reported by Thorsten. | |
1665 |
|
1669 | |||
1666 | 2004-06-20 Fernando Perez <fperez@colorado.edu> |
|
1670 | 2004-06-20 Fernando Perez <fperez@colorado.edu> | |
1667 |
|
1671 | |||
1668 | * IPython/iplib.py (complete): modified the completer so that the |
|
1672 | * IPython/iplib.py (complete): modified the completer so that the | |
1669 | order of priorities can be easily changed at runtime. |
|
1673 | order of priorities can be easily changed at runtime. | |
1670 |
|
1674 | |||
1671 | * IPython/Extensions/InterpreterExec.py (prefilter_shell): |
|
1675 | * IPython/Extensions/InterpreterExec.py (prefilter_shell): | |
1672 | Modified to auto-execute all lines beginning with '~', '/' or '.'. |
|
1676 | Modified to auto-execute all lines beginning with '~', '/' or '.'. | |
1673 |
|
1677 | |||
1674 | * IPython/Magic.py (Magic.magic_sx): modified @sc and @sx to |
|
1678 | * IPython/Magic.py (Magic.magic_sx): modified @sc and @sx to | |
1675 | expand Python variables prepended with $ in all system calls. The |
|
1679 | expand Python variables prepended with $ in all system calls. The | |
1676 | same was done to InteractiveShell.handle_shell_escape. Now all |
|
1680 | same was done to InteractiveShell.handle_shell_escape. Now all | |
1677 | system access mechanisms (!, !!, @sc, @sx and aliases) allow the |
|
1681 | system access mechanisms (!, !!, @sc, @sx and aliases) allow the | |
1678 | expansion of python variables and expressions according to the |
|
1682 | expansion of python variables and expressions according to the | |
1679 | syntax of PEP-215 - http://www.python.org/peps/pep-0215.html. |
|
1683 | syntax of PEP-215 - http://www.python.org/peps/pep-0215.html. | |
1680 |
|
1684 | |||
1681 | Though PEP-215 has been rejected, a similar (but simpler) one |
|
1685 | Though PEP-215 has been rejected, a similar (but simpler) one | |
1682 | seems like it will go into Python 2.4, PEP-292 - |
|
1686 | seems like it will go into Python 2.4, PEP-292 - | |
1683 | http://www.python.org/peps/pep-0292.html. |
|
1687 | http://www.python.org/peps/pep-0292.html. | |
1684 |
|
1688 | |||
1685 | I'll keep the full syntax of PEP-215, since IPython has since the |
|
1689 | I'll keep the full syntax of PEP-215, since IPython has since the | |
1686 | start used Ka-Ping Yee's reference implementation discussed there |
|
1690 | start used Ka-Ping Yee's reference implementation discussed there | |
1687 | (Itpl), and I actually like the powerful semantics it offers. |
|
1691 | (Itpl), and I actually like the powerful semantics it offers. | |
1688 |
|
1692 | |||
1689 | In order to access normal shell variables, the $ has to be escaped |
|
1693 | In order to access normal shell variables, the $ has to be escaped | |
1690 | via an extra $. For example: |
|
1694 | via an extra $. For example: | |
1691 |
|
1695 | |||
1692 | In [7]: PATH='a python variable' |
|
1696 | In [7]: PATH='a python variable' | |
1693 |
|
1697 | |||
1694 | In [8]: !echo $PATH |
|
1698 | In [8]: !echo $PATH | |
1695 | a python variable |
|
1699 | a python variable | |
1696 |
|
1700 | |||
1697 | In [9]: !echo $$PATH |
|
1701 | In [9]: !echo $$PATH | |
1698 | /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:... |
|
1702 | /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:... | |
1699 |
|
1703 | |||
1700 | (Magic.parse_options): escape $ so the shell doesn't evaluate |
|
1704 | (Magic.parse_options): escape $ so the shell doesn't evaluate | |
1701 | things prematurely. |
|
1705 | things prematurely. | |
1702 |
|
1706 | |||
1703 | * IPython/iplib.py (InteractiveShell.call_alias): added the |
|
1707 | * IPython/iplib.py (InteractiveShell.call_alias): added the | |
1704 | ability for aliases to expand python variables via $. |
|
1708 | ability for aliases to expand python variables via $. | |
1705 |
|
1709 | |||
1706 | * IPython/Magic.py (Magic.magic_rehash): based on the new alias |
|
1710 | * IPython/Magic.py (Magic.magic_rehash): based on the new alias | |
1707 | system, now there's a @rehash/@rehashx pair of magics. These work |
|
1711 | system, now there's a @rehash/@rehashx pair of magics. These work | |
1708 | like the csh rehash command, and can be invoked at any time. They |
|
1712 | like the csh rehash command, and can be invoked at any time. They | |
1709 | build a table of aliases to everything in the user's $PATH |
|
1713 | build a table of aliases to everything in the user's $PATH | |
1710 | (@rehash uses everything, @rehashx is slower but only adds |
|
1714 | (@rehash uses everything, @rehashx is slower but only adds | |
1711 | executable files). With this, the pysh.py-based shell profile can |
|
1715 | executable files). With this, the pysh.py-based shell profile can | |
1712 | now simply call rehash upon startup, and full access to all |
|
1716 | now simply call rehash upon startup, and full access to all | |
1713 | programs in the user's path is obtained. |
|
1717 | programs in the user's path is obtained. | |
1714 |
|
1718 | |||
1715 | * IPython/iplib.py (InteractiveShell.call_alias): The new alias |
|
1719 | * IPython/iplib.py (InteractiveShell.call_alias): The new alias | |
1716 | functionality is now fully in place. I removed the old dynamic |
|
1720 | functionality is now fully in place. I removed the old dynamic | |
1717 | code generation based approach, in favor of a much lighter one |
|
1721 | code generation based approach, in favor of a much lighter one | |
1718 | based on a simple dict. The advantage is that this allows me to |
|
1722 | based on a simple dict. The advantage is that this allows me to | |
1719 | now have thousands of aliases with negligible cost (unthinkable |
|
1723 | now have thousands of aliases with negligible cost (unthinkable | |
1720 | with the old system). |
|
1724 | with the old system). | |
1721 |
|
1725 | |||
1722 | 2004-06-19 Fernando Perez <fperez@colorado.edu> |
|
1726 | 2004-06-19 Fernando Perez <fperez@colorado.edu> | |
1723 |
|
1727 | |||
1724 | * IPython/iplib.py (__init__): extended MagicCompleter class to |
|
1728 | * IPython/iplib.py (__init__): extended MagicCompleter class to | |
1725 | also complete (last in priority) on user aliases. |
|
1729 | also complete (last in priority) on user aliases. | |
1726 |
|
1730 | |||
1727 | * IPython/Itpl.py (Itpl.__str__): fixed order of globals/locals in |
|
1731 | * IPython/Itpl.py (Itpl.__str__): fixed order of globals/locals in | |
1728 | call to eval. |
|
1732 | call to eval. | |
1729 | (ItplNS.__init__): Added a new class which functions like Itpl, |
|
1733 | (ItplNS.__init__): Added a new class which functions like Itpl, | |
1730 | but allows configuring the namespace for the evaluation to occur |
|
1734 | but allows configuring the namespace for the evaluation to occur | |
1731 | in. |
|
1735 | in. | |
1732 |
|
1736 | |||
1733 | 2004-06-18 Fernando Perez <fperez@colorado.edu> |
|
1737 | 2004-06-18 Fernando Perez <fperez@colorado.edu> | |
1734 |
|
1738 | |||
1735 | * IPython/iplib.py (InteractiveShell.runcode): modify to print a |
|
1739 | * IPython/iplib.py (InteractiveShell.runcode): modify to print a | |
1736 | better message when 'exit' or 'quit' are typed (a common newbie |
|
1740 | better message when 'exit' or 'quit' are typed (a common newbie | |
1737 | confusion). |
|
1741 | confusion). | |
1738 |
|
1742 | |||
1739 | * IPython/Magic.py (Magic.magic_colors): Added the runtime color |
|
1743 | * IPython/Magic.py (Magic.magic_colors): Added the runtime color | |
1740 | check for Windows users. |
|
1744 | check for Windows users. | |
1741 |
|
1745 | |||
1742 | * IPython/iplib.py (InteractiveShell.user_setup): removed |
|
1746 | * IPython/iplib.py (InteractiveShell.user_setup): removed | |
1743 | disabling of colors for Windows. I'll test at runtime and issue a |
|
1747 | disabling of colors for Windows. I'll test at runtime and issue a | |
1744 | warning if Gary's readline isn't found, as to nudge users to |
|
1748 | warning if Gary's readline isn't found, as to nudge users to | |
1745 | download it. |
|
1749 | download it. | |
1746 |
|
1750 | |||
1747 | 2004-06-16 Fernando Perez <fperez@colorado.edu> |
|
1751 | 2004-06-16 Fernando Perez <fperez@colorado.edu> | |
1748 |
|
1752 | |||
1749 | * IPython/genutils.py (Stream.__init__): changed to print errors |
|
1753 | * IPython/genutils.py (Stream.__init__): changed to print errors | |
1750 | to sys.stderr. I had a circular dependency here. Now it's |
|
1754 | to sys.stderr. I had a circular dependency here. Now it's | |
1751 | possible to run ipython as IDLE's shell (consider this pre-alpha, |
|
1755 | possible to run ipython as IDLE's shell (consider this pre-alpha, | |
1752 | since true stdout things end up in the starting terminal instead |
|
1756 | since true stdout things end up in the starting terminal instead | |
1753 | of IDLE's out). |
|
1757 | of IDLE's out). | |
1754 |
|
1758 | |||
1755 | * IPython/Prompts.py (Prompt2.set_colors): prevent crashes for |
|
1759 | * IPython/Prompts.py (Prompt2.set_colors): prevent crashes for | |
1756 | users who haven't # updated their prompt_in2 definitions. Remove |
|
1760 | users who haven't # updated their prompt_in2 definitions. Remove | |
1757 | eventually. |
|
1761 | eventually. | |
1758 | (multiple_replace): added credit to original ASPN recipe. |
|
1762 | (multiple_replace): added credit to original ASPN recipe. | |
1759 |
|
1763 | |||
1760 | 2004-06-15 Fernando Perez <fperez@colorado.edu> |
|
1764 | 2004-06-15 Fernando Perez <fperez@colorado.edu> | |
1761 |
|
1765 | |||
1762 | * IPython/iplib.py (InteractiveShell.__init__): add 'cp' to the |
|
1766 | * IPython/iplib.py (InteractiveShell.__init__): add 'cp' to the | |
1763 | list of auto-defined aliases. |
|
1767 | list of auto-defined aliases. | |
1764 |
|
1768 | |||
1765 | 2004-06-13 Fernando Perez <fperez@colorado.edu> |
|
1769 | 2004-06-13 Fernando Perez <fperez@colorado.edu> | |
1766 |
|
1770 | |||
1767 | * setup.py (scriptfiles): Don't trigger win_post_install unless an |
|
1771 | * setup.py (scriptfiles): Don't trigger win_post_install unless an | |
1768 | install was really requested (so setup.py can be used for other |
|
1772 | install was really requested (so setup.py can be used for other | |
1769 | things under Windows). |
|
1773 | things under Windows). | |
1770 |
|
1774 | |||
1771 | 2004-06-10 Fernando Perez <fperez@colorado.edu> |
|
1775 | 2004-06-10 Fernando Perez <fperez@colorado.edu> | |
1772 |
|
1776 | |||
1773 | * IPython/Logger.py (Logger.create_log): Manually remove any old |
|
1777 | * IPython/Logger.py (Logger.create_log): Manually remove any old | |
1774 | backup, since os.remove may fail under Windows. Fixes bug |
|
1778 | backup, since os.remove may fail under Windows. Fixes bug | |
1775 | reported by Thorsten. |
|
1779 | reported by Thorsten. | |
1776 |
|
1780 | |||
1777 | 2004-06-09 Fernando Perez <fperez@colorado.edu> |
|
1781 | 2004-06-09 Fernando Perez <fperez@colorado.edu> | |
1778 |
|
1782 | |||
1779 | * examples/example-embed.py: fixed all references to %n (replaced |
|
1783 | * examples/example-embed.py: fixed all references to %n (replaced | |
1780 | with \\# for ps1/out prompts and with \\D for ps2 prompts). Done |
|
1784 | with \\# for ps1/out prompts and with \\D for ps2 prompts). Done | |
1781 | for all examples and the manual as well. |
|
1785 | for all examples and the manual as well. | |
1782 |
|
1786 | |||
1783 | 2004-06-08 Fernando Perez <fperez@colorado.edu> |
|
1787 | 2004-06-08 Fernando Perez <fperez@colorado.edu> | |
1784 |
|
1788 | |||
1785 | * IPython/Prompts.py (Prompt2.set_p_str): fixed all prompt |
|
1789 | * IPython/Prompts.py (Prompt2.set_p_str): fixed all prompt | |
1786 | alignment and color management. All 3 prompt subsystems now |
|
1790 | alignment and color management. All 3 prompt subsystems now | |
1787 | inherit from BasePrompt. |
|
1791 | inherit from BasePrompt. | |
1788 |
|
1792 | |||
1789 | * tools/release: updates for windows installer build and tag rpms |
|
1793 | * tools/release: updates for windows installer build and tag rpms | |
1790 | with python version (since paths are fixed). |
|
1794 | with python version (since paths are fixed). | |
1791 |
|
1795 | |||
1792 | * IPython/UserConfig/ipythonrc: modified to use \# instead of %n, |
|
1796 | * IPython/UserConfig/ipythonrc: modified to use \# instead of %n, | |
1793 | which will become eventually obsolete. Also fixed the default |
|
1797 | which will become eventually obsolete. Also fixed the default | |
1794 | prompt_in2 to use \D, so at least new users start with the correct |
|
1798 | prompt_in2 to use \D, so at least new users start with the correct | |
1795 | defaults. |
|
1799 | defaults. | |
1796 | WARNING: Users with existing ipythonrc files will need to apply |
|
1800 | WARNING: Users with existing ipythonrc files will need to apply | |
1797 | this fix manually! |
|
1801 | this fix manually! | |
1798 |
|
1802 | |||
1799 | * setup.py: make windows installer (.exe). This is finally the |
|
1803 | * setup.py: make windows installer (.exe). This is finally the | |
1800 | integration of an old patch by Cory Dodt <dodt-AT-fcoe.k12.ca.us>, |
|
1804 | integration of an old patch by Cory Dodt <dodt-AT-fcoe.k12.ca.us>, | |
1801 | which I hadn't included because it required Python 2.3 (or recent |
|
1805 | which I hadn't included because it required Python 2.3 (or recent | |
1802 | distutils). |
|
1806 | distutils). | |
1803 |
|
1807 | |||
1804 | * IPython/usage.py (__doc__): update docs (and manpage) to reflect |
|
1808 | * IPython/usage.py (__doc__): update docs (and manpage) to reflect | |
1805 | usage of new '\D' escape. |
|
1809 | usage of new '\D' escape. | |
1806 |
|
1810 | |||
1807 | * IPython/Prompts.py (ROOT_SYMBOL): Small fix for Windows (which |
|
1811 | * IPython/Prompts.py (ROOT_SYMBOL): Small fix for Windows (which | |
1808 | lacks os.getuid()) |
|
1812 | lacks os.getuid()) | |
1809 | (CachedOutput.set_colors): Added the ability to turn coloring |
|
1813 | (CachedOutput.set_colors): Added the ability to turn coloring | |
1810 | on/off with @colors even for manually defined prompt colors. It |
|
1814 | on/off with @colors even for manually defined prompt colors. It | |
1811 | uses a nasty global, but it works safely and via the generic color |
|
1815 | uses a nasty global, but it works safely and via the generic color | |
1812 | handling mechanism. |
|
1816 | handling mechanism. | |
1813 | (Prompt2.__init__): Introduced new escape '\D' for continuation |
|
1817 | (Prompt2.__init__): Introduced new escape '\D' for continuation | |
1814 | prompts. It represents the counter ('\#') as dots. |
|
1818 | prompts. It represents the counter ('\#') as dots. | |
1815 | *** NOTE *** THIS IS A BACKWARDS-INCOMPATIBLE CHANGE. Users will |
|
1819 | *** NOTE *** THIS IS A BACKWARDS-INCOMPATIBLE CHANGE. Users will | |
1816 | need to update their ipythonrc files and replace '%n' with '\D' in |
|
1820 | need to update their ipythonrc files and replace '%n' with '\D' in | |
1817 | their prompt_in2 settings everywhere. Sorry, but there's |
|
1821 | their prompt_in2 settings everywhere. Sorry, but there's | |
1818 | otherwise no clean way to get all prompts to properly align. The |
|
1822 | otherwise no clean way to get all prompts to properly align. The | |
1819 | ipythonrc shipped with IPython has been updated. |
|
1823 | ipythonrc shipped with IPython has been updated. | |
1820 |
|
1824 | |||
1821 | 2004-06-07 Fernando Perez <fperez@colorado.edu> |
|
1825 | 2004-06-07 Fernando Perez <fperez@colorado.edu> | |
1822 |
|
1826 | |||
1823 | * setup.py (isfile): Pass local_icons option to latex2html, so the |
|
1827 | * setup.py (isfile): Pass local_icons option to latex2html, so the | |
1824 | resulting HTML file is self-contained. Thanks to |
|
1828 | resulting HTML file is self-contained. Thanks to | |
1825 | dryice-AT-liu.com.cn for the tip. |
|
1829 | dryice-AT-liu.com.cn for the tip. | |
1826 |
|
1830 | |||
1827 | * pysh.py: I created a new profile 'shell', which implements a |
|
1831 | * pysh.py: I created a new profile 'shell', which implements a | |
1828 | _rudimentary_ IPython-based shell. This is in NO WAY a realy |
|
1832 | _rudimentary_ IPython-based shell. This is in NO WAY a realy | |
1829 | system shell, nor will it become one anytime soon. It's mainly |
|
1833 | system shell, nor will it become one anytime soon. It's mainly | |
1830 | meant to illustrate the use of the new flexible bash-like prompts. |
|
1834 | meant to illustrate the use of the new flexible bash-like prompts. | |
1831 | I guess it could be used by hardy souls for true shell management, |
|
1835 | I guess it could be used by hardy souls for true shell management, | |
1832 | but it's no tcsh/bash... pysh.py is loaded by the 'shell' |
|
1836 | but it's no tcsh/bash... pysh.py is loaded by the 'shell' | |
1833 | profile. This uses the InterpreterExec extension provided by |
|
1837 | profile. This uses the InterpreterExec extension provided by | |
1834 | W.J. van der Laan <gnufnork-AT-hetdigitalegat.nl> |
|
1838 | W.J. van der Laan <gnufnork-AT-hetdigitalegat.nl> | |
1835 |
|
1839 | |||
1836 | * IPython/Prompts.py (PromptOut.__str__): now it will correctly |
|
1840 | * IPython/Prompts.py (PromptOut.__str__): now it will correctly | |
1837 | auto-align itself with the length of the previous input prompt |
|
1841 | auto-align itself with the length of the previous input prompt | |
1838 | (taking into account the invisible color escapes). |
|
1842 | (taking into account the invisible color escapes). | |
1839 | (CachedOutput.__init__): Large restructuring of this class. Now |
|
1843 | (CachedOutput.__init__): Large restructuring of this class. Now | |
1840 | all three prompts (primary1, primary2, output) are proper objects, |
|
1844 | all three prompts (primary1, primary2, output) are proper objects, | |
1841 | managed by the 'parent' CachedOutput class. The code is still a |
|
1845 | managed by the 'parent' CachedOutput class. The code is still a | |
1842 | bit hackish (all prompts share state via a pointer to the cache), |
|
1846 | bit hackish (all prompts share state via a pointer to the cache), | |
1843 | but it's overall far cleaner than before. |
|
1847 | but it's overall far cleaner than before. | |
1844 |
|
1848 | |||
1845 | * IPython/genutils.py (getoutputerror): modified to add verbose, |
|
1849 | * IPython/genutils.py (getoutputerror): modified to add verbose, | |
1846 | debug and header options. This makes the interface of all getout* |
|
1850 | debug and header options. This makes the interface of all getout* | |
1847 | functions uniform. |
|
1851 | functions uniform. | |
1848 | (SystemExec.getoutputerror): added getoutputerror to SystemExec. |
|
1852 | (SystemExec.getoutputerror): added getoutputerror to SystemExec. | |
1849 |
|
1853 | |||
1850 | * IPython/Magic.py (Magic.default_option): added a function to |
|
1854 | * IPython/Magic.py (Magic.default_option): added a function to | |
1851 | allow registering default options for any magic command. This |
|
1855 | allow registering default options for any magic command. This | |
1852 | makes it easy to have profiles which customize the magics globally |
|
1856 | makes it easy to have profiles which customize the magics globally | |
1853 | for a certain use. The values set through this function are |
|
1857 | for a certain use. The values set through this function are | |
1854 | picked up by the parse_options() method, which all magics should |
|
1858 | picked up by the parse_options() method, which all magics should | |
1855 | use to parse their options. |
|
1859 | use to parse their options. | |
1856 |
|
1860 | |||
1857 | * IPython/genutils.py (warn): modified the warnings framework to |
|
1861 | * IPython/genutils.py (warn): modified the warnings framework to | |
1858 | use the Term I/O class. I'm trying to slowly unify all of |
|
1862 | use the Term I/O class. I'm trying to slowly unify all of | |
1859 | IPython's I/O operations to pass through Term. |
|
1863 | IPython's I/O operations to pass through Term. | |
1860 |
|
1864 | |||
1861 | * IPython/Prompts.py (Prompt2._str_other): Added functionality in |
|
1865 | * IPython/Prompts.py (Prompt2._str_other): Added functionality in | |
1862 | the secondary prompt to correctly match the length of the primary |
|
1866 | the secondary prompt to correctly match the length of the primary | |
1863 | one for any prompt. Now multi-line code will properly line up |
|
1867 | one for any prompt. Now multi-line code will properly line up | |
1864 | even for path dependent prompts, such as the new ones available |
|
1868 | even for path dependent prompts, such as the new ones available | |
1865 | via the prompt_specials. |
|
1869 | via the prompt_specials. | |
1866 |
|
1870 | |||
1867 | 2004-06-06 Fernando Perez <fperez@colorado.edu> |
|
1871 | 2004-06-06 Fernando Perez <fperez@colorado.edu> | |
1868 |
|
1872 | |||
1869 | * IPython/Prompts.py (prompt_specials): Added the ability to have |
|
1873 | * IPython/Prompts.py (prompt_specials): Added the ability to have | |
1870 | bash-like special sequences in the prompts, which get |
|
1874 | bash-like special sequences in the prompts, which get | |
1871 | automatically expanded. Things like hostname, current working |
|
1875 | automatically expanded. Things like hostname, current working | |
1872 | directory and username are implemented already, but it's easy to |
|
1876 | directory and username are implemented already, but it's easy to | |
1873 | add more in the future. Thanks to a patch by W.J. van der Laan |
|
1877 | add more in the future. Thanks to a patch by W.J. van der Laan | |
1874 | <gnufnork-AT-hetdigitalegat.nl> |
|
1878 | <gnufnork-AT-hetdigitalegat.nl> | |
1875 | (prompt_specials): Added color support for prompt strings, so |
|
1879 | (prompt_specials): Added color support for prompt strings, so | |
1876 | users can define arbitrary color setups for their prompts. |
|
1880 | users can define arbitrary color setups for their prompts. | |
1877 |
|
1881 | |||
1878 | 2004-06-05 Fernando Perez <fperez@colorado.edu> |
|
1882 | 2004-06-05 Fernando Perez <fperez@colorado.edu> | |
1879 |
|
1883 | |||
1880 | * IPython/genutils.py (Term.reopen_all): Added Windows-specific |
|
1884 | * IPython/genutils.py (Term.reopen_all): Added Windows-specific | |
1881 | code to load Gary Bishop's readline and configure it |
|
1885 | code to load Gary Bishop's readline and configure it | |
1882 | automatically. Thanks to Gary for help on this. |
|
1886 | automatically. Thanks to Gary for help on this. | |
1883 |
|
1887 | |||
1884 | 2004-06-01 Fernando Perez <fperez@colorado.edu> |
|
1888 | 2004-06-01 Fernando Perez <fperez@colorado.edu> | |
1885 |
|
1889 | |||
1886 | * IPython/Logger.py (Logger.create_log): fix bug for logging |
|
1890 | * IPython/Logger.py (Logger.create_log): fix bug for logging | |
1887 | with no filename (previous fix was incomplete). |
|
1891 | with no filename (previous fix was incomplete). | |
1888 |
|
1892 | |||
1889 | 2004-05-25 Fernando Perez <fperez@colorado.edu> |
|
1893 | 2004-05-25 Fernando Perez <fperez@colorado.edu> | |
1890 |
|
1894 | |||
1891 | * IPython/Magic.py (Magic.parse_options): fix bug where naked |
|
1895 | * IPython/Magic.py (Magic.parse_options): fix bug where naked | |
1892 | parens would get passed to the shell. |
|
1896 | parens would get passed to the shell. | |
1893 |
|
1897 | |||
1894 | 2004-05-20 Fernando Perez <fperez@colorado.edu> |
|
1898 | 2004-05-20 Fernando Perez <fperez@colorado.edu> | |
1895 |
|
1899 | |||
1896 | * IPython/Magic.py (Magic.magic_prun): changed default profile |
|
1900 | * IPython/Magic.py (Magic.magic_prun): changed default profile | |
1897 | sort order to 'time' (the more common profiling need). |
|
1901 | sort order to 'time' (the more common profiling need). | |
1898 |
|
1902 | |||
1899 | * IPython/OInspect.py (Inspector.pinfo): flush the inspect cache |
|
1903 | * IPython/OInspect.py (Inspector.pinfo): flush the inspect cache | |
1900 | so that source code shown is guaranteed in sync with the file on |
|
1904 | so that source code shown is guaranteed in sync with the file on | |
1901 | disk (also changed in psource). Similar fix to the one for |
|
1905 | disk (also changed in psource). Similar fix to the one for | |
1902 | ultraTB on 2004-05-06. Thanks to a bug report by Yann Le Du |
|
1906 | ultraTB on 2004-05-06. Thanks to a bug report by Yann Le Du | |
1903 | <yann.ledu-AT-noos.fr>. |
|
1907 | <yann.ledu-AT-noos.fr>. | |
1904 |
|
1908 | |||
1905 | * IPython/Magic.py (Magic.parse_options): Fixed bug where commands |
|
1909 | * IPython/Magic.py (Magic.parse_options): Fixed bug where commands | |
1906 | with a single option would not be correctly parsed. Closes |
|
1910 | with a single option would not be correctly parsed. Closes | |
1907 | http://www.scipy.net/roundup/ipython/issue14. This bug had been |
|
1911 | http://www.scipy.net/roundup/ipython/issue14. This bug had been | |
1908 | introduced in 0.6.0 (on 2004-05-06). |
|
1912 | introduced in 0.6.0 (on 2004-05-06). | |
1909 |
|
1913 | |||
1910 | 2004-05-13 *** Released version 0.6.0 |
|
1914 | 2004-05-13 *** Released version 0.6.0 | |
1911 |
|
1915 | |||
1912 | 2004-05-13 Fernando Perez <fperez@colorado.edu> |
|
1916 | 2004-05-13 Fernando Perez <fperez@colorado.edu> | |
1913 |
|
1917 | |||
1914 | * debian/: Added debian/ directory to CVS, so that debian support |
|
1918 | * debian/: Added debian/ directory to CVS, so that debian support | |
1915 | is publicly accessible. The debian package is maintained by Jack |
|
1919 | is publicly accessible. The debian package is maintained by Jack | |
1916 | Moffit <jack-AT-xiph.org>. |
|
1920 | Moffit <jack-AT-xiph.org>. | |
1917 |
|
1921 | |||
1918 | * Documentation: included the notes about an ipython-based system |
|
1922 | * Documentation: included the notes about an ipython-based system | |
1919 | shell (the hypothetical 'pysh') into the new_design.pdf document, |
|
1923 | shell (the hypothetical 'pysh') into the new_design.pdf document, | |
1920 | so that these ideas get distributed to users along with the |
|
1924 | so that these ideas get distributed to users along with the | |
1921 | official documentation. |
|
1925 | official documentation. | |
1922 |
|
1926 | |||
1923 | 2004-05-10 Fernando Perez <fperez@colorado.edu> |
|
1927 | 2004-05-10 Fernando Perez <fperez@colorado.edu> | |
1924 |
|
1928 | |||
1925 | * IPython/Logger.py (Logger.create_log): fix recently introduced |
|
1929 | * IPython/Logger.py (Logger.create_log): fix recently introduced | |
1926 | bug (misindented line) where logstart would fail when not given an |
|
1930 | bug (misindented line) where logstart would fail when not given an | |
1927 | explicit filename. |
|
1931 | explicit filename. | |
1928 |
|
1932 | |||
1929 | 2004-05-09 Fernando Perez <fperez@colorado.edu> |
|
1933 | 2004-05-09 Fernando Perez <fperez@colorado.edu> | |
1930 |
|
1934 | |||
1931 | * IPython/Magic.py (Magic.parse_options): skip system call when |
|
1935 | * IPython/Magic.py (Magic.parse_options): skip system call when | |
1932 | there are no options to look for. Faster, cleaner for the common |
|
1936 | there are no options to look for. Faster, cleaner for the common | |
1933 | case. |
|
1937 | case. | |
1934 |
|
1938 | |||
1935 | * Documentation: many updates to the manual: describing Windows |
|
1939 | * Documentation: many updates to the manual: describing Windows | |
1936 | support better, Gnuplot updates, credits, misc small stuff. Also |
|
1940 | support better, Gnuplot updates, credits, misc small stuff. Also | |
1937 | updated the new_design doc a bit. |
|
1941 | updated the new_design doc a bit. | |
1938 |
|
1942 | |||
1939 | 2004-05-06 *** Released version 0.6.0.rc1 |
|
1943 | 2004-05-06 *** Released version 0.6.0.rc1 | |
1940 |
|
1944 | |||
1941 | 2004-05-06 Fernando Perez <fperez@colorado.edu> |
|
1945 | 2004-05-06 Fernando Perez <fperez@colorado.edu> | |
1942 |
|
1946 | |||
1943 | * IPython/ultraTB.py (ListTB.text): modified a ton of string += |
|
1947 | * IPython/ultraTB.py (ListTB.text): modified a ton of string += | |
1944 | operations to use the vastly more efficient list/''.join() method. |
|
1948 | operations to use the vastly more efficient list/''.join() method. | |
1945 | (FormattedTB.text): Fix |
|
1949 | (FormattedTB.text): Fix | |
1946 | http://www.scipy.net/roundup/ipython/issue12 - exception source |
|
1950 | http://www.scipy.net/roundup/ipython/issue12 - exception source | |
1947 | extract not updated after reload. Thanks to Mike Salib |
|
1951 | extract not updated after reload. Thanks to Mike Salib | |
1948 | <msalib-AT-mit.edu> for pinning the source of the problem. |
|
1952 | <msalib-AT-mit.edu> for pinning the source of the problem. | |
1949 | Fortunately, the solution works inside ipython and doesn't require |
|
1953 | Fortunately, the solution works inside ipython and doesn't require | |
1950 | any changes to python proper. |
|
1954 | any changes to python proper. | |
1951 |
|
1955 | |||
1952 | * IPython/Magic.py (Magic.parse_options): Improved to process the |
|
1956 | * IPython/Magic.py (Magic.parse_options): Improved to process the | |
1953 | argument list as a true shell would (by actually using the |
|
1957 | argument list as a true shell would (by actually using the | |
1954 | underlying system shell). This way, all @magics automatically get |
|
1958 | underlying system shell). This way, all @magics automatically get | |
1955 | shell expansion for variables. Thanks to a comment by Alex |
|
1959 | shell expansion for variables. Thanks to a comment by Alex | |
1956 | Schmolck. |
|
1960 | Schmolck. | |
1957 |
|
1961 | |||
1958 | 2004-04-04 Fernando Perez <fperez@colorado.edu> |
|
1962 | 2004-04-04 Fernando Perez <fperez@colorado.edu> | |
1959 |
|
1963 | |||
1960 | * IPython/iplib.py (InteractiveShell.interact): Added a special |
|
1964 | * IPython/iplib.py (InteractiveShell.interact): Added a special | |
1961 | trap for a debugger quit exception, which is basically impossible |
|
1965 | trap for a debugger quit exception, which is basically impossible | |
1962 | to handle by normal mechanisms, given what pdb does to the stack. |
|
1966 | to handle by normal mechanisms, given what pdb does to the stack. | |
1963 | This fixes a crash reported by <fgibbons-AT-llama.med.harvard.edu>. |
|
1967 | This fixes a crash reported by <fgibbons-AT-llama.med.harvard.edu>. | |
1964 |
|
1968 | |||
1965 | 2004-04-03 Fernando Perez <fperez@colorado.edu> |
|
1969 | 2004-04-03 Fernando Perez <fperez@colorado.edu> | |
1966 |
|
1970 | |||
1967 | * IPython/genutils.py (Term): Standardized the names of the Term |
|
1971 | * IPython/genutils.py (Term): Standardized the names of the Term | |
1968 | class streams to cin/cout/cerr, following C++ naming conventions |
|
1972 | class streams to cin/cout/cerr, following C++ naming conventions | |
1969 | (I can't use in/out/err because 'in' is not a valid attribute |
|
1973 | (I can't use in/out/err because 'in' is not a valid attribute | |
1970 | name). |
|
1974 | name). | |
1971 |
|
1975 | |||
1972 | * IPython/iplib.py (InteractiveShell.interact): don't increment |
|
1976 | * IPython/iplib.py (InteractiveShell.interact): don't increment | |
1973 | the prompt if there's no user input. By Daniel 'Dang' Griffith |
|
1977 | the prompt if there's no user input. By Daniel 'Dang' Griffith | |
1974 | <pythondev-dang-AT-lazytwinacres.net>, after a suggestion from |
|
1978 | <pythondev-dang-AT-lazytwinacres.net>, after a suggestion from | |
1975 | Francois Pinard. |
|
1979 | Francois Pinard. | |
1976 |
|
1980 | |||
1977 | 2004-04-02 Fernando Perez <fperez@colorado.edu> |
|
1981 | 2004-04-02 Fernando Perez <fperez@colorado.edu> | |
1978 |
|
1982 | |||
1979 | * IPython/genutils.py (Stream.__init__): Modified to survive at |
|
1983 | * IPython/genutils.py (Stream.__init__): Modified to survive at | |
1980 | least importing in contexts where stdin/out/err aren't true file |
|
1984 | least importing in contexts where stdin/out/err aren't true file | |
1981 | objects, such as PyCrust (they lack fileno() and mode). However, |
|
1985 | objects, such as PyCrust (they lack fileno() and mode). However, | |
1982 | the recovery facilities which rely on these things existing will |
|
1986 | the recovery facilities which rely on these things existing will | |
1983 | not work. |
|
1987 | not work. | |
1984 |
|
1988 | |||
1985 | 2004-04-01 Fernando Perez <fperez@colorado.edu> |
|
1989 | 2004-04-01 Fernando Perez <fperez@colorado.edu> | |
1986 |
|
1990 | |||
1987 | * IPython/Magic.py (Magic.magic_sx): modified (as well as @sc) to |
|
1991 | * IPython/Magic.py (Magic.magic_sx): modified (as well as @sc) to | |
1988 | use the new getoutputerror() function, so it properly |
|
1992 | use the new getoutputerror() function, so it properly | |
1989 | distinguishes stdout/err. |
|
1993 | distinguishes stdout/err. | |
1990 |
|
1994 | |||
1991 | * IPython/genutils.py (getoutputerror): added a function to |
|
1995 | * IPython/genutils.py (getoutputerror): added a function to | |
1992 | capture separately the standard output and error of a command. |
|
1996 | capture separately the standard output and error of a command. | |
1993 | After a comment from dang on the mailing lists. This code is |
|
1997 | After a comment from dang on the mailing lists. This code is | |
1994 | basically a modified version of commands.getstatusoutput(), from |
|
1998 | basically a modified version of commands.getstatusoutput(), from | |
1995 | the standard library. |
|
1999 | the standard library. | |
1996 |
|
2000 | |||
1997 | * IPython/iplib.py (InteractiveShell.handle_shell_escape): added |
|
2001 | * IPython/iplib.py (InteractiveShell.handle_shell_escape): added | |
1998 | '!!' as a special syntax (shorthand) to access @sx. |
|
2002 | '!!' as a special syntax (shorthand) to access @sx. | |
1999 |
|
2003 | |||
2000 | * IPython/Magic.py (Magic.magic_sx): new magic, to execute a shell |
|
2004 | * IPython/Magic.py (Magic.magic_sx): new magic, to execute a shell | |
2001 | command and return its output as a list split on '\n'. |
|
2005 | command and return its output as a list split on '\n'. | |
2002 |
|
2006 | |||
2003 | 2004-03-31 Fernando Perez <fperez@colorado.edu> |
|
2007 | 2004-03-31 Fernando Perez <fperez@colorado.edu> | |
2004 |
|
2008 | |||
2005 | * IPython/FakeModule.py (FakeModule.__init__): added __nonzero__ |
|
2009 | * IPython/FakeModule.py (FakeModule.__init__): added __nonzero__ | |
2006 | method to dictionaries used as FakeModule instances if they lack |
|
2010 | method to dictionaries used as FakeModule instances if they lack | |
2007 | it. At least pydoc in python2.3 breaks for runtime-defined |
|
2011 | it. At least pydoc in python2.3 breaks for runtime-defined | |
2008 | functions without this hack. At some point I need to _really_ |
|
2012 | functions without this hack. At some point I need to _really_ | |
2009 | understand what FakeModule is doing, because it's a gross hack. |
|
2013 | understand what FakeModule is doing, because it's a gross hack. | |
2010 | But it solves Arnd's problem for now... |
|
2014 | But it solves Arnd's problem for now... | |
2011 |
|
2015 | |||
2012 | 2004-02-27 Fernando Perez <fperez@colorado.edu> |
|
2016 | 2004-02-27 Fernando Perez <fperez@colorado.edu> | |
2013 |
|
2017 | |||
2014 | * IPython/Logger.py (Logger.create_log): Fix bug where 'rotate' |
|
2018 | * IPython/Logger.py (Logger.create_log): Fix bug where 'rotate' | |
2015 | mode would behave erratically. Also increased the number of |
|
2019 | mode would behave erratically. Also increased the number of | |
2016 | possible logs in rotate mod to 999. Thanks to Rod Holland |
|
2020 | possible logs in rotate mod to 999. Thanks to Rod Holland | |
2017 | <rhh@StructureLABS.com> for the report and fixes. |
|
2021 | <rhh@StructureLABS.com> for the report and fixes. | |
2018 |
|
2022 | |||
2019 | 2004-02-26 Fernando Perez <fperez@colorado.edu> |
|
2023 | 2004-02-26 Fernando Perez <fperez@colorado.edu> | |
2020 |
|
2024 | |||
2021 | * IPython/genutils.py (page): Check that the curses module really |
|
2025 | * IPython/genutils.py (page): Check that the curses module really | |
2022 | has the initscr attribute before trying to use it. For some |
|
2026 | has the initscr attribute before trying to use it. For some | |
2023 | reason, the Solaris curses module is missing this. I think this |
|
2027 | reason, the Solaris curses module is missing this. I think this | |
2024 | should be considered a Solaris python bug, but I'm not sure. |
|
2028 | should be considered a Solaris python bug, but I'm not sure. | |
2025 |
|
2029 | |||
2026 | 2004-01-17 Fernando Perez <fperez@colorado.edu> |
|
2030 | 2004-01-17 Fernando Perez <fperez@colorado.edu> | |
2027 |
|
2031 | |||
2028 | * IPython/genutils.py (Stream.__init__): Changes to try to make |
|
2032 | * IPython/genutils.py (Stream.__init__): Changes to try to make | |
2029 | ipython robust against stdin/out/err being closed by the user. |
|
2033 | ipython robust against stdin/out/err being closed by the user. | |
2030 | This is 'user error' (and blocks a normal python session, at least |
|
2034 | This is 'user error' (and blocks a normal python session, at least | |
2031 | the stdout case). However, Ipython should be able to survive such |
|
2035 | the stdout case). However, Ipython should be able to survive such | |
2032 | instances of abuse as gracefully as possible. To simplify the |
|
2036 | instances of abuse as gracefully as possible. To simplify the | |
2033 | coding and maintain compatibility with Gary Bishop's Term |
|
2037 | coding and maintain compatibility with Gary Bishop's Term | |
2034 | contributions, I've made use of classmethods for this. I think |
|
2038 | contributions, I've made use of classmethods for this. I think | |
2035 | this introduces a dependency on python 2.2. |
|
2039 | this introduces a dependency on python 2.2. | |
2036 |
|
2040 | |||
2037 | 2004-01-13 Fernando Perez <fperez@colorado.edu> |
|
2041 | 2004-01-13 Fernando Perez <fperez@colorado.edu> | |
2038 |
|
2042 | |||
2039 | * IPython/numutils.py (exp_safe): simplified the code a bit and |
|
2043 | * IPython/numutils.py (exp_safe): simplified the code a bit and | |
2040 | removed the need for importing the kinds module altogether. |
|
2044 | removed the need for importing the kinds module altogether. | |
2041 |
|
2045 | |||
2042 | 2004-01-06 Fernando Perez <fperez@colorado.edu> |
|
2046 | 2004-01-06 Fernando Perez <fperez@colorado.edu> | |
2043 |
|
2047 | |||
2044 | * IPython/Magic.py (Magic.magic_sc): Made the shell capture system |
|
2048 | * IPython/Magic.py (Magic.magic_sc): Made the shell capture system | |
2045 | a magic function instead, after some community feedback. No |
|
2049 | a magic function instead, after some community feedback. No | |
2046 | special syntax will exist for it, but its name is deliberately |
|
2050 | special syntax will exist for it, but its name is deliberately | |
2047 | very short. |
|
2051 | very short. | |
2048 |
|
2052 | |||
2049 | 2003-12-20 Fernando Perez <fperez@colorado.edu> |
|
2053 | 2003-12-20 Fernando Perez <fperez@colorado.edu> | |
2050 |
|
2054 | |||
2051 | * IPython/iplib.py (InteractiveShell.handle_shell_assign): Added |
|
2055 | * IPython/iplib.py (InteractiveShell.handle_shell_assign): Added | |
2052 | new functionality, to automagically assign the result of a shell |
|
2056 | new functionality, to automagically assign the result of a shell | |
2053 | command to a variable. I'll solicit some community feedback on |
|
2057 | command to a variable. I'll solicit some community feedback on | |
2054 | this before making it permanent. |
|
2058 | this before making it permanent. | |
2055 |
|
2059 | |||
2056 | * IPython/OInspect.py (Inspector.pinfo): Fix crash when info was |
|
2060 | * IPython/OInspect.py (Inspector.pinfo): Fix crash when info was | |
2057 | requested about callables for which inspect couldn't obtain a |
|
2061 | requested about callables for which inspect couldn't obtain a | |
2058 | proper argspec. Thanks to a crash report sent by Etienne |
|
2062 | proper argspec. Thanks to a crash report sent by Etienne | |
2059 | Posthumus <etienne-AT-apple01.cs.vu.nl>. |
|
2063 | Posthumus <etienne-AT-apple01.cs.vu.nl>. | |
2060 |
|
2064 | |||
2061 | 2003-12-09 Fernando Perez <fperez@colorado.edu> |
|
2065 | 2003-12-09 Fernando Perez <fperez@colorado.edu> | |
2062 |
|
2066 | |||
2063 | * IPython/genutils.py (page): patch for the pager to work across |
|
2067 | * IPython/genutils.py (page): patch for the pager to work across | |
2064 | various versions of Windows. By Gary Bishop. |
|
2068 | various versions of Windows. By Gary Bishop. | |
2065 |
|
2069 | |||
2066 | 2003-12-04 Fernando Perez <fperez@colorado.edu> |
|
2070 | 2003-12-04 Fernando Perez <fperez@colorado.edu> | |
2067 |
|
2071 | |||
2068 | * IPython/Gnuplot2.py (PlotItems): Fixes for working with |
|
2072 | * IPython/Gnuplot2.py (PlotItems): Fixes for working with | |
2069 | Gnuplot.py version 1.7, whose internal names changed quite a bit. |
|
2073 | Gnuplot.py version 1.7, whose internal names changed quite a bit. | |
2070 | While I tested this and it looks ok, there may still be corner |
|
2074 | While I tested this and it looks ok, there may still be corner | |
2071 | cases I've missed. |
|
2075 | cases I've missed. | |
2072 |
|
2076 | |||
2073 | 2003-12-01 Fernando Perez <fperez@colorado.edu> |
|
2077 | 2003-12-01 Fernando Perez <fperez@colorado.edu> | |
2074 |
|
2078 | |||
2075 | * IPython/iplib.py (InteractiveShell._prefilter): Fixed a bug |
|
2079 | * IPython/iplib.py (InteractiveShell._prefilter): Fixed a bug | |
2076 | where a line like 'p,q=1,2' would fail because the automagic |
|
2080 | where a line like 'p,q=1,2' would fail because the automagic | |
2077 | system would be triggered for @p. |
|
2081 | system would be triggered for @p. | |
2078 |
|
2082 | |||
2079 | * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): Tab-related |
|
2083 | * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): Tab-related | |
2080 | cleanups, code unmodified. |
|
2084 | cleanups, code unmodified. | |
2081 |
|
2085 | |||
2082 | * IPython/genutils.py (Term): added a class for IPython to handle |
|
2086 | * IPython/genutils.py (Term): added a class for IPython to handle | |
2083 | output. In most cases it will just be a proxy for stdout/err, but |
|
2087 | output. In most cases it will just be a proxy for stdout/err, but | |
2084 | having this allows modifications to be made for some platforms, |
|
2088 | having this allows modifications to be made for some platforms, | |
2085 | such as handling color escapes under Windows. All of this code |
|
2089 | such as handling color escapes under Windows. All of this code | |
2086 | was contributed by Gary Bishop, with minor modifications by me. |
|
2090 | was contributed by Gary Bishop, with minor modifications by me. | |
2087 | The actual changes affect many files. |
|
2091 | The actual changes affect many files. | |
2088 |
|
2092 | |||
2089 | 2003-11-30 Fernando Perez <fperez@colorado.edu> |
|
2093 | 2003-11-30 Fernando Perez <fperez@colorado.edu> | |
2090 |
|
2094 | |||
2091 | * IPython/iplib.py (file_matches): new completion code, courtesy |
|
2095 | * IPython/iplib.py (file_matches): new completion code, courtesy | |
2092 | of Jeff Collins. This enables filename completion again under |
|
2096 | of Jeff Collins. This enables filename completion again under | |
2093 | python 2.3, which disabled it at the C level. |
|
2097 | python 2.3, which disabled it at the C level. | |
2094 |
|
2098 | |||
2095 | 2003-11-11 Fernando Perez <fperez@colorado.edu> |
|
2099 | 2003-11-11 Fernando Perez <fperez@colorado.edu> | |
2096 |
|
2100 | |||
2097 | * IPython/numutils.py (amap): Added amap() fn. Simple shorthand |
|
2101 | * IPython/numutils.py (amap): Added amap() fn. Simple shorthand | |
2098 | for Numeric.array(map(...)), but often convenient. |
|
2102 | for Numeric.array(map(...)), but often convenient. | |
2099 |
|
2103 | |||
2100 | 2003-11-05 Fernando Perez <fperez@colorado.edu> |
|
2104 | 2003-11-05 Fernando Perez <fperez@colorado.edu> | |
2101 |
|
2105 | |||
2102 | * IPython/numutils.py (frange): Changed a call from int() to |
|
2106 | * IPython/numutils.py (frange): Changed a call from int() to | |
2103 | int(round()) to prevent a problem reported with arange() in the |
|
2107 | int(round()) to prevent a problem reported with arange() in the | |
2104 | numpy list. |
|
2108 | numpy list. | |
2105 |
|
2109 | |||
2106 | 2003-10-06 Fernando Perez <fperez@colorado.edu> |
|
2110 | 2003-10-06 Fernando Perez <fperez@colorado.edu> | |
2107 |
|
2111 | |||
2108 | * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): changed to |
|
2112 | * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): changed to | |
2109 | prevent crashes if sys lacks an argv attribute (it happens with |
|
2113 | prevent crashes if sys lacks an argv attribute (it happens with | |
2110 | embedded interpreters which build a bare-bones sys module). |
|
2114 | embedded interpreters which build a bare-bones sys module). | |
2111 | Thanks to a report/bugfix by Adam Hupp <hupp-AT-cs.wisc.edu>. |
|
2115 | Thanks to a report/bugfix by Adam Hupp <hupp-AT-cs.wisc.edu>. | |
2112 |
|
2116 | |||
2113 | 2003-09-24 Fernando Perez <fperez@colorado.edu> |
|
2117 | 2003-09-24 Fernando Perez <fperez@colorado.edu> | |
2114 |
|
2118 | |||
2115 | * IPython/Magic.py (Magic._ofind): blanket except around getattr() |
|
2119 | * IPython/Magic.py (Magic._ofind): blanket except around getattr() | |
2116 | to protect against poorly written user objects where __getattr__ |
|
2120 | to protect against poorly written user objects where __getattr__ | |
2117 | raises exceptions other than AttributeError. Thanks to a bug |
|
2121 | raises exceptions other than AttributeError. Thanks to a bug | |
2118 | report by Oliver Sander <osander-AT-gmx.de>. |
|
2122 | report by Oliver Sander <osander-AT-gmx.de>. | |
2119 |
|
2123 | |||
2120 | * IPython/FakeModule.py (FakeModule.__repr__): this method was |
|
2124 | * IPython/FakeModule.py (FakeModule.__repr__): this method was | |
2121 | missing. Thanks to bug report by Ralf Schmitt <ralf-AT-brainbot.com>. |
|
2125 | missing. Thanks to bug report by Ralf Schmitt <ralf-AT-brainbot.com>. | |
2122 |
|
2126 | |||
2123 | 2003-09-09 Fernando Perez <fperez@colorado.edu> |
|
2127 | 2003-09-09 Fernando Perez <fperez@colorado.edu> | |
2124 |
|
2128 | |||
2125 | * IPython/iplib.py (InteractiveShell._prefilter): fix bug where |
|
2129 | * IPython/iplib.py (InteractiveShell._prefilter): fix bug where | |
2126 | unpacking a list whith a callable as first element would |
|
2130 | unpacking a list whith a callable as first element would | |
2127 | mistakenly trigger autocalling. Thanks to a bug report by Jeffery |
|
2131 | mistakenly trigger autocalling. Thanks to a bug report by Jeffery | |
2128 | Collins. |
|
2132 | Collins. | |
2129 |
|
2133 | |||
2130 | 2003-08-25 *** Released version 0.5.0 |
|
2134 | 2003-08-25 *** Released version 0.5.0 | |
2131 |
|
2135 | |||
2132 | 2003-08-22 Fernando Perez <fperez@colorado.edu> |
|
2136 | 2003-08-22 Fernando Perez <fperez@colorado.edu> | |
2133 |
|
2137 | |||
2134 | * IPython/ultraTB.py (VerboseTB.linereader): Improved handling of |
|
2138 | * IPython/ultraTB.py (VerboseTB.linereader): Improved handling of | |
2135 | improperly defined user exceptions. Thanks to feedback from Mark |
|
2139 | improperly defined user exceptions. Thanks to feedback from Mark | |
2136 | Russell <mrussell-AT-verio.net>. |
|
2140 | Russell <mrussell-AT-verio.net>. | |
2137 |
|
2141 | |||
2138 | 2003-08-20 Fernando Perez <fperez@colorado.edu> |
|
2142 | 2003-08-20 Fernando Perez <fperez@colorado.edu> | |
2139 |
|
2143 | |||
2140 | * IPython/OInspect.py (Inspector.pinfo): changed String Form |
|
2144 | * IPython/OInspect.py (Inspector.pinfo): changed String Form | |
2141 | printing so that it would print multi-line string forms starting |
|
2145 | printing so that it would print multi-line string forms starting | |
2142 | with a new line. This way the formatting is better respected for |
|
2146 | with a new line. This way the formatting is better respected for | |
2143 | objects which work hard to make nice string forms. |
|
2147 | objects which work hard to make nice string forms. | |
2144 |
|
2148 | |||
2145 | * IPython/iplib.py (InteractiveShell.handle_auto): Fix bug where |
|
2149 | * IPython/iplib.py (InteractiveShell.handle_auto): Fix bug where | |
2146 | autocall would overtake data access for objects with both |
|
2150 | autocall would overtake data access for objects with both | |
2147 | __getitem__ and __call__. |
|
2151 | __getitem__ and __call__. | |
2148 |
|
2152 | |||
2149 | 2003-08-19 *** Released version 0.5.0-rc1 |
|
2153 | 2003-08-19 *** Released version 0.5.0-rc1 | |
2150 |
|
2154 | |||
2151 | 2003-08-19 Fernando Perez <fperez@colorado.edu> |
|
2155 | 2003-08-19 Fernando Perez <fperez@colorado.edu> | |
2152 |
|
2156 | |||
2153 | * IPython/deep_reload.py (load_tail): single tiny change here |
|
2157 | * IPython/deep_reload.py (load_tail): single tiny change here | |
2154 | seems to fix the long-standing bug of dreload() failing to work |
|
2158 | seems to fix the long-standing bug of dreload() failing to work | |
2155 | for dotted names. But this module is pretty tricky, so I may have |
|
2159 | for dotted names. But this module is pretty tricky, so I may have | |
2156 | missed some subtlety. Needs more testing!. |
|
2160 | missed some subtlety. Needs more testing!. | |
2157 |
|
2161 | |||
2158 | * IPython/ultraTB.py (VerboseTB.linereader): harden against user |
|
2162 | * IPython/ultraTB.py (VerboseTB.linereader): harden against user | |
2159 | exceptions which have badly implemented __str__ methods. |
|
2163 | exceptions which have badly implemented __str__ methods. | |
2160 | (VerboseTB.text): harden against inspect.getinnerframes crashing, |
|
2164 | (VerboseTB.text): harden against inspect.getinnerframes crashing, | |
2161 | which I've been getting reports about from Python 2.3 users. I |
|
2165 | which I've been getting reports about from Python 2.3 users. I | |
2162 | wish I had a simple test case to reproduce the problem, so I could |
|
2166 | wish I had a simple test case to reproduce the problem, so I could | |
2163 | either write a cleaner workaround or file a bug report if |
|
2167 | either write a cleaner workaround or file a bug report if | |
2164 | necessary. |
|
2168 | necessary. | |
2165 |
|
2169 | |||
2166 | * IPython/Magic.py (Magic.magic_edit): fixed bug where after |
|
2170 | * IPython/Magic.py (Magic.magic_edit): fixed bug where after | |
2167 | making a class 'foo', file 'foo.py' couldn't be edited. Thanks to |
|
2171 | making a class 'foo', file 'foo.py' couldn't be edited. Thanks to | |
2168 | a bug report by Tjabo Kloppenburg. |
|
2172 | a bug report by Tjabo Kloppenburg. | |
2169 |
|
2173 | |||
2170 | * IPython/ultraTB.py (VerboseTB.debugger): hardened against pdb |
|
2174 | * IPython/ultraTB.py (VerboseTB.debugger): hardened against pdb | |
2171 | crashes. Wrapped the pdb call in a blanket try/except, since pdb |
|
2175 | crashes. Wrapped the pdb call in a blanket try/except, since pdb | |
2172 | seems rather unstable. Thanks to a bug report by Tjabo |
|
2176 | seems rather unstable. Thanks to a bug report by Tjabo | |
2173 | Kloppenburg <tjabo.kloppenburg-AT-unix-ag.uni-siegen.de>. |
|
2177 | Kloppenburg <tjabo.kloppenburg-AT-unix-ag.uni-siegen.de>. | |
2174 |
|
2178 | |||
2175 | * IPython/Release.py (version): release 0.5.0-rc1. I want to put |
|
2179 | * IPython/Release.py (version): release 0.5.0-rc1. I want to put | |
2176 | this out soon because of the critical fixes in the inner loop for |
|
2180 | this out soon because of the critical fixes in the inner loop for | |
2177 | generators. |
|
2181 | generators. | |
2178 |
|
2182 | |||
2179 | * IPython/Magic.py (Magic.getargspec): removed. This (and |
|
2183 | * IPython/Magic.py (Magic.getargspec): removed. This (and | |
2180 | _get_def) have been obsoleted by OInspect for a long time, I |
|
2184 | _get_def) have been obsoleted by OInspect for a long time, I | |
2181 | hadn't noticed that they were dead code. |
|
2185 | hadn't noticed that they were dead code. | |
2182 | (Magic._ofind): restored _ofind functionality for a few literals |
|
2186 | (Magic._ofind): restored _ofind functionality for a few literals | |
2183 | (those in ["''",'""','[]','{}','()']). But it won't work anymore |
|
2187 | (those in ["''",'""','[]','{}','()']). But it won't work anymore | |
2184 | for things like "hello".capitalize?, since that would require a |
|
2188 | for things like "hello".capitalize?, since that would require a | |
2185 | potentially dangerous eval() again. |
|
2189 | potentially dangerous eval() again. | |
2186 |
|
2190 | |||
2187 | * IPython/iplib.py (InteractiveShell._prefilter): reorganized the |
|
2191 | * IPython/iplib.py (InteractiveShell._prefilter): reorganized the | |
2188 | logic a bit more to clean up the escapes handling and minimize the |
|
2192 | logic a bit more to clean up the escapes handling and minimize the | |
2189 | use of _ofind to only necessary cases. The interactive 'feel' of |
|
2193 | use of _ofind to only necessary cases. The interactive 'feel' of | |
2190 | IPython should have improved quite a bit with the changes in |
|
2194 | IPython should have improved quite a bit with the changes in | |
2191 | _prefilter and _ofind (besides being far safer than before). |
|
2195 | _prefilter and _ofind (besides being far safer than before). | |
2192 |
|
2196 | |||
2193 | * IPython/Magic.py (Magic.magic_edit): Fixed old bug (but rather |
|
2197 | * IPython/Magic.py (Magic.magic_edit): Fixed old bug (but rather | |
2194 | obscure, never reported). Edit would fail to find the object to |
|
2198 | obscure, never reported). Edit would fail to find the object to | |
2195 | edit under some circumstances. |
|
2199 | edit under some circumstances. | |
2196 | (Magic._ofind): CRITICAL FIX. Finally removed the eval() calls |
|
2200 | (Magic._ofind): CRITICAL FIX. Finally removed the eval() calls | |
2197 | which were causing double-calling of generators. Those eval calls |
|
2201 | which were causing double-calling of generators. Those eval calls | |
2198 | were _very_ dangerous, since code with side effects could be |
|
2202 | were _very_ dangerous, since code with side effects could be | |
2199 | triggered. As they say, 'eval is evil'... These were the |
|
2203 | triggered. As they say, 'eval is evil'... These were the | |
2200 | nastiest evals in IPython. Besides, _ofind is now far simpler, |
|
2204 | nastiest evals in IPython. Besides, _ofind is now far simpler, | |
2201 | and it should also be quite a bit faster. Its use of inspect is |
|
2205 | and it should also be quite a bit faster. Its use of inspect is | |
2202 | also safer, so perhaps some of the inspect-related crashes I've |
|
2206 | also safer, so perhaps some of the inspect-related crashes I've | |
2203 | seen lately with Python 2.3 might be taken care of. That will |
|
2207 | seen lately with Python 2.3 might be taken care of. That will | |
2204 | need more testing. |
|
2208 | need more testing. | |
2205 |
|
2209 | |||
2206 | 2003-08-17 Fernando Perez <fperez@colorado.edu> |
|
2210 | 2003-08-17 Fernando Perez <fperez@colorado.edu> | |
2207 |
|
2211 | |||
2208 | * IPython/iplib.py (InteractiveShell._prefilter): significant |
|
2212 | * IPython/iplib.py (InteractiveShell._prefilter): significant | |
2209 | simplifications to the logic for handling user escapes. Faster |
|
2213 | simplifications to the logic for handling user escapes. Faster | |
2210 | and simpler code. |
|
2214 | and simpler code. | |
2211 |
|
2215 | |||
2212 | 2003-08-14 Fernando Perez <fperez@colorado.edu> |
|
2216 | 2003-08-14 Fernando Perez <fperez@colorado.edu> | |
2213 |
|
2217 | |||
2214 | * IPython/numutils.py (sum_flat): rewrote to be non-recursive. |
|
2218 | * IPython/numutils.py (sum_flat): rewrote to be non-recursive. | |
2215 | Now it requires O(N) storage (N=size(a)) for non-contiguous input, |
|
2219 | Now it requires O(N) storage (N=size(a)) for non-contiguous input, | |
2216 | but it should be quite a bit faster. And the recursive version |
|
2220 | but it should be quite a bit faster. And the recursive version | |
2217 | generated O(log N) intermediate storage for all rank>1 arrays, |
|
2221 | generated O(log N) intermediate storage for all rank>1 arrays, | |
2218 | even if they were contiguous. |
|
2222 | even if they were contiguous. | |
2219 | (l1norm): Added this function. |
|
2223 | (l1norm): Added this function. | |
2220 | (norm): Added this function for arbitrary norms (including |
|
2224 | (norm): Added this function for arbitrary norms (including | |
2221 | l-infinity). l1 and l2 are still special cases for convenience |
|
2225 | l-infinity). l1 and l2 are still special cases for convenience | |
2222 | and speed. |
|
2226 | and speed. | |
2223 |
|
2227 | |||
2224 | 2003-08-03 Fernando Perez <fperez@colorado.edu> |
|
2228 | 2003-08-03 Fernando Perez <fperez@colorado.edu> | |
2225 |
|
2229 | |||
2226 | * IPython/Magic.py (Magic.magic_edit): Removed all remaining string |
|
2230 | * IPython/Magic.py (Magic.magic_edit): Removed all remaining string | |
2227 | exceptions, which now raise PendingDeprecationWarnings in Python |
|
2231 | exceptions, which now raise PendingDeprecationWarnings in Python | |
2228 | 2.3. There were some in Magic and some in Gnuplot2. |
|
2232 | 2.3. There were some in Magic and some in Gnuplot2. | |
2229 |
|
2233 | |||
2230 | 2003-06-30 Fernando Perez <fperez@colorado.edu> |
|
2234 | 2003-06-30 Fernando Perez <fperez@colorado.edu> | |
2231 |
|
2235 | |||
2232 | * IPython/genutils.py (page): modified to call curses only for |
|
2236 | * IPython/genutils.py (page): modified to call curses only for | |
2233 | terminals where TERM=='xterm'. After problems under many other |
|
2237 | terminals where TERM=='xterm'. After problems under many other | |
2234 | terminals were reported by Keith Beattie <KSBeattie-AT-lbl.gov>. |
|
2238 | terminals were reported by Keith Beattie <KSBeattie-AT-lbl.gov>. | |
2235 |
|
2239 | |||
2236 | * IPython/iplib.py (complete): removed spurious 'print "IE"' which |
|
2240 | * IPython/iplib.py (complete): removed spurious 'print "IE"' which | |
2237 | would be triggered when readline was absent. This was just an old |
|
2241 | would be triggered when readline was absent. This was just an old | |
2238 | debugging statement I'd forgotten to take out. |
|
2242 | debugging statement I'd forgotten to take out. | |
2239 |
|
2243 | |||
2240 | 2003-06-20 Fernando Perez <fperez@colorado.edu> |
|
2244 | 2003-06-20 Fernando Perez <fperez@colorado.edu> | |
2241 |
|
2245 | |||
2242 | * IPython/genutils.py (clock): modified to return only user time |
|
2246 | * IPython/genutils.py (clock): modified to return only user time | |
2243 | (not counting system time), after a discussion on scipy. While |
|
2247 | (not counting system time), after a discussion on scipy. While | |
2244 | system time may be a useful quantity occasionally, it may much |
|
2248 | system time may be a useful quantity occasionally, it may much | |
2245 | more easily be skewed by occasional swapping or other similar |
|
2249 | more easily be skewed by occasional swapping or other similar | |
2246 | activity. |
|
2250 | activity. | |
2247 |
|
2251 | |||
2248 | 2003-06-05 Fernando Perez <fperez@colorado.edu> |
|
2252 | 2003-06-05 Fernando Perez <fperez@colorado.edu> | |
2249 |
|
2253 | |||
2250 | * IPython/numutils.py (identity): new function, for building |
|
2254 | * IPython/numutils.py (identity): new function, for building | |
2251 | arbitrary rank Kronecker deltas (mostly backwards compatible with |
|
2255 | arbitrary rank Kronecker deltas (mostly backwards compatible with | |
2252 | Numeric.identity) |
|
2256 | Numeric.identity) | |
2253 |
|
2257 | |||
2254 | 2003-06-03 Fernando Perez <fperez@colorado.edu> |
|
2258 | 2003-06-03 Fernando Perez <fperez@colorado.edu> | |
2255 |
|
2259 | |||
2256 | * IPython/iplib.py (InteractiveShell.handle_magic): protect |
|
2260 | * IPython/iplib.py (InteractiveShell.handle_magic): protect | |
2257 | arguments passed to magics with spaces, to allow trailing '\' to |
|
2261 | arguments passed to magics with spaces, to allow trailing '\' to | |
2258 | work normally (mainly for Windows users). |
|
2262 | work normally (mainly for Windows users). | |
2259 |
|
2263 | |||
2260 | 2003-05-29 Fernando Perez <fperez@colorado.edu> |
|
2264 | 2003-05-29 Fernando Perez <fperez@colorado.edu> | |
2261 |
|
2265 | |||
2262 | * IPython/ipmaker.py (make_IPython): Load site._Helper() as help |
|
2266 | * IPython/ipmaker.py (make_IPython): Load site._Helper() as help | |
2263 | instead of pydoc.help. This fixes a bizarre behavior where |
|
2267 | instead of pydoc.help. This fixes a bizarre behavior where | |
2264 | printing '%s' % locals() would trigger the help system. Now |
|
2268 | printing '%s' % locals() would trigger the help system. Now | |
2265 | ipython behaves like normal python does. |
|
2269 | ipython behaves like normal python does. | |
2266 |
|
2270 | |||
2267 | Note that if one does 'from pydoc import help', the bizarre |
|
2271 | Note that if one does 'from pydoc import help', the bizarre | |
2268 | behavior returns, but this will also happen in normal python, so |
|
2272 | behavior returns, but this will also happen in normal python, so | |
2269 | it's not an ipython bug anymore (it has to do with how pydoc.help |
|
2273 | it's not an ipython bug anymore (it has to do with how pydoc.help | |
2270 | is implemented). |
|
2274 | is implemented). | |
2271 |
|
2275 | |||
2272 | 2003-05-22 Fernando Perez <fperez@colorado.edu> |
|
2276 | 2003-05-22 Fernando Perez <fperez@colorado.edu> | |
2273 |
|
2277 | |||
2274 | * IPython/FlexCompleter.py (Completer.attr_matches): fixed to |
|
2278 | * IPython/FlexCompleter.py (Completer.attr_matches): fixed to | |
2275 | return [] instead of None when nothing matches, also match to end |
|
2279 | return [] instead of None when nothing matches, also match to end | |
2276 | of line. Patch by Gary Bishop. |
|
2280 | of line. Patch by Gary Bishop. | |
2277 |
|
2281 | |||
2278 | * IPython/ipmaker.py (make_IPython): Added same sys.excepthook |
|
2282 | * IPython/ipmaker.py (make_IPython): Added same sys.excepthook | |
2279 | protection as before, for files passed on the command line. This |
|
2283 | protection as before, for files passed on the command line. This | |
2280 | prevents the CrashHandler from kicking in if user files call into |
|
2284 | prevents the CrashHandler from kicking in if user files call into | |
2281 | sys.excepthook (such as PyQt and WxWindows have a nasty habit of |
|
2285 | sys.excepthook (such as PyQt and WxWindows have a nasty habit of | |
2282 | doing). After a report by Kasper Souren <Kasper.Souren-AT-ircam.fr> |
|
2286 | doing). After a report by Kasper Souren <Kasper.Souren-AT-ircam.fr> | |
2283 |
|
2287 | |||
2284 | 2003-05-20 *** Released version 0.4.0 |
|
2288 | 2003-05-20 *** Released version 0.4.0 | |
2285 |
|
2289 | |||
2286 | 2003-05-20 Fernando Perez <fperez@colorado.edu> |
|
2290 | 2003-05-20 Fernando Perez <fperez@colorado.edu> | |
2287 |
|
2291 | |||
2288 | * setup.py: added support for manpages. It's a bit hackish b/c of |
|
2292 | * setup.py: added support for manpages. It's a bit hackish b/c of | |
2289 | a bug in the way the bdist_rpm distutils target handles gzipped |
|
2293 | a bug in the way the bdist_rpm distutils target handles gzipped | |
2290 | manpages, but it works. After a patch by Jack. |
|
2294 | manpages, but it works. After a patch by Jack. | |
2291 |
|
2295 | |||
2292 | 2003-05-19 Fernando Perez <fperez@colorado.edu> |
|
2296 | 2003-05-19 Fernando Perez <fperez@colorado.edu> | |
2293 |
|
2297 | |||
2294 | * IPython/numutils.py: added a mockup of the kinds module, since |
|
2298 | * IPython/numutils.py: added a mockup of the kinds module, since | |
2295 | it was recently removed from Numeric. This way, numutils will |
|
2299 | it was recently removed from Numeric. This way, numutils will | |
2296 | work for all users even if they are missing kinds. |
|
2300 | work for all users even if they are missing kinds. | |
2297 |
|
2301 | |||
2298 | * IPython/Magic.py (Magic._ofind): Harden against an inspect |
|
2302 | * IPython/Magic.py (Magic._ofind): Harden against an inspect | |
2299 | failure, which can occur with SWIG-wrapped extensions. After a |
|
2303 | failure, which can occur with SWIG-wrapped extensions. After a | |
2300 | crash report from Prabhu. |
|
2304 | crash report from Prabhu. | |
2301 |
|
2305 | |||
2302 | 2003-05-16 Fernando Perez <fperez@colorado.edu> |
|
2306 | 2003-05-16 Fernando Perez <fperez@colorado.edu> | |
2303 |
|
2307 | |||
2304 | * IPython/iplib.py (InteractiveShell.excepthook): New method to |
|
2308 | * IPython/iplib.py (InteractiveShell.excepthook): New method to | |
2305 | protect ipython from user code which may call directly |
|
2309 | protect ipython from user code which may call directly | |
2306 | sys.excepthook (this looks like an ipython crash to the user, even |
|
2310 | sys.excepthook (this looks like an ipython crash to the user, even | |
2307 | when it isn't). After a patch by Gary Bishop <gb-AT-cs.unc.edu>. |
|
2311 | when it isn't). After a patch by Gary Bishop <gb-AT-cs.unc.edu>. | |
2308 | This is especially important to help users of WxWindows, but may |
|
2312 | This is especially important to help users of WxWindows, but may | |
2309 | also be useful in other cases. |
|
2313 | also be useful in other cases. | |
2310 |
|
2314 | |||
2311 | * IPython/ultraTB.py (AutoFormattedTB.__call__): Changed to allow |
|
2315 | * IPython/ultraTB.py (AutoFormattedTB.__call__): Changed to allow | |
2312 | an optional tb_offset to be specified, and to preserve exception |
|
2316 | an optional tb_offset to be specified, and to preserve exception | |
2313 | info if given. After a patch by Gary Bishop <gb-AT-cs.unc.edu>. |
|
2317 | info if given. After a patch by Gary Bishop <gb-AT-cs.unc.edu>. | |
2314 |
|
2318 | |||
2315 | * ipython.1 (Default): Thanks to Jack's work, we now have manpages! |
|
2319 | * ipython.1 (Default): Thanks to Jack's work, we now have manpages! | |
2316 |
|
2320 | |||
2317 | 2003-05-15 Fernando Perez <fperez@colorado.edu> |
|
2321 | 2003-05-15 Fernando Perez <fperez@colorado.edu> | |
2318 |
|
2322 | |||
2319 | * IPython/iplib.py (InteractiveShell.user_setup): Fix crash when |
|
2323 | * IPython/iplib.py (InteractiveShell.user_setup): Fix crash when | |
2320 | installing for a new user under Windows. |
|
2324 | installing for a new user under Windows. | |
2321 |
|
2325 | |||
2322 | 2003-05-12 Fernando Perez <fperez@colorado.edu> |
|
2326 | 2003-05-12 Fernando Perez <fperez@colorado.edu> | |
2323 |
|
2327 | |||
2324 | * IPython/iplib.py (InteractiveShell.handle_emacs): New line |
|
2328 | * IPython/iplib.py (InteractiveShell.handle_emacs): New line | |
2325 | handler for Emacs comint-based lines. Currently it doesn't do |
|
2329 | handler for Emacs comint-based lines. Currently it doesn't do | |
2326 | much (but importantly, it doesn't update the history cache). In |
|
2330 | much (but importantly, it doesn't update the history cache). In | |
2327 | the future it may be expanded if Alex needs more functionality |
|
2331 | the future it may be expanded if Alex needs more functionality | |
2328 | there. |
|
2332 | there. | |
2329 |
|
2333 | |||
2330 | * IPython/CrashHandler.py (CrashHandler.__call__): Added platform |
|
2334 | * IPython/CrashHandler.py (CrashHandler.__call__): Added platform | |
2331 | info to crash reports. |
|
2335 | info to crash reports. | |
2332 |
|
2336 | |||
2333 | * IPython/iplib.py (InteractiveShell.mainloop): Added -c option, |
|
2337 | * IPython/iplib.py (InteractiveShell.mainloop): Added -c option, | |
2334 | just like Python's -c. Also fixed crash with invalid -color |
|
2338 | just like Python's -c. Also fixed crash with invalid -color | |
2335 | option value at startup. Thanks to Will French |
|
2339 | option value at startup. Thanks to Will French | |
2336 | <wfrench-AT-bestweb.net> for the bug report. |
|
2340 | <wfrench-AT-bestweb.net> for the bug report. | |
2337 |
|
2341 | |||
2338 | 2003-05-09 Fernando Perez <fperez@colorado.edu> |
|
2342 | 2003-05-09 Fernando Perez <fperez@colorado.edu> | |
2339 |
|
2343 | |||
2340 | * IPython/genutils.py (EvalDict.__getitem__): Renamed EvalString |
|
2344 | * IPython/genutils.py (EvalDict.__getitem__): Renamed EvalString | |
2341 | to EvalDict (it's a mapping, after all) and simplified its code |
|
2345 | to EvalDict (it's a mapping, after all) and simplified its code | |
2342 | quite a bit, after a nice discussion on c.l.py where Gustavo |
|
2346 | quite a bit, after a nice discussion on c.l.py where Gustavo | |
2343 | CΓ³rdova <gcordova-AT-sismex.com> suggested the new version. |
|
2347 | CΓ³rdova <gcordova-AT-sismex.com> suggested the new version. | |
2344 |
|
2348 | |||
2345 | 2003-04-30 Fernando Perez <fperez@colorado.edu> |
|
2349 | 2003-04-30 Fernando Perez <fperez@colorado.edu> | |
2346 |
|
2350 | |||
2347 | * IPython/genutils.py (timings_out): modified it to reduce its |
|
2351 | * IPython/genutils.py (timings_out): modified it to reduce its | |
2348 | overhead in the common reps==1 case. |
|
2352 | overhead in the common reps==1 case. | |
2349 |
|
2353 | |||
2350 | 2003-04-29 Fernando Perez <fperez@colorado.edu> |
|
2354 | 2003-04-29 Fernando Perez <fperez@colorado.edu> | |
2351 |
|
2355 | |||
2352 | * IPython/genutils.py (timings_out): Modified to use the resource |
|
2356 | * IPython/genutils.py (timings_out): Modified to use the resource | |
2353 | module, which avoids the wraparound problems of time.clock(). |
|
2357 | module, which avoids the wraparound problems of time.clock(). | |
2354 |
|
2358 | |||
2355 | 2003-04-17 *** Released version 0.2.15pre4 |
|
2359 | 2003-04-17 *** Released version 0.2.15pre4 | |
2356 |
|
2360 | |||
2357 | 2003-04-17 Fernando Perez <fperez@colorado.edu> |
|
2361 | 2003-04-17 Fernando Perez <fperez@colorado.edu> | |
2358 |
|
2362 | |||
2359 | * setup.py (scriptfiles): Split windows-specific stuff over to a |
|
2363 | * setup.py (scriptfiles): Split windows-specific stuff over to a | |
2360 | separate file, in an attempt to have a Windows GUI installer. |
|
2364 | separate file, in an attempt to have a Windows GUI installer. | |
2361 | That didn't work, but part of the groundwork is done. |
|
2365 | That didn't work, but part of the groundwork is done. | |
2362 |
|
2366 | |||
2363 | * IPython/UserConfig/ipythonrc: Added M-i, M-o and M-I for |
|
2367 | * IPython/UserConfig/ipythonrc: Added M-i, M-o and M-I for | |
2364 | indent/unindent with 4 spaces. Particularly useful in combination |
|
2368 | indent/unindent with 4 spaces. Particularly useful in combination | |
2365 | with the new auto-indent option. |
|
2369 | with the new auto-indent option. | |
2366 |
|
2370 | |||
2367 | 2003-04-16 Fernando Perez <fperez@colorado.edu> |
|
2371 | 2003-04-16 Fernando Perez <fperez@colorado.edu> | |
2368 |
|
2372 | |||
2369 | * IPython/Magic.py: various replacements of self.rc for |
|
2373 | * IPython/Magic.py: various replacements of self.rc for | |
2370 | self.shell.rc. A lot more remains to be done to fully disentangle |
|
2374 | self.shell.rc. A lot more remains to be done to fully disentangle | |
2371 | this class from the main Shell class. |
|
2375 | this class from the main Shell class. | |
2372 |
|
2376 | |||
2373 | * IPython/GnuplotRuntime.py: added checks for mouse support so |
|
2377 | * IPython/GnuplotRuntime.py: added checks for mouse support so | |
2374 | that we don't try to enable it if the current gnuplot doesn't |
|
2378 | that we don't try to enable it if the current gnuplot doesn't | |
2375 | really support it. Also added checks so that we don't try to |
|
2379 | really support it. Also added checks so that we don't try to | |
2376 | enable persist under Windows (where Gnuplot doesn't recognize the |
|
2380 | enable persist under Windows (where Gnuplot doesn't recognize the | |
2377 | option). |
|
2381 | option). | |
2378 |
|
2382 | |||
2379 | * IPython/iplib.py (InteractiveShell.interact): Added optional |
|
2383 | * IPython/iplib.py (InteractiveShell.interact): Added optional | |
2380 | auto-indenting code, after a patch by King C. Shu |
|
2384 | auto-indenting code, after a patch by King C. Shu | |
2381 | <kingshu-AT-myrealbox.com>. It's off by default because it doesn't |
|
2385 | <kingshu-AT-myrealbox.com>. It's off by default because it doesn't | |
2382 | get along well with pasting indented code. If I ever figure out |
|
2386 | get along well with pasting indented code. If I ever figure out | |
2383 | how to make that part go well, it will become on by default. |
|
2387 | how to make that part go well, it will become on by default. | |
2384 |
|
2388 | |||
2385 | * IPython/Prompts.py (Prompt1.auto_rewrite): Fixed bug which would |
|
2389 | * IPython/Prompts.py (Prompt1.auto_rewrite): Fixed bug which would | |
2386 | crash ipython if there was an unmatched '%' in the user's prompt |
|
2390 | crash ipython if there was an unmatched '%' in the user's prompt | |
2387 | string. Reported by Thorsten Kampe <thorsten-AT-thorstenkampe.de>. |
|
2391 | string. Reported by Thorsten Kampe <thorsten-AT-thorstenkampe.de>. | |
2388 |
|
2392 | |||
2389 | * IPython/iplib.py (InteractiveShell.interact): removed the |
|
2393 | * IPython/iplib.py (InteractiveShell.interact): removed the | |
2390 | ability to ask the user whether he wants to crash or not at the |
|
2394 | ability to ask the user whether he wants to crash or not at the | |
2391 | 'last line' exception handler. Calling functions at that point |
|
2395 | 'last line' exception handler. Calling functions at that point | |
2392 | changes the stack, and the error reports would have incorrect |
|
2396 | changes the stack, and the error reports would have incorrect | |
2393 | tracebacks. |
|
2397 | tracebacks. | |
2394 |
|
2398 | |||
2395 | * IPython/Magic.py (Magic.magic_page): Added new @page magic, to |
|
2399 | * IPython/Magic.py (Magic.magic_page): Added new @page magic, to | |
2396 | pass through a peger a pretty-printed form of any object. After a |
|
2400 | pass through a peger a pretty-printed form of any object. After a | |
2397 | contribution by Olivier Aubert <oaubert-AT-bat710.univ-lyon1.fr> |
|
2401 | contribution by Olivier Aubert <oaubert-AT-bat710.univ-lyon1.fr> | |
2398 |
|
2402 | |||
2399 | 2003-04-14 Fernando Perez <fperez@colorado.edu> |
|
2403 | 2003-04-14 Fernando Perez <fperez@colorado.edu> | |
2400 |
|
2404 | |||
2401 | * IPython/iplib.py (InteractiveShell.user_setup): Fixed bug where |
|
2405 | * IPython/iplib.py (InteractiveShell.user_setup): Fixed bug where | |
2402 | all files in ~ would be modified at first install (instead of |
|
2406 | all files in ~ would be modified at first install (instead of | |
2403 | ~/.ipython). This could be potentially disastrous, as the |
|
2407 | ~/.ipython). This could be potentially disastrous, as the | |
2404 | modification (make line-endings native) could damage binary files. |
|
2408 | modification (make line-endings native) could damage binary files. | |
2405 |
|
2409 | |||
2406 | 2003-04-10 Fernando Perez <fperez@colorado.edu> |
|
2410 | 2003-04-10 Fernando Perez <fperez@colorado.edu> | |
2407 |
|
2411 | |||
2408 | * IPython/iplib.py (InteractiveShell.handle_help): Modified to |
|
2412 | * IPython/iplib.py (InteractiveShell.handle_help): Modified to | |
2409 | handle only lines which are invalid python. This now means that |
|
2413 | handle only lines which are invalid python. This now means that | |
2410 | lines like 'x=1 #?' execute properly. Thanks to Jeffery Collins |
|
2414 | lines like 'x=1 #?' execute properly. Thanks to Jeffery Collins | |
2411 | for the bug report. |
|
2415 | for the bug report. | |
2412 |
|
2416 | |||
2413 | 2003-04-01 Fernando Perez <fperez@colorado.edu> |
|
2417 | 2003-04-01 Fernando Perez <fperez@colorado.edu> | |
2414 |
|
2418 | |||
2415 | * IPython/iplib.py (InteractiveShell.showtraceback): Fixed bug |
|
2419 | * IPython/iplib.py (InteractiveShell.showtraceback): Fixed bug | |
2416 | where failing to set sys.last_traceback would crash pdb.pm(). |
|
2420 | where failing to set sys.last_traceback would crash pdb.pm(). | |
2417 | Thanks to Jeffery D. Collins <Jeff.Collins-AT-vexcel.com> for the bug |
|
2421 | Thanks to Jeffery D. Collins <Jeff.Collins-AT-vexcel.com> for the bug | |
2418 | report. |
|
2422 | report. | |
2419 |
|
2423 | |||
2420 | 2003-03-25 Fernando Perez <fperez@colorado.edu> |
|
2424 | 2003-03-25 Fernando Perez <fperez@colorado.edu> | |
2421 |
|
2425 | |||
2422 | * IPython/Magic.py (Magic.magic_prun): rstrip() output of profiler |
|
2426 | * IPython/Magic.py (Magic.magic_prun): rstrip() output of profiler | |
2423 | before printing it (it had a lot of spurious blank lines at the |
|
2427 | before printing it (it had a lot of spurious blank lines at the | |
2424 | end). |
|
2428 | end). | |
2425 |
|
2429 | |||
2426 | * IPython/Gnuplot2.py (Gnuplot.hardcopy): fixed bug where lpr |
|
2430 | * IPython/Gnuplot2.py (Gnuplot.hardcopy): fixed bug where lpr | |
2427 | output would be sent 21 times! Obviously people don't use this |
|
2431 | output would be sent 21 times! Obviously people don't use this | |
2428 | too often, or I would have heard about it. |
|
2432 | too often, or I would have heard about it. | |
2429 |
|
2433 | |||
2430 | 2003-03-24 Fernando Perez <fperez@colorado.edu> |
|
2434 | 2003-03-24 Fernando Perez <fperez@colorado.edu> | |
2431 |
|
2435 | |||
2432 | * setup.py (scriptfiles): renamed the data_files parameter from |
|
2436 | * setup.py (scriptfiles): renamed the data_files parameter from | |
2433 | 'base' to 'data' to fix rpm build issues. Thanks to Ralf Ahlbrink |
|
2437 | 'base' to 'data' to fix rpm build issues. Thanks to Ralf Ahlbrink | |
2434 | for the patch. |
|
2438 | for the patch. | |
2435 |
|
2439 | |||
2436 | 2003-03-20 Fernando Perez <fperez@colorado.edu> |
|
2440 | 2003-03-20 Fernando Perez <fperez@colorado.edu> | |
2437 |
|
2441 | |||
2438 | * IPython/genutils.py (error): added error() and fatal() |
|
2442 | * IPython/genutils.py (error): added error() and fatal() | |
2439 | functions. |
|
2443 | functions. | |
2440 |
|
2444 | |||
2441 | 2003-03-18 *** Released version 0.2.15pre3 |
|
2445 | 2003-03-18 *** Released version 0.2.15pre3 | |
2442 |
|
2446 | |||
2443 | 2003-03-18 Fernando Perez <fperez@colorado.edu> |
|
2447 | 2003-03-18 Fernando Perez <fperez@colorado.edu> | |
2444 |
|
2448 | |||
2445 | * setupext/install_data_ext.py |
|
2449 | * setupext/install_data_ext.py | |
2446 | (install_data_ext.initialize_options): Class contributed by Jack |
|
2450 | (install_data_ext.initialize_options): Class contributed by Jack | |
2447 | Moffit for fixing the old distutils hack. He is sending this to |
|
2451 | Moffit for fixing the old distutils hack. He is sending this to | |
2448 | the distutils folks so in the future we may not need it as a |
|
2452 | the distutils folks so in the future we may not need it as a | |
2449 | private fix. |
|
2453 | private fix. | |
2450 |
|
2454 | |||
2451 | * MANIFEST.in: Extensive reorganization, based on Jack Moffit's |
|
2455 | * MANIFEST.in: Extensive reorganization, based on Jack Moffit's | |
2452 | changes for Debian packaging. See his patch for full details. |
|
2456 | changes for Debian packaging. See his patch for full details. | |
2453 | The old distutils hack of making the ipythonrc* files carry a |
|
2457 | The old distutils hack of making the ipythonrc* files carry a | |
2454 | bogus .py extension is gone, at last. Examples were moved to a |
|
2458 | bogus .py extension is gone, at last. Examples were moved to a | |
2455 | separate subdir under doc/, and the separate executable scripts |
|
2459 | separate subdir under doc/, and the separate executable scripts | |
2456 | now live in their own directory. Overall a great cleanup. The |
|
2460 | now live in their own directory. Overall a great cleanup. The | |
2457 | manual was updated to use the new files, and setup.py has been |
|
2461 | manual was updated to use the new files, and setup.py has been | |
2458 | fixed for this setup. |
|
2462 | fixed for this setup. | |
2459 |
|
2463 | |||
2460 | * IPython/PyColorize.py (Parser.usage): made non-executable and |
|
2464 | * IPython/PyColorize.py (Parser.usage): made non-executable and | |
2461 | created a pycolor wrapper around it to be included as a script. |
|
2465 | created a pycolor wrapper around it to be included as a script. | |
2462 |
|
2466 | |||
2463 | 2003-03-12 *** Released version 0.2.15pre2 |
|
2467 | 2003-03-12 *** Released version 0.2.15pre2 | |
2464 |
|
2468 | |||
2465 | 2003-03-12 Fernando Perez <fperez@colorado.edu> |
|
2469 | 2003-03-12 Fernando Perez <fperez@colorado.edu> | |
2466 |
|
2470 | |||
2467 | * IPython/ColorANSI.py (make_color_table): Finally fixed the |
|
2471 | * IPython/ColorANSI.py (make_color_table): Finally fixed the | |
2468 | long-standing problem with garbage characters in some terminals. |
|
2472 | long-standing problem with garbage characters in some terminals. | |
2469 | The issue was really that the \001 and \002 escapes must _only_ be |
|
2473 | The issue was really that the \001 and \002 escapes must _only_ be | |
2470 | passed to input prompts (which call readline), but _never_ to |
|
2474 | passed to input prompts (which call readline), but _never_ to | |
2471 | normal text to be printed on screen. I changed ColorANSI to have |
|
2475 | normal text to be printed on screen. I changed ColorANSI to have | |
2472 | two classes: TermColors and InputTermColors, each with the |
|
2476 | two classes: TermColors and InputTermColors, each with the | |
2473 | appropriate escapes for input prompts or normal text. The code in |
|
2477 | appropriate escapes for input prompts or normal text. The code in | |
2474 | Prompts.py got slightly more complicated, but this very old and |
|
2478 | Prompts.py got slightly more complicated, but this very old and | |
2475 | annoying bug is finally fixed. |
|
2479 | annoying bug is finally fixed. | |
2476 |
|
2480 | |||
2477 | All the credit for nailing down the real origin of this problem |
|
2481 | All the credit for nailing down the real origin of this problem | |
2478 | and the correct solution goes to Jack Moffit <jack-AT-xiph.org>. |
|
2482 | and the correct solution goes to Jack Moffit <jack-AT-xiph.org>. | |
2479 | *Many* thanks to him for spending quite a bit of effort on this. |
|
2483 | *Many* thanks to him for spending quite a bit of effort on this. | |
2480 |
|
2484 | |||
2481 | 2003-03-05 *** Released version 0.2.15pre1 |
|
2485 | 2003-03-05 *** Released version 0.2.15pre1 | |
2482 |
|
2486 | |||
2483 | 2003-03-03 Fernando Perez <fperez@colorado.edu> |
|
2487 | 2003-03-03 Fernando Perez <fperez@colorado.edu> | |
2484 |
|
2488 | |||
2485 | * IPython/FakeModule.py: Moved the former _FakeModule to a |
|
2489 | * IPython/FakeModule.py: Moved the former _FakeModule to a | |
2486 | separate file, because it's also needed by Magic (to fix a similar |
|
2490 | separate file, because it's also needed by Magic (to fix a similar | |
2487 | pickle-related issue in @run). |
|
2491 | pickle-related issue in @run). | |
2488 |
|
2492 | |||
2489 | 2003-03-02 Fernando Perez <fperez@colorado.edu> |
|
2493 | 2003-03-02 Fernando Perez <fperez@colorado.edu> | |
2490 |
|
2494 | |||
2491 | * IPython/Magic.py (Magic.magic_autocall): new magic to control |
|
2495 | * IPython/Magic.py (Magic.magic_autocall): new magic to control | |
2492 | the autocall option at runtime. |
|
2496 | the autocall option at runtime. | |
2493 | (Magic.magic_dhist): changed self.user_ns to self.shell.user_ns |
|
2497 | (Magic.magic_dhist): changed self.user_ns to self.shell.user_ns | |
2494 | across Magic.py to start separating Magic from InteractiveShell. |
|
2498 | across Magic.py to start separating Magic from InteractiveShell. | |
2495 | (Magic._ofind): Fixed to return proper namespace for dotted |
|
2499 | (Magic._ofind): Fixed to return proper namespace for dotted | |
2496 | names. Before, a dotted name would always return 'not currently |
|
2500 | names. Before, a dotted name would always return 'not currently | |
2497 | defined', because it would find the 'parent'. s.x would be found, |
|
2501 | defined', because it would find the 'parent'. s.x would be found, | |
2498 | but since 'x' isn't defined by itself, it would get confused. |
|
2502 | but since 'x' isn't defined by itself, it would get confused. | |
2499 | (Magic.magic_run): Fixed pickling problems reported by Ralf |
|
2503 | (Magic.magic_run): Fixed pickling problems reported by Ralf | |
2500 | Ahlbrink <RAhlbrink-AT-RosenInspection.net>. The fix was similar to |
|
2504 | Ahlbrink <RAhlbrink-AT-RosenInspection.net>. The fix was similar to | |
2501 | that I'd used when Mike Heeter reported similar issues at the |
|
2505 | that I'd used when Mike Heeter reported similar issues at the | |
2502 | top-level, but now for @run. It boils down to injecting the |
|
2506 | top-level, but now for @run. It boils down to injecting the | |
2503 | namespace where code is being executed with something that looks |
|
2507 | namespace where code is being executed with something that looks | |
2504 | enough like a module to fool pickle.dump(). Since a pickle stores |
|
2508 | enough like a module to fool pickle.dump(). Since a pickle stores | |
2505 | a named reference to the importing module, we need this for |
|
2509 | a named reference to the importing module, we need this for | |
2506 | pickles to save something sensible. |
|
2510 | pickles to save something sensible. | |
2507 |
|
2511 | |||
2508 | * IPython/ipmaker.py (make_IPython): added an autocall option. |
|
2512 | * IPython/ipmaker.py (make_IPython): added an autocall option. | |
2509 |
|
2513 | |||
2510 | * IPython/iplib.py (InteractiveShell._prefilter): reordered all of |
|
2514 | * IPython/iplib.py (InteractiveShell._prefilter): reordered all of | |
2511 | the auto-eval code. Now autocalling is an option, and the code is |
|
2515 | the auto-eval code. Now autocalling is an option, and the code is | |
2512 | also vastly safer. There is no more eval() involved at all. |
|
2516 | also vastly safer. There is no more eval() involved at all. | |
2513 |
|
2517 | |||
2514 | 2003-03-01 Fernando Perez <fperez@colorado.edu> |
|
2518 | 2003-03-01 Fernando Perez <fperez@colorado.edu> | |
2515 |
|
2519 | |||
2516 | * IPython/Magic.py (Magic._ofind): Changed interface to return a |
|
2520 | * IPython/Magic.py (Magic._ofind): Changed interface to return a | |
2517 | dict with named keys instead of a tuple. |
|
2521 | dict with named keys instead of a tuple. | |
2518 |
|
2522 | |||
2519 | * IPython: Started using CVS for IPython as of 0.2.15pre1. |
|
2523 | * IPython: Started using CVS for IPython as of 0.2.15pre1. | |
2520 |
|
2524 | |||
2521 | * setup.py (make_shortcut): Fixed message about directories |
|
2525 | * setup.py (make_shortcut): Fixed message about directories | |
2522 | created during Windows installation (the directories were ok, just |
|
2526 | created during Windows installation (the directories were ok, just | |
2523 | the printed message was misleading). Thanks to Chris Liechti |
|
2527 | the printed message was misleading). Thanks to Chris Liechti | |
2524 | <cliechti-AT-gmx.net> for the heads up. |
|
2528 | <cliechti-AT-gmx.net> for the heads up. | |
2525 |
|
2529 | |||
2526 | 2003-02-21 Fernando Perez <fperez@colorado.edu> |
|
2530 | 2003-02-21 Fernando Perez <fperez@colorado.edu> | |
2527 |
|
2531 | |||
2528 | * IPython/iplib.py (InteractiveShell._prefilter): Fixed catching |
|
2532 | * IPython/iplib.py (InteractiveShell._prefilter): Fixed catching | |
2529 | of ValueError exception when checking for auto-execution. This |
|
2533 | of ValueError exception when checking for auto-execution. This | |
2530 | one is raised by things like Numeric arrays arr.flat when the |
|
2534 | one is raised by things like Numeric arrays arr.flat when the | |
2531 | array is non-contiguous. |
|
2535 | array is non-contiguous. | |
2532 |
|
2536 | |||
2533 | 2003-01-31 Fernando Perez <fperez@colorado.edu> |
|
2537 | 2003-01-31 Fernando Perez <fperez@colorado.edu> | |
2534 |
|
2538 | |||
2535 | * IPython/genutils.py (SystemExec.bq): Fixed bug where bq would |
|
2539 | * IPython/genutils.py (SystemExec.bq): Fixed bug where bq would | |
2536 | not return any value at all (even though the command would get |
|
2540 | not return any value at all (even though the command would get | |
2537 | executed). |
|
2541 | executed). | |
2538 | (xsys): Flush stdout right after printing the command to ensure |
|
2542 | (xsys): Flush stdout right after printing the command to ensure | |
2539 | proper ordering of commands and command output in the total |
|
2543 | proper ordering of commands and command output in the total | |
2540 | output. |
|
2544 | output. | |
2541 | (SystemExec/xsys/bq): Switched the names of xsys/bq and |
|
2545 | (SystemExec/xsys/bq): Switched the names of xsys/bq and | |
2542 | system/getoutput as defaults. The old ones are kept for |
|
2546 | system/getoutput as defaults. The old ones are kept for | |
2543 | compatibility reasons, so no code which uses this library needs |
|
2547 | compatibility reasons, so no code which uses this library needs | |
2544 | changing. |
|
2548 | changing. | |
2545 |
|
2549 | |||
2546 | 2003-01-27 *** Released version 0.2.14 |
|
2550 | 2003-01-27 *** Released version 0.2.14 | |
2547 |
|
2551 | |||
2548 | 2003-01-25 Fernando Perez <fperez@colorado.edu> |
|
2552 | 2003-01-25 Fernando Perez <fperez@colorado.edu> | |
2549 |
|
2553 | |||
2550 | * IPython/Magic.py (Magic.magic_edit): Fixed problem where |
|
2554 | * IPython/Magic.py (Magic.magic_edit): Fixed problem where | |
2551 | functions defined in previous edit sessions could not be re-edited |
|
2555 | functions defined in previous edit sessions could not be re-edited | |
2552 | (because the temp files were immediately removed). Now temp files |
|
2556 | (because the temp files were immediately removed). Now temp files | |
2553 | are removed only at IPython's exit. |
|
2557 | are removed only at IPython's exit. | |
2554 | (Magic.magic_run): Improved @run to perform shell-like expansions |
|
2558 | (Magic.magic_run): Improved @run to perform shell-like expansions | |
2555 | on its arguments (~users and $VARS). With this, @run becomes more |
|
2559 | on its arguments (~users and $VARS). With this, @run becomes more | |
2556 | like a normal command-line. |
|
2560 | like a normal command-line. | |
2557 |
|
2561 | |||
2558 | * IPython/Shell.py (IPShellEmbed.__call__): Fixed a bunch of small |
|
2562 | * IPython/Shell.py (IPShellEmbed.__call__): Fixed a bunch of small | |
2559 | bugs related to embedding and cleaned up that code. A fairly |
|
2563 | bugs related to embedding and cleaned up that code. A fairly | |
2560 | important one was the impossibility to access the global namespace |
|
2564 | important one was the impossibility to access the global namespace | |
2561 | through the embedded IPython (only local variables were visible). |
|
2565 | through the embedded IPython (only local variables were visible). | |
2562 |
|
2566 | |||
2563 | 2003-01-14 Fernando Perez <fperez@colorado.edu> |
|
2567 | 2003-01-14 Fernando Perez <fperez@colorado.edu> | |
2564 |
|
2568 | |||
2565 | * IPython/iplib.py (InteractiveShell._prefilter): Fixed |
|
2569 | * IPython/iplib.py (InteractiveShell._prefilter): Fixed | |
2566 | auto-calling to be a bit more conservative. Now it doesn't get |
|
2570 | auto-calling to be a bit more conservative. Now it doesn't get | |
2567 | triggered if any of '!=()<>' are in the rest of the input line, to |
|
2571 | triggered if any of '!=()<>' are in the rest of the input line, to | |
2568 | allow comparing callables. Thanks to Alex for the heads up. |
|
2572 | allow comparing callables. Thanks to Alex for the heads up. | |
2569 |
|
2573 | |||
2570 | 2003-01-07 Fernando Perez <fperez@colorado.edu> |
|
2574 | 2003-01-07 Fernando Perez <fperez@colorado.edu> | |
2571 |
|
2575 | |||
2572 | * IPython/genutils.py (page): fixed estimation of the number of |
|
2576 | * IPython/genutils.py (page): fixed estimation of the number of | |
2573 | lines in a string to be paged to simply count newlines. This |
|
2577 | lines in a string to be paged to simply count newlines. This | |
2574 | prevents over-guessing due to embedded escape sequences. A better |
|
2578 | prevents over-guessing due to embedded escape sequences. A better | |
2575 | long-term solution would involve stripping out the control chars |
|
2579 | long-term solution would involve stripping out the control chars | |
2576 | for the count, but it's potentially so expensive I just don't |
|
2580 | for the count, but it's potentially so expensive I just don't | |
2577 | think it's worth doing. |
|
2581 | think it's worth doing. | |
2578 |
|
2582 | |||
2579 | 2002-12-19 *** Released version 0.2.14pre50 |
|
2583 | 2002-12-19 *** Released version 0.2.14pre50 | |
2580 |
|
2584 | |||
2581 | 2002-12-19 Fernando Perez <fperez@colorado.edu> |
|
2585 | 2002-12-19 Fernando Perez <fperez@colorado.edu> | |
2582 |
|
2586 | |||
2583 | * tools/release (version): Changed release scripts to inform |
|
2587 | * tools/release (version): Changed release scripts to inform | |
2584 | Andrea and build a NEWS file with a list of recent changes. |
|
2588 | Andrea and build a NEWS file with a list of recent changes. | |
2585 |
|
2589 | |||
2586 | * IPython/ColorANSI.py (__all__): changed terminal detection |
|
2590 | * IPython/ColorANSI.py (__all__): changed terminal detection | |
2587 | code. Seems to work better for xterms without breaking |
|
2591 | code. Seems to work better for xterms without breaking | |
2588 | konsole. Will need more testing to determine if WinXP and Mac OSX |
|
2592 | konsole. Will need more testing to determine if WinXP and Mac OSX | |
2589 | also work ok. |
|
2593 | also work ok. | |
2590 |
|
2594 | |||
2591 | 2002-12-18 *** Released version 0.2.14pre49 |
|
2595 | 2002-12-18 *** Released version 0.2.14pre49 | |
2592 |
|
2596 | |||
2593 | 2002-12-18 Fernando Perez <fperez@colorado.edu> |
|
2597 | 2002-12-18 Fernando Perez <fperez@colorado.edu> | |
2594 |
|
2598 | |||
2595 | * Docs: added new info about Mac OSX, from Andrea. |
|
2599 | * Docs: added new info about Mac OSX, from Andrea. | |
2596 |
|
2600 | |||
2597 | * IPython/Gnuplot2.py (String): Added a String PlotItem class to |
|
2601 | * IPython/Gnuplot2.py (String): Added a String PlotItem class to | |
2598 | allow direct plotting of python strings whose format is the same |
|
2602 | allow direct plotting of python strings whose format is the same | |
2599 | of gnuplot data files. |
|
2603 | of gnuplot data files. | |
2600 |
|
2604 | |||
2601 | 2002-12-16 Fernando Perez <fperez@colorado.edu> |
|
2605 | 2002-12-16 Fernando Perez <fperez@colorado.edu> | |
2602 |
|
2606 | |||
2603 | * IPython/iplib.py (InteractiveShell.interact): fixed default (y) |
|
2607 | * IPython/iplib.py (InteractiveShell.interact): fixed default (y) | |
2604 | value of exit question to be acknowledged. |
|
2608 | value of exit question to be acknowledged. | |
2605 |
|
2609 | |||
2606 | 2002-12-03 Fernando Perez <fperez@colorado.edu> |
|
2610 | 2002-12-03 Fernando Perez <fperez@colorado.edu> | |
2607 |
|
2611 | |||
2608 | * IPython/ipmaker.py: removed generators, which had been added |
|
2612 | * IPython/ipmaker.py: removed generators, which had been added | |
2609 | by mistake in an earlier debugging run. This was causing trouble |
|
2613 | by mistake in an earlier debugging run. This was causing trouble | |
2610 | to users of python 2.1.x. Thanks to Abel Daniel <abli-AT-freemail.hu> |
|
2614 | to users of python 2.1.x. Thanks to Abel Daniel <abli-AT-freemail.hu> | |
2611 | for pointing this out. |
|
2615 | for pointing this out. | |
2612 |
|
2616 | |||
2613 | 2002-11-17 Fernando Perez <fperez@colorado.edu> |
|
2617 | 2002-11-17 Fernando Perez <fperez@colorado.edu> | |
2614 |
|
2618 | |||
2615 | * Manual: updated the Gnuplot section. |
|
2619 | * Manual: updated the Gnuplot section. | |
2616 |
|
2620 | |||
2617 | * IPython/GnuplotRuntime.py: refactored a lot all this code, with |
|
2621 | * IPython/GnuplotRuntime.py: refactored a lot all this code, with | |
2618 | a much better split of what goes in Runtime and what goes in |
|
2622 | a much better split of what goes in Runtime and what goes in | |
2619 | Interactive. |
|
2623 | Interactive. | |
2620 |
|
2624 | |||
2621 | * IPython/ipmaker.py: fixed bug where import_fail_info wasn't |
|
2625 | * IPython/ipmaker.py: fixed bug where import_fail_info wasn't | |
2622 | being imported from iplib. |
|
2626 | being imported from iplib. | |
2623 |
|
2627 | |||
2624 | * IPython/GnuplotInteractive.py (magic_gpc): renamed @gp to @gpc |
|
2628 | * IPython/GnuplotInteractive.py (magic_gpc): renamed @gp to @gpc | |
2625 | for command-passing. Now the global Gnuplot instance is called |
|
2629 | for command-passing. Now the global Gnuplot instance is called | |
2626 | 'gp' instead of 'g', which was really a far too fragile and |
|
2630 | 'gp' instead of 'g', which was really a far too fragile and | |
2627 | common name. |
|
2631 | common name. | |
2628 |
|
2632 | |||
2629 | * IPython/Gnuplot2.py (eps_fix_bbox): added this to fix broken |
|
2633 | * IPython/Gnuplot2.py (eps_fix_bbox): added this to fix broken | |
2630 | bounding boxes generated by Gnuplot for square plots. |
|
2634 | bounding boxes generated by Gnuplot for square plots. | |
2631 |
|
2635 | |||
2632 | * IPython/genutils.py (popkey): new function added. I should |
|
2636 | * IPython/genutils.py (popkey): new function added. I should | |
2633 | suggest this on c.l.py as a dict method, it seems useful. |
|
2637 | suggest this on c.l.py as a dict method, it seems useful. | |
2634 |
|
2638 | |||
2635 | * IPython/Gnuplot2.py (Gnuplot.plot): Overhauled plot and replot |
|
2639 | * IPython/Gnuplot2.py (Gnuplot.plot): Overhauled plot and replot | |
2636 | to transparently handle PostScript generation. MUCH better than |
|
2640 | to transparently handle PostScript generation. MUCH better than | |
2637 | the previous plot_eps/replot_eps (which I removed now). The code |
|
2641 | the previous plot_eps/replot_eps (which I removed now). The code | |
2638 | is also fairly clean and well documented now (including |
|
2642 | is also fairly clean and well documented now (including | |
2639 | docstrings). |
|
2643 | docstrings). | |
2640 |
|
2644 | |||
2641 | 2002-11-13 Fernando Perez <fperez@colorado.edu> |
|
2645 | 2002-11-13 Fernando Perez <fperez@colorado.edu> | |
2642 |
|
2646 | |||
2643 | * IPython/Magic.py (Magic.magic_edit): fixed docstring |
|
2647 | * IPython/Magic.py (Magic.magic_edit): fixed docstring | |
2644 | (inconsistent with options). |
|
2648 | (inconsistent with options). | |
2645 |
|
2649 | |||
2646 | * IPython/Gnuplot2.py (Gnuplot.hardcopy): hardcopy had been |
|
2650 | * IPython/Gnuplot2.py (Gnuplot.hardcopy): hardcopy had been | |
2647 | manually disabled, I don't know why. Fixed it. |
|
2651 | manually disabled, I don't know why. Fixed it. | |
2648 | (Gnuplot._plot_eps): added new plot_eps/replot_eps to get directly |
|
2652 | (Gnuplot._plot_eps): added new plot_eps/replot_eps to get directly | |
2649 | eps output. |
|
2653 | eps output. | |
2650 |
|
2654 | |||
2651 | 2002-11-12 Fernando Perez <fperez@colorado.edu> |
|
2655 | 2002-11-12 Fernando Perez <fperez@colorado.edu> | |
2652 |
|
2656 | |||
2653 | * IPython/genutils.py (ask_yes_no): trap EOF and ^C so that they |
|
2657 | * IPython/genutils.py (ask_yes_no): trap EOF and ^C so that they | |
2654 | don't propagate up to caller. Fixes crash reported by François |
|
2658 | don't propagate up to caller. Fixes crash reported by François | |
2655 | Pinard. |
|
2659 | Pinard. | |
2656 |
|
2660 | |||
2657 | 2002-11-09 Fernando Perez <fperez@colorado.edu> |
|
2661 | 2002-11-09 Fernando Perez <fperez@colorado.edu> | |
2658 |
|
2662 | |||
2659 | * IPython/ipmaker.py (make_IPython): fixed problem with writing |
|
2663 | * IPython/ipmaker.py (make_IPython): fixed problem with writing | |
2660 | history file for new users. |
|
2664 | history file for new users. | |
2661 | (make_IPython): fixed bug where initial install would leave the |
|
2665 | (make_IPython): fixed bug where initial install would leave the | |
2662 | user running in the .ipython dir. |
|
2666 | user running in the .ipython dir. | |
2663 | (make_IPython): fixed bug where config dir .ipython would be |
|
2667 | (make_IPython): fixed bug where config dir .ipython would be | |
2664 | created regardless of the given -ipythondir option. Thanks to Cory |
|
2668 | created regardless of the given -ipythondir option. Thanks to Cory | |
2665 | Dodt <cdodt-AT-fcoe.k12.ca.us> for the bug report. |
|
2669 | Dodt <cdodt-AT-fcoe.k12.ca.us> for the bug report. | |
2666 |
|
2670 | |||
2667 | * IPython/genutils.py (ask_yes_no): new function for asking yes/no |
|
2671 | * IPython/genutils.py (ask_yes_no): new function for asking yes/no | |
2668 | type confirmations. Will need to use it in all of IPython's code |
|
2672 | type confirmations. Will need to use it in all of IPython's code | |
2669 | consistently. |
|
2673 | consistently. | |
2670 |
|
2674 | |||
2671 | * IPython/CrashHandler.py (CrashHandler.__call__): changed the |
|
2675 | * IPython/CrashHandler.py (CrashHandler.__call__): changed the | |
2672 | context to print 31 lines instead of the default 5. This will make |
|
2676 | context to print 31 lines instead of the default 5. This will make | |
2673 | the crash reports extremely detailed in case the problem is in |
|
2677 | the crash reports extremely detailed in case the problem is in | |
2674 | libraries I don't have access to. |
|
2678 | libraries I don't have access to. | |
2675 |
|
2679 | |||
2676 | * IPython/iplib.py (InteractiveShell.interact): changed the 'last |
|
2680 | * IPython/iplib.py (InteractiveShell.interact): changed the 'last | |
2677 | line of defense' code to still crash, but giving users fair |
|
2681 | line of defense' code to still crash, but giving users fair | |
2678 | warning. I don't want internal errors to go unreported: if there's |
|
2682 | warning. I don't want internal errors to go unreported: if there's | |
2679 | an internal problem, IPython should crash and generate a full |
|
2683 | an internal problem, IPython should crash and generate a full | |
2680 | report. |
|
2684 | report. | |
2681 |
|
2685 | |||
2682 | 2002-11-08 Fernando Perez <fperez@colorado.edu> |
|
2686 | 2002-11-08 Fernando Perez <fperez@colorado.edu> | |
2683 |
|
2687 | |||
2684 | * IPython/iplib.py (InteractiveShell.interact): added code to trap |
|
2688 | * IPython/iplib.py (InteractiveShell.interact): added code to trap | |
2685 | otherwise uncaught exceptions which can appear if people set |
|
2689 | otherwise uncaught exceptions which can appear if people set | |
2686 | sys.stdout to something badly broken. Thanks to a crash report |
|
2690 | sys.stdout to something badly broken. Thanks to a crash report | |
2687 | from henni-AT-mail.brainbot.com. |
|
2691 | from henni-AT-mail.brainbot.com. | |
2688 |
|
2692 | |||
2689 | 2002-11-04 Fernando Perez <fperez@colorado.edu> |
|
2693 | 2002-11-04 Fernando Perez <fperez@colorado.edu> | |
2690 |
|
2694 | |||
2691 | * IPython/iplib.py (InteractiveShell.interact): added |
|
2695 | * IPython/iplib.py (InteractiveShell.interact): added | |
2692 | __IPYTHON__active to the builtins. It's a flag which goes on when |
|
2696 | __IPYTHON__active to the builtins. It's a flag which goes on when | |
2693 | the interaction starts and goes off again when it stops. This |
|
2697 | the interaction starts and goes off again when it stops. This | |
2694 | allows embedding code to detect being inside IPython. Before this |
|
2698 | allows embedding code to detect being inside IPython. Before this | |
2695 | was done via __IPYTHON__, but that only shows that an IPython |
|
2699 | was done via __IPYTHON__, but that only shows that an IPython | |
2696 | instance has been created. |
|
2700 | instance has been created. | |
2697 |
|
2701 | |||
2698 | * IPython/Magic.py (Magic.magic_env): I realized that in a |
|
2702 | * IPython/Magic.py (Magic.magic_env): I realized that in a | |
2699 | UserDict, instance.data holds the data as a normal dict. So I |
|
2703 | UserDict, instance.data holds the data as a normal dict. So I | |
2700 | modified @env to return os.environ.data instead of rebuilding a |
|
2704 | modified @env to return os.environ.data instead of rebuilding a | |
2701 | dict by hand. |
|
2705 | dict by hand. | |
2702 |
|
2706 | |||
2703 | 2002-11-02 Fernando Perez <fperez@colorado.edu> |
|
2707 | 2002-11-02 Fernando Perez <fperez@colorado.edu> | |
2704 |
|
2708 | |||
2705 | * IPython/genutils.py (warn): changed so that level 1 prints no |
|
2709 | * IPython/genutils.py (warn): changed so that level 1 prints no | |
2706 | header. Level 2 is now the default (with 'WARNING' header, as |
|
2710 | header. Level 2 is now the default (with 'WARNING' header, as | |
2707 | before). I think I tracked all places where changes were needed in |
|
2711 | before). I think I tracked all places where changes were needed in | |
2708 | IPython, but outside code using the old level numbering may have |
|
2712 | IPython, but outside code using the old level numbering may have | |
2709 | broken. |
|
2713 | broken. | |
2710 |
|
2714 | |||
2711 | * IPython/iplib.py (InteractiveShell.runcode): added this to |
|
2715 | * IPython/iplib.py (InteractiveShell.runcode): added this to | |
2712 | handle the tracebacks in SystemExit traps correctly. The previous |
|
2716 | handle the tracebacks in SystemExit traps correctly. The previous | |
2713 | code (through interact) was printing more of the stack than |
|
2717 | code (through interact) was printing more of the stack than | |
2714 | necessary, showing IPython internal code to the user. |
|
2718 | necessary, showing IPython internal code to the user. | |
2715 |
|
2719 | |||
2716 | * IPython/UserConfig/ipythonrc.py: Made confirm_exit 1 by |
|
2720 | * IPython/UserConfig/ipythonrc.py: Made confirm_exit 1 by | |
2717 | default. Now that the default at the confirmation prompt is yes, |
|
2721 | default. Now that the default at the confirmation prompt is yes, | |
2718 | it's not so intrusive. François' argument that ipython sessions |
|
2722 | it's not so intrusive. François' argument that ipython sessions | |
2719 | tend to be complex enough not to lose them from an accidental C-d, |
|
2723 | tend to be complex enough not to lose them from an accidental C-d, | |
2720 | is a valid one. |
|
2724 | is a valid one. | |
2721 |
|
2725 | |||
2722 | * IPython/iplib.py (InteractiveShell.interact): added a |
|
2726 | * IPython/iplib.py (InteractiveShell.interact): added a | |
2723 | showtraceback() call to the SystemExit trap, and modified the exit |
|
2727 | showtraceback() call to the SystemExit trap, and modified the exit | |
2724 | confirmation to have yes as the default. |
|
2728 | confirmation to have yes as the default. | |
2725 |
|
2729 | |||
2726 | * IPython/UserConfig/ipythonrc.py: removed 'session' option from |
|
2730 | * IPython/UserConfig/ipythonrc.py: removed 'session' option from | |
2727 | this file. It's been gone from the code for a long time, this was |
|
2731 | this file. It's been gone from the code for a long time, this was | |
2728 | simply leftover junk. |
|
2732 | simply leftover junk. | |
2729 |
|
2733 | |||
2730 | 2002-11-01 Fernando Perez <fperez@colorado.edu> |
|
2734 | 2002-11-01 Fernando Perez <fperez@colorado.edu> | |
2731 |
|
2735 | |||
2732 | * IPython/UserConfig/ipythonrc.py: new confirm_exit option |
|
2736 | * IPython/UserConfig/ipythonrc.py: new confirm_exit option | |
2733 | added. If set, IPython now traps EOF and asks for |
|
2737 | added. If set, IPython now traps EOF and asks for | |
2734 | confirmation. After a request by François Pinard. |
|
2738 | confirmation. After a request by François Pinard. | |
2735 |
|
2739 | |||
2736 | * IPython/Magic.py (Magic.magic_Exit): New @Exit and @Quit instead |
|
2740 | * IPython/Magic.py (Magic.magic_Exit): New @Exit and @Quit instead | |
2737 | of @abort, and with a new (better) mechanism for handling the |
|
2741 | of @abort, and with a new (better) mechanism for handling the | |
2738 | exceptions. |
|
2742 | exceptions. | |
2739 |
|
2743 | |||
2740 | 2002-10-27 Fernando Perez <fperez@colorado.edu> |
|
2744 | 2002-10-27 Fernando Perez <fperez@colorado.edu> | |
2741 |
|
2745 | |||
2742 | * IPython/usage.py (__doc__): updated the --help information and |
|
2746 | * IPython/usage.py (__doc__): updated the --help information and | |
2743 | the ipythonrc file to indicate that -log generates |
|
2747 | the ipythonrc file to indicate that -log generates | |
2744 | ./ipython.log. Also fixed the corresponding info in @logstart. |
|
2748 | ./ipython.log. Also fixed the corresponding info in @logstart. | |
2745 | This and several other fixes in the manuals thanks to reports by |
|
2749 | This and several other fixes in the manuals thanks to reports by | |
2746 | François Pinard <pinard-AT-iro.umontreal.ca>. |
|
2750 | François Pinard <pinard-AT-iro.umontreal.ca>. | |
2747 |
|
2751 | |||
2748 | * IPython/Logger.py (Logger.switch_log): Fixed error message to |
|
2752 | * IPython/Logger.py (Logger.switch_log): Fixed error message to | |
2749 | refer to @logstart (instead of @log, which doesn't exist). |
|
2753 | refer to @logstart (instead of @log, which doesn't exist). | |
2750 |
|
2754 | |||
2751 | * IPython/iplib.py (InteractiveShell._prefilter): fixed |
|
2755 | * IPython/iplib.py (InteractiveShell._prefilter): fixed | |
2752 | AttributeError crash. Thanks to Christopher Armstrong |
|
2756 | AttributeError crash. Thanks to Christopher Armstrong | |
2753 | <radix-AT-twistedmatrix.com> for the report/fix. This bug had been |
|
2757 | <radix-AT-twistedmatrix.com> for the report/fix. This bug had been | |
2754 | introduced recently (in 0.2.14pre37) with the fix to the eval |
|
2758 | introduced recently (in 0.2.14pre37) with the fix to the eval | |
2755 | problem mentioned below. |
|
2759 | problem mentioned below. | |
2756 |
|
2760 | |||
2757 | 2002-10-17 Fernando Perez <fperez@colorado.edu> |
|
2761 | 2002-10-17 Fernando Perez <fperez@colorado.edu> | |
2758 |
|
2762 | |||
2759 | * IPython/ConfigLoader.py (ConfigLoader.load): Fixes for Windows |
|
2763 | * IPython/ConfigLoader.py (ConfigLoader.load): Fixes for Windows | |
2760 | installation. Thanks to Leonardo Santagada <retype-AT-terra.com.br>. |
|
2764 | installation. Thanks to Leonardo Santagada <retype-AT-terra.com.br>. | |
2761 |
|
2765 | |||
2762 | * IPython/iplib.py (InteractiveShell._prefilter): Many changes to |
|
2766 | * IPython/iplib.py (InteractiveShell._prefilter): Many changes to | |
2763 | this function to fix a problem reported by Alex Schmolck. He saw |
|
2767 | this function to fix a problem reported by Alex Schmolck. He saw | |
2764 | it with list comprehensions and generators, which were getting |
|
2768 | it with list comprehensions and generators, which were getting | |
2765 | called twice. The real problem was an 'eval' call in testing for |
|
2769 | called twice. The real problem was an 'eval' call in testing for | |
2766 | automagic which was evaluating the input line silently. |
|
2770 | automagic which was evaluating the input line silently. | |
2767 |
|
2771 | |||
2768 | This is a potentially very nasty bug, if the input has side |
|
2772 | This is a potentially very nasty bug, if the input has side | |
2769 | effects which must not be repeated. The code is much cleaner now, |
|
2773 | effects which must not be repeated. The code is much cleaner now, | |
2770 | without any blanket 'except' left and with a regexp test for |
|
2774 | without any blanket 'except' left and with a regexp test for | |
2771 | actual function names. |
|
2775 | actual function names. | |
2772 |
|
2776 | |||
2773 | But an eval remains, which I'm not fully comfortable with. I just |
|
2777 | But an eval remains, which I'm not fully comfortable with. I just | |
2774 | don't know how to find out if an expression could be a callable in |
|
2778 | don't know how to find out if an expression could be a callable in | |
2775 | the user's namespace without doing an eval on the string. However |
|
2779 | the user's namespace without doing an eval on the string. However | |
2776 | that string is now much more strictly checked so that no code |
|
2780 | that string is now much more strictly checked so that no code | |
2777 | slips by, so the eval should only happen for things that can |
|
2781 | slips by, so the eval should only happen for things that can | |
2778 | really be only function/method names. |
|
2782 | really be only function/method names. | |
2779 |
|
2783 | |||
2780 | 2002-10-15 Fernando Perez <fperez@colorado.edu> |
|
2784 | 2002-10-15 Fernando Perez <fperez@colorado.edu> | |
2781 |
|
2785 | |||
2782 | * Updated LyX to 1.2.1 so I can work on the docs again. Added Mac |
|
2786 | * Updated LyX to 1.2.1 so I can work on the docs again. Added Mac | |
2783 | OSX information to main manual, removed README_Mac_OSX file from |
|
2787 | OSX information to main manual, removed README_Mac_OSX file from | |
2784 | distribution. Also updated credits for recent additions. |
|
2788 | distribution. Also updated credits for recent additions. | |
2785 |
|
2789 | |||
2786 | 2002-10-10 Fernando Perez <fperez@colorado.edu> |
|
2790 | 2002-10-10 Fernando Perez <fperez@colorado.edu> | |
2787 |
|
2791 | |||
2788 | * README_Mac_OSX: Added a README for Mac OSX users for fixing |
|
2792 | * README_Mac_OSX: Added a README for Mac OSX users for fixing | |
2789 | terminal-related issues. Many thanks to Andrea Riciputi |
|
2793 | terminal-related issues. Many thanks to Andrea Riciputi | |
2790 | <andrea.riciputi-AT-libero.it> for writing it. |
|
2794 | <andrea.riciputi-AT-libero.it> for writing it. | |
2791 |
|
2795 | |||
2792 | * IPython/UserConfig/ipythonrc.py: Fixes to various small issues, |
|
2796 | * IPython/UserConfig/ipythonrc.py: Fixes to various small issues, | |
2793 | thanks to Thorsten Kampe <thorsten-AT-thorstenkampe.de>. |
|
2797 | thanks to Thorsten Kampe <thorsten-AT-thorstenkampe.de>. | |
2794 |
|
2798 | |||
2795 | * setup.py (make_shortcut): Fixes for Windows installation. Thanks |
|
2799 | * setup.py (make_shortcut): Fixes for Windows installation. Thanks | |
2796 | to Fredrik Kant <fredrik.kant-AT-front.com> and Syver Enstad |
|
2800 | to Fredrik Kant <fredrik.kant-AT-front.com> and Syver Enstad | |
2797 | <syver-en-AT-online.no> who both submitted patches for this problem. |
|
2801 | <syver-en-AT-online.no> who both submitted patches for this problem. | |
2798 |
|
2802 | |||
2799 | * IPython/iplib.py (InteractiveShell.embed_mainloop): Patch for |
|
2803 | * IPython/iplib.py (InteractiveShell.embed_mainloop): Patch for | |
2800 | global embedding to make sure that things don't overwrite user |
|
2804 | global embedding to make sure that things don't overwrite user | |
2801 | globals accidentally. Thanks to Richard <rxe-AT-renre-europe.com> |
|
2805 | globals accidentally. Thanks to Richard <rxe-AT-renre-europe.com> | |
2802 |
|
2806 | |||
2803 | * IPython/Gnuplot2.py (gp): Patch for Gnuplot.py 1.6 |
|
2807 | * IPython/Gnuplot2.py (gp): Patch for Gnuplot.py 1.6 | |
2804 | compatibility. Thanks to Hayden Callow |
|
2808 | compatibility. Thanks to Hayden Callow | |
2805 | <h.callow-AT-elec.canterbury.ac.nz> |
|
2809 | <h.callow-AT-elec.canterbury.ac.nz> | |
2806 |
|
2810 | |||
2807 | 2002-10-04 Fernando Perez <fperez@colorado.edu> |
|
2811 | 2002-10-04 Fernando Perez <fperez@colorado.edu> | |
2808 |
|
2812 | |||
2809 | * IPython/Gnuplot2.py (PlotItem): Added 'index' option for |
|
2813 | * IPython/Gnuplot2.py (PlotItem): Added 'index' option for | |
2810 | Gnuplot.File objects. |
|
2814 | Gnuplot.File objects. | |
2811 |
|
2815 | |||
2812 | 2002-07-23 Fernando Perez <fperez@colorado.edu> |
|
2816 | 2002-07-23 Fernando Perez <fperez@colorado.edu> | |
2813 |
|
2817 | |||
2814 | * IPython/genutils.py (timing): Added timings() and timing() for |
|
2818 | * IPython/genutils.py (timing): Added timings() and timing() for | |
2815 | quick access to the most commonly needed data, the execution |
|
2819 | quick access to the most commonly needed data, the execution | |
2816 | times. Old timing() renamed to timings_out(). |
|
2820 | times. Old timing() renamed to timings_out(). | |
2817 |
|
2821 | |||
2818 | 2002-07-18 Fernando Perez <fperez@colorado.edu> |
|
2822 | 2002-07-18 Fernando Perez <fperez@colorado.edu> | |
2819 |
|
2823 | |||
2820 | * IPython/Shell.py (IPShellEmbed.restore_system_completer): fixed |
|
2824 | * IPython/Shell.py (IPShellEmbed.restore_system_completer): fixed | |
2821 | bug with nested instances disrupting the parent's tab completion. |
|
2825 | bug with nested instances disrupting the parent's tab completion. | |
2822 |
|
2826 | |||
2823 | * IPython/iplib.py (all_completions): Added Alex Schmolck's |
|
2827 | * IPython/iplib.py (all_completions): Added Alex Schmolck's | |
2824 | all_completions code to begin the emacs integration. |
|
2828 | all_completions code to begin the emacs integration. | |
2825 |
|
2829 | |||
2826 | * IPython/Gnuplot2.py (zip_items): Added optional 'titles' |
|
2830 | * IPython/Gnuplot2.py (zip_items): Added optional 'titles' | |
2827 | argument to allow titling individual arrays when plotting. |
|
2831 | argument to allow titling individual arrays when plotting. | |
2828 |
|
2832 | |||
2829 | 2002-07-15 Fernando Perez <fperez@colorado.edu> |
|
2833 | 2002-07-15 Fernando Perez <fperez@colorado.edu> | |
2830 |
|
2834 | |||
2831 | * setup.py (make_shortcut): changed to retrieve the value of |
|
2835 | * setup.py (make_shortcut): changed to retrieve the value of | |
2832 | 'Program Files' directory from the registry (this value changes in |
|
2836 | 'Program Files' directory from the registry (this value changes in | |
2833 | non-english versions of Windows). Thanks to Thomas Fanslau |
|
2837 | non-english versions of Windows). Thanks to Thomas Fanslau | |
2834 | <tfanslau-AT-gmx.de> for the report. |
|
2838 | <tfanslau-AT-gmx.de> for the report. | |
2835 |
|
2839 | |||
2836 | 2002-07-10 Fernando Perez <fperez@colorado.edu> |
|
2840 | 2002-07-10 Fernando Perez <fperez@colorado.edu> | |
2837 |
|
2841 | |||
2838 | * IPython/ultraTB.py (VerboseTB.debugger): enabled workaround for |
|
2842 | * IPython/ultraTB.py (VerboseTB.debugger): enabled workaround for | |
2839 | a bug in pdb, which crashes if a line with only whitespace is |
|
2843 | a bug in pdb, which crashes if a line with only whitespace is | |
2840 | entered. Bug report submitted to sourceforge. |
|
2844 | entered. Bug report submitted to sourceforge. | |
2841 |
|
2845 | |||
2842 | 2002-07-09 Fernando Perez <fperez@colorado.edu> |
|
2846 | 2002-07-09 Fernando Perez <fperez@colorado.edu> | |
2843 |
|
2847 | |||
2844 | * IPython/ultraTB.py (VerboseTB.nullrepr): fixed rare crash when |
|
2848 | * IPython/ultraTB.py (VerboseTB.nullrepr): fixed rare crash when | |
2845 | reporting exceptions (it's a bug in inspect.py, I just set a |
|
2849 | reporting exceptions (it's a bug in inspect.py, I just set a | |
2846 | workaround). |
|
2850 | workaround). | |
2847 |
|
2851 | |||
2848 | 2002-07-08 Fernando Perez <fperez@colorado.edu> |
|
2852 | 2002-07-08 Fernando Perez <fperez@colorado.edu> | |
2849 |
|
2853 | |||
2850 | * IPython/iplib.py (InteractiveShell.__init__): fixed reference to |
|
2854 | * IPython/iplib.py (InteractiveShell.__init__): fixed reference to | |
2851 | __IPYTHON__ in __builtins__ to show up in user_ns. |
|
2855 | __IPYTHON__ in __builtins__ to show up in user_ns. | |
2852 |
|
2856 | |||
2853 | 2002-07-03 Fernando Perez <fperez@colorado.edu> |
|
2857 | 2002-07-03 Fernando Perez <fperez@colorado.edu> | |
2854 |
|
2858 | |||
2855 | * IPython/GnuplotInteractive.py (magic_gp_set_default): changed |
|
2859 | * IPython/GnuplotInteractive.py (magic_gp_set_default): changed | |
2856 | name from @gp_set_instance to @gp_set_default. |
|
2860 | name from @gp_set_instance to @gp_set_default. | |
2857 |
|
2861 | |||
2858 | * IPython/ipmaker.py (make_IPython): default editor value set to |
|
2862 | * IPython/ipmaker.py (make_IPython): default editor value set to | |
2859 | '0' (a string), to match the rc file. Otherwise will crash when |
|
2863 | '0' (a string), to match the rc file. Otherwise will crash when | |
2860 | .strip() is called on it. |
|
2864 | .strip() is called on it. | |
2861 |
|
2865 | |||
2862 |
|
2866 | |||
2863 | 2002-06-28 Fernando Perez <fperez@colorado.edu> |
|
2867 | 2002-06-28 Fernando Perez <fperez@colorado.edu> | |
2864 |
|
2868 | |||
2865 | * IPython/iplib.py (InteractiveShell.safe_execfile): fix importing |
|
2869 | * IPython/iplib.py (InteractiveShell.safe_execfile): fix importing | |
2866 | of files in current directory when a file is executed via |
|
2870 | of files in current directory when a file is executed via | |
2867 | @run. Patch also by RA <ralf_ahlbrink-AT-web.de>. |
|
2871 | @run. Patch also by RA <ralf_ahlbrink-AT-web.de>. | |
2868 |
|
2872 | |||
2869 | * setup.py (manfiles): fix for rpm builds, submitted by RA |
|
2873 | * setup.py (manfiles): fix for rpm builds, submitted by RA | |
2870 | <ralf_ahlbrink-AT-web.de>. Now we have RPMs! |
|
2874 | <ralf_ahlbrink-AT-web.de>. Now we have RPMs! | |
2871 |
|
2875 | |||
2872 | * IPython/ipmaker.py (make_IPython): fixed lookup of default |
|
2876 | * IPython/ipmaker.py (make_IPython): fixed lookup of default | |
2873 | editor when set to '0'. Problem was, '0' evaluates to True (it's a |
|
2877 | editor when set to '0'. Problem was, '0' evaluates to True (it's a | |
2874 | string!). A. Schmolck caught this one. |
|
2878 | string!). A. Schmolck caught this one. | |
2875 |
|
2879 | |||
2876 | 2002-06-27 Fernando Perez <fperez@colorado.edu> |
|
2880 | 2002-06-27 Fernando Perez <fperez@colorado.edu> | |
2877 |
|
2881 | |||
2878 | * IPython/ipmaker.py (make_IPython): fixed bug when running user |
|
2882 | * IPython/ipmaker.py (make_IPython): fixed bug when running user | |
2879 | defined files at the cmd line. __name__ wasn't being set to |
|
2883 | defined files at the cmd line. __name__ wasn't being set to | |
2880 | __main__. |
|
2884 | __main__. | |
2881 |
|
2885 | |||
2882 | * IPython/Gnuplot2.py (zip_items): improved it so it can plot also |
|
2886 | * IPython/Gnuplot2.py (zip_items): improved it so it can plot also | |
2883 | regular lists and tuples besides Numeric arrays. |
|
2887 | regular lists and tuples besides Numeric arrays. | |
2884 |
|
2888 | |||
2885 | * IPython/Prompts.py (CachedOutput.__call__): Added output |
|
2889 | * IPython/Prompts.py (CachedOutput.__call__): Added output | |
2886 | supression for input ending with ';'. Similar to Mathematica and |
|
2890 | supression for input ending with ';'. Similar to Mathematica and | |
2887 | Matlab. The _* vars and Out[] list are still updated, just like |
|
2891 | Matlab. The _* vars and Out[] list are still updated, just like | |
2888 | Mathematica behaves. |
|
2892 | Mathematica behaves. | |
2889 |
|
2893 | |||
2890 | 2002-06-25 Fernando Perez <fperez@colorado.edu> |
|
2894 | 2002-06-25 Fernando Perez <fperez@colorado.edu> | |
2891 |
|
2895 | |||
2892 | * IPython/ConfigLoader.py (ConfigLoader.load): fixed checking of |
|
2896 | * IPython/ConfigLoader.py (ConfigLoader.load): fixed checking of | |
2893 | .ini extensions for profiels under Windows. |
|
2897 | .ini extensions for profiels under Windows. | |
2894 |
|
2898 | |||
2895 | * IPython/OInspect.py (Inspector.pinfo): improved alignment of |
|
2899 | * IPython/OInspect.py (Inspector.pinfo): improved alignment of | |
2896 | string form. Fix contributed by Alexander Schmolck |
|
2900 | string form. Fix contributed by Alexander Schmolck | |
2897 | <a.schmolck-AT-gmx.net> |
|
2901 | <a.schmolck-AT-gmx.net> | |
2898 |
|
2902 | |||
2899 | * IPython/GnuplotRuntime.py (gp_new): new function. Returns a |
|
2903 | * IPython/GnuplotRuntime.py (gp_new): new function. Returns a | |
2900 | pre-configured Gnuplot instance. |
|
2904 | pre-configured Gnuplot instance. | |
2901 |
|
2905 | |||
2902 | 2002-06-21 Fernando Perez <fperez@colorado.edu> |
|
2906 | 2002-06-21 Fernando Perez <fperez@colorado.edu> | |
2903 |
|
2907 | |||
2904 | * IPython/numutils.py (exp_safe): new function, works around the |
|
2908 | * IPython/numutils.py (exp_safe): new function, works around the | |
2905 | underflow problems in Numeric. |
|
2909 | underflow problems in Numeric. | |
2906 | (log2): New fn. Safe log in base 2: returns exact integer answer |
|
2910 | (log2): New fn. Safe log in base 2: returns exact integer answer | |
2907 | for exact integer powers of 2. |
|
2911 | for exact integer powers of 2. | |
2908 |
|
2912 | |||
2909 | * IPython/Magic.py (get_py_filename): fixed it not expanding '~' |
|
2913 | * IPython/Magic.py (get_py_filename): fixed it not expanding '~' | |
2910 | properly. |
|
2914 | properly. | |
2911 |
|
2915 | |||
2912 | 2002-06-20 Fernando Perez <fperez@colorado.edu> |
|
2916 | 2002-06-20 Fernando Perez <fperez@colorado.edu> | |
2913 |
|
2917 | |||
2914 | * IPython/genutils.py (timing): new function like |
|
2918 | * IPython/genutils.py (timing): new function like | |
2915 | Mathematica's. Similar to time_test, but returns more info. |
|
2919 | Mathematica's. Similar to time_test, but returns more info. | |
2916 |
|
2920 | |||
2917 | 2002-06-18 Fernando Perez <fperez@colorado.edu> |
|
2921 | 2002-06-18 Fernando Perez <fperez@colorado.edu> | |
2918 |
|
2922 | |||
2919 | * IPython/Magic.py (Magic.magic_save): modified @save and @r |
|
2923 | * IPython/Magic.py (Magic.magic_save): modified @save and @r | |
2920 | according to Mike Heeter's suggestions. |
|
2924 | according to Mike Heeter's suggestions. | |
2921 |
|
2925 | |||
2922 | 2002-06-16 Fernando Perez <fperez@colorado.edu> |
|
2926 | 2002-06-16 Fernando Perez <fperez@colorado.edu> | |
2923 |
|
2927 | |||
2924 | * IPython/GnuplotRuntime.py: Massive overhaul to the Gnuplot |
|
2928 | * IPython/GnuplotRuntime.py: Massive overhaul to the Gnuplot | |
2925 | system. GnuplotMagic is gone as a user-directory option. New files |
|
2929 | system. GnuplotMagic is gone as a user-directory option. New files | |
2926 | make it easier to use all the gnuplot stuff both from external |
|
2930 | make it easier to use all the gnuplot stuff both from external | |
2927 | programs as well as from IPython. Had to rewrite part of |
|
2931 | programs as well as from IPython. Had to rewrite part of | |
2928 | hardcopy() b/c of a strange bug: often the ps files simply don't |
|
2932 | hardcopy() b/c of a strange bug: often the ps files simply don't | |
2929 | get created, and require a repeat of the command (often several |
|
2933 | get created, and require a repeat of the command (often several | |
2930 | times). |
|
2934 | times). | |
2931 |
|
2935 | |||
2932 | * IPython/ultraTB.py (AutoFormattedTB.__call__): changed to |
|
2936 | * IPython/ultraTB.py (AutoFormattedTB.__call__): changed to | |
2933 | resolve output channel at call time, so that if sys.stderr has |
|
2937 | resolve output channel at call time, so that if sys.stderr has | |
2934 | been redirected by user this gets honored. |
|
2938 | been redirected by user this gets honored. | |
2935 |
|
2939 | |||
2936 | 2002-06-13 Fernando Perez <fperez@colorado.edu> |
|
2940 | 2002-06-13 Fernando Perez <fperez@colorado.edu> | |
2937 |
|
2941 | |||
2938 | * IPython/Shell.py (IPShell.__init__): Changed IPythonShell to |
|
2942 | * IPython/Shell.py (IPShell.__init__): Changed IPythonShell to | |
2939 | IPShell. Kept a copy with the old names to avoid breaking people's |
|
2943 | IPShell. Kept a copy with the old names to avoid breaking people's | |
2940 | embedded code. |
|
2944 | embedded code. | |
2941 |
|
2945 | |||
2942 | * IPython/ipython: simplified it to the bare minimum after |
|
2946 | * IPython/ipython: simplified it to the bare minimum after | |
2943 | Holger's suggestions. Added info about how to use it in |
|
2947 | Holger's suggestions. Added info about how to use it in | |
2944 | PYTHONSTARTUP. |
|
2948 | PYTHONSTARTUP. | |
2945 |
|
2949 | |||
2946 | * IPython/Shell.py (IPythonShell): changed the options passing |
|
2950 | * IPython/Shell.py (IPythonShell): changed the options passing | |
2947 | from a string with funky %s replacements to a straight list. Maybe |
|
2951 | from a string with funky %s replacements to a straight list. Maybe | |
2948 | a bit more typing, but it follows sys.argv conventions, so there's |
|
2952 | a bit more typing, but it follows sys.argv conventions, so there's | |
2949 | less special-casing to remember. |
|
2953 | less special-casing to remember. | |
2950 |
|
2954 | |||
2951 | 2002-06-12 Fernando Perez <fperez@colorado.edu> |
|
2955 | 2002-06-12 Fernando Perez <fperez@colorado.edu> | |
2952 |
|
2956 | |||
2953 | * IPython/Magic.py (Magic.magic_r): new magic auto-repeat |
|
2957 | * IPython/Magic.py (Magic.magic_r): new magic auto-repeat | |
2954 | command. Thanks to a suggestion by Mike Heeter. |
|
2958 | command. Thanks to a suggestion by Mike Heeter. | |
2955 | (Magic.magic_pfile): added behavior to look at filenames if given |
|
2959 | (Magic.magic_pfile): added behavior to look at filenames if given | |
2956 | arg is not a defined object. |
|
2960 | arg is not a defined object. | |
2957 | (Magic.magic_save): New @save function to save code snippets. Also |
|
2961 | (Magic.magic_save): New @save function to save code snippets. Also | |
2958 | a Mike Heeter idea. |
|
2962 | a Mike Heeter idea. | |
2959 |
|
2963 | |||
2960 | * IPython/UserConfig/GnuplotMagic.py (plot): Improvements to |
|
2964 | * IPython/UserConfig/GnuplotMagic.py (plot): Improvements to | |
2961 | plot() and replot(). Much more convenient now, especially for |
|
2965 | plot() and replot(). Much more convenient now, especially for | |
2962 | interactive use. |
|
2966 | interactive use. | |
2963 |
|
2967 | |||
2964 | * IPython/Magic.py (Magic.magic_run): Added .py automatically to |
|
2968 | * IPython/Magic.py (Magic.magic_run): Added .py automatically to | |
2965 | filenames. |
|
2969 | filenames. | |
2966 |
|
2970 | |||
2967 | 2002-06-02 Fernando Perez <fperez@colorado.edu> |
|
2971 | 2002-06-02 Fernando Perez <fperez@colorado.edu> | |
2968 |
|
2972 | |||
2969 | * IPython/Struct.py (Struct.__init__): modified to admit |
|
2973 | * IPython/Struct.py (Struct.__init__): modified to admit | |
2970 | initialization via another struct. |
|
2974 | initialization via another struct. | |
2971 |
|
2975 | |||
2972 | * IPython/genutils.py (SystemExec.__init__): New stateful |
|
2976 | * IPython/genutils.py (SystemExec.__init__): New stateful | |
2973 | interface to xsys and bq. Useful for writing system scripts. |
|
2977 | interface to xsys and bq. Useful for writing system scripts. | |
2974 |
|
2978 | |||
2975 | 2002-05-30 Fernando Perez <fperez@colorado.edu> |
|
2979 | 2002-05-30 Fernando Perez <fperez@colorado.edu> | |
2976 |
|
2980 | |||
2977 | * MANIFEST.in: Changed docfile selection to exclude all the lyx |
|
2981 | * MANIFEST.in: Changed docfile selection to exclude all the lyx | |
2978 | documents. This will make the user download smaller (it's getting |
|
2982 | documents. This will make the user download smaller (it's getting | |
2979 | too big). |
|
2983 | too big). | |
2980 |
|
2984 | |||
2981 | 2002-05-29 Fernando Perez <fperez@colorado.edu> |
|
2985 | 2002-05-29 Fernando Perez <fperez@colorado.edu> | |
2982 |
|
2986 | |||
2983 | * IPython/iplib.py (_FakeModule.__init__): New class introduced to |
|
2987 | * IPython/iplib.py (_FakeModule.__init__): New class introduced to | |
2984 | fix problems with shelve and pickle. Seems to work, but I don't |
|
2988 | fix problems with shelve and pickle. Seems to work, but I don't | |
2985 | know if corner cases break it. Thanks to Mike Heeter |
|
2989 | know if corner cases break it. Thanks to Mike Heeter | |
2986 | <korora-AT-SDF.LONESTAR.ORG> for the bug reports and test cases. |
|
2990 | <korora-AT-SDF.LONESTAR.ORG> for the bug reports and test cases. | |
2987 |
|
2991 | |||
2988 | 2002-05-24 Fernando Perez <fperez@colorado.edu> |
|
2992 | 2002-05-24 Fernando Perez <fperez@colorado.edu> | |
2989 |
|
2993 | |||
2990 | * IPython/Magic.py (Macro.__init__): fixed magics embedded in |
|
2994 | * IPython/Magic.py (Macro.__init__): fixed magics embedded in | |
2991 | macros having broken. |
|
2995 | macros having broken. | |
2992 |
|
2996 | |||
2993 | 2002-05-21 Fernando Perez <fperez@colorado.edu> |
|
2997 | 2002-05-21 Fernando Perez <fperez@colorado.edu> | |
2994 |
|
2998 | |||
2995 | * IPython/Magic.py (Magic.magic_logstart): fixed recently |
|
2999 | * IPython/Magic.py (Magic.magic_logstart): fixed recently | |
2996 | introduced logging bug: all history before logging started was |
|
3000 | introduced logging bug: all history before logging started was | |
2997 | being written one character per line! This came from the redesign |
|
3001 | being written one character per line! This came from the redesign | |
2998 | of the input history as a special list which slices to strings, |
|
3002 | of the input history as a special list which slices to strings, | |
2999 | not to lists. |
|
3003 | not to lists. | |
3000 |
|
3004 | |||
3001 | 2002-05-20 Fernando Perez <fperez@colorado.edu> |
|
3005 | 2002-05-20 Fernando Perez <fperez@colorado.edu> | |
3002 |
|
3006 | |||
3003 | * IPython/Prompts.py (CachedOutput.__init__): made the color table |
|
3007 | * IPython/Prompts.py (CachedOutput.__init__): made the color table | |
3004 | be an attribute of all classes in this module. The design of these |
|
3008 | be an attribute of all classes in this module. The design of these | |
3005 | classes needs some serious overhauling. |
|
3009 | classes needs some serious overhauling. | |
3006 |
|
3010 | |||
3007 | * IPython/DPyGetOpt.py (DPyGetOpt.setPosixCompliance): fixed bug |
|
3011 | * IPython/DPyGetOpt.py (DPyGetOpt.setPosixCompliance): fixed bug | |
3008 | which was ignoring '_' in option names. |
|
3012 | which was ignoring '_' in option names. | |
3009 |
|
3013 | |||
3010 | * IPython/ultraTB.py (FormattedTB.__init__): Changed |
|
3014 | * IPython/ultraTB.py (FormattedTB.__init__): Changed | |
3011 | 'Verbose_novars' to 'Context' and made it the new default. It's a |
|
3015 | 'Verbose_novars' to 'Context' and made it the new default. It's a | |
3012 | bit more readable and also safer than verbose. |
|
3016 | bit more readable and also safer than verbose. | |
3013 |
|
3017 | |||
3014 | * IPython/PyColorize.py (Parser.__call__): Fixed coloring of |
|
3018 | * IPython/PyColorize.py (Parser.__call__): Fixed coloring of | |
3015 | triple-quoted strings. |
|
3019 | triple-quoted strings. | |
3016 |
|
3020 | |||
3017 | * IPython/OInspect.py (__all__): new module exposing the object |
|
3021 | * IPython/OInspect.py (__all__): new module exposing the object | |
3018 | introspection facilities. Now the corresponding magics are dummy |
|
3022 | introspection facilities. Now the corresponding magics are dummy | |
3019 | wrappers around this. Having this module will make it much easier |
|
3023 | wrappers around this. Having this module will make it much easier | |
3020 | to put these functions into our modified pdb. |
|
3024 | to put these functions into our modified pdb. | |
3021 | This new object inspector system uses the new colorizing module, |
|
3025 | This new object inspector system uses the new colorizing module, | |
3022 | so source code and other things are nicely syntax highlighted. |
|
3026 | so source code and other things are nicely syntax highlighted. | |
3023 |
|
3027 | |||
3024 | 2002-05-18 Fernando Perez <fperez@colorado.edu> |
|
3028 | 2002-05-18 Fernando Perez <fperez@colorado.edu> | |
3025 |
|
3029 | |||
3026 | * IPython/ColorANSI.py: Split the coloring tools into a separate |
|
3030 | * IPython/ColorANSI.py: Split the coloring tools into a separate | |
3027 | module so I can use them in other code easier (they were part of |
|
3031 | module so I can use them in other code easier (they were part of | |
3028 | ultraTB). |
|
3032 | ultraTB). | |
3029 |
|
3033 | |||
3030 | 2002-05-17 Fernando Perez <fperez@colorado.edu> |
|
3034 | 2002-05-17 Fernando Perez <fperez@colorado.edu> | |
3031 |
|
3035 | |||
3032 | * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance): |
|
3036 | * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance): | |
3033 | fixed it to set the global 'g' also to the called instance, as |
|
3037 | fixed it to set the global 'g' also to the called instance, as | |
3034 | long as 'g' was still a gnuplot instance (so it doesn't overwrite |
|
3038 | long as 'g' was still a gnuplot instance (so it doesn't overwrite | |
3035 | user's 'g' variables). |
|
3039 | user's 'g' variables). | |
3036 |
|
3040 | |||
3037 | * IPython/iplib.py (InteractiveShell.__init__): Added In/Out |
|
3041 | * IPython/iplib.py (InteractiveShell.__init__): Added In/Out | |
3038 | global variables (aliases to _ih,_oh) so that users which expect |
|
3042 | global variables (aliases to _ih,_oh) so that users which expect | |
3039 | In[5] or Out[7] to work aren't unpleasantly surprised. |
|
3043 | In[5] or Out[7] to work aren't unpleasantly surprised. | |
3040 | (InputList.__getslice__): new class to allow executing slices of |
|
3044 | (InputList.__getslice__): new class to allow executing slices of | |
3041 | input history directly. Very simple class, complements the use of |
|
3045 | input history directly. Very simple class, complements the use of | |
3042 | macros. |
|
3046 | macros. | |
3043 |
|
3047 | |||
3044 | 2002-05-16 Fernando Perez <fperez@colorado.edu> |
|
3048 | 2002-05-16 Fernando Perez <fperez@colorado.edu> | |
3045 |
|
3049 | |||
3046 | * setup.py (docdirbase): make doc directory be just doc/IPython |
|
3050 | * setup.py (docdirbase): make doc directory be just doc/IPython | |
3047 | without version numbers, it will reduce clutter for users. |
|
3051 | without version numbers, it will reduce clutter for users. | |
3048 |
|
3052 | |||
3049 | * IPython/Magic.py (Magic.magic_run): Add explicit local dict to |
|
3053 | * IPython/Magic.py (Magic.magic_run): Add explicit local dict to | |
3050 | execfile call to prevent possible memory leak. See for details: |
|
3054 | execfile call to prevent possible memory leak. See for details: | |
3051 | http://mail.python.org/pipermail/python-list/2002-February/088476.html |
|
3055 | http://mail.python.org/pipermail/python-list/2002-February/088476.html | |
3052 |
|
3056 | |||
3053 | 2002-05-15 Fernando Perez <fperez@colorado.edu> |
|
3057 | 2002-05-15 Fernando Perez <fperez@colorado.edu> | |
3054 |
|
3058 | |||
3055 | * IPython/Magic.py (Magic.magic_psource): made the object |
|
3059 | * IPython/Magic.py (Magic.magic_psource): made the object | |
3056 | introspection names be more standard: pdoc, pdef, pfile and |
|
3060 | introspection names be more standard: pdoc, pdef, pfile and | |
3057 | psource. They all print/page their output, and it makes |
|
3061 | psource. They all print/page their output, and it makes | |
3058 | remembering them easier. Kept old names for compatibility as |
|
3062 | remembering them easier. Kept old names for compatibility as | |
3059 | aliases. |
|
3063 | aliases. | |
3060 |
|
3064 | |||
3061 | 2002-05-14 Fernando Perez <fperez@colorado.edu> |
|
3065 | 2002-05-14 Fernando Perez <fperez@colorado.edu> | |
3062 |
|
3066 | |||
3063 | * IPython/UserConfig/GnuplotMagic.py: I think I finally understood |
|
3067 | * IPython/UserConfig/GnuplotMagic.py: I think I finally understood | |
3064 | what the mouse problem was. The trick is to use gnuplot with temp |
|
3068 | what the mouse problem was. The trick is to use gnuplot with temp | |
3065 | files and NOT with pipes (for data communication), because having |
|
3069 | files and NOT with pipes (for data communication), because having | |
3066 | both pipes and the mouse on is bad news. |
|
3070 | both pipes and the mouse on is bad news. | |
3067 |
|
3071 | |||
3068 | 2002-05-13 Fernando Perez <fperez@colorado.edu> |
|
3072 | 2002-05-13 Fernando Perez <fperez@colorado.edu> | |
3069 |
|
3073 | |||
3070 | * IPython/Magic.py (Magic._ofind): fixed namespace order search |
|
3074 | * IPython/Magic.py (Magic._ofind): fixed namespace order search | |
3071 | bug. Information would be reported about builtins even when |
|
3075 | bug. Information would be reported about builtins even when | |
3072 | user-defined functions overrode them. |
|
3076 | user-defined functions overrode them. | |
3073 |
|
3077 | |||
3074 | 2002-05-11 Fernando Perez <fperez@colorado.edu> |
|
3078 | 2002-05-11 Fernando Perez <fperez@colorado.edu> | |
3075 |
|
3079 | |||
3076 | * IPython/__init__.py (__all__): removed FlexCompleter from |
|
3080 | * IPython/__init__.py (__all__): removed FlexCompleter from | |
3077 | __all__ so that things don't fail in platforms without readline. |
|
3081 | __all__ so that things don't fail in platforms without readline. | |
3078 |
|
3082 | |||
3079 | 2002-05-10 Fernando Perez <fperez@colorado.edu> |
|
3083 | 2002-05-10 Fernando Perez <fperez@colorado.edu> | |
3080 |
|
3084 | |||
3081 | * IPython/__init__.py (__all__): removed numutils from __all__ b/c |
|
3085 | * IPython/__init__.py (__all__): removed numutils from __all__ b/c | |
3082 | it requires Numeric, effectively making Numeric a dependency for |
|
3086 | it requires Numeric, effectively making Numeric a dependency for | |
3083 | IPython. |
|
3087 | IPython. | |
3084 |
|
3088 | |||
3085 | * Released 0.2.13 |
|
3089 | * Released 0.2.13 | |
3086 |
|
3090 | |||
3087 | * IPython/Magic.py (Magic.magic_prun): big overhaul to the |
|
3091 | * IPython/Magic.py (Magic.magic_prun): big overhaul to the | |
3088 | profiler interface. Now all the major options from the profiler |
|
3092 | profiler interface. Now all the major options from the profiler | |
3089 | module are directly supported in IPython, both for single |
|
3093 | module are directly supported in IPython, both for single | |
3090 | expressions (@prun) and for full programs (@run -p). |
|
3094 | expressions (@prun) and for full programs (@run -p). | |
3091 |
|
3095 | |||
3092 | 2002-05-09 Fernando Perez <fperez@colorado.edu> |
|
3096 | 2002-05-09 Fernando Perez <fperez@colorado.edu> | |
3093 |
|
3097 | |||
3094 | * IPython/Magic.py (Magic.magic_doc): fixed to show docstrings of |
|
3098 | * IPython/Magic.py (Magic.magic_doc): fixed to show docstrings of | |
3095 | magic properly formatted for screen. |
|
3099 | magic properly formatted for screen. | |
3096 |
|
3100 | |||
3097 | * setup.py (make_shortcut): Changed things to put pdf version in |
|
3101 | * setup.py (make_shortcut): Changed things to put pdf version in | |
3098 | doc/ instead of doc/manual (had to change lyxport a bit). |
|
3102 | doc/ instead of doc/manual (had to change lyxport a bit). | |
3099 |
|
3103 | |||
3100 | * IPython/Magic.py (Profile.string_stats): made profile runs go |
|
3104 | * IPython/Magic.py (Profile.string_stats): made profile runs go | |
3101 | through pager (they are long and a pager allows searching, saving, |
|
3105 | through pager (they are long and a pager allows searching, saving, | |
3102 | etc.) |
|
3106 | etc.) | |
3103 |
|
3107 | |||
3104 | 2002-05-08 Fernando Perez <fperez@colorado.edu> |
|
3108 | 2002-05-08 Fernando Perez <fperez@colorado.edu> | |
3105 |
|
3109 | |||
3106 | * Released 0.2.12 |
|
3110 | * Released 0.2.12 | |
3107 |
|
3111 | |||
3108 | 2002-05-06 Fernando Perez <fperez@colorado.edu> |
|
3112 | 2002-05-06 Fernando Perez <fperez@colorado.edu> | |
3109 |
|
3113 | |||
3110 | * IPython/Magic.py (Magic.magic_hist): small bug fixed (recently |
|
3114 | * IPython/Magic.py (Magic.magic_hist): small bug fixed (recently | |
3111 | introduced); 'hist n1 n2' was broken. |
|
3115 | introduced); 'hist n1 n2' was broken. | |
3112 | (Magic.magic_pdb): added optional on/off arguments to @pdb |
|
3116 | (Magic.magic_pdb): added optional on/off arguments to @pdb | |
3113 | (Magic.magic_run): added option -i to @run, which executes code in |
|
3117 | (Magic.magic_run): added option -i to @run, which executes code in | |
3114 | the IPython namespace instead of a clean one. Also added @irun as |
|
3118 | the IPython namespace instead of a clean one. Also added @irun as | |
3115 | an alias to @run -i. |
|
3119 | an alias to @run -i. | |
3116 |
|
3120 | |||
3117 | * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance): |
|
3121 | * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance): | |
3118 | fixed (it didn't really do anything, the namespaces were wrong). |
|
3122 | fixed (it didn't really do anything, the namespaces were wrong). | |
3119 |
|
3123 | |||
3120 | * IPython/Debugger.py (__init__): Added workaround for python 2.1 |
|
3124 | * IPython/Debugger.py (__init__): Added workaround for python 2.1 | |
3121 |
|
3125 | |||
3122 | * IPython/__init__.py (__all__): Fixed package namespace, now |
|
3126 | * IPython/__init__.py (__all__): Fixed package namespace, now | |
3123 | 'import IPython' does give access to IPython.<all> as |
|
3127 | 'import IPython' does give access to IPython.<all> as | |
3124 | expected. Also renamed __release__ to Release. |
|
3128 | expected. Also renamed __release__ to Release. | |
3125 |
|
3129 | |||
3126 | * IPython/Debugger.py (__license__): created new Pdb class which |
|
3130 | * IPython/Debugger.py (__license__): created new Pdb class which | |
3127 | functions like a drop-in for the normal pdb.Pdb but does NOT |
|
3131 | functions like a drop-in for the normal pdb.Pdb but does NOT | |
3128 | import readline by default. This way it doesn't muck up IPython's |
|
3132 | import readline by default. This way it doesn't muck up IPython's | |
3129 | readline handling, and now tab-completion finally works in the |
|
3133 | readline handling, and now tab-completion finally works in the | |
3130 | debugger -- sort of. It completes things globally visible, but the |
|
3134 | debugger -- sort of. It completes things globally visible, but the | |
3131 | completer doesn't track the stack as pdb walks it. That's a bit |
|
3135 | completer doesn't track the stack as pdb walks it. That's a bit | |
3132 | tricky, and I'll have to implement it later. |
|
3136 | tricky, and I'll have to implement it later. | |
3133 |
|
3137 | |||
3134 | 2002-05-05 Fernando Perez <fperez@colorado.edu> |
|
3138 | 2002-05-05 Fernando Perez <fperez@colorado.edu> | |
3135 |
|
3139 | |||
3136 | * IPython/Magic.py (Magic.magic_oinfo): fixed formatting bug for |
|
3140 | * IPython/Magic.py (Magic.magic_oinfo): fixed formatting bug for | |
3137 | magic docstrings when printed via ? (explicit \'s were being |
|
3141 | magic docstrings when printed via ? (explicit \'s were being | |
3138 | printed). |
|
3142 | printed). | |
3139 |
|
3143 | |||
3140 | * IPython/ipmaker.py (make_IPython): fixed namespace |
|
3144 | * IPython/ipmaker.py (make_IPython): fixed namespace | |
3141 | identification bug. Now variables loaded via logs or command-line |
|
3145 | identification bug. Now variables loaded via logs or command-line | |
3142 | files are recognized in the interactive namespace by @who. |
|
3146 | files are recognized in the interactive namespace by @who. | |
3143 |
|
3147 | |||
3144 | * IPython/iplib.py (InteractiveShell.safe_execfile): Fixed bug in |
|
3148 | * IPython/iplib.py (InteractiveShell.safe_execfile): Fixed bug in | |
3145 | log replay system stemming from the string form of Structs. |
|
3149 | log replay system stemming from the string form of Structs. | |
3146 |
|
3150 | |||
3147 | * IPython/Magic.py (Macro.__init__): improved macros to properly |
|
3151 | * IPython/Magic.py (Macro.__init__): improved macros to properly | |
3148 | handle magic commands in them. |
|
3152 | handle magic commands in them. | |
3149 | (Magic.magic_logstart): usernames are now expanded so 'logstart |
|
3153 | (Magic.magic_logstart): usernames are now expanded so 'logstart | |
3150 | ~/mylog' now works. |
|
3154 | ~/mylog' now works. | |
3151 |
|
3155 | |||
3152 | * IPython/iplib.py (complete): fixed bug where paths starting with |
|
3156 | * IPython/iplib.py (complete): fixed bug where paths starting with | |
3153 | '/' would be completed as magic names. |
|
3157 | '/' would be completed as magic names. | |
3154 |
|
3158 | |||
3155 | 2002-05-04 Fernando Perez <fperez@colorado.edu> |
|
3159 | 2002-05-04 Fernando Perez <fperez@colorado.edu> | |
3156 |
|
3160 | |||
3157 | * IPython/Magic.py (Magic.magic_run): added options -p and -f to |
|
3161 | * IPython/Magic.py (Magic.magic_run): added options -p and -f to | |
3158 | allow running full programs under the profiler's control. |
|
3162 | allow running full programs under the profiler's control. | |
3159 |
|
3163 | |||
3160 | * IPython/ultraTB.py (FormattedTB.__init__): Added Verbose_novars |
|
3164 | * IPython/ultraTB.py (FormattedTB.__init__): Added Verbose_novars | |
3161 | mode to report exceptions verbosely but without formatting |
|
3165 | mode to report exceptions verbosely but without formatting | |
3162 | variables. This addresses the issue of ipython 'freezing' (it's |
|
3166 | variables. This addresses the issue of ipython 'freezing' (it's | |
3163 | not frozen, but caught in an expensive formatting loop) when huge |
|
3167 | not frozen, but caught in an expensive formatting loop) when huge | |
3164 | variables are in the context of an exception. |
|
3168 | variables are in the context of an exception. | |
3165 | (VerboseTB.text): Added '--->' markers at line where exception was |
|
3169 | (VerboseTB.text): Added '--->' markers at line where exception was | |
3166 | triggered. Much clearer to read, especially in NoColor modes. |
|
3170 | triggered. Much clearer to read, especially in NoColor modes. | |
3167 |
|
3171 | |||
3168 | * IPython/Magic.py (Magic.magic_run): bugfix: -n option had been |
|
3172 | * IPython/Magic.py (Magic.magic_run): bugfix: -n option had been | |
3169 | implemented in reverse when changing to the new parse_options(). |
|
3173 | implemented in reverse when changing to the new parse_options(). | |
3170 |
|
3174 | |||
3171 | 2002-05-03 Fernando Perez <fperez@colorado.edu> |
|
3175 | 2002-05-03 Fernando Perez <fperez@colorado.edu> | |
3172 |
|
3176 | |||
3173 | * IPython/Magic.py (Magic.parse_options): new function so that |
|
3177 | * IPython/Magic.py (Magic.parse_options): new function so that | |
3174 | magics can parse options easier. |
|
3178 | magics can parse options easier. | |
3175 | (Magic.magic_prun): new function similar to profile.run(), |
|
3179 | (Magic.magic_prun): new function similar to profile.run(), | |
3176 | suggested by Chris Hart. |
|
3180 | suggested by Chris Hart. | |
3177 | (Magic.magic_cd): fixed behavior so that it only changes if |
|
3181 | (Magic.magic_cd): fixed behavior so that it only changes if | |
3178 | directory actually is in history. |
|
3182 | directory actually is in history. | |
3179 |
|
3183 | |||
3180 | * IPython/usage.py (__doc__): added information about potential |
|
3184 | * IPython/usage.py (__doc__): added information about potential | |
3181 | slowness of Verbose exception mode when there are huge data |
|
3185 | slowness of Verbose exception mode when there are huge data | |
3182 | structures to be formatted (thanks to Archie Paulson). |
|
3186 | structures to be formatted (thanks to Archie Paulson). | |
3183 |
|
3187 | |||
3184 | * IPython/ipmaker.py (make_IPython): Changed default logging |
|
3188 | * IPython/ipmaker.py (make_IPython): Changed default logging | |
3185 | (when simply called with -log) to use curr_dir/ipython.log in |
|
3189 | (when simply called with -log) to use curr_dir/ipython.log in | |
3186 | rotate mode. Fixed crash which was occuring with -log before |
|
3190 | rotate mode. Fixed crash which was occuring with -log before | |
3187 | (thanks to Jim Boyle). |
|
3191 | (thanks to Jim Boyle). | |
3188 |
|
3192 | |||
3189 | 2002-05-01 Fernando Perez <fperez@colorado.edu> |
|
3193 | 2002-05-01 Fernando Perez <fperez@colorado.edu> | |
3190 |
|
3194 | |||
3191 | * Released 0.2.11 for these fixes (mainly the ultraTB one which |
|
3195 | * Released 0.2.11 for these fixes (mainly the ultraTB one which | |
3192 | was nasty -- though somewhat of a corner case). |
|
3196 | was nasty -- though somewhat of a corner case). | |
3193 |
|
3197 | |||
3194 | * IPython/ultraTB.py (AutoFormattedTB.text): renamed __text to |
|
3198 | * IPython/ultraTB.py (AutoFormattedTB.text): renamed __text to | |
3195 | text (was a bug). |
|
3199 | text (was a bug). | |
3196 |
|
3200 | |||
3197 | 2002-04-30 Fernando Perez <fperez@colorado.edu> |
|
3201 | 2002-04-30 Fernando Perez <fperez@colorado.edu> | |
3198 |
|
3202 | |||
3199 | * IPython/UserConfig/GnuplotMagic.py (magic_gp): Minor fix to add |
|
3203 | * IPython/UserConfig/GnuplotMagic.py (magic_gp): Minor fix to add | |
3200 | a print after ^D or ^C from the user so that the In[] prompt |
|
3204 | a print after ^D or ^C from the user so that the In[] prompt | |
3201 | doesn't over-run the gnuplot one. |
|
3205 | doesn't over-run the gnuplot one. | |
3202 |
|
3206 | |||
3203 | 2002-04-29 Fernando Perez <fperez@colorado.edu> |
|
3207 | 2002-04-29 Fernando Perez <fperez@colorado.edu> | |
3204 |
|
3208 | |||
3205 | * Released 0.2.10 |
|
3209 | * Released 0.2.10 | |
3206 |
|
3210 | |||
3207 | * IPython/__release__.py (version): get date dynamically. |
|
3211 | * IPython/__release__.py (version): get date dynamically. | |
3208 |
|
3212 | |||
3209 | * Misc. documentation updates thanks to Arnd's comments. Also ran |
|
3213 | * Misc. documentation updates thanks to Arnd's comments. Also ran | |
3210 | a full spellcheck on the manual (hadn't been done in a while). |
|
3214 | a full spellcheck on the manual (hadn't been done in a while). | |
3211 |
|
3215 | |||
3212 | 2002-04-27 Fernando Perez <fperez@colorado.edu> |
|
3216 | 2002-04-27 Fernando Perez <fperez@colorado.edu> | |
3213 |
|
3217 | |||
3214 | * IPython/Magic.py (Magic.magic_logstart): Fixed bug where |
|
3218 | * IPython/Magic.py (Magic.magic_logstart): Fixed bug where | |
3215 | starting a log in mid-session would reset the input history list. |
|
3219 | starting a log in mid-session would reset the input history list. | |
3216 |
|
3220 | |||
3217 | 2002-04-26 Fernando Perez <fperez@colorado.edu> |
|
3221 | 2002-04-26 Fernando Perez <fperez@colorado.edu> | |
3218 |
|
3222 | |||
3219 | * IPython/iplib.py (InteractiveShell.wait): Fixed bug where not |
|
3223 | * IPython/iplib.py (InteractiveShell.wait): Fixed bug where not | |
3220 | all files were being included in an update. Now anything in |
|
3224 | all files were being included in an update. Now anything in | |
3221 | UserConfig that matches [A-Za-z]*.py will go (this excludes |
|
3225 | UserConfig that matches [A-Za-z]*.py will go (this excludes | |
3222 | __init__.py) |
|
3226 | __init__.py) | |
3223 |
|
3227 | |||
3224 | 2002-04-25 Fernando Perez <fperez@colorado.edu> |
|
3228 | 2002-04-25 Fernando Perez <fperez@colorado.edu> | |
3225 |
|
3229 | |||
3226 | * IPython/iplib.py (InteractiveShell.__init__): Added __IPYTHON__ |
|
3230 | * IPython/iplib.py (InteractiveShell.__init__): Added __IPYTHON__ | |
3227 | to __builtins__ so that any form of embedded or imported code can |
|
3231 | to __builtins__ so that any form of embedded or imported code can | |
3228 | test for being inside IPython. |
|
3232 | test for being inside IPython. | |
3229 |
|
3233 | |||
3230 | * IPython/UserConfig/GnuplotMagic.py: (magic_gp_set_instance): |
|
3234 | * IPython/UserConfig/GnuplotMagic.py: (magic_gp_set_instance): | |
3231 | changed to GnuplotMagic because it's now an importable module, |
|
3235 | changed to GnuplotMagic because it's now an importable module, | |
3232 | this makes the name follow that of the standard Gnuplot module. |
|
3236 | this makes the name follow that of the standard Gnuplot module. | |
3233 | GnuplotMagic can now be loaded at any time in mid-session. |
|
3237 | GnuplotMagic can now be loaded at any time in mid-session. | |
3234 |
|
3238 | |||
3235 | 2002-04-24 Fernando Perez <fperez@colorado.edu> |
|
3239 | 2002-04-24 Fernando Perez <fperez@colorado.edu> | |
3236 |
|
3240 | |||
3237 | * IPython/numutils.py: removed SIUnits. It doesn't properly set |
|
3241 | * IPython/numutils.py: removed SIUnits. It doesn't properly set | |
3238 | the globals (IPython has its own namespace) and the |
|
3242 | the globals (IPython has its own namespace) and the | |
3239 | PhysicalQuantity stuff is much better anyway. |
|
3243 | PhysicalQuantity stuff is much better anyway. | |
3240 |
|
3244 | |||
3241 | * IPython/UserConfig/example-gnuplot.py (g2): Added gnuplot |
|
3245 | * IPython/UserConfig/example-gnuplot.py (g2): Added gnuplot | |
3242 | embedding example to standard user directory for |
|
3246 | embedding example to standard user directory for | |
3243 | distribution. Also put it in the manual. |
|
3247 | distribution. Also put it in the manual. | |
3244 |
|
3248 | |||
3245 | * IPython/numutils.py (gnuplot_exec): Changed to take a gnuplot |
|
3249 | * IPython/numutils.py (gnuplot_exec): Changed to take a gnuplot | |
3246 | instance as first argument (so it doesn't rely on some obscure |
|
3250 | instance as first argument (so it doesn't rely on some obscure | |
3247 | hidden global). |
|
3251 | hidden global). | |
3248 |
|
3252 | |||
3249 | * IPython/UserConfig/ipythonrc.py: put () back in accepted |
|
3253 | * IPython/UserConfig/ipythonrc.py: put () back in accepted | |
3250 | delimiters. While it prevents ().TAB from working, it allows |
|
3254 | delimiters. While it prevents ().TAB from working, it allows | |
3251 | completions in open (... expressions. This is by far a more common |
|
3255 | completions in open (... expressions. This is by far a more common | |
3252 | case. |
|
3256 | case. | |
3253 |
|
3257 | |||
3254 | 2002-04-23 Fernando Perez <fperez@colorado.edu> |
|
3258 | 2002-04-23 Fernando Perez <fperez@colorado.edu> | |
3255 |
|
3259 | |||
3256 | * IPython/Extensions/InterpreterPasteInput.py: new |
|
3260 | * IPython/Extensions/InterpreterPasteInput.py: new | |
3257 | syntax-processing module for pasting lines with >>> or ... at the |
|
3261 | syntax-processing module for pasting lines with >>> or ... at the | |
3258 | start. |
|
3262 | start. | |
3259 |
|
3263 | |||
3260 | * IPython/Extensions/PhysicalQ_Interactive.py |
|
3264 | * IPython/Extensions/PhysicalQ_Interactive.py | |
3261 | (PhysicalQuantityInteractive.__int__): fixed to work with either |
|
3265 | (PhysicalQuantityInteractive.__int__): fixed to work with either | |
3262 | Numeric or math. |
|
3266 | Numeric or math. | |
3263 |
|
3267 | |||
3264 | * IPython/UserConfig/ipythonrc-numeric.py: reorganized the |
|
3268 | * IPython/UserConfig/ipythonrc-numeric.py: reorganized the | |
3265 | provided profiles. Now we have: |
|
3269 | provided profiles. Now we have: | |
3266 | -math -> math module as * and cmath with its own namespace. |
|
3270 | -math -> math module as * and cmath with its own namespace. | |
3267 | -numeric -> Numeric as *, plus gnuplot & grace |
|
3271 | -numeric -> Numeric as *, plus gnuplot & grace | |
3268 | -physics -> same as before |
|
3272 | -physics -> same as before | |
3269 |
|
3273 | |||
3270 | * IPython/Magic.py (Magic.magic_magic): Fixed bug where |
|
3274 | * IPython/Magic.py (Magic.magic_magic): Fixed bug where | |
3271 | user-defined magics wouldn't be found by @magic if they were |
|
3275 | user-defined magics wouldn't be found by @magic if they were | |
3272 | defined as class methods. Also cleaned up the namespace search |
|
3276 | defined as class methods. Also cleaned up the namespace search | |
3273 | logic and the string building (to use %s instead of many repeated |
|
3277 | logic and the string building (to use %s instead of many repeated | |
3274 | string adds). |
|
3278 | string adds). | |
3275 |
|
3279 | |||
3276 | * IPython/UserConfig/example-magic.py (magic_foo): updated example |
|
3280 | * IPython/UserConfig/example-magic.py (magic_foo): updated example | |
3277 | of user-defined magics to operate with class methods (cleaner, in |
|
3281 | of user-defined magics to operate with class methods (cleaner, in | |
3278 | line with the gnuplot code). |
|
3282 | line with the gnuplot code). | |
3279 |
|
3283 | |||
3280 | 2002-04-22 Fernando Perez <fperez@colorado.edu> |
|
3284 | 2002-04-22 Fernando Perez <fperez@colorado.edu> | |
3281 |
|
3285 | |||
3282 | * setup.py: updated dependency list so that manual is updated when |
|
3286 | * setup.py: updated dependency list so that manual is updated when | |
3283 | all included files change. |
|
3287 | all included files change. | |
3284 |
|
3288 | |||
3285 | * IPython/ipmaker.py (make_IPython): Fixed bug which was ignoring |
|
3289 | * IPython/ipmaker.py (make_IPython): Fixed bug which was ignoring | |
3286 | the delimiter removal option (the fix is ugly right now). |
|
3290 | the delimiter removal option (the fix is ugly right now). | |
3287 |
|
3291 | |||
3288 | * IPython/UserConfig/ipythonrc-physics.py: simplified not to load |
|
3292 | * IPython/UserConfig/ipythonrc-physics.py: simplified not to load | |
3289 | all of the math profile (quicker loading, no conflict between |
|
3293 | all of the math profile (quicker loading, no conflict between | |
3290 | g-9.8 and g-gnuplot). |
|
3294 | g-9.8 and g-gnuplot). | |
3291 |
|
3295 | |||
3292 | * IPython/CrashHandler.py (CrashHandler.__call__): changed default |
|
3296 | * IPython/CrashHandler.py (CrashHandler.__call__): changed default | |
3293 | name of post-mortem files to IPython_crash_report.txt. |
|
3297 | name of post-mortem files to IPython_crash_report.txt. | |
3294 |
|
3298 | |||
3295 | * Cleanup/update of the docs. Added all the new readline info and |
|
3299 | * Cleanup/update of the docs. Added all the new readline info and | |
3296 | formatted all lists as 'real lists'. |
|
3300 | formatted all lists as 'real lists'. | |
3297 |
|
3301 | |||
3298 | * IPython/ipmaker.py (make_IPython): removed now-obsolete |
|
3302 | * IPython/ipmaker.py (make_IPython): removed now-obsolete | |
3299 | tab-completion options, since the full readline parse_and_bind is |
|
3303 | tab-completion options, since the full readline parse_and_bind is | |
3300 | now accessible. |
|
3304 | now accessible. | |
3301 |
|
3305 | |||
3302 | * IPython/iplib.py (InteractiveShell.init_readline): Changed |
|
3306 | * IPython/iplib.py (InteractiveShell.init_readline): Changed | |
3303 | handling of readline options. Now users can specify any string to |
|
3307 | handling of readline options. Now users can specify any string to | |
3304 | be passed to parse_and_bind(), as well as the delimiters to be |
|
3308 | be passed to parse_and_bind(), as well as the delimiters to be | |
3305 | removed. |
|
3309 | removed. | |
3306 | (InteractiveShell.__init__): Added __name__ to the global |
|
3310 | (InteractiveShell.__init__): Added __name__ to the global | |
3307 | namespace so that things like Itpl which rely on its existence |
|
3311 | namespace so that things like Itpl which rely on its existence | |
3308 | don't crash. |
|
3312 | don't crash. | |
3309 | (InteractiveShell._prefilter): Defined the default with a _ so |
|
3313 | (InteractiveShell._prefilter): Defined the default with a _ so | |
3310 | that prefilter() is easier to override, while the default one |
|
3314 | that prefilter() is easier to override, while the default one | |
3311 | remains available. |
|
3315 | remains available. | |
3312 |
|
3316 | |||
3313 | 2002-04-18 Fernando Perez <fperez@colorado.edu> |
|
3317 | 2002-04-18 Fernando Perez <fperez@colorado.edu> | |
3314 |
|
3318 | |||
3315 | * Added information about pdb in the docs. |
|
3319 | * Added information about pdb in the docs. | |
3316 |
|
3320 | |||
3317 | 2002-04-17 Fernando Perez <fperez@colorado.edu> |
|
3321 | 2002-04-17 Fernando Perez <fperez@colorado.edu> | |
3318 |
|
3322 | |||
3319 | * IPython/ipmaker.py (make_IPython): added rc_override option to |
|
3323 | * IPython/ipmaker.py (make_IPython): added rc_override option to | |
3320 | allow passing config options at creation time which may override |
|
3324 | allow passing config options at creation time which may override | |
3321 | anything set in the config files or command line. This is |
|
3325 | anything set in the config files or command line. This is | |
3322 | particularly useful for configuring embedded instances. |
|
3326 | particularly useful for configuring embedded instances. | |
3323 |
|
3327 | |||
3324 | 2002-04-15 Fernando Perez <fperez@colorado.edu> |
|
3328 | 2002-04-15 Fernando Perez <fperez@colorado.edu> | |
3325 |
|
3329 | |||
3326 | * IPython/Logger.py (Logger.log): Fixed a nasty bug which could |
|
3330 | * IPython/Logger.py (Logger.log): Fixed a nasty bug which could | |
3327 | crash embedded instances because of the input cache falling out of |
|
3331 | crash embedded instances because of the input cache falling out of | |
3328 | sync with the output counter. |
|
3332 | sync with the output counter. | |
3329 |
|
3333 | |||
3330 | * IPython/Shell.py (IPythonShellEmbed.__init__): added a debug |
|
3334 | * IPython/Shell.py (IPythonShellEmbed.__init__): added a debug | |
3331 | mode which calls pdb after an uncaught exception in IPython itself. |
|
3335 | mode which calls pdb after an uncaught exception in IPython itself. | |
3332 |
|
3336 | |||
3333 | 2002-04-14 Fernando Perez <fperez@colorado.edu> |
|
3337 | 2002-04-14 Fernando Perez <fperez@colorado.edu> | |
3334 |
|
3338 | |||
3335 | * IPython/iplib.py (InteractiveShell.showtraceback): pdb mucks up |
|
3339 | * IPython/iplib.py (InteractiveShell.showtraceback): pdb mucks up | |
3336 | readline, fix it back after each call. |
|
3340 | readline, fix it back after each call. | |
3337 |
|
3341 | |||
3338 | * IPython/ultraTB.py (AutoFormattedTB.__text): made text a private |
|
3342 | * IPython/ultraTB.py (AutoFormattedTB.__text): made text a private | |
3339 | method to force all access via __call__(), which guarantees that |
|
3343 | method to force all access via __call__(), which guarantees that | |
3340 | traceback references are properly deleted. |
|
3344 | traceback references are properly deleted. | |
3341 |
|
3345 | |||
3342 | * IPython/Prompts.py (CachedOutput._display): minor fixes to |
|
3346 | * IPython/Prompts.py (CachedOutput._display): minor fixes to | |
3343 | improve printing when pprint is in use. |
|
3347 | improve printing when pprint is in use. | |
3344 |
|
3348 | |||
3345 | 2002-04-13 Fernando Perez <fperez@colorado.edu> |
|
3349 | 2002-04-13 Fernando Perez <fperez@colorado.edu> | |
3346 |
|
3350 | |||
3347 | * IPython/Shell.py (IPythonShellEmbed.__call__): SystemExit |
|
3351 | * IPython/Shell.py (IPythonShellEmbed.__call__): SystemExit | |
3348 | exceptions aren't caught anymore. If the user triggers one, he |
|
3352 | exceptions aren't caught anymore. If the user triggers one, he | |
3349 | should know why he's doing it and it should go all the way up, |
|
3353 | should know why he's doing it and it should go all the way up, | |
3350 | just like any other exception. So now @abort will fully kill the |
|
3354 | just like any other exception. So now @abort will fully kill the | |
3351 | embedded interpreter and the embedding code (unless that happens |
|
3355 | embedded interpreter and the embedding code (unless that happens | |
3352 | to catch SystemExit). |
|
3356 | to catch SystemExit). | |
3353 |
|
3357 | |||
3354 | * IPython/ultraTB.py (VerboseTB.__init__): added a call_pdb flag |
|
3358 | * IPython/ultraTB.py (VerboseTB.__init__): added a call_pdb flag | |
3355 | and a debugger() method to invoke the interactive pdb debugger |
|
3359 | and a debugger() method to invoke the interactive pdb debugger | |
3356 | after printing exception information. Also added the corresponding |
|
3360 | after printing exception information. Also added the corresponding | |
3357 | -pdb option and @pdb magic to control this feature, and updated |
|
3361 | -pdb option and @pdb magic to control this feature, and updated | |
3358 | the docs. After a suggestion from Christopher Hart |
|
3362 | the docs. After a suggestion from Christopher Hart | |
3359 | (hart-AT-caltech.edu). |
|
3363 | (hart-AT-caltech.edu). | |
3360 |
|
3364 | |||
3361 | 2002-04-12 Fernando Perez <fperez@colorado.edu> |
|
3365 | 2002-04-12 Fernando Perez <fperez@colorado.edu> | |
3362 |
|
3366 | |||
3363 | * IPython/Shell.py (IPythonShellEmbed.__init__): modified to use |
|
3367 | * IPython/Shell.py (IPythonShellEmbed.__init__): modified to use | |
3364 | the exception handlers defined by the user (not the CrashHandler) |
|
3368 | the exception handlers defined by the user (not the CrashHandler) | |
3365 | so that user exceptions don't trigger an ipython bug report. |
|
3369 | so that user exceptions don't trigger an ipython bug report. | |
3366 |
|
3370 | |||
3367 | * IPython/ultraTB.py (ColorTB.__init__): made the color scheme |
|
3371 | * IPython/ultraTB.py (ColorTB.__init__): made the color scheme | |
3368 | configurable (it should have always been so). |
|
3372 | configurable (it should have always been so). | |
3369 |
|
3373 | |||
3370 | 2002-03-26 Fernando Perez <fperez@colorado.edu> |
|
3374 | 2002-03-26 Fernando Perez <fperez@colorado.edu> | |
3371 |
|
3375 | |||
3372 | * IPython/Shell.py (IPythonShellEmbed.__call__): many changes here |
|
3376 | * IPython/Shell.py (IPythonShellEmbed.__call__): many changes here | |
3373 | and there to fix embedding namespace issues. This should all be |
|
3377 | and there to fix embedding namespace issues. This should all be | |
3374 | done in a more elegant way. |
|
3378 | done in a more elegant way. | |
3375 |
|
3379 | |||
3376 | 2002-03-25 Fernando Perez <fperez@colorado.edu> |
|
3380 | 2002-03-25 Fernando Perez <fperez@colorado.edu> | |
3377 |
|
3381 | |||
3378 | * IPython/genutils.py (get_home_dir): Try to make it work under |
|
3382 | * IPython/genutils.py (get_home_dir): Try to make it work under | |
3379 | win9x also. |
|
3383 | win9x also. | |
3380 |
|
3384 | |||
3381 | 2002-03-20 Fernando Perez <fperez@colorado.edu> |
|
3385 | 2002-03-20 Fernando Perez <fperez@colorado.edu> | |
3382 |
|
3386 | |||
3383 | * IPython/Shell.py (IPythonShellEmbed.__init__): leave |
|
3387 | * IPython/Shell.py (IPythonShellEmbed.__init__): leave | |
3384 | sys.displayhook untouched upon __init__. |
|
3388 | sys.displayhook untouched upon __init__. | |
3385 |
|
3389 | |||
3386 | 2002-03-19 Fernando Perez <fperez@colorado.edu> |
|
3390 | 2002-03-19 Fernando Perez <fperez@colorado.edu> | |
3387 |
|
3391 | |||
3388 | * Released 0.2.9 (for embedding bug, basically). |
|
3392 | * Released 0.2.9 (for embedding bug, basically). | |
3389 |
|
3393 | |||
3390 | * IPython/Shell.py (IPythonShellEmbed.__call__): Trap SystemExit |
|
3394 | * IPython/Shell.py (IPythonShellEmbed.__call__): Trap SystemExit | |
3391 | exceptions so that enclosing shell's state can be restored. |
|
3395 | exceptions so that enclosing shell's state can be restored. | |
3392 |
|
3396 | |||
3393 | * Changed magic_gnuplot.py to magic-gnuplot.py to standardize |
|
3397 | * Changed magic_gnuplot.py to magic-gnuplot.py to standardize | |
3394 | naming conventions in the .ipython/ dir. |
|
3398 | naming conventions in the .ipython/ dir. | |
3395 |
|
3399 | |||
3396 | * IPython/iplib.py (InteractiveShell.init_readline): removed '-' |
|
3400 | * IPython/iplib.py (InteractiveShell.init_readline): removed '-' | |
3397 | from delimiters list so filenames with - in them get expanded. |
|
3401 | from delimiters list so filenames with - in them get expanded. | |
3398 |
|
3402 | |||
3399 | * IPython/Shell.py (IPythonShellEmbed.__call__): fixed bug with |
|
3403 | * IPython/Shell.py (IPythonShellEmbed.__call__): fixed bug with | |
3400 | sys.displayhook not being properly restored after an embedded call. |
|
3404 | sys.displayhook not being properly restored after an embedded call. | |
3401 |
|
3405 | |||
3402 | 2002-03-18 Fernando Perez <fperez@colorado.edu> |
|
3406 | 2002-03-18 Fernando Perez <fperez@colorado.edu> | |
3403 |
|
3407 | |||
3404 | * Released 0.2.8 |
|
3408 | * Released 0.2.8 | |
3405 |
|
3409 | |||
3406 | * IPython/iplib.py (InteractiveShell.user_setup): fixed bug where |
|
3410 | * IPython/iplib.py (InteractiveShell.user_setup): fixed bug where | |
3407 | some files weren't being included in a -upgrade. |
|
3411 | some files weren't being included in a -upgrade. | |
3408 | (InteractiveShell.init_readline): Added 'set show-all-if-ambiguous |
|
3412 | (InteractiveShell.init_readline): Added 'set show-all-if-ambiguous | |
3409 | on' so that the first tab completes. |
|
3413 | on' so that the first tab completes. | |
3410 | (InteractiveShell.handle_magic): fixed bug with spaces around |
|
3414 | (InteractiveShell.handle_magic): fixed bug with spaces around | |
3411 | quotes breaking many magic commands. |
|
3415 | quotes breaking many magic commands. | |
3412 |
|
3416 | |||
3413 | * setup.py: added note about ignoring the syntax error messages at |
|
3417 | * setup.py: added note about ignoring the syntax error messages at | |
3414 | installation. |
|
3418 | installation. | |
3415 |
|
3419 | |||
3416 | * IPython/UserConfig/magic_gnuplot.py (magic_gp): finished |
|
3420 | * IPython/UserConfig/magic_gnuplot.py (magic_gp): finished | |
3417 | streamlining the gnuplot interface, now there's only one magic @gp. |
|
3421 | streamlining the gnuplot interface, now there's only one magic @gp. | |
3418 |
|
3422 | |||
3419 | 2002-03-17 Fernando Perez <fperez@colorado.edu> |
|
3423 | 2002-03-17 Fernando Perez <fperez@colorado.edu> | |
3420 |
|
3424 | |||
3421 | * IPython/UserConfig/magic_gnuplot.py: new name for the |
|
3425 | * IPython/UserConfig/magic_gnuplot.py: new name for the | |
3422 | example-magic_pm.py file. Much enhanced system, now with a shell |
|
3426 | example-magic_pm.py file. Much enhanced system, now with a shell | |
3423 | for communicating directly with gnuplot, one command at a time. |
|
3427 | for communicating directly with gnuplot, one command at a time. | |
3424 |
|
3428 | |||
3425 | * IPython/Magic.py (Magic.magic_run): added option -n to prevent |
|
3429 | * IPython/Magic.py (Magic.magic_run): added option -n to prevent | |
3426 | setting __name__=='__main__'. |
|
3430 | setting __name__=='__main__'. | |
3427 |
|
3431 | |||
3428 | * IPython/UserConfig/example-magic_pm.py (magic_pm): Added |
|
3432 | * IPython/UserConfig/example-magic_pm.py (magic_pm): Added | |
3429 | mini-shell for accessing gnuplot from inside ipython. Should |
|
3433 | mini-shell for accessing gnuplot from inside ipython. Should | |
3430 | extend it later for grace access too. Inspired by Arnd's |
|
3434 | extend it later for grace access too. Inspired by Arnd's | |
3431 | suggestion. |
|
3435 | suggestion. | |
3432 |
|
3436 | |||
3433 | * IPython/iplib.py (InteractiveShell.handle_magic): fixed bug when |
|
3437 | * IPython/iplib.py (InteractiveShell.handle_magic): fixed bug when | |
3434 | calling magic functions with () in their arguments. Thanks to Arnd |
|
3438 | calling magic functions with () in their arguments. Thanks to Arnd | |
3435 | Baecker for pointing this to me. |
|
3439 | Baecker for pointing this to me. | |
3436 |
|
3440 | |||
3437 | * IPython/numutils.py (sum_flat): fixed bug. Would recurse |
|
3441 | * IPython/numutils.py (sum_flat): fixed bug. Would recurse | |
3438 | infinitely for integer or complex arrays (only worked with floats). |
|
3442 | infinitely for integer or complex arrays (only worked with floats). | |
3439 |
|
3443 | |||
3440 | 2002-03-16 Fernando Perez <fperez@colorado.edu> |
|
3444 | 2002-03-16 Fernando Perez <fperez@colorado.edu> | |
3441 |
|
3445 | |||
3442 | * setup.py: Merged setup and setup_windows into a single script |
|
3446 | * setup.py: Merged setup and setup_windows into a single script | |
3443 | which properly handles things for windows users. |
|
3447 | which properly handles things for windows users. | |
3444 |
|
3448 | |||
3445 | 2002-03-15 Fernando Perez <fperez@colorado.edu> |
|
3449 | 2002-03-15 Fernando Perez <fperez@colorado.edu> | |
3446 |
|
3450 | |||
3447 | * Big change to the manual: now the magics are all automatically |
|
3451 | * Big change to the manual: now the magics are all automatically | |
3448 | documented. This information is generated from their docstrings |
|
3452 | documented. This information is generated from their docstrings | |
3449 | and put in a latex file included by the manual lyx file. This way |
|
3453 | and put in a latex file included by the manual lyx file. This way | |
3450 | we get always up to date information for the magics. The manual |
|
3454 | we get always up to date information for the magics. The manual | |
3451 | now also has proper version information, also auto-synced. |
|
3455 | now also has proper version information, also auto-synced. | |
3452 |
|
3456 | |||
3453 | For this to work, an undocumented --magic_docstrings option was added. |
|
3457 | For this to work, an undocumented --magic_docstrings option was added. | |
3454 |
|
3458 | |||
3455 | 2002-03-13 Fernando Perez <fperez@colorado.edu> |
|
3459 | 2002-03-13 Fernando Perez <fperez@colorado.edu> | |
3456 |
|
3460 | |||
3457 | * IPython/ultraTB.py (TermColors): fixed problem with dark colors |
|
3461 | * IPython/ultraTB.py (TermColors): fixed problem with dark colors | |
3458 | under CDE terminals. An explicit ;2 color reset is needed in the escapes. |
|
3462 | under CDE terminals. An explicit ;2 color reset is needed in the escapes. | |
3459 |
|
3463 | |||
3460 | 2002-03-12 Fernando Perez <fperez@colorado.edu> |
|
3464 | 2002-03-12 Fernando Perez <fperez@colorado.edu> | |
3461 |
|
3465 | |||
3462 | * IPython/ultraTB.py (TermColors): changed color escapes again to |
|
3466 | * IPython/ultraTB.py (TermColors): changed color escapes again to | |
3463 | fix the (old, reintroduced) line-wrapping bug. Basically, if |
|
3467 | fix the (old, reintroduced) line-wrapping bug. Basically, if | |
3464 | \001..\002 aren't given in the color escapes, lines get wrapped |
|
3468 | \001..\002 aren't given in the color escapes, lines get wrapped | |
3465 | weirdly. But giving those screws up old xterms and emacs terms. So |
|
3469 | weirdly. But giving those screws up old xterms and emacs terms. So | |
3466 | I added some logic for emacs terms to be ok, but I can't identify old |
|
3470 | I added some logic for emacs terms to be ok, but I can't identify old | |
3467 | xterms separately ($TERM=='xterm' for many terminals, like konsole). |
|
3471 | xterms separately ($TERM=='xterm' for many terminals, like konsole). | |
3468 |
|
3472 | |||
3469 | 2002-03-10 Fernando Perez <fperez@colorado.edu> |
|
3473 | 2002-03-10 Fernando Perez <fperez@colorado.edu> | |
3470 |
|
3474 | |||
3471 | * IPython/usage.py (__doc__): Various documentation cleanups and |
|
3475 | * IPython/usage.py (__doc__): Various documentation cleanups and | |
3472 | updates, both in usage docstrings and in the manual. |
|
3476 | updates, both in usage docstrings and in the manual. | |
3473 |
|
3477 | |||
3474 | * IPython/Prompts.py (CachedOutput.set_colors): cleanups for |
|
3478 | * IPython/Prompts.py (CachedOutput.set_colors): cleanups for | |
3475 | handling of caching. Set minimum acceptabe value for having a |
|
3479 | handling of caching. Set minimum acceptabe value for having a | |
3476 | cache at 20 values. |
|
3480 | cache at 20 values. | |
3477 |
|
3481 | |||
3478 | * IPython/iplib.py (InteractiveShell.user_setup): moved the |
|
3482 | * IPython/iplib.py (InteractiveShell.user_setup): moved the | |
3479 | install_first_time function to a method, renamed it and added an |
|
3483 | install_first_time function to a method, renamed it and added an | |
3480 | 'upgrade' mode. Now people can update their config directory with |
|
3484 | 'upgrade' mode. Now people can update their config directory with | |
3481 | a simple command line switch (-upgrade, also new). |
|
3485 | a simple command line switch (-upgrade, also new). | |
3482 |
|
3486 | |||
3483 | * IPython/Magic.py (Magic.magic_pfile): Made @pfile an alias to |
|
3487 | * IPython/Magic.py (Magic.magic_pfile): Made @pfile an alias to | |
3484 | @file (convenient for automagic users under Python >= 2.2). |
|
3488 | @file (convenient for automagic users under Python >= 2.2). | |
3485 | Removed @files (it seemed more like a plural than an abbrev. of |
|
3489 | Removed @files (it seemed more like a plural than an abbrev. of | |
3486 | 'file show'). |
|
3490 | 'file show'). | |
3487 |
|
3491 | |||
3488 | * IPython/iplib.py (install_first_time): Fixed crash if there were |
|
3492 | * IPython/iplib.py (install_first_time): Fixed crash if there were | |
3489 | backup files ('~') in .ipython/ install directory. |
|
3493 | backup files ('~') in .ipython/ install directory. | |
3490 |
|
3494 | |||
3491 | * IPython/ipmaker.py (make_IPython): fixes for new prompt |
|
3495 | * IPython/ipmaker.py (make_IPython): fixes for new prompt | |
3492 | system. Things look fine, but these changes are fairly |
|
3496 | system. Things look fine, but these changes are fairly | |
3493 | intrusive. Test them for a few days. |
|
3497 | intrusive. Test them for a few days. | |
3494 |
|
3498 | |||
3495 | * IPython/Prompts.py (CachedOutput.__init__): Massive rewrite of |
|
3499 | * IPython/Prompts.py (CachedOutput.__init__): Massive rewrite of | |
3496 | the prompts system. Now all in/out prompt strings are user |
|
3500 | the prompts system. Now all in/out prompt strings are user | |
3497 | controllable. This is particularly useful for embedding, as one |
|
3501 | controllable. This is particularly useful for embedding, as one | |
3498 | can tag embedded instances with particular prompts. |
|
3502 | can tag embedded instances with particular prompts. | |
3499 |
|
3503 | |||
3500 | Also removed global use of sys.ps1/2, which now allows nested |
|
3504 | Also removed global use of sys.ps1/2, which now allows nested | |
3501 | embeddings without any problems. Added command-line options for |
|
3505 | embeddings without any problems. Added command-line options for | |
3502 | the prompt strings. |
|
3506 | the prompt strings. | |
3503 |
|
3507 | |||
3504 | 2002-03-08 Fernando Perez <fperez@colorado.edu> |
|
3508 | 2002-03-08 Fernando Perez <fperez@colorado.edu> | |
3505 |
|
3509 | |||
3506 | * IPython/UserConfig/example-embed-short.py (ipshell): added |
|
3510 | * IPython/UserConfig/example-embed-short.py (ipshell): added | |
3507 | example file with the bare minimum code for embedding. |
|
3511 | example file with the bare minimum code for embedding. | |
3508 |
|
3512 | |||
3509 | * IPython/Shell.py (IPythonShellEmbed.set_dummy_mode): added |
|
3513 | * IPython/Shell.py (IPythonShellEmbed.set_dummy_mode): added | |
3510 | functionality for the embeddable shell to be activated/deactivated |
|
3514 | functionality for the embeddable shell to be activated/deactivated | |
3511 | either globally or at each call. |
|
3515 | either globally or at each call. | |
3512 |
|
3516 | |||
3513 | * IPython/Prompts.py (Prompt1.auto_rewrite): Fixes the problem of |
|
3517 | * IPython/Prompts.py (Prompt1.auto_rewrite): Fixes the problem of | |
3514 | rewriting the prompt with '--->' for auto-inputs with proper |
|
3518 | rewriting the prompt with '--->' for auto-inputs with proper | |
3515 | coloring. Now the previous UGLY hack in handle_auto() is gone, and |
|
3519 | coloring. Now the previous UGLY hack in handle_auto() is gone, and | |
3516 | this is handled by the prompts class itself, as it should. |
|
3520 | this is handled by the prompts class itself, as it should. | |
3517 |
|
3521 | |||
3518 | 2002-03-05 Fernando Perez <fperez@colorado.edu> |
|
3522 | 2002-03-05 Fernando Perez <fperez@colorado.edu> | |
3519 |
|
3523 | |||
3520 | * IPython/Magic.py (Magic.magic_logstart): Changed @log to |
|
3524 | * IPython/Magic.py (Magic.magic_logstart): Changed @log to | |
3521 | @logstart to avoid name clashes with the math log function. |
|
3525 | @logstart to avoid name clashes with the math log function. | |
3522 |
|
3526 | |||
3523 | * Big updates to X/Emacs section of the manual. |
|
3527 | * Big updates to X/Emacs section of the manual. | |
3524 |
|
3528 | |||
3525 | * Removed ipython_emacs. Milan explained to me how to pass |
|
3529 | * Removed ipython_emacs. Milan explained to me how to pass | |
3526 | arguments to ipython through Emacs. Some day I'm going to end up |
|
3530 | arguments to ipython through Emacs. Some day I'm going to end up | |
3527 | learning some lisp... |
|
3531 | learning some lisp... | |
3528 |
|
3532 | |||
3529 | 2002-03-04 Fernando Perez <fperez@colorado.edu> |
|
3533 | 2002-03-04 Fernando Perez <fperez@colorado.edu> | |
3530 |
|
3534 | |||
3531 | * IPython/ipython_emacs: Created script to be used as the |
|
3535 | * IPython/ipython_emacs: Created script to be used as the | |
3532 | py-python-command Emacs variable so we can pass IPython |
|
3536 | py-python-command Emacs variable so we can pass IPython | |
3533 | parameters. I can't figure out how to tell Emacs directly to pass |
|
3537 | parameters. I can't figure out how to tell Emacs directly to pass | |
3534 | parameters to IPython, so a dummy shell script will do it. |
|
3538 | parameters to IPython, so a dummy shell script will do it. | |
3535 |
|
3539 | |||
3536 | Other enhancements made for things to work better under Emacs' |
|
3540 | Other enhancements made for things to work better under Emacs' | |
3537 | various types of terminals. Many thanks to Milan Zamazal |
|
3541 | various types of terminals. Many thanks to Milan Zamazal | |
3538 | <pdm-AT-zamazal.org> for all the suggestions and pointers. |
|
3542 | <pdm-AT-zamazal.org> for all the suggestions and pointers. | |
3539 |
|
3543 | |||
3540 | 2002-03-01 Fernando Perez <fperez@colorado.edu> |
|
3544 | 2002-03-01 Fernando Perez <fperez@colorado.edu> | |
3541 |
|
3545 | |||
3542 | * IPython/ipmaker.py (make_IPython): added a --readline! option so |
|
3546 | * IPython/ipmaker.py (make_IPython): added a --readline! option so | |
3543 | that loading of readline is now optional. This gives better |
|
3547 | that loading of readline is now optional. This gives better | |
3544 | control to emacs users. |
|
3548 | control to emacs users. | |
3545 |
|
3549 | |||
3546 | * IPython/ultraTB.py (__date__): Modified color escape sequences |
|
3550 | * IPython/ultraTB.py (__date__): Modified color escape sequences | |
3547 | and now things work fine under xterm and in Emacs' term buffers |
|
3551 | and now things work fine under xterm and in Emacs' term buffers | |
3548 | (though not shell ones). Well, in emacs you get colors, but all |
|
3552 | (though not shell ones). Well, in emacs you get colors, but all | |
3549 | seem to be 'light' colors (no difference between dark and light |
|
3553 | seem to be 'light' colors (no difference between dark and light | |
3550 | ones). But the garbage chars are gone, and also in xterms. It |
|
3554 | ones). But the garbage chars are gone, and also in xterms. It | |
3551 | seems that now I'm using 'cleaner' ansi sequences. |
|
3555 | seems that now I'm using 'cleaner' ansi sequences. | |
3552 |
|
3556 | |||
3553 | 2002-02-21 Fernando Perez <fperez@colorado.edu> |
|
3557 | 2002-02-21 Fernando Perez <fperez@colorado.edu> | |
3554 |
|
3558 | |||
3555 | * Released 0.2.7 (mainly to publish the scoping fix). |
|
3559 | * Released 0.2.7 (mainly to publish the scoping fix). | |
3556 |
|
3560 | |||
3557 | * IPython/Logger.py (Logger.logstate): added. A corresponding |
|
3561 | * IPython/Logger.py (Logger.logstate): added. A corresponding | |
3558 | @logstate magic was created. |
|
3562 | @logstate magic was created. | |
3559 |
|
3563 | |||
3560 | * IPython/Magic.py: fixed nested scoping problem under Python |
|
3564 | * IPython/Magic.py: fixed nested scoping problem under Python | |
3561 | 2.1.x (automagic wasn't working). |
|
3565 | 2.1.x (automagic wasn't working). | |
3562 |
|
3566 | |||
3563 | 2002-02-20 Fernando Perez <fperez@colorado.edu> |
|
3567 | 2002-02-20 Fernando Perez <fperez@colorado.edu> | |
3564 |
|
3568 | |||
3565 | * Released 0.2.6. |
|
3569 | * Released 0.2.6. | |
3566 |
|
3570 | |||
3567 | * IPython/OutputTrap.py (OutputTrap.__init__): added a 'quiet' |
|
3571 | * IPython/OutputTrap.py (OutputTrap.__init__): added a 'quiet' | |
3568 | option so that logs can come out without any headers at all. |
|
3572 | option so that logs can come out without any headers at all. | |
3569 |
|
3573 | |||
3570 | * IPython/UserConfig/ipythonrc-scipy.py: created a profile for |
|
3574 | * IPython/UserConfig/ipythonrc-scipy.py: created a profile for | |
3571 | SciPy. |
|
3575 | SciPy. | |
3572 |
|
3576 | |||
3573 | * IPython/iplib.py (InteractiveShell.embed_mainloop): Changed so |
|
3577 | * IPython/iplib.py (InteractiveShell.embed_mainloop): Changed so | |
3574 | that embedded IPython calls don't require vars() to be explicitly |
|
3578 | that embedded IPython calls don't require vars() to be explicitly | |
3575 | passed. Now they are extracted from the caller's frame (code |
|
3579 | passed. Now they are extracted from the caller's frame (code | |
3576 | snatched from Eric Jones' weave). Added better documentation to |
|
3580 | snatched from Eric Jones' weave). Added better documentation to | |
3577 | the section on embedding and the example file. |
|
3581 | the section on embedding and the example file. | |
3578 |
|
3582 | |||
3579 | * IPython/genutils.py (page): Changed so that under emacs, it just |
|
3583 | * IPython/genutils.py (page): Changed so that under emacs, it just | |
3580 | prints the string. You can then page up and down in the emacs |
|
3584 | prints the string. You can then page up and down in the emacs | |
3581 | buffer itself. This is how the builtin help() works. |
|
3585 | buffer itself. This is how the builtin help() works. | |
3582 |
|
3586 | |||
3583 | * IPython/Prompts.py (CachedOutput.__call__): Fixed issue with |
|
3587 | * IPython/Prompts.py (CachedOutput.__call__): Fixed issue with | |
3584 | macro scoping: macros need to be executed in the user's namespace |
|
3588 | macro scoping: macros need to be executed in the user's namespace | |
3585 | to work as if they had been typed by the user. |
|
3589 | to work as if they had been typed by the user. | |
3586 |
|
3590 | |||
3587 | * IPython/Magic.py (Magic.magic_macro): Changed macros so they |
|
3591 | * IPython/Magic.py (Magic.magic_macro): Changed macros so they | |
3588 | execute automatically (no need to type 'exec...'). They then |
|
3592 | execute automatically (no need to type 'exec...'). They then | |
3589 | behave like 'true macros'. The printing system was also modified |
|
3593 | behave like 'true macros'. The printing system was also modified | |
3590 | for this to work. |
|
3594 | for this to work. | |
3591 |
|
3595 | |||
3592 | 2002-02-19 Fernando Perez <fperez@colorado.edu> |
|
3596 | 2002-02-19 Fernando Perez <fperez@colorado.edu> | |
3593 |
|
3597 | |||
3594 | * IPython/genutils.py (page_file): new function for paging files |
|
3598 | * IPython/genutils.py (page_file): new function for paging files | |
3595 | in an OS-independent way. Also necessary for file viewing to work |
|
3599 | in an OS-independent way. Also necessary for file viewing to work | |
3596 | well inside Emacs buffers. |
|
3600 | well inside Emacs buffers. | |
3597 | (page): Added checks for being in an emacs buffer. |
|
3601 | (page): Added checks for being in an emacs buffer. | |
3598 | (page): fixed bug for Windows ($TERM isn't set in Windows). Fixed |
|
3602 | (page): fixed bug for Windows ($TERM isn't set in Windows). Fixed | |
3599 | same bug in iplib. |
|
3603 | same bug in iplib. | |
3600 |
|
3604 | |||
3601 | 2002-02-18 Fernando Perez <fperez@colorado.edu> |
|
3605 | 2002-02-18 Fernando Perez <fperez@colorado.edu> | |
3602 |
|
3606 | |||
3603 | * IPython/iplib.py (InteractiveShell.init_readline): modified use |
|
3607 | * IPython/iplib.py (InteractiveShell.init_readline): modified use | |
3604 | of readline so that IPython can work inside an Emacs buffer. |
|
3608 | of readline so that IPython can work inside an Emacs buffer. | |
3605 |
|
3609 | |||
3606 | * IPython/ultraTB.py (AutoFormattedTB.__call__): some fixes to |
|
3610 | * IPython/ultraTB.py (AutoFormattedTB.__call__): some fixes to | |
3607 | method signatures (they weren't really bugs, but it looks cleaner |
|
3611 | method signatures (they weren't really bugs, but it looks cleaner | |
3608 | and keeps PyChecker happy). |
|
3612 | and keeps PyChecker happy). | |
3609 |
|
3613 | |||
3610 | * IPython/ipmaker.py (make_IPython): added hooks Struct to __IP |
|
3614 | * IPython/ipmaker.py (make_IPython): added hooks Struct to __IP | |
3611 | for implementing various user-defined hooks. Currently only |
|
3615 | for implementing various user-defined hooks. Currently only | |
3612 | display is done. |
|
3616 | display is done. | |
3613 |
|
3617 | |||
3614 | * IPython/Prompts.py (CachedOutput._display): changed display |
|
3618 | * IPython/Prompts.py (CachedOutput._display): changed display | |
3615 | functions so that they can be dynamically changed by users easily. |
|
3619 | functions so that they can be dynamically changed by users easily. | |
3616 |
|
3620 | |||
3617 | * IPython/Extensions/numeric_formats.py (num_display): added an |
|
3621 | * IPython/Extensions/numeric_formats.py (num_display): added an | |
3618 | extension for printing NumPy arrays in flexible manners. It |
|
3622 | extension for printing NumPy arrays in flexible manners. It | |
3619 | doesn't do anything yet, but all the structure is in |
|
3623 | doesn't do anything yet, but all the structure is in | |
3620 | place. Ultimately the plan is to implement output format control |
|
3624 | place. Ultimately the plan is to implement output format control | |
3621 | like in Octave. |
|
3625 | like in Octave. | |
3622 |
|
3626 | |||
3623 | * IPython/Magic.py (Magic.lsmagic): changed so that bound magic |
|
3627 | * IPython/Magic.py (Magic.lsmagic): changed so that bound magic | |
3624 | methods are found at run-time by all the automatic machinery. |
|
3628 | methods are found at run-time by all the automatic machinery. | |
3625 |
|
3629 | |||
3626 | 2002-02-17 Fernando Perez <fperez@colorado.edu> |
|
3630 | 2002-02-17 Fernando Perez <fperez@colorado.edu> | |
3627 |
|
3631 | |||
3628 | * setup_Windows.py (make_shortcut): documented. Cleaned up the |
|
3632 | * setup_Windows.py (make_shortcut): documented. Cleaned up the | |
3629 | whole file a little. |
|
3633 | whole file a little. | |
3630 |
|
3634 | |||
3631 | * ToDo: closed this document. Now there's a new_design.lyx |
|
3635 | * ToDo: closed this document. Now there's a new_design.lyx | |
3632 | document for all new ideas. Added making a pdf of it for the |
|
3636 | document for all new ideas. Added making a pdf of it for the | |
3633 | end-user distro. |
|
3637 | end-user distro. | |
3634 |
|
3638 | |||
3635 | * IPython/Logger.py (Logger.switch_log): Created this to replace |
|
3639 | * IPython/Logger.py (Logger.switch_log): Created this to replace | |
3636 | logon() and logoff(). It also fixes a nasty crash reported by |
|
3640 | logon() and logoff(). It also fixes a nasty crash reported by | |
3637 | Philip Hisley <compsys-AT-starpower.net>. Many thanks to him. |
|
3641 | Philip Hisley <compsys-AT-starpower.net>. Many thanks to him. | |
3638 |
|
3642 | |||
3639 | * IPython/iplib.py (complete): got auto-completion to work with |
|
3643 | * IPython/iplib.py (complete): got auto-completion to work with | |
3640 | automagic (I had wanted this for a long time). |
|
3644 | automagic (I had wanted this for a long time). | |
3641 |
|
3645 | |||
3642 | * IPython/Magic.py (Magic.magic_files): Added @files as an alias |
|
3646 | * IPython/Magic.py (Magic.magic_files): Added @files as an alias | |
3643 | to @file, since file() is now a builtin and clashes with automagic |
|
3647 | to @file, since file() is now a builtin and clashes with automagic | |
3644 | for @file. |
|
3648 | for @file. | |
3645 |
|
3649 | |||
3646 | * Made some new files: Prompts, CrashHandler, Magic, Logger. All |
|
3650 | * Made some new files: Prompts, CrashHandler, Magic, Logger. All | |
3647 | of this was previously in iplib, which had grown to more than 2000 |
|
3651 | of this was previously in iplib, which had grown to more than 2000 | |
3648 | lines, way too long. No new functionality, but it makes managing |
|
3652 | lines, way too long. No new functionality, but it makes managing | |
3649 | the code a bit easier. |
|
3653 | the code a bit easier. | |
3650 |
|
3654 | |||
3651 | * IPython/iplib.py (IPythonCrashHandler.__call__): Added version |
|
3655 | * IPython/iplib.py (IPythonCrashHandler.__call__): Added version | |
3652 | information to crash reports. |
|
3656 | information to crash reports. | |
3653 |
|
3657 | |||
3654 | 2002-02-12 Fernando Perez <fperez@colorado.edu> |
|
3658 | 2002-02-12 Fernando Perez <fperez@colorado.edu> | |
3655 |
|
3659 | |||
3656 | * Released 0.2.5. |
|
3660 | * Released 0.2.5. | |
3657 |
|
3661 | |||
3658 | 2002-02-11 Fernando Perez <fperez@colorado.edu> |
|
3662 | 2002-02-11 Fernando Perez <fperez@colorado.edu> | |
3659 |
|
3663 | |||
3660 | * Wrote a relatively complete Windows installer. It puts |
|
3664 | * Wrote a relatively complete Windows installer. It puts | |
3661 | everything in place, creates Start Menu entries and fixes the |
|
3665 | everything in place, creates Start Menu entries and fixes the | |
3662 | color issues. Nothing fancy, but it works. |
|
3666 | color issues. Nothing fancy, but it works. | |
3663 |
|
3667 | |||
3664 | 2002-02-10 Fernando Perez <fperez@colorado.edu> |
|
3668 | 2002-02-10 Fernando Perez <fperez@colorado.edu> | |
3665 |
|
3669 | |||
3666 | * IPython/iplib.py (InteractiveShell.safe_execfile): added an |
|
3670 | * IPython/iplib.py (InteractiveShell.safe_execfile): added an | |
3667 | os.path.expanduser() call so that we can type @run ~/myfile.py and |
|
3671 | os.path.expanduser() call so that we can type @run ~/myfile.py and | |
3668 | have thigs work as expected. |
|
3672 | have thigs work as expected. | |
3669 |
|
3673 | |||
3670 | * IPython/genutils.py (page): fixed exception handling so things |
|
3674 | * IPython/genutils.py (page): fixed exception handling so things | |
3671 | work both in Unix and Windows correctly. Quitting a pager triggers |
|
3675 | work both in Unix and Windows correctly. Quitting a pager triggers | |
3672 | an IOError/broken pipe in Unix, and in windows not finding a pager |
|
3676 | an IOError/broken pipe in Unix, and in windows not finding a pager | |
3673 | is also an IOError, so I had to actually look at the return value |
|
3677 | is also an IOError, so I had to actually look at the return value | |
3674 | of the exception, not just the exception itself. Should be ok now. |
|
3678 | of the exception, not just the exception itself. Should be ok now. | |
3675 |
|
3679 | |||
3676 | * IPython/ultraTB.py (ColorSchemeTable.set_active_scheme): |
|
3680 | * IPython/ultraTB.py (ColorSchemeTable.set_active_scheme): | |
3677 | modified to allow case-insensitive color scheme changes. |
|
3681 | modified to allow case-insensitive color scheme changes. | |
3678 |
|
3682 | |||
3679 | 2002-02-09 Fernando Perez <fperez@colorado.edu> |
|
3683 | 2002-02-09 Fernando Perez <fperez@colorado.edu> | |
3680 |
|
3684 | |||
3681 | * IPython/genutils.py (native_line_ends): new function to leave |
|
3685 | * IPython/genutils.py (native_line_ends): new function to leave | |
3682 | user config files with os-native line-endings. |
|
3686 | user config files with os-native line-endings. | |
3683 |
|
3687 | |||
3684 | * README and manual updates. |
|
3688 | * README and manual updates. | |
3685 |
|
3689 | |||
3686 | * IPython/genutils.py: fixed unicode bug: use types.StringTypes |
|
3690 | * IPython/genutils.py: fixed unicode bug: use types.StringTypes | |
3687 | instead of StringType to catch Unicode strings. |
|
3691 | instead of StringType to catch Unicode strings. | |
3688 |
|
3692 | |||
3689 | * IPython/genutils.py (filefind): fixed bug for paths with |
|
3693 | * IPython/genutils.py (filefind): fixed bug for paths with | |
3690 | embedded spaces (very common in Windows). |
|
3694 | embedded spaces (very common in Windows). | |
3691 |
|
3695 | |||
3692 | * IPython/ipmaker.py (make_IPython): added a '.ini' to the rc |
|
3696 | * IPython/ipmaker.py (make_IPython): added a '.ini' to the rc | |
3693 | files under Windows, so that they get automatically associated |
|
3697 | files under Windows, so that they get automatically associated | |
3694 | with a text editor. Windows makes it a pain to handle |
|
3698 | with a text editor. Windows makes it a pain to handle | |
3695 | extension-less files. |
|
3699 | extension-less files. | |
3696 |
|
3700 | |||
3697 | * IPython/iplib.py (InteractiveShell.init_readline): Made the |
|
3701 | * IPython/iplib.py (InteractiveShell.init_readline): Made the | |
3698 | warning about readline only occur for Posix. In Windows there's no |
|
3702 | warning about readline only occur for Posix. In Windows there's no | |
3699 | way to get readline, so why bother with the warning. |
|
3703 | way to get readline, so why bother with the warning. | |
3700 |
|
3704 | |||
3701 | * IPython/Struct.py (Struct.__str__): fixed to use self.__dict__ |
|
3705 | * IPython/Struct.py (Struct.__str__): fixed to use self.__dict__ | |
3702 | for __str__ instead of dir(self), since dir() changed in 2.2. |
|
3706 | for __str__ instead of dir(self), since dir() changed in 2.2. | |
3703 |
|
3707 | |||
3704 | * Ported to Windows! Tested on XP, I suspect it should work fine |
|
3708 | * Ported to Windows! Tested on XP, I suspect it should work fine | |
3705 | on NT/2000, but I don't think it will work on 98 et al. That |
|
3709 | on NT/2000, but I don't think it will work on 98 et al. That | |
3706 | series of Windows is such a piece of junk anyway that I won't try |
|
3710 | series of Windows is such a piece of junk anyway that I won't try | |
3707 | porting it there. The XP port was straightforward, showed a few |
|
3711 | porting it there. The XP port was straightforward, showed a few | |
3708 | bugs here and there (fixed all), in particular some string |
|
3712 | bugs here and there (fixed all), in particular some string | |
3709 | handling stuff which required considering Unicode strings (which |
|
3713 | handling stuff which required considering Unicode strings (which | |
3710 | Windows uses). This is good, but hasn't been too tested :) No |
|
3714 | Windows uses). This is good, but hasn't been too tested :) No | |
3711 | fancy installer yet, I'll put a note in the manual so people at |
|
3715 | fancy installer yet, I'll put a note in the manual so people at | |
3712 | least make manually a shortcut. |
|
3716 | least make manually a shortcut. | |
3713 |
|
3717 | |||
3714 | * IPython/iplib.py (Magic.magic_colors): Unified the color options |
|
3718 | * IPython/iplib.py (Magic.magic_colors): Unified the color options | |
3715 | into a single one, "colors". This now controls both prompt and |
|
3719 | into a single one, "colors". This now controls both prompt and | |
3716 | exception color schemes, and can be changed both at startup |
|
3720 | exception color schemes, and can be changed both at startup | |
3717 | (either via command-line switches or via ipythonrc files) and at |
|
3721 | (either via command-line switches or via ipythonrc files) and at | |
3718 | runtime, with @colors. |
|
3722 | runtime, with @colors. | |
3719 | (Magic.magic_run): renamed @prun to @run and removed the old |
|
3723 | (Magic.magic_run): renamed @prun to @run and removed the old | |
3720 | @run. The two were too similar to warrant keeping both. |
|
3724 | @run. The two were too similar to warrant keeping both. | |
3721 |
|
3725 | |||
3722 | 2002-02-03 Fernando Perez <fperez@colorado.edu> |
|
3726 | 2002-02-03 Fernando Perez <fperez@colorado.edu> | |
3723 |
|
3727 | |||
3724 | * IPython/iplib.py (install_first_time): Added comment on how to |
|
3728 | * IPython/iplib.py (install_first_time): Added comment on how to | |
3725 | configure the color options for first-time users. Put a <return> |
|
3729 | configure the color options for first-time users. Put a <return> | |
3726 | request at the end so that small-terminal users get a chance to |
|
3730 | request at the end so that small-terminal users get a chance to | |
3727 | read the startup info. |
|
3731 | read the startup info. | |
3728 |
|
3732 | |||
3729 | 2002-01-23 Fernando Perez <fperez@colorado.edu> |
|
3733 | 2002-01-23 Fernando Perez <fperez@colorado.edu> | |
3730 |
|
3734 | |||
3731 | * IPython/iplib.py (CachedOutput.update): Changed output memory |
|
3735 | * IPython/iplib.py (CachedOutput.update): Changed output memory | |
3732 | variable names from _o,_oo,_ooo,_o<n> to simply _,__,___,_<n>. For |
|
3736 | variable names from _o,_oo,_ooo,_o<n> to simply _,__,___,_<n>. For | |
3733 | input history we still use _i. Did this b/c these variable are |
|
3737 | input history we still use _i. Did this b/c these variable are | |
3734 | very commonly used in interactive work, so the less we need to |
|
3738 | very commonly used in interactive work, so the less we need to | |
3735 | type the better off we are. |
|
3739 | type the better off we are. | |
3736 | (Magic.magic_prun): updated @prun to better handle the namespaces |
|
3740 | (Magic.magic_prun): updated @prun to better handle the namespaces | |
3737 | the file will run in, including a fix for __name__ not being set |
|
3741 | the file will run in, including a fix for __name__ not being set | |
3738 | before. |
|
3742 | before. | |
3739 |
|
3743 | |||
3740 | 2002-01-20 Fernando Perez <fperez@colorado.edu> |
|
3744 | 2002-01-20 Fernando Perez <fperez@colorado.edu> | |
3741 |
|
3745 | |||
3742 | * IPython/ultraTB.py (VerboseTB.linereader): Fixed printing of |
|
3746 | * IPython/ultraTB.py (VerboseTB.linereader): Fixed printing of | |
3743 | extra garbage for Python 2.2. Need to look more carefully into |
|
3747 | extra garbage for Python 2.2. Need to look more carefully into | |
3744 | this later. |
|
3748 | this later. | |
3745 |
|
3749 | |||
3746 | 2002-01-19 Fernando Perez <fperez@colorado.edu> |
|
3750 | 2002-01-19 Fernando Perez <fperez@colorado.edu> | |
3747 |
|
3751 | |||
3748 | * IPython/iplib.py (InteractiveShell.showtraceback): fixed to |
|
3752 | * IPython/iplib.py (InteractiveShell.showtraceback): fixed to | |
3749 | display SyntaxError exceptions properly formatted when they occur |
|
3753 | display SyntaxError exceptions properly formatted when they occur | |
3750 | (they can be triggered by imported code). |
|
3754 | (they can be triggered by imported code). | |
3751 |
|
3755 | |||
3752 | 2002-01-18 Fernando Perez <fperez@colorado.edu> |
|
3756 | 2002-01-18 Fernando Perez <fperez@colorado.edu> | |
3753 |
|
3757 | |||
3754 | * IPython/iplib.py (InteractiveShell.safe_execfile): now |
|
3758 | * IPython/iplib.py (InteractiveShell.safe_execfile): now | |
3755 | SyntaxError exceptions are reported nicely formatted, instead of |
|
3759 | SyntaxError exceptions are reported nicely formatted, instead of | |
3756 | spitting out only offset information as before. |
|
3760 | spitting out only offset information as before. | |
3757 | (Magic.magic_prun): Added the @prun function for executing |
|
3761 | (Magic.magic_prun): Added the @prun function for executing | |
3758 | programs with command line args inside IPython. |
|
3762 | programs with command line args inside IPython. | |
3759 |
|
3763 | |||
3760 | 2002-01-16 Fernando Perez <fperez@colorado.edu> |
|
3764 | 2002-01-16 Fernando Perez <fperez@colorado.edu> | |
3761 |
|
3765 | |||
3762 | * IPython/iplib.py (Magic.magic_hist): Changed @hist and @dhist |
|
3766 | * IPython/iplib.py (Magic.magic_hist): Changed @hist and @dhist | |
3763 | to *not* include the last item given in a range. This brings their |
|
3767 | to *not* include the last item given in a range. This brings their | |
3764 | behavior in line with Python's slicing: |
|
3768 | behavior in line with Python's slicing: | |
3765 | a[n1:n2] -> a[n1]...a[n2-1] |
|
3769 | a[n1:n2] -> a[n1]...a[n2-1] | |
3766 | It may be a bit less convenient, but I prefer to stick to Python's |
|
3770 | It may be a bit less convenient, but I prefer to stick to Python's | |
3767 | conventions *everywhere*, so users never have to wonder. |
|
3771 | conventions *everywhere*, so users never have to wonder. | |
3768 | (Magic.magic_macro): Added @macro function to ease the creation of |
|
3772 | (Magic.magic_macro): Added @macro function to ease the creation of | |
3769 | macros. |
|
3773 | macros. | |
3770 |
|
3774 | |||
3771 | 2002-01-05 Fernando Perez <fperez@colorado.edu> |
|
3775 | 2002-01-05 Fernando Perez <fperez@colorado.edu> | |
3772 |
|
3776 | |||
3773 | * Released 0.2.4. |
|
3777 | * Released 0.2.4. | |
3774 |
|
3778 | |||
3775 | * IPython/iplib.py (Magic.magic_pdef): |
|
3779 | * IPython/iplib.py (Magic.magic_pdef): | |
3776 | (InteractiveShell.safe_execfile): report magic lines and error |
|
3780 | (InteractiveShell.safe_execfile): report magic lines and error | |
3777 | lines without line numbers so one can easily copy/paste them for |
|
3781 | lines without line numbers so one can easily copy/paste them for | |
3778 | re-execution. |
|
3782 | re-execution. | |
3779 |
|
3783 | |||
3780 | * Updated manual with recent changes. |
|
3784 | * Updated manual with recent changes. | |
3781 |
|
3785 | |||
3782 | * IPython/iplib.py (Magic.magic_oinfo): added constructor |
|
3786 | * IPython/iplib.py (Magic.magic_oinfo): added constructor | |
3783 | docstring printing when class? is called. Very handy for knowing |
|
3787 | docstring printing when class? is called. Very handy for knowing | |
3784 | how to create class instances (as long as __init__ is well |
|
3788 | how to create class instances (as long as __init__ is well | |
3785 | documented, of course :) |
|
3789 | documented, of course :) | |
3786 | (Magic.magic_doc): print both class and constructor docstrings. |
|
3790 | (Magic.magic_doc): print both class and constructor docstrings. | |
3787 | (Magic.magic_pdef): give constructor info if passed a class and |
|
3791 | (Magic.magic_pdef): give constructor info if passed a class and | |
3788 | __call__ info for callable object instances. |
|
3792 | __call__ info for callable object instances. | |
3789 |
|
3793 | |||
3790 | 2002-01-04 Fernando Perez <fperez@colorado.edu> |
|
3794 | 2002-01-04 Fernando Perez <fperez@colorado.edu> | |
3791 |
|
3795 | |||
3792 | * Made deep_reload() off by default. It doesn't always work |
|
3796 | * Made deep_reload() off by default. It doesn't always work | |
3793 | exactly as intended, so it's probably safer to have it off. It's |
|
3797 | exactly as intended, so it's probably safer to have it off. It's | |
3794 | still available as dreload() anyway, so nothing is lost. |
|
3798 | still available as dreload() anyway, so nothing is lost. | |
3795 |
|
3799 | |||
3796 | 2002-01-02 Fernando Perez <fperez@colorado.edu> |
|
3800 | 2002-01-02 Fernando Perez <fperez@colorado.edu> | |
3797 |
|
3801 | |||
3798 | * Released 0.2.3 (contacted R.Singh at CU about biopython course, |
|
3802 | * Released 0.2.3 (contacted R.Singh at CU about biopython course, | |
3799 | so I wanted an updated release). |
|
3803 | so I wanted an updated release). | |
3800 |
|
3804 | |||
3801 | 2001-12-27 Fernando Perez <fperez@colorado.edu> |
|
3805 | 2001-12-27 Fernando Perez <fperez@colorado.edu> | |
3802 |
|
3806 | |||
3803 | * IPython/iplib.py (InteractiveShell.interact): Added the original |
|
3807 | * IPython/iplib.py (InteractiveShell.interact): Added the original | |
3804 | code from 'code.py' for this module in order to change the |
|
3808 | code from 'code.py' for this module in order to change the | |
3805 | handling of a KeyboardInterrupt. This was necessary b/c otherwise |
|
3809 | handling of a KeyboardInterrupt. This was necessary b/c otherwise | |
3806 | the history cache would break when the user hit Ctrl-C, and |
|
3810 | the history cache would break when the user hit Ctrl-C, and | |
3807 | interact() offers no way to add any hooks to it. |
|
3811 | interact() offers no way to add any hooks to it. | |
3808 |
|
3812 | |||
3809 | 2001-12-23 Fernando Perez <fperez@colorado.edu> |
|
3813 | 2001-12-23 Fernando Perez <fperez@colorado.edu> | |
3810 |
|
3814 | |||
3811 | * setup.py: added check for 'MANIFEST' before trying to remove |
|
3815 | * setup.py: added check for 'MANIFEST' before trying to remove | |
3812 | it. Thanks to Sean Reifschneider. |
|
3816 | it. Thanks to Sean Reifschneider. | |
3813 |
|
3817 | |||
3814 | 2001-12-22 Fernando Perez <fperez@colorado.edu> |
|
3818 | 2001-12-22 Fernando Perez <fperez@colorado.edu> | |
3815 |
|
3819 | |||
3816 | * Released 0.2.2. |
|
3820 | * Released 0.2.2. | |
3817 |
|
3821 | |||
3818 | * Finished (reasonably) writing the manual. Later will add the |
|
3822 | * Finished (reasonably) writing the manual. Later will add the | |
3819 | python-standard navigation stylesheets, but for the time being |
|
3823 | python-standard navigation stylesheets, but for the time being | |
3820 | it's fairly complete. Distribution will include html and pdf |
|
3824 | it's fairly complete. Distribution will include html and pdf | |
3821 | versions. |
|
3825 | versions. | |
3822 |
|
3826 | |||
3823 | * Bugfix: '.' wasn't being added to sys.path. Thanks to Prabhu |
|
3827 | * Bugfix: '.' wasn't being added to sys.path. Thanks to Prabhu | |
3824 | (MayaVi author). |
|
3828 | (MayaVi author). | |
3825 |
|
3829 | |||
3826 | 2001-12-21 Fernando Perez <fperez@colorado.edu> |
|
3830 | 2001-12-21 Fernando Perez <fperez@colorado.edu> | |
3827 |
|
3831 | |||
3828 | * Released 0.2.1. Barring any nasty bugs, this is it as far as a |
|
3832 | * Released 0.2.1. Barring any nasty bugs, this is it as far as a | |
3829 | good public release, I think (with the manual and the distutils |
|
3833 | good public release, I think (with the manual and the distutils | |
3830 | installer). The manual can use some work, but that can go |
|
3834 | installer). The manual can use some work, but that can go | |
3831 | slowly. Otherwise I think it's quite nice for end users. Next |
|
3835 | slowly. Otherwise I think it's quite nice for end users. Next | |
3832 | summer, rewrite the guts of it... |
|
3836 | summer, rewrite the guts of it... | |
3833 |
|
3837 | |||
3834 | * Changed format of ipythonrc files to use whitespace as the |
|
3838 | * Changed format of ipythonrc files to use whitespace as the | |
3835 | separator instead of an explicit '='. Cleaner. |
|
3839 | separator instead of an explicit '='. Cleaner. | |
3836 |
|
3840 | |||
3837 | 2001-12-20 Fernando Perez <fperez@colorado.edu> |
|
3841 | 2001-12-20 Fernando Perez <fperez@colorado.edu> | |
3838 |
|
3842 | |||
3839 | * Started a manual in LyX. For now it's just a quick merge of the |
|
3843 | * Started a manual in LyX. For now it's just a quick merge of the | |
3840 | various internal docstrings and READMEs. Later it may grow into a |
|
3844 | various internal docstrings and READMEs. Later it may grow into a | |
3841 | nice, full-blown manual. |
|
3845 | nice, full-blown manual. | |
3842 |
|
3846 | |||
3843 | * Set up a distutils based installer. Installation should now be |
|
3847 | * Set up a distutils based installer. Installation should now be | |
3844 | trivially simple for end-users. |
|
3848 | trivially simple for end-users. | |
3845 |
|
3849 | |||
3846 | 2001-12-11 Fernando Perez <fperez@colorado.edu> |
|
3850 | 2001-12-11 Fernando Perez <fperez@colorado.edu> | |
3847 |
|
3851 | |||
3848 | * Released 0.2.0. First public release, announced it at |
|
3852 | * Released 0.2.0. First public release, announced it at | |
3849 | comp.lang.python. From now on, just bugfixes... |
|
3853 | comp.lang.python. From now on, just bugfixes... | |
3850 |
|
3854 | |||
3851 | * Went through all the files, set copyright/license notices and |
|
3855 | * Went through all the files, set copyright/license notices and | |
3852 | cleaned up things. Ready for release. |
|
3856 | cleaned up things. Ready for release. | |
3853 |
|
3857 | |||
3854 | 2001-12-10 Fernando Perez <fperez@colorado.edu> |
|
3858 | 2001-12-10 Fernando Perez <fperez@colorado.edu> | |
3855 |
|
3859 | |||
3856 | * Changed the first-time installer not to use tarfiles. It's more |
|
3860 | * Changed the first-time installer not to use tarfiles. It's more | |
3857 | robust now and less unix-dependent. Also makes it easier for |
|
3861 | robust now and less unix-dependent. Also makes it easier for | |
3858 | people to later upgrade versions. |
|
3862 | people to later upgrade versions. | |
3859 |
|
3863 | |||
3860 | * Changed @exit to @abort to reflect the fact that it's pretty |
|
3864 | * Changed @exit to @abort to reflect the fact that it's pretty | |
3861 | brutal (a sys.exit()). The difference between @abort and Ctrl-D |
|
3865 | brutal (a sys.exit()). The difference between @abort and Ctrl-D | |
3862 | becomes significant only when IPyhton is embedded: in that case, |
|
3866 | becomes significant only when IPyhton is embedded: in that case, | |
3863 | C-D closes IPython only, but @abort kills the enclosing program |
|
3867 | C-D closes IPython only, but @abort kills the enclosing program | |
3864 | too (unless it had called IPython inside a try catching |
|
3868 | too (unless it had called IPython inside a try catching | |
3865 | SystemExit). |
|
3869 | SystemExit). | |
3866 |
|
3870 | |||
3867 | * Created Shell module which exposes the actuall IPython Shell |
|
3871 | * Created Shell module which exposes the actuall IPython Shell | |
3868 | classes, currently the normal and the embeddable one. This at |
|
3872 | classes, currently the normal and the embeddable one. This at | |
3869 | least offers a stable interface we won't need to change when |
|
3873 | least offers a stable interface we won't need to change when | |
3870 | (later) the internals are rewritten. That rewrite will be confined |
|
3874 | (later) the internals are rewritten. That rewrite will be confined | |
3871 | to iplib and ipmaker, but the Shell interface should remain as is. |
|
3875 | to iplib and ipmaker, but the Shell interface should remain as is. | |
3872 |
|
3876 | |||
3873 | * Added embed module which offers an embeddable IPShell object, |
|
3877 | * Added embed module which offers an embeddable IPShell object, | |
3874 | useful to fire up IPython *inside* a running program. Great for |
|
3878 | useful to fire up IPython *inside* a running program. Great for | |
3875 | debugging or dynamical data analysis. |
|
3879 | debugging or dynamical data analysis. | |
3876 |
|
3880 | |||
3877 | 2001-12-08 Fernando Perez <fperez@colorado.edu> |
|
3881 | 2001-12-08 Fernando Perez <fperez@colorado.edu> | |
3878 |
|
3882 | |||
3879 | * Fixed small bug preventing seeing info from methods of defined |
|
3883 | * Fixed small bug preventing seeing info from methods of defined | |
3880 | objects (incorrect namespace in _ofind()). |
|
3884 | objects (incorrect namespace in _ofind()). | |
3881 |
|
3885 | |||
3882 | * Documentation cleanup. Moved the main usage docstrings to a |
|
3886 | * Documentation cleanup. Moved the main usage docstrings to a | |
3883 | separate file, usage.py (cleaner to maintain, and hopefully in the |
|
3887 | separate file, usage.py (cleaner to maintain, and hopefully in the | |
3884 | future some perlpod-like way of producing interactive, man and |
|
3888 | future some perlpod-like way of producing interactive, man and | |
3885 | html docs out of it will be found). |
|
3889 | html docs out of it will be found). | |
3886 |
|
3890 | |||
3887 | * Added @profile to see your profile at any time. |
|
3891 | * Added @profile to see your profile at any time. | |
3888 |
|
3892 | |||
3889 | * Added @p as an alias for 'print'. It's especially convenient if |
|
3893 | * Added @p as an alias for 'print'. It's especially convenient if | |
3890 | using automagic ('p x' prints x). |
|
3894 | using automagic ('p x' prints x). | |
3891 |
|
3895 | |||
3892 | * Small cleanups and fixes after a pychecker run. |
|
3896 | * Small cleanups and fixes after a pychecker run. | |
3893 |
|
3897 | |||
3894 | * Changed the @cd command to handle @cd - and @cd -<n> for |
|
3898 | * Changed the @cd command to handle @cd - and @cd -<n> for | |
3895 | visiting any directory in _dh. |
|
3899 | visiting any directory in _dh. | |
3896 |
|
3900 | |||
3897 | * Introduced _dh, a history of visited directories. @dhist prints |
|
3901 | * Introduced _dh, a history of visited directories. @dhist prints | |
3898 | it out with numbers. |
|
3902 | it out with numbers. | |
3899 |
|
3903 | |||
3900 | 2001-12-07 Fernando Perez <fperez@colorado.edu> |
|
3904 | 2001-12-07 Fernando Perez <fperez@colorado.edu> | |
3901 |
|
3905 | |||
3902 | * Released 0.1.22 |
|
3906 | * Released 0.1.22 | |
3903 |
|
3907 | |||
3904 | * Made initialization a bit more robust against invalid color |
|
3908 | * Made initialization a bit more robust against invalid color | |
3905 | options in user input (exit, not traceback-crash). |
|
3909 | options in user input (exit, not traceback-crash). | |
3906 |
|
3910 | |||
3907 | * Changed the bug crash reporter to write the report only in the |
|
3911 | * Changed the bug crash reporter to write the report only in the | |
3908 | user's .ipython directory. That way IPython won't litter people's |
|
3912 | user's .ipython directory. That way IPython won't litter people's | |
3909 | hard disks with crash files all over the place. Also print on |
|
3913 | hard disks with crash files all over the place. Also print on | |
3910 | screen the necessary mail command. |
|
3914 | screen the necessary mail command. | |
3911 |
|
3915 | |||
3912 | * With the new ultraTB, implemented LightBG color scheme for light |
|
3916 | * With the new ultraTB, implemented LightBG color scheme for light | |
3913 | background terminals. A lot of people like white backgrounds, so I |
|
3917 | background terminals. A lot of people like white backgrounds, so I | |
3914 | guess we should at least give them something readable. |
|
3918 | guess we should at least give them something readable. | |
3915 |
|
3919 | |||
3916 | 2001-12-06 Fernando Perez <fperez@colorado.edu> |
|
3920 | 2001-12-06 Fernando Perez <fperez@colorado.edu> | |
3917 |
|
3921 | |||
3918 | * Modified the structure of ultraTB. Now there's a proper class |
|
3922 | * Modified the structure of ultraTB. Now there's a proper class | |
3919 | for tables of color schemes which allow adding schemes easily and |
|
3923 | for tables of color schemes which allow adding schemes easily and | |
3920 | switching the active scheme without creating a new instance every |
|
3924 | switching the active scheme without creating a new instance every | |
3921 | time (which was ridiculous). The syntax for creating new schemes |
|
3925 | time (which was ridiculous). The syntax for creating new schemes | |
3922 | is also cleaner. I think ultraTB is finally done, with a clean |
|
3926 | is also cleaner. I think ultraTB is finally done, with a clean | |
3923 | class structure. Names are also much cleaner (now there's proper |
|
3927 | class structure. Names are also much cleaner (now there's proper | |
3924 | color tables, no need for every variable to also have 'color' in |
|
3928 | color tables, no need for every variable to also have 'color' in | |
3925 | its name). |
|
3929 | its name). | |
3926 |
|
3930 | |||
3927 | * Broke down genutils into separate files. Now genutils only |
|
3931 | * Broke down genutils into separate files. Now genutils only | |
3928 | contains utility functions, and classes have been moved to their |
|
3932 | contains utility functions, and classes have been moved to their | |
3929 | own files (they had enough independent functionality to warrant |
|
3933 | own files (they had enough independent functionality to warrant | |
3930 | it): ConfigLoader, OutputTrap, Struct. |
|
3934 | it): ConfigLoader, OutputTrap, Struct. | |
3931 |
|
3935 | |||
3932 | 2001-12-05 Fernando Perez <fperez@colorado.edu> |
|
3936 | 2001-12-05 Fernando Perez <fperez@colorado.edu> | |
3933 |
|
3937 | |||
3934 | * IPython turns 21! Released version 0.1.21, as a candidate for |
|
3938 | * IPython turns 21! Released version 0.1.21, as a candidate for | |
3935 | public consumption. If all goes well, release in a few days. |
|
3939 | public consumption. If all goes well, release in a few days. | |
3936 |
|
3940 | |||
3937 | * Fixed path bug (files in Extensions/ directory wouldn't be found |
|
3941 | * Fixed path bug (files in Extensions/ directory wouldn't be found | |
3938 | unless IPython/ was explicitly in sys.path). |
|
3942 | unless IPython/ was explicitly in sys.path). | |
3939 |
|
3943 | |||
3940 | * Extended the FlexCompleter class as MagicCompleter to allow |
|
3944 | * Extended the FlexCompleter class as MagicCompleter to allow | |
3941 | completion of @-starting lines. |
|
3945 | completion of @-starting lines. | |
3942 |
|
3946 | |||
3943 | * Created __release__.py file as a central repository for release |
|
3947 | * Created __release__.py file as a central repository for release | |
3944 | info that other files can read from. |
|
3948 | info that other files can read from. | |
3945 |
|
3949 | |||
3946 | * Fixed small bug in logging: when logging was turned on in |
|
3950 | * Fixed small bug in logging: when logging was turned on in | |
3947 | mid-session, old lines with special meanings (!@?) were being |
|
3951 | mid-session, old lines with special meanings (!@?) were being | |
3948 | logged without the prepended comment, which is necessary since |
|
3952 | logged without the prepended comment, which is necessary since | |
3949 | they are not truly valid python syntax. This should make session |
|
3953 | they are not truly valid python syntax. This should make session | |
3950 | restores produce less errors. |
|
3954 | restores produce less errors. | |
3951 |
|
3955 | |||
3952 | * The namespace cleanup forced me to make a FlexCompleter class |
|
3956 | * The namespace cleanup forced me to make a FlexCompleter class | |
3953 | which is nothing but a ripoff of rlcompleter, but with selectable |
|
3957 | which is nothing but a ripoff of rlcompleter, but with selectable | |
3954 | namespace (rlcompleter only works in __main__.__dict__). I'll try |
|
3958 | namespace (rlcompleter only works in __main__.__dict__). I'll try | |
3955 | to submit a note to the authors to see if this change can be |
|
3959 | to submit a note to the authors to see if this change can be | |
3956 | incorporated in future rlcompleter releases (Dec.6: done) |
|
3960 | incorporated in future rlcompleter releases (Dec.6: done) | |
3957 |
|
3961 | |||
3958 | * More fixes to namespace handling. It was a mess! Now all |
|
3962 | * More fixes to namespace handling. It was a mess! Now all | |
3959 | explicit references to __main__.__dict__ are gone (except when |
|
3963 | explicit references to __main__.__dict__ are gone (except when | |
3960 | really needed) and everything is handled through the namespace |
|
3964 | really needed) and everything is handled through the namespace | |
3961 | dicts in the IPython instance. We seem to be getting somewhere |
|
3965 | dicts in the IPython instance. We seem to be getting somewhere | |
3962 | with this, finally... |
|
3966 | with this, finally... | |
3963 |
|
3967 | |||
3964 | * Small documentation updates. |
|
3968 | * Small documentation updates. | |
3965 |
|
3969 | |||
3966 | * Created the Extensions directory under IPython (with an |
|
3970 | * Created the Extensions directory under IPython (with an | |
3967 | __init__.py). Put the PhysicalQ stuff there. This directory should |
|
3971 | __init__.py). Put the PhysicalQ stuff there. This directory should | |
3968 | be used for all special-purpose extensions. |
|
3972 | be used for all special-purpose extensions. | |
3969 |
|
3973 | |||
3970 | * File renaming: |
|
3974 | * File renaming: | |
3971 | ipythonlib --> ipmaker |
|
3975 | ipythonlib --> ipmaker | |
3972 | ipplib --> iplib |
|
3976 | ipplib --> iplib | |
3973 | This makes a bit more sense in terms of what these files actually do. |
|
3977 | This makes a bit more sense in terms of what these files actually do. | |
3974 |
|
3978 | |||
3975 | * Moved all the classes and functions in ipythonlib to ipplib, so |
|
3979 | * Moved all the classes and functions in ipythonlib to ipplib, so | |
3976 | now ipythonlib only has make_IPython(). This will ease up its |
|
3980 | now ipythonlib only has make_IPython(). This will ease up its | |
3977 | splitting in smaller functional chunks later. |
|
3981 | splitting in smaller functional chunks later. | |
3978 |
|
3982 | |||
3979 | * Cleaned up (done, I think) output of @whos. Better column |
|
3983 | * Cleaned up (done, I think) output of @whos. Better column | |
3980 | formatting, and now shows str(var) for as much as it can, which is |
|
3984 | formatting, and now shows str(var) for as much as it can, which is | |
3981 | typically what one gets with a 'print var'. |
|
3985 | typically what one gets with a 'print var'. | |
3982 |
|
3986 | |||
3983 | 2001-12-04 Fernando Perez <fperez@colorado.edu> |
|
3987 | 2001-12-04 Fernando Perez <fperez@colorado.edu> | |
3984 |
|
3988 | |||
3985 | * Fixed namespace problems. Now builtin/IPyhton/user names get |
|
3989 | * Fixed namespace problems. Now builtin/IPyhton/user names get | |
3986 | properly reported in their namespace. Internal namespace handling |
|
3990 | properly reported in their namespace. Internal namespace handling | |
3987 | is finally getting decent (not perfect yet, but much better than |
|
3991 | is finally getting decent (not perfect yet, but much better than | |
3988 | the ad-hoc mess we had). |
|
3992 | the ad-hoc mess we had). | |
3989 |
|
3993 | |||
3990 | * Removed -exit option. If people just want to run a python |
|
3994 | * Removed -exit option. If people just want to run a python | |
3991 | script, that's what the normal interpreter is for. Less |
|
3995 | script, that's what the normal interpreter is for. Less | |
3992 | unnecessary options, less chances for bugs. |
|
3996 | unnecessary options, less chances for bugs. | |
3993 |
|
3997 | |||
3994 | * Added a crash handler which generates a complete post-mortem if |
|
3998 | * Added a crash handler which generates a complete post-mortem if | |
3995 | IPython crashes. This will help a lot in tracking bugs down the |
|
3999 | IPython crashes. This will help a lot in tracking bugs down the | |
3996 | road. |
|
4000 | road. | |
3997 |
|
4001 | |||
3998 | * Fixed nasty bug in auto-evaluation part of prefilter(). Names |
|
4002 | * Fixed nasty bug in auto-evaluation part of prefilter(). Names | |
3999 | which were boud to functions being reassigned would bypass the |
|
4003 | which were boud to functions being reassigned would bypass the | |
4000 | logger, breaking the sync of _il with the prompt counter. This |
|
4004 | logger, breaking the sync of _il with the prompt counter. This | |
4001 | would then crash IPython later when a new line was logged. |
|
4005 | would then crash IPython later when a new line was logged. | |
4002 |
|
4006 | |||
4003 | 2001-12-02 Fernando Perez <fperez@colorado.edu> |
|
4007 | 2001-12-02 Fernando Perez <fperez@colorado.edu> | |
4004 |
|
4008 | |||
4005 | * Made IPython a package. This means people don't have to clutter |
|
4009 | * Made IPython a package. This means people don't have to clutter | |
4006 | their sys.path with yet another directory. Changed the INSTALL |
|
4010 | their sys.path with yet another directory. Changed the INSTALL | |
4007 | file accordingly. |
|
4011 | file accordingly. | |
4008 |
|
4012 | |||
4009 | * Cleaned up the output of @who_ls, @who and @whos. @who_ls now |
|
4013 | * Cleaned up the output of @who_ls, @who and @whos. @who_ls now | |
4010 | sorts its output (so @who shows it sorted) and @whos formats the |
|
4014 | sorts its output (so @who shows it sorted) and @whos formats the | |
4011 | table according to the width of the first column. Nicer, easier to |
|
4015 | table according to the width of the first column. Nicer, easier to | |
4012 | read. Todo: write a generic table_format() which takes a list of |
|
4016 | read. Todo: write a generic table_format() which takes a list of | |
4013 | lists and prints it nicely formatted, with optional row/column |
|
4017 | lists and prints it nicely formatted, with optional row/column | |
4014 | separators and proper padding and justification. |
|
4018 | separators and proper padding and justification. | |
4015 |
|
4019 | |||
4016 | * Released 0.1.20 |
|
4020 | * Released 0.1.20 | |
4017 |
|
4021 | |||
4018 | * Fixed bug in @log which would reverse the inputcache list (a |
|
4022 | * Fixed bug in @log which would reverse the inputcache list (a | |
4019 | copy operation was missing). |
|
4023 | copy operation was missing). | |
4020 |
|
4024 | |||
4021 | * Code cleanup. @config was changed to use page(). Better, since |
|
4025 | * Code cleanup. @config was changed to use page(). Better, since | |
4022 | its output is always quite long. |
|
4026 | its output is always quite long. | |
4023 |
|
4027 | |||
4024 | * Itpl is back as a dependency. I was having too many problems |
|
4028 | * Itpl is back as a dependency. I was having too many problems | |
4025 | getting the parametric aliases to work reliably, and it's just |
|
4029 | getting the parametric aliases to work reliably, and it's just | |
4026 | easier to code weird string operations with it than playing %()s |
|
4030 | easier to code weird string operations with it than playing %()s | |
4027 | games. It's only ~6k, so I don't think it's too big a deal. |
|
4031 | games. It's only ~6k, so I don't think it's too big a deal. | |
4028 |
|
4032 | |||
4029 | * Found (and fixed) a very nasty bug with history. !lines weren't |
|
4033 | * Found (and fixed) a very nasty bug with history. !lines weren't | |
4030 | getting cached, and the out of sync caches would crash |
|
4034 | getting cached, and the out of sync caches would crash | |
4031 | IPython. Fixed it by reorganizing the prefilter/handlers/logger |
|
4035 | IPython. Fixed it by reorganizing the prefilter/handlers/logger | |
4032 | division of labor a bit better. Bug fixed, cleaner structure. |
|
4036 | division of labor a bit better. Bug fixed, cleaner structure. | |
4033 |
|
4037 | |||
4034 | 2001-12-01 Fernando Perez <fperez@colorado.edu> |
|
4038 | 2001-12-01 Fernando Perez <fperez@colorado.edu> | |
4035 |
|
4039 | |||
4036 | * Released 0.1.19 |
|
4040 | * Released 0.1.19 | |
4037 |
|
4041 | |||
4038 | * Added option -n to @hist to prevent line number printing. Much |
|
4042 | * Added option -n to @hist to prevent line number printing. Much | |
4039 | easier to copy/paste code this way. |
|
4043 | easier to copy/paste code this way. | |
4040 |
|
4044 | |||
4041 | * Created global _il to hold the input list. Allows easy |
|
4045 | * Created global _il to hold the input list. Allows easy | |
4042 | re-execution of blocks of code by slicing it (inspired by Janko's |
|
4046 | re-execution of blocks of code by slicing it (inspired by Janko's | |
4043 | comment on 'macros'). |
|
4047 | comment on 'macros'). | |
4044 |
|
4048 | |||
4045 | * Small fixes and doc updates. |
|
4049 | * Small fixes and doc updates. | |
4046 |
|
4050 | |||
4047 | * Rewrote @history function (was @h). Renamed it to @hist, @h is |
|
4051 | * Rewrote @history function (was @h). Renamed it to @hist, @h is | |
4048 | much too fragile with automagic. Handles properly multi-line |
|
4052 | much too fragile with automagic. Handles properly multi-line | |
4049 | statements and takes parameters. |
|
4053 | statements and takes parameters. | |
4050 |
|
4054 | |||
4051 | 2001-11-30 Fernando Perez <fperez@colorado.edu> |
|
4055 | 2001-11-30 Fernando Perez <fperez@colorado.edu> | |
4052 |
|
4056 | |||
4053 | * Version 0.1.18 released. |
|
4057 | * Version 0.1.18 released. | |
4054 |
|
4058 | |||
4055 | * Fixed nasty namespace bug in initial module imports. |
|
4059 | * Fixed nasty namespace bug in initial module imports. | |
4056 |
|
4060 | |||
4057 | * Added copyright/license notes to all code files (except |
|
4061 | * Added copyright/license notes to all code files (except | |
4058 | DPyGetOpt). For the time being, LGPL. That could change. |
|
4062 | DPyGetOpt). For the time being, LGPL. That could change. | |
4059 |
|
4063 | |||
4060 | * Rewrote a much nicer README, updated INSTALL, cleaned up |
|
4064 | * Rewrote a much nicer README, updated INSTALL, cleaned up | |
4061 | ipythonrc-* samples. |
|
4065 | ipythonrc-* samples. | |
4062 |
|
4066 | |||
4063 | * Overall code/documentation cleanup. Basically ready for |
|
4067 | * Overall code/documentation cleanup. Basically ready for | |
4064 | release. Only remaining thing: licence decision (LGPL?). |
|
4068 | release. Only remaining thing: licence decision (LGPL?). | |
4065 |
|
4069 | |||
4066 | * Converted load_config to a class, ConfigLoader. Now recursion |
|
4070 | * Converted load_config to a class, ConfigLoader. Now recursion | |
4067 | control is better organized. Doesn't include the same file twice. |
|
4071 | control is better organized. Doesn't include the same file twice. | |
4068 |
|
4072 | |||
4069 | 2001-11-29 Fernando Perez <fperez@colorado.edu> |
|
4073 | 2001-11-29 Fernando Perez <fperez@colorado.edu> | |
4070 |
|
4074 | |||
4071 | * Got input history working. Changed output history variables from |
|
4075 | * Got input history working. Changed output history variables from | |
4072 | _p to _o so that _i is for input and _o for output. Just cleaner |
|
4076 | _p to _o so that _i is for input and _o for output. Just cleaner | |
4073 | convention. |
|
4077 | convention. | |
4074 |
|
4078 | |||
4075 | * Implemented parametric aliases. This pretty much allows the |
|
4079 | * Implemented parametric aliases. This pretty much allows the | |
4076 | alias system to offer full-blown shell convenience, I think. |
|
4080 | alias system to offer full-blown shell convenience, I think. | |
4077 |
|
4081 | |||
4078 | * Version 0.1.17 released, 0.1.18 opened. |
|
4082 | * Version 0.1.17 released, 0.1.18 opened. | |
4079 |
|
4083 | |||
4080 | * dot_ipython/ipythonrc (alias): added documentation. |
|
4084 | * dot_ipython/ipythonrc (alias): added documentation. | |
4081 | (xcolor): Fixed small bug (xcolors -> xcolor) |
|
4085 | (xcolor): Fixed small bug (xcolors -> xcolor) | |
4082 |
|
4086 | |||
4083 | * Changed the alias system. Now alias is a magic command to define |
|
4087 | * Changed the alias system. Now alias is a magic command to define | |
4084 | aliases just like the shell. Rationale: the builtin magics should |
|
4088 | aliases just like the shell. Rationale: the builtin magics should | |
4085 | be there for things deeply connected to IPython's |
|
4089 | be there for things deeply connected to IPython's | |
4086 | architecture. And this is a much lighter system for what I think |
|
4090 | architecture. And this is a much lighter system for what I think | |
4087 | is the really important feature: allowing users to define quickly |
|
4091 | is the really important feature: allowing users to define quickly | |
4088 | magics that will do shell things for them, so they can customize |
|
4092 | magics that will do shell things for them, so they can customize | |
4089 | IPython easily to match their work habits. If someone is really |
|
4093 | IPython easily to match their work habits. If someone is really | |
4090 | desperate to have another name for a builtin alias, they can |
|
4094 | desperate to have another name for a builtin alias, they can | |
4091 | always use __IP.magic_newname = __IP.magic_oldname. Hackish but |
|
4095 | always use __IP.magic_newname = __IP.magic_oldname. Hackish but | |
4092 | works. |
|
4096 | works. | |
4093 |
|
4097 | |||
4094 | 2001-11-28 Fernando Perez <fperez@colorado.edu> |
|
4098 | 2001-11-28 Fernando Perez <fperez@colorado.edu> | |
4095 |
|
4099 | |||
4096 | * Changed @file so that it opens the source file at the proper |
|
4100 | * Changed @file so that it opens the source file at the proper | |
4097 | line. Since it uses less, if your EDITOR environment is |
|
4101 | line. Since it uses less, if your EDITOR environment is | |
4098 | configured, typing v will immediately open your editor of choice |
|
4102 | configured, typing v will immediately open your editor of choice | |
4099 | right at the line where the object is defined. Not as quick as |
|
4103 | right at the line where the object is defined. Not as quick as | |
4100 | having a direct @edit command, but for all intents and purposes it |
|
4104 | having a direct @edit command, but for all intents and purposes it | |
4101 | works. And I don't have to worry about writing @edit to deal with |
|
4105 | works. And I don't have to worry about writing @edit to deal with | |
4102 | all the editors, less does that. |
|
4106 | all the editors, less does that. | |
4103 |
|
4107 | |||
4104 | * Version 0.1.16 released, 0.1.17 opened. |
|
4108 | * Version 0.1.16 released, 0.1.17 opened. | |
4105 |
|
4109 | |||
4106 | * Fixed some nasty bugs in the page/page_dumb combo that could |
|
4110 | * Fixed some nasty bugs in the page/page_dumb combo that could | |
4107 | crash IPython. |
|
4111 | crash IPython. | |
4108 |
|
4112 | |||
4109 | 2001-11-27 Fernando Perez <fperez@colorado.edu> |
|
4113 | 2001-11-27 Fernando Perez <fperez@colorado.edu> | |
4110 |
|
4114 | |||
4111 | * Version 0.1.15 released, 0.1.16 opened. |
|
4115 | * Version 0.1.15 released, 0.1.16 opened. | |
4112 |
|
4116 | |||
4113 | * Finally got ? and ?? to work for undefined things: now it's |
|
4117 | * Finally got ? and ?? to work for undefined things: now it's | |
4114 | possible to type {}.get? and get information about the get method |
|
4118 | possible to type {}.get? and get information about the get method | |
4115 | of dicts, or os.path? even if only os is defined (so technically |
|
4119 | of dicts, or os.path? even if only os is defined (so technically | |
4116 | os.path isn't). Works at any level. For example, after import os, |
|
4120 | os.path isn't). Works at any level. For example, after import os, | |
4117 | os?, os.path?, os.path.abspath? all work. This is great, took some |
|
4121 | os?, os.path?, os.path.abspath? all work. This is great, took some | |
4118 | work in _ofind. |
|
4122 | work in _ofind. | |
4119 |
|
4123 | |||
4120 | * Fixed more bugs with logging. The sanest way to do it was to add |
|
4124 | * Fixed more bugs with logging. The sanest way to do it was to add | |
4121 | to @log a 'mode' parameter. Killed two in one shot (this mode |
|
4125 | to @log a 'mode' parameter. Killed two in one shot (this mode | |
4122 | option was a request of Janko's). I think it's finally clean |
|
4126 | option was a request of Janko's). I think it's finally clean | |
4123 | (famous last words). |
|
4127 | (famous last words). | |
4124 |
|
4128 | |||
4125 | * Added a page_dumb() pager which does a decent job of paging on |
|
4129 | * Added a page_dumb() pager which does a decent job of paging on | |
4126 | screen, if better things (like less) aren't available. One less |
|
4130 | screen, if better things (like less) aren't available. One less | |
4127 | unix dependency (someday maybe somebody will port this to |
|
4131 | unix dependency (someday maybe somebody will port this to | |
4128 | windows). |
|
4132 | windows). | |
4129 |
|
4133 | |||
4130 | * Fixed problem in magic_log: would lock of logging out if log |
|
4134 | * Fixed problem in magic_log: would lock of logging out if log | |
4131 | creation failed (because it would still think it had succeeded). |
|
4135 | creation failed (because it would still think it had succeeded). | |
4132 |
|
4136 | |||
4133 | * Improved the page() function using curses to auto-detect screen |
|
4137 | * Improved the page() function using curses to auto-detect screen | |
4134 | size. Now it can make a much better decision on whether to print |
|
4138 | size. Now it can make a much better decision on whether to print | |
4135 | or page a string. Option screen_length was modified: a value 0 |
|
4139 | or page a string. Option screen_length was modified: a value 0 | |
4136 | means auto-detect, and that's the default now. |
|
4140 | means auto-detect, and that's the default now. | |
4137 |
|
4141 | |||
4138 | * Version 0.1.14 released, 0.1.15 opened. I think this is ready to |
|
4142 | * Version 0.1.14 released, 0.1.15 opened. I think this is ready to | |
4139 | go out. I'll test it for a few days, then talk to Janko about |
|
4143 | go out. I'll test it for a few days, then talk to Janko about | |
4140 | licences and announce it. |
|
4144 | licences and announce it. | |
4141 |
|
4145 | |||
4142 | * Fixed the length of the auto-generated ---> prompt which appears |
|
4146 | * Fixed the length of the auto-generated ---> prompt which appears | |
4143 | for auto-parens and auto-quotes. Getting this right isn't trivial, |
|
4147 | for auto-parens and auto-quotes. Getting this right isn't trivial, | |
4144 | with all the color escapes, different prompt types and optional |
|
4148 | with all the color escapes, different prompt types and optional | |
4145 | separators. But it seems to be working in all the combinations. |
|
4149 | separators. But it seems to be working in all the combinations. | |
4146 |
|
4150 | |||
4147 | 2001-11-26 Fernando Perez <fperez@colorado.edu> |
|
4151 | 2001-11-26 Fernando Perez <fperez@colorado.edu> | |
4148 |
|
4152 | |||
4149 | * Wrote a regexp filter to get option types from the option names |
|
4153 | * Wrote a regexp filter to get option types from the option names | |
4150 | string. This eliminates the need to manually keep two duplicate |
|
4154 | string. This eliminates the need to manually keep two duplicate | |
4151 | lists. |
|
4155 | lists. | |
4152 |
|
4156 | |||
4153 | * Removed the unneeded check_option_names. Now options are handled |
|
4157 | * Removed the unneeded check_option_names. Now options are handled | |
4154 | in a much saner manner and it's easy to visually check that things |
|
4158 | in a much saner manner and it's easy to visually check that things | |
4155 | are ok. |
|
4159 | are ok. | |
4156 |
|
4160 | |||
4157 | * Updated version numbers on all files I modified to carry a |
|
4161 | * Updated version numbers on all files I modified to carry a | |
4158 | notice so Janko and Nathan have clear version markers. |
|
4162 | notice so Janko and Nathan have clear version markers. | |
4159 |
|
4163 | |||
4160 | * Updated docstring for ultraTB with my changes. I should send |
|
4164 | * Updated docstring for ultraTB with my changes. I should send | |
4161 | this to Nathan. |
|
4165 | this to Nathan. | |
4162 |
|
4166 | |||
4163 | * Lots of small fixes. Ran everything through pychecker again. |
|
4167 | * Lots of small fixes. Ran everything through pychecker again. | |
4164 |
|
4168 | |||
4165 | * Made loading of deep_reload an cmd line option. If it's not too |
|
4169 | * Made loading of deep_reload an cmd line option. If it's not too | |
4166 | kosher, now people can just disable it. With -nodeep_reload it's |
|
4170 | kosher, now people can just disable it. With -nodeep_reload it's | |
4167 | still available as dreload(), it just won't overwrite reload(). |
|
4171 | still available as dreload(), it just won't overwrite reload(). | |
4168 |
|
4172 | |||
4169 | * Moved many options to the no| form (-opt and -noopt |
|
4173 | * Moved many options to the no| form (-opt and -noopt | |
4170 | accepted). Cleaner. |
|
4174 | accepted). Cleaner. | |
4171 |
|
4175 | |||
4172 | * Changed magic_log so that if called with no parameters, it uses |
|
4176 | * Changed magic_log so that if called with no parameters, it uses | |
4173 | 'rotate' mode. That way auto-generated logs aren't automatically |
|
4177 | 'rotate' mode. That way auto-generated logs aren't automatically | |
4174 | over-written. For normal logs, now a backup is made if it exists |
|
4178 | over-written. For normal logs, now a backup is made if it exists | |
4175 | (only 1 level of backups). A new 'backup' mode was added to the |
|
4179 | (only 1 level of backups). A new 'backup' mode was added to the | |
4176 | Logger class to support this. This was a request by Janko. |
|
4180 | Logger class to support this. This was a request by Janko. | |
4177 |
|
4181 | |||
4178 | * Added @logoff/@logon to stop/restart an active log. |
|
4182 | * Added @logoff/@logon to stop/restart an active log. | |
4179 |
|
4183 | |||
4180 | * Fixed a lot of bugs in log saving/replay. It was pretty |
|
4184 | * Fixed a lot of bugs in log saving/replay. It was pretty | |
4181 | broken. Now special lines (!@,/) appear properly in the command |
|
4185 | broken. Now special lines (!@,/) appear properly in the command | |
4182 | history after a log replay. |
|
4186 | history after a log replay. | |
4183 |
|
4187 | |||
4184 | * Tried and failed to implement full session saving via pickle. My |
|
4188 | * Tried and failed to implement full session saving via pickle. My | |
4185 | idea was to pickle __main__.__dict__, but modules can't be |
|
4189 | idea was to pickle __main__.__dict__, but modules can't be | |
4186 | pickled. This would be a better alternative to replaying logs, but |
|
4190 | pickled. This would be a better alternative to replaying logs, but | |
4187 | seems quite tricky to get to work. Changed -session to be called |
|
4191 | seems quite tricky to get to work. Changed -session to be called | |
4188 | -logplay, which more accurately reflects what it does. And if we |
|
4192 | -logplay, which more accurately reflects what it does. And if we | |
4189 | ever get real session saving working, -session is now available. |
|
4193 | ever get real session saving working, -session is now available. | |
4190 |
|
4194 | |||
4191 | * Implemented color schemes for prompts also. As for tracebacks, |
|
4195 | * Implemented color schemes for prompts also. As for tracebacks, | |
4192 | currently only NoColor and Linux are supported. But now the |
|
4196 | currently only NoColor and Linux are supported. But now the | |
4193 | infrastructure is in place, based on a generic ColorScheme |
|
4197 | infrastructure is in place, based on a generic ColorScheme | |
4194 | class. So writing and activating new schemes both for the prompts |
|
4198 | class. So writing and activating new schemes both for the prompts | |
4195 | and the tracebacks should be straightforward. |
|
4199 | and the tracebacks should be straightforward. | |
4196 |
|
4200 | |||
4197 | * Version 0.1.13 released, 0.1.14 opened. |
|
4201 | * Version 0.1.13 released, 0.1.14 opened. | |
4198 |
|
4202 | |||
4199 | * Changed handling of options for output cache. Now counter is |
|
4203 | * Changed handling of options for output cache. Now counter is | |
4200 | hardwired starting at 1 and one specifies the maximum number of |
|
4204 | hardwired starting at 1 and one specifies the maximum number of | |
4201 | entries *in the outcache* (not the max prompt counter). This is |
|
4205 | entries *in the outcache* (not the max prompt counter). This is | |
4202 | much better, since many statements won't increase the cache |
|
4206 | much better, since many statements won't increase the cache | |
4203 | count. It also eliminated some confusing options, now there's only |
|
4207 | count. It also eliminated some confusing options, now there's only | |
4204 | one: cache_size. |
|
4208 | one: cache_size. | |
4205 |
|
4209 | |||
4206 | * Added 'alias' magic function and magic_alias option in the |
|
4210 | * Added 'alias' magic function and magic_alias option in the | |
4207 | ipythonrc file. Now the user can easily define whatever names he |
|
4211 | ipythonrc file. Now the user can easily define whatever names he | |
4208 | wants for the magic functions without having to play weird |
|
4212 | wants for the magic functions without having to play weird | |
4209 | namespace games. This gives IPython a real shell-like feel. |
|
4213 | namespace games. This gives IPython a real shell-like feel. | |
4210 |
|
4214 | |||
4211 | * Fixed doc/?/?? for magics. Now all work, in all forms (explicit |
|
4215 | * Fixed doc/?/?? for magics. Now all work, in all forms (explicit | |
4212 | @ or not). |
|
4216 | @ or not). | |
4213 |
|
4217 | |||
4214 | This was one of the last remaining 'visible' bugs (that I know |
|
4218 | This was one of the last remaining 'visible' bugs (that I know | |
4215 | of). I think if I can clean up the session loading so it works |
|
4219 | of). I think if I can clean up the session loading so it works | |
4216 | 100% I'll release a 0.2.0 version on c.p.l (talk to Janko first |
|
4220 | 100% I'll release a 0.2.0 version on c.p.l (talk to Janko first | |
4217 | about licensing). |
|
4221 | about licensing). | |
4218 |
|
4222 | |||
4219 | 2001-11-25 Fernando Perez <fperez@colorado.edu> |
|
4223 | 2001-11-25 Fernando Perez <fperez@colorado.edu> | |
4220 |
|
4224 | |||
4221 | * Rewrote somewhat oinfo (?/??). Nicer, now uses page() and |
|
4225 | * Rewrote somewhat oinfo (?/??). Nicer, now uses page() and | |
4222 | there's a cleaner distinction between what ? and ?? show. |
|
4226 | there's a cleaner distinction between what ? and ?? show. | |
4223 |
|
4227 | |||
4224 | * Added screen_length option. Now the user can define his own |
|
4228 | * Added screen_length option. Now the user can define his own | |
4225 | screen size for page() operations. |
|
4229 | screen size for page() operations. | |
4226 |
|
4230 | |||
4227 | * Implemented magic shell-like functions with automatic code |
|
4231 | * Implemented magic shell-like functions with automatic code | |
4228 | generation. Now adding another function is just a matter of adding |
|
4232 | generation. Now adding another function is just a matter of adding | |
4229 | an entry to a dict, and the function is dynamically generated at |
|
4233 | an entry to a dict, and the function is dynamically generated at | |
4230 | run-time. Python has some really cool features! |
|
4234 | run-time. Python has some really cool features! | |
4231 |
|
4235 | |||
4232 | * Renamed many options to cleanup conventions a little. Now all |
|
4236 | * Renamed many options to cleanup conventions a little. Now all | |
4233 | are lowercase, and only underscores where needed. Also in the code |
|
4237 | are lowercase, and only underscores where needed. Also in the code | |
4234 | option name tables are clearer. |
|
4238 | option name tables are clearer. | |
4235 |
|
4239 | |||
4236 | * Changed prompts a little. Now input is 'In [n]:' instead of |
|
4240 | * Changed prompts a little. Now input is 'In [n]:' instead of | |
4237 | 'In[n]:='. This allows it the numbers to be aligned with the |
|
4241 | 'In[n]:='. This allows it the numbers to be aligned with the | |
4238 | Out[n] numbers, and removes usage of ':=' which doesn't exist in |
|
4242 | Out[n] numbers, and removes usage of ':=' which doesn't exist in | |
4239 | Python (it was a Mathematica thing). The '...' continuation prompt |
|
4243 | Python (it was a Mathematica thing). The '...' continuation prompt | |
4240 | was also changed a little to align better. |
|
4244 | was also changed a little to align better. | |
4241 |
|
4245 | |||
4242 | * Fixed bug when flushing output cache. Not all _p<n> variables |
|
4246 | * Fixed bug when flushing output cache. Not all _p<n> variables | |
4243 | exist, so their deletion needs to be wrapped in a try: |
|
4247 | exist, so their deletion needs to be wrapped in a try: | |
4244 |
|
4248 | |||
4245 | * Figured out how to properly use inspect.formatargspec() (it |
|
4249 | * Figured out how to properly use inspect.formatargspec() (it | |
4246 | requires the args preceded by *). So I removed all the code from |
|
4250 | requires the args preceded by *). So I removed all the code from | |
4247 | _get_pdef in Magic, which was just replicating that. |
|
4251 | _get_pdef in Magic, which was just replicating that. | |
4248 |
|
4252 | |||
4249 | * Added test to prefilter to allow redefining magic function names |
|
4253 | * Added test to prefilter to allow redefining magic function names | |
4250 | as variables. This is ok, since the @ form is always available, |
|
4254 | as variables. This is ok, since the @ form is always available, | |
4251 | but whe should allow the user to define a variable called 'ls' if |
|
4255 | but whe should allow the user to define a variable called 'ls' if | |
4252 | he needs it. |
|
4256 | he needs it. | |
4253 |
|
4257 | |||
4254 | * Moved the ToDo information from README into a separate ToDo. |
|
4258 | * Moved the ToDo information from README into a separate ToDo. | |
4255 |
|
4259 | |||
4256 | * General code cleanup and small bugfixes. I think it's close to a |
|
4260 | * General code cleanup and small bugfixes. I think it's close to a | |
4257 | state where it can be released, obviously with a big 'beta' |
|
4261 | state where it can be released, obviously with a big 'beta' | |
4258 | warning on it. |
|
4262 | warning on it. | |
4259 |
|
4263 | |||
4260 | * Got the magic function split to work. Now all magics are defined |
|
4264 | * Got the magic function split to work. Now all magics are defined | |
4261 | in a separate class. It just organizes things a bit, and now |
|
4265 | in a separate class. It just organizes things a bit, and now | |
4262 | Xemacs behaves nicer (it was choking on InteractiveShell b/c it |
|
4266 | Xemacs behaves nicer (it was choking on InteractiveShell b/c it | |
4263 | was too long). |
|
4267 | was too long). | |
4264 |
|
4268 | |||
4265 | * Changed @clear to @reset to avoid potential confusions with |
|
4269 | * Changed @clear to @reset to avoid potential confusions with | |
4266 | the shell command clear. Also renamed @cl to @clear, which does |
|
4270 | the shell command clear. Also renamed @cl to @clear, which does | |
4267 | exactly what people expect it to from their shell experience. |
|
4271 | exactly what people expect it to from their shell experience. | |
4268 |
|
4272 | |||
4269 | Added a check to the @reset command (since it's so |
|
4273 | Added a check to the @reset command (since it's so | |
4270 | destructive, it's probably a good idea to ask for confirmation). |
|
4274 | destructive, it's probably a good idea to ask for confirmation). | |
4271 | But now reset only works for full namespace resetting. Since the |
|
4275 | But now reset only works for full namespace resetting. Since the | |
4272 | del keyword is already there for deleting a few specific |
|
4276 | del keyword is already there for deleting a few specific | |
4273 | variables, I don't see the point of having a redundant magic |
|
4277 | variables, I don't see the point of having a redundant magic | |
4274 | function for the same task. |
|
4278 | function for the same task. | |
4275 |
|
4279 | |||
4276 | 2001-11-24 Fernando Perez <fperez@colorado.edu> |
|
4280 | 2001-11-24 Fernando Perez <fperez@colorado.edu> | |
4277 |
|
4281 | |||
4278 | * Updated the builtin docs (esp. the ? ones). |
|
4282 | * Updated the builtin docs (esp. the ? ones). | |
4279 |
|
4283 | |||
4280 | * Ran all the code through pychecker. Not terribly impressed with |
|
4284 | * Ran all the code through pychecker. Not terribly impressed with | |
4281 | it: lots of spurious warnings and didn't really find anything of |
|
4285 | it: lots of spurious warnings and didn't really find anything of | |
4282 | substance (just a few modules being imported and not used). |
|
4286 | substance (just a few modules being imported and not used). | |
4283 |
|
4287 | |||
4284 | * Implemented the new ultraTB functionality into IPython. New |
|
4288 | * Implemented the new ultraTB functionality into IPython. New | |
4285 | option: xcolors. This chooses color scheme. xmode now only selects |
|
4289 | option: xcolors. This chooses color scheme. xmode now only selects | |
4286 | between Plain and Verbose. Better orthogonality. |
|
4290 | between Plain and Verbose. Better orthogonality. | |
4287 |
|
4291 | |||
4288 | * Large rewrite of ultraTB. Much cleaner now, with a separation of |
|
4292 | * Large rewrite of ultraTB. Much cleaner now, with a separation of | |
4289 | mode and color scheme for the exception handlers. Now it's |
|
4293 | mode and color scheme for the exception handlers. Now it's | |
4290 | possible to have the verbose traceback with no coloring. |
|
4294 | possible to have the verbose traceback with no coloring. | |
4291 |
|
4295 | |||
4292 | 2001-11-23 Fernando Perez <fperez@colorado.edu> |
|
4296 | 2001-11-23 Fernando Perez <fperez@colorado.edu> | |
4293 |
|
4297 | |||
4294 | * Version 0.1.12 released, 0.1.13 opened. |
|
4298 | * Version 0.1.12 released, 0.1.13 opened. | |
4295 |
|
4299 | |||
4296 | * Removed option to set auto-quote and auto-paren escapes by |
|
4300 | * Removed option to set auto-quote and auto-paren escapes by | |
4297 | user. The chances of breaking valid syntax are just too high. If |
|
4301 | user. The chances of breaking valid syntax are just too high. If | |
4298 | someone *really* wants, they can always dig into the code. |
|
4302 | someone *really* wants, they can always dig into the code. | |
4299 |
|
4303 | |||
4300 | * Made prompt separators configurable. |
|
4304 | * Made prompt separators configurable. | |
4301 |
|
4305 | |||
4302 | 2001-11-22 Fernando Perez <fperez@colorado.edu> |
|
4306 | 2001-11-22 Fernando Perez <fperez@colorado.edu> | |
4303 |
|
4307 | |||
4304 | * Small bugfixes in many places. |
|
4308 | * Small bugfixes in many places. | |
4305 |
|
4309 | |||
4306 | * Removed the MyCompleter class from ipplib. It seemed redundant |
|
4310 | * Removed the MyCompleter class from ipplib. It seemed redundant | |
4307 | with the C-p,C-n history search functionality. Less code to |
|
4311 | with the C-p,C-n history search functionality. Less code to | |
4308 | maintain. |
|
4312 | maintain. | |
4309 |
|
4313 | |||
4310 | * Moved all the original ipython.py code into ipythonlib.py. Right |
|
4314 | * Moved all the original ipython.py code into ipythonlib.py. Right | |
4311 | now it's just one big dump into a function called make_IPython, so |
|
4315 | now it's just one big dump into a function called make_IPython, so | |
4312 | no real modularity has been gained. But at least it makes the |
|
4316 | no real modularity has been gained. But at least it makes the | |
4313 | wrapper script tiny, and since ipythonlib is a module, it gets |
|
4317 | wrapper script tiny, and since ipythonlib is a module, it gets | |
4314 | compiled and startup is much faster. |
|
4318 | compiled and startup is much faster. | |
4315 |
|
4319 | |||
4316 | This is a reasobably 'deep' change, so we should test it for a |
|
4320 | This is a reasobably 'deep' change, so we should test it for a | |
4317 | while without messing too much more with the code. |
|
4321 | while without messing too much more with the code. | |
4318 |
|
4322 | |||
4319 | 2001-11-21 Fernando Perez <fperez@colorado.edu> |
|
4323 | 2001-11-21 Fernando Perez <fperez@colorado.edu> | |
4320 |
|
4324 | |||
4321 | * Version 0.1.11 released, 0.1.12 opened for further work. |
|
4325 | * Version 0.1.11 released, 0.1.12 opened for further work. | |
4322 |
|
4326 | |||
4323 | * Removed dependency on Itpl. It was only needed in one place. It |
|
4327 | * Removed dependency on Itpl. It was only needed in one place. It | |
4324 | would be nice if this became part of python, though. It makes life |
|
4328 | would be nice if this became part of python, though. It makes life | |
4325 | *a lot* easier in some cases. |
|
4329 | *a lot* easier in some cases. | |
4326 |
|
4330 | |||
4327 | * Simplified the prefilter code a bit. Now all handlers are |
|
4331 | * Simplified the prefilter code a bit. Now all handlers are | |
4328 | expected to explicitly return a value (at least a blank string). |
|
4332 | expected to explicitly return a value (at least a blank string). | |
4329 |
|
4333 | |||
4330 | * Heavy edits in ipplib. Removed the help system altogether. Now |
|
4334 | * Heavy edits in ipplib. Removed the help system altogether. Now | |
4331 | obj?/?? is used for inspecting objects, a magic @doc prints |
|
4335 | obj?/?? is used for inspecting objects, a magic @doc prints | |
4332 | docstrings, and full-blown Python help is accessed via the 'help' |
|
4336 | docstrings, and full-blown Python help is accessed via the 'help' | |
4333 | keyword. This cleans up a lot of code (less to maintain) and does |
|
4337 | keyword. This cleans up a lot of code (less to maintain) and does | |
4334 | the job. Since 'help' is now a standard Python component, might as |
|
4338 | the job. Since 'help' is now a standard Python component, might as | |
4335 | well use it and remove duplicate functionality. |
|
4339 | well use it and remove duplicate functionality. | |
4336 |
|
4340 | |||
4337 | Also removed the option to use ipplib as a standalone program. By |
|
4341 | Also removed the option to use ipplib as a standalone program. By | |
4338 | now it's too dependent on other parts of IPython to function alone. |
|
4342 | now it's too dependent on other parts of IPython to function alone. | |
4339 |
|
4343 | |||
4340 | * Fixed bug in genutils.pager. It would crash if the pager was |
|
4344 | * Fixed bug in genutils.pager. It would crash if the pager was | |
4341 | exited immediately after opening (broken pipe). |
|
4345 | exited immediately after opening (broken pipe). | |
4342 |
|
4346 | |||
4343 | * Trimmed down the VerboseTB reporting a little. The header is |
|
4347 | * Trimmed down the VerboseTB reporting a little. The header is | |
4344 | much shorter now and the repeated exception arguments at the end |
|
4348 | much shorter now and the repeated exception arguments at the end | |
4345 | have been removed. For interactive use the old header seemed a bit |
|
4349 | have been removed. For interactive use the old header seemed a bit | |
4346 | excessive. |
|
4350 | excessive. | |
4347 |
|
4351 | |||
4348 | * Fixed small bug in output of @whos for variables with multi-word |
|
4352 | * Fixed small bug in output of @whos for variables with multi-word | |
4349 | types (only first word was displayed). |
|
4353 | types (only first word was displayed). | |
4350 |
|
4354 | |||
4351 | 2001-11-17 Fernando Perez <fperez@colorado.edu> |
|
4355 | 2001-11-17 Fernando Perez <fperez@colorado.edu> | |
4352 |
|
4356 | |||
4353 | * Version 0.1.10 released, 0.1.11 opened for further work. |
|
4357 | * Version 0.1.10 released, 0.1.11 opened for further work. | |
4354 |
|
4358 | |||
4355 | * Modified dirs and friends. dirs now *returns* the stack (not |
|
4359 | * Modified dirs and friends. dirs now *returns* the stack (not | |
4356 | prints), so one can manipulate it as a variable. Convenient to |
|
4360 | prints), so one can manipulate it as a variable. Convenient to | |
4357 | travel along many directories. |
|
4361 | travel along many directories. | |
4358 |
|
4362 | |||
4359 | * Fixed bug in magic_pdef: would only work with functions with |
|
4363 | * Fixed bug in magic_pdef: would only work with functions with | |
4360 | arguments with default values. |
|
4364 | arguments with default values. | |
4361 |
|
4365 | |||
4362 | 2001-11-14 Fernando Perez <fperez@colorado.edu> |
|
4366 | 2001-11-14 Fernando Perez <fperez@colorado.edu> | |
4363 |
|
4367 | |||
4364 | * Added the PhysicsInput stuff to dot_ipython so it ships as an |
|
4368 | * Added the PhysicsInput stuff to dot_ipython so it ships as an | |
4365 | example with IPython. Various other minor fixes and cleanups. |
|
4369 | example with IPython. Various other minor fixes and cleanups. | |
4366 |
|
4370 | |||
4367 | * Version 0.1.9 released, 0.1.10 opened for further work. |
|
4371 | * Version 0.1.9 released, 0.1.10 opened for further work. | |
4368 |
|
4372 | |||
4369 | * Added sys.path to the list of directories searched in the |
|
4373 | * Added sys.path to the list of directories searched in the | |
4370 | execfile= option. It used to be the current directory and the |
|
4374 | execfile= option. It used to be the current directory and the | |
4371 | user's IPYTHONDIR only. |
|
4375 | user's IPYTHONDIR only. | |
4372 |
|
4376 | |||
4373 | 2001-11-13 Fernando Perez <fperez@colorado.edu> |
|
4377 | 2001-11-13 Fernando Perez <fperez@colorado.edu> | |
4374 |
|
4378 | |||
4375 | * Reinstated the raw_input/prefilter separation that Janko had |
|
4379 | * Reinstated the raw_input/prefilter separation that Janko had | |
4376 | initially. This gives a more convenient setup for extending the |
|
4380 | initially. This gives a more convenient setup for extending the | |
4377 | pre-processor from the outside: raw_input always gets a string, |
|
4381 | pre-processor from the outside: raw_input always gets a string, | |
4378 | and prefilter has to process it. We can then redefine prefilter |
|
4382 | and prefilter has to process it. We can then redefine prefilter | |
4379 | from the outside and implement extensions for special |
|
4383 | from the outside and implement extensions for special | |
4380 | purposes. |
|
4384 | purposes. | |
4381 |
|
4385 | |||
4382 | Today I got one for inputting PhysicalQuantity objects |
|
4386 | Today I got one for inputting PhysicalQuantity objects | |
4383 | (from Scientific) without needing any function calls at |
|
4387 | (from Scientific) without needing any function calls at | |
4384 | all. Extremely convenient, and it's all done as a user-level |
|
4388 | all. Extremely convenient, and it's all done as a user-level | |
4385 | extension (no IPython code was touched). Now instead of: |
|
4389 | extension (no IPython code was touched). Now instead of: | |
4386 | a = PhysicalQuantity(4.2,'m/s**2') |
|
4390 | a = PhysicalQuantity(4.2,'m/s**2') | |
4387 | one can simply say |
|
4391 | one can simply say | |
4388 | a = 4.2 m/s**2 |
|
4392 | a = 4.2 m/s**2 | |
4389 | or even |
|
4393 | or even | |
4390 | a = 4.2 m/s^2 |
|
4394 | a = 4.2 m/s^2 | |
4391 |
|
4395 | |||
4392 | I use this, but it's also a proof of concept: IPython really is |
|
4396 | I use this, but it's also a proof of concept: IPython really is | |
4393 | fully user-extensible, even at the level of the parsing of the |
|
4397 | fully user-extensible, even at the level of the parsing of the | |
4394 | command line. It's not trivial, but it's perfectly doable. |
|
4398 | command line. It's not trivial, but it's perfectly doable. | |
4395 |
|
4399 | |||
4396 | * Added 'add_flip' method to inclusion conflict resolver. Fixes |
|
4400 | * Added 'add_flip' method to inclusion conflict resolver. Fixes | |
4397 | the problem of modules being loaded in the inverse order in which |
|
4401 | the problem of modules being loaded in the inverse order in which | |
4398 | they were defined in |
|
4402 | they were defined in | |
4399 |
|
4403 | |||
4400 | * Version 0.1.8 released, 0.1.9 opened for further work. |
|
4404 | * Version 0.1.8 released, 0.1.9 opened for further work. | |
4401 |
|
4405 | |||
4402 | * Added magics pdef, source and file. They respectively show the |
|
4406 | * Added magics pdef, source and file. They respectively show the | |
4403 | definition line ('prototype' in C), source code and full python |
|
4407 | definition line ('prototype' in C), source code and full python | |
4404 | file for any callable object. The object inspector oinfo uses |
|
4408 | file for any callable object. The object inspector oinfo uses | |
4405 | these to show the same information. |
|
4409 | these to show the same information. | |
4406 |
|
4410 | |||
4407 | * Version 0.1.7 released, 0.1.8 opened for further work. |
|
4411 | * Version 0.1.7 released, 0.1.8 opened for further work. | |
4408 |
|
4412 | |||
4409 | * Separated all the magic functions into a class called Magic. The |
|
4413 | * Separated all the magic functions into a class called Magic. The | |
4410 | InteractiveShell class was becoming too big for Xemacs to handle |
|
4414 | InteractiveShell class was becoming too big for Xemacs to handle | |
4411 | (de-indenting a line would lock it up for 10 seconds while it |
|
4415 | (de-indenting a line would lock it up for 10 seconds while it | |
4412 | backtracked on the whole class!) |
|
4416 | backtracked on the whole class!) | |
4413 |
|
4417 | |||
4414 | FIXME: didn't work. It can be done, but right now namespaces are |
|
4418 | FIXME: didn't work. It can be done, but right now namespaces are | |
4415 | all messed up. Do it later (reverted it for now, so at least |
|
4419 | all messed up. Do it later (reverted it for now, so at least | |
4416 | everything works as before). |
|
4420 | everything works as before). | |
4417 |
|
4421 | |||
4418 | * Got the object introspection system (magic_oinfo) working! I |
|
4422 | * Got the object introspection system (magic_oinfo) working! I | |
4419 | think this is pretty much ready for release to Janko, so he can |
|
4423 | think this is pretty much ready for release to Janko, so he can | |
4420 | test it for a while and then announce it. Pretty much 100% of what |
|
4424 | test it for a while and then announce it. Pretty much 100% of what | |
4421 | I wanted for the 'phase 1' release is ready. Happy, tired. |
|
4425 | I wanted for the 'phase 1' release is ready. Happy, tired. | |
4422 |
|
4426 | |||
4423 | 2001-11-12 Fernando Perez <fperez@colorado.edu> |
|
4427 | 2001-11-12 Fernando Perez <fperez@colorado.edu> | |
4424 |
|
4428 | |||
4425 | * Version 0.1.6 released, 0.1.7 opened for further work. |
|
4429 | * Version 0.1.6 released, 0.1.7 opened for further work. | |
4426 |
|
4430 | |||
4427 | * Fixed bug in printing: it used to test for truth before |
|
4431 | * Fixed bug in printing: it used to test for truth before | |
4428 | printing, so 0 wouldn't print. Now checks for None. |
|
4432 | printing, so 0 wouldn't print. Now checks for None. | |
4429 |
|
4433 | |||
4430 | * Fixed bug where auto-execs increase the prompt counter by 2 (b/c |
|
4434 | * Fixed bug where auto-execs increase the prompt counter by 2 (b/c | |
4431 | they have to call len(str(sys.ps1)) ). But the fix is ugly, it |
|
4435 | they have to call len(str(sys.ps1)) ). But the fix is ugly, it | |
4432 | reaches by hand into the outputcache. Think of a better way to do |
|
4436 | reaches by hand into the outputcache. Think of a better way to do | |
4433 | this later. |
|
4437 | this later. | |
4434 |
|
4438 | |||
4435 | * Various small fixes thanks to Nathan's comments. |
|
4439 | * Various small fixes thanks to Nathan's comments. | |
4436 |
|
4440 | |||
4437 | * Changed magic_pprint to magic_Pprint. This way it doesn't |
|
4441 | * Changed magic_pprint to magic_Pprint. This way it doesn't | |
4438 | collide with pprint() and the name is consistent with the command |
|
4442 | collide with pprint() and the name is consistent with the command | |
4439 | line option. |
|
4443 | line option. | |
4440 |
|
4444 | |||
4441 | * Changed prompt counter behavior to be fully like |
|
4445 | * Changed prompt counter behavior to be fully like | |
4442 | Mathematica's. That is, even input that doesn't return a result |
|
4446 | Mathematica's. That is, even input that doesn't return a result | |
4443 | raises the prompt counter. The old behavior was kind of confusing |
|
4447 | raises the prompt counter. The old behavior was kind of confusing | |
4444 | (getting the same prompt number several times if the operation |
|
4448 | (getting the same prompt number several times if the operation | |
4445 | didn't return a result). |
|
4449 | didn't return a result). | |
4446 |
|
4450 | |||
4447 | * Fixed Nathan's last name in a couple of places (Gray, not Graham). |
|
4451 | * Fixed Nathan's last name in a couple of places (Gray, not Graham). | |
4448 |
|
4452 | |||
4449 | * Fixed -Classic mode (wasn't working anymore). |
|
4453 | * Fixed -Classic mode (wasn't working anymore). | |
4450 |
|
4454 | |||
4451 | * Added colored prompts using Nathan's new code. Colors are |
|
4455 | * Added colored prompts using Nathan's new code. Colors are | |
4452 | currently hardwired, they can be user-configurable. For |
|
4456 | currently hardwired, they can be user-configurable. For | |
4453 | developers, they can be chosen in file ipythonlib.py, at the |
|
4457 | developers, they can be chosen in file ipythonlib.py, at the | |
4454 | beginning of the CachedOutput class def. |
|
4458 | beginning of the CachedOutput class def. | |
4455 |
|
4459 | |||
4456 | 2001-11-11 Fernando Perez <fperez@colorado.edu> |
|
4460 | 2001-11-11 Fernando Perez <fperez@colorado.edu> | |
4457 |
|
4461 | |||
4458 | * Version 0.1.5 released, 0.1.6 opened for further work. |
|
4462 | * Version 0.1.5 released, 0.1.6 opened for further work. | |
4459 |
|
4463 | |||
4460 | * Changed magic_env to *return* the environment as a dict (not to |
|
4464 | * Changed magic_env to *return* the environment as a dict (not to | |
4461 | print it). This way it prints, but it can also be processed. |
|
4465 | print it). This way it prints, but it can also be processed. | |
4462 |
|
4466 | |||
4463 | * Added Verbose exception reporting to interactive |
|
4467 | * Added Verbose exception reporting to interactive | |
4464 | exceptions. Very nice, now even 1/0 at the prompt gives a verbose |
|
4468 | exceptions. Very nice, now even 1/0 at the prompt gives a verbose | |
4465 | traceback. Had to make some changes to the ultraTB file. This is |
|
4469 | traceback. Had to make some changes to the ultraTB file. This is | |
4466 | probably the last 'big' thing in my mental todo list. This ties |
|
4470 | probably the last 'big' thing in my mental todo list. This ties | |
4467 | in with the next entry: |
|
4471 | in with the next entry: | |
4468 |
|
4472 | |||
4469 | * Changed -Xi and -Xf to a single -xmode option. Now all the user |
|
4473 | * Changed -Xi and -Xf to a single -xmode option. Now all the user | |
4470 | has to specify is Plain, Color or Verbose for all exception |
|
4474 | has to specify is Plain, Color or Verbose for all exception | |
4471 | handling. |
|
4475 | handling. | |
4472 |
|
4476 | |||
4473 | * Removed ShellServices option. All this can really be done via |
|
4477 | * Removed ShellServices option. All this can really be done via | |
4474 | the magic system. It's easier to extend, cleaner and has automatic |
|
4478 | the magic system. It's easier to extend, cleaner and has automatic | |
4475 | namespace protection and documentation. |
|
4479 | namespace protection and documentation. | |
4476 |
|
4480 | |||
4477 | 2001-11-09 Fernando Perez <fperez@colorado.edu> |
|
4481 | 2001-11-09 Fernando Perez <fperez@colorado.edu> | |
4478 |
|
4482 | |||
4479 | * Fixed bug in output cache flushing (missing parameter to |
|
4483 | * Fixed bug in output cache flushing (missing parameter to | |
4480 | __init__). Other small bugs fixed (found using pychecker). |
|
4484 | __init__). Other small bugs fixed (found using pychecker). | |
4481 |
|
4485 | |||
4482 | * Version 0.1.4 opened for bugfixing. |
|
4486 | * Version 0.1.4 opened for bugfixing. | |
4483 |
|
4487 | |||
4484 | 2001-11-07 Fernando Perez <fperez@colorado.edu> |
|
4488 | 2001-11-07 Fernando Perez <fperez@colorado.edu> | |
4485 |
|
4489 | |||
4486 | * Version 0.1.3 released, mainly because of the raw_input bug. |
|
4490 | * Version 0.1.3 released, mainly because of the raw_input bug. | |
4487 |
|
4491 | |||
4488 | * Fixed NASTY bug in raw_input: input line wasn't properly parsed |
|
4492 | * Fixed NASTY bug in raw_input: input line wasn't properly parsed | |
4489 | and when testing for whether things were callable, a call could |
|
4493 | and when testing for whether things were callable, a call could | |
4490 | actually be made to certain functions. They would get called again |
|
4494 | actually be made to certain functions. They would get called again | |
4491 | once 'really' executed, with a resulting double call. A disaster |
|
4495 | once 'really' executed, with a resulting double call. A disaster | |
4492 | in many cases (list.reverse() would never work!). |
|
4496 | in many cases (list.reverse() would never work!). | |
4493 |
|
4497 | |||
4494 | * Removed prefilter() function, moved its code to raw_input (which |
|
4498 | * Removed prefilter() function, moved its code to raw_input (which | |
4495 | after all was just a near-empty caller for prefilter). This saves |
|
4499 | after all was just a near-empty caller for prefilter). This saves | |
4496 | a function call on every prompt, and simplifies the class a tiny bit. |
|
4500 | a function call on every prompt, and simplifies the class a tiny bit. | |
4497 |
|
4501 | |||
4498 | * Fix _ip to __ip name in magic example file. |
|
4502 | * Fix _ip to __ip name in magic example file. | |
4499 |
|
4503 | |||
4500 | * Changed 'tar -x -f' to 'tar xvf' in auto-installer. This should |
|
4504 | * Changed 'tar -x -f' to 'tar xvf' in auto-installer. This should | |
4501 | work with non-gnu versions of tar. |
|
4505 | work with non-gnu versions of tar. | |
4502 |
|
4506 | |||
4503 | 2001-11-06 Fernando Perez <fperez@colorado.edu> |
|
4507 | 2001-11-06 Fernando Perez <fperez@colorado.edu> | |
4504 |
|
4508 | |||
4505 | * Version 0.1.2. Just to keep track of the recent changes. |
|
4509 | * Version 0.1.2. Just to keep track of the recent changes. | |
4506 |
|
4510 | |||
4507 | * Fixed nasty bug in output prompt routine. It used to check 'if |
|
4511 | * Fixed nasty bug in output prompt routine. It used to check 'if | |
4508 | arg != None...'. Problem is, this fails if arg implements a |
|
4512 | arg != None...'. Problem is, this fails if arg implements a | |
4509 | special comparison (__cmp__) which disallows comparing to |
|
4513 | special comparison (__cmp__) which disallows comparing to | |
4510 | None. Found it when trying to use the PhysicalQuantity module from |
|
4514 | None. Found it when trying to use the PhysicalQuantity module from | |
4511 | ScientificPython. |
|
4515 | ScientificPython. | |
4512 |
|
4516 | |||
4513 | 2001-11-05 Fernando Perez <fperez@colorado.edu> |
|
4517 | 2001-11-05 Fernando Perez <fperez@colorado.edu> | |
4514 |
|
4518 | |||
4515 | * Also added dirs. Now the pushd/popd/dirs family functions |
|
4519 | * Also added dirs. Now the pushd/popd/dirs family functions | |
4516 | basically like the shell, with the added convenience of going home |
|
4520 | basically like the shell, with the added convenience of going home | |
4517 | when called with no args. |
|
4521 | when called with no args. | |
4518 |
|
4522 | |||
4519 | * pushd/popd slightly modified to mimic shell behavior more |
|
4523 | * pushd/popd slightly modified to mimic shell behavior more | |
4520 | closely. |
|
4524 | closely. | |
4521 |
|
4525 | |||
4522 | * Added env,pushd,popd from ShellServices as magic functions. I |
|
4526 | * Added env,pushd,popd from ShellServices as magic functions. I | |
4523 | think the cleanest will be to port all desired functions from |
|
4527 | think the cleanest will be to port all desired functions from | |
4524 | ShellServices as magics and remove ShellServices altogether. This |
|
4528 | ShellServices as magics and remove ShellServices altogether. This | |
4525 | will provide a single, clean way of adding functionality |
|
4529 | will provide a single, clean way of adding functionality | |
4526 | (shell-type or otherwise) to IP. |
|
4530 | (shell-type or otherwise) to IP. | |
4527 |
|
4531 | |||
4528 | 2001-11-04 Fernando Perez <fperez@colorado.edu> |
|
4532 | 2001-11-04 Fernando Perez <fperez@colorado.edu> | |
4529 |
|
4533 | |||
4530 | * Added .ipython/ directory to sys.path. This way users can keep |
|
4534 | * Added .ipython/ directory to sys.path. This way users can keep | |
4531 | customizations there and access them via import. |
|
4535 | customizations there and access them via import. | |
4532 |
|
4536 | |||
4533 | 2001-11-03 Fernando Perez <fperez@colorado.edu> |
|
4537 | 2001-11-03 Fernando Perez <fperez@colorado.edu> | |
4534 |
|
4538 | |||
4535 | * Opened version 0.1.1 for new changes. |
|
4539 | * Opened version 0.1.1 for new changes. | |
4536 |
|
4540 | |||
4537 | * Changed version number to 0.1.0: first 'public' release, sent to |
|
4541 | * Changed version number to 0.1.0: first 'public' release, sent to | |
4538 | Nathan and Janko. |
|
4542 | Nathan and Janko. | |
4539 |
|
4543 | |||
4540 | * Lots of small fixes and tweaks. |
|
4544 | * Lots of small fixes and tweaks. | |
4541 |
|
4545 | |||
4542 | * Minor changes to whos format. Now strings are shown, snipped if |
|
4546 | * Minor changes to whos format. Now strings are shown, snipped if | |
4543 | too long. |
|
4547 | too long. | |
4544 |
|
4548 | |||
4545 | * Changed ShellServices to work on __main__ so they show up in @who |
|
4549 | * Changed ShellServices to work on __main__ so they show up in @who | |
4546 |
|
4550 | |||
4547 | * Help also works with ? at the end of a line: |
|
4551 | * Help also works with ? at the end of a line: | |
4548 | ?sin and sin? |
|
4552 | ?sin and sin? | |
4549 | both produce the same effect. This is nice, as often I use the |
|
4553 | both produce the same effect. This is nice, as often I use the | |
4550 | tab-complete to find the name of a method, but I used to then have |
|
4554 | tab-complete to find the name of a method, but I used to then have | |
4551 | to go to the beginning of the line to put a ? if I wanted more |
|
4555 | to go to the beginning of the line to put a ? if I wanted more | |
4552 | info. Now I can just add the ? and hit return. Convenient. |
|
4556 | info. Now I can just add the ? and hit return. Convenient. | |
4553 |
|
4557 | |||
4554 | 2001-11-02 Fernando Perez <fperez@colorado.edu> |
|
4558 | 2001-11-02 Fernando Perez <fperez@colorado.edu> | |
4555 |
|
4559 | |||
4556 | * Python version check (>=2.1) added. |
|
4560 | * Python version check (>=2.1) added. | |
4557 |
|
4561 | |||
4558 | * Added LazyPython documentation. At this point the docs are quite |
|
4562 | * Added LazyPython documentation. At this point the docs are quite | |
4559 | a mess. A cleanup is in order. |
|
4563 | a mess. A cleanup is in order. | |
4560 |
|
4564 | |||
4561 | * Auto-installer created. For some bizarre reason, the zipfiles |
|
4565 | * Auto-installer created. For some bizarre reason, the zipfiles | |
4562 | module isn't working on my system. So I made a tar version |
|
4566 | module isn't working on my system. So I made a tar version | |
4563 | (hopefully the command line options in various systems won't kill |
|
4567 | (hopefully the command line options in various systems won't kill | |
4564 | me). |
|
4568 | me). | |
4565 |
|
4569 | |||
4566 | * Fixes to Struct in genutils. Now all dictionary-like methods are |
|
4570 | * Fixes to Struct in genutils. Now all dictionary-like methods are | |
4567 | protected (reasonably). |
|
4571 | protected (reasonably). | |
4568 |
|
4572 | |||
4569 | * Added pager function to genutils and changed ? to print usage |
|
4573 | * Added pager function to genutils and changed ? to print usage | |
4570 | note through it (it was too long). |
|
4574 | note through it (it was too long). | |
4571 |
|
4575 | |||
4572 | * Added the LazyPython functionality. Works great! I changed the |
|
4576 | * Added the LazyPython functionality. Works great! I changed the | |
4573 | auto-quote escape to ';', it's on home row and next to '. But |
|
4577 | auto-quote escape to ';', it's on home row and next to '. But | |
4574 | both auto-quote and auto-paren (still /) escapes are command-line |
|
4578 | both auto-quote and auto-paren (still /) escapes are command-line | |
4575 | parameters. |
|
4579 | parameters. | |
4576 |
|
4580 | |||
4577 |
|
4581 | |||
4578 | 2001-11-01 Fernando Perez <fperez@colorado.edu> |
|
4582 | 2001-11-01 Fernando Perez <fperez@colorado.edu> | |
4579 |
|
4583 | |||
4580 | * Version changed to 0.0.7. Fairly large change: configuration now |
|
4584 | * Version changed to 0.0.7. Fairly large change: configuration now | |
4581 | is all stored in a directory, by default .ipython. There, all |
|
4585 | is all stored in a directory, by default .ipython. There, all | |
4582 | config files have normal looking names (not .names) |
|
4586 | config files have normal looking names (not .names) | |
4583 |
|
4587 | |||
4584 | * Version 0.0.6 Released first to Lucas and Archie as a test |
|
4588 | * Version 0.0.6 Released first to Lucas and Archie as a test | |
4585 | run. Since it's the first 'semi-public' release, change version to |
|
4589 | run. Since it's the first 'semi-public' release, change version to | |
4586 | > 0.0.6 for any changes now. |
|
4590 | > 0.0.6 for any changes now. | |
4587 |
|
4591 | |||
4588 | * Stuff I had put in the ipplib.py changelog: |
|
4592 | * Stuff I had put in the ipplib.py changelog: | |
4589 |
|
4593 | |||
4590 | Changes to InteractiveShell: |
|
4594 | Changes to InteractiveShell: | |
4591 |
|
4595 | |||
4592 | - Made the usage message a parameter. |
|
4596 | - Made the usage message a parameter. | |
4593 |
|
4597 | |||
4594 | - Require the name of the shell variable to be given. It's a bit |
|
4598 | - Require the name of the shell variable to be given. It's a bit | |
4595 | of a hack, but allows the name 'shell' not to be hardwire in the |
|
4599 | of a hack, but allows the name 'shell' not to be hardwire in the | |
4596 | magic (@) handler, which is problematic b/c it requires |
|
4600 | magic (@) handler, which is problematic b/c it requires | |
4597 | polluting the global namespace with 'shell'. This in turn is |
|
4601 | polluting the global namespace with 'shell'. This in turn is | |
4598 | fragile: if a user redefines a variable called shell, things |
|
4602 | fragile: if a user redefines a variable called shell, things | |
4599 | break. |
|
4603 | break. | |
4600 |
|
4604 | |||
4601 | - magic @: all functions available through @ need to be defined |
|
4605 | - magic @: all functions available through @ need to be defined | |
4602 | as magic_<name>, even though they can be called simply as |
|
4606 | as magic_<name>, even though they can be called simply as | |
4603 | @<name>. This allows the special command @magic to gather |
|
4607 | @<name>. This allows the special command @magic to gather | |
4604 | information automatically about all existing magic functions, |
|
4608 | information automatically about all existing magic functions, | |
4605 | even if they are run-time user extensions, by parsing the shell |
|
4609 | even if they are run-time user extensions, by parsing the shell | |
4606 | instance __dict__ looking for special magic_ names. |
|
4610 | instance __dict__ looking for special magic_ names. | |
4607 |
|
4611 | |||
4608 | - mainloop: added *two* local namespace parameters. This allows |
|
4612 | - mainloop: added *two* local namespace parameters. This allows | |
4609 | the class to differentiate between parameters which were there |
|
4613 | the class to differentiate between parameters which were there | |
4610 | before and after command line initialization was processed. This |
|
4614 | before and after command line initialization was processed. This | |
4611 | way, later @who can show things loaded at startup by the |
|
4615 | way, later @who can show things loaded at startup by the | |
4612 | user. This trick was necessary to make session saving/reloading |
|
4616 | user. This trick was necessary to make session saving/reloading | |
4613 | really work: ideally after saving/exiting/reloading a session, |
|
4617 | really work: ideally after saving/exiting/reloading a session, | |
4614 | *everythin* should look the same, including the output of @who. I |
|
4618 | *everythin* should look the same, including the output of @who. I | |
4615 | was only able to make this work with this double namespace |
|
4619 | was only able to make this work with this double namespace | |
4616 | trick. |
|
4620 | trick. | |
4617 |
|
4621 | |||
4618 | - added a header to the logfile which allows (almost) full |
|
4622 | - added a header to the logfile which allows (almost) full | |
4619 | session restoring. |
|
4623 | session restoring. | |
4620 |
|
4624 | |||
4621 | - prepend lines beginning with @ or !, with a and log |
|
4625 | - prepend lines beginning with @ or !, with a and log | |
4622 | them. Why? !lines: may be useful to know what you did @lines: |
|
4626 | them. Why? !lines: may be useful to know what you did @lines: | |
4623 | they may affect session state. So when restoring a session, at |
|
4627 | they may affect session state. So when restoring a session, at | |
4624 | least inform the user of their presence. I couldn't quite get |
|
4628 | least inform the user of their presence. I couldn't quite get | |
4625 | them to properly re-execute, but at least the user is warned. |
|
4629 | them to properly re-execute, but at least the user is warned. | |
4626 |
|
4630 | |||
4627 | * Started ChangeLog. |
|
4631 | * Started ChangeLog. |
General Comments 0
You need to be logged in to leave comments.
Login now