##// END OF EJS Templates
New wildcard support. Lightly tested, so proceed with caution. We need to...
fperez -
Show More
@@ -0,0 +1,157 b''
1 # -*- coding: utf-8 -*-
2 """Support for wildcard pattern matching in object inspection.
3
4 $Id: OInspect.py 608 2005-07-06 17:52:32Z fperez $
5 """
6
7 #*****************************************************************************
8 # Copyright (C) 2005 Jörgen Stenarson <jorgen.stenarson@bostream.nu>
9 #
10 # Distributed under the terms of the BSD License. The full license is in
11 # the file COPYING, distributed as part of this software.
12 #*****************************************************************************
13
14 from IPython import Release
15 __author__ = "Jörgen Stenarson <jorgen.stenarson@bostream.nu>"
16 __license__ = Release.license
17
18 import __builtin__
19 import types
20 import re
21 import pprint
22 import exceptions
23 import pdb
24 import IPython.genutils as genutils
25
26 def create_typestr2type_dicts(dont_include_in_type2type2str=["lambda"]):
27 """Return dictionaries mapping lower case typename to type objects, from
28 the types package, and vice versa."""
29 typenamelist=[]
30 for tname in dir(types):
31 if tname[-4:]=="Type":
32 typenamelist.append(tname)
33 typestr2type={}
34 type2typestr={}
35 for tname in typenamelist:
36 name=tname[:-4].lower()
37 obj=getattr(types,tname)
38 typestr2type[name]=getattr(types,tname)
39 if name in dont_include_in_type2type2str:
40 type2typestr[obj]=name
41 return typestr2type,type2typestr
42
43 typestr2type,type2typestr=create_typestr2type_dicts()
44
45 def is_type(obj,typestr_or_type):
46 """is_type(obj,typestr_or_type) verifies if obj is of a certain type or
47 group of types takes strings as parameters of the for 'tuple'<->TupleType
48 'all' matches all types. TODO: Should be extended for choosing more than
49 one type
50 """
51 if typestr_or_type=="all":
52 return True
53 if type(typestr_or_type)==types.TypeType:
54 test_type=typestr_or_type
55 else:
56 test_type=typestr2type.get(typestr_or_type,False)
57 if test_type:
58 return isinstance(obj,test_type)
59 else:
60 return False
61
62 def show_hidden(str,showhidden=False):
63 """Return true for strings starting with single _ if showhidden is true."""
64 return showhidden or str.startswith("__") or not str.startswith("_")
65
66
67 class NameSpace(object):
68 """NameSpace holds the dictionary for a namespace and implements filtering
69 on name and types"""
70 def __init__(self,obj,namepattern="*",typepattern="all",ignorecase=True,
71 showhidden=True):
72 self.showhidden=showhidden #Hide names beginning with single _
73 self.object=obj
74 self.namepattern=namepattern
75 self.typepattern=typepattern
76 self.ignorecase=ignorecase
77 if type(obj)==type(dict()):
78 self._ns=obj
79 else:
80 try:
81 self._ns=self.object.__dict__
82 except exceptions.AttributeError:
83 self._ns=dict([(key,getattr(self.object,key))
84 for key in dir(self.object)])
85
86 def get_ns(self):
87 """Return name space dictionary with objects matching type and name patterns."""
88 return self.filter(self.namepattern,self.typepattern)
89 ns=property(get_ns)
90
91 def get_ns_names(self):
92 """Return list of object names in namespace that match the patterns."""
93 return self.ns.keys()
94 ns_names=property(get_ns_names,doc="List of objects in name space that "
95 "match the type and name patterns.")
96
97 def filter(self,namepattern,typepattern):
98 """Return dictionary of filtered namespace."""
99 def glob_filter(lista,namepattern,hidehidden,ignorecase):
100 """Return list of elements in lista that match pattern."""
101 pattern=namepattern.replace("*",".*")
102 if ignorecase:
103 reg=re.compile(pattern+"$",re.I)
104 else:
105 reg=re.compile(pattern+"$")
106 result=[x for x in lista if reg.match(x) and show_hidden(x,hidehidden)]
107 return result
108 ns=self._ns
109 #Filter namespace by the namepattern
110 all=[(x,ns[x]) for x in glob_filter(ns.keys(),namepattern,
111 self.showhidden,self.ignorecase)]
112 #Filter namespace by typepattern
113 all=[(key,obj) for key,obj in all if is_type(obj,typepattern)]
114 all=dict(all)
115 return all
116
117 #TODO: Implement dictionary like access to filtered name space?
118
119 def list_namespace(namespace,typepattern,filter,ignorecase=False,showhidden=False):
120 """Return dictionary of all objects in namespace that matches typepattern
121 and filter."""
122 patternlist=filter.split(".")
123 if len(patternlist)==1:
124 ns=NameSpace(namespace,namepattern=patternlist[0],typepattern=typepattern,
125 ignorecase=ignorecase,showhidden=showhidden)
126 return ns.ns
127 if len(patternlist)>1:
128 #This is where we can change if all objects should be searched or only moduleas
129 #Just change the typepattern to module to search only modules
130 ns=NameSpace(namespace,
131 namepattern=patternlist[0],
132 typepattern="all",ignorecase=ignorecase,showhidden=showhidden)
133 res={}
134 nsdict=ns.ns
135 for name,obj in nsdict.iteritems():
136 ns=list_namespace(obj,typepattern,".".join(patternlist[1:]),
137 ignorecase=ignorecase,showhidden=showhidden)
138 for inner_name,inner_obj in ns.iteritems():
139 res["%s.%s"%(name,inner_name)]=inner_obj
140 return res
141
142 def choose_namespaces(shell,cmds):
143 """Returns a list of namespaces modified by arguments."""
144 nslist=genutils.mkdict(user=shell.user_ns,internal=shell.internal_ns,
145 builtin=__builtin__.__dict__,alias=shell.alias_table)
146 default_list=["user","builtin"] # Should this list be a user option??
147 for cmd in cmds:
148 if cmd[0]=="-": #remove from defaultlist
149 if cmd[1:] in default_list:
150 default_list.remove(cmd[1:])
151 elif cmd[0]=="+":
152 if cmd[1:] not in default_list and cmd[1:]in nslist:
153 default_list.append(cmd[1:])
154 else:
155 if cmd in nslist:
156 default_list.append(cmd[1:])
157 return [nslist[x] for x in default_list]
@@ -1,2452 +1,2509 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 908 2005-09-26 16:05:48Z fperez $"""
4 $Id: Magic.py 919 2005-10-15 07:57:05Z 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 os,sys,inspect,pydoc,re,tempfile,pdb,bdb,time
24 import os,sys,inspect,pydoc,re,tempfile,pdb,bdb,time
25 try:
25 try:
26 import profile,pstats
26 import profile,pstats
27 except ImportError:
27 except ImportError:
28 profile = pstats = None
28 profile = pstats = None
29 from getopt import getopt
29 from getopt import getopt
30 from pprint import pprint, pformat
30 from pprint import pprint, pformat
31 from cStringIO import StringIO
31 from cStringIO import StringIO
32
32
33 # Homebrewed
33 # Homebrewed
34 from IPython.Struct import Struct
34 from IPython.Struct import Struct
35 from IPython.Itpl import Itpl, itpl, printpl,itplns
35 from IPython.Itpl import Itpl, itpl, printpl,itplns
36 from IPython.FakeModule import FakeModule
36 from IPython.FakeModule import FakeModule
37 from IPython import OInspect
38 from IPython.PyColorize import Parser
37 from IPython.PyColorize import Parser
38 from IPython import OInspect
39 from IPython import wildcard
39 from IPython.genutils import *
40 from IPython.genutils import *
40
41
41 # Globals to be set later by Magic constructor
42 # Globals to be set later by Magic constructor
42 MAGIC_PREFIX = ''
43 MAGIC_PREFIX = ''
43 MAGIC_ESCAPE = ''
44 MAGIC_ESCAPE = ''
44
45
45 #***************************************************************************
46 #***************************************************************************
46 # Utility functions
47 # Utility functions
47 def magic2python(cmd):
48 def magic2python(cmd):
48 """Convert a command string of magic syntax to valid Python code."""
49 """Convert a command string of magic syntax to valid Python code."""
49
50
50 if cmd.startswith('#'+MAGIC_ESCAPE) or \
51 if cmd.startswith('#'+MAGIC_ESCAPE) or \
51 cmd.startswith(MAGIC_ESCAPE):
52 cmd.startswith(MAGIC_ESCAPE):
52 if cmd[0]=='#':
53 if cmd[0]=='#':
53 cmd = cmd[1:]
54 cmd = cmd[1:]
54 # we need to return the proper line end later
55 # we need to return the proper line end later
55 if cmd[-1] == '\n':
56 if cmd[-1] == '\n':
56 endl = '\n'
57 endl = '\n'
57 else:
58 else:
58 endl = ''
59 endl = ''
59 try:
60 try:
60 func,args = cmd[1:].split(' ',1)
61 func,args = cmd[1:].split(' ',1)
61 except:
62 except:
62 func,args = cmd[1:].rstrip(),''
63 func,args = cmd[1:].rstrip(),''
63 args = args.replace('"','\\"').replace("'","\\'").rstrip()
64 args = args.replace('"','\\"').replace("'","\\'").rstrip()
64 return '%s%s ("%s")%s' % (MAGIC_PREFIX,func,args,endl)
65 return '%s%s ("%s")%s' % (MAGIC_PREFIX,func,args,endl)
65 else:
66 else:
66 return cmd
67 return cmd
67
68
68 def on_off(tag):
69 def on_off(tag):
69 """Return an ON/OFF string for a 1/0 input. Simple utility function."""
70 """Return an ON/OFF string for a 1/0 input. Simple utility function."""
70 return ['OFF','ON'][tag]
71 return ['OFF','ON'][tag]
71
72
72
73
73 #****************************************************************************
74 #****************************************************************************
74 # Utility classes
75 # Utility classes
75 class Macro:
76 class Macro:
76 """Simple class to store the value of macros as strings.
77 """Simple class to store the value of macros as strings.
77
78
78 This allows us to later exec them by checking when something is an
79 This allows us to later exec them by checking when something is an
79 instance of this class."""
80 instance of this class."""
80
81
81 def __init__(self,cmds):
82 def __init__(self,cmds):
82 """Build a macro from a list of commands."""
83 """Build a macro from a list of commands."""
83
84
84 # Since the list may include multi-line entries, first make sure that
85 # Since the list may include multi-line entries, first make sure that
85 # they've been all broken up before passing it to magic2python
86 # they've been all broken up before passing it to magic2python
86 cmdlist = map(magic2python,''.join(cmds).split('\n'))
87 cmdlist = map(magic2python,''.join(cmds).split('\n'))
87 self.value = '\n'.join(cmdlist)
88 self.value = '\n'.join(cmdlist)
88
89
89 def __str__(self):
90 def __str__(self):
90 return self.value
91 return self.value
91
92
92 #***************************************************************************
93 #***************************************************************************
93 # Main class implementing Magic functionality
94 # Main class implementing Magic functionality
94 class Magic:
95 class Magic:
95 """Magic functions for InteractiveShell.
96 """Magic functions for InteractiveShell.
96
97
97 Shell functions which can be reached as %function_name. All magic
98 Shell functions which can be reached as %function_name. All magic
98 functions should accept a string, which they can parse for their own
99 functions should accept a string, which they can parse for their own
99 needs. This can make some functions easier to type, eg `%cd ../`
100 needs. This can make some functions easier to type, eg `%cd ../`
100 vs. `%cd("../")`
101 vs. `%cd("../")`
101
102
102 ALL definitions MUST begin with the prefix magic_. The user won't need it
103 ALL definitions MUST begin with the prefix magic_. The user won't need it
103 at the command line, but it is is needed in the definition. """
104 at the command line, but it is is needed in the definition. """
104
105
105 # class globals
106 # class globals
106 auto_status = ['Automagic is OFF, % prefix IS needed for magic functions.',
107 auto_status = ['Automagic is OFF, % prefix IS needed for magic functions.',
107 'Automagic is ON, % prefix NOT needed for magic functions.']
108 'Automagic is ON, % prefix NOT needed for magic functions.']
108
109
109 #......................................................................
110 #......................................................................
110 # some utility functions
111 # some utility functions
111
112
112 def __init__(self,shell):
113 def __init__(self,shell):
113 # XXX This is hackish, clean up later to avoid these messy globals
114 # XXX This is hackish, clean up later to avoid these messy globals
114 global MAGIC_PREFIX, MAGIC_ESCAPE
115 global MAGIC_PREFIX, MAGIC_ESCAPE
115
116
116 self.options_table = {}
117 self.options_table = {}
117 MAGIC_PREFIX = shell.name+'.magic_'
118 MAGIC_PREFIX = shell.name+'.magic_'
118 MAGIC_ESCAPE = shell.ESC_MAGIC
119 MAGIC_ESCAPE = shell.ESC_MAGIC
119 if profile is None:
120 if profile is None:
120 self.magic_prun = self.profile_missing_notice
121 self.magic_prun = self.profile_missing_notice
121
122
122 def profile_missing_notice(self, *args, **kwargs):
123 def profile_missing_notice(self, *args, **kwargs):
123 error("""\
124 error("""\
124 The profile module could not be found. If you are a Debian user,
125 The profile module could not be found. If you are a Debian user,
125 it has been removed from the standard Debian package because of its non-free
126 it has been removed from the standard Debian package because of its non-free
126 license. To use profiling, please install"python2.3-profiler" from non-free.""")
127 license. To use profiling, please install"python2.3-profiler" from non-free.""")
127
128
128 def default_option(self,fn,optstr):
129 def default_option(self,fn,optstr):
129 """Make an entry in the options_table for fn, with value optstr"""
130 """Make an entry in the options_table for fn, with value optstr"""
130
131
131 if fn not in self.lsmagic():
132 if fn not in self.lsmagic():
132 error("%s is not a magic function" % fn)
133 error("%s is not a magic function" % fn)
133 self.options_table[fn] = optstr
134 self.options_table[fn] = optstr
134
135
135 def lsmagic(self):
136 def lsmagic(self):
136 """Return a list of currently available magic functions.
137 """Return a list of currently available magic functions.
137
138
138 Gives a list of the bare names after mangling (['ls','cd', ...], not
139 Gives a list of the bare names after mangling (['ls','cd', ...], not
139 ['magic_ls','magic_cd',...]"""
140 ['magic_ls','magic_cd',...]"""
140
141
141 # FIXME. This needs a cleanup, in the way the magics list is built.
142 # FIXME. This needs a cleanup, in the way the magics list is built.
142
143
143 # magics in class definition
144 # magics in class definition
144 class_magic = lambda fn: fn.startswith('magic_') and \
145 class_magic = lambda fn: fn.startswith('magic_') and \
145 callable(Magic.__dict__[fn])
146 callable(Magic.__dict__[fn])
146 # in instance namespace (run-time user additions)
147 # in instance namespace (run-time user additions)
147 inst_magic = lambda fn: fn.startswith('magic_') and \
148 inst_magic = lambda fn: fn.startswith('magic_') and \
148 callable(self.__dict__[fn])
149 callable(self.__dict__[fn])
149 # and bound magics by user (so they can access self):
150 # and bound magics by user (so they can access self):
150 inst_bound_magic = lambda fn: fn.startswith('magic_') and \
151 inst_bound_magic = lambda fn: fn.startswith('magic_') and \
151 callable(self.__class__.__dict__[fn])
152 callable(self.__class__.__dict__[fn])
152 magics = filter(class_magic,Magic.__dict__.keys()) + \
153 magics = filter(class_magic,Magic.__dict__.keys()) + \
153 filter(inst_magic,self.__dict__.keys()) + \
154 filter(inst_magic,self.__dict__.keys()) + \
154 filter(inst_bound_magic,self.__class__.__dict__.keys())
155 filter(inst_bound_magic,self.__class__.__dict__.keys())
155 out = []
156 out = []
156 for fn in magics:
157 for fn in magics:
157 out.append(fn.replace('magic_','',1))
158 out.append(fn.replace('magic_','',1))
158 out.sort()
159 out.sort()
159 return out
160 return out
160
161
161 def set_shell(self,shell):
162 def set_shell(self,shell):
162 self.shell = shell
163 self.shell = shell
163 self.alias_table = shell.alias_table
164 self.alias_table = shell.alias_table
164
165
165 def extract_input_slices(self,slices):
166 def extract_input_slices(self,slices):
166 """Return as a string a set of input history slices.
167 """Return as a string a set of input history slices.
167
168
168 The set of slices is given as a list of strings (like ['1','4:8','9'],
169 The set of slices is given as a list of strings (like ['1','4:8','9'],
169 since this function is for use by magic functions which get their
170 since this function is for use by magic functions which get their
170 arguments as strings."""
171 arguments as strings."""
171
172
172 cmds = []
173 cmds = []
173 for chunk in slices:
174 for chunk in slices:
174 if ':' in chunk:
175 if ':' in chunk:
175 ini,fin = map(int,chunk.split(':'))
176 ini,fin = map(int,chunk.split(':'))
176 else:
177 else:
177 ini = int(chunk)
178 ini = int(chunk)
178 fin = ini+1
179 fin = ini+1
179 cmds.append(self.shell.input_hist[ini:fin])
180 cmds.append(self.shell.input_hist[ini:fin])
180 return cmds
181 return cmds
181
182
182 def _ofind(self,oname):
183 def _ofind(self,oname):
183 """Find an object in the available namespaces.
184 """Find an object in the available namespaces.
184
185
185 self._ofind(oname) -> dict with keys: found,obj,ospace,ismagic
186 self._ofind(oname) -> dict with keys: found,obj,ospace,ismagic
186
187
187 Has special code to detect magic functions.
188 Has special code to detect magic functions.
188 """
189 """
189
190
190 oname = oname.strip()
191 oname = oname.strip()
191
192
192 # Namespaces to search in:
193 # Namespaces to search in:
193 user_ns = self.shell.user_ns
194 user_ns = self.shell.user_ns
194 internal_ns = self.shell.internal_ns
195 internal_ns = self.shell.internal_ns
195 builtin_ns = __builtin__.__dict__
196 builtin_ns = __builtin__.__dict__
196 alias_ns = self.shell.alias_table
197 alias_ns = self.shell.alias_table
197
198
198 # Put them in a list. The order is important so that we find things in
199 # Put them in a list. The order is important so that we find things in
199 # the same order that Python finds them.
200 # the same order that Python finds them.
200 namespaces = [ ('Interactive',user_ns),
201 namespaces = [ ('Interactive',user_ns),
201 ('IPython internal',internal_ns),
202 ('IPython internal',internal_ns),
202 ('Python builtin',builtin_ns),
203 ('Python builtin',builtin_ns),
203 ('Alias',alias_ns),
204 ('Alias',alias_ns),
204 ]
205 ]
205
206
206 # initialize results to 'null'
207 # initialize results to 'null'
207 found = 0; obj = None; ospace = None; ds = None;
208 found = 0; obj = None; ospace = None; ds = None;
208 ismagic = 0; isalias = 0
209 ismagic = 0; isalias = 0
209
210
210 # Look for the given name by splitting it in parts. If the head is
211 # Look for the given name by splitting it in parts. If the head is
211 # found, then we look for all the remaining parts as members, and only
212 # found, then we look for all the remaining parts as members, and only
212 # declare success if we can find them all.
213 # declare success if we can find them all.
213 oname_parts = oname.split('.')
214 oname_parts = oname.split('.')
214 oname_head, oname_rest = oname_parts[0],oname_parts[1:]
215 oname_head, oname_rest = oname_parts[0],oname_parts[1:]
215 for nsname,ns in namespaces:
216 for nsname,ns in namespaces:
216 try:
217 try:
217 obj = ns[oname_head]
218 obj = ns[oname_head]
218 except KeyError:
219 except KeyError:
219 continue
220 continue
220 else:
221 else:
221 for part in oname_rest:
222 for part in oname_rest:
222 try:
223 try:
223 obj = getattr(obj,part)
224 obj = getattr(obj,part)
224 except:
225 except:
225 # Blanket except b/c some badly implemented objects
226 # Blanket except b/c some badly implemented objects
226 # allow __getattr__ to raise exceptions other than
227 # allow __getattr__ to raise exceptions other than
227 # AttributeError, which then crashes IPython.
228 # AttributeError, which then crashes IPython.
228 break
229 break
229 else:
230 else:
230 # If we finish the for loop (no break), we got all members
231 # If we finish the for loop (no break), we got all members
231 found = 1
232 found = 1
232 ospace = nsname
233 ospace = nsname
233 if ns == alias_ns:
234 if ns == alias_ns:
234 isalias = 1
235 isalias = 1
235 break # namespace loop
236 break # namespace loop
236
237
237 # Try to see if it's magic
238 # Try to see if it's magic
238 if not found:
239 if not found:
239 if oname.startswith(self.shell.ESC_MAGIC):
240 if oname.startswith(self.shell.ESC_MAGIC):
240 oname = oname[1:]
241 oname = oname[1:]
241 obj = getattr(self,'magic_'+oname,None)
242 obj = getattr(self,'magic_'+oname,None)
242 if obj is not None:
243 if obj is not None:
243 found = 1
244 found = 1
244 ospace = 'IPython internal'
245 ospace = 'IPython internal'
245 ismagic = 1
246 ismagic = 1
246
247
247 # Last try: special-case some literals like '', [], {}, etc:
248 # Last try: special-case some literals like '', [], {}, etc:
248 if not found and oname_head in ["''",'""','[]','{}','()']:
249 if not found and oname_head in ["''",'""','[]','{}','()']:
249 obj = eval(oname_head)
250 obj = eval(oname_head)
250 found = 1
251 found = 1
251 ospace = 'Interactive'
252 ospace = 'Interactive'
252
253
253 return {'found':found, 'obj':obj, 'namespace':ospace,
254 return {'found':found, 'obj':obj, 'namespace':ospace,
254 'ismagic':ismagic, 'isalias':isalias}
255 'ismagic':ismagic, 'isalias':isalias}
255
256
256 def arg_err(self,func):
257 def arg_err(self,func):
257 """Print docstring if incorrect arguments were passed"""
258 """Print docstring if incorrect arguments were passed"""
258 print 'Error in arguments:'
259 print 'Error in arguments:'
259 print OInspect.getdoc(func)
260 print OInspect.getdoc(func)
260
261
261
262
262 def format_latex(self,str):
263 def format_latex(self,str):
263 """Format a string for latex inclusion."""
264 """Format a string for latex inclusion."""
264
265
265 # Characters that need to be escaped for latex:
266 # Characters that need to be escaped for latex:
266 escape_re = re.compile(r'(%|_|\$)',re.MULTILINE)
267 escape_re = re.compile(r'(%|_|\$)',re.MULTILINE)
267 # Magic command names as headers:
268 # Magic command names as headers:
268 cmd_name_re = re.compile(r'^(%s.*?):' % self.shell.ESC_MAGIC,
269 cmd_name_re = re.compile(r'^(%s.*?):' % self.shell.ESC_MAGIC,
269 re.MULTILINE)
270 re.MULTILINE)
270 # Magic commands
271 # Magic commands
271 cmd_re = re.compile(r'(?P<cmd>%s.+?\b)(?!\}\}:)' % self.shell.ESC_MAGIC,
272 cmd_re = re.compile(r'(?P<cmd>%s.+?\b)(?!\}\}:)' % self.shell.ESC_MAGIC,
272 re.MULTILINE)
273 re.MULTILINE)
273 # Paragraph continue
274 # Paragraph continue
274 par_re = re.compile(r'\\$',re.MULTILINE)
275 par_re = re.compile(r'\\$',re.MULTILINE)
275
276
276 str = cmd_name_re.sub(r'\n\\texttt{\\textsl{\\large \1}}:',str)
277 str = cmd_name_re.sub(r'\n\\texttt{\\textsl{\\large \1}}:',str)
277 str = cmd_re.sub(r'\\texttt{\g<cmd>}',str)
278 str = cmd_re.sub(r'\\texttt{\g<cmd>}',str)
278 str = par_re.sub(r'\\\\',str)
279 str = par_re.sub(r'\\\\',str)
279 str = escape_re.sub(r'\\\1',str)
280 str = escape_re.sub(r'\\\1',str)
280 return str
281 return str
281
282
282 def format_screen(self,str):
283 def format_screen(self,str):
283 """Format a string for screen printing.
284 """Format a string for screen printing.
284
285
285 This removes some latex-type format codes."""
286 This removes some latex-type format codes."""
286 # Paragraph continue
287 # Paragraph continue
287 par_re = re.compile(r'\\$',re.MULTILINE)
288 par_re = re.compile(r'\\$',re.MULTILINE)
288 str = par_re.sub('',str)
289 str = par_re.sub('',str)
289 return str
290 return str
290
291
291 def parse_options(self,arg_str,opt_str,*long_opts,**kw):
292 def parse_options(self,arg_str,opt_str,*long_opts,**kw):
292 """Parse options passed to an argument string.
293 """Parse options passed to an argument string.
293
294
294 The interface is similar to that of getopt(), but it returns back a
295 The interface is similar to that of getopt(), but it returns back a
295 Struct with the options as keys and the stripped argument string still
296 Struct with the options as keys and the stripped argument string still
296 as a string.
297 as a string.
297
298
298 arg_str is quoted as a true sys.argv vector by calling on the fly a
299 arg_str is quoted as a true sys.argv vector by calling on the fly a
299 python process in a subshell. This allows us to easily expand
300 python process in a subshell. This allows us to easily expand
300 variables, glob files, quote arguments, etc, with all the power and
301 variables, glob files, quote arguments, etc, with all the power and
301 correctness of the underlying system shell.
302 correctness of the underlying system shell.
302
303
303 Options:
304 Options:
304 -mode: default 'string'. If given as 'list', the argument string is
305 -mode: default 'string'. If given as 'list', the argument string is
305 returned as a list (split on whitespace) instead of a string.
306 returned as a list (split on whitespace) instead of a string.
306
307
307 -list_all: put all option values in lists. Normally only options
308 -list_all: put all option values in lists. Normally only options
308 appearing more than once are put in a list."""
309 appearing more than once are put in a list."""
309
310
310 # inject default options at the beginning of the input line
311 # inject default options at the beginning of the input line
311 caller = sys._getframe(1).f_code.co_name.replace('magic_','')
312 caller = sys._getframe(1).f_code.co_name.replace('magic_','')
312 arg_str = '%s %s' % (self.options_table.get(caller,''),arg_str)
313 arg_str = '%s %s' % (self.options_table.get(caller,''),arg_str)
313
314
314 mode = kw.get('mode','string')
315 mode = kw.get('mode','string')
315 if mode not in ['string','list']:
316 if mode not in ['string','list']:
316 raise ValueError,'incorrect mode given: %s' % mode
317 raise ValueError,'incorrect mode given: %s' % mode
317 # Get options
318 # Get options
318 list_all = kw.get('list_all',0)
319 list_all = kw.get('list_all',0)
319
320
320 # Check if we have more than one argument to warrant extra processing:
321 # Check if we have more than one argument to warrant extra processing:
321 odict = {} # Dictionary with options
322 odict = {} # Dictionary with options
322 args = arg_str.split()
323 args = arg_str.split()
323 if len(args) >= 1:
324 if len(args) >= 1:
324 # If the list of inputs only has 0 or 1 thing in it, there's no
325 # If the list of inputs only has 0 or 1 thing in it, there's no
325 # need to look for options
326 # need to look for options
326 argv = shlex_split(arg_str)
327 argv = shlex_split(arg_str)
327 # Do regular option processing
328 # Do regular option processing
328 opts,args = getopt(argv,opt_str,*long_opts)
329 opts,args = getopt(argv,opt_str,*long_opts)
329 for o,a in opts:
330 for o,a in opts:
330 if o.startswith('--'):
331 if o.startswith('--'):
331 o = o[2:]
332 o = o[2:]
332 else:
333 else:
333 o = o[1:]
334 o = o[1:]
334 try:
335 try:
335 odict[o].append(a)
336 odict[o].append(a)
336 except AttributeError:
337 except AttributeError:
337 odict[o] = [odict[o],a]
338 odict[o] = [odict[o],a]
338 except KeyError:
339 except KeyError:
339 if list_all:
340 if list_all:
340 odict[o] = [a]
341 odict[o] = [a]
341 else:
342 else:
342 odict[o] = a
343 odict[o] = a
343
344
344 # Prepare opts,args for return
345 # Prepare opts,args for return
345 opts = Struct(odict)
346 opts = Struct(odict)
346 if mode == 'string':
347 if mode == 'string':
347 args = ' '.join(args)
348 args = ' '.join(args)
348
349
349 return opts,args
350 return opts,args
350
351
351 #......................................................................
352 #......................................................................
352 # And now the actual magic functions
353 # And now the actual magic functions
353
354
354 # Functions for IPython shell work (vars,funcs, config, etc)
355 # Functions for IPython shell work (vars,funcs, config, etc)
355 def magic_lsmagic(self, parameter_s = ''):
356 def magic_lsmagic(self, parameter_s = ''):
356 """List currently available magic functions."""
357 """List currently available magic functions."""
357 mesc = self.shell.ESC_MAGIC
358 mesc = self.shell.ESC_MAGIC
358 print 'Available magic functions:\n'+mesc+\
359 print 'Available magic functions:\n'+mesc+\
359 (' '+mesc).join(self.lsmagic())
360 (' '+mesc).join(self.lsmagic())
360 print '\n' + Magic.auto_status[self.shell.rc.automagic]
361 print '\n' + Magic.auto_status[self.shell.rc.automagic]
361 return None
362 return None
362
363
363 def magic_magic(self, parameter_s = ''):
364 def magic_magic(self, parameter_s = ''):
364 """Print information about the magic function system."""
365 """Print information about the magic function system."""
365
366
366 mode = ''
367 mode = ''
367 try:
368 try:
368 if parameter_s.split()[0] == '-latex':
369 if parameter_s.split()[0] == '-latex':
369 mode = 'latex'
370 mode = 'latex'
370 except:
371 except:
371 pass
372 pass
372
373
373 magic_docs = []
374 magic_docs = []
374 for fname in self.lsmagic():
375 for fname in self.lsmagic():
375 mname = 'magic_' + fname
376 mname = 'magic_' + fname
376 for space in (Magic,self,self.__class__):
377 for space in (Magic,self,self.__class__):
377 try:
378 try:
378 fn = space.__dict__[mname]
379 fn = space.__dict__[mname]
379 except KeyError:
380 except KeyError:
380 pass
381 pass
381 else:
382 else:
382 break
383 break
383 magic_docs.append('%s%s:\n\t%s\n' %(self.shell.ESC_MAGIC,
384 magic_docs.append('%s%s:\n\t%s\n' %(self.shell.ESC_MAGIC,
384 fname,fn.__doc__))
385 fname,fn.__doc__))
385 magic_docs = ''.join(magic_docs)
386 magic_docs = ''.join(magic_docs)
386
387
387 if mode == 'latex':
388 if mode == 'latex':
388 print self.format_latex(magic_docs)
389 print self.format_latex(magic_docs)
389 return
390 return
390 else:
391 else:
391 magic_docs = self.format_screen(magic_docs)
392 magic_docs = self.format_screen(magic_docs)
392
393
393 outmsg = """
394 outmsg = """
394 IPython's 'magic' functions
395 IPython's 'magic' functions
395 ===========================
396 ===========================
396
397
397 The magic function system provides a series of functions which allow you to
398 The magic function system provides a series of functions which allow you to
398 control the behavior of IPython itself, plus a lot of system-type
399 control the behavior of IPython itself, plus a lot of system-type
399 features. All these functions are prefixed with a % character, but parameters
400 features. All these functions are prefixed with a % character, but parameters
400 are given without parentheses or quotes.
401 are given without parentheses or quotes.
401
402
402 NOTE: If you have 'automagic' enabled (via the command line option or with the
403 NOTE: If you have 'automagic' enabled (via the command line option or with the
403 %automagic function), you don't need to type in the % explicitly. By default,
404 %automagic function), you don't need to type in the % explicitly. By default,
404 IPython ships with automagic on, so you should only rarely need the % escape.
405 IPython ships with automagic on, so you should only rarely need the % escape.
405
406
406 Example: typing '%cd mydir' (without the quotes) changes you working directory
407 Example: typing '%cd mydir' (without the quotes) changes you working directory
407 to 'mydir', if it exists.
408 to 'mydir', if it exists.
408
409
409 You can define your own magic functions to extend the system. See the supplied
410 You can define your own magic functions to extend the system. See the supplied
410 ipythonrc and example-magic.py files for details (in your ipython
411 ipythonrc and example-magic.py files for details (in your ipython
411 configuration directory, typically $HOME/.ipython/).
412 configuration directory, typically $HOME/.ipython/).
412
413
413 You can also define your own aliased names for magic functions. In your
414 You can also define your own aliased names for magic functions. In your
414 ipythonrc file, placing a line like:
415 ipythonrc file, placing a line like:
415
416
416 execute __IPYTHON__.magic_pf = __IPYTHON__.magic_profile
417 execute __IPYTHON__.magic_pf = __IPYTHON__.magic_profile
417
418
418 will define %pf as a new name for %profile.
419 will define %pf as a new name for %profile.
419
420
420 You can also call magics in code using the ipmagic() function, which IPython
421 You can also call magics in code using the ipmagic() function, which IPython
421 automatically adds to the builtin namespace. Type 'ipmagic?' for details.
422 automatically adds to the builtin namespace. Type 'ipmagic?' for details.
422
423
423 For a list of the available magic functions, use %lsmagic. For a description
424 For a list of the available magic functions, use %lsmagic. For a description
424 of any of them, type %magic_name?, e.g. '%cd?'.
425 of any of them, type %magic_name?, e.g. '%cd?'.
425
426
426 Currently the magic system has the following functions:\n"""
427 Currently the magic system has the following functions:\n"""
427
428
428 mesc = self.shell.ESC_MAGIC
429 mesc = self.shell.ESC_MAGIC
429 outmsg = ("%s\n%s\n\nSummary of magic functions (from %slsmagic):"
430 outmsg = ("%s\n%s\n\nSummary of magic functions (from %slsmagic):"
430 "\n\n%s%s\n\n%s" % (outmsg,
431 "\n\n%s%s\n\n%s" % (outmsg,
431 magic_docs,mesc,mesc,
432 magic_docs,mesc,mesc,
432 (' '+mesc).join(self.lsmagic()),
433 (' '+mesc).join(self.lsmagic()),
433 Magic.auto_status[self.shell.rc.automagic] ) )
434 Magic.auto_status[self.shell.rc.automagic] ) )
434
435
435 page(outmsg,screen_lines=self.shell.rc.screen_length)
436 page(outmsg,screen_lines=self.shell.rc.screen_length)
436
437
437 def magic_automagic(self, parameter_s = ''):
438 def magic_automagic(self, parameter_s = ''):
438 """Make magic functions callable without having to type the initial %.
439 """Make magic functions callable without having to type the initial %.
439
440
440 Toggles on/off (when off, you must call it as %automagic, of
441 Toggles on/off (when off, you must call it as %automagic, of
441 course). Note that magic functions have lowest priority, so if there's
442 course). Note that magic functions have lowest priority, so if there's
442 a variable whose name collides with that of a magic fn, automagic
443 a variable whose name collides with that of a magic fn, automagic
443 won't work for that function (you get the variable instead). However,
444 won't work for that function (you get the variable instead). However,
444 if you delete the variable (del var), the previously shadowed magic
445 if you delete the variable (del var), the previously shadowed magic
445 function becomes visible to automagic again."""
446 function becomes visible to automagic again."""
446
447
447 rc = self.shell.rc
448 rc = self.shell.rc
448 rc.automagic = not rc.automagic
449 rc.automagic = not rc.automagic
449 print '\n' + Magic.auto_status[rc.automagic]
450 print '\n' + Magic.auto_status[rc.automagic]
450
451
451 def magic_autocall(self, parameter_s = ''):
452 def magic_autocall(self, parameter_s = ''):
452 """Make functions callable without having to type parentheses.
453 """Make functions callable without having to type parentheses.
453
454
454 This toggles the autocall command line option on and off."""
455 This toggles the autocall command line option on and off."""
455
456
456 rc = self.shell.rc
457 rc = self.shell.rc
457 rc.autocall = not rc.autocall
458 rc.autocall = not rc.autocall
458 print "Automatic calling is:",['OFF','ON'][rc.autocall]
459 print "Automatic calling is:",['OFF','ON'][rc.autocall]
459
460
460 def magic_autoindent(self, parameter_s = ''):
461 def magic_autoindent(self, parameter_s = ''):
461 """Toggle autoindent on/off (if available)."""
462 """Toggle autoindent on/off (if available)."""
462
463
463 self.shell.set_autoindent()
464 self.shell.set_autoindent()
464 print "Automatic indentation is:",['OFF','ON'][self.shell.autoindent]
465 print "Automatic indentation is:",['OFF','ON'][self.shell.autoindent]
465
466
466 def magic_system_verbose(self, parameter_s = ''):
467 def magic_system_verbose(self, parameter_s = ''):
467 """Toggle verbose printing of system calls on/off."""
468 """Toggle verbose printing of system calls on/off."""
468
469
469 self.shell.rc_set_toggle('system_verbose')
470 self.shell.rc_set_toggle('system_verbose')
470 print "System verbose printing is:",\
471 print "System verbose printing is:",\
471 ['OFF','ON'][self.shell.rc.system_verbose]
472 ['OFF','ON'][self.shell.rc.system_verbose]
472
473
473 def magic_history(self, parameter_s = ''):
474 def magic_history(self, parameter_s = ''):
474 """Print input history (_i<n> variables), with most recent last.
475 """Print input history (_i<n> variables), with most recent last.
475
476
476 %history [-n] -> print at most 40 inputs (some may be multi-line)\\
477 %history [-n] -> print at most 40 inputs (some may be multi-line)\\
477 %history [-n] n -> print at most n inputs\\
478 %history [-n] n -> print at most n inputs\\
478 %history [-n] n1 n2 -> print inputs between n1 and n2 (n2 not included)\\
479 %history [-n] n1 n2 -> print inputs between n1 and n2 (n2 not included)\\
479
480
480 Each input's number <n> is shown, and is accessible as the
481 Each input's number <n> is shown, and is accessible as the
481 automatically generated variable _i<n>. Multi-line statements are
482 automatically generated variable _i<n>. Multi-line statements are
482 printed starting at a new line for easy copy/paste.
483 printed starting at a new line for easy copy/paste.
483
484
484 If option -n is used, input numbers are not printed. This is useful if
485 If option -n is used, input numbers are not printed. This is useful if
485 you want to get a printout of many lines which can be directly pasted
486 you want to get a printout of many lines which can be directly pasted
486 into a text editor.
487 into a text editor.
487
488
488 This feature is only available if numbered prompts are in use."""
489 This feature is only available if numbered prompts are in use."""
489
490
490 if not self.do_full_cache:
491 if not self.do_full_cache:
491 print 'This feature is only available if numbered prompts are in use.'
492 print 'This feature is only available if numbered prompts are in use.'
492 return
493 return
493 opts,args = self.parse_options(parameter_s,'n',mode='list')
494 opts,args = self.parse_options(parameter_s,'n',mode='list')
494
495
495 default_length = 40
496 default_length = 40
496 if len(args) == 0:
497 if len(args) == 0:
497 final = self.outputcache.prompt_count
498 final = self.outputcache.prompt_count
498 init = max(1,final-default_length)
499 init = max(1,final-default_length)
499 elif len(args) == 1:
500 elif len(args) == 1:
500 final = self.outputcache.prompt_count
501 final = self.outputcache.prompt_count
501 init = max(1,final-int(args[0]))
502 init = max(1,final-int(args[0]))
502 elif len(args) == 2:
503 elif len(args) == 2:
503 init,final = map(int,args)
504 init,final = map(int,args)
504 else:
505 else:
505 warn('%hist takes 0, 1 or 2 arguments separated by spaces.')
506 warn('%hist takes 0, 1 or 2 arguments separated by spaces.')
506 print self.magic_hist.__doc__
507 print self.magic_hist.__doc__
507 return
508 return
508 width = len(str(final))
509 width = len(str(final))
509 line_sep = ['','\n']
510 line_sep = ['','\n']
510 input_hist = self.shell.input_hist
511 input_hist = self.shell.input_hist
511 print_nums = not opts.has_key('n')
512 print_nums = not opts.has_key('n')
512 for in_num in range(init,final):
513 for in_num in range(init,final):
513 inline = input_hist[in_num]
514 inline = input_hist[in_num]
514 multiline = inline.count('\n') > 1
515 multiline = inline.count('\n') > 1
515 if print_nums:
516 if print_nums:
516 print str(in_num).ljust(width)+':'+ line_sep[multiline],
517 print str(in_num).ljust(width)+':'+ line_sep[multiline],
517 if inline.startswith('#'+self.shell.ESC_MAGIC) or \
518 if inline.startswith('#'+self.shell.ESC_MAGIC) or \
518 inline.startswith('#!'):
519 inline.startswith('#!'):
519 print inline[1:],
520 print inline[1:],
520 else:
521 else:
521 print inline,
522 print inline,
522
523
523 def magic_hist(self, parameter_s=''):
524 def magic_hist(self, parameter_s=''):
524 """Alternate name for %history."""
525 """Alternate name for %history."""
525 return self.magic_history(parameter_s)
526 return self.magic_history(parameter_s)
526
527
527 def magic_p(self, parameter_s=''):
528 def magic_p(self, parameter_s=''):
528 """Just a short alias for Python's 'print'."""
529 """Just a short alias for Python's 'print'."""
529 exec 'print ' + parameter_s in self.shell.user_ns
530 exec 'print ' + parameter_s in self.shell.user_ns
530
531
531 def magic_r(self, parameter_s=''):
532 def magic_r(self, parameter_s=''):
532 """Repeat previous input.
533 """Repeat previous input.
533
534
534 If given an argument, repeats the previous command which starts with
535 If given an argument, repeats the previous command which starts with
535 the same string, otherwise it just repeats the previous input.
536 the same string, otherwise it just repeats the previous input.
536
537
537 Shell escaped commands (with ! as first character) are not recognized
538 Shell escaped commands (with ! as first character) are not recognized
538 by this system, only pure python code and magic commands.
539 by this system, only pure python code and magic commands.
539 """
540 """
540
541
541 start = parameter_s.strip()
542 start = parameter_s.strip()
542 esc_magic = self.shell.ESC_MAGIC
543 esc_magic = self.shell.ESC_MAGIC
543 # Identify magic commands even if automagic is on (which means
544 # Identify magic commands even if automagic is on (which means
544 # the in-memory version is different from that typed by the user).
545 # the in-memory version is different from that typed by the user).
545 if self.shell.rc.automagic:
546 if self.shell.rc.automagic:
546 start_magic = esc_magic+start
547 start_magic = esc_magic+start
547 else:
548 else:
548 start_magic = start
549 start_magic = start
549 # Look through the input history in reverse
550 # Look through the input history in reverse
550 for n in range(len(self.shell.input_hist)-2,0,-1):
551 for n in range(len(self.shell.input_hist)-2,0,-1):
551 input = self.shell.input_hist[n]
552 input = self.shell.input_hist[n]
552 # skip plain 'r' lines so we don't recurse to infinity
553 # skip plain 'r' lines so we don't recurse to infinity
553 if input != 'ipmagic("r")\n' and \
554 if input != 'ipmagic("r")\n' and \
554 (input.startswith(start) or input.startswith(start_magic)):
555 (input.startswith(start) or input.startswith(start_magic)):
555 #print 'match',`input` # dbg
556 #print 'match',`input` # dbg
556 if input.startswith(esc_magic):
557 if input.startswith(esc_magic):
557 input = magic2python(input)
558 input = magic2python(input)
558 #print 'modified',`input` # dbg
559 #print 'modified',`input` # dbg
559 print 'Executing:',input,
560 print 'Executing:',input,
560 exec input in self.shell.user_ns
561 exec input in self.shell.user_ns
561 return
562 return
562 print 'No previous input matching `%s` found.' % start
563 print 'No previous input matching `%s` found.' % start
563
564
564 def magic_page(self, parameter_s=''):
565 def magic_page(self, parameter_s=''):
565 """Pretty print the object and display it through a pager.
566 """Pretty print the object and display it through a pager.
566
567
567 If no parameter is given, use _ (last output)."""
568 If no parameter is given, use _ (last output)."""
568 # After a function contributed by Olivier Aubert, slightly modified.
569 # After a function contributed by Olivier Aubert, slightly modified.
569
570
570 oname = parameter_s and parameter_s or '_'
571 oname = parameter_s and parameter_s or '_'
571 info = self._ofind(oname)
572 info = self._ofind(oname)
572 if info['found']:
573 if info['found']:
573 page(pformat(info['obj']))
574 page(pformat(info['obj']))
574 else:
575 else:
575 print 'Object `%s` not found' % oname
576 print 'Object `%s` not found' % oname
576
577
577 def magic_profile(self, parameter_s=''):
578 def magic_profile(self, parameter_s=''):
578 """Print your currently active IPyhton profile."""
579 """Print your currently active IPyhton profile."""
579 if self.shell.rc.profile:
580 if self.shell.rc.profile:
580 printpl('Current IPython profile: $self.shell.rc.profile.')
581 printpl('Current IPython profile: $self.shell.rc.profile.')
581 else:
582 else:
582 print 'No profile active.'
583 print 'No profile active.'
583
584
584 def _inspect(self,meth,oname,**kw):
585 def _inspect(self,meth,oname,**kw):
585 """Generic interface to the inspector system.
586 """Generic interface to the inspector system.
586
587
587 This function is meant to be called by pdef, pdoc & friends."""
588 This function is meant to be called by pdef, pdoc & friends."""
588
589
589 oname = oname.strip()
590 oname = oname.strip()
590 info = Struct(self._ofind(oname))
591 info = Struct(self._ofind(oname))
591 if info.found:
592 if info.found:
592 pmethod = getattr(self.shell.inspector,meth)
593 pmethod = getattr(self.shell.inspector,meth)
593 formatter = info.ismagic and self.format_screen or None
594 formatter = info.ismagic and self.format_screen or None
594 if meth == 'pdoc':
595 if meth == 'pdoc':
595 pmethod(info.obj,oname,formatter)
596 pmethod(info.obj,oname,formatter)
596 elif meth == 'pinfo':
597 elif meth == 'pinfo':
597 pmethod(info.obj,oname,formatter,info,**kw)
598 pmethod(info.obj,oname,formatter,info,**kw)
598 else:
599 else:
599 pmethod(info.obj,oname)
600 pmethod(info.obj,oname)
600 else:
601 else:
601 print 'Object `%s` not found.' % oname
602 print 'Object `%s` not found.' % oname
602 return 'not found' # so callers can take other action
603 return 'not found' # so callers can take other action
603
604
604 def magic_pdef(self, parameter_s=''):
605 def magic_pdef(self, parameter_s=''):
605 """Print the definition header for any callable object.
606 """Print the definition header for any callable object.
606
607
607 If the object is a class, print the constructor information."""
608 If the object is a class, print the constructor information."""
608 self._inspect('pdef',parameter_s)
609 self._inspect('pdef',parameter_s)
609
610
610 def magic_pdoc(self, parameter_s=''):
611 def magic_pdoc(self, parameter_s=''):
611 """Print the docstring for an object.
612 """Print the docstring for an object.
612
613
613 If the given object is a class, it will print both the class and the
614 If the given object is a class, it will print both the class and the
614 constructor docstrings."""
615 constructor docstrings."""
615 self._inspect('pdoc',parameter_s)
616 self._inspect('pdoc',parameter_s)
616
617
617 def magic_psource(self, parameter_s=''):
618 def magic_psource(self, parameter_s=''):
618 """Print (or run through pager) the source code for an object."""
619 """Print (or run through pager) the source code for an object."""
619 self._inspect('psource',parameter_s)
620 self._inspect('psource',parameter_s)
620
621
621 def magic_pfile(self, parameter_s=''):
622 def magic_pfile(self, parameter_s=''):
622 """Print (or run through pager) the file where an object is defined.
623 """Print (or run through pager) the file where an object is defined.
623
624
624 The file opens at the line where the object definition begins. IPython
625 The file opens at the line where the object definition begins. IPython
625 will honor the environment variable PAGER if set, and otherwise will
626 will honor the environment variable PAGER if set, and otherwise will
626 do its best to print the file in a convenient form.
627 do its best to print the file in a convenient form.
627
628
628 If the given argument is not an object currently defined, IPython will
629 If the given argument is not an object currently defined, IPython will
629 try to interpret it as a filename (automatically adding a .py extension
630 try to interpret it as a filename (automatically adding a .py extension
630 if needed). You can thus use %pfile as a syntax highlighting code
631 if needed). You can thus use %pfile as a syntax highlighting code
631 viewer."""
632 viewer."""
632
633
633 # first interpret argument as an object name
634 # first interpret argument as an object name
634 out = self._inspect('pfile',parameter_s)
635 out = self._inspect('pfile',parameter_s)
635 # if not, try the input as a filename
636 # if not, try the input as a filename
636 if out == 'not found':
637 if out == 'not found':
637 try:
638 try:
638 filename = get_py_filename(parameter_s)
639 filename = get_py_filename(parameter_s)
639 except IOError,msg:
640 except IOError,msg:
640 print msg
641 print msg
641 return
642 return
642 page(self.shell.inspector.format(file(filename).read()))
643 page(self.shell.inspector.format(file(filename).read()))
643
644
644 def magic_pinfo(self, parameter_s=''):
645 def magic_pinfo(self, parameter_s=''):
645 """Provide detailed information about an object.
646 """Provide detailed information about an object.
646
647
647 '%pinfo object' is just a synonym for object? or ?object."""
648 '%pinfo object' is just a synonym for object? or ?object."""
648
649
649 #print 'pinfo par: <%s>' % parameter_s # dbg
650 #print 'pinfo par: <%s>' % parameter_s # dbg
650
651
651 # detail_level: 0 -> obj? , 1 -> obj??
652 # detail_level: 0 -> obj? , 1 -> obj??
652 detail_level = 0
653 detail_level = 0
653 # We need to detect if we got called as 'pinfo pinfo foo', which can
654 # We need to detect if we got called as 'pinfo pinfo foo', which can
654 # happen if the user types 'pinfo foo?' at the cmd line.
655 # happen if the user types 'pinfo foo?' at the cmd line.
655 pinfo,qmark1,oname,qmark2 = \
656 pinfo,qmark1,oname,qmark2 = \
656 re.match('(pinfo )?(\?*)(.*?)(\??$)',parameter_s).groups()
657 re.match('(pinfo )?(\?*)(.*?)(\??$)',parameter_s).groups()
657 if pinfo or qmark1 or qmark2:
658 if pinfo or qmark1 or qmark2:
658 detail_level = 1
659 detail_level = 1
659 self._inspect('pinfo',oname,detail_level=detail_level)
660 if "*" in oname:
661 self.magic_psearch(oname)
662 else:
663 self._inspect('pinfo',oname,detail_level=detail_level)
664
665 def magic_psearch(self, parameter_s=''):
666 """Search for object in namespaces by wildcard.
667
668 %psearch PATTERN [OBJECT TYPE] [-NAMESPACE]* [+NAMESPACE]* [-a] [-c]
669
670 Note: ? can be used as a synonym for %psearch, at the beginning or at
671 the end: both a*? and ?a* are equivalent to '%psearch a*'.
672
673 PATTERN
674
675 where PATTERN is a string containing * as a wildcard similar to its
676 use in a shell. The pattern is matched in all namespaces on the
677 search path. By default objects starting with a single _ are not
678 matched, many IPython generated objects have a single underscore. The
679 default is case insensitive matching. Matching is also done on the
680 attributes of objects and not only on the objects in a module.
681
682 [OBJECT TYPE]
683 Is the name of a python type from the types module. The name is given
684 in lowercase without the ending type, ex. StringType is written
685 string. By adding a type here only objects matching the given type are
686 matched. Using all here makes the pattern match all types (this is the
687 default).
688
689 [-NAMESPACE]* [+NAMESPACE]*
690 The possible namespaces are builtin, user, internal, alias. Where
691 builtin and user are default. Builtin contains the python module
692 builtin, user contains all imported namespaces, alias only contain the
693 shell aliases and no python objects, internal contains objects used by
694 IPython. The namespaces on the search path are removed by -namespace
695 and added by +namespace.
696
697 [-a] makes the pattern match even objects with a single underscore.
698 [-c] makes the pattern case sensitive.
699
700 Examples:
701
702 %psearch a* list objects beginning with an a
703 %psearch a* function list all functions beginning with an a
704 %psearch re.e* list objects beginning with an e in module re
705 %psearch r*.e* list objects that starts with e in modules starting in r
706 %psearch r*.* string list all strings in modules beginning with r
707
708 Case sensitve search:
709
710 %psearch a* -c list all object beginning with lower case a
711
712 Show objects beginning with a single _:
713
714 %psearch _* -a list objects beginning with underscore"""
715
716 self.shell.inspector.psearch(parameter_s,shell=self.shell)
660
717
661 def magic_who_ls(self, parameter_s=''):
718 def magic_who_ls(self, parameter_s=''):
662 """Return a sorted list of all interactive variables.
719 """Return a sorted list of all interactive variables.
663
720
664 If arguments are given, only variables of types matching these
721 If arguments are given, only variables of types matching these
665 arguments are returned."""
722 arguments are returned."""
666
723
667 user_ns = self.shell.user_ns
724 user_ns = self.shell.user_ns
668 out = []
725 out = []
669 typelist = parameter_s.split()
726 typelist = parameter_s.split()
670 for i in self.shell.user_ns.keys():
727 for i in self.shell.user_ns.keys():
671 if not (i.startswith('_') or i.startswith('_i')) \
728 if not (i.startswith('_') or i.startswith('_i')) \
672 and not (self.internal_ns.has_key(i) or
729 and not (self.internal_ns.has_key(i) or
673 self.user_config_ns.has_key(i)):
730 self.user_config_ns.has_key(i)):
674 if typelist:
731 if typelist:
675 if type(user_ns[i]).__name__ in typelist:
732 if type(user_ns[i]).__name__ in typelist:
676 out.append(i)
733 out.append(i)
677 else:
734 else:
678 out.append(i)
735 out.append(i)
679 out.sort()
736 out.sort()
680 return out
737 return out
681
738
682 def magic_who(self, parameter_s=''):
739 def magic_who(self, parameter_s=''):
683 """Print all interactive variables, with some minimal formatting.
740 """Print all interactive variables, with some minimal formatting.
684
741
685 If any arguments are given, only variables whose type matches one of
742 If any arguments are given, only variables whose type matches one of
686 these are printed. For example:
743 these are printed. For example:
687
744
688 %who function str
745 %who function str
689
746
690 will only list functions and strings, excluding all other types of
747 will only list functions and strings, excluding all other types of
691 variables. To find the proper type names, simply use type(var) at a
748 variables. To find the proper type names, simply use type(var) at a
692 command line to see how python prints type names. For example:
749 command line to see how python prints type names. For example:
693
750
694 In [1]: type('hello')\\
751 In [1]: type('hello')\\
695 Out[1]: <type 'str'>
752 Out[1]: <type 'str'>
696
753
697 indicates that the type name for strings is 'str'.
754 indicates that the type name for strings is 'str'.
698
755
699 %who always excludes executed names loaded through your configuration
756 %who always excludes executed names loaded through your configuration
700 file and things which are internal to IPython.
757 file and things which are internal to IPython.
701
758
702 This is deliberate, as typically you may load many modules and the
759 This is deliberate, as typically you may load many modules and the
703 purpose of %who is to show you only what you've manually defined."""
760 purpose of %who is to show you only what you've manually defined."""
704
761
705 varlist = self.magic_who_ls(parameter_s)
762 varlist = self.magic_who_ls(parameter_s)
706 if not varlist:
763 if not varlist:
707 print 'Interactive namespace is empty.'
764 print 'Interactive namespace is empty.'
708 return
765 return
709
766
710 # if we have variables, move on...
767 # if we have variables, move on...
711
768
712 # stupid flushing problem: when prompts have no separators, stdout is
769 # stupid flushing problem: when prompts have no separators, stdout is
713 # getting lost. I'm starting to think this is a python bug. I'm having
770 # getting lost. I'm starting to think this is a python bug. I'm having
714 # to force a flush with a print because even a sys.stdout.flush
771 # to force a flush with a print because even a sys.stdout.flush
715 # doesn't seem to do anything!
772 # doesn't seem to do anything!
716
773
717 count = 0
774 count = 0
718 for i in varlist:
775 for i in varlist:
719 print i+'\t',
776 print i+'\t',
720 count += 1
777 count += 1
721 if count > 8:
778 if count > 8:
722 count = 0
779 count = 0
723 print
780 print
724 sys.stdout.flush() # FIXME. Why the hell isn't this flushing???
781 sys.stdout.flush() # FIXME. Why the hell isn't this flushing???
725
782
726 print # well, this does force a flush at the expense of an extra \n
783 print # well, this does force a flush at the expense of an extra \n
727
784
728 def magic_whos(self, parameter_s=''):
785 def magic_whos(self, parameter_s=''):
729 """Like %who, but gives some extra information about each variable.
786 """Like %who, but gives some extra information about each variable.
730
787
731 The same type filtering of %who can be applied here.
788 The same type filtering of %who can be applied here.
732
789
733 For all variables, the type is printed. Additionally it prints:
790 For all variables, the type is printed. Additionally it prints:
734
791
735 - For {},[],(): their length.
792 - For {},[],(): their length.
736
793
737 - For Numeric arrays, a summary with shape, number of elements,
794 - For Numeric arrays, a summary with shape, number of elements,
738 typecode and size in memory.
795 typecode and size in memory.
739
796
740 - Everything else: a string representation, snipping their middle if
797 - Everything else: a string representation, snipping their middle if
741 too long."""
798 too long."""
742
799
743 varnames = self.magic_who_ls(parameter_s)
800 varnames = self.magic_who_ls(parameter_s)
744 if not varnames:
801 if not varnames:
745 print 'Interactive namespace is empty.'
802 print 'Interactive namespace is empty.'
746 return
803 return
747
804
748 # if we have variables, move on...
805 # if we have variables, move on...
749
806
750 # for these types, show len() instead of data:
807 # for these types, show len() instead of data:
751 seq_types = [types.DictType,types.ListType,types.TupleType]
808 seq_types = [types.DictType,types.ListType,types.TupleType]
752
809
753 # for Numeric arrays, display summary info
810 # for Numeric arrays, display summary info
754 try:
811 try:
755 import Numeric
812 import Numeric
756 except ImportError:
813 except ImportError:
757 array_type = None
814 array_type = None
758 else:
815 else:
759 array_type = Numeric.ArrayType.__name__
816 array_type = Numeric.ArrayType.__name__
760
817
761 # Find all variable names and types so we can figure out column sizes
818 # Find all variable names and types so we can figure out column sizes
762 get_vars = lambda i: self.locals[i]
819 get_vars = lambda i: self.locals[i]
763 type_name = lambda v: type(v).__name__
820 type_name = lambda v: type(v).__name__
764 varlist = map(get_vars,varnames)
821 varlist = map(get_vars,varnames)
765 typelist = map(type_name,varlist)
822 typelist = map(type_name,varlist)
766 # column labels and # of spaces as separator
823 # column labels and # of spaces as separator
767 varlabel = 'Variable'
824 varlabel = 'Variable'
768 typelabel = 'Type'
825 typelabel = 'Type'
769 datalabel = 'Data/Info'
826 datalabel = 'Data/Info'
770 colsep = 3
827 colsep = 3
771 # variable format strings
828 # variable format strings
772 vformat = "$vname.ljust(varwidth)$vtype.ljust(typewidth)"
829 vformat = "$vname.ljust(varwidth)$vtype.ljust(typewidth)"
773 vfmt_short = '$vstr[:25]<...>$vstr[-25:]'
830 vfmt_short = '$vstr[:25]<...>$vstr[-25:]'
774 aformat = "%s: %s elems, type `%s`, %s bytes"
831 aformat = "%s: %s elems, type `%s`, %s bytes"
775 # find the size of the columns to format the output nicely
832 # find the size of the columns to format the output nicely
776 varwidth = max(max(map(len,varnames)), len(varlabel)) + colsep
833 varwidth = max(max(map(len,varnames)), len(varlabel)) + colsep
777 typewidth = max(max(map(len,typelist)), len(typelabel)) + colsep
834 typewidth = max(max(map(len,typelist)), len(typelabel)) + colsep
778 # table header
835 # table header
779 print varlabel.ljust(varwidth) + typelabel.ljust(typewidth) + \
836 print varlabel.ljust(varwidth) + typelabel.ljust(typewidth) + \
780 ' '+datalabel+'\n' + '-'*(varwidth+typewidth+len(datalabel)+1)
837 ' '+datalabel+'\n' + '-'*(varwidth+typewidth+len(datalabel)+1)
781 # and the table itself
838 # and the table itself
782 kb = 1024
839 kb = 1024
783 Mb = 1048576 # kb**2
840 Mb = 1048576 # kb**2
784 for vname,var,vtype in zip(varnames,varlist,typelist):
841 for vname,var,vtype in zip(varnames,varlist,typelist):
785 print itpl(vformat),
842 print itpl(vformat),
786 if vtype in seq_types:
843 if vtype in seq_types:
787 print len(var)
844 print len(var)
788 elif vtype==array_type:
845 elif vtype==array_type:
789 vshape = str(var.shape).replace(',','').replace(' ','x')[1:-1]
846 vshape = str(var.shape).replace(',','').replace(' ','x')[1:-1]
790 vsize = Numeric.size(var)
847 vsize = Numeric.size(var)
791 vbytes = vsize*var.itemsize()
848 vbytes = vsize*var.itemsize()
792 if vbytes < 100000:
849 if vbytes < 100000:
793 print aformat % (vshape,vsize,var.typecode(),vbytes)
850 print aformat % (vshape,vsize,var.typecode(),vbytes)
794 else:
851 else:
795 print aformat % (vshape,vsize,var.typecode(),vbytes),
852 print aformat % (vshape,vsize,var.typecode(),vbytes),
796 if vbytes < Mb:
853 if vbytes < Mb:
797 print '(%s kb)' % (vbytes/kb,)
854 print '(%s kb)' % (vbytes/kb,)
798 else:
855 else:
799 print '(%s Mb)' % (vbytes/Mb,)
856 print '(%s Mb)' % (vbytes/Mb,)
800 else:
857 else:
801 vstr = str(var)
858 vstr = str(var)
802 if len(vstr) < 50:
859 if len(vstr) < 50:
803 print vstr
860 print vstr
804 else:
861 else:
805 printpl(vfmt_short)
862 printpl(vfmt_short)
806
863
807 def magic_reset(self, parameter_s=''):
864 def magic_reset(self, parameter_s=''):
808 """Resets the namespace by removing all names defined by the user.
865 """Resets the namespace by removing all names defined by the user.
809
866
810 Input/Output history are left around in case you need them."""
867 Input/Output history are left around in case you need them."""
811
868
812 ans = raw_input(
869 ans = raw_input(
813 "Once deleted, variables cannot be recovered. Proceed (y/n)? ")
870 "Once deleted, variables cannot be recovered. Proceed (y/n)? ")
814 if not ans.lower() == 'y':
871 if not ans.lower() == 'y':
815 print 'Nothing done.'
872 print 'Nothing done.'
816 return
873 return
817 for i in self.magic_who_ls():
874 for i in self.magic_who_ls():
818 del(self.locals[i])
875 del(self.locals[i])
819
876
820 def magic_config(self,parameter_s=''):
877 def magic_config(self,parameter_s=''):
821 """Show IPython's internal configuration."""
878 """Show IPython's internal configuration."""
822
879
823 page('Current configuration structure:\n'+
880 page('Current configuration structure:\n'+
824 pformat(self.shell.rc.dict()))
881 pformat(self.shell.rc.dict()))
825
882
826 def magic_logstart(self,parameter_s=''):
883 def magic_logstart(self,parameter_s=''):
827 """Start logging anywhere in a session.
884 """Start logging anywhere in a session.
828
885
829 %logstart [log_name [log_mode]]
886 %logstart [log_name [log_mode]]
830
887
831 If no name is given, it defaults to a file named 'ipython.log' in your
888 If no name is given, it defaults to a file named 'ipython.log' in your
832 current directory, in 'rotate' mode (see below).
889 current directory, in 'rotate' mode (see below).
833
890
834 '%logstart name' saves to file 'name' in 'backup' mode. It saves your
891 '%logstart name' saves to file 'name' in 'backup' mode. It saves your
835 history up to that point and then continues logging.
892 history up to that point and then continues logging.
836
893
837 %logstart takes a second optional parameter: logging mode. This can be one
894 %logstart takes a second optional parameter: logging mode. This can be one
838 of (note that the modes are given unquoted):\\
895 of (note that the modes are given unquoted):\\
839 over: overwrite existing log.\\
896 over: overwrite existing log.\\
840 backup: rename (if exists) to name~ and start name.\\
897 backup: rename (if exists) to name~ and start name.\\
841 append: well, that says it.\\
898 append: well, that says it.\\
842 rotate: create rotating logs name.1~, name.2~, etc.
899 rotate: create rotating logs name.1~, name.2~, etc.
843 """
900 """
844
901
845 #FIXME. This function should all be moved to the Logger class.
902 #FIXME. This function should all be moved to the Logger class.
846
903
847 valid_modes = qw('over backup append rotate')
904 valid_modes = qw('over backup append rotate')
848 if self.LOG:
905 if self.LOG:
849 print 'Logging is already in place. Logfile:',self.LOG
906 print 'Logging is already in place. Logfile:',self.LOG
850 return
907 return
851
908
852 par = parameter_s.strip()
909 par = parameter_s.strip()
853 if not par:
910 if not par:
854 logname = self.LOGDEF
911 logname = self.LOGDEF
855 logmode = 'rotate' # use rotate for the auto-generated logs
912 logmode = 'rotate' # use rotate for the auto-generated logs
856 else:
913 else:
857 try:
914 try:
858 logname,logmode = par.split()
915 logname,logmode = par.split()
859 except:
916 except:
860 try:
917 try:
861 logname = par
918 logname = par
862 logmode = 'backup'
919 logmode = 'backup'
863 except:
920 except:
864 warn('Usage: %log [log_name [log_mode]]')
921 warn('Usage: %log [log_name [log_mode]]')
865 return
922 return
866 if not logmode in valid_modes:
923 if not logmode in valid_modes:
867 warn('Logging NOT activated.\n'
924 warn('Logging NOT activated.\n'
868 'Usage: %log [log_name [log_mode]]\n'
925 'Usage: %log [log_name [log_mode]]\n'
869 'Valid modes: '+str(valid_modes))
926 'Valid modes: '+str(valid_modes))
870 return
927 return
871
928
872 # If we made it this far, I think we're ok:
929 # If we made it this far, I think we're ok:
873 print 'Activating auto-logging.'
930 print 'Activating auto-logging.'
874 print 'Current session state plus future input saved to:',logname
931 print 'Current session state plus future input saved to:',logname
875 print 'Logging mode: ',logmode
932 print 'Logging mode: ',logmode
876 # put logname into rc struct as if it had been called on the command line,
933 # put logname into rc struct as if it had been called on the command line,
877 # so it ends up saved in the log header
934 # so it ends up saved in the log header
878 # Save it in case we need to restore it...
935 # Save it in case we need to restore it...
879 old_logfile = self.shell.rc.opts.get('logfile','')
936 old_logfile = self.shell.rc.opts.get('logfile','')
880 logname = os.path.expanduser(logname)
937 logname = os.path.expanduser(logname)
881 self.shell.rc.opts.logfile = logname
938 self.shell.rc.opts.logfile = logname
882 self.LOGMODE = logmode # FIXME: this should be set through a function.
939 self.LOGMODE = logmode # FIXME: this should be set through a function.
883 try:
940 try:
884 header = str(self.LOGHEAD)
941 header = str(self.LOGHEAD)
885 self.create_log(header,logname)
942 self.create_log(header,logname)
886 self.logstart(header,logname)
943 self.logstart(header,logname)
887 except:
944 except:
888 self.LOG = '' # we are NOT logging, something went wrong
945 self.LOG = '' # we are NOT logging, something went wrong
889 self.shell.rc.opts.logfile = old_logfile
946 self.shell.rc.opts.logfile = old_logfile
890 warn("Couldn't start log: "+str(sys.exc_info()[1]))
947 warn("Couldn't start log: "+str(sys.exc_info()[1]))
891 else: # log input history up to this point
948 else: # log input history up to this point
892 self.logfile.write(self.shell.user_ns['_ih'][1:])
949 self.logfile.write(self.shell.user_ns['_ih'][1:])
893 self.logfile.flush()
950 self.logfile.flush()
894
951
895 def magic_logoff(self,parameter_s=''):
952 def magic_logoff(self,parameter_s=''):
896 """Temporarily stop logging.
953 """Temporarily stop logging.
897
954
898 You must have previously started logging."""
955 You must have previously started logging."""
899 self.switch_log(0)
956 self.switch_log(0)
900
957
901 def magic_logon(self,parameter_s=''):
958 def magic_logon(self,parameter_s=''):
902 """Restart logging.
959 """Restart logging.
903
960
904 This function is for restarting logging which you've temporarily
961 This function is for restarting logging which you've temporarily
905 stopped with %logoff. For starting logging for the first time, you
962 stopped with %logoff. For starting logging for the first time, you
906 must use the %logstart function, which allows you to specify an
963 must use the %logstart function, which allows you to specify an
907 optional log filename."""
964 optional log filename."""
908
965
909 self.switch_log(1)
966 self.switch_log(1)
910
967
911 def magic_logstate(self,parameter_s=''):
968 def magic_logstate(self,parameter_s=''):
912 """Print the status of the logging system."""
969 """Print the status of the logging system."""
913
970
914 self.logstate()
971 self.logstate()
915
972
916 def magic_pdb(self, parameter_s=''):
973 def magic_pdb(self, parameter_s=''):
917 """Control the calling of the pdb interactive debugger.
974 """Control the calling of the pdb interactive debugger.
918
975
919 Call as '%pdb on', '%pdb 1', '%pdb off' or '%pdb 0'. If called without
976 Call as '%pdb on', '%pdb 1', '%pdb off' or '%pdb 0'. If called without
920 argument it works as a toggle.
977 argument it works as a toggle.
921
978
922 When an exception is triggered, IPython can optionally call the
979 When an exception is triggered, IPython can optionally call the
923 interactive pdb debugger after the traceback printout. %pdb toggles
980 interactive pdb debugger after the traceback printout. %pdb toggles
924 this feature on and off."""
981 this feature on and off."""
925
982
926 par = parameter_s.strip().lower()
983 par = parameter_s.strip().lower()
927
984
928 if par:
985 if par:
929 try:
986 try:
930 pdb = {'off':0,'0':0,'on':1,'1':1}[par]
987 pdb = {'off':0,'0':0,'on':1,'1':1}[par]
931 except KeyError:
988 except KeyError:
932 print 'Incorrect argument. Use on/1, off/0 or nothing for a toggle.'
989 print 'Incorrect argument. Use on/1, off/0 or nothing for a toggle.'
933 return
990 return
934 else:
991 else:
935 self.shell.InteractiveTB.call_pdb = pdb
992 self.shell.InteractiveTB.call_pdb = pdb
936 else:
993 else:
937 self.shell.InteractiveTB.call_pdb = 1 - self.shell.InteractiveTB.call_pdb
994 self.shell.InteractiveTB.call_pdb = 1 - self.shell.InteractiveTB.call_pdb
938 print 'Automatic pdb calling has been turned',\
995 print 'Automatic pdb calling has been turned',\
939 on_off(self.shell.InteractiveTB.call_pdb)
996 on_off(self.shell.InteractiveTB.call_pdb)
940
997
941
998
942 def magic_prun(self, parameter_s ='',user_mode=1,
999 def magic_prun(self, parameter_s ='',user_mode=1,
943 opts=None,arg_lst=None,prog_ns=None):
1000 opts=None,arg_lst=None,prog_ns=None):
944
1001
945 """Run a statement through the python code profiler.
1002 """Run a statement through the python code profiler.
946
1003
947 Usage:\\
1004 Usage:\\
948 %prun [options] statement
1005 %prun [options] statement
949
1006
950 The given statement (which doesn't require quote marks) is run via the
1007 The given statement (which doesn't require quote marks) is run via the
951 python profiler in a manner similar to the profile.run() function.
1008 python profiler in a manner similar to the profile.run() function.
952 Namespaces are internally managed to work correctly; profile.run
1009 Namespaces are internally managed to work correctly; profile.run
953 cannot be used in IPython because it makes certain assumptions about
1010 cannot be used in IPython because it makes certain assumptions about
954 namespaces which do not hold under IPython.
1011 namespaces which do not hold under IPython.
955
1012
956 Options:
1013 Options:
957
1014
958 -l <limit>: you can place restrictions on what or how much of the
1015 -l <limit>: you can place restrictions on what or how much of the
959 profile gets printed. The limit value can be:
1016 profile gets printed. The limit value can be:
960
1017
961 * A string: only information for function names containing this string
1018 * A string: only information for function names containing this string
962 is printed.
1019 is printed.
963
1020
964 * An integer: only these many lines are printed.
1021 * An integer: only these many lines are printed.
965
1022
966 * A float (between 0 and 1): this fraction of the report is printed
1023 * A float (between 0 and 1): this fraction of the report is printed
967 (for example, use a limit of 0.4 to see the topmost 40% only).
1024 (for example, use a limit of 0.4 to see the topmost 40% only).
968
1025
969 You can combine several limits with repeated use of the option. For
1026 You can combine several limits with repeated use of the option. For
970 example, '-l __init__ -l 5' will print only the topmost 5 lines of
1027 example, '-l __init__ -l 5' will print only the topmost 5 lines of
971 information about class constructors.
1028 information about class constructors.
972
1029
973 -r: return the pstats.Stats object generated by the profiling. This
1030 -r: return the pstats.Stats object generated by the profiling. This
974 object has all the information about the profile in it, and you can
1031 object has all the information about the profile in it, and you can
975 later use it for further analysis or in other functions.
1032 later use it for further analysis or in other functions.
976
1033
977 Since magic functions have a particular form of calling which prevents
1034 Since magic functions have a particular form of calling which prevents
978 you from writing something like:\\
1035 you from writing something like:\\
979 In [1]: p = %prun -r print 4 # invalid!\\
1036 In [1]: p = %prun -r print 4 # invalid!\\
980 you must instead use IPython's automatic variables to assign this:\\
1037 you must instead use IPython's automatic variables to assign this:\\
981 In [1]: %prun -r print 4 \\
1038 In [1]: %prun -r print 4 \\
982 Out[1]: <pstats.Stats instance at 0x8222cec>\\
1039 Out[1]: <pstats.Stats instance at 0x8222cec>\\
983 In [2]: stats = _
1040 In [2]: stats = _
984
1041
985 If you really need to assign this value via an explicit function call,
1042 If you really need to assign this value via an explicit function call,
986 you can always tap directly into the true name of the magic function
1043 you can always tap directly into the true name of the magic function
987 by using the ipmagic function (which IPython automatically adds to the
1044 by using the ipmagic function (which IPython automatically adds to the
988 builtins):\\
1045 builtins):\\
989 In [3]: stats = ipmagic('prun','-r print 4')
1046 In [3]: stats = ipmagic('prun','-r print 4')
990
1047
991 You can type ipmagic? for more details on ipmagic.
1048 You can type ipmagic? for more details on ipmagic.
992
1049
993 -s <key>: sort profile by given key. You can provide more than one key
1050 -s <key>: sort profile by given key. You can provide more than one key
994 by using the option several times: '-s key1 -s key2 -s key3...'. The
1051 by using the option several times: '-s key1 -s key2 -s key3...'. The
995 default sorting key is 'time'.
1052 default sorting key is 'time'.
996
1053
997 The following is copied verbatim from the profile documentation
1054 The following is copied verbatim from the profile documentation
998 referenced below:
1055 referenced below:
999
1056
1000 When more than one key is provided, additional keys are used as
1057 When more than one key is provided, additional keys are used as
1001 secondary criteria when the there is equality in all keys selected
1058 secondary criteria when the there is equality in all keys selected
1002 before them.
1059 before them.
1003
1060
1004 Abbreviations can be used for any key names, as long as the
1061 Abbreviations can be used for any key names, as long as the
1005 abbreviation is unambiguous. The following are the keys currently
1062 abbreviation is unambiguous. The following are the keys currently
1006 defined:
1063 defined:
1007
1064
1008 Valid Arg Meaning\\
1065 Valid Arg Meaning\\
1009 "calls" call count\\
1066 "calls" call count\\
1010 "cumulative" cumulative time\\
1067 "cumulative" cumulative time\\
1011 "file" file name\\
1068 "file" file name\\
1012 "module" file name\\
1069 "module" file name\\
1013 "pcalls" primitive call count\\
1070 "pcalls" primitive call count\\
1014 "line" line number\\
1071 "line" line number\\
1015 "name" function name\\
1072 "name" function name\\
1016 "nfl" name/file/line\\
1073 "nfl" name/file/line\\
1017 "stdname" standard name\\
1074 "stdname" standard name\\
1018 "time" internal time
1075 "time" internal time
1019
1076
1020 Note that all sorts on statistics are in descending order (placing
1077 Note that all sorts on statistics are in descending order (placing
1021 most time consuming items first), where as name, file, and line number
1078 most time consuming items first), where as name, file, and line number
1022 searches are in ascending order (i.e., alphabetical). The subtle
1079 searches are in ascending order (i.e., alphabetical). The subtle
1023 distinction between "nfl" and "stdname" is that the standard name is a
1080 distinction between "nfl" and "stdname" is that the standard name is a
1024 sort of the name as printed, which means that the embedded line
1081 sort of the name as printed, which means that the embedded line
1025 numbers get compared in an odd way. For example, lines 3, 20, and 40
1082 numbers get compared in an odd way. For example, lines 3, 20, and 40
1026 would (if the file names were the same) appear in the string order
1083 would (if the file names were the same) appear in the string order
1027 "20" "3" and "40". In contrast, "nfl" does a numeric compare of the
1084 "20" "3" and "40". In contrast, "nfl" does a numeric compare of the
1028 line numbers. In fact, sort_stats("nfl") is the same as
1085 line numbers. In fact, sort_stats("nfl") is the same as
1029 sort_stats("name", "file", "line").
1086 sort_stats("name", "file", "line").
1030
1087
1031 -T <filename>: save profile results as shown on screen to a text
1088 -T <filename>: save profile results as shown on screen to a text
1032 file. The profile is still shown on screen.
1089 file. The profile is still shown on screen.
1033
1090
1034 -D <filename>: save (via dump_stats) profile statistics to given
1091 -D <filename>: save (via dump_stats) profile statistics to given
1035 filename. This data is in a format understod by the pstats module, and
1092 filename. This data is in a format understod by the pstats module, and
1036 is generated by a call to the dump_stats() method of profile
1093 is generated by a call to the dump_stats() method of profile
1037 objects. The profile is still shown on screen.
1094 objects. The profile is still shown on screen.
1038
1095
1039 If you want to run complete programs under the profiler's control, use
1096 If you want to run complete programs under the profiler's control, use
1040 '%run -p [prof_opts] filename.py [args to program]' where prof_opts
1097 '%run -p [prof_opts] filename.py [args to program]' where prof_opts
1041 contains profiler specific options as described here.
1098 contains profiler specific options as described here.
1042
1099
1043 You can read the complete documentation for the profile module with:\\
1100 You can read the complete documentation for the profile module with:\\
1044 In [1]: import profile; profile.help() """
1101 In [1]: import profile; profile.help() """
1045
1102
1046 opts_def = Struct(D=[''],l=[],s=['time'],T=[''])
1103 opts_def = Struct(D=[''],l=[],s=['time'],T=[''])
1047 # protect user quote marks
1104 # protect user quote marks
1048 parameter_s = parameter_s.replace('"',r'\"').replace("'",r"\'")
1105 parameter_s = parameter_s.replace('"',r'\"').replace("'",r"\'")
1049
1106
1050 if user_mode: # regular user call
1107 if user_mode: # regular user call
1051 opts,arg_str = self.parse_options(parameter_s,'D:l:rs:T:',
1108 opts,arg_str = self.parse_options(parameter_s,'D:l:rs:T:',
1052 list_all=1)
1109 list_all=1)
1053 namespace = self.shell.user_ns
1110 namespace = self.shell.user_ns
1054 else: # called to run a program by %run -p
1111 else: # called to run a program by %run -p
1055 try:
1112 try:
1056 filename = get_py_filename(arg_lst[0])
1113 filename = get_py_filename(arg_lst[0])
1057 except IOError,msg:
1114 except IOError,msg:
1058 error(msg)
1115 error(msg)
1059 return
1116 return
1060
1117
1061 arg_str = 'execfile(filename,prog_ns)'
1118 arg_str = 'execfile(filename,prog_ns)'
1062 namespace = locals()
1119 namespace = locals()
1063
1120
1064 opts.merge(opts_def)
1121 opts.merge(opts_def)
1065
1122
1066 prof = profile.Profile()
1123 prof = profile.Profile()
1067 try:
1124 try:
1068 prof = prof.runctx(arg_str,namespace,namespace)
1125 prof = prof.runctx(arg_str,namespace,namespace)
1069 sys_exit = ''
1126 sys_exit = ''
1070 except SystemExit:
1127 except SystemExit:
1071 sys_exit = """*** SystemExit exception caught in code being profiled."""
1128 sys_exit = """*** SystemExit exception caught in code being profiled."""
1072
1129
1073 stats = pstats.Stats(prof).strip_dirs().sort_stats(*opts.s)
1130 stats = pstats.Stats(prof).strip_dirs().sort_stats(*opts.s)
1074
1131
1075 lims = opts.l
1132 lims = opts.l
1076 if lims:
1133 if lims:
1077 lims = [] # rebuild lims with ints/floats/strings
1134 lims = [] # rebuild lims with ints/floats/strings
1078 for lim in opts.l:
1135 for lim in opts.l:
1079 try:
1136 try:
1080 lims.append(int(lim))
1137 lims.append(int(lim))
1081 except ValueError:
1138 except ValueError:
1082 try:
1139 try:
1083 lims.append(float(lim))
1140 lims.append(float(lim))
1084 except ValueError:
1141 except ValueError:
1085 lims.append(lim)
1142 lims.append(lim)
1086
1143
1087 # trap output
1144 # trap output
1088 sys_stdout = sys.stdout
1145 sys_stdout = sys.stdout
1089 stdout_trap = StringIO()
1146 stdout_trap = StringIO()
1090 try:
1147 try:
1091 sys.stdout = stdout_trap
1148 sys.stdout = stdout_trap
1092 stats.print_stats(*lims)
1149 stats.print_stats(*lims)
1093 finally:
1150 finally:
1094 sys.stdout = sys_stdout
1151 sys.stdout = sys_stdout
1095 output = stdout_trap.getvalue()
1152 output = stdout_trap.getvalue()
1096 output = output.rstrip()
1153 output = output.rstrip()
1097
1154
1098 page(output,screen_lines=self.shell.rc.screen_length)
1155 page(output,screen_lines=self.shell.rc.screen_length)
1099 print sys_exit,
1156 print sys_exit,
1100
1157
1101 dump_file = opts.D[0]
1158 dump_file = opts.D[0]
1102 text_file = opts.T[0]
1159 text_file = opts.T[0]
1103 if dump_file:
1160 if dump_file:
1104 prof.dump_stats(dump_file)
1161 prof.dump_stats(dump_file)
1105 print '\n*** Profile stats marshalled to file',\
1162 print '\n*** Profile stats marshalled to file',\
1106 `dump_file`+'.',sys_exit
1163 `dump_file`+'.',sys_exit
1107 if text_file:
1164 if text_file:
1108 file(text_file,'w').write(output)
1165 file(text_file,'w').write(output)
1109 print '\n*** Profile printout saved to text file',\
1166 print '\n*** Profile printout saved to text file',\
1110 `text_file`+'.',sys_exit
1167 `text_file`+'.',sys_exit
1111
1168
1112 if opts.has_key('r'):
1169 if opts.has_key('r'):
1113 return stats
1170 return stats
1114 else:
1171 else:
1115 return None
1172 return None
1116
1173
1117 def magic_run(self, parameter_s ='',runner=None):
1174 def magic_run(self, parameter_s ='',runner=None):
1118 """Run the named file inside IPython as a program.
1175 """Run the named file inside IPython as a program.
1119
1176
1120 Usage:\\
1177 Usage:\\
1121 %run [-n -i -t [-N<N>] -d [-b<N>] -p [profile options]] file [args]
1178 %run [-n -i -t [-N<N>] -d [-b<N>] -p [profile options]] file [args]
1122
1179
1123 Parameters after the filename are passed as command-line arguments to
1180 Parameters after the filename are passed as command-line arguments to
1124 the program (put in sys.argv). Then, control returns to IPython's
1181 the program (put in sys.argv). Then, control returns to IPython's
1125 prompt.
1182 prompt.
1126
1183
1127 This is similar to running at a system prompt:\\
1184 This is similar to running at a system prompt:\\
1128 $ python file args\\
1185 $ python file args\\
1129 but with the advantage of giving you IPython's tracebacks, and of
1186 but with the advantage of giving you IPython's tracebacks, and of
1130 loading all variables into your interactive namespace for further use
1187 loading all variables into your interactive namespace for further use
1131 (unless -p is used, see below).
1188 (unless -p is used, see below).
1132
1189
1133 The file is executed in a namespace initially consisting only of
1190 The file is executed in a namespace initially consisting only of
1134 __name__=='__main__' and sys.argv constructed as indicated. It thus
1191 __name__=='__main__' and sys.argv constructed as indicated. It thus
1135 sees its environment as if it were being run as a stand-alone
1192 sees its environment as if it were being run as a stand-alone
1136 program. But after execution, the IPython interactive namespace gets
1193 program. But after execution, the IPython interactive namespace gets
1137 updated with all variables defined in the program (except for __name__
1194 updated with all variables defined in the program (except for __name__
1138 and sys.argv). This allows for very convenient loading of code for
1195 and sys.argv). This allows for very convenient loading of code for
1139 interactive work, while giving each program a 'clean sheet' to run in.
1196 interactive work, while giving each program a 'clean sheet' to run in.
1140
1197
1141 Options:
1198 Options:
1142
1199
1143 -n: __name__ is NOT set to '__main__', but to the running file's name
1200 -n: __name__ is NOT set to '__main__', but to the running file's name
1144 without extension (as python does under import). This allows running
1201 without extension (as python does under import). This allows running
1145 scripts and reloading the definitions in them without calling code
1202 scripts and reloading the definitions in them without calling code
1146 protected by an ' if __name__ == "__main__" ' clause.
1203 protected by an ' if __name__ == "__main__" ' clause.
1147
1204
1148 -i: run the file in IPython's namespace instead of an empty one. This
1205 -i: run the file in IPython's namespace instead of an empty one. This
1149 is useful if you are experimenting with code written in a text editor
1206 is useful if you are experimenting with code written in a text editor
1150 which depends on variables defined interactively.
1207 which depends on variables defined interactively.
1151
1208
1152 -e: ignore sys.exit() calls or SystemExit exceptions in the script
1209 -e: ignore sys.exit() calls or SystemExit exceptions in the script
1153 being run. This is particularly useful if IPython is being used to
1210 being run. This is particularly useful if IPython is being used to
1154 run unittests, which always exit with a sys.exit() call. In such
1211 run unittests, which always exit with a sys.exit() call. In such
1155 cases you are interested in the output of the test results, not in
1212 cases you are interested in the output of the test results, not in
1156 seeing a traceback of the unittest module.
1213 seeing a traceback of the unittest module.
1157
1214
1158 -t: print timing information at the end of the run. IPython will give
1215 -t: print timing information at the end of the run. IPython will give
1159 you an estimated CPU time consumption for your script, which under
1216 you an estimated CPU time consumption for your script, which under
1160 Unix uses the resource module to avoid the wraparound problems of
1217 Unix uses the resource module to avoid the wraparound problems of
1161 time.clock(). Under Unix, an estimate of time spent on system tasks
1218 time.clock(). Under Unix, an estimate of time spent on system tasks
1162 is also given (for Windows platforms this is reported as 0.0).
1219 is also given (for Windows platforms this is reported as 0.0).
1163
1220
1164 If -t is given, an additional -N<N> option can be given, where <N>
1221 If -t is given, an additional -N<N> option can be given, where <N>
1165 must be an integer indicating how many times you want the script to
1222 must be an integer indicating how many times you want the script to
1166 run. The final timing report will include total and per run results.
1223 run. The final timing report will include total and per run results.
1167
1224
1168 For example (testing the script uniq_stable.py):
1225 For example (testing the script uniq_stable.py):
1169
1226
1170 In [1]: run -t uniq_stable
1227 In [1]: run -t uniq_stable
1171
1228
1172 IPython CPU timings (estimated):\\
1229 IPython CPU timings (estimated):\\
1173 User : 0.19597 s.\\
1230 User : 0.19597 s.\\
1174 System: 0.0 s.\\
1231 System: 0.0 s.\\
1175
1232
1176 In [2]: run -t -N5 uniq_stable
1233 In [2]: run -t -N5 uniq_stable
1177
1234
1178 IPython CPU timings (estimated):\\
1235 IPython CPU timings (estimated):\\
1179 Total runs performed: 5\\
1236 Total runs performed: 5\\
1180 Times : Total Per run\\
1237 Times : Total Per run\\
1181 User : 0.910862 s, 0.1821724 s.\\
1238 User : 0.910862 s, 0.1821724 s.\\
1182 System: 0.0 s, 0.0 s.
1239 System: 0.0 s, 0.0 s.
1183
1240
1184 -d: run your program under the control of pdb, the Python debugger.
1241 -d: run your program under the control of pdb, the Python debugger.
1185 This allows you to execute your program step by step, watch variables,
1242 This allows you to execute your program step by step, watch variables,
1186 etc. Internally, what IPython does is similar to calling:
1243 etc. Internally, what IPython does is similar to calling:
1187
1244
1188 pdb.run('execfile("YOURFILENAME")')
1245 pdb.run('execfile("YOURFILENAME")')
1189
1246
1190 with a breakpoint set on line 1 of your file. You can change the line
1247 with a breakpoint set on line 1 of your file. You can change the line
1191 number for this automatic breakpoint to be <N> by using the -bN option
1248 number for this automatic breakpoint to be <N> by using the -bN option
1192 (where N must be an integer). For example:
1249 (where N must be an integer). For example:
1193
1250
1194 %run -d -b40 myscript
1251 %run -d -b40 myscript
1195
1252
1196 will set the first breakpoint at line 40 in myscript.py. Note that
1253 will set the first breakpoint at line 40 in myscript.py. Note that
1197 the first breakpoint must be set on a line which actually does
1254 the first breakpoint must be set on a line which actually does
1198 something (not a comment or docstring) for it to stop execution.
1255 something (not a comment or docstring) for it to stop execution.
1199
1256
1200 When the pdb debugger starts, you will see a (Pdb) prompt. You must
1257 When the pdb debugger starts, you will see a (Pdb) prompt. You must
1201 first enter 'c' (without qoutes) to start execution up to the first
1258 first enter 'c' (without qoutes) to start execution up to the first
1202 breakpoint.
1259 breakpoint.
1203
1260
1204 Entering 'help' gives information about the use of the debugger. You
1261 Entering 'help' gives information about the use of the debugger. You
1205 can easily see pdb's full documentation with "import pdb;pdb.help()"
1262 can easily see pdb's full documentation with "import pdb;pdb.help()"
1206 at a prompt.
1263 at a prompt.
1207
1264
1208 -p: run program under the control of the Python profiler module (which
1265 -p: run program under the control of the Python profiler module (which
1209 prints a detailed report of execution times, function calls, etc).
1266 prints a detailed report of execution times, function calls, etc).
1210
1267
1211 You can pass other options after -p which affect the behavior of the
1268 You can pass other options after -p which affect the behavior of the
1212 profiler itself. See the docs for %prun for details.
1269 profiler itself. See the docs for %prun for details.
1213
1270
1214 In this mode, the program's variables do NOT propagate back to the
1271 In this mode, the program's variables do NOT propagate back to the
1215 IPython interactive namespace (because they remain in the namespace
1272 IPython interactive namespace (because they remain in the namespace
1216 where the profiler executes them).
1273 where the profiler executes them).
1217
1274
1218 Internally this triggers a call to %prun, see its documentation for
1275 Internally this triggers a call to %prun, see its documentation for
1219 details on the options available specifically for profiling."""
1276 details on the options available specifically for profiling."""
1220
1277
1221 # get arguments and set sys.argv for program to be run.
1278 # get arguments and set sys.argv for program to be run.
1222 opts,arg_lst = self.parse_options(parameter_s,'nidtN:b:pD:l:rs:T:e',
1279 opts,arg_lst = self.parse_options(parameter_s,'nidtN:b:pD:l:rs:T:e',
1223 mode='list',list_all=1)
1280 mode='list',list_all=1)
1224
1281
1225 try:
1282 try:
1226 filename = get_py_filename(arg_lst[0])
1283 filename = get_py_filename(arg_lst[0])
1227 except IndexError:
1284 except IndexError:
1228 warn('you must provide at least a filename.')
1285 warn('you must provide at least a filename.')
1229 print '\n%run:\n',OInspect.getdoc(self.magic_run)
1286 print '\n%run:\n',OInspect.getdoc(self.magic_run)
1230 return
1287 return
1231 except IOError,msg:
1288 except IOError,msg:
1232 error(msg)
1289 error(msg)
1233 return
1290 return
1234
1291
1235 # Control the response to exit() calls made by the script being run
1292 # Control the response to exit() calls made by the script being run
1236 exit_ignore = opts.has_key('e')
1293 exit_ignore = opts.has_key('e')
1237
1294
1238 # Make sure that the running script gets a proper sys.argv as if it
1295 # Make sure that the running script gets a proper sys.argv as if it
1239 # were run from a system shell.
1296 # were run from a system shell.
1240 save_argv = sys.argv # save it for later restoring
1297 save_argv = sys.argv # save it for later restoring
1241 sys.argv = [filename]+ arg_lst[1:] # put in the proper filename
1298 sys.argv = [filename]+ arg_lst[1:] # put in the proper filename
1242
1299
1243 if opts.has_key('i'):
1300 if opts.has_key('i'):
1244 prog_ns = self.shell.user_ns
1301 prog_ns = self.shell.user_ns
1245 __name__save = self.shell.user_ns['__name__']
1302 __name__save = self.shell.user_ns['__name__']
1246 prog_ns['__name__'] = '__main__'
1303 prog_ns['__name__'] = '__main__'
1247 else:
1304 else:
1248 if opts.has_key('n'):
1305 if opts.has_key('n'):
1249 name = os.path.splitext(os.path.basename(filename))[0]
1306 name = os.path.splitext(os.path.basename(filename))[0]
1250 else:
1307 else:
1251 name = '__main__'
1308 name = '__main__'
1252 prog_ns = {'__name__':name}
1309 prog_ns = {'__name__':name}
1253
1310
1254 # pickle fix. See iplib for an explanation
1311 # pickle fix. See iplib for an explanation
1255 sys.modules[prog_ns['__name__']] = FakeModule(prog_ns)
1312 sys.modules[prog_ns['__name__']] = FakeModule(prog_ns)
1256
1313
1257 stats = None
1314 stats = None
1258 try:
1315 try:
1259 if opts.has_key('p'):
1316 if opts.has_key('p'):
1260 stats = self.magic_prun('',0,opts,arg_lst,prog_ns)
1317 stats = self.magic_prun('',0,opts,arg_lst,prog_ns)
1261 else:
1318 else:
1262 if opts.has_key('d'):
1319 if opts.has_key('d'):
1263 deb = pdb.Pdb()
1320 deb = pdb.Pdb()
1264 # reset Breakpoint state, which is moronically kept
1321 # reset Breakpoint state, which is moronically kept
1265 # in a class
1322 # in a class
1266 bdb.Breakpoint.next = 1
1323 bdb.Breakpoint.next = 1
1267 bdb.Breakpoint.bplist = {}
1324 bdb.Breakpoint.bplist = {}
1268 bdb.Breakpoint.bpbynumber = [None]
1325 bdb.Breakpoint.bpbynumber = [None]
1269 # Set an initial breakpoint to stop execution
1326 # Set an initial breakpoint to stop execution
1270 maxtries = 10
1327 maxtries = 10
1271 bp = int(opts.get('b',[1])[0])
1328 bp = int(opts.get('b',[1])[0])
1272 checkline = deb.checkline(filename,bp)
1329 checkline = deb.checkline(filename,bp)
1273 if not checkline:
1330 if not checkline:
1274 for bp in range(bp+1,bp+maxtries+1):
1331 for bp in range(bp+1,bp+maxtries+1):
1275 if deb.checkline(filename,bp):
1332 if deb.checkline(filename,bp):
1276 break
1333 break
1277 else:
1334 else:
1278 msg = ("\nI failed to find a valid line to set "
1335 msg = ("\nI failed to find a valid line to set "
1279 "a breakpoint\n"
1336 "a breakpoint\n"
1280 "after trying up to line: %s.\n"
1337 "after trying up to line: %s.\n"
1281 "Please set a valid breakpoint manually "
1338 "Please set a valid breakpoint manually "
1282 "with the -b option." % bp)
1339 "with the -b option." % bp)
1283 error(msg)
1340 error(msg)
1284 return
1341 return
1285 # if we find a good linenumber, set the breakpoint
1342 # if we find a good linenumber, set the breakpoint
1286 deb.do_break('%s:%s' % (filename,bp))
1343 deb.do_break('%s:%s' % (filename,bp))
1287 # Start file run
1344 # Start file run
1288 print "NOTE: Enter 'c' at the",
1345 print "NOTE: Enter 'c' at the",
1289 print "(Pdb) prompt to start your script."
1346 print "(Pdb) prompt to start your script."
1290 deb.run('execfile("%s")' % filename,prog_ns)
1347 deb.run('execfile("%s")' % filename,prog_ns)
1291 else:
1348 else:
1292 if runner is None:
1349 if runner is None:
1293 runner = self.shell.safe_execfile
1350 runner = self.shell.safe_execfile
1294 if opts.has_key('t'):
1351 if opts.has_key('t'):
1295 try:
1352 try:
1296 nruns = int(opts['N'][0])
1353 nruns = int(opts['N'][0])
1297 if nruns < 1:
1354 if nruns < 1:
1298 error('Number of runs must be >=1')
1355 error('Number of runs must be >=1')
1299 return
1356 return
1300 except (KeyError):
1357 except (KeyError):
1301 nruns = 1
1358 nruns = 1
1302 if nruns == 1:
1359 if nruns == 1:
1303 t0 = clock2()
1360 t0 = clock2()
1304 runner(filename,prog_ns,prog_ns,exit_ignore=exit_ignore)
1361 runner(filename,prog_ns,prog_ns,exit_ignore=exit_ignore)
1305 t1 = clock2()
1362 t1 = clock2()
1306 t_usr = t1[0]-t0[0]
1363 t_usr = t1[0]-t0[0]
1307 t_sys = t1[1]-t1[1]
1364 t_sys = t1[1]-t1[1]
1308 print "\nIPython CPU timings (estimated):"
1365 print "\nIPython CPU timings (estimated):"
1309 print " User : %10s s." % t_usr
1366 print " User : %10s s." % t_usr
1310 print " System: %10s s." % t_sys
1367 print " System: %10s s." % t_sys
1311 else:
1368 else:
1312 runs = range(nruns)
1369 runs = range(nruns)
1313 t0 = clock2()
1370 t0 = clock2()
1314 for nr in runs:
1371 for nr in runs:
1315 runner(filename,prog_ns,prog_ns,exit_ignore=exit_ignore)
1372 runner(filename,prog_ns,prog_ns,exit_ignore=exit_ignore)
1316 t1 = clock2()
1373 t1 = clock2()
1317 t_usr = t1[0]-t0[0]
1374 t_usr = t1[0]-t0[0]
1318 t_sys = t1[1]-t1[1]
1375 t_sys = t1[1]-t1[1]
1319 print "\nIPython CPU timings (estimated):"
1376 print "\nIPython CPU timings (estimated):"
1320 print "Total runs performed:",nruns
1377 print "Total runs performed:",nruns
1321 print " Times : %10s %10s" % ('Total','Per run')
1378 print " Times : %10s %10s" % ('Total','Per run')
1322 print " User : %10s s, %10s s." % (t_usr,t_usr/nruns)
1379 print " User : %10s s, %10s s." % (t_usr,t_usr/nruns)
1323 print " System: %10s s, %10s s." % (t_sys,t_sys/nruns)
1380 print " System: %10s s, %10s s." % (t_sys,t_sys/nruns)
1324
1381
1325 else:
1382 else:
1326 runner(filename,prog_ns,prog_ns,exit_ignore=exit_ignore)
1383 runner(filename,prog_ns,prog_ns,exit_ignore=exit_ignore)
1327 if opts.has_key('i'):
1384 if opts.has_key('i'):
1328 self.shell.user_ns['__name__'] = __name__save
1385 self.shell.user_ns['__name__'] = __name__save
1329 else:
1386 else:
1330 # update IPython interactive namespace
1387 # update IPython interactive namespace
1331 del prog_ns['__name__']
1388 del prog_ns['__name__']
1332 self.shell.user_ns.update(prog_ns)
1389 self.shell.user_ns.update(prog_ns)
1333 finally:
1390 finally:
1334 sys.argv = save_argv
1391 sys.argv = save_argv
1335 return stats
1392 return stats
1336
1393
1337 def magic_runlog(self, parameter_s =''):
1394 def magic_runlog(self, parameter_s =''):
1338 """Run files as logs.
1395 """Run files as logs.
1339
1396
1340 Usage:\\
1397 Usage:\\
1341 %runlog file1 file2 ...
1398 %runlog file1 file2 ...
1342
1399
1343 Run the named files (treating them as log files) in sequence inside
1400 Run the named files (treating them as log files) in sequence inside
1344 the interpreter, and return to the prompt. This is much slower than
1401 the interpreter, and return to the prompt. This is much slower than
1345 %run because each line is executed in a try/except block, but it
1402 %run because each line is executed in a try/except block, but it
1346 allows running files with syntax errors in them.
1403 allows running files with syntax errors in them.
1347
1404
1348 Normally IPython will guess when a file is one of its own logfiles, so
1405 Normally IPython will guess when a file is one of its own logfiles, so
1349 you can typically use %run even for logs. This shorthand allows you to
1406 you can typically use %run even for logs. This shorthand allows you to
1350 force any file to be treated as a log file."""
1407 force any file to be treated as a log file."""
1351
1408
1352 for f in parameter_s.split():
1409 for f in parameter_s.split():
1353 self.shell.safe_execfile(f,self.shell.user_ns,
1410 self.shell.safe_execfile(f,self.shell.user_ns,
1354 self.shell.user_ns,islog=1)
1411 self.shell.user_ns,islog=1)
1355
1412
1356 def magic_time(self,parameter_s = ''):
1413 def magic_time(self,parameter_s = ''):
1357 """Time execution of a Python statement or expression.
1414 """Time execution of a Python statement or expression.
1358
1415
1359 The CPU and wall clock times are printed, and the value of the
1416 The CPU and wall clock times are printed, and the value of the
1360 expression (if any) is returned. Note that under Win32, system time
1417 expression (if any) is returned. Note that under Win32, system time
1361 is always reported as 0, since it can not be measured.
1418 is always reported as 0, since it can not be measured.
1362
1419
1363 This function provides very basic timing functionality. In Python
1420 This function provides very basic timing functionality. In Python
1364 2.3, the timeit module offers more control and sophistication, but for
1421 2.3, the timeit module offers more control and sophistication, but for
1365 now IPython supports Python 2.2, so we can not rely on timeit being
1422 now IPython supports Python 2.2, so we can not rely on timeit being
1366 present.
1423 present.
1367
1424
1368 Some examples:
1425 Some examples:
1369
1426
1370 In [1]: time 2**128
1427 In [1]: time 2**128
1371 CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s
1428 CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s
1372 Wall time: 0.00
1429 Wall time: 0.00
1373 Out[1]: 340282366920938463463374607431768211456L
1430 Out[1]: 340282366920938463463374607431768211456L
1374
1431
1375 In [2]: n = 1000000
1432 In [2]: n = 1000000
1376
1433
1377 In [3]: time sum(range(n))
1434 In [3]: time sum(range(n))
1378 CPU times: user 1.20 s, sys: 0.05 s, total: 1.25 s
1435 CPU times: user 1.20 s, sys: 0.05 s, total: 1.25 s
1379 Wall time: 1.37
1436 Wall time: 1.37
1380 Out[3]: 499999500000L
1437 Out[3]: 499999500000L
1381
1438
1382 In [4]: time print 'hello world'
1439 In [4]: time print 'hello world'
1383 hello world
1440 hello world
1384 CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s
1441 CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s
1385 Wall time: 0.00
1442 Wall time: 0.00
1386 """
1443 """
1387
1444
1388 # fail immediately if the given expression can't be compiled
1445 # fail immediately if the given expression can't be compiled
1389 try:
1446 try:
1390 mode = 'eval'
1447 mode = 'eval'
1391 code = compile(parameter_s,'<timed eval>',mode)
1448 code = compile(parameter_s,'<timed eval>',mode)
1392 except SyntaxError:
1449 except SyntaxError:
1393 mode = 'exec'
1450 mode = 'exec'
1394 code = compile(parameter_s,'<timed exec>',mode)
1451 code = compile(parameter_s,'<timed exec>',mode)
1395 # skew measurement as little as possible
1452 # skew measurement as little as possible
1396 glob = self.shell.user_ns
1453 glob = self.shell.user_ns
1397 clk = clock2
1454 clk = clock2
1398 wtime = time.time
1455 wtime = time.time
1399 # time execution
1456 # time execution
1400 wall_st = wtime()
1457 wall_st = wtime()
1401 if mode=='eval':
1458 if mode=='eval':
1402 st = clk()
1459 st = clk()
1403 out = eval(code,glob)
1460 out = eval(code,glob)
1404 end = clk()
1461 end = clk()
1405 else:
1462 else:
1406 st = clk()
1463 st = clk()
1407 exec code in glob
1464 exec code in glob
1408 end = clk()
1465 end = clk()
1409 out = None
1466 out = None
1410 wall_end = wtime()
1467 wall_end = wtime()
1411 # Compute actual times and report
1468 # Compute actual times and report
1412 wall_time = wall_end-wall_st
1469 wall_time = wall_end-wall_st
1413 cpu_user = end[0]-st[0]
1470 cpu_user = end[0]-st[0]
1414 cpu_sys = end[1]-st[1]
1471 cpu_sys = end[1]-st[1]
1415 cpu_tot = cpu_user+cpu_sys
1472 cpu_tot = cpu_user+cpu_sys
1416 print "CPU times: user %.2f s, sys: %.2f s, total: %.2f s" % \
1473 print "CPU times: user %.2f s, sys: %.2f s, total: %.2f s" % \
1417 (cpu_user,cpu_sys,cpu_tot)
1474 (cpu_user,cpu_sys,cpu_tot)
1418 print "Wall time: %.2f" % wall_time
1475 print "Wall time: %.2f" % wall_time
1419 return out
1476 return out
1420
1477
1421 def magic_macro(self,parameter_s = ''):
1478 def magic_macro(self,parameter_s = ''):
1422 """Define a set of input lines as a macro for future re-execution.
1479 """Define a set of input lines as a macro for future re-execution.
1423
1480
1424 Usage:\\
1481 Usage:\\
1425 %macro name n1:n2 n3:n4 ... n5 .. n6 ...
1482 %macro name n1:n2 n3:n4 ... n5 .. n6 ...
1426
1483
1427 This will define a global variable called `name` which is a string
1484 This will define a global variable called `name` which is a string
1428 made of joining the slices and lines you specify (n1,n2,... numbers
1485 made of joining the slices and lines you specify (n1,n2,... numbers
1429 above) from your input history into a single string. This variable
1486 above) from your input history into a single string. This variable
1430 acts like an automatic function which re-executes those lines as if
1487 acts like an automatic function which re-executes those lines as if
1431 you had typed them. You just type 'name' at the prompt and the code
1488 you had typed them. You just type 'name' at the prompt and the code
1432 executes.
1489 executes.
1433
1490
1434 Note that the slices use the standard Python slicing notation (5:8
1491 Note that the slices use the standard Python slicing notation (5:8
1435 means include lines numbered 5,6,7).
1492 means include lines numbered 5,6,7).
1436
1493
1437 For example, if your history contains (%hist prints it):
1494 For example, if your history contains (%hist prints it):
1438
1495
1439 44: x=1\\
1496 44: x=1\\
1440 45: y=3\\
1497 45: y=3\\
1441 46: z=x+y\\
1498 46: z=x+y\\
1442 47: print x\\
1499 47: print x\\
1443 48: a=5\\
1500 48: a=5\\
1444 49: print 'x',x,'y',y\\
1501 49: print 'x',x,'y',y\\
1445
1502
1446 you can create a macro with lines 44 through 47 (included) and line 49
1503 you can create a macro with lines 44 through 47 (included) and line 49
1447 called my_macro with:
1504 called my_macro with:
1448
1505
1449 In [51]: %macro my_macro 44:48 49
1506 In [51]: %macro my_macro 44:48 49
1450
1507
1451 Now, typing `my_macro` (without quotes) will re-execute all this code
1508 Now, typing `my_macro` (without quotes) will re-execute all this code
1452 in one pass.
1509 in one pass.
1453
1510
1454 You don't need to give the line-numbers in order, and any given line
1511 You don't need to give the line-numbers in order, and any given line
1455 number can appear multiple times. You can assemble macros with any
1512 number can appear multiple times. You can assemble macros with any
1456 lines from your input history in any order.
1513 lines from your input history in any order.
1457
1514
1458 The macro is a simple object which holds its value in an attribute,
1515 The macro is a simple object which holds its value in an attribute,
1459 but IPython's display system checks for macros and executes them as
1516 but IPython's display system checks for macros and executes them as
1460 code instead of printing them when you type their name.
1517 code instead of printing them when you type their name.
1461
1518
1462 You can view a macro's contents by explicitly printing it with:
1519 You can view a macro's contents by explicitly printing it with:
1463
1520
1464 'print macro_name'.
1521 'print macro_name'.
1465
1522
1466 For one-off cases which DON'T contain magic function calls in them you
1523 For one-off cases which DON'T contain magic function calls in them you
1467 can obtain similar results by explicitly executing slices from your
1524 can obtain similar results by explicitly executing slices from your
1468 input history with:
1525 input history with:
1469
1526
1470 In [60]: exec In[44:48]+In[49]"""
1527 In [60]: exec In[44:48]+In[49]"""
1471
1528
1472 args = parameter_s.split()
1529 args = parameter_s.split()
1473 name,ranges = args[0], args[1:]
1530 name,ranges = args[0], args[1:]
1474 #print 'rng',ranges # dbg
1531 #print 'rng',ranges # dbg
1475 cmds = self.extract_input_slices(ranges)
1532 cmds = self.extract_input_slices(ranges)
1476 macro = Macro(cmds)
1533 macro = Macro(cmds)
1477 self.shell.user_ns.update({name:macro})
1534 self.shell.user_ns.update({name:macro})
1478 print 'Macro `%s` created. To execute, type its name (without quotes).' % name
1535 print 'Macro `%s` created. To execute, type its name (without quotes).' % name
1479 print 'Macro contents:'
1536 print 'Macro contents:'
1480 print str(macro).rstrip(),
1537 print str(macro).rstrip(),
1481
1538
1482 def magic_save(self,parameter_s = ''):
1539 def magic_save(self,parameter_s = ''):
1483 """Save a set of lines to a given filename.
1540 """Save a set of lines to a given filename.
1484
1541
1485 Usage:\\
1542 Usage:\\
1486 %save filename n1:n2 n3:n4 ... n5 .. n6 ...
1543 %save filename n1:n2 n3:n4 ... n5 .. n6 ...
1487
1544
1488 This function uses the same syntax as %macro for line extraction, but
1545 This function uses the same syntax as %macro for line extraction, but
1489 instead of creating a macro it saves the resulting string to the
1546 instead of creating a macro it saves the resulting string to the
1490 filename you specify.
1547 filename you specify.
1491
1548
1492 It adds a '.py' extension to the file if you don't do so yourself, and
1549 It adds a '.py' extension to the file if you don't do so yourself, and
1493 it asks for confirmation before overwriting existing files."""
1550 it asks for confirmation before overwriting existing files."""
1494
1551
1495 args = parameter_s.split()
1552 args = parameter_s.split()
1496 fname,ranges = args[0], args[1:]
1553 fname,ranges = args[0], args[1:]
1497 if not fname.endswith('.py'):
1554 if not fname.endswith('.py'):
1498 fname += '.py'
1555 fname += '.py'
1499 if os.path.isfile(fname):
1556 if os.path.isfile(fname):
1500 ans = raw_input('File `%s` exists. Overwrite (y/[N])? ' % fname)
1557 ans = raw_input('File `%s` exists. Overwrite (y/[N])? ' % fname)
1501 if ans.lower() not in ['y','yes']:
1558 if ans.lower() not in ['y','yes']:
1502 print 'Operation cancelled.'
1559 print 'Operation cancelled.'
1503 return
1560 return
1504 cmds = ''.join(self.extract_input_slices(ranges))
1561 cmds = ''.join(self.extract_input_slices(ranges))
1505 f = file(fname,'w')
1562 f = file(fname,'w')
1506 f.write(cmds)
1563 f.write(cmds)
1507 f.close()
1564 f.close()
1508 print 'The following commands were written to file `%s`:' % fname
1565 print 'The following commands were written to file `%s`:' % fname
1509 print cmds
1566 print cmds
1510
1567
1511 def magic_ed(self,parameter_s = ''):
1568 def magic_ed(self,parameter_s = ''):
1512 """Alias to %edit."""
1569 """Alias to %edit."""
1513 return self.magic_edit(parameter_s)
1570 return self.magic_edit(parameter_s)
1514
1571
1515 def magic_edit(self,parameter_s = '',last_call=['','']):
1572 def magic_edit(self,parameter_s = '',last_call=['','']):
1516 """Bring up an editor and execute the resulting code.
1573 """Bring up an editor and execute the resulting code.
1517
1574
1518 Usage:
1575 Usage:
1519 %edit [options] [args]
1576 %edit [options] [args]
1520
1577
1521 %edit runs IPython's editor hook. The default version of this hook is
1578 %edit runs IPython's editor hook. The default version of this hook is
1522 set to call the __IPYTHON__.rc.editor command. This is read from your
1579 set to call the __IPYTHON__.rc.editor command. This is read from your
1523 environment variable $EDITOR. If this isn't found, it will default to
1580 environment variable $EDITOR. If this isn't found, it will default to
1524 vi under Linux/Unix and to notepad under Windows. See the end of this
1581 vi under Linux/Unix and to notepad under Windows. See the end of this
1525 docstring for how to change the editor hook.
1582 docstring for how to change the editor hook.
1526
1583
1527 You can also set the value of this editor via the command line option
1584 You can also set the value of this editor via the command line option
1528 '-editor' or in your ipythonrc file. This is useful if you wish to use
1585 '-editor' or in your ipythonrc file. This is useful if you wish to use
1529 specifically for IPython an editor different from your typical default
1586 specifically for IPython an editor different from your typical default
1530 (and for Windows users who typically don't set environment variables).
1587 (and for Windows users who typically don't set environment variables).
1531
1588
1532 This command allows you to conveniently edit multi-line code right in
1589 This command allows you to conveniently edit multi-line code right in
1533 your IPython session.
1590 your IPython session.
1534
1591
1535 If called without arguments, %edit opens up an empty editor with a
1592 If called without arguments, %edit opens up an empty editor with a
1536 temporary file and will execute the contents of this file when you
1593 temporary file and will execute the contents of this file when you
1537 close it (don't forget to save it!).
1594 close it (don't forget to save it!).
1538
1595
1539 Options:
1596 Options:
1540
1597
1541 -p: this will call the editor with the same data as the previous time
1598 -p: this will call the editor with the same data as the previous time
1542 it was used, regardless of how long ago (in your current session) it
1599 it was used, regardless of how long ago (in your current session) it
1543 was.
1600 was.
1544
1601
1545 -x: do not execute the edited code immediately upon exit. This is
1602 -x: do not execute the edited code immediately upon exit. This is
1546 mainly useful if you are editing programs which need to be called with
1603 mainly useful if you are editing programs which need to be called with
1547 command line arguments, which you can then do using %run.
1604 command line arguments, which you can then do using %run.
1548
1605
1549 Arguments:
1606 Arguments:
1550
1607
1551 If arguments are given, the following possibilites exist:
1608 If arguments are given, the following possibilites exist:
1552
1609
1553 - The arguments are numbers or pairs of colon-separated numbers (like
1610 - The arguments are numbers or pairs of colon-separated numbers (like
1554 1 4:8 9). These are interpreted as lines of previous input to be
1611 1 4:8 9). These are interpreted as lines of previous input to be
1555 loaded into the editor. The syntax is the same of the %macro command.
1612 loaded into the editor. The syntax is the same of the %macro command.
1556
1613
1557 - If the argument doesn't start with a number, it is evaluated as a
1614 - If the argument doesn't start with a number, it is evaluated as a
1558 variable and its contents loaded into the editor. You can thus edit
1615 variable and its contents loaded into the editor. You can thus edit
1559 any string which contains python code (including the result of
1616 any string which contains python code (including the result of
1560 previous edits).
1617 previous edits).
1561
1618
1562 - If the argument is the name of an object (other than a string),
1619 - If the argument is the name of an object (other than a string),
1563 IPython will try to locate the file where it was defined and open the
1620 IPython will try to locate the file where it was defined and open the
1564 editor at the point where it is defined. You can use `%edit function`
1621 editor at the point where it is defined. You can use `%edit function`
1565 to load an editor exactly at the point where 'function' is defined,
1622 to load an editor exactly at the point where 'function' is defined,
1566 edit it and have the file be executed automatically.
1623 edit it and have the file be executed automatically.
1567
1624
1568 Note: opening at an exact line is only supported under Unix, and some
1625 Note: opening at an exact line is only supported under Unix, and some
1569 editors (like kedit and gedit up to Gnome 2.8) do not understand the
1626 editors (like kedit and gedit up to Gnome 2.8) do not understand the
1570 '+NUMBER' parameter necessary for this feature. Good editors like
1627 '+NUMBER' parameter necessary for this feature. Good editors like
1571 (X)Emacs, vi, jed, pico and joe all do.
1628 (X)Emacs, vi, jed, pico and joe all do.
1572
1629
1573 - If the argument is not found as a variable, IPython will look for a
1630 - If the argument is not found as a variable, IPython will look for a
1574 file with that name (adding .py if necessary) and load it into the
1631 file with that name (adding .py if necessary) and load it into the
1575 editor. It will execute its contents with execfile() when you exit,
1632 editor. It will execute its contents with execfile() when you exit,
1576 loading any code in the file into your interactive namespace.
1633 loading any code in the file into your interactive namespace.
1577
1634
1578 After executing your code, %edit will return as output the code you
1635 After executing your code, %edit will return as output the code you
1579 typed in the editor (except when it was an existing file). This way
1636 typed in the editor (except when it was an existing file). This way
1580 you can reload the code in further invocations of %edit as a variable,
1637 you can reload the code in further invocations of %edit as a variable,
1581 via _<NUMBER> or Out[<NUMBER>], where <NUMBER> is the prompt number of
1638 via _<NUMBER> or Out[<NUMBER>], where <NUMBER> is the prompt number of
1582 the output.
1639 the output.
1583
1640
1584 Note that %edit is also available through the alias %ed.
1641 Note that %edit is also available through the alias %ed.
1585
1642
1586 This is an example of creating a simple function inside the editor and
1643 This is an example of creating a simple function inside the editor and
1587 then modifying it. First, start up the editor:
1644 then modifying it. First, start up the editor:
1588
1645
1589 In [1]: ed\\
1646 In [1]: ed\\
1590 Editing... done. Executing edited code...\\
1647 Editing... done. Executing edited code...\\
1591 Out[1]: 'def foo():\\n print "foo() was defined in an editing session"\\n'
1648 Out[1]: 'def foo():\\n print "foo() was defined in an editing session"\\n'
1592
1649
1593 We can then call the function foo():
1650 We can then call the function foo():
1594
1651
1595 In [2]: foo()\\
1652 In [2]: foo()\\
1596 foo() was defined in an editing session
1653 foo() was defined in an editing session
1597
1654
1598 Now we edit foo. IPython automatically loads the editor with the
1655 Now we edit foo. IPython automatically loads the editor with the
1599 (temporary) file where foo() was previously defined:
1656 (temporary) file where foo() was previously defined:
1600
1657
1601 In [3]: ed foo\\
1658 In [3]: ed foo\\
1602 Editing... done. Executing edited code...
1659 Editing... done. Executing edited code...
1603
1660
1604 And if we call foo() again we get the modified version:
1661 And if we call foo() again we get the modified version:
1605
1662
1606 In [4]: foo()\\
1663 In [4]: foo()\\
1607 foo() has now been changed!
1664 foo() has now been changed!
1608
1665
1609 Here is an example of how to edit a code snippet successive
1666 Here is an example of how to edit a code snippet successive
1610 times. First we call the editor:
1667 times. First we call the editor:
1611
1668
1612 In [8]: ed\\
1669 In [8]: ed\\
1613 Editing... done. Executing edited code...\\
1670 Editing... done. Executing edited code...\\
1614 hello\\
1671 hello\\
1615 Out[8]: "print 'hello'\\n"
1672 Out[8]: "print 'hello'\\n"
1616
1673
1617 Now we call it again with the previous output (stored in _):
1674 Now we call it again with the previous output (stored in _):
1618
1675
1619 In [9]: ed _\\
1676 In [9]: ed _\\
1620 Editing... done. Executing edited code...\\
1677 Editing... done. Executing edited code...\\
1621 hello world\\
1678 hello world\\
1622 Out[9]: "print 'hello world'\\n"
1679 Out[9]: "print 'hello world'\\n"
1623
1680
1624 Now we call it with the output #8 (stored in _8, also as Out[8]):
1681 Now we call it with the output #8 (stored in _8, also as Out[8]):
1625
1682
1626 In [10]: ed _8\\
1683 In [10]: ed _8\\
1627 Editing... done. Executing edited code...\\
1684 Editing... done. Executing edited code...\\
1628 hello again\\
1685 hello again\\
1629 Out[10]: "print 'hello again'\\n"
1686 Out[10]: "print 'hello again'\\n"
1630
1687
1631
1688
1632 Changing the default editor hook:
1689 Changing the default editor hook:
1633
1690
1634 If you wish to write your own editor hook, you can put it in a
1691 If you wish to write your own editor hook, you can put it in a
1635 configuration file which you load at startup time. The default hook
1692 configuration file which you load at startup time. The default hook
1636 is defined in the IPython.hooks module, and you can use that as a
1693 is defined in the IPython.hooks module, and you can use that as a
1637 starting example for further modifications. That file also has
1694 starting example for further modifications. That file also has
1638 general instructions on how to set a new hook for use once you've
1695 general instructions on how to set a new hook for use once you've
1639 defined it."""
1696 defined it."""
1640
1697
1641 # FIXME: This function has become a convoluted mess. It needs a
1698 # FIXME: This function has become a convoluted mess. It needs a
1642 # ground-up rewrite with clean, simple logic.
1699 # ground-up rewrite with clean, simple logic.
1643
1700
1644 def make_filename(arg):
1701 def make_filename(arg):
1645 "Make a filename from the given args"
1702 "Make a filename from the given args"
1646 try:
1703 try:
1647 filename = get_py_filename(arg)
1704 filename = get_py_filename(arg)
1648 except IOError:
1705 except IOError:
1649 if args.endswith('.py'):
1706 if args.endswith('.py'):
1650 filename = arg
1707 filename = arg
1651 else:
1708 else:
1652 filename = None
1709 filename = None
1653 return filename
1710 return filename
1654
1711
1655 # custom exceptions
1712 # custom exceptions
1656 class DataIsObject(Exception): pass
1713 class DataIsObject(Exception): pass
1657
1714
1658 opts,args = self.parse_options(parameter_s,'px')
1715 opts,args = self.parse_options(parameter_s,'px')
1659
1716
1660 # Default line number value
1717 # Default line number value
1661 lineno = None
1718 lineno = None
1662 if opts.has_key('p'):
1719 if opts.has_key('p'):
1663 args = '_%s' % last_call[0]
1720 args = '_%s' % last_call[0]
1664 if not self.shell.user_ns.has_key(args):
1721 if not self.shell.user_ns.has_key(args):
1665 args = last_call[1]
1722 args = last_call[1]
1666
1723
1667 # use last_call to remember the state of the previous call, but don't
1724 # use last_call to remember the state of the previous call, but don't
1668 # let it be clobbered by successive '-p' calls.
1725 # let it be clobbered by successive '-p' calls.
1669 try:
1726 try:
1670 last_call[0] = self.shell.outputcache.prompt_count
1727 last_call[0] = self.shell.outputcache.prompt_count
1671 if not opts.has_key('p'):
1728 if not opts.has_key('p'):
1672 last_call[1] = parameter_s
1729 last_call[1] = parameter_s
1673 except:
1730 except:
1674 pass
1731 pass
1675
1732
1676 # by default this is done with temp files, except when the given
1733 # by default this is done with temp files, except when the given
1677 # arg is a filename
1734 # arg is a filename
1678 use_temp = 1
1735 use_temp = 1
1679
1736
1680 if re.match(r'\d',args):
1737 if re.match(r'\d',args):
1681 # Mode where user specifies ranges of lines, like in %macro.
1738 # Mode where user specifies ranges of lines, like in %macro.
1682 # This means that you can't edit files whose names begin with
1739 # This means that you can't edit files whose names begin with
1683 # numbers this way. Tough.
1740 # numbers this way. Tough.
1684 ranges = args.split()
1741 ranges = args.split()
1685 data = ''.join(self.extract_input_slices(ranges))
1742 data = ''.join(self.extract_input_slices(ranges))
1686 elif args.endswith('.py'):
1743 elif args.endswith('.py'):
1687 filename = make_filename(args)
1744 filename = make_filename(args)
1688 data = ''
1745 data = ''
1689 use_temp = 0
1746 use_temp = 0
1690 elif args:
1747 elif args:
1691 try:
1748 try:
1692 # Load the parameter given as a variable. If not a string,
1749 # Load the parameter given as a variable. If not a string,
1693 # process it as an object instead (below)
1750 # process it as an object instead (below)
1694
1751
1695 #print '*** args',args,'type',type(args) # dbg
1752 #print '*** args',args,'type',type(args) # dbg
1696 data = eval(args,self.shell.user_ns)
1753 data = eval(args,self.shell.user_ns)
1697 if not type(data) in StringTypes:
1754 if not type(data) in StringTypes:
1698 raise DataIsObject
1755 raise DataIsObject
1699 except (NameError,SyntaxError):
1756 except (NameError,SyntaxError):
1700 # given argument is not a variable, try as a filename
1757 # given argument is not a variable, try as a filename
1701 filename = make_filename(args)
1758 filename = make_filename(args)
1702 if filename is None:
1759 if filename is None:
1703 warn("Argument given (%s) can't be found as a variable "
1760 warn("Argument given (%s) can't be found as a variable "
1704 "or as a filename." % args)
1761 "or as a filename." % args)
1705 return
1762 return
1706 data = ''
1763 data = ''
1707 use_temp = 0
1764 use_temp = 0
1708 except DataIsObject:
1765 except DataIsObject:
1709 # For objects, try to edit the file where they are defined
1766 # For objects, try to edit the file where they are defined
1710 try:
1767 try:
1711 filename = inspect.getabsfile(data)
1768 filename = inspect.getabsfile(data)
1712 datafile = 1
1769 datafile = 1
1713 except TypeError:
1770 except TypeError:
1714 filename = make_filename(args)
1771 filename = make_filename(args)
1715 datafile = 1
1772 datafile = 1
1716 warn('Could not find file where `%s` is defined.\n'
1773 warn('Could not find file where `%s` is defined.\n'
1717 'Opening a file named `%s`' % (args,filename))
1774 'Opening a file named `%s`' % (args,filename))
1718 # Now, make sure we can actually read the source (if it was in
1775 # Now, make sure we can actually read the source (if it was in
1719 # a temp file it's gone by now).
1776 # a temp file it's gone by now).
1720 if datafile:
1777 if datafile:
1721 try:
1778 try:
1722 lineno = inspect.getsourcelines(data)[1]
1779 lineno = inspect.getsourcelines(data)[1]
1723 except IOError:
1780 except IOError:
1724 filename = make_filename(args)
1781 filename = make_filename(args)
1725 if filename is None:
1782 if filename is None:
1726 warn('The file `%s` where `%s` was defined cannot '
1783 warn('The file `%s` where `%s` was defined cannot '
1727 'be read.' % (filename,data))
1784 'be read.' % (filename,data))
1728 return
1785 return
1729 use_temp = 0
1786 use_temp = 0
1730 else:
1787 else:
1731 data = ''
1788 data = ''
1732
1789
1733 if use_temp:
1790 if use_temp:
1734 filename = tempfile.mktemp('.py')
1791 filename = tempfile.mktemp('.py')
1735 self.shell.tempfiles.append(filename)
1792 self.shell.tempfiles.append(filename)
1736
1793
1737 if data and use_temp:
1794 if data and use_temp:
1738 tmp_file = open(filename,'w')
1795 tmp_file = open(filename,'w')
1739 tmp_file.write(data)
1796 tmp_file.write(data)
1740 tmp_file.close()
1797 tmp_file.close()
1741
1798
1742 # do actual editing here
1799 # do actual editing here
1743 print 'Editing...',
1800 print 'Editing...',
1744 sys.stdout.flush()
1801 sys.stdout.flush()
1745 self.shell.hooks.editor(filename,lineno)
1802 self.shell.hooks.editor(filename,lineno)
1746 if opts.has_key('x'): # -x prevents actual execution
1803 if opts.has_key('x'): # -x prevents actual execution
1747 print
1804 print
1748 else:
1805 else:
1749 print 'done. Executing edited code...'
1806 print 'done. Executing edited code...'
1750 try:
1807 try:
1751 execfile(filename,self.shell.user_ns)
1808 execfile(filename,self.shell.user_ns)
1752 except IOError,msg:
1809 except IOError,msg:
1753 if msg.filename == filename:
1810 if msg.filename == filename:
1754 warn('File not found. Did you forget to save?')
1811 warn('File not found. Did you forget to save?')
1755 return
1812 return
1756 else:
1813 else:
1757 self.shell.showtraceback()
1814 self.shell.showtraceback()
1758 except:
1815 except:
1759 self.shell.showtraceback()
1816 self.shell.showtraceback()
1760 if use_temp:
1817 if use_temp:
1761 contents = open(filename).read()
1818 contents = open(filename).read()
1762 return contents
1819 return contents
1763
1820
1764 def magic_xmode(self,parameter_s = ''):
1821 def magic_xmode(self,parameter_s = ''):
1765 """Switch modes for the exception handlers.
1822 """Switch modes for the exception handlers.
1766
1823
1767 Valid modes: Plain, Context and Verbose.
1824 Valid modes: Plain, Context and Verbose.
1768
1825
1769 If called without arguments, acts as a toggle."""
1826 If called without arguments, acts as a toggle."""
1770
1827
1771 new_mode = parameter_s.strip().capitalize()
1828 new_mode = parameter_s.strip().capitalize()
1772 try:
1829 try:
1773 self.InteractiveTB.set_mode(mode = new_mode)
1830 self.InteractiveTB.set_mode(mode = new_mode)
1774 print 'Exception reporting mode:',self.InteractiveTB.mode
1831 print 'Exception reporting mode:',self.InteractiveTB.mode
1775 except:
1832 except:
1776 warn('Error changing exception modes.\n' + str(sys.exc_info()[1]))
1833 warn('Error changing exception modes.\n' + str(sys.exc_info()[1]))
1777
1834
1778 def magic_colors(self,parameter_s = ''):
1835 def magic_colors(self,parameter_s = ''):
1779 """Switch color scheme for prompts, info system and exception handlers.
1836 """Switch color scheme for prompts, info system and exception handlers.
1780
1837
1781 Currently implemented schemes: NoColor, Linux, LightBG.
1838 Currently implemented schemes: NoColor, Linux, LightBG.
1782
1839
1783 Color scheme names are not case-sensitive."""
1840 Color scheme names are not case-sensitive."""
1784
1841
1785 new_scheme = parameter_s.strip()
1842 new_scheme = parameter_s.strip()
1786 if not new_scheme:
1843 if not new_scheme:
1787 print 'You must specify a color scheme.'
1844 print 'You must specify a color scheme.'
1788 return
1845 return
1789 # Under Windows, check for Gary Bishop's readline, which is necessary
1846 # Under Windows, check for Gary Bishop's readline, which is necessary
1790 # for ANSI coloring
1847 # for ANSI coloring
1791 if os.name in ['nt','dos']:
1848 if os.name in ['nt','dos']:
1792 try:
1849 try:
1793 import readline
1850 import readline
1794 except ImportError:
1851 except ImportError:
1795 has_readline = 0
1852 has_readline = 0
1796 else:
1853 else:
1797 try:
1854 try:
1798 readline.GetOutputFile()
1855 readline.GetOutputFile()
1799 except AttributeError:
1856 except AttributeError:
1800 has_readline = 0
1857 has_readline = 0
1801 else:
1858 else:
1802 has_readline = 1
1859 has_readline = 1
1803 if not has_readline:
1860 if not has_readline:
1804 msg = """\
1861 msg = """\
1805 Proper color support under MS Windows requires Gary Bishop's readline library.
1862 Proper color support under MS Windows requires Gary Bishop's readline library.
1806 You can find it at:
1863 You can find it at:
1807 http://sourceforge.net/projects/uncpythontools
1864 http://sourceforge.net/projects/uncpythontools
1808 Gary's readline needs the ctypes module, from:
1865 Gary's readline needs the ctypes module, from:
1809 http://starship.python.net/crew/theller/ctypes
1866 http://starship.python.net/crew/theller/ctypes
1810
1867
1811 Defaulting color scheme to 'NoColor'"""
1868 Defaulting color scheme to 'NoColor'"""
1812 new_scheme = 'NoColor'
1869 new_scheme = 'NoColor'
1813 warn(msg)
1870 warn(msg)
1814
1871
1815 # Set prompt colors
1872 # Set prompt colors
1816 try:
1873 try:
1817 self.shell.outputcache.set_colors(new_scheme)
1874 self.shell.outputcache.set_colors(new_scheme)
1818 except:
1875 except:
1819 warn('Error changing prompt color schemes.\n'
1876 warn('Error changing prompt color schemes.\n'
1820 + str(sys.exc_info()[1]))
1877 + str(sys.exc_info()[1]))
1821 else:
1878 else:
1822 self.shell.rc.colors = \
1879 self.shell.rc.colors = \
1823 self.shell.outputcache.color_table.active_scheme_name
1880 self.shell.outputcache.color_table.active_scheme_name
1824 # Set exception colors
1881 # Set exception colors
1825 try:
1882 try:
1826 self.shell.InteractiveTB.set_colors(scheme = new_scheme)
1883 self.shell.InteractiveTB.set_colors(scheme = new_scheme)
1827 self.shell.SyntaxTB.set_colors(scheme = new_scheme)
1884 self.shell.SyntaxTB.set_colors(scheme = new_scheme)
1828 except:
1885 except:
1829 warn('Error changing exception color schemes.\n'
1886 warn('Error changing exception color schemes.\n'
1830 + str(sys.exc_info()[1]))
1887 + str(sys.exc_info()[1]))
1831 # Set info (for 'object?') colors
1888 # Set info (for 'object?') colors
1832 if self.shell.rc.color_info:
1889 if self.shell.rc.color_info:
1833 try:
1890 try:
1834 self.shell.inspector.set_active_scheme(new_scheme)
1891 self.shell.inspector.set_active_scheme(new_scheme)
1835 except:
1892 except:
1836 warn('Error changing object inspector color schemes.\n'
1893 warn('Error changing object inspector color schemes.\n'
1837 + str(sys.exc_info()[1]))
1894 + str(sys.exc_info()[1]))
1838 else:
1895 else:
1839 self.shell.inspector.set_active_scheme('NoColor')
1896 self.shell.inspector.set_active_scheme('NoColor')
1840
1897
1841 def magic_color_info(self,parameter_s = ''):
1898 def magic_color_info(self,parameter_s = ''):
1842 """Toggle color_info.
1899 """Toggle color_info.
1843
1900
1844 The color_info configuration parameter controls whether colors are
1901 The color_info configuration parameter controls whether colors are
1845 used for displaying object details (by things like %psource, %pfile or
1902 used for displaying object details (by things like %psource, %pfile or
1846 the '?' system). This function toggles this value with each call.
1903 the '?' system). This function toggles this value with each call.
1847
1904
1848 Note that unless you have a fairly recent pager (less works better
1905 Note that unless you have a fairly recent pager (less works better
1849 than more) in your system, using colored object information displays
1906 than more) in your system, using colored object information displays
1850 will not work properly. Test it and see."""
1907 will not work properly. Test it and see."""
1851
1908
1852 self.shell.rc.color_info = 1 - self.shell.rc.color_info
1909 self.shell.rc.color_info = 1 - self.shell.rc.color_info
1853 self.magic_colors(self.shell.rc.colors)
1910 self.magic_colors(self.shell.rc.colors)
1854 print 'Object introspection functions have now coloring:',
1911 print 'Object introspection functions have now coloring:',
1855 print ['OFF','ON'][self.shell.rc.color_info]
1912 print ['OFF','ON'][self.shell.rc.color_info]
1856
1913
1857 def magic_Pprint(self, parameter_s=''):
1914 def magic_Pprint(self, parameter_s=''):
1858 """Toggle pretty printing on/off."""
1915 """Toggle pretty printing on/off."""
1859
1916
1860 self.shell.outputcache.Pprint = 1 - self.shell.outputcache.Pprint
1917 self.shell.outputcache.Pprint = 1 - self.shell.outputcache.Pprint
1861 print 'Pretty printing has been turned', \
1918 print 'Pretty printing has been turned', \
1862 ['OFF','ON'][self.shell.outputcache.Pprint]
1919 ['OFF','ON'][self.shell.outputcache.Pprint]
1863
1920
1864 def magic_Exit(self, parameter_s=''):
1921 def magic_Exit(self, parameter_s=''):
1865 """Exit IPython without confirmation."""
1922 """Exit IPython without confirmation."""
1866
1923
1867 self.shell.exit_now = True
1924 self.shell.exit_now = True
1868
1925
1869 def magic_Quit(self, parameter_s=''):
1926 def magic_Quit(self, parameter_s=''):
1870 """Exit IPython without confirmation (like %Exit)."""
1927 """Exit IPython without confirmation (like %Exit)."""
1871
1928
1872 self.shell.exit_now = True
1929 self.shell.exit_now = True
1873
1930
1874 #......................................................................
1931 #......................................................................
1875 # Functions to implement unix shell-type things
1932 # Functions to implement unix shell-type things
1876
1933
1877 def magic_alias(self, parameter_s = ''):
1934 def magic_alias(self, parameter_s = ''):
1878 """Define an alias for a system command.
1935 """Define an alias for a system command.
1879
1936
1880 '%alias alias_name cmd' defines 'alias_name' as an alias for 'cmd'
1937 '%alias alias_name cmd' defines 'alias_name' as an alias for 'cmd'
1881
1938
1882 Then, typing 'alias_name params' will execute the system command 'cmd
1939 Then, typing 'alias_name params' will execute the system command 'cmd
1883 params' (from your underlying operating system).
1940 params' (from your underlying operating system).
1884
1941
1885 Aliases have lower precedence than magic functions and Python normal
1942 Aliases have lower precedence than magic functions and Python normal
1886 variables, so if 'foo' is both a Python variable and an alias, the
1943 variables, so if 'foo' is both a Python variable and an alias, the
1887 alias can not be executed until 'del foo' removes the Python variable.
1944 alias can not be executed until 'del foo' removes the Python variable.
1888
1945
1889 You can use the %l specifier in an alias definition to represent the
1946 You can use the %l specifier in an alias definition to represent the
1890 whole line when the alias is called. For example:
1947 whole line when the alias is called. For example:
1891
1948
1892 In [2]: alias all echo "Input in brackets: <%l>"\\
1949 In [2]: alias all echo "Input in brackets: <%l>"\\
1893 In [3]: all hello world\\
1950 In [3]: all hello world\\
1894 Input in brackets: <hello world>
1951 Input in brackets: <hello world>
1895
1952
1896 You can also define aliases with parameters using %s specifiers (one
1953 You can also define aliases with parameters using %s specifiers (one
1897 per parameter):
1954 per parameter):
1898
1955
1899 In [1]: alias parts echo first %s second %s\\
1956 In [1]: alias parts echo first %s second %s\\
1900 In [2]: %parts A B\\
1957 In [2]: %parts A B\\
1901 first A second B\\
1958 first A second B\\
1902 In [3]: %parts A\\
1959 In [3]: %parts A\\
1903 Incorrect number of arguments: 2 expected.\\
1960 Incorrect number of arguments: 2 expected.\\
1904 parts is an alias to: 'echo first %s second %s'
1961 parts is an alias to: 'echo first %s second %s'
1905
1962
1906 Note that %l and %s are mutually exclusive. You can only use one or
1963 Note that %l and %s are mutually exclusive. You can only use one or
1907 the other in your aliases.
1964 the other in your aliases.
1908
1965
1909 Aliases expand Python variables just like system calls using ! or !!
1966 Aliases expand Python variables just like system calls using ! or !!
1910 do: all expressions prefixed with '$' get expanded. For details of
1967 do: all expressions prefixed with '$' get expanded. For details of
1911 the semantic rules, see PEP-215:
1968 the semantic rules, see PEP-215:
1912 http://www.python.org/peps/pep-0215.html. This is the library used by
1969 http://www.python.org/peps/pep-0215.html. This is the library used by
1913 IPython for variable expansion. If you want to access a true shell
1970 IPython for variable expansion. If you want to access a true shell
1914 variable, an extra $ is necessary to prevent its expansion by IPython:
1971 variable, an extra $ is necessary to prevent its expansion by IPython:
1915
1972
1916 In [6]: alias show echo\\
1973 In [6]: alias show echo\\
1917 In [7]: PATH='A Python string'\\
1974 In [7]: PATH='A Python string'\\
1918 In [8]: show $PATH\\
1975 In [8]: show $PATH\\
1919 A Python string\\
1976 A Python string\\
1920 In [9]: show $$PATH\\
1977 In [9]: show $$PATH\\
1921 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
1978 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
1922
1979
1923 You can use the alias facility to acess all of $PATH. See the %rehash
1980 You can use the alias facility to acess all of $PATH. See the %rehash
1924 and %rehashx functions, which automatically create aliases for the
1981 and %rehashx functions, which automatically create aliases for the
1925 contents of your $PATH.
1982 contents of your $PATH.
1926
1983
1927 If called with no parameters, %alias prints the current alias table."""
1984 If called with no parameters, %alias prints the current alias table."""
1928
1985
1929 par = parameter_s.strip()
1986 par = parameter_s.strip()
1930 if not par:
1987 if not par:
1931 if self.shell.rc.automagic:
1988 if self.shell.rc.automagic:
1932 prechar = ''
1989 prechar = ''
1933 else:
1990 else:
1934 prechar = self.shell.ESC_MAGIC
1991 prechar = self.shell.ESC_MAGIC
1935 print 'Alias\t\tSystem Command\n'+'-'*30
1992 print 'Alias\t\tSystem Command\n'+'-'*30
1936 atab = self.shell.alias_table
1993 atab = self.shell.alias_table
1937 aliases = atab.keys()
1994 aliases = atab.keys()
1938 aliases.sort()
1995 aliases.sort()
1939 for alias in aliases:
1996 for alias in aliases:
1940 print prechar+alias+'\t\t'+atab[alias][1]
1997 print prechar+alias+'\t\t'+atab[alias][1]
1941 print '-'*30+'\nTotal number of aliases:',len(aliases)
1998 print '-'*30+'\nTotal number of aliases:',len(aliases)
1942 return
1999 return
1943 try:
2000 try:
1944 alias,cmd = par.split(None,1)
2001 alias,cmd = par.split(None,1)
1945 except:
2002 except:
1946 print OInspect.getdoc(self.magic_alias)
2003 print OInspect.getdoc(self.magic_alias)
1947 else:
2004 else:
1948 nargs = cmd.count('%s')
2005 nargs = cmd.count('%s')
1949 if nargs>0 and cmd.find('%l')>=0:
2006 if nargs>0 and cmd.find('%l')>=0:
1950 error('The %s and %l specifiers are mutually exclusive '
2007 error('The %s and %l specifiers are mutually exclusive '
1951 'in alias definitions.')
2008 'in alias definitions.')
1952 else: # all looks OK
2009 else: # all looks OK
1953 self.shell.alias_table[alias] = (nargs,cmd)
2010 self.shell.alias_table[alias] = (nargs,cmd)
1954 self.shell.alias_table_validate(verbose=1)
2011 self.shell.alias_table_validate(verbose=1)
1955 # end magic_alias
2012 # end magic_alias
1956
2013
1957 def magic_unalias(self, parameter_s = ''):
2014 def magic_unalias(self, parameter_s = ''):
1958 """Remove an alias"""
2015 """Remove an alias"""
1959
2016
1960 aname = parameter_s.strip()
2017 aname = parameter_s.strip()
1961 if aname in self.shell.alias_table:
2018 if aname in self.shell.alias_table:
1962 del self.shell.alias_table[aname]
2019 del self.shell.alias_table[aname]
1963
2020
1964 def magic_rehash(self, parameter_s = ''):
2021 def magic_rehash(self, parameter_s = ''):
1965 """Update the alias table with all entries in $PATH.
2022 """Update the alias table with all entries in $PATH.
1966
2023
1967 This version does no checks on execute permissions or whether the
2024 This version does no checks on execute permissions or whether the
1968 contents of $PATH are truly files (instead of directories or something
2025 contents of $PATH are truly files (instead of directories or something
1969 else). For such a safer (but slower) version, use %rehashx."""
2026 else). For such a safer (but slower) version, use %rehashx."""
1970
2027
1971 # This function (and rehashx) manipulate the alias_table directly
2028 # This function (and rehashx) manipulate the alias_table directly
1972 # rather than calling magic_alias, for speed reasons. A rehash on a
2029 # rather than calling magic_alias, for speed reasons. A rehash on a
1973 # typical Linux box involves several thousand entries, so efficiency
2030 # typical Linux box involves several thousand entries, so efficiency
1974 # here is a top concern.
2031 # here is a top concern.
1975
2032
1976 path = filter(os.path.isdir,os.environ['PATH'].split(os.pathsep))
2033 path = filter(os.path.isdir,os.environ['PATH'].split(os.pathsep))
1977 alias_table = self.shell.alias_table
2034 alias_table = self.shell.alias_table
1978 for pdir in path:
2035 for pdir in path:
1979 for ff in os.listdir(pdir):
2036 for ff in os.listdir(pdir):
1980 # each entry in the alias table must be (N,name), where
2037 # each entry in the alias table must be (N,name), where
1981 # N is the number of positional arguments of the alias.
2038 # N is the number of positional arguments of the alias.
1982 alias_table[ff] = (0,ff)
2039 alias_table[ff] = (0,ff)
1983 # Make sure the alias table doesn't contain keywords or builtins
2040 # Make sure the alias table doesn't contain keywords or builtins
1984 self.shell.alias_table_validate()
2041 self.shell.alias_table_validate()
1985 # Call again init_auto_alias() so we get 'rm -i' and other modified
2042 # Call again init_auto_alias() so we get 'rm -i' and other modified
1986 # aliases since %rehash will probably clobber them
2043 # aliases since %rehash will probably clobber them
1987 self.shell.init_auto_alias()
2044 self.shell.init_auto_alias()
1988
2045
1989 def magic_rehashx(self, parameter_s = ''):
2046 def magic_rehashx(self, parameter_s = ''):
1990 """Update the alias table with all executable files in $PATH.
2047 """Update the alias table with all executable files in $PATH.
1991
2048
1992 This version explicitly checks that every entry in $PATH is a file
2049 This version explicitly checks that every entry in $PATH is a file
1993 with execute access (os.X_OK), so it is much slower than %rehash.
2050 with execute access (os.X_OK), so it is much slower than %rehash.
1994
2051
1995 Under Windows, it checks executability as a match agains a
2052 Under Windows, it checks executability as a match agains a
1996 '|'-separated string of extensions, stored in the IPython config
2053 '|'-separated string of extensions, stored in the IPython config
1997 variable win_exec_ext. This defaults to 'exe|com|bat'. """
2054 variable win_exec_ext. This defaults to 'exe|com|bat'. """
1998
2055
1999 path = filter(os.path.isdir,os.environ['PATH'].split(os.pathsep))
2056 path = filter(os.path.isdir,os.environ['PATH'].split(os.pathsep))
2000 alias_table = self.shell.alias_table
2057 alias_table = self.shell.alias_table
2001
2058
2002 if os.name == 'posix':
2059 if os.name == 'posix':
2003 isexec = lambda fname:os.path.isfile(fname) and \
2060 isexec = lambda fname:os.path.isfile(fname) and \
2004 os.access(fname,os.X_OK)
2061 os.access(fname,os.X_OK)
2005 else:
2062 else:
2006
2063
2007 try:
2064 try:
2008 winext = os.environ['pathext'].replace(';','|').replace('.','')
2065 winext = os.environ['pathext'].replace(';','|').replace('.','')
2009 except KeyError:
2066 except KeyError:
2010 winext = 'exe|com|bat'
2067 winext = 'exe|com|bat'
2011
2068
2012 execre = re.compile(r'(.*)\.(%s)$' % winext,re.IGNORECASE)
2069 execre = re.compile(r'(.*)\.(%s)$' % winext,re.IGNORECASE)
2013 isexec = lambda fname:os.path.isfile(fname) and execre.match(fname)
2070 isexec = lambda fname:os.path.isfile(fname) and execre.match(fname)
2014 savedir = os.getcwd()
2071 savedir = os.getcwd()
2015 try:
2072 try:
2016 # write the whole loop for posix/Windows so we don't have an if in
2073 # write the whole loop for posix/Windows so we don't have an if in
2017 # the innermost part
2074 # the innermost part
2018 if os.name == 'posix':
2075 if os.name == 'posix':
2019 for pdir in path:
2076 for pdir in path:
2020 os.chdir(pdir)
2077 os.chdir(pdir)
2021 for ff in os.listdir(pdir):
2078 for ff in os.listdir(pdir):
2022 if isexec(ff):
2079 if isexec(ff):
2023 # each entry in the alias table must be (N,name),
2080 # each entry in the alias table must be (N,name),
2024 # where N is the number of positional arguments of the
2081 # where N is the number of positional arguments of the
2025 # alias.
2082 # alias.
2026 alias_table[ff] = (0,ff)
2083 alias_table[ff] = (0,ff)
2027 else:
2084 else:
2028 for pdir in path:
2085 for pdir in path:
2029 os.chdir(pdir)
2086 os.chdir(pdir)
2030 for ff in os.listdir(pdir):
2087 for ff in os.listdir(pdir):
2031 if isexec(ff):
2088 if isexec(ff):
2032 alias_table[execre.sub(r'\1',ff)] = (0,ff)
2089 alias_table[execre.sub(r'\1',ff)] = (0,ff)
2033 # Make sure the alias table doesn't contain keywords or builtins
2090 # Make sure the alias table doesn't contain keywords or builtins
2034 self.shell.alias_table_validate()
2091 self.shell.alias_table_validate()
2035 # Call again init_auto_alias() so we get 'rm -i' and other
2092 # Call again init_auto_alias() so we get 'rm -i' and other
2036 # modified aliases since %rehashx will probably clobber them
2093 # modified aliases since %rehashx will probably clobber them
2037 self.shell.init_auto_alias()
2094 self.shell.init_auto_alias()
2038 finally:
2095 finally:
2039 os.chdir(savedir)
2096 os.chdir(savedir)
2040
2097
2041 def magic_pwd(self, parameter_s = ''):
2098 def magic_pwd(self, parameter_s = ''):
2042 """Return the current working directory path."""
2099 """Return the current working directory path."""
2043 return os.getcwd()
2100 return os.getcwd()
2044
2101
2045 def magic_cd(self, parameter_s=''):
2102 def magic_cd(self, parameter_s=''):
2046 """Change the current working directory.
2103 """Change the current working directory.
2047
2104
2048 This command automatically maintains an internal list of directories
2105 This command automatically maintains an internal list of directories
2049 you visit during your IPython session, in the variable _dh. The
2106 you visit during your IPython session, in the variable _dh. The
2050 command %dhist shows this history nicely formatted.
2107 command %dhist shows this history nicely formatted.
2051
2108
2052 Usage:
2109 Usage:
2053
2110
2054 cd 'dir': changes to directory 'dir'.
2111 cd 'dir': changes to directory 'dir'.
2055
2112
2056 cd -: changes to the last visited directory.
2113 cd -: changes to the last visited directory.
2057
2114
2058 cd -<n>: changes to the n-th directory in the directory history.
2115 cd -<n>: changes to the n-th directory in the directory history.
2059
2116
2060 cd -b <bookmark_name>: jump to a bookmark set by %bookmark
2117 cd -b <bookmark_name>: jump to a bookmark set by %bookmark
2061 (note: cd <bookmark_name> is enough if there is no
2118 (note: cd <bookmark_name> is enough if there is no
2062 directory <bookmark_name>, but a bookmark with the name exists.)
2119 directory <bookmark_name>, but a bookmark with the name exists.)
2063
2120
2064 Options:
2121 Options:
2065
2122
2066 -q: quiet. Do not print the working directory after the cd command is
2123 -q: quiet. Do not print the working directory after the cd command is
2067 executed. By default IPython's cd command does print this directory,
2124 executed. By default IPython's cd command does print this directory,
2068 since the default prompts do not display path information.
2125 since the default prompts do not display path information.
2069
2126
2070 Note that !cd doesn't work for this purpose because the shell where
2127 Note that !cd doesn't work for this purpose because the shell where
2071 !command runs is immediately discarded after executing 'command'."""
2128 !command runs is immediately discarded after executing 'command'."""
2072
2129
2073 parameter_s = parameter_s.strip()
2130 parameter_s = parameter_s.strip()
2074 bkms = self.shell.persist.get("bookmarks",{})
2131 bkms = self.shell.persist.get("bookmarks",{})
2075
2132
2076 numcd = re.match(r'(-)(\d+)$',parameter_s)
2133 numcd = re.match(r'(-)(\d+)$',parameter_s)
2077 # jump in directory history by number
2134 # jump in directory history by number
2078 if numcd:
2135 if numcd:
2079 nn = int(numcd.group(2))
2136 nn = int(numcd.group(2))
2080 try:
2137 try:
2081 ps = self.shell.user_ns['_dh'][nn]
2138 ps = self.shell.user_ns['_dh'][nn]
2082 except IndexError:
2139 except IndexError:
2083 print 'The requested directory does not exist in history.'
2140 print 'The requested directory does not exist in history.'
2084 return
2141 return
2085 else:
2142 else:
2086 opts = {}
2143 opts = {}
2087 else:
2144 else:
2088 opts,ps = self.parse_options(parameter_s,'qb',mode='string')
2145 opts,ps = self.parse_options(parameter_s,'qb',mode='string')
2089 # jump to previous
2146 # jump to previous
2090 if ps == '-':
2147 if ps == '-':
2091 try:
2148 try:
2092 ps = self.shell.user_ns['_dh'][-2]
2149 ps = self.shell.user_ns['_dh'][-2]
2093 except IndexError:
2150 except IndexError:
2094 print 'No previous directory to change to.'
2151 print 'No previous directory to change to.'
2095 return
2152 return
2096 # jump to bookmark
2153 # jump to bookmark
2097 elif opts.has_key('b') or (bkms.has_key(ps) and not os.path.isdir(ps)):
2154 elif opts.has_key('b') or (bkms.has_key(ps) and not os.path.isdir(ps)):
2098 if bkms.has_key(ps):
2155 if bkms.has_key(ps):
2099 target = bkms[ps]
2156 target = bkms[ps]
2100 print '(bookmark:%s) -> %s' % (ps,target)
2157 print '(bookmark:%s) -> %s' % (ps,target)
2101 ps = target
2158 ps = target
2102 else:
2159 else:
2103 if bkms:
2160 if bkms:
2104 error("Bookmark '%s' not found. "
2161 error("Bookmark '%s' not found. "
2105 "Use '%bookmark -l' to see your bookmarks." % ps)
2162 "Use '%bookmark -l' to see your bookmarks." % ps)
2106 else:
2163 else:
2107 print "Bookmarks not set - use %bookmark <bookmarkname>"
2164 print "Bookmarks not set - use %bookmark <bookmarkname>"
2108 return
2165 return
2109
2166
2110 # at this point ps should point to the target dir
2167 # at this point ps should point to the target dir
2111 if ps:
2168 if ps:
2112 try:
2169 try:
2113 os.chdir(os.path.expanduser(ps))
2170 os.chdir(os.path.expanduser(ps))
2114 except OSError:
2171 except OSError:
2115 print sys.exc_info()[1]
2172 print sys.exc_info()[1]
2116 else:
2173 else:
2117 self.shell.user_ns['_dh'].append(os.getcwd())
2174 self.shell.user_ns['_dh'].append(os.getcwd())
2118 else:
2175 else:
2119 os.chdir(self.home_dir)
2176 os.chdir(self.home_dir)
2120 self.shell.user_ns['_dh'].append(os.getcwd())
2177 self.shell.user_ns['_dh'].append(os.getcwd())
2121 if not 'q' in opts:
2178 if not 'q' in opts:
2122 print self.shell.user_ns['_dh'][-1]
2179 print self.shell.user_ns['_dh'][-1]
2123
2180
2124 def magic_dhist(self, parameter_s=''):
2181 def magic_dhist(self, parameter_s=''):
2125 """Print your history of visited directories.
2182 """Print your history of visited directories.
2126
2183
2127 %dhist -> print full history\\
2184 %dhist -> print full history\\
2128 %dhist n -> print last n entries only\\
2185 %dhist n -> print last n entries only\\
2129 %dhist n1 n2 -> print entries between n1 and n2 (n1 not included)\\
2186 %dhist n1 n2 -> print entries between n1 and n2 (n1 not included)\\
2130
2187
2131 This history is automatically maintained by the %cd command, and
2188 This history is automatically maintained by the %cd command, and
2132 always available as the global list variable _dh. You can use %cd -<n>
2189 always available as the global list variable _dh. You can use %cd -<n>
2133 to go to directory number <n>."""
2190 to go to directory number <n>."""
2134
2191
2135 dh = self.shell.user_ns['_dh']
2192 dh = self.shell.user_ns['_dh']
2136 if parameter_s:
2193 if parameter_s:
2137 try:
2194 try:
2138 args = map(int,parameter_s.split())
2195 args = map(int,parameter_s.split())
2139 except:
2196 except:
2140 self.arg_err(Magic.magic_dhist)
2197 self.arg_err(Magic.magic_dhist)
2141 return
2198 return
2142 if len(args) == 1:
2199 if len(args) == 1:
2143 ini,fin = max(len(dh)-(args[0]),0),len(dh)
2200 ini,fin = max(len(dh)-(args[0]),0),len(dh)
2144 elif len(args) == 2:
2201 elif len(args) == 2:
2145 ini,fin = args
2202 ini,fin = args
2146 else:
2203 else:
2147 self.arg_err(Magic.magic_dhist)
2204 self.arg_err(Magic.magic_dhist)
2148 return
2205 return
2149 else:
2206 else:
2150 ini,fin = 0,len(dh)
2207 ini,fin = 0,len(dh)
2151 nlprint(dh,
2208 nlprint(dh,
2152 header = 'Directory history (kept in _dh)',
2209 header = 'Directory history (kept in _dh)',
2153 start=ini,stop=fin)
2210 start=ini,stop=fin)
2154
2211
2155 def magic_env(self, parameter_s=''):
2212 def magic_env(self, parameter_s=''):
2156 """List environment variables."""
2213 """List environment variables."""
2157
2214
2158 # environ is an instance of UserDict
2215 # environ is an instance of UserDict
2159 return os.environ.data
2216 return os.environ.data
2160
2217
2161 def magic_pushd(self, parameter_s=''):
2218 def magic_pushd(self, parameter_s=''):
2162 """Place the current dir on stack and change directory.
2219 """Place the current dir on stack and change directory.
2163
2220
2164 Usage:\\
2221 Usage:\\
2165 %pushd ['dirname']
2222 %pushd ['dirname']
2166
2223
2167 %pushd with no arguments does a %pushd to your home directory.
2224 %pushd with no arguments does a %pushd to your home directory.
2168 """
2225 """
2169 if parameter_s == '': parameter_s = '~'
2226 if parameter_s == '': parameter_s = '~'
2170 if len(self.dir_stack)>0 and os.path.expanduser(parameter_s) != \
2227 if len(self.dir_stack)>0 and os.path.expanduser(parameter_s) != \
2171 os.path.expanduser(self.dir_stack[0]):
2228 os.path.expanduser(self.dir_stack[0]):
2172 try:
2229 try:
2173 self.magic_cd(parameter_s)
2230 self.magic_cd(parameter_s)
2174 self.dir_stack.insert(0,os.getcwd().replace(self.home_dir,'~'))
2231 self.dir_stack.insert(0,os.getcwd().replace(self.home_dir,'~'))
2175 self.magic_dirs()
2232 self.magic_dirs()
2176 except:
2233 except:
2177 print 'Invalid directory'
2234 print 'Invalid directory'
2178 else:
2235 else:
2179 print 'You are already there!'
2236 print 'You are already there!'
2180
2237
2181 def magic_popd(self, parameter_s=''):
2238 def magic_popd(self, parameter_s=''):
2182 """Change to directory popped off the top of the stack.
2239 """Change to directory popped off the top of the stack.
2183 """
2240 """
2184 if len (self.dir_stack) > 1:
2241 if len (self.dir_stack) > 1:
2185 self.dir_stack.pop(0)
2242 self.dir_stack.pop(0)
2186 self.magic_cd(self.dir_stack[0])
2243 self.magic_cd(self.dir_stack[0])
2187 print self.dir_stack[0]
2244 print self.dir_stack[0]
2188 else:
2245 else:
2189 print "You can't remove the starting directory from the stack:",\
2246 print "You can't remove the starting directory from the stack:",\
2190 self.dir_stack
2247 self.dir_stack
2191
2248
2192 def magic_dirs(self, parameter_s=''):
2249 def magic_dirs(self, parameter_s=''):
2193 """Return the current directory stack."""
2250 """Return the current directory stack."""
2194
2251
2195 return self.dir_stack[:]
2252 return self.dir_stack[:]
2196
2253
2197 def magic_sc(self, parameter_s=''):
2254 def magic_sc(self, parameter_s=''):
2198 """Shell capture - execute a shell command and capture its output.
2255 """Shell capture - execute a shell command and capture its output.
2199
2256
2200 %sc [options] varname=command
2257 %sc [options] varname=command
2201
2258
2202 IPython will run the given command using commands.getoutput(), and
2259 IPython will run the given command using commands.getoutput(), and
2203 will then update the user's interactive namespace with a variable
2260 will then update the user's interactive namespace with a variable
2204 called varname, containing the value of the call. Your command can
2261 called varname, containing the value of the call. Your command can
2205 contain shell wildcards, pipes, etc.
2262 contain shell wildcards, pipes, etc.
2206
2263
2207 The '=' sign in the syntax is mandatory, and the variable name you
2264 The '=' sign in the syntax is mandatory, and the variable name you
2208 supply must follow Python's standard conventions for valid names.
2265 supply must follow Python's standard conventions for valid names.
2209
2266
2210 Options:
2267 Options:
2211
2268
2212 -l: list output. Split the output on newlines into a list before
2269 -l: list output. Split the output on newlines into a list before
2213 assigning it to the given variable. By default the output is stored
2270 assigning it to the given variable. By default the output is stored
2214 as a single string.
2271 as a single string.
2215
2272
2216 -v: verbose. Print the contents of the variable.
2273 -v: verbose. Print the contents of the variable.
2217
2274
2218 In most cases you should not need to split as a list, because the
2275 In most cases you should not need to split as a list, because the
2219 returned value is a special type of string which can automatically
2276 returned value is a special type of string which can automatically
2220 provide its contents either as a list (split on newlines) or as a
2277 provide its contents either as a list (split on newlines) or as a
2221 space-separated string. These are convenient, respectively, either
2278 space-separated string. These are convenient, respectively, either
2222 for sequential processing or to be passed to a shell command.
2279 for sequential processing or to be passed to a shell command.
2223
2280
2224 For example:
2281 For example:
2225
2282
2226 # Capture into variable a
2283 # Capture into variable a
2227 In [9]: sc a=ls *py
2284 In [9]: sc a=ls *py
2228
2285
2229 # a is a string with embedded newlines
2286 # a is a string with embedded newlines
2230 In [10]: a
2287 In [10]: a
2231 Out[10]: 'setup.py\nwin32_manual_post_install.py'
2288 Out[10]: 'setup.py\nwin32_manual_post_install.py'
2232
2289
2233 # which can be seen as a list:
2290 # which can be seen as a list:
2234 In [11]: a.l
2291 In [11]: a.l
2235 Out[11]: ['setup.py', 'win32_manual_post_install.py']
2292 Out[11]: ['setup.py', 'win32_manual_post_install.py']
2236
2293
2237 # or as a whitespace-separated string:
2294 # or as a whitespace-separated string:
2238 In [12]: a.s
2295 In [12]: a.s
2239 Out[12]: 'setup.py win32_manual_post_install.py'
2296 Out[12]: 'setup.py win32_manual_post_install.py'
2240
2297
2241 # a.s is useful to pass as a single command line:
2298 # a.s is useful to pass as a single command line:
2242 In [13]: !wc -l $a.s
2299 In [13]: !wc -l $a.s
2243 146 setup.py
2300 146 setup.py
2244 130 win32_manual_post_install.py
2301 130 win32_manual_post_install.py
2245 276 total
2302 276 total
2246
2303
2247 # while the list form is useful to loop over:
2304 # while the list form is useful to loop over:
2248 In [14]: for f in a.l:
2305 In [14]: for f in a.l:
2249 ....: !wc -l $f
2306 ....: !wc -l $f
2250 ....:
2307 ....:
2251 146 setup.py
2308 146 setup.py
2252 130 win32_manual_post_install.py
2309 130 win32_manual_post_install.py
2253
2310
2254 Similiarly, the lists returned by the -l option are also special, in
2311 Similiarly, the lists returned by the -l option are also special, in
2255 the sense that you can equally invoke the .s attribute on them to
2312 the sense that you can equally invoke the .s attribute on them to
2256 automatically get a whitespace-separated string from their contents:
2313 automatically get a whitespace-separated string from their contents:
2257
2314
2258 In [1]: sc -l b=ls *py
2315 In [1]: sc -l b=ls *py
2259
2316
2260 In [2]: b
2317 In [2]: b
2261 Out[2]: ['setup.py', 'win32_manual_post_install.py']
2318 Out[2]: ['setup.py', 'win32_manual_post_install.py']
2262
2319
2263 In [3]: b.s
2320 In [3]: b.s
2264 Out[3]: 'setup.py win32_manual_post_install.py'
2321 Out[3]: 'setup.py win32_manual_post_install.py'
2265
2322
2266 In summary, both the lists and strings used for ouptut capture have
2323 In summary, both the lists and strings used for ouptut capture have
2267 the following special attributes:
2324 the following special attributes:
2268
2325
2269 .l (or .list) : value as list.
2326 .l (or .list) : value as list.
2270 .n (or .nlstr): value as newline-separated string.
2327 .n (or .nlstr): value as newline-separated string.
2271 .s (or .spstr): value as space-separated string.
2328 .s (or .spstr): value as space-separated string.
2272 """
2329 """
2273
2330
2274 opts,args = self.parse_options(parameter_s,'lv')
2331 opts,args = self.parse_options(parameter_s,'lv')
2275 # Try to get a variable name and command to run
2332 # Try to get a variable name and command to run
2276 try:
2333 try:
2277 # the variable name must be obtained from the parse_options
2334 # the variable name must be obtained from the parse_options
2278 # output, which uses shlex.split to strip options out.
2335 # output, which uses shlex.split to strip options out.
2279 var,_ = args.split('=',1)
2336 var,_ = args.split('=',1)
2280 var = var.strip()
2337 var = var.strip()
2281 # But the the command has to be extracted from the original input
2338 # But the the command has to be extracted from the original input
2282 # parameter_s, not on what parse_options returns, to avoid the
2339 # parameter_s, not on what parse_options returns, to avoid the
2283 # quote stripping which shlex.split performs on it.
2340 # quote stripping which shlex.split performs on it.
2284 _,cmd = parameter_s.split('=',1)
2341 _,cmd = parameter_s.split('=',1)
2285 except ValueError:
2342 except ValueError:
2286 var,cmd = '',''
2343 var,cmd = '',''
2287 if not var:
2344 if not var:
2288 error('you must specify a variable to assign the command to.')
2345 error('you must specify a variable to assign the command to.')
2289 return
2346 return
2290 # If all looks ok, proceed
2347 # If all looks ok, proceed
2291 out,err = self.shell.getoutputerror(cmd)
2348 out,err = self.shell.getoutputerror(cmd)
2292 if err:
2349 if err:
2293 print >> Term.cerr,err
2350 print >> Term.cerr,err
2294 if opts.has_key('l'):
2351 if opts.has_key('l'):
2295 out = SList(out.split('\n'))
2352 out = SList(out.split('\n'))
2296 else:
2353 else:
2297 out = LSString(out)
2354 out = LSString(out)
2298 if opts.has_key('v'):
2355 if opts.has_key('v'):
2299 print '%s ==\n%s' % (var,pformat(out))
2356 print '%s ==\n%s' % (var,pformat(out))
2300 self.shell.user_ns.update({var:out})
2357 self.shell.user_ns.update({var:out})
2301
2358
2302 def magic_sx(self, parameter_s=''):
2359 def magic_sx(self, parameter_s=''):
2303 """Shell execute - run a shell command and capture its output.
2360 """Shell execute - run a shell command and capture its output.
2304
2361
2305 %sx command
2362 %sx command
2306
2363
2307 IPython will run the given command using commands.getoutput(), and
2364 IPython will run the given command using commands.getoutput(), and
2308 return the result formatted as a list (split on '\\n'). Since the
2365 return the result formatted as a list (split on '\\n'). Since the
2309 output is _returned_, it will be stored in ipython's regular output
2366 output is _returned_, it will be stored in ipython's regular output
2310 cache Out[N] and in the '_N' automatic variables.
2367 cache Out[N] and in the '_N' automatic variables.
2311
2368
2312 Notes:
2369 Notes:
2313
2370
2314 1) If an input line begins with '!!', then %sx is automatically
2371 1) If an input line begins with '!!', then %sx is automatically
2315 invoked. That is, while:
2372 invoked. That is, while:
2316 !ls
2373 !ls
2317 causes ipython to simply issue system('ls'), typing
2374 causes ipython to simply issue system('ls'), typing
2318 !!ls
2375 !!ls
2319 is a shorthand equivalent to:
2376 is a shorthand equivalent to:
2320 %sx ls
2377 %sx ls
2321
2378
2322 2) %sx differs from %sc in that %sx automatically splits into a list,
2379 2) %sx differs from %sc in that %sx automatically splits into a list,
2323 like '%sc -l'. The reason for this is to make it as easy as possible
2380 like '%sc -l'. The reason for this is to make it as easy as possible
2324 to process line-oriented shell output via further python commands.
2381 to process line-oriented shell output via further python commands.
2325 %sc is meant to provide much finer control, but requires more
2382 %sc is meant to provide much finer control, but requires more
2326 typing.
2383 typing.
2327
2384
2328 3) Just like %sc -l, this is a list with special attributes:
2385 3) Just like %sc -l, this is a list with special attributes:
2329
2386
2330 .l (or .list) : value as list.
2387 .l (or .list) : value as list.
2331 .n (or .nlstr): value as newline-separated string.
2388 .n (or .nlstr): value as newline-separated string.
2332 .s (or .spstr): value as whitespace-separated string.
2389 .s (or .spstr): value as whitespace-separated string.
2333
2390
2334 This is very useful when trying to use such lists as arguments to
2391 This is very useful when trying to use such lists as arguments to
2335 system commands."""
2392 system commands."""
2336
2393
2337 if parameter_s:
2394 if parameter_s:
2338 out,err = self.shell.getoutputerror(parameter_s)
2395 out,err = self.shell.getoutputerror(parameter_s)
2339 if err:
2396 if err:
2340 print >> Term.cerr,err
2397 print >> Term.cerr,err
2341 return SList(out.split('\n'))
2398 return SList(out.split('\n'))
2342
2399
2343 def magic_bg(self, parameter_s=''):
2400 def magic_bg(self, parameter_s=''):
2344 """Run a job in the background, in a separate thread.
2401 """Run a job in the background, in a separate thread.
2345
2402
2346 For example,
2403 For example,
2347
2404
2348 %bg myfunc(x,y,z=1)
2405 %bg myfunc(x,y,z=1)
2349
2406
2350 will execute 'myfunc(x,y,z=1)' in a background thread. As soon as the
2407 will execute 'myfunc(x,y,z=1)' in a background thread. As soon as the
2351 execution starts, a message will be printed indicating the job
2408 execution starts, a message will be printed indicating the job
2352 number. If your job number is 5, you can use
2409 number. If your job number is 5, you can use
2353
2410
2354 myvar = jobs.result(5) or myvar = jobs[5].result
2411 myvar = jobs.result(5) or myvar = jobs[5].result
2355
2412
2356 to assign this result to variable 'myvar'.
2413 to assign this result to variable 'myvar'.
2357
2414
2358 IPython has a job manager, accessible via the 'jobs' object. You can
2415 IPython has a job manager, accessible via the 'jobs' object. You can
2359 type jobs? to get more information about it, and use jobs.<TAB> to see
2416 type jobs? to get more information about it, and use jobs.<TAB> to see
2360 its attributes. All attributes not starting with an underscore are
2417 its attributes. All attributes not starting with an underscore are
2361 meant for public use.
2418 meant for public use.
2362
2419
2363 In particular, look at the jobs.new() method, which is used to create
2420 In particular, look at the jobs.new() method, which is used to create
2364 new jobs. This magic %bg function is just a convenience wrapper
2421 new jobs. This magic %bg function is just a convenience wrapper
2365 around jobs.new(), for expression-based jobs. If you want to create a
2422 around jobs.new(), for expression-based jobs. If you want to create a
2366 new job with an explicit function object and arguments, you must call
2423 new job with an explicit function object and arguments, you must call
2367 jobs.new() directly.
2424 jobs.new() directly.
2368
2425
2369 The jobs.new docstring also describes in detail several important
2426 The jobs.new docstring also describes in detail several important
2370 caveats associated with a thread-based model for background job
2427 caveats associated with a thread-based model for background job
2371 execution. Type jobs.new? for details.
2428 execution. Type jobs.new? for details.
2372
2429
2373 You can check the status of all jobs with jobs.status().
2430 You can check the status of all jobs with jobs.status().
2374
2431
2375 The jobs variable is set by IPython into the Python builtin namespace.
2432 The jobs variable is set by IPython into the Python builtin namespace.
2376 If you ever declare a variable named 'jobs', you will shadow this
2433 If you ever declare a variable named 'jobs', you will shadow this
2377 name. You can either delete your global jobs variable to regain
2434 name. You can either delete your global jobs variable to regain
2378 access to the job manager, or make a new name and assign it manually
2435 access to the job manager, or make a new name and assign it manually
2379 to the manager (stored in IPython's namespace). For example, to
2436 to the manager (stored in IPython's namespace). For example, to
2380 assign the job manager to the Jobs name, use:
2437 assign the job manager to the Jobs name, use:
2381
2438
2382 Jobs = __builtins__.jobs"""
2439 Jobs = __builtins__.jobs"""
2383
2440
2384 self.shell.jobs.new(parameter_s,self.shell.user_ns)
2441 self.shell.jobs.new(parameter_s,self.shell.user_ns)
2385
2442
2386 def magic_bookmark(self, parameter_s=''):
2443 def magic_bookmark(self, parameter_s=''):
2387 """Manage IPython's bookmark system.
2444 """Manage IPython's bookmark system.
2388
2445
2389 %bookmark <name> - set bookmark to current dir
2446 %bookmark <name> - set bookmark to current dir
2390 %bookmark <name> <dir> - set bookmark to <dir>
2447 %bookmark <name> <dir> - set bookmark to <dir>
2391 %bookmark -l - list all bookmarks
2448 %bookmark -l - list all bookmarks
2392 %bookmark -d <name> - remove bookmark
2449 %bookmark -d <name> - remove bookmark
2393 %bookmark -r - remove all bookmarks
2450 %bookmark -r - remove all bookmarks
2394
2451
2395 You can later on access a bookmarked folder with:
2452 You can later on access a bookmarked folder with:
2396 %cd -b <name>
2453 %cd -b <name>
2397 or simply '%cd <name>' if there is no directory called <name> AND
2454 or simply '%cd <name>' if there is no directory called <name> AND
2398 there is such a bookmark defined.
2455 there is such a bookmark defined.
2399
2456
2400 Your bookmarks persist through IPython sessions, but they are
2457 Your bookmarks persist through IPython sessions, but they are
2401 associated with each profile."""
2458 associated with each profile."""
2402
2459
2403 opts,args = self.parse_options(parameter_s,'drl',mode='list')
2460 opts,args = self.parse_options(parameter_s,'drl',mode='list')
2404 if len(args) > 2:
2461 if len(args) > 2:
2405 error('You can only give at most two arguments')
2462 error('You can only give at most two arguments')
2406 return
2463 return
2407
2464
2408 bkms = self.shell.persist.get('bookmarks',{})
2465 bkms = self.shell.persist.get('bookmarks',{})
2409
2466
2410 if opts.has_key('d'):
2467 if opts.has_key('d'):
2411 try:
2468 try:
2412 todel = args[0]
2469 todel = args[0]
2413 except IndexError:
2470 except IndexError:
2414 error('You must provide a bookmark to delete')
2471 error('You must provide a bookmark to delete')
2415 else:
2472 else:
2416 try:
2473 try:
2417 del bkms[todel]
2474 del bkms[todel]
2418 except:
2475 except:
2419 error("Can't delete bookmark '%s'" % todel)
2476 error("Can't delete bookmark '%s'" % todel)
2420 elif opts.has_key('r'):
2477 elif opts.has_key('r'):
2421 bkms = {}
2478 bkms = {}
2422 elif opts.has_key('l'):
2479 elif opts.has_key('l'):
2423 bks = bkms.keys()
2480 bks = bkms.keys()
2424 bks.sort()
2481 bks.sort()
2425 if bks:
2482 if bks:
2426 size = max(map(len,bks))
2483 size = max(map(len,bks))
2427 else:
2484 else:
2428 size = 0
2485 size = 0
2429 fmt = '%-'+str(size)+'s -> %s'
2486 fmt = '%-'+str(size)+'s -> %s'
2430 print 'Current bookmarks:'
2487 print 'Current bookmarks:'
2431 for bk in bks:
2488 for bk in bks:
2432 print fmt % (bk,bkms[bk])
2489 print fmt % (bk,bkms[bk])
2433 else:
2490 else:
2434 if not args:
2491 if not args:
2435 error("You must specify the bookmark name")
2492 error("You must specify the bookmark name")
2436 elif len(args)==1:
2493 elif len(args)==1:
2437 bkms[args[0]] = os.getcwd()
2494 bkms[args[0]] = os.getcwd()
2438 elif len(args)==2:
2495 elif len(args)==2:
2439 bkms[args[0]] = args[1]
2496 bkms[args[0]] = args[1]
2440 self.persist['bookmarks'] = bkms
2497 self.persist['bookmarks'] = bkms
2441
2498
2442 def magic_pycat(self, parameter_s=''):
2499 def magic_pycat(self, parameter_s=''):
2443 """Show a syntax-highlighted file through a pager.
2500 """Show a syntax-highlighted file through a pager.
2444
2501
2445 This magic is similar to the cat utility, but it will assume the file
2502 This magic is similar to the cat utility, but it will assume the file
2446 to be Python source and will show it with syntax highlighting. """
2503 to be Python source and will show it with syntax highlighting. """
2447
2504
2448 filename = get_py_filename(parameter_s)
2505 filename = get_py_filename(parameter_s)
2449 page(self.shell.colorize(file_read(filename)),
2506 page(self.shell.colorize(file_read(filename)),
2450 screen_lines=self.shell.rc.screen_length)
2507 screen_lines=self.shell.rc.screen_length)
2451
2508
2452 # end Magic
2509 # end Magic
@@ -1,398 +1,442 b''
1 # -*- coding: utf-8 -*-
1 # -*- coding: utf-8 -*-
2 """Tools for inspecting Python objects.
2 """Tools for inspecting Python objects.
3
3
4 Uses syntax highlighting for presenting the various information elements.
4 Uses syntax highlighting for presenting the various information elements.
5
5
6 Similar in spirit to the inspect module, but all calls take a name argument to
6 Similar in spirit to the inspect module, but all calls take a name argument to
7 reference the name under which an object is being read.
7 reference the name under which an object is being read.
8
8
9 $Id: OInspect.py 575 2005-04-08 14:16:44Z fperez $
9 $Id: OInspect.py 919 2005-10-15 07:57:05Z fperez $
10 """
10 """
11
11
12 #*****************************************************************************
12 #*****************************************************************************
13 # Copyright (C) 2001-2004 Fernando Perez <fperez@colorado.edu>
13 # Copyright (C) 2001-2004 Fernando Perez <fperez@colorado.edu>
14 #
14 #
15 # Distributed under the terms of the BSD License. The full license is in
15 # Distributed under the terms of the BSD License. The full license is in
16 # the file COPYING, distributed as part of this software.
16 # the file COPYING, distributed as part of this software.
17 #*****************************************************************************
17 #*****************************************************************************
18
18
19 from IPython import Release
19 from IPython import Release
20 __author__ = '%s <%s>' % Release.authors['Fernando']
20 __author__ = '%s <%s>' % Release.authors['Fernando']
21 __license__ = Release.license
21 __license__ = Release.license
22
22
23 __all__ = ['Inspector','InspectColors']
23 __all__ = ['Inspector','InspectColors']
24
24
25 # stdlib modules
25 # stdlib modules
26 import inspect,linecache,types,StringIO,string
26 import inspect,linecache,types,StringIO,string
27
27
28 # IPython's own
28 # IPython's own
29 from IPython import PyColorize
29 from IPython.Itpl import itpl
30 from IPython.Itpl import itpl
31 from IPython.wildcard import choose_namespaces,list_namespace
30 from IPython.genutils import page,indent,Term
32 from IPython.genutils import page,indent,Term
31 from IPython import PyColorize
32 from IPython.ColorANSI import *
33 from IPython.ColorANSI import *
33
34
34 #****************************************************************************
35 #****************************************************************************
35 # Builtin color schemes
36 # Builtin color schemes
36
37
37 Colors = TermColors # just a shorthand
38 Colors = TermColors # just a shorthand
38
39
39 # Build a few color schemes
40 # Build a few color schemes
40 NoColor = ColorScheme(
41 NoColor = ColorScheme(
41 'NoColor',{
42 'NoColor',{
42 'header' : Colors.NoColor,
43 'header' : Colors.NoColor,
43 'normal' : Colors.NoColor # color off (usu. Colors.Normal)
44 'normal' : Colors.NoColor # color off (usu. Colors.Normal)
44 } )
45 } )
45
46
46 LinuxColors = ColorScheme(
47 LinuxColors = ColorScheme(
47 'Linux',{
48 'Linux',{
48 'header' : Colors.LightRed,
49 'header' : Colors.LightRed,
49 'normal' : Colors.Normal # color off (usu. Colors.Normal)
50 'normal' : Colors.Normal # color off (usu. Colors.Normal)
50 } )
51 } )
51
52
52 LightBGColors = ColorScheme(
53 LightBGColors = ColorScheme(
53 'LightBG',{
54 'LightBG',{
54 'header' : Colors.Red,
55 'header' : Colors.Red,
55 'normal' : Colors.Normal # color off (usu. Colors.Normal)
56 'normal' : Colors.Normal # color off (usu. Colors.Normal)
56 } )
57 } )
57
58
58 # Build table of color schemes (needed by the parser)
59 # Build table of color schemes (needed by the parser)
59 InspectColors = ColorSchemeTable([NoColor,LinuxColors,LightBGColors],
60 InspectColors = ColorSchemeTable([NoColor,LinuxColors,LightBGColors],
60 'Linux')
61 'Linux')
61
62
62 #****************************************************************************
63 #****************************************************************************
63 # Auxiliary functions
64 # Auxiliary functions
64 def getdoc(obj):
65 def getdoc(obj):
65 """Stable wrapper around inspect.getdoc.
66 """Stable wrapper around inspect.getdoc.
66
67
67 This can't crash because of attribute problems.
68 This can't crash because of attribute problems.
68
69
69 It also attempts to call a getdoc() method on the given object. This
70 It also attempts to call a getdoc() method on the given object. This
70 allows objects which provide their docstrings via non-standard mechanisms
71 allows objects which provide their docstrings via non-standard mechanisms
71 (like Pyro proxies) to still be inspected by ipython's ? system."""
72 (like Pyro proxies) to still be inspected by ipython's ? system."""
72
73
73 ds = None # default return value
74 ds = None # default return value
74 try:
75 try:
75 ds = inspect.getdoc(obj)
76 ds = inspect.getdoc(obj)
76 except:
77 except:
77 # Harden against an inspect failure, which can occur with
78 # Harden against an inspect failure, which can occur with
78 # SWIG-wrapped extensions.
79 # SWIG-wrapped extensions.
79 pass
80 pass
80 # Allow objects to offer customized documentation via a getdoc method:
81 # Allow objects to offer customized documentation via a getdoc method:
81 try:
82 try:
82 ds2 = obj.getdoc()
83 ds2 = obj.getdoc()
83 except:
84 except:
84 pass
85 pass
85 else:
86 else:
86 # if we get extra info, we add it to the normal docstring.
87 # if we get extra info, we add it to the normal docstring.
87 if ds is None:
88 if ds is None:
88 ds = ds2
89 ds = ds2
89 else:
90 else:
90 ds = '%s\n%s' % (ds,ds2)
91 ds = '%s\n%s' % (ds,ds2)
91 return ds
92 return ds
92
93
93 #****************************************************************************
94 #****************************************************************************
94 # Class definitions
95 # Class definitions
95
96
96 class myStringIO(StringIO.StringIO):
97 class myStringIO(StringIO.StringIO):
97 """Adds a writeln method to normal StringIO."""
98 """Adds a writeln method to normal StringIO."""
98 def writeln(self,*arg,**kw):
99 def writeln(self,*arg,**kw):
99 """Does a write() and then a write('\n')"""
100 """Does a write() and then a write('\n')"""
100 self.write(*arg,**kw)
101 self.write(*arg,**kw)
101 self.write('\n')
102 self.write('\n')
102
103
103 class Inspector:
104 class Inspector:
104 def __init__(self,color_table,code_color_table,scheme):
105 def __init__(self,color_table,code_color_table,scheme):
105 self.color_table = color_table
106 self.color_table = color_table
106 self.parser = PyColorize.Parser(code_color_table,out='str')
107 self.parser = PyColorize.Parser(code_color_table,out='str')
107 self.format = self.parser.format
108 self.format = self.parser.format
108 self.set_active_scheme(scheme)
109 self.set_active_scheme(scheme)
109
110
110 def __getargspec(self,obj):
111 def __getargspec(self,obj):
111 """Get the names and default values of a function's arguments.
112 """Get the names and default values of a function's arguments.
112
113
113 A tuple of four things is returned: (args, varargs, varkw, defaults).
114 A tuple of four things is returned: (args, varargs, varkw, defaults).
114 'args' is a list of the argument names (it may contain nested lists).
115 'args' is a list of the argument names (it may contain nested lists).
115 'varargs' and 'varkw' are the names of the * and ** arguments or None.
116 'varargs' and 'varkw' are the names of the * and ** arguments or None.
116 'defaults' is an n-tuple of the default values of the last n arguments.
117 'defaults' is an n-tuple of the default values of the last n arguments.
117
118
118 Modified version of inspect.getargspec from the Python Standard
119 Modified version of inspect.getargspec from the Python Standard
119 Library."""
120 Library."""
120
121
121 if inspect.isfunction(obj):
122 if inspect.isfunction(obj):
122 func_obj = obj
123 func_obj = obj
123 elif inspect.ismethod(obj):
124 elif inspect.ismethod(obj):
124 func_obj = obj.im_func
125 func_obj = obj.im_func
125 else:
126 else:
126 raise TypeError, 'arg is not a Python function'
127 raise TypeError, 'arg is not a Python function'
127 args, varargs, varkw = inspect.getargs(func_obj.func_code)
128 args, varargs, varkw = inspect.getargs(func_obj.func_code)
128 return args, varargs, varkw, func_obj.func_defaults
129 return args, varargs, varkw, func_obj.func_defaults
129
130
130 def __getdef(self,obj,oname=''):
131 def __getdef(self,obj,oname=''):
131 """Return the definition header for any callable object.
132 """Return the definition header for any callable object.
132
133
133 If any exception is generated, None is returned instead and the
134 If any exception is generated, None is returned instead and the
134 exception is suppressed."""
135 exception is suppressed."""
135
136
136 try:
137 try:
137 return oname + inspect.formatargspec(*self.__getargspec(obj))
138 return oname + inspect.formatargspec(*self.__getargspec(obj))
138 except:
139 except:
139 return None
140 return None
140
141
141 def __head(self,h):
142 def __head(self,h):
142 """Return a header string with proper colors."""
143 """Return a header string with proper colors."""
143 return '%s%s%s' % (self.color_table.active_colors.header,h,
144 return '%s%s%s' % (self.color_table.active_colors.header,h,
144 self.color_table.active_colors.normal)
145 self.color_table.active_colors.normal)
145
146
146 def set_active_scheme(self,scheme):
147 def set_active_scheme(self,scheme):
147 self.color_table.set_active_scheme(scheme)
148 self.color_table.set_active_scheme(scheme)
148 self.parser.color_table.set_active_scheme(scheme)
149 self.parser.color_table.set_active_scheme(scheme)
149
150
150 def noinfo(self,msg,oname):
151 def noinfo(self,msg,oname):
151 """Generic message when no information is found."""
152 """Generic message when no information is found."""
152 print 'No %s found' % msg,
153 print 'No %s found' % msg,
153 if oname:
154 if oname:
154 print 'for %s' % oname
155 print 'for %s' % oname
155 else:
156 else:
156 print
157 print
157
158
158 def pdef(self,obj,oname=''):
159 def pdef(self,obj,oname=''):
159 """Print the definition header for any callable object.
160 """Print the definition header for any callable object.
160
161
161 If the object is a class, print the constructor information."""
162 If the object is a class, print the constructor information."""
162
163
163 if not callable(obj):
164 if not callable(obj):
164 print 'Object is not callable.'
165 print 'Object is not callable.'
165 return
166 return
166
167
167 header = ''
168 header = ''
168 if type(obj) is types.ClassType:
169 if type(obj) is types.ClassType:
169 header = self.__head('Class constructor information:\n')
170 header = self.__head('Class constructor information:\n')
170 obj = obj.__init__
171 obj = obj.__init__
171 elif type(obj) is types.InstanceType:
172 elif type(obj) is types.InstanceType:
172 obj = obj.__call__
173 obj = obj.__call__
173
174
174 output = self.__getdef(obj,oname)
175 output = self.__getdef(obj,oname)
175 if output is None:
176 if output is None:
176 self.noinfo('definition header',oname)
177 self.noinfo('definition header',oname)
177 else:
178 else:
178 print >>Term.cout, header,self.format(output),
179 print >>Term.cout, header,self.format(output),
179
180
180 def pdoc(self,obj,oname='',formatter = None):
181 def pdoc(self,obj,oname='',formatter = None):
181 """Print the docstring for any object.
182 """Print the docstring for any object.
182
183
183 Optional:
184 Optional:
184 -formatter: a function to run the docstring through for specially
185 -formatter: a function to run the docstring through for specially
185 formatted docstrings."""
186 formatted docstrings."""
186
187
187 head = self.__head # so that itpl can find it even if private
188 head = self.__head # so that itpl can find it even if private
188 ds = getdoc(obj)
189 ds = getdoc(obj)
189 if formatter:
190 if formatter:
190 ds = formatter(ds)
191 ds = formatter(ds)
191 if type(obj) is types.ClassType:
192 if type(obj) is types.ClassType:
192 init_ds = getdoc(obj.__init__)
193 init_ds = getdoc(obj.__init__)
193 output = itpl('$head("Class Docstring:")\n'
194 output = itpl('$head("Class Docstring:")\n'
194 '$indent(ds)\n'
195 '$indent(ds)\n'
195 '$head("Constructor Docstring"):\n'
196 '$head("Constructor Docstring"):\n'
196 '$indent(init_ds)')
197 '$indent(init_ds)')
197 elif type(obj) is types.InstanceType and hasattr(obj,'__call__'):
198 elif type(obj) is types.InstanceType and hasattr(obj,'__call__'):
198 call_ds = getdoc(obj.__call__)
199 call_ds = getdoc(obj.__call__)
199 if call_ds:
200 if call_ds:
200 output = itpl('$head("Class Docstring:")\n$indent(ds)\n'
201 output = itpl('$head("Class Docstring:")\n$indent(ds)\n'
201 '$head("Calling Docstring:")\n$indent(call_ds)')
202 '$head("Calling Docstring:")\n$indent(call_ds)')
202 else:
203 else:
203 output = ds
204 output = ds
204 else:
205 else:
205 output = ds
206 output = ds
206 if output is None:
207 if output is None:
207 self.noinfo('documentation',oname)
208 self.noinfo('documentation',oname)
208 return
209 return
209 page(output)
210 page(output)
210
211
211 def psource(self,obj,oname=''):
212 def psource(self,obj,oname=''):
212 """Print the source code for an object."""
213 """Print the source code for an object."""
213
214
214 # Flush the source cache because inspect can return out-of-date source
215 # Flush the source cache because inspect can return out-of-date source
215 linecache.checkcache()
216 linecache.checkcache()
216 try:
217 try:
217 src = inspect.getsource(obj)
218 src = inspect.getsource(obj)
218 except:
219 except:
219 self.noinfo('source',oname)
220 self.noinfo('source',oname)
220 else:
221 else:
221 page(self.format(src))
222 page(self.format(src))
222
223
223 def pfile(self,obj,oname=''):
224 def pfile(self,obj,oname=''):
224 """Show the whole file where an object was defined."""
225 """Show the whole file where an object was defined."""
225 try:
226 try:
226 sourcelines,lineno = inspect.getsourcelines(obj)
227 sourcelines,lineno = inspect.getsourcelines(obj)
227 except:
228 except:
228 self.noinfo('file',oname)
229 self.noinfo('file',oname)
229 else:
230 else:
230 # run contents of file through pager starting at line
231 # run contents of file through pager starting at line
231 # where the object is defined
232 # where the object is defined
232 page(self.format(open(inspect.getabsfile(obj)).read()),lineno)
233 page(self.format(open(inspect.getabsfile(obj)).read()),lineno)
233
234
234 def pinfo(self,obj,oname='',formatter=None,info=None,detail_level=0):
235 def pinfo(self,obj,oname='',formatter=None,info=None,detail_level=0):
235 """Show detailed information about an object.
236 """Show detailed information about an object.
236
237
237 Optional arguments:
238 Optional arguments:
238
239
239 - oname: name of the variable pointing to the object.
240 - oname: name of the variable pointing to the object.
240
241
241 - formatter: special formatter for docstrings (see pdoc)
242 - formatter: special formatter for docstrings (see pdoc)
242
243
243 - info: a structure with some information fields which may have been
244 - info: a structure with some information fields which may have been
244 precomputed already.
245 precomputed already.
245
246
246 - detail_level: if set to 1, more information is given.
247 - detail_level: if set to 1, more information is given.
247 """
248 """
248
249
249 obj_type = type(obj)
250 obj_type = type(obj)
250
251
251 header = self.__head
252 header = self.__head
252 if info is None:
253 if info is None:
253 ismagic = 0
254 ismagic = 0
254 isalias = 0
255 isalias = 0
255 ospace = ''
256 ospace = ''
256 else:
257 else:
257 ismagic = info.ismagic
258 ismagic = info.ismagic
258 isalias = info.isalias
259 isalias = info.isalias
259 ospace = info.namespace
260 ospace = info.namespace
260 # Get docstring, special-casing aliases:
261 # Get docstring, special-casing aliases:
261 if isalias:
262 if isalias:
262 ds = "Alias to the system command:\n %s" % obj[1]
263 ds = "Alias to the system command:\n %s" % obj[1]
263 else:
264 else:
264 ds = getdoc(obj)
265 ds = getdoc(obj)
265 if formatter is not None:
266 if formatter is not None:
266 ds = formatter(ds)
267 ds = formatter(ds)
267
268
268 # store output in a list which gets joined with \n at the end.
269 # store output in a list which gets joined with \n at the end.
269 out = myStringIO()
270 out = myStringIO()
270
271
271 string_max = 200 # max size of strings to show (snipped if longer)
272 string_max = 200 # max size of strings to show (snipped if longer)
272 shalf = int((string_max -5)/2)
273 shalf = int((string_max -5)/2)
273
274
274 if ismagic:
275 if ismagic:
275 obj_type_name = 'Magic function'
276 obj_type_name = 'Magic function'
276 elif isalias:
277 elif isalias:
277 obj_type_name = 'System alias'
278 obj_type_name = 'System alias'
278 else:
279 else:
279 obj_type_name = obj_type.__name__
280 obj_type_name = obj_type.__name__
280 out.writeln(header('Type:\t\t')+obj_type_name)
281 out.writeln(header('Type:\t\t')+obj_type_name)
281
282
282 try:
283 try:
283 bclass = obj.__class__
284 bclass = obj.__class__
284 out.writeln(header('Base Class:\t')+str(bclass))
285 out.writeln(header('Base Class:\t')+str(bclass))
285 except: pass
286 except: pass
286
287
287 # String form, but snip if too long in ? form (full in ??)
288 # String form, but snip if too long in ? form (full in ??)
288 try:
289 try:
289 ostr = str(obj)
290 ostr = str(obj)
290 str_head = 'String Form:'
291 str_head = 'String Form:'
291 if not detail_level and len(ostr)>string_max:
292 if not detail_level and len(ostr)>string_max:
292 ostr = ostr[:shalf] + ' <...> ' + ostr[-shalf:]
293 ostr = ostr[:shalf] + ' <...> ' + ostr[-shalf:]
293 ostr = ("\n" + " " * len(str_head.expandtabs())).\
294 ostr = ("\n" + " " * len(str_head.expandtabs())).\
294 join(map(string.strip,ostr.split("\n")))
295 join(map(string.strip,ostr.split("\n")))
295 if ostr.find('\n') > -1:
296 if ostr.find('\n') > -1:
296 # Print multi-line strings starting at the next line.
297 # Print multi-line strings starting at the next line.
297 str_sep = '\n'
298 str_sep = '\n'
298 else:
299 else:
299 str_sep = '\t'
300 str_sep = '\t'
300 out.writeln("%s%s%s" % (header(str_head),str_sep,ostr))
301 out.writeln("%s%s%s" % (header(str_head),str_sep,ostr))
301 except:
302 except:
302 pass
303 pass
303
304
304 if ospace:
305 if ospace:
305 out.writeln(header('Namespace:\t')+ospace)
306 out.writeln(header('Namespace:\t')+ospace)
306
307
307 # Length (for strings and lists)
308 # Length (for strings and lists)
308 try:
309 try:
309 length = str(len(obj))
310 length = str(len(obj))
310 out.writeln(header('Length:\t\t')+length)
311 out.writeln(header('Length:\t\t')+length)
311 except: pass
312 except: pass
312
313
313 # Filename where object was defined
314 # Filename where object was defined
314 try:
315 try:
315 file = inspect.getabsfile(obj)
316 file = inspect.getabsfile(obj)
316 if file.endswith('<string>'):
317 if file.endswith('<string>'):
317 file = 'Dynamically generated function. No source code available.'
318 file = 'Dynamically generated function. No source code available.'
318 out.writeln(header('File:\t\t')+file)
319 out.writeln(header('File:\t\t')+file)
319 except: pass
320 except: pass
320
321
321 # reconstruct the function definition and print it:
322 # reconstruct the function definition and print it:
322 defln = self.__getdef(obj,oname)
323 defln = self.__getdef(obj,oname)
323 if defln:
324 if defln:
324 out.write(header('Definition:\t')+self.format(defln))
325 out.write(header('Definition:\t')+self.format(defln))
325
326
326 # Docstrings only in detail 0 mode, since source contains them (we
327 # Docstrings only in detail 0 mode, since source contains them (we
327 # avoid repetitions). If source fails, we add them back, see below.
328 # avoid repetitions). If source fails, we add them back, see below.
328 if ds and detail_level == 0:
329 if ds and detail_level == 0:
329 out.writeln(header('Docstring:\n') + indent(ds))
330 out.writeln(header('Docstring:\n') + indent(ds))
330
331
331 # Original source code for any callable
332 # Original source code for any callable
332 if detail_level:
333 if detail_level:
333 # Flush the source cache because inspect can return out-of-date source
334 # Flush the source cache because inspect can return out-of-date source
334 linecache.checkcache()
335 linecache.checkcache()
335 try:
336 try:
336 source = self.format(inspect.getsource(obj))
337 source = self.format(inspect.getsource(obj))
337 out.write(header('Source:\n')+source.rstrip())
338 out.write(header('Source:\n')+source.rstrip())
338 except:
339 except:
339 if ds:
340 if ds:
340 out.writeln(header('Docstring:\n') + indent(ds))
341 out.writeln(header('Docstring:\n') + indent(ds))
341
342
342 # Constructor docstring for classes
343 # Constructor docstring for classes
343 if obj_type is types.ClassType:
344 if obj_type is types.ClassType:
344 # reconstruct the function definition and print it:
345 # reconstruct the function definition and print it:
345 try:
346 try:
346 obj_init = obj.__init__
347 obj_init = obj.__init__
347 except AttributeError:
348 except AttributeError:
348 init_def = init_ds = None
349 init_def = init_ds = None
349 else:
350 else:
350 init_def = self.__getdef(obj_init,oname)
351 init_def = self.__getdef(obj_init,oname)
351 init_ds = getdoc(obj_init)
352 init_ds = getdoc(obj_init)
352
353
353 if init_def or init_ds:
354 if init_def or init_ds:
354 out.writeln(header('\nConstructor information:'))
355 out.writeln(header('\nConstructor information:'))
355 if init_def:
356 if init_def:
356 out.write(header('Definition:\t')+ self.format(init_def))
357 out.write(header('Definition:\t')+ self.format(init_def))
357 if init_ds:
358 if init_ds:
358 out.writeln(header('Docstring:\n') + indent(init_ds))
359 out.writeln(header('Docstring:\n') + indent(init_ds))
359 # and class docstring for instances:
360 # and class docstring for instances:
360 elif obj_type is types.InstanceType:
361 elif obj_type is types.InstanceType:
361
362
362 # First, check whether the instance docstring is identical to the
363 # First, check whether the instance docstring is identical to the
363 # class one, and print it separately if they don't coincide. In
364 # class one, and print it separately if they don't coincide. In
364 # most cases they will, but it's nice to print all the info for
365 # most cases they will, but it's nice to print all the info for
365 # objects which use instance-customized docstrings.
366 # objects which use instance-customized docstrings.
366 if ds:
367 if ds:
367 class_ds = getdoc(obj.__class__)
368 class_ds = getdoc(obj.__class__)
368 if class_ds and ds != class_ds:
369 if class_ds and ds != class_ds:
369 out.writeln(header('Class Docstring:\n') +
370 out.writeln(header('Class Docstring:\n') +
370 indent(class_ds))
371 indent(class_ds))
371
372
372 # Next, try to show constructor docstrings
373 # Next, try to show constructor docstrings
373 try:
374 try:
374 init_ds = getdoc(obj.__init__)
375 init_ds = getdoc(obj.__init__)
375 except AttributeError:
376 except AttributeError:
376 init_ds = None
377 init_ds = None
377 if init_ds:
378 if init_ds:
378 out.writeln(header('Constructor Docstring:\n') +
379 out.writeln(header('Constructor Docstring:\n') +
379 indent(init_ds))
380 indent(init_ds))
380
381
381 # Call form docstring for callable instances
382 # Call form docstring for callable instances
382 if hasattr(obj,'__call__'):
383 if hasattr(obj,'__call__'):
383 out.writeln(header('Callable:\t')+'Yes')
384 out.writeln(header('Callable:\t')+'Yes')
384 call_def = self.__getdef(obj.__call__,oname)
385 call_def = self.__getdef(obj.__call__,oname)
385 if call_def is None:
386 if call_def is None:
386 out.write(header('Call def:\t')+
387 out.write(header('Call def:\t')+
387 'Calling definition not available.')
388 'Calling definition not available.')
388 else:
389 else:
389 out.write(header('Call def:\t')+self.format(call_def))
390 out.write(header('Call def:\t')+self.format(call_def))
390 call_ds = getdoc(obj.__call__)
391 call_ds = getdoc(obj.__call__)
391 if call_ds:
392 if call_ds:
392 out.writeln(header('Call docstring:\n') + indent(call_ds))
393 out.writeln(header('Call docstring:\n') + indent(call_ds))
393
394
394 # Finally send to printer/pager
395 # Finally send to printer/pager
395 output = out.getvalue()
396 output = out.getvalue()
396 if output:
397 if output:
397 page(output)
398 page(output)
398 # end pinfo
399 # end pinfo
400
401 def psearch(self,oname='',formatter = None,shell=None):
402 """Search namespaces with wildcards for objects.
403
404 Optional arguments:
405
406 - oname: rest of the commandline containging pattern and options
407
408 - formatter: Not used
409
410 - shell: The shell object from the Magic class. Needed to
411 access the namespaces
412
413 """
414 option_list=["-c","-a"]
415 import pdb
416 # pdb.set_trace()
417 cmds=oname.split()
418 filter=""
419 type_pattern="all"
420 ns_cmds=[]
421 options=[x for x in cmds if x in option_list]
422 ignorecase="-c" not in options
423 showhidden="-a" in options
424 ns_cmds=[x for x in cmds if x[0] in "-+" and x not in option_list]
425 cmds=[x for x in cmds if x[0] not in "-+"]
426 if len(cmds)>2: #assume we want to choose name spaces.
427 #Rather poor design forces the use of a typepattern in order to choose name spaces
428 cmds=cmds[:2]
429 if len(cmds)==2:
430 filter,type_pattern=cmds
431 elif len(cmds)==1:
432 filter=cmds[0].strip()
433
434 do_list=choose_namespaces(shell,ns_cmds)
435
436 search_result=[]
437 for ns in do_list:
438 tmp_res=list(list_namespace(ns,type_pattern,filter,ignorecase=ignorecase,showhidden=showhidden))
439 search_result.extend(tmp_res)
440 search_result.sort()
441
442 page("\n".join(search_result))
@@ -1,4421 +1,4430 b''
1 2005-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
2
3 * IPython/Magic.py (magic_psearch): new support for wildcard
4 patterns. Now, typing ?a*b will list all names which begin with a
5 and end in b, for example. The %psearch magic has full
6 docstrings. Many thanks to Jörgen Stenarson
7 <jorgen.stenarson-AT-bostream.nu>, author of the patches
8 implementing this functionality.
9
1 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
10 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
2
11
3 * Manual: fixed long-standing annoyance of double-dashes (as in
12 * Manual: fixed long-standing annoyance of double-dashes (as in
4 --prefix=~, for example) being stripped in the HTML version. This
13 --prefix=~, for example) being stripped in the HTML version. This
5 is a latex2html bug, but a workaround was provided. Many thanks
14 is a latex2html bug, but a workaround was provided. Many thanks
6 to George K. Thiruvathukal <gthiruv AT luc.edu> for the detailed
15 to George K. Thiruvathukal <gthiruv-AT-luc.edu> for the detailed
7 help, and Michael Tobis <mtobis AT gmail.com> for getting the ball
16 help, and Michael Tobis <mtobis-AT-gmail.com> for getting the ball
8 rolling. This seemingly small issue had tripped a number of users
17 rolling. This seemingly small issue had tripped a number of users
9 when first installing, so I'm glad to see it gone.
18 when first installing, so I'm glad to see it gone.
10
19
11 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
20 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
12
21
13 * IPython/Extensions/numeric_formats.py: fix missing import,
22 * IPython/Extensions/numeric_formats.py: fix missing import,
14 reported by Stephen Walton.
23 reported by Stephen Walton.
15
24
16 2005-09-24 Fernando Perez <Fernando.Perez@colorado.edu>
25 2005-09-24 Fernando Perez <Fernando.Perez@colorado.edu>
17
26
18 * IPython/demo.py: finish demo module, fully documented now.
27 * IPython/demo.py: finish demo module, fully documented now.
19
28
20 * IPython/genutils.py (file_read): simple little utility to read a
29 * IPython/genutils.py (file_read): simple little utility to read a
21 file and ensure it's closed afterwards.
30 file and ensure it's closed afterwards.
22
31
23 2005-09-23 Fernando Perez <Fernando.Perez@colorado.edu>
32 2005-09-23 Fernando Perez <Fernando.Perez@colorado.edu>
24
33
25 * IPython/demo.py (Demo.__init__): added support for individually
34 * IPython/demo.py (Demo.__init__): added support for individually
26 tagging blocks for automatic execution.
35 tagging blocks for automatic execution.
27
36
28 * IPython/Magic.py (magic_pycat): new %pycat magic for showing
37 * IPython/Magic.py (magic_pycat): new %pycat magic for showing
29 syntax-highlighted python sources, requested by John.
38 syntax-highlighted python sources, requested by John.
30
39
31 2005-09-22 Fernando Perez <Fernando.Perez@colorado.edu>
40 2005-09-22 Fernando Perez <Fernando.Perez@colorado.edu>
32
41
33 * IPython/demo.py (Demo.again): fix bug where again() blocks after
42 * IPython/demo.py (Demo.again): fix bug where again() blocks after
34 finishing.
43 finishing.
35
44
36 * IPython/genutils.py (shlex_split): moved from Magic to here,
45 * IPython/genutils.py (shlex_split): moved from Magic to here,
37 where all 2.2 compatibility stuff lives. I needed it for demo.py.
46 where all 2.2 compatibility stuff lives. I needed it for demo.py.
38
47
39 * IPython/demo.py (Demo.__init__): added support for silent
48 * IPython/demo.py (Demo.__init__): added support for silent
40 blocks, improved marks as regexps, docstrings written.
49 blocks, improved marks as regexps, docstrings written.
41 (Demo.__init__): better docstring, added support for sys.argv.
50 (Demo.__init__): better docstring, added support for sys.argv.
42
51
43 * IPython/genutils.py (marquee): little utility used by the demo
52 * IPython/genutils.py (marquee): little utility used by the demo
44 code, handy in general.
53 code, handy in general.
45
54
46 * IPython/demo.py (Demo.__init__): new class for interactive
55 * IPython/demo.py (Demo.__init__): new class for interactive
47 demos. Not documented yet, I just wrote it in a hurry for
56 demos. Not documented yet, I just wrote it in a hurry for
48 scipy'05. Will docstring later.
57 scipy'05. Will docstring later.
49
58
50 2005-09-20 Fernando Perez <Fernando.Perez@colorado.edu>
59 2005-09-20 Fernando Perez <Fernando.Perez@colorado.edu>
51
60
52 * IPython/Shell.py (sigint_handler): Drastic simplification which
61 * IPython/Shell.py (sigint_handler): Drastic simplification which
53 also seems to make Ctrl-C work correctly across threads! This is
62 also seems to make Ctrl-C work correctly across threads! This is
54 so simple, that I can't beleive I'd missed it before. Needs more
63 so simple, that I can't beleive I'd missed it before. Needs more
55 testing, though.
64 testing, though.
56 (KBINT): Never mind, revert changes. I'm sure I'd tried something
65 (KBINT): Never mind, revert changes. I'm sure I'd tried something
57 like this before...
66 like this before...
58
67
59 * IPython/genutils.py (get_home_dir): add protection against
68 * IPython/genutils.py (get_home_dir): add protection against
60 non-dirs in win32 registry.
69 non-dirs in win32 registry.
61
70
62 * IPython/iplib.py (InteractiveShell.alias_table_validate): fix
71 * IPython/iplib.py (InteractiveShell.alias_table_validate): fix
63 bug where dict was mutated while iterating (pysh crash).
72 bug where dict was mutated while iterating (pysh crash).
64
73
65 2005-09-06 Fernando Perez <Fernando.Perez@colorado.edu>
74 2005-09-06 Fernando Perez <Fernando.Perez@colorado.edu>
66
75
67 * IPython/iplib.py (handle_auto): Fix inconsistency arising from
76 * IPython/iplib.py (handle_auto): Fix inconsistency arising from
68 spurious newlines added by this routine. After a report by
77 spurious newlines added by this routine. After a report by
69 F. Mantegazza.
78 F. Mantegazza.
70
79
71 2005-09-05 Fernando Perez <Fernando.Perez@colorado.edu>
80 2005-09-05 Fernando Perez <Fernando.Perez@colorado.edu>
72
81
73 * IPython/Shell.py (hijack_gtk): remove pygtk.require("2.0")
82 * IPython/Shell.py (hijack_gtk): remove pygtk.require("2.0")
74 calls. These were a leftover from the GTK 1.x days, and can cause
83 calls. These were a leftover from the GTK 1.x days, and can cause
75 problems in certain cases (after a report by John Hunter).
84 problems in certain cases (after a report by John Hunter).
76
85
77 * IPython/iplib.py (InteractiveShell.__init__): Trap exception if
86 * IPython/iplib.py (InteractiveShell.__init__): Trap exception if
78 os.getcwd() fails at init time. Thanks to patch from David Remahl
87 os.getcwd() fails at init time. Thanks to patch from David Remahl
79 <chmod007 AT mac.com>.
88 <chmod007-AT-mac.com>.
80 (InteractiveShell.__init__): prevent certain special magics from
89 (InteractiveShell.__init__): prevent certain special magics from
81 being shadowed by aliases. Closes
90 being shadowed by aliases. Closes
82 http://www.scipy.net/roundup/ipython/issue41.
91 http://www.scipy.net/roundup/ipython/issue41.
83
92
84 2005-08-31 Fernando Perez <Fernando.Perez@colorado.edu>
93 2005-08-31 Fernando Perez <Fernando.Perez@colorado.edu>
85
94
86 * IPython/iplib.py (InteractiveShell.complete): Added new
95 * IPython/iplib.py (InteractiveShell.complete): Added new
87 top-level completion method to expose the completion mechanism
96 top-level completion method to expose the completion mechanism
88 beyond readline-based environments.
97 beyond readline-based environments.
89
98
90 2005-08-19 Fernando Perez <Fernando.Perez@colorado.edu>
99 2005-08-19 Fernando Perez <Fernando.Perez@colorado.edu>
91
100
92 * tools/ipsvnc (svnversion): fix svnversion capture.
101 * tools/ipsvnc (svnversion): fix svnversion capture.
93
102
94 * IPython/iplib.py (InteractiveShell.__init__): Add has_readline
103 * IPython/iplib.py (InteractiveShell.__init__): Add has_readline
95 attribute to self, which was missing. Before, it was set by a
104 attribute to self, which was missing. Before, it was set by a
96 routine which in certain cases wasn't being called, so the
105 routine which in certain cases wasn't being called, so the
97 instance could end up missing the attribute. This caused a crash.
106 instance could end up missing the attribute. This caused a crash.
98 Closes http://www.scipy.net/roundup/ipython/issue40.
107 Closes http://www.scipy.net/roundup/ipython/issue40.
99
108
100 2005-08-16 Fernando Perez <fperez@colorado.edu>
109 2005-08-16 Fernando Perez <fperez@colorado.edu>
101
110
102 * IPython/ultraTB.py (VerboseTB.text): don't crash if object
111 * IPython/ultraTB.py (VerboseTB.text): don't crash if object
103 contains non-string attribute. Closes
112 contains non-string attribute. Closes
104 http://www.scipy.net/roundup/ipython/issue38.
113 http://www.scipy.net/roundup/ipython/issue38.
105
114
106 2005-08-14 Fernando Perez <fperez@colorado.edu>
115 2005-08-14 Fernando Perez <fperez@colorado.edu>
107
116
108 * tools/ipsvnc: Minor improvements, to add changeset info.
117 * tools/ipsvnc: Minor improvements, to add changeset info.
109
118
110 2005-08-12 Fernando Perez <fperez@colorado.edu>
119 2005-08-12 Fernando Perez <fperez@colorado.edu>
111
120
112 * IPython/iplib.py (runsource): remove self.code_to_run_src
121 * IPython/iplib.py (runsource): remove self.code_to_run_src
113 attribute. I realized this is nothing more than
122 attribute. I realized this is nothing more than
114 '\n'.join(self.buffer), and having the same data in two different
123 '\n'.join(self.buffer), and having the same data in two different
115 places is just asking for synchronization bugs. This may impact
124 places is just asking for synchronization bugs. This may impact
116 people who have custom exception handlers, so I need to warn
125 people who have custom exception handlers, so I need to warn
117 ipython-dev about it (F. Mantegazza may use them).
126 ipython-dev about it (F. Mantegazza may use them).
118
127
119 2005-07-29 Fernando Perez <Fernando.Perez@colorado.edu>
128 2005-07-29 Fernando Perez <Fernando.Perez@colorado.edu>
120
129
121 * IPython/genutils.py: fix 2.2 compatibility (generators)
130 * IPython/genutils.py: fix 2.2 compatibility (generators)
122
131
123 2005-07-18 Fernando Perez <fperez@colorado.edu>
132 2005-07-18 Fernando Perez <fperez@colorado.edu>
124
133
125 * IPython/genutils.py (get_home_dir): fix to help users with
134 * IPython/genutils.py (get_home_dir): fix to help users with
126 invalid $HOME under win32.
135 invalid $HOME under win32.
127
136
128 2005-07-17 Fernando Perez <fperez@colorado.edu>
137 2005-07-17 Fernando Perez <fperez@colorado.edu>
129
138
130 * IPython/Prompts.py (str_safe): Make unicode-safe. Also remove
139 * IPython/Prompts.py (str_safe): Make unicode-safe. Also remove
131 some old hacks and clean up a bit other routines; code should be
140 some old hacks and clean up a bit other routines; code should be
132 simpler and a bit faster.
141 simpler and a bit faster.
133
142
134 * IPython/iplib.py (interact): removed some last-resort attempts
143 * IPython/iplib.py (interact): removed some last-resort attempts
135 to survive broken stdout/stderr. That code was only making it
144 to survive broken stdout/stderr. That code was only making it
136 harder to abstract out the i/o (necessary for gui integration),
145 harder to abstract out the i/o (necessary for gui integration),
137 and the crashes it could prevent were extremely rare in practice
146 and the crashes it could prevent were extremely rare in practice
138 (besides being fully user-induced in a pretty violent manner).
147 (besides being fully user-induced in a pretty violent manner).
139
148
140 * IPython/genutils.py (IOStream.__init__): Simplify the i/o stuff.
149 * IPython/genutils.py (IOStream.__init__): Simplify the i/o stuff.
141 Nothing major yet, but the code is simpler to read; this should
150 Nothing major yet, but the code is simpler to read; this should
142 make it easier to do more serious modifications in the future.
151 make it easier to do more serious modifications in the future.
143
152
144 * IPython/Extensions/InterpreterExec.py: Fix auto-quoting in pysh,
153 * IPython/Extensions/InterpreterExec.py: Fix auto-quoting in pysh,
145 which broke in .15 (thanks to a report by Ville).
154 which broke in .15 (thanks to a report by Ville).
146
155
147 * IPython/Itpl.py (Itpl.__init__): add unicode support (it may not
156 * IPython/Itpl.py (Itpl.__init__): add unicode support (it may not
148 be quite correct, I know next to nothing about unicode). This
157 be quite correct, I know next to nothing about unicode). This
149 will allow unicode strings to be used in prompts, amongst other
158 will allow unicode strings to be used in prompts, amongst other
150 cases. It also will prevent ipython from crashing when unicode
159 cases. It also will prevent ipython from crashing when unicode
151 shows up unexpectedly in many places. If ascii encoding fails, we
160 shows up unexpectedly in many places. If ascii encoding fails, we
152 assume utf_8. Currently the encoding is not a user-visible
161 assume utf_8. Currently the encoding is not a user-visible
153 setting, though it could be made so if there is demand for it.
162 setting, though it could be made so if there is demand for it.
154
163
155 * IPython/ipmaker.py (make_IPython): remove old 2.1-specific hack.
164 * IPython/ipmaker.py (make_IPython): remove old 2.1-specific hack.
156
165
157 * IPython/Struct.py (Struct.merge): switch keys() to iterator.
166 * IPython/Struct.py (Struct.merge): switch keys() to iterator.
158
167
159 * IPython/background_jobs.py: moved 2.2 compatibility to genutils.
168 * IPython/background_jobs.py: moved 2.2 compatibility to genutils.
160
169
161 * IPython/genutils.py: Add 2.2 compatibility here, so all other
170 * IPython/genutils.py: Add 2.2 compatibility here, so all other
162 code can work transparently for 2.2/2.3.
171 code can work transparently for 2.2/2.3.
163
172
164 2005-07-16 Fernando Perez <fperez@colorado.edu>
173 2005-07-16 Fernando Perez <fperez@colorado.edu>
165
174
166 * IPython/ultraTB.py (ExceptionColors): Make a global variable
175 * IPython/ultraTB.py (ExceptionColors): Make a global variable
167 out of the color scheme table used for coloring exception
176 out of the color scheme table used for coloring exception
168 tracebacks. This allows user code to add new schemes at runtime.
177 tracebacks. This allows user code to add new schemes at runtime.
169 This is a minimally modified version of the patch at
178 This is a minimally modified version of the patch at
170 http://www.scipy.net/roundup/ipython/issue35, many thanks to pabw
179 http://www.scipy.net/roundup/ipython/issue35, many thanks to pabw
171 for the contribution.
180 for the contribution.
172
181
173 * IPython/FlexCompleter.py (Completer.attr_matches): Add a
182 * IPython/FlexCompleter.py (Completer.attr_matches): Add a
174 slightly modified version of the patch in
183 slightly modified version of the patch in
175 http://www.scipy.net/roundup/ipython/issue34, which also allows me
184 http://www.scipy.net/roundup/ipython/issue34, which also allows me
176 to remove the previous try/except solution (which was costlier).
185 to remove the previous try/except solution (which was costlier).
177 Thanks to Gaetan Lehmann <gaetan.lehmann AT jouy.inra.fr> for the fix.
186 Thanks to Gaetan Lehmann <gaetan.lehmann-AT-jouy.inra.fr> for the fix.
178
187
179 2005-06-08 Fernando Perez <fperez@colorado.edu>
188 2005-06-08 Fernando Perez <fperez@colorado.edu>
180
189
181 * IPython/iplib.py (write/write_err): Add methods to abstract all
190 * IPython/iplib.py (write/write_err): Add methods to abstract all
182 I/O a bit more.
191 I/O a bit more.
183
192
184 * IPython/Shell.py (IPShellGTK.mainloop): Fix GTK deprecation
193 * IPython/Shell.py (IPShellGTK.mainloop): Fix GTK deprecation
185 warning, reported by Aric Hagberg, fix by JD Hunter.
194 warning, reported by Aric Hagberg, fix by JD Hunter.
186
195
187 2005-06-02 *** Released version 0.6.15
196 2005-06-02 *** Released version 0.6.15
188
197
189 2005-06-01 Fernando Perez <fperez@colorado.edu>
198 2005-06-01 Fernando Perez <fperez@colorado.edu>
190
199
191 * IPython/iplib.py (MagicCompleter.file_matches): Fix
200 * IPython/iplib.py (MagicCompleter.file_matches): Fix
192 tab-completion of filenames within open-quoted strings. Note that
201 tab-completion of filenames within open-quoted strings. Note that
193 this requires that in ~/.ipython/ipythonrc, users change the
202 this requires that in ~/.ipython/ipythonrc, users change the
194 readline delimiters configuration to read:
203 readline delimiters configuration to read:
195
204
196 readline_remove_delims -/~
205 readline_remove_delims -/~
197
206
198
207
199 2005-05-31 *** Released version 0.6.14
208 2005-05-31 *** Released version 0.6.14
200
209
201 2005-05-29 Fernando Perez <fperez@colorado.edu>
210 2005-05-29 Fernando Perez <fperez@colorado.edu>
202
211
203 * IPython/ultraTB.py (VerboseTB.text): Fix crash for tracebacks
212 * IPython/ultraTB.py (VerboseTB.text): Fix crash for tracebacks
204 with files not on the filesystem. Reported by Eliyahu Sandler
213 with files not on the filesystem. Reported by Eliyahu Sandler
205 <eli@gondolin.net>
214 <eli@gondolin.net>
206
215
207 2005-05-22 Fernando Perez <fperez@colorado.edu>
216 2005-05-22 Fernando Perez <fperez@colorado.edu>
208
217
209 * IPython/iplib.py: Fix a few crashes in the --upgrade option.
218 * IPython/iplib.py: Fix a few crashes in the --upgrade option.
210 After an initial report by LUK ShunTim <shuntim.luk@polyu.edu.hk>.
219 After an initial report by LUK ShunTim <shuntim.luk@polyu.edu.hk>.
211
220
212 2005-05-19 Fernando Perez <fperez@colorado.edu>
221 2005-05-19 Fernando Perez <fperez@colorado.edu>
213
222
214 * IPython/iplib.py (safe_execfile): close a file which could be
223 * IPython/iplib.py (safe_execfile): close a file which could be
215 left open (causing problems in win32, which locks open files).
224 left open (causing problems in win32, which locks open files).
216 Thanks to a bug report by D Brown <dbrown2@yahoo.com>.
225 Thanks to a bug report by D Brown <dbrown2@yahoo.com>.
217
226
218 2005-05-18 Fernando Perez <fperez@colorado.edu>
227 2005-05-18 Fernando Perez <fperez@colorado.edu>
219
228
220 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): pass all
229 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): pass all
221 keyword arguments correctly to safe_execfile().
230 keyword arguments correctly to safe_execfile().
222
231
223 2005-05-13 Fernando Perez <fperez@colorado.edu>
232 2005-05-13 Fernando Perez <fperez@colorado.edu>
224
233
225 * ipython.1: Added info about Qt to manpage, and threads warning
234 * ipython.1: Added info about Qt to manpage, and threads warning
226 to usage page (invoked with --help).
235 to usage page (invoked with --help).
227
236
228 * IPython/iplib.py (MagicCompleter.python_func_kw_matches): Added
237 * IPython/iplib.py (MagicCompleter.python_func_kw_matches): Added
229 new matcher (it goes at the end of the priority list) to do
238 new matcher (it goes at the end of the priority list) to do
230 tab-completion on named function arguments. Submitted by George
239 tab-completion on named function arguments. Submitted by George
231 Sakkis <gsakkis-AT-eden.rutgers.edu>. See the thread at
240 Sakkis <gsakkis-AT-eden.rutgers.edu>. See the thread at
232 http://www.scipy.net/pipermail/ipython-dev/2005-April/000436.html
241 http://www.scipy.net/pipermail/ipython-dev/2005-April/000436.html
233 for more details.
242 for more details.
234
243
235 * IPython/Magic.py (magic_run): Added new -e flag to ignore
244 * IPython/Magic.py (magic_run): Added new -e flag to ignore
236 SystemExit exceptions in the script being run. Thanks to a report
245 SystemExit exceptions in the script being run. Thanks to a report
237 by danny shevitz <danny_shevitz-AT-yahoo.com>, about this
246 by danny shevitz <danny_shevitz-AT-yahoo.com>, about this
238 producing very annoying behavior when running unit tests.
247 producing very annoying behavior when running unit tests.
239
248
240 2005-05-12 Fernando Perez <fperez@colorado.edu>
249 2005-05-12 Fernando Perez <fperez@colorado.edu>
241
250
242 * IPython/iplib.py (handle_auto): fixed auto-quoting and parens,
251 * IPython/iplib.py (handle_auto): fixed auto-quoting and parens,
243 which I'd broken (again) due to a changed regexp. In the process,
252 which I'd broken (again) due to a changed regexp. In the process,
244 added ';' as an escape to auto-quote the whole line without
253 added ';' as an escape to auto-quote the whole line without
245 splitting its arguments. Thanks to a report by Jerry McRae
254 splitting its arguments. Thanks to a report by Jerry McRae
246 <qrs0xyc02-AT-sneakemail.com>.
255 <qrs0xyc02-AT-sneakemail.com>.
247
256
248 * IPython/ultraTB.py (VerboseTB.text): protect against rare but
257 * IPython/ultraTB.py (VerboseTB.text): protect against rare but
249 possible crashes caused by a TokenError. Reported by Ed Schofield
258 possible crashes caused by a TokenError. Reported by Ed Schofield
250 <schofield-AT-ftw.at>.
259 <schofield-AT-ftw.at>.
251
260
252 2005-05-06 Fernando Perez <fperez@colorado.edu>
261 2005-05-06 Fernando Perez <fperez@colorado.edu>
253
262
254 * IPython/Shell.py (hijack_wx): Fix to work with WX v.2.6.
263 * IPython/Shell.py (hijack_wx): Fix to work with WX v.2.6.
255
264
256 2005-04-29 Fernando Perez <fperez@colorado.edu>
265 2005-04-29 Fernando Perez <fperez@colorado.edu>
257
266
258 * IPython/Shell.py (IPShellQt): Thanks to Denis Rivière
267 * IPython/Shell.py (IPShellQt): Thanks to Denis Rivière
259 <nudz-AT-free.fr>, Yann Cointepas <yann-AT-sapetnioc.org> and Benjamin
268 <nudz-AT-free.fr>, Yann Cointepas <yann-AT-sapetnioc.org> and Benjamin
260 Thyreau <Benji2-AT-decideur.info>, we now have a -qthread option
269 Thyreau <Benji2-AT-decideur.info>, we now have a -qthread option
261 which provides support for Qt interactive usage (similar to the
270 which provides support for Qt interactive usage (similar to the
262 existing one for WX and GTK). This had been often requested.
271 existing one for WX and GTK). This had been often requested.
263
272
264 2005-04-14 *** Released version 0.6.13
273 2005-04-14 *** Released version 0.6.13
265
274
266 2005-04-08 Fernando Perez <fperez@colorado.edu>
275 2005-04-08 Fernando Perez <fperez@colorado.edu>
267
276
268 * IPython/Magic.py (Magic._ofind): remove docstring evaluation
277 * IPython/Magic.py (Magic._ofind): remove docstring evaluation
269 from _ofind, which gets called on almost every input line. Now,
278 from _ofind, which gets called on almost every input line. Now,
270 we only try to get docstrings if they are actually going to be
279 we only try to get docstrings if they are actually going to be
271 used (the overhead of fetching unnecessary docstrings can be
280 used (the overhead of fetching unnecessary docstrings can be
272 noticeable for certain objects, such as Pyro proxies).
281 noticeable for certain objects, such as Pyro proxies).
273
282
274 * IPython/iplib.py (MagicCompleter.python_matches): Change the API
283 * IPython/iplib.py (MagicCompleter.python_matches): Change the API
275 for completers. For some reason I had been passing them the state
284 for completers. For some reason I had been passing them the state
276 variable, which completers never actually need, and was in
285 variable, which completers never actually need, and was in
277 conflict with the rlcompleter API. Custom completers ONLY need to
286 conflict with the rlcompleter API. Custom completers ONLY need to
278 take the text parameter.
287 take the text parameter.
279
288
280 * IPython/Extensions/InterpreterExec.py: Fix regexp so that magics
289 * IPython/Extensions/InterpreterExec.py: Fix regexp so that magics
281 work correctly in pysh. I've also moved all the logic which used
290 work correctly in pysh. I've also moved all the logic which used
282 to be in pysh.py here, which will prevent problems with future
291 to be in pysh.py here, which will prevent problems with future
283 upgrades. However, this time I must warn users to update their
292 upgrades. However, this time I must warn users to update their
284 pysh profile to include the line
293 pysh profile to include the line
285
294
286 import_all IPython.Extensions.InterpreterExec
295 import_all IPython.Extensions.InterpreterExec
287
296
288 because otherwise things won't work for them. They MUST also
297 because otherwise things won't work for them. They MUST also
289 delete pysh.py and the line
298 delete pysh.py and the line
290
299
291 execfile pysh.py
300 execfile pysh.py
292
301
293 from their ipythonrc-pysh.
302 from their ipythonrc-pysh.
294
303
295 * IPython/FlexCompleter.py (Completer.attr_matches): Make more
304 * IPython/FlexCompleter.py (Completer.attr_matches): Make more
296 robust in the face of objects whose dir() returns non-strings
305 robust in the face of objects whose dir() returns non-strings
297 (which it shouldn't, but some broken libs like ITK do). Thanks to
306 (which it shouldn't, but some broken libs like ITK do). Thanks to
298 a patch by John Hunter (implemented differently, though). Also
307 a patch by John Hunter (implemented differently, though). Also
299 minor improvements by using .extend instead of + on lists.
308 minor improvements by using .extend instead of + on lists.
300
309
301 * pysh.py:
310 * pysh.py:
302
311
303 2005-04-06 Fernando Perez <fperez@colorado.edu>
312 2005-04-06 Fernando Perez <fperez@colorado.edu>
304
313
305 * IPython/ipmaker.py (make_IPython): Make multi_line_specials on
314 * IPython/ipmaker.py (make_IPython): Make multi_line_specials on
306 by default, so that all users benefit from it. Those who don't
315 by default, so that all users benefit from it. Those who don't
307 want it can still turn it off.
316 want it can still turn it off.
308
317
309 * IPython/UserConfig/ipythonrc: Add multi_line_specials to the
318 * IPython/UserConfig/ipythonrc: Add multi_line_specials to the
310 config file, I'd forgotten about this, so users were getting it
319 config file, I'd forgotten about this, so users were getting it
311 off by default.
320 off by default.
312
321
313 * IPython/iplib.py (ipmagic): big overhaul of the magic system for
322 * IPython/iplib.py (ipmagic): big overhaul of the magic system for
314 consistency. Now magics can be called in multiline statements,
323 consistency. Now magics can be called in multiline statements,
315 and python variables can be expanded in magic calls via $var.
324 and python variables can be expanded in magic calls via $var.
316 This makes the magic system behave just like aliases or !system
325 This makes the magic system behave just like aliases or !system
317 calls.
326 calls.
318
327
319 2005-03-28 Fernando Perez <fperez@colorado.edu>
328 2005-03-28 Fernando Perez <fperez@colorado.edu>
320
329
321 * IPython/iplib.py (handle_auto): cleanup to use %s instead of
330 * IPython/iplib.py (handle_auto): cleanup to use %s instead of
322 expensive string additions for building command. Add support for
331 expensive string additions for building command. Add support for
323 trailing ';' when autocall is used.
332 trailing ';' when autocall is used.
324
333
325 2005-03-26 Fernando Perez <fperez@colorado.edu>
334 2005-03-26 Fernando Perez <fperez@colorado.edu>
326
335
327 * ipython.el: Fix http://www.scipy.net/roundup/ipython/issue31.
336 * ipython.el: Fix http://www.scipy.net/roundup/ipython/issue31.
328 Bugfix by A. Schmolck, the ipython.el maintainer. Also make
337 Bugfix by A. Schmolck, the ipython.el maintainer. Also make
329 ipython.el robust against prompts with any number of spaces
338 ipython.el robust against prompts with any number of spaces
330 (including 0) after the ':' character.
339 (including 0) after the ':' character.
331
340
332 * IPython/Prompts.py (Prompt2.set_p_str): Fix spurious space in
341 * IPython/Prompts.py (Prompt2.set_p_str): Fix spurious space in
333 continuation prompt, which misled users to think the line was
342 continuation prompt, which misled users to think the line was
334 already indented. Closes debian Bug#300847, reported to me by
343 already indented. Closes debian Bug#300847, reported to me by
335 Norbert Tretkowski <tretkowski-AT-inittab.de>.
344 Norbert Tretkowski <tretkowski-AT-inittab.de>.
336
345
337 2005-03-23 Fernando Perez <fperez@colorado.edu>
346 2005-03-23 Fernando Perez <fperez@colorado.edu>
338
347
339 * IPython/Prompts.py (Prompt1.__str__): Make sure that prompts are
348 * IPython/Prompts.py (Prompt1.__str__): Make sure that prompts are
340 properly aligned if they have embedded newlines.
349 properly aligned if they have embedded newlines.
341
350
342 * IPython/iplib.py (runlines): Add a public method to expose
351 * IPython/iplib.py (runlines): Add a public method to expose
343 IPython's code execution machinery, so that users can run strings
352 IPython's code execution machinery, so that users can run strings
344 as if they had been typed at the prompt interactively.
353 as if they had been typed at the prompt interactively.
345 (InteractiveShell.__init__): Added getoutput() to the __IPYTHON__
354 (InteractiveShell.__init__): Added getoutput() to the __IPYTHON__
346 methods which can call the system shell, but with python variable
355 methods which can call the system shell, but with python variable
347 expansion. The three such methods are: __IPYTHON__.system,
356 expansion. The three such methods are: __IPYTHON__.system,
348 .getoutput and .getoutputerror. These need to be documented in a
357 .getoutput and .getoutputerror. These need to be documented in a
349 'public API' section (to be written) of the manual.
358 'public API' section (to be written) of the manual.
350
359
351 2005-03-20 Fernando Perez <fperez@colorado.edu>
360 2005-03-20 Fernando Perez <fperez@colorado.edu>
352
361
353 * IPython/iplib.py (InteractiveShell.set_custom_exc): new system
362 * IPython/iplib.py (InteractiveShell.set_custom_exc): new system
354 for custom exception handling. This is quite powerful, and it
363 for custom exception handling. This is quite powerful, and it
355 allows for user-installable exception handlers which can trap
364 allows for user-installable exception handlers which can trap
356 custom exceptions at runtime and treat them separately from
365 custom exceptions at runtime and treat them separately from
357 IPython's default mechanisms. At the request of Frédéric
366 IPython's default mechanisms. At the request of Frédéric
358 Mantegazza <mantegazza-AT-ill.fr>.
367 Mantegazza <mantegazza-AT-ill.fr>.
359 (InteractiveShell.set_custom_completer): public API function to
368 (InteractiveShell.set_custom_completer): public API function to
360 add new completers at runtime.
369 add new completers at runtime.
361
370
362 2005-03-19 Fernando Perez <fperez@colorado.edu>
371 2005-03-19 Fernando Perez <fperez@colorado.edu>
363
372
364 * IPython/OInspect.py (getdoc): Add a call to obj.getdoc(), to
373 * IPython/OInspect.py (getdoc): Add a call to obj.getdoc(), to
365 allow objects which provide their docstrings via non-standard
374 allow objects which provide their docstrings via non-standard
366 mechanisms (like Pyro proxies) to still be inspected by ipython's
375 mechanisms (like Pyro proxies) to still be inspected by ipython's
367 ? system.
376 ? system.
368
377
369 * IPython/iplib.py (InteractiveShell.__init__): back off the _o/_e
378 * IPython/iplib.py (InteractiveShell.__init__): back off the _o/_e
370 automatic capture system. I tried quite hard to make it work
379 automatic capture system. I tried quite hard to make it work
371 reliably, and simply failed. I tried many combinations with the
380 reliably, and simply failed. I tried many combinations with the
372 subprocess module, but eventually nothing worked in all needed
381 subprocess module, but eventually nothing worked in all needed
373 cases (not blocking stdin for the child, duplicating stdout
382 cases (not blocking stdin for the child, duplicating stdout
374 without blocking, etc). The new %sc/%sx still do capture to these
383 without blocking, etc). The new %sc/%sx still do capture to these
375 magical list/string objects which make shell use much more
384 magical list/string objects which make shell use much more
376 conveninent, so not all is lost.
385 conveninent, so not all is lost.
377
386
378 XXX - FIX MANUAL for the change above!
387 XXX - FIX MANUAL for the change above!
379
388
380 (runsource): I copied code.py's runsource() into ipython to modify
389 (runsource): I copied code.py's runsource() into ipython to modify
381 it a bit. Now the code object and source to be executed are
390 it a bit. Now the code object and source to be executed are
382 stored in ipython. This makes this info accessible to third-party
391 stored in ipython. This makes this info accessible to third-party
383 tools, like custom exception handlers. After a request by Frédéric
392 tools, like custom exception handlers. After a request by Frédéric
384 Mantegazza <mantegazza-AT-ill.fr>.
393 Mantegazza <mantegazza-AT-ill.fr>.
385
394
386 * IPython/UserConfig/ipythonrc: Add up/down arrow keys to
395 * IPython/UserConfig/ipythonrc: Add up/down arrow keys to
387 history-search via readline (like C-p/C-n). I'd wanted this for a
396 history-search via readline (like C-p/C-n). I'd wanted this for a
388 long time, but only recently found out how to do it. For users
397 long time, but only recently found out how to do it. For users
389 who already have their ipythonrc files made and want this, just
398 who already have their ipythonrc files made and want this, just
390 add:
399 add:
391
400
392 readline_parse_and_bind "\e[A": history-search-backward
401 readline_parse_and_bind "\e[A": history-search-backward
393 readline_parse_and_bind "\e[B": history-search-forward
402 readline_parse_and_bind "\e[B": history-search-forward
394
403
395 2005-03-18 Fernando Perez <fperez@colorado.edu>
404 2005-03-18 Fernando Perez <fperez@colorado.edu>
396
405
397 * IPython/Magic.py (magic_sc): %sc and %sx now use the fancy
406 * IPython/Magic.py (magic_sc): %sc and %sx now use the fancy
398 LSString and SList classes which allow transparent conversions
407 LSString and SList classes which allow transparent conversions
399 between list mode and whitespace-separated string.
408 between list mode and whitespace-separated string.
400 (magic_r): Fix recursion problem in %r.
409 (magic_r): Fix recursion problem in %r.
401
410
402 * IPython/genutils.py (LSString): New class to be used for
411 * IPython/genutils.py (LSString): New class to be used for
403 automatic storage of the results of all alias/system calls in _o
412 automatic storage of the results of all alias/system calls in _o
404 and _e (stdout/err). These provide a .l/.list attribute which
413 and _e (stdout/err). These provide a .l/.list attribute which
405 does automatic splitting on newlines. This means that for most
414 does automatic splitting on newlines. This means that for most
406 uses, you'll never need to do capturing of output with %sc/%sx
415 uses, you'll never need to do capturing of output with %sc/%sx
407 anymore, since ipython keeps this always done for you. Note that
416 anymore, since ipython keeps this always done for you. Note that
408 only the LAST results are stored, the _o/e variables are
417 only the LAST results are stored, the _o/e variables are
409 overwritten on each call. If you need to save their contents
418 overwritten on each call. If you need to save their contents
410 further, simply bind them to any other name.
419 further, simply bind them to any other name.
411
420
412 2005-03-17 Fernando Perez <fperez@colorado.edu>
421 2005-03-17 Fernando Perez <fperez@colorado.edu>
413
422
414 * IPython/Prompts.py (BasePrompt.cwd_filt): a few more fixes for
423 * IPython/Prompts.py (BasePrompt.cwd_filt): a few more fixes for
415 prompt namespace handling.
424 prompt namespace handling.
416
425
417 2005-03-16 Fernando Perez <fperez@colorado.edu>
426 2005-03-16 Fernando Perez <fperez@colorado.edu>
418
427
419 * IPython/Prompts.py (CachedOutput.__init__): Fix default and
428 * IPython/Prompts.py (CachedOutput.__init__): Fix default and
420 classic prompts to be '>>> ' (final space was missing, and it
429 classic prompts to be '>>> ' (final space was missing, and it
421 trips the emacs python mode).
430 trips the emacs python mode).
422 (BasePrompt.__str__): Added safe support for dynamic prompt
431 (BasePrompt.__str__): Added safe support for dynamic prompt
423 strings. Now you can set your prompt string to be '$x', and the
432 strings. Now you can set your prompt string to be '$x', and the
424 value of x will be printed from your interactive namespace. The
433 value of x will be printed from your interactive namespace. The
425 interpolation syntax includes the full Itpl support, so
434 interpolation syntax includes the full Itpl support, so
426 ${foo()+x+bar()} is a valid prompt string now, and the function
435 ${foo()+x+bar()} is a valid prompt string now, and the function
427 calls will be made at runtime.
436 calls will be made at runtime.
428
437
429 2005-03-15 Fernando Perez <fperez@colorado.edu>
438 2005-03-15 Fernando Perez <fperez@colorado.edu>
430
439
431 * IPython/Magic.py (magic_history): renamed %hist to %history, to
440 * IPython/Magic.py (magic_history): renamed %hist to %history, to
432 avoid name clashes in pylab. %hist still works, it just forwards
441 avoid name clashes in pylab. %hist still works, it just forwards
433 the call to %history.
442 the call to %history.
434
443
435 2005-03-02 *** Released version 0.6.12
444 2005-03-02 *** Released version 0.6.12
436
445
437 2005-03-02 Fernando Perez <fperez@colorado.edu>
446 2005-03-02 Fernando Perez <fperez@colorado.edu>
438
447
439 * IPython/iplib.py (handle_magic): log magic calls properly as
448 * IPython/iplib.py (handle_magic): log magic calls properly as
440 ipmagic() function calls.
449 ipmagic() function calls.
441
450
442 * IPython/Magic.py (magic_time): Improved %time to support
451 * IPython/Magic.py (magic_time): Improved %time to support
443 statements and provide wall-clock as well as CPU time.
452 statements and provide wall-clock as well as CPU time.
444
453
445 2005-02-27 Fernando Perez <fperez@colorado.edu>
454 2005-02-27 Fernando Perez <fperez@colorado.edu>
446
455
447 * IPython/hooks.py: New hooks module, to expose user-modifiable
456 * IPython/hooks.py: New hooks module, to expose user-modifiable
448 IPython functionality in a clean manner. For now only the editor
457 IPython functionality in a clean manner. For now only the editor
449 hook is actually written, and other thigns which I intend to turn
458 hook is actually written, and other thigns which I intend to turn
450 into proper hooks aren't yet there. The display and prefilter
459 into proper hooks aren't yet there. The display and prefilter
451 stuff, for example, should be hooks. But at least now the
460 stuff, for example, should be hooks. But at least now the
452 framework is in place, and the rest can be moved here with more
461 framework is in place, and the rest can be moved here with more
453 time later. IPython had had a .hooks variable for a long time for
462 time later. IPython had had a .hooks variable for a long time for
454 this purpose, but I'd never actually used it for anything.
463 this purpose, but I'd never actually used it for anything.
455
464
456 2005-02-26 Fernando Perez <fperez@colorado.edu>
465 2005-02-26 Fernando Perez <fperez@colorado.edu>
457
466
458 * IPython/ipmaker.py (make_IPython): make the default ipython
467 * IPython/ipmaker.py (make_IPython): make the default ipython
459 directory be called _ipython under win32, to follow more the
468 directory be called _ipython under win32, to follow more the
460 naming peculiarities of that platform (where buggy software like
469 naming peculiarities of that platform (where buggy software like
461 Visual Sourcesafe breaks with .named directories). Reported by
470 Visual Sourcesafe breaks with .named directories). Reported by
462 Ville Vainio.
471 Ville Vainio.
463
472
464 2005-02-23 Fernando Perez <fperez@colorado.edu>
473 2005-02-23 Fernando Perez <fperez@colorado.edu>
465
474
466 * IPython/iplib.py (InteractiveShell.__init__): removed a few
475 * IPython/iplib.py (InteractiveShell.__init__): removed a few
467 auto_aliases for win32 which were causing problems. Users can
476 auto_aliases for win32 which were causing problems. Users can
468 define the ones they personally like.
477 define the ones they personally like.
469
478
470 2005-02-21 Fernando Perez <fperez@colorado.edu>
479 2005-02-21 Fernando Perez <fperez@colorado.edu>
471
480
472 * IPython/Magic.py (magic_time): new magic to time execution of
481 * IPython/Magic.py (magic_time): new magic to time execution of
473 expressions. After a request by Charles Moad <cmoad-AT-indiana.edu>.
482 expressions. After a request by Charles Moad <cmoad-AT-indiana.edu>.
474
483
475 2005-02-19 Fernando Perez <fperez@colorado.edu>
484 2005-02-19 Fernando Perez <fperez@colorado.edu>
476
485
477 * IPython/ConfigLoader.py (ConfigLoader.load): Allow empty strings
486 * IPython/ConfigLoader.py (ConfigLoader.load): Allow empty strings
478 into keys (for prompts, for example).
487 into keys (for prompts, for example).
479
488
480 * IPython/Prompts.py (BasePrompt.set_p_str): Fix to allow empty
489 * IPython/Prompts.py (BasePrompt.set_p_str): Fix to allow empty
481 prompts in case users want them. This introduces a small behavior
490 prompts in case users want them. This introduces a small behavior
482 change: ipython does not automatically add a space to all prompts
491 change: ipython does not automatically add a space to all prompts
483 anymore. To get the old prompts with a space, users should add it
492 anymore. To get the old prompts with a space, users should add it
484 manually to their ipythonrc file, so for example prompt_in1 should
493 manually to their ipythonrc file, so for example prompt_in1 should
485 now read 'In [\#]: ' instead of 'In [\#]:'.
494 now read 'In [\#]: ' instead of 'In [\#]:'.
486 (BasePrompt.__init__): New option prompts_pad_left (only in rc
495 (BasePrompt.__init__): New option prompts_pad_left (only in rc
487 file) to control left-padding of secondary prompts.
496 file) to control left-padding of secondary prompts.
488
497
489 * IPython/Magic.py (Magic.profile_missing_notice): Don't crash if
498 * IPython/Magic.py (Magic.profile_missing_notice): Don't crash if
490 the profiler can't be imported. Fix for Debian, which removed
499 the profiler can't be imported. Fix for Debian, which removed
491 profile.py because of License issues. I applied a slightly
500 profile.py because of License issues. I applied a slightly
492 modified version of the original Debian patch at
501 modified version of the original Debian patch at
493 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=294500.
502 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=294500.
494
503
495 2005-02-17 Fernando Perez <fperez@colorado.edu>
504 2005-02-17 Fernando Perez <fperez@colorado.edu>
496
505
497 * IPython/genutils.py (native_line_ends): Fix bug which would
506 * IPython/genutils.py (native_line_ends): Fix bug which would
498 cause improper line-ends under win32 b/c I was not opening files
507 cause improper line-ends under win32 b/c I was not opening files
499 in binary mode. Bug report and fix thanks to Ville.
508 in binary mode. Bug report and fix thanks to Ville.
500
509
501 * IPython/iplib.py (handle_auto): Fix bug which I introduced when
510 * IPython/iplib.py (handle_auto): Fix bug which I introduced when
502 trying to catch spurious foo[1] autocalls. My fix actually broke
511 trying to catch spurious foo[1] autocalls. My fix actually broke
503 ',/' autoquote/call with explicit escape (bad regexp).
512 ',/' autoquote/call with explicit escape (bad regexp).
504
513
505 2005-02-15 *** Released version 0.6.11
514 2005-02-15 *** Released version 0.6.11
506
515
507 2005-02-14 Fernando Perez <fperez@colorado.edu>
516 2005-02-14 Fernando Perez <fperez@colorado.edu>
508
517
509 * IPython/background_jobs.py: New background job management
518 * IPython/background_jobs.py: New background job management
510 subsystem. This is implemented via a new set of classes, and
519 subsystem. This is implemented via a new set of classes, and
511 IPython now provides a builtin 'jobs' object for background job
520 IPython now provides a builtin 'jobs' object for background job
512 execution. A convenience %bg magic serves as a lightweight
521 execution. A convenience %bg magic serves as a lightweight
513 frontend for starting the more common type of calls. This was
522 frontend for starting the more common type of calls. This was
514 inspired by discussions with B. Granger and the BackgroundCommand
523 inspired by discussions with B. Granger and the BackgroundCommand
515 class described in the book Python Scripting for Computational
524 class described in the book Python Scripting for Computational
516 Science, by H. P. Langtangen: http://folk.uio.no/hpl/scripting
525 Science, by H. P. Langtangen: http://folk.uio.no/hpl/scripting
517 (although ultimately no code from this text was used, as IPython's
526 (although ultimately no code from this text was used, as IPython's
518 system is a separate implementation).
527 system is a separate implementation).
519
528
520 * IPython/iplib.py (MagicCompleter.python_matches): add new option
529 * IPython/iplib.py (MagicCompleter.python_matches): add new option
521 to control the completion of single/double underscore names
530 to control the completion of single/double underscore names
522 separately. As documented in the example ipytonrc file, the
531 separately. As documented in the example ipytonrc file, the
523 readline_omit__names variable can now be set to 2, to omit even
532 readline_omit__names variable can now be set to 2, to omit even
524 single underscore names. Thanks to a patch by Brian Wong
533 single underscore names. Thanks to a patch by Brian Wong
525 <BrianWong-AT-AirgoNetworks.Com>.
534 <BrianWong-AT-AirgoNetworks.Com>.
526 (InteractiveShell.__init__): Fix bug which would cause foo[1] to
535 (InteractiveShell.__init__): Fix bug which would cause foo[1] to
527 be autocalled as foo([1]) if foo were callable. A problem for
536 be autocalled as foo([1]) if foo were callable. A problem for
528 things which are both callable and implement __getitem__.
537 things which are both callable and implement __getitem__.
529 (init_readline): Fix autoindentation for win32. Thanks to a patch
538 (init_readline): Fix autoindentation for win32. Thanks to a patch
530 by Vivian De Smedt <vivian-AT-vdesmedt.com>.
539 by Vivian De Smedt <vivian-AT-vdesmedt.com>.
531
540
532 2005-02-12 Fernando Perez <fperez@colorado.edu>
541 2005-02-12 Fernando Perez <fperez@colorado.edu>
533
542
534 * IPython/ipmaker.py (make_IPython): Disabled the stout traps
543 * IPython/ipmaker.py (make_IPython): Disabled the stout traps
535 which I had written long ago to sort out user error messages which
544 which I had written long ago to sort out user error messages which
536 may occur during startup. This seemed like a good idea initially,
545 may occur during startup. This seemed like a good idea initially,
537 but it has proven a disaster in retrospect. I don't want to
546 but it has proven a disaster in retrospect. I don't want to
538 change much code for now, so my fix is to set the internal 'debug'
547 change much code for now, so my fix is to set the internal 'debug'
539 flag to true everywhere, whose only job was precisely to control
548 flag to true everywhere, whose only job was precisely to control
540 this subsystem. This closes issue 28 (as well as avoiding all
549 this subsystem. This closes issue 28 (as well as avoiding all
541 sorts of strange hangups which occur from time to time).
550 sorts of strange hangups which occur from time to time).
542
551
543 2005-02-07 Fernando Perez <fperez@colorado.edu>
552 2005-02-07 Fernando Perez <fperez@colorado.edu>
544
553
545 * IPython/Magic.py (magic_edit): Fix 'ed -p' not working when the
554 * IPython/Magic.py (magic_edit): Fix 'ed -p' not working when the
546 previous call produced a syntax error.
555 previous call produced a syntax error.
547
556
548 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
557 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
549 classes without constructor.
558 classes without constructor.
550
559
551 2005-02-06 Fernando Perez <fperez@colorado.edu>
560 2005-02-06 Fernando Perez <fperez@colorado.edu>
552
561
553 * IPython/iplib.py (MagicCompleter.complete): Extend the list of
562 * IPython/iplib.py (MagicCompleter.complete): Extend the list of
554 completions with the results of each matcher, so we return results
563 completions with the results of each matcher, so we return results
555 to the user from all namespaces. This breaks with ipython
564 to the user from all namespaces. This breaks with ipython
556 tradition, but I think it's a nicer behavior. Now you get all
565 tradition, but I think it's a nicer behavior. Now you get all
557 possible completions listed, from all possible namespaces (python,
566 possible completions listed, from all possible namespaces (python,
558 filesystem, magics...) After a request by John Hunter
567 filesystem, magics...) After a request by John Hunter
559 <jdhunter-AT-nitace.bsd.uchicago.edu>.
568 <jdhunter-AT-nitace.bsd.uchicago.edu>.
560
569
561 2005-02-05 Fernando Perez <fperez@colorado.edu>
570 2005-02-05 Fernando Perez <fperez@colorado.edu>
562
571
563 * IPython/Magic.py (magic_prun): Fix bug where prun would fail if
572 * IPython/Magic.py (magic_prun): Fix bug where prun would fail if
564 the call had quote characters in it (the quotes were stripped).
573 the call had quote characters in it (the quotes were stripped).
565
574
566 2005-01-31 Fernando Perez <fperez@colorado.edu>
575 2005-01-31 Fernando Perez <fperez@colorado.edu>
567
576
568 * IPython/iplib.py (InteractiveShell.__init__): reduce reliance on
577 * IPython/iplib.py (InteractiveShell.__init__): reduce reliance on
569 Itpl.itpl() to make the code more robust against psyco
578 Itpl.itpl() to make the code more robust against psyco
570 optimizations.
579 optimizations.
571
580
572 * IPython/Itpl.py (Itpl.__str__): Use a _getframe() call instead
581 * IPython/Itpl.py (Itpl.__str__): Use a _getframe() call instead
573 of causing an exception. Quicker, cleaner.
582 of causing an exception. Quicker, cleaner.
574
583
575 2005-01-28 Fernando Perez <fperez@colorado.edu>
584 2005-01-28 Fernando Perez <fperez@colorado.edu>
576
585
577 * scripts/ipython_win_post_install.py (install): hardcode
586 * scripts/ipython_win_post_install.py (install): hardcode
578 sys.prefix+'python.exe' as the executable path. It turns out that
587 sys.prefix+'python.exe' as the executable path. It turns out that
579 during the post-installation run, sys.executable resolves to the
588 during the post-installation run, sys.executable resolves to the
580 name of the binary installer! I should report this as a distutils
589 name of the binary installer! I should report this as a distutils
581 bug, I think. I updated the .10 release with this tiny fix, to
590 bug, I think. I updated the .10 release with this tiny fix, to
582 avoid annoying the lists further.
591 avoid annoying the lists further.
583
592
584 2005-01-27 *** Released version 0.6.10
593 2005-01-27 *** Released version 0.6.10
585
594
586 2005-01-27 Fernando Perez <fperez@colorado.edu>
595 2005-01-27 Fernando Perez <fperez@colorado.edu>
587
596
588 * IPython/numutils.py (norm): Added 'inf' as optional name for
597 * IPython/numutils.py (norm): Added 'inf' as optional name for
589 L-infinity norm, included references to mathworld.com for vector
598 L-infinity norm, included references to mathworld.com for vector
590 norm definitions.
599 norm definitions.
591 (amin/amax): added amin/amax for array min/max. Similar to what
600 (amin/amax): added amin/amax for array min/max. Similar to what
592 pylab ships with after the recent reorganization of names.
601 pylab ships with after the recent reorganization of names.
593 (spike/spike_odd): removed deprecated spike/spike_odd functions.
602 (spike/spike_odd): removed deprecated spike/spike_odd functions.
594
603
595 * ipython.el: committed Alex's recent fixes and improvements.
604 * ipython.el: committed Alex's recent fixes and improvements.
596 Tested with python-mode from CVS, and it looks excellent. Since
605 Tested with python-mode from CVS, and it looks excellent. Since
597 python-mode hasn't released anything in a while, I'm temporarily
606 python-mode hasn't released anything in a while, I'm temporarily
598 putting a copy of today's CVS (v 4.70) of python-mode in:
607 putting a copy of today's CVS (v 4.70) of python-mode in:
599 http://ipython.scipy.org/tmp/python-mode.el
608 http://ipython.scipy.org/tmp/python-mode.el
600
609
601 * scripts/ipython_win_post_install.py (install): Win32 fix to use
610 * scripts/ipython_win_post_install.py (install): Win32 fix to use
602 sys.executable for the executable name, instead of assuming it's
611 sys.executable for the executable name, instead of assuming it's
603 called 'python.exe' (the post-installer would have produced broken
612 called 'python.exe' (the post-installer would have produced broken
604 setups on systems with a differently named python binary).
613 setups on systems with a differently named python binary).
605
614
606 * IPython/PyColorize.py (Parser.__call__): change explicit '\n'
615 * IPython/PyColorize.py (Parser.__call__): change explicit '\n'
607 references to os.linesep, to make the code more
616 references to os.linesep, to make the code more
608 platform-independent. This is also part of the win32 coloring
617 platform-independent. This is also part of the win32 coloring
609 fixes.
618 fixes.
610
619
611 * IPython/genutils.py (page_dumb): Remove attempts to chop long
620 * IPython/genutils.py (page_dumb): Remove attempts to chop long
612 lines, which actually cause coloring bugs because the length of
621 lines, which actually cause coloring bugs because the length of
613 the line is very difficult to correctly compute with embedded
622 the line is very difficult to correctly compute with embedded
614 escapes. This was the source of all the coloring problems under
623 escapes. This was the source of all the coloring problems under
615 Win32. I think that _finally_, Win32 users have a properly
624 Win32. I think that _finally_, Win32 users have a properly
616 working ipython in all respects. This would never have happened
625 working ipython in all respects. This would never have happened
617 if not for Gary Bishop and Viktor Ransmayr's great help and work.
626 if not for Gary Bishop and Viktor Ransmayr's great help and work.
618
627
619 2005-01-26 *** Released version 0.6.9
628 2005-01-26 *** Released version 0.6.9
620
629
621 2005-01-25 Fernando Perez <fperez@colorado.edu>
630 2005-01-25 Fernando Perez <fperez@colorado.edu>
622
631
623 * setup.py: finally, we have a true Windows installer, thanks to
632 * setup.py: finally, we have a true Windows installer, thanks to
624 the excellent work of Viktor Ransmayr
633 the excellent work of Viktor Ransmayr
625 <viktor.ransmayr-AT-t-online.de>. The docs have been updated for
634 <viktor.ransmayr-AT-t-online.de>. The docs have been updated for
626 Windows users. The setup routine is quite a bit cleaner thanks to
635 Windows users. The setup routine is quite a bit cleaner thanks to
627 this, and the post-install script uses the proper functions to
636 this, and the post-install script uses the proper functions to
628 allow a clean de-installation using the standard Windows Control
637 allow a clean de-installation using the standard Windows Control
629 Panel.
638 Panel.
630
639
631 * IPython/genutils.py (get_home_dir): changed to use the $HOME
640 * IPython/genutils.py (get_home_dir): changed to use the $HOME
632 environment variable under all OSes (including win32) if
641 environment variable under all OSes (including win32) if
633 available. This will give consistency to win32 users who have set
642 available. This will give consistency to win32 users who have set
634 this variable for any reason. If os.environ['HOME'] fails, the
643 this variable for any reason. If os.environ['HOME'] fails, the
635 previous policy of using HOMEDRIVE\HOMEPATH kicks in.
644 previous policy of using HOMEDRIVE\HOMEPATH kicks in.
636
645
637 2005-01-24 Fernando Perez <fperez@colorado.edu>
646 2005-01-24 Fernando Perez <fperez@colorado.edu>
638
647
639 * IPython/numutils.py (empty_like): add empty_like(), similar to
648 * IPython/numutils.py (empty_like): add empty_like(), similar to
640 zeros_like() but taking advantage of the new empty() Numeric routine.
649 zeros_like() but taking advantage of the new empty() Numeric routine.
641
650
642 2005-01-23 *** Released version 0.6.8
651 2005-01-23 *** Released version 0.6.8
643
652
644 2005-01-22 Fernando Perez <fperez@colorado.edu>
653 2005-01-22 Fernando Perez <fperez@colorado.edu>
645
654
646 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): I removed the
655 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): I removed the
647 automatic show() calls. After discussing things with JDH, it
656 automatic show() calls. After discussing things with JDH, it
648 turns out there are too many corner cases where this can go wrong.
657 turns out there are too many corner cases where this can go wrong.
649 It's best not to try to be 'too smart', and simply have ipython
658 It's best not to try to be 'too smart', and simply have ipython
650 reproduce as much as possible the default behavior of a normal
659 reproduce as much as possible the default behavior of a normal
651 python shell.
660 python shell.
652
661
653 * IPython/iplib.py (InteractiveShell.__init__): Modified the
662 * IPython/iplib.py (InteractiveShell.__init__): Modified the
654 line-splitting regexp and _prefilter() to avoid calling getattr()
663 line-splitting regexp and _prefilter() to avoid calling getattr()
655 on assignments. This closes
664 on assignments. This closes
656 http://www.scipy.net/roundup/ipython/issue24. Note that Python's
665 http://www.scipy.net/roundup/ipython/issue24. Note that Python's
657 readline uses getattr(), so a simple <TAB> keypress is still
666 readline uses getattr(), so a simple <TAB> keypress is still
658 enough to trigger getattr() calls on an object.
667 enough to trigger getattr() calls on an object.
659
668
660 2005-01-21 Fernando Perez <fperez@colorado.edu>
669 2005-01-21 Fernando Perez <fperez@colorado.edu>
661
670
662 * IPython/Shell.py (MatplotlibShellBase.magic_run): Fix the %run
671 * IPython/Shell.py (MatplotlibShellBase.magic_run): Fix the %run
663 docstring under pylab so it doesn't mask the original.
672 docstring under pylab so it doesn't mask the original.
664
673
665 2005-01-21 *** Released version 0.6.7
674 2005-01-21 *** Released version 0.6.7
666
675
667 2005-01-21 Fernando Perez <fperez@colorado.edu>
676 2005-01-21 Fernando Perez <fperez@colorado.edu>
668
677
669 * IPython/Shell.py (MTInteractiveShell.runcode): Trap a crash with
678 * IPython/Shell.py (MTInteractiveShell.runcode): Trap a crash with
670 signal handling for win32 users in multithreaded mode.
679 signal handling for win32 users in multithreaded mode.
671
680
672 2005-01-17 Fernando Perez <fperez@colorado.edu>
681 2005-01-17 Fernando Perez <fperez@colorado.edu>
673
682
674 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
683 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
675 instances with no __init__. After a crash report by Norbert Nemec
684 instances with no __init__. After a crash report by Norbert Nemec
676 <Norbert-AT-nemec-online.de>.
685 <Norbert-AT-nemec-online.de>.
677
686
678 2005-01-14 Fernando Perez <fperez@colorado.edu>
687 2005-01-14 Fernando Perez <fperez@colorado.edu>
679
688
680 * IPython/ultraTB.py (VerboseTB.text): Fix bug in reporting of
689 * IPython/ultraTB.py (VerboseTB.text): Fix bug in reporting of
681 names for verbose exceptions, when multiple dotted names and the
690 names for verbose exceptions, when multiple dotted names and the
682 'parent' object were present on the same line.
691 'parent' object were present on the same line.
683
692
684 2005-01-11 Fernando Perez <fperez@colorado.edu>
693 2005-01-11 Fernando Perez <fperez@colorado.edu>
685
694
686 * IPython/genutils.py (flag_calls): new utility to trap and flag
695 * IPython/genutils.py (flag_calls): new utility to trap and flag
687 calls in functions. I need it to clean up matplotlib support.
696 calls in functions. I need it to clean up matplotlib support.
688 Also removed some deprecated code in genutils.
697 Also removed some deprecated code in genutils.
689
698
690 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): small fix so
699 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): small fix so
691 that matplotlib scripts called with %run, which don't call show()
700 that matplotlib scripts called with %run, which don't call show()
692 themselves, still have their plotting windows open.
701 themselves, still have their plotting windows open.
693
702
694 2005-01-05 Fernando Perez <fperez@colorado.edu>
703 2005-01-05 Fernando Perez <fperez@colorado.edu>
695
704
696 * IPython/Shell.py (IPShellGTK.__init__): Patch by Andrew Straw
705 * IPython/Shell.py (IPShellGTK.__init__): Patch by Andrew Straw
697 <astraw-AT-caltech.edu>, to fix gtk deprecation warnings.
706 <astraw-AT-caltech.edu>, to fix gtk deprecation warnings.
698
707
699 2004-12-19 Fernando Perez <fperez@colorado.edu>
708 2004-12-19 Fernando Perez <fperez@colorado.edu>
700
709
701 * IPython/Shell.py (MTInteractiveShell.runcode): Get rid of
710 * IPython/Shell.py (MTInteractiveShell.runcode): Get rid of
702 parent_runcode, which was an eyesore. The same result can be
711 parent_runcode, which was an eyesore. The same result can be
703 obtained with Python's regular superclass mechanisms.
712 obtained with Python's regular superclass mechanisms.
704
713
705 2004-12-17 Fernando Perez <fperez@colorado.edu>
714 2004-12-17 Fernando Perez <fperez@colorado.edu>
706
715
707 * IPython/Magic.py (Magic.magic_sc): Fix quote stripping problem
716 * IPython/Magic.py (Magic.magic_sc): Fix quote stripping problem
708 reported by Prabhu.
717 reported by Prabhu.
709 (Magic.magic_sx): direct all errors to Term.cerr (defaults to
718 (Magic.magic_sx): direct all errors to Term.cerr (defaults to
710 sys.stderr) instead of explicitly calling sys.stderr. This helps
719 sys.stderr) instead of explicitly calling sys.stderr. This helps
711 maintain our I/O abstractions clean, for future GUI embeddings.
720 maintain our I/O abstractions clean, for future GUI embeddings.
712
721
713 * IPython/genutils.py (info): added new utility for sys.stderr
722 * IPython/genutils.py (info): added new utility for sys.stderr
714 unified info message handling (thin wrapper around warn()).
723 unified info message handling (thin wrapper around warn()).
715
724
716 * IPython/ultraTB.py (VerboseTB.text): Fix misreported global
725 * IPython/ultraTB.py (VerboseTB.text): Fix misreported global
717 composite (dotted) names on verbose exceptions.
726 composite (dotted) names on verbose exceptions.
718 (VerboseTB.nullrepr): harden against another kind of errors which
727 (VerboseTB.nullrepr): harden against another kind of errors which
719 Python's inspect module can trigger, and which were crashing
728 Python's inspect module can trigger, and which were crashing
720 IPython. Thanks to a report by Marco Lombardi
729 IPython. Thanks to a report by Marco Lombardi
721 <mlombard-AT-ma010192.hq.eso.org>.
730 <mlombard-AT-ma010192.hq.eso.org>.
722
731
723 2004-12-13 *** Released version 0.6.6
732 2004-12-13 *** Released version 0.6.6
724
733
725 2004-12-12 Fernando Perez <fperez@colorado.edu>
734 2004-12-12 Fernando Perez <fperez@colorado.edu>
726
735
727 * IPython/Shell.py (IPShellGTK.mainloop): catch RuntimeErrors
736 * IPython/Shell.py (IPShellGTK.mainloop): catch RuntimeErrors
728 generated by pygtk upon initialization if it was built without
737 generated by pygtk upon initialization if it was built without
729 threads (for matplotlib users). After a crash reported by
738 threads (for matplotlib users). After a crash reported by
730 Leguijt, Jaap J SIEP-EPT-RES <Jaap.Leguijt-AT-shell.com>.
739 Leguijt, Jaap J SIEP-EPT-RES <Jaap.Leguijt-AT-shell.com>.
731
740
732 * IPython/ipmaker.py (make_IPython): fix small bug in the
741 * IPython/ipmaker.py (make_IPython): fix small bug in the
733 import_some parameter for multiple imports.
742 import_some parameter for multiple imports.
734
743
735 * IPython/iplib.py (ipmagic): simplified the interface of
744 * IPython/iplib.py (ipmagic): simplified the interface of
736 ipmagic() to take a single string argument, just as it would be
745 ipmagic() to take a single string argument, just as it would be
737 typed at the IPython cmd line.
746 typed at the IPython cmd line.
738 (ipalias): Added new ipalias() with an interface identical to
747 (ipalias): Added new ipalias() with an interface identical to
739 ipmagic(). This completes exposing a pure python interface to the
748 ipmagic(). This completes exposing a pure python interface to the
740 alias and magic system, which can be used in loops or more complex
749 alias and magic system, which can be used in loops or more complex
741 code where IPython's automatic line mangling is not active.
750 code where IPython's automatic line mangling is not active.
742
751
743 * IPython/genutils.py (timing): changed interface of timing to
752 * IPython/genutils.py (timing): changed interface of timing to
744 simply run code once, which is the most common case. timings()
753 simply run code once, which is the most common case. timings()
745 remains unchanged, for the cases where you want multiple runs.
754 remains unchanged, for the cases where you want multiple runs.
746
755
747 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix a
756 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix a
748 bug where Python2.2 crashes with exec'ing code which does not end
757 bug where Python2.2 crashes with exec'ing code which does not end
749 in a single newline. Python 2.3 is OK, so I hadn't noticed this
758 in a single newline. Python 2.3 is OK, so I hadn't noticed this
750 before.
759 before.
751
760
752 2004-12-10 Fernando Perez <fperez@colorado.edu>
761 2004-12-10 Fernando Perez <fperez@colorado.edu>
753
762
754 * IPython/Magic.py (Magic.magic_prun): changed name of option from
763 * IPython/Magic.py (Magic.magic_prun): changed name of option from
755 -t to -T, to accomodate the new -t flag in %run (the %run and
764 -t to -T, to accomodate the new -t flag in %run (the %run and
756 %prun options are kind of intermixed, and it's not easy to change
765 %prun options are kind of intermixed, and it's not easy to change
757 this with the limitations of python's getopt).
766 this with the limitations of python's getopt).
758
767
759 * IPython/Magic.py (Magic.magic_run): Added new -t option to time
768 * IPython/Magic.py (Magic.magic_run): Added new -t option to time
760 the execution of scripts. It's not as fine-tuned as timeit.py,
769 the execution of scripts. It's not as fine-tuned as timeit.py,
761 but it works from inside ipython (and under 2.2, which lacks
770 but it works from inside ipython (and under 2.2, which lacks
762 timeit.py). Optionally a number of runs > 1 can be given for
771 timeit.py). Optionally a number of runs > 1 can be given for
763 timing very short-running code.
772 timing very short-running code.
764
773
765 * IPython/genutils.py (uniq_stable): new routine which returns a
774 * IPython/genutils.py (uniq_stable): new routine which returns a
766 list of unique elements in any iterable, but in stable order of
775 list of unique elements in any iterable, but in stable order of
767 appearance. I needed this for the ultraTB fixes, and it's a handy
776 appearance. I needed this for the ultraTB fixes, and it's a handy
768 utility.
777 utility.
769
778
770 * IPython/ultraTB.py (VerboseTB.text): Fix proper reporting of
779 * IPython/ultraTB.py (VerboseTB.text): Fix proper reporting of
771 dotted names in Verbose exceptions. This had been broken since
780 dotted names in Verbose exceptions. This had been broken since
772 the very start, now x.y will properly be printed in a Verbose
781 the very start, now x.y will properly be printed in a Verbose
773 traceback, instead of x being shown and y appearing always as an
782 traceback, instead of x being shown and y appearing always as an
774 'undefined global'. Getting this to work was a bit tricky,
783 'undefined global'. Getting this to work was a bit tricky,
775 because by default python tokenizers are stateless. Saved by
784 because by default python tokenizers are stateless. Saved by
776 python's ability to easily add a bit of state to an arbitrary
785 python's ability to easily add a bit of state to an arbitrary
777 function (without needing to build a full-blown callable object).
786 function (without needing to build a full-blown callable object).
778
787
779 Also big cleanup of this code, which had horrendous runtime
788 Also big cleanup of this code, which had horrendous runtime
780 lookups of zillions of attributes for colorization. Moved all
789 lookups of zillions of attributes for colorization. Moved all
781 this code into a few templates, which make it cleaner and quicker.
790 this code into a few templates, which make it cleaner and quicker.
782
791
783 Printout quality was also improved for Verbose exceptions: one
792 Printout quality was also improved for Verbose exceptions: one
784 variable per line, and memory addresses are printed (this can be
793 variable per line, and memory addresses are printed (this can be
785 quite handy in nasty debugging situations, which is what Verbose
794 quite handy in nasty debugging situations, which is what Verbose
786 is for).
795 is for).
787
796
788 * IPython/ipmaker.py (make_IPython): Do NOT execute files named in
797 * IPython/ipmaker.py (make_IPython): Do NOT execute files named in
789 the command line as scripts to be loaded by embedded instances.
798 the command line as scripts to be loaded by embedded instances.
790 Doing so has the potential for an infinite recursion if there are
799 Doing so has the potential for an infinite recursion if there are
791 exceptions thrown in the process. This fixes a strange crash
800 exceptions thrown in the process. This fixes a strange crash
792 reported by Philippe MULLER <muller-AT-irit.fr>.
801 reported by Philippe MULLER <muller-AT-irit.fr>.
793
802
794 2004-12-09 Fernando Perez <fperez@colorado.edu>
803 2004-12-09 Fernando Perez <fperez@colorado.edu>
795
804
796 * IPython/Shell.py (MatplotlibShellBase.use): Change pylab support
805 * IPython/Shell.py (MatplotlibShellBase.use): Change pylab support
797 to reflect new names in matplotlib, which now expose the
806 to reflect new names in matplotlib, which now expose the
798 matlab-compatible interface via a pylab module instead of the
807 matlab-compatible interface via a pylab module instead of the
799 'matlab' name. The new code is backwards compatible, so users of
808 'matlab' name. The new code is backwards compatible, so users of
800 all matplotlib versions are OK. Patch by J. Hunter.
809 all matplotlib versions are OK. Patch by J. Hunter.
801
810
802 * IPython/OInspect.py (Inspector.pinfo): Add to object? printing
811 * IPython/OInspect.py (Inspector.pinfo): Add to object? printing
803 of __init__ docstrings for instances (class docstrings are already
812 of __init__ docstrings for instances (class docstrings are already
804 automatically printed). Instances with customized docstrings
813 automatically printed). Instances with customized docstrings
805 (indep. of the class) are also recognized and all 3 separate
814 (indep. of the class) are also recognized and all 3 separate
806 docstrings are printed (instance, class, constructor). After some
815 docstrings are printed (instance, class, constructor). After some
807 comments/suggestions by J. Hunter.
816 comments/suggestions by J. Hunter.
808
817
809 2004-12-05 Fernando Perez <fperez@colorado.edu>
818 2004-12-05 Fernando Perez <fperez@colorado.edu>
810
819
811 * IPython/iplib.py (MagicCompleter.complete): Remove annoying
820 * IPython/iplib.py (MagicCompleter.complete): Remove annoying
812 warnings when tab-completion fails and triggers an exception.
821 warnings when tab-completion fails and triggers an exception.
813
822
814 2004-12-03 Fernando Perez <fperez@colorado.edu>
823 2004-12-03 Fernando Perez <fperez@colorado.edu>
815
824
816 * IPython/Magic.py (magic_prun): Fix bug where an exception would
825 * IPython/Magic.py (magic_prun): Fix bug where an exception would
817 be triggered when using 'run -p'. An incorrect option flag was
826 be triggered when using 'run -p'. An incorrect option flag was
818 being set ('d' instead of 'D').
827 being set ('d' instead of 'D').
819 (manpage): fix missing escaped \- sign.
828 (manpage): fix missing escaped \- sign.
820
829
821 2004-11-30 *** Released version 0.6.5
830 2004-11-30 *** Released version 0.6.5
822
831
823 2004-11-30 Fernando Perez <fperez@colorado.edu>
832 2004-11-30 Fernando Perez <fperez@colorado.edu>
824
833
825 * IPython/Magic.py (Magic.magic_run): Fix bug in breakpoint
834 * IPython/Magic.py (Magic.magic_run): Fix bug in breakpoint
826 setting with -d option.
835 setting with -d option.
827
836
828 * setup.py (docfiles): Fix problem where the doc glob I was using
837 * setup.py (docfiles): Fix problem where the doc glob I was using
829 was COMPLETELY BROKEN. It was giving the right files by pure
838 was COMPLETELY BROKEN. It was giving the right files by pure
830 accident, but failed once I tried to include ipython.el. Note:
839 accident, but failed once I tried to include ipython.el. Note:
831 glob() does NOT allow you to do exclusion on multiple endings!
840 glob() does NOT allow you to do exclusion on multiple endings!
832
841
833 2004-11-29 Fernando Perez <fperez@colorado.edu>
842 2004-11-29 Fernando Perez <fperez@colorado.edu>
834
843
835 * IPython/usage.py (__doc__): cleaned up usage docstring, by using
844 * IPython/usage.py (__doc__): cleaned up usage docstring, by using
836 the manpage as the source. Better formatting & consistency.
845 the manpage as the source. Better formatting & consistency.
837
846
838 * IPython/Magic.py (magic_run): Added new -d option, to run
847 * IPython/Magic.py (magic_run): Added new -d option, to run
839 scripts under the control of the python pdb debugger. Note that
848 scripts under the control of the python pdb debugger. Note that
840 this required changing the %prun option -d to -D, to avoid a clash
849 this required changing the %prun option -d to -D, to avoid a clash
841 (since %run must pass options to %prun, and getopt is too dumb to
850 (since %run must pass options to %prun, and getopt is too dumb to
842 handle options with string values with embedded spaces). Thanks
851 handle options with string values with embedded spaces). Thanks
843 to a suggestion by Matthew Arnison <maffew-AT-cat.org.au>.
852 to a suggestion by Matthew Arnison <maffew-AT-cat.org.au>.
844 (magic_who_ls): added type matching to %who and %whos, so that one
853 (magic_who_ls): added type matching to %who and %whos, so that one
845 can filter their output to only include variables of certain
854 can filter their output to only include variables of certain
846 types. Another suggestion by Matthew.
855 types. Another suggestion by Matthew.
847 (magic_whos): Added memory summaries in kb and Mb for arrays.
856 (magic_whos): Added memory summaries in kb and Mb for arrays.
848 (magic_who): Improve formatting (break lines every 9 vars).
857 (magic_who): Improve formatting (break lines every 9 vars).
849
858
850 2004-11-28 Fernando Perez <fperez@colorado.edu>
859 2004-11-28 Fernando Perez <fperez@colorado.edu>
851
860
852 * IPython/Logger.py (Logger.log): Fix bug in syncing the input
861 * IPython/Logger.py (Logger.log): Fix bug in syncing the input
853 cache when empty lines were present.
862 cache when empty lines were present.
854
863
855 2004-11-24 Fernando Perez <fperez@colorado.edu>
864 2004-11-24 Fernando Perez <fperez@colorado.edu>
856
865
857 * IPython/usage.py (__doc__): document the re-activated threading
866 * IPython/usage.py (__doc__): document the re-activated threading
858 options for WX and GTK.
867 options for WX and GTK.
859
868
860 2004-11-23 Fernando Perez <fperez@colorado.edu>
869 2004-11-23 Fernando Perez <fperez@colorado.edu>
861
870
862 * IPython/Shell.py (start): Added Prabhu's big patch to reactivate
871 * IPython/Shell.py (start): Added Prabhu's big patch to reactivate
863 the -wthread and -gthread options, along with a new -tk one to try
872 the -wthread and -gthread options, along with a new -tk one to try
864 and coordinate Tk threading with wx/gtk. The tk support is very
873 and coordinate Tk threading with wx/gtk. The tk support is very
865 platform dependent, since it seems to require Tcl and Tk to be
874 platform dependent, since it seems to require Tcl and Tk to be
866 built with threads (Fedora1/2 appears NOT to have it, but in
875 built with threads (Fedora1/2 appears NOT to have it, but in
867 Prabhu's Debian boxes it works OK). But even with some Tk
876 Prabhu's Debian boxes it works OK). But even with some Tk
868 limitations, this is a great improvement.
877 limitations, this is a great improvement.
869
878
870 * IPython/Prompts.py (prompt_specials_color): Added \t for time
879 * IPython/Prompts.py (prompt_specials_color): Added \t for time
871 info in user prompts. Patch by Prabhu.
880 info in user prompts. Patch by Prabhu.
872
881
873 2004-11-18 Fernando Perez <fperez@colorado.edu>
882 2004-11-18 Fernando Perez <fperez@colorado.edu>
874
883
875 * IPython/genutils.py (ask_yes_no): Add check for a max of 20
884 * IPython/genutils.py (ask_yes_no): Add check for a max of 20
876 EOFErrors and bail, to avoid infinite loops if a non-terminating
885 EOFErrors and bail, to avoid infinite loops if a non-terminating
877 file is fed into ipython. Patch submitted in issue 19 by user,
886 file is fed into ipython. Patch submitted in issue 19 by user,
878 many thanks.
887 many thanks.
879
888
880 * IPython/iplib.py (InteractiveShell.handle_auto): do NOT trigger
889 * IPython/iplib.py (InteractiveShell.handle_auto): do NOT trigger
881 autoquote/parens in continuation prompts, which can cause lots of
890 autoquote/parens in continuation prompts, which can cause lots of
882 problems. Closes roundup issue 20.
891 problems. Closes roundup issue 20.
883
892
884 2004-11-17 Fernando Perez <fperez@colorado.edu>
893 2004-11-17 Fernando Perez <fperez@colorado.edu>
885
894
886 * debian/control (Build-Depends-Indep): Fix dpatch dependency,
895 * debian/control (Build-Depends-Indep): Fix dpatch dependency,
887 reported as debian bug #280505. I'm not sure my local changelog
896 reported as debian bug #280505. I'm not sure my local changelog
888 entry has the proper debian format (Jack?).
897 entry has the proper debian format (Jack?).
889
898
890 2004-11-08 *** Released version 0.6.4
899 2004-11-08 *** Released version 0.6.4
891
900
892 2004-11-08 Fernando Perez <fperez@colorado.edu>
901 2004-11-08 Fernando Perez <fperez@colorado.edu>
893
902
894 * IPython/iplib.py (init_readline): Fix exit message for Windows
903 * IPython/iplib.py (init_readline): Fix exit message for Windows
895 when readline is active. Thanks to a report by Eric Jones
904 when readline is active. Thanks to a report by Eric Jones
896 <eric-AT-enthought.com>.
905 <eric-AT-enthought.com>.
897
906
898 2004-11-07 Fernando Perez <fperez@colorado.edu>
907 2004-11-07 Fernando Perez <fperez@colorado.edu>
899
908
900 * IPython/genutils.py (page): Add a trap for OSError exceptions,
909 * IPython/genutils.py (page): Add a trap for OSError exceptions,
901 sometimes seen by win2k/cygwin users.
910 sometimes seen by win2k/cygwin users.
902
911
903 2004-11-06 Fernando Perez <fperez@colorado.edu>
912 2004-11-06 Fernando Perez <fperez@colorado.edu>
904
913
905 * IPython/iplib.py (interact): Change the handling of %Exit from
914 * IPython/iplib.py (interact): Change the handling of %Exit from
906 trying to propagate a SystemExit to an internal ipython flag.
915 trying to propagate a SystemExit to an internal ipython flag.
907 This is less elegant than using Python's exception mechanism, but
916 This is less elegant than using Python's exception mechanism, but
908 I can't get that to work reliably with threads, so under -pylab
917 I can't get that to work reliably with threads, so under -pylab
909 %Exit was hanging IPython. Cross-thread exception handling is
918 %Exit was hanging IPython. Cross-thread exception handling is
910 really a bitch. Thaks to a bug report by Stephen Walton
919 really a bitch. Thaks to a bug report by Stephen Walton
911 <stephen.walton-AT-csun.edu>.
920 <stephen.walton-AT-csun.edu>.
912
921
913 2004-11-04 Fernando Perez <fperez@colorado.edu>
922 2004-11-04 Fernando Perez <fperez@colorado.edu>
914
923
915 * IPython/iplib.py (raw_input_original): store a pointer to the
924 * IPython/iplib.py (raw_input_original): store a pointer to the
916 true raw_input to harden against code which can modify it
925 true raw_input to harden against code which can modify it
917 (wx.py.PyShell does this and would otherwise crash ipython).
926 (wx.py.PyShell does this and would otherwise crash ipython).
918 Thanks to a bug report by Jim Flowers <james.flowers-AT-lgx.com>.
927 Thanks to a bug report by Jim Flowers <james.flowers-AT-lgx.com>.
919
928
920 * IPython/Shell.py (MTInteractiveShell.runsource): Cleaner fix for
929 * IPython/Shell.py (MTInteractiveShell.runsource): Cleaner fix for
921 Ctrl-C problem, which does not mess up the input line.
930 Ctrl-C problem, which does not mess up the input line.
922
931
923 2004-11-03 Fernando Perez <fperez@colorado.edu>
932 2004-11-03 Fernando Perez <fperez@colorado.edu>
924
933
925 * IPython/Release.py: Changed licensing to BSD, in all files.
934 * IPython/Release.py: Changed licensing to BSD, in all files.
926 (name): lowercase name for tarball/RPM release.
935 (name): lowercase name for tarball/RPM release.
927
936
928 * IPython/OInspect.py (getdoc): wrap inspect.getdoc() safely for
937 * IPython/OInspect.py (getdoc): wrap inspect.getdoc() safely for
929 use throughout ipython.
938 use throughout ipython.
930
939
931 * IPython/Magic.py (Magic._ofind): Switch to using the new
940 * IPython/Magic.py (Magic._ofind): Switch to using the new
932 OInspect.getdoc() function.
941 OInspect.getdoc() function.
933
942
934 * IPython/Shell.py (sigint_handler): Hack to ignore the execution
943 * IPython/Shell.py (sigint_handler): Hack to ignore the execution
935 of the line currently being canceled via Ctrl-C. It's extremely
944 of the line currently being canceled via Ctrl-C. It's extremely
936 ugly, but I don't know how to do it better (the problem is one of
945 ugly, but I don't know how to do it better (the problem is one of
937 handling cross-thread exceptions).
946 handling cross-thread exceptions).
938
947
939 2004-10-28 Fernando Perez <fperez@colorado.edu>
948 2004-10-28 Fernando Perez <fperez@colorado.edu>
940
949
941 * IPython/Shell.py (signal_handler): add signal handlers to trap
950 * IPython/Shell.py (signal_handler): add signal handlers to trap
942 SIGINT and SIGSEGV in threaded code properly. Thanks to a bug
951 SIGINT and SIGSEGV in threaded code properly. Thanks to a bug
943 report by Francesc Alted.
952 report by Francesc Alted.
944
953
945 2004-10-21 Fernando Perez <fperez@colorado.edu>
954 2004-10-21 Fernando Perez <fperez@colorado.edu>
946
955
947 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Fix @
956 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Fix @
948 to % for pysh syntax extensions.
957 to % for pysh syntax extensions.
949
958
950 2004-10-09 Fernando Perez <fperez@colorado.edu>
959 2004-10-09 Fernando Perez <fperez@colorado.edu>
951
960
952 * IPython/Magic.py (Magic.magic_whos): modify output of Numeric
961 * IPython/Magic.py (Magic.magic_whos): modify output of Numeric
953 arrays to print a more useful summary, without calling str(arr).
962 arrays to print a more useful summary, without calling str(arr).
954 This avoids the problem of extremely lengthy computations which
963 This avoids the problem of extremely lengthy computations which
955 occur if arr is large, and appear to the user as a system lockup
964 occur if arr is large, and appear to the user as a system lockup
956 with 100% cpu activity. After a suggestion by Kristian Sandberg
965 with 100% cpu activity. After a suggestion by Kristian Sandberg
957 <Kristian.Sandberg@colorado.edu>.
966 <Kristian.Sandberg@colorado.edu>.
958 (Magic.__init__): fix bug in global magic escapes not being
967 (Magic.__init__): fix bug in global magic escapes not being
959 correctly set.
968 correctly set.
960
969
961 2004-10-08 Fernando Perez <fperez@colorado.edu>
970 2004-10-08 Fernando Perez <fperez@colorado.edu>
962
971
963 * IPython/Magic.py (__license__): change to absolute imports of
972 * IPython/Magic.py (__license__): change to absolute imports of
964 ipython's own internal packages, to start adapting to the absolute
973 ipython's own internal packages, to start adapting to the absolute
965 import requirement of PEP-328.
974 import requirement of PEP-328.
966
975
967 * IPython/genutils.py (__author__): Fix coding to utf-8 on all
976 * IPython/genutils.py (__author__): Fix coding to utf-8 on all
968 files, and standardize author/license marks through the Release
977 files, and standardize author/license marks through the Release
969 module instead of having per/file stuff (except for files with
978 module instead of having per/file stuff (except for files with
970 particular licenses, like the MIT/PSF-licensed codes).
979 particular licenses, like the MIT/PSF-licensed codes).
971
980
972 * IPython/Debugger.py: remove dead code for python 2.1
981 * IPython/Debugger.py: remove dead code for python 2.1
973
982
974 2004-10-04 Fernando Perez <fperez@colorado.edu>
983 2004-10-04 Fernando Perez <fperez@colorado.edu>
975
984
976 * IPython/iplib.py (ipmagic): New function for accessing magics
985 * IPython/iplib.py (ipmagic): New function for accessing magics
977 via a normal python function call.
986 via a normal python function call.
978
987
979 * IPython/Magic.py (Magic.magic_magic): Change the magic escape
988 * IPython/Magic.py (Magic.magic_magic): Change the magic escape
980 from '@' to '%', to accomodate the new @decorator syntax of python
989 from '@' to '%', to accomodate the new @decorator syntax of python
981 2.4.
990 2.4.
982
991
983 2004-09-29 Fernando Perez <fperez@colorado.edu>
992 2004-09-29 Fernando Perez <fperez@colorado.edu>
984
993
985 * IPython/Shell.py (MatplotlibShellBase.use): Added a wrapper to
994 * IPython/Shell.py (MatplotlibShellBase.use): Added a wrapper to
986 matplotlib.use to prevent running scripts which try to switch
995 matplotlib.use to prevent running scripts which try to switch
987 interactive backends from within ipython. This will just crash
996 interactive backends from within ipython. This will just crash
988 the python interpreter, so we can't allow it (but a detailed error
997 the python interpreter, so we can't allow it (but a detailed error
989 is given to the user).
998 is given to the user).
990
999
991 2004-09-28 Fernando Perez <fperez@colorado.edu>
1000 2004-09-28 Fernando Perez <fperez@colorado.edu>
992
1001
993 * IPython/Shell.py (MatplotlibShellBase.mplot_exec):
1002 * IPython/Shell.py (MatplotlibShellBase.mplot_exec):
994 matplotlib-related fixes so that using @run with non-matplotlib
1003 matplotlib-related fixes so that using @run with non-matplotlib
995 scripts doesn't pop up spurious plot windows. This requires
1004 scripts doesn't pop up spurious plot windows. This requires
996 matplotlib >= 0.63, where I had to make some changes as well.
1005 matplotlib >= 0.63, where I had to make some changes as well.
997
1006
998 * IPython/ipmaker.py (make_IPython): update version requirement to
1007 * IPython/ipmaker.py (make_IPython): update version requirement to
999 python 2.2.
1008 python 2.2.
1000
1009
1001 * IPython/iplib.py (InteractiveShell.mainloop): Add an optional
1010 * IPython/iplib.py (InteractiveShell.mainloop): Add an optional
1002 banner arg for embedded customization.
1011 banner arg for embedded customization.
1003
1012
1004 * IPython/Magic.py (Magic.__init__): big cleanup to remove all
1013 * IPython/Magic.py (Magic.__init__): big cleanup to remove all
1005 explicit uses of __IP as the IPython's instance name. Now things
1014 explicit uses of __IP as the IPython's instance name. Now things
1006 are properly handled via the shell.name value. The actual code
1015 are properly handled via the shell.name value. The actual code
1007 is a bit ugly b/c I'm doing it via a global in Magic.py, but this
1016 is a bit ugly b/c I'm doing it via a global in Magic.py, but this
1008 is much better than before. I'll clean things completely when the
1017 is much better than before. I'll clean things completely when the
1009 magic stuff gets a real overhaul.
1018 magic stuff gets a real overhaul.
1010
1019
1011 * ipython.1: small fixes, sent in by Jack Moffit. He also sent in
1020 * ipython.1: small fixes, sent in by Jack Moffit. He also sent in
1012 minor changes to debian dir.
1021 minor changes to debian dir.
1013
1022
1014 * IPython/iplib.py (InteractiveShell.__init__): Fix adding a
1023 * IPython/iplib.py (InteractiveShell.__init__): Fix adding a
1015 pointer to the shell itself in the interactive namespace even when
1024 pointer to the shell itself in the interactive namespace even when
1016 a user-supplied dict is provided. This is needed for embedding
1025 a user-supplied dict is provided. This is needed for embedding
1017 purposes (found by tests with Michel Sanner).
1026 purposes (found by tests with Michel Sanner).
1018
1027
1019 2004-09-27 Fernando Perez <fperez@colorado.edu>
1028 2004-09-27 Fernando Perez <fperez@colorado.edu>
1020
1029
1021 * IPython/UserConfig/ipythonrc: remove []{} from
1030 * IPython/UserConfig/ipythonrc: remove []{} from
1022 readline_remove_delims, so that things like [modname.<TAB> do
1031 readline_remove_delims, so that things like [modname.<TAB> do
1023 proper completion. This disables [].TAB, but that's a less common
1032 proper completion. This disables [].TAB, but that's a less common
1024 case than module names in list comprehensions, for example.
1033 case than module names in list comprehensions, for example.
1025 Thanks to a report by Andrea Riciputi.
1034 Thanks to a report by Andrea Riciputi.
1026
1035
1027 2004-09-09 Fernando Perez <fperez@colorado.edu>
1036 2004-09-09 Fernando Perez <fperez@colorado.edu>
1028
1037
1029 * IPython/Shell.py (IPShellGTK.mainloop): reorder to avoid
1038 * IPython/Shell.py (IPShellGTK.mainloop): reorder to avoid
1030 blocking problems in win32 and osx. Fix by John.
1039 blocking problems in win32 and osx. Fix by John.
1031
1040
1032 2004-09-08 Fernando Perez <fperez@colorado.edu>
1041 2004-09-08 Fernando Perez <fperez@colorado.edu>
1033
1042
1034 * IPython/Shell.py (IPShellWX.OnInit): Fix output redirection bug
1043 * IPython/Shell.py (IPShellWX.OnInit): Fix output redirection bug
1035 for Win32 and OSX. Fix by John Hunter.
1044 for Win32 and OSX. Fix by John Hunter.
1036
1045
1037 2004-08-30 *** Released version 0.6.3
1046 2004-08-30 *** Released version 0.6.3
1038
1047
1039 2004-08-30 Fernando Perez <fperez@colorado.edu>
1048 2004-08-30 Fernando Perez <fperez@colorado.edu>
1040
1049
1041 * setup.py (isfile): Add manpages to list of dependent files to be
1050 * setup.py (isfile): Add manpages to list of dependent files to be
1042 updated.
1051 updated.
1043
1052
1044 2004-08-27 Fernando Perez <fperez@colorado.edu>
1053 2004-08-27 Fernando Perez <fperez@colorado.edu>
1045
1054
1046 * IPython/Shell.py (start): I've disabled -wthread and -gthread
1055 * IPython/Shell.py (start): I've disabled -wthread and -gthread
1047 for now. They don't really work with standalone WX/GTK code
1056 for now. They don't really work with standalone WX/GTK code
1048 (though matplotlib IS working fine with both of those backends).
1057 (though matplotlib IS working fine with both of those backends).
1049 This will neeed much more testing. I disabled most things with
1058 This will neeed much more testing. I disabled most things with
1050 comments, so turning it back on later should be pretty easy.
1059 comments, so turning it back on later should be pretty easy.
1051
1060
1052 * IPython/iplib.py (InteractiveShell.__init__): Fix accidental
1061 * IPython/iplib.py (InteractiveShell.__init__): Fix accidental
1053 autocalling of expressions like r'foo', by modifying the line
1062 autocalling of expressions like r'foo', by modifying the line
1054 split regexp. Closes
1063 split regexp. Closes
1055 http://www.scipy.net/roundup/ipython/issue18, reported by Nicholas
1064 http://www.scipy.net/roundup/ipython/issue18, reported by Nicholas
1056 Riley <ipythonbugs-AT-sabi.net>.
1065 Riley <ipythonbugs-AT-sabi.net>.
1057 (InteractiveShell.mainloop): honor --nobanner with banner
1066 (InteractiveShell.mainloop): honor --nobanner with banner
1058 extensions.
1067 extensions.
1059
1068
1060 * IPython/Shell.py: Significant refactoring of all classes, so
1069 * IPython/Shell.py: Significant refactoring of all classes, so
1061 that we can really support ALL matplotlib backends and threading
1070 that we can really support ALL matplotlib backends and threading
1062 models (John spotted a bug with Tk which required this). Now we
1071 models (John spotted a bug with Tk which required this). Now we
1063 should support single-threaded, WX-threads and GTK-threads, both
1072 should support single-threaded, WX-threads and GTK-threads, both
1064 for generic code and for matplotlib.
1073 for generic code and for matplotlib.
1065
1074
1066 * IPython/ipmaker.py (__call__): Changed -mpthread option to
1075 * IPython/ipmaker.py (__call__): Changed -mpthread option to
1067 -pylab, to simplify things for users. Will also remove the pylab
1076 -pylab, to simplify things for users. Will also remove the pylab
1068 profile, since now all of matplotlib configuration is directly
1077 profile, since now all of matplotlib configuration is directly
1069 handled here. This also reduces startup time.
1078 handled here. This also reduces startup time.
1070
1079
1071 * IPython/Shell.py (IPShellGTK.run): Fixed bug where mainloop() of
1080 * IPython/Shell.py (IPShellGTK.run): Fixed bug where mainloop() of
1072 shell wasn't being correctly called. Also in IPShellWX.
1081 shell wasn't being correctly called. Also in IPShellWX.
1073
1082
1074 * IPython/iplib.py (InteractiveShell.__init__): Added option to
1083 * IPython/iplib.py (InteractiveShell.__init__): Added option to
1075 fine-tune banner.
1084 fine-tune banner.
1076
1085
1077 * IPython/numutils.py (spike): Deprecate these spike functions,
1086 * IPython/numutils.py (spike): Deprecate these spike functions,
1078 delete (long deprecated) gnuplot_exec handler.
1087 delete (long deprecated) gnuplot_exec handler.
1079
1088
1080 2004-08-26 Fernando Perez <fperez@colorado.edu>
1089 2004-08-26 Fernando Perez <fperez@colorado.edu>
1081
1090
1082 * ipython.1: Update for threading options, plus some others which
1091 * ipython.1: Update for threading options, plus some others which
1083 were missing.
1092 were missing.
1084
1093
1085 * IPython/ipmaker.py (__call__): Added -wthread option for
1094 * IPython/ipmaker.py (__call__): Added -wthread option for
1086 wxpython thread handling. Make sure threading options are only
1095 wxpython thread handling. Make sure threading options are only
1087 valid at the command line.
1096 valid at the command line.
1088
1097
1089 * scripts/ipython: moved shell selection into a factory function
1098 * scripts/ipython: moved shell selection into a factory function
1090 in Shell.py, to keep the starter script to a minimum.
1099 in Shell.py, to keep the starter script to a minimum.
1091
1100
1092 2004-08-25 Fernando Perez <fperez@colorado.edu>
1101 2004-08-25 Fernando Perez <fperez@colorado.edu>
1093
1102
1094 * IPython/Shell.py (IPShellWX.wxexit): fixes to WX threading, by
1103 * IPython/Shell.py (IPShellWX.wxexit): fixes to WX threading, by
1095 John. Along with some recent changes he made to matplotlib, the
1104 John. Along with some recent changes he made to matplotlib, the
1096 next versions of both systems should work very well together.
1105 next versions of both systems should work very well together.
1097
1106
1098 2004-08-24 Fernando Perez <fperez@colorado.edu>
1107 2004-08-24 Fernando Perez <fperez@colorado.edu>
1099
1108
1100 * IPython/Magic.py (Magic.magic_prun): cleanup some dead code. I
1109 * IPython/Magic.py (Magic.magic_prun): cleanup some dead code. I
1101 tried to switch the profiling to using hotshot, but I'm getting
1110 tried to switch the profiling to using hotshot, but I'm getting
1102 strange errors from prof.runctx() there. I may be misreading the
1111 strange errors from prof.runctx() there. I may be misreading the
1103 docs, but it looks weird. For now the profiling code will
1112 docs, but it looks weird. For now the profiling code will
1104 continue to use the standard profiler.
1113 continue to use the standard profiler.
1105
1114
1106 2004-08-23 Fernando Perez <fperez@colorado.edu>
1115 2004-08-23 Fernando Perez <fperez@colorado.edu>
1107
1116
1108 * IPython/Shell.py (IPShellWX.__init__): Improvements to the WX
1117 * IPython/Shell.py (IPShellWX.__init__): Improvements to the WX
1109 threaded shell, by John Hunter. It's not quite ready yet, but
1118 threaded shell, by John Hunter. It's not quite ready yet, but
1110 close.
1119 close.
1111
1120
1112 2004-08-22 Fernando Perez <fperez@colorado.edu>
1121 2004-08-22 Fernando Perez <fperez@colorado.edu>
1113
1122
1114 * IPython/iplib.py (InteractiveShell.interact): tab cleanups, also
1123 * IPython/iplib.py (InteractiveShell.interact): tab cleanups, also
1115 in Magic and ultraTB.
1124 in Magic and ultraTB.
1116
1125
1117 * ipython.1: document threading options in manpage.
1126 * ipython.1: document threading options in manpage.
1118
1127
1119 * scripts/ipython: Changed name of -thread option to -gthread,
1128 * scripts/ipython: Changed name of -thread option to -gthread,
1120 since this is GTK specific. I want to leave the door open for a
1129 since this is GTK specific. I want to leave the door open for a
1121 -wthread option for WX, which will most likely be necessary. This
1130 -wthread option for WX, which will most likely be necessary. This
1122 change affects usage and ipmaker as well.
1131 change affects usage and ipmaker as well.
1123
1132
1124 * IPython/Shell.py (matplotlib_shell): Add a factory function to
1133 * IPython/Shell.py (matplotlib_shell): Add a factory function to
1125 handle the matplotlib shell issues. Code by John Hunter
1134 handle the matplotlib shell issues. Code by John Hunter
1126 <jdhunter-AT-nitace.bsd.uchicago.edu>.
1135 <jdhunter-AT-nitace.bsd.uchicago.edu>.
1127 (IPShellMatplotlibWX.__init__): Rudimentary WX support. It's
1136 (IPShellMatplotlibWX.__init__): Rudimentary WX support. It's
1128 broken (and disabled for end users) for now, but it puts the
1137 broken (and disabled for end users) for now, but it puts the
1129 infrastructure in place.
1138 infrastructure in place.
1130
1139
1131 2004-08-21 Fernando Perez <fperez@colorado.edu>
1140 2004-08-21 Fernando Perez <fperez@colorado.edu>
1132
1141
1133 * ipythonrc-pylab: Add matplotlib support.
1142 * ipythonrc-pylab: Add matplotlib support.
1134
1143
1135 * matplotlib_config.py: new files for matplotlib support, part of
1144 * matplotlib_config.py: new files for matplotlib support, part of
1136 the pylab profile.
1145 the pylab profile.
1137
1146
1138 * IPython/usage.py (__doc__): documented the threading options.
1147 * IPython/usage.py (__doc__): documented the threading options.
1139
1148
1140 2004-08-20 Fernando Perez <fperez@colorado.edu>
1149 2004-08-20 Fernando Perez <fperez@colorado.edu>
1141
1150
1142 * ipython: Modified the main calling routine to handle the -thread
1151 * ipython: Modified the main calling routine to handle the -thread
1143 and -mpthread options. This needs to be done as a top-level hack,
1152 and -mpthread options. This needs to be done as a top-level hack,
1144 because it determines which class to instantiate for IPython
1153 because it determines which class to instantiate for IPython
1145 itself.
1154 itself.
1146
1155
1147 * IPython/Shell.py (MTInteractiveShell.__init__): New set of
1156 * IPython/Shell.py (MTInteractiveShell.__init__): New set of
1148 classes to support multithreaded GTK operation without blocking,
1157 classes to support multithreaded GTK operation without blocking,
1149 and matplotlib with all backends. This is a lot of still very
1158 and matplotlib with all backends. This is a lot of still very
1150 experimental code, and threads are tricky. So it may still have a
1159 experimental code, and threads are tricky. So it may still have a
1151 few rough edges... This code owes a lot to
1160 few rough edges... This code owes a lot to
1152 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65109, by
1161 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65109, by
1153 Brian # McErlean and John Finlay, to Antoon Pardon for fixes, and
1162 Brian # McErlean and John Finlay, to Antoon Pardon for fixes, and
1154 to John Hunter for all the matplotlib work.
1163 to John Hunter for all the matplotlib work.
1155
1164
1156 * IPython/ipmaker.py (__call__): Added -thread and -mpthread
1165 * IPython/ipmaker.py (__call__): Added -thread and -mpthread
1157 options for gtk thread and matplotlib support.
1166 options for gtk thread and matplotlib support.
1158
1167
1159 2004-08-16 Fernando Perez <fperez@colorado.edu>
1168 2004-08-16 Fernando Perez <fperez@colorado.edu>
1160
1169
1161 * IPython/iplib.py (InteractiveShell.__init__): don't trigger
1170 * IPython/iplib.py (InteractiveShell.__init__): don't trigger
1162 autocall for things like p*q,p/q,p+q,p-q, when p is callable. Bug
1171 autocall for things like p*q,p/q,p+q,p-q, when p is callable. Bug
1163 reported by Stephen Walton <stephen.walton-AT-csun.edu>.
1172 reported by Stephen Walton <stephen.walton-AT-csun.edu>.
1164
1173
1165 2004-08-11 Fernando Perez <fperez@colorado.edu>
1174 2004-08-11 Fernando Perez <fperez@colorado.edu>
1166
1175
1167 * setup.py (isfile): Fix build so documentation gets updated for
1176 * setup.py (isfile): Fix build so documentation gets updated for
1168 rpms (it was only done for .tgz builds).
1177 rpms (it was only done for .tgz builds).
1169
1178
1170 2004-08-10 Fernando Perez <fperez@colorado.edu>
1179 2004-08-10 Fernando Perez <fperez@colorado.edu>
1171
1180
1172 * genutils.py (Term): Fix misspell of stdin stream (sin->cin).
1181 * genutils.py (Term): Fix misspell of stdin stream (sin->cin).
1173
1182
1174 * iplib.py : Silence syntax error exceptions in tab-completion.
1183 * iplib.py : Silence syntax error exceptions in tab-completion.
1175
1184
1176 2004-08-05 Fernando Perez <fperez@colorado.edu>
1185 2004-08-05 Fernando Perez <fperez@colorado.edu>
1177
1186
1178 * IPython/Prompts.py (Prompt2.set_colors): Fix incorrectly set
1187 * IPython/Prompts.py (Prompt2.set_colors): Fix incorrectly set
1179 'color off' mark for continuation prompts. This was causing long
1188 'color off' mark for continuation prompts. This was causing long
1180 continuation lines to mis-wrap.
1189 continuation lines to mis-wrap.
1181
1190
1182 2004-08-01 Fernando Perez <fperez@colorado.edu>
1191 2004-08-01 Fernando Perez <fperez@colorado.edu>
1183
1192
1184 * IPython/ipmaker.py (make_IPython): Allow the shell class used
1193 * IPython/ipmaker.py (make_IPython): Allow the shell class used
1185 for building ipython to be a parameter. All this is necessary
1194 for building ipython to be a parameter. All this is necessary
1186 right now to have a multithreaded version, but this insane
1195 right now to have a multithreaded version, but this insane
1187 non-design will be cleaned up soon. For now, it's a hack that
1196 non-design will be cleaned up soon. For now, it's a hack that
1188 works.
1197 works.
1189
1198
1190 * IPython/Shell.py (IPShell.__init__): Stop using mutable default
1199 * IPython/Shell.py (IPShell.__init__): Stop using mutable default
1191 args in various places. No bugs so far, but it's a dangerous
1200 args in various places. No bugs so far, but it's a dangerous
1192 practice.
1201 practice.
1193
1202
1194 2004-07-31 Fernando Perez <fperez@colorado.edu>
1203 2004-07-31 Fernando Perez <fperez@colorado.edu>
1195
1204
1196 * IPython/iplib.py (complete): ignore SyntaxError exceptions to
1205 * IPython/iplib.py (complete): ignore SyntaxError exceptions to
1197 fix completion of files with dots in their names under most
1206 fix completion of files with dots in their names under most
1198 profiles (pysh was OK because the completion order is different).
1207 profiles (pysh was OK because the completion order is different).
1199
1208
1200 2004-07-27 Fernando Perez <fperez@colorado.edu>
1209 2004-07-27 Fernando Perez <fperez@colorado.edu>
1201
1210
1202 * IPython/iplib.py (InteractiveShell.__init__): build dict of
1211 * IPython/iplib.py (InteractiveShell.__init__): build dict of
1203 keywords manually, b/c the one in keyword.py was removed in python
1212 keywords manually, b/c the one in keyword.py was removed in python
1204 2.4. Patch by Anakim Border <aborder-AT-users.sourceforge.net>.
1213 2.4. Patch by Anakim Border <aborder-AT-users.sourceforge.net>.
1205 This is NOT a bug under python 2.3 and earlier.
1214 This is NOT a bug under python 2.3 and earlier.
1206
1215
1207 2004-07-26 Fernando Perez <fperez@colorado.edu>
1216 2004-07-26 Fernando Perez <fperez@colorado.edu>
1208
1217
1209 * IPython/ultraTB.py (VerboseTB.text): Add another
1218 * IPython/ultraTB.py (VerboseTB.text): Add another
1210 linecache.checkcache() call to try to prevent inspect.py from
1219 linecache.checkcache() call to try to prevent inspect.py from
1211 crashing under python 2.3. I think this fixes
1220 crashing under python 2.3. I think this fixes
1212 http://www.scipy.net/roundup/ipython/issue17.
1221 http://www.scipy.net/roundup/ipython/issue17.
1213
1222
1214 2004-07-26 *** Released version 0.6.2
1223 2004-07-26 *** Released version 0.6.2
1215
1224
1216 2004-07-26 Fernando Perez <fperez@colorado.edu>
1225 2004-07-26 Fernando Perez <fperez@colorado.edu>
1217
1226
1218 * IPython/Magic.py (Magic.magic_cd): Fix bug where 'cd -N' would
1227 * IPython/Magic.py (Magic.magic_cd): Fix bug where 'cd -N' would
1219 fail for any number.
1228 fail for any number.
1220 (Magic.magic_bookmark): Fix bug where 'bookmark -l' would fail for
1229 (Magic.magic_bookmark): Fix bug where 'bookmark -l' would fail for
1221 empty bookmarks.
1230 empty bookmarks.
1222
1231
1223 2004-07-26 *** Released version 0.6.1
1232 2004-07-26 *** Released version 0.6.1
1224
1233
1225 2004-07-26 Fernando Perez <fperez@colorado.edu>
1234 2004-07-26 Fernando Perez <fperez@colorado.edu>
1226
1235
1227 * ipython_win_post_install.py (run): Added pysh shortcut for Windows.
1236 * ipython_win_post_install.py (run): Added pysh shortcut for Windows.
1228
1237
1229 * IPython/iplib.py (protect_filename): Applied Ville's patch for
1238 * IPython/iplib.py (protect_filename): Applied Ville's patch for
1230 escaping '()[]{}' in filenames.
1239 escaping '()[]{}' in filenames.
1231
1240
1232 * IPython/Magic.py (shlex_split): Fix handling of '*' and '?' for
1241 * IPython/Magic.py (shlex_split): Fix handling of '*' and '?' for
1233 Python 2.2 users who lack a proper shlex.split.
1242 Python 2.2 users who lack a proper shlex.split.
1234
1243
1235 2004-07-19 Fernando Perez <fperez@colorado.edu>
1244 2004-07-19 Fernando Perez <fperez@colorado.edu>
1236
1245
1237 * IPython/iplib.py (InteractiveShell.init_readline): Add support
1246 * IPython/iplib.py (InteractiveShell.init_readline): Add support
1238 for reading readline's init file. I follow the normal chain:
1247 for reading readline's init file. I follow the normal chain:
1239 $INPUTRC is honored, otherwise ~/.inputrc is used. Thanks to a
1248 $INPUTRC is honored, otherwise ~/.inputrc is used. Thanks to a
1240 report by Mike Heeter. This closes
1249 report by Mike Heeter. This closes
1241 http://www.scipy.net/roundup/ipython/issue16.
1250 http://www.scipy.net/roundup/ipython/issue16.
1242
1251
1243 2004-07-18 Fernando Perez <fperez@colorado.edu>
1252 2004-07-18 Fernando Perez <fperez@colorado.edu>
1244
1253
1245 * IPython/iplib.py (__init__): Add better handling of '\' under
1254 * IPython/iplib.py (__init__): Add better handling of '\' under
1246 Win32 for filenames. After a patch by Ville.
1255 Win32 for filenames. After a patch by Ville.
1247
1256
1248 2004-07-17 Fernando Perez <fperez@colorado.edu>
1257 2004-07-17 Fernando Perez <fperez@colorado.edu>
1249
1258
1250 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
1259 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
1251 autocalling would be triggered for 'foo is bar' if foo is
1260 autocalling would be triggered for 'foo is bar' if foo is
1252 callable. I also cleaned up the autocall detection code to use a
1261 callable. I also cleaned up the autocall detection code to use a
1253 regexp, which is faster. Bug reported by Alexander Schmolck.
1262 regexp, which is faster. Bug reported by Alexander Schmolck.
1254
1263
1255 * IPython/Magic.py (Magic.magic_pinfo): Fix bug where strings with
1264 * IPython/Magic.py (Magic.magic_pinfo): Fix bug where strings with
1256 '?' in them would confuse the help system. Reported by Alex
1265 '?' in them would confuse the help system. Reported by Alex
1257 Schmolck.
1266 Schmolck.
1258
1267
1259 2004-07-16 Fernando Perez <fperez@colorado.edu>
1268 2004-07-16 Fernando Perez <fperez@colorado.edu>
1260
1269
1261 * IPython/GnuplotInteractive.py (__all__): added plot2.
1270 * IPython/GnuplotInteractive.py (__all__): added plot2.
1262
1271
1263 * IPython/Gnuplot2.py (Gnuplot.plot2): added new function for
1272 * IPython/Gnuplot2.py (Gnuplot.plot2): added new function for
1264 plotting dictionaries, lists or tuples of 1d arrays.
1273 plotting dictionaries, lists or tuples of 1d arrays.
1265
1274
1266 * IPython/Magic.py (Magic.magic_hist): small clenaups and
1275 * IPython/Magic.py (Magic.magic_hist): small clenaups and
1267 optimizations.
1276 optimizations.
1268
1277
1269 * IPython/iplib.py:Remove old Changelog info for cleanup. This is
1278 * IPython/iplib.py:Remove old Changelog info for cleanup. This is
1270 the information which was there from Janko's original IPP code:
1279 the information which was there from Janko's original IPP code:
1271
1280
1272 03.05.99 20:53 porto.ifm.uni-kiel.de
1281 03.05.99 20:53 porto.ifm.uni-kiel.de
1273 --Started changelog.
1282 --Started changelog.
1274 --make clear do what it say it does
1283 --make clear do what it say it does
1275 --added pretty output of lines from inputcache
1284 --added pretty output of lines from inputcache
1276 --Made Logger a mixin class, simplifies handling of switches
1285 --Made Logger a mixin class, simplifies handling of switches
1277 --Added own completer class. .string<TAB> expands to last history
1286 --Added own completer class. .string<TAB> expands to last history
1278 line which starts with string. The new expansion is also present
1287 line which starts with string. The new expansion is also present
1279 with Ctrl-r from the readline library. But this shows, who this
1288 with Ctrl-r from the readline library. But this shows, who this
1280 can be done for other cases.
1289 can be done for other cases.
1281 --Added convention that all shell functions should accept a
1290 --Added convention that all shell functions should accept a
1282 parameter_string This opens the door for different behaviour for
1291 parameter_string This opens the door for different behaviour for
1283 each function. @cd is a good example of this.
1292 each function. @cd is a good example of this.
1284
1293
1285 04.05.99 12:12 porto.ifm.uni-kiel.de
1294 04.05.99 12:12 porto.ifm.uni-kiel.de
1286 --added logfile rotation
1295 --added logfile rotation
1287 --added new mainloop method which freezes first the namespace
1296 --added new mainloop method which freezes first the namespace
1288
1297
1289 07.05.99 21:24 porto.ifm.uni-kiel.de
1298 07.05.99 21:24 porto.ifm.uni-kiel.de
1290 --added the docreader classes. Now there is a help system.
1299 --added the docreader classes. Now there is a help system.
1291 -This is only a first try. Currently it's not easy to put new
1300 -This is only a first try. Currently it's not easy to put new
1292 stuff in the indices. But this is the way to go. Info would be
1301 stuff in the indices. But this is the way to go. Info would be
1293 better, but HTML is every where and not everybody has an info
1302 better, but HTML is every where and not everybody has an info
1294 system installed and it's not so easy to change html-docs to info.
1303 system installed and it's not so easy to change html-docs to info.
1295 --added global logfile option
1304 --added global logfile option
1296 --there is now a hook for object inspection method pinfo needs to
1305 --there is now a hook for object inspection method pinfo needs to
1297 be provided for this. Can be reached by two '??'.
1306 be provided for this. Can be reached by two '??'.
1298
1307
1299 08.05.99 20:51 porto.ifm.uni-kiel.de
1308 08.05.99 20:51 porto.ifm.uni-kiel.de
1300 --added a README
1309 --added a README
1301 --bug in rc file. Something has changed so functions in the rc
1310 --bug in rc file. Something has changed so functions in the rc
1302 file need to reference the shell and not self. Not clear if it's a
1311 file need to reference the shell and not self. Not clear if it's a
1303 bug or feature.
1312 bug or feature.
1304 --changed rc file for new behavior
1313 --changed rc file for new behavior
1305
1314
1306 2004-07-15 Fernando Perez <fperez@colorado.edu>
1315 2004-07-15 Fernando Perez <fperez@colorado.edu>
1307
1316
1308 * IPython/Logger.py (Logger.log): fixed recent bug where the input
1317 * IPython/Logger.py (Logger.log): fixed recent bug where the input
1309 cache was falling out of sync in bizarre manners when multi-line
1318 cache was falling out of sync in bizarre manners when multi-line
1310 input was present. Minor optimizations and cleanup.
1319 input was present. Minor optimizations and cleanup.
1311
1320
1312 (Logger): Remove old Changelog info for cleanup. This is the
1321 (Logger): Remove old Changelog info for cleanup. This is the
1313 information which was there from Janko's original code:
1322 information which was there from Janko's original code:
1314
1323
1315 Changes to Logger: - made the default log filename a parameter
1324 Changes to Logger: - made the default log filename a parameter
1316
1325
1317 - put a check for lines beginning with !@? in log(). Needed
1326 - put a check for lines beginning with !@? in log(). Needed
1318 (even if the handlers properly log their lines) for mid-session
1327 (even if the handlers properly log their lines) for mid-session
1319 logging activation to work properly. Without this, lines logged
1328 logging activation to work properly. Without this, lines logged
1320 in mid session, which get read from the cache, would end up
1329 in mid session, which get read from the cache, would end up
1321 'bare' (with !@? in the open) in the log. Now they are caught
1330 'bare' (with !@? in the open) in the log. Now they are caught
1322 and prepended with a #.
1331 and prepended with a #.
1323
1332
1324 * IPython/iplib.py (InteractiveShell.init_readline): added check
1333 * IPython/iplib.py (InteractiveShell.init_readline): added check
1325 in case MagicCompleter fails to be defined, so we don't crash.
1334 in case MagicCompleter fails to be defined, so we don't crash.
1326
1335
1327 2004-07-13 Fernando Perez <fperez@colorado.edu>
1336 2004-07-13 Fernando Perez <fperez@colorado.edu>
1328
1337
1329 * IPython/Gnuplot2.py (Gnuplot.hardcopy): add automatic generation
1338 * IPython/Gnuplot2.py (Gnuplot.hardcopy): add automatic generation
1330 of EPS if the requested filename ends in '.eps'.
1339 of EPS if the requested filename ends in '.eps'.
1331
1340
1332 2004-07-04 Fernando Perez <fperez@colorado.edu>
1341 2004-07-04 Fernando Perez <fperez@colorado.edu>
1333
1342
1334 * IPython/iplib.py (InteractiveShell.handle_shell_escape): Fix
1343 * IPython/iplib.py (InteractiveShell.handle_shell_escape): Fix
1335 escaping of quotes when calling the shell.
1344 escaping of quotes when calling the shell.
1336
1345
1337 2004-07-02 Fernando Perez <fperez@colorado.edu>
1346 2004-07-02 Fernando Perez <fperez@colorado.edu>
1338
1347
1339 * IPython/Prompts.py (CachedOutput.update): Fix problem with
1348 * IPython/Prompts.py (CachedOutput.update): Fix problem with
1340 gettext not working because we were clobbering '_'. Fixes
1349 gettext not working because we were clobbering '_'. Fixes
1341 http://www.scipy.net/roundup/ipython/issue6.
1350 http://www.scipy.net/roundup/ipython/issue6.
1342
1351
1343 2004-07-01 Fernando Perez <fperez@colorado.edu>
1352 2004-07-01 Fernando Perez <fperez@colorado.edu>
1344
1353
1345 * IPython/Magic.py (Magic.magic_cd): integrated bookmark handling
1354 * IPython/Magic.py (Magic.magic_cd): integrated bookmark handling
1346 into @cd. Patch by Ville.
1355 into @cd. Patch by Ville.
1347
1356
1348 * IPython/iplib.py (InteractiveShell.post_config_initialization):
1357 * IPython/iplib.py (InteractiveShell.post_config_initialization):
1349 new function to store things after ipmaker runs. Patch by Ville.
1358 new function to store things after ipmaker runs. Patch by Ville.
1350 Eventually this will go away once ipmaker is removed and the class
1359 Eventually this will go away once ipmaker is removed and the class
1351 gets cleaned up, but for now it's ok. Key functionality here is
1360 gets cleaned up, but for now it's ok. Key functionality here is
1352 the addition of the persistent storage mechanism, a dict for
1361 the addition of the persistent storage mechanism, a dict for
1353 keeping data across sessions (for now just bookmarks, but more can
1362 keeping data across sessions (for now just bookmarks, but more can
1354 be implemented later).
1363 be implemented later).
1355
1364
1356 * IPython/Magic.py (Magic.magic_bookmark): New bookmark system,
1365 * IPython/Magic.py (Magic.magic_bookmark): New bookmark system,
1357 persistent across sections. Patch by Ville, I modified it
1366 persistent across sections. Patch by Ville, I modified it
1358 soemwhat to allow bookmarking arbitrary dirs other than CWD. Also
1367 soemwhat to allow bookmarking arbitrary dirs other than CWD. Also
1359 added a '-l' option to list all bookmarks.
1368 added a '-l' option to list all bookmarks.
1360
1369
1361 * IPython/iplib.py (InteractiveShell.atexit_operations): new
1370 * IPython/iplib.py (InteractiveShell.atexit_operations): new
1362 center for cleanup. Registered with atexit.register(). I moved
1371 center for cleanup. Registered with atexit.register(). I moved
1363 here the old exit_cleanup(). After a patch by Ville.
1372 here the old exit_cleanup(). After a patch by Ville.
1364
1373
1365 * IPython/Magic.py (get_py_filename): added '~' to the accepted
1374 * IPython/Magic.py (get_py_filename): added '~' to the accepted
1366 characters in the hacked shlex_split for python 2.2.
1375 characters in the hacked shlex_split for python 2.2.
1367
1376
1368 * IPython/iplib.py (file_matches): more fixes to filenames with
1377 * IPython/iplib.py (file_matches): more fixes to filenames with
1369 whitespace in them. It's not perfect, but limitations in python's
1378 whitespace in them. It's not perfect, but limitations in python's
1370 readline make it impossible to go further.
1379 readline make it impossible to go further.
1371
1380
1372 2004-06-29 Fernando Perez <fperez@colorado.edu>
1381 2004-06-29 Fernando Perez <fperez@colorado.edu>
1373
1382
1374 * IPython/iplib.py (file_matches): escape whitespace correctly in
1383 * IPython/iplib.py (file_matches): escape whitespace correctly in
1375 filename completions. Bug reported by Ville.
1384 filename completions. Bug reported by Ville.
1376
1385
1377 2004-06-28 Fernando Perez <fperez@colorado.edu>
1386 2004-06-28 Fernando Perez <fperez@colorado.edu>
1378
1387
1379 * IPython/ipmaker.py (__call__): Added per-profile histories. Now
1388 * IPython/ipmaker.py (__call__): Added per-profile histories. Now
1380 the history file will be called 'history-PROFNAME' (or just
1389 the history file will be called 'history-PROFNAME' (or just
1381 'history' if no profile is loaded). I was getting annoyed at
1390 'history' if no profile is loaded). I was getting annoyed at
1382 getting my Numerical work history clobbered by pysh sessions.
1391 getting my Numerical work history clobbered by pysh sessions.
1383
1392
1384 * IPython/iplib.py (InteractiveShell.__init__): Internal
1393 * IPython/iplib.py (InteractiveShell.__init__): Internal
1385 getoutputerror() function so that we can honor the system_verbose
1394 getoutputerror() function so that we can honor the system_verbose
1386 flag for _all_ system calls. I also added escaping of #
1395 flag for _all_ system calls. I also added escaping of #
1387 characters here to avoid confusing Itpl.
1396 characters here to avoid confusing Itpl.
1388
1397
1389 * IPython/Magic.py (shlex_split): removed call to shell in
1398 * IPython/Magic.py (shlex_split): removed call to shell in
1390 parse_options and replaced it with shlex.split(). The annoying
1399 parse_options and replaced it with shlex.split(). The annoying
1391 part was that in Python 2.2, shlex.split() doesn't exist, so I had
1400 part was that in Python 2.2, shlex.split() doesn't exist, so I had
1392 to backport it from 2.3, with several frail hacks (the shlex
1401 to backport it from 2.3, with several frail hacks (the shlex
1393 module is rather limited in 2.2). Thanks to a suggestion by Ville
1402 module is rather limited in 2.2). Thanks to a suggestion by Ville
1394 Vainio <vivainio@kolumbus.fi>. For Python 2.3 there should be no
1403 Vainio <vivainio@kolumbus.fi>. For Python 2.3 there should be no
1395 problem.
1404 problem.
1396
1405
1397 (Magic.magic_system_verbose): new toggle to print the actual
1406 (Magic.magic_system_verbose): new toggle to print the actual
1398 system calls made by ipython. Mainly for debugging purposes.
1407 system calls made by ipython. Mainly for debugging purposes.
1399
1408
1400 * IPython/GnuplotRuntime.py (gnu_out): fix bug for cygwin, which
1409 * IPython/GnuplotRuntime.py (gnu_out): fix bug for cygwin, which
1401 doesn't support persistence. Reported (and fix suggested) by
1410 doesn't support persistence. Reported (and fix suggested) by
1402 Travis Caldwell <travis_caldwell2000@yahoo.com>.
1411 Travis Caldwell <travis_caldwell2000@yahoo.com>.
1403
1412
1404 2004-06-26 Fernando Perez <fperez@colorado.edu>
1413 2004-06-26 Fernando Perez <fperez@colorado.edu>
1405
1414
1406 * IPython/Logger.py (Logger.log): fix to handle correctly empty
1415 * IPython/Logger.py (Logger.log): fix to handle correctly empty
1407 continue prompts.
1416 continue prompts.
1408
1417
1409 * IPython/Extensions/InterpreterExec.py (pysh): moved the pysh()
1418 * IPython/Extensions/InterpreterExec.py (pysh): moved the pysh()
1410 function (basically a big docstring) and a few more things here to
1419 function (basically a big docstring) and a few more things here to
1411 speedup startup. pysh.py is now very lightweight. We want because
1420 speedup startup. pysh.py is now very lightweight. We want because
1412 it gets execfile'd, while InterpreterExec gets imported, so
1421 it gets execfile'd, while InterpreterExec gets imported, so
1413 byte-compilation saves time.
1422 byte-compilation saves time.
1414
1423
1415 2004-06-25 Fernando Perez <fperez@colorado.edu>
1424 2004-06-25 Fernando Perez <fperez@colorado.edu>
1416
1425
1417 * IPython/Magic.py (Magic.magic_cd): Fixed to restore usage of 'cd
1426 * IPython/Magic.py (Magic.magic_cd): Fixed to restore usage of 'cd
1418 -NUM', which was recently broken.
1427 -NUM', which was recently broken.
1419
1428
1420 * IPython/iplib.py (InteractiveShell.handle_shell_escape): allow !
1429 * IPython/iplib.py (InteractiveShell.handle_shell_escape): allow !
1421 in multi-line input (but not !!, which doesn't make sense there).
1430 in multi-line input (but not !!, which doesn't make sense there).
1422
1431
1423 * IPython/UserConfig/ipythonrc: made autoindent on by default.
1432 * IPython/UserConfig/ipythonrc: made autoindent on by default.
1424 It's just too useful, and people can turn it off in the less
1433 It's just too useful, and people can turn it off in the less
1425 common cases where it's a problem.
1434 common cases where it's a problem.
1426
1435
1427 2004-06-24 Fernando Perez <fperez@colorado.edu>
1436 2004-06-24 Fernando Perez <fperez@colorado.edu>
1428
1437
1429 * IPython/iplib.py (InteractiveShell._prefilter): big change -
1438 * IPython/iplib.py (InteractiveShell._prefilter): big change -
1430 special syntaxes (like alias calling) is now allied in multi-line
1439 special syntaxes (like alias calling) is now allied in multi-line
1431 input. This is still _very_ experimental, but it's necessary for
1440 input. This is still _very_ experimental, but it's necessary for
1432 efficient shell usage combining python looping syntax with system
1441 efficient shell usage combining python looping syntax with system
1433 calls. For now it's restricted to aliases, I don't think it
1442 calls. For now it's restricted to aliases, I don't think it
1434 really even makes sense to have this for magics.
1443 really even makes sense to have this for magics.
1435
1444
1436 2004-06-23 Fernando Perez <fperez@colorado.edu>
1445 2004-06-23 Fernando Perez <fperez@colorado.edu>
1437
1446
1438 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Added
1447 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Added
1439 $var=cmd <=> @sc var=cmd and $$var=cmd <=> @sc -l var=cmd.
1448 $var=cmd <=> @sc var=cmd and $$var=cmd <=> @sc -l var=cmd.
1440
1449
1441 * IPython/Magic.py (Magic.magic_rehashx): modified to handle
1450 * IPython/Magic.py (Magic.magic_rehashx): modified to handle
1442 extensions under Windows (after code sent by Gary Bishop). The
1451 extensions under Windows (after code sent by Gary Bishop). The
1443 extensions considered 'executable' are stored in IPython's rc
1452 extensions considered 'executable' are stored in IPython's rc
1444 structure as win_exec_ext.
1453 structure as win_exec_ext.
1445
1454
1446 * IPython/genutils.py (shell): new function, like system() but
1455 * IPython/genutils.py (shell): new function, like system() but
1447 without return value. Very useful for interactive shell work.
1456 without return value. Very useful for interactive shell work.
1448
1457
1449 * IPython/Magic.py (Magic.magic_unalias): New @unalias function to
1458 * IPython/Magic.py (Magic.magic_unalias): New @unalias function to
1450 delete aliases.
1459 delete aliases.
1451
1460
1452 * IPython/iplib.py (InteractiveShell.alias_table_update): make
1461 * IPython/iplib.py (InteractiveShell.alias_table_update): make
1453 sure that the alias table doesn't contain python keywords.
1462 sure that the alias table doesn't contain python keywords.
1454
1463
1455 2004-06-21 Fernando Perez <fperez@colorado.edu>
1464 2004-06-21 Fernando Perez <fperez@colorado.edu>
1456
1465
1457 * IPython/Magic.py (Magic.magic_rehash): Fix crash when
1466 * IPython/Magic.py (Magic.magic_rehash): Fix crash when
1458 non-existent items are found in $PATH. Reported by Thorsten.
1467 non-existent items are found in $PATH. Reported by Thorsten.
1459
1468
1460 2004-06-20 Fernando Perez <fperez@colorado.edu>
1469 2004-06-20 Fernando Perez <fperez@colorado.edu>
1461
1470
1462 * IPython/iplib.py (complete): modified the completer so that the
1471 * IPython/iplib.py (complete): modified the completer so that the
1463 order of priorities can be easily changed at runtime.
1472 order of priorities can be easily changed at runtime.
1464
1473
1465 * IPython/Extensions/InterpreterExec.py (prefilter_shell):
1474 * IPython/Extensions/InterpreterExec.py (prefilter_shell):
1466 Modified to auto-execute all lines beginning with '~', '/' or '.'.
1475 Modified to auto-execute all lines beginning with '~', '/' or '.'.
1467
1476
1468 * IPython/Magic.py (Magic.magic_sx): modified @sc and @sx to
1477 * IPython/Magic.py (Magic.magic_sx): modified @sc and @sx to
1469 expand Python variables prepended with $ in all system calls. The
1478 expand Python variables prepended with $ in all system calls. The
1470 same was done to InteractiveShell.handle_shell_escape. Now all
1479 same was done to InteractiveShell.handle_shell_escape. Now all
1471 system access mechanisms (!, !!, @sc, @sx and aliases) allow the
1480 system access mechanisms (!, !!, @sc, @sx and aliases) allow the
1472 expansion of python variables and expressions according to the
1481 expansion of python variables and expressions according to the
1473 syntax of PEP-215 - http://www.python.org/peps/pep-0215.html.
1482 syntax of PEP-215 - http://www.python.org/peps/pep-0215.html.
1474
1483
1475 Though PEP-215 has been rejected, a similar (but simpler) one
1484 Though PEP-215 has been rejected, a similar (but simpler) one
1476 seems like it will go into Python 2.4, PEP-292 -
1485 seems like it will go into Python 2.4, PEP-292 -
1477 http://www.python.org/peps/pep-0292.html.
1486 http://www.python.org/peps/pep-0292.html.
1478
1487
1479 I'll keep the full syntax of PEP-215, since IPython has since the
1488 I'll keep the full syntax of PEP-215, since IPython has since the
1480 start used Ka-Ping Yee's reference implementation discussed there
1489 start used Ka-Ping Yee's reference implementation discussed there
1481 (Itpl), and I actually like the powerful semantics it offers.
1490 (Itpl), and I actually like the powerful semantics it offers.
1482
1491
1483 In order to access normal shell variables, the $ has to be escaped
1492 In order to access normal shell variables, the $ has to be escaped
1484 via an extra $. For example:
1493 via an extra $. For example:
1485
1494
1486 In [7]: PATH='a python variable'
1495 In [7]: PATH='a python variable'
1487
1496
1488 In [8]: !echo $PATH
1497 In [8]: !echo $PATH
1489 a python variable
1498 a python variable
1490
1499
1491 In [9]: !echo $$PATH
1500 In [9]: !echo $$PATH
1492 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
1501 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
1493
1502
1494 (Magic.parse_options): escape $ so the shell doesn't evaluate
1503 (Magic.parse_options): escape $ so the shell doesn't evaluate
1495 things prematurely.
1504 things prematurely.
1496
1505
1497 * IPython/iplib.py (InteractiveShell.call_alias): added the
1506 * IPython/iplib.py (InteractiveShell.call_alias): added the
1498 ability for aliases to expand python variables via $.
1507 ability for aliases to expand python variables via $.
1499
1508
1500 * IPython/Magic.py (Magic.magic_rehash): based on the new alias
1509 * IPython/Magic.py (Magic.magic_rehash): based on the new alias
1501 system, now there's a @rehash/@rehashx pair of magics. These work
1510 system, now there's a @rehash/@rehashx pair of magics. These work
1502 like the csh rehash command, and can be invoked at any time. They
1511 like the csh rehash command, and can be invoked at any time. They
1503 build a table of aliases to everything in the user's $PATH
1512 build a table of aliases to everything in the user's $PATH
1504 (@rehash uses everything, @rehashx is slower but only adds
1513 (@rehash uses everything, @rehashx is slower but only adds
1505 executable files). With this, the pysh.py-based shell profile can
1514 executable files). With this, the pysh.py-based shell profile can
1506 now simply call rehash upon startup, and full access to all
1515 now simply call rehash upon startup, and full access to all
1507 programs in the user's path is obtained.
1516 programs in the user's path is obtained.
1508
1517
1509 * IPython/iplib.py (InteractiveShell.call_alias): The new alias
1518 * IPython/iplib.py (InteractiveShell.call_alias): The new alias
1510 functionality is now fully in place. I removed the old dynamic
1519 functionality is now fully in place. I removed the old dynamic
1511 code generation based approach, in favor of a much lighter one
1520 code generation based approach, in favor of a much lighter one
1512 based on a simple dict. The advantage is that this allows me to
1521 based on a simple dict. The advantage is that this allows me to
1513 now have thousands of aliases with negligible cost (unthinkable
1522 now have thousands of aliases with negligible cost (unthinkable
1514 with the old system).
1523 with the old system).
1515
1524
1516 2004-06-19 Fernando Perez <fperez@colorado.edu>
1525 2004-06-19 Fernando Perez <fperez@colorado.edu>
1517
1526
1518 * IPython/iplib.py (__init__): extended MagicCompleter class to
1527 * IPython/iplib.py (__init__): extended MagicCompleter class to
1519 also complete (last in priority) on user aliases.
1528 also complete (last in priority) on user aliases.
1520
1529
1521 * IPython/Itpl.py (Itpl.__str__): fixed order of globals/locals in
1530 * IPython/Itpl.py (Itpl.__str__): fixed order of globals/locals in
1522 call to eval.
1531 call to eval.
1523 (ItplNS.__init__): Added a new class which functions like Itpl,
1532 (ItplNS.__init__): Added a new class which functions like Itpl,
1524 but allows configuring the namespace for the evaluation to occur
1533 but allows configuring the namespace for the evaluation to occur
1525 in.
1534 in.
1526
1535
1527 2004-06-18 Fernando Perez <fperez@colorado.edu>
1536 2004-06-18 Fernando Perez <fperez@colorado.edu>
1528
1537
1529 * IPython/iplib.py (InteractiveShell.runcode): modify to print a
1538 * IPython/iplib.py (InteractiveShell.runcode): modify to print a
1530 better message when 'exit' or 'quit' are typed (a common newbie
1539 better message when 'exit' or 'quit' are typed (a common newbie
1531 confusion).
1540 confusion).
1532
1541
1533 * IPython/Magic.py (Magic.magic_colors): Added the runtime color
1542 * IPython/Magic.py (Magic.magic_colors): Added the runtime color
1534 check for Windows users.
1543 check for Windows users.
1535
1544
1536 * IPython/iplib.py (InteractiveShell.user_setup): removed
1545 * IPython/iplib.py (InteractiveShell.user_setup): removed
1537 disabling of colors for Windows. I'll test at runtime and issue a
1546 disabling of colors for Windows. I'll test at runtime and issue a
1538 warning if Gary's readline isn't found, as to nudge users to
1547 warning if Gary's readline isn't found, as to nudge users to
1539 download it.
1548 download it.
1540
1549
1541 2004-06-16 Fernando Perez <fperez@colorado.edu>
1550 2004-06-16 Fernando Perez <fperez@colorado.edu>
1542
1551
1543 * IPython/genutils.py (Stream.__init__): changed to print errors
1552 * IPython/genutils.py (Stream.__init__): changed to print errors
1544 to sys.stderr. I had a circular dependency here. Now it's
1553 to sys.stderr. I had a circular dependency here. Now it's
1545 possible to run ipython as IDLE's shell (consider this pre-alpha,
1554 possible to run ipython as IDLE's shell (consider this pre-alpha,
1546 since true stdout things end up in the starting terminal instead
1555 since true stdout things end up in the starting terminal instead
1547 of IDLE's out).
1556 of IDLE's out).
1548
1557
1549 * IPython/Prompts.py (Prompt2.set_colors): prevent crashes for
1558 * IPython/Prompts.py (Prompt2.set_colors): prevent crashes for
1550 users who haven't # updated their prompt_in2 definitions. Remove
1559 users who haven't # updated their prompt_in2 definitions. Remove
1551 eventually.
1560 eventually.
1552 (multiple_replace): added credit to original ASPN recipe.
1561 (multiple_replace): added credit to original ASPN recipe.
1553
1562
1554 2004-06-15 Fernando Perez <fperez@colorado.edu>
1563 2004-06-15 Fernando Perez <fperez@colorado.edu>
1555
1564
1556 * IPython/iplib.py (InteractiveShell.__init__): add 'cp' to the
1565 * IPython/iplib.py (InteractiveShell.__init__): add 'cp' to the
1557 list of auto-defined aliases.
1566 list of auto-defined aliases.
1558
1567
1559 2004-06-13 Fernando Perez <fperez@colorado.edu>
1568 2004-06-13 Fernando Perez <fperez@colorado.edu>
1560
1569
1561 * setup.py (scriptfiles): Don't trigger win_post_install unless an
1570 * setup.py (scriptfiles): Don't trigger win_post_install unless an
1562 install was really requested (so setup.py can be used for other
1571 install was really requested (so setup.py can be used for other
1563 things under Windows).
1572 things under Windows).
1564
1573
1565 2004-06-10 Fernando Perez <fperez@colorado.edu>
1574 2004-06-10 Fernando Perez <fperez@colorado.edu>
1566
1575
1567 * IPython/Logger.py (Logger.create_log): Manually remove any old
1576 * IPython/Logger.py (Logger.create_log): Manually remove any old
1568 backup, since os.remove may fail under Windows. Fixes bug
1577 backup, since os.remove may fail under Windows. Fixes bug
1569 reported by Thorsten.
1578 reported by Thorsten.
1570
1579
1571 2004-06-09 Fernando Perez <fperez@colorado.edu>
1580 2004-06-09 Fernando Perez <fperez@colorado.edu>
1572
1581
1573 * examples/example-embed.py: fixed all references to %n (replaced
1582 * examples/example-embed.py: fixed all references to %n (replaced
1574 with \\# for ps1/out prompts and with \\D for ps2 prompts). Done
1583 with \\# for ps1/out prompts and with \\D for ps2 prompts). Done
1575 for all examples and the manual as well.
1584 for all examples and the manual as well.
1576
1585
1577 2004-06-08 Fernando Perez <fperez@colorado.edu>
1586 2004-06-08 Fernando Perez <fperez@colorado.edu>
1578
1587
1579 * IPython/Prompts.py (Prompt2.set_p_str): fixed all prompt
1588 * IPython/Prompts.py (Prompt2.set_p_str): fixed all prompt
1580 alignment and color management. All 3 prompt subsystems now
1589 alignment and color management. All 3 prompt subsystems now
1581 inherit from BasePrompt.
1590 inherit from BasePrompt.
1582
1591
1583 * tools/release: updates for windows installer build and tag rpms
1592 * tools/release: updates for windows installer build and tag rpms
1584 with python version (since paths are fixed).
1593 with python version (since paths are fixed).
1585
1594
1586 * IPython/UserConfig/ipythonrc: modified to use \# instead of %n,
1595 * IPython/UserConfig/ipythonrc: modified to use \# instead of %n,
1587 which will become eventually obsolete. Also fixed the default
1596 which will become eventually obsolete. Also fixed the default
1588 prompt_in2 to use \D, so at least new users start with the correct
1597 prompt_in2 to use \D, so at least new users start with the correct
1589 defaults.
1598 defaults.
1590 WARNING: Users with existing ipythonrc files will need to apply
1599 WARNING: Users with existing ipythonrc files will need to apply
1591 this fix manually!
1600 this fix manually!
1592
1601
1593 * setup.py: make windows installer (.exe). This is finally the
1602 * setup.py: make windows installer (.exe). This is finally the
1594 integration of an old patch by Cory Dodt <dodt-AT-fcoe.k12.ca.us>,
1603 integration of an old patch by Cory Dodt <dodt-AT-fcoe.k12.ca.us>,
1595 which I hadn't included because it required Python 2.3 (or recent
1604 which I hadn't included because it required Python 2.3 (or recent
1596 distutils).
1605 distutils).
1597
1606
1598 * IPython/usage.py (__doc__): update docs (and manpage) to reflect
1607 * IPython/usage.py (__doc__): update docs (and manpage) to reflect
1599 usage of new '\D' escape.
1608 usage of new '\D' escape.
1600
1609
1601 * IPython/Prompts.py (ROOT_SYMBOL): Small fix for Windows (which
1610 * IPython/Prompts.py (ROOT_SYMBOL): Small fix for Windows (which
1602 lacks os.getuid())
1611 lacks os.getuid())
1603 (CachedOutput.set_colors): Added the ability to turn coloring
1612 (CachedOutput.set_colors): Added the ability to turn coloring
1604 on/off with @colors even for manually defined prompt colors. It
1613 on/off with @colors even for manually defined prompt colors. It
1605 uses a nasty global, but it works safely and via the generic color
1614 uses a nasty global, but it works safely and via the generic color
1606 handling mechanism.
1615 handling mechanism.
1607 (Prompt2.__init__): Introduced new escape '\D' for continuation
1616 (Prompt2.__init__): Introduced new escape '\D' for continuation
1608 prompts. It represents the counter ('\#') as dots.
1617 prompts. It represents the counter ('\#') as dots.
1609 *** NOTE *** THIS IS A BACKWARDS-INCOMPATIBLE CHANGE. Users will
1618 *** NOTE *** THIS IS A BACKWARDS-INCOMPATIBLE CHANGE. Users will
1610 need to update their ipythonrc files and replace '%n' with '\D' in
1619 need to update their ipythonrc files and replace '%n' with '\D' in
1611 their prompt_in2 settings everywhere. Sorry, but there's
1620 their prompt_in2 settings everywhere. Sorry, but there's
1612 otherwise no clean way to get all prompts to properly align. The
1621 otherwise no clean way to get all prompts to properly align. The
1613 ipythonrc shipped with IPython has been updated.
1622 ipythonrc shipped with IPython has been updated.
1614
1623
1615 2004-06-07 Fernando Perez <fperez@colorado.edu>
1624 2004-06-07 Fernando Perez <fperez@colorado.edu>
1616
1625
1617 * setup.py (isfile): Pass local_icons option to latex2html, so the
1626 * setup.py (isfile): Pass local_icons option to latex2html, so the
1618 resulting HTML file is self-contained. Thanks to
1627 resulting HTML file is self-contained. Thanks to
1619 dryice-AT-liu.com.cn for the tip.
1628 dryice-AT-liu.com.cn for the tip.
1620
1629
1621 * pysh.py: I created a new profile 'shell', which implements a
1630 * pysh.py: I created a new profile 'shell', which implements a
1622 _rudimentary_ IPython-based shell. This is in NO WAY a realy
1631 _rudimentary_ IPython-based shell. This is in NO WAY a realy
1623 system shell, nor will it become one anytime soon. It's mainly
1632 system shell, nor will it become one anytime soon. It's mainly
1624 meant to illustrate the use of the new flexible bash-like prompts.
1633 meant to illustrate the use of the new flexible bash-like prompts.
1625 I guess it could be used by hardy souls for true shell management,
1634 I guess it could be used by hardy souls for true shell management,
1626 but it's no tcsh/bash... pysh.py is loaded by the 'shell'
1635 but it's no tcsh/bash... pysh.py is loaded by the 'shell'
1627 profile. This uses the InterpreterExec extension provided by
1636 profile. This uses the InterpreterExec extension provided by
1628 W.J. van der Laan <gnufnork-AT-hetdigitalegat.nl>
1637 W.J. van der Laan <gnufnork-AT-hetdigitalegat.nl>
1629
1638
1630 * IPython/Prompts.py (PromptOut.__str__): now it will correctly
1639 * IPython/Prompts.py (PromptOut.__str__): now it will correctly
1631 auto-align itself with the length of the previous input prompt
1640 auto-align itself with the length of the previous input prompt
1632 (taking into account the invisible color escapes).
1641 (taking into account the invisible color escapes).
1633 (CachedOutput.__init__): Large restructuring of this class. Now
1642 (CachedOutput.__init__): Large restructuring of this class. Now
1634 all three prompts (primary1, primary2, output) are proper objects,
1643 all three prompts (primary1, primary2, output) are proper objects,
1635 managed by the 'parent' CachedOutput class. The code is still a
1644 managed by the 'parent' CachedOutput class. The code is still a
1636 bit hackish (all prompts share state via a pointer to the cache),
1645 bit hackish (all prompts share state via a pointer to the cache),
1637 but it's overall far cleaner than before.
1646 but it's overall far cleaner than before.
1638
1647
1639 * IPython/genutils.py (getoutputerror): modified to add verbose,
1648 * IPython/genutils.py (getoutputerror): modified to add verbose,
1640 debug and header options. This makes the interface of all getout*
1649 debug and header options. This makes the interface of all getout*
1641 functions uniform.
1650 functions uniform.
1642 (SystemExec.getoutputerror): added getoutputerror to SystemExec.
1651 (SystemExec.getoutputerror): added getoutputerror to SystemExec.
1643
1652
1644 * IPython/Magic.py (Magic.default_option): added a function to
1653 * IPython/Magic.py (Magic.default_option): added a function to
1645 allow registering default options for any magic command. This
1654 allow registering default options for any magic command. This
1646 makes it easy to have profiles which customize the magics globally
1655 makes it easy to have profiles which customize the magics globally
1647 for a certain use. The values set through this function are
1656 for a certain use. The values set through this function are
1648 picked up by the parse_options() method, which all magics should
1657 picked up by the parse_options() method, which all magics should
1649 use to parse their options.
1658 use to parse their options.
1650
1659
1651 * IPython/genutils.py (warn): modified the warnings framework to
1660 * IPython/genutils.py (warn): modified the warnings framework to
1652 use the Term I/O class. I'm trying to slowly unify all of
1661 use the Term I/O class. I'm trying to slowly unify all of
1653 IPython's I/O operations to pass through Term.
1662 IPython's I/O operations to pass through Term.
1654
1663
1655 * IPython/Prompts.py (Prompt2._str_other): Added functionality in
1664 * IPython/Prompts.py (Prompt2._str_other): Added functionality in
1656 the secondary prompt to correctly match the length of the primary
1665 the secondary prompt to correctly match the length of the primary
1657 one for any prompt. Now multi-line code will properly line up
1666 one for any prompt. Now multi-line code will properly line up
1658 even for path dependent prompts, such as the new ones available
1667 even for path dependent prompts, such as the new ones available
1659 via the prompt_specials.
1668 via the prompt_specials.
1660
1669
1661 2004-06-06 Fernando Perez <fperez@colorado.edu>
1670 2004-06-06 Fernando Perez <fperez@colorado.edu>
1662
1671
1663 * IPython/Prompts.py (prompt_specials): Added the ability to have
1672 * IPython/Prompts.py (prompt_specials): Added the ability to have
1664 bash-like special sequences in the prompts, which get
1673 bash-like special sequences in the prompts, which get
1665 automatically expanded. Things like hostname, current working
1674 automatically expanded. Things like hostname, current working
1666 directory and username are implemented already, but it's easy to
1675 directory and username are implemented already, but it's easy to
1667 add more in the future. Thanks to a patch by W.J. van der Laan
1676 add more in the future. Thanks to a patch by W.J. van der Laan
1668 <gnufnork-AT-hetdigitalegat.nl>
1677 <gnufnork-AT-hetdigitalegat.nl>
1669 (prompt_specials): Added color support for prompt strings, so
1678 (prompt_specials): Added color support for prompt strings, so
1670 users can define arbitrary color setups for their prompts.
1679 users can define arbitrary color setups for their prompts.
1671
1680
1672 2004-06-05 Fernando Perez <fperez@colorado.edu>
1681 2004-06-05 Fernando Perez <fperez@colorado.edu>
1673
1682
1674 * IPython/genutils.py (Term.reopen_all): Added Windows-specific
1683 * IPython/genutils.py (Term.reopen_all): Added Windows-specific
1675 code to load Gary Bishop's readline and configure it
1684 code to load Gary Bishop's readline and configure it
1676 automatically. Thanks to Gary for help on this.
1685 automatically. Thanks to Gary for help on this.
1677
1686
1678 2004-06-01 Fernando Perez <fperez@colorado.edu>
1687 2004-06-01 Fernando Perez <fperez@colorado.edu>
1679
1688
1680 * IPython/Logger.py (Logger.create_log): fix bug for logging
1689 * IPython/Logger.py (Logger.create_log): fix bug for logging
1681 with no filename (previous fix was incomplete).
1690 with no filename (previous fix was incomplete).
1682
1691
1683 2004-05-25 Fernando Perez <fperez@colorado.edu>
1692 2004-05-25 Fernando Perez <fperez@colorado.edu>
1684
1693
1685 * IPython/Magic.py (Magic.parse_options): fix bug where naked
1694 * IPython/Magic.py (Magic.parse_options): fix bug where naked
1686 parens would get passed to the shell.
1695 parens would get passed to the shell.
1687
1696
1688 2004-05-20 Fernando Perez <fperez@colorado.edu>
1697 2004-05-20 Fernando Perez <fperez@colorado.edu>
1689
1698
1690 * IPython/Magic.py (Magic.magic_prun): changed default profile
1699 * IPython/Magic.py (Magic.magic_prun): changed default profile
1691 sort order to 'time' (the more common profiling need).
1700 sort order to 'time' (the more common profiling need).
1692
1701
1693 * IPython/OInspect.py (Inspector.pinfo): flush the inspect cache
1702 * IPython/OInspect.py (Inspector.pinfo): flush the inspect cache
1694 so that source code shown is guaranteed in sync with the file on
1703 so that source code shown is guaranteed in sync with the file on
1695 disk (also changed in psource). Similar fix to the one for
1704 disk (also changed in psource). Similar fix to the one for
1696 ultraTB on 2004-05-06. Thanks to a bug report by Yann Le Du
1705 ultraTB on 2004-05-06. Thanks to a bug report by Yann Le Du
1697 <yann.ledu-AT-noos.fr>.
1706 <yann.ledu-AT-noos.fr>.
1698
1707
1699 * IPython/Magic.py (Magic.parse_options): Fixed bug where commands
1708 * IPython/Magic.py (Magic.parse_options): Fixed bug where commands
1700 with a single option would not be correctly parsed. Closes
1709 with a single option would not be correctly parsed. Closes
1701 http://www.scipy.net/roundup/ipython/issue14. This bug had been
1710 http://www.scipy.net/roundup/ipython/issue14. This bug had been
1702 introduced in 0.6.0 (on 2004-05-06).
1711 introduced in 0.6.0 (on 2004-05-06).
1703
1712
1704 2004-05-13 *** Released version 0.6.0
1713 2004-05-13 *** Released version 0.6.0
1705
1714
1706 2004-05-13 Fernando Perez <fperez@colorado.edu>
1715 2004-05-13 Fernando Perez <fperez@colorado.edu>
1707
1716
1708 * debian/: Added debian/ directory to CVS, so that debian support
1717 * debian/: Added debian/ directory to CVS, so that debian support
1709 is publicly accessible. The debian package is maintained by Jack
1718 is publicly accessible. The debian package is maintained by Jack
1710 Moffit <jack-AT-xiph.org>.
1719 Moffit <jack-AT-xiph.org>.
1711
1720
1712 * Documentation: included the notes about an ipython-based system
1721 * Documentation: included the notes about an ipython-based system
1713 shell (the hypothetical 'pysh') into the new_design.pdf document,
1722 shell (the hypothetical 'pysh') into the new_design.pdf document,
1714 so that these ideas get distributed to users along with the
1723 so that these ideas get distributed to users along with the
1715 official documentation.
1724 official documentation.
1716
1725
1717 2004-05-10 Fernando Perez <fperez@colorado.edu>
1726 2004-05-10 Fernando Perez <fperez@colorado.edu>
1718
1727
1719 * IPython/Logger.py (Logger.create_log): fix recently introduced
1728 * IPython/Logger.py (Logger.create_log): fix recently introduced
1720 bug (misindented line) where logstart would fail when not given an
1729 bug (misindented line) where logstart would fail when not given an
1721 explicit filename.
1730 explicit filename.
1722
1731
1723 2004-05-09 Fernando Perez <fperez@colorado.edu>
1732 2004-05-09 Fernando Perez <fperez@colorado.edu>
1724
1733
1725 * IPython/Magic.py (Magic.parse_options): skip system call when
1734 * IPython/Magic.py (Magic.parse_options): skip system call when
1726 there are no options to look for. Faster, cleaner for the common
1735 there are no options to look for. Faster, cleaner for the common
1727 case.
1736 case.
1728
1737
1729 * Documentation: many updates to the manual: describing Windows
1738 * Documentation: many updates to the manual: describing Windows
1730 support better, Gnuplot updates, credits, misc small stuff. Also
1739 support better, Gnuplot updates, credits, misc small stuff. Also
1731 updated the new_design doc a bit.
1740 updated the new_design doc a bit.
1732
1741
1733 2004-05-06 *** Released version 0.6.0.rc1
1742 2004-05-06 *** Released version 0.6.0.rc1
1734
1743
1735 2004-05-06 Fernando Perez <fperez@colorado.edu>
1744 2004-05-06 Fernando Perez <fperez@colorado.edu>
1736
1745
1737 * IPython/ultraTB.py (ListTB.text): modified a ton of string +=
1746 * IPython/ultraTB.py (ListTB.text): modified a ton of string +=
1738 operations to use the vastly more efficient list/''.join() method.
1747 operations to use the vastly more efficient list/''.join() method.
1739 (FormattedTB.text): Fix
1748 (FormattedTB.text): Fix
1740 http://www.scipy.net/roundup/ipython/issue12 - exception source
1749 http://www.scipy.net/roundup/ipython/issue12 - exception source
1741 extract not updated after reload. Thanks to Mike Salib
1750 extract not updated after reload. Thanks to Mike Salib
1742 <msalib-AT-mit.edu> for pinning the source of the problem.
1751 <msalib-AT-mit.edu> for pinning the source of the problem.
1743 Fortunately, the solution works inside ipython and doesn't require
1752 Fortunately, the solution works inside ipython and doesn't require
1744 any changes to python proper.
1753 any changes to python proper.
1745
1754
1746 * IPython/Magic.py (Magic.parse_options): Improved to process the
1755 * IPython/Magic.py (Magic.parse_options): Improved to process the
1747 argument list as a true shell would (by actually using the
1756 argument list as a true shell would (by actually using the
1748 underlying system shell). This way, all @magics automatically get
1757 underlying system shell). This way, all @magics automatically get
1749 shell expansion for variables. Thanks to a comment by Alex
1758 shell expansion for variables. Thanks to a comment by Alex
1750 Schmolck.
1759 Schmolck.
1751
1760
1752 2004-04-04 Fernando Perez <fperez@colorado.edu>
1761 2004-04-04 Fernando Perez <fperez@colorado.edu>
1753
1762
1754 * IPython/iplib.py (InteractiveShell.interact): Added a special
1763 * IPython/iplib.py (InteractiveShell.interact): Added a special
1755 trap for a debugger quit exception, which is basically impossible
1764 trap for a debugger quit exception, which is basically impossible
1756 to handle by normal mechanisms, given what pdb does to the stack.
1765 to handle by normal mechanisms, given what pdb does to the stack.
1757 This fixes a crash reported by <fgibbons-AT-llama.med.harvard.edu>.
1766 This fixes a crash reported by <fgibbons-AT-llama.med.harvard.edu>.
1758
1767
1759 2004-04-03 Fernando Perez <fperez@colorado.edu>
1768 2004-04-03 Fernando Perez <fperez@colorado.edu>
1760
1769
1761 * IPython/genutils.py (Term): Standardized the names of the Term
1770 * IPython/genutils.py (Term): Standardized the names of the Term
1762 class streams to cin/cout/cerr, following C++ naming conventions
1771 class streams to cin/cout/cerr, following C++ naming conventions
1763 (I can't use in/out/err because 'in' is not a valid attribute
1772 (I can't use in/out/err because 'in' is not a valid attribute
1764 name).
1773 name).
1765
1774
1766 * IPython/iplib.py (InteractiveShell.interact): don't increment
1775 * IPython/iplib.py (InteractiveShell.interact): don't increment
1767 the prompt if there's no user input. By Daniel 'Dang' Griffith
1776 the prompt if there's no user input. By Daniel 'Dang' Griffith
1768 <pythondev-dang-AT-lazytwinacres.net>, after a suggestion from
1777 <pythondev-dang-AT-lazytwinacres.net>, after a suggestion from
1769 Francois Pinard.
1778 Francois Pinard.
1770
1779
1771 2004-04-02 Fernando Perez <fperez@colorado.edu>
1780 2004-04-02 Fernando Perez <fperez@colorado.edu>
1772
1781
1773 * IPython/genutils.py (Stream.__init__): Modified to survive at
1782 * IPython/genutils.py (Stream.__init__): Modified to survive at
1774 least importing in contexts where stdin/out/err aren't true file
1783 least importing in contexts where stdin/out/err aren't true file
1775 objects, such as PyCrust (they lack fileno() and mode). However,
1784 objects, such as PyCrust (they lack fileno() and mode). However,
1776 the recovery facilities which rely on these things existing will
1785 the recovery facilities which rely on these things existing will
1777 not work.
1786 not work.
1778
1787
1779 2004-04-01 Fernando Perez <fperez@colorado.edu>
1788 2004-04-01 Fernando Perez <fperez@colorado.edu>
1780
1789
1781 * IPython/Magic.py (Magic.magic_sx): modified (as well as @sc) to
1790 * IPython/Magic.py (Magic.magic_sx): modified (as well as @sc) to
1782 use the new getoutputerror() function, so it properly
1791 use the new getoutputerror() function, so it properly
1783 distinguishes stdout/err.
1792 distinguishes stdout/err.
1784
1793
1785 * IPython/genutils.py (getoutputerror): added a function to
1794 * IPython/genutils.py (getoutputerror): added a function to
1786 capture separately the standard output and error of a command.
1795 capture separately the standard output and error of a command.
1787 After a comment from dang on the mailing lists. This code is
1796 After a comment from dang on the mailing lists. This code is
1788 basically a modified version of commands.getstatusoutput(), from
1797 basically a modified version of commands.getstatusoutput(), from
1789 the standard library.
1798 the standard library.
1790
1799
1791 * IPython/iplib.py (InteractiveShell.handle_shell_escape): added
1800 * IPython/iplib.py (InteractiveShell.handle_shell_escape): added
1792 '!!' as a special syntax (shorthand) to access @sx.
1801 '!!' as a special syntax (shorthand) to access @sx.
1793
1802
1794 * IPython/Magic.py (Magic.magic_sx): new magic, to execute a shell
1803 * IPython/Magic.py (Magic.magic_sx): new magic, to execute a shell
1795 command and return its output as a list split on '\n'.
1804 command and return its output as a list split on '\n'.
1796
1805
1797 2004-03-31 Fernando Perez <fperez@colorado.edu>
1806 2004-03-31 Fernando Perez <fperez@colorado.edu>
1798
1807
1799 * IPython/FakeModule.py (FakeModule.__init__): added __nonzero__
1808 * IPython/FakeModule.py (FakeModule.__init__): added __nonzero__
1800 method to dictionaries used as FakeModule instances if they lack
1809 method to dictionaries used as FakeModule instances if they lack
1801 it. At least pydoc in python2.3 breaks for runtime-defined
1810 it. At least pydoc in python2.3 breaks for runtime-defined
1802 functions without this hack. At some point I need to _really_
1811 functions without this hack. At some point I need to _really_
1803 understand what FakeModule is doing, because it's a gross hack.
1812 understand what FakeModule is doing, because it's a gross hack.
1804 But it solves Arnd's problem for now...
1813 But it solves Arnd's problem for now...
1805
1814
1806 2004-02-27 Fernando Perez <fperez@colorado.edu>
1815 2004-02-27 Fernando Perez <fperez@colorado.edu>
1807
1816
1808 * IPython/Logger.py (Logger.create_log): Fix bug where 'rotate'
1817 * IPython/Logger.py (Logger.create_log): Fix bug where 'rotate'
1809 mode would behave erratically. Also increased the number of
1818 mode would behave erratically. Also increased the number of
1810 possible logs in rotate mod to 999. Thanks to Rod Holland
1819 possible logs in rotate mod to 999. Thanks to Rod Holland
1811 <rhh@StructureLABS.com> for the report and fixes.
1820 <rhh@StructureLABS.com> for the report and fixes.
1812
1821
1813 2004-02-26 Fernando Perez <fperez@colorado.edu>
1822 2004-02-26 Fernando Perez <fperez@colorado.edu>
1814
1823
1815 * IPython/genutils.py (page): Check that the curses module really
1824 * IPython/genutils.py (page): Check that the curses module really
1816 has the initscr attribute before trying to use it. For some
1825 has the initscr attribute before trying to use it. For some
1817 reason, the Solaris curses module is missing this. I think this
1826 reason, the Solaris curses module is missing this. I think this
1818 should be considered a Solaris python bug, but I'm not sure.
1827 should be considered a Solaris python bug, but I'm not sure.
1819
1828
1820 2004-01-17 Fernando Perez <fperez@colorado.edu>
1829 2004-01-17 Fernando Perez <fperez@colorado.edu>
1821
1830
1822 * IPython/genutils.py (Stream.__init__): Changes to try to make
1831 * IPython/genutils.py (Stream.__init__): Changes to try to make
1823 ipython robust against stdin/out/err being closed by the user.
1832 ipython robust against stdin/out/err being closed by the user.
1824 This is 'user error' (and blocks a normal python session, at least
1833 This is 'user error' (and blocks a normal python session, at least
1825 the stdout case). However, Ipython should be able to survive such
1834 the stdout case). However, Ipython should be able to survive such
1826 instances of abuse as gracefully as possible. To simplify the
1835 instances of abuse as gracefully as possible. To simplify the
1827 coding and maintain compatibility with Gary Bishop's Term
1836 coding and maintain compatibility with Gary Bishop's Term
1828 contributions, I've made use of classmethods for this. I think
1837 contributions, I've made use of classmethods for this. I think
1829 this introduces a dependency on python 2.2.
1838 this introduces a dependency on python 2.2.
1830
1839
1831 2004-01-13 Fernando Perez <fperez@colorado.edu>
1840 2004-01-13 Fernando Perez <fperez@colorado.edu>
1832
1841
1833 * IPython/numutils.py (exp_safe): simplified the code a bit and
1842 * IPython/numutils.py (exp_safe): simplified the code a bit and
1834 removed the need for importing the kinds module altogether.
1843 removed the need for importing the kinds module altogether.
1835
1844
1836 2004-01-06 Fernando Perez <fperez@colorado.edu>
1845 2004-01-06 Fernando Perez <fperez@colorado.edu>
1837
1846
1838 * IPython/Magic.py (Magic.magic_sc): Made the shell capture system
1847 * IPython/Magic.py (Magic.magic_sc): Made the shell capture system
1839 a magic function instead, after some community feedback. No
1848 a magic function instead, after some community feedback. No
1840 special syntax will exist for it, but its name is deliberately
1849 special syntax will exist for it, but its name is deliberately
1841 very short.
1850 very short.
1842
1851
1843 2003-12-20 Fernando Perez <fperez@colorado.edu>
1852 2003-12-20 Fernando Perez <fperez@colorado.edu>
1844
1853
1845 * IPython/iplib.py (InteractiveShell.handle_shell_assign): Added
1854 * IPython/iplib.py (InteractiveShell.handle_shell_assign): Added
1846 new functionality, to automagically assign the result of a shell
1855 new functionality, to automagically assign the result of a shell
1847 command to a variable. I'll solicit some community feedback on
1856 command to a variable. I'll solicit some community feedback on
1848 this before making it permanent.
1857 this before making it permanent.
1849
1858
1850 * IPython/OInspect.py (Inspector.pinfo): Fix crash when info was
1859 * IPython/OInspect.py (Inspector.pinfo): Fix crash when info was
1851 requested about callables for which inspect couldn't obtain a
1860 requested about callables for which inspect couldn't obtain a
1852 proper argspec. Thanks to a crash report sent by Etienne
1861 proper argspec. Thanks to a crash report sent by Etienne
1853 Posthumus <etienne-AT-apple01.cs.vu.nl>.
1862 Posthumus <etienne-AT-apple01.cs.vu.nl>.
1854
1863
1855 2003-12-09 Fernando Perez <fperez@colorado.edu>
1864 2003-12-09 Fernando Perez <fperez@colorado.edu>
1856
1865
1857 * IPython/genutils.py (page): patch for the pager to work across
1866 * IPython/genutils.py (page): patch for the pager to work across
1858 various versions of Windows. By Gary Bishop.
1867 various versions of Windows. By Gary Bishop.
1859
1868
1860 2003-12-04 Fernando Perez <fperez@colorado.edu>
1869 2003-12-04 Fernando Perez <fperez@colorado.edu>
1861
1870
1862 * IPython/Gnuplot2.py (PlotItems): Fixes for working with
1871 * IPython/Gnuplot2.py (PlotItems): Fixes for working with
1863 Gnuplot.py version 1.7, whose internal names changed quite a bit.
1872 Gnuplot.py version 1.7, whose internal names changed quite a bit.
1864 While I tested this and it looks ok, there may still be corner
1873 While I tested this and it looks ok, there may still be corner
1865 cases I've missed.
1874 cases I've missed.
1866
1875
1867 2003-12-01 Fernando Perez <fperez@colorado.edu>
1876 2003-12-01 Fernando Perez <fperez@colorado.edu>
1868
1877
1869 * IPython/iplib.py (InteractiveShell._prefilter): Fixed a bug
1878 * IPython/iplib.py (InteractiveShell._prefilter): Fixed a bug
1870 where a line like 'p,q=1,2' would fail because the automagic
1879 where a line like 'p,q=1,2' would fail because the automagic
1871 system would be triggered for @p.
1880 system would be triggered for @p.
1872
1881
1873 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): Tab-related
1882 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): Tab-related
1874 cleanups, code unmodified.
1883 cleanups, code unmodified.
1875
1884
1876 * IPython/genutils.py (Term): added a class for IPython to handle
1885 * IPython/genutils.py (Term): added a class for IPython to handle
1877 output. In most cases it will just be a proxy for stdout/err, but
1886 output. In most cases it will just be a proxy for stdout/err, but
1878 having this allows modifications to be made for some platforms,
1887 having this allows modifications to be made for some platforms,
1879 such as handling color escapes under Windows. All of this code
1888 such as handling color escapes under Windows. All of this code
1880 was contributed by Gary Bishop, with minor modifications by me.
1889 was contributed by Gary Bishop, with minor modifications by me.
1881 The actual changes affect many files.
1890 The actual changes affect many files.
1882
1891
1883 2003-11-30 Fernando Perez <fperez@colorado.edu>
1892 2003-11-30 Fernando Perez <fperez@colorado.edu>
1884
1893
1885 * IPython/iplib.py (file_matches): new completion code, courtesy
1894 * IPython/iplib.py (file_matches): new completion code, courtesy
1886 of Jeff Collins. This enables filename completion again under
1895 of Jeff Collins. This enables filename completion again under
1887 python 2.3, which disabled it at the C level.
1896 python 2.3, which disabled it at the C level.
1888
1897
1889 2003-11-11 Fernando Perez <fperez@colorado.edu>
1898 2003-11-11 Fernando Perez <fperez@colorado.edu>
1890
1899
1891 * IPython/numutils.py (amap): Added amap() fn. Simple shorthand
1900 * IPython/numutils.py (amap): Added amap() fn. Simple shorthand
1892 for Numeric.array(map(...)), but often convenient.
1901 for Numeric.array(map(...)), but often convenient.
1893
1902
1894 2003-11-05 Fernando Perez <fperez@colorado.edu>
1903 2003-11-05 Fernando Perez <fperez@colorado.edu>
1895
1904
1896 * IPython/numutils.py (frange): Changed a call from int() to
1905 * IPython/numutils.py (frange): Changed a call from int() to
1897 int(round()) to prevent a problem reported with arange() in the
1906 int(round()) to prevent a problem reported with arange() in the
1898 numpy list.
1907 numpy list.
1899
1908
1900 2003-10-06 Fernando Perez <fperez@colorado.edu>
1909 2003-10-06 Fernando Perez <fperez@colorado.edu>
1901
1910
1902 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): changed to
1911 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): changed to
1903 prevent crashes if sys lacks an argv attribute (it happens with
1912 prevent crashes if sys lacks an argv attribute (it happens with
1904 embedded interpreters which build a bare-bones sys module).
1913 embedded interpreters which build a bare-bones sys module).
1905 Thanks to a report/bugfix by Adam Hupp <hupp-AT-cs.wisc.edu>.
1914 Thanks to a report/bugfix by Adam Hupp <hupp-AT-cs.wisc.edu>.
1906
1915
1907 2003-09-24 Fernando Perez <fperez@colorado.edu>
1916 2003-09-24 Fernando Perez <fperez@colorado.edu>
1908
1917
1909 * IPython/Magic.py (Magic._ofind): blanket except around getattr()
1918 * IPython/Magic.py (Magic._ofind): blanket except around getattr()
1910 to protect against poorly written user objects where __getattr__
1919 to protect against poorly written user objects where __getattr__
1911 raises exceptions other than AttributeError. Thanks to a bug
1920 raises exceptions other than AttributeError. Thanks to a bug
1912 report by Oliver Sander <osander-AT-gmx.de>.
1921 report by Oliver Sander <osander-AT-gmx.de>.
1913
1922
1914 * IPython/FakeModule.py (FakeModule.__repr__): this method was
1923 * IPython/FakeModule.py (FakeModule.__repr__): this method was
1915 missing. Thanks to bug report by Ralf Schmitt <ralf-AT-brainbot.com>.
1924 missing. Thanks to bug report by Ralf Schmitt <ralf-AT-brainbot.com>.
1916
1925
1917 2003-09-09 Fernando Perez <fperez@colorado.edu>
1926 2003-09-09 Fernando Perez <fperez@colorado.edu>
1918
1927
1919 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
1928 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
1920 unpacking a list whith a callable as first element would
1929 unpacking a list whith a callable as first element would
1921 mistakenly trigger autocalling. Thanks to a bug report by Jeffery
1930 mistakenly trigger autocalling. Thanks to a bug report by Jeffery
1922 Collins.
1931 Collins.
1923
1932
1924 2003-08-25 *** Released version 0.5.0
1933 2003-08-25 *** Released version 0.5.0
1925
1934
1926 2003-08-22 Fernando Perez <fperez@colorado.edu>
1935 2003-08-22 Fernando Perez <fperez@colorado.edu>
1927
1936
1928 * IPython/ultraTB.py (VerboseTB.linereader): Improved handling of
1937 * IPython/ultraTB.py (VerboseTB.linereader): Improved handling of
1929 improperly defined user exceptions. Thanks to feedback from Mark
1938 improperly defined user exceptions. Thanks to feedback from Mark
1930 Russell <mrussell-AT-verio.net>.
1939 Russell <mrussell-AT-verio.net>.
1931
1940
1932 2003-08-20 Fernando Perez <fperez@colorado.edu>
1941 2003-08-20 Fernando Perez <fperez@colorado.edu>
1933
1942
1934 * IPython/OInspect.py (Inspector.pinfo): changed String Form
1943 * IPython/OInspect.py (Inspector.pinfo): changed String Form
1935 printing so that it would print multi-line string forms starting
1944 printing so that it would print multi-line string forms starting
1936 with a new line. This way the formatting is better respected for
1945 with a new line. This way the formatting is better respected for
1937 objects which work hard to make nice string forms.
1946 objects which work hard to make nice string forms.
1938
1947
1939 * IPython/iplib.py (InteractiveShell.handle_auto): Fix bug where
1948 * IPython/iplib.py (InteractiveShell.handle_auto): Fix bug where
1940 autocall would overtake data access for objects with both
1949 autocall would overtake data access for objects with both
1941 __getitem__ and __call__.
1950 __getitem__ and __call__.
1942
1951
1943 2003-08-19 *** Released version 0.5.0-rc1
1952 2003-08-19 *** Released version 0.5.0-rc1
1944
1953
1945 2003-08-19 Fernando Perez <fperez@colorado.edu>
1954 2003-08-19 Fernando Perez <fperez@colorado.edu>
1946
1955
1947 * IPython/deep_reload.py (load_tail): single tiny change here
1956 * IPython/deep_reload.py (load_tail): single tiny change here
1948 seems to fix the long-standing bug of dreload() failing to work
1957 seems to fix the long-standing bug of dreload() failing to work
1949 for dotted names. But this module is pretty tricky, so I may have
1958 for dotted names. But this module is pretty tricky, so I may have
1950 missed some subtlety. Needs more testing!.
1959 missed some subtlety. Needs more testing!.
1951
1960
1952 * IPython/ultraTB.py (VerboseTB.linereader): harden against user
1961 * IPython/ultraTB.py (VerboseTB.linereader): harden against user
1953 exceptions which have badly implemented __str__ methods.
1962 exceptions which have badly implemented __str__ methods.
1954 (VerboseTB.text): harden against inspect.getinnerframes crashing,
1963 (VerboseTB.text): harden against inspect.getinnerframes crashing,
1955 which I've been getting reports about from Python 2.3 users. I
1964 which I've been getting reports about from Python 2.3 users. I
1956 wish I had a simple test case to reproduce the problem, so I could
1965 wish I had a simple test case to reproduce the problem, so I could
1957 either write a cleaner workaround or file a bug report if
1966 either write a cleaner workaround or file a bug report if
1958 necessary.
1967 necessary.
1959
1968
1960 * IPython/Magic.py (Magic.magic_edit): fixed bug where after
1969 * IPython/Magic.py (Magic.magic_edit): fixed bug where after
1961 making a class 'foo', file 'foo.py' couldn't be edited. Thanks to
1970 making a class 'foo', file 'foo.py' couldn't be edited. Thanks to
1962 a bug report by Tjabo Kloppenburg.
1971 a bug report by Tjabo Kloppenburg.
1963
1972
1964 * IPython/ultraTB.py (VerboseTB.debugger): hardened against pdb
1973 * IPython/ultraTB.py (VerboseTB.debugger): hardened against pdb
1965 crashes. Wrapped the pdb call in a blanket try/except, since pdb
1974 crashes. Wrapped the pdb call in a blanket try/except, since pdb
1966 seems rather unstable. Thanks to a bug report by Tjabo
1975 seems rather unstable. Thanks to a bug report by Tjabo
1967 Kloppenburg <tjabo.kloppenburg-AT-unix-ag.uni-siegen.de>.
1976 Kloppenburg <tjabo.kloppenburg-AT-unix-ag.uni-siegen.de>.
1968
1977
1969 * IPython/Release.py (version): release 0.5.0-rc1. I want to put
1978 * IPython/Release.py (version): release 0.5.0-rc1. I want to put
1970 this out soon because of the critical fixes in the inner loop for
1979 this out soon because of the critical fixes in the inner loop for
1971 generators.
1980 generators.
1972
1981
1973 * IPython/Magic.py (Magic.getargspec): removed. This (and
1982 * IPython/Magic.py (Magic.getargspec): removed. This (and
1974 _get_def) have been obsoleted by OInspect for a long time, I
1983 _get_def) have been obsoleted by OInspect for a long time, I
1975 hadn't noticed that they were dead code.
1984 hadn't noticed that they were dead code.
1976 (Magic._ofind): restored _ofind functionality for a few literals
1985 (Magic._ofind): restored _ofind functionality for a few literals
1977 (those in ["''",'""','[]','{}','()']). But it won't work anymore
1986 (those in ["''",'""','[]','{}','()']). But it won't work anymore
1978 for things like "hello".capitalize?, since that would require a
1987 for things like "hello".capitalize?, since that would require a
1979 potentially dangerous eval() again.
1988 potentially dangerous eval() again.
1980
1989
1981 * IPython/iplib.py (InteractiveShell._prefilter): reorganized the
1990 * IPython/iplib.py (InteractiveShell._prefilter): reorganized the
1982 logic a bit more to clean up the escapes handling and minimize the
1991 logic a bit more to clean up the escapes handling and minimize the
1983 use of _ofind to only necessary cases. The interactive 'feel' of
1992 use of _ofind to only necessary cases. The interactive 'feel' of
1984 IPython should have improved quite a bit with the changes in
1993 IPython should have improved quite a bit with the changes in
1985 _prefilter and _ofind (besides being far safer than before).
1994 _prefilter and _ofind (besides being far safer than before).
1986
1995
1987 * IPython/Magic.py (Magic.magic_edit): Fixed old bug (but rather
1996 * IPython/Magic.py (Magic.magic_edit): Fixed old bug (but rather
1988 obscure, never reported). Edit would fail to find the object to
1997 obscure, never reported). Edit would fail to find the object to
1989 edit under some circumstances.
1998 edit under some circumstances.
1990 (Magic._ofind): CRITICAL FIX. Finally removed the eval() calls
1999 (Magic._ofind): CRITICAL FIX. Finally removed the eval() calls
1991 which were causing double-calling of generators. Those eval calls
2000 which were causing double-calling of generators. Those eval calls
1992 were _very_ dangerous, since code with side effects could be
2001 were _very_ dangerous, since code with side effects could be
1993 triggered. As they say, 'eval is evil'... These were the
2002 triggered. As they say, 'eval is evil'... These were the
1994 nastiest evals in IPython. Besides, _ofind is now far simpler,
2003 nastiest evals in IPython. Besides, _ofind is now far simpler,
1995 and it should also be quite a bit faster. Its use of inspect is
2004 and it should also be quite a bit faster. Its use of inspect is
1996 also safer, so perhaps some of the inspect-related crashes I've
2005 also safer, so perhaps some of the inspect-related crashes I've
1997 seen lately with Python 2.3 might be taken care of. That will
2006 seen lately with Python 2.3 might be taken care of. That will
1998 need more testing.
2007 need more testing.
1999
2008
2000 2003-08-17 Fernando Perez <fperez@colorado.edu>
2009 2003-08-17 Fernando Perez <fperez@colorado.edu>
2001
2010
2002 * IPython/iplib.py (InteractiveShell._prefilter): significant
2011 * IPython/iplib.py (InteractiveShell._prefilter): significant
2003 simplifications to the logic for handling user escapes. Faster
2012 simplifications to the logic for handling user escapes. Faster
2004 and simpler code.
2013 and simpler code.
2005
2014
2006 2003-08-14 Fernando Perez <fperez@colorado.edu>
2015 2003-08-14 Fernando Perez <fperez@colorado.edu>
2007
2016
2008 * IPython/numutils.py (sum_flat): rewrote to be non-recursive.
2017 * IPython/numutils.py (sum_flat): rewrote to be non-recursive.
2009 Now it requires O(N) storage (N=size(a)) for non-contiguous input,
2018 Now it requires O(N) storage (N=size(a)) for non-contiguous input,
2010 but it should be quite a bit faster. And the recursive version
2019 but it should be quite a bit faster. And the recursive version
2011 generated O(log N) intermediate storage for all rank>1 arrays,
2020 generated O(log N) intermediate storage for all rank>1 arrays,
2012 even if they were contiguous.
2021 even if they were contiguous.
2013 (l1norm): Added this function.
2022 (l1norm): Added this function.
2014 (norm): Added this function for arbitrary norms (including
2023 (norm): Added this function for arbitrary norms (including
2015 l-infinity). l1 and l2 are still special cases for convenience
2024 l-infinity). l1 and l2 are still special cases for convenience
2016 and speed.
2025 and speed.
2017
2026
2018 2003-08-03 Fernando Perez <fperez@colorado.edu>
2027 2003-08-03 Fernando Perez <fperez@colorado.edu>
2019
2028
2020 * IPython/Magic.py (Magic.magic_edit): Removed all remaining string
2029 * IPython/Magic.py (Magic.magic_edit): Removed all remaining string
2021 exceptions, which now raise PendingDeprecationWarnings in Python
2030 exceptions, which now raise PendingDeprecationWarnings in Python
2022 2.3. There were some in Magic and some in Gnuplot2.
2031 2.3. There were some in Magic and some in Gnuplot2.
2023
2032
2024 2003-06-30 Fernando Perez <fperez@colorado.edu>
2033 2003-06-30 Fernando Perez <fperez@colorado.edu>
2025
2034
2026 * IPython/genutils.py (page): modified to call curses only for
2035 * IPython/genutils.py (page): modified to call curses only for
2027 terminals where TERM=='xterm'. After problems under many other
2036 terminals where TERM=='xterm'. After problems under many other
2028 terminals were reported by Keith Beattie <KSBeattie-AT-lbl.gov>.
2037 terminals were reported by Keith Beattie <KSBeattie-AT-lbl.gov>.
2029
2038
2030 * IPython/iplib.py (complete): removed spurious 'print "IE"' which
2039 * IPython/iplib.py (complete): removed spurious 'print "IE"' which
2031 would be triggered when readline was absent. This was just an old
2040 would be triggered when readline was absent. This was just an old
2032 debugging statement I'd forgotten to take out.
2041 debugging statement I'd forgotten to take out.
2033
2042
2034 2003-06-20 Fernando Perez <fperez@colorado.edu>
2043 2003-06-20 Fernando Perez <fperez@colorado.edu>
2035
2044
2036 * IPython/genutils.py (clock): modified to return only user time
2045 * IPython/genutils.py (clock): modified to return only user time
2037 (not counting system time), after a discussion on scipy. While
2046 (not counting system time), after a discussion on scipy. While
2038 system time may be a useful quantity occasionally, it may much
2047 system time may be a useful quantity occasionally, it may much
2039 more easily be skewed by occasional swapping or other similar
2048 more easily be skewed by occasional swapping or other similar
2040 activity.
2049 activity.
2041
2050
2042 2003-06-05 Fernando Perez <fperez@colorado.edu>
2051 2003-06-05 Fernando Perez <fperez@colorado.edu>
2043
2052
2044 * IPython/numutils.py (identity): new function, for building
2053 * IPython/numutils.py (identity): new function, for building
2045 arbitrary rank Kronecker deltas (mostly backwards compatible with
2054 arbitrary rank Kronecker deltas (mostly backwards compatible with
2046 Numeric.identity)
2055 Numeric.identity)
2047
2056
2048 2003-06-03 Fernando Perez <fperez@colorado.edu>
2057 2003-06-03 Fernando Perez <fperez@colorado.edu>
2049
2058
2050 * IPython/iplib.py (InteractiveShell.handle_magic): protect
2059 * IPython/iplib.py (InteractiveShell.handle_magic): protect
2051 arguments passed to magics with spaces, to allow trailing '\' to
2060 arguments passed to magics with spaces, to allow trailing '\' to
2052 work normally (mainly for Windows users).
2061 work normally (mainly for Windows users).
2053
2062
2054 2003-05-29 Fernando Perez <fperez@colorado.edu>
2063 2003-05-29 Fernando Perez <fperez@colorado.edu>
2055
2064
2056 * IPython/ipmaker.py (make_IPython): Load site._Helper() as help
2065 * IPython/ipmaker.py (make_IPython): Load site._Helper() as help
2057 instead of pydoc.help. This fixes a bizarre behavior where
2066 instead of pydoc.help. This fixes a bizarre behavior where
2058 printing '%s' % locals() would trigger the help system. Now
2067 printing '%s' % locals() would trigger the help system. Now
2059 ipython behaves like normal python does.
2068 ipython behaves like normal python does.
2060
2069
2061 Note that if one does 'from pydoc import help', the bizarre
2070 Note that if one does 'from pydoc import help', the bizarre
2062 behavior returns, but this will also happen in normal python, so
2071 behavior returns, but this will also happen in normal python, so
2063 it's not an ipython bug anymore (it has to do with how pydoc.help
2072 it's not an ipython bug anymore (it has to do with how pydoc.help
2064 is implemented).
2073 is implemented).
2065
2074
2066 2003-05-22 Fernando Perez <fperez@colorado.edu>
2075 2003-05-22 Fernando Perez <fperez@colorado.edu>
2067
2076
2068 * IPython/FlexCompleter.py (Completer.attr_matches): fixed to
2077 * IPython/FlexCompleter.py (Completer.attr_matches): fixed to
2069 return [] instead of None when nothing matches, also match to end
2078 return [] instead of None when nothing matches, also match to end
2070 of line. Patch by Gary Bishop.
2079 of line. Patch by Gary Bishop.
2071
2080
2072 * IPython/ipmaker.py (make_IPython): Added same sys.excepthook
2081 * IPython/ipmaker.py (make_IPython): Added same sys.excepthook
2073 protection as before, for files passed on the command line. This
2082 protection as before, for files passed on the command line. This
2074 prevents the CrashHandler from kicking in if user files call into
2083 prevents the CrashHandler from kicking in if user files call into
2075 sys.excepthook (such as PyQt and WxWindows have a nasty habit of
2084 sys.excepthook (such as PyQt and WxWindows have a nasty habit of
2076 doing). After a report by Kasper Souren <Kasper.Souren-AT-ircam.fr>
2085 doing). After a report by Kasper Souren <Kasper.Souren-AT-ircam.fr>
2077
2086
2078 2003-05-20 *** Released version 0.4.0
2087 2003-05-20 *** Released version 0.4.0
2079
2088
2080 2003-05-20 Fernando Perez <fperez@colorado.edu>
2089 2003-05-20 Fernando Perez <fperez@colorado.edu>
2081
2090
2082 * setup.py: added support for manpages. It's a bit hackish b/c of
2091 * setup.py: added support for manpages. It's a bit hackish b/c of
2083 a bug in the way the bdist_rpm distutils target handles gzipped
2092 a bug in the way the bdist_rpm distutils target handles gzipped
2084 manpages, but it works. After a patch by Jack.
2093 manpages, but it works. After a patch by Jack.
2085
2094
2086 2003-05-19 Fernando Perez <fperez@colorado.edu>
2095 2003-05-19 Fernando Perez <fperez@colorado.edu>
2087
2096
2088 * IPython/numutils.py: added a mockup of the kinds module, since
2097 * IPython/numutils.py: added a mockup of the kinds module, since
2089 it was recently removed from Numeric. This way, numutils will
2098 it was recently removed from Numeric. This way, numutils will
2090 work for all users even if they are missing kinds.
2099 work for all users even if they are missing kinds.
2091
2100
2092 * IPython/Magic.py (Magic._ofind): Harden against an inspect
2101 * IPython/Magic.py (Magic._ofind): Harden against an inspect
2093 failure, which can occur with SWIG-wrapped extensions. After a
2102 failure, which can occur with SWIG-wrapped extensions. After a
2094 crash report from Prabhu.
2103 crash report from Prabhu.
2095
2104
2096 2003-05-16 Fernando Perez <fperez@colorado.edu>
2105 2003-05-16 Fernando Perez <fperez@colorado.edu>
2097
2106
2098 * IPython/iplib.py (InteractiveShell.excepthook): New method to
2107 * IPython/iplib.py (InteractiveShell.excepthook): New method to
2099 protect ipython from user code which may call directly
2108 protect ipython from user code which may call directly
2100 sys.excepthook (this looks like an ipython crash to the user, even
2109 sys.excepthook (this looks like an ipython crash to the user, even
2101 when it isn't). After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
2110 when it isn't). After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
2102 This is especially important to help users of WxWindows, but may
2111 This is especially important to help users of WxWindows, but may
2103 also be useful in other cases.
2112 also be useful in other cases.
2104
2113
2105 * IPython/ultraTB.py (AutoFormattedTB.__call__): Changed to allow
2114 * IPython/ultraTB.py (AutoFormattedTB.__call__): Changed to allow
2106 an optional tb_offset to be specified, and to preserve exception
2115 an optional tb_offset to be specified, and to preserve exception
2107 info if given. After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
2116 info if given. After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
2108
2117
2109 * ipython.1 (Default): Thanks to Jack's work, we now have manpages!
2118 * ipython.1 (Default): Thanks to Jack's work, we now have manpages!
2110
2119
2111 2003-05-15 Fernando Perez <fperez@colorado.edu>
2120 2003-05-15 Fernando Perez <fperez@colorado.edu>
2112
2121
2113 * IPython/iplib.py (InteractiveShell.user_setup): Fix crash when
2122 * IPython/iplib.py (InteractiveShell.user_setup): Fix crash when
2114 installing for a new user under Windows.
2123 installing for a new user under Windows.
2115
2124
2116 2003-05-12 Fernando Perez <fperez@colorado.edu>
2125 2003-05-12 Fernando Perez <fperez@colorado.edu>
2117
2126
2118 * IPython/iplib.py (InteractiveShell.handle_emacs): New line
2127 * IPython/iplib.py (InteractiveShell.handle_emacs): New line
2119 handler for Emacs comint-based lines. Currently it doesn't do
2128 handler for Emacs comint-based lines. Currently it doesn't do
2120 much (but importantly, it doesn't update the history cache). In
2129 much (but importantly, it doesn't update the history cache). In
2121 the future it may be expanded if Alex needs more functionality
2130 the future it may be expanded if Alex needs more functionality
2122 there.
2131 there.
2123
2132
2124 * IPython/CrashHandler.py (CrashHandler.__call__): Added platform
2133 * IPython/CrashHandler.py (CrashHandler.__call__): Added platform
2125 info to crash reports.
2134 info to crash reports.
2126
2135
2127 * IPython/iplib.py (InteractiveShell.mainloop): Added -c option,
2136 * IPython/iplib.py (InteractiveShell.mainloop): Added -c option,
2128 just like Python's -c. Also fixed crash with invalid -color
2137 just like Python's -c. Also fixed crash with invalid -color
2129 option value at startup. Thanks to Will French
2138 option value at startup. Thanks to Will French
2130 <wfrench-AT-bestweb.net> for the bug report.
2139 <wfrench-AT-bestweb.net> for the bug report.
2131
2140
2132 2003-05-09 Fernando Perez <fperez@colorado.edu>
2141 2003-05-09 Fernando Perez <fperez@colorado.edu>
2133
2142
2134 * IPython/genutils.py (EvalDict.__getitem__): Renamed EvalString
2143 * IPython/genutils.py (EvalDict.__getitem__): Renamed EvalString
2135 to EvalDict (it's a mapping, after all) and simplified its code
2144 to EvalDict (it's a mapping, after all) and simplified its code
2136 quite a bit, after a nice discussion on c.l.py where Gustavo
2145 quite a bit, after a nice discussion on c.l.py where Gustavo
2137 Córdova <gcordova-AT-sismex.com> suggested the new version.
2146 Córdova <gcordova-AT-sismex.com> suggested the new version.
2138
2147
2139 2003-04-30 Fernando Perez <fperez@colorado.edu>
2148 2003-04-30 Fernando Perez <fperez@colorado.edu>
2140
2149
2141 * IPython/genutils.py (timings_out): modified it to reduce its
2150 * IPython/genutils.py (timings_out): modified it to reduce its
2142 overhead in the common reps==1 case.
2151 overhead in the common reps==1 case.
2143
2152
2144 2003-04-29 Fernando Perez <fperez@colorado.edu>
2153 2003-04-29 Fernando Perez <fperez@colorado.edu>
2145
2154
2146 * IPython/genutils.py (timings_out): Modified to use the resource
2155 * IPython/genutils.py (timings_out): Modified to use the resource
2147 module, which avoids the wraparound problems of time.clock().
2156 module, which avoids the wraparound problems of time.clock().
2148
2157
2149 2003-04-17 *** Released version 0.2.15pre4
2158 2003-04-17 *** Released version 0.2.15pre4
2150
2159
2151 2003-04-17 Fernando Perez <fperez@colorado.edu>
2160 2003-04-17 Fernando Perez <fperez@colorado.edu>
2152
2161
2153 * setup.py (scriptfiles): Split windows-specific stuff over to a
2162 * setup.py (scriptfiles): Split windows-specific stuff over to a
2154 separate file, in an attempt to have a Windows GUI installer.
2163 separate file, in an attempt to have a Windows GUI installer.
2155 That didn't work, but part of the groundwork is done.
2164 That didn't work, but part of the groundwork is done.
2156
2165
2157 * IPython/UserConfig/ipythonrc: Added M-i, M-o and M-I for
2166 * IPython/UserConfig/ipythonrc: Added M-i, M-o and M-I for
2158 indent/unindent with 4 spaces. Particularly useful in combination
2167 indent/unindent with 4 spaces. Particularly useful in combination
2159 with the new auto-indent option.
2168 with the new auto-indent option.
2160
2169
2161 2003-04-16 Fernando Perez <fperez@colorado.edu>
2170 2003-04-16 Fernando Perez <fperez@colorado.edu>
2162
2171
2163 * IPython/Magic.py: various replacements of self.rc for
2172 * IPython/Magic.py: various replacements of self.rc for
2164 self.shell.rc. A lot more remains to be done to fully disentangle
2173 self.shell.rc. A lot more remains to be done to fully disentangle
2165 this class from the main Shell class.
2174 this class from the main Shell class.
2166
2175
2167 * IPython/GnuplotRuntime.py: added checks for mouse support so
2176 * IPython/GnuplotRuntime.py: added checks for mouse support so
2168 that we don't try to enable it if the current gnuplot doesn't
2177 that we don't try to enable it if the current gnuplot doesn't
2169 really support it. Also added checks so that we don't try to
2178 really support it. Also added checks so that we don't try to
2170 enable persist under Windows (where Gnuplot doesn't recognize the
2179 enable persist under Windows (where Gnuplot doesn't recognize the
2171 option).
2180 option).
2172
2181
2173 * IPython/iplib.py (InteractiveShell.interact): Added optional
2182 * IPython/iplib.py (InteractiveShell.interact): Added optional
2174 auto-indenting code, after a patch by King C. Shu
2183 auto-indenting code, after a patch by King C. Shu
2175 <kingshu-AT-myrealbox.com>. It's off by default because it doesn't
2184 <kingshu-AT-myrealbox.com>. It's off by default because it doesn't
2176 get along well with pasting indented code. If I ever figure out
2185 get along well with pasting indented code. If I ever figure out
2177 how to make that part go well, it will become on by default.
2186 how to make that part go well, it will become on by default.
2178
2187
2179 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixed bug which would
2188 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixed bug which would
2180 crash ipython if there was an unmatched '%' in the user's prompt
2189 crash ipython if there was an unmatched '%' in the user's prompt
2181 string. Reported by Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
2190 string. Reported by Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
2182
2191
2183 * IPython/iplib.py (InteractiveShell.interact): removed the
2192 * IPython/iplib.py (InteractiveShell.interact): removed the
2184 ability to ask the user whether he wants to crash or not at the
2193 ability to ask the user whether he wants to crash or not at the
2185 'last line' exception handler. Calling functions at that point
2194 'last line' exception handler. Calling functions at that point
2186 changes the stack, and the error reports would have incorrect
2195 changes the stack, and the error reports would have incorrect
2187 tracebacks.
2196 tracebacks.
2188
2197
2189 * IPython/Magic.py (Magic.magic_page): Added new @page magic, to
2198 * IPython/Magic.py (Magic.magic_page): Added new @page magic, to
2190 pass through a peger a pretty-printed form of any object. After a
2199 pass through a peger a pretty-printed form of any object. After a
2191 contribution by Olivier Aubert <oaubert-AT-bat710.univ-lyon1.fr>
2200 contribution by Olivier Aubert <oaubert-AT-bat710.univ-lyon1.fr>
2192
2201
2193 2003-04-14 Fernando Perez <fperez@colorado.edu>
2202 2003-04-14 Fernando Perez <fperez@colorado.edu>
2194
2203
2195 * IPython/iplib.py (InteractiveShell.user_setup): Fixed bug where
2204 * IPython/iplib.py (InteractiveShell.user_setup): Fixed bug where
2196 all files in ~ would be modified at first install (instead of
2205 all files in ~ would be modified at first install (instead of
2197 ~/.ipython). This could be potentially disastrous, as the
2206 ~/.ipython). This could be potentially disastrous, as the
2198 modification (make line-endings native) could damage binary files.
2207 modification (make line-endings native) could damage binary files.
2199
2208
2200 2003-04-10 Fernando Perez <fperez@colorado.edu>
2209 2003-04-10 Fernando Perez <fperez@colorado.edu>
2201
2210
2202 * IPython/iplib.py (InteractiveShell.handle_help): Modified to
2211 * IPython/iplib.py (InteractiveShell.handle_help): Modified to
2203 handle only lines which are invalid python. This now means that
2212 handle only lines which are invalid python. This now means that
2204 lines like 'x=1 #?' execute properly. Thanks to Jeffery Collins
2213 lines like 'x=1 #?' execute properly. Thanks to Jeffery Collins
2205 for the bug report.
2214 for the bug report.
2206
2215
2207 2003-04-01 Fernando Perez <fperez@colorado.edu>
2216 2003-04-01 Fernando Perez <fperez@colorado.edu>
2208
2217
2209 * IPython/iplib.py (InteractiveShell.showtraceback): Fixed bug
2218 * IPython/iplib.py (InteractiveShell.showtraceback): Fixed bug
2210 where failing to set sys.last_traceback would crash pdb.pm().
2219 where failing to set sys.last_traceback would crash pdb.pm().
2211 Thanks to Jeffery D. Collins <Jeff.Collins-AT-vexcel.com> for the bug
2220 Thanks to Jeffery D. Collins <Jeff.Collins-AT-vexcel.com> for the bug
2212 report.
2221 report.
2213
2222
2214 2003-03-25 Fernando Perez <fperez@colorado.edu>
2223 2003-03-25 Fernando Perez <fperez@colorado.edu>
2215
2224
2216 * IPython/Magic.py (Magic.magic_prun): rstrip() output of profiler
2225 * IPython/Magic.py (Magic.magic_prun): rstrip() output of profiler
2217 before printing it (it had a lot of spurious blank lines at the
2226 before printing it (it had a lot of spurious blank lines at the
2218 end).
2227 end).
2219
2228
2220 * IPython/Gnuplot2.py (Gnuplot.hardcopy): fixed bug where lpr
2229 * IPython/Gnuplot2.py (Gnuplot.hardcopy): fixed bug where lpr
2221 output would be sent 21 times! Obviously people don't use this
2230 output would be sent 21 times! Obviously people don't use this
2222 too often, or I would have heard about it.
2231 too often, or I would have heard about it.
2223
2232
2224 2003-03-24 Fernando Perez <fperez@colorado.edu>
2233 2003-03-24 Fernando Perez <fperez@colorado.edu>
2225
2234
2226 * setup.py (scriptfiles): renamed the data_files parameter from
2235 * setup.py (scriptfiles): renamed the data_files parameter from
2227 'base' to 'data' to fix rpm build issues. Thanks to Ralf Ahlbrink
2236 'base' to 'data' to fix rpm build issues. Thanks to Ralf Ahlbrink
2228 for the patch.
2237 for the patch.
2229
2238
2230 2003-03-20 Fernando Perez <fperez@colorado.edu>
2239 2003-03-20 Fernando Perez <fperez@colorado.edu>
2231
2240
2232 * IPython/genutils.py (error): added error() and fatal()
2241 * IPython/genutils.py (error): added error() and fatal()
2233 functions.
2242 functions.
2234
2243
2235 2003-03-18 *** Released version 0.2.15pre3
2244 2003-03-18 *** Released version 0.2.15pre3
2236
2245
2237 2003-03-18 Fernando Perez <fperez@colorado.edu>
2246 2003-03-18 Fernando Perez <fperez@colorado.edu>
2238
2247
2239 * setupext/install_data_ext.py
2248 * setupext/install_data_ext.py
2240 (install_data_ext.initialize_options): Class contributed by Jack
2249 (install_data_ext.initialize_options): Class contributed by Jack
2241 Moffit for fixing the old distutils hack. He is sending this to
2250 Moffit for fixing the old distutils hack. He is sending this to
2242 the distutils folks so in the future we may not need it as a
2251 the distutils folks so in the future we may not need it as a
2243 private fix.
2252 private fix.
2244
2253
2245 * MANIFEST.in: Extensive reorganization, based on Jack Moffit's
2254 * MANIFEST.in: Extensive reorganization, based on Jack Moffit's
2246 changes for Debian packaging. See his patch for full details.
2255 changes for Debian packaging. See his patch for full details.
2247 The old distutils hack of making the ipythonrc* files carry a
2256 The old distutils hack of making the ipythonrc* files carry a
2248 bogus .py extension is gone, at last. Examples were moved to a
2257 bogus .py extension is gone, at last. Examples were moved to a
2249 separate subdir under doc/, and the separate executable scripts
2258 separate subdir under doc/, and the separate executable scripts
2250 now live in their own directory. Overall a great cleanup. The
2259 now live in their own directory. Overall a great cleanup. The
2251 manual was updated to use the new files, and setup.py has been
2260 manual was updated to use the new files, and setup.py has been
2252 fixed for this setup.
2261 fixed for this setup.
2253
2262
2254 * IPython/PyColorize.py (Parser.usage): made non-executable and
2263 * IPython/PyColorize.py (Parser.usage): made non-executable and
2255 created a pycolor wrapper around it to be included as a script.
2264 created a pycolor wrapper around it to be included as a script.
2256
2265
2257 2003-03-12 *** Released version 0.2.15pre2
2266 2003-03-12 *** Released version 0.2.15pre2
2258
2267
2259 2003-03-12 Fernando Perez <fperez@colorado.edu>
2268 2003-03-12 Fernando Perez <fperez@colorado.edu>
2260
2269
2261 * IPython/ColorANSI.py (make_color_table): Finally fixed the
2270 * IPython/ColorANSI.py (make_color_table): Finally fixed the
2262 long-standing problem with garbage characters in some terminals.
2271 long-standing problem with garbage characters in some terminals.
2263 The issue was really that the \001 and \002 escapes must _only_ be
2272 The issue was really that the \001 and \002 escapes must _only_ be
2264 passed to input prompts (which call readline), but _never_ to
2273 passed to input prompts (which call readline), but _never_ to
2265 normal text to be printed on screen. I changed ColorANSI to have
2274 normal text to be printed on screen. I changed ColorANSI to have
2266 two classes: TermColors and InputTermColors, each with the
2275 two classes: TermColors and InputTermColors, each with the
2267 appropriate escapes for input prompts or normal text. The code in
2276 appropriate escapes for input prompts or normal text. The code in
2268 Prompts.py got slightly more complicated, but this very old and
2277 Prompts.py got slightly more complicated, but this very old and
2269 annoying bug is finally fixed.
2278 annoying bug is finally fixed.
2270
2279
2271 All the credit for nailing down the real origin of this problem
2280 All the credit for nailing down the real origin of this problem
2272 and the correct solution goes to Jack Moffit <jack-AT-xiph.org>.
2281 and the correct solution goes to Jack Moffit <jack-AT-xiph.org>.
2273 *Many* thanks to him for spending quite a bit of effort on this.
2282 *Many* thanks to him for spending quite a bit of effort on this.
2274
2283
2275 2003-03-05 *** Released version 0.2.15pre1
2284 2003-03-05 *** Released version 0.2.15pre1
2276
2285
2277 2003-03-03 Fernando Perez <fperez@colorado.edu>
2286 2003-03-03 Fernando Perez <fperez@colorado.edu>
2278
2287
2279 * IPython/FakeModule.py: Moved the former _FakeModule to a
2288 * IPython/FakeModule.py: Moved the former _FakeModule to a
2280 separate file, because it's also needed by Magic (to fix a similar
2289 separate file, because it's also needed by Magic (to fix a similar
2281 pickle-related issue in @run).
2290 pickle-related issue in @run).
2282
2291
2283 2003-03-02 Fernando Perez <fperez@colorado.edu>
2292 2003-03-02 Fernando Perez <fperez@colorado.edu>
2284
2293
2285 * IPython/Magic.py (Magic.magic_autocall): new magic to control
2294 * IPython/Magic.py (Magic.magic_autocall): new magic to control
2286 the autocall option at runtime.
2295 the autocall option at runtime.
2287 (Magic.magic_dhist): changed self.user_ns to self.shell.user_ns
2296 (Magic.magic_dhist): changed self.user_ns to self.shell.user_ns
2288 across Magic.py to start separating Magic from InteractiveShell.
2297 across Magic.py to start separating Magic from InteractiveShell.
2289 (Magic._ofind): Fixed to return proper namespace for dotted
2298 (Magic._ofind): Fixed to return proper namespace for dotted
2290 names. Before, a dotted name would always return 'not currently
2299 names. Before, a dotted name would always return 'not currently
2291 defined', because it would find the 'parent'. s.x would be found,
2300 defined', because it would find the 'parent'. s.x would be found,
2292 but since 'x' isn't defined by itself, it would get confused.
2301 but since 'x' isn't defined by itself, it would get confused.
2293 (Magic.magic_run): Fixed pickling problems reported by Ralf
2302 (Magic.magic_run): Fixed pickling problems reported by Ralf
2294 Ahlbrink <RAhlbrink-AT-RosenInspection.net>. The fix was similar to
2303 Ahlbrink <RAhlbrink-AT-RosenInspection.net>. The fix was similar to
2295 that I'd used when Mike Heeter reported similar issues at the
2304 that I'd used when Mike Heeter reported similar issues at the
2296 top-level, but now for @run. It boils down to injecting the
2305 top-level, but now for @run. It boils down to injecting the
2297 namespace where code is being executed with something that looks
2306 namespace where code is being executed with something that looks
2298 enough like a module to fool pickle.dump(). Since a pickle stores
2307 enough like a module to fool pickle.dump(). Since a pickle stores
2299 a named reference to the importing module, we need this for
2308 a named reference to the importing module, we need this for
2300 pickles to save something sensible.
2309 pickles to save something sensible.
2301
2310
2302 * IPython/ipmaker.py (make_IPython): added an autocall option.
2311 * IPython/ipmaker.py (make_IPython): added an autocall option.
2303
2312
2304 * IPython/iplib.py (InteractiveShell._prefilter): reordered all of
2313 * IPython/iplib.py (InteractiveShell._prefilter): reordered all of
2305 the auto-eval code. Now autocalling is an option, and the code is
2314 the auto-eval code. Now autocalling is an option, and the code is
2306 also vastly safer. There is no more eval() involved at all.
2315 also vastly safer. There is no more eval() involved at all.
2307
2316
2308 2003-03-01 Fernando Perez <fperez@colorado.edu>
2317 2003-03-01 Fernando Perez <fperez@colorado.edu>
2309
2318
2310 * IPython/Magic.py (Magic._ofind): Changed interface to return a
2319 * IPython/Magic.py (Magic._ofind): Changed interface to return a
2311 dict with named keys instead of a tuple.
2320 dict with named keys instead of a tuple.
2312
2321
2313 * IPython: Started using CVS for IPython as of 0.2.15pre1.
2322 * IPython: Started using CVS for IPython as of 0.2.15pre1.
2314
2323
2315 * setup.py (make_shortcut): Fixed message about directories
2324 * setup.py (make_shortcut): Fixed message about directories
2316 created during Windows installation (the directories were ok, just
2325 created during Windows installation (the directories were ok, just
2317 the printed message was misleading). Thanks to Chris Liechti
2326 the printed message was misleading). Thanks to Chris Liechti
2318 <cliechti-AT-gmx.net> for the heads up.
2327 <cliechti-AT-gmx.net> for the heads up.
2319
2328
2320 2003-02-21 Fernando Perez <fperez@colorado.edu>
2329 2003-02-21 Fernando Perez <fperez@colorado.edu>
2321
2330
2322 * IPython/iplib.py (InteractiveShell._prefilter): Fixed catching
2331 * IPython/iplib.py (InteractiveShell._prefilter): Fixed catching
2323 of ValueError exception when checking for auto-execution. This
2332 of ValueError exception when checking for auto-execution. This
2324 one is raised by things like Numeric arrays arr.flat when the
2333 one is raised by things like Numeric arrays arr.flat when the
2325 array is non-contiguous.
2334 array is non-contiguous.
2326
2335
2327 2003-01-31 Fernando Perez <fperez@colorado.edu>
2336 2003-01-31 Fernando Perez <fperez@colorado.edu>
2328
2337
2329 * IPython/genutils.py (SystemExec.bq): Fixed bug where bq would
2338 * IPython/genutils.py (SystemExec.bq): Fixed bug where bq would
2330 not return any value at all (even though the command would get
2339 not return any value at all (even though the command would get
2331 executed).
2340 executed).
2332 (xsys): Flush stdout right after printing the command to ensure
2341 (xsys): Flush stdout right after printing the command to ensure
2333 proper ordering of commands and command output in the total
2342 proper ordering of commands and command output in the total
2334 output.
2343 output.
2335 (SystemExec/xsys/bq): Switched the names of xsys/bq and
2344 (SystemExec/xsys/bq): Switched the names of xsys/bq and
2336 system/getoutput as defaults. The old ones are kept for
2345 system/getoutput as defaults. The old ones are kept for
2337 compatibility reasons, so no code which uses this library needs
2346 compatibility reasons, so no code which uses this library needs
2338 changing.
2347 changing.
2339
2348
2340 2003-01-27 *** Released version 0.2.14
2349 2003-01-27 *** Released version 0.2.14
2341
2350
2342 2003-01-25 Fernando Perez <fperez@colorado.edu>
2351 2003-01-25 Fernando Perez <fperez@colorado.edu>
2343
2352
2344 * IPython/Magic.py (Magic.magic_edit): Fixed problem where
2353 * IPython/Magic.py (Magic.magic_edit): Fixed problem where
2345 functions defined in previous edit sessions could not be re-edited
2354 functions defined in previous edit sessions could not be re-edited
2346 (because the temp files were immediately removed). Now temp files
2355 (because the temp files were immediately removed). Now temp files
2347 are removed only at IPython's exit.
2356 are removed only at IPython's exit.
2348 (Magic.magic_run): Improved @run to perform shell-like expansions
2357 (Magic.magic_run): Improved @run to perform shell-like expansions
2349 on its arguments (~users and $VARS). With this, @run becomes more
2358 on its arguments (~users and $VARS). With this, @run becomes more
2350 like a normal command-line.
2359 like a normal command-line.
2351
2360
2352 * IPython/Shell.py (IPShellEmbed.__call__): Fixed a bunch of small
2361 * IPython/Shell.py (IPShellEmbed.__call__): Fixed a bunch of small
2353 bugs related to embedding and cleaned up that code. A fairly
2362 bugs related to embedding and cleaned up that code. A fairly
2354 important one was the impossibility to access the global namespace
2363 important one was the impossibility to access the global namespace
2355 through the embedded IPython (only local variables were visible).
2364 through the embedded IPython (only local variables were visible).
2356
2365
2357 2003-01-14 Fernando Perez <fperez@colorado.edu>
2366 2003-01-14 Fernando Perez <fperez@colorado.edu>
2358
2367
2359 * IPython/iplib.py (InteractiveShell._prefilter): Fixed
2368 * IPython/iplib.py (InteractiveShell._prefilter): Fixed
2360 auto-calling to be a bit more conservative. Now it doesn't get
2369 auto-calling to be a bit more conservative. Now it doesn't get
2361 triggered if any of '!=()<>' are in the rest of the input line, to
2370 triggered if any of '!=()<>' are in the rest of the input line, to
2362 allow comparing callables. Thanks to Alex for the heads up.
2371 allow comparing callables. Thanks to Alex for the heads up.
2363
2372
2364 2003-01-07 Fernando Perez <fperez@colorado.edu>
2373 2003-01-07 Fernando Perez <fperez@colorado.edu>
2365
2374
2366 * IPython/genutils.py (page): fixed estimation of the number of
2375 * IPython/genutils.py (page): fixed estimation of the number of
2367 lines in a string to be paged to simply count newlines. This
2376 lines in a string to be paged to simply count newlines. This
2368 prevents over-guessing due to embedded escape sequences. A better
2377 prevents over-guessing due to embedded escape sequences. A better
2369 long-term solution would involve stripping out the control chars
2378 long-term solution would involve stripping out the control chars
2370 for the count, but it's potentially so expensive I just don't
2379 for the count, but it's potentially so expensive I just don't
2371 think it's worth doing.
2380 think it's worth doing.
2372
2381
2373 2002-12-19 *** Released version 0.2.14pre50
2382 2002-12-19 *** Released version 0.2.14pre50
2374
2383
2375 2002-12-19 Fernando Perez <fperez@colorado.edu>
2384 2002-12-19 Fernando Perez <fperez@colorado.edu>
2376
2385
2377 * tools/release (version): Changed release scripts to inform
2386 * tools/release (version): Changed release scripts to inform
2378 Andrea and build a NEWS file with a list of recent changes.
2387 Andrea and build a NEWS file with a list of recent changes.
2379
2388
2380 * IPython/ColorANSI.py (__all__): changed terminal detection
2389 * IPython/ColorANSI.py (__all__): changed terminal detection
2381 code. Seems to work better for xterms without breaking
2390 code. Seems to work better for xterms without breaking
2382 konsole. Will need more testing to determine if WinXP and Mac OSX
2391 konsole. Will need more testing to determine if WinXP and Mac OSX
2383 also work ok.
2392 also work ok.
2384
2393
2385 2002-12-18 *** Released version 0.2.14pre49
2394 2002-12-18 *** Released version 0.2.14pre49
2386
2395
2387 2002-12-18 Fernando Perez <fperez@colorado.edu>
2396 2002-12-18 Fernando Perez <fperez@colorado.edu>
2388
2397
2389 * Docs: added new info about Mac OSX, from Andrea.
2398 * Docs: added new info about Mac OSX, from Andrea.
2390
2399
2391 * IPython/Gnuplot2.py (String): Added a String PlotItem class to
2400 * IPython/Gnuplot2.py (String): Added a String PlotItem class to
2392 allow direct plotting of python strings whose format is the same
2401 allow direct plotting of python strings whose format is the same
2393 of gnuplot data files.
2402 of gnuplot data files.
2394
2403
2395 2002-12-16 Fernando Perez <fperez@colorado.edu>
2404 2002-12-16 Fernando Perez <fperez@colorado.edu>
2396
2405
2397 * IPython/iplib.py (InteractiveShell.interact): fixed default (y)
2406 * IPython/iplib.py (InteractiveShell.interact): fixed default (y)
2398 value of exit question to be acknowledged.
2407 value of exit question to be acknowledged.
2399
2408
2400 2002-12-03 Fernando Perez <fperez@colorado.edu>
2409 2002-12-03 Fernando Perez <fperez@colorado.edu>
2401
2410
2402 * IPython/ipmaker.py: removed generators, which had been added
2411 * IPython/ipmaker.py: removed generators, which had been added
2403 by mistake in an earlier debugging run. This was causing trouble
2412 by mistake in an earlier debugging run. This was causing trouble
2404 to users of python 2.1.x. Thanks to Abel Daniel <abli-AT-freemail.hu>
2413 to users of python 2.1.x. Thanks to Abel Daniel <abli-AT-freemail.hu>
2405 for pointing this out.
2414 for pointing this out.
2406
2415
2407 2002-11-17 Fernando Perez <fperez@colorado.edu>
2416 2002-11-17 Fernando Perez <fperez@colorado.edu>
2408
2417
2409 * Manual: updated the Gnuplot section.
2418 * Manual: updated the Gnuplot section.
2410
2419
2411 * IPython/GnuplotRuntime.py: refactored a lot all this code, with
2420 * IPython/GnuplotRuntime.py: refactored a lot all this code, with
2412 a much better split of what goes in Runtime and what goes in
2421 a much better split of what goes in Runtime and what goes in
2413 Interactive.
2422 Interactive.
2414
2423
2415 * IPython/ipmaker.py: fixed bug where import_fail_info wasn't
2424 * IPython/ipmaker.py: fixed bug where import_fail_info wasn't
2416 being imported from iplib.
2425 being imported from iplib.
2417
2426
2418 * IPython/GnuplotInteractive.py (magic_gpc): renamed @gp to @gpc
2427 * IPython/GnuplotInteractive.py (magic_gpc): renamed @gp to @gpc
2419 for command-passing. Now the global Gnuplot instance is called
2428 for command-passing. Now the global Gnuplot instance is called
2420 'gp' instead of 'g', which was really a far too fragile and
2429 'gp' instead of 'g', which was really a far too fragile and
2421 common name.
2430 common name.
2422
2431
2423 * IPython/Gnuplot2.py (eps_fix_bbox): added this to fix broken
2432 * IPython/Gnuplot2.py (eps_fix_bbox): added this to fix broken
2424 bounding boxes generated by Gnuplot for square plots.
2433 bounding boxes generated by Gnuplot for square plots.
2425
2434
2426 * IPython/genutils.py (popkey): new function added. I should
2435 * IPython/genutils.py (popkey): new function added. I should
2427 suggest this on c.l.py as a dict method, it seems useful.
2436 suggest this on c.l.py as a dict method, it seems useful.
2428
2437
2429 * IPython/Gnuplot2.py (Gnuplot.plot): Overhauled plot and replot
2438 * IPython/Gnuplot2.py (Gnuplot.plot): Overhauled plot and replot
2430 to transparently handle PostScript generation. MUCH better than
2439 to transparently handle PostScript generation. MUCH better than
2431 the previous plot_eps/replot_eps (which I removed now). The code
2440 the previous plot_eps/replot_eps (which I removed now). The code
2432 is also fairly clean and well documented now (including
2441 is also fairly clean and well documented now (including
2433 docstrings).
2442 docstrings).
2434
2443
2435 2002-11-13 Fernando Perez <fperez@colorado.edu>
2444 2002-11-13 Fernando Perez <fperez@colorado.edu>
2436
2445
2437 * IPython/Magic.py (Magic.magic_edit): fixed docstring
2446 * IPython/Magic.py (Magic.magic_edit): fixed docstring
2438 (inconsistent with options).
2447 (inconsistent with options).
2439
2448
2440 * IPython/Gnuplot2.py (Gnuplot.hardcopy): hardcopy had been
2449 * IPython/Gnuplot2.py (Gnuplot.hardcopy): hardcopy had been
2441 manually disabled, I don't know why. Fixed it.
2450 manually disabled, I don't know why. Fixed it.
2442 (Gnuplot._plot_eps): added new plot_eps/replot_eps to get directly
2451 (Gnuplot._plot_eps): added new plot_eps/replot_eps to get directly
2443 eps output.
2452 eps output.
2444
2453
2445 2002-11-12 Fernando Perez <fperez@colorado.edu>
2454 2002-11-12 Fernando Perez <fperez@colorado.edu>
2446
2455
2447 * IPython/genutils.py (ask_yes_no): trap EOF and ^C so that they
2456 * IPython/genutils.py (ask_yes_no): trap EOF and ^C so that they
2448 don't propagate up to caller. Fixes crash reported by François
2457 don't propagate up to caller. Fixes crash reported by François
2449 Pinard.
2458 Pinard.
2450
2459
2451 2002-11-09 Fernando Perez <fperez@colorado.edu>
2460 2002-11-09 Fernando Perez <fperez@colorado.edu>
2452
2461
2453 * IPython/ipmaker.py (make_IPython): fixed problem with writing
2462 * IPython/ipmaker.py (make_IPython): fixed problem with writing
2454 history file for new users.
2463 history file for new users.
2455 (make_IPython): fixed bug where initial install would leave the
2464 (make_IPython): fixed bug where initial install would leave the
2456 user running in the .ipython dir.
2465 user running in the .ipython dir.
2457 (make_IPython): fixed bug where config dir .ipython would be
2466 (make_IPython): fixed bug where config dir .ipython would be
2458 created regardless of the given -ipythondir option. Thanks to Cory
2467 created regardless of the given -ipythondir option. Thanks to Cory
2459 Dodt <cdodt-AT-fcoe.k12.ca.us> for the bug report.
2468 Dodt <cdodt-AT-fcoe.k12.ca.us> for the bug report.
2460
2469
2461 * IPython/genutils.py (ask_yes_no): new function for asking yes/no
2470 * IPython/genutils.py (ask_yes_no): new function for asking yes/no
2462 type confirmations. Will need to use it in all of IPython's code
2471 type confirmations. Will need to use it in all of IPython's code
2463 consistently.
2472 consistently.
2464
2473
2465 * IPython/CrashHandler.py (CrashHandler.__call__): changed the
2474 * IPython/CrashHandler.py (CrashHandler.__call__): changed the
2466 context to print 31 lines instead of the default 5. This will make
2475 context to print 31 lines instead of the default 5. This will make
2467 the crash reports extremely detailed in case the problem is in
2476 the crash reports extremely detailed in case the problem is in
2468 libraries I don't have access to.
2477 libraries I don't have access to.
2469
2478
2470 * IPython/iplib.py (InteractiveShell.interact): changed the 'last
2479 * IPython/iplib.py (InteractiveShell.interact): changed the 'last
2471 line of defense' code to still crash, but giving users fair
2480 line of defense' code to still crash, but giving users fair
2472 warning. I don't want internal errors to go unreported: if there's
2481 warning. I don't want internal errors to go unreported: if there's
2473 an internal problem, IPython should crash and generate a full
2482 an internal problem, IPython should crash and generate a full
2474 report.
2483 report.
2475
2484
2476 2002-11-08 Fernando Perez <fperez@colorado.edu>
2485 2002-11-08 Fernando Perez <fperez@colorado.edu>
2477
2486
2478 * IPython/iplib.py (InteractiveShell.interact): added code to trap
2487 * IPython/iplib.py (InteractiveShell.interact): added code to trap
2479 otherwise uncaught exceptions which can appear if people set
2488 otherwise uncaught exceptions which can appear if people set
2480 sys.stdout to something badly broken. Thanks to a crash report
2489 sys.stdout to something badly broken. Thanks to a crash report
2481 from henni-AT-mail.brainbot.com.
2490 from henni-AT-mail.brainbot.com.
2482
2491
2483 2002-11-04 Fernando Perez <fperez@colorado.edu>
2492 2002-11-04 Fernando Perez <fperez@colorado.edu>
2484
2493
2485 * IPython/iplib.py (InteractiveShell.interact): added
2494 * IPython/iplib.py (InteractiveShell.interact): added
2486 __IPYTHON__active to the builtins. It's a flag which goes on when
2495 __IPYTHON__active to the builtins. It's a flag which goes on when
2487 the interaction starts and goes off again when it stops. This
2496 the interaction starts and goes off again when it stops. This
2488 allows embedding code to detect being inside IPython. Before this
2497 allows embedding code to detect being inside IPython. Before this
2489 was done via __IPYTHON__, but that only shows that an IPython
2498 was done via __IPYTHON__, but that only shows that an IPython
2490 instance has been created.
2499 instance has been created.
2491
2500
2492 * IPython/Magic.py (Magic.magic_env): I realized that in a
2501 * IPython/Magic.py (Magic.magic_env): I realized that in a
2493 UserDict, instance.data holds the data as a normal dict. So I
2502 UserDict, instance.data holds the data as a normal dict. So I
2494 modified @env to return os.environ.data instead of rebuilding a
2503 modified @env to return os.environ.data instead of rebuilding a
2495 dict by hand.
2504 dict by hand.
2496
2505
2497 2002-11-02 Fernando Perez <fperez@colorado.edu>
2506 2002-11-02 Fernando Perez <fperez@colorado.edu>
2498
2507
2499 * IPython/genutils.py (warn): changed so that level 1 prints no
2508 * IPython/genutils.py (warn): changed so that level 1 prints no
2500 header. Level 2 is now the default (with 'WARNING' header, as
2509 header. Level 2 is now the default (with 'WARNING' header, as
2501 before). I think I tracked all places where changes were needed in
2510 before). I think I tracked all places where changes were needed in
2502 IPython, but outside code using the old level numbering may have
2511 IPython, but outside code using the old level numbering may have
2503 broken.
2512 broken.
2504
2513
2505 * IPython/iplib.py (InteractiveShell.runcode): added this to
2514 * IPython/iplib.py (InteractiveShell.runcode): added this to
2506 handle the tracebacks in SystemExit traps correctly. The previous
2515 handle the tracebacks in SystemExit traps correctly. The previous
2507 code (through interact) was printing more of the stack than
2516 code (through interact) was printing more of the stack than
2508 necessary, showing IPython internal code to the user.
2517 necessary, showing IPython internal code to the user.
2509
2518
2510 * IPython/UserConfig/ipythonrc.py: Made confirm_exit 1 by
2519 * IPython/UserConfig/ipythonrc.py: Made confirm_exit 1 by
2511 default. Now that the default at the confirmation prompt is yes,
2520 default. Now that the default at the confirmation prompt is yes,
2512 it's not so intrusive. François' argument that ipython sessions
2521 it's not so intrusive. François' argument that ipython sessions
2513 tend to be complex enough not to lose them from an accidental C-d,
2522 tend to be complex enough not to lose them from an accidental C-d,
2514 is a valid one.
2523 is a valid one.
2515
2524
2516 * IPython/iplib.py (InteractiveShell.interact): added a
2525 * IPython/iplib.py (InteractiveShell.interact): added a
2517 showtraceback() call to the SystemExit trap, and modified the exit
2526 showtraceback() call to the SystemExit trap, and modified the exit
2518 confirmation to have yes as the default.
2527 confirmation to have yes as the default.
2519
2528
2520 * IPython/UserConfig/ipythonrc.py: removed 'session' option from
2529 * IPython/UserConfig/ipythonrc.py: removed 'session' option from
2521 this file. It's been gone from the code for a long time, this was
2530 this file. It's been gone from the code for a long time, this was
2522 simply leftover junk.
2531 simply leftover junk.
2523
2532
2524 2002-11-01 Fernando Perez <fperez@colorado.edu>
2533 2002-11-01 Fernando Perez <fperez@colorado.edu>
2525
2534
2526 * IPython/UserConfig/ipythonrc.py: new confirm_exit option
2535 * IPython/UserConfig/ipythonrc.py: new confirm_exit option
2527 added. If set, IPython now traps EOF and asks for
2536 added. If set, IPython now traps EOF and asks for
2528 confirmation. After a request by François Pinard.
2537 confirmation. After a request by François Pinard.
2529
2538
2530 * IPython/Magic.py (Magic.magic_Exit): New @Exit and @Quit instead
2539 * IPython/Magic.py (Magic.magic_Exit): New @Exit and @Quit instead
2531 of @abort, and with a new (better) mechanism for handling the
2540 of @abort, and with a new (better) mechanism for handling the
2532 exceptions.
2541 exceptions.
2533
2542
2534 2002-10-27 Fernando Perez <fperez@colorado.edu>
2543 2002-10-27 Fernando Perez <fperez@colorado.edu>
2535
2544
2536 * IPython/usage.py (__doc__): updated the --help information and
2545 * IPython/usage.py (__doc__): updated the --help information and
2537 the ipythonrc file to indicate that -log generates
2546 the ipythonrc file to indicate that -log generates
2538 ./ipython.log. Also fixed the corresponding info in @logstart.
2547 ./ipython.log. Also fixed the corresponding info in @logstart.
2539 This and several other fixes in the manuals thanks to reports by
2548 This and several other fixes in the manuals thanks to reports by
2540 François Pinard <pinard-AT-iro.umontreal.ca>.
2549 François Pinard <pinard-AT-iro.umontreal.ca>.
2541
2550
2542 * IPython/Logger.py (Logger.switch_log): Fixed error message to
2551 * IPython/Logger.py (Logger.switch_log): Fixed error message to
2543 refer to @logstart (instead of @log, which doesn't exist).
2552 refer to @logstart (instead of @log, which doesn't exist).
2544
2553
2545 * IPython/iplib.py (InteractiveShell._prefilter): fixed
2554 * IPython/iplib.py (InteractiveShell._prefilter): fixed
2546 AttributeError crash. Thanks to Christopher Armstrong
2555 AttributeError crash. Thanks to Christopher Armstrong
2547 <radix-AT-twistedmatrix.com> for the report/fix. This bug had been
2556 <radix-AT-twistedmatrix.com> for the report/fix. This bug had been
2548 introduced recently (in 0.2.14pre37) with the fix to the eval
2557 introduced recently (in 0.2.14pre37) with the fix to the eval
2549 problem mentioned below.
2558 problem mentioned below.
2550
2559
2551 2002-10-17 Fernando Perez <fperez@colorado.edu>
2560 2002-10-17 Fernando Perez <fperez@colorado.edu>
2552
2561
2553 * IPython/ConfigLoader.py (ConfigLoader.load): Fixes for Windows
2562 * IPython/ConfigLoader.py (ConfigLoader.load): Fixes for Windows
2554 installation. Thanks to Leonardo Santagada <retype-AT-terra.com.br>.
2563 installation. Thanks to Leonardo Santagada <retype-AT-terra.com.br>.
2555
2564
2556 * IPython/iplib.py (InteractiveShell._prefilter): Many changes to
2565 * IPython/iplib.py (InteractiveShell._prefilter): Many changes to
2557 this function to fix a problem reported by Alex Schmolck. He saw
2566 this function to fix a problem reported by Alex Schmolck. He saw
2558 it with list comprehensions and generators, which were getting
2567 it with list comprehensions and generators, which were getting
2559 called twice. The real problem was an 'eval' call in testing for
2568 called twice. The real problem was an 'eval' call in testing for
2560 automagic which was evaluating the input line silently.
2569 automagic which was evaluating the input line silently.
2561
2570
2562 This is a potentially very nasty bug, if the input has side
2571 This is a potentially very nasty bug, if the input has side
2563 effects which must not be repeated. The code is much cleaner now,
2572 effects which must not be repeated. The code is much cleaner now,
2564 without any blanket 'except' left and with a regexp test for
2573 without any blanket 'except' left and with a regexp test for
2565 actual function names.
2574 actual function names.
2566
2575
2567 But an eval remains, which I'm not fully comfortable with. I just
2576 But an eval remains, which I'm not fully comfortable with. I just
2568 don't know how to find out if an expression could be a callable in
2577 don't know how to find out if an expression could be a callable in
2569 the user's namespace without doing an eval on the string. However
2578 the user's namespace without doing an eval on the string. However
2570 that string is now much more strictly checked so that no code
2579 that string is now much more strictly checked so that no code
2571 slips by, so the eval should only happen for things that can
2580 slips by, so the eval should only happen for things that can
2572 really be only function/method names.
2581 really be only function/method names.
2573
2582
2574 2002-10-15 Fernando Perez <fperez@colorado.edu>
2583 2002-10-15 Fernando Perez <fperez@colorado.edu>
2575
2584
2576 * Updated LyX to 1.2.1 so I can work on the docs again. Added Mac
2585 * Updated LyX to 1.2.1 so I can work on the docs again. Added Mac
2577 OSX information to main manual, removed README_Mac_OSX file from
2586 OSX information to main manual, removed README_Mac_OSX file from
2578 distribution. Also updated credits for recent additions.
2587 distribution. Also updated credits for recent additions.
2579
2588
2580 2002-10-10 Fernando Perez <fperez@colorado.edu>
2589 2002-10-10 Fernando Perez <fperez@colorado.edu>
2581
2590
2582 * README_Mac_OSX: Added a README for Mac OSX users for fixing
2591 * README_Mac_OSX: Added a README for Mac OSX users for fixing
2583 terminal-related issues. Many thanks to Andrea Riciputi
2592 terminal-related issues. Many thanks to Andrea Riciputi
2584 <andrea.riciputi-AT-libero.it> for writing it.
2593 <andrea.riciputi-AT-libero.it> for writing it.
2585
2594
2586 * IPython/UserConfig/ipythonrc.py: Fixes to various small issues,
2595 * IPython/UserConfig/ipythonrc.py: Fixes to various small issues,
2587 thanks to Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
2596 thanks to Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
2588
2597
2589 * setup.py (make_shortcut): Fixes for Windows installation. Thanks
2598 * setup.py (make_shortcut): Fixes for Windows installation. Thanks
2590 to Fredrik Kant <fredrik.kant-AT-front.com> and Syver Enstad
2599 to Fredrik Kant <fredrik.kant-AT-front.com> and Syver Enstad
2591 <syver-en-AT-online.no> who both submitted patches for this problem.
2600 <syver-en-AT-online.no> who both submitted patches for this problem.
2592
2601
2593 * IPython/iplib.py (InteractiveShell.embed_mainloop): Patch for
2602 * IPython/iplib.py (InteractiveShell.embed_mainloop): Patch for
2594 global embedding to make sure that things don't overwrite user
2603 global embedding to make sure that things don't overwrite user
2595 globals accidentally. Thanks to Richard <rxe-AT-renre-europe.com>
2604 globals accidentally. Thanks to Richard <rxe-AT-renre-europe.com>
2596
2605
2597 * IPython/Gnuplot2.py (gp): Patch for Gnuplot.py 1.6
2606 * IPython/Gnuplot2.py (gp): Patch for Gnuplot.py 1.6
2598 compatibility. Thanks to Hayden Callow
2607 compatibility. Thanks to Hayden Callow
2599 <h.callow-AT-elec.canterbury.ac.nz>
2608 <h.callow-AT-elec.canterbury.ac.nz>
2600
2609
2601 2002-10-04 Fernando Perez <fperez@colorado.edu>
2610 2002-10-04 Fernando Perez <fperez@colorado.edu>
2602
2611
2603 * IPython/Gnuplot2.py (PlotItem): Added 'index' option for
2612 * IPython/Gnuplot2.py (PlotItem): Added 'index' option for
2604 Gnuplot.File objects.
2613 Gnuplot.File objects.
2605
2614
2606 2002-07-23 Fernando Perez <fperez@colorado.edu>
2615 2002-07-23 Fernando Perez <fperez@colorado.edu>
2607
2616
2608 * IPython/genutils.py (timing): Added timings() and timing() for
2617 * IPython/genutils.py (timing): Added timings() and timing() for
2609 quick access to the most commonly needed data, the execution
2618 quick access to the most commonly needed data, the execution
2610 times. Old timing() renamed to timings_out().
2619 times. Old timing() renamed to timings_out().
2611
2620
2612 2002-07-18 Fernando Perez <fperez@colorado.edu>
2621 2002-07-18 Fernando Perez <fperez@colorado.edu>
2613
2622
2614 * IPython/Shell.py (IPShellEmbed.restore_system_completer): fixed
2623 * IPython/Shell.py (IPShellEmbed.restore_system_completer): fixed
2615 bug with nested instances disrupting the parent's tab completion.
2624 bug with nested instances disrupting the parent's tab completion.
2616
2625
2617 * IPython/iplib.py (all_completions): Added Alex Schmolck's
2626 * IPython/iplib.py (all_completions): Added Alex Schmolck's
2618 all_completions code to begin the emacs integration.
2627 all_completions code to begin the emacs integration.
2619
2628
2620 * IPython/Gnuplot2.py (zip_items): Added optional 'titles'
2629 * IPython/Gnuplot2.py (zip_items): Added optional 'titles'
2621 argument to allow titling individual arrays when plotting.
2630 argument to allow titling individual arrays when plotting.
2622
2631
2623 2002-07-15 Fernando Perez <fperez@colorado.edu>
2632 2002-07-15 Fernando Perez <fperez@colorado.edu>
2624
2633
2625 * setup.py (make_shortcut): changed to retrieve the value of
2634 * setup.py (make_shortcut): changed to retrieve the value of
2626 'Program Files' directory from the registry (this value changes in
2635 'Program Files' directory from the registry (this value changes in
2627 non-english versions of Windows). Thanks to Thomas Fanslau
2636 non-english versions of Windows). Thanks to Thomas Fanslau
2628 <tfanslau-AT-gmx.de> for the report.
2637 <tfanslau-AT-gmx.de> for the report.
2629
2638
2630 2002-07-10 Fernando Perez <fperez@colorado.edu>
2639 2002-07-10 Fernando Perez <fperez@colorado.edu>
2631
2640
2632 * IPython/ultraTB.py (VerboseTB.debugger): enabled workaround for
2641 * IPython/ultraTB.py (VerboseTB.debugger): enabled workaround for
2633 a bug in pdb, which crashes if a line with only whitespace is
2642 a bug in pdb, which crashes if a line with only whitespace is
2634 entered. Bug report submitted to sourceforge.
2643 entered. Bug report submitted to sourceforge.
2635
2644
2636 2002-07-09 Fernando Perez <fperez@colorado.edu>
2645 2002-07-09 Fernando Perez <fperez@colorado.edu>
2637
2646
2638 * IPython/ultraTB.py (VerboseTB.nullrepr): fixed rare crash when
2647 * IPython/ultraTB.py (VerboseTB.nullrepr): fixed rare crash when
2639 reporting exceptions (it's a bug in inspect.py, I just set a
2648 reporting exceptions (it's a bug in inspect.py, I just set a
2640 workaround).
2649 workaround).
2641
2650
2642 2002-07-08 Fernando Perez <fperez@colorado.edu>
2651 2002-07-08 Fernando Perez <fperez@colorado.edu>
2643
2652
2644 * IPython/iplib.py (InteractiveShell.__init__): fixed reference to
2653 * IPython/iplib.py (InteractiveShell.__init__): fixed reference to
2645 __IPYTHON__ in __builtins__ to show up in user_ns.
2654 __IPYTHON__ in __builtins__ to show up in user_ns.
2646
2655
2647 2002-07-03 Fernando Perez <fperez@colorado.edu>
2656 2002-07-03 Fernando Perez <fperez@colorado.edu>
2648
2657
2649 * IPython/GnuplotInteractive.py (magic_gp_set_default): changed
2658 * IPython/GnuplotInteractive.py (magic_gp_set_default): changed
2650 name from @gp_set_instance to @gp_set_default.
2659 name from @gp_set_instance to @gp_set_default.
2651
2660
2652 * IPython/ipmaker.py (make_IPython): default editor value set to
2661 * IPython/ipmaker.py (make_IPython): default editor value set to
2653 '0' (a string), to match the rc file. Otherwise will crash when
2662 '0' (a string), to match the rc file. Otherwise will crash when
2654 .strip() is called on it.
2663 .strip() is called on it.
2655
2664
2656
2665
2657 2002-06-28 Fernando Perez <fperez@colorado.edu>
2666 2002-06-28 Fernando Perez <fperez@colorado.edu>
2658
2667
2659 * IPython/iplib.py (InteractiveShell.safe_execfile): fix importing
2668 * IPython/iplib.py (InteractiveShell.safe_execfile): fix importing
2660 of files in current directory when a file is executed via
2669 of files in current directory when a file is executed via
2661 @run. Patch also by RA <ralf_ahlbrink-AT-web.de>.
2670 @run. Patch also by RA <ralf_ahlbrink-AT-web.de>.
2662
2671
2663 * setup.py (manfiles): fix for rpm builds, submitted by RA
2672 * setup.py (manfiles): fix for rpm builds, submitted by RA
2664 <ralf_ahlbrink-AT-web.de>. Now we have RPMs!
2673 <ralf_ahlbrink-AT-web.de>. Now we have RPMs!
2665
2674
2666 * IPython/ipmaker.py (make_IPython): fixed lookup of default
2675 * IPython/ipmaker.py (make_IPython): fixed lookup of default
2667 editor when set to '0'. Problem was, '0' evaluates to True (it's a
2676 editor when set to '0'. Problem was, '0' evaluates to True (it's a
2668 string!). A. Schmolck caught this one.
2677 string!). A. Schmolck caught this one.
2669
2678
2670 2002-06-27 Fernando Perez <fperez@colorado.edu>
2679 2002-06-27 Fernando Perez <fperez@colorado.edu>
2671
2680
2672 * IPython/ipmaker.py (make_IPython): fixed bug when running user
2681 * IPython/ipmaker.py (make_IPython): fixed bug when running user
2673 defined files at the cmd line. __name__ wasn't being set to
2682 defined files at the cmd line. __name__ wasn't being set to
2674 __main__.
2683 __main__.
2675
2684
2676 * IPython/Gnuplot2.py (zip_items): improved it so it can plot also
2685 * IPython/Gnuplot2.py (zip_items): improved it so it can plot also
2677 regular lists and tuples besides Numeric arrays.
2686 regular lists and tuples besides Numeric arrays.
2678
2687
2679 * IPython/Prompts.py (CachedOutput.__call__): Added output
2688 * IPython/Prompts.py (CachedOutput.__call__): Added output
2680 supression for input ending with ';'. Similar to Mathematica and
2689 supression for input ending with ';'. Similar to Mathematica and
2681 Matlab. The _* vars and Out[] list are still updated, just like
2690 Matlab. The _* vars and Out[] list are still updated, just like
2682 Mathematica behaves.
2691 Mathematica behaves.
2683
2692
2684 2002-06-25 Fernando Perez <fperez@colorado.edu>
2693 2002-06-25 Fernando Perez <fperez@colorado.edu>
2685
2694
2686 * IPython/ConfigLoader.py (ConfigLoader.load): fixed checking of
2695 * IPython/ConfigLoader.py (ConfigLoader.load): fixed checking of
2687 .ini extensions for profiels under Windows.
2696 .ini extensions for profiels under Windows.
2688
2697
2689 * IPython/OInspect.py (Inspector.pinfo): improved alignment of
2698 * IPython/OInspect.py (Inspector.pinfo): improved alignment of
2690 string form. Fix contributed by Alexander Schmolck
2699 string form. Fix contributed by Alexander Schmolck
2691 <a.schmolck-AT-gmx.net>
2700 <a.schmolck-AT-gmx.net>
2692
2701
2693 * IPython/GnuplotRuntime.py (gp_new): new function. Returns a
2702 * IPython/GnuplotRuntime.py (gp_new): new function. Returns a
2694 pre-configured Gnuplot instance.
2703 pre-configured Gnuplot instance.
2695
2704
2696 2002-06-21 Fernando Perez <fperez@colorado.edu>
2705 2002-06-21 Fernando Perez <fperez@colorado.edu>
2697
2706
2698 * IPython/numutils.py (exp_safe): new function, works around the
2707 * IPython/numutils.py (exp_safe): new function, works around the
2699 underflow problems in Numeric.
2708 underflow problems in Numeric.
2700 (log2): New fn. Safe log in base 2: returns exact integer answer
2709 (log2): New fn. Safe log in base 2: returns exact integer answer
2701 for exact integer powers of 2.
2710 for exact integer powers of 2.
2702
2711
2703 * IPython/Magic.py (get_py_filename): fixed it not expanding '~'
2712 * IPython/Magic.py (get_py_filename): fixed it not expanding '~'
2704 properly.
2713 properly.
2705
2714
2706 2002-06-20 Fernando Perez <fperez@colorado.edu>
2715 2002-06-20 Fernando Perez <fperez@colorado.edu>
2707
2716
2708 * IPython/genutils.py (timing): new function like
2717 * IPython/genutils.py (timing): new function like
2709 Mathematica's. Similar to time_test, but returns more info.
2718 Mathematica's. Similar to time_test, but returns more info.
2710
2719
2711 2002-06-18 Fernando Perez <fperez@colorado.edu>
2720 2002-06-18 Fernando Perez <fperez@colorado.edu>
2712
2721
2713 * IPython/Magic.py (Magic.magic_save): modified @save and @r
2722 * IPython/Magic.py (Magic.magic_save): modified @save and @r
2714 according to Mike Heeter's suggestions.
2723 according to Mike Heeter's suggestions.
2715
2724
2716 2002-06-16 Fernando Perez <fperez@colorado.edu>
2725 2002-06-16 Fernando Perez <fperez@colorado.edu>
2717
2726
2718 * IPython/GnuplotRuntime.py: Massive overhaul to the Gnuplot
2727 * IPython/GnuplotRuntime.py: Massive overhaul to the Gnuplot
2719 system. GnuplotMagic is gone as a user-directory option. New files
2728 system. GnuplotMagic is gone as a user-directory option. New files
2720 make it easier to use all the gnuplot stuff both from external
2729 make it easier to use all the gnuplot stuff both from external
2721 programs as well as from IPython. Had to rewrite part of
2730 programs as well as from IPython. Had to rewrite part of
2722 hardcopy() b/c of a strange bug: often the ps files simply don't
2731 hardcopy() b/c of a strange bug: often the ps files simply don't
2723 get created, and require a repeat of the command (often several
2732 get created, and require a repeat of the command (often several
2724 times).
2733 times).
2725
2734
2726 * IPython/ultraTB.py (AutoFormattedTB.__call__): changed to
2735 * IPython/ultraTB.py (AutoFormattedTB.__call__): changed to
2727 resolve output channel at call time, so that if sys.stderr has
2736 resolve output channel at call time, so that if sys.stderr has
2728 been redirected by user this gets honored.
2737 been redirected by user this gets honored.
2729
2738
2730 2002-06-13 Fernando Perez <fperez@colorado.edu>
2739 2002-06-13 Fernando Perez <fperez@colorado.edu>
2731
2740
2732 * IPython/Shell.py (IPShell.__init__): Changed IPythonShell to
2741 * IPython/Shell.py (IPShell.__init__): Changed IPythonShell to
2733 IPShell. Kept a copy with the old names to avoid breaking people's
2742 IPShell. Kept a copy with the old names to avoid breaking people's
2734 embedded code.
2743 embedded code.
2735
2744
2736 * IPython/ipython: simplified it to the bare minimum after
2745 * IPython/ipython: simplified it to the bare minimum after
2737 Holger's suggestions. Added info about how to use it in
2746 Holger's suggestions. Added info about how to use it in
2738 PYTHONSTARTUP.
2747 PYTHONSTARTUP.
2739
2748
2740 * IPython/Shell.py (IPythonShell): changed the options passing
2749 * IPython/Shell.py (IPythonShell): changed the options passing
2741 from a string with funky %s replacements to a straight list. Maybe
2750 from a string with funky %s replacements to a straight list. Maybe
2742 a bit more typing, but it follows sys.argv conventions, so there's
2751 a bit more typing, but it follows sys.argv conventions, so there's
2743 less special-casing to remember.
2752 less special-casing to remember.
2744
2753
2745 2002-06-12 Fernando Perez <fperez@colorado.edu>
2754 2002-06-12 Fernando Perez <fperez@colorado.edu>
2746
2755
2747 * IPython/Magic.py (Magic.magic_r): new magic auto-repeat
2756 * IPython/Magic.py (Magic.magic_r): new magic auto-repeat
2748 command. Thanks to a suggestion by Mike Heeter.
2757 command. Thanks to a suggestion by Mike Heeter.
2749 (Magic.magic_pfile): added behavior to look at filenames if given
2758 (Magic.magic_pfile): added behavior to look at filenames if given
2750 arg is not a defined object.
2759 arg is not a defined object.
2751 (Magic.magic_save): New @save function to save code snippets. Also
2760 (Magic.magic_save): New @save function to save code snippets. Also
2752 a Mike Heeter idea.
2761 a Mike Heeter idea.
2753
2762
2754 * IPython/UserConfig/GnuplotMagic.py (plot): Improvements to
2763 * IPython/UserConfig/GnuplotMagic.py (plot): Improvements to
2755 plot() and replot(). Much more convenient now, especially for
2764 plot() and replot(). Much more convenient now, especially for
2756 interactive use.
2765 interactive use.
2757
2766
2758 * IPython/Magic.py (Magic.magic_run): Added .py automatically to
2767 * IPython/Magic.py (Magic.magic_run): Added .py automatically to
2759 filenames.
2768 filenames.
2760
2769
2761 2002-06-02 Fernando Perez <fperez@colorado.edu>
2770 2002-06-02 Fernando Perez <fperez@colorado.edu>
2762
2771
2763 * IPython/Struct.py (Struct.__init__): modified to admit
2772 * IPython/Struct.py (Struct.__init__): modified to admit
2764 initialization via another struct.
2773 initialization via another struct.
2765
2774
2766 * IPython/genutils.py (SystemExec.__init__): New stateful
2775 * IPython/genutils.py (SystemExec.__init__): New stateful
2767 interface to xsys and bq. Useful for writing system scripts.
2776 interface to xsys and bq. Useful for writing system scripts.
2768
2777
2769 2002-05-30 Fernando Perez <fperez@colorado.edu>
2778 2002-05-30 Fernando Perez <fperez@colorado.edu>
2770
2779
2771 * MANIFEST.in: Changed docfile selection to exclude all the lyx
2780 * MANIFEST.in: Changed docfile selection to exclude all the lyx
2772 documents. This will make the user download smaller (it's getting
2781 documents. This will make the user download smaller (it's getting
2773 too big).
2782 too big).
2774
2783
2775 2002-05-29 Fernando Perez <fperez@colorado.edu>
2784 2002-05-29 Fernando Perez <fperez@colorado.edu>
2776
2785
2777 * IPython/iplib.py (_FakeModule.__init__): New class introduced to
2786 * IPython/iplib.py (_FakeModule.__init__): New class introduced to
2778 fix problems with shelve and pickle. Seems to work, but I don't
2787 fix problems with shelve and pickle. Seems to work, but I don't
2779 know if corner cases break it. Thanks to Mike Heeter
2788 know if corner cases break it. Thanks to Mike Heeter
2780 <korora-AT-SDF.LONESTAR.ORG> for the bug reports and test cases.
2789 <korora-AT-SDF.LONESTAR.ORG> for the bug reports and test cases.
2781
2790
2782 2002-05-24 Fernando Perez <fperez@colorado.edu>
2791 2002-05-24 Fernando Perez <fperez@colorado.edu>
2783
2792
2784 * IPython/Magic.py (Macro.__init__): fixed magics embedded in
2793 * IPython/Magic.py (Macro.__init__): fixed magics embedded in
2785 macros having broken.
2794 macros having broken.
2786
2795
2787 2002-05-21 Fernando Perez <fperez@colorado.edu>
2796 2002-05-21 Fernando Perez <fperez@colorado.edu>
2788
2797
2789 * IPython/Magic.py (Magic.magic_logstart): fixed recently
2798 * IPython/Magic.py (Magic.magic_logstart): fixed recently
2790 introduced logging bug: all history before logging started was
2799 introduced logging bug: all history before logging started was
2791 being written one character per line! This came from the redesign
2800 being written one character per line! This came from the redesign
2792 of the input history as a special list which slices to strings,
2801 of the input history as a special list which slices to strings,
2793 not to lists.
2802 not to lists.
2794
2803
2795 2002-05-20 Fernando Perez <fperez@colorado.edu>
2804 2002-05-20 Fernando Perez <fperez@colorado.edu>
2796
2805
2797 * IPython/Prompts.py (CachedOutput.__init__): made the color table
2806 * IPython/Prompts.py (CachedOutput.__init__): made the color table
2798 be an attribute of all classes in this module. The design of these
2807 be an attribute of all classes in this module. The design of these
2799 classes needs some serious overhauling.
2808 classes needs some serious overhauling.
2800
2809
2801 * IPython/DPyGetOpt.py (DPyGetOpt.setPosixCompliance): fixed bug
2810 * IPython/DPyGetOpt.py (DPyGetOpt.setPosixCompliance): fixed bug
2802 which was ignoring '_' in option names.
2811 which was ignoring '_' in option names.
2803
2812
2804 * IPython/ultraTB.py (FormattedTB.__init__): Changed
2813 * IPython/ultraTB.py (FormattedTB.__init__): Changed
2805 'Verbose_novars' to 'Context' and made it the new default. It's a
2814 'Verbose_novars' to 'Context' and made it the new default. It's a
2806 bit more readable and also safer than verbose.
2815 bit more readable and also safer than verbose.
2807
2816
2808 * IPython/PyColorize.py (Parser.__call__): Fixed coloring of
2817 * IPython/PyColorize.py (Parser.__call__): Fixed coloring of
2809 triple-quoted strings.
2818 triple-quoted strings.
2810
2819
2811 * IPython/OInspect.py (__all__): new module exposing the object
2820 * IPython/OInspect.py (__all__): new module exposing the object
2812 introspection facilities. Now the corresponding magics are dummy
2821 introspection facilities. Now the corresponding magics are dummy
2813 wrappers around this. Having this module will make it much easier
2822 wrappers around this. Having this module will make it much easier
2814 to put these functions into our modified pdb.
2823 to put these functions into our modified pdb.
2815 This new object inspector system uses the new colorizing module,
2824 This new object inspector system uses the new colorizing module,
2816 so source code and other things are nicely syntax highlighted.
2825 so source code and other things are nicely syntax highlighted.
2817
2826
2818 2002-05-18 Fernando Perez <fperez@colorado.edu>
2827 2002-05-18 Fernando Perez <fperez@colorado.edu>
2819
2828
2820 * IPython/ColorANSI.py: Split the coloring tools into a separate
2829 * IPython/ColorANSI.py: Split the coloring tools into a separate
2821 module so I can use them in other code easier (they were part of
2830 module so I can use them in other code easier (they were part of
2822 ultraTB).
2831 ultraTB).
2823
2832
2824 2002-05-17 Fernando Perez <fperez@colorado.edu>
2833 2002-05-17 Fernando Perez <fperez@colorado.edu>
2825
2834
2826 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
2835 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
2827 fixed it to set the global 'g' also to the called instance, as
2836 fixed it to set the global 'g' also to the called instance, as
2828 long as 'g' was still a gnuplot instance (so it doesn't overwrite
2837 long as 'g' was still a gnuplot instance (so it doesn't overwrite
2829 user's 'g' variables).
2838 user's 'g' variables).
2830
2839
2831 * IPython/iplib.py (InteractiveShell.__init__): Added In/Out
2840 * IPython/iplib.py (InteractiveShell.__init__): Added In/Out
2832 global variables (aliases to _ih,_oh) so that users which expect
2841 global variables (aliases to _ih,_oh) so that users which expect
2833 In[5] or Out[7] to work aren't unpleasantly surprised.
2842 In[5] or Out[7] to work aren't unpleasantly surprised.
2834 (InputList.__getslice__): new class to allow executing slices of
2843 (InputList.__getslice__): new class to allow executing slices of
2835 input history directly. Very simple class, complements the use of
2844 input history directly. Very simple class, complements the use of
2836 macros.
2845 macros.
2837
2846
2838 2002-05-16 Fernando Perez <fperez@colorado.edu>
2847 2002-05-16 Fernando Perez <fperez@colorado.edu>
2839
2848
2840 * setup.py (docdirbase): make doc directory be just doc/IPython
2849 * setup.py (docdirbase): make doc directory be just doc/IPython
2841 without version numbers, it will reduce clutter for users.
2850 without version numbers, it will reduce clutter for users.
2842
2851
2843 * IPython/Magic.py (Magic.magic_run): Add explicit local dict to
2852 * IPython/Magic.py (Magic.magic_run): Add explicit local dict to
2844 execfile call to prevent possible memory leak. See for details:
2853 execfile call to prevent possible memory leak. See for details:
2845 http://mail.python.org/pipermail/python-list/2002-February/088476.html
2854 http://mail.python.org/pipermail/python-list/2002-February/088476.html
2846
2855
2847 2002-05-15 Fernando Perez <fperez@colorado.edu>
2856 2002-05-15 Fernando Perez <fperez@colorado.edu>
2848
2857
2849 * IPython/Magic.py (Magic.magic_psource): made the object
2858 * IPython/Magic.py (Magic.magic_psource): made the object
2850 introspection names be more standard: pdoc, pdef, pfile and
2859 introspection names be more standard: pdoc, pdef, pfile and
2851 psource. They all print/page their output, and it makes
2860 psource. They all print/page their output, and it makes
2852 remembering them easier. Kept old names for compatibility as
2861 remembering them easier. Kept old names for compatibility as
2853 aliases.
2862 aliases.
2854
2863
2855 2002-05-14 Fernando Perez <fperez@colorado.edu>
2864 2002-05-14 Fernando Perez <fperez@colorado.edu>
2856
2865
2857 * IPython/UserConfig/GnuplotMagic.py: I think I finally understood
2866 * IPython/UserConfig/GnuplotMagic.py: I think I finally understood
2858 what the mouse problem was. The trick is to use gnuplot with temp
2867 what the mouse problem was. The trick is to use gnuplot with temp
2859 files and NOT with pipes (for data communication), because having
2868 files and NOT with pipes (for data communication), because having
2860 both pipes and the mouse on is bad news.
2869 both pipes and the mouse on is bad news.
2861
2870
2862 2002-05-13 Fernando Perez <fperez@colorado.edu>
2871 2002-05-13 Fernando Perez <fperez@colorado.edu>
2863
2872
2864 * IPython/Magic.py (Magic._ofind): fixed namespace order search
2873 * IPython/Magic.py (Magic._ofind): fixed namespace order search
2865 bug. Information would be reported about builtins even when
2874 bug. Information would be reported about builtins even when
2866 user-defined functions overrode them.
2875 user-defined functions overrode them.
2867
2876
2868 2002-05-11 Fernando Perez <fperez@colorado.edu>
2877 2002-05-11 Fernando Perez <fperez@colorado.edu>
2869
2878
2870 * IPython/__init__.py (__all__): removed FlexCompleter from
2879 * IPython/__init__.py (__all__): removed FlexCompleter from
2871 __all__ so that things don't fail in platforms without readline.
2880 __all__ so that things don't fail in platforms without readline.
2872
2881
2873 2002-05-10 Fernando Perez <fperez@colorado.edu>
2882 2002-05-10 Fernando Perez <fperez@colorado.edu>
2874
2883
2875 * IPython/__init__.py (__all__): removed numutils from __all__ b/c
2884 * IPython/__init__.py (__all__): removed numutils from __all__ b/c
2876 it requires Numeric, effectively making Numeric a dependency for
2885 it requires Numeric, effectively making Numeric a dependency for
2877 IPython.
2886 IPython.
2878
2887
2879 * Released 0.2.13
2888 * Released 0.2.13
2880
2889
2881 * IPython/Magic.py (Magic.magic_prun): big overhaul to the
2890 * IPython/Magic.py (Magic.magic_prun): big overhaul to the
2882 profiler interface. Now all the major options from the profiler
2891 profiler interface. Now all the major options from the profiler
2883 module are directly supported in IPython, both for single
2892 module are directly supported in IPython, both for single
2884 expressions (@prun) and for full programs (@run -p).
2893 expressions (@prun) and for full programs (@run -p).
2885
2894
2886 2002-05-09 Fernando Perez <fperez@colorado.edu>
2895 2002-05-09 Fernando Perez <fperez@colorado.edu>
2887
2896
2888 * IPython/Magic.py (Magic.magic_doc): fixed to show docstrings of
2897 * IPython/Magic.py (Magic.magic_doc): fixed to show docstrings of
2889 magic properly formatted for screen.
2898 magic properly formatted for screen.
2890
2899
2891 * setup.py (make_shortcut): Changed things to put pdf version in
2900 * setup.py (make_shortcut): Changed things to put pdf version in
2892 doc/ instead of doc/manual (had to change lyxport a bit).
2901 doc/ instead of doc/manual (had to change lyxport a bit).
2893
2902
2894 * IPython/Magic.py (Profile.string_stats): made profile runs go
2903 * IPython/Magic.py (Profile.string_stats): made profile runs go
2895 through pager (they are long and a pager allows searching, saving,
2904 through pager (they are long and a pager allows searching, saving,
2896 etc.)
2905 etc.)
2897
2906
2898 2002-05-08 Fernando Perez <fperez@colorado.edu>
2907 2002-05-08 Fernando Perez <fperez@colorado.edu>
2899
2908
2900 * Released 0.2.12
2909 * Released 0.2.12
2901
2910
2902 2002-05-06 Fernando Perez <fperez@colorado.edu>
2911 2002-05-06 Fernando Perez <fperez@colorado.edu>
2903
2912
2904 * IPython/Magic.py (Magic.magic_hist): small bug fixed (recently
2913 * IPython/Magic.py (Magic.magic_hist): small bug fixed (recently
2905 introduced); 'hist n1 n2' was broken.
2914 introduced); 'hist n1 n2' was broken.
2906 (Magic.magic_pdb): added optional on/off arguments to @pdb
2915 (Magic.magic_pdb): added optional on/off arguments to @pdb
2907 (Magic.magic_run): added option -i to @run, which executes code in
2916 (Magic.magic_run): added option -i to @run, which executes code in
2908 the IPython namespace instead of a clean one. Also added @irun as
2917 the IPython namespace instead of a clean one. Also added @irun as
2909 an alias to @run -i.
2918 an alias to @run -i.
2910
2919
2911 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
2920 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
2912 fixed (it didn't really do anything, the namespaces were wrong).
2921 fixed (it didn't really do anything, the namespaces were wrong).
2913
2922
2914 * IPython/Debugger.py (__init__): Added workaround for python 2.1
2923 * IPython/Debugger.py (__init__): Added workaround for python 2.1
2915
2924
2916 * IPython/__init__.py (__all__): Fixed package namespace, now
2925 * IPython/__init__.py (__all__): Fixed package namespace, now
2917 'import IPython' does give access to IPython.<all> as
2926 'import IPython' does give access to IPython.<all> as
2918 expected. Also renamed __release__ to Release.
2927 expected. Also renamed __release__ to Release.
2919
2928
2920 * IPython/Debugger.py (__license__): created new Pdb class which
2929 * IPython/Debugger.py (__license__): created new Pdb class which
2921 functions like a drop-in for the normal pdb.Pdb but does NOT
2930 functions like a drop-in for the normal pdb.Pdb but does NOT
2922 import readline by default. This way it doesn't muck up IPython's
2931 import readline by default. This way it doesn't muck up IPython's
2923 readline handling, and now tab-completion finally works in the
2932 readline handling, and now tab-completion finally works in the
2924 debugger -- sort of. It completes things globally visible, but the
2933 debugger -- sort of. It completes things globally visible, but the
2925 completer doesn't track the stack as pdb walks it. That's a bit
2934 completer doesn't track the stack as pdb walks it. That's a bit
2926 tricky, and I'll have to implement it later.
2935 tricky, and I'll have to implement it later.
2927
2936
2928 2002-05-05 Fernando Perez <fperez@colorado.edu>
2937 2002-05-05 Fernando Perez <fperez@colorado.edu>
2929
2938
2930 * IPython/Magic.py (Magic.magic_oinfo): fixed formatting bug for
2939 * IPython/Magic.py (Magic.magic_oinfo): fixed formatting bug for
2931 magic docstrings when printed via ? (explicit \'s were being
2940 magic docstrings when printed via ? (explicit \'s were being
2932 printed).
2941 printed).
2933
2942
2934 * IPython/ipmaker.py (make_IPython): fixed namespace
2943 * IPython/ipmaker.py (make_IPython): fixed namespace
2935 identification bug. Now variables loaded via logs or command-line
2944 identification bug. Now variables loaded via logs or command-line
2936 files are recognized in the interactive namespace by @who.
2945 files are recognized in the interactive namespace by @who.
2937
2946
2938 * IPython/iplib.py (InteractiveShell.safe_execfile): Fixed bug in
2947 * IPython/iplib.py (InteractiveShell.safe_execfile): Fixed bug in
2939 log replay system stemming from the string form of Structs.
2948 log replay system stemming from the string form of Structs.
2940
2949
2941 * IPython/Magic.py (Macro.__init__): improved macros to properly
2950 * IPython/Magic.py (Macro.__init__): improved macros to properly
2942 handle magic commands in them.
2951 handle magic commands in them.
2943 (Magic.magic_logstart): usernames are now expanded so 'logstart
2952 (Magic.magic_logstart): usernames are now expanded so 'logstart
2944 ~/mylog' now works.
2953 ~/mylog' now works.
2945
2954
2946 * IPython/iplib.py (complete): fixed bug where paths starting with
2955 * IPython/iplib.py (complete): fixed bug where paths starting with
2947 '/' would be completed as magic names.
2956 '/' would be completed as magic names.
2948
2957
2949 2002-05-04 Fernando Perez <fperez@colorado.edu>
2958 2002-05-04 Fernando Perez <fperez@colorado.edu>
2950
2959
2951 * IPython/Magic.py (Magic.magic_run): added options -p and -f to
2960 * IPython/Magic.py (Magic.magic_run): added options -p and -f to
2952 allow running full programs under the profiler's control.
2961 allow running full programs under the profiler's control.
2953
2962
2954 * IPython/ultraTB.py (FormattedTB.__init__): Added Verbose_novars
2963 * IPython/ultraTB.py (FormattedTB.__init__): Added Verbose_novars
2955 mode to report exceptions verbosely but without formatting
2964 mode to report exceptions verbosely but without formatting
2956 variables. This addresses the issue of ipython 'freezing' (it's
2965 variables. This addresses the issue of ipython 'freezing' (it's
2957 not frozen, but caught in an expensive formatting loop) when huge
2966 not frozen, but caught in an expensive formatting loop) when huge
2958 variables are in the context of an exception.
2967 variables are in the context of an exception.
2959 (VerboseTB.text): Added '--->' markers at line where exception was
2968 (VerboseTB.text): Added '--->' markers at line where exception was
2960 triggered. Much clearer to read, especially in NoColor modes.
2969 triggered. Much clearer to read, especially in NoColor modes.
2961
2970
2962 * IPython/Magic.py (Magic.magic_run): bugfix: -n option had been
2971 * IPython/Magic.py (Magic.magic_run): bugfix: -n option had been
2963 implemented in reverse when changing to the new parse_options().
2972 implemented in reverse when changing to the new parse_options().
2964
2973
2965 2002-05-03 Fernando Perez <fperez@colorado.edu>
2974 2002-05-03 Fernando Perez <fperez@colorado.edu>
2966
2975
2967 * IPython/Magic.py (Magic.parse_options): new function so that
2976 * IPython/Magic.py (Magic.parse_options): new function so that
2968 magics can parse options easier.
2977 magics can parse options easier.
2969 (Magic.magic_prun): new function similar to profile.run(),
2978 (Magic.magic_prun): new function similar to profile.run(),
2970 suggested by Chris Hart.
2979 suggested by Chris Hart.
2971 (Magic.magic_cd): fixed behavior so that it only changes if
2980 (Magic.magic_cd): fixed behavior so that it only changes if
2972 directory actually is in history.
2981 directory actually is in history.
2973
2982
2974 * IPython/usage.py (__doc__): added information about potential
2983 * IPython/usage.py (__doc__): added information about potential
2975 slowness of Verbose exception mode when there are huge data
2984 slowness of Verbose exception mode when there are huge data
2976 structures to be formatted (thanks to Archie Paulson).
2985 structures to be formatted (thanks to Archie Paulson).
2977
2986
2978 * IPython/ipmaker.py (make_IPython): Changed default logging
2987 * IPython/ipmaker.py (make_IPython): Changed default logging
2979 (when simply called with -log) to use curr_dir/ipython.log in
2988 (when simply called with -log) to use curr_dir/ipython.log in
2980 rotate mode. Fixed crash which was occuring with -log before
2989 rotate mode. Fixed crash which was occuring with -log before
2981 (thanks to Jim Boyle).
2990 (thanks to Jim Boyle).
2982
2991
2983 2002-05-01 Fernando Perez <fperez@colorado.edu>
2992 2002-05-01 Fernando Perez <fperez@colorado.edu>
2984
2993
2985 * Released 0.2.11 for these fixes (mainly the ultraTB one which
2994 * Released 0.2.11 for these fixes (mainly the ultraTB one which
2986 was nasty -- though somewhat of a corner case).
2995 was nasty -- though somewhat of a corner case).
2987
2996
2988 * IPython/ultraTB.py (AutoFormattedTB.text): renamed __text to
2997 * IPython/ultraTB.py (AutoFormattedTB.text): renamed __text to
2989 text (was a bug).
2998 text (was a bug).
2990
2999
2991 2002-04-30 Fernando Perez <fperez@colorado.edu>
3000 2002-04-30 Fernando Perez <fperez@colorado.edu>
2992
3001
2993 * IPython/UserConfig/GnuplotMagic.py (magic_gp): Minor fix to add
3002 * IPython/UserConfig/GnuplotMagic.py (magic_gp): Minor fix to add
2994 a print after ^D or ^C from the user so that the In[] prompt
3003 a print after ^D or ^C from the user so that the In[] prompt
2995 doesn't over-run the gnuplot one.
3004 doesn't over-run the gnuplot one.
2996
3005
2997 2002-04-29 Fernando Perez <fperez@colorado.edu>
3006 2002-04-29 Fernando Perez <fperez@colorado.edu>
2998
3007
2999 * Released 0.2.10
3008 * Released 0.2.10
3000
3009
3001 * IPython/__release__.py (version): get date dynamically.
3010 * IPython/__release__.py (version): get date dynamically.
3002
3011
3003 * Misc. documentation updates thanks to Arnd's comments. Also ran
3012 * Misc. documentation updates thanks to Arnd's comments. Also ran
3004 a full spellcheck on the manual (hadn't been done in a while).
3013 a full spellcheck on the manual (hadn't been done in a while).
3005
3014
3006 2002-04-27 Fernando Perez <fperez@colorado.edu>
3015 2002-04-27 Fernando Perez <fperez@colorado.edu>
3007
3016
3008 * IPython/Magic.py (Magic.magic_logstart): Fixed bug where
3017 * IPython/Magic.py (Magic.magic_logstart): Fixed bug where
3009 starting a log in mid-session would reset the input history list.
3018 starting a log in mid-session would reset the input history list.
3010
3019
3011 2002-04-26 Fernando Perez <fperez@colorado.edu>
3020 2002-04-26 Fernando Perez <fperez@colorado.edu>
3012
3021
3013 * IPython/iplib.py (InteractiveShell.wait): Fixed bug where not
3022 * IPython/iplib.py (InteractiveShell.wait): Fixed bug where not
3014 all files were being included in an update. Now anything in
3023 all files were being included in an update. Now anything in
3015 UserConfig that matches [A-Za-z]*.py will go (this excludes
3024 UserConfig that matches [A-Za-z]*.py will go (this excludes
3016 __init__.py)
3025 __init__.py)
3017
3026
3018 2002-04-25 Fernando Perez <fperez@colorado.edu>
3027 2002-04-25 Fernando Perez <fperez@colorado.edu>
3019
3028
3020 * IPython/iplib.py (InteractiveShell.__init__): Added __IPYTHON__
3029 * IPython/iplib.py (InteractiveShell.__init__): Added __IPYTHON__
3021 to __builtins__ so that any form of embedded or imported code can
3030 to __builtins__ so that any form of embedded or imported code can
3022 test for being inside IPython.
3031 test for being inside IPython.
3023
3032
3024 * IPython/UserConfig/GnuplotMagic.py: (magic_gp_set_instance):
3033 * IPython/UserConfig/GnuplotMagic.py: (magic_gp_set_instance):
3025 changed to GnuplotMagic because it's now an importable module,
3034 changed to GnuplotMagic because it's now an importable module,
3026 this makes the name follow that of the standard Gnuplot module.
3035 this makes the name follow that of the standard Gnuplot module.
3027 GnuplotMagic can now be loaded at any time in mid-session.
3036 GnuplotMagic can now be loaded at any time in mid-session.
3028
3037
3029 2002-04-24 Fernando Perez <fperez@colorado.edu>
3038 2002-04-24 Fernando Perez <fperez@colorado.edu>
3030
3039
3031 * IPython/numutils.py: removed SIUnits. It doesn't properly set
3040 * IPython/numutils.py: removed SIUnits. It doesn't properly set
3032 the globals (IPython has its own namespace) and the
3041 the globals (IPython has its own namespace) and the
3033 PhysicalQuantity stuff is much better anyway.
3042 PhysicalQuantity stuff is much better anyway.
3034
3043
3035 * IPython/UserConfig/example-gnuplot.py (g2): Added gnuplot
3044 * IPython/UserConfig/example-gnuplot.py (g2): Added gnuplot
3036 embedding example to standard user directory for
3045 embedding example to standard user directory for
3037 distribution. Also put it in the manual.
3046 distribution. Also put it in the manual.
3038
3047
3039 * IPython/numutils.py (gnuplot_exec): Changed to take a gnuplot
3048 * IPython/numutils.py (gnuplot_exec): Changed to take a gnuplot
3040 instance as first argument (so it doesn't rely on some obscure
3049 instance as first argument (so it doesn't rely on some obscure
3041 hidden global).
3050 hidden global).
3042
3051
3043 * IPython/UserConfig/ipythonrc.py: put () back in accepted
3052 * IPython/UserConfig/ipythonrc.py: put () back in accepted
3044 delimiters. While it prevents ().TAB from working, it allows
3053 delimiters. While it prevents ().TAB from working, it allows
3045 completions in open (... expressions. This is by far a more common
3054 completions in open (... expressions. This is by far a more common
3046 case.
3055 case.
3047
3056
3048 2002-04-23 Fernando Perez <fperez@colorado.edu>
3057 2002-04-23 Fernando Perez <fperez@colorado.edu>
3049
3058
3050 * IPython/Extensions/InterpreterPasteInput.py: new
3059 * IPython/Extensions/InterpreterPasteInput.py: new
3051 syntax-processing module for pasting lines with >>> or ... at the
3060 syntax-processing module for pasting lines with >>> or ... at the
3052 start.
3061 start.
3053
3062
3054 * IPython/Extensions/PhysicalQ_Interactive.py
3063 * IPython/Extensions/PhysicalQ_Interactive.py
3055 (PhysicalQuantityInteractive.__int__): fixed to work with either
3064 (PhysicalQuantityInteractive.__int__): fixed to work with either
3056 Numeric or math.
3065 Numeric or math.
3057
3066
3058 * IPython/UserConfig/ipythonrc-numeric.py: reorganized the
3067 * IPython/UserConfig/ipythonrc-numeric.py: reorganized the
3059 provided profiles. Now we have:
3068 provided profiles. Now we have:
3060 -math -> math module as * and cmath with its own namespace.
3069 -math -> math module as * and cmath with its own namespace.
3061 -numeric -> Numeric as *, plus gnuplot & grace
3070 -numeric -> Numeric as *, plus gnuplot & grace
3062 -physics -> same as before
3071 -physics -> same as before
3063
3072
3064 * IPython/Magic.py (Magic.magic_magic): Fixed bug where
3073 * IPython/Magic.py (Magic.magic_magic): Fixed bug where
3065 user-defined magics wouldn't be found by @magic if they were
3074 user-defined magics wouldn't be found by @magic if they were
3066 defined as class methods. Also cleaned up the namespace search
3075 defined as class methods. Also cleaned up the namespace search
3067 logic and the string building (to use %s instead of many repeated
3076 logic and the string building (to use %s instead of many repeated
3068 string adds).
3077 string adds).
3069
3078
3070 * IPython/UserConfig/example-magic.py (magic_foo): updated example
3079 * IPython/UserConfig/example-magic.py (magic_foo): updated example
3071 of user-defined magics to operate with class methods (cleaner, in
3080 of user-defined magics to operate with class methods (cleaner, in
3072 line with the gnuplot code).
3081 line with the gnuplot code).
3073
3082
3074 2002-04-22 Fernando Perez <fperez@colorado.edu>
3083 2002-04-22 Fernando Perez <fperez@colorado.edu>
3075
3084
3076 * setup.py: updated dependency list so that manual is updated when
3085 * setup.py: updated dependency list so that manual is updated when
3077 all included files change.
3086 all included files change.
3078
3087
3079 * IPython/ipmaker.py (make_IPython): Fixed bug which was ignoring
3088 * IPython/ipmaker.py (make_IPython): Fixed bug which was ignoring
3080 the delimiter removal option (the fix is ugly right now).
3089 the delimiter removal option (the fix is ugly right now).
3081
3090
3082 * IPython/UserConfig/ipythonrc-physics.py: simplified not to load
3091 * IPython/UserConfig/ipythonrc-physics.py: simplified not to load
3083 all of the math profile (quicker loading, no conflict between
3092 all of the math profile (quicker loading, no conflict between
3084 g-9.8 and g-gnuplot).
3093 g-9.8 and g-gnuplot).
3085
3094
3086 * IPython/CrashHandler.py (CrashHandler.__call__): changed default
3095 * IPython/CrashHandler.py (CrashHandler.__call__): changed default
3087 name of post-mortem files to IPython_crash_report.txt.
3096 name of post-mortem files to IPython_crash_report.txt.
3088
3097
3089 * Cleanup/update of the docs. Added all the new readline info and
3098 * Cleanup/update of the docs. Added all the new readline info and
3090 formatted all lists as 'real lists'.
3099 formatted all lists as 'real lists'.
3091
3100
3092 * IPython/ipmaker.py (make_IPython): removed now-obsolete
3101 * IPython/ipmaker.py (make_IPython): removed now-obsolete
3093 tab-completion options, since the full readline parse_and_bind is
3102 tab-completion options, since the full readline parse_and_bind is
3094 now accessible.
3103 now accessible.
3095
3104
3096 * IPython/iplib.py (InteractiveShell.init_readline): Changed
3105 * IPython/iplib.py (InteractiveShell.init_readline): Changed
3097 handling of readline options. Now users can specify any string to
3106 handling of readline options. Now users can specify any string to
3098 be passed to parse_and_bind(), as well as the delimiters to be
3107 be passed to parse_and_bind(), as well as the delimiters to be
3099 removed.
3108 removed.
3100 (InteractiveShell.__init__): Added __name__ to the global
3109 (InteractiveShell.__init__): Added __name__ to the global
3101 namespace so that things like Itpl which rely on its existence
3110 namespace so that things like Itpl which rely on its existence
3102 don't crash.
3111 don't crash.
3103 (InteractiveShell._prefilter): Defined the default with a _ so
3112 (InteractiveShell._prefilter): Defined the default with a _ so
3104 that prefilter() is easier to override, while the default one
3113 that prefilter() is easier to override, while the default one
3105 remains available.
3114 remains available.
3106
3115
3107 2002-04-18 Fernando Perez <fperez@colorado.edu>
3116 2002-04-18 Fernando Perez <fperez@colorado.edu>
3108
3117
3109 * Added information about pdb in the docs.
3118 * Added information about pdb in the docs.
3110
3119
3111 2002-04-17 Fernando Perez <fperez@colorado.edu>
3120 2002-04-17 Fernando Perez <fperez@colorado.edu>
3112
3121
3113 * IPython/ipmaker.py (make_IPython): added rc_override option to
3122 * IPython/ipmaker.py (make_IPython): added rc_override option to
3114 allow passing config options at creation time which may override
3123 allow passing config options at creation time which may override
3115 anything set in the config files or command line. This is
3124 anything set in the config files or command line. This is
3116 particularly useful for configuring embedded instances.
3125 particularly useful for configuring embedded instances.
3117
3126
3118 2002-04-15 Fernando Perez <fperez@colorado.edu>
3127 2002-04-15 Fernando Perez <fperez@colorado.edu>
3119
3128
3120 * IPython/Logger.py (Logger.log): Fixed a nasty bug which could
3129 * IPython/Logger.py (Logger.log): Fixed a nasty bug which could
3121 crash embedded instances because of the input cache falling out of
3130 crash embedded instances because of the input cache falling out of
3122 sync with the output counter.
3131 sync with the output counter.
3123
3132
3124 * IPython/Shell.py (IPythonShellEmbed.__init__): added a debug
3133 * IPython/Shell.py (IPythonShellEmbed.__init__): added a debug
3125 mode which calls pdb after an uncaught exception in IPython itself.
3134 mode which calls pdb after an uncaught exception in IPython itself.
3126
3135
3127 2002-04-14 Fernando Perez <fperez@colorado.edu>
3136 2002-04-14 Fernando Perez <fperez@colorado.edu>
3128
3137
3129 * IPython/iplib.py (InteractiveShell.showtraceback): pdb mucks up
3138 * IPython/iplib.py (InteractiveShell.showtraceback): pdb mucks up
3130 readline, fix it back after each call.
3139 readline, fix it back after each call.
3131
3140
3132 * IPython/ultraTB.py (AutoFormattedTB.__text): made text a private
3141 * IPython/ultraTB.py (AutoFormattedTB.__text): made text a private
3133 method to force all access via __call__(), which guarantees that
3142 method to force all access via __call__(), which guarantees that
3134 traceback references are properly deleted.
3143 traceback references are properly deleted.
3135
3144
3136 * IPython/Prompts.py (CachedOutput._display): minor fixes to
3145 * IPython/Prompts.py (CachedOutput._display): minor fixes to
3137 improve printing when pprint is in use.
3146 improve printing when pprint is in use.
3138
3147
3139 2002-04-13 Fernando Perez <fperez@colorado.edu>
3148 2002-04-13 Fernando Perez <fperez@colorado.edu>
3140
3149
3141 * IPython/Shell.py (IPythonShellEmbed.__call__): SystemExit
3150 * IPython/Shell.py (IPythonShellEmbed.__call__): SystemExit
3142 exceptions aren't caught anymore. If the user triggers one, he
3151 exceptions aren't caught anymore. If the user triggers one, he
3143 should know why he's doing it and it should go all the way up,
3152 should know why he's doing it and it should go all the way up,
3144 just like any other exception. So now @abort will fully kill the
3153 just like any other exception. So now @abort will fully kill the
3145 embedded interpreter and the embedding code (unless that happens
3154 embedded interpreter and the embedding code (unless that happens
3146 to catch SystemExit).
3155 to catch SystemExit).
3147
3156
3148 * IPython/ultraTB.py (VerboseTB.__init__): added a call_pdb flag
3157 * IPython/ultraTB.py (VerboseTB.__init__): added a call_pdb flag
3149 and a debugger() method to invoke the interactive pdb debugger
3158 and a debugger() method to invoke the interactive pdb debugger
3150 after printing exception information. Also added the corresponding
3159 after printing exception information. Also added the corresponding
3151 -pdb option and @pdb magic to control this feature, and updated
3160 -pdb option and @pdb magic to control this feature, and updated
3152 the docs. After a suggestion from Christopher Hart
3161 the docs. After a suggestion from Christopher Hart
3153 (hart-AT-caltech.edu).
3162 (hart-AT-caltech.edu).
3154
3163
3155 2002-04-12 Fernando Perez <fperez@colorado.edu>
3164 2002-04-12 Fernando Perez <fperez@colorado.edu>
3156
3165
3157 * IPython/Shell.py (IPythonShellEmbed.__init__): modified to use
3166 * IPython/Shell.py (IPythonShellEmbed.__init__): modified to use
3158 the exception handlers defined by the user (not the CrashHandler)
3167 the exception handlers defined by the user (not the CrashHandler)
3159 so that user exceptions don't trigger an ipython bug report.
3168 so that user exceptions don't trigger an ipython bug report.
3160
3169
3161 * IPython/ultraTB.py (ColorTB.__init__): made the color scheme
3170 * IPython/ultraTB.py (ColorTB.__init__): made the color scheme
3162 configurable (it should have always been so).
3171 configurable (it should have always been so).
3163
3172
3164 2002-03-26 Fernando Perez <fperez@colorado.edu>
3173 2002-03-26 Fernando Perez <fperez@colorado.edu>
3165
3174
3166 * IPython/Shell.py (IPythonShellEmbed.__call__): many changes here
3175 * IPython/Shell.py (IPythonShellEmbed.__call__): many changes here
3167 and there to fix embedding namespace issues. This should all be
3176 and there to fix embedding namespace issues. This should all be
3168 done in a more elegant way.
3177 done in a more elegant way.
3169
3178
3170 2002-03-25 Fernando Perez <fperez@colorado.edu>
3179 2002-03-25 Fernando Perez <fperez@colorado.edu>
3171
3180
3172 * IPython/genutils.py (get_home_dir): Try to make it work under
3181 * IPython/genutils.py (get_home_dir): Try to make it work under
3173 win9x also.
3182 win9x also.
3174
3183
3175 2002-03-20 Fernando Perez <fperez@colorado.edu>
3184 2002-03-20 Fernando Perez <fperez@colorado.edu>
3176
3185
3177 * IPython/Shell.py (IPythonShellEmbed.__init__): leave
3186 * IPython/Shell.py (IPythonShellEmbed.__init__): leave
3178 sys.displayhook untouched upon __init__.
3187 sys.displayhook untouched upon __init__.
3179
3188
3180 2002-03-19 Fernando Perez <fperez@colorado.edu>
3189 2002-03-19 Fernando Perez <fperez@colorado.edu>
3181
3190
3182 * Released 0.2.9 (for embedding bug, basically).
3191 * Released 0.2.9 (for embedding bug, basically).
3183
3192
3184 * IPython/Shell.py (IPythonShellEmbed.__call__): Trap SystemExit
3193 * IPython/Shell.py (IPythonShellEmbed.__call__): Trap SystemExit
3185 exceptions so that enclosing shell's state can be restored.
3194 exceptions so that enclosing shell's state can be restored.
3186
3195
3187 * Changed magic_gnuplot.py to magic-gnuplot.py to standardize
3196 * Changed magic_gnuplot.py to magic-gnuplot.py to standardize
3188 naming conventions in the .ipython/ dir.
3197 naming conventions in the .ipython/ dir.
3189
3198
3190 * IPython/iplib.py (InteractiveShell.init_readline): removed '-'
3199 * IPython/iplib.py (InteractiveShell.init_readline): removed '-'
3191 from delimiters list so filenames with - in them get expanded.
3200 from delimiters list so filenames with - in them get expanded.
3192
3201
3193 * IPython/Shell.py (IPythonShellEmbed.__call__): fixed bug with
3202 * IPython/Shell.py (IPythonShellEmbed.__call__): fixed bug with
3194 sys.displayhook not being properly restored after an embedded call.
3203 sys.displayhook not being properly restored after an embedded call.
3195
3204
3196 2002-03-18 Fernando Perez <fperez@colorado.edu>
3205 2002-03-18 Fernando Perez <fperez@colorado.edu>
3197
3206
3198 * Released 0.2.8
3207 * Released 0.2.8
3199
3208
3200 * IPython/iplib.py (InteractiveShell.user_setup): fixed bug where
3209 * IPython/iplib.py (InteractiveShell.user_setup): fixed bug where
3201 some files weren't being included in a -upgrade.
3210 some files weren't being included in a -upgrade.
3202 (InteractiveShell.init_readline): Added 'set show-all-if-ambiguous
3211 (InteractiveShell.init_readline): Added 'set show-all-if-ambiguous
3203 on' so that the first tab completes.
3212 on' so that the first tab completes.
3204 (InteractiveShell.handle_magic): fixed bug with spaces around
3213 (InteractiveShell.handle_magic): fixed bug with spaces around
3205 quotes breaking many magic commands.
3214 quotes breaking many magic commands.
3206
3215
3207 * setup.py: added note about ignoring the syntax error messages at
3216 * setup.py: added note about ignoring the syntax error messages at
3208 installation.
3217 installation.
3209
3218
3210 * IPython/UserConfig/magic_gnuplot.py (magic_gp): finished
3219 * IPython/UserConfig/magic_gnuplot.py (magic_gp): finished
3211 streamlining the gnuplot interface, now there's only one magic @gp.
3220 streamlining the gnuplot interface, now there's only one magic @gp.
3212
3221
3213 2002-03-17 Fernando Perez <fperez@colorado.edu>
3222 2002-03-17 Fernando Perez <fperez@colorado.edu>
3214
3223
3215 * IPython/UserConfig/magic_gnuplot.py: new name for the
3224 * IPython/UserConfig/magic_gnuplot.py: new name for the
3216 example-magic_pm.py file. Much enhanced system, now with a shell
3225 example-magic_pm.py file. Much enhanced system, now with a shell
3217 for communicating directly with gnuplot, one command at a time.
3226 for communicating directly with gnuplot, one command at a time.
3218
3227
3219 * IPython/Magic.py (Magic.magic_run): added option -n to prevent
3228 * IPython/Magic.py (Magic.magic_run): added option -n to prevent
3220 setting __name__=='__main__'.
3229 setting __name__=='__main__'.
3221
3230
3222 * IPython/UserConfig/example-magic_pm.py (magic_pm): Added
3231 * IPython/UserConfig/example-magic_pm.py (magic_pm): Added
3223 mini-shell for accessing gnuplot from inside ipython. Should
3232 mini-shell for accessing gnuplot from inside ipython. Should
3224 extend it later for grace access too. Inspired by Arnd's
3233 extend it later for grace access too. Inspired by Arnd's
3225 suggestion.
3234 suggestion.
3226
3235
3227 * IPython/iplib.py (InteractiveShell.handle_magic): fixed bug when
3236 * IPython/iplib.py (InteractiveShell.handle_magic): fixed bug when
3228 calling magic functions with () in their arguments. Thanks to Arnd
3237 calling magic functions with () in their arguments. Thanks to Arnd
3229 Baecker for pointing this to me.
3238 Baecker for pointing this to me.
3230
3239
3231 * IPython/numutils.py (sum_flat): fixed bug. Would recurse
3240 * IPython/numutils.py (sum_flat): fixed bug. Would recurse
3232 infinitely for integer or complex arrays (only worked with floats).
3241 infinitely for integer or complex arrays (only worked with floats).
3233
3242
3234 2002-03-16 Fernando Perez <fperez@colorado.edu>
3243 2002-03-16 Fernando Perez <fperez@colorado.edu>
3235
3244
3236 * setup.py: Merged setup and setup_windows into a single script
3245 * setup.py: Merged setup and setup_windows into a single script
3237 which properly handles things for windows users.
3246 which properly handles things for windows users.
3238
3247
3239 2002-03-15 Fernando Perez <fperez@colorado.edu>
3248 2002-03-15 Fernando Perez <fperez@colorado.edu>
3240
3249
3241 * Big change to the manual: now the magics are all automatically
3250 * Big change to the manual: now the magics are all automatically
3242 documented. This information is generated from their docstrings
3251 documented. This information is generated from their docstrings
3243 and put in a latex file included by the manual lyx file. This way
3252 and put in a latex file included by the manual lyx file. This way
3244 we get always up to date information for the magics. The manual
3253 we get always up to date information for the magics. The manual
3245 now also has proper version information, also auto-synced.
3254 now also has proper version information, also auto-synced.
3246
3255
3247 For this to work, an undocumented --magic_docstrings option was added.
3256 For this to work, an undocumented --magic_docstrings option was added.
3248
3257
3249 2002-03-13 Fernando Perez <fperez@colorado.edu>
3258 2002-03-13 Fernando Perez <fperez@colorado.edu>
3250
3259
3251 * IPython/ultraTB.py (TermColors): fixed problem with dark colors
3260 * IPython/ultraTB.py (TermColors): fixed problem with dark colors
3252 under CDE terminals. An explicit ;2 color reset is needed in the escapes.
3261 under CDE terminals. An explicit ;2 color reset is needed in the escapes.
3253
3262
3254 2002-03-12 Fernando Perez <fperez@colorado.edu>
3263 2002-03-12 Fernando Perez <fperez@colorado.edu>
3255
3264
3256 * IPython/ultraTB.py (TermColors): changed color escapes again to
3265 * IPython/ultraTB.py (TermColors): changed color escapes again to
3257 fix the (old, reintroduced) line-wrapping bug. Basically, if
3266 fix the (old, reintroduced) line-wrapping bug. Basically, if
3258 \001..\002 aren't given in the color escapes, lines get wrapped
3267 \001..\002 aren't given in the color escapes, lines get wrapped
3259 weirdly. But giving those screws up old xterms and emacs terms. So
3268 weirdly. But giving those screws up old xterms and emacs terms. So
3260 I added some logic for emacs terms to be ok, but I can't identify old
3269 I added some logic for emacs terms to be ok, but I can't identify old
3261 xterms separately ($TERM=='xterm' for many terminals, like konsole).
3270 xterms separately ($TERM=='xterm' for many terminals, like konsole).
3262
3271
3263 2002-03-10 Fernando Perez <fperez@colorado.edu>
3272 2002-03-10 Fernando Perez <fperez@colorado.edu>
3264
3273
3265 * IPython/usage.py (__doc__): Various documentation cleanups and
3274 * IPython/usage.py (__doc__): Various documentation cleanups and
3266 updates, both in usage docstrings and in the manual.
3275 updates, both in usage docstrings and in the manual.
3267
3276
3268 * IPython/Prompts.py (CachedOutput.set_colors): cleanups for
3277 * IPython/Prompts.py (CachedOutput.set_colors): cleanups for
3269 handling of caching. Set minimum acceptabe value for having a
3278 handling of caching. Set minimum acceptabe value for having a
3270 cache at 20 values.
3279 cache at 20 values.
3271
3280
3272 * IPython/iplib.py (InteractiveShell.user_setup): moved the
3281 * IPython/iplib.py (InteractiveShell.user_setup): moved the
3273 install_first_time function to a method, renamed it and added an
3282 install_first_time function to a method, renamed it and added an
3274 'upgrade' mode. Now people can update their config directory with
3283 'upgrade' mode. Now people can update their config directory with
3275 a simple command line switch (-upgrade, also new).
3284 a simple command line switch (-upgrade, also new).
3276
3285
3277 * IPython/Magic.py (Magic.magic_pfile): Made @pfile an alias to
3286 * IPython/Magic.py (Magic.magic_pfile): Made @pfile an alias to
3278 @file (convenient for automagic users under Python >= 2.2).
3287 @file (convenient for automagic users under Python >= 2.2).
3279 Removed @files (it seemed more like a plural than an abbrev. of
3288 Removed @files (it seemed more like a plural than an abbrev. of
3280 'file show').
3289 'file show').
3281
3290
3282 * IPython/iplib.py (install_first_time): Fixed crash if there were
3291 * IPython/iplib.py (install_first_time): Fixed crash if there were
3283 backup files ('~') in .ipython/ install directory.
3292 backup files ('~') in .ipython/ install directory.
3284
3293
3285 * IPython/ipmaker.py (make_IPython): fixes for new prompt
3294 * IPython/ipmaker.py (make_IPython): fixes for new prompt
3286 system. Things look fine, but these changes are fairly
3295 system. Things look fine, but these changes are fairly
3287 intrusive. Test them for a few days.
3296 intrusive. Test them for a few days.
3288
3297
3289 * IPython/Prompts.py (CachedOutput.__init__): Massive rewrite of
3298 * IPython/Prompts.py (CachedOutput.__init__): Massive rewrite of
3290 the prompts system. Now all in/out prompt strings are user
3299 the prompts system. Now all in/out prompt strings are user
3291 controllable. This is particularly useful for embedding, as one
3300 controllable. This is particularly useful for embedding, as one
3292 can tag embedded instances with particular prompts.
3301 can tag embedded instances with particular prompts.
3293
3302
3294 Also removed global use of sys.ps1/2, which now allows nested
3303 Also removed global use of sys.ps1/2, which now allows nested
3295 embeddings without any problems. Added command-line options for
3304 embeddings without any problems. Added command-line options for
3296 the prompt strings.
3305 the prompt strings.
3297
3306
3298 2002-03-08 Fernando Perez <fperez@colorado.edu>
3307 2002-03-08 Fernando Perez <fperez@colorado.edu>
3299
3308
3300 * IPython/UserConfig/example-embed-short.py (ipshell): added
3309 * IPython/UserConfig/example-embed-short.py (ipshell): added
3301 example file with the bare minimum code for embedding.
3310 example file with the bare minimum code for embedding.
3302
3311
3303 * IPython/Shell.py (IPythonShellEmbed.set_dummy_mode): added
3312 * IPython/Shell.py (IPythonShellEmbed.set_dummy_mode): added
3304 functionality for the embeddable shell to be activated/deactivated
3313 functionality for the embeddable shell to be activated/deactivated
3305 either globally or at each call.
3314 either globally or at each call.
3306
3315
3307 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixes the problem of
3316 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixes the problem of
3308 rewriting the prompt with '--->' for auto-inputs with proper
3317 rewriting the prompt with '--->' for auto-inputs with proper
3309 coloring. Now the previous UGLY hack in handle_auto() is gone, and
3318 coloring. Now the previous UGLY hack in handle_auto() is gone, and
3310 this is handled by the prompts class itself, as it should.
3319 this is handled by the prompts class itself, as it should.
3311
3320
3312 2002-03-05 Fernando Perez <fperez@colorado.edu>
3321 2002-03-05 Fernando Perez <fperez@colorado.edu>
3313
3322
3314 * IPython/Magic.py (Magic.magic_logstart): Changed @log to
3323 * IPython/Magic.py (Magic.magic_logstart): Changed @log to
3315 @logstart to avoid name clashes with the math log function.
3324 @logstart to avoid name clashes with the math log function.
3316
3325
3317 * Big updates to X/Emacs section of the manual.
3326 * Big updates to X/Emacs section of the manual.
3318
3327
3319 * Removed ipython_emacs. Milan explained to me how to pass
3328 * Removed ipython_emacs. Milan explained to me how to pass
3320 arguments to ipython through Emacs. Some day I'm going to end up
3329 arguments to ipython through Emacs. Some day I'm going to end up
3321 learning some lisp...
3330 learning some lisp...
3322
3331
3323 2002-03-04 Fernando Perez <fperez@colorado.edu>
3332 2002-03-04 Fernando Perez <fperez@colorado.edu>
3324
3333
3325 * IPython/ipython_emacs: Created script to be used as the
3334 * IPython/ipython_emacs: Created script to be used as the
3326 py-python-command Emacs variable so we can pass IPython
3335 py-python-command Emacs variable so we can pass IPython
3327 parameters. I can't figure out how to tell Emacs directly to pass
3336 parameters. I can't figure out how to tell Emacs directly to pass
3328 parameters to IPython, so a dummy shell script will do it.
3337 parameters to IPython, so a dummy shell script will do it.
3329
3338
3330 Other enhancements made for things to work better under Emacs'
3339 Other enhancements made for things to work better under Emacs'
3331 various types of terminals. Many thanks to Milan Zamazal
3340 various types of terminals. Many thanks to Milan Zamazal
3332 <pdm-AT-zamazal.org> for all the suggestions and pointers.
3341 <pdm-AT-zamazal.org> for all the suggestions and pointers.
3333
3342
3334 2002-03-01 Fernando Perez <fperez@colorado.edu>
3343 2002-03-01 Fernando Perez <fperez@colorado.edu>
3335
3344
3336 * IPython/ipmaker.py (make_IPython): added a --readline! option so
3345 * IPython/ipmaker.py (make_IPython): added a --readline! option so
3337 that loading of readline is now optional. This gives better
3346 that loading of readline is now optional. This gives better
3338 control to emacs users.
3347 control to emacs users.
3339
3348
3340 * IPython/ultraTB.py (__date__): Modified color escape sequences
3349 * IPython/ultraTB.py (__date__): Modified color escape sequences
3341 and now things work fine under xterm and in Emacs' term buffers
3350 and now things work fine under xterm and in Emacs' term buffers
3342 (though not shell ones). Well, in emacs you get colors, but all
3351 (though not shell ones). Well, in emacs you get colors, but all
3343 seem to be 'light' colors (no difference between dark and light
3352 seem to be 'light' colors (no difference between dark and light
3344 ones). But the garbage chars are gone, and also in xterms. It
3353 ones). But the garbage chars are gone, and also in xterms. It
3345 seems that now I'm using 'cleaner' ansi sequences.
3354 seems that now I'm using 'cleaner' ansi sequences.
3346
3355
3347 2002-02-21 Fernando Perez <fperez@colorado.edu>
3356 2002-02-21 Fernando Perez <fperez@colorado.edu>
3348
3357
3349 * Released 0.2.7 (mainly to publish the scoping fix).
3358 * Released 0.2.7 (mainly to publish the scoping fix).
3350
3359
3351 * IPython/Logger.py (Logger.logstate): added. A corresponding
3360 * IPython/Logger.py (Logger.logstate): added. A corresponding
3352 @logstate magic was created.
3361 @logstate magic was created.
3353
3362
3354 * IPython/Magic.py: fixed nested scoping problem under Python
3363 * IPython/Magic.py: fixed nested scoping problem under Python
3355 2.1.x (automagic wasn't working).
3364 2.1.x (automagic wasn't working).
3356
3365
3357 2002-02-20 Fernando Perez <fperez@colorado.edu>
3366 2002-02-20 Fernando Perez <fperez@colorado.edu>
3358
3367
3359 * Released 0.2.6.
3368 * Released 0.2.6.
3360
3369
3361 * IPython/OutputTrap.py (OutputTrap.__init__): added a 'quiet'
3370 * IPython/OutputTrap.py (OutputTrap.__init__): added a 'quiet'
3362 option so that logs can come out without any headers at all.
3371 option so that logs can come out without any headers at all.
3363
3372
3364 * IPython/UserConfig/ipythonrc-scipy.py: created a profile for
3373 * IPython/UserConfig/ipythonrc-scipy.py: created a profile for
3365 SciPy.
3374 SciPy.
3366
3375
3367 * IPython/iplib.py (InteractiveShell.embed_mainloop): Changed so
3376 * IPython/iplib.py (InteractiveShell.embed_mainloop): Changed so
3368 that embedded IPython calls don't require vars() to be explicitly
3377 that embedded IPython calls don't require vars() to be explicitly
3369 passed. Now they are extracted from the caller's frame (code
3378 passed. Now they are extracted from the caller's frame (code
3370 snatched from Eric Jones' weave). Added better documentation to
3379 snatched from Eric Jones' weave). Added better documentation to
3371 the section on embedding and the example file.
3380 the section on embedding and the example file.
3372
3381
3373 * IPython/genutils.py (page): Changed so that under emacs, it just
3382 * IPython/genutils.py (page): Changed so that under emacs, it just
3374 prints the string. You can then page up and down in the emacs
3383 prints the string. You can then page up and down in the emacs
3375 buffer itself. This is how the builtin help() works.
3384 buffer itself. This is how the builtin help() works.
3376
3385
3377 * IPython/Prompts.py (CachedOutput.__call__): Fixed issue with
3386 * IPython/Prompts.py (CachedOutput.__call__): Fixed issue with
3378 macro scoping: macros need to be executed in the user's namespace
3387 macro scoping: macros need to be executed in the user's namespace
3379 to work as if they had been typed by the user.
3388 to work as if they had been typed by the user.
3380
3389
3381 * IPython/Magic.py (Magic.magic_macro): Changed macros so they
3390 * IPython/Magic.py (Magic.magic_macro): Changed macros so they
3382 execute automatically (no need to type 'exec...'). They then
3391 execute automatically (no need to type 'exec...'). They then
3383 behave like 'true macros'. The printing system was also modified
3392 behave like 'true macros'. The printing system was also modified
3384 for this to work.
3393 for this to work.
3385
3394
3386 2002-02-19 Fernando Perez <fperez@colorado.edu>
3395 2002-02-19 Fernando Perez <fperez@colorado.edu>
3387
3396
3388 * IPython/genutils.py (page_file): new function for paging files
3397 * IPython/genutils.py (page_file): new function for paging files
3389 in an OS-independent way. Also necessary for file viewing to work
3398 in an OS-independent way. Also necessary for file viewing to work
3390 well inside Emacs buffers.
3399 well inside Emacs buffers.
3391 (page): Added checks for being in an emacs buffer.
3400 (page): Added checks for being in an emacs buffer.
3392 (page): fixed bug for Windows ($TERM isn't set in Windows). Fixed
3401 (page): fixed bug for Windows ($TERM isn't set in Windows). Fixed
3393 same bug in iplib.
3402 same bug in iplib.
3394
3403
3395 2002-02-18 Fernando Perez <fperez@colorado.edu>
3404 2002-02-18 Fernando Perez <fperez@colorado.edu>
3396
3405
3397 * IPython/iplib.py (InteractiveShell.init_readline): modified use
3406 * IPython/iplib.py (InteractiveShell.init_readline): modified use
3398 of readline so that IPython can work inside an Emacs buffer.
3407 of readline so that IPython can work inside an Emacs buffer.
3399
3408
3400 * IPython/ultraTB.py (AutoFormattedTB.__call__): some fixes to
3409 * IPython/ultraTB.py (AutoFormattedTB.__call__): some fixes to
3401 method signatures (they weren't really bugs, but it looks cleaner
3410 method signatures (they weren't really bugs, but it looks cleaner
3402 and keeps PyChecker happy).
3411 and keeps PyChecker happy).
3403
3412
3404 * IPython/ipmaker.py (make_IPython): added hooks Struct to __IP
3413 * IPython/ipmaker.py (make_IPython): added hooks Struct to __IP
3405 for implementing various user-defined hooks. Currently only
3414 for implementing various user-defined hooks. Currently only
3406 display is done.
3415 display is done.
3407
3416
3408 * IPython/Prompts.py (CachedOutput._display): changed display
3417 * IPython/Prompts.py (CachedOutput._display): changed display
3409 functions so that they can be dynamically changed by users easily.
3418 functions so that they can be dynamically changed by users easily.
3410
3419
3411 * IPython/Extensions/numeric_formats.py (num_display): added an
3420 * IPython/Extensions/numeric_formats.py (num_display): added an
3412 extension for printing NumPy arrays in flexible manners. It
3421 extension for printing NumPy arrays in flexible manners. It
3413 doesn't do anything yet, but all the structure is in
3422 doesn't do anything yet, but all the structure is in
3414 place. Ultimately the plan is to implement output format control
3423 place. Ultimately the plan is to implement output format control
3415 like in Octave.
3424 like in Octave.
3416
3425
3417 * IPython/Magic.py (Magic.lsmagic): changed so that bound magic
3426 * IPython/Magic.py (Magic.lsmagic): changed so that bound magic
3418 methods are found at run-time by all the automatic machinery.
3427 methods are found at run-time by all the automatic machinery.
3419
3428
3420 2002-02-17 Fernando Perez <fperez@colorado.edu>
3429 2002-02-17 Fernando Perez <fperez@colorado.edu>
3421
3430
3422 * setup_Windows.py (make_shortcut): documented. Cleaned up the
3431 * setup_Windows.py (make_shortcut): documented. Cleaned up the
3423 whole file a little.
3432 whole file a little.
3424
3433
3425 * ToDo: closed this document. Now there's a new_design.lyx
3434 * ToDo: closed this document. Now there's a new_design.lyx
3426 document for all new ideas. Added making a pdf of it for the
3435 document for all new ideas. Added making a pdf of it for the
3427 end-user distro.
3436 end-user distro.
3428
3437
3429 * IPython/Logger.py (Logger.switch_log): Created this to replace
3438 * IPython/Logger.py (Logger.switch_log): Created this to replace
3430 logon() and logoff(). It also fixes a nasty crash reported by
3439 logon() and logoff(). It also fixes a nasty crash reported by
3431 Philip Hisley <compsys-AT-starpower.net>. Many thanks to him.
3440 Philip Hisley <compsys-AT-starpower.net>. Many thanks to him.
3432
3441
3433 * IPython/iplib.py (complete): got auto-completion to work with
3442 * IPython/iplib.py (complete): got auto-completion to work with
3434 automagic (I had wanted this for a long time).
3443 automagic (I had wanted this for a long time).
3435
3444
3436 * IPython/Magic.py (Magic.magic_files): Added @files as an alias
3445 * IPython/Magic.py (Magic.magic_files): Added @files as an alias
3437 to @file, since file() is now a builtin and clashes with automagic
3446 to @file, since file() is now a builtin and clashes with automagic
3438 for @file.
3447 for @file.
3439
3448
3440 * Made some new files: Prompts, CrashHandler, Magic, Logger. All
3449 * Made some new files: Prompts, CrashHandler, Magic, Logger. All
3441 of this was previously in iplib, which had grown to more than 2000
3450 of this was previously in iplib, which had grown to more than 2000
3442 lines, way too long. No new functionality, but it makes managing
3451 lines, way too long. No new functionality, but it makes managing
3443 the code a bit easier.
3452 the code a bit easier.
3444
3453
3445 * IPython/iplib.py (IPythonCrashHandler.__call__): Added version
3454 * IPython/iplib.py (IPythonCrashHandler.__call__): Added version
3446 information to crash reports.
3455 information to crash reports.
3447
3456
3448 2002-02-12 Fernando Perez <fperez@colorado.edu>
3457 2002-02-12 Fernando Perez <fperez@colorado.edu>
3449
3458
3450 * Released 0.2.5.
3459 * Released 0.2.5.
3451
3460
3452 2002-02-11 Fernando Perez <fperez@colorado.edu>
3461 2002-02-11 Fernando Perez <fperez@colorado.edu>
3453
3462
3454 * Wrote a relatively complete Windows installer. It puts
3463 * Wrote a relatively complete Windows installer. It puts
3455 everything in place, creates Start Menu entries and fixes the
3464 everything in place, creates Start Menu entries and fixes the
3456 color issues. Nothing fancy, but it works.
3465 color issues. Nothing fancy, but it works.
3457
3466
3458 2002-02-10 Fernando Perez <fperez@colorado.edu>
3467 2002-02-10 Fernando Perez <fperez@colorado.edu>
3459
3468
3460 * IPython/iplib.py (InteractiveShell.safe_execfile): added an
3469 * IPython/iplib.py (InteractiveShell.safe_execfile): added an
3461 os.path.expanduser() call so that we can type @run ~/myfile.py and
3470 os.path.expanduser() call so that we can type @run ~/myfile.py and
3462 have thigs work as expected.
3471 have thigs work as expected.
3463
3472
3464 * IPython/genutils.py (page): fixed exception handling so things
3473 * IPython/genutils.py (page): fixed exception handling so things
3465 work both in Unix and Windows correctly. Quitting a pager triggers
3474 work both in Unix and Windows correctly. Quitting a pager triggers
3466 an IOError/broken pipe in Unix, and in windows not finding a pager
3475 an IOError/broken pipe in Unix, and in windows not finding a pager
3467 is also an IOError, so I had to actually look at the return value
3476 is also an IOError, so I had to actually look at the return value
3468 of the exception, not just the exception itself. Should be ok now.
3477 of the exception, not just the exception itself. Should be ok now.
3469
3478
3470 * IPython/ultraTB.py (ColorSchemeTable.set_active_scheme):
3479 * IPython/ultraTB.py (ColorSchemeTable.set_active_scheme):
3471 modified to allow case-insensitive color scheme changes.
3480 modified to allow case-insensitive color scheme changes.
3472
3481
3473 2002-02-09 Fernando Perez <fperez@colorado.edu>
3482 2002-02-09 Fernando Perez <fperez@colorado.edu>
3474
3483
3475 * IPython/genutils.py (native_line_ends): new function to leave
3484 * IPython/genutils.py (native_line_ends): new function to leave
3476 user config files with os-native line-endings.
3485 user config files with os-native line-endings.
3477
3486
3478 * README and manual updates.
3487 * README and manual updates.
3479
3488
3480 * IPython/genutils.py: fixed unicode bug: use types.StringTypes
3489 * IPython/genutils.py: fixed unicode bug: use types.StringTypes
3481 instead of StringType to catch Unicode strings.
3490 instead of StringType to catch Unicode strings.
3482
3491
3483 * IPython/genutils.py (filefind): fixed bug for paths with
3492 * IPython/genutils.py (filefind): fixed bug for paths with
3484 embedded spaces (very common in Windows).
3493 embedded spaces (very common in Windows).
3485
3494
3486 * IPython/ipmaker.py (make_IPython): added a '.ini' to the rc
3495 * IPython/ipmaker.py (make_IPython): added a '.ini' to the rc
3487 files under Windows, so that they get automatically associated
3496 files under Windows, so that they get automatically associated
3488 with a text editor. Windows makes it a pain to handle
3497 with a text editor. Windows makes it a pain to handle
3489 extension-less files.
3498 extension-less files.
3490
3499
3491 * IPython/iplib.py (InteractiveShell.init_readline): Made the
3500 * IPython/iplib.py (InteractiveShell.init_readline): Made the
3492 warning about readline only occur for Posix. In Windows there's no
3501 warning about readline only occur for Posix. In Windows there's no
3493 way to get readline, so why bother with the warning.
3502 way to get readline, so why bother with the warning.
3494
3503
3495 * IPython/Struct.py (Struct.__str__): fixed to use self.__dict__
3504 * IPython/Struct.py (Struct.__str__): fixed to use self.__dict__
3496 for __str__ instead of dir(self), since dir() changed in 2.2.
3505 for __str__ instead of dir(self), since dir() changed in 2.2.
3497
3506
3498 * Ported to Windows! Tested on XP, I suspect it should work fine
3507 * Ported to Windows! Tested on XP, I suspect it should work fine
3499 on NT/2000, but I don't think it will work on 98 et al. That
3508 on NT/2000, but I don't think it will work on 98 et al. That
3500 series of Windows is such a piece of junk anyway that I won't try
3509 series of Windows is such a piece of junk anyway that I won't try
3501 porting it there. The XP port was straightforward, showed a few
3510 porting it there. The XP port was straightforward, showed a few
3502 bugs here and there (fixed all), in particular some string
3511 bugs here and there (fixed all), in particular some string
3503 handling stuff which required considering Unicode strings (which
3512 handling stuff which required considering Unicode strings (which
3504 Windows uses). This is good, but hasn't been too tested :) No
3513 Windows uses). This is good, but hasn't been too tested :) No
3505 fancy installer yet, I'll put a note in the manual so people at
3514 fancy installer yet, I'll put a note in the manual so people at
3506 least make manually a shortcut.
3515 least make manually a shortcut.
3507
3516
3508 * IPython/iplib.py (Magic.magic_colors): Unified the color options
3517 * IPython/iplib.py (Magic.magic_colors): Unified the color options
3509 into a single one, "colors". This now controls both prompt and
3518 into a single one, "colors". This now controls both prompt and
3510 exception color schemes, and can be changed both at startup
3519 exception color schemes, and can be changed both at startup
3511 (either via command-line switches or via ipythonrc files) and at
3520 (either via command-line switches or via ipythonrc files) and at
3512 runtime, with @colors.
3521 runtime, with @colors.
3513 (Magic.magic_run): renamed @prun to @run and removed the old
3522 (Magic.magic_run): renamed @prun to @run and removed the old
3514 @run. The two were too similar to warrant keeping both.
3523 @run. The two were too similar to warrant keeping both.
3515
3524
3516 2002-02-03 Fernando Perez <fperez@colorado.edu>
3525 2002-02-03 Fernando Perez <fperez@colorado.edu>
3517
3526
3518 * IPython/iplib.py (install_first_time): Added comment on how to
3527 * IPython/iplib.py (install_first_time): Added comment on how to
3519 configure the color options for first-time users. Put a <return>
3528 configure the color options for first-time users. Put a <return>
3520 request at the end so that small-terminal users get a chance to
3529 request at the end so that small-terminal users get a chance to
3521 read the startup info.
3530 read the startup info.
3522
3531
3523 2002-01-23 Fernando Perez <fperez@colorado.edu>
3532 2002-01-23 Fernando Perez <fperez@colorado.edu>
3524
3533
3525 * IPython/iplib.py (CachedOutput.update): Changed output memory
3534 * IPython/iplib.py (CachedOutput.update): Changed output memory
3526 variable names from _o,_oo,_ooo,_o<n> to simply _,__,___,_<n>. For
3535 variable names from _o,_oo,_ooo,_o<n> to simply _,__,___,_<n>. For
3527 input history we still use _i. Did this b/c these variable are
3536 input history we still use _i. Did this b/c these variable are
3528 very commonly used in interactive work, so the less we need to
3537 very commonly used in interactive work, so the less we need to
3529 type the better off we are.
3538 type the better off we are.
3530 (Magic.magic_prun): updated @prun to better handle the namespaces
3539 (Magic.magic_prun): updated @prun to better handle the namespaces
3531 the file will run in, including a fix for __name__ not being set
3540 the file will run in, including a fix for __name__ not being set
3532 before.
3541 before.
3533
3542
3534 2002-01-20 Fernando Perez <fperez@colorado.edu>
3543 2002-01-20 Fernando Perez <fperez@colorado.edu>
3535
3544
3536 * IPython/ultraTB.py (VerboseTB.linereader): Fixed printing of
3545 * IPython/ultraTB.py (VerboseTB.linereader): Fixed printing of
3537 extra garbage for Python 2.2. Need to look more carefully into
3546 extra garbage for Python 2.2. Need to look more carefully into
3538 this later.
3547 this later.
3539
3548
3540 2002-01-19 Fernando Perez <fperez@colorado.edu>
3549 2002-01-19 Fernando Perez <fperez@colorado.edu>
3541
3550
3542 * IPython/iplib.py (InteractiveShell.showtraceback): fixed to
3551 * IPython/iplib.py (InteractiveShell.showtraceback): fixed to
3543 display SyntaxError exceptions properly formatted when they occur
3552 display SyntaxError exceptions properly formatted when they occur
3544 (they can be triggered by imported code).
3553 (they can be triggered by imported code).
3545
3554
3546 2002-01-18 Fernando Perez <fperez@colorado.edu>
3555 2002-01-18 Fernando Perez <fperez@colorado.edu>
3547
3556
3548 * IPython/iplib.py (InteractiveShell.safe_execfile): now
3557 * IPython/iplib.py (InteractiveShell.safe_execfile): now
3549 SyntaxError exceptions are reported nicely formatted, instead of
3558 SyntaxError exceptions are reported nicely formatted, instead of
3550 spitting out only offset information as before.
3559 spitting out only offset information as before.
3551 (Magic.magic_prun): Added the @prun function for executing
3560 (Magic.magic_prun): Added the @prun function for executing
3552 programs with command line args inside IPython.
3561 programs with command line args inside IPython.
3553
3562
3554 2002-01-16 Fernando Perez <fperez@colorado.edu>
3563 2002-01-16 Fernando Perez <fperez@colorado.edu>
3555
3564
3556 * IPython/iplib.py (Magic.magic_hist): Changed @hist and @dhist
3565 * IPython/iplib.py (Magic.magic_hist): Changed @hist and @dhist
3557 to *not* include the last item given in a range. This brings their
3566 to *not* include the last item given in a range. This brings their
3558 behavior in line with Python's slicing:
3567 behavior in line with Python's slicing:
3559 a[n1:n2] -> a[n1]...a[n2-1]
3568 a[n1:n2] -> a[n1]...a[n2-1]
3560 It may be a bit less convenient, but I prefer to stick to Python's
3569 It may be a bit less convenient, but I prefer to stick to Python's
3561 conventions *everywhere*, so users never have to wonder.
3570 conventions *everywhere*, so users never have to wonder.
3562 (Magic.magic_macro): Added @macro function to ease the creation of
3571 (Magic.magic_macro): Added @macro function to ease the creation of
3563 macros.
3572 macros.
3564
3573
3565 2002-01-05 Fernando Perez <fperez@colorado.edu>
3574 2002-01-05 Fernando Perez <fperez@colorado.edu>
3566
3575
3567 * Released 0.2.4.
3576 * Released 0.2.4.
3568
3577
3569 * IPython/iplib.py (Magic.magic_pdef):
3578 * IPython/iplib.py (Magic.magic_pdef):
3570 (InteractiveShell.safe_execfile): report magic lines and error
3579 (InteractiveShell.safe_execfile): report magic lines and error
3571 lines without line numbers so one can easily copy/paste them for
3580 lines without line numbers so one can easily copy/paste them for
3572 re-execution.
3581 re-execution.
3573
3582
3574 * Updated manual with recent changes.
3583 * Updated manual with recent changes.
3575
3584
3576 * IPython/iplib.py (Magic.magic_oinfo): added constructor
3585 * IPython/iplib.py (Magic.magic_oinfo): added constructor
3577 docstring printing when class? is called. Very handy for knowing
3586 docstring printing when class? is called. Very handy for knowing
3578 how to create class instances (as long as __init__ is well
3587 how to create class instances (as long as __init__ is well
3579 documented, of course :)
3588 documented, of course :)
3580 (Magic.magic_doc): print both class and constructor docstrings.
3589 (Magic.magic_doc): print both class and constructor docstrings.
3581 (Magic.magic_pdef): give constructor info if passed a class and
3590 (Magic.magic_pdef): give constructor info if passed a class and
3582 __call__ info for callable object instances.
3591 __call__ info for callable object instances.
3583
3592
3584 2002-01-04 Fernando Perez <fperez@colorado.edu>
3593 2002-01-04 Fernando Perez <fperez@colorado.edu>
3585
3594
3586 * Made deep_reload() off by default. It doesn't always work
3595 * Made deep_reload() off by default. It doesn't always work
3587 exactly as intended, so it's probably safer to have it off. It's
3596 exactly as intended, so it's probably safer to have it off. It's
3588 still available as dreload() anyway, so nothing is lost.
3597 still available as dreload() anyway, so nothing is lost.
3589
3598
3590 2002-01-02 Fernando Perez <fperez@colorado.edu>
3599 2002-01-02 Fernando Perez <fperez@colorado.edu>
3591
3600
3592 * Released 0.2.3 (contacted R.Singh at CU about biopython course,
3601 * Released 0.2.3 (contacted R.Singh at CU about biopython course,
3593 so I wanted an updated release).
3602 so I wanted an updated release).
3594
3603
3595 2001-12-27 Fernando Perez <fperez@colorado.edu>
3604 2001-12-27 Fernando Perez <fperez@colorado.edu>
3596
3605
3597 * IPython/iplib.py (InteractiveShell.interact): Added the original
3606 * IPython/iplib.py (InteractiveShell.interact): Added the original
3598 code from 'code.py' for this module in order to change the
3607 code from 'code.py' for this module in order to change the
3599 handling of a KeyboardInterrupt. This was necessary b/c otherwise
3608 handling of a KeyboardInterrupt. This was necessary b/c otherwise
3600 the history cache would break when the user hit Ctrl-C, and
3609 the history cache would break when the user hit Ctrl-C, and
3601 interact() offers no way to add any hooks to it.
3610 interact() offers no way to add any hooks to it.
3602
3611
3603 2001-12-23 Fernando Perez <fperez@colorado.edu>
3612 2001-12-23 Fernando Perez <fperez@colorado.edu>
3604
3613
3605 * setup.py: added check for 'MANIFEST' before trying to remove
3614 * setup.py: added check for 'MANIFEST' before trying to remove
3606 it. Thanks to Sean Reifschneider.
3615 it. Thanks to Sean Reifschneider.
3607
3616
3608 2001-12-22 Fernando Perez <fperez@colorado.edu>
3617 2001-12-22 Fernando Perez <fperez@colorado.edu>
3609
3618
3610 * Released 0.2.2.
3619 * Released 0.2.2.
3611
3620
3612 * Finished (reasonably) writing the manual. Later will add the
3621 * Finished (reasonably) writing the manual. Later will add the
3613 python-standard navigation stylesheets, but for the time being
3622 python-standard navigation stylesheets, but for the time being
3614 it's fairly complete. Distribution will include html and pdf
3623 it's fairly complete. Distribution will include html and pdf
3615 versions.
3624 versions.
3616
3625
3617 * Bugfix: '.' wasn't being added to sys.path. Thanks to Prabhu
3626 * Bugfix: '.' wasn't being added to sys.path. Thanks to Prabhu
3618 (MayaVi author).
3627 (MayaVi author).
3619
3628
3620 2001-12-21 Fernando Perez <fperez@colorado.edu>
3629 2001-12-21 Fernando Perez <fperez@colorado.edu>
3621
3630
3622 * Released 0.2.1. Barring any nasty bugs, this is it as far as a
3631 * Released 0.2.1. Barring any nasty bugs, this is it as far as a
3623 good public release, I think (with the manual and the distutils
3632 good public release, I think (with the manual and the distutils
3624 installer). The manual can use some work, but that can go
3633 installer). The manual can use some work, but that can go
3625 slowly. Otherwise I think it's quite nice for end users. Next
3634 slowly. Otherwise I think it's quite nice for end users. Next
3626 summer, rewrite the guts of it...
3635 summer, rewrite the guts of it...
3627
3636
3628 * Changed format of ipythonrc files to use whitespace as the
3637 * Changed format of ipythonrc files to use whitespace as the
3629 separator instead of an explicit '='. Cleaner.
3638 separator instead of an explicit '='. Cleaner.
3630
3639
3631 2001-12-20 Fernando Perez <fperez@colorado.edu>
3640 2001-12-20 Fernando Perez <fperez@colorado.edu>
3632
3641
3633 * Started a manual in LyX. For now it's just a quick merge of the
3642 * Started a manual in LyX. For now it's just a quick merge of the
3634 various internal docstrings and READMEs. Later it may grow into a
3643 various internal docstrings and READMEs. Later it may grow into a
3635 nice, full-blown manual.
3644 nice, full-blown manual.
3636
3645
3637 * Set up a distutils based installer. Installation should now be
3646 * Set up a distutils based installer. Installation should now be
3638 trivially simple for end-users.
3647 trivially simple for end-users.
3639
3648
3640 2001-12-11 Fernando Perez <fperez@colorado.edu>
3649 2001-12-11 Fernando Perez <fperez@colorado.edu>
3641
3650
3642 * Released 0.2.0. First public release, announced it at
3651 * Released 0.2.0. First public release, announced it at
3643 comp.lang.python. From now on, just bugfixes...
3652 comp.lang.python. From now on, just bugfixes...
3644
3653
3645 * Went through all the files, set copyright/license notices and
3654 * Went through all the files, set copyright/license notices and
3646 cleaned up things. Ready for release.
3655 cleaned up things. Ready for release.
3647
3656
3648 2001-12-10 Fernando Perez <fperez@colorado.edu>
3657 2001-12-10 Fernando Perez <fperez@colorado.edu>
3649
3658
3650 * Changed the first-time installer not to use tarfiles. It's more
3659 * Changed the first-time installer not to use tarfiles. It's more
3651 robust now and less unix-dependent. Also makes it easier for
3660 robust now and less unix-dependent. Also makes it easier for
3652 people to later upgrade versions.
3661 people to later upgrade versions.
3653
3662
3654 * Changed @exit to @abort to reflect the fact that it's pretty
3663 * Changed @exit to @abort to reflect the fact that it's pretty
3655 brutal (a sys.exit()). The difference between @abort and Ctrl-D
3664 brutal (a sys.exit()). The difference between @abort and Ctrl-D
3656 becomes significant only when IPyhton is embedded: in that case,
3665 becomes significant only when IPyhton is embedded: in that case,
3657 C-D closes IPython only, but @abort kills the enclosing program
3666 C-D closes IPython only, but @abort kills the enclosing program
3658 too (unless it had called IPython inside a try catching
3667 too (unless it had called IPython inside a try catching
3659 SystemExit).
3668 SystemExit).
3660
3669
3661 * Created Shell module which exposes the actuall IPython Shell
3670 * Created Shell module which exposes the actuall IPython Shell
3662 classes, currently the normal and the embeddable one. This at
3671 classes, currently the normal and the embeddable one. This at
3663 least offers a stable interface we won't need to change when
3672 least offers a stable interface we won't need to change when
3664 (later) the internals are rewritten. That rewrite will be confined
3673 (later) the internals are rewritten. That rewrite will be confined
3665 to iplib and ipmaker, but the Shell interface should remain as is.
3674 to iplib and ipmaker, but the Shell interface should remain as is.
3666
3675
3667 * Added embed module which offers an embeddable IPShell object,
3676 * Added embed module which offers an embeddable IPShell object,
3668 useful to fire up IPython *inside* a running program. Great for
3677 useful to fire up IPython *inside* a running program. Great for
3669 debugging or dynamical data analysis.
3678 debugging or dynamical data analysis.
3670
3679
3671 2001-12-08 Fernando Perez <fperez@colorado.edu>
3680 2001-12-08 Fernando Perez <fperez@colorado.edu>
3672
3681
3673 * Fixed small bug preventing seeing info from methods of defined
3682 * Fixed small bug preventing seeing info from methods of defined
3674 objects (incorrect namespace in _ofind()).
3683 objects (incorrect namespace in _ofind()).
3675
3684
3676 * Documentation cleanup. Moved the main usage docstrings to a
3685 * Documentation cleanup. Moved the main usage docstrings to a
3677 separate file, usage.py (cleaner to maintain, and hopefully in the
3686 separate file, usage.py (cleaner to maintain, and hopefully in the
3678 future some perlpod-like way of producing interactive, man and
3687 future some perlpod-like way of producing interactive, man and
3679 html docs out of it will be found).
3688 html docs out of it will be found).
3680
3689
3681 * Added @profile to see your profile at any time.
3690 * Added @profile to see your profile at any time.
3682
3691
3683 * Added @p as an alias for 'print'. It's especially convenient if
3692 * Added @p as an alias for 'print'. It's especially convenient if
3684 using automagic ('p x' prints x).
3693 using automagic ('p x' prints x).
3685
3694
3686 * Small cleanups and fixes after a pychecker run.
3695 * Small cleanups and fixes after a pychecker run.
3687
3696
3688 * Changed the @cd command to handle @cd - and @cd -<n> for
3697 * Changed the @cd command to handle @cd - and @cd -<n> for
3689 visiting any directory in _dh.
3698 visiting any directory in _dh.
3690
3699
3691 * Introduced _dh, a history of visited directories. @dhist prints
3700 * Introduced _dh, a history of visited directories. @dhist prints
3692 it out with numbers.
3701 it out with numbers.
3693
3702
3694 2001-12-07 Fernando Perez <fperez@colorado.edu>
3703 2001-12-07 Fernando Perez <fperez@colorado.edu>
3695
3704
3696 * Released 0.1.22
3705 * Released 0.1.22
3697
3706
3698 * Made initialization a bit more robust against invalid color
3707 * Made initialization a bit more robust against invalid color
3699 options in user input (exit, not traceback-crash).
3708 options in user input (exit, not traceback-crash).
3700
3709
3701 * Changed the bug crash reporter to write the report only in the
3710 * Changed the bug crash reporter to write the report only in the
3702 user's .ipython directory. That way IPython won't litter people's
3711 user's .ipython directory. That way IPython won't litter people's
3703 hard disks with crash files all over the place. Also print on
3712 hard disks with crash files all over the place. Also print on
3704 screen the necessary mail command.
3713 screen the necessary mail command.
3705
3714
3706 * With the new ultraTB, implemented LightBG color scheme for light
3715 * With the new ultraTB, implemented LightBG color scheme for light
3707 background terminals. A lot of people like white backgrounds, so I
3716 background terminals. A lot of people like white backgrounds, so I
3708 guess we should at least give them something readable.
3717 guess we should at least give them something readable.
3709
3718
3710 2001-12-06 Fernando Perez <fperez@colorado.edu>
3719 2001-12-06 Fernando Perez <fperez@colorado.edu>
3711
3720
3712 * Modified the structure of ultraTB. Now there's a proper class
3721 * Modified the structure of ultraTB. Now there's a proper class
3713 for tables of color schemes which allow adding schemes easily and
3722 for tables of color schemes which allow adding schemes easily and
3714 switching the active scheme without creating a new instance every
3723 switching the active scheme without creating a new instance every
3715 time (which was ridiculous). The syntax for creating new schemes
3724 time (which was ridiculous). The syntax for creating new schemes
3716 is also cleaner. I think ultraTB is finally done, with a clean
3725 is also cleaner. I think ultraTB is finally done, with a clean
3717 class structure. Names are also much cleaner (now there's proper
3726 class structure. Names are also much cleaner (now there's proper
3718 color tables, no need for every variable to also have 'color' in
3727 color tables, no need for every variable to also have 'color' in
3719 its name).
3728 its name).
3720
3729
3721 * Broke down genutils into separate files. Now genutils only
3730 * Broke down genutils into separate files. Now genutils only
3722 contains utility functions, and classes have been moved to their
3731 contains utility functions, and classes have been moved to their
3723 own files (they had enough independent functionality to warrant
3732 own files (they had enough independent functionality to warrant
3724 it): ConfigLoader, OutputTrap, Struct.
3733 it): ConfigLoader, OutputTrap, Struct.
3725
3734
3726 2001-12-05 Fernando Perez <fperez@colorado.edu>
3735 2001-12-05 Fernando Perez <fperez@colorado.edu>
3727
3736
3728 * IPython turns 21! Released version 0.1.21, as a candidate for
3737 * IPython turns 21! Released version 0.1.21, as a candidate for
3729 public consumption. If all goes well, release in a few days.
3738 public consumption. If all goes well, release in a few days.
3730
3739
3731 * Fixed path bug (files in Extensions/ directory wouldn't be found
3740 * Fixed path bug (files in Extensions/ directory wouldn't be found
3732 unless IPython/ was explicitly in sys.path).
3741 unless IPython/ was explicitly in sys.path).
3733
3742
3734 * Extended the FlexCompleter class as MagicCompleter to allow
3743 * Extended the FlexCompleter class as MagicCompleter to allow
3735 completion of @-starting lines.
3744 completion of @-starting lines.
3736
3745
3737 * Created __release__.py file as a central repository for release
3746 * Created __release__.py file as a central repository for release
3738 info that other files can read from.
3747 info that other files can read from.
3739
3748
3740 * Fixed small bug in logging: when logging was turned on in
3749 * Fixed small bug in logging: when logging was turned on in
3741 mid-session, old lines with special meanings (!@?) were being
3750 mid-session, old lines with special meanings (!@?) were being
3742 logged without the prepended comment, which is necessary since
3751 logged without the prepended comment, which is necessary since
3743 they are not truly valid python syntax. This should make session
3752 they are not truly valid python syntax. This should make session
3744 restores produce less errors.
3753 restores produce less errors.
3745
3754
3746 * The namespace cleanup forced me to make a FlexCompleter class
3755 * The namespace cleanup forced me to make a FlexCompleter class
3747 which is nothing but a ripoff of rlcompleter, but with selectable
3756 which is nothing but a ripoff of rlcompleter, but with selectable
3748 namespace (rlcompleter only works in __main__.__dict__). I'll try
3757 namespace (rlcompleter only works in __main__.__dict__). I'll try
3749 to submit a note to the authors to see if this change can be
3758 to submit a note to the authors to see if this change can be
3750 incorporated in future rlcompleter releases (Dec.6: done)
3759 incorporated in future rlcompleter releases (Dec.6: done)
3751
3760
3752 * More fixes to namespace handling. It was a mess! Now all
3761 * More fixes to namespace handling. It was a mess! Now all
3753 explicit references to __main__.__dict__ are gone (except when
3762 explicit references to __main__.__dict__ are gone (except when
3754 really needed) and everything is handled through the namespace
3763 really needed) and everything is handled through the namespace
3755 dicts in the IPython instance. We seem to be getting somewhere
3764 dicts in the IPython instance. We seem to be getting somewhere
3756 with this, finally...
3765 with this, finally...
3757
3766
3758 * Small documentation updates.
3767 * Small documentation updates.
3759
3768
3760 * Created the Extensions directory under IPython (with an
3769 * Created the Extensions directory under IPython (with an
3761 __init__.py). Put the PhysicalQ stuff there. This directory should
3770 __init__.py). Put the PhysicalQ stuff there. This directory should
3762 be used for all special-purpose extensions.
3771 be used for all special-purpose extensions.
3763
3772
3764 * File renaming:
3773 * File renaming:
3765 ipythonlib --> ipmaker
3774 ipythonlib --> ipmaker
3766 ipplib --> iplib
3775 ipplib --> iplib
3767 This makes a bit more sense in terms of what these files actually do.
3776 This makes a bit more sense in terms of what these files actually do.
3768
3777
3769 * Moved all the classes and functions in ipythonlib to ipplib, so
3778 * Moved all the classes and functions in ipythonlib to ipplib, so
3770 now ipythonlib only has make_IPython(). This will ease up its
3779 now ipythonlib only has make_IPython(). This will ease up its
3771 splitting in smaller functional chunks later.
3780 splitting in smaller functional chunks later.
3772
3781
3773 * Cleaned up (done, I think) output of @whos. Better column
3782 * Cleaned up (done, I think) output of @whos. Better column
3774 formatting, and now shows str(var) for as much as it can, which is
3783 formatting, and now shows str(var) for as much as it can, which is
3775 typically what one gets with a 'print var'.
3784 typically what one gets with a 'print var'.
3776
3785
3777 2001-12-04 Fernando Perez <fperez@colorado.edu>
3786 2001-12-04 Fernando Perez <fperez@colorado.edu>
3778
3787
3779 * Fixed namespace problems. Now builtin/IPyhton/user names get
3788 * Fixed namespace problems. Now builtin/IPyhton/user names get
3780 properly reported in their namespace. Internal namespace handling
3789 properly reported in their namespace. Internal namespace handling
3781 is finally getting decent (not perfect yet, but much better than
3790 is finally getting decent (not perfect yet, but much better than
3782 the ad-hoc mess we had).
3791 the ad-hoc mess we had).
3783
3792
3784 * Removed -exit option. If people just want to run a python
3793 * Removed -exit option. If people just want to run a python
3785 script, that's what the normal interpreter is for. Less
3794 script, that's what the normal interpreter is for. Less
3786 unnecessary options, less chances for bugs.
3795 unnecessary options, less chances for bugs.
3787
3796
3788 * Added a crash handler which generates a complete post-mortem if
3797 * Added a crash handler which generates a complete post-mortem if
3789 IPython crashes. This will help a lot in tracking bugs down the
3798 IPython crashes. This will help a lot in tracking bugs down the
3790 road.
3799 road.
3791
3800
3792 * Fixed nasty bug in auto-evaluation part of prefilter(). Names
3801 * Fixed nasty bug in auto-evaluation part of prefilter(). Names
3793 which were boud to functions being reassigned would bypass the
3802 which were boud to functions being reassigned would bypass the
3794 logger, breaking the sync of _il with the prompt counter. This
3803 logger, breaking the sync of _il with the prompt counter. This
3795 would then crash IPython later when a new line was logged.
3804 would then crash IPython later when a new line was logged.
3796
3805
3797 2001-12-02 Fernando Perez <fperez@colorado.edu>
3806 2001-12-02 Fernando Perez <fperez@colorado.edu>
3798
3807
3799 * Made IPython a package. This means people don't have to clutter
3808 * Made IPython a package. This means people don't have to clutter
3800 their sys.path with yet another directory. Changed the INSTALL
3809 their sys.path with yet another directory. Changed the INSTALL
3801 file accordingly.
3810 file accordingly.
3802
3811
3803 * Cleaned up the output of @who_ls, @who and @whos. @who_ls now
3812 * Cleaned up the output of @who_ls, @who and @whos. @who_ls now
3804 sorts its output (so @who shows it sorted) and @whos formats the
3813 sorts its output (so @who shows it sorted) and @whos formats the
3805 table according to the width of the first column. Nicer, easier to
3814 table according to the width of the first column. Nicer, easier to
3806 read. Todo: write a generic table_format() which takes a list of
3815 read. Todo: write a generic table_format() which takes a list of
3807 lists and prints it nicely formatted, with optional row/column
3816 lists and prints it nicely formatted, with optional row/column
3808 separators and proper padding and justification.
3817 separators and proper padding and justification.
3809
3818
3810 * Released 0.1.20
3819 * Released 0.1.20
3811
3820
3812 * Fixed bug in @log which would reverse the inputcache list (a
3821 * Fixed bug in @log which would reverse the inputcache list (a
3813 copy operation was missing).
3822 copy operation was missing).
3814
3823
3815 * Code cleanup. @config was changed to use page(). Better, since
3824 * Code cleanup. @config was changed to use page(). Better, since
3816 its output is always quite long.
3825 its output is always quite long.
3817
3826
3818 * Itpl is back as a dependency. I was having too many problems
3827 * Itpl is back as a dependency. I was having too many problems
3819 getting the parametric aliases to work reliably, and it's just
3828 getting the parametric aliases to work reliably, and it's just
3820 easier to code weird string operations with it than playing %()s
3829 easier to code weird string operations with it than playing %()s
3821 games. It's only ~6k, so I don't think it's too big a deal.
3830 games. It's only ~6k, so I don't think it's too big a deal.
3822
3831
3823 * Found (and fixed) a very nasty bug with history. !lines weren't
3832 * Found (and fixed) a very nasty bug with history. !lines weren't
3824 getting cached, and the out of sync caches would crash
3833 getting cached, and the out of sync caches would crash
3825 IPython. Fixed it by reorganizing the prefilter/handlers/logger
3834 IPython. Fixed it by reorganizing the prefilter/handlers/logger
3826 division of labor a bit better. Bug fixed, cleaner structure.
3835 division of labor a bit better. Bug fixed, cleaner structure.
3827
3836
3828 2001-12-01 Fernando Perez <fperez@colorado.edu>
3837 2001-12-01 Fernando Perez <fperez@colorado.edu>
3829
3838
3830 * Released 0.1.19
3839 * Released 0.1.19
3831
3840
3832 * Added option -n to @hist to prevent line number printing. Much
3841 * Added option -n to @hist to prevent line number printing. Much
3833 easier to copy/paste code this way.
3842 easier to copy/paste code this way.
3834
3843
3835 * Created global _il to hold the input list. Allows easy
3844 * Created global _il to hold the input list. Allows easy
3836 re-execution of blocks of code by slicing it (inspired by Janko's
3845 re-execution of blocks of code by slicing it (inspired by Janko's
3837 comment on 'macros').
3846 comment on 'macros').
3838
3847
3839 * Small fixes and doc updates.
3848 * Small fixes and doc updates.
3840
3849
3841 * Rewrote @history function (was @h). Renamed it to @hist, @h is
3850 * Rewrote @history function (was @h). Renamed it to @hist, @h is
3842 much too fragile with automagic. Handles properly multi-line
3851 much too fragile with automagic. Handles properly multi-line
3843 statements and takes parameters.
3852 statements and takes parameters.
3844
3853
3845 2001-11-30 Fernando Perez <fperez@colorado.edu>
3854 2001-11-30 Fernando Perez <fperez@colorado.edu>
3846
3855
3847 * Version 0.1.18 released.
3856 * Version 0.1.18 released.
3848
3857
3849 * Fixed nasty namespace bug in initial module imports.
3858 * Fixed nasty namespace bug in initial module imports.
3850
3859
3851 * Added copyright/license notes to all code files (except
3860 * Added copyright/license notes to all code files (except
3852 DPyGetOpt). For the time being, LGPL. That could change.
3861 DPyGetOpt). For the time being, LGPL. That could change.
3853
3862
3854 * Rewrote a much nicer README, updated INSTALL, cleaned up
3863 * Rewrote a much nicer README, updated INSTALL, cleaned up
3855 ipythonrc-* samples.
3864 ipythonrc-* samples.
3856
3865
3857 * Overall code/documentation cleanup. Basically ready for
3866 * Overall code/documentation cleanup. Basically ready for
3858 release. Only remaining thing: licence decision (LGPL?).
3867 release. Only remaining thing: licence decision (LGPL?).
3859
3868
3860 * Converted load_config to a class, ConfigLoader. Now recursion
3869 * Converted load_config to a class, ConfigLoader. Now recursion
3861 control is better organized. Doesn't include the same file twice.
3870 control is better organized. Doesn't include the same file twice.
3862
3871
3863 2001-11-29 Fernando Perez <fperez@colorado.edu>
3872 2001-11-29 Fernando Perez <fperez@colorado.edu>
3864
3873
3865 * Got input history working. Changed output history variables from
3874 * Got input history working. Changed output history variables from
3866 _p to _o so that _i is for input and _o for output. Just cleaner
3875 _p to _o so that _i is for input and _o for output. Just cleaner
3867 convention.
3876 convention.
3868
3877
3869 * Implemented parametric aliases. This pretty much allows the
3878 * Implemented parametric aliases. This pretty much allows the
3870 alias system to offer full-blown shell convenience, I think.
3879 alias system to offer full-blown shell convenience, I think.
3871
3880
3872 * Version 0.1.17 released, 0.1.18 opened.
3881 * Version 0.1.17 released, 0.1.18 opened.
3873
3882
3874 * dot_ipython/ipythonrc (alias): added documentation.
3883 * dot_ipython/ipythonrc (alias): added documentation.
3875 (xcolor): Fixed small bug (xcolors -> xcolor)
3884 (xcolor): Fixed small bug (xcolors -> xcolor)
3876
3885
3877 * Changed the alias system. Now alias is a magic command to define
3886 * Changed the alias system. Now alias is a magic command to define
3878 aliases just like the shell. Rationale: the builtin magics should
3887 aliases just like the shell. Rationale: the builtin magics should
3879 be there for things deeply connected to IPython's
3888 be there for things deeply connected to IPython's
3880 architecture. And this is a much lighter system for what I think
3889 architecture. And this is a much lighter system for what I think
3881 is the really important feature: allowing users to define quickly
3890 is the really important feature: allowing users to define quickly
3882 magics that will do shell things for them, so they can customize
3891 magics that will do shell things for them, so they can customize
3883 IPython easily to match their work habits. If someone is really
3892 IPython easily to match their work habits. If someone is really
3884 desperate to have another name for a builtin alias, they can
3893 desperate to have another name for a builtin alias, they can
3885 always use __IP.magic_newname = __IP.magic_oldname. Hackish but
3894 always use __IP.magic_newname = __IP.magic_oldname. Hackish but
3886 works.
3895 works.
3887
3896
3888 2001-11-28 Fernando Perez <fperez@colorado.edu>
3897 2001-11-28 Fernando Perez <fperez@colorado.edu>
3889
3898
3890 * Changed @file so that it opens the source file at the proper
3899 * Changed @file so that it opens the source file at the proper
3891 line. Since it uses less, if your EDITOR environment is
3900 line. Since it uses less, if your EDITOR environment is
3892 configured, typing v will immediately open your editor of choice
3901 configured, typing v will immediately open your editor of choice
3893 right at the line where the object is defined. Not as quick as
3902 right at the line where the object is defined. Not as quick as
3894 having a direct @edit command, but for all intents and purposes it
3903 having a direct @edit command, but for all intents and purposes it
3895 works. And I don't have to worry about writing @edit to deal with
3904 works. And I don't have to worry about writing @edit to deal with
3896 all the editors, less does that.
3905 all the editors, less does that.
3897
3906
3898 * Version 0.1.16 released, 0.1.17 opened.
3907 * Version 0.1.16 released, 0.1.17 opened.
3899
3908
3900 * Fixed some nasty bugs in the page/page_dumb combo that could
3909 * Fixed some nasty bugs in the page/page_dumb combo that could
3901 crash IPython.
3910 crash IPython.
3902
3911
3903 2001-11-27 Fernando Perez <fperez@colorado.edu>
3912 2001-11-27 Fernando Perez <fperez@colorado.edu>
3904
3913
3905 * Version 0.1.15 released, 0.1.16 opened.
3914 * Version 0.1.15 released, 0.1.16 opened.
3906
3915
3907 * Finally got ? and ?? to work for undefined things: now it's
3916 * Finally got ? and ?? to work for undefined things: now it's
3908 possible to type {}.get? and get information about the get method
3917 possible to type {}.get? and get information about the get method
3909 of dicts, or os.path? even if only os is defined (so technically
3918 of dicts, or os.path? even if only os is defined (so technically
3910 os.path isn't). Works at any level. For example, after import os,
3919 os.path isn't). Works at any level. For example, after import os,
3911 os?, os.path?, os.path.abspath? all work. This is great, took some
3920 os?, os.path?, os.path.abspath? all work. This is great, took some
3912 work in _ofind.
3921 work in _ofind.
3913
3922
3914 * Fixed more bugs with logging. The sanest way to do it was to add
3923 * Fixed more bugs with logging. The sanest way to do it was to add
3915 to @log a 'mode' parameter. Killed two in one shot (this mode
3924 to @log a 'mode' parameter. Killed two in one shot (this mode
3916 option was a request of Janko's). I think it's finally clean
3925 option was a request of Janko's). I think it's finally clean
3917 (famous last words).
3926 (famous last words).
3918
3927
3919 * Added a page_dumb() pager which does a decent job of paging on
3928 * Added a page_dumb() pager which does a decent job of paging on
3920 screen, if better things (like less) aren't available. One less
3929 screen, if better things (like less) aren't available. One less
3921 unix dependency (someday maybe somebody will port this to
3930 unix dependency (someday maybe somebody will port this to
3922 windows).
3931 windows).
3923
3932
3924 * Fixed problem in magic_log: would lock of logging out if log
3933 * Fixed problem in magic_log: would lock of logging out if log
3925 creation failed (because it would still think it had succeeded).
3934 creation failed (because it would still think it had succeeded).
3926
3935
3927 * Improved the page() function using curses to auto-detect screen
3936 * Improved the page() function using curses to auto-detect screen
3928 size. Now it can make a much better decision on whether to print
3937 size. Now it can make a much better decision on whether to print
3929 or page a string. Option screen_length was modified: a value 0
3938 or page a string. Option screen_length was modified: a value 0
3930 means auto-detect, and that's the default now.
3939 means auto-detect, and that's the default now.
3931
3940
3932 * Version 0.1.14 released, 0.1.15 opened. I think this is ready to
3941 * Version 0.1.14 released, 0.1.15 opened. I think this is ready to
3933 go out. I'll test it for a few days, then talk to Janko about
3942 go out. I'll test it for a few days, then talk to Janko about
3934 licences and announce it.
3943 licences and announce it.
3935
3944
3936 * Fixed the length of the auto-generated ---> prompt which appears
3945 * Fixed the length of the auto-generated ---> prompt which appears
3937 for auto-parens and auto-quotes. Getting this right isn't trivial,
3946 for auto-parens and auto-quotes. Getting this right isn't trivial,
3938 with all the color escapes, different prompt types and optional
3947 with all the color escapes, different prompt types and optional
3939 separators. But it seems to be working in all the combinations.
3948 separators. But it seems to be working in all the combinations.
3940
3949
3941 2001-11-26 Fernando Perez <fperez@colorado.edu>
3950 2001-11-26 Fernando Perez <fperez@colorado.edu>
3942
3951
3943 * Wrote a regexp filter to get option types from the option names
3952 * Wrote a regexp filter to get option types from the option names
3944 string. This eliminates the need to manually keep two duplicate
3953 string. This eliminates the need to manually keep two duplicate
3945 lists.
3954 lists.
3946
3955
3947 * Removed the unneeded check_option_names. Now options are handled
3956 * Removed the unneeded check_option_names. Now options are handled
3948 in a much saner manner and it's easy to visually check that things
3957 in a much saner manner and it's easy to visually check that things
3949 are ok.
3958 are ok.
3950
3959
3951 * Updated version numbers on all files I modified to carry a
3960 * Updated version numbers on all files I modified to carry a
3952 notice so Janko and Nathan have clear version markers.
3961 notice so Janko and Nathan have clear version markers.
3953
3962
3954 * Updated docstring for ultraTB with my changes. I should send
3963 * Updated docstring for ultraTB with my changes. I should send
3955 this to Nathan.
3964 this to Nathan.
3956
3965
3957 * Lots of small fixes. Ran everything through pychecker again.
3966 * Lots of small fixes. Ran everything through pychecker again.
3958
3967
3959 * Made loading of deep_reload an cmd line option. If it's not too
3968 * Made loading of deep_reload an cmd line option. If it's not too
3960 kosher, now people can just disable it. With -nodeep_reload it's
3969 kosher, now people can just disable it. With -nodeep_reload it's
3961 still available as dreload(), it just won't overwrite reload().
3970 still available as dreload(), it just won't overwrite reload().
3962
3971
3963 * Moved many options to the no| form (-opt and -noopt
3972 * Moved many options to the no| form (-opt and -noopt
3964 accepted). Cleaner.
3973 accepted). Cleaner.
3965
3974
3966 * Changed magic_log so that if called with no parameters, it uses
3975 * Changed magic_log so that if called with no parameters, it uses
3967 'rotate' mode. That way auto-generated logs aren't automatically
3976 'rotate' mode. That way auto-generated logs aren't automatically
3968 over-written. For normal logs, now a backup is made if it exists
3977 over-written. For normal logs, now a backup is made if it exists
3969 (only 1 level of backups). A new 'backup' mode was added to the
3978 (only 1 level of backups). A new 'backup' mode was added to the
3970 Logger class to support this. This was a request by Janko.
3979 Logger class to support this. This was a request by Janko.
3971
3980
3972 * Added @logoff/@logon to stop/restart an active log.
3981 * Added @logoff/@logon to stop/restart an active log.
3973
3982
3974 * Fixed a lot of bugs in log saving/replay. It was pretty
3983 * Fixed a lot of bugs in log saving/replay. It was pretty
3975 broken. Now special lines (!@,/) appear properly in the command
3984 broken. Now special lines (!@,/) appear properly in the command
3976 history after a log replay.
3985 history after a log replay.
3977
3986
3978 * Tried and failed to implement full session saving via pickle. My
3987 * Tried and failed to implement full session saving via pickle. My
3979 idea was to pickle __main__.__dict__, but modules can't be
3988 idea was to pickle __main__.__dict__, but modules can't be
3980 pickled. This would be a better alternative to replaying logs, but
3989 pickled. This would be a better alternative to replaying logs, but
3981 seems quite tricky to get to work. Changed -session to be called
3990 seems quite tricky to get to work. Changed -session to be called
3982 -logplay, which more accurately reflects what it does. And if we
3991 -logplay, which more accurately reflects what it does. And if we
3983 ever get real session saving working, -session is now available.
3992 ever get real session saving working, -session is now available.
3984
3993
3985 * Implemented color schemes for prompts also. As for tracebacks,
3994 * Implemented color schemes for prompts also. As for tracebacks,
3986 currently only NoColor and Linux are supported. But now the
3995 currently only NoColor and Linux are supported. But now the
3987 infrastructure is in place, based on a generic ColorScheme
3996 infrastructure is in place, based on a generic ColorScheme
3988 class. So writing and activating new schemes both for the prompts
3997 class. So writing and activating new schemes both for the prompts
3989 and the tracebacks should be straightforward.
3998 and the tracebacks should be straightforward.
3990
3999
3991 * Version 0.1.13 released, 0.1.14 opened.
4000 * Version 0.1.13 released, 0.1.14 opened.
3992
4001
3993 * Changed handling of options for output cache. Now counter is
4002 * Changed handling of options for output cache. Now counter is
3994 hardwired starting at 1 and one specifies the maximum number of
4003 hardwired starting at 1 and one specifies the maximum number of
3995 entries *in the outcache* (not the max prompt counter). This is
4004 entries *in the outcache* (not the max prompt counter). This is
3996 much better, since many statements won't increase the cache
4005 much better, since many statements won't increase the cache
3997 count. It also eliminated some confusing options, now there's only
4006 count. It also eliminated some confusing options, now there's only
3998 one: cache_size.
4007 one: cache_size.
3999
4008
4000 * Added 'alias' magic function and magic_alias option in the
4009 * Added 'alias' magic function and magic_alias option in the
4001 ipythonrc file. Now the user can easily define whatever names he
4010 ipythonrc file. Now the user can easily define whatever names he
4002 wants for the magic functions without having to play weird
4011 wants for the magic functions without having to play weird
4003 namespace games. This gives IPython a real shell-like feel.
4012 namespace games. This gives IPython a real shell-like feel.
4004
4013
4005 * Fixed doc/?/?? for magics. Now all work, in all forms (explicit
4014 * Fixed doc/?/?? for magics. Now all work, in all forms (explicit
4006 @ or not).
4015 @ or not).
4007
4016
4008 This was one of the last remaining 'visible' bugs (that I know
4017 This was one of the last remaining 'visible' bugs (that I know
4009 of). I think if I can clean up the session loading so it works
4018 of). I think if I can clean up the session loading so it works
4010 100% I'll release a 0.2.0 version on c.p.l (talk to Janko first
4019 100% I'll release a 0.2.0 version on c.p.l (talk to Janko first
4011 about licensing).
4020 about licensing).
4012
4021
4013 2001-11-25 Fernando Perez <fperez@colorado.edu>
4022 2001-11-25 Fernando Perez <fperez@colorado.edu>
4014
4023
4015 * Rewrote somewhat oinfo (?/??). Nicer, now uses page() and
4024 * Rewrote somewhat oinfo (?/??). Nicer, now uses page() and
4016 there's a cleaner distinction between what ? and ?? show.
4025 there's a cleaner distinction between what ? and ?? show.
4017
4026
4018 * Added screen_length option. Now the user can define his own
4027 * Added screen_length option. Now the user can define his own
4019 screen size for page() operations.
4028 screen size for page() operations.
4020
4029
4021 * Implemented magic shell-like functions with automatic code
4030 * Implemented magic shell-like functions with automatic code
4022 generation. Now adding another function is just a matter of adding
4031 generation. Now adding another function is just a matter of adding
4023 an entry to a dict, and the function is dynamically generated at
4032 an entry to a dict, and the function is dynamically generated at
4024 run-time. Python has some really cool features!
4033 run-time. Python has some really cool features!
4025
4034
4026 * Renamed many options to cleanup conventions a little. Now all
4035 * Renamed many options to cleanup conventions a little. Now all
4027 are lowercase, and only underscores where needed. Also in the code
4036 are lowercase, and only underscores where needed. Also in the code
4028 option name tables are clearer.
4037 option name tables are clearer.
4029
4038
4030 * Changed prompts a little. Now input is 'In [n]:' instead of
4039 * Changed prompts a little. Now input is 'In [n]:' instead of
4031 'In[n]:='. This allows it the numbers to be aligned with the
4040 'In[n]:='. This allows it the numbers to be aligned with the
4032 Out[n] numbers, and removes usage of ':=' which doesn't exist in
4041 Out[n] numbers, and removes usage of ':=' which doesn't exist in
4033 Python (it was a Mathematica thing). The '...' continuation prompt
4042 Python (it was a Mathematica thing). The '...' continuation prompt
4034 was also changed a little to align better.
4043 was also changed a little to align better.
4035
4044
4036 * Fixed bug when flushing output cache. Not all _p<n> variables
4045 * Fixed bug when flushing output cache. Not all _p<n> variables
4037 exist, so their deletion needs to be wrapped in a try:
4046 exist, so their deletion needs to be wrapped in a try:
4038
4047
4039 * Figured out how to properly use inspect.formatargspec() (it
4048 * Figured out how to properly use inspect.formatargspec() (it
4040 requires the args preceded by *). So I removed all the code from
4049 requires the args preceded by *). So I removed all the code from
4041 _get_pdef in Magic, which was just replicating that.
4050 _get_pdef in Magic, which was just replicating that.
4042
4051
4043 * Added test to prefilter to allow redefining magic function names
4052 * Added test to prefilter to allow redefining magic function names
4044 as variables. This is ok, since the @ form is always available,
4053 as variables. This is ok, since the @ form is always available,
4045 but whe should allow the user to define a variable called 'ls' if
4054 but whe should allow the user to define a variable called 'ls' if
4046 he needs it.
4055 he needs it.
4047
4056
4048 * Moved the ToDo information from README into a separate ToDo.
4057 * Moved the ToDo information from README into a separate ToDo.
4049
4058
4050 * General code cleanup and small bugfixes. I think it's close to a
4059 * General code cleanup and small bugfixes. I think it's close to a
4051 state where it can be released, obviously with a big 'beta'
4060 state where it can be released, obviously with a big 'beta'
4052 warning on it.
4061 warning on it.
4053
4062
4054 * Got the magic function split to work. Now all magics are defined
4063 * Got the magic function split to work. Now all magics are defined
4055 in a separate class. It just organizes things a bit, and now
4064 in a separate class. It just organizes things a bit, and now
4056 Xemacs behaves nicer (it was choking on InteractiveShell b/c it
4065 Xemacs behaves nicer (it was choking on InteractiveShell b/c it
4057 was too long).
4066 was too long).
4058
4067
4059 * Changed @clear to @reset to avoid potential confusions with
4068 * Changed @clear to @reset to avoid potential confusions with
4060 the shell command clear. Also renamed @cl to @clear, which does
4069 the shell command clear. Also renamed @cl to @clear, which does
4061 exactly what people expect it to from their shell experience.
4070 exactly what people expect it to from their shell experience.
4062
4071
4063 Added a check to the @reset command (since it's so
4072 Added a check to the @reset command (since it's so
4064 destructive, it's probably a good idea to ask for confirmation).
4073 destructive, it's probably a good idea to ask for confirmation).
4065 But now reset only works for full namespace resetting. Since the
4074 But now reset only works for full namespace resetting. Since the
4066 del keyword is already there for deleting a few specific
4075 del keyword is already there for deleting a few specific
4067 variables, I don't see the point of having a redundant magic
4076 variables, I don't see the point of having a redundant magic
4068 function for the same task.
4077 function for the same task.
4069
4078
4070 2001-11-24 Fernando Perez <fperez@colorado.edu>
4079 2001-11-24 Fernando Perez <fperez@colorado.edu>
4071
4080
4072 * Updated the builtin docs (esp. the ? ones).
4081 * Updated the builtin docs (esp. the ? ones).
4073
4082
4074 * Ran all the code through pychecker. Not terribly impressed with
4083 * Ran all the code through pychecker. Not terribly impressed with
4075 it: lots of spurious warnings and didn't really find anything of
4084 it: lots of spurious warnings and didn't really find anything of
4076 substance (just a few modules being imported and not used).
4085 substance (just a few modules being imported and not used).
4077
4086
4078 * Implemented the new ultraTB functionality into IPython. New
4087 * Implemented the new ultraTB functionality into IPython. New
4079 option: xcolors. This chooses color scheme. xmode now only selects
4088 option: xcolors. This chooses color scheme. xmode now only selects
4080 between Plain and Verbose. Better orthogonality.
4089 between Plain and Verbose. Better orthogonality.
4081
4090
4082 * Large rewrite of ultraTB. Much cleaner now, with a separation of
4091 * Large rewrite of ultraTB. Much cleaner now, with a separation of
4083 mode and color scheme for the exception handlers. Now it's
4092 mode and color scheme for the exception handlers. Now it's
4084 possible to have the verbose traceback with no coloring.
4093 possible to have the verbose traceback with no coloring.
4085
4094
4086 2001-11-23 Fernando Perez <fperez@colorado.edu>
4095 2001-11-23 Fernando Perez <fperez@colorado.edu>
4087
4096
4088 * Version 0.1.12 released, 0.1.13 opened.
4097 * Version 0.1.12 released, 0.1.13 opened.
4089
4098
4090 * Removed option to set auto-quote and auto-paren escapes by
4099 * Removed option to set auto-quote and auto-paren escapes by
4091 user. The chances of breaking valid syntax are just too high. If
4100 user. The chances of breaking valid syntax are just too high. If
4092 someone *really* wants, they can always dig into the code.
4101 someone *really* wants, they can always dig into the code.
4093
4102
4094 * Made prompt separators configurable.
4103 * Made prompt separators configurable.
4095
4104
4096 2001-11-22 Fernando Perez <fperez@colorado.edu>
4105 2001-11-22 Fernando Perez <fperez@colorado.edu>
4097
4106
4098 * Small bugfixes in many places.
4107 * Small bugfixes in many places.
4099
4108
4100 * Removed the MyCompleter class from ipplib. It seemed redundant
4109 * Removed the MyCompleter class from ipplib. It seemed redundant
4101 with the C-p,C-n history search functionality. Less code to
4110 with the C-p,C-n history search functionality. Less code to
4102 maintain.
4111 maintain.
4103
4112
4104 * Moved all the original ipython.py code into ipythonlib.py. Right
4113 * Moved all the original ipython.py code into ipythonlib.py. Right
4105 now it's just one big dump into a function called make_IPython, so
4114 now it's just one big dump into a function called make_IPython, so
4106 no real modularity has been gained. But at least it makes the
4115 no real modularity has been gained. But at least it makes the
4107 wrapper script tiny, and since ipythonlib is a module, it gets
4116 wrapper script tiny, and since ipythonlib is a module, it gets
4108 compiled and startup is much faster.
4117 compiled and startup is much faster.
4109
4118
4110 This is a reasobably 'deep' change, so we should test it for a
4119 This is a reasobably 'deep' change, so we should test it for a
4111 while without messing too much more with the code.
4120 while without messing too much more with the code.
4112
4121
4113 2001-11-21 Fernando Perez <fperez@colorado.edu>
4122 2001-11-21 Fernando Perez <fperez@colorado.edu>
4114
4123
4115 * Version 0.1.11 released, 0.1.12 opened for further work.
4124 * Version 0.1.11 released, 0.1.12 opened for further work.
4116
4125
4117 * Removed dependency on Itpl. It was only needed in one place. It
4126 * Removed dependency on Itpl. It was only needed in one place. It
4118 would be nice if this became part of python, though. It makes life
4127 would be nice if this became part of python, though. It makes life
4119 *a lot* easier in some cases.
4128 *a lot* easier in some cases.
4120
4129
4121 * Simplified the prefilter code a bit. Now all handlers are
4130 * Simplified the prefilter code a bit. Now all handlers are
4122 expected to explicitly return a value (at least a blank string).
4131 expected to explicitly return a value (at least a blank string).
4123
4132
4124 * Heavy edits in ipplib. Removed the help system altogether. Now
4133 * Heavy edits in ipplib. Removed the help system altogether. Now
4125 obj?/?? is used for inspecting objects, a magic @doc prints
4134 obj?/?? is used for inspecting objects, a magic @doc prints
4126 docstrings, and full-blown Python help is accessed via the 'help'
4135 docstrings, and full-blown Python help is accessed via the 'help'
4127 keyword. This cleans up a lot of code (less to maintain) and does
4136 keyword. This cleans up a lot of code (less to maintain) and does
4128 the job. Since 'help' is now a standard Python component, might as
4137 the job. Since 'help' is now a standard Python component, might as
4129 well use it and remove duplicate functionality.
4138 well use it and remove duplicate functionality.
4130
4139
4131 Also removed the option to use ipplib as a standalone program. By
4140 Also removed the option to use ipplib as a standalone program. By
4132 now it's too dependent on other parts of IPython to function alone.
4141 now it's too dependent on other parts of IPython to function alone.
4133
4142
4134 * Fixed bug in genutils.pager. It would crash if the pager was
4143 * Fixed bug in genutils.pager. It would crash if the pager was
4135 exited immediately after opening (broken pipe).
4144 exited immediately after opening (broken pipe).
4136
4145
4137 * Trimmed down the VerboseTB reporting a little. The header is
4146 * Trimmed down the VerboseTB reporting a little. The header is
4138 much shorter now and the repeated exception arguments at the end
4147 much shorter now and the repeated exception arguments at the end
4139 have been removed. For interactive use the old header seemed a bit
4148 have been removed. For interactive use the old header seemed a bit
4140 excessive.
4149 excessive.
4141
4150
4142 * Fixed small bug in output of @whos for variables with multi-word
4151 * Fixed small bug in output of @whos for variables with multi-word
4143 types (only first word was displayed).
4152 types (only first word was displayed).
4144
4153
4145 2001-11-17 Fernando Perez <fperez@colorado.edu>
4154 2001-11-17 Fernando Perez <fperez@colorado.edu>
4146
4155
4147 * Version 0.1.10 released, 0.1.11 opened for further work.
4156 * Version 0.1.10 released, 0.1.11 opened for further work.
4148
4157
4149 * Modified dirs and friends. dirs now *returns* the stack (not
4158 * Modified dirs and friends. dirs now *returns* the stack (not
4150 prints), so one can manipulate it as a variable. Convenient to
4159 prints), so one can manipulate it as a variable. Convenient to
4151 travel along many directories.
4160 travel along many directories.
4152
4161
4153 * Fixed bug in magic_pdef: would only work with functions with
4162 * Fixed bug in magic_pdef: would only work with functions with
4154 arguments with default values.
4163 arguments with default values.
4155
4164
4156 2001-11-14 Fernando Perez <fperez@colorado.edu>
4165 2001-11-14 Fernando Perez <fperez@colorado.edu>
4157
4166
4158 * Added the PhysicsInput stuff to dot_ipython so it ships as an
4167 * Added the PhysicsInput stuff to dot_ipython so it ships as an
4159 example with IPython. Various other minor fixes and cleanups.
4168 example with IPython. Various other minor fixes and cleanups.
4160
4169
4161 * Version 0.1.9 released, 0.1.10 opened for further work.
4170 * Version 0.1.9 released, 0.1.10 opened for further work.
4162
4171
4163 * Added sys.path to the list of directories searched in the
4172 * Added sys.path to the list of directories searched in the
4164 execfile= option. It used to be the current directory and the
4173 execfile= option. It used to be the current directory and the
4165 user's IPYTHONDIR only.
4174 user's IPYTHONDIR only.
4166
4175
4167 2001-11-13 Fernando Perez <fperez@colorado.edu>
4176 2001-11-13 Fernando Perez <fperez@colorado.edu>
4168
4177
4169 * Reinstated the raw_input/prefilter separation that Janko had
4178 * Reinstated the raw_input/prefilter separation that Janko had
4170 initially. This gives a more convenient setup for extending the
4179 initially. This gives a more convenient setup for extending the
4171 pre-processor from the outside: raw_input always gets a string,
4180 pre-processor from the outside: raw_input always gets a string,
4172 and prefilter has to process it. We can then redefine prefilter
4181 and prefilter has to process it. We can then redefine prefilter
4173 from the outside and implement extensions for special
4182 from the outside and implement extensions for special
4174 purposes.
4183 purposes.
4175
4184
4176 Today I got one for inputting PhysicalQuantity objects
4185 Today I got one for inputting PhysicalQuantity objects
4177 (from Scientific) without needing any function calls at
4186 (from Scientific) without needing any function calls at
4178 all. Extremely convenient, and it's all done as a user-level
4187 all. Extremely convenient, and it's all done as a user-level
4179 extension (no IPython code was touched). Now instead of:
4188 extension (no IPython code was touched). Now instead of:
4180 a = PhysicalQuantity(4.2,'m/s**2')
4189 a = PhysicalQuantity(4.2,'m/s**2')
4181 one can simply say
4190 one can simply say
4182 a = 4.2 m/s**2
4191 a = 4.2 m/s**2
4183 or even
4192 or even
4184 a = 4.2 m/s^2
4193 a = 4.2 m/s^2
4185
4194
4186 I use this, but it's also a proof of concept: IPython really is
4195 I use this, but it's also a proof of concept: IPython really is
4187 fully user-extensible, even at the level of the parsing of the
4196 fully user-extensible, even at the level of the parsing of the
4188 command line. It's not trivial, but it's perfectly doable.
4197 command line. It's not trivial, but it's perfectly doable.
4189
4198
4190 * Added 'add_flip' method to inclusion conflict resolver. Fixes
4199 * Added 'add_flip' method to inclusion conflict resolver. Fixes
4191 the problem of modules being loaded in the inverse order in which
4200 the problem of modules being loaded in the inverse order in which
4192 they were defined in
4201 they were defined in
4193
4202
4194 * Version 0.1.8 released, 0.1.9 opened for further work.
4203 * Version 0.1.8 released, 0.1.9 opened for further work.
4195
4204
4196 * Added magics pdef, source and file. They respectively show the
4205 * Added magics pdef, source and file. They respectively show the
4197 definition line ('prototype' in C), source code and full python
4206 definition line ('prototype' in C), source code and full python
4198 file for any callable object. The object inspector oinfo uses
4207 file for any callable object. The object inspector oinfo uses
4199 these to show the same information.
4208 these to show the same information.
4200
4209
4201 * Version 0.1.7 released, 0.1.8 opened for further work.
4210 * Version 0.1.7 released, 0.1.8 opened for further work.
4202
4211
4203 * Separated all the magic functions into a class called Magic. The
4212 * Separated all the magic functions into a class called Magic. The
4204 InteractiveShell class was becoming too big for Xemacs to handle
4213 InteractiveShell class was becoming too big for Xemacs to handle
4205 (de-indenting a line would lock it up for 10 seconds while it
4214 (de-indenting a line would lock it up for 10 seconds while it
4206 backtracked on the whole class!)
4215 backtracked on the whole class!)
4207
4216
4208 FIXME: didn't work. It can be done, but right now namespaces are
4217 FIXME: didn't work. It can be done, but right now namespaces are
4209 all messed up. Do it later (reverted it for now, so at least
4218 all messed up. Do it later (reverted it for now, so at least
4210 everything works as before).
4219 everything works as before).
4211
4220
4212 * Got the object introspection system (magic_oinfo) working! I
4221 * Got the object introspection system (magic_oinfo) working! I
4213 think this is pretty much ready for release to Janko, so he can
4222 think this is pretty much ready for release to Janko, so he can
4214 test it for a while and then announce it. Pretty much 100% of what
4223 test it for a while and then announce it. Pretty much 100% of what
4215 I wanted for the 'phase 1' release is ready. Happy, tired.
4224 I wanted for the 'phase 1' release is ready. Happy, tired.
4216
4225
4217 2001-11-12 Fernando Perez <fperez@colorado.edu>
4226 2001-11-12 Fernando Perez <fperez@colorado.edu>
4218
4227
4219 * Version 0.1.6 released, 0.1.7 opened for further work.
4228 * Version 0.1.6 released, 0.1.7 opened for further work.
4220
4229
4221 * Fixed bug in printing: it used to test for truth before
4230 * Fixed bug in printing: it used to test for truth before
4222 printing, so 0 wouldn't print. Now checks for None.
4231 printing, so 0 wouldn't print. Now checks for None.
4223
4232
4224 * Fixed bug where auto-execs increase the prompt counter by 2 (b/c
4233 * Fixed bug where auto-execs increase the prompt counter by 2 (b/c
4225 they have to call len(str(sys.ps1)) ). But the fix is ugly, it
4234 they have to call len(str(sys.ps1)) ). But the fix is ugly, it
4226 reaches by hand into the outputcache. Think of a better way to do
4235 reaches by hand into the outputcache. Think of a better way to do
4227 this later.
4236 this later.
4228
4237
4229 * Various small fixes thanks to Nathan's comments.
4238 * Various small fixes thanks to Nathan's comments.
4230
4239
4231 * Changed magic_pprint to magic_Pprint. This way it doesn't
4240 * Changed magic_pprint to magic_Pprint. This way it doesn't
4232 collide with pprint() and the name is consistent with the command
4241 collide with pprint() and the name is consistent with the command
4233 line option.
4242 line option.
4234
4243
4235 * Changed prompt counter behavior to be fully like
4244 * Changed prompt counter behavior to be fully like
4236 Mathematica's. That is, even input that doesn't return a result
4245 Mathematica's. That is, even input that doesn't return a result
4237 raises the prompt counter. The old behavior was kind of confusing
4246 raises the prompt counter. The old behavior was kind of confusing
4238 (getting the same prompt number several times if the operation
4247 (getting the same prompt number several times if the operation
4239 didn't return a result).
4248 didn't return a result).
4240
4249
4241 * Fixed Nathan's last name in a couple of places (Gray, not Graham).
4250 * Fixed Nathan's last name in a couple of places (Gray, not Graham).
4242
4251
4243 * Fixed -Classic mode (wasn't working anymore).
4252 * Fixed -Classic mode (wasn't working anymore).
4244
4253
4245 * Added colored prompts using Nathan's new code. Colors are
4254 * Added colored prompts using Nathan's new code. Colors are
4246 currently hardwired, they can be user-configurable. For
4255 currently hardwired, they can be user-configurable. For
4247 developers, they can be chosen in file ipythonlib.py, at the
4256 developers, they can be chosen in file ipythonlib.py, at the
4248 beginning of the CachedOutput class def.
4257 beginning of the CachedOutput class def.
4249
4258
4250 2001-11-11 Fernando Perez <fperez@colorado.edu>
4259 2001-11-11 Fernando Perez <fperez@colorado.edu>
4251
4260
4252 * Version 0.1.5 released, 0.1.6 opened for further work.
4261 * Version 0.1.5 released, 0.1.6 opened for further work.
4253
4262
4254 * Changed magic_env to *return* the environment as a dict (not to
4263 * Changed magic_env to *return* the environment as a dict (not to
4255 print it). This way it prints, but it can also be processed.
4264 print it). This way it prints, but it can also be processed.
4256
4265
4257 * Added Verbose exception reporting to interactive
4266 * Added Verbose exception reporting to interactive
4258 exceptions. Very nice, now even 1/0 at the prompt gives a verbose
4267 exceptions. Very nice, now even 1/0 at the prompt gives a verbose
4259 traceback. Had to make some changes to the ultraTB file. This is
4268 traceback. Had to make some changes to the ultraTB file. This is
4260 probably the last 'big' thing in my mental todo list. This ties
4269 probably the last 'big' thing in my mental todo list. This ties
4261 in with the next entry:
4270 in with the next entry:
4262
4271
4263 * Changed -Xi and -Xf to a single -xmode option. Now all the user
4272 * Changed -Xi and -Xf to a single -xmode option. Now all the user
4264 has to specify is Plain, Color or Verbose for all exception
4273 has to specify is Plain, Color or Verbose for all exception
4265 handling.
4274 handling.
4266
4275
4267 * Removed ShellServices option. All this can really be done via
4276 * Removed ShellServices option. All this can really be done via
4268 the magic system. It's easier to extend, cleaner and has automatic
4277 the magic system. It's easier to extend, cleaner and has automatic
4269 namespace protection and documentation.
4278 namespace protection and documentation.
4270
4279
4271 2001-11-09 Fernando Perez <fperez@colorado.edu>
4280 2001-11-09 Fernando Perez <fperez@colorado.edu>
4272
4281
4273 * Fixed bug in output cache flushing (missing parameter to
4282 * Fixed bug in output cache flushing (missing parameter to
4274 __init__). Other small bugs fixed (found using pychecker).
4283 __init__). Other small bugs fixed (found using pychecker).
4275
4284
4276 * Version 0.1.4 opened for bugfixing.
4285 * Version 0.1.4 opened for bugfixing.
4277
4286
4278 2001-11-07 Fernando Perez <fperez@colorado.edu>
4287 2001-11-07 Fernando Perez <fperez@colorado.edu>
4279
4288
4280 * Version 0.1.3 released, mainly because of the raw_input bug.
4289 * Version 0.1.3 released, mainly because of the raw_input bug.
4281
4290
4282 * Fixed NASTY bug in raw_input: input line wasn't properly parsed
4291 * Fixed NASTY bug in raw_input: input line wasn't properly parsed
4283 and when testing for whether things were callable, a call could
4292 and when testing for whether things were callable, a call could
4284 actually be made to certain functions. They would get called again
4293 actually be made to certain functions. They would get called again
4285 once 'really' executed, with a resulting double call. A disaster
4294 once 'really' executed, with a resulting double call. A disaster
4286 in many cases (list.reverse() would never work!).
4295 in many cases (list.reverse() would never work!).
4287
4296
4288 * Removed prefilter() function, moved its code to raw_input (which
4297 * Removed prefilter() function, moved its code to raw_input (which
4289 after all was just a near-empty caller for prefilter). This saves
4298 after all was just a near-empty caller for prefilter). This saves
4290 a function call on every prompt, and simplifies the class a tiny bit.
4299 a function call on every prompt, and simplifies the class a tiny bit.
4291
4300
4292 * Fix _ip to __ip name in magic example file.
4301 * Fix _ip to __ip name in magic example file.
4293
4302
4294 * Changed 'tar -x -f' to 'tar xvf' in auto-installer. This should
4303 * Changed 'tar -x -f' to 'tar xvf' in auto-installer. This should
4295 work with non-gnu versions of tar.
4304 work with non-gnu versions of tar.
4296
4305
4297 2001-11-06 Fernando Perez <fperez@colorado.edu>
4306 2001-11-06 Fernando Perez <fperez@colorado.edu>
4298
4307
4299 * Version 0.1.2. Just to keep track of the recent changes.
4308 * Version 0.1.2. Just to keep track of the recent changes.
4300
4309
4301 * Fixed nasty bug in output prompt routine. It used to check 'if
4310 * Fixed nasty bug in output prompt routine. It used to check 'if
4302 arg != None...'. Problem is, this fails if arg implements a
4311 arg != None...'. Problem is, this fails if arg implements a
4303 special comparison (__cmp__) which disallows comparing to
4312 special comparison (__cmp__) which disallows comparing to
4304 None. Found it when trying to use the PhysicalQuantity module from
4313 None. Found it when trying to use the PhysicalQuantity module from
4305 ScientificPython.
4314 ScientificPython.
4306
4315
4307 2001-11-05 Fernando Perez <fperez@colorado.edu>
4316 2001-11-05 Fernando Perez <fperez@colorado.edu>
4308
4317
4309 * Also added dirs. Now the pushd/popd/dirs family functions
4318 * Also added dirs. Now the pushd/popd/dirs family functions
4310 basically like the shell, with the added convenience of going home
4319 basically like the shell, with the added convenience of going home
4311 when called with no args.
4320 when called with no args.
4312
4321
4313 * pushd/popd slightly modified to mimic shell behavior more
4322 * pushd/popd slightly modified to mimic shell behavior more
4314 closely.
4323 closely.
4315
4324
4316 * Added env,pushd,popd from ShellServices as magic functions. I
4325 * Added env,pushd,popd from ShellServices as magic functions. I
4317 think the cleanest will be to port all desired functions from
4326 think the cleanest will be to port all desired functions from
4318 ShellServices as magics and remove ShellServices altogether. This
4327 ShellServices as magics and remove ShellServices altogether. This
4319 will provide a single, clean way of adding functionality
4328 will provide a single, clean way of adding functionality
4320 (shell-type or otherwise) to IP.
4329 (shell-type or otherwise) to IP.
4321
4330
4322 2001-11-04 Fernando Perez <fperez@colorado.edu>
4331 2001-11-04 Fernando Perez <fperez@colorado.edu>
4323
4332
4324 * Added .ipython/ directory to sys.path. This way users can keep
4333 * Added .ipython/ directory to sys.path. This way users can keep
4325 customizations there and access them via import.
4334 customizations there and access them via import.
4326
4335
4327 2001-11-03 Fernando Perez <fperez@colorado.edu>
4336 2001-11-03 Fernando Perez <fperez@colorado.edu>
4328
4337
4329 * Opened version 0.1.1 for new changes.
4338 * Opened version 0.1.1 for new changes.
4330
4339
4331 * Changed version number to 0.1.0: first 'public' release, sent to
4340 * Changed version number to 0.1.0: first 'public' release, sent to
4332 Nathan and Janko.
4341 Nathan and Janko.
4333
4342
4334 * Lots of small fixes and tweaks.
4343 * Lots of small fixes and tweaks.
4335
4344
4336 * Minor changes to whos format. Now strings are shown, snipped if
4345 * Minor changes to whos format. Now strings are shown, snipped if
4337 too long.
4346 too long.
4338
4347
4339 * Changed ShellServices to work on __main__ so they show up in @who
4348 * Changed ShellServices to work on __main__ so they show up in @who
4340
4349
4341 * Help also works with ? at the end of a line:
4350 * Help also works with ? at the end of a line:
4342 ?sin and sin?
4351 ?sin and sin?
4343 both produce the same effect. This is nice, as often I use the
4352 both produce the same effect. This is nice, as often I use the
4344 tab-complete to find the name of a method, but I used to then have
4353 tab-complete to find the name of a method, but I used to then have
4345 to go to the beginning of the line to put a ? if I wanted more
4354 to go to the beginning of the line to put a ? if I wanted more
4346 info. Now I can just add the ? and hit return. Convenient.
4355 info. Now I can just add the ? and hit return. Convenient.
4347
4356
4348 2001-11-02 Fernando Perez <fperez@colorado.edu>
4357 2001-11-02 Fernando Perez <fperez@colorado.edu>
4349
4358
4350 * Python version check (>=2.1) added.
4359 * Python version check (>=2.1) added.
4351
4360
4352 * Added LazyPython documentation. At this point the docs are quite
4361 * Added LazyPython documentation. At this point the docs are quite
4353 a mess. A cleanup is in order.
4362 a mess. A cleanup is in order.
4354
4363
4355 * Auto-installer created. For some bizarre reason, the zipfiles
4364 * Auto-installer created. For some bizarre reason, the zipfiles
4356 module isn't working on my system. So I made a tar version
4365 module isn't working on my system. So I made a tar version
4357 (hopefully the command line options in various systems won't kill
4366 (hopefully the command line options in various systems won't kill
4358 me).
4367 me).
4359
4368
4360 * Fixes to Struct in genutils. Now all dictionary-like methods are
4369 * Fixes to Struct in genutils. Now all dictionary-like methods are
4361 protected (reasonably).
4370 protected (reasonably).
4362
4371
4363 * Added pager function to genutils and changed ? to print usage
4372 * Added pager function to genutils and changed ? to print usage
4364 note through it (it was too long).
4373 note through it (it was too long).
4365
4374
4366 * Added the LazyPython functionality. Works great! I changed the
4375 * Added the LazyPython functionality. Works great! I changed the
4367 auto-quote escape to ';', it's on home row and next to '. But
4376 auto-quote escape to ';', it's on home row and next to '. But
4368 both auto-quote and auto-paren (still /) escapes are command-line
4377 both auto-quote and auto-paren (still /) escapes are command-line
4369 parameters.
4378 parameters.
4370
4379
4371
4380
4372 2001-11-01 Fernando Perez <fperez@colorado.edu>
4381 2001-11-01 Fernando Perez <fperez@colorado.edu>
4373
4382
4374 * Version changed to 0.0.7. Fairly large change: configuration now
4383 * Version changed to 0.0.7. Fairly large change: configuration now
4375 is all stored in a directory, by default .ipython. There, all
4384 is all stored in a directory, by default .ipython. There, all
4376 config files have normal looking names (not .names)
4385 config files have normal looking names (not .names)
4377
4386
4378 * Version 0.0.6 Released first to Lucas and Archie as a test
4387 * Version 0.0.6 Released first to Lucas and Archie as a test
4379 run. Since it's the first 'semi-public' release, change version to
4388 run. Since it's the first 'semi-public' release, change version to
4380 > 0.0.6 for any changes now.
4389 > 0.0.6 for any changes now.
4381
4390
4382 * Stuff I had put in the ipplib.py changelog:
4391 * Stuff I had put in the ipplib.py changelog:
4383
4392
4384 Changes to InteractiveShell:
4393 Changes to InteractiveShell:
4385
4394
4386 - Made the usage message a parameter.
4395 - Made the usage message a parameter.
4387
4396
4388 - Require the name of the shell variable to be given. It's a bit
4397 - Require the name of the shell variable to be given. It's a bit
4389 of a hack, but allows the name 'shell' not to be hardwire in the
4398 of a hack, but allows the name 'shell' not to be hardwire in the
4390 magic (@) handler, which is problematic b/c it requires
4399 magic (@) handler, which is problematic b/c it requires
4391 polluting the global namespace with 'shell'. This in turn is
4400 polluting the global namespace with 'shell'. This in turn is
4392 fragile: if a user redefines a variable called shell, things
4401 fragile: if a user redefines a variable called shell, things
4393 break.
4402 break.
4394
4403
4395 - magic @: all functions available through @ need to be defined
4404 - magic @: all functions available through @ need to be defined
4396 as magic_<name>, even though they can be called simply as
4405 as magic_<name>, even though they can be called simply as
4397 @<name>. This allows the special command @magic to gather
4406 @<name>. This allows the special command @magic to gather
4398 information automatically about all existing magic functions,
4407 information automatically about all existing magic functions,
4399 even if they are run-time user extensions, by parsing the shell
4408 even if they are run-time user extensions, by parsing the shell
4400 instance __dict__ looking for special magic_ names.
4409 instance __dict__ looking for special magic_ names.
4401
4410
4402 - mainloop: added *two* local namespace parameters. This allows
4411 - mainloop: added *two* local namespace parameters. This allows
4403 the class to differentiate between parameters which were there
4412 the class to differentiate between parameters which were there
4404 before and after command line initialization was processed. This
4413 before and after command line initialization was processed. This
4405 way, later @who can show things loaded at startup by the
4414 way, later @who can show things loaded at startup by the
4406 user. This trick was necessary to make session saving/reloading
4415 user. This trick was necessary to make session saving/reloading
4407 really work: ideally after saving/exiting/reloading a session,
4416 really work: ideally after saving/exiting/reloading a session,
4408 *everythin* should look the same, including the output of @who. I
4417 *everythin* should look the same, including the output of @who. I
4409 was only able to make this work with this double namespace
4418 was only able to make this work with this double namespace
4410 trick.
4419 trick.
4411
4420
4412 - added a header to the logfile which allows (almost) full
4421 - added a header to the logfile which allows (almost) full
4413 session restoring.
4422 session restoring.
4414
4423
4415 - prepend lines beginning with @ or !, with a and log
4424 - prepend lines beginning with @ or !, with a and log
4416 them. Why? !lines: may be useful to know what you did @lines:
4425 them. Why? !lines: may be useful to know what you did @lines:
4417 they may affect session state. So when restoring a session, at
4426 they may affect session state. So when restoring a session, at
4418 least inform the user of their presence. I couldn't quite get
4427 least inform the user of their presence. I couldn't quite get
4419 them to properly re-execute, but at least the user is warned.
4428 them to properly re-execute, but at least the user is warned.
4420
4429
4421 * Started ChangeLog.
4430 * Started ChangeLog.
@@ -1,9056 +1,9065 b''
1 #LyX 1.3 created this file. For more info see http://www.lyx.org/
1 #LyX 1.3 created this file. For more info see http://www.lyx.org/
2 \lyxformat 221
2 \lyxformat 221
3 \textclass article
3 \textclass article
4 \begin_preamble
4 \begin_preamble
5 %\usepackage{ae,aecompl}
5 %\usepackage{ae,aecompl}
6 \usepackage{color}
6 \usepackage{color}
7
7
8 % A few colors to replace the defaults for certain link types
8 % A few colors to replace the defaults for certain link types
9 \definecolor{orange}{cmyk}{0,0.4,0.8,0.2}
9 \definecolor{orange}{cmyk}{0,0.4,0.8,0.2}
10 \definecolor{darkorange}{rgb}{.71,0.21,0.01}
10 \definecolor{darkorange}{rgb}{.71,0.21,0.01}
11 \definecolor{darkred}{rgb}{.52,0.08,0.01}
11 \definecolor{darkred}{rgb}{.52,0.08,0.01}
12 \definecolor{darkgreen}{rgb}{.12,.54,.11}
12 \definecolor{darkgreen}{rgb}{.12,.54,.11}
13
13
14 % Use and configure listings package for nicely formatted code
14 % Use and configure listings package for nicely formatted code
15 \usepackage{listings}
15 \usepackage{listings}
16 \lstset{
16 \lstset{
17 language=Python,
17 language=Python,
18 basicstyle=\small\ttfamily,
18 basicstyle=\small\ttfamily,
19 commentstyle=\ttfamily\color{blue},
19 commentstyle=\ttfamily\color{blue},
20 stringstyle=\ttfamily\color{darkorange},
20 stringstyle=\ttfamily\color{darkorange},
21 showstringspaces=false,
21 showstringspaces=false,
22 breaklines=true,
22 breaklines=true,
23 postbreak = \space\dots
23 postbreak = \space\dots
24 }
24 }
25
25
26 \usepackage[%pdftex, % needed for pdflatex
26 \usepackage[%pdftex, % needed for pdflatex
27 breaklinks=true, % so long urls are correctly broken across lines
27 breaklinks=true, % so long urls are correctly broken across lines
28 colorlinks=true,
28 colorlinks=true,
29 urlcolor=blue,
29 urlcolor=blue,
30 linkcolor=darkred,
30 linkcolor=darkred,
31 citecolor=darkgreen,
31 citecolor=darkgreen,
32 ]{hyperref}
32 ]{hyperref}
33
33
34 \usepackage{html}
34 \usepackage{html}
35
35
36 % This helps prevent overly long lines that stretch beyond the margins
36 % This helps prevent overly long lines that stretch beyond the margins
37 \sloppy
37 \sloppy
38
38
39 % Define a \codelist command which either uses listings for latex, or
39 % Define a \codelist command which either uses listings for latex, or
40 % plain verbatim for html (since latex2html doesn't understand the
40 % plain verbatim for html (since latex2html doesn't understand the
41 % listings package).
41 % listings package).
42 \usepackage{verbatim}
42 \usepackage{verbatim}
43 \newcommand{\codelist}[1] {
43 \newcommand{\codelist}[1] {
44 \latex{\lstinputlisting{#1}}
44 \latex{\lstinputlisting{#1}}
45 \html{\verbatiminput{#1}}
45 \html{\verbatiminput{#1}}
46 }
46 }
47 \end_preamble
47 \end_preamble
48 \language english
48 \language english
49 \inputencoding latin1
49 \inputencoding latin1
50 \fontscheme palatino
50 \fontscheme palatino
51 \graphics default
51 \graphics default
52 \paperfontsize 10
52 \paperfontsize 10
53 \spacing single
53 \spacing single
54 \papersize Default
54 \papersize Default
55 \paperpackage a4
55 \paperpackage a4
56 \use_geometry 1
56 \use_geometry 1
57 \use_amsmath 0
57 \use_amsmath 0
58 \use_natbib 0
58 \use_natbib 0
59 \use_numerical_citations 0
59 \use_numerical_citations 0
60 \paperorientation portrait
60 \paperorientation portrait
61 \leftmargin 1.1in
61 \leftmargin 1.1in
62 \topmargin 1in
62 \topmargin 1in
63 \rightmargin 1.1in
63 \rightmargin 1.1in
64 \bottommargin 1in
64 \bottommargin 1in
65 \secnumdepth 3
65 \secnumdepth 3
66 \tocdepth 3
66 \tocdepth 3
67 \paragraph_separation skip
67 \paragraph_separation skip
68 \defskip medskip
68 \defskip medskip
69 \quotes_language english
69 \quotes_language english
70 \quotes_times 2
70 \quotes_times 2
71 \papercolumns 1
71 \papercolumns 1
72 \papersides 1
72 \papersides 1
73 \paperpagestyle fancy
73 \paperpagestyle fancy
74
74
75 \layout Title
75 \layout Title
76
76
77 IPython
77 IPython
78 \newline
78 \newline
79
79
80 \size larger
80 \size larger
81 An enhanced Interactive Python
81 An enhanced Interactive Python
82 \size large
82 \size large
83
83
84 \newline
84 \newline
85 User Manual, v.
85 User Manual, v.
86 __version__
86 __version__
87 \layout Author
87 \layout Author
88
88
89 Fernando P�rez
89 Fernando P�rez
90 \layout Standard
90 \layout Standard
91
91
92
92
93 \begin_inset ERT
93 \begin_inset ERT
94 status Collapsed
94 status Collapsed
95
95
96 \layout Standard
96 \layout Standard
97
97
98 \backslash
98 \backslash
99 latex{
99 latex{
100 \end_inset
100 \end_inset
101
101
102
102
103 \begin_inset LatexCommand \tableofcontents{}
103 \begin_inset LatexCommand \tableofcontents{}
104
104
105 \end_inset
105 \end_inset
106
106
107
107
108 \begin_inset ERT
108 \begin_inset ERT
109 status Collapsed
109 status Collapsed
110
110
111 \layout Standard
111 \layout Standard
112 }
112 }
113 \end_inset
113 \end_inset
114
114
115
115
116 \layout Standard
116 \layout Standard
117
117
118
118
119 \begin_inset ERT
119 \begin_inset ERT
120 status Open
120 status Open
121
121
122 \layout Standard
122 \layout Standard
123
123
124 \backslash
124 \backslash
125 html{
125 html{
126 \backslash
126 \backslash
127 bodytext{bgcolor=#ffffff}}
127 bodytext{bgcolor=#ffffff}}
128 \end_inset
128 \end_inset
129
129
130
130
131 \layout Section
131 \layout Section
132 \pagebreak_top
132 \pagebreak_top
133 Overview
133 Overview
134 \layout Standard
134 \layout Standard
135
135
136 One of Python's most useful features is its interactive interpreter.
136 One of Python's most useful features is its interactive interpreter.
137 This system allows very fast testing of ideas without the overhead of creating
137 This system allows very fast testing of ideas without the overhead of creating
138 test files as is typical in most programming languages.
138 test files as is typical in most programming languages.
139 However, the interpreter supplied with the standard Python distribution
139 However, the interpreter supplied with the standard Python distribution
140 is somewhat limited for extended interactive use.
140 is somewhat limited for extended interactive use.
141 \layout Standard
141 \layout Standard
142
142
143 IPython is a free software project (released under the BSD license) which
143 IPython is a free software project (released under the BSD license) which
144 tries to:
144 tries to:
145 \layout Enumerate
145 \layout Enumerate
146
146
147 Provide an interactive shell superior to Python's default.
147 Provide an interactive shell superior to Python's default.
148 IPython has many features for object introspection, system shell access,
148 IPython has many features for object introspection, system shell access,
149 and its own special command system for adding functionality when working
149 and its own special command system for adding functionality when working
150 interactively.
150 interactively.
151 It tries to be a very efficient environment both for Python code development
151 It tries to be a very efficient environment both for Python code development
152 and for exploration of problems using Python objects (in situations like
152 and for exploration of problems using Python objects (in situations like
153 data analysis).
153 data analysis).
154 \layout Enumerate
154 \layout Enumerate
155
155
156 Serve as an embeddable, ready to use interpreter for your own programs.
156 Serve as an embeddable, ready to use interpreter for your own programs.
157 IPython can be started with a single call from inside another program,
157 IPython can be started with a single call from inside another program,
158 providing access to the current namespace.
158 providing access to the current namespace.
159 This can be very useful both for debugging purposes and for situations
159 This can be very useful both for debugging purposes and for situations
160 where a blend of batch-processing and interactive exploration are needed.
160 where a blend of batch-processing and interactive exploration are needed.
161 \layout Enumerate
161 \layout Enumerate
162
162
163 Offer a flexible framework which can be used as the base environment for
163 Offer a flexible framework which can be used as the base environment for
164 other systems with Python as the underlying language.
164 other systems with Python as the underlying language.
165 Specifically scientific environments like Mathematica, IDL and Matlab inspired
165 Specifically scientific environments like Mathematica, IDL and Matlab inspired
166 its design, but similar ideas can be useful in many fields.
166 its design, but similar ideas can be useful in many fields.
167 \layout Subsection
167 \layout Subsection
168
168
169 Main features
169 Main features
170 \layout Itemize
170 \layout Itemize
171
171
172 Dynamic object introspection.
172 Dynamic object introspection.
173 One can access docstrings, function definition prototypes, source code,
173 One can access docstrings, function definition prototypes, source code,
174 source files and other details of any object accessible to the interpreter
174 source files and other details of any object accessible to the interpreter
175 with a single keystroke (`
175 with a single keystroke (`
176 \family typewriter
176 \family typewriter
177 ?
177 ?
178 \family default
178 \family default
179 ').
179 ').
180 \layout Itemize
180 \layout Itemize
181
181
182 Completion in the local namespace, by typing TAB at the prompt.
182 Completion in the local namespace, by typing TAB at the prompt.
183 This works for keywords, methods, variables and files in the current directory.
183 This works for keywords, methods, variables and files in the current directory.
184 This is supported via the readline library, and full access to configuring
184 This is supported via the readline library, and full access to configuring
185 readline's behavior is provided.
185 readline's behavior is provided.
186 \layout Itemize
186 \layout Itemize
187
187
188 Numbered input/output prompts with command history (persistent across sessions
188 Numbered input/output prompts with command history (persistent across sessions
189 and tied to each profile), full searching in this history and caching of
189 and tied to each profile), full searching in this history and caching of
190 all input and output.
190 all input and output.
191 \layout Itemize
191 \layout Itemize
192
192
193 User-extensible `magic' commands.
193 User-extensible `magic' commands.
194 A set of commands prefixed with
194 A set of commands prefixed with
195 \family typewriter
195 \family typewriter
196 %
196 %
197 \family default
197 \family default
198 is available for controlling IPython itself and provides directory control,
198 is available for controlling IPython itself and provides directory control,
199 namespace information and many aliases to common system shell commands.
199 namespace information and many aliases to common system shell commands.
200 \layout Itemize
200 \layout Itemize
201
201
202 Alias facility for defining your own system aliases.
202 Alias facility for defining your own system aliases.
203 \layout Itemize
203 \layout Itemize
204
204
205 Complete system shell access.
205 Complete system shell access.
206 Lines starting with ! are passed directly to the system shell, and using
206 Lines starting with ! are passed directly to the system shell, and using
207 !! captures shell output into python variables for further use.
207 !! captures shell output into python variables for further use.
208 \layout Itemize
208 \layout Itemize
209
209
210 All calls to the system (via aliases or via !) have their standard output/error
210 All calls to the system (via aliases or via !) have their standard output/error
211 automatically stored as strings, and also available as lists.
211 automatically stored as strings, and also available as lists.
212 \layout Itemize
212 \layout Itemize
213
213
214 Background execution of Python commands in a separate thread.
214 Background execution of Python commands in a separate thread.
215 IPython has an internal job manager called
215 IPython has an internal job manager called
216 \family typewriter
216 \family typewriter
217 jobs
217 jobs
218 \family default
218 \family default
219 , and a conveninence backgrounding magic function called
219 , and a conveninence backgrounding magic function called
220 \family typewriter
220 \family typewriter
221 %bg
221 %bg
222 \family default
222 \family default
223 .
223 .
224 \layout Itemize
224 \layout Itemize
225
225
226 The ability to expand python variables when calling the system shell.
226 The ability to expand python variables when calling the system shell.
227 In a shell command, any python variable prefixed with
227 In a shell command, any python variable prefixed with
228 \family typewriter
228 \family typewriter
229 $
229 $
230 \family default
230 \family default
231 is expanded.
231 is expanded.
232 A double
232 A double
233 \family typewriter
233 \family typewriter
234 $$
234 $$
235 \family default
235 \family default
236 allows passing a literal
236 allows passing a literal
237 \family typewriter
237 \family typewriter
238 $
238 $
239 \family default
239 \family default
240 to the shell (for access to shell and environment variables like
240 to the shell (for access to shell and environment variables like
241 \family typewriter
241 \family typewriter
242 $PATH
242 $PATH
243 \family default
243 \family default
244 ).
244 ).
245 \layout Itemize
245 \layout Itemize
246
246
247 Filesystem navigation, via a magic
247 Filesystem navigation, via a magic
248 \family typewriter
248 \family typewriter
249 %cd
249 %cd
250 \family default
250 \family default
251 command, along with a persistent bookmark system (using
251 command, along with a persistent bookmark system (using
252 \family typewriter
252 \family typewriter
253 %bookmark
253 %bookmark
254 \family default
254 \family default
255 ) for fast access to frequently visited directories.
255 ) for fast access to frequently visited directories.
256 \layout Itemize
256 \layout Itemize
257
257
258 Automatic indentation (optional) of code as you type (through the readline
258 Automatic indentation (optional) of code as you type (through the readline
259 library).
259 library).
260 \layout Itemize
260 \layout Itemize
261
261
262 Macro system for quickly re-executing multiple lines of previous input with
262 Macro system for quickly re-executing multiple lines of previous input with
263 a single name.
263 a single name.
264 \layout Itemize
264 \layout Itemize
265
265
266 Session logging (you can then later use these logs as code in your programs).
266 Session logging (you can then later use these logs as code in your programs).
267 \layout Itemize
267 \layout Itemize
268
268
269 Session restoring: logs can be replayed to restore a previous session to
269 Session restoring: logs can be replayed to restore a previous session to
270 the state where you left it.
270 the state where you left it.
271 \layout Itemize
271 \layout Itemize
272
272
273 Verbose and colored exception traceback printouts.
273 Verbose and colored exception traceback printouts.
274 Easier to parse visually, and in verbose mode they produce a lot of useful
274 Easier to parse visually, and in verbose mode they produce a lot of useful
275 debugging information (basically a terminal version of the cgitb module).
275 debugging information (basically a terminal version of the cgitb module).
276 \layout Itemize
276 \layout Itemize
277
277
278 Auto-parentheses: callable objects can be executed without parentheses:
278 Auto-parentheses: callable objects can be executed without parentheses:
279
279
280 \family typewriter
280 \family typewriter
281 `sin 3'
281 `sin 3'
282 \family default
282 \family default
283 is automatically converted to
283 is automatically converted to
284 \family typewriter
284 \family typewriter
285 `sin(3)
285 `sin(3)
286 \family default
286 \family default
287 '.
287 '.
288 \layout Itemize
288 \layout Itemize
289
289
290 Auto-quoting: using `
290 Auto-quoting: using `
291 \family typewriter
291 \family typewriter
292 ,
292 ,
293 \family default
293 \family default
294 ' or `
294 ' or `
295 \family typewriter
295 \family typewriter
296 ;
296 ;
297 \family default
297 \family default
298 ' as the first character forces auto-quoting of the rest of the line:
298 ' as the first character forces auto-quoting of the rest of the line:
299 \family typewriter
299 \family typewriter
300 `,my_function a\SpecialChar ~
300 `,my_function a\SpecialChar ~
301 b'
301 b'
302 \family default
302 \family default
303 becomes automatically
303 becomes automatically
304 \family typewriter
304 \family typewriter
305 `my_function("a","b")'
305 `my_function("a","b")'
306 \family default
306 \family default
307 , while
307 , while
308 \family typewriter
308 \family typewriter
309 `;my_function a\SpecialChar ~
309 `;my_function a\SpecialChar ~
310 b'
310 b'
311 \family default
311 \family default
312 becomes
312 becomes
313 \family typewriter
313 \family typewriter
314 `my_function("a b")'
314 `my_function("a b")'
315 \family default
315 \family default
316 .
316 .
317 \layout Itemize
317 \layout Itemize
318
318
319 Extensible input syntax.
319 Extensible input syntax.
320 You can define filters that pre-process user input to simplify input in
320 You can define filters that pre-process user input to simplify input in
321 special situations.
321 special situations.
322 This allows for example pasting multi-line code fragments which start with
322 This allows for example pasting multi-line code fragments which start with
323
323
324 \family typewriter
324 \family typewriter
325 `>>>'
325 `>>>'
326 \family default
326 \family default
327 or
327 or
328 \family typewriter
328 \family typewriter
329 `...'
329 `...'
330 \family default
330 \family default
331 such as those from other python sessions or the standard Python documentation.
331 such as those from other python sessions or the standard Python documentation.
332 \layout Itemize
332 \layout Itemize
333
333
334 Flexible configuration system.
334 Flexible configuration system.
335 It uses a configuration file which allows permanent setting of all command-line
335 It uses a configuration file which allows permanent setting of all command-line
336 options, module loading, code and file execution.
336 options, module loading, code and file execution.
337 The system allows recursive file inclusion, so you can have a base file
337 The system allows recursive file inclusion, so you can have a base file
338 with defaults and layers which load other customizations for particular
338 with defaults and layers which load other customizations for particular
339 projects.
339 projects.
340 \layout Itemize
340 \layout Itemize
341
341
342 Embeddable.
342 Embeddable.
343 You can call IPython as a python shell inside your own python programs.
343 You can call IPython as a python shell inside your own python programs.
344 This can be used both for debugging code or for providing interactive abilities
344 This can be used both for debugging code or for providing interactive abilities
345 to your programs with knowledge about the local namespaces (very useful
345 to your programs with knowledge about the local namespaces (very useful
346 in debugging and data analysis situations).
346 in debugging and data analysis situations).
347 \layout Itemize
347 \layout Itemize
348
348
349 Easy debugger access.
349 Easy debugger access.
350 You can set IPython to call up the Python debugger (pdb) every time there
350 You can set IPython to call up the Python debugger (pdb) every time there
351 is an uncaught exception.
351 is an uncaught exception.
352 This drops you inside the code which triggered the exception with all the
352 This drops you inside the code which triggered the exception with all the
353 data live and it is possible to navigate the stack to rapidly isolate the
353 data live and it is possible to navigate the stack to rapidly isolate the
354 source of a bug.
354 source of a bug.
355 The
355 The
356 \family typewriter
356 \family typewriter
357 %run
357 %run
358 \family default
358 \family default
359 magic command --with the
359 magic command --with the
360 \family typewriter
360 \family typewriter
361 -d
361 -d
362 \family default
362 \family default
363 option-- can run any script under
363 option-- can run any script under
364 \family typewriter
364 \family typewriter
365 pdb
365 pdb
366 \family default
366 \family default
367 's control, automatically setting initial breakpoints for you.
367 's control, automatically setting initial breakpoints for you.
368 \layout Itemize
368 \layout Itemize
369
369
370 Profiler support.
370 Profiler support.
371 You can run single statements (similar to
371 You can run single statements (similar to
372 \family typewriter
372 \family typewriter
373 profile.run()
373 profile.run()
374 \family default
374 \family default
375 ) or complete programs under the profiler's control.
375 ) or complete programs under the profiler's control.
376 While this is possible with the standard
376 While this is possible with the standard
377 \family typewriter
377 \family typewriter
378 profile
378 profile
379 \family default
379 \family default
380 module, IPython wraps this functionality with magic commands (see
380 module, IPython wraps this functionality with magic commands (see
381 \family typewriter
381 \family typewriter
382 `%prun'
382 `%prun'
383 \family default
383 \family default
384 and
384 and
385 \family typewriter
385 \family typewriter
386 `%run -p
386 `%run -p
387 \family default
387 \family default
388 ') convenient for rapid interactive work.
388 ') convenient for rapid interactive work.
389 \layout Subsection
389 \layout Subsection
390
390
391 Portability and Python requirements
391 Portability and Python requirements
392 \layout Standard
392 \layout Standard
393
393
394
394
395 \series bold
395 \series bold
396 Python requirements:
396 Python requirements:
397 \series default
397 \series default
398 IPython works with Python version 2.2 or newer.
398 IPython works with Python version 2.2 or newer.
399 It has been tested with Python 2.4 and no problems have been reported.
399 It has been tested with Python 2.4 and no problems have been reported.
400 Support for Python 2.1 hasn't been recently tested, since I don't have access
400 Support for Python 2.1 hasn't been recently tested, since I don't have access
401 to it on any of my systems.
401 to it on any of my systems.
402 But I suspect there may be some problems with Python 2.1, because some of
402 But I suspect there may be some problems with Python 2.1, because some of
403 the newer code may use 2.2 features.
403 the newer code may use 2.2 features.
404 \layout Standard
404 \layout Standard
405
405
406 IPython is developed under
406 IPython is developed under
407 \series bold
407 \series bold
408 Linux
408 Linux
409 \series default
409 \series default
410 , but it should work in any reasonable Unix-type system (tested OK under
410 , but it should work in any reasonable Unix-type system (tested OK under
411 Solaris and the *BSD family, for which a port exists thanks to Dryice Liu).
411 Solaris and the *BSD family, for which a port exists thanks to Dryice Liu).
412 \layout Standard
412 \layout Standard
413
413
414
414
415 \series bold
415 \series bold
416 Mac OS X
416 Mac OS X
417 \series default
417 \series default
418 : it works, apparently without any problems (thanks to Jim Boyle at Lawrence
418 : it works, apparently without any problems (thanks to Jim Boyle at Lawrence
419 Livermore for the information).
419 Livermore for the information).
420 Thanks to Andrea Riciputi, Fink support is available.
420 Thanks to Andrea Riciputi, Fink support is available.
421 \layout Standard
421 \layout Standard
422
422
423
423
424 \series bold
424 \series bold
425 CygWin
425 CygWin
426 \series default
426 \series default
427 : it works mostly OK, though some users have reported problems with prompt
427 : it works mostly OK, though some users have reported problems with prompt
428 coloring.
428 coloring.
429 No satisfactory solution to this has been found so far, you may want to
429 No satisfactory solution to this has been found so far, you may want to
430 disable colors permanently in the
430 disable colors permanently in the
431 \family typewriter
431 \family typewriter
432 ipythonrc
432 ipythonrc
433 \family default
433 \family default
434 configuration file if you experience problems.
434 configuration file if you experience problems.
435 If you have proper color support under cygwin, please post to the IPython
435 If you have proper color support under cygwin, please post to the IPython
436 mailing list so this issue can be resolved for all users.
436 mailing list so this issue can be resolved for all users.
437 \layout Standard
437 \layout Standard
438
438
439
439
440 \series bold
440 \series bold
441 Windows
441 Windows
442 \series default
442 \series default
443 : it works well under Windows XP/2k, and I suspect NT should behave similarly.
443 : it works well under Windows XP/2k, and I suspect NT should behave similarly.
444 Section\SpecialChar ~
444 Section\SpecialChar ~
445
445
446 \begin_inset LatexCommand \ref{sub:Under-Windows}
446 \begin_inset LatexCommand \ref{sub:Under-Windows}
447
447
448 \end_inset
448 \end_inset
449
449
450 describes installation details for Windows, including some additional tools
450 describes installation details for Windows, including some additional tools
451 needed on this platform.
451 needed on this platform.
452 \layout Standard
452 \layout Standard
453
453
454 Windows 9x support is present, and has been reported to work fine (at least
454 Windows 9x support is present, and has been reported to work fine (at least
455 on WinME).
455 on WinME).
456 \layout Standard
456 \layout Standard
457
457
458 Please note, however, that I have very little access to and experience with
458 Please note, however, that I have very little access to and experience with
459 Windows development.
459 Windows development.
460 For this reason, Windows-specific bugs tend to linger far longer than I
460 For this reason, Windows-specific bugs tend to linger far longer than I
461 would like, and often I just can't find a satisfactory solution.
461 would like, and often I just can't find a satisfactory solution.
462 If any Windows user wants to join in with development help, all hands are
462 If any Windows user wants to join in with development help, all hands are
463 always welcome.
463 always welcome.
464 \layout Subsection
464 \layout Subsection
465
465
466 Location
466 Location
467 \layout Standard
467 \layout Standard
468
468
469 IPython is generously hosted at
469 IPython is generously hosted at
470 \begin_inset LatexCommand \htmlurl{http://ipython.scipy.org}
470 \begin_inset LatexCommand \htmlurl{http://ipython.scipy.org}
471
471
472 \end_inset
472 \end_inset
473
473
474 by the SciPy project.
474 by the SciPy project.
475 This site offers downloads, subversion access, mailing lists and a bug
475 This site offers downloads, subversion access, mailing lists and a bug
476 tracking system.
476 tracking system.
477 I am very grateful to Enthought (
477 I am very grateful to Enthought (
478 \begin_inset LatexCommand \htmlurl{http://www.enthought.com}
478 \begin_inset LatexCommand \htmlurl{http://www.enthought.com}
479
479
480 \end_inset
480 \end_inset
481
481
482 ) and all of the SciPy team for their contribution.
482 ) and all of the SciPy team for their contribution.
483 \layout Section
483 \layout Section
484
484
485
485
486 \begin_inset LatexCommand \label{sec:install}
486 \begin_inset LatexCommand \label{sec:install}
487
487
488 \end_inset
488 \end_inset
489
489
490 Installation
490 Installation
491 \layout Subsection
491 \layout Subsection
492
492
493 Instant instructions
493 Instant instructions
494 \layout Standard
494 \layout Standard
495
495
496 If you are of the impatient kind, under Linux/Unix simply untar/unzip the
496 If you are of the impatient kind, under Linux/Unix simply untar/unzip the
497 download, then install with
497 download, then install with
498 \family typewriter
498 \family typewriter
499 `python setup.py install'
499 `python setup.py install'
500 \family default
500 \family default
501 .
501 .
502 Under Windows, double-click on the provided
502 Under Windows, double-click on the provided
503 \family typewriter
503 \family typewriter
504 .exe
504 .exe
505 \family default
505 \family default
506 binary installer.
506 binary installer.
507 \layout Standard
507 \layout Standard
508
508
509 Then, take a look at Sections
509 Then, take a look at Sections
510 \begin_inset LatexCommand \ref{sec:good_config}
510 \begin_inset LatexCommand \ref{sec:good_config}
511
511
512 \end_inset
512 \end_inset
513
513
514 for configuring things optimally and
514 for configuring things optimally and
515 \begin_inset LatexCommand \ref{sec:quick_tips}
515 \begin_inset LatexCommand \ref{sec:quick_tips}
516
516
517 \end_inset
517 \end_inset
518
518
519 for quick tips on efficient use of IPython.
519 for quick tips on efficient use of IPython.
520 You can later refer to the rest of the manual for all the gory details.
520 You can later refer to the rest of the manual for all the gory details.
521 \layout Standard
521 \layout Standard
522
522
523 See the notes in sec.
523 See the notes in sec.
524
524
525 \begin_inset LatexCommand \ref{sec:upgrade}
525 \begin_inset LatexCommand \ref{sec:upgrade}
526
526
527 \end_inset
527 \end_inset
528
528
529 for upgrading IPython versions.
529 for upgrading IPython versions.
530 \layout Subsection
530 \layout Subsection
531
531
532 Detailed Unix instructions (Linux, Mac OS X, etc.)
532 Detailed Unix instructions (Linux, Mac OS X, etc.)
533 \layout Standard
533 \layout Standard
534
534
535 For RPM based systems, simply install the supplied package in the usual
535 For RPM based systems, simply install the supplied package in the usual
536 manner.
536 manner.
537 If you download the tar archive, the process is:
537 If you download the tar archive, the process is:
538 \layout Enumerate
538 \layout Enumerate
539
539
540 Unzip/untar the
540 Unzip/untar the
541 \family typewriter
541 \family typewriter
542 ipython-XXX.tar.gz
542 ipython-XXX.tar.gz
543 \family default
543 \family default
544 file wherever you want (
544 file wherever you want (
545 \family typewriter
545 \family typewriter
546 XXX
546 XXX
547 \family default
547 \family default
548 is the version number).
548 is the version number).
549 It will make a directory called
549 It will make a directory called
550 \family typewriter
550 \family typewriter
551 ipython-XXX.
551 ipython-XXX.
552
552
553 \family default
553 \family default
554 Change into that directory where you will find the files
554 Change into that directory where you will find the files
555 \family typewriter
555 \family typewriter
556 README
556 README
557 \family default
557 \family default
558 and
558 and
559 \family typewriter
559 \family typewriter
560 setup.py
560 setup.py
561 \family default
561 \family default
562 .
562 .
563
563
564 \family typewriter
564 \family typewriter
565 O
565 O
566 \family default
566 \family default
567 nce you've completed the installation, you can safely remove this directory.
567 nce you've completed the installation, you can safely remove this directory.
568
568
569 \layout Enumerate
569 \layout Enumerate
570
570
571 If you are installing over a previous installation of version 0.2.0 or earlier,
571 If you are installing over a previous installation of version 0.2.0 or earlier,
572 first remove your
572 first remove your
573 \family typewriter
573 \family typewriter
574 $HOME/.ipython
574 $HOME/.ipython
575 \family default
575 \family default
576 directory, since the configuration file format has changed somewhat (the
576 directory, since the configuration file format has changed somewhat (the
577 '=' were removed from all option specifications).
577 '=' were removed from all option specifications).
578 Or you can call ipython with the
578 Or you can call ipython with the
579 \family typewriter
579 \family typewriter
580 -upgrade
580 -upgrade
581 \family default
581 \family default
582 option and it will do this automatically for you.
582 option and it will do this automatically for you.
583 \layout Enumerate
583 \layout Enumerate
584
584
585 IPython uses distutils, so you can install it by simply typing at the system
585 IPython uses distutils, so you can install it by simply typing at the system
586 prompt (don't type the
586 prompt (don't type the
587 \family typewriter
587 \family typewriter
588 $
588 $
589 \family default
589 \family default
590 )
590 )
591 \newline
591 \newline
592
592
593 \family typewriter
593 \family typewriter
594 $ python setup.py install
594 $ python setup.py install
595 \family default
595 \family default
596
596
597 \newline
597 \newline
598 Note that this assumes you have root access to your machine.
598 Note that this assumes you have root access to your machine.
599 If you don't have root access or don't want IPython to go in the default
599 If you don't have root access or don't want IPython to go in the default
600 python directories, you'll need to use the
600 python directories, you'll need to use the
601 \begin_inset ERT
601 \begin_inset ERT
602 status Collapsed
602 status Collapsed
603
603
604 \layout Standard
604 \layout Standard
605
605
606 \backslash
606 \backslash
607 verb|--home|
607 verb|--home|
608 \end_inset
608 \end_inset
609
609
610 option (or
610 option (or
611 \begin_inset ERT
611 \begin_inset ERT
612 status Collapsed
612 status Collapsed
613
613
614 \layout Standard
614 \layout Standard
615
615
616 \backslash
616 \backslash
617 verb|--prefix|
617 verb|--prefix|
618 \end_inset
618 \end_inset
619
619
620 ).
620 ).
621 For example:
621 For example:
622 \newline
622 \newline
623
623
624 \begin_inset ERT
624 \begin_inset ERT
625 status Collapsed
625 status Collapsed
626
626
627 \layout Standard
627 \layout Standard
628
628
629 \backslash
629 \backslash
630 verb|$ python setup.py install --home $HOME/local|
630 verb|$ python setup.py install --home $HOME/local|
631 \end_inset
631 \end_inset
632
632
633
633
634 \newline
634 \newline
635 will install IPython into
635 will install IPython into
636 \family typewriter
636 \family typewriter
637 $HOME/local
637 $HOME/local
638 \family default
638 \family default
639 and its subdirectories (creating them if necessary).
639 and its subdirectories (creating them if necessary).
640 \newline
640 \newline
641 You can type
641 You can type
642 \newline
642 \newline
643
643
644 \begin_inset ERT
644 \begin_inset ERT
645 status Collapsed
645 status Collapsed
646
646
647 \layout Standard
647 \layout Standard
648
648
649 \backslash
649 \backslash
650 verb|$ python setup.py --help|
650 verb|$ python setup.py --help|
651 \end_inset
651 \end_inset
652
652
653
653
654 \newline
654 \newline
655 for more details.
655 for more details.
656 \newline
656 \newline
657 Note that if you change the default location for
657 Note that if you change the default location for
658 \begin_inset ERT
658 \begin_inset ERT
659 status Collapsed
659 status Collapsed
660
660
661 \layout Standard
661 \layout Standard
662
662
663 \backslash
663 \backslash
664 verb|--home|
664 verb|--home|
665 \end_inset
665 \end_inset
666
666
667 at installation, IPython may end up installed at a location which is not
667 at installation, IPython may end up installed at a location which is not
668 part of your
668 part of your
669 \family typewriter
669 \family typewriter
670 $PYTHONPATH
670 $PYTHONPATH
671 \family default
671 \family default
672 environment variable.
672 environment variable.
673 In this case, you'll need to configure this variable to include the actual
673 In this case, you'll need to configure this variable to include the actual
674 directory where the
674 directory where the
675 \family typewriter
675 \family typewriter
676 IPython/
676 IPython/
677 \family default
677 \family default
678 directory ended (typically the value you give to
678 directory ended (typically the value you give to
679 \begin_inset ERT
679 \begin_inset ERT
680 status Collapsed
680 status Collapsed
681
681
682 \layout Standard
682 \layout Standard
683
683
684 \backslash
684 \backslash
685 verb|--home|
685 verb|--home|
686 \end_inset
686 \end_inset
687
687
688 plus
688 plus
689 \family typewriter
689 \family typewriter
690 /lib/python
690 /lib/python
691 \family default
691 \family default
692 ).
692 ).
693 \layout Subsubsection
693 \layout Subsubsection
694
694
695 Mac OSX information
695 Mac OSX information
696 \layout Standard
696 \layout Standard
697
697
698 Under OSX, there is a choice you need to make.
698 Under OSX, there is a choice you need to make.
699 Apple ships its own build of Python, which lives in the core OSX filesystem
699 Apple ships its own build of Python, which lives in the core OSX filesystem
700 hierarchy.
700 hierarchy.
701 You can also manually install a separate Python, either purely by hand
701 You can also manually install a separate Python, either purely by hand
702 (typically in
702 (typically in
703 \family typewriter
703 \family typewriter
704 /usr/local
704 /usr/local
705 \family default
705 \family default
706 ) or by using Fink, which puts everything under
706 ) or by using Fink, which puts everything under
707 \family typewriter
707 \family typewriter
708 /sw
708 /sw
709 \family default
709 \family default
710 .
710 .
711 Which route to follow is a matter of personal preference, as I've seen
711 Which route to follow is a matter of personal preference, as I've seen
712 users who favor each of the approaches.
712 users who favor each of the approaches.
713 Here I will simply list the known installation issues under OSX, along
713 Here I will simply list the known installation issues under OSX, along
714 with their solutions.
714 with their solutions.
715 \layout Standard
715 \layout Standard
716
716
717 This page:
717 This page:
718 \begin_inset LatexCommand \htmlurl{http://geosci.uchicago.edu/~tobis/pylab.html}
718 \begin_inset LatexCommand \htmlurl{http://geosci.uchicago.edu/~tobis/pylab.html}
719
719
720 \end_inset
720 \end_inset
721
721
722 contains information on this topic, with additional details on how to make
722 contains information on this topic, with additional details on how to make
723 IPython and matplotlib play nicely under OSX.
723 IPython and matplotlib play nicely under OSX.
724 \layout Subsubsection*
724 \layout Subsubsection*
725
725
726 GUI problems
726 GUI problems
727 \layout Standard
727 \layout Standard
728
728
729 The following instructions apply to an install of IPython under OSX from
729 The following instructions apply to an install of IPython under OSX from
730 unpacking the
730 unpacking the
731 \family typewriter
731 \family typewriter
732 .tar.gz
732 .tar.gz
733 \family default
733 \family default
734 distribution and installing it for the default Python interpreter shipped
734 distribution and installing it for the default Python interpreter shipped
735 by Apple.
735 by Apple.
736 If you are using a fink install, fink will take care of these details for
736 If you are using a fink install, fink will take care of these details for
737 you, by installing IPython against fink's Python.
737 you, by installing IPython against fink's Python.
738 \layout Standard
738 \layout Standard
739
739
740 IPython offers various forms of support for interacting with graphical applicati
740 IPython offers various forms of support for interacting with graphical applicati
741 ons from the command line, from simple Tk apps (which are in principle always
741 ons from the command line, from simple Tk apps (which are in principle always
742 supported by Python) to interactive control of WX, Qt and GTK apps.
742 supported by Python) to interactive control of WX, Qt and GTK apps.
743 Under OSX, however, this requires that ipython is installed by calling
743 Under OSX, however, this requires that ipython is installed by calling
744 the special
744 the special
745 \family typewriter
745 \family typewriter
746 pythonw
746 pythonw
747 \family default
747 \family default
748 script at installation time, which takes care of coordinating things with
748 script at installation time, which takes care of coordinating things with
749 Apple's graphical environment.
749 Apple's graphical environment.
750 \layout Standard
750 \layout Standard
751
751
752 So when installing under OSX, it is best to use the following command:
752 So when installing under OSX, it is best to use the following command:
753 \family typewriter
753 \family typewriter
754
754
755 \newline
755 \newline
756
756
757 \family default
757 \family default
758
758
759 \begin_inset ERT
759 \begin_inset ERT
760 status Collapsed
760 status Collapsed
761
761
762 \layout Standard
762 \layout Standard
763
763
764 \backslash
764 \backslash
765 verb| $ sudo pythonw setup.py install --install-scripts=/usr/local/bin|
765 verb| $ sudo pythonw setup.py install --install-scripts=/usr/local/bin|
766 \end_inset
766 \end_inset
767
767
768
768
769 \newline
769 \newline
770 or
770 or
771 \newline
771 \newline
772
772
773 \begin_inset ERT
773 \begin_inset ERT
774 status Open
774 status Open
775
775
776 \layout Standard
776 \layout Standard
777
777
778 \backslash
778 \backslash
779 verb| $ sudo pythonw setup.py install --install-scripts=/usr/bin|
779 verb| $ sudo pythonw setup.py install --install-scripts=/usr/bin|
780 \end_inset
780 \end_inset
781
781
782
782
783 \newline
783 \newline
784 depending on where you like to keep hand-installed executables.
784 depending on where you like to keep hand-installed executables.
785 \layout Standard
785 \layout Standard
786
786
787 The resulting script will have an appropriate shebang line (the first line
787 The resulting script will have an appropriate shebang line (the first line
788 in the script whic begins with
788 in the script whic begins with
789 \family typewriter
789 \family typewriter
790 #!...
790 #!...
791 \family default
791 \family default
792 ) such that the ipython interpreter can interact with the OS X GUI.
792 ) such that the ipython interpreter can interact with the OS X GUI.
793 If the installed version does not work and has a shebang line that points
793 If the installed version does not work and has a shebang line that points
794 to, for example, just
794 to, for example, just
795 \family typewriter
795 \family typewriter
796 /usr/bin/python
796 /usr/bin/python
797 \family default
797 \family default
798 , then you might have a stale, cached version in your
798 , then you might have a stale, cached version in your
799 \family typewriter
799 \family typewriter
800 build/scripts-<python-version>
800 build/scripts-<python-version>
801 \family default
801 \family default
802 directory.
802 directory.
803 Delete that directory and rerun the
803 Delete that directory and rerun the
804 \family typewriter
804 \family typewriter
805 setup.py
805 setup.py
806 \family default
806 \family default
807 .
807 .
808
808
809 \layout Standard
809 \layout Standard
810
810
811 It is also a good idea to use the special flag
811 It is also a good idea to use the special flag
812 \begin_inset ERT
812 \begin_inset ERT
813 status Collapsed
813 status Collapsed
814
814
815 \layout Standard
815 \layout Standard
816
816
817 \backslash
817 \backslash
818 verb|--install-scripts|
818 verb|--install-scripts|
819 \end_inset
819 \end_inset
820
820
821 as indicated above, to ensure that the ipython scripts end up in a location
821 as indicated above, to ensure that the ipython scripts end up in a location
822 which is part of your
822 which is part of your
823 \family typewriter
823 \family typewriter
824 $PATH
824 $PATH
825 \family default
825 \family default
826 .
826 .
827 Otherwise Apple's Python will put the scripts in an internal directory
827 Otherwise Apple's Python will put the scripts in an internal directory
828 not available by default at the command line (if you use
828 not available by default at the command line (if you use
829 \family typewriter
829 \family typewriter
830 /usr/local/bin
830 /usr/local/bin
831 \family default
831 \family default
832 , you need to make sure this is in your
832 , you need to make sure this is in your
833 \family typewriter
833 \family typewriter
834 $PATH
834 $PATH
835 \family default
835 \family default
836 , which may not be true by default).
836 , which may not be true by default).
837 \layout Subsubsection*
837 \layout Subsubsection*
838
838
839 Readline problems
839 Readline problems
840 \layout Standard
840 \layout Standard
841
841
842 By default, the Python version shipped by Apple does
842 By default, the Python version shipped by Apple does
843 \emph on
843 \emph on
844 not
844 not
845 \emph default
845 \emph default
846 include the readline library, so central to IPython's behavior.
846 include the readline library, so central to IPython's behavior.
847 If you install IPython against Apple's Python, you will not have arrow
847 If you install IPython against Apple's Python, you will not have arrow
848 keys, tab completion, etc.
848 keys, tab completion, etc.
849 For Mac OSX 10.3 (Panther), you can find a prebuilt readline library here:
849 For Mac OSX 10.3 (Panther), you can find a prebuilt readline library here:
850 \newline
850 \newline
851
851
852 \begin_inset LatexCommand \htmlurl{http://pythonmac.org/packages/readline-5.0-py2.3-macosx10.3.zip}
852 \begin_inset LatexCommand \htmlurl{http://pythonmac.org/packages/readline-5.0-py2.3-macosx10.3.zip}
853
853
854 \end_inset
854 \end_inset
855
855
856
856
857 \layout Standard
857 \layout Standard
858
858
859 If you are using OSX 10.4 (Tiger), after installing this package you need
859 If you are using OSX 10.4 (Tiger), after installing this package you need
860 to either:
860 to either:
861 \layout Enumerate
861 \layout Enumerate
862
862
863 move
863 move
864 \family typewriter
864 \family typewriter
865 readline.so
865 readline.so
866 \family default
866 \family default
867 from
867 from
868 \family typewriter
868 \family typewriter
869 /Library/Python/2.3
869 /Library/Python/2.3
870 \family default
870 \family default
871 to
871 to
872 \family typewriter
872 \family typewriter
873 /Library/Python/2.3/site-packages
873 /Library/Python/2.3/site-packages
874 \family default
874 \family default
875 , or
875 , or
876 \layout Enumerate
876 \layout Enumerate
877
877
878 install
878 install
879 \begin_inset LatexCommand \htmlurl{http://pythonmac.org/packages/TigerPython23Compat.pkg.zip}
879 \begin_inset LatexCommand \htmlurl{http://pythonmac.org/packages/TigerPython23Compat.pkg.zip}
880
880
881 \end_inset
881 \end_inset
882
882
883
883
884 \layout Standard
884 \layout Standard
885
885
886 Users installing against Fink's Python or a properly hand-built one should
886 Users installing against Fink's Python or a properly hand-built one should
887 not have this problem.
887 not have this problem.
888 \layout Subsection
888 \layout Subsection
889
889
890
890
891 \begin_inset LatexCommand \label{sub:Under-Windows}
891 \begin_inset LatexCommand \label{sub:Under-Windows}
892
892
893 \end_inset
893 \end_inset
894
894
895 Windows instructions
895 Windows instructions
896 \layout Standard
896 \layout Standard
897
897
898 While you can use IPython under Windows with only a stock Python installation,
898 While you can use IPython under Windows with only a stock Python installation,
899 there is one extension,
899 there is one extension,
900 \family typewriter
900 \family typewriter
901 readline
901 readline
902 \family default
902 \family default
903 , which will make the whole experience a lot more pleasant.
903 , which will make the whole experience a lot more pleasant.
904 It is almost a requirement, since IPython will complain in its absence
904 It is almost a requirement, since IPython will complain in its absence
905 (though it will function).
905 (though it will function).
906
906
907 \layout Standard
907 \layout Standard
908
908
909 The
909 The
910 \family typewriter
910 \family typewriter
911 readline
911 readline
912 \family default
912 \family default
913 extension needs two other libraries to work, so in all you need:
913 extension needs two other libraries to work, so in all you need:
914 \layout Enumerate
914 \layout Enumerate
915
915
916
916
917 \family typewriter
917 \family typewriter
918 PyWin32
918 PyWin32
919 \family default
919 \family default
920 from
920 from
921 \begin_inset LatexCommand \htmlurl{http://starship.python.net/crew/mhammond}
921 \begin_inset LatexCommand \htmlurl{http://starship.python.net/crew/mhammond}
922
922
923 \end_inset
923 \end_inset
924
924
925 .
925 .
926 \layout Enumerate
926 \layout Enumerate
927
927
928
928
929 \family typewriter
929 \family typewriter
930 CTypes
930 CTypes
931 \family default
931 \family default
932 from
932 from
933 \begin_inset LatexCommand \htmlurl{http://starship.python.net/crew/theller/ctypes}
933 \begin_inset LatexCommand \htmlurl{http://starship.python.net/crew/theller/ctypes}
934
934
935 \end_inset
935 \end_inset
936
936
937 (you
937 (you
938 \emph on
938 \emph on
939 must
939 must
940 \emph default
940 \emph default
941 use version 0.9.1 or newer).
941 use version 0.9.1 or newer).
942 \layout Enumerate
942 \layout Enumerate
943
943
944
944
945 \family typewriter
945 \family typewriter
946 Readline
946 Readline
947 \family default
947 \family default
948 for Windows from
948 for Windows from
949 \begin_inset LatexCommand \htmlurl{http://sourceforge.net/projects/uncpythontools}
949 \begin_inset LatexCommand \htmlurl{http://sourceforge.net/projects/uncpythontools}
950
950
951 \end_inset
951 \end_inset
952
952
953 .
953 .
954 \layout Standard
954 \layout Standard
955
955
956
956
957 \series bold
957 \series bold
958 Warning about a broken readline-like library:
958 Warning about a broken readline-like library:
959 \series default
959 \series default
960 several users have reported problems stemming from using the pseudo-readline
960 several users have reported problems stemming from using the pseudo-readline
961 library at
961 library at
962 \begin_inset LatexCommand \htmlurl{http://newcenturycomputers.net/projects/readline.html}
962 \begin_inset LatexCommand \htmlurl{http://newcenturycomputers.net/projects/readline.html}
963
963
964 \end_inset
964 \end_inset
965
965
966 .
966 .
967 This is a broken library which, while called readline, only implements
967 This is a broken library which, while called readline, only implements
968 an incomplete subset of the readline API.
968 an incomplete subset of the readline API.
969 Since it is still called readline, it fools IPython's detection mechanisms
969 Since it is still called readline, it fools IPython's detection mechanisms
970 and causes unpredictable crashes later.
970 and causes unpredictable crashes later.
971 If you wish to use IPython under Windows, you must NOT use this library,
971 If you wish to use IPython under Windows, you must NOT use this library,
972 which for all purposes is (at least as of version 1.6) terminally broken.
972 which for all purposes is (at least as of version 1.6) terminally broken.
973 \layout Subsubsection
973 \layout Subsubsection
974
974
975 Gary Bishop's readline and color support for Windows
975 Gary Bishop's readline and color support for Windows
976 \layout Standard
976 \layout Standard
977
977
978 Some of IPython's very useful features are:
978 Some of IPython's very useful features are:
979 \layout Itemize
979 \layout Itemize
980
980
981 Integrated readline support (Tab-based file, object and attribute completion,
981 Integrated readline support (Tab-based file, object and attribute completion,
982 input history across sessions, editable command line, etc.)
982 input history across sessions, editable command line, etc.)
983 \layout Itemize
983 \layout Itemize
984
984
985 Coloring of prompts, code and tracebacks.
985 Coloring of prompts, code and tracebacks.
986 \layout Standard
986 \layout Standard
987
987
988 These, by default, are only available under Unix-like operating systems.
988 These, by default, are only available under Unix-like operating systems.
989 However, thanks to Gary Bishop's work, Windows XP/2k users can also benefit
989 However, thanks to Gary Bishop's work, Windows XP/2k users can also benefit
990 from them.
990 from them.
991 His readline library implements both GNU readline functionality and color
991 His readline library implements both GNU readline functionality and color
992 support, so that IPython under Windows XP/2k can be as friendly and powerful
992 support, so that IPython under Windows XP/2k can be as friendly and powerful
993 as under Unix-like environments.
993 as under Unix-like environments.
994 \layout Standard
994 \layout Standard
995
995
996 You can find Gary's tools at
996 You can find Gary's tools at
997 \begin_inset LatexCommand \htmlurl{http://sourceforge.net/projects/uncpythontools}
997 \begin_inset LatexCommand \htmlurl{http://sourceforge.net/projects/uncpythontools}
998
998
999 \end_inset
999 \end_inset
1000
1000
1001 ; Gary's
1001 ; Gary's
1002 \family typewriter
1002 \family typewriter
1003 readline
1003 readline
1004 \family default
1004 \family default
1005 requires in turn the
1005 requires in turn the
1006 \family typewriter
1006 \family typewriter
1007 ctypes
1007 ctypes
1008 \family default
1008 \family default
1009 library by Thomas Heller, available at
1009 library by Thomas Heller, available at
1010 \begin_inset LatexCommand \htmlurl{http://starship.python.net/crew/theller/ctypes}
1010 \begin_inset LatexCommand \htmlurl{http://starship.python.net/crew/theller/ctypes}
1011
1011
1012 \end_inset
1012 \end_inset
1013
1013
1014 , and Mark Hammond's
1014 , and Mark Hammond's
1015 \family typewriter
1015 \family typewriter
1016 PyWin32
1016 PyWin32
1017 \family default
1017 \family default
1018 from
1018 from
1019 \begin_inset LatexCommand \htmlurl{http://starship.python.net/crew/mhammond}
1019 \begin_inset LatexCommand \htmlurl{http://starship.python.net/crew/mhammond}
1020
1020
1021 \end_inset
1021 \end_inset
1022
1022
1023 (
1023 (
1024 \family typewriter
1024 \family typewriter
1025 PyWin32
1025 PyWin32
1026 \family default
1026 \family default
1027 is great for anything Windows-related anyway, so you might as well get
1027 is great for anything Windows-related anyway, so you might as well get
1028 it).
1028 it).
1029 \layout Standard
1029 \layout Standard
1030
1030
1031 Under MS\SpecialChar ~
1031 Under MS\SpecialChar ~
1032 Windows, IPython will complain if it can not find this
1032 Windows, IPython will complain if it can not find this
1033 \family typewriter
1033 \family typewriter
1034 readline
1034 readline
1035 \family default
1035 \family default
1036 library at startup and any time the
1036 library at startup and any time the
1037 \family typewriter
1037 \family typewriter
1038 %colors
1038 %colors
1039 \family default
1039 \family default
1040 command is issued, so you can consider it to be a quasi-requirement.
1040 command is issued, so you can consider it to be a quasi-requirement.
1041 \layout Subsubsection
1041 \layout Subsubsection
1042
1042
1043 Installation procedure
1043 Installation procedure
1044 \layout Standard
1044 \layout Standard
1045
1045
1046 Once you have the above installed, from the IPython download directory grab
1046 Once you have the above installed, from the IPython download directory grab
1047 the
1047 the
1048 \family typewriter
1048 \family typewriter
1049 ipython-XXX.win32.exe
1049 ipython-XXX.win32.exe
1050 \family default
1050 \family default
1051 file, where
1051 file, where
1052 \family typewriter
1052 \family typewriter
1053 XXX
1053 XXX
1054 \family default
1054 \family default
1055 represents the version number.
1055 represents the version number.
1056 This is a regular windows executable installer, which you can simply double-cli
1056 This is a regular windows executable installer, which you can simply double-cli
1057 ck to install.
1057 ck to install.
1058 It will add an entry for IPython to your Start Menu, as well as registering
1058 It will add an entry for IPython to your Start Menu, as well as registering
1059 IPython in the Windows list of applications, so you can later uninstall
1059 IPython in the Windows list of applications, so you can later uninstall
1060 it from the Control Panel.
1060 it from the Control Panel.
1061
1061
1062 \layout Standard
1062 \layout Standard
1063
1063
1064 IPython tries to install the configuration information in a directory named
1064 IPython tries to install the configuration information in a directory named
1065
1065
1066 \family typewriter
1066 \family typewriter
1067 .ipython
1067 .ipython
1068 \family default
1068 \family default
1069 (
1069 (
1070 \family typewriter
1070 \family typewriter
1071 _ipython
1071 _ipython
1072 \family default
1072 \family default
1073 under Windows) located in your `home' directory.
1073 under Windows) located in your `home' directory.
1074 IPython sets this directory by looking for a
1074 IPython sets this directory by looking for a
1075 \family typewriter
1075 \family typewriter
1076 HOME
1076 HOME
1077 \family default
1077 \family default
1078 environment variable; if such a variable does not exist, it uses
1078 environment variable; if such a variable does not exist, it uses
1079 \family typewriter
1079 \family typewriter
1080 HOMEDRIVE
1080 HOMEDRIVE
1081 \backslash
1081 \backslash
1082 HOMEPATH
1082 HOMEPATH
1083 \family default
1083 \family default
1084 (these are always defined by Windows).
1084 (these are always defined by Windows).
1085 This typically gives something like
1085 This typically gives something like
1086 \family typewriter
1086 \family typewriter
1087 C:
1087 C:
1088 \backslash
1088 \backslash
1089 Documents and Settings
1089 Documents and Settings
1090 \backslash
1090 \backslash
1091 YourUserName
1091 YourUserName
1092 \family default
1092 \family default
1093 , but your local details may vary.
1093 , but your local details may vary.
1094 In this directory you will find all the files that configure IPython's
1094 In this directory you will find all the files that configure IPython's
1095 defaults, and you can put there your profiles and extensions.
1095 defaults, and you can put there your profiles and extensions.
1096 This directory is automatically added by IPython to
1096 This directory is automatically added by IPython to
1097 \family typewriter
1097 \family typewriter
1098 sys.path
1098 sys.path
1099 \family default
1099 \family default
1100 , so anything you place there can be found by
1100 , so anything you place there can be found by
1101 \family typewriter
1101 \family typewriter
1102 import
1102 import
1103 \family default
1103 \family default
1104 statements.
1104 statements.
1105 \layout Paragraph
1105 \layout Paragraph
1106
1106
1107 Upgrading
1107 Upgrading
1108 \layout Standard
1108 \layout Standard
1109
1109
1110 For an IPython upgrade, you should first uninstall the previous version.
1110 For an IPython upgrade, you should first uninstall the previous version.
1111 This will ensure that all files and directories (such as the documentation)
1111 This will ensure that all files and directories (such as the documentation)
1112 which carry embedded version strings in their names are properly removed.
1112 which carry embedded version strings in their names are properly removed.
1113 \layout Paragraph
1113 \layout Paragraph
1114
1114
1115 Manual installation under Win32
1115 Manual installation under Win32
1116 \layout Standard
1116 \layout Standard
1117
1117
1118 In case the automatic installer does not work for some reason, you can download
1118 In case the automatic installer does not work for some reason, you can download
1119 the
1119 the
1120 \family typewriter
1120 \family typewriter
1121 ipython-XXX.tar.gz
1121 ipython-XXX.tar.gz
1122 \family default
1122 \family default
1123 file, which contains the full IPython source distribution (the popular
1123 file, which contains the full IPython source distribution (the popular
1124 WinZip can read
1124 WinZip can read
1125 \family typewriter
1125 \family typewriter
1126 .tar.gz
1126 .tar.gz
1127 \family default
1127 \family default
1128 files).
1128 files).
1129 After uncompressing the archive, you can install it at a command terminal
1129 After uncompressing the archive, you can install it at a command terminal
1130 just like any other Python module, by using
1130 just like any other Python module, by using
1131 \family typewriter
1131 \family typewriter
1132 `python setup.py install'
1132 `python setup.py install'
1133 \family default
1133 \family default
1134 .
1134 .
1135
1135
1136 \layout Standard
1136 \layout Standard
1137
1137
1138 After the installation, run the supplied
1138 After the installation, run the supplied
1139 \family typewriter
1139 \family typewriter
1140 win32_manual_post_install.py
1140 win32_manual_post_install.py
1141 \family default
1141 \family default
1142 script, which creates the necessary Start Menu shortcuts for you.
1142 script, which creates the necessary Start Menu shortcuts for you.
1143 \layout Subsection
1143 \layout Subsection
1144
1144
1145
1145
1146 \begin_inset LatexCommand \label{sec:upgrade}
1146 \begin_inset LatexCommand \label{sec:upgrade}
1147
1147
1148 \end_inset
1148 \end_inset
1149
1149
1150 Upgrading from a previous version
1150 Upgrading from a previous version
1151 \layout Standard
1151 \layout Standard
1152
1152
1153 If you are upgrading from a previous version of IPython, after doing the
1153 If you are upgrading from a previous version of IPython, after doing the
1154 routine installation described above, you should call IPython with the
1154 routine installation described above, you should call IPython with the
1155
1155
1156 \family typewriter
1156 \family typewriter
1157 -upgrade
1157 -upgrade
1158 \family default
1158 \family default
1159 option the first time you run your new copy.
1159 option the first time you run your new copy.
1160 This will automatically update your configuration directory while preserving
1160 This will automatically update your configuration directory while preserving
1161 copies of your old files.
1161 copies of your old files.
1162 You can then later merge back any personal customizations you may have
1162 You can then later merge back any personal customizations you may have
1163 made into the new files.
1163 made into the new files.
1164 It is a good idea to do this as there may be new options available in the
1164 It is a good idea to do this as there may be new options available in the
1165 new configuration files which you will not have.
1165 new configuration files which you will not have.
1166 \layout Standard
1166 \layout Standard
1167
1167
1168 Under Windows, if you don't know how to call python scripts with arguments
1168 Under Windows, if you don't know how to call python scripts with arguments
1169 from a command line, simply delete the old config directory and IPython
1169 from a command line, simply delete the old config directory and IPython
1170 will make a new one.
1170 will make a new one.
1171 Win2k and WinXP users will find it in
1171 Win2k and WinXP users will find it in
1172 \family typewriter
1172 \family typewriter
1173 C:
1173 C:
1174 \backslash
1174 \backslash
1175 Documents and Settings
1175 Documents and Settings
1176 \backslash
1176 \backslash
1177 YourUserName
1177 YourUserName
1178 \backslash
1178 \backslash
1179 _ipython
1179 _ipython
1180 \family default
1180 \family default
1181 , and Win 9x users under
1181 , and Win 9x users under
1182 \family typewriter
1182 \family typewriter
1183 C:
1183 C:
1184 \backslash
1184 \backslash
1185 Program Files
1185 Program Files
1186 \backslash
1186 \backslash
1187 IPython
1187 IPython
1188 \backslash
1188 \backslash
1189 _ipython.
1189 _ipython.
1190 \layout Section
1190 \layout Section
1191
1191
1192
1192
1193 \begin_inset LatexCommand \label{sec:good_config}
1193 \begin_inset LatexCommand \label{sec:good_config}
1194
1194
1195 \end_inset
1195 \end_inset
1196
1196
1197
1197
1198 \begin_inset OptArg
1198 \begin_inset OptArg
1199 collapsed true
1199 collapsed true
1200
1200
1201 \layout Standard
1201 \layout Standard
1202
1202
1203 Initial configuration
1203 Initial configuration
1204 \begin_inset ERT
1204 \begin_inset ERT
1205 status Collapsed
1205 status Collapsed
1206
1206
1207 \layout Standard
1207 \layout Standard
1208
1208
1209 \backslash
1209 \backslash
1210 ldots
1210 ldots
1211 \end_inset
1211 \end_inset
1212
1212
1213
1213
1214 \end_inset
1214 \end_inset
1215
1215
1216 Initial configuration of your environment
1216 Initial configuration of your environment
1217 \layout Standard
1217 \layout Standard
1218
1218
1219 This section will help you set various things in your environment for your
1219 This section will help you set various things in your environment for your
1220 IPython sessions to be as efficient as possible.
1220 IPython sessions to be as efficient as possible.
1221 All of IPython's configuration information, along with several example
1221 All of IPython's configuration information, along with several example
1222 files, is stored in a directory named by default
1222 files, is stored in a directory named by default
1223 \family typewriter
1223 \family typewriter
1224 $HOME/.ipython
1224 $HOME/.ipython
1225 \family default
1225 \family default
1226 .
1226 .
1227 You can change this by defining the environment variable
1227 You can change this by defining the environment variable
1228 \family typewriter
1228 \family typewriter
1229 IPYTHONDIR
1229 IPYTHONDIR
1230 \family default
1230 \family default
1231 , or at runtime with the command line option
1231 , or at runtime with the command line option
1232 \family typewriter
1232 \family typewriter
1233 -ipythondir
1233 -ipythondir
1234 \family default
1234 \family default
1235 .
1235 .
1236 \layout Standard
1236 \layout Standard
1237
1237
1238 If all goes well, the first time you run IPython it should automatically
1238 If all goes well, the first time you run IPython it should automatically
1239 create a user copy of the config directory for you, based on its builtin
1239 create a user copy of the config directory for you, based on its builtin
1240 defaults.
1240 defaults.
1241 You can look at the files it creates to learn more about configuring the
1241 You can look at the files it creates to learn more about configuring the
1242 system.
1242 system.
1243 The main file you will modify to configure IPython's behavior is called
1243 The main file you will modify to configure IPython's behavior is called
1244
1244
1245 \family typewriter
1245 \family typewriter
1246 ipythonrc
1246 ipythonrc
1247 \family default
1247 \family default
1248 (with a
1248 (with a
1249 \family typewriter
1249 \family typewriter
1250 .ini
1250 .ini
1251 \family default
1251 \family default
1252 extension under Windows), included for reference in Sec.
1252 extension under Windows), included for reference in Sec.
1253
1253
1254 \begin_inset LatexCommand \ref{sec:ipytonrc-sample}
1254 \begin_inset LatexCommand \ref{sec:ipytonrc-sample}
1255
1255
1256 \end_inset
1256 \end_inset
1257
1257
1258 .
1258 .
1259 This file is very commented and has many variables you can change to suit
1259 This file is very commented and has many variables you can change to suit
1260 your taste, you can find more details in Sec.
1260 your taste, you can find more details in Sec.
1261
1261
1262 \begin_inset LatexCommand \ref{sec:customization}
1262 \begin_inset LatexCommand \ref{sec:customization}
1263
1263
1264 \end_inset
1264 \end_inset
1265
1265
1266 .
1266 .
1267 Here we discuss the basic things you will want to make sure things are
1267 Here we discuss the basic things you will want to make sure things are
1268 working properly from the beginning.
1268 working properly from the beginning.
1269 \layout Subsection
1269 \layout Subsection
1270
1270
1271
1271
1272 \begin_inset LatexCommand \label{sec:help-access}
1272 \begin_inset LatexCommand \label{sec:help-access}
1273
1273
1274 \end_inset
1274 \end_inset
1275
1275
1276 Access to the Python help system
1276 Access to the Python help system
1277 \layout Standard
1277 \layout Standard
1278
1278
1279 This is true for Python in general (not just for IPython): you should have
1279 This is true for Python in general (not just for IPython): you should have
1280 an environment variable called
1280 an environment variable called
1281 \family typewriter
1281 \family typewriter
1282 PYTHONDOCS
1282 PYTHONDOCS
1283 \family default
1283 \family default
1284 pointing to the directory where your HTML Python documentation lives.
1284 pointing to the directory where your HTML Python documentation lives.
1285 In my system it's
1285 In my system it's
1286 \family typewriter
1286 \family typewriter
1287 /usr/share/doc/python-docs-2.3.4/html
1287 /usr/share/doc/python-docs-2.3.4/html
1288 \family default
1288 \family default
1289 , check your local details or ask your systems administrator.
1289 , check your local details or ask your systems administrator.
1290
1290
1291 \layout Standard
1291 \layout Standard
1292
1292
1293 This is the directory which holds the HTML version of the Python manuals.
1293 This is the directory which holds the HTML version of the Python manuals.
1294 Unfortunately it seems that different Linux distributions package these
1294 Unfortunately it seems that different Linux distributions package these
1295 files differently, so you may have to look around a bit.
1295 files differently, so you may have to look around a bit.
1296 Below I show the contents of this directory on my system for reference:
1296 Below I show the contents of this directory on my system for reference:
1297 \layout Standard
1297 \layout Standard
1298
1298
1299
1299
1300 \family typewriter
1300 \family typewriter
1301 [html]> ls
1301 [html]> ls
1302 \newline
1302 \newline
1303 about.dat acks.html dist/ ext/ index.html lib/ modindex.html stdabout.dat tut/
1303 about.dat acks.html dist/ ext/ index.html lib/ modindex.html stdabout.dat tut/
1304 about.html api/ doc/ icons/ inst/ mac/ ref/ style.css
1304 about.html api/ doc/ icons/ inst/ mac/ ref/ style.css
1305 \layout Standard
1305 \layout Standard
1306
1306
1307 You should really make sure this variable is correctly set so that Python's
1307 You should really make sure this variable is correctly set so that Python's
1308 pydoc-based help system works.
1308 pydoc-based help system works.
1309 It is a powerful and convenient system with full access to the Python manuals
1309 It is a powerful and convenient system with full access to the Python manuals
1310 and all modules accessible to you.
1310 and all modules accessible to you.
1311 \layout Standard
1311 \layout Standard
1312
1312
1313 Under Windows it seems that pydoc finds the documentation automatically,
1313 Under Windows it seems that pydoc finds the documentation automatically,
1314 so no extra setup appears necessary.
1314 so no extra setup appears necessary.
1315 \layout Subsection
1315 \layout Subsection
1316
1316
1317 Editor
1317 Editor
1318 \layout Standard
1318 \layout Standard
1319
1319
1320 The
1320 The
1321 \family typewriter
1321 \family typewriter
1322 %edit
1322 %edit
1323 \family default
1323 \family default
1324 command (and its alias
1324 command (and its alias
1325 \family typewriter
1325 \family typewriter
1326 %ed
1326 %ed
1327 \family default
1327 \family default
1328 ) will invoke the editor set in your environment as
1328 ) will invoke the editor set in your environment as
1329 \family typewriter
1329 \family typewriter
1330 EDITOR
1330 EDITOR
1331 \family default
1331 \family default
1332 .
1332 .
1333 If this variable is not set, it will default to
1333 If this variable is not set, it will default to
1334 \family typewriter
1334 \family typewriter
1335 vi
1335 vi
1336 \family default
1336 \family default
1337 under Linux/Unix and to
1337 under Linux/Unix and to
1338 \family typewriter
1338 \family typewriter
1339 notepad
1339 notepad
1340 \family default
1340 \family default
1341 under Windows.
1341 under Windows.
1342 You may want to set this variable properly and to a lightweight editor
1342 You may want to set this variable properly and to a lightweight editor
1343 which doesn't take too long to start (that is, something other than a new
1343 which doesn't take too long to start (that is, something other than a new
1344 instance of
1344 instance of
1345 \family typewriter
1345 \family typewriter
1346 Emacs
1346 Emacs
1347 \family default
1347 \family default
1348 ).
1348 ).
1349 This way you can edit multi-line code quickly and with the power of a real
1349 This way you can edit multi-line code quickly and with the power of a real
1350 editor right inside IPython.
1350 editor right inside IPython.
1351
1351
1352 \layout Standard
1352 \layout Standard
1353
1353
1354 If you are a dedicated
1354 If you are a dedicated
1355 \family typewriter
1355 \family typewriter
1356 Emacs
1356 Emacs
1357 \family default
1357 \family default
1358 user, you should set up the
1358 user, you should set up the
1359 \family typewriter
1359 \family typewriter
1360 Emacs
1360 Emacs
1361 \family default
1361 \family default
1362 server so that new requests are handled by the original process.
1362 server so that new requests are handled by the original process.
1363 This means that almost no time is spent in handling the request (assuming
1363 This means that almost no time is spent in handling the request (assuming
1364 an
1364 an
1365 \family typewriter
1365 \family typewriter
1366 Emacs
1366 Emacs
1367 \family default
1367 \family default
1368 process is already running).
1368 process is already running).
1369 For this to work, you need to set your
1369 For this to work, you need to set your
1370 \family typewriter
1370 \family typewriter
1371 EDITOR
1371 EDITOR
1372 \family default
1372 \family default
1373 environment variable to
1373 environment variable to
1374 \family typewriter
1374 \family typewriter
1375 'emacsclient'
1375 'emacsclient'
1376 \family default
1376 \family default
1377 .
1377 .
1378
1378
1379 \family typewriter
1379 \family typewriter
1380
1380
1381 \family default
1381 \family default
1382 The code below, supplied by Francois Pinard, can then be used in your
1382 The code below, supplied by Francois Pinard, can then be used in your
1383 \family typewriter
1383 \family typewriter
1384 .emacs
1384 .emacs
1385 \family default
1385 \family default
1386 file to enable the server:
1386 file to enable the server:
1387 \layout Standard
1387 \layout Standard
1388
1388
1389
1389
1390 \family typewriter
1390 \family typewriter
1391 (defvar server-buffer-clients)
1391 (defvar server-buffer-clients)
1392 \newline
1392 \newline
1393 (when (and (fboundp 'server-start) (string-equal (getenv "TERM") 'xterm))
1393 (when (and (fboundp 'server-start) (string-equal (getenv "TERM") 'xterm))
1394 \newline
1394 \newline
1395
1395
1396 \begin_inset ERT
1396 \begin_inset ERT
1397 status Collapsed
1397 status Collapsed
1398
1398
1399 \layout Standard
1399 \layout Standard
1400
1400
1401 \backslash
1401 \backslash
1402 hspace*{0mm}
1402 hspace*{0mm}
1403 \end_inset
1403 \end_inset
1404
1404
1405 \SpecialChar ~
1405 \SpecialChar ~
1406 \SpecialChar ~
1406 \SpecialChar ~
1407 (server-start)
1407 (server-start)
1408 \newline
1408 \newline
1409
1409
1410 \begin_inset ERT
1410 \begin_inset ERT
1411 status Collapsed
1411 status Collapsed
1412
1412
1413 \layout Standard
1413 \layout Standard
1414
1414
1415 \backslash
1415 \backslash
1416 hspace*{0mm}
1416 hspace*{0mm}
1417 \end_inset
1417 \end_inset
1418
1418
1419 \SpecialChar ~
1419 \SpecialChar ~
1420 \SpecialChar ~
1420 \SpecialChar ~
1421 (defun fp-kill-server-with-buffer-routine ()
1421 (defun fp-kill-server-with-buffer-routine ()
1422 \newline
1422 \newline
1423
1423
1424 \begin_inset ERT
1424 \begin_inset ERT
1425 status Collapsed
1425 status Collapsed
1426
1426
1427 \layout Standard
1427 \layout Standard
1428
1428
1429 \backslash
1429 \backslash
1430 hspace*{0mm}
1430 hspace*{0mm}
1431 \end_inset
1431 \end_inset
1432
1432
1433 \SpecialChar ~
1433 \SpecialChar ~
1434 \SpecialChar ~
1434 \SpecialChar ~
1435 \SpecialChar ~
1435 \SpecialChar ~
1436 \SpecialChar ~
1436 \SpecialChar ~
1437 (and server-buffer-clients (server-done)))
1437 (and server-buffer-clients (server-done)))
1438 \newline
1438 \newline
1439
1439
1440 \begin_inset ERT
1440 \begin_inset ERT
1441 status Collapsed
1441 status Collapsed
1442
1442
1443 \layout Standard
1443 \layout Standard
1444
1444
1445 \backslash
1445 \backslash
1446 hspace*{0mm}
1446 hspace*{0mm}
1447 \end_inset
1447 \end_inset
1448
1448
1449 \SpecialChar ~
1449 \SpecialChar ~
1450 \SpecialChar ~
1450 \SpecialChar ~
1451 (add-hook 'kill-buffer-hook 'fp-kill-server-with-buffer-routine))
1451 (add-hook 'kill-buffer-hook 'fp-kill-server-with-buffer-routine))
1452 \layout Standard
1452 \layout Standard
1453
1453
1454 You can also set the value of this editor via the commmand-line option '-
1454 You can also set the value of this editor via the commmand-line option '-
1455 \family typewriter
1455 \family typewriter
1456 editor'
1456 editor'
1457 \family default
1457 \family default
1458 or in your
1458 or in your
1459 \family typewriter
1459 \family typewriter
1460 ipythonrc
1460 ipythonrc
1461 \family default
1461 \family default
1462 file.
1462 file.
1463 This is useful if you wish to use specifically for IPython an editor different
1463 This is useful if you wish to use specifically for IPython an editor different
1464 from your typical default (and for Windows users who tend to use fewer
1464 from your typical default (and for Windows users who tend to use fewer
1465 environment variables).
1465 environment variables).
1466 \layout Subsection
1466 \layout Subsection
1467
1467
1468 Color
1468 Color
1469 \layout Standard
1469 \layout Standard
1470
1470
1471 The default IPython configuration has most bells and whistles turned on
1471 The default IPython configuration has most bells and whistles turned on
1472 (they're pretty safe).
1472 (they're pretty safe).
1473 But there's one that
1473 But there's one that
1474 \emph on
1474 \emph on
1475 may
1475 may
1476 \emph default
1476 \emph default
1477 cause problems on some systems: the use of color on screen for displaying
1477 cause problems on some systems: the use of color on screen for displaying
1478 information.
1478 information.
1479 This is very useful, since IPython can show prompts and exception tracebacks
1479 This is very useful, since IPython can show prompts and exception tracebacks
1480 with various colors, display syntax-highlighted source code, and in general
1480 with various colors, display syntax-highlighted source code, and in general
1481 make it easier to visually parse information.
1481 make it easier to visually parse information.
1482 \layout Standard
1482 \layout Standard
1483
1483
1484 The following terminals seem to handle the color sequences fine:
1484 The following terminals seem to handle the color sequences fine:
1485 \layout Itemize
1485 \layout Itemize
1486
1486
1487 Linux main text console, KDE Konsole, Gnome Terminal, E-term, rxvt, xterm.
1487 Linux main text console, KDE Konsole, Gnome Terminal, E-term, rxvt, xterm.
1488 \layout Itemize
1488 \layout Itemize
1489
1489
1490 CDE terminal (tested under Solaris).
1490 CDE terminal (tested under Solaris).
1491 This one boldfaces light colors.
1491 This one boldfaces light colors.
1492 \layout Itemize
1492 \layout Itemize
1493
1493
1494 (X)Emacs buffers.
1494 (X)Emacs buffers.
1495 See sec.
1495 See sec.
1496 \begin_inset LatexCommand \ref{sec:emacs}
1496 \begin_inset LatexCommand \ref{sec:emacs}
1497
1497
1498 \end_inset
1498 \end_inset
1499
1499
1500 for more details on using IPython with (X)Emacs.
1500 for more details on using IPython with (X)Emacs.
1501 \layout Itemize
1501 \layout Itemize
1502
1502
1503 A Windows (XP/2k) command prompt
1503 A Windows (XP/2k) command prompt
1504 \emph on
1504 \emph on
1505 with Gary Bishop's support extensions
1505 with Gary Bishop's support extensions
1506 \emph default
1506 \emph default
1507 .
1507 .
1508 Gary's extensions are discussed in Sec.\SpecialChar ~
1508 Gary's extensions are discussed in Sec.\SpecialChar ~
1509
1509
1510 \begin_inset LatexCommand \ref{sub:Under-Windows}
1510 \begin_inset LatexCommand \ref{sub:Under-Windows}
1511
1511
1512 \end_inset
1512 \end_inset
1513
1513
1514 .
1514 .
1515 \layout Itemize
1515 \layout Itemize
1516
1516
1517 A Windows (XP/2k) CygWin shell.
1517 A Windows (XP/2k) CygWin shell.
1518 Although some users have reported problems; it is not clear whether there
1518 Although some users have reported problems; it is not clear whether there
1519 is an issue for everyone or only under specific configurations.
1519 is an issue for everyone or only under specific configurations.
1520 If you have full color support under cygwin, please post to the IPython
1520 If you have full color support under cygwin, please post to the IPython
1521 mailing list so this issue can be resolved for all users.
1521 mailing list so this issue can be resolved for all users.
1522 \layout Standard
1522 \layout Standard
1523
1523
1524 These have shown problems:
1524 These have shown problems:
1525 \layout Itemize
1525 \layout Itemize
1526
1526
1527 Windows command prompt in WinXP/2k logged into a Linux machine via telnet
1527 Windows command prompt in WinXP/2k logged into a Linux machine via telnet
1528 or ssh.
1528 or ssh.
1529 \layout Itemize
1529 \layout Itemize
1530
1530
1531 Windows native command prompt in WinXP/2k,
1531 Windows native command prompt in WinXP/2k,
1532 \emph on
1532 \emph on
1533 without
1533 without
1534 \emph default
1534 \emph default
1535 Gary Bishop's extensions.
1535 Gary Bishop's extensions.
1536 Once Gary's readline library is installed, the normal WinXP/2k command
1536 Once Gary's readline library is installed, the normal WinXP/2k command
1537 prompt works perfectly.
1537 prompt works perfectly.
1538 \layout Standard
1538 \layout Standard
1539
1539
1540 Currently the following color schemes are available:
1540 Currently the following color schemes are available:
1541 \layout Itemize
1541 \layout Itemize
1542
1542
1543
1543
1544 \family typewriter
1544 \family typewriter
1545 NoColor
1545 NoColor
1546 \family default
1546 \family default
1547 : uses no color escapes at all (all escapes are empty
1547 : uses no color escapes at all (all escapes are empty
1548 \begin_inset Quotes eld
1548 \begin_inset Quotes eld
1549 \end_inset
1549 \end_inset
1550
1550
1551
1551
1552 \begin_inset Quotes eld
1552 \begin_inset Quotes eld
1553 \end_inset
1553 \end_inset
1554
1554
1555 strings).
1555 strings).
1556 This 'scheme' is thus fully safe to use in any terminal.
1556 This 'scheme' is thus fully safe to use in any terminal.
1557 \layout Itemize
1557 \layout Itemize
1558
1558
1559
1559
1560 \family typewriter
1560 \family typewriter
1561 Linux
1561 Linux
1562 \family default
1562 \family default
1563 : works well in Linux console type environments: dark background with light
1563 : works well in Linux console type environments: dark background with light
1564 fonts.
1564 fonts.
1565 It uses bright colors for information, so it is difficult to read if you
1565 It uses bright colors for information, so it is difficult to read if you
1566 have a light colored background.
1566 have a light colored background.
1567 \layout Itemize
1567 \layout Itemize
1568
1568
1569
1569
1570 \family typewriter
1570 \family typewriter
1571 LightBG
1571 LightBG
1572 \family default
1572 \family default
1573 : the basic colors are similar to those in the
1573 : the basic colors are similar to those in the
1574 \family typewriter
1574 \family typewriter
1575 Linux
1575 Linux
1576 \family default
1576 \family default
1577 scheme but darker.
1577 scheme but darker.
1578 It is easy to read in terminals with light backgrounds.
1578 It is easy to read in terminals with light backgrounds.
1579 \layout Standard
1579 \layout Standard
1580
1580
1581 IPython uses colors for two main groups of things: prompts and tracebacks
1581 IPython uses colors for two main groups of things: prompts and tracebacks
1582 which are directly printed to the terminal, and the object introspection
1582 which are directly printed to the terminal, and the object introspection
1583 system which passes large sets of data through a pager.
1583 system which passes large sets of data through a pager.
1584 \layout Subsubsection
1584 \layout Subsubsection
1585
1585
1586 Input/Output prompts and exception tracebacks
1586 Input/Output prompts and exception tracebacks
1587 \layout Standard
1587 \layout Standard
1588
1588
1589 You can test whether the colored prompts and tracebacks work on your system
1589 You can test whether the colored prompts and tracebacks work on your system
1590 interactively by typing
1590 interactively by typing
1591 \family typewriter
1591 \family typewriter
1592 '%colors Linux'
1592 '%colors Linux'
1593 \family default
1593 \family default
1594 at the prompt (use '
1594 at the prompt (use '
1595 \family typewriter
1595 \family typewriter
1596 %colors LightBG'
1596 %colors LightBG'
1597 \family default
1597 \family default
1598 if your terminal has a light background).
1598 if your terminal has a light background).
1599 If the input prompt shows garbage like:
1599 If the input prompt shows garbage like:
1600 \newline
1600 \newline
1601
1601
1602 \family typewriter
1602 \family typewriter
1603 [0;32mIn [[1;32m1[0;32m]: [0;00m
1603 [0;32mIn [[1;32m1[0;32m]: [0;00m
1604 \family default
1604 \family default
1605
1605
1606 \newline
1606 \newline
1607 instead of (in color) something like:
1607 instead of (in color) something like:
1608 \newline
1608 \newline
1609
1609
1610 \family typewriter
1610 \family typewriter
1611 In [1]:
1611 In [1]:
1612 \family default
1612 \family default
1613
1613
1614 \newline
1614 \newline
1615 this means that your terminal doesn't properly handle color escape sequences.
1615 this means that your terminal doesn't properly handle color escape sequences.
1616 You can go to a 'no color' mode by typing '
1616 You can go to a 'no color' mode by typing '
1617 \family typewriter
1617 \family typewriter
1618 %colors NoColor
1618 %colors NoColor
1619 \family default
1619 \family default
1620 '.
1620 '.
1621
1621
1622 \layout Standard
1622 \layout Standard
1623
1623
1624 You can try using a different terminal emulator program.
1624 You can try using a different terminal emulator program.
1625 To permanently set your color preferences, edit the file
1625 To permanently set your color preferences, edit the file
1626 \family typewriter
1626 \family typewriter
1627 $HOME/.ipython/ipythonrc
1627 $HOME/.ipython/ipythonrc
1628 \family default
1628 \family default
1629 and set the
1629 and set the
1630 \family typewriter
1630 \family typewriter
1631 colors
1631 colors
1632 \family default
1632 \family default
1633 option to the desired value.
1633 option to the desired value.
1634 \layout Subsubsection
1634 \layout Subsubsection
1635
1635
1636 Object details (types, docstrings, source code, etc.)
1636 Object details (types, docstrings, source code, etc.)
1637 \layout Standard
1637 \layout Standard
1638
1638
1639 IPython has a set of special functions for studying the objects you are
1639 IPython has a set of special functions for studying the objects you are
1640 working with, discussed in detail in Sec.
1640 working with, discussed in detail in Sec.
1641
1641
1642 \begin_inset LatexCommand \ref{sec:dyn-object-info}
1642 \begin_inset LatexCommand \ref{sec:dyn-object-info}
1643
1643
1644 \end_inset
1644 \end_inset
1645
1645
1646 .
1646 .
1647 But this system relies on passing information which is longer than your
1647 But this system relies on passing information which is longer than your
1648 screen through a data pager, such as the common Unix
1648 screen through a data pager, such as the common Unix
1649 \family typewriter
1649 \family typewriter
1650 less
1650 less
1651 \family default
1651 \family default
1652 and
1652 and
1653 \family typewriter
1653 \family typewriter
1654 more
1654 more
1655 \family default
1655 \family default
1656 programs.
1656 programs.
1657 In order to be able to see this information in color, your pager needs
1657 In order to be able to see this information in color, your pager needs
1658 to be properly configured.
1658 to be properly configured.
1659 I strongly recommend using
1659 I strongly recommend using
1660 \family typewriter
1660 \family typewriter
1661 less
1661 less
1662 \family default
1662 \family default
1663 instead of
1663 instead of
1664 \family typewriter
1664 \family typewriter
1665 more
1665 more
1666 \family default
1666 \family default
1667 , as it seems that
1667 , as it seems that
1668 \family typewriter
1668 \family typewriter
1669 more
1669 more
1670 \family default
1670 \family default
1671 simply can not understand colored text correctly.
1671 simply can not understand colored text correctly.
1672 \layout Standard
1672 \layout Standard
1673
1673
1674 In order to configure
1674 In order to configure
1675 \family typewriter
1675 \family typewriter
1676 less
1676 less
1677 \family default
1677 \family default
1678 as your default pager, do the following:
1678 as your default pager, do the following:
1679 \layout Enumerate
1679 \layout Enumerate
1680
1680
1681 Set the environment
1681 Set the environment
1682 \family typewriter
1682 \family typewriter
1683 PAGER
1683 PAGER
1684 \family default
1684 \family default
1685 variable to
1685 variable to
1686 \family typewriter
1686 \family typewriter
1687 less
1687 less
1688 \family default
1688 \family default
1689 .
1689 .
1690 \layout Enumerate
1690 \layout Enumerate
1691
1691
1692 Set the environment
1692 Set the environment
1693 \family typewriter
1693 \family typewriter
1694 LESS
1694 LESS
1695 \family default
1695 \family default
1696 variable to
1696 variable to
1697 \family typewriter
1697 \family typewriter
1698 -r
1698 -r
1699 \family default
1699 \family default
1700 (plus any other options you always want to pass to
1700 (plus any other options you always want to pass to
1701 \family typewriter
1701 \family typewriter
1702 less
1702 less
1703 \family default
1703 \family default
1704 by default).
1704 by default).
1705 This tells
1705 This tells
1706 \family typewriter
1706 \family typewriter
1707 less
1707 less
1708 \family default
1708 \family default
1709 to properly interpret control sequences, which is how color information
1709 to properly interpret control sequences, which is how color information
1710 is given to your terminal.
1710 is given to your terminal.
1711 \layout Standard
1711 \layout Standard
1712
1712
1713 For the
1713 For the
1714 \family typewriter
1714 \family typewriter
1715 csh
1715 csh
1716 \family default
1716 \family default
1717 or
1717 or
1718 \family typewriter
1718 \family typewriter
1719 tcsh
1719 tcsh
1720 \family default
1720 \family default
1721 shells, add to your
1721 shells, add to your
1722 \family typewriter
1722 \family typewriter
1723 ~/.cshrc
1723 ~/.cshrc
1724 \family default
1724 \family default
1725 file the lines:
1725 file the lines:
1726 \layout Standard
1726 \layout Standard
1727
1727
1728
1728
1729 \family typewriter
1729 \family typewriter
1730 setenv PAGER less
1730 setenv PAGER less
1731 \newline
1731 \newline
1732 setenv LESS -r
1732 setenv LESS -r
1733 \layout Standard
1733 \layout Standard
1734
1734
1735 There is similar syntax for other Unix shells, look at your system documentation
1735 There is similar syntax for other Unix shells, look at your system documentation
1736 for details.
1736 for details.
1737 \layout Standard
1737 \layout Standard
1738
1738
1739 If you are on a system which lacks proper data pagers (such as Windows),
1739 If you are on a system which lacks proper data pagers (such as Windows),
1740 IPython will use a very limited builtin pager.
1740 IPython will use a very limited builtin pager.
1741 \layout Subsection
1741 \layout Subsection
1742
1742
1743
1743
1744 \begin_inset LatexCommand \label{sec:emacs}
1744 \begin_inset LatexCommand \label{sec:emacs}
1745
1745
1746 \end_inset
1746 \end_inset
1747
1747
1748 (X)Emacs configuration
1748 (X)Emacs configuration
1749 \layout Standard
1749 \layout Standard
1750
1750
1751 Thanks to the work of Alexander Schmolck and Prabhu Ramachandran, currently
1751 Thanks to the work of Alexander Schmolck and Prabhu Ramachandran, currently
1752 (X)Emacs and IPython get along very well.
1752 (X)Emacs and IPython get along very well.
1753
1753
1754 \layout Standard
1754 \layout Standard
1755
1755
1756
1756
1757 \series bold
1757 \series bold
1758 Important note:
1758 Important note:
1759 \series default
1759 \series default
1760 You will need to use a recent enough version of
1760 You will need to use a recent enough version of
1761 \family typewriter
1761 \family typewriter
1762 python-mode.el
1762 python-mode.el
1763 \family default
1763 \family default
1764 , along with the file
1764 , along with the file
1765 \family typewriter
1765 \family typewriter
1766 ipython.el
1766 ipython.el
1767 \family default
1767 \family default
1768 .
1768 .
1769 You can check that the version you have of
1769 You can check that the version you have of
1770 \family typewriter
1770 \family typewriter
1771 python-mode.el
1771 python-mode.el
1772 \family default
1772 \family default
1773 is new enough by either looking at the revision number in the file itself,
1773 is new enough by either looking at the revision number in the file itself,
1774 or asking for it in (X)Emacs via
1774 or asking for it in (X)Emacs via
1775 \family typewriter
1775 \family typewriter
1776 M-x py-version
1776 M-x py-version
1777 \family default
1777 \family default
1778 .
1778 .
1779 Versions 4.68 and newer contain the necessary fixes for proper IPython support.
1779 Versions 4.68 and newer contain the necessary fixes for proper IPython support.
1780 \layout Standard
1780 \layout Standard
1781
1781
1782 The file
1782 The file
1783 \family typewriter
1783 \family typewriter
1784 ipython.el
1784 ipython.el
1785 \family default
1785 \family default
1786 is included with the IPython distribution, in the documentation directory
1786 is included with the IPython distribution, in the documentation directory
1787 (where this manual resides in PDF and HTML formats).
1787 (where this manual resides in PDF and HTML formats).
1788 \layout Standard
1788 \layout Standard
1789
1789
1790 Once you put these files in your Emacs path, all you need in your
1790 Once you put these files in your Emacs path, all you need in your
1791 \family typewriter
1791 \family typewriter
1792 .emacs
1792 .emacs
1793 \family default
1793 \family default
1794 file is:
1794 file is:
1795 \layout Standard
1795 \layout Standard
1796
1796
1797
1797
1798 \family typewriter
1798 \family typewriter
1799 (require 'ipython)
1799 (require 'ipython)
1800 \layout Standard
1800 \layout Standard
1801
1801
1802 This should give you full support for executing code snippets via IPython,
1802 This should give you full support for executing code snippets via IPython,
1803 opening IPython as your Python shell via
1803 opening IPython as your Python shell via
1804 \family typewriter
1804 \family typewriter
1805 C-c\SpecialChar ~
1805 C-c\SpecialChar ~
1806 !
1806 !
1807 \family default
1807 \family default
1808 , etc.
1808 , etc.
1809
1809
1810 \layout Subsubsection*
1810 \layout Subsubsection*
1811
1811
1812 Notes
1812 Notes
1813 \layout Itemize
1813 \layout Itemize
1814
1814
1815 There is one caveat you should be aware of: you must start the IPython shell
1815 There is one caveat you should be aware of: you must start the IPython shell
1816
1816
1817 \emph on
1817 \emph on
1818 before
1818 before
1819 \emph default
1819 \emph default
1820 attempting to execute any code regions via
1820 attempting to execute any code regions via
1821 \family typewriter
1821 \family typewriter
1822 C-c\SpecialChar ~
1822 C-c\SpecialChar ~
1823 |
1823 |
1824 \family default
1824 \family default
1825 .
1825 .
1826 Simply type
1826 Simply type
1827 \family typewriter
1827 \family typewriter
1828 C-c\SpecialChar ~
1828 C-c\SpecialChar ~
1829 !
1829 !
1830 \family default
1830 \family default
1831 to start IPython before passing any code regions to the interpreter, and
1831 to start IPython before passing any code regions to the interpreter, and
1832 you shouldn't experience any problems.
1832 you shouldn't experience any problems.
1833 \newline
1833 \newline
1834 This is due to a bug in Python itself, which has been fixed for Python 2.3,
1834 This is due to a bug in Python itself, which has been fixed for Python 2.3,
1835 but exists as of Python 2.2.2 (reported as SF bug [ 737947 ]).
1835 but exists as of Python 2.2.2 (reported as SF bug [ 737947 ]).
1836 \layout Itemize
1836 \layout Itemize
1837
1837
1838 The (X)Emacs support is maintained by Alexander Schmolck, so all comments/reques
1838 The (X)Emacs support is maintained by Alexander Schmolck, so all comments/reques
1839 ts should be directed to him through the IPython mailing lists.
1839 ts should be directed to him through the IPython mailing lists.
1840
1840
1841 \layout Itemize
1841 \layout Itemize
1842
1842
1843 This code is still somewhat experimental so it's a bit rough around the
1843 This code is still somewhat experimental so it's a bit rough around the
1844 edges (although in practice, it works quite well).
1844 edges (although in practice, it works quite well).
1845 \layout Itemize
1845 \layout Itemize
1846
1846
1847 Be aware that if you customize
1847 Be aware that if you customize
1848 \family typewriter
1848 \family typewriter
1849 py-python-command
1849 py-python-command
1850 \family default
1850 \family default
1851 previously, this value will override what
1851 previously, this value will override what
1852 \family typewriter
1852 \family typewriter
1853 ipython.el
1853 ipython.el
1854 \family default
1854 \family default
1855 does (because loading the customization variables comes later).
1855 does (because loading the customization variables comes later).
1856 \layout Section
1856 \layout Section
1857
1857
1858
1858
1859 \begin_inset LatexCommand \label{sec:quick_tips}
1859 \begin_inset LatexCommand \label{sec:quick_tips}
1860
1860
1861 \end_inset
1861 \end_inset
1862
1862
1863 Quick tips
1863 Quick tips
1864 \layout Standard
1864 \layout Standard
1865
1865
1866 IPython can be used as an improved replacement for the Python prompt, and
1866 IPython can be used as an improved replacement for the Python prompt, and
1867 for that you don't really need to read any more of this manual.
1867 for that you don't really need to read any more of this manual.
1868 But in this section we'll try to summarize a few tips on how to make the
1868 But in this section we'll try to summarize a few tips on how to make the
1869 most effective use of it for everyday Python development, highlighting
1869 most effective use of it for everyday Python development, highlighting
1870 things you might miss in the rest of the manual (which is getting long).
1870 things you might miss in the rest of the manual (which is getting long).
1871 We'll give references to parts in the manual which provide more detail
1871 We'll give references to parts in the manual which provide more detail
1872 when appropriate.
1872 when appropriate.
1873 \layout Standard
1873 \layout Standard
1874
1874
1875 The following article by Jeremy Jones provides an introductory tutorial
1875 The following article by Jeremy Jones provides an introductory tutorial
1876 about IPython:
1876 about IPython:
1877 \newline
1877 \newline
1878
1878
1879 \begin_inset LatexCommand \htmlurl{http://www.onlamp.com/pub/a/python/2005/01/27/ipython.html}
1879 \begin_inset LatexCommand \htmlurl{http://www.onlamp.com/pub/a/python/2005/01/27/ipython.html}
1880
1880
1881 \end_inset
1881 \end_inset
1882
1882
1883
1883
1884 \layout Itemize
1884 \layout Itemize
1885
1885
1886 The TAB key.
1886 The TAB key.
1887 TAB-completion, especially for attributes, is a convenient way to explore
1887 TAB-completion, especially for attributes, is a convenient way to explore
1888 the structure of any object you're dealing with.
1888 the structure of any object you're dealing with.
1889 Simply type
1889 Simply type
1890 \family typewriter
1890 \family typewriter
1891 object_name.<TAB>
1891 object_name.<TAB>
1892 \family default
1892 \family default
1893 and a list of the object's attributes will be printed (see sec.
1893 and a list of the object's attributes will be printed (see sec.
1894
1894
1895 \begin_inset LatexCommand \ref{sec:readline}
1895 \begin_inset LatexCommand \ref{sec:readline}
1896
1896
1897 \end_inset
1897 \end_inset
1898
1898
1899 for more).
1899 for more).
1900 Tab completion also works on file and directory names, which combined with
1900 Tab completion also works on file and directory names, which combined with
1901 IPython's alias system allows you to do from within IPython many of the
1901 IPython's alias system allows you to do from within IPython many of the
1902 things you normally would need the system shell for.
1902 things you normally would need the system shell for.
1903
1903
1904 \layout Itemize
1904 \layout Itemize
1905
1905
1906 Explore your objects.
1906 Explore your objects.
1907 Typing
1907 Typing
1908 \family typewriter
1908 \family typewriter
1909 object_name?
1909 object_name?
1910 \family default
1910 \family default
1911 will print all sorts of details about any object, including docstrings,
1911 will print all sorts of details about any object, including docstrings,
1912 function definition lines (for call arguments) and constructor details
1912 function definition lines (for call arguments) and constructor details
1913 for classes.
1913 for classes.
1914 The magic commands
1914 The magic commands
1915 \family typewriter
1915 \family typewriter
1916 %pdoc
1916 %pdoc
1917 \family default
1917 \family default
1918 ,
1918 ,
1919 \family typewriter
1919 \family typewriter
1920 %pdef
1920 %pdef
1921 \family default
1921 \family default
1922 ,
1922 ,
1923 \family typewriter
1923 \family typewriter
1924 %psource
1924 %psource
1925 \family default
1925 \family default
1926 and
1926 and
1927 \family typewriter
1927 \family typewriter
1928 %pfile
1928 %pfile
1929 \family default
1929 \family default
1930 will respectively print the docstring, function definition line, full source
1930 will respectively print the docstring, function definition line, full source
1931 code and the complete file for any object (when they can be found).
1931 code and the complete file for any object (when they can be found).
1932 If automagic is on (it is by default), you don't need to type the '
1932 If automagic is on (it is by default), you don't need to type the '
1933 \family typewriter
1933 \family typewriter
1934 %
1934 %
1935 \family default
1935 \family default
1936 ' explicitly.
1936 ' explicitly.
1937 See sec.
1937 See sec.
1938
1938
1939 \begin_inset LatexCommand \ref{sec:dyn-object-info}
1939 \begin_inset LatexCommand \ref{sec:dyn-object-info}
1940
1940
1941 \end_inset
1941 \end_inset
1942
1942
1943 for more.
1943 for more.
1944 \layout Itemize
1944 \layout Itemize
1945
1945
1946 The
1946 The
1947 \family typewriter
1947 \family typewriter
1948 %run
1948 %run
1949 \family default
1949 \family default
1950 magic command allows you to run any python script and load all of its data
1950 magic command allows you to run any python script and load all of its data
1951 directly into the interactive namespace.
1951 directly into the interactive namespace.
1952 Since the file is re-read from disk each time, changes you make to it are
1952 Since the file is re-read from disk each time, changes you make to it are
1953 reflected immediately (in contrast to the behavior of
1953 reflected immediately (in contrast to the behavior of
1954 \family typewriter
1954 \family typewriter
1955 import
1955 import
1956 \family default
1956 \family default
1957 ).
1957 ).
1958 I rarely use
1958 I rarely use
1959 \family typewriter
1959 \family typewriter
1960 import
1960 import
1961 \family default
1961 \family default
1962 for code I am testing, relying on
1962 for code I am testing, relying on
1963 \family typewriter
1963 \family typewriter
1964 %run
1964 %run
1965 \family default
1965 \family default
1966 instead.
1966 instead.
1967 See sec.
1967 See sec.
1968
1968
1969 \begin_inset LatexCommand \ref{sec:magic}
1969 \begin_inset LatexCommand \ref{sec:magic}
1970
1970
1971 \end_inset
1971 \end_inset
1972
1972
1973 for more on this and other magic commands, or type the name of any magic
1973 for more on this and other magic commands, or type the name of any magic
1974 command and ? to get details on it.
1974 command and ? to get details on it.
1975 See also sec.
1975 See also sec.
1976
1976
1977 \begin_inset LatexCommand \ref{sec:dreload}
1977 \begin_inset LatexCommand \ref{sec:dreload}
1978
1978
1979 \end_inset
1979 \end_inset
1980
1980
1981 for a recursive reload command.
1981 for a recursive reload command.
1982 \newline
1982 \newline
1983
1983
1984 \family typewriter
1984 \family typewriter
1985 %run
1985 %run
1986 \family default
1986 \family default
1987 also has special flags for timing the execution of your scripts (
1987 also has special flags for timing the execution of your scripts (
1988 \family typewriter
1988 \family typewriter
1989 -t
1989 -t
1990 \family default
1990 \family default
1991 ) and for executing them under the control of either Python's
1991 ) and for executing them under the control of either Python's
1992 \family typewriter
1992 \family typewriter
1993 pdb
1993 pdb
1994 \family default
1994 \family default
1995 debugger (
1995 debugger (
1996 \family typewriter
1996 \family typewriter
1997 -d
1997 -d
1998 \family default
1998 \family default
1999 ) or profiler (
1999 ) or profiler (
2000 \family typewriter
2000 \family typewriter
2001 -p
2001 -p
2002 \family default
2002 \family default
2003 ).
2003 ).
2004 With all of these,
2004 With all of these,
2005 \family typewriter
2005 \family typewriter
2006 %run
2006 %run
2007 \family default
2007 \family default
2008 can be used as the main tool for efficient interactive development of code
2008 can be used as the main tool for efficient interactive development of code
2009 which you write in your editor of choice.
2009 which you write in your editor of choice.
2010 \layout Itemize
2010 \layout Itemize
2011
2011
2012 Use the Python debugger,
2012 Use the Python debugger,
2013 \family typewriter
2013 \family typewriter
2014 pdb
2014 pdb
2015 \family default
2015 \family default
2016
2016
2017 \begin_inset Foot
2017 \begin_inset Foot
2018 collapsed true
2018 collapsed true
2019
2019
2020 \layout Standard
2020 \layout Standard
2021
2021
2022 Thanks to Christian Hart and Matthew Arnison for the suggestions leading
2022 Thanks to Christian Hart and Matthew Arnison for the suggestions leading
2023 to IPython's improved debugger and profiler support.
2023 to IPython's improved debugger and profiler support.
2024 \end_inset
2024 \end_inset
2025
2025
2026 .
2026 .
2027 The
2027 The
2028 \family typewriter
2028 \family typewriter
2029 %pdb
2029 %pdb
2030 \family default
2030 \family default
2031 command allows you to toggle on and off the automatic invocation of the
2031 command allows you to toggle on and off the automatic invocation of the
2032 pdb debugger at any uncaught exception.
2032 pdb debugger at any uncaught exception.
2033 The advantage of this is that pdb starts
2033 The advantage of this is that pdb starts
2034 \emph on
2034 \emph on
2035 inside
2035 inside
2036 \emph default
2036 \emph default
2037 the function where the exception occurred, with all data still available.
2037 the function where the exception occurred, with all data still available.
2038 You can print variables, see code, execute statements and even walk up
2038 You can print variables, see code, execute statements and even walk up
2039 and down the call stack to track down the true source of the problem (which
2039 and down the call stack to track down the true source of the problem (which
2040 often is many layers in the stack above where the exception gets triggered).
2040 often is many layers in the stack above where the exception gets triggered).
2041 \newline
2041 \newline
2042 Running programs with
2042 Running programs with
2043 \family typewriter
2043 \family typewriter
2044 %run
2044 %run
2045 \family default
2045 \family default
2046 and pdb active can be an efficient to develop and debug code, in many cases
2046 and pdb active can be an efficient to develop and debug code, in many cases
2047 eliminating the need for
2047 eliminating the need for
2048 \family typewriter
2048 \family typewriter
2049 print
2049 print
2050 \family default
2050 \family default
2051 statements or external debugging tools.
2051 statements or external debugging tools.
2052 I often simply put a
2052 I often simply put a
2053 \family typewriter
2053 \family typewriter
2054 1/0
2054 1/0
2055 \family default
2055 \family default
2056 in a place where I want to take a look so that pdb gets called, quickly
2056 in a place where I want to take a look so that pdb gets called, quickly
2057 view whatever variables I need to or test various pieces of code and then
2057 view whatever variables I need to or test various pieces of code and then
2058 remove the
2058 remove the
2059 \family typewriter
2059 \family typewriter
2060 1/0
2060 1/0
2061 \family default
2061 \family default
2062 .
2062 .
2063 \newline
2063 \newline
2064 Note also that `
2064 Note also that `
2065 \family typewriter
2065 \family typewriter
2066 %run -d
2066 %run -d
2067 \family default
2067 \family default
2068 ' activates
2068 ' activates
2069 \family typewriter
2069 \family typewriter
2070 pdb
2070 pdb
2071 \family default
2071 \family default
2072 and automatically sets initial breakpoints for you to step through your
2072 and automatically sets initial breakpoints for you to step through your
2073 code, watch variables, etc.
2073 code, watch variables, etc.
2074 See Sec.\SpecialChar ~
2074 See Sec.\SpecialChar ~
2075
2075
2076 \begin_inset LatexCommand \ref{sec:cache_output}
2076 \begin_inset LatexCommand \ref{sec:cache_output}
2077
2077
2078 \end_inset
2078 \end_inset
2079
2079
2080 for details.
2080 for details.
2081 \layout Itemize
2081 \layout Itemize
2082
2082
2083 Use the output cache.
2083 Use the output cache.
2084 All output results are automatically stored in a global dictionary named
2084 All output results are automatically stored in a global dictionary named
2085
2085
2086 \family typewriter
2086 \family typewriter
2087 Out
2087 Out
2088 \family default
2088 \family default
2089 and variables named
2089 and variables named
2090 \family typewriter
2090 \family typewriter
2091 _1
2091 _1
2092 \family default
2092 \family default
2093 ,
2093 ,
2094 \family typewriter
2094 \family typewriter
2095 _2
2095 _2
2096 \family default
2096 \family default
2097 , etc.
2097 , etc.
2098 alias them.
2098 alias them.
2099 For example, the result of input line 4 is available either as
2099 For example, the result of input line 4 is available either as
2100 \family typewriter
2100 \family typewriter
2101 Out[4]
2101 Out[4]
2102 \family default
2102 \family default
2103 or as
2103 or as
2104 \family typewriter
2104 \family typewriter
2105 _4
2105 _4
2106 \family default
2106 \family default
2107 .
2107 .
2108 Additionally, three variables named
2108 Additionally, three variables named
2109 \family typewriter
2109 \family typewriter
2110 _
2110 _
2111 \family default
2111 \family default
2112 ,
2112 ,
2113 \family typewriter
2113 \family typewriter
2114 __
2114 __
2115 \family default
2115 \family default
2116 and
2116 and
2117 \family typewriter
2117 \family typewriter
2118 ___
2118 ___
2119 \family default
2119 \family default
2120 are always kept updated with the for the last three results.
2120 are always kept updated with the for the last three results.
2121 This allows you to recall any previous result and further use it for new
2121 This allows you to recall any previous result and further use it for new
2122 calculations.
2122 calculations.
2123 See Sec.\SpecialChar ~
2123 See Sec.\SpecialChar ~
2124
2124
2125 \begin_inset LatexCommand \ref{sec:cache_output}
2125 \begin_inset LatexCommand \ref{sec:cache_output}
2126
2126
2127 \end_inset
2127 \end_inset
2128
2128
2129 for more.
2129 for more.
2130 \layout Itemize
2130 \layout Itemize
2131
2131
2132 Put a '
2132 Put a '
2133 \family typewriter
2133 \family typewriter
2134 ;
2134 ;
2135 \family default
2135 \family default
2136 ' at the end of a line to supress the printing of output.
2136 ' at the end of a line to supress the printing of output.
2137 This is useful when doing calculations which generate long output you are
2137 This is useful when doing calculations which generate long output you are
2138 not interested in seeing.
2138 not interested in seeing.
2139 The
2139 The
2140 \family typewriter
2140 \family typewriter
2141 _*
2141 _*
2142 \family default
2142 \family default
2143 variables and the
2143 variables and the
2144 \family typewriter
2144 \family typewriter
2145 Out[]
2145 Out[]
2146 \family default
2146 \family default
2147 list do get updated with the contents of the output, even if it is not
2147 list do get updated with the contents of the output, even if it is not
2148 printed.
2148 printed.
2149 You can thus still access the generated results this way for further processing.
2149 You can thus still access the generated results this way for further processing.
2150 \layout Itemize
2150 \layout Itemize
2151
2151
2152 A similar system exists for caching input.
2152 A similar system exists for caching input.
2153 All input is stored in a global list called
2153 All input is stored in a global list called
2154 \family typewriter
2154 \family typewriter
2155 In
2155 In
2156 \family default
2156 \family default
2157 , so you can re-execute lines 22 through 28 plus line 34 by typing
2157 , so you can re-execute lines 22 through 28 plus line 34 by typing
2158 \family typewriter
2158 \family typewriter
2159 'exec In[22:29]+In[34]'
2159 'exec In[22:29]+In[34]'
2160 \family default
2160 \family default
2161 (using Python slicing notation).
2161 (using Python slicing notation).
2162 If you need to execute the same set of lines often, you can assign them
2162 If you need to execute the same set of lines often, you can assign them
2163 to a macro with the
2163 to a macro with the
2164 \family typewriter
2164 \family typewriter
2165 %macro
2165 %macro
2166 \family default
2166 \family default
2167
2167
2168 \family typewriter
2168 \family typewriter
2169 function.
2169 function.
2170
2170
2171 \family default
2171 \family default
2172 See sec.
2172 See sec.
2173
2173
2174 \begin_inset LatexCommand \ref{sec:cache_input}
2174 \begin_inset LatexCommand \ref{sec:cache_input}
2175
2175
2176 \end_inset
2176 \end_inset
2177
2177
2178 for more.
2178 for more.
2179 \layout Itemize
2179 \layout Itemize
2180
2180
2181 Use your input history.
2181 Use your input history.
2182 The
2182 The
2183 \family typewriter
2183 \family typewriter
2184 %hist
2184 %hist
2185 \family default
2185 \family default
2186 command can show you all previous input, without line numbers if desired
2186 command can show you all previous input, without line numbers if desired
2187 (option
2187 (option
2188 \family typewriter
2188 \family typewriter
2189 -n
2189 -n
2190 \family default
2190 \family default
2191 ) so you can directly copy and paste code either back in IPython or in a
2191 ) so you can directly copy and paste code either back in IPython or in a
2192 text editor.
2192 text editor.
2193 You can also save all your history by turning on logging via
2193 You can also save all your history by turning on logging via
2194 \family typewriter
2194 \family typewriter
2195 %logstart
2195 %logstart
2196 \family default
2196 \family default
2197 ; these logs can later be either reloaded as IPython sessions or used as
2197 ; these logs can later be either reloaded as IPython sessions or used as
2198 code for your programs.
2198 code for your programs.
2199 \layout Itemize
2199 \layout Itemize
2200
2200
2201 Define your own macros with
2201 Define your own macros with
2202 \family typewriter
2202 \family typewriter
2203 %macro
2203 %macro
2204 \family default
2204 \family default
2205 .
2205 .
2206 This can be useful for automating sequences of expressions when working
2206 This can be useful for automating sequences of expressions when working
2207 interactively.
2207 interactively.
2208 \layout Itemize
2208 \layout Itemize
2209
2209
2210 Define your own system aliases.
2210 Define your own system aliases.
2211 Even though IPython gives you access to your system shell via the
2211 Even though IPython gives you access to your system shell via the
2212 \family typewriter
2212 \family typewriter
2213 !
2213 !
2214 \family default
2214 \family default
2215 prefix, it is convenient to have aliases to the system commands you use
2215 prefix, it is convenient to have aliases to the system commands you use
2216 most often.
2216 most often.
2217 This allows you to work seamlessly from inside IPython with the same commands
2217 This allows you to work seamlessly from inside IPython with the same commands
2218 you are used to in your system shell.
2218 you are used to in your system shell.
2219 \newline
2219 \newline
2220 IPython comes with some pre-defined aliases and a complete system for changing
2220 IPython comes with some pre-defined aliases and a complete system for changing
2221 directories, both via a stack (see
2221 directories, both via a stack (see
2222 \family typewriter
2222 \family typewriter
2223 %pushd
2223 %pushd
2224 \family default
2224 \family default
2225 ,
2225 ,
2226 \family typewriter
2226 \family typewriter
2227 %popd
2227 %popd
2228 \family default
2228 \family default
2229 and
2229 and
2230 \family typewriter
2230 \family typewriter
2231 %ds
2231 %ds
2232 \family default
2232 \family default
2233 ) and via direct
2233 ) and via direct
2234 \family typewriter
2234 \family typewriter
2235 %cd
2235 %cd
2236 \family default
2236 \family default
2237 .
2237 .
2238 The latter keeps a history of visited directories and allows you to go
2238 The latter keeps a history of visited directories and allows you to go
2239 to any previously visited one.
2239 to any previously visited one.
2240 \layout Itemize
2240 \layout Itemize
2241
2241
2242 Use Python to manipulate the results of system commands.
2242 Use Python to manipulate the results of system commands.
2243 The `
2243 The `
2244 \family typewriter
2244 \family typewriter
2245 !!
2245 !!
2246 \family default
2246 \family default
2247 ' special syntax, and the
2247 ' special syntax, and the
2248 \family typewriter
2248 \family typewriter
2249 %sc
2249 %sc
2250 \family default
2250 \family default
2251 and
2251 and
2252 \family typewriter
2252 \family typewriter
2253 %sx
2253 %sx
2254 \family default
2254 \family default
2255 magic commands allow you to capture system output into Python variables.
2255 magic commands allow you to capture system output into Python variables.
2256 \layout Itemize
2256 \layout Itemize
2257
2257
2258 Expand python variables when calling the shell (either via
2258 Expand python variables when calling the shell (either via
2259 \family typewriter
2259 \family typewriter
2260 `!'
2260 `!'
2261 \family default
2261 \family default
2262 and
2262 and
2263 \family typewriter
2263 \family typewriter
2264 `!!'
2264 `!!'
2265 \family default
2265 \family default
2266 or via aliases) by prepending a
2266 or via aliases) by prepending a
2267 \family typewriter
2267 \family typewriter
2268 $
2268 $
2269 \family default
2269 \family default
2270 in front of them.
2270 in front of them.
2271 You can also expand complete python expressions.
2271 You can also expand complete python expressions.
2272 See sec.\SpecialChar ~
2272 See sec.\SpecialChar ~
2273
2273
2274 \begin_inset LatexCommand \ref{sub:System-shell-access}
2274 \begin_inset LatexCommand \ref{sub:System-shell-access}
2275
2275
2276 \end_inset
2276 \end_inset
2277
2277
2278 for more.
2278 for more.
2279 \layout Itemize
2279 \layout Itemize
2280
2280
2281 Use profiles to maintain different configurations (modules to load, function
2281 Use profiles to maintain different configurations (modules to load, function
2282 definitions, option settings) for particular tasks.
2282 definitions, option settings) for particular tasks.
2283 You can then have customized versions of IPython for specific purposes.
2283 You can then have customized versions of IPython for specific purposes.
2284 See sec.\SpecialChar ~
2284 See sec.\SpecialChar ~
2285
2285
2286 \begin_inset LatexCommand \ref{sec:profiles}
2286 \begin_inset LatexCommand \ref{sec:profiles}
2287
2287
2288 \end_inset
2288 \end_inset
2289
2289
2290 for more.
2290 for more.
2291 \layout Itemize
2291 \layout Itemize
2292
2292
2293 Embed IPython in your programs.
2293 Embed IPython in your programs.
2294 A few lines of code are enough to load a complete IPython inside your own
2294 A few lines of code are enough to load a complete IPython inside your own
2295 programs, giving you the ability to work with your data interactively after
2295 programs, giving you the ability to work with your data interactively after
2296 automatic processing has been completed.
2296 automatic processing has been completed.
2297 See sec.\SpecialChar ~
2297 See sec.\SpecialChar ~
2298
2298
2299 \begin_inset LatexCommand \ref{sec:embed}
2299 \begin_inset LatexCommand \ref{sec:embed}
2300
2300
2301 \end_inset
2301 \end_inset
2302
2302
2303 for more.
2303 for more.
2304 \layout Itemize
2304 \layout Itemize
2305
2305
2306 Use the Python profiler.
2306 Use the Python profiler.
2307 When dealing with performance issues, the
2307 When dealing with performance issues, the
2308 \family typewriter
2308 \family typewriter
2309 %run
2309 %run
2310 \family default
2310 \family default
2311 command with a
2311 command with a
2312 \family typewriter
2312 \family typewriter
2313 -p
2313 -p
2314 \family default
2314 \family default
2315 option allows you to run complete programs under the control of the Python
2315 option allows you to run complete programs under the control of the Python
2316 profiler.
2316 profiler.
2317 The
2317 The
2318 \family typewriter
2318 \family typewriter
2319 %prun
2319 %prun
2320 \family default
2320 \family default
2321 command does a similar job for single Python expressions (like function
2321 command does a similar job for single Python expressions (like function
2322 calls).
2322 calls).
2323 \layout Itemize
2323 \layout Itemize
2324
2324
2325 Use
2325 Use
2326 \family typewriter
2326 \family typewriter
2327 %edit
2327 %edit
2328 \family default
2328 \family default
2329 to have almost multiline editing.
2329 to have almost multiline editing.
2330 While IPython doesn't support true multiline editing, this command allows
2330 While IPython doesn't support true multiline editing, this command allows
2331 you to call an editor on the spot, and IPython will execute the code you
2331 you to call an editor on the spot, and IPython will execute the code you
2332 type in there as if it were typed interactively.
2332 type in there as if it were typed interactively.
2333 \layout Itemize
2333 \layout Itemize
2334
2334
2335 Use the IPython.demo.Demo class to load any Python script as an interactive
2335 Use the IPython.demo.Demo class to load any Python script as an interactive
2336 demo.
2336 demo.
2337 With a minimal amount of simple markup, you can control the execution of
2337 With a minimal amount of simple markup, you can control the execution of
2338 the script, stopping as needed.
2338 the script, stopping as needed.
2339 See sec.\SpecialChar ~
2339 See sec.\SpecialChar ~
2340
2340
2341 \begin_inset LatexCommand \ref{sec:interactive-demos}
2341 \begin_inset LatexCommand \ref{sec:interactive-demos}
2342
2342
2343 \end_inset
2343 \end_inset
2344
2344
2345 for more.
2345 for more.
2346 \layout Standard
2346 \layout Standard
2347
2347
2348 If you have your own favorite tip on using IPython efficiently for a certain
2348 If you have your own favorite tip on using IPython efficiently for a certain
2349 task (especially things which can't be done in the normal Python interpreter),
2349 task (especially things which can't be done in the normal Python interpreter),
2350 don't hesitate to send it!
2350 don't hesitate to send it!
2351 \layout Section
2351 \layout Section
2352
2352
2353 Command-line use
2353 Command-line use
2354 \layout Standard
2354 \layout Standard
2355
2355
2356 You start IPython with the command:
2356 You start IPython with the command:
2357 \layout Standard
2357 \layout Standard
2358
2358
2359
2359
2360 \family typewriter
2360 \family typewriter
2361 $ ipython [options] files
2361 $ ipython [options] files
2362 \layout Standard
2362 \layout Standard
2363
2363
2364 If invoked with no options, it executes all the files listed in sequence
2364 If invoked with no options, it executes all the files listed in sequence
2365 and drops you into the interpreter while still acknowledging any options
2365 and drops you into the interpreter while still acknowledging any options
2366 you may have set in your ipythonrc file.
2366 you may have set in your ipythonrc file.
2367 This behavior is different from standard Python, which when called as
2367 This behavior is different from standard Python, which when called as
2368 \family typewriter
2368 \family typewriter
2369 python -i
2369 python -i
2370 \family default
2370 \family default
2371 will only execute one file and ignore your configuration setup.
2371 will only execute one file and ignore your configuration setup.
2372 \layout Standard
2372 \layout Standard
2373
2373
2374 Please note that some of the configuration options are not available at
2374 Please note that some of the configuration options are not available at
2375 the command line, simply because they are not practical here.
2375 the command line, simply because they are not practical here.
2376 Look into your ipythonrc configuration file for details on those.
2376 Look into your ipythonrc configuration file for details on those.
2377 This file typically installed in the
2377 This file typically installed in the
2378 \family typewriter
2378 \family typewriter
2379 $HOME/.ipython
2379 $HOME/.ipython
2380 \family default
2380 \family default
2381 directory.
2381 directory.
2382 For Windows users,
2382 For Windows users,
2383 \family typewriter
2383 \family typewriter
2384 $HOME
2384 $HOME
2385 \family default
2385 \family default
2386 resolves to
2386 resolves to
2387 \family typewriter
2387 \family typewriter
2388 C:
2388 C:
2389 \backslash
2389 \backslash
2390
2390
2391 \backslash
2391 \backslash
2392 Documents and Settings
2392 Documents and Settings
2393 \backslash
2393 \backslash
2394
2394
2395 \backslash
2395 \backslash
2396 YourUserName
2396 YourUserName
2397 \family default
2397 \family default
2398 in most instances.
2398 in most instances.
2399 In the rest of this text, we will refer to this directory as
2399 In the rest of this text, we will refer to this directory as
2400 \family typewriter
2400 \family typewriter
2401 IPYTHONDIR
2401 IPYTHONDIR
2402 \family default
2402 \family default
2403 .
2403 .
2404 \layout Subsection
2404 \layout Subsection
2405
2405
2406
2406
2407 \begin_inset LatexCommand \label{sec:threading-opts}
2407 \begin_inset LatexCommand \label{sec:threading-opts}
2408
2408
2409 \end_inset
2409 \end_inset
2410
2410
2411 Special Threading Options
2411 Special Threading Options
2412 \layout Standard
2412 \layout Standard
2413
2413
2414 The following special options are ONLY valid at the beginning of the command
2414 The following special options are ONLY valid at the beginning of the command
2415 line, and not later.
2415 line, and not later.
2416 This is because they control the initial- ization of ipython itself, before
2416 This is because they control the initial- ization of ipython itself, before
2417 the normal option-handling mechanism is active.
2417 the normal option-handling mechanism is active.
2418 \layout List
2418 \layout List
2419 \labelwidthstring 00.00.0000
2419 \labelwidthstring 00.00.0000
2420
2420
2421
2421
2422 \family typewriter
2422 \family typewriter
2423 \series bold
2423 \series bold
2424 -gthread,\SpecialChar ~
2424 -gthread,\SpecialChar ~
2425 -qthread,\SpecialChar ~
2425 -qthread,\SpecialChar ~
2426 -wthread,\SpecialChar ~
2426 -wthread,\SpecialChar ~
2427 -pylab:
2427 -pylab:
2428 \family default
2428 \family default
2429 \series default
2429 \series default
2430 Only
2430 Only
2431 \emph on
2431 \emph on
2432 one
2432 one
2433 \emph default
2433 \emph default
2434 of these can be given, and it can only be given as the first option passed
2434 of these can be given, and it can only be given as the first option passed
2435 to IPython (it will have no effect in any other position).
2435 to IPython (it will have no effect in any other position).
2436 They provide threading support for the GTK Qt and WXPython toolkits, and
2436 They provide threading support for the GTK Qt and WXPython toolkits, and
2437 for the matplotlib library.
2437 for the matplotlib library.
2438 \layout List
2438 \layout List
2439 \labelwidthstring 00.00.0000
2439 \labelwidthstring 00.00.0000
2440
2440
2441 \SpecialChar ~
2441 \SpecialChar ~
2442 With any of the first three options, IPython starts running a separate
2442 With any of the first three options, IPython starts running a separate
2443 thread for the graphical toolkit's operation, so that you can open and
2443 thread for the graphical toolkit's operation, so that you can open and
2444 control graphical elements from within an IPython command line, without
2444 control graphical elements from within an IPython command line, without
2445 blocking.
2445 blocking.
2446 All three provide essentially the same functionality, respectively for
2446 All three provide essentially the same functionality, respectively for
2447 GTK, QT and WXWidgets (via their Python interfaces).
2447 GTK, QT and WXWidgets (via their Python interfaces).
2448 \layout List
2448 \layout List
2449 \labelwidthstring 00.00.0000
2449 \labelwidthstring 00.00.0000
2450
2450
2451 \SpecialChar ~
2451 \SpecialChar ~
2452 If
2452 If
2453 \family typewriter
2453 \family typewriter
2454 -pylab
2454 -pylab
2455 \family default
2455 \family default
2456 is given, IPython loads special support for the mat plotlib library (
2456 is given, IPython loads special support for the mat plotlib library (
2457 \begin_inset LatexCommand \htmlurl{http://matplotlib.sourceforge.net}
2457 \begin_inset LatexCommand \htmlurl{http://matplotlib.sourceforge.net}
2458
2458
2459 \end_inset
2459 \end_inset
2460
2460
2461 ), allowing interactive usage of any of its backends as defined in the user's
2461 ), allowing interactive usage of any of its backends as defined in the user's
2462
2462
2463 \family typewriter
2463 \family typewriter
2464 ~/.matplotlib/matplotlibrc
2464 ~/.matplotlib/matplotlibrc
2465 \family default
2465 \family default
2466 file.
2466 file.
2467 It automatically activates GTK, Qt or WX threading for IPyhton if the choice
2467 It automatically activates GTK, Qt or WX threading for IPyhton if the choice
2468 of matplotlib backend requires it.
2468 of matplotlib backend requires it.
2469 It also modifies the
2469 It also modifies the
2470 \family typewriter
2470 \family typewriter
2471 %run
2471 %run
2472 \family default
2472 \family default
2473 command to correctly execute (without blocking) any matplotlib-based script
2473 command to correctly execute (without blocking) any matplotlib-based script
2474 which calls
2474 which calls
2475 \family typewriter
2475 \family typewriter
2476 show()
2476 show()
2477 \family default
2477 \family default
2478 at the end.
2478 at the end.
2479
2479
2480 \layout List
2480 \layout List
2481 \labelwidthstring 00.00.0000
2481 \labelwidthstring 00.00.0000
2482
2482
2483
2483
2484 \family typewriter
2484 \family typewriter
2485 \series bold
2485 \series bold
2486 -tk
2486 -tk
2487 \family default
2487 \family default
2488 \series default
2488 \series default
2489 The
2489 The
2490 \family typewriter
2490 \family typewriter
2491 -g/q/wthread
2491 -g/q/wthread
2492 \family default
2492 \family default
2493 options, and
2493 options, and
2494 \family typewriter
2494 \family typewriter
2495 -pylab
2495 -pylab
2496 \family default
2496 \family default
2497 (if matplotlib is configured to use GTK, Qt or WX), will normally block
2497 (if matplotlib is configured to use GTK, Qt or WX), will normally block
2498 Tk graphical interfaces.
2498 Tk graphical interfaces.
2499 This means that when either GTK, Qt or WX threading is active, any attempt
2499 This means that when either GTK, Qt or WX threading is active, any attempt
2500 to open a Tk GUI will result in a dead window, and possibly cause the Python
2500 to open a Tk GUI will result in a dead window, and possibly cause the Python
2501 interpreter to crash.
2501 interpreter to crash.
2502 An extra option,
2502 An extra option,
2503 \family typewriter
2503 \family typewriter
2504 -tk
2504 -tk
2505 \family default
2505 \family default
2506 , is available to address this issue.
2506 , is available to address this issue.
2507 It can
2507 It can
2508 \emph on
2508 \emph on
2509 only
2509 only
2510 \emph default
2510 \emph default
2511 be given as a
2511 be given as a
2512 \emph on
2512 \emph on
2513 second
2513 second
2514 \emph default
2514 \emph default
2515 option after any of the above (
2515 option after any of the above (
2516 \family typewriter
2516 \family typewriter
2517 -gthread
2517 -gthread
2518 \family default
2518 \family default
2519 ,
2519 ,
2520 \family typewriter
2520 \family typewriter
2521 -wthread
2521 -wthread
2522 \family default
2522 \family default
2523 or
2523 or
2524 \family typewriter
2524 \family typewriter
2525 -pylab
2525 -pylab
2526 \family default
2526 \family default
2527 ).
2527 ).
2528 \layout List
2528 \layout List
2529 \labelwidthstring 00.00.0000
2529 \labelwidthstring 00.00.0000
2530
2530
2531 \SpecialChar ~
2531 \SpecialChar ~
2532 If
2532 If
2533 \family typewriter
2533 \family typewriter
2534 -tk
2534 -tk
2535 \family default
2535 \family default
2536 is given, IPython will try to coordinate Tk threading with GTK, Qt or WX.
2536 is given, IPython will try to coordinate Tk threading with GTK, Qt or WX.
2537 This is however potentially unreliable, and you will have to test on your
2537 This is however potentially unreliable, and you will have to test on your
2538 platform and Python configuration to determine whether it works for you.
2538 platform and Python configuration to determine whether it works for you.
2539 Debian users have reported success, apparently due to the fact that Debian
2539 Debian users have reported success, apparently due to the fact that Debian
2540 builds all of Tcl, Tk, Tkinter and Python with pthreads support.
2540 builds all of Tcl, Tk, Tkinter and Python with pthreads support.
2541 Under other Linux environments (such as Fedora Core 2/3), this option has
2541 Under other Linux environments (such as Fedora Core 2/3), this option has
2542 caused random crashes and lockups of the Python interpreter.
2542 caused random crashes and lockups of the Python interpreter.
2543 Under other operating systems (Mac OSX and Windows), you'll need to try
2543 Under other operating systems (Mac OSX and Windows), you'll need to try
2544 it to find out, since currently no user reports are available.
2544 it to find out, since currently no user reports are available.
2545 \layout List
2545 \layout List
2546 \labelwidthstring 00.00.0000
2546 \labelwidthstring 00.00.0000
2547
2547
2548 \SpecialChar ~
2548 \SpecialChar ~
2549 There is unfortunately no way for IPython to determine at run time whether
2549 There is unfortunately no way for IPython to determine at run time whether
2550
2550
2551 \family typewriter
2551 \family typewriter
2552 -tk
2552 -tk
2553 \family default
2553 \family default
2554 will work reliably or not, so you will need to do some experiments before
2554 will work reliably or not, so you will need to do some experiments before
2555 relying on it for regular work.
2555 relying on it for regular work.
2556
2556
2557 \layout Subsection
2557 \layout Subsection
2558
2558
2559
2559
2560 \begin_inset LatexCommand \label{sec:cmd-line-opts}
2560 \begin_inset LatexCommand \label{sec:cmd-line-opts}
2561
2561
2562 \end_inset
2562 \end_inset
2563
2563
2564 Regular Options
2564 Regular Options
2565 \layout Standard
2565 \layout Standard
2566
2566
2567 After the above threading options have been given, regular options can follow
2567 After the above threading options have been given, regular options can follow
2568 in any order.
2568 in any order.
2569 All options can be abbreviated to their shortest non-ambiguous form and
2569 All options can be abbreviated to their shortest non-ambiguous form and
2570 are case-sensitive.
2570 are case-sensitive.
2571 One or two dashes can be used.
2571 One or two dashes can be used.
2572 Some options have an alternate short form, indicated after a
2572 Some options have an alternate short form, indicated after a
2573 \family typewriter
2573 \family typewriter
2574 |
2574 |
2575 \family default
2575 \family default
2576 .
2576 .
2577 \layout Standard
2577 \layout Standard
2578
2578
2579 Most options can also be set from your ipythonrc configuration file.
2579 Most options can also be set from your ipythonrc configuration file.
2580 See the provided example for more details on what the options do.
2580 See the provided example for more details on what the options do.
2581 Options given at the command line override the values set in the ipythonrc
2581 Options given at the command line override the values set in the ipythonrc
2582 file.
2582 file.
2583 \layout Standard
2583 \layout Standard
2584
2584
2585 All options with a
2585 All options with a
2586 \family typewriter
2586 \family typewriter
2587 no|
2587 no|
2588 \family default
2588 \family default
2589 prepended can be specified in 'no' form (
2589 prepended can be specified in 'no' form (
2590 \family typewriter
2590 \family typewriter
2591 -nooption
2591 -nooption
2592 \family default
2592 \family default
2593 instead of
2593 instead of
2594 \family typewriter
2594 \family typewriter
2595 -option
2595 -option
2596 \family default
2596 \family default
2597 ) to turn the feature off.
2597 ) to turn the feature off.
2598 \layout List
2598 \layout List
2599 \labelwidthstring 00.00.0000
2599 \labelwidthstring 00.00.0000
2600
2600
2601
2601
2602 \family typewriter
2602 \family typewriter
2603 \series bold
2603 \series bold
2604 -help
2604 -help
2605 \family default
2605 \family default
2606 \series default
2606 \series default
2607 : print a help message and exit.
2607 : print a help message and exit.
2608 \layout List
2608 \layout List
2609 \labelwidthstring 00.00.0000
2609 \labelwidthstring 00.00.0000
2610
2610
2611
2611
2612 \family typewriter
2612 \family typewriter
2613 \series bold
2613 \series bold
2614 -pylab:
2614 -pylab:
2615 \family default
2615 \family default
2616 \series default
2616 \series default
2617 this can
2617 this can
2618 \emph on
2618 \emph on
2619 only
2619 only
2620 \emph default
2620 \emph default
2621 be given as the
2621 be given as the
2622 \emph on
2622 \emph on
2623 first
2623 first
2624 \emph default
2624 \emph default
2625 option passed to IPython (it will have no effect in any other position).
2625 option passed to IPython (it will have no effect in any other position).
2626 It adds special support for the matplotlib library (
2626 It adds special support for the matplotlib library (
2627 \begin_inset LatexCommand \htmlurl[http://matplotlib.sourceforge.net]{http://matplotlib.sourceforge.net}
2627 \begin_inset LatexCommand \htmlurl[http://matplotlib.sourceforge.net]{http://matplotlib.sourceforge.net}
2628
2628
2629 \end_inset
2629 \end_inset
2630
2630
2631 ), allowing interactive usage of any of its backends as defined in the user's
2631 ), allowing interactive usage of any of its backends as defined in the user's
2632
2632
2633 \family typewriter
2633 \family typewriter
2634 .matplotlibrc
2634 .matplotlibrc
2635 \family default
2635 \family default
2636 file.
2636 file.
2637 It automatically activates GTK or WX threading for IPyhton if the choice
2637 It automatically activates GTK or WX threading for IPyhton if the choice
2638 of matplotlib backend requires it.
2638 of matplotlib backend requires it.
2639 It also modifies the
2639 It also modifies the
2640 \family typewriter
2640 \family typewriter
2641 %run
2641 %run
2642 \family default
2642 \family default
2643 command to correctly execute (without blocking) any matplotlib-based script
2643 command to correctly execute (without blocking) any matplotlib-based script
2644 which calls
2644 which calls
2645 \family typewriter
2645 \family typewriter
2646 show()
2646 show()
2647 \family default
2647 \family default
2648 at the end.
2648 at the end.
2649 See Sec.\SpecialChar ~
2649 See Sec.\SpecialChar ~
2650
2650
2651 \begin_inset LatexCommand \ref{sec:matplotlib-support}
2651 \begin_inset LatexCommand \ref{sec:matplotlib-support}
2652
2652
2653 \end_inset
2653 \end_inset
2654
2654
2655 for more details.
2655 for more details.
2656 \layout List
2656 \layout List
2657 \labelwidthstring 00.00.0000
2657 \labelwidthstring 00.00.0000
2658
2658
2659
2659
2660 \family typewriter
2660 \family typewriter
2661 \series bold
2661 \series bold
2662 -no|automagic
2662 -no|automagic
2663 \series default
2663 \series default
2664 :
2664 :
2665 \family default
2665 \family default
2666 make magic commands automatic (without needing their first character to
2666 make magic commands automatic (without needing their first character to
2667 be
2667 be
2668 \family typewriter
2668 \family typewriter
2669 %
2669 %
2670 \family default
2670 \family default
2671 ).
2671 ).
2672 Type
2672 Type
2673 \family typewriter
2673 \family typewriter
2674 %magic
2674 %magic
2675 \family default
2675 \family default
2676 at the IPython prompt for more information.
2676 at the IPython prompt for more information.
2677 \layout List
2677 \layout List
2678 \labelwidthstring 00.00.0000
2678 \labelwidthstring 00.00.0000
2679
2679
2680
2680
2681 \family typewriter
2681 \family typewriter
2682 \series bold
2682 \series bold
2683 -no|banner
2683 -no|banner
2684 \series default
2684 \series default
2685 :
2685 :
2686 \family default
2686 \family default
2687 Print the initial information banner (default on).
2687 Print the initial information banner (default on).
2688 \layout List
2688 \layout List
2689 \labelwidthstring 00.00.0000
2689 \labelwidthstring 00.00.0000
2690
2690
2691
2691
2692 \family typewriter
2692 \family typewriter
2693 \series bold
2693 \series bold
2694 -c\SpecialChar ~
2694 -c\SpecialChar ~
2695 <command>:
2695 <command>:
2696 \family default
2696 \family default
2697 \series default
2697 \series default
2698 execute the given command string, and set sys.argv to
2698 execute the given command string, and set sys.argv to
2699 \family typewriter
2699 \family typewriter
2700 ['c']
2700 ['c']
2701 \family default
2701 \family default
2702 .
2702 .
2703 This is similar to the
2703 This is similar to the
2704 \family typewriter
2704 \family typewriter
2705 -c
2705 -c
2706 \family default
2706 \family default
2707 option in the normal Python interpreter.
2707 option in the normal Python interpreter.
2708
2708
2709 \layout List
2709 \layout List
2710 \labelwidthstring 00.00.0000
2710 \labelwidthstring 00.00.0000
2711
2711
2712
2712
2713 \family typewriter
2713 \family typewriter
2714 \series bold
2714 \series bold
2715 -cache_size|cs\SpecialChar ~
2715 -cache_size|cs\SpecialChar ~
2716 <n>
2716 <n>
2717 \series default
2717 \series default
2718 :
2718 :
2719 \family default
2719 \family default
2720 size of the output cache (maximum number of entries to hold in memory).
2720 size of the output cache (maximum number of entries to hold in memory).
2721 The default is 1000, you can change it permanently in your config file.
2721 The default is 1000, you can change it permanently in your config file.
2722 Setting it to 0 completely disables the caching system, and the minimum
2722 Setting it to 0 completely disables the caching system, and the minimum
2723 value accepted is 20 (if you provide a value less than 20, it is reset
2723 value accepted is 20 (if you provide a value less than 20, it is reset
2724 to 0 and a warning is issued) This limit is defined because otherwise you'll
2724 to 0 and a warning is issued) This limit is defined because otherwise you'll
2725 spend more time re-flushing a too small cache than working.
2725 spend more time re-flushing a too small cache than working.
2726 \layout List
2726 \layout List
2727 \labelwidthstring 00.00.0000
2727 \labelwidthstring 00.00.0000
2728
2728
2729
2729
2730 \family typewriter
2730 \family typewriter
2731 \series bold
2731 \series bold
2732 -classic|cl
2732 -classic|cl
2733 \series default
2733 \series default
2734 :
2734 :
2735 \family default
2735 \family default
2736 Gives IPython a similar feel to the classic Python prompt.
2736 Gives IPython a similar feel to the classic Python prompt.
2737 \layout List
2737 \layout List
2738 \labelwidthstring 00.00.0000
2738 \labelwidthstring 00.00.0000
2739
2739
2740
2740
2741 \family typewriter
2741 \family typewriter
2742 \series bold
2742 \series bold
2743 -colors\SpecialChar ~
2743 -colors\SpecialChar ~
2744 <scheme>:
2744 <scheme>:
2745 \family default
2745 \family default
2746 \series default
2746 \series default
2747 Color scheme for prompts and exception reporting.
2747 Color scheme for prompts and exception reporting.
2748 Currently implemented: NoColor, Linux and LightBG.
2748 Currently implemented: NoColor, Linux and LightBG.
2749 \layout List
2749 \layout List
2750 \labelwidthstring 00.00.0000
2750 \labelwidthstring 00.00.0000
2751
2751
2752
2752
2753 \family typewriter
2753 \family typewriter
2754 \series bold
2754 \series bold
2755 -no|color_info:
2755 -no|color_info:
2756 \family default
2756 \family default
2757 \series default
2757 \series default
2758 IPython can display information about objects via a set of functions, and
2758 IPython can display information about objects via a set of functions, and
2759 optionally can use colors for this, syntax highlighting source code and
2759 optionally can use colors for this, syntax highlighting source code and
2760 various other elements.
2760 various other elements.
2761 However, because this information is passed through a pager (like 'less')
2761 However, because this information is passed through a pager (like 'less')
2762 and many pagers get confused with color codes, this option is off by default.
2762 and many pagers get confused with color codes, this option is off by default.
2763 You can test it and turn it on permanently in your ipythonrc file if it
2763 You can test it and turn it on permanently in your ipythonrc file if it
2764 works for you.
2764 works for you.
2765 As a reference, the 'less' pager supplied with Mandrake 8.2 works ok, but
2765 As a reference, the 'less' pager supplied with Mandrake 8.2 works ok, but
2766 that in RedHat 7.2 doesn't.
2766 that in RedHat 7.2 doesn't.
2767 \layout List
2767 \layout List
2768 \labelwidthstring 00.00.0000
2768 \labelwidthstring 00.00.0000
2769
2769
2770 \SpecialChar ~
2770 \SpecialChar ~
2771 Test it and turn it on permanently if it works with your system.
2771 Test it and turn it on permanently if it works with your system.
2772 The magic function
2772 The magic function
2773 \family typewriter
2773 \family typewriter
2774 %color_info
2774 %color_info
2775 \family default
2775 \family default
2776 allows you to toggle this interactively for testing.
2776 allows you to toggle this interactively for testing.
2777 \layout List
2777 \layout List
2778 \labelwidthstring 00.00.0000
2778 \labelwidthstring 00.00.0000
2779
2779
2780
2780
2781 \family typewriter
2781 \family typewriter
2782 \series bold
2782 \series bold
2783 -no|debug
2783 -no|debug
2784 \family default
2784 \family default
2785 \series default
2785 \series default
2786 : Show information about the loading process.
2786 : Show information about the loading process.
2787 Very useful to pin down problems with your configuration files or to get
2787 Very useful to pin down problems with your configuration files or to get
2788 details about session restores.
2788 details about session restores.
2789 \layout List
2789 \layout List
2790 \labelwidthstring 00.00.0000
2790 \labelwidthstring 00.00.0000
2791
2791
2792
2792
2793 \family typewriter
2793 \family typewriter
2794 \series bold
2794 \series bold
2795 -no|deep_reload
2795 -no|deep_reload
2796 \series default
2796 \series default
2797 :
2797 :
2798 \family default
2798 \family default
2799 IPython can use the
2799 IPython can use the
2800 \family typewriter
2800 \family typewriter
2801 deep_reload
2801 deep_reload
2802 \family default
2802 \family default
2803 module which reloads changes in modules recursively (it replaces the
2803 module which reloads changes in modules recursively (it replaces the
2804 \family typewriter
2804 \family typewriter
2805 reload()
2805 reload()
2806 \family default
2806 \family default
2807 function, so you don't need to change anything to use it).
2807 function, so you don't need to change anything to use it).
2808
2808
2809 \family typewriter
2809 \family typewriter
2810 deep_reload()
2810 deep_reload()
2811 \family default
2811 \family default
2812 forces a full reload of modules whose code may have changed, which the
2812 forces a full reload of modules whose code may have changed, which the
2813 default
2813 default
2814 \family typewriter
2814 \family typewriter
2815 reload()
2815 reload()
2816 \family default
2816 \family default
2817 function does not.
2817 function does not.
2818 \layout List
2818 \layout List
2819 \labelwidthstring 00.00.0000
2819 \labelwidthstring 00.00.0000
2820
2820
2821 \SpecialChar ~
2821 \SpecialChar ~
2822 When deep_reload is off, IPython will use the normal
2822 When deep_reload is off, IPython will use the normal
2823 \family typewriter
2823 \family typewriter
2824 reload()
2824 reload()
2825 \family default
2825 \family default
2826 , but deep_reload will still be available as
2826 , but deep_reload will still be available as
2827 \family typewriter
2827 \family typewriter
2828 dreload()
2828 dreload()
2829 \family default
2829 \family default
2830 .
2830 .
2831 This feature is off by default [which means that you have both normal
2831 This feature is off by default [which means that you have both normal
2832 \family typewriter
2832 \family typewriter
2833 reload()
2833 reload()
2834 \family default
2834 \family default
2835 and
2835 and
2836 \family typewriter
2836 \family typewriter
2837 dreload()
2837 dreload()
2838 \family default
2838 \family default
2839 ].
2839 ].
2840 \layout List
2840 \layout List
2841 \labelwidthstring 00.00.0000
2841 \labelwidthstring 00.00.0000
2842
2842
2843
2843
2844 \family typewriter
2844 \family typewriter
2845 \series bold
2845 \series bold
2846 -editor\SpecialChar ~
2846 -editor\SpecialChar ~
2847 <name>
2847 <name>
2848 \family default
2848 \family default
2849 \series default
2849 \series default
2850 : Which editor to use with the
2850 : Which editor to use with the
2851 \family typewriter
2851 \family typewriter
2852 %edit
2852 %edit
2853 \family default
2853 \family default
2854 command.
2854 command.
2855 By default, IPython will honor your
2855 By default, IPython will honor your
2856 \family typewriter
2856 \family typewriter
2857 EDITOR
2857 EDITOR
2858 \family default
2858 \family default
2859 environment variable (if not set, vi is the Unix default and notepad the
2859 environment variable (if not set, vi is the Unix default and notepad the
2860 Windows one).
2860 Windows one).
2861 Since this editor is invoked on the fly by IPython and is meant for editing
2861 Since this editor is invoked on the fly by IPython and is meant for editing
2862 small code snippets, you may want to use a small, lightweight editor here
2862 small code snippets, you may want to use a small, lightweight editor here
2863 (in case your default
2863 (in case your default
2864 \family typewriter
2864 \family typewriter
2865 EDITOR
2865 EDITOR
2866 \family default
2866 \family default
2867 is something like Emacs).
2867 is something like Emacs).
2868 \layout List
2868 \layout List
2869 \labelwidthstring 00.00.0000
2869 \labelwidthstring 00.00.0000
2870
2870
2871
2871
2872 \family typewriter
2872 \family typewriter
2873 \series bold
2873 \series bold
2874 -ipythondir\SpecialChar ~
2874 -ipythondir\SpecialChar ~
2875 <name>
2875 <name>
2876 \series default
2876 \series default
2877 :
2877 :
2878 \family default
2878 \family default
2879 name of your IPython configuration directory
2879 name of your IPython configuration directory
2880 \family typewriter
2880 \family typewriter
2881 IPYTHONDIR
2881 IPYTHONDIR
2882 \family default
2882 \family default
2883 .
2883 .
2884 This can also be specified through the environment variable
2884 This can also be specified through the environment variable
2885 \family typewriter
2885 \family typewriter
2886 IPYTHONDIR
2886 IPYTHONDIR
2887 \family default
2887 \family default
2888 .
2888 .
2889 \layout List
2889 \layout List
2890 \labelwidthstring 00.00.0000
2890 \labelwidthstring 00.00.0000
2891
2891
2892
2892
2893 \family typewriter
2893 \family typewriter
2894 \series bold
2894 \series bold
2895 -log|l
2895 -log|l
2896 \family default
2896 \family default
2897 \series default
2897 \series default
2898 : generate a log file of all input.
2898 : generate a log file of all input.
2899 Defaults to
2899 Defaults to
2900 \family typewriter
2900 \family typewriter
2901 $IPYTHONDIR/log
2901 $IPYTHONDIR/log
2902 \family default
2902 \family default
2903 .
2903 .
2904 You can use this to later restore a session by loading your logfile as
2904 You can use this to later restore a session by loading your logfile as
2905 a file to be executed with option
2905 a file to be executed with option
2906 \family typewriter
2906 \family typewriter
2907 -logplay
2907 -logplay
2908 \family default
2908 \family default
2909 (see below).
2909 (see below).
2910 \layout List
2910 \layout List
2911 \labelwidthstring 00.00.0000
2911 \labelwidthstring 00.00.0000
2912
2912
2913
2913
2914 \family typewriter
2914 \family typewriter
2915 \series bold
2915 \series bold
2916 -logfile|lf\SpecialChar ~
2916 -logfile|lf\SpecialChar ~
2917 <name>
2917 <name>
2918 \series default
2918 \series default
2919 :
2919 :
2920 \family default
2920 \family default
2921 specify the name of your logfile.
2921 specify the name of your logfile.
2922 \layout List
2922 \layout List
2923 \labelwidthstring 00.00.0000
2923 \labelwidthstring 00.00.0000
2924
2924
2925
2925
2926 \family typewriter
2926 \family typewriter
2927 \series bold
2927 \series bold
2928 -logplay|lp\SpecialChar ~
2928 -logplay|lp\SpecialChar ~
2929 <name>
2929 <name>
2930 \series default
2930 \series default
2931 :
2931 :
2932 \family default
2932 \family default
2933 you can replay a previous log.
2933 you can replay a previous log.
2934 For restoring a session as close as possible to the state you left it in,
2934 For restoring a session as close as possible to the state you left it in,
2935 use this option (don't just run the logfile).
2935 use this option (don't just run the logfile).
2936 With
2936 With
2937 \family typewriter
2937 \family typewriter
2938 -logplay
2938 -logplay
2939 \family default
2939 \family default
2940 , IPython will try to reconstruct the previous working environment in full,
2940 , IPython will try to reconstruct the previous working environment in full,
2941 not just execute the commands in the logfile.
2941 not just execute the commands in the logfile.
2942 \layout List
2942 \layout List
2943 \labelwidthstring 00.00.0000
2943 \labelwidthstring 00.00.0000
2944
2944
2945 \SpecialChar ~
2945 \SpecialChar ~
2946 When a session is restored, logging is automatically turned on again with
2946 When a session is restored, logging is automatically turned on again with
2947 the name of the logfile it was invoked with (it is read from the log header).
2947 the name of the logfile it was invoked with (it is read from the log header).
2948 So once you've turned logging on for a session, you can quit IPython and
2948 So once you've turned logging on for a session, you can quit IPython and
2949 reload it as many times as you want and it will continue to log its history
2949 reload it as many times as you want and it will continue to log its history
2950 and restore from the beginning every time.
2950 and restore from the beginning every time.
2951 \layout List
2951 \layout List
2952 \labelwidthstring 00.00.0000
2952 \labelwidthstring 00.00.0000
2953
2953
2954 \SpecialChar ~
2954 \SpecialChar ~
2955 Caveats: there are limitations in this option.
2955 Caveats: there are limitations in this option.
2956 The history variables
2956 The history variables
2957 \family typewriter
2957 \family typewriter
2958 _i*
2958 _i*
2959 \family default
2959 \family default
2960 ,
2960 ,
2961 \family typewriter
2961 \family typewriter
2962 _*
2962 _*
2963 \family default
2963 \family default
2964 and
2964 and
2965 \family typewriter
2965 \family typewriter
2966 _dh
2966 _dh
2967 \family default
2967 \family default
2968 don't get restored properly.
2968 don't get restored properly.
2969 In the future we will try to implement full session saving by writing and
2969 In the future we will try to implement full session saving by writing and
2970 retrieving a 'snapshot' of the memory state of IPython.
2970 retrieving a 'snapshot' of the memory state of IPython.
2971 But our first attempts failed because of inherent limitations of Python's
2971 But our first attempts failed because of inherent limitations of Python's
2972 Pickle module, so this may have to wait.
2972 Pickle module, so this may have to wait.
2973 \layout List
2973 \layout List
2974 \labelwidthstring 00.00.0000
2974 \labelwidthstring 00.00.0000
2975
2975
2976
2976
2977 \family typewriter
2977 \family typewriter
2978 \series bold
2978 \series bold
2979 -no|messages
2979 -no|messages
2980 \series default
2980 \series default
2981 :
2981 :
2982 \family default
2982 \family default
2983 Print messages which IPython collects about its startup process (default
2983 Print messages which IPython collects about its startup process (default
2984 on).
2984 on).
2985 \layout List
2985 \layout List
2986 \labelwidthstring 00.00.0000
2986 \labelwidthstring 00.00.0000
2987
2987
2988
2988
2989 \family typewriter
2989 \family typewriter
2990 \series bold
2990 \series bold
2991 -no|pdb
2991 -no|pdb
2992 \family default
2992 \family default
2993 \series default
2993 \series default
2994 : Automatically call the pdb debugger after every uncaught exception.
2994 : Automatically call the pdb debugger after every uncaught exception.
2995 If you are used to debugging using pdb, this puts you automatically inside
2995 If you are used to debugging using pdb, this puts you automatically inside
2996 of it after any call (either in IPython or in code called by it) which
2996 of it after any call (either in IPython or in code called by it) which
2997 triggers an exception which goes uncaught.
2997 triggers an exception which goes uncaught.
2998 \layout List
2998 \layout List
2999 \labelwidthstring 00.00.0000
2999 \labelwidthstring 00.00.0000
3000
3000
3001
3001
3002 \family typewriter
3002 \family typewriter
3003 \series bold
3003 \series bold
3004 -no|pprint
3004 -no|pprint
3005 \series default
3005 \series default
3006 :
3006 :
3007 \family default
3007 \family default
3008 ipython can optionally use the pprint (pretty printer) module for displaying
3008 ipython can optionally use the pprint (pretty printer) module for displaying
3009 results.
3009 results.
3010 pprint tends to give a nicer display of nested data structures.
3010 pprint tends to give a nicer display of nested data structures.
3011 If you like it, you can turn it on permanently in your config file (default
3011 If you like it, you can turn it on permanently in your config file (default
3012 off).
3012 off).
3013 \layout List
3013 \layout List
3014 \labelwidthstring 00.00.0000
3014 \labelwidthstring 00.00.0000
3015
3015
3016
3016
3017 \family typewriter
3017 \family typewriter
3018 \series bold
3018 \series bold
3019 -profile|p <name>
3019 -profile|p <name>
3020 \series default
3020 \series default
3021 :
3021 :
3022 \family default
3022 \family default
3023 assume that your config file is
3023 assume that your config file is
3024 \family typewriter
3024 \family typewriter
3025 ipythonrc-<name>
3025 ipythonrc-<name>
3026 \family default
3026 \family default
3027 (looks in current dir first, then in
3027 (looks in current dir first, then in
3028 \family typewriter
3028 \family typewriter
3029 IPYTHONDIR
3029 IPYTHONDIR
3030 \family default
3030 \family default
3031 ).
3031 ).
3032 This is a quick way to keep and load multiple config files for different
3032 This is a quick way to keep and load multiple config files for different
3033 tasks, especially if you use the include option of config files.
3033 tasks, especially if you use the include option of config files.
3034 You can keep a basic
3034 You can keep a basic
3035 \family typewriter
3035 \family typewriter
3036 IPYTHONDIR/ipythonrc
3036 IPYTHONDIR/ipythonrc
3037 \family default
3037 \family default
3038 file and then have other 'profiles' which include this one and load extra
3038 file and then have other 'profiles' which include this one and load extra
3039 things for particular tasks.
3039 things for particular tasks.
3040 For example:
3040 For example:
3041 \layout List
3041 \layout List
3042 \labelwidthstring 00.00.0000
3042 \labelwidthstring 00.00.0000
3043
3043
3044
3044
3045 \family typewriter
3045 \family typewriter
3046 \SpecialChar ~
3046 \SpecialChar ~
3047
3047
3048 \family default
3048 \family default
3049 1.
3049 1.
3050
3050
3051 \family typewriter
3051 \family typewriter
3052 $HOME/.ipython/ipythonrc
3052 $HOME/.ipython/ipythonrc
3053 \family default
3053 \family default
3054 : load basic things you always want.
3054 : load basic things you always want.
3055 \layout List
3055 \layout List
3056 \labelwidthstring 00.00.0000
3056 \labelwidthstring 00.00.0000
3057
3057
3058
3058
3059 \family typewriter
3059 \family typewriter
3060 \SpecialChar ~
3060 \SpecialChar ~
3061
3061
3062 \family default
3062 \family default
3063 2.
3063 2.
3064
3064
3065 \family typewriter
3065 \family typewriter
3066 $HOME/.ipython/ipythonrc-math
3066 $HOME/.ipython/ipythonrc-math
3067 \family default
3067 \family default
3068 : load (1) and basic math-related modules.
3068 : load (1) and basic math-related modules.
3069
3069
3070 \layout List
3070 \layout List
3071 \labelwidthstring 00.00.0000
3071 \labelwidthstring 00.00.0000
3072
3072
3073
3073
3074 \family typewriter
3074 \family typewriter
3075 \SpecialChar ~
3075 \SpecialChar ~
3076
3076
3077 \family default
3077 \family default
3078 3.
3078 3.
3079
3079
3080 \family typewriter
3080 \family typewriter
3081 $HOME/.ipython/ipythonrc-numeric
3081 $HOME/.ipython/ipythonrc-numeric
3082 \family default
3082 \family default
3083 : load (1) and Numeric and plotting modules.
3083 : load (1) and Numeric and plotting modules.
3084 \layout List
3084 \layout List
3085 \labelwidthstring 00.00.0000
3085 \labelwidthstring 00.00.0000
3086
3086
3087 \SpecialChar ~
3087 \SpecialChar ~
3088 Since it is possible to create an endless loop by having circular file
3088 Since it is possible to create an endless loop by having circular file
3089 inclusions, IPython will stop if it reaches 15 recursive inclusions.
3089 inclusions, IPython will stop if it reaches 15 recursive inclusions.
3090 \layout List
3090 \layout List
3091 \labelwidthstring 00.00.0000
3091 \labelwidthstring 00.00.0000
3092
3092
3093
3093
3094 \family typewriter
3094 \family typewriter
3095 \series bold
3095 \series bold
3096 -prompt_in1|pi1\SpecialChar ~
3096 -prompt_in1|pi1\SpecialChar ~
3097 <string>:
3097 <string>:
3098 \family default
3098 \family default
3099 \series default
3099 \series default
3100 Specify the string used for input prompts.
3100 Specify the string used for input prompts.
3101 Note that if you are using numbered prompts, the number is represented
3101 Note that if you are using numbered prompts, the number is represented
3102 with a '
3102 with a '
3103 \backslash
3103 \backslash
3104 #' in the string.
3104 #' in the string.
3105 Don't forget to quote strings with spaces embedded in them.
3105 Don't forget to quote strings with spaces embedded in them.
3106 Default: '
3106 Default: '
3107 \family typewriter
3107 \family typewriter
3108 In\SpecialChar ~
3108 In\SpecialChar ~
3109 [
3109 [
3110 \backslash
3110 \backslash
3111 #]:
3111 #]:
3112 \family default
3112 \family default
3113 '.
3113 '.
3114 Sec.\SpecialChar ~
3114 Sec.\SpecialChar ~
3115
3115
3116 \begin_inset LatexCommand \ref{sec:prompts}
3116 \begin_inset LatexCommand \ref{sec:prompts}
3117
3117
3118 \end_inset
3118 \end_inset
3119
3119
3120 discusses in detail all the available escapes to customize your prompts.
3120 discusses in detail all the available escapes to customize your prompts.
3121 \layout List
3121 \layout List
3122 \labelwidthstring 00.00.0000
3122 \labelwidthstring 00.00.0000
3123
3123
3124
3124
3125 \family typewriter
3125 \family typewriter
3126 \series bold
3126 \series bold
3127 -prompt_in2|pi2\SpecialChar ~
3127 -prompt_in2|pi2\SpecialChar ~
3128 <string>:
3128 <string>:
3129 \family default
3129 \family default
3130 \series default
3130 \series default
3131 Similar to the previous option, but used for the continuation prompts.
3131 Similar to the previous option, but used for the continuation prompts.
3132 The special sequence '
3132 The special sequence '
3133 \family typewriter
3133 \family typewriter
3134
3134
3135 \backslash
3135 \backslash
3136 D
3136 D
3137 \family default
3137 \family default
3138 ' is similar to '
3138 ' is similar to '
3139 \family typewriter
3139 \family typewriter
3140
3140
3141 \backslash
3141 \backslash
3142 #
3142 #
3143 \family default
3143 \family default
3144 ', but with all digits replaced dots (so you can have your continuation
3144 ', but with all digits replaced dots (so you can have your continuation
3145 prompt aligned with your input prompt).
3145 prompt aligned with your input prompt).
3146 Default: '
3146 Default: '
3147 \family typewriter
3147 \family typewriter
3148 \SpecialChar ~
3148 \SpecialChar ~
3149 \SpecialChar ~
3149 \SpecialChar ~
3150 \SpecialChar ~
3150 \SpecialChar ~
3151 .
3151 .
3152 \backslash
3152 \backslash
3153 D.:
3153 D.:
3154 \family default
3154 \family default
3155 ' (note three spaces at the start for alignment with '
3155 ' (note three spaces at the start for alignment with '
3156 \family typewriter
3156 \family typewriter
3157 In\SpecialChar ~
3157 In\SpecialChar ~
3158 [
3158 [
3159 \backslash
3159 \backslash
3160 #]
3160 #]
3161 \family default
3161 \family default
3162 ').
3162 ').
3163 \layout List
3163 \layout List
3164 \labelwidthstring 00.00.0000
3164 \labelwidthstring 00.00.0000
3165
3165
3166
3166
3167 \family typewriter
3167 \family typewriter
3168 \series bold
3168 \series bold
3169 -prompt_out|po\SpecialChar ~
3169 -prompt_out|po\SpecialChar ~
3170 <string>:
3170 <string>:
3171 \family default
3171 \family default
3172 \series default
3172 \series default
3173 String used for output prompts, also uses numbers like
3173 String used for output prompts, also uses numbers like
3174 \family typewriter
3174 \family typewriter
3175 prompt_in1
3175 prompt_in1
3176 \family default
3176 \family default
3177 .
3177 .
3178 Default: '
3178 Default: '
3179 \family typewriter
3179 \family typewriter
3180 Out[
3180 Out[
3181 \backslash
3181 \backslash
3182 #]:
3182 #]:
3183 \family default
3183 \family default
3184 '
3184 '
3185 \layout List
3185 \layout List
3186 \labelwidthstring 00.00.0000
3186 \labelwidthstring 00.00.0000
3187
3187
3188
3188
3189 \family typewriter
3189 \family typewriter
3190 \series bold
3190 \series bold
3191 -quick
3191 -quick
3192 \family default
3192 \family default
3193 \series default
3193 \series default
3194 : start in bare bones mode (no config file loaded).
3194 : start in bare bones mode (no config file loaded).
3195 \layout List
3195 \layout List
3196 \labelwidthstring 00.00.0000
3196 \labelwidthstring 00.00.0000
3197
3197
3198
3198
3199 \family typewriter
3199 \family typewriter
3200 \series bold
3200 \series bold
3201 -rcfile\SpecialChar ~
3201 -rcfile\SpecialChar ~
3202 <name>
3202 <name>
3203 \series default
3203 \series default
3204 :
3204 :
3205 \family default
3205 \family default
3206 name of your IPython resource configuration file.
3206 name of your IPython resource configuration file.
3207 Normally IPython loads ipythonrc (from current directory) or
3207 Normally IPython loads ipythonrc (from current directory) or
3208 \family typewriter
3208 \family typewriter
3209 IPYTHONDIR/ipythonrc
3209 IPYTHONDIR/ipythonrc
3210 \family default
3210 \family default
3211 .
3211 .
3212 \layout List
3212 \layout List
3213 \labelwidthstring 00.00.0000
3213 \labelwidthstring 00.00.0000
3214
3214
3215 \SpecialChar ~
3215 \SpecialChar ~
3216 If the loading of your config file fails, IPython starts with a bare bones
3216 If the loading of your config file fails, IPython starts with a bare bones
3217 configuration (no modules loaded at all).
3217 configuration (no modules loaded at all).
3218 \layout List
3218 \layout List
3219 \labelwidthstring 00.00.0000
3219 \labelwidthstring 00.00.0000
3220
3220
3221
3221
3222 \family typewriter
3222 \family typewriter
3223 \series bold
3223 \series bold
3224 -no|readline
3224 -no|readline
3225 \family default
3225 \family default
3226 \series default
3226 \series default
3227 : use the readline library, which is needed to support name completion and
3227 : use the readline library, which is needed to support name completion and
3228 command history, among other things.
3228 command history, among other things.
3229 It is enabled by default, but may cause problems for users of X/Emacs in
3229 It is enabled by default, but may cause problems for users of X/Emacs in
3230 Python comint or shell buffers.
3230 Python comint or shell buffers.
3231 \layout List
3231 \layout List
3232 \labelwidthstring 00.00.0000
3232 \labelwidthstring 00.00.0000
3233
3233
3234 \SpecialChar ~
3234 \SpecialChar ~
3235 Note that X/Emacs 'eterm' buffers (opened with
3235 Note that X/Emacs 'eterm' buffers (opened with
3236 \family typewriter
3236 \family typewriter
3237 M-x\SpecialChar ~
3237 M-x\SpecialChar ~
3238 term
3238 term
3239 \family default
3239 \family default
3240 ) support IPython's readline and syntax coloring fine, only 'emacs' (
3240 ) support IPython's readline and syntax coloring fine, only 'emacs' (
3241 \family typewriter
3241 \family typewriter
3242 M-x\SpecialChar ~
3242 M-x\SpecialChar ~
3243 shell
3243 shell
3244 \family default
3244 \family default
3245 and
3245 and
3246 \family typewriter
3246 \family typewriter
3247 C-c\SpecialChar ~
3247 C-c\SpecialChar ~
3248 !
3248 !
3249 \family default
3249 \family default
3250 ) buffers do not.
3250 ) buffers do not.
3251 \layout List
3251 \layout List
3252 \labelwidthstring 00.00.0000
3252 \labelwidthstring 00.00.0000
3253
3253
3254
3254
3255 \family typewriter
3255 \family typewriter
3256 \series bold
3256 \series bold
3257 -screen_length|sl\SpecialChar ~
3257 -screen_length|sl\SpecialChar ~
3258 <n>
3258 <n>
3259 \series default
3259 \series default
3260 :
3260 :
3261 \family default
3261 \family default
3262 number of lines of your screen.
3262 number of lines of your screen.
3263 This is used to control printing of very long strings.
3263 This is used to control printing of very long strings.
3264 Strings longer than this number of lines will be sent through a pager instead
3264 Strings longer than this number of lines will be sent through a pager instead
3265 of directly printed.
3265 of directly printed.
3266 \layout List
3266 \layout List
3267 \labelwidthstring 00.00.0000
3267 \labelwidthstring 00.00.0000
3268
3268
3269 \SpecialChar ~
3269 \SpecialChar ~
3270 The default value for this is 0, which means IPython will auto-detect your
3270 The default value for this is 0, which means IPython will auto-detect your
3271 screen size every time it needs to print certain potentially long strings
3271 screen size every time it needs to print certain potentially long strings
3272 (this doesn't change the behavior of the 'print' keyword, it's only triggered
3272 (this doesn't change the behavior of the 'print' keyword, it's only triggered
3273 internally).
3273 internally).
3274 If for some reason this isn't working well (it needs curses support), specify
3274 If for some reason this isn't working well (it needs curses support), specify
3275 it yourself.
3275 it yourself.
3276 Otherwise don't change the default.
3276 Otherwise don't change the default.
3277 \layout List
3277 \layout List
3278 \labelwidthstring 00.00.0000
3278 \labelwidthstring 00.00.0000
3279
3279
3280
3280
3281 \family typewriter
3281 \family typewriter
3282 \series bold
3282 \series bold
3283 -separate_in|si\SpecialChar ~
3283 -separate_in|si\SpecialChar ~
3284 <string>
3284 <string>
3285 \series default
3285 \series default
3286 :
3286 :
3287 \family default
3287 \family default
3288 separator before input prompts.
3288 separator before input prompts.
3289 Default: '
3289 Default: '
3290 \family typewriter
3290 \family typewriter
3291
3291
3292 \backslash
3292 \backslash
3293 n
3293 n
3294 \family default
3294 \family default
3295 '
3295 '
3296 \layout List
3296 \layout List
3297 \labelwidthstring 00.00.0000
3297 \labelwidthstring 00.00.0000
3298
3298
3299
3299
3300 \family typewriter
3300 \family typewriter
3301 \series bold
3301 \series bold
3302 -separate_out|so\SpecialChar ~
3302 -separate_out|so\SpecialChar ~
3303 <string>
3303 <string>
3304 \family default
3304 \family default
3305 \series default
3305 \series default
3306 : separator before output prompts.
3306 : separator before output prompts.
3307 Default: nothing.
3307 Default: nothing.
3308 \layout List
3308 \layout List
3309 \labelwidthstring 00.00.0000
3309 \labelwidthstring 00.00.0000
3310
3310
3311
3311
3312 \family typewriter
3312 \family typewriter
3313 \series bold
3313 \series bold
3314 -separate_out2|so2\SpecialChar ~
3314 -separate_out2|so2\SpecialChar ~
3315 <string>
3315 <string>
3316 \series default
3316 \series default
3317 :
3317 :
3318 \family default
3318 \family default
3319 separator after output prompts.
3319 separator after output prompts.
3320 Default: nothing.
3320 Default: nothing.
3321 \layout List
3321 \layout List
3322 \labelwidthstring 00.00.0000
3322 \labelwidthstring 00.00.0000
3323
3323
3324 \SpecialChar ~
3324 \SpecialChar ~
3325 For these three options, use the value 0 to specify no separator.
3325 For these three options, use the value 0 to specify no separator.
3326 \layout List
3326 \layout List
3327 \labelwidthstring 00.00.0000
3327 \labelwidthstring 00.00.0000
3328
3328
3329
3329
3330 \family typewriter
3330 \family typewriter
3331 \series bold
3331 \series bold
3332 -nosep
3332 -nosep
3333 \series default
3333 \series default
3334 :
3334 :
3335 \family default
3335 \family default
3336 shorthand for
3336 shorthand for
3337 \family typewriter
3337 \family typewriter
3338 '-SeparateIn 0 -SeparateOut 0 -SeparateOut2 0'
3338 '-SeparateIn 0 -SeparateOut 0 -SeparateOut2 0'
3339 \family default
3339 \family default
3340 .
3340 .
3341 Simply removes all input/output separators.
3341 Simply removes all input/output separators.
3342 \layout List
3342 \layout List
3343 \labelwidthstring 00.00.0000
3343 \labelwidthstring 00.00.0000
3344
3344
3345
3345
3346 \family typewriter
3346 \family typewriter
3347 \series bold
3347 \series bold
3348 -upgrade
3348 -upgrade
3349 \family default
3349 \family default
3350 \series default
3350 \series default
3351 : allows you to upgrade your
3351 : allows you to upgrade your
3352 \family typewriter
3352 \family typewriter
3353 IPYTHONDIR
3353 IPYTHONDIR
3354 \family default
3354 \family default
3355 configuration when you install a new version of IPython.
3355 configuration when you install a new version of IPython.
3356 Since new versions may include new command line options or example files,
3356 Since new versions may include new command line options or example files,
3357 this copies updated ipythonrc-type files.
3357 this copies updated ipythonrc-type files.
3358 However, it backs up (with a
3358 However, it backs up (with a
3359 \family typewriter
3359 \family typewriter
3360 .old
3360 .old
3361 \family default
3361 \family default
3362 extension) all files which it overwrites so that you can merge back any
3362 extension) all files which it overwrites so that you can merge back any
3363 customizations you might have in your personal files.
3363 customizations you might have in your personal files.
3364 \layout List
3364 \layout List
3365 \labelwidthstring 00.00.0000
3365 \labelwidthstring 00.00.0000
3366
3366
3367
3367
3368 \family typewriter
3368 \family typewriter
3369 \series bold
3369 \series bold
3370 -Version
3370 -Version
3371 \series default
3371 \series default
3372 :
3372 :
3373 \family default
3373 \family default
3374 print version information and exit.
3374 print version information and exit.
3375 \layout List
3375 \layout List
3376 \labelwidthstring 00.00.0000
3376 \labelwidthstring 00.00.0000
3377
3377
3378
3378
3379 \family typewriter
3379 \family typewriter
3380 \series bold
3380 \series bold
3381 -xmode <modename>
3381 -xmode <modename>
3382 \series default
3382 \series default
3383 :
3383 :
3384 \family default
3384 \family default
3385 Mode for exception reporting.
3385 Mode for exception reporting.
3386 \layout List
3386 \layout List
3387 \labelwidthstring 00.00.0000
3387 \labelwidthstring 00.00.0000
3388
3388
3389 \SpecialChar ~
3389 \SpecialChar ~
3390 Valid modes: Plain, Context and Verbose.
3390 Valid modes: Plain, Context and Verbose.
3391 \layout List
3391 \layout List
3392 \labelwidthstring 00.00.0000
3392 \labelwidthstring 00.00.0000
3393
3393
3394 \SpecialChar ~
3394 \SpecialChar ~
3395 Plain: similar to python's normal traceback printing.
3395 Plain: similar to python's normal traceback printing.
3396 \layout List
3396 \layout List
3397 \labelwidthstring 00.00.0000
3397 \labelwidthstring 00.00.0000
3398
3398
3399 \SpecialChar ~
3399 \SpecialChar ~
3400 Context: prints 5 lines of context source code around each line in the
3400 Context: prints 5 lines of context source code around each line in the
3401 traceback.
3401 traceback.
3402 \layout List
3402 \layout List
3403 \labelwidthstring 00.00.0000
3403 \labelwidthstring 00.00.0000
3404
3404
3405 \SpecialChar ~
3405 \SpecialChar ~
3406 Verbose: similar to Context, but additionally prints the variables currently
3406 Verbose: similar to Context, but additionally prints the variables currently
3407 visible where the exception happened (shortening their strings if too long).
3407 visible where the exception happened (shortening their strings if too long).
3408 This can potentially be very slow, if you happen to have a huge data structure
3408 This can potentially be very slow, if you happen to have a huge data structure
3409 whose string representation is complex to compute.
3409 whose string representation is complex to compute.
3410 Your computer may appear to freeze for a while with cpu usage at 100%.
3410 Your computer may appear to freeze for a while with cpu usage at 100%.
3411 If this occurs, you can cancel the traceback with Ctrl-C (maybe hitting
3411 If this occurs, you can cancel the traceback with Ctrl-C (maybe hitting
3412 it more than once).
3412 it more than once).
3413 \layout Section
3413 \layout Section
3414
3414
3415 Interactive use
3415 Interactive use
3416 \layout Standard
3416 \layout Standard
3417
3417
3418
3418
3419 \series bold
3419 \series bold
3420 Warning
3420 Warning
3421 \series default
3421 \series default
3422 : IPython relies on the existence of a global variable called
3422 : IPython relies on the existence of a global variable called
3423 \family typewriter
3423 \family typewriter
3424 __IP
3424 __IP
3425 \family default
3425 \family default
3426 which controls the shell itself.
3426 which controls the shell itself.
3427 If you redefine
3427 If you redefine
3428 \family typewriter
3428 \family typewriter
3429 __IP
3429 __IP
3430 \family default
3430 \family default
3431 to anything, bizarre behavior will quickly occur.
3431 to anything, bizarre behavior will quickly occur.
3432 \layout Standard
3432 \layout Standard
3433
3433
3434 Other than the above warning, IPython is meant to work as a drop-in replacement
3434 Other than the above warning, IPython is meant to work as a drop-in replacement
3435 for the standard interactive interpreter.
3435 for the standard interactive interpreter.
3436 As such, any code which is valid python should execute normally under IPython
3436 As such, any code which is valid python should execute normally under IPython
3437 (cases where this is not true should be reported as bugs).
3437 (cases where this is not true should be reported as bugs).
3438 It does, however, offer many features which are not available at a standard
3438 It does, however, offer many features which are not available at a standard
3439 python prompt.
3439 python prompt.
3440 What follows is a list of these.
3440 What follows is a list of these.
3441 \layout Subsection
3441 \layout Subsection
3442
3442
3443 Caution for Windows users
3443 Caution for Windows users
3444 \layout Standard
3444 \layout Standard
3445
3445
3446 Windows, unfortunately, uses the `
3446 Windows, unfortunately, uses the `
3447 \family typewriter
3447 \family typewriter
3448
3448
3449 \backslash
3449 \backslash
3450
3450
3451 \family default
3451 \family default
3452 ' character as a path separator.
3452 ' character as a path separator.
3453 This is a terrible choice, because `
3453 This is a terrible choice, because `
3454 \family typewriter
3454 \family typewriter
3455
3455
3456 \backslash
3456 \backslash
3457
3457
3458 \family default
3458 \family default
3459 ' also represents the escape character in most modern programming languages,
3459 ' also represents the escape character in most modern programming languages,
3460 including Python.
3460 including Python.
3461 For this reason, issuing many of the commands discussed below (especially
3461 For this reason, issuing many of the commands discussed below (especially
3462 magics which affect the filesystem) with `
3462 magics which affect the filesystem) with `
3463 \family typewriter
3463 \family typewriter
3464
3464
3465 \backslash
3465 \backslash
3466
3466
3467 \family default
3467 \family default
3468 ' in them will cause strange errors.
3468 ' in them will cause strange errors.
3469 \layout Standard
3469 \layout Standard
3470
3470
3471 A partial solution is to use instead the `
3471 A partial solution is to use instead the `
3472 \family typewriter
3472 \family typewriter
3473 /
3473 /
3474 \family default
3474 \family default
3475 ' character as a path separator, which Windows recognizes in
3475 ' character as a path separator, which Windows recognizes in
3476 \emph on
3476 \emph on
3477 most
3477 most
3478 \emph default
3478 \emph default
3479 situations.
3479 situations.
3480 However, in Windows commands `
3480 However, in Windows commands `
3481 \family typewriter
3481 \family typewriter
3482 /
3482 /
3483 \family default
3483 \family default
3484 ' flags options, so you can not use it for the root directory.
3484 ' flags options, so you can not use it for the root directory.
3485 This means that paths beginning at the root must be typed in a contrived
3485 This means that paths beginning at the root must be typed in a contrived
3486 manner like:
3486 manner like:
3487 \newline
3487 \newline
3488
3488
3489 \family typewriter
3489 \family typewriter
3490 %copy
3490 %copy
3491 \backslash
3491 \backslash
3492 opt/foo/bar.txt
3492 opt/foo/bar.txt
3493 \backslash
3493 \backslash
3494 tmp
3494 tmp
3495 \layout Standard
3495 \layout Standard
3496
3496
3497 There is no sensible thing IPython can do to truly work around this flaw
3497 There is no sensible thing IPython can do to truly work around this flaw
3498 in Windows
3498 in Windows
3499 \begin_inset Foot
3499 \begin_inset Foot
3500 collapsed true
3500 collapsed true
3501
3501
3502 \layout Standard
3502 \layout Standard
3503
3503
3504 If anyone comes up with a
3504 If anyone comes up with a
3505 \emph on
3505 \emph on
3506 clean
3506 clean
3507 \emph default
3507 \emph default
3508 solution which works consistently and does not negatively impact other
3508 solution which works consistently and does not negatively impact other
3509 platforms at all, I'll gladly accept a patch.
3509 platforms at all, I'll gladly accept a patch.
3510 \end_inset
3510 \end_inset
3511
3511
3512 .
3512 .
3513 \layout Subsection
3513 \layout Subsection
3514
3514
3515
3515
3516 \begin_inset LatexCommand \label{sec:magic}
3516 \begin_inset LatexCommand \label{sec:magic}
3517
3517
3518 \end_inset
3518 \end_inset
3519
3519
3520 Magic command system
3520 Magic command system
3521 \layout Standard
3521 \layout Standard
3522
3522
3523 IPython will treat any line whose first character is a
3523 IPython will treat any line whose first character is a
3524 \family typewriter
3524 \family typewriter
3525 %
3525 %
3526 \family default
3526 \family default
3527 as a special call to a 'magic' function.
3527 as a special call to a 'magic' function.
3528 These allow you to control the behavior of IPython itself, plus a lot of
3528 These allow you to control the behavior of IPython itself, plus a lot of
3529 system-type features.
3529 system-type features.
3530 They are all prefixed with a
3530 They are all prefixed with a
3531 \family typewriter
3531 \family typewriter
3532 %
3532 %
3533 \family default
3533 \family default
3534 character, but parameters are given without parentheses or quotes.
3534 character, but parameters are given without parentheses or quotes.
3535 \layout Standard
3535 \layout Standard
3536
3536
3537 Example: typing
3537 Example: typing
3538 \family typewriter
3538 \family typewriter
3539 '%cd mydir'
3539 '%cd mydir'
3540 \family default
3540 \family default
3541 (without the quotes) changes you working directory to
3541 (without the quotes) changes you working directory to
3542 \family typewriter
3542 \family typewriter
3543 'mydir'
3543 'mydir'
3544 \family default
3544 \family default
3545 , if it exists.
3545 , if it exists.
3546 \layout Standard
3546 \layout Standard
3547
3547
3548 If you have 'automagic' enabled (in your
3548 If you have 'automagic' enabled (in your
3549 \family typewriter
3549 \family typewriter
3550 ipythonrc
3550 ipythonrc
3551 \family default
3551 \family default
3552 file, via the command line option
3552 file, via the command line option
3553 \family typewriter
3553 \family typewriter
3554 -automagic
3554 -automagic
3555 \family default
3555 \family default
3556 or with the
3556 or with the
3557 \family typewriter
3557 \family typewriter
3558 %automagic
3558 %automagic
3559 \family default
3559 \family default
3560 function), you don't need to type in the
3560 function), you don't need to type in the
3561 \family typewriter
3561 \family typewriter
3562 %
3562 %
3563 \family default
3563 \family default
3564 explicitly.
3564 explicitly.
3565 IPython will scan its internal list of magic functions and call one if
3565 IPython will scan its internal list of magic functions and call one if
3566 it exists.
3566 it exists.
3567 With automagic on you can then just type '
3567 With automagic on you can then just type '
3568 \family typewriter
3568 \family typewriter
3569 cd mydir
3569 cd mydir
3570 \family default
3570 \family default
3571 ' to go to directory '
3571 ' to go to directory '
3572 \family typewriter
3572 \family typewriter
3573 mydir
3573 mydir
3574 \family default
3574 \family default
3575 '.
3575 '.
3576 The automagic system has the lowest possible precedence in name searches,
3576 The automagic system has the lowest possible precedence in name searches,
3577 so defining an identifier with the same name as an existing magic function
3577 so defining an identifier with the same name as an existing magic function
3578 will shadow it for automagic use.
3578 will shadow it for automagic use.
3579 You can still access the shadowed magic function by explicitly using the
3579 You can still access the shadowed magic function by explicitly using the
3580
3580
3581 \family typewriter
3581 \family typewriter
3582 %
3582 %
3583 \family default
3583 \family default
3584 character at the beginning of the line.
3584 character at the beginning of the line.
3585 \layout Standard
3585 \layout Standard
3586
3586
3587 An example (with automagic on) should clarify all this:
3587 An example (with automagic on) should clarify all this:
3588 \layout LyX-Code
3588 \layout LyX-Code
3589
3589
3590 In [1]: cd ipython # %cd is called by automagic
3590 In [1]: cd ipython # %cd is called by automagic
3591 \layout LyX-Code
3591 \layout LyX-Code
3592
3592
3593 /home/fperez/ipython
3593 /home/fperez/ipython
3594 \layout LyX-Code
3594 \layout LyX-Code
3595
3595
3596 In [2]: cd=1 # now cd is just a variable
3596 In [2]: cd=1 # now cd is just a variable
3597 \layout LyX-Code
3597 \layout LyX-Code
3598
3598
3599 In [3]: cd ..
3599 In [3]: cd ..
3600 # and doesn't work as a function anymore
3600 # and doesn't work as a function anymore
3601 \layout LyX-Code
3601 \layout LyX-Code
3602
3602
3603 ------------------------------------------------------------
3603 ------------------------------------------------------------
3604 \layout LyX-Code
3604 \layout LyX-Code
3605
3605
3606 File "<console>", line 1
3606 File "<console>", line 1
3607 \layout LyX-Code
3607 \layout LyX-Code
3608
3608
3609 cd ..
3609 cd ..
3610 \layout LyX-Code
3610 \layout LyX-Code
3611
3611
3612 ^
3612 ^
3613 \layout LyX-Code
3613 \layout LyX-Code
3614
3614
3615 SyntaxError: invalid syntax
3615 SyntaxError: invalid syntax
3616 \layout LyX-Code
3616 \layout LyX-Code
3617
3617
3618 \layout LyX-Code
3618 \layout LyX-Code
3619
3619
3620 In [4]: %cd ..
3620 In [4]: %cd ..
3621 # but %cd always works
3621 # but %cd always works
3622 \layout LyX-Code
3622 \layout LyX-Code
3623
3623
3624 /home/fperez
3624 /home/fperez
3625 \layout LyX-Code
3625 \layout LyX-Code
3626
3626
3627 In [5]: del cd # if you remove the cd variable
3627 In [5]: del cd # if you remove the cd variable
3628 \layout LyX-Code
3628 \layout LyX-Code
3629
3629
3630 In [6]: cd ipython # automagic can work again
3630 In [6]: cd ipython # automagic can work again
3631 \layout LyX-Code
3631 \layout LyX-Code
3632
3632
3633 /home/fperez/ipython
3633 /home/fperez/ipython
3634 \layout Standard
3634 \layout Standard
3635
3635
3636 You can define your own magic functions to extend the system.
3636 You can define your own magic functions to extend the system.
3637 The following is a snippet of code which shows how to do it.
3637 The following is a snippet of code which shows how to do it.
3638 It is provided as file
3638 It is provided as file
3639 \family typewriter
3639 \family typewriter
3640 example-magic.py
3640 example-magic.py
3641 \family default
3641 \family default
3642 in the examples directory:
3642 in the examples directory:
3643 \layout Standard
3643 \layout Standard
3644
3644
3645
3645
3646 \begin_inset ERT
3646 \begin_inset ERT
3647 status Open
3647 status Open
3648
3648
3649 \layout Standard
3649 \layout Standard
3650
3650
3651 \backslash
3651 \backslash
3652 codelist{examples/example-magic.py}
3652 codelist{examples/example-magic.py}
3653 \end_inset
3653 \end_inset
3654
3654
3655
3655
3656 \layout Standard
3656 \layout Standard
3657
3657
3658 You can also define your own aliased names for magic functions.
3658 You can also define your own aliased names for magic functions.
3659 In your
3659 In your
3660 \family typewriter
3660 \family typewriter
3661 ipythonrc
3661 ipythonrc
3662 \family default
3662 \family default
3663 file, placing a line like:
3663 file, placing a line like:
3664 \layout Standard
3664 \layout Standard
3665
3665
3666
3666
3667 \family typewriter
3667 \family typewriter
3668 execute __IP.magic_cl = __IP.magic_clear
3668 execute __IP.magic_cl = __IP.magic_clear
3669 \layout Standard
3669 \layout Standard
3670
3670
3671 will define
3671 will define
3672 \family typewriter
3672 \family typewriter
3673 %cl
3673 %cl
3674 \family default
3674 \family default
3675 as a new name for
3675 as a new name for
3676 \family typewriter
3676 \family typewriter
3677 %clear
3677 %clear
3678 \family default
3678 \family default
3679 .
3679 .
3680 \layout Standard
3680 \layout Standard
3681
3681
3682 Type
3682 Type
3683 \family typewriter
3683 \family typewriter
3684 %magic
3684 %magic
3685 \family default
3685 \family default
3686 for more information, including a list of all available magic functions
3686 for more information, including a list of all available magic functions
3687 at any time and their docstrings.
3687 at any time and their docstrings.
3688 You can also type
3688 You can also type
3689 \family typewriter
3689 \family typewriter
3690 %magic_function_name?
3690 %magic_function_name?
3691 \family default
3691 \family default
3692 (see sec.
3692 (see sec.
3693
3693
3694 \begin_inset LatexCommand \ref{sec:dyn-object-info}
3694 \begin_inset LatexCommand \ref{sec:dyn-object-info}
3695
3695
3696 \end_inset
3696 \end_inset
3697
3697
3698 for information on the
3698 for information on the
3699 \family typewriter
3699 \family typewriter
3700 '?'
3700 '?'
3701 \family default
3701 \family default
3702 system) to get information about any particular magic function you are
3702 system) to get information about any particular magic function you are
3703 interested in.
3703 interested in.
3704 \layout Subsubsection
3704 \layout Subsubsection
3705
3705
3706 Magic commands
3706 Magic commands
3707 \layout Standard
3707 \layout Standard
3708
3708
3709 The rest of this section is automatically generated for each release from
3709 The rest of this section is automatically generated for each release from
3710 the docstrings in the IPython code.
3710 the docstrings in the IPython code.
3711 Therefore the formatting is somewhat minimal, but this method has the advantage
3711 Therefore the formatting is somewhat minimal, but this method has the advantage
3712 of having information always in sync with the code.
3712 of having information always in sync with the code.
3713 \layout Standard
3713 \layout Standard
3714
3714
3715 A list of all the magic commands available in IPython's
3715 A list of all the magic commands available in IPython's
3716 \emph on
3716 \emph on
3717 default
3717 default
3718 \emph default
3718 \emph default
3719 installation follows.
3719 installation follows.
3720 This is similar to what you'll see by simply typing
3720 This is similar to what you'll see by simply typing
3721 \family typewriter
3721 \family typewriter
3722 %magic
3722 %magic
3723 \family default
3723 \family default
3724 at the prompt, but that will also give you information about magic commands
3724 at the prompt, but that will also give you information about magic commands
3725 you may have added as part of your personal customizations.
3725 you may have added as part of your personal customizations.
3726 \layout Standard
3726 \layout Standard
3727
3727
3728
3728
3729 \begin_inset Include \input{magic.tex}
3729 \begin_inset Include \input{magic.tex}
3730 preview false
3730 preview false
3731
3731
3732 \end_inset
3732 \end_inset
3733
3733
3734
3734
3735 \layout Subsection
3735 \layout Subsection
3736
3736
3737 Access to the standard Python help
3737 Access to the standard Python help
3738 \layout Standard
3738 \layout Standard
3739
3739
3740 As of Python 2.1, a help system is available with access to object docstrings
3740 As of Python 2.1, a help system is available with access to object docstrings
3741 and the Python manuals.
3741 and the Python manuals.
3742 Simply type
3742 Simply type
3743 \family typewriter
3743 \family typewriter
3744 'help'
3744 'help'
3745 \family default
3745 \family default
3746 (no quotes) to access it.
3746 (no quotes) to access it.
3747 You can also type
3747 You can also type
3748 \family typewriter
3748 \family typewriter
3749 help(object)
3749 help(object)
3750 \family default
3750 \family default
3751 to obtain information about a given object, and
3751 to obtain information about a given object, and
3752 \family typewriter
3752 \family typewriter
3753 help('keyword')
3753 help('keyword')
3754 \family default
3754 \family default
3755 for information on a keyword.
3755 for information on a keyword.
3756 As noted in sec.
3756 As noted in sec.
3757
3757
3758 \begin_inset LatexCommand \ref{sec:help-access}
3758 \begin_inset LatexCommand \ref{sec:help-access}
3759
3759
3760 \end_inset
3760 \end_inset
3761
3761
3762 , you need to properly configure your environment variable
3762 , you need to properly configure your environment variable
3763 \family typewriter
3763 \family typewriter
3764 PYTHONDOCS
3764 PYTHONDOCS
3765 \family default
3765 \family default
3766 for this feature to work correctly.
3766 for this feature to work correctly.
3767 \layout Subsection
3767 \layout Subsection
3768
3768
3769
3769
3770 \begin_inset LatexCommand \label{sec:dyn-object-info}
3770 \begin_inset LatexCommand \label{sec:dyn-object-info}
3771
3771
3772 \end_inset
3772 \end_inset
3773
3773
3774 Dynamic object information
3774 Dynamic object information
3775 \layout Standard
3775 \layout Standard
3776
3776
3777 Typing
3777 Typing
3778 \family typewriter
3778 \family typewriter
3779 ?word
3779 ?word
3780 \family default
3780 \family default
3781 or
3781 or
3782 \family typewriter
3782 \family typewriter
3783 word?
3783 word?
3784 \family default
3784 \family default
3785 prints detailed information about an object.
3785 prints detailed information about an object.
3786 If certain strings in the object are too long (docstrings, code, etc.) they
3786 If certain strings in the object are too long (docstrings, code, etc.) they
3787 get snipped in the center for brevity.
3787 get snipped in the center for brevity.
3788 This system gives access variable types and values, full source code for
3788 This system gives access variable types and values, full source code for
3789 any object (if available), function prototypes and other useful information.
3789 any object (if available), function prototypes and other useful information.
3790 \layout Standard
3790 \layout Standard
3791
3791
3792 Typing
3792 Typing
3793 \family typewriter
3793 \family typewriter
3794 ??word
3794 ??word
3795 \family default
3795 \family default
3796 or
3796 or
3797 \family typewriter
3797 \family typewriter
3798 word??
3798 word??
3799 \family default
3799 \family default
3800 gives access to the full information without snipping long strings.
3800 gives access to the full information without snipping long strings.
3801 Long strings are sent to the screen through the
3801 Long strings are sent to the screen through the
3802 \family typewriter
3802 \family typewriter
3803 less
3803 less
3804 \family default
3804 \family default
3805 pager if longer than the screen and printed otherwise.
3805 pager if longer than the screen and printed otherwise.
3806 On systems lacking the
3806 On systems lacking the
3807 \family typewriter
3807 \family typewriter
3808 less
3808 less
3809 \family default
3809 \family default
3810 command, IPython uses a very basic internal pager.
3810 command, IPython uses a very basic internal pager.
3811 \layout Standard
3811 \layout Standard
3812
3812
3813 The following magic functions are particularly useful for gathering information
3813 The following magic functions are particularly useful for gathering information
3814 about your working environment.
3814 about your working environment.
3815 You can get more details by typing
3815 You can get more details by typing
3816 \family typewriter
3816 \family typewriter
3817 %magic
3817 %magic
3818 \family default
3818 \family default
3819 or querying them individually (use
3819 or querying them individually (use
3820 \family typewriter
3820 \family typewriter
3821 %function_name?
3821 %function_name?
3822 \family default
3822 \family default
3823 with or without the
3823 with or without the
3824 \family typewriter
3824 \family typewriter
3825 %
3825 %
3826 \family default
3826 \family default
3827 ), this is just a summary:
3827 ), this is just a summary:
3828 \layout List
3828 \layout List
3829 \labelwidthstring 00.00.0000
3829 \labelwidthstring 00.00.0000
3830
3830
3831
3831
3832 \family typewriter
3832 \family typewriter
3833 \series bold
3833 \series bold
3834 %pdoc\SpecialChar ~
3834 %pdoc\SpecialChar ~
3835 <object>
3835 <object>
3836 \family default
3836 \family default
3837 \series default
3837 \series default
3838 : Print (or run through a pager if too long) the docstring for an object.
3838 : Print (or run through a pager if too long) the docstring for an object.
3839 If the given object is a class, it will print both the class and the constructo
3839 If the given object is a class, it will print both the class and the constructo
3840 r docstrings.
3840 r docstrings.
3841 \layout List
3841 \layout List
3842 \labelwidthstring 00.00.0000
3842 \labelwidthstring 00.00.0000
3843
3843
3844
3844
3845 \family typewriter
3845 \family typewriter
3846 \series bold
3846 \series bold
3847 %pdef\SpecialChar ~
3847 %pdef\SpecialChar ~
3848 <object>
3848 <object>
3849 \family default
3849 \family default
3850 \series default
3850 \series default
3851 : Print the definition header for any callable object.
3851 : Print the definition header for any callable object.
3852 If the object is a class, print the constructor information.
3852 If the object is a class, print the constructor information.
3853 \layout List
3853 \layout List
3854 \labelwidthstring 00.00.0000
3854 \labelwidthstring 00.00.0000
3855
3855
3856
3856
3857 \family typewriter
3857 \family typewriter
3858 \series bold
3858 \series bold
3859 %psource\SpecialChar ~
3859 %psource\SpecialChar ~
3860 <object>
3860 <object>
3861 \family default
3861 \family default
3862 \series default
3862 \series default
3863 : Print (or run through a pager if too long) the source code for an object.
3863 : Print (or run through a pager if too long) the source code for an object.
3864 \layout List
3864 \layout List
3865 \labelwidthstring 00.00.0000
3865 \labelwidthstring 00.00.0000
3866
3866
3867
3867
3868 \family typewriter
3868 \family typewriter
3869 \series bold
3869 \series bold
3870 %pfile\SpecialChar ~
3870 %pfile\SpecialChar ~
3871 <object>
3871 <object>
3872 \family default
3872 \family default
3873 \series default
3873 \series default
3874 : Show the entire source file where an object was defined via a pager, opening
3874 : Show the entire source file where an object was defined via a pager, opening
3875 it at the line where the object definition begins.
3875 it at the line where the object definition begins.
3876 \layout List
3876 \layout List
3877 \labelwidthstring 00.00.0000
3877 \labelwidthstring 00.00.0000
3878
3878
3879
3879
3880 \family typewriter
3880 \family typewriter
3881 \series bold
3881 \series bold
3882 %who/%whos
3882 %who/%whos
3883 \family default
3883 \family default
3884 \series default
3884 \series default
3885 : These functions give information about identifiers you have defined interactiv
3885 : These functions give information about identifiers you have defined interactiv
3886 ely (not things you loaded or defined in your configuration files).
3886 ely (not things you loaded or defined in your configuration files).
3887
3887
3888 \family typewriter
3888 \family typewriter
3889 %who
3889 %who
3890 \family default
3890 \family default
3891 just prints a list of identifiers and
3891 just prints a list of identifiers and
3892 \family typewriter
3892 \family typewriter
3893 %whos
3893 %whos
3894 \family default
3894 \family default
3895 prints a table with some basic details about each identifier.
3895 prints a table with some basic details about each identifier.
3896 \layout Standard
3896 \layout Standard
3897
3897
3898 Note that the dynamic object information functions (
3898 Note that the dynamic object information functions (
3899 \family typewriter
3899 \family typewriter
3900 ?/??, %pdoc, %pfile, %pdef, %psource
3900 ?/??, %pdoc, %pfile, %pdef, %psource
3901 \family default
3901 \family default
3902 ) give you access to documentation even on things which are not really defined
3902 ) give you access to documentation even on things which are not really defined
3903 as separate identifiers.
3903 as separate identifiers.
3904 Try for example typing
3904 Try for example typing
3905 \family typewriter
3905 \family typewriter
3906 {}.get?
3906 {}.get?
3907 \family default
3907 \family default
3908 or after doing
3908 or after doing
3909 \family typewriter
3909 \family typewriter
3910 import os
3910 import os
3911 \family default
3911 \family default
3912 , type
3912 , type
3913 \family typewriter
3913 \family typewriter
3914 os.path.abspath??
3914 os.path.abspath??
3915 \family default
3915 \family default
3916 .
3916 .
3917 \layout Subsection
3917 \layout Subsection
3918
3918
3919
3919
3920 \begin_inset LatexCommand \label{sec:readline}
3920 \begin_inset LatexCommand \label{sec:readline}
3921
3921
3922 \end_inset
3922 \end_inset
3923
3923
3924 Readline-based features
3924 Readline-based features
3925 \layout Standard
3925 \layout Standard
3926
3926
3927 These features require the GNU readline library, so they won't work if your
3927 These features require the GNU readline library, so they won't work if your
3928 Python installation lacks readline support.
3928 Python installation lacks readline support.
3929 We will first describe the default behavior IPython uses, and then how
3929 We will first describe the default behavior IPython uses, and then how
3930 to change it to suit your preferences.
3930 to change it to suit your preferences.
3931 \layout Subsubsection
3931 \layout Subsubsection
3932
3932
3933 Command line completion
3933 Command line completion
3934 \layout Standard
3934 \layout Standard
3935
3935
3936 At any time, hitting TAB will complete any available python commands or
3936 At any time, hitting TAB will complete any available python commands or
3937 variable names, and show you a list of the possible completions if there's
3937 variable names, and show you a list of the possible completions if there's
3938 no unambiguous one.
3938 no unambiguous one.
3939 It will also complete filenames in the current directory if no python names
3939 It will also complete filenames in the current directory if no python names
3940 match what you've typed so far.
3940 match what you've typed so far.
3941 \layout Subsubsection
3941 \layout Subsubsection
3942
3942
3943 Search command history
3943 Search command history
3944 \layout Standard
3944 \layout Standard
3945
3945
3946 IPython provides two ways for searching through previous input and thus
3946 IPython provides two ways for searching through previous input and thus
3947 reduce the need for repetitive typing:
3947 reduce the need for repetitive typing:
3948 \layout Enumerate
3948 \layout Enumerate
3949
3949
3950 Start typing, and then use
3950 Start typing, and then use
3951 \family typewriter
3951 \family typewriter
3952 Ctrl-p
3952 Ctrl-p
3953 \family default
3953 \family default
3954 (previous,up) and
3954 (previous,up) and
3955 \family typewriter
3955 \family typewriter
3956 Ctrl-n
3956 Ctrl-n
3957 \family default
3957 \family default
3958 (next,down) to search through only the history items that match what you've
3958 (next,down) to search through only the history items that match what you've
3959 typed so far.
3959 typed so far.
3960 If you use
3960 If you use
3961 \family typewriter
3961 \family typewriter
3962 Ctrl-p/Ctrl-n
3962 Ctrl-p/Ctrl-n
3963 \family default
3963 \family default
3964 at a blank prompt, they just behave like normal arrow keys.
3964 at a blank prompt, they just behave like normal arrow keys.
3965 \layout Enumerate
3965 \layout Enumerate
3966
3966
3967 Hit
3967 Hit
3968 \family typewriter
3968 \family typewriter
3969 Ctrl-r
3969 Ctrl-r
3970 \family default
3970 \family default
3971 : opens a search prompt.
3971 : opens a search prompt.
3972 Begin typing and the system searches your history for lines that contain
3972 Begin typing and the system searches your history for lines that contain
3973 what you've typed so far, completing as much as it can.
3973 what you've typed so far, completing as much as it can.
3974 \layout Subsubsection
3974 \layout Subsubsection
3975
3975
3976 Persistent command history across sessions
3976 Persistent command history across sessions
3977 \layout Standard
3977 \layout Standard
3978
3978
3979 IPython will save your input history when it leaves and reload it next time
3979 IPython will save your input history when it leaves and reload it next time
3980 you restart it.
3980 you restart it.
3981 By default, the history file is named
3981 By default, the history file is named
3982 \family typewriter
3982 \family typewriter
3983 $IPYTHONDIR/history
3983 $IPYTHONDIR/history
3984 \family default
3984 \family default
3985 , but if you've loaded a named profile, '
3985 , but if you've loaded a named profile, '
3986 \family typewriter
3986 \family typewriter
3987 -PROFILE_NAME
3987 -PROFILE_NAME
3988 \family default
3988 \family default
3989 ' is appended to the name.
3989 ' is appended to the name.
3990 This allows you to keep separate histories related to various tasks: commands
3990 This allows you to keep separate histories related to various tasks: commands
3991 related to numerical work will not be clobbered by a system shell history,
3991 related to numerical work will not be clobbered by a system shell history,
3992 for example.
3992 for example.
3993 \layout Subsubsection
3993 \layout Subsubsection
3994
3994
3995 Autoindent
3995 Autoindent
3996 \layout Standard
3996 \layout Standard
3997
3997
3998 IPython can recognize lines ending in ':' and indent the next line, while
3998 IPython can recognize lines ending in ':' and indent the next line, while
3999 also un-indenting automatically after 'raise' or 'return'.
3999 also un-indenting automatically after 'raise' or 'return'.
4000
4000
4001 \layout Standard
4001 \layout Standard
4002
4002
4003 This feature uses the readline library, so it will honor your
4003 This feature uses the readline library, so it will honor your
4004 \family typewriter
4004 \family typewriter
4005 ~/.inputrc
4005 ~/.inputrc
4006 \family default
4006 \family default
4007 configuration (or whatever file your
4007 configuration (or whatever file your
4008 \family typewriter
4008 \family typewriter
4009 INPUTRC
4009 INPUTRC
4010 \family default
4010 \family default
4011 variable points to).
4011 variable points to).
4012 Adding the following lines to your
4012 Adding the following lines to your
4013 \family typewriter
4013 \family typewriter
4014 .inputrc
4014 .inputrc
4015 \family default
4015 \family default
4016 file can make indenting/unindenting more convenient (
4016 file can make indenting/unindenting more convenient (
4017 \family typewriter
4017 \family typewriter
4018 M-i
4018 M-i
4019 \family default
4019 \family default
4020 indents,
4020 indents,
4021 \family typewriter
4021 \family typewriter
4022 M-u
4022 M-u
4023 \family default
4023 \family default
4024 unindents):
4024 unindents):
4025 \layout Standard
4025 \layout Standard
4026
4026
4027
4027
4028 \family typewriter
4028 \family typewriter
4029 $if Python
4029 $if Python
4030 \newline
4030 \newline
4031 "
4031 "
4032 \backslash
4032 \backslash
4033 M-i": "\SpecialChar ~
4033 M-i": "\SpecialChar ~
4034 \SpecialChar ~
4034 \SpecialChar ~
4035 \SpecialChar ~
4035 \SpecialChar ~
4036 \SpecialChar ~
4036 \SpecialChar ~
4037 "
4037 "
4038 \newline
4038 \newline
4039 "
4039 "
4040 \backslash
4040 \backslash
4041 M-u": "
4041 M-u": "
4042 \backslash
4042 \backslash
4043 d
4043 d
4044 \backslash
4044 \backslash
4045 d
4045 d
4046 \backslash
4046 \backslash
4047 d
4047 d
4048 \backslash
4048 \backslash
4049 d"
4049 d"
4050 \newline
4050 \newline
4051 $endif
4051 $endif
4052 \layout Standard
4052 \layout Standard
4053
4053
4054 Note that there are 4 spaces between the quote marks after
4054 Note that there are 4 spaces between the quote marks after
4055 \family typewriter
4055 \family typewriter
4056 "M-i"
4056 "M-i"
4057 \family default
4057 \family default
4058 above.
4058 above.
4059 \layout Standard
4059 \layout Standard
4060
4060
4061
4061
4062 \series bold
4062 \series bold
4063 Warning:
4063 Warning:
4064 \series default
4064 \series default
4065 this feature is ON by default, but it can cause problems with the pasting
4065 this feature is ON by default, but it can cause problems with the pasting
4066 of multi-line indented code (the pasted code gets re-indented on each line).
4066 of multi-line indented code (the pasted code gets re-indented on each line).
4067 A magic function
4067 A magic function
4068 \family typewriter
4068 \family typewriter
4069 %autoindent
4069 %autoindent
4070 \family default
4070 \family default
4071 allows you to toggle it on/off at runtime.
4071 allows you to toggle it on/off at runtime.
4072 You can also disable it permanently on in your
4072 You can also disable it permanently on in your
4073 \family typewriter
4073 \family typewriter
4074 ipythonrc
4074 ipythonrc
4075 \family default
4075 \family default
4076 file (set
4076 file (set
4077 \family typewriter
4077 \family typewriter
4078 autoindent 0
4078 autoindent 0
4079 \family default
4079 \family default
4080 ).
4080 ).
4081 \layout Subsubsection
4081 \layout Subsubsection
4082
4082
4083 Customizing readline behavior
4083 Customizing readline behavior
4084 \layout Standard
4084 \layout Standard
4085
4085
4086 All these features are based on the GNU readline library, which has an extremely
4086 All these features are based on the GNU readline library, which has an extremely
4087 customizable interface.
4087 customizable interface.
4088 Normally, readline is configured via a file which defines the behavior
4088 Normally, readline is configured via a file which defines the behavior
4089 of the library; the details of the syntax for this can be found in the
4089 of the library; the details of the syntax for this can be found in the
4090 readline documentation available with your system or on the Internet.
4090 readline documentation available with your system or on the Internet.
4091 IPython doesn't read this file (if it exists) directly, but it does support
4091 IPython doesn't read this file (if it exists) directly, but it does support
4092 passing to readline valid options via a simple interface.
4092 passing to readline valid options via a simple interface.
4093 In brief, you can customize readline by setting the following options in
4093 In brief, you can customize readline by setting the following options in
4094 your
4094 your
4095 \family typewriter
4095 \family typewriter
4096 ipythonrc
4096 ipythonrc
4097 \family default
4097 \family default
4098 configuration file (note that these options can
4098 configuration file (note that these options can
4099 \emph on
4099 \emph on
4100 not
4100 not
4101 \emph default
4101 \emph default
4102 be specified at the command line):
4102 be specified at the command line):
4103 \layout List
4103 \layout List
4104 \labelwidthstring 00.00.0000
4104 \labelwidthstring 00.00.0000
4105
4105
4106
4106
4107 \family typewriter
4107 \family typewriter
4108 \series bold
4108 \series bold
4109 readline_parse_and_bind:
4109 readline_parse_and_bind:
4110 \family default
4110 \family default
4111 \series default
4111 \series default
4112 this option can appear as many times as you want, each time defining a
4112 this option can appear as many times as you want, each time defining a
4113 string to be executed via a
4113 string to be executed via a
4114 \family typewriter
4114 \family typewriter
4115 readline.parse_and_bind()
4115 readline.parse_and_bind()
4116 \family default
4116 \family default
4117 command.
4117 command.
4118 The syntax for valid commands of this kind can be found by reading the
4118 The syntax for valid commands of this kind can be found by reading the
4119 documentation for the GNU readline library, as these commands are of the
4119 documentation for the GNU readline library, as these commands are of the
4120 kind which readline accepts in its configuration file.
4120 kind which readline accepts in its configuration file.
4121 \layout List
4121 \layout List
4122 \labelwidthstring 00.00.0000
4122 \labelwidthstring 00.00.0000
4123
4123
4124
4124
4125 \family typewriter
4125 \family typewriter
4126 \series bold
4126 \series bold
4127 readline_remove_delims:
4127 readline_remove_delims:
4128 \family default
4128 \family default
4129 \series default
4129 \series default
4130 a string of characters to be removed from the default word-delimiters list
4130 a string of characters to be removed from the default word-delimiters list
4131 used by readline, so that completions may be performed on strings which
4131 used by readline, so that completions may be performed on strings which
4132 contain them.
4132 contain them.
4133 Do not change the default value unless you know what you're doing.
4133 Do not change the default value unless you know what you're doing.
4134 \layout List
4134 \layout List
4135 \labelwidthstring 00.00.0000
4135 \labelwidthstring 00.00.0000
4136
4136
4137
4137
4138 \family typewriter
4138 \family typewriter
4139 \series bold
4139 \series bold
4140 readline_omit__names
4140 readline_omit__names
4141 \family default
4141 \family default
4142 \series default
4142 \series default
4143 : when tab-completion is enabled, hitting
4143 : when tab-completion is enabled, hitting
4144 \family typewriter
4144 \family typewriter
4145 <tab>
4145 <tab>
4146 \family default
4146 \family default
4147 after a '
4147 after a '
4148 \family typewriter
4148 \family typewriter
4149 .
4149 .
4150 \family default
4150 \family default
4151 ' in a name will complete all attributes of an object, including all the
4151 ' in a name will complete all attributes of an object, including all the
4152 special methods whose names include double underscores (like
4152 special methods whose names include double underscores (like
4153 \family typewriter
4153 \family typewriter
4154 __getitem__
4154 __getitem__
4155 \family default
4155 \family default
4156 or
4156 or
4157 \family typewriter
4157 \family typewriter
4158 __class__
4158 __class__
4159 \family default
4159 \family default
4160 ).
4160 ).
4161 If you'd rather not see these names by default, you can set this option
4161 If you'd rather not see these names by default, you can set this option
4162 to 1.
4162 to 1.
4163 Note that even when this option is set, you can still see those names by
4163 Note that even when this option is set, you can still see those names by
4164 explicitly typing a
4164 explicitly typing a
4165 \family typewriter
4165 \family typewriter
4166 _
4166 _
4167 \family default
4167 \family default
4168 after the period and hitting
4168 after the period and hitting
4169 \family typewriter
4169 \family typewriter
4170 <tab>
4170 <tab>
4171 \family default
4171 \family default
4172 : '
4172 : '
4173 \family typewriter
4173 \family typewriter
4174 name._<tab>
4174 name._<tab>
4175 \family default
4175 \family default
4176 ' will always complete attribute names starting with '
4176 ' will always complete attribute names starting with '
4177 \family typewriter
4177 \family typewriter
4178 _
4178 _
4179 \family default
4179 \family default
4180 '.
4180 '.
4181 \layout List
4181 \layout List
4182 \labelwidthstring 00.00.0000
4182 \labelwidthstring 00.00.0000
4183
4183
4184 \SpecialChar ~
4184 \SpecialChar ~
4185 This option is off by default so that new users see all attributes of any
4185 This option is off by default so that new users see all attributes of any
4186 objects they are dealing with.
4186 objects they are dealing with.
4187 \layout Standard
4187 \layout Standard
4188
4188
4189 You will find the default values along with a corresponding detailed explanation
4189 You will find the default values along with a corresponding detailed explanation
4190 in your
4190 in your
4191 \family typewriter
4191 \family typewriter
4192 ipythonrc
4192 ipythonrc
4193 \family default
4193 \family default
4194 file.
4194 file.
4195 \layout Subsection
4195 \layout Subsection
4196
4196
4197 Session logging and restoring
4197 Session logging and restoring
4198 \layout Standard
4198 \layout Standard
4199
4199
4200 You can log all input from a session either by starting IPython with the
4200 You can log all input from a session either by starting IPython with the
4201 command line switches
4201 command line switches
4202 \family typewriter
4202 \family typewriter
4203 -log
4203 -log
4204 \family default
4204 \family default
4205 or
4205 or
4206 \family typewriter
4206 \family typewriter
4207 -logfile
4207 -logfile
4208 \family default
4208 \family default
4209 (see sec.
4209 (see sec.
4210
4210
4211 \begin_inset LatexCommand \ref{sec:cmd-line-opts}
4211 \begin_inset LatexCommand \ref{sec:cmd-line-opts}
4212
4212
4213 \end_inset
4213 \end_inset
4214
4214
4215 )or by activating the logging at any moment with the magic function
4215 )or by activating the logging at any moment with the magic function
4216 \family typewriter
4216 \family typewriter
4217 %logstart
4217 %logstart
4218 \family default
4218 \family default
4219 .
4219 .
4220
4220
4221 \layout Standard
4221 \layout Standard
4222
4222
4223 Log files can later be reloaded with the
4223 Log files can later be reloaded with the
4224 \family typewriter
4224 \family typewriter
4225 -logplay
4225 -logplay
4226 \family default
4226 \family default
4227 option and IPython will attempt to 'replay' the log by executing all the
4227 option and IPython will attempt to 'replay' the log by executing all the
4228 lines in it, thus restoring the state of a previous session.
4228 lines in it, thus restoring the state of a previous session.
4229 This feature is not quite perfect, but can still be useful in many cases.
4229 This feature is not quite perfect, but can still be useful in many cases.
4230 \layout Standard
4230 \layout Standard
4231
4231
4232 The log files can also be used as a way to have a permanent record of any
4232 The log files can also be used as a way to have a permanent record of any
4233 code you wrote while experimenting.
4233 code you wrote while experimenting.
4234 Log files are regular text files which you can later open in your favorite
4234 Log files are regular text files which you can later open in your favorite
4235 text editor to extract code or to 'clean them up' before using them to
4235 text editor to extract code or to 'clean them up' before using them to
4236 replay a session.
4236 replay a session.
4237 \layout Standard
4237 \layout Standard
4238
4238
4239 The
4239 The
4240 \family typewriter
4240 \family typewriter
4241 %logstart
4241 %logstart
4242 \family default
4242 \family default
4243 function for activating logging in mid-session is used as follows:
4243 function for activating logging in mid-session is used as follows:
4244 \layout Standard
4244 \layout Standard
4245
4245
4246
4246
4247 \family typewriter
4247 \family typewriter
4248 %logstart [log_name [log_mode]]
4248 %logstart [log_name [log_mode]]
4249 \layout Standard
4249 \layout Standard
4250
4250
4251 If no name is given, it defaults to a file named
4251 If no name is given, it defaults to a file named
4252 \family typewriter
4252 \family typewriter
4253 'log'
4253 'log'
4254 \family default
4254 \family default
4255 in your IPYTHONDIR directory, in
4255 in your IPYTHONDIR directory, in
4256 \family typewriter
4256 \family typewriter
4257 'rotate'
4257 'rotate'
4258 \family default
4258 \family default
4259 mode (see below).
4259 mode (see below).
4260 \layout Standard
4260 \layout Standard
4261
4261
4262 '
4262 '
4263 \family typewriter
4263 \family typewriter
4264 %logstart name
4264 %logstart name
4265 \family default
4265 \family default
4266 ' saves to file
4266 ' saves to file
4267 \family typewriter
4267 \family typewriter
4268 'name'
4268 'name'
4269 \family default
4269 \family default
4270 in
4270 in
4271 \family typewriter
4271 \family typewriter
4272 'backup'
4272 'backup'
4273 \family default
4273 \family default
4274 mode.
4274 mode.
4275 It saves your history up to that point and then continues logging.
4275 It saves your history up to that point and then continues logging.
4276 \layout Standard
4276 \layout Standard
4277
4277
4278
4278
4279 \family typewriter
4279 \family typewriter
4280 %logstart
4280 %logstart
4281 \family default
4281 \family default
4282 takes a second optional parameter: logging mode.
4282 takes a second optional parameter: logging mode.
4283 This can be one of (note that the modes are given unquoted):
4283 This can be one of (note that the modes are given unquoted):
4284 \layout List
4284 \layout List
4285 \labelwidthstring 00.00.0000
4285 \labelwidthstring 00.00.0000
4286
4286
4287
4287
4288 \family typewriter
4288 \family typewriter
4289 over
4289 over
4290 \family default
4290 \family default
4291 : overwrite existing
4291 : overwrite existing
4292 \family typewriter
4292 \family typewriter
4293 log_name
4293 log_name
4294 \family default
4294 \family default
4295 .
4295 .
4296 \layout List
4296 \layout List
4297 \labelwidthstring 00.00.0000
4297 \labelwidthstring 00.00.0000
4298
4298
4299
4299
4300 \family typewriter
4300 \family typewriter
4301 backup
4301 backup
4302 \family default
4302 \family default
4303 : rename (if exists) to
4303 : rename (if exists) to
4304 \family typewriter
4304 \family typewriter
4305 log_name~
4305 log_name~
4306 \family default
4306 \family default
4307 and start
4307 and start
4308 \family typewriter
4308 \family typewriter
4309 log_name
4309 log_name
4310 \family default
4310 \family default
4311 .
4311 .
4312 \layout List
4312 \layout List
4313 \labelwidthstring 00.00.0000
4313 \labelwidthstring 00.00.0000
4314
4314
4315
4315
4316 \family typewriter
4316 \family typewriter
4317 append
4317 append
4318 \family default
4318 \family default
4319 : well, that says it.
4319 : well, that says it.
4320 \layout List
4320 \layout List
4321 \labelwidthstring 00.00.0000
4321 \labelwidthstring 00.00.0000
4322
4322
4323
4323
4324 \family typewriter
4324 \family typewriter
4325 rotate
4325 rotate
4326 \family default
4326 \family default
4327 : create rotating logs
4327 : create rotating logs
4328 \family typewriter
4328 \family typewriter
4329 log_name
4329 log_name
4330 \family default
4330 \family default
4331 .
4331 .
4332 \family typewriter
4332 \family typewriter
4333 1~
4333 1~
4334 \family default
4334 \family default
4335 ,
4335 ,
4336 \family typewriter
4336 \family typewriter
4337 log_name.2~
4337 log_name.2~
4338 \family default
4338 \family default
4339 , etc.
4339 , etc.
4340 \layout Standard
4340 \layout Standard
4341
4341
4342 The
4342 The
4343 \family typewriter
4343 \family typewriter
4344 %logoff
4344 %logoff
4345 \family default
4345 \family default
4346 and
4346 and
4347 \family typewriter
4347 \family typewriter
4348 %logon
4348 %logon
4349 \family default
4349 \family default
4350 functions allow you to temporarily stop and resume logging to a file which
4350 functions allow you to temporarily stop and resume logging to a file which
4351 had previously been started with
4351 had previously been started with
4352 \family typewriter
4352 \family typewriter
4353 %logstart
4353 %logstart
4354 \family default
4354 \family default
4355 .
4355 .
4356 They will fail (with an explanation) if you try to use them before logging
4356 They will fail (with an explanation) if you try to use them before logging
4357 has been started.
4357 has been started.
4358 \layout Subsection
4358 \layout Subsection
4359
4359
4360
4360
4361 \begin_inset LatexCommand \label{sub:System-shell-access}
4361 \begin_inset LatexCommand \label{sub:System-shell-access}
4362
4362
4363 \end_inset
4363 \end_inset
4364
4364
4365 System shell access
4365 System shell access
4366 \layout Standard
4366 \layout Standard
4367
4367
4368 Any input line beginning with a
4368 Any input line beginning with a
4369 \family typewriter
4369 \family typewriter
4370 !
4370 !
4371 \family default
4371 \family default
4372 character is passed verbatim (minus the
4372 character is passed verbatim (minus the
4373 \family typewriter
4373 \family typewriter
4374 !
4374 !
4375 \family default
4375 \family default
4376 , of course) to the underlying operating system.
4376 , of course) to the underlying operating system.
4377 For example, typing
4377 For example, typing
4378 \family typewriter
4378 \family typewriter
4379 !ls
4379 !ls
4380 \family default
4380 \family default
4381 will run
4381 will run
4382 \family typewriter
4382 \family typewriter
4383 'ls'
4383 'ls'
4384 \family default
4384 \family default
4385 in the current directory.
4385 in the current directory.
4386 \layout Subsubsection
4386 \layout Subsubsection
4387
4387
4388 Manual capture of command output
4388 Manual capture of command output
4389 \layout Standard
4389 \layout Standard
4390
4390
4391 If the input line begins with
4391 If the input line begins with
4392 \emph on
4392 \emph on
4393 two
4393 two
4394 \emph default
4394 \emph default
4395 exclamation marks,
4395 exclamation marks,
4396 \family typewriter
4396 \family typewriter
4397 !!
4397 !!
4398 \family default
4398 \family default
4399 , the command is executed but its output is captured and returned as a python
4399 , the command is executed but its output is captured and returned as a python
4400 list, split on newlines.
4400 list, split on newlines.
4401 Any output sent by the subprocess to standard error is printed separately,
4401 Any output sent by the subprocess to standard error is printed separately,
4402 so that the resulting list only captures standard output.
4402 so that the resulting list only captures standard output.
4403 The
4403 The
4404 \family typewriter
4404 \family typewriter
4405 !!
4405 !!
4406 \family default
4406 \family default
4407 syntax is a shorthand for the
4407 syntax is a shorthand for the
4408 \family typewriter
4408 \family typewriter
4409 %sx
4409 %sx
4410 \family default
4410 \family default
4411 magic command.
4411 magic command.
4412 \layout Standard
4412 \layout Standard
4413
4413
4414 Finally, the
4414 Finally, the
4415 \family typewriter
4415 \family typewriter
4416 %sc
4416 %sc
4417 \family default
4417 \family default
4418 magic (short for `shell capture') is similar to
4418 magic (short for `shell capture') is similar to
4419 \family typewriter
4419 \family typewriter
4420 %sx
4420 %sx
4421 \family default
4421 \family default
4422 , but allowing more fine-grained control of the capture details, and storing
4422 , but allowing more fine-grained control of the capture details, and storing
4423 the result directly into a named variable.
4423 the result directly into a named variable.
4424 \layout Standard
4424 \layout Standard
4425
4425
4426 See Sec.\SpecialChar ~
4426 See Sec.\SpecialChar ~
4427
4427
4428 \begin_inset LatexCommand \ref{sec:magic}
4428 \begin_inset LatexCommand \ref{sec:magic}
4429
4429
4430 \end_inset
4430 \end_inset
4431
4431
4432 for details on the magics
4432 for details on the magics
4433 \family typewriter
4433 \family typewriter
4434 %sc
4434 %sc
4435 \family default
4435 \family default
4436 and
4436 and
4437 \family typewriter
4437 \family typewriter
4438 %sx
4438 %sx
4439 \family default
4439 \family default
4440 , or use IPython's own help (
4440 , or use IPython's own help (
4441 \family typewriter
4441 \family typewriter
4442 sc?
4442 sc?
4443 \family default
4443 \family default
4444 and
4444 and
4445 \family typewriter
4445 \family typewriter
4446 sx?
4446 sx?
4447 \family default
4447 \family default
4448 ) for further details.
4448 ) for further details.
4449 \layout Standard
4449 \layout Standard
4450
4450
4451 IPython also allows you to expand the value of python variables when making
4451 IPython also allows you to expand the value of python variables when making
4452 system calls.
4452 system calls.
4453 Any python variable or expression which you prepend with
4453 Any python variable or expression which you prepend with
4454 \family typewriter
4454 \family typewriter
4455 $
4455 $
4456 \family default
4456 \family default
4457 will get expanded before the system call is made.
4457 will get expanded before the system call is made.
4458
4458
4459 \layout Standard
4459 \layout Standard
4460
4460
4461
4461
4462 \family typewriter
4462 \family typewriter
4463 In [1]: pyvar='Hello world'
4463 In [1]: pyvar='Hello world'
4464 \newline
4464 \newline
4465 In [2]: !echo "A python variable: $pyvar"
4465 In [2]: !echo "A python variable: $pyvar"
4466 \newline
4466 \newline
4467 A python variable: Hello world
4467 A python variable: Hello world
4468 \layout Standard
4468 \layout Standard
4469
4469
4470 If you want the shell to actually see a literal
4470 If you want the shell to actually see a literal
4471 \family typewriter
4471 \family typewriter
4472 $
4472 $
4473 \family default
4473 \family default
4474 , you need to type it twice:
4474 , you need to type it twice:
4475 \layout Standard
4475 \layout Standard
4476
4476
4477
4477
4478 \family typewriter
4478 \family typewriter
4479 In [3]: !echo "A system variable: $$HOME"
4479 In [3]: !echo "A system variable: $$HOME"
4480 \newline
4480 \newline
4481 A system variable: /home/fperez
4481 A system variable: /home/fperez
4482 \layout Standard
4482 \layout Standard
4483
4483
4484 You can pass arbitrary expressions, though you'll need to delimit them with
4484 You can pass arbitrary expressions, though you'll need to delimit them with
4485
4485
4486 \family typewriter
4486 \family typewriter
4487 {}
4487 {}
4488 \family default
4488 \family default
4489 if there is ambiguity as to the extent of the expression:
4489 if there is ambiguity as to the extent of the expression:
4490 \layout Standard
4490 \layout Standard
4491
4491
4492
4492
4493 \family typewriter
4493 \family typewriter
4494 In [5]: x=10
4494 In [5]: x=10
4495 \newline
4495 \newline
4496 In [6]: y=20
4496 In [6]: y=20
4497 \newline
4497 \newline
4498 In [13]: !echo $x+y
4498 In [13]: !echo $x+y
4499 \newline
4499 \newline
4500 10+y
4500 10+y
4501 \newline
4501 \newline
4502 In [7]: !echo ${x+y}
4502 In [7]: !echo ${x+y}
4503 \newline
4503 \newline
4504 30
4504 30
4505 \layout Standard
4505 \layout Standard
4506
4506
4507 Even object attributes can be expanded:
4507 Even object attributes can be expanded:
4508 \layout Standard
4508 \layout Standard
4509
4509
4510
4510
4511 \family typewriter
4511 \family typewriter
4512 In [12]: !echo $sys.argv
4512 In [12]: !echo $sys.argv
4513 \newline
4513 \newline
4514 [/home/fperez/usr/bin/ipython]
4514 [/home/fperez/usr/bin/ipython]
4515 \layout Subsection
4515 \layout Subsection
4516
4516
4517 System command aliases
4517 System command aliases
4518 \layout Standard
4518 \layout Standard
4519
4519
4520 The
4520 The
4521 \family typewriter
4521 \family typewriter
4522 %alias
4522 %alias
4523 \family default
4523 \family default
4524 magic function and the
4524 magic function and the
4525 \family typewriter
4525 \family typewriter
4526 alias
4526 alias
4527 \family default
4527 \family default
4528 option in the
4528 option in the
4529 \family typewriter
4529 \family typewriter
4530 ipythonrc
4530 ipythonrc
4531 \family default
4531 \family default
4532 configuration file allow you to define magic functions which are in fact
4532 configuration file allow you to define magic functions which are in fact
4533 system shell commands.
4533 system shell commands.
4534 These aliases can have parameters.
4534 These aliases can have parameters.
4535
4535
4536 \layout Standard
4536 \layout Standard
4537
4537
4538 '
4538 '
4539 \family typewriter
4539 \family typewriter
4540 %alias alias_name cmd
4540 %alias alias_name cmd
4541 \family default
4541 \family default
4542 ' defines '
4542 ' defines '
4543 \family typewriter
4543 \family typewriter
4544 alias_name
4544 alias_name
4545 \family default
4545 \family default
4546 ' as an alias for '
4546 ' as an alias for '
4547 \family typewriter
4547 \family typewriter
4548 cmd
4548 cmd
4549 \family default
4549 \family default
4550 '
4550 '
4551 \layout Standard
4551 \layout Standard
4552
4552
4553 Then, typing '
4553 Then, typing '
4554 \family typewriter
4554 \family typewriter
4555 %alias_name params
4555 %alias_name params
4556 \family default
4556 \family default
4557 ' will execute the system command '
4557 ' will execute the system command '
4558 \family typewriter
4558 \family typewriter
4559 cmd params
4559 cmd params
4560 \family default
4560 \family default
4561 ' (from your underlying operating system).
4561 ' (from your underlying operating system).
4562
4562
4563 \layout Standard
4563 \layout Standard
4564
4564
4565 You can also define aliases with parameters using
4565 You can also define aliases with parameters using
4566 \family typewriter
4566 \family typewriter
4567 %s
4567 %s
4568 \family default
4568 \family default
4569 specifiers (one per parameter).
4569 specifiers (one per parameter).
4570 The following example defines the
4570 The following example defines the
4571 \family typewriter
4571 \family typewriter
4572 %parts
4572 %parts
4573 \family default
4573 \family default
4574 function as an alias to the command '
4574 function as an alias to the command '
4575 \family typewriter
4575 \family typewriter
4576 echo first %s second %s
4576 echo first %s second %s
4577 \family default
4577 \family default
4578 ' where each
4578 ' where each
4579 \family typewriter
4579 \family typewriter
4580 %s
4580 %s
4581 \family default
4581 \family default
4582 will be replaced by a positional parameter to the call to
4582 will be replaced by a positional parameter to the call to
4583 \family typewriter
4583 \family typewriter
4584 %parts:
4584 %parts:
4585 \layout Standard
4585 \layout Standard
4586
4586
4587
4587
4588 \family typewriter
4588 \family typewriter
4589 In [1]: alias parts echo first %s second %s
4589 In [1]: alias parts echo first %s second %s
4590 \newline
4590 \newline
4591 In [2]: %parts A B
4591 In [2]: %parts A B
4592 \newline
4592 \newline
4593 first A second B
4593 first A second B
4594 \newline
4594 \newline
4595 In [3]: %parts A
4595 In [3]: %parts A
4596 \newline
4596 \newline
4597 Incorrect number of arguments: 2 expected.
4597 Incorrect number of arguments: 2 expected.
4598
4598
4599 \newline
4599 \newline
4600 parts is an alias to: 'echo first %s second %s'
4600 parts is an alias to: 'echo first %s second %s'
4601 \layout Standard
4601 \layout Standard
4602
4602
4603 If called with no parameters,
4603 If called with no parameters,
4604 \family typewriter
4604 \family typewriter
4605 %alias
4605 %alias
4606 \family default
4606 \family default
4607 prints the table of currently defined aliases.
4607 prints the table of currently defined aliases.
4608 \layout Standard
4608 \layout Standard
4609
4609
4610 The
4610 The
4611 \family typewriter
4611 \family typewriter
4612 %rehash/rehashx
4612 %rehash/rehashx
4613 \family default
4613 \family default
4614 magics allow you to load your entire
4614 magics allow you to load your entire
4615 \family typewriter
4615 \family typewriter
4616 $PATH
4616 $PATH
4617 \family default
4617 \family default
4618 as ipython aliases.
4618 as ipython aliases.
4619 See their respective docstrings (or sec.\SpecialChar ~
4619 See their respective docstrings (or sec.\SpecialChar ~
4620
4620
4621 \begin_inset LatexCommand \ref{sec:magic}
4621 \begin_inset LatexCommand \ref{sec:magic}
4622
4622
4623 \end_inset
4623 \end_inset
4624
4624
4625 for further details).
4625 for further details).
4626 \layout Subsection
4626 \layout Subsection
4627
4627
4628
4628
4629 \begin_inset LatexCommand \label{sec:dreload}
4629 \begin_inset LatexCommand \label{sec:dreload}
4630
4630
4631 \end_inset
4631 \end_inset
4632
4632
4633 Recursive reload
4633 Recursive reload
4634 \layout Standard
4634 \layout Standard
4635
4635
4636 The
4636 The
4637 \family typewriter
4637 \family typewriter
4638 %dreload
4638 %dreload
4639 \family default
4639 \family default
4640 command does a recursive reload of a module: changes made to the module
4640 command does a recursive reload of a module: changes made to the module
4641 since you imported will actually be available without having to exit.
4641 since you imported will actually be available without having to exit.
4642 \layout Subsection
4642 \layout Subsection
4643
4643
4644 Verbose and colored exception traceback printouts
4644 Verbose and colored exception traceback printouts
4645 \layout Standard
4645 \layout Standard
4646
4646
4647 IPython provides the option to see very detailed exception tracebacks, which
4647 IPython provides the option to see very detailed exception tracebacks, which
4648 can be especially useful when debugging large programs.
4648 can be especially useful when debugging large programs.
4649 You can run any Python file with the
4649 You can run any Python file with the
4650 \family typewriter
4650 \family typewriter
4651 %run
4651 %run
4652 \family default
4652 \family default
4653 function to benefit from these detailed tracebacks.
4653 function to benefit from these detailed tracebacks.
4654 Furthermore, both normal and verbose tracebacks can be colored (if your
4654 Furthermore, both normal and verbose tracebacks can be colored (if your
4655 terminal supports it) which makes them much easier to parse visually.
4655 terminal supports it) which makes them much easier to parse visually.
4656 \layout Standard
4656 \layout Standard
4657
4657
4658 See the magic
4658 See the magic
4659 \family typewriter
4659 \family typewriter
4660 xmode
4660 xmode
4661 \family default
4661 \family default
4662 and
4662 and
4663 \family typewriter
4663 \family typewriter
4664 colors
4664 colors
4665 \family default
4665 \family default
4666 functions for details (just type
4666 functions for details (just type
4667 \family typewriter
4667 \family typewriter
4668 %magic
4668 %magic
4669 \family default
4669 \family default
4670 ).
4670 ).
4671 \layout Standard
4671 \layout Standard
4672
4672
4673 These features are basically a terminal version of Ka-Ping Yee's
4673 These features are basically a terminal version of Ka-Ping Yee's
4674 \family typewriter
4674 \family typewriter
4675 cgitb
4675 cgitb
4676 \family default
4676 \family default
4677 module, now part of the standard Python library.
4677 module, now part of the standard Python library.
4678 \layout Subsection
4678 \layout Subsection
4679
4679
4680
4680
4681 \begin_inset LatexCommand \label{sec:cache_input}
4681 \begin_inset LatexCommand \label{sec:cache_input}
4682
4682
4683 \end_inset
4683 \end_inset
4684
4684
4685 Input caching system
4685 Input caching system
4686 \layout Standard
4686 \layout Standard
4687
4687
4688 IPython offers numbered prompts (In/Out) with input and output caching.
4688 IPython offers numbered prompts (In/Out) with input and output caching.
4689 All input is saved and can be retrieved as variables (besides the usual
4689 All input is saved and can be retrieved as variables (besides the usual
4690 arrow key recall).
4690 arrow key recall).
4691 \layout Standard
4691 \layout Standard
4692
4692
4693 The following GLOBAL variables always exist (so don't overwrite them!):
4693 The following GLOBAL variables always exist (so don't overwrite them!):
4694
4694
4695 \family typewriter
4695 \family typewriter
4696 _i
4696 _i
4697 \family default
4697 \family default
4698 : stores previous input.
4698 : stores previous input.
4699
4699
4700 \family typewriter
4700 \family typewriter
4701 _ii
4701 _ii
4702 \family default
4702 \family default
4703 : next previous.
4703 : next previous.
4704
4704
4705 \family typewriter
4705 \family typewriter
4706 _iii
4706 _iii
4707 \family default
4707 \family default
4708 : next-next previous.
4708 : next-next previous.
4709
4709
4710 \family typewriter
4710 \family typewriter
4711 _ih
4711 _ih
4712 \family default
4712 \family default
4713 : a list of all input
4713 : a list of all input
4714 \family typewriter
4714 \family typewriter
4715 _ih[n]
4715 _ih[n]
4716 \family default
4716 \family default
4717 is the input from line
4717 is the input from line
4718 \family typewriter
4718 \family typewriter
4719 n
4719 n
4720 \family default
4720 \family default
4721 and this list is aliased to the global variable
4721 and this list is aliased to the global variable
4722 \family typewriter
4722 \family typewriter
4723 In
4723 In
4724 \family default
4724 \family default
4725 .
4725 .
4726 If you overwrite
4726 If you overwrite
4727 \family typewriter
4727 \family typewriter
4728 In
4728 In
4729 \family default
4729 \family default
4730 with a variable of your own, you can remake the assignment to the internal
4730 with a variable of your own, you can remake the assignment to the internal
4731 list with a simple
4731 list with a simple
4732 \family typewriter
4732 \family typewriter
4733 'In=_ih'
4733 'In=_ih'
4734 \family default
4734 \family default
4735 .
4735 .
4736 \layout Standard
4736 \layout Standard
4737
4737
4738 Additionally, global variables named
4738 Additionally, global variables named
4739 \family typewriter
4739 \family typewriter
4740 _i<n>
4740 _i<n>
4741 \family default
4741 \family default
4742 are dynamically created (
4742 are dynamically created (
4743 \family typewriter
4743 \family typewriter
4744 <n>
4744 <n>
4745 \family default
4745 \family default
4746 being the prompt counter), such that
4746 being the prompt counter), such that
4747 \newline
4747 \newline
4748
4748
4749 \family typewriter
4749 \family typewriter
4750 _i<n> == _ih[<n>] == In[<n>].
4750 _i<n> == _ih[<n>] == In[<n>].
4751 \layout Standard
4751 \layout Standard
4752
4752
4753 For example, what you typed at prompt 14 is available as
4753 For example, what you typed at prompt 14 is available as
4754 \family typewriter
4754 \family typewriter
4755 _i14,
4755 _i14,
4756 \family default
4756 \family default
4757
4757
4758 \family typewriter
4758 \family typewriter
4759 _ih[14]
4759 _ih[14]
4760 \family default
4760 \family default
4761 and
4761 and
4762 \family typewriter
4762 \family typewriter
4763 In[14]
4763 In[14]
4764 \family default
4764 \family default
4765 .
4765 .
4766 \layout Standard
4766 \layout Standard
4767
4767
4768 This allows you to easily cut and paste multi line interactive prompts by
4768 This allows you to easily cut and paste multi line interactive prompts by
4769 printing them out: they print like a clean string, without prompt characters.
4769 printing them out: they print like a clean string, without prompt characters.
4770 You can also manipulate them like regular variables (they are strings),
4770 You can also manipulate them like regular variables (they are strings),
4771 modify or exec them (typing
4771 modify or exec them (typing
4772 \family typewriter
4772 \family typewriter
4773 'exec _i9'
4773 'exec _i9'
4774 \family default
4774 \family default
4775 will re-execute the contents of input prompt 9, '
4775 will re-execute the contents of input prompt 9, '
4776 \family typewriter
4776 \family typewriter
4777 exec In[9:14]+In[18]
4777 exec In[9:14]+In[18]
4778 \family default
4778 \family default
4779 ' will re-execute lines 9 through 13 and line 18).
4779 ' will re-execute lines 9 through 13 and line 18).
4780 \layout Standard
4780 \layout Standard
4781
4781
4782 You can also re-execute multiple lines of input easily by using the magic
4782 You can also re-execute multiple lines of input easily by using the magic
4783
4783
4784 \family typewriter
4784 \family typewriter
4785 %macro
4785 %macro
4786 \family default
4786 \family default
4787 function (which automates the process and allows re-execution without having
4787 function (which automates the process and allows re-execution without having
4788 to type '
4788 to type '
4789 \family typewriter
4789 \family typewriter
4790 exec
4790 exec
4791 \family default
4791 \family default
4792 ' every time).
4792 ' every time).
4793 The macro system also allows you to re-execute previous lines which include
4793 The macro system also allows you to re-execute previous lines which include
4794 magic function calls (which require special processing).
4794 magic function calls (which require special processing).
4795 Type
4795 Type
4796 \family typewriter
4796 \family typewriter
4797 %macro?
4797 %macro?
4798 \family default
4798 \family default
4799 or see sec.
4799 or see sec.
4800
4800
4801 \begin_inset LatexCommand \ref{sec:magic}
4801 \begin_inset LatexCommand \ref{sec:magic}
4802
4802
4803 \end_inset
4803 \end_inset
4804
4804
4805 for more details on the macro system.
4805 for more details on the macro system.
4806 \layout Standard
4806 \layout Standard
4807
4807
4808 A history function
4808 A history function
4809 \family typewriter
4809 \family typewriter
4810 %hist
4810 %hist
4811 \family default
4811 \family default
4812 allows you to see any part of your input history by printing a range of
4812 allows you to see any part of your input history by printing a range of
4813 the
4813 the
4814 \family typewriter
4814 \family typewriter
4815 _i
4815 _i
4816 \family default
4816 \family default
4817 variables.
4817 variables.
4818 \layout Subsection
4818 \layout Subsection
4819
4819
4820
4820
4821 \begin_inset LatexCommand \label{sec:cache_output}
4821 \begin_inset LatexCommand \label{sec:cache_output}
4822
4822
4823 \end_inset
4823 \end_inset
4824
4824
4825 Output caching system
4825 Output caching system
4826 \layout Standard
4826 \layout Standard
4827
4827
4828 For output that is returned from actions, a system similar to the input
4828 For output that is returned from actions, a system similar to the input
4829 cache exists but using
4829 cache exists but using
4830 \family typewriter
4830 \family typewriter
4831 _
4831 _
4832 \family default
4832 \family default
4833 instead of
4833 instead of
4834 \family typewriter
4834 \family typewriter
4835 _i
4835 _i
4836 \family default
4836 \family default
4837 .
4837 .
4838 Only actions that produce a result (NOT assignments, for example) are cached.
4838 Only actions that produce a result (NOT assignments, for example) are cached.
4839 If you are familiar with Mathematica, IPython's
4839 If you are familiar with Mathematica, IPython's
4840 \family typewriter
4840 \family typewriter
4841 _
4841 _
4842 \family default
4842 \family default
4843 variables behave exactly like Mathematica's
4843 variables behave exactly like Mathematica's
4844 \family typewriter
4844 \family typewriter
4845 %
4845 %
4846 \family default
4846 \family default
4847 variables.
4847 variables.
4848 \layout Standard
4848 \layout Standard
4849
4849
4850 The following GLOBAL variables always exist (so don't overwrite them!):
4850 The following GLOBAL variables always exist (so don't overwrite them!):
4851
4851
4852 \layout List
4852 \layout List
4853 \labelwidthstring 00.00.0000
4853 \labelwidthstring 00.00.0000
4854
4854
4855
4855
4856 \family typewriter
4856 \family typewriter
4857 \series bold
4857 \series bold
4858 _
4858 _
4859 \family default
4859 \family default
4860 \series default
4860 \series default
4861 (a
4861 (a
4862 \emph on
4862 \emph on
4863 single
4863 single
4864 \emph default
4864 \emph default
4865 underscore) : stores previous output, like Python's default interpreter.
4865 underscore) : stores previous output, like Python's default interpreter.
4866 \layout List
4866 \layout List
4867 \labelwidthstring 00.00.0000
4867 \labelwidthstring 00.00.0000
4868
4868
4869
4869
4870 \family typewriter
4870 \family typewriter
4871 \series bold
4871 \series bold
4872 __
4872 __
4873 \family default
4873 \family default
4874 \series default
4874 \series default
4875 (two underscores): next previous.
4875 (two underscores): next previous.
4876 \layout List
4876 \layout List
4877 \labelwidthstring 00.00.0000
4877 \labelwidthstring 00.00.0000
4878
4878
4879
4879
4880 \family typewriter
4880 \family typewriter
4881 \series bold
4881 \series bold
4882 ___
4882 ___
4883 \family default
4883 \family default
4884 \series default
4884 \series default
4885 (three underscores): next-next previous.
4885 (three underscores): next-next previous.
4886 \layout Standard
4886 \layout Standard
4887
4887
4888 Additionally, global variables named
4888 Additionally, global variables named
4889 \family typewriter
4889 \family typewriter
4890 _<n>
4890 _<n>
4891 \family default
4891 \family default
4892 are dynamically created (
4892 are dynamically created (
4893 \family typewriter
4893 \family typewriter
4894 <n>
4894 <n>
4895 \family default
4895 \family default
4896 being the prompt counter), such that the result of output
4896 being the prompt counter), such that the result of output
4897 \family typewriter
4897 \family typewriter
4898 <n>
4898 <n>
4899 \family default
4899 \family default
4900 is always available as
4900 is always available as
4901 \family typewriter
4901 \family typewriter
4902 _<n>
4902 _<n>
4903 \family default
4903 \family default
4904 (don't use the angle brackets, just the number, e.g.
4904 (don't use the angle brackets, just the number, e.g.
4905
4905
4906 \family typewriter
4906 \family typewriter
4907 _21
4907 _21
4908 \family default
4908 \family default
4909 ).
4909 ).
4910 \layout Standard
4910 \layout Standard
4911
4911
4912 These global variables are all stored in a global dictionary (not a list,
4912 These global variables are all stored in a global dictionary (not a list,
4913 since it only has entries for lines which returned a result) available
4913 since it only has entries for lines which returned a result) available
4914 under the names
4914 under the names
4915 \family typewriter
4915 \family typewriter
4916 _oh
4916 _oh
4917 \family default
4917 \family default
4918 and
4918 and
4919 \family typewriter
4919 \family typewriter
4920 Out
4920 Out
4921 \family default
4921 \family default
4922 (similar to
4922 (similar to
4923 \family typewriter
4923 \family typewriter
4924 _ih
4924 _ih
4925 \family default
4925 \family default
4926 and
4926 and
4927 \family typewriter
4927 \family typewriter
4928 In
4928 In
4929 \family default
4929 \family default
4930 ).
4930 ).
4931 So the output from line 12 can be obtained as
4931 So the output from line 12 can be obtained as
4932 \family typewriter
4932 \family typewriter
4933 _12
4933 _12
4934 \family default
4934 \family default
4935 ,
4935 ,
4936 \family typewriter
4936 \family typewriter
4937 Out[12]
4937 Out[12]
4938 \family default
4938 \family default
4939 or
4939 or
4940 \family typewriter
4940 \family typewriter
4941 _oh[12]
4941 _oh[12]
4942 \family default
4942 \family default
4943 .
4943 .
4944 If you accidentally overwrite the
4944 If you accidentally overwrite the
4945 \family typewriter
4945 \family typewriter
4946 Out
4946 Out
4947 \family default
4947 \family default
4948 variable you can recover it by typing
4948 variable you can recover it by typing
4949 \family typewriter
4949 \family typewriter
4950 'Out=_oh
4950 'Out=_oh
4951 \family default
4951 \family default
4952 ' at the prompt.
4952 ' at the prompt.
4953 \layout Standard
4953 \layout Standard
4954
4954
4955 This system obviously can potentially put heavy memory demands on your system,
4955 This system obviously can potentially put heavy memory demands on your system,
4956 since it prevents Python's garbage collector from removing any previously
4956 since it prevents Python's garbage collector from removing any previously
4957 computed results.
4957 computed results.
4958 You can control how many results are kept in memory with the option (at
4958 You can control how many results are kept in memory with the option (at
4959 the command line or in your
4959 the command line or in your
4960 \family typewriter
4960 \family typewriter
4961 ipythonrc
4961 ipythonrc
4962 \family default
4962 \family default
4963 file)
4963 file)
4964 \family typewriter
4964 \family typewriter
4965 cache_size
4965 cache_size
4966 \family default
4966 \family default
4967 .
4967 .
4968 If you set it to 0, the whole system is completely disabled and the prompts
4968 If you set it to 0, the whole system is completely disabled and the prompts
4969 revert to the classic
4969 revert to the classic
4970 \family typewriter
4970 \family typewriter
4971 '>>>'
4971 '>>>'
4972 \family default
4972 \family default
4973 of normal Python.
4973 of normal Python.
4974 \layout Subsection
4974 \layout Subsection
4975
4975
4976 Directory history
4976 Directory history
4977 \layout Standard
4977 \layout Standard
4978
4978
4979 Your history of visited directories is kept in the global list
4979 Your history of visited directories is kept in the global list
4980 \family typewriter
4980 \family typewriter
4981 _dh
4981 _dh
4982 \family default
4982 \family default
4983 , and the magic
4983 , and the magic
4984 \family typewriter
4984 \family typewriter
4985 %cd
4985 %cd
4986 \family default
4986 \family default
4987 command can be used to go to any entry in that list.
4987 command can be used to go to any entry in that list.
4988 The
4988 The
4989 \family typewriter
4989 \family typewriter
4990 %dhist
4990 %dhist
4991 \family default
4991 \family default
4992 command allows you to view this history.
4992 command allows you to view this history.
4993 \layout Subsection
4993 \layout Subsection
4994
4994
4995 Automatic parentheses and quotes
4995 Automatic parentheses and quotes
4996 \layout Standard
4996 \layout Standard
4997
4997
4998 These features were adapted from Nathan Gray's LazyPython.
4998 These features were adapted from Nathan Gray's LazyPython.
4999 They are meant to allow less typing for common situations.
4999 They are meant to allow less typing for common situations.
5000 \layout Subsubsection
5000 \layout Subsubsection
5001
5001
5002 Automatic parentheses
5002 Automatic parentheses
5003 \layout Standard
5003 \layout Standard
5004
5004
5005 Callable objects (i.e.
5005 Callable objects (i.e.
5006 functions, methods, etc) can be invoked like this (notice the commas between
5006 functions, methods, etc) can be invoked like this (notice the commas between
5007 the arguments):
5007 the arguments):
5008 \layout Standard
5008 \layout Standard
5009
5009
5010
5010
5011 \family typewriter
5011 \family typewriter
5012 >>> callable_ob arg1, arg2, arg3
5012 >>> callable_ob arg1, arg2, arg3
5013 \layout Standard
5013 \layout Standard
5014
5014
5015 and the input will be translated to this:
5015 and the input will be translated to this:
5016 \layout Standard
5016 \layout Standard
5017
5017
5018
5018
5019 \family typewriter
5019 \family typewriter
5020 --> callable_ob(arg1, arg2, arg3)
5020 --> callable_ob(arg1, arg2, arg3)
5021 \layout Standard
5021 \layout Standard
5022
5022
5023 You can force automatic parentheses by using '/' as the first character
5023 You can force automatic parentheses by using '/' as the first character
5024 of a line.
5024 of a line.
5025 For example:
5025 For example:
5026 \layout Standard
5026 \layout Standard
5027
5027
5028
5028
5029 \family typewriter
5029 \family typewriter
5030 >>> /globals # becomes 'globals()'
5030 >>> /globals # becomes 'globals()'
5031 \layout Standard
5031 \layout Standard
5032
5032
5033 Note that the '/' MUST be the first character on the line! This won't work:
5033 Note that the '/' MUST be the first character on the line! This won't work:
5034
5034
5035 \layout Standard
5035 \layout Standard
5036
5036
5037
5037
5038 \family typewriter
5038 \family typewriter
5039 >>> print /globals # syntax error
5039 >>> print /globals # syntax error
5040 \layout Standard
5040 \layout Standard
5041
5041
5042 In most cases the automatic algorithm should work, so you should rarely
5042 In most cases the automatic algorithm should work, so you should rarely
5043 need to explicitly invoke /.
5043 need to explicitly invoke /.
5044 One notable exception is if you are trying to call a function with a list
5044 One notable exception is if you are trying to call a function with a list
5045 of tuples as arguments (the parenthesis will confuse IPython):
5045 of tuples as arguments (the parenthesis will confuse IPython):
5046 \layout Standard
5046 \layout Standard
5047
5047
5048
5048
5049 \family typewriter
5049 \family typewriter
5050 In [1]: zip (1,2,3),(4,5,6) # won't work
5050 In [1]: zip (1,2,3),(4,5,6) # won't work
5051 \layout Standard
5051 \layout Standard
5052
5052
5053 but this will work:
5053 but this will work:
5054 \layout Standard
5054 \layout Standard
5055
5055
5056
5056
5057 \family typewriter
5057 \family typewriter
5058 In [2]: /zip (1,2,3),(4,5,6)
5058 In [2]: /zip (1,2,3),(4,5,6)
5059 \newline
5059 \newline
5060 ------> zip ((1,2,3),(4,5,6))
5060 ------> zip ((1,2,3),(4,5,6))
5061 \newline
5061 \newline
5062 Out[2]= [(1, 4), (2, 5), (3, 6)]
5062 Out[2]= [(1, 4), (2, 5), (3, 6)]
5063 \layout Standard
5063 \layout Standard
5064
5064
5065 IPython tells you that it has altered your command line by displaying the
5065 IPython tells you that it has altered your command line by displaying the
5066 new command line preceded by
5066 new command line preceded by
5067 \family typewriter
5067 \family typewriter
5068 -->
5068 -->
5069 \family default
5069 \family default
5070 .
5070 .
5071 e.g.:
5071 e.g.:
5072 \layout Standard
5072 \layout Standard
5073
5073
5074
5074
5075 \family typewriter
5075 \family typewriter
5076 In [18]: callable list
5076 In [18]: callable list
5077 \newline
5077 \newline
5078 -------> callable (list)
5078 -------> callable (list)
5079 \layout Subsubsection
5079 \layout Subsubsection
5080
5080
5081 Automatic quoting
5081 Automatic quoting
5082 \layout Standard
5082 \layout Standard
5083
5083
5084 You can force automatic quoting of a function's arguments by using
5084 You can force automatic quoting of a function's arguments by using
5085 \family typewriter
5085 \family typewriter
5086 `,'
5086 `,'
5087 \family default
5087 \family default
5088 or
5088 or
5089 \family typewriter
5089 \family typewriter
5090 `;'
5090 `;'
5091 \family default
5091 \family default
5092 as the first character of a line.
5092 as the first character of a line.
5093 For example:
5093 For example:
5094 \layout Standard
5094 \layout Standard
5095
5095
5096
5096
5097 \family typewriter
5097 \family typewriter
5098 >>> ,my_function /home/me # becomes my_function("/home/me")
5098 >>> ,my_function /home/me # becomes my_function("/home/me")
5099 \layout Standard
5099 \layout Standard
5100
5100
5101 If you use
5101 If you use
5102 \family typewriter
5102 \family typewriter
5103 `;'
5103 `;'
5104 \family default
5104 \family default
5105 instead, the whole argument is quoted as a single string (while
5105 instead, the whole argument is quoted as a single string (while
5106 \family typewriter
5106 \family typewriter
5107 `,'
5107 `,'
5108 \family default
5108 \family default
5109 splits on whitespace):
5109 splits on whitespace):
5110 \layout Standard
5110 \layout Standard
5111
5111
5112
5112
5113 \family typewriter
5113 \family typewriter
5114 >>> ,my_function a b c # becomes my_function("a","b","c")
5114 >>> ,my_function a b c # becomes my_function("a","b","c")
5115 \layout Standard
5115 \layout Standard
5116
5116
5117
5117
5118 \family typewriter
5118 \family typewriter
5119 >>> ;my_function a b c # becomes my_function("a b c")
5119 >>> ;my_function a b c # becomes my_function("a b c")
5120 \layout Standard
5120 \layout Standard
5121
5121
5122 Note that the `
5122 Note that the `
5123 \family typewriter
5123 \family typewriter
5124 ,
5124 ,
5125 \family default
5125 \family default
5126 ' or `
5126 ' or `
5127 \family typewriter
5127 \family typewriter
5128 ;
5128 ;
5129 \family default
5129 \family default
5130 ' MUST be the first character on the line! This won't work:
5130 ' MUST be the first character on the line! This won't work:
5131 \layout Standard
5131 \layout Standard
5132
5132
5133
5133
5134 \family typewriter
5134 \family typewriter
5135 >>> x = ,my_function /home/me # syntax error
5135 >>> x = ,my_function /home/me # syntax error
5136 \layout Section
5136 \layout Section
5137
5137
5138
5138
5139 \begin_inset LatexCommand \label{sec:customization}
5139 \begin_inset LatexCommand \label{sec:customization}
5140
5140
5141 \end_inset
5141 \end_inset
5142
5142
5143 Customization
5143 Customization
5144 \layout Standard
5144 \layout Standard
5145
5145
5146 As we've already mentioned, IPython reads a configuration file which can
5146 As we've already mentioned, IPython reads a configuration file which can
5147 be specified at the command line (
5147 be specified at the command line (
5148 \family typewriter
5148 \family typewriter
5149 -rcfile
5149 -rcfile
5150 \family default
5150 \family default
5151 ) or which by default is assumed to be called
5151 ) or which by default is assumed to be called
5152 \family typewriter
5152 \family typewriter
5153 ipythonrc
5153 ipythonrc
5154 \family default
5154 \family default
5155 .
5155 .
5156 Such a file is looked for in the current directory where IPython is started
5156 Such a file is looked for in the current directory where IPython is started
5157 and then in your
5157 and then in your
5158 \family typewriter
5158 \family typewriter
5159 IPYTHONDIR
5159 IPYTHONDIR
5160 \family default
5160 \family default
5161 , which allows you to have local configuration files for specific projects.
5161 , which allows you to have local configuration files for specific projects.
5162 In this section we will call these types of configuration files simply
5162 In this section we will call these types of configuration files simply
5163 rcfiles (short for resource configuration file).
5163 rcfiles (short for resource configuration file).
5164 \layout Standard
5164 \layout Standard
5165
5165
5166 The syntax of an rcfile is one of key-value pairs separated by whitespace,
5166 The syntax of an rcfile is one of key-value pairs separated by whitespace,
5167 one per line.
5167 one per line.
5168 Lines beginning with a
5168 Lines beginning with a
5169 \family typewriter
5169 \family typewriter
5170 #
5170 #
5171 \family default
5171 \family default
5172 are ignored as comments, but comments can
5172 are ignored as comments, but comments can
5173 \series bold
5173 \series bold
5174 not
5174 not
5175 \series default
5175 \series default
5176 be put on lines with data (the parser is fairly primitive).
5176 be put on lines with data (the parser is fairly primitive).
5177 Note that these are not python files, and this is deliberate, because it
5177 Note that these are not python files, and this is deliberate, because it
5178 allows us to do some things which would be quite tricky to implement if
5178 allows us to do some things which would be quite tricky to implement if
5179 they were normal python files.
5179 they were normal python files.
5180 \layout Standard
5180 \layout Standard
5181
5181
5182 First, an rcfile can contain permanent default values for almost all command
5182 First, an rcfile can contain permanent default values for almost all command
5183 line options (except things like
5183 line options (except things like
5184 \family typewriter
5184 \family typewriter
5185 -help
5185 -help
5186 \family default
5186 \family default
5187 or
5187 or
5188 \family typewriter
5188 \family typewriter
5189 -Version
5189 -Version
5190 \family default
5190 \family default
5191 ).
5191 ).
5192 Sec\SpecialChar ~
5192 Sec\SpecialChar ~
5193
5193
5194 \begin_inset LatexCommand \ref{sec:cmd-line-opts}
5194 \begin_inset LatexCommand \ref{sec:cmd-line-opts}
5195
5195
5196 \end_inset
5196 \end_inset
5197
5197
5198 contains a description of all command-line options.
5198 contains a description of all command-line options.
5199 However, values you explicitly specify at the command line override the
5199 However, values you explicitly specify at the command line override the
5200 values defined in the rcfile.
5200 values defined in the rcfile.
5201 \layout Standard
5201 \layout Standard
5202
5202
5203 Besides command line option values, the rcfile can specify values for certain
5203 Besides command line option values, the rcfile can specify values for certain
5204 extra special options which are not available at the command line.
5204 extra special options which are not available at the command line.
5205 These options are briefly described below.
5205 These options are briefly described below.
5206
5206
5207 \layout Standard
5207 \layout Standard
5208
5208
5209 Each of these options may appear as many times as you need it in the file.
5209 Each of these options may appear as many times as you need it in the file.
5210 \layout List
5210 \layout List
5211 \labelwidthstring 00.00.0000
5211 \labelwidthstring 00.00.0000
5212
5212
5213
5213
5214 \family typewriter
5214 \family typewriter
5215 \series bold
5215 \series bold
5216 include\SpecialChar ~
5216 include\SpecialChar ~
5217 <file1>\SpecialChar ~
5217 <file1>\SpecialChar ~
5218 <file2>\SpecialChar ~
5218 <file2>\SpecialChar ~
5219 ...
5219 ...
5220 \family default
5220 \family default
5221 \series default
5221 \series default
5222 : you can name
5222 : you can name
5223 \emph on
5223 \emph on
5224 other
5224 other
5225 \emph default
5225 \emph default
5226 rcfiles you want to recursively load up to 15 levels (don't use the
5226 rcfiles you want to recursively load up to 15 levels (don't use the
5227 \family typewriter
5227 \family typewriter
5228 <>
5228 <>
5229 \family default
5229 \family default
5230 brackets in your names!).
5230 brackets in your names!).
5231 This feature allows you to define a 'base' rcfile with general options
5231 This feature allows you to define a 'base' rcfile with general options
5232 and special-purpose files which can be loaded only when needed with particular
5232 and special-purpose files which can be loaded only when needed with particular
5233 configuration options.
5233 configuration options.
5234 To make this more convenient, IPython accepts the
5234 To make this more convenient, IPython accepts the
5235 \family typewriter
5235 \family typewriter
5236 -profile <name>
5236 -profile <name>
5237 \family default
5237 \family default
5238 option (abbreviates to
5238 option (abbreviates to
5239 \family typewriter
5239 \family typewriter
5240 -p <name
5240 -p <name
5241 \family default
5241 \family default
5242 >)
5242 >)
5243 \family typewriter
5243 \family typewriter
5244 which
5244 which
5245 \family default
5245 \family default
5246 tells it to look for an rcfile named
5246 tells it to look for an rcfile named
5247 \family typewriter
5247 \family typewriter
5248 ipythonrc-<name>
5248 ipythonrc-<name>
5249 \family default
5249 \family default
5250 .
5250 .
5251
5251
5252 \layout List
5252 \layout List
5253 \labelwidthstring 00.00.0000
5253 \labelwidthstring 00.00.0000
5254
5254
5255
5255
5256 \family typewriter
5256 \family typewriter
5257 \series bold
5257 \series bold
5258 import_mod\SpecialChar ~
5258 import_mod\SpecialChar ~
5259 <mod1>\SpecialChar ~
5259 <mod1>\SpecialChar ~
5260 <mod2>\SpecialChar ~
5260 <mod2>\SpecialChar ~
5261 ...
5261 ...
5262 \family default
5262 \family default
5263 \series default
5263 \series default
5264 : import modules with '
5264 : import modules with '
5265 \family typewriter
5265 \family typewriter
5266 import
5266 import
5267 \family default
5267 \family default
5268
5268
5269 \family typewriter
5269 \family typewriter
5270 <mod1>,<mod2>,...
5270 <mod1>,<mod2>,...
5271 \family default
5271 \family default
5272 '
5272 '
5273 \layout List
5273 \layout List
5274 \labelwidthstring 00.00.0000
5274 \labelwidthstring 00.00.0000
5275
5275
5276
5276
5277 \family typewriter
5277 \family typewriter
5278 \series bold
5278 \series bold
5279 import_some\SpecialChar ~
5279 import_some\SpecialChar ~
5280 <mod>\SpecialChar ~
5280 <mod>\SpecialChar ~
5281 <f1>\SpecialChar ~
5281 <f1>\SpecialChar ~
5282 <f2>\SpecialChar ~
5282 <f2>\SpecialChar ~
5283 ...
5283 ...
5284 \family default
5284 \family default
5285 \series default
5285 \series default
5286 : import functions with '
5286 : import functions with '
5287 \family typewriter
5287 \family typewriter
5288 from <mod> import
5288 from <mod> import
5289 \family default
5289 \family default
5290
5290
5291 \family typewriter
5291 \family typewriter
5292 <f1>,<f2>,...
5292 <f1>,<f2>,...
5293 \family default
5293 \family default
5294 '
5294 '
5295 \layout List
5295 \layout List
5296 \labelwidthstring 00.00.0000
5296 \labelwidthstring 00.00.0000
5297
5297
5298
5298
5299 \family typewriter
5299 \family typewriter
5300 \series bold
5300 \series bold
5301 import_all\SpecialChar ~
5301 import_all\SpecialChar ~
5302 <mod1>\SpecialChar ~
5302 <mod1>\SpecialChar ~
5303 <mod2>\SpecialChar ~
5303 <mod2>\SpecialChar ~
5304 ...
5304 ...
5305 \family default
5305 \family default
5306 \series default
5306 \series default
5307 : for each module listed import functions with '
5307 : for each module listed import functions with '
5308 \family typewriter
5308 \family typewriter
5309 from <mod> import *
5309 from <mod> import *
5310 \family default
5310 \family default
5311 '
5311 '
5312 \layout List
5312 \layout List
5313 \labelwidthstring 00.00.0000
5313 \labelwidthstring 00.00.0000
5314
5314
5315
5315
5316 \family typewriter
5316 \family typewriter
5317 \series bold
5317 \series bold
5318 execute\SpecialChar ~
5318 execute\SpecialChar ~
5319 <python\SpecialChar ~
5319 <python\SpecialChar ~
5320 code>
5320 code>
5321 \family default
5321 \family default
5322 \series default
5322 \series default
5323 : give any single-line python code to be executed.
5323 : give any single-line python code to be executed.
5324 \layout List
5324 \layout List
5325 \labelwidthstring 00.00.0000
5325 \labelwidthstring 00.00.0000
5326
5326
5327
5327
5328 \family typewriter
5328 \family typewriter
5329 \series bold
5329 \series bold
5330 execfile\SpecialChar ~
5330 execfile\SpecialChar ~
5331 <filename>
5331 <filename>
5332 \family default
5332 \family default
5333 \series default
5333 \series default
5334 : execute the python file given with an '
5334 : execute the python file given with an '
5335 \family typewriter
5335 \family typewriter
5336 execfile(filename)
5336 execfile(filename)
5337 \family default
5337 \family default
5338 ' command.
5338 ' command.
5339 Username expansion is performed on the given names.
5339 Username expansion is performed on the given names.
5340 So if you need any amount of extra fancy customization that won't fit in
5340 So if you need any amount of extra fancy customization that won't fit in
5341 any of the above 'canned' options, you can just put it in a separate python
5341 any of the above 'canned' options, you can just put it in a separate python
5342 file and execute it.
5342 file and execute it.
5343 \layout List
5343 \layout List
5344 \labelwidthstring 00.00.0000
5344 \labelwidthstring 00.00.0000
5345
5345
5346
5346
5347 \family typewriter
5347 \family typewriter
5348 \series bold
5348 \series bold
5349 alias\SpecialChar ~
5349 alias\SpecialChar ~
5350 <alias_def>
5350 <alias_def>
5351 \family default
5351 \family default
5352 \series default
5352 \series default
5353 : this is equivalent to calling '
5353 : this is equivalent to calling '
5354 \family typewriter
5354 \family typewriter
5355 %alias\SpecialChar ~
5355 %alias\SpecialChar ~
5356 <alias_def>
5356 <alias_def>
5357 \family default
5357 \family default
5358 ' at the IPython command line.
5358 ' at the IPython command line.
5359 This way, from within IPython you can do common system tasks without having
5359 This way, from within IPython you can do common system tasks without having
5360 to exit it or use the
5360 to exit it or use the
5361 \family typewriter
5361 \family typewriter
5362 !
5362 !
5363 \family default
5363 \family default
5364 escape.
5364 escape.
5365 IPython isn't meant to be a shell replacement, but it is often very useful
5365 IPython isn't meant to be a shell replacement, but it is often very useful
5366 to be able to do things with files while testing code.
5366 to be able to do things with files while testing code.
5367 This gives you the flexibility to have within IPython any aliases you may
5367 This gives you the flexibility to have within IPython any aliases you may
5368 be used to under your normal system shell.
5368 be used to under your normal system shell.
5369 \layout Subsection
5369 \layout Subsection
5370
5370
5371
5371
5372 \begin_inset LatexCommand \label{sec:ipytonrc-sample}
5372 \begin_inset LatexCommand \label{sec:ipytonrc-sample}
5373
5373
5374 \end_inset
5374 \end_inset
5375
5375
5376 Sample
5376 Sample
5377 \family typewriter
5377 \family typewriter
5378 ipythonrc
5378 ipythonrc
5379 \family default
5379 \family default
5380 file
5380 file
5381 \layout Standard
5381 \layout Standard
5382
5382
5383 The default rcfile, called
5383 The default rcfile, called
5384 \family typewriter
5384 \family typewriter
5385 ipythonrc
5385 ipythonrc
5386 \family default
5386 \family default
5387 and supplied in your
5387 and supplied in your
5388 \family typewriter
5388 \family typewriter
5389 IPYTHONDIR
5389 IPYTHONDIR
5390 \family default
5390 \family default
5391 directory contains lots of comments on all of these options.
5391 directory contains lots of comments on all of these options.
5392 We reproduce it here for reference:
5392 We reproduce it here for reference:
5393 \layout Standard
5393 \layout Standard
5394
5394
5395
5395
5396 \begin_inset ERT
5396 \begin_inset ERT
5397 status Open
5397 status Open
5398
5398
5399 \layout Standard
5399 \layout Standard
5400
5400
5401 \backslash
5401 \backslash
5402 codelist{../IPython/UserConfig/ipythonrc}
5402 codelist{../IPython/UserConfig/ipythonrc}
5403 \end_inset
5403 \end_inset
5404
5404
5405
5405
5406 \layout Subsection
5406 \layout Subsection
5407
5407
5408
5408
5409 \begin_inset LatexCommand \label{sec:prompts}
5409 \begin_inset LatexCommand \label{sec:prompts}
5410
5410
5411 \end_inset
5411 \end_inset
5412
5412
5413 Fine-tuning your prompt
5413 Fine-tuning your prompt
5414 \layout Standard
5414 \layout Standard
5415
5415
5416 IPython's prompts can be customized using a syntax similar to that of the
5416 IPython's prompts can be customized using a syntax similar to that of the
5417
5417
5418 \family typewriter
5418 \family typewriter
5419 bash
5419 bash
5420 \family default
5420 \family default
5421 shell.
5421 shell.
5422 Many of
5422 Many of
5423 \family typewriter
5423 \family typewriter
5424 bash
5424 bash
5425 \family default
5425 \family default
5426 's escapes are supported, as well as a few additional ones.
5426 's escapes are supported, as well as a few additional ones.
5427 We list them below:
5427 We list them below:
5428 \layout Description
5428 \layout Description
5429
5429
5430
5430
5431 \backslash
5431 \backslash
5432 # the prompt/history count number
5432 # the prompt/history count number
5433 \layout Description
5433 \layout Description
5434
5434
5435
5435
5436 \backslash
5436 \backslash
5437 D the prompt/history count, with the actual digits replaced by dots.
5437 D the prompt/history count, with the actual digits replaced by dots.
5438 Used mainly in continuation prompts (prompt_in2)
5438 Used mainly in continuation prompts (prompt_in2)
5439 \layout Description
5439 \layout Description
5440
5440
5441
5441
5442 \backslash
5442 \backslash
5443 w the current working directory
5443 w the current working directory
5444 \layout Description
5444 \layout Description
5445
5445
5446
5446
5447 \backslash
5447 \backslash
5448 W the basename of current working directory
5448 W the basename of current working directory
5449 \layout Description
5449 \layout Description
5450
5450
5451
5451
5452 \backslash
5452 \backslash
5453 X
5453 X
5454 \emph on
5454 \emph on
5455 n
5455 n
5456 \emph default
5456 \emph default
5457 where
5457 where
5458 \begin_inset Formula $n=0\ldots5.$
5458 \begin_inset Formula $n=0\ldots5.$
5459 \end_inset
5459 \end_inset
5460
5460
5461 The current working directory, with
5461 The current working directory, with
5462 \family typewriter
5462 \family typewriter
5463 $HOME
5463 $HOME
5464 \family default
5464 \family default
5465 replaced by
5465 replaced by
5466 \family typewriter
5466 \family typewriter
5467 ~
5467 ~
5468 \family default
5468 \family default
5469 , and filtered out to contain only
5469 , and filtered out to contain only
5470 \begin_inset Formula $n$
5470 \begin_inset Formula $n$
5471 \end_inset
5471 \end_inset
5472
5472
5473 path elements
5473 path elements
5474 \layout Description
5474 \layout Description
5475
5475
5476
5476
5477 \backslash
5477 \backslash
5478 Y
5478 Y
5479 \emph on
5479 \emph on
5480 n
5480 n
5481 \emph default
5481 \emph default
5482 Similar to
5482 Similar to
5483 \backslash
5483 \backslash
5484 X
5484 X
5485 \emph on
5485 \emph on
5486 n
5486 n
5487 \emph default
5487 \emph default
5488 , but with the
5488 , but with the
5489 \begin_inset Formula $n+1$
5489 \begin_inset Formula $n+1$
5490 \end_inset
5490 \end_inset
5491
5491
5492 element included if it is
5492 element included if it is
5493 \family typewriter
5493 \family typewriter
5494 ~
5494 ~
5495 \family default
5495 \family default
5496 (this is similar to the behavior of the %c
5496 (this is similar to the behavior of the %c
5497 \emph on
5497 \emph on
5498 n
5498 n
5499 \emph default
5499 \emph default
5500 escapes in
5500 escapes in
5501 \family typewriter
5501 \family typewriter
5502 tcsh
5502 tcsh
5503 \family default
5503 \family default
5504 )
5504 )
5505 \layout Description
5505 \layout Description
5506
5506
5507
5507
5508 \backslash
5508 \backslash
5509 u the username of the current user
5509 u the username of the current user
5510 \layout Description
5510 \layout Description
5511
5511
5512
5512
5513 \backslash
5513 \backslash
5514 $ if the effective UID is 0, a #, otherwise a $
5514 $ if the effective UID is 0, a #, otherwise a $
5515 \layout Description
5515 \layout Description
5516
5516
5517
5517
5518 \backslash
5518 \backslash
5519 h the hostname up to the first `.'
5519 h the hostname up to the first `.'
5520 \layout Description
5520 \layout Description
5521
5521
5522
5522
5523 \backslash
5523 \backslash
5524 H the hostname
5524 H the hostname
5525 \layout Description
5525 \layout Description
5526
5526
5527
5527
5528 \backslash
5528 \backslash
5529 n a newline
5529 n a newline
5530 \layout Description
5530 \layout Description
5531
5531
5532
5532
5533 \backslash
5533 \backslash
5534 r a carriage return
5534 r a carriage return
5535 \layout Description
5535 \layout Description
5536
5536
5537
5537
5538 \backslash
5538 \backslash
5539 v IPython version string
5539 v IPython version string
5540 \layout Standard
5540 \layout Standard
5541
5541
5542 In addition to these, ANSI color escapes can be insterted into the prompts,
5542 In addition to these, ANSI color escapes can be insterted into the prompts,
5543 as
5543 as
5544 \family typewriter
5544 \family typewriter
5545
5545
5546 \backslash
5546 \backslash
5547 C_
5547 C_
5548 \emph on
5548 \emph on
5549 ColorName
5549 ColorName
5550 \family default
5550 \family default
5551 \emph default
5551 \emph default
5552 .
5552 .
5553 The list of valid color names is: Black, Blue, Brown, Cyan, DarkGray, Green,
5553 The list of valid color names is: Black, Blue, Brown, Cyan, DarkGray, Green,
5554 LightBlue, LightCyan, LightGray, LightGreen, LightPurple, LightRed, NoColor,
5554 LightBlue, LightCyan, LightGray, LightGreen, LightPurple, LightRed, NoColor,
5555 Normal, Purple, Red, White, Yellow.
5555 Normal, Purple, Red, White, Yellow.
5556 \layout Standard
5556 \layout Standard
5557
5557
5558 Finally, IPython supports the evaluation of arbitrary expressions in your
5558 Finally, IPython supports the evaluation of arbitrary expressions in your
5559 prompt string.
5559 prompt string.
5560 The prompt strings are evaluated through the syntax of PEP 215, but basically
5560 The prompt strings are evaluated through the syntax of PEP 215, but basically
5561 you can use
5561 you can use
5562 \family typewriter
5562 \family typewriter
5563 $x.y
5563 $x.y
5564 \family default
5564 \family default
5565 to expand the value of
5565 to expand the value of
5566 \family typewriter
5566 \family typewriter
5567 x.y
5567 x.y
5568 \family default
5568 \family default
5569 , and for more complicated expressions you can use braces:
5569 , and for more complicated expressions you can use braces:
5570 \family typewriter
5570 \family typewriter
5571 ${foo()+x}
5571 ${foo()+x}
5572 \family default
5572 \family default
5573 will call function
5573 will call function
5574 \family typewriter
5574 \family typewriter
5575 foo
5575 foo
5576 \family default
5576 \family default
5577 and add to it the value of
5577 and add to it the value of
5578 \family typewriter
5578 \family typewriter
5579 x
5579 x
5580 \family default
5580 \family default
5581 , before putting the result into your prompt.
5581 , before putting the result into your prompt.
5582 For example, using
5582 For example, using
5583 \newline
5583 \newline
5584
5584
5585 \family typewriter
5585 \family typewriter
5586 prompt_in1 '${commands.getoutput("uptime")}
5586 prompt_in1 '${commands.getoutput("uptime")}
5587 \backslash
5587 \backslash
5588 nIn [
5588 nIn [
5589 \backslash
5589 \backslash
5590 #]: '
5590 #]: '
5591 \newline
5591 \newline
5592
5592
5593 \family default
5593 \family default
5594 will print the result of the uptime command on each prompt (assuming the
5594 will print the result of the uptime command on each prompt (assuming the
5595
5595
5596 \family typewriter
5596 \family typewriter
5597 commands
5597 commands
5598 \family default
5598 \family default
5599 module has been imported in your
5599 module has been imported in your
5600 \family typewriter
5600 \family typewriter
5601 ipythonrc
5601 ipythonrc
5602 \family default
5602 \family default
5603 file).
5603 file).
5604 \layout Subsubsection
5604 \layout Subsubsection
5605
5605
5606 Prompt examples
5606 Prompt examples
5607 \layout Standard
5607 \layout Standard
5608
5608
5609 The following options in an ipythonrc file will give you IPython's default
5609 The following options in an ipythonrc file will give you IPython's default
5610 prompts:
5610 prompts:
5611 \layout Standard
5611 \layout Standard
5612
5612
5613
5613
5614 \family typewriter
5614 \family typewriter
5615 prompt_in1 'In [
5615 prompt_in1 'In [
5616 \backslash
5616 \backslash
5617 #]:'
5617 #]:'
5618 \newline
5618 \newline
5619 prompt_in2 '\SpecialChar ~
5619 prompt_in2 '\SpecialChar ~
5620 \SpecialChar ~
5620 \SpecialChar ~
5621 \SpecialChar ~
5621 \SpecialChar ~
5622 .
5622 .
5623 \backslash
5623 \backslash
5624 D.:'
5624 D.:'
5625 \newline
5625 \newline
5626 prompt_out 'Out[
5626 prompt_out 'Out[
5627 \backslash
5627 \backslash
5628 #]:'
5628 #]:'
5629 \layout Standard
5629 \layout Standard
5630
5630
5631 which look like this:
5631 which look like this:
5632 \layout Standard
5632 \layout Standard
5633
5633
5634
5634
5635 \family typewriter
5635 \family typewriter
5636 In [1]: 1+2
5636 In [1]: 1+2
5637 \newline
5637 \newline
5638 Out[1]: 3
5638 Out[1]: 3
5639 \layout Standard
5639 \layout Standard
5640
5640
5641
5641
5642 \family typewriter
5642 \family typewriter
5643 In [2]: for i in (1,2,3):
5643 In [2]: for i in (1,2,3):
5644 \newline
5644 \newline
5645
5645
5646 \begin_inset ERT
5646 \begin_inset ERT
5647 status Collapsed
5647 status Collapsed
5648
5648
5649 \layout Standard
5649 \layout Standard
5650
5650
5651 \backslash
5651 \backslash
5652 hspace*{0mm}
5652 hspace*{0mm}
5653 \end_inset
5653 \end_inset
5654
5654
5655 \SpecialChar ~
5655 \SpecialChar ~
5656 \SpecialChar ~
5656 \SpecialChar ~
5657 \SpecialChar ~
5657 \SpecialChar ~
5658 ...: \SpecialChar ~
5658 ...: \SpecialChar ~
5659 \SpecialChar ~
5659 \SpecialChar ~
5660 \SpecialChar ~
5660 \SpecialChar ~
5661 \SpecialChar ~
5661 \SpecialChar ~
5662 print i,
5662 print i,
5663 \newline
5663 \newline
5664
5664
5665 \begin_inset ERT
5665 \begin_inset ERT
5666 status Collapsed
5666 status Collapsed
5667
5667
5668 \layout Standard
5668 \layout Standard
5669
5669
5670 \backslash
5670 \backslash
5671 hspace*{0mm}
5671 hspace*{0mm}
5672 \end_inset
5672 \end_inset
5673
5673
5674 \SpecialChar ~
5674 \SpecialChar ~
5675 \SpecialChar ~
5675 \SpecialChar ~
5676 \SpecialChar ~
5676 \SpecialChar ~
5677 ...:
5677 ...:
5678 \newline
5678 \newline
5679 1 2 3
5679 1 2 3
5680 \layout Standard
5680 \layout Standard
5681
5681
5682 These will give you a very colorful prompt with path information:
5682 These will give you a very colorful prompt with path information:
5683 \layout Standard
5683 \layout Standard
5684
5684
5685
5685
5686 \family typewriter
5686 \family typewriter
5687 #prompt_in1 '
5687 #prompt_in1 '
5688 \backslash
5688 \backslash
5689 C_Red
5689 C_Red
5690 \backslash
5690 \backslash
5691 u
5691 u
5692 \backslash
5692 \backslash
5693 C_Blue[
5693 C_Blue[
5694 \backslash
5694 \backslash
5695 C_Cyan
5695 C_Cyan
5696 \backslash
5696 \backslash
5697 Y1
5697 Y1
5698 \backslash
5698 \backslash
5699 C_Blue]
5699 C_Blue]
5700 \backslash
5700 \backslash
5701 C_LightGreen
5701 C_LightGreen
5702 \backslash
5702 \backslash
5703 #>'
5703 #>'
5704 \newline
5704 \newline
5705 prompt_in2 ' ..
5705 prompt_in2 ' ..
5706 \backslash
5706 \backslash
5707 D>'
5707 D>'
5708 \newline
5708 \newline
5709 prompt_out '<
5709 prompt_out '<
5710 \backslash
5710 \backslash
5711 #>'
5711 #>'
5712 \layout Standard
5712 \layout Standard
5713
5713
5714 which look like this:
5714 which look like this:
5715 \layout Standard
5715 \layout Standard
5716
5716
5717
5717
5718 \family typewriter
5718 \family typewriter
5719 \color red
5719 \color red
5720 fperez
5720 fperez
5721 \color blue
5721 \color blue
5722 [
5722 [
5723 \color cyan
5723 \color cyan
5724 ~/ipython
5724 ~/ipython
5725 \color blue
5725 \color blue
5726 ]
5726 ]
5727 \color green
5727 \color green
5728 1>
5728 1>
5729 \color default
5729 \color default
5730 1+2
5730 1+2
5731 \newline
5731 \newline
5732
5732
5733 \begin_inset ERT
5733 \begin_inset ERT
5734 status Collapsed
5734 status Collapsed
5735
5735
5736 \layout Standard
5736 \layout Standard
5737
5737
5738 \backslash
5738 \backslash
5739 hspace*{0mm}
5739 hspace*{0mm}
5740 \end_inset
5740 \end_inset
5741
5741
5742 \SpecialChar ~
5742 \SpecialChar ~
5743 \SpecialChar ~
5743 \SpecialChar ~
5744 \SpecialChar ~
5744 \SpecialChar ~
5745 \SpecialChar ~
5745 \SpecialChar ~
5746 \SpecialChar ~
5746 \SpecialChar ~
5747 \SpecialChar ~
5747 \SpecialChar ~
5748 \SpecialChar ~
5748 \SpecialChar ~
5749 \SpecialChar ~
5749 \SpecialChar ~
5750 \SpecialChar ~
5750 \SpecialChar ~
5751 \SpecialChar ~
5751 \SpecialChar ~
5752 \SpecialChar ~
5752 \SpecialChar ~
5753 \SpecialChar ~
5753 \SpecialChar ~
5754 \SpecialChar ~
5754 \SpecialChar ~
5755 \SpecialChar ~
5755 \SpecialChar ~
5756 \SpecialChar ~
5756 \SpecialChar ~
5757 \SpecialChar ~
5757 \SpecialChar ~
5758
5758
5759 \color red
5759 \color red
5760 <1>
5760 <1>
5761 \color default
5761 \color default
5762 3
5762 3
5763 \newline
5763 \newline
5764
5764
5765 \color red
5765 \color red
5766 fperez
5766 fperez
5767 \color blue
5767 \color blue
5768 [
5768 [
5769 \color cyan
5769 \color cyan
5770 ~/ipython
5770 ~/ipython
5771 \color blue
5771 \color blue
5772 ]
5772 ]
5773 \color green
5773 \color green
5774 2>
5774 2>
5775 \color default
5775 \color default
5776 for i in (1,2,3):
5776 for i in (1,2,3):
5777 \newline
5777 \newline
5778
5778
5779 \begin_inset ERT
5779 \begin_inset ERT
5780 status Collapsed
5780 status Collapsed
5781
5781
5782 \layout Standard
5782 \layout Standard
5783
5783
5784 \backslash
5784 \backslash
5785 hspace*{0mm}
5785 hspace*{0mm}
5786 \end_inset
5786 \end_inset
5787
5787
5788 \SpecialChar ~
5788 \SpecialChar ~
5789 \SpecialChar ~
5789 \SpecialChar ~
5790 \SpecialChar ~
5790 \SpecialChar ~
5791 \SpecialChar ~
5791 \SpecialChar ~
5792 \SpecialChar ~
5792 \SpecialChar ~
5793 \SpecialChar ~
5793 \SpecialChar ~
5794 \SpecialChar ~
5794 \SpecialChar ~
5795 \SpecialChar ~
5795 \SpecialChar ~
5796 \SpecialChar ~
5796 \SpecialChar ~
5797 \SpecialChar ~
5797 \SpecialChar ~
5798 \SpecialChar ~
5798 \SpecialChar ~
5799 \SpecialChar ~
5799 \SpecialChar ~
5800 \SpecialChar ~
5800 \SpecialChar ~
5801 \SpecialChar ~
5801 \SpecialChar ~
5802 \SpecialChar ~
5802 \SpecialChar ~
5803
5803
5804 \color green
5804 \color green
5805 ...>
5805 ...>
5806 \color default
5806 \color default
5807 \SpecialChar ~
5807 \SpecialChar ~
5808 \SpecialChar ~
5808 \SpecialChar ~
5809 \SpecialChar ~
5809 \SpecialChar ~
5810 \SpecialChar ~
5810 \SpecialChar ~
5811 print i,
5811 print i,
5812 \newline
5812 \newline
5813
5813
5814 \begin_inset ERT
5814 \begin_inset ERT
5815 status Collapsed
5815 status Collapsed
5816
5816
5817 \layout Standard
5817 \layout Standard
5818
5818
5819 \backslash
5819 \backslash
5820 hspace*{0mm}
5820 hspace*{0mm}
5821 \end_inset
5821 \end_inset
5822
5822
5823 \SpecialChar ~
5823 \SpecialChar ~
5824 \SpecialChar ~
5824 \SpecialChar ~
5825 \SpecialChar ~
5825 \SpecialChar ~
5826 \SpecialChar ~
5826 \SpecialChar ~
5827 \SpecialChar ~
5827 \SpecialChar ~
5828 \SpecialChar ~
5828 \SpecialChar ~
5829 \SpecialChar ~
5829 \SpecialChar ~
5830 \SpecialChar ~
5830 \SpecialChar ~
5831 \SpecialChar ~
5831 \SpecialChar ~
5832 \SpecialChar ~
5832 \SpecialChar ~
5833 \SpecialChar ~
5833 \SpecialChar ~
5834 \SpecialChar ~
5834 \SpecialChar ~
5835 \SpecialChar ~
5835 \SpecialChar ~
5836 \SpecialChar ~
5836 \SpecialChar ~
5837 \SpecialChar ~
5837 \SpecialChar ~
5838
5838
5839 \color green
5839 \color green
5840 ...>
5840 ...>
5841 \color default
5841 \color default
5842
5842
5843 \newline
5843 \newline
5844 1 2 3
5844 1 2 3
5845 \layout Standard
5845 \layout Standard
5846
5846
5847 The following shows the usage of dynamic expression evaluation:
5847 The following shows the usage of dynamic expression evaluation:
5848 \layout Subsection
5848 \layout Subsection
5849
5849
5850
5850
5851 \begin_inset LatexCommand \label{sec:profiles}
5851 \begin_inset LatexCommand \label{sec:profiles}
5852
5852
5853 \end_inset
5853 \end_inset
5854
5854
5855 IPython profiles
5855 IPython profiles
5856 \layout Standard
5856 \layout Standard
5857
5857
5858 As we already mentioned, IPython supports the
5858 As we already mentioned, IPython supports the
5859 \family typewriter
5859 \family typewriter
5860 -profile
5860 -profile
5861 \family default
5861 \family default
5862 command-line option (see sec.
5862 command-line option (see sec.
5863
5863
5864 \begin_inset LatexCommand \ref{sec:cmd-line-opts}
5864 \begin_inset LatexCommand \ref{sec:cmd-line-opts}
5865
5865
5866 \end_inset
5866 \end_inset
5867
5867
5868 ).
5868 ).
5869 A profile is nothing more than a particular configuration file like your
5869 A profile is nothing more than a particular configuration file like your
5870 basic
5870 basic
5871 \family typewriter
5871 \family typewriter
5872 ipythonrc
5872 ipythonrc
5873 \family default
5873 \family default
5874 one, but with particular customizations for a specific purpose.
5874 one, but with particular customizations for a specific purpose.
5875 When you start IPython with '
5875 When you start IPython with '
5876 \family typewriter
5876 \family typewriter
5877 ipython -profile <name>
5877 ipython -profile <name>
5878 \family default
5878 \family default
5879 ', it assumes that in your
5879 ', it assumes that in your
5880 \family typewriter
5880 \family typewriter
5881 IPYTHONDIR
5881 IPYTHONDIR
5882 \family default
5882 \family default
5883 there is a file called
5883 there is a file called
5884 \family typewriter
5884 \family typewriter
5885 ipythonrc-<name>
5885 ipythonrc-<name>
5886 \family default
5886 \family default
5887 , and loads it instead of the normal
5887 , and loads it instead of the normal
5888 \family typewriter
5888 \family typewriter
5889 ipythonrc
5889 ipythonrc
5890 \family default
5890 \family default
5891 .
5891 .
5892 \layout Standard
5892 \layout Standard
5893
5893
5894 This system allows you to maintain multiple configurations which load modules,
5894 This system allows you to maintain multiple configurations which load modules,
5895 set options, define functions, etc.
5895 set options, define functions, etc.
5896 suitable for different tasks and activate them in a very simple manner.
5896 suitable for different tasks and activate them in a very simple manner.
5897 In order to avoid having to repeat all of your basic options (common things
5897 In order to avoid having to repeat all of your basic options (common things
5898 that don't change such as your color preferences, for example), any profile
5898 that don't change such as your color preferences, for example), any profile
5899 can include another configuration file.
5899 can include another configuration file.
5900 The most common way to use profiles is then to have each one include your
5900 The most common way to use profiles is then to have each one include your
5901 basic
5901 basic
5902 \family typewriter
5902 \family typewriter
5903 ipythonrc
5903 ipythonrc
5904 \family default
5904 \family default
5905 file as a starting point, and then add further customizations.
5905 file as a starting point, and then add further customizations.
5906 \layout Standard
5906 \layout Standard
5907
5907
5908 In sections
5908 In sections
5909 \begin_inset LatexCommand \ref{sec:syntax-extensions}
5909 \begin_inset LatexCommand \ref{sec:syntax-extensions}
5910
5910
5911 \end_inset
5911 \end_inset
5912
5912
5913 and
5913 and
5914 \begin_inset LatexCommand \ref{sec:Gnuplot}
5914 \begin_inset LatexCommand \ref{sec:Gnuplot}
5915
5915
5916 \end_inset
5916 \end_inset
5917
5917
5918 we discuss some particular profiles which come as part of the standard
5918 we discuss some particular profiles which come as part of the standard
5919 IPython distribution.
5919 IPython distribution.
5920 You may also look in your
5920 You may also look in your
5921 \family typewriter
5921 \family typewriter
5922 IPYTHONDIR
5922 IPYTHONDIR
5923 \family default
5923 \family default
5924 directory, any file whose name begins with
5924 directory, any file whose name begins with
5925 \family typewriter
5925 \family typewriter
5926 ipythonrc-
5926 ipythonrc-
5927 \family default
5927 \family default
5928 is a profile.
5928 is a profile.
5929 You can use those as examples for further customizations to suit your own
5929 You can use those as examples for further customizations to suit your own
5930 needs.
5930 needs.
5931 \layout Section
5931 \layout Section
5932
5932
5933
5933
5934 \begin_inset OptArg
5934 \begin_inset OptArg
5935 collapsed false
5935 collapsed false
5936
5936
5937 \layout Standard
5937 \layout Standard
5938
5938
5939 IPython as default...
5939 IPython as default...
5940 \end_inset
5940 \end_inset
5941
5941
5942 IPython as your default Python environment
5942 IPython as your default Python environment
5943 \layout Standard
5943 \layout Standard
5944
5944
5945 Python honors the environment variable
5945 Python honors the environment variable
5946 \family typewriter
5946 \family typewriter
5947 PYTHONSTARTUP
5947 PYTHONSTARTUP
5948 \family default
5948 \family default
5949 and will execute at startup the file referenced by this variable.
5949 and will execute at startup the file referenced by this variable.
5950 If you put at the end of this file the following two lines of code:
5950 If you put at the end of this file the following two lines of code:
5951 \layout Standard
5951 \layout Standard
5952
5952
5953
5953
5954 \family typewriter
5954 \family typewriter
5955 import IPython
5955 import IPython
5956 \newline
5956 \newline
5957 IPython.Shell.IPShell().mainloop(sys_exit=1)
5957 IPython.Shell.IPShell().mainloop(sys_exit=1)
5958 \layout Standard
5958 \layout Standard
5959
5959
5960 then IPython will be your working environment anytime you start Python.
5960 then IPython will be your working environment anytime you start Python.
5961 The
5961 The
5962 \family typewriter
5962 \family typewriter
5963 sys_exit=1
5963 sys_exit=1
5964 \family default
5964 \family default
5965 is needed to have IPython issue a call to
5965 is needed to have IPython issue a call to
5966 \family typewriter
5966 \family typewriter
5967 sys.exit()
5967 sys.exit()
5968 \family default
5968 \family default
5969 when it finishes, otherwise you'll be back at the normal Python '
5969 when it finishes, otherwise you'll be back at the normal Python '
5970 \family typewriter
5970 \family typewriter
5971 >>>
5971 >>>
5972 \family default
5972 \family default
5973 ' prompt
5973 ' prompt
5974 \begin_inset Foot
5974 \begin_inset Foot
5975 collapsed true
5975 collapsed true
5976
5976
5977 \layout Standard
5977 \layout Standard
5978
5978
5979 Based on an idea by Holger Krekel.
5979 Based on an idea by Holger Krekel.
5980 \end_inset
5980 \end_inset
5981
5981
5982 .
5982 .
5983 \layout Standard
5983 \layout Standard
5984
5984
5985 This is probably useful to developers who manage multiple Python versions
5985 This is probably useful to developers who manage multiple Python versions
5986 and don't want to have correspondingly multiple IPython versions.
5986 and don't want to have correspondingly multiple IPython versions.
5987 Note that in this mode, there is no way to pass IPython any command-line
5987 Note that in this mode, there is no way to pass IPython any command-line
5988 options, as those are trapped first by Python itself.
5988 options, as those are trapped first by Python itself.
5989 \layout Section
5989 \layout Section
5990
5990
5991
5991
5992 \begin_inset LatexCommand \label{sec:embed}
5992 \begin_inset LatexCommand \label{sec:embed}
5993
5993
5994 \end_inset
5994 \end_inset
5995
5995
5996 Embedding IPython
5996 Embedding IPython
5997 \layout Standard
5997 \layout Standard
5998
5998
5999 It is possible to start an IPython instance
5999 It is possible to start an IPython instance
6000 \emph on
6000 \emph on
6001 inside
6001 inside
6002 \emph default
6002 \emph default
6003 your own Python programs.
6003 your own Python programs.
6004 This allows you to evaluate dynamically the state of your code, operate
6004 This allows you to evaluate dynamically the state of your code, operate
6005 with your variables, analyze them, etc.
6005 with your variables, analyze them, etc.
6006 Note however that any changes you make to values while in the shell do
6006 Note however that any changes you make to values while in the shell do
6007
6007
6008 \emph on
6008 \emph on
6009 not
6009 not
6010 \emph default
6010 \emph default
6011 propagate back to the running code, so it is safe to modify your values
6011 propagate back to the running code, so it is safe to modify your values
6012 because you won't break your code in bizarre ways by doing so.
6012 because you won't break your code in bizarre ways by doing so.
6013 \layout Standard
6013 \layout Standard
6014
6014
6015 This feature allows you to easily have a fully functional python environment
6015 This feature allows you to easily have a fully functional python environment
6016 for doing object introspection anywhere in your code with a simple function
6016 for doing object introspection anywhere in your code with a simple function
6017 call.
6017 call.
6018 In some cases a simple print statement is enough, but if you need to do
6018 In some cases a simple print statement is enough, but if you need to do
6019 more detailed analysis of a code fragment this feature can be very valuable.
6019 more detailed analysis of a code fragment this feature can be very valuable.
6020 \layout Standard
6020 \layout Standard
6021
6021
6022 It can also be useful in scientific computing situations where it is common
6022 It can also be useful in scientific computing situations where it is common
6023 to need to do some automatic, computationally intensive part and then stop
6023 to need to do some automatic, computationally intensive part and then stop
6024 to look at data, plots, etc
6024 to look at data, plots, etc
6025 \begin_inset Foot
6025 \begin_inset Foot
6026 collapsed true
6026 collapsed true
6027
6027
6028 \layout Standard
6028 \layout Standard
6029
6029
6030 This functionality was inspired by IDL's combination of the
6030 This functionality was inspired by IDL's combination of the
6031 \family typewriter
6031 \family typewriter
6032 stop
6032 stop
6033 \family default
6033 \family default
6034 keyword and the
6034 keyword and the
6035 \family typewriter
6035 \family typewriter
6036 .continue
6036 .continue
6037 \family default
6037 \family default
6038 executive command, which I have found very useful in the past, and by a
6038 executive command, which I have found very useful in the past, and by a
6039 posting on comp.lang.python by cmkl <cmkleffner-AT-gmx.de> on Dec.
6039 posting on comp.lang.python by cmkl <cmkleffner-AT-gmx.de> on Dec.
6040 06/01 concerning similar uses of pyrepl.
6040 06/01 concerning similar uses of pyrepl.
6041 \end_inset
6041 \end_inset
6042
6042
6043 .
6043 .
6044 Opening an IPython instance will give you full access to your data and
6044 Opening an IPython instance will give you full access to your data and
6045 functions, and you can resume program execution once you are done with
6045 functions, and you can resume program execution once you are done with
6046 the interactive part (perhaps to stop again later, as many times as needed).
6046 the interactive part (perhaps to stop again later, as many times as needed).
6047 \layout Standard
6047 \layout Standard
6048
6048
6049 The following code snippet is the bare minimum you need to include in your
6049 The following code snippet is the bare minimum you need to include in your
6050 Python programs for this to work (detailed examples follow later):
6050 Python programs for this to work (detailed examples follow later):
6051 \layout LyX-Code
6051 \layout LyX-Code
6052
6052
6053 from IPython.Shell import IPShellEmbed
6053 from IPython.Shell import IPShellEmbed
6054 \layout LyX-Code
6054 \layout LyX-Code
6055
6055
6056 ipshell = IPShellEmbed()
6056 ipshell = IPShellEmbed()
6057 \layout LyX-Code
6057 \layout LyX-Code
6058
6058
6059 ipshell() # this call anywhere in your program will start IPython
6059 ipshell() # this call anywhere in your program will start IPython
6060 \layout Standard
6060 \layout Standard
6061
6061
6062 You can run embedded instances even in code which is itself being run at
6062 You can run embedded instances even in code which is itself being run at
6063 the IPython interactive prompt with '
6063 the IPython interactive prompt with '
6064 \family typewriter
6064 \family typewriter
6065 %run\SpecialChar ~
6065 %run\SpecialChar ~
6066 <filename>
6066 <filename>
6067 \family default
6067 \family default
6068 '.
6068 '.
6069 Since it's easy to get lost as to where you are (in your top-level IPython
6069 Since it's easy to get lost as to where you are (in your top-level IPython
6070 or in your embedded one), it's a good idea in such cases to set the in/out
6070 or in your embedded one), it's a good idea in such cases to set the in/out
6071 prompts to something different for the embedded instances.
6071 prompts to something different for the embedded instances.
6072 The code examples below illustrate this.
6072 The code examples below illustrate this.
6073 \layout Standard
6073 \layout Standard
6074
6074
6075 You can also have multiple IPython instances in your program and open them
6075 You can also have multiple IPython instances in your program and open them
6076 separately, for example with different options for data presentation.
6076 separately, for example with different options for data presentation.
6077 If you close and open the same instance multiple times, its prompt counters
6077 If you close and open the same instance multiple times, its prompt counters
6078 simply continue from each execution to the next.
6078 simply continue from each execution to the next.
6079 \layout Standard
6079 \layout Standard
6080
6080
6081 Please look at the docstrings in the
6081 Please look at the docstrings in the
6082 \family typewriter
6082 \family typewriter
6083 Shell.py
6083 Shell.py
6084 \family default
6084 \family default
6085 module for more details on the use of this system.
6085 module for more details on the use of this system.
6086 \layout Standard
6086 \layout Standard
6087
6087
6088 The following sample file illustrating how to use the embedding functionality
6088 The following sample file illustrating how to use the embedding functionality
6089 is provided in the examples directory as
6089 is provided in the examples directory as
6090 \family typewriter
6090 \family typewriter
6091 example-embed.py
6091 example-embed.py
6092 \family default
6092 \family default
6093 .
6093 .
6094 It should be fairly self-explanatory:
6094 It should be fairly self-explanatory:
6095 \layout Standard
6095 \layout Standard
6096
6096
6097
6097
6098 \begin_inset ERT
6098 \begin_inset ERT
6099 status Open
6099 status Open
6100
6100
6101 \layout Standard
6101 \layout Standard
6102
6102
6103 \backslash
6103 \backslash
6104 codelist{examples/example-embed.py}
6104 codelist{examples/example-embed.py}
6105 \end_inset
6105 \end_inset
6106
6106
6107
6107
6108 \layout Standard
6108 \layout Standard
6109
6109
6110 Once you understand how the system functions, you can use the following
6110 Once you understand how the system functions, you can use the following
6111 code fragments in your programs which are ready for cut and paste:
6111 code fragments in your programs which are ready for cut and paste:
6112 \layout Standard
6112 \layout Standard
6113
6113
6114
6114
6115 \begin_inset ERT
6115 \begin_inset ERT
6116 status Open
6116 status Open
6117
6117
6118 \layout Standard
6118 \layout Standard
6119
6119
6120 \backslash
6120 \backslash
6121 codelist{examples/example-embed-short.py}
6121 codelist{examples/example-embed-short.py}
6122 \end_inset
6122 \end_inset
6123
6123
6124
6124
6125 \layout Section
6125 \layout Section
6126
6126
6127
6127
6128 \begin_inset LatexCommand \label{sec:using-pdb}
6128 \begin_inset LatexCommand \label{sec:using-pdb}
6129
6129
6130 \end_inset
6130 \end_inset
6131
6131
6132 Using the Python debugger (
6132 Using the Python debugger (
6133 \family typewriter
6133 \family typewriter
6134 pdb
6134 pdb
6135 \family default
6135 \family default
6136 )
6136 )
6137 \layout Subsection
6137 \layout Subsection
6138
6138
6139 Running entire programs via
6139 Running entire programs via
6140 \family typewriter
6140 \family typewriter
6141 pdb
6141 pdb
6142 \layout Standard
6142 \layout Standard
6143
6143
6144
6144
6145 \family typewriter
6145 \family typewriter
6146 pdb
6146 pdb
6147 \family default
6147 \family default
6148 , the Python debugger, is a powerful interactive debugger which allows you
6148 , the Python debugger, is a powerful interactive debugger which allows you
6149 to step through code, set breakpoints, watch variables, etc.
6149 to step through code, set breakpoints, watch variables, etc.
6150 IPython makes it very easy to start any script under the control of
6150 IPython makes it very easy to start any script under the control of
6151 \family typewriter
6151 \family typewriter
6152 pdb
6152 pdb
6153 \family default
6153 \family default
6154 , regardless of whether you have wrapped it into a
6154 , regardless of whether you have wrapped it into a
6155 \family typewriter
6155 \family typewriter
6156 `main()'
6156 `main()'
6157 \family default
6157 \family default
6158 function or not.
6158 function or not.
6159 For this, simply type
6159 For this, simply type
6160 \family typewriter
6160 \family typewriter
6161 `%run -d myscript'
6161 `%run -d myscript'
6162 \family default
6162 \family default
6163 at an IPython prompt.
6163 at an IPython prompt.
6164 See the
6164 See the
6165 \family typewriter
6165 \family typewriter
6166 %run
6166 %run
6167 \family default
6167 \family default
6168 command's documentation (via
6168 command's documentation (via
6169 \family typewriter
6169 \family typewriter
6170 `%run?'
6170 `%run?'
6171 \family default
6171 \family default
6172 or in Sec.\SpecialChar ~
6172 or in Sec.\SpecialChar ~
6173
6173
6174 \begin_inset LatexCommand \ref{sec:magic}
6174 \begin_inset LatexCommand \ref{sec:magic}
6175
6175
6176 \end_inset
6176 \end_inset
6177
6177
6178 ) for more details, including how to control where
6178 ) for more details, including how to control where
6179 \family typewriter
6179 \family typewriter
6180 pdb
6180 pdb
6181 \family default
6181 \family default
6182 will stop execution first.
6182 will stop execution first.
6183 \layout Standard
6183 \layout Standard
6184
6184
6185 For more information on the use of the
6185 For more information on the use of the
6186 \family typewriter
6186 \family typewriter
6187 pdb
6187 pdb
6188 \family default
6188 \family default
6189 debugger, read the included
6189 debugger, read the included
6190 \family typewriter
6190 \family typewriter
6191 pdb.doc
6191 pdb.doc
6192 \family default
6192 \family default
6193 file (part of the standard Python distribution).
6193 file (part of the standard Python distribution).
6194 On a stock Linux system it is located at
6194 On a stock Linux system it is located at
6195 \family typewriter
6195 \family typewriter
6196 /usr/lib/python2.3/pdb.doc
6196 /usr/lib/python2.3/pdb.doc
6197 \family default
6197 \family default
6198 , but the easiest way to read it is by using the
6198 , but the easiest way to read it is by using the
6199 \family typewriter
6199 \family typewriter
6200 help()
6200 help()
6201 \family default
6201 \family default
6202 function of the
6202 function of the
6203 \family typewriter
6203 \family typewriter
6204 pdb
6204 pdb
6205 \family default
6205 \family default
6206 module as follows (in an IPython prompt):
6206 module as follows (in an IPython prompt):
6207 \layout Standard
6207 \layout Standard
6208
6208
6209
6209
6210 \family typewriter
6210 \family typewriter
6211 In [1]: import pdb
6211 In [1]: import pdb
6212 \newline
6212 \newline
6213 In [2]: pdb.help()
6213 In [2]: pdb.help()
6214 \layout Standard
6214 \layout Standard
6215
6215
6216 This will load the
6216 This will load the
6217 \family typewriter
6217 \family typewriter
6218 pdb.doc
6218 pdb.doc
6219 \family default
6219 \family default
6220 document in a file viewer for you automatically.
6220 document in a file viewer for you automatically.
6221 \layout Subsection
6221 \layout Subsection
6222
6222
6223 Automatic invocation of
6223 Automatic invocation of
6224 \family typewriter
6224 \family typewriter
6225 pdb
6225 pdb
6226 \family default
6226 \family default
6227 on exceptions
6227 on exceptions
6228 \layout Standard
6228 \layout Standard
6229
6229
6230 IPython, if started with the
6230 IPython, if started with the
6231 \family typewriter
6231 \family typewriter
6232 -pdb
6232 -pdb
6233 \family default
6233 \family default
6234 option (or if the option is set in your rc file) can call the Python
6234 option (or if the option is set in your rc file) can call the Python
6235 \family typewriter
6235 \family typewriter
6236 pdb
6236 pdb
6237 \family default
6237 \family default
6238 debugger every time your code triggers an uncaught exception
6238 debugger every time your code triggers an uncaught exception
6239 \begin_inset Foot
6239 \begin_inset Foot
6240 collapsed true
6240 collapsed true
6241
6241
6242 \layout Standard
6242 \layout Standard
6243
6243
6244 Many thanks to Christopher Hart for the request which prompted adding this
6244 Many thanks to Christopher Hart for the request which prompted adding this
6245 feature to IPython.
6245 feature to IPython.
6246 \end_inset
6246 \end_inset
6247
6247
6248 .
6248 .
6249 This feature can also be toggled at any time with the
6249 This feature can also be toggled at any time with the
6250 \family typewriter
6250 \family typewriter
6251 %pdb
6251 %pdb
6252 \family default
6252 \family default
6253 magic command.
6253 magic command.
6254 This can be extremely useful in order to find the origin of subtle bugs,
6254 This can be extremely useful in order to find the origin of subtle bugs,
6255 because
6255 because
6256 \family typewriter
6256 \family typewriter
6257 pdb
6257 pdb
6258 \family default
6258 \family default
6259 opens up at the point in your code which triggered the exception, and while
6259 opens up at the point in your code which triggered the exception, and while
6260 your program is at this point `dead', all the data is still available and
6260 your program is at this point `dead', all the data is still available and
6261 you can walk up and down the stack frame and understand the origin of the
6261 you can walk up and down the stack frame and understand the origin of the
6262 problem.
6262 problem.
6263 \layout Standard
6263 \layout Standard
6264
6264
6265 Furthermore, you can use these debugging facilities both with the embedded
6265 Furthermore, you can use these debugging facilities both with the embedded
6266 IPython mode and without IPython at all.
6266 IPython mode and without IPython at all.
6267 For an embedded shell (see sec.
6267 For an embedded shell (see sec.
6268
6268
6269 \begin_inset LatexCommand \ref{sec:embed}
6269 \begin_inset LatexCommand \ref{sec:embed}
6270
6270
6271 \end_inset
6271 \end_inset
6272
6272
6273 ), simply call the constructor with
6273 ), simply call the constructor with
6274 \family typewriter
6274 \family typewriter
6275 `-pdb'
6275 `-pdb'
6276 \family default
6276 \family default
6277 in the argument string and automatically
6277 in the argument string and automatically
6278 \family typewriter
6278 \family typewriter
6279 pdb
6279 pdb
6280 \family default
6280 \family default
6281 will be called if an uncaught exception is triggered by your code.
6281 will be called if an uncaught exception is triggered by your code.
6282
6282
6283 \layout Standard
6283 \layout Standard
6284
6284
6285 For stand-alone use of the feature in your programs which do not use IPython
6285 For stand-alone use of the feature in your programs which do not use IPython
6286 at all, put the following lines toward the top of your `main' routine:
6286 at all, put the following lines toward the top of your `main' routine:
6287 \layout Standard
6287 \layout Standard
6288 \align left
6288 \align left
6289
6289
6290 \family typewriter
6290 \family typewriter
6291 import sys,IPython.ultraTB
6291 import sys,IPython.ultraTB
6292 \newline
6292 \newline
6293 sys.excepthook = IPython.ultraTB.FormattedTB(mode=`Verbose', color_scheme=`Linux',
6293 sys.excepthook = IPython.ultraTB.FormattedTB(mode=`Verbose', color_scheme=`Linux',
6294 call_pdb=1)
6294 call_pdb=1)
6295 \layout Standard
6295 \layout Standard
6296
6296
6297 The
6297 The
6298 \family typewriter
6298 \family typewriter
6299 mode
6299 mode
6300 \family default
6300 \family default
6301 keyword can be either
6301 keyword can be either
6302 \family typewriter
6302 \family typewriter
6303 `Verbose'
6303 `Verbose'
6304 \family default
6304 \family default
6305 or
6305 or
6306 \family typewriter
6306 \family typewriter
6307 `Plain'
6307 `Plain'
6308 \family default
6308 \family default
6309 , giving either very detailed or normal tracebacks respectively.
6309 , giving either very detailed or normal tracebacks respectively.
6310 The
6310 The
6311 \family typewriter
6311 \family typewriter
6312 color_scheme
6312 color_scheme
6313 \family default
6313 \family default
6314 keyword can be one of
6314 keyword can be one of
6315 \family typewriter
6315 \family typewriter
6316 `NoColor'
6316 `NoColor'
6317 \family default
6317 \family default
6318 ,
6318 ,
6319 \family typewriter
6319 \family typewriter
6320 `Linux'
6320 `Linux'
6321 \family default
6321 \family default
6322 (default) or
6322 (default) or
6323 \family typewriter
6323 \family typewriter
6324 `LightBG'
6324 `LightBG'
6325 \family default
6325 \family default
6326 .
6326 .
6327 These are the same options which can be set in IPython with
6327 These are the same options which can be set in IPython with
6328 \family typewriter
6328 \family typewriter
6329 -colors
6329 -colors
6330 \family default
6330 \family default
6331 and
6331 and
6332 \family typewriter
6332 \family typewriter
6333 -xmode
6333 -xmode
6334 \family default
6334 \family default
6335 .
6335 .
6336 \layout Standard
6336 \layout Standard
6337
6337
6338 This will give any of your programs detailed, colored tracebacks with automatic
6338 This will give any of your programs detailed, colored tracebacks with automatic
6339 invocation of
6339 invocation of
6340 \family typewriter
6340 \family typewriter
6341 pdb
6341 pdb
6342 \family default
6342 \family default
6343 .
6343 .
6344 \layout Section
6344 \layout Section
6345
6345
6346
6346
6347 \begin_inset LatexCommand \label{sec:syntax-extensions}
6347 \begin_inset LatexCommand \label{sec:syntax-extensions}
6348
6348
6349 \end_inset
6349 \end_inset
6350
6350
6351 Extensions for syntax processing
6351 Extensions for syntax processing
6352 \layout Standard
6352 \layout Standard
6353
6353
6354 This isn't for the faint of heart, because the potential for breaking things
6354 This isn't for the faint of heart, because the potential for breaking things
6355 is quite high.
6355 is quite high.
6356 But it can be a very powerful and useful feature.
6356 But it can be a very powerful and useful feature.
6357 In a nutshell, you can redefine the way IPython processes the user input
6357 In a nutshell, you can redefine the way IPython processes the user input
6358 line to accept new, special extensions to the syntax without needing to
6358 line to accept new, special extensions to the syntax without needing to
6359 change any of IPython's own code.
6359 change any of IPython's own code.
6360 \layout Standard
6360 \layout Standard
6361
6361
6362 In the
6362 In the
6363 \family typewriter
6363 \family typewriter
6364 IPython/Extensions
6364 IPython/Extensions
6365 \family default
6365 \family default
6366 directory you will find some examples supplied, which we will briefly describe
6366 directory you will find some examples supplied, which we will briefly describe
6367 now.
6367 now.
6368 These can be used `as is' (and both provide very useful functionality),
6368 These can be used `as is' (and both provide very useful functionality),
6369 or you can use them as a starting point for writing your own extensions.
6369 or you can use them as a starting point for writing your own extensions.
6370 \layout Subsection
6370 \layout Subsection
6371
6371
6372 Pasting of code starting with
6372 Pasting of code starting with
6373 \family typewriter
6373 \family typewriter
6374 `>>>
6374 `>>>
6375 \family default
6375 \family default
6376 ' or
6376 ' or
6377 \family typewriter
6377 \family typewriter
6378 `...
6378 `...
6379
6379
6380 \family default
6380 \family default
6381 '
6381 '
6382 \layout Standard
6382 \layout Standard
6383
6383
6384 In the python tutorial it is common to find code examples which have been
6384 In the python tutorial it is common to find code examples which have been
6385 taken from real python sessions.
6385 taken from real python sessions.
6386 The problem with those is that all the lines begin with either
6386 The problem with those is that all the lines begin with either
6387 \family typewriter
6387 \family typewriter
6388 `>>>
6388 `>>>
6389 \family default
6389 \family default
6390 ' or
6390 ' or
6391 \family typewriter
6391 \family typewriter
6392 `...
6392 `...
6393
6393
6394 \family default
6394 \family default
6395 ', which makes it impossible to paste them all at once.
6395 ', which makes it impossible to paste them all at once.
6396 One must instead do a line by line manual copying, carefully removing the
6396 One must instead do a line by line manual copying, carefully removing the
6397 leading extraneous characters.
6397 leading extraneous characters.
6398 \layout Standard
6398 \layout Standard
6399
6399
6400 This extension identifies those starting characters and removes them from
6400 This extension identifies those starting characters and removes them from
6401 the input automatically, so that one can paste multi-line examples directly
6401 the input automatically, so that one can paste multi-line examples directly
6402 into IPython, saving a lot of time.
6402 into IPython, saving a lot of time.
6403 Please look at the file
6403 Please look at the file
6404 \family typewriter
6404 \family typewriter
6405 InterpreterPasteInput.py
6405 InterpreterPasteInput.py
6406 \family default
6406 \family default
6407 in the
6407 in the
6408 \family typewriter
6408 \family typewriter
6409 IPython/Extensions
6409 IPython/Extensions
6410 \family default
6410 \family default
6411 directory for details on how this is done.
6411 directory for details on how this is done.
6412 \layout Standard
6412 \layout Standard
6413
6413
6414 IPython comes with a special profile enabling this feature, called
6414 IPython comes with a special profile enabling this feature, called
6415 \family typewriter
6415 \family typewriter
6416 tutorial
6416 tutorial
6417 \family default
6417 \family default
6418 \emph on
6418 \emph on
6419 .
6419 .
6420
6420
6421 \emph default
6421 \emph default
6422 Simply start IPython via
6422 Simply start IPython via
6423 \family typewriter
6423 \family typewriter
6424 `ipython\SpecialChar ~
6424 `ipython\SpecialChar ~
6425 -p\SpecialChar ~
6425 -p\SpecialChar ~
6426 tutorial'
6426 tutorial'
6427 \family default
6427 \family default
6428 and the feature will be available.
6428 and the feature will be available.
6429 In a normal IPython session you can activate the feature by importing the
6429 In a normal IPython session you can activate the feature by importing the
6430 corresponding module with:
6430 corresponding module with:
6431 \newline
6431 \newline
6432
6432
6433 \family typewriter
6433 \family typewriter
6434 In [1]: import IPython.Extensions.InterpreterPasteInput
6434 In [1]: import IPython.Extensions.InterpreterPasteInput
6435 \layout Standard
6435 \layout Standard
6436
6436
6437 The following is a 'screenshot' of how things work when this extension is
6437 The following is a 'screenshot' of how things work when this extension is
6438 on, copying an example from the standard tutorial:
6438 on, copying an example from the standard tutorial:
6439 \layout Standard
6439 \layout Standard
6440
6440
6441
6441
6442 \family typewriter
6442 \family typewriter
6443 IPython profile: tutorial
6443 IPython profile: tutorial
6444 \newline
6444 \newline
6445 \SpecialChar ~
6445 \SpecialChar ~
6446
6446
6447 \newline
6447 \newline
6448 *** Pasting of code with ">>>" or "..." has been enabled.
6448 *** Pasting of code with ">>>" or "..." has been enabled.
6449 \newline
6449 \newline
6450 \SpecialChar ~
6450 \SpecialChar ~
6451
6451
6452 \newline
6452 \newline
6453 In [1]: >>> def fib2(n): # return Fibonacci series up to n
6453 In [1]: >>> def fib2(n): # return Fibonacci series up to n
6454 \newline
6454 \newline
6455
6455
6456 \begin_inset ERT
6456 \begin_inset ERT
6457 status Collapsed
6457 status Collapsed
6458
6458
6459 \layout Standard
6459 \layout Standard
6460
6460
6461 \backslash
6461 \backslash
6462 hspace*{0mm}
6462 hspace*{0mm}
6463 \end_inset
6463 \end_inset
6464
6464
6465 \SpecialChar ~
6465 \SpecialChar ~
6466 \SpecialChar ~
6466 \SpecialChar ~
6467 ...: ...\SpecialChar ~
6467 ...: ...\SpecialChar ~
6468 \SpecialChar ~
6468 \SpecialChar ~
6469 \SpecialChar ~
6469 \SpecialChar ~
6470 \SpecialChar ~
6470 \SpecialChar ~
6471 """Return a list containing the Fibonacci series up to n."""
6471 """Return a list containing the Fibonacci series up to n."""
6472 \newline
6472 \newline
6473
6473
6474 \begin_inset ERT
6474 \begin_inset ERT
6475 status Collapsed
6475 status Collapsed
6476
6476
6477 \layout Standard
6477 \layout Standard
6478
6478
6479 \backslash
6479 \backslash
6480 hspace*{0mm}
6480 hspace*{0mm}
6481 \end_inset
6481 \end_inset
6482
6482
6483 \SpecialChar ~
6483 \SpecialChar ~
6484 \SpecialChar ~
6484 \SpecialChar ~
6485 ...: ...\SpecialChar ~
6485 ...: ...\SpecialChar ~
6486 \SpecialChar ~
6486 \SpecialChar ~
6487 \SpecialChar ~
6487 \SpecialChar ~
6488 \SpecialChar ~
6488 \SpecialChar ~
6489 result = []
6489 result = []
6490 \newline
6490 \newline
6491
6491
6492 \begin_inset ERT
6492 \begin_inset ERT
6493 status Collapsed
6493 status Collapsed
6494
6494
6495 \layout Standard
6495 \layout Standard
6496
6496
6497 \backslash
6497 \backslash
6498 hspace*{0mm}
6498 hspace*{0mm}
6499 \end_inset
6499 \end_inset
6500
6500
6501 \SpecialChar ~
6501 \SpecialChar ~
6502 \SpecialChar ~
6502 \SpecialChar ~
6503 ...: ...\SpecialChar ~
6503 ...: ...\SpecialChar ~
6504 \SpecialChar ~
6504 \SpecialChar ~
6505 \SpecialChar ~
6505 \SpecialChar ~
6506 \SpecialChar ~
6506 \SpecialChar ~
6507 a, b = 0, 1
6507 a, b = 0, 1
6508 \newline
6508 \newline
6509
6509
6510 \begin_inset ERT
6510 \begin_inset ERT
6511 status Collapsed
6511 status Collapsed
6512
6512
6513 \layout Standard
6513 \layout Standard
6514
6514
6515 \backslash
6515 \backslash
6516 hspace*{0mm}
6516 hspace*{0mm}
6517 \end_inset
6517 \end_inset
6518
6518
6519 \SpecialChar ~
6519 \SpecialChar ~
6520 \SpecialChar ~
6520 \SpecialChar ~
6521 ...: ...\SpecialChar ~
6521 ...: ...\SpecialChar ~
6522 \SpecialChar ~
6522 \SpecialChar ~
6523 \SpecialChar ~
6523 \SpecialChar ~
6524 \SpecialChar ~
6524 \SpecialChar ~
6525 while b < n:
6525 while b < n:
6526 \newline
6526 \newline
6527
6527
6528 \begin_inset ERT
6528 \begin_inset ERT
6529 status Collapsed
6529 status Collapsed
6530
6530
6531 \layout Standard
6531 \layout Standard
6532
6532
6533 \backslash
6533 \backslash
6534 hspace*{0mm}
6534 hspace*{0mm}
6535 \end_inset
6535 \end_inset
6536
6536
6537 \SpecialChar ~
6537 \SpecialChar ~
6538 \SpecialChar ~
6538 \SpecialChar ~
6539 ...: ...\SpecialChar ~
6539 ...: ...\SpecialChar ~
6540 \SpecialChar ~
6540 \SpecialChar ~
6541 \SpecialChar ~
6541 \SpecialChar ~
6542 \SpecialChar ~
6542 \SpecialChar ~
6543 \SpecialChar ~
6543 \SpecialChar ~
6544 \SpecialChar ~
6544 \SpecialChar ~
6545 \SpecialChar ~
6545 \SpecialChar ~
6546 \SpecialChar ~
6546 \SpecialChar ~
6547 result.append(b)\SpecialChar ~
6547 result.append(b)\SpecialChar ~
6548 \SpecialChar ~
6548 \SpecialChar ~
6549 \SpecialChar ~
6549 \SpecialChar ~
6550 # see below
6550 # see below
6551 \newline
6551 \newline
6552
6552
6553 \begin_inset ERT
6553 \begin_inset ERT
6554 status Collapsed
6554 status Collapsed
6555
6555
6556 \layout Standard
6556 \layout Standard
6557
6557
6558 \backslash
6558 \backslash
6559 hspace*{0mm}
6559 hspace*{0mm}
6560 \end_inset
6560 \end_inset
6561
6561
6562 \SpecialChar ~
6562 \SpecialChar ~
6563 \SpecialChar ~
6563 \SpecialChar ~
6564 ...: ...\SpecialChar ~
6564 ...: ...\SpecialChar ~
6565 \SpecialChar ~
6565 \SpecialChar ~
6566 \SpecialChar ~
6566 \SpecialChar ~
6567 \SpecialChar ~
6567 \SpecialChar ~
6568 \SpecialChar ~
6568 \SpecialChar ~
6569 \SpecialChar ~
6569 \SpecialChar ~
6570 \SpecialChar ~
6570 \SpecialChar ~
6571 \SpecialChar ~
6571 \SpecialChar ~
6572 a, b = b, a+b
6572 a, b = b, a+b
6573 \newline
6573 \newline
6574
6574
6575 \begin_inset ERT
6575 \begin_inset ERT
6576 status Collapsed
6576 status Collapsed
6577
6577
6578 \layout Standard
6578 \layout Standard
6579
6579
6580 \backslash
6580 \backslash
6581 hspace*{0mm}
6581 hspace*{0mm}
6582 \end_inset
6582 \end_inset
6583
6583
6584 \SpecialChar ~
6584 \SpecialChar ~
6585 \SpecialChar ~
6585 \SpecialChar ~
6586 ...: ...\SpecialChar ~
6586 ...: ...\SpecialChar ~
6587 \SpecialChar ~
6587 \SpecialChar ~
6588 \SpecialChar ~
6588 \SpecialChar ~
6589 \SpecialChar ~
6589 \SpecialChar ~
6590 return result
6590 return result
6591 \newline
6591 \newline
6592
6592
6593 \begin_inset ERT
6593 \begin_inset ERT
6594 status Collapsed
6594 status Collapsed
6595
6595
6596 \layout Standard
6596 \layout Standard
6597
6597
6598 \backslash
6598 \backslash
6599 hspace*{0mm}
6599 hspace*{0mm}
6600 \end_inset
6600 \end_inset
6601
6601
6602 \SpecialChar ~
6602 \SpecialChar ~
6603 \SpecialChar ~
6603 \SpecialChar ~
6604 ...:
6604 ...:
6605 \newline
6605 \newline
6606 \SpecialChar ~
6606 \SpecialChar ~
6607
6607
6608 \newline
6608 \newline
6609 In [2]: fib2(10)
6609 In [2]: fib2(10)
6610 \newline
6610 \newline
6611 Out[2]: [1, 1, 2, 3, 5, 8]
6611 Out[2]: [1, 1, 2, 3, 5, 8]
6612 \layout Standard
6612 \layout Standard
6613
6613
6614 Note that as currently written, this extension does
6614 Note that as currently written, this extension does
6615 \emph on
6615 \emph on
6616 not
6616 not
6617 \emph default
6617 \emph default
6618 recognize IPython's prompts for pasting.
6618 recognize IPython's prompts for pasting.
6619 Those are more complicated, since the user can change them very easily,
6619 Those are more complicated, since the user can change them very easily,
6620 they involve numbers and can vary in length.
6620 they involve numbers and can vary in length.
6621 One could however extract all the relevant information from the IPython
6621 One could however extract all the relevant information from the IPython
6622 instance and build an appropriate regular expression.
6622 instance and build an appropriate regular expression.
6623 This is left as an exercise for the reader.
6623 This is left as an exercise for the reader.
6624 \layout Subsection
6624 \layout Subsection
6625
6625
6626 Input of physical quantities with units
6626 Input of physical quantities with units
6627 \layout Standard
6627 \layout Standard
6628
6628
6629 The module
6629 The module
6630 \family typewriter
6630 \family typewriter
6631 PhysicalQInput
6631 PhysicalQInput
6632 \family default
6632 \family default
6633 allows a simplified form of input for physical quantities with units.
6633 allows a simplified form of input for physical quantities with units.
6634 This file is meant to be used in conjunction with the
6634 This file is meant to be used in conjunction with the
6635 \family typewriter
6635 \family typewriter
6636 PhysicalQInteractive
6636 PhysicalQInteractive
6637 \family default
6637 \family default
6638 module (in the same directory) and
6638 module (in the same directory) and
6639 \family typewriter
6639 \family typewriter
6640 Physics.PhysicalQuantities
6640 Physics.PhysicalQuantities
6641 \family default
6641 \family default
6642 from Konrad Hinsen's ScientificPython (
6642 from Konrad Hinsen's ScientificPython (
6643 \begin_inset LatexCommand \htmlurl{http://starship.python.net/crew/hinsen/scientific.html}
6643 \begin_inset LatexCommand \htmlurl{http://starship.python.net/crew/hinsen/scientific.html}
6644
6644
6645 \end_inset
6645 \end_inset
6646
6646
6647 ).
6647 ).
6648 \layout Standard
6648 \layout Standard
6649
6649
6650 The
6650 The
6651 \family typewriter
6651 \family typewriter
6652 Physics.PhysicalQuantities
6652 Physics.PhysicalQuantities
6653 \family default
6653 \family default
6654 module defines
6654 module defines
6655 \family typewriter
6655 \family typewriter
6656 PhysicalQuantity
6656 PhysicalQuantity
6657 \family default
6657 \family default
6658 objects, but these must be declared as instances of a class.
6658 objects, but these must be declared as instances of a class.
6659 For example, to define
6659 For example, to define
6660 \family typewriter
6660 \family typewriter
6661 v
6661 v
6662 \family default
6662 \family default
6663 as a velocity of 3\SpecialChar ~
6663 as a velocity of 3\SpecialChar ~
6664 m/s, normally you would write:
6664 m/s, normally you would write:
6665 \family typewriter
6665 \family typewriter
6666
6666
6667 \newline
6667 \newline
6668 In [1]: v = PhysicalQuantity(3,'m/s')
6668 In [1]: v = PhysicalQuantity(3,'m/s')
6669 \layout Standard
6669 \layout Standard
6670
6670
6671 Using the
6671 Using the
6672 \family typewriter
6672 \family typewriter
6673 PhysicalQ_Input
6673 PhysicalQ_Input
6674 \family default
6674 \family default
6675 extension this can be input instead as:
6675 extension this can be input instead as:
6676 \family typewriter
6676 \family typewriter
6677
6677
6678 \newline
6678 \newline
6679 In [1]: v = 3 m/s
6679 In [1]: v = 3 m/s
6680 \family default
6680 \family default
6681
6681
6682 \newline
6682 \newline
6683 which is much more convenient for interactive use (even though it is blatantly
6683 which is much more convenient for interactive use (even though it is blatantly
6684 invalid Python syntax).
6684 invalid Python syntax).
6685 \layout Standard
6685 \layout Standard
6686
6686
6687 The
6687 The
6688 \family typewriter
6688 \family typewriter
6689 physics
6689 physics
6690 \family default
6690 \family default
6691 profile supplied with IPython (enabled via
6691 profile supplied with IPython (enabled via
6692 \family typewriter
6692 \family typewriter
6693 'ipython -p physics'
6693 'ipython -p physics'
6694 \family default
6694 \family default
6695 ) uses these extensions, which you can also activate with:
6695 ) uses these extensions, which you can also activate with:
6696 \layout Standard
6696 \layout Standard
6697
6697
6698
6698
6699 \family typewriter
6699 \family typewriter
6700 from math import * # math MUST be imported BEFORE PhysicalQInteractive
6700 from math import * # math MUST be imported BEFORE PhysicalQInteractive
6701 \newline
6701 \newline
6702 from IPython.Extensions.PhysicalQInteractive import *
6702 from IPython.Extensions.PhysicalQInteractive import *
6703 \newline
6703 \newline
6704 import IPython.Extensions.PhysicalQInput
6704 import IPython.Extensions.PhysicalQInput
6705 \layout Section
6705 \layout Section
6706
6706
6707 IPython as a system shell
6707 IPython as a system shell
6708 \layout Standard
6708 \layout Standard
6709
6709
6710 IPython ships with a special profile called
6710 IPython ships with a special profile called
6711 \family typewriter
6711 \family typewriter
6712 pysh
6712 pysh
6713 \family default
6713 \family default
6714 , which you can activate at the command line as
6714 , which you can activate at the command line as
6715 \family typewriter
6715 \family typewriter
6716 `ipython -p pysh'
6716 `ipython -p pysh'
6717 \family default
6717 \family default
6718 .
6718 .
6719 This loads
6719 This loads
6720 \family typewriter
6720 \family typewriter
6721 InterpreterExec
6721 InterpreterExec
6722 \family default
6722 \family default
6723 , along with some additional facilities and a prompt customized for filesystem
6723 , along with some additional facilities and a prompt customized for filesystem
6724 navigation.
6724 navigation.
6725 \layout Standard
6725 \layout Standard
6726
6726
6727 Note that this does
6727 Note that this does
6728 \emph on
6728 \emph on
6729 not
6729 not
6730 \emph default
6730 \emph default
6731 make IPython a full-fledged system shell.
6731 make IPython a full-fledged system shell.
6732 In particular, it has no job control, so if you type Ctrl-Z (under Unix),
6732 In particular, it has no job control, so if you type Ctrl-Z (under Unix),
6733 you'll suspend pysh itself, not the process you just started.
6733 you'll suspend pysh itself, not the process you just started.
6734
6734
6735 \layout Standard
6735 \layout Standard
6736
6736
6737 What the shell profile allows you to do is to use the convenient and powerful
6737 What the shell profile allows you to do is to use the convenient and powerful
6738 syntax of Python to do quick scripting at the command line.
6738 syntax of Python to do quick scripting at the command line.
6739 Below we describe some of its features.
6739 Below we describe some of its features.
6740 \layout Subsection
6740 \layout Subsection
6741
6741
6742 Aliases
6742 Aliases
6743 \layout Standard
6743 \layout Standard
6744
6744
6745 All of your
6745 All of your
6746 \family typewriter
6746 \family typewriter
6747 $PATH
6747 $PATH
6748 \family default
6748 \family default
6749 has been loaded as IPython aliases, so you should be able to type any normal
6749 has been loaded as IPython aliases, so you should be able to type any normal
6750 system command and have it executed.
6750 system command and have it executed.
6751 See
6751 See
6752 \family typewriter
6752 \family typewriter
6753 %alias?
6753 %alias?
6754 \family default
6754 \family default
6755 and
6755 and
6756 \family typewriter
6756 \family typewriter
6757 %unalias?
6757 %unalias?
6758 \family default
6758 \family default
6759 for details on the alias facilities.
6759 for details on the alias facilities.
6760 See also
6760 See also
6761 \family typewriter
6761 \family typewriter
6762 %rehash?
6762 %rehash?
6763 \family default
6763 \family default
6764 and
6764 and
6765 \family typewriter
6765 \family typewriter
6766 %rehashx?
6766 %rehashx?
6767 \family default
6767 \family default
6768 for details on the mechanism used to load
6768 for details on the mechanism used to load
6769 \family typewriter
6769 \family typewriter
6770 $PATH
6770 $PATH
6771 \family default
6771 \family default
6772 .
6772 .
6773 \layout Subsection
6773 \layout Subsection
6774
6774
6775 Special syntax
6775 Special syntax
6776 \layout Standard
6776 \layout Standard
6777
6777
6778 Any lines which begin with
6778 Any lines which begin with
6779 \family typewriter
6779 \family typewriter
6780 `~'
6780 `~'
6781 \family default
6781 \family default
6782 ,
6782 ,
6783 \family typewriter
6783 \family typewriter
6784 `/'
6784 `/'
6785 \family default
6785 \family default
6786 and
6786 and
6787 \family typewriter
6787 \family typewriter
6788 `.'
6788 `.'
6789 \family default
6789 \family default
6790 will be executed as shell commands instead of as Python code.
6790 will be executed as shell commands instead of as Python code.
6791 The special escapes below are also recognized.
6791 The special escapes below are also recognized.
6792
6792
6793 \family typewriter
6793 \family typewriter
6794 !cmd
6794 !cmd
6795 \family default
6795 \family default
6796 is valid in single or multi-line input, all others are only valid in single-lin
6796 is valid in single or multi-line input, all others are only valid in single-lin
6797 e input:
6797 e input:
6798 \layout Description
6798 \layout Description
6799
6799
6800
6800
6801 \family typewriter
6801 \family typewriter
6802 !cmd
6802 !cmd
6803 \family default
6803 \family default
6804 pass `cmd' directly to the shell
6804 pass `cmd' directly to the shell
6805 \layout Description
6805 \layout Description
6806
6806
6807
6807
6808 \family typewriter
6808 \family typewriter
6809 !!cmd
6809 !!cmd
6810 \family default
6810 \family default
6811 execute `cmd' and return output as a list (split on `
6811 execute `cmd' and return output as a list (split on `
6812 \backslash
6812 \backslash
6813 n')
6813 n')
6814 \layout Description
6814 \layout Description
6815
6815
6816
6816
6817 \family typewriter
6817 \family typewriter
6818 $var=cmd
6818 $var=cmd
6819 \family default
6819 \family default
6820 capture output of cmd into var, as a string
6820 capture output of cmd into var, as a string
6821 \layout Description
6821 \layout Description
6822
6822
6823
6823
6824 \family typewriter
6824 \family typewriter
6825 $$var=cmd
6825 $$var=cmd
6826 \family default
6826 \family default
6827 capture output of cmd into var, as a list (split on `
6827 capture output of cmd into var, as a list (split on `
6828 \backslash
6828 \backslash
6829 n')
6829 n')
6830 \layout Standard
6830 \layout Standard
6831
6831
6832 The
6832 The
6833 \family typewriter
6833 \family typewriter
6834 $
6834 $
6835 \family default
6835 \family default
6836 /
6836 /
6837 \family typewriter
6837 \family typewriter
6838 $$
6838 $$
6839 \family default
6839 \family default
6840 syntaxes make Python variables from system output, which you can later
6840 syntaxes make Python variables from system output, which you can later
6841 use for further scripting.
6841 use for further scripting.
6842 The converse is also possible: when executing an alias or calling to the
6842 The converse is also possible: when executing an alias or calling to the
6843 system via
6843 system via
6844 \family typewriter
6844 \family typewriter
6845 !
6845 !
6846 \family default
6846 \family default
6847 /
6847 /
6848 \family typewriter
6848 \family typewriter
6849 !!
6849 !!
6850 \family default
6850 \family default
6851 , you can expand any python variable or expression by prepending it with
6851 , you can expand any python variable or expression by prepending it with
6852
6852
6853 \family typewriter
6853 \family typewriter
6854 $
6854 $
6855 \family default
6855 \family default
6856 .
6856 .
6857 Full details of the allowed syntax can be found in Python's PEP 215.
6857 Full details of the allowed syntax can be found in Python's PEP 215.
6858 \layout Standard
6858 \layout Standard
6859
6859
6860 A few brief examples will illustrate these (note that the indentation below
6860 A few brief examples will illustrate these (note that the indentation below
6861 may be incorrectly displayed):
6861 may be incorrectly displayed):
6862 \layout Standard
6862 \layout Standard
6863
6863
6864
6864
6865 \family typewriter
6865 \family typewriter
6866 fperez[~/test]|3> !ls *s.py
6866 fperez[~/test]|3> !ls *s.py
6867 \newline
6867 \newline
6868 scopes.py strings.py
6868 scopes.py strings.py
6869 \layout Standard
6869 \layout Standard
6870
6870
6871 ls is an internal alias, so there's no need to use
6871 ls is an internal alias, so there's no need to use
6872 \family typewriter
6872 \family typewriter
6873 !
6873 !
6874 \family default
6874 \family default
6875 :
6875 :
6876 \layout Standard
6876 \layout Standard
6877
6877
6878
6878
6879 \family typewriter
6879 \family typewriter
6880 fperez[~/test]|4> ls *s.py
6880 fperez[~/test]|4> ls *s.py
6881 \newline
6881 \newline
6882 scopes.py* strings.py
6882 scopes.py* strings.py
6883 \layout Standard
6883 \layout Standard
6884
6884
6885 !!ls will return the output into a Python variable:
6885 !!ls will return the output into a Python variable:
6886 \layout Standard
6886 \layout Standard
6887
6887
6888
6888
6889 \family typewriter
6889 \family typewriter
6890 fperez[~/test]|5> !!ls *s.py
6890 fperez[~/test]|5> !!ls *s.py
6891 \newline
6891 \newline
6892
6892
6893 \begin_inset ERT
6893 \begin_inset ERT
6894 status Collapsed
6894 status Collapsed
6895
6895
6896 \layout Standard
6896 \layout Standard
6897
6897
6898 \backslash
6898 \backslash
6899 hspace*{0mm}
6899 hspace*{0mm}
6900 \end_inset
6900 \end_inset
6901
6901
6902 \SpecialChar ~
6902 \SpecialChar ~
6903 \SpecialChar ~
6903 \SpecialChar ~
6904 \SpecialChar ~
6904 \SpecialChar ~
6905 \SpecialChar ~
6905 \SpecialChar ~
6906 \SpecialChar ~
6906 \SpecialChar ~
6907 \SpecialChar ~
6907 \SpecialChar ~
6908 \SpecialChar ~
6908 \SpecialChar ~
6909 \SpecialChar ~
6909 \SpecialChar ~
6910 \SpecialChar ~
6910 \SpecialChar ~
6911 \SpecialChar ~
6911 \SpecialChar ~
6912 \SpecialChar ~
6912 \SpecialChar ~
6913 \SpecialChar ~
6913 \SpecialChar ~
6914 \SpecialChar ~
6914 \SpecialChar ~
6915 \SpecialChar ~
6915 \SpecialChar ~
6916 <5> ['scopes.py', 'strings.py']
6916 <5> ['scopes.py', 'strings.py']
6917 \newline
6917 \newline
6918 fperez[~/test]|6> print _5
6918 fperez[~/test]|6> print _5
6919 \newline
6919 \newline
6920 ['scopes.py', 'strings.py']
6920 ['scopes.py', 'strings.py']
6921 \layout Standard
6921 \layout Standard
6922
6922
6923
6923
6924 \family typewriter
6924 \family typewriter
6925 $
6925 $
6926 \family default
6926 \family default
6927 and
6927 and
6928 \family typewriter
6928 \family typewriter
6929 $$
6929 $$
6930 \family default
6930 \family default
6931 allow direct capture to named variables:
6931 allow direct capture to named variables:
6932 \layout Standard
6932 \layout Standard
6933
6933
6934
6934
6935 \family typewriter
6935 \family typewriter
6936 fperez[~/test]|7> $astr = ls *s.py
6936 fperez[~/test]|7> $astr = ls *s.py
6937 \newline
6937 \newline
6938 fperez[~/test]|8> astr
6938 fperez[~/test]|8> astr
6939 \newline
6939 \newline
6940
6940
6941 \begin_inset ERT
6941 \begin_inset ERT
6942 status Collapsed
6942 status Collapsed
6943
6943
6944 \layout Standard
6944 \layout Standard
6945
6945
6946 \backslash
6946 \backslash
6947 hspace*{0mm}
6947 hspace*{0mm}
6948 \end_inset
6948 \end_inset
6949
6949
6950 \SpecialChar ~
6950 \SpecialChar ~
6951 \SpecialChar ~
6951 \SpecialChar ~
6952 \SpecialChar ~
6952 \SpecialChar ~
6953 \SpecialChar ~
6953 \SpecialChar ~
6954 \SpecialChar ~
6954 \SpecialChar ~
6955 \SpecialChar ~
6955 \SpecialChar ~
6956 \SpecialChar ~
6956 \SpecialChar ~
6957 \SpecialChar ~
6957 \SpecialChar ~
6958 \SpecialChar ~
6958 \SpecialChar ~
6959 \SpecialChar ~
6959 \SpecialChar ~
6960 \SpecialChar ~
6960 \SpecialChar ~
6961 \SpecialChar ~
6961 \SpecialChar ~
6962 \SpecialChar ~
6962 \SpecialChar ~
6963 \SpecialChar ~
6963 \SpecialChar ~
6964 <8> 'scopes.py
6964 <8> 'scopes.py
6965 \backslash
6965 \backslash
6966 nstrings.py'
6966 nstrings.py'
6967 \layout Standard
6967 \layout Standard
6968
6968
6969
6969
6970 \family typewriter
6970 \family typewriter
6971 fperez[~/test]|9> $$alist = ls *s.py
6971 fperez[~/test]|9> $$alist = ls *s.py
6972 \newline
6972 \newline
6973 fperez[~/test]|10> alist
6973 fperez[~/test]|10> alist
6974 \newline
6974 \newline
6975
6975
6976 \begin_inset ERT
6976 \begin_inset ERT
6977 status Collapsed
6977 status Collapsed
6978
6978
6979 \layout Standard
6979 \layout Standard
6980
6980
6981 \backslash
6981 \backslash
6982 hspace*{0mm}
6982 hspace*{0mm}
6983 \end_inset
6983 \end_inset
6984
6984
6985 \SpecialChar ~
6985 \SpecialChar ~
6986 \SpecialChar ~
6986 \SpecialChar ~
6987 \SpecialChar ~
6987 \SpecialChar ~
6988 \SpecialChar ~
6988 \SpecialChar ~
6989 \SpecialChar ~
6989 \SpecialChar ~
6990 \SpecialChar ~
6990 \SpecialChar ~
6991 \SpecialChar ~
6991 \SpecialChar ~
6992 \SpecialChar ~
6992 \SpecialChar ~
6993 \SpecialChar ~
6993 \SpecialChar ~
6994 \SpecialChar ~
6994 \SpecialChar ~
6995 \SpecialChar ~
6995 \SpecialChar ~
6996 \SpecialChar ~
6996 \SpecialChar ~
6997 \SpecialChar ~
6997 \SpecialChar ~
6998 \SpecialChar ~
6998 \SpecialChar ~
6999 <10> ['scopes.py', 'strings.py']
6999 <10> ['scopes.py', 'strings.py']
7000 \layout Standard
7000 \layout Standard
7001
7001
7002 alist is now a normal python list you can loop over.
7002 alist is now a normal python list you can loop over.
7003 Using
7003 Using
7004 \family typewriter
7004 \family typewriter
7005 $
7005 $
7006 \family default
7006 \family default
7007 will expand back the python values when alias calls are made:
7007 will expand back the python values when alias calls are made:
7008 \layout Standard
7008 \layout Standard
7009
7009
7010
7010
7011 \family typewriter
7011 \family typewriter
7012 fperez[~/test]|11> for f in alist:
7012 fperez[~/test]|11> for f in alist:
7013 \newline
7013 \newline
7014
7014
7015 \begin_inset ERT
7015 \begin_inset ERT
7016 status Collapsed
7016 status Collapsed
7017
7017
7018 \layout Standard
7018 \layout Standard
7019
7019
7020 \backslash
7020 \backslash
7021 hspace*{0mm}
7021 hspace*{0mm}
7022 \end_inset
7022 \end_inset
7023
7023
7024 \SpecialChar ~
7024 \SpecialChar ~
7025 \SpecialChar ~
7025 \SpecialChar ~
7026 \SpecialChar ~
7026 \SpecialChar ~
7027 \SpecialChar ~
7027 \SpecialChar ~
7028 \SpecialChar ~
7028 \SpecialChar ~
7029 \SpecialChar ~
7029 \SpecialChar ~
7030 \SpecialChar ~
7030 \SpecialChar ~
7031 \SpecialChar ~
7031 \SpecialChar ~
7032 \SpecialChar ~
7032 \SpecialChar ~
7033 \SpecialChar ~
7033 \SpecialChar ~
7034 \SpecialChar ~
7034 \SpecialChar ~
7035 \SpecialChar ~
7035 \SpecialChar ~
7036 \SpecialChar ~
7036 \SpecialChar ~
7037 \SpecialChar ~
7037 \SpecialChar ~
7038 |..> \SpecialChar ~
7038 |..> \SpecialChar ~
7039 \SpecialChar ~
7039 \SpecialChar ~
7040 \SpecialChar ~
7040 \SpecialChar ~
7041 \SpecialChar ~
7041 \SpecialChar ~
7042 print 'file',f,
7042 print 'file',f,
7043 \newline
7043 \newline
7044
7044
7045 \begin_inset ERT
7045 \begin_inset ERT
7046 status Collapsed
7046 status Collapsed
7047
7047
7048 \layout Standard
7048 \layout Standard
7049
7049
7050 \backslash
7050 \backslash
7051 hspace*{0mm}
7051 hspace*{0mm}
7052 \end_inset
7052 \end_inset
7053
7053
7054 \SpecialChar ~
7054 \SpecialChar ~
7055 \SpecialChar ~
7055 \SpecialChar ~
7056 \SpecialChar ~
7056 \SpecialChar ~
7057 \SpecialChar ~
7057 \SpecialChar ~
7058 \SpecialChar ~
7058 \SpecialChar ~
7059 \SpecialChar ~
7059 \SpecialChar ~
7060 \SpecialChar ~
7060 \SpecialChar ~
7061 \SpecialChar ~
7061 \SpecialChar ~
7062 \SpecialChar ~
7062 \SpecialChar ~
7063 \SpecialChar ~
7063 \SpecialChar ~
7064 \SpecialChar ~
7064 \SpecialChar ~
7065 \SpecialChar ~
7065 \SpecialChar ~
7066 \SpecialChar ~
7066 \SpecialChar ~
7067 \SpecialChar ~
7067 \SpecialChar ~
7068 |..> \SpecialChar ~
7068 |..> \SpecialChar ~
7069 \SpecialChar ~
7069 \SpecialChar ~
7070 \SpecialChar ~
7070 \SpecialChar ~
7071 \SpecialChar ~
7071 \SpecialChar ~
7072 wc -l $f
7072 wc -l $f
7073 \newline
7073 \newline
7074
7074
7075 \begin_inset ERT
7075 \begin_inset ERT
7076 status Collapsed
7076 status Collapsed
7077
7077
7078 \layout Standard
7078 \layout Standard
7079
7079
7080 \backslash
7080 \backslash
7081 hspace*{0mm}
7081 hspace*{0mm}
7082 \end_inset
7082 \end_inset
7083
7083
7084 \SpecialChar ~
7084 \SpecialChar ~
7085 \SpecialChar ~
7085 \SpecialChar ~
7086 \SpecialChar ~
7086 \SpecialChar ~
7087 \SpecialChar ~
7087 \SpecialChar ~
7088 \SpecialChar ~
7088 \SpecialChar ~
7089 \SpecialChar ~
7089 \SpecialChar ~
7090 \SpecialChar ~
7090 \SpecialChar ~
7091 \SpecialChar ~
7091 \SpecialChar ~
7092 \SpecialChar ~
7092 \SpecialChar ~
7093 \SpecialChar ~
7093 \SpecialChar ~
7094 \SpecialChar ~
7094 \SpecialChar ~
7095 \SpecialChar ~
7095 \SpecialChar ~
7096 \SpecialChar ~
7096 \SpecialChar ~
7097 \SpecialChar ~
7097 \SpecialChar ~
7098 |..>
7098 |..>
7099 \newline
7099 \newline
7100 file scopes.py 13 scopes.py
7100 file scopes.py 13 scopes.py
7101 \newline
7101 \newline
7102 file strings.py 4 strings.py
7102 file strings.py 4 strings.py
7103 \layout Standard
7103 \layout Standard
7104
7104
7105 Note that you may need to protect your variables with braces if you want
7105 Note that you may need to protect your variables with braces if you want
7106 to append strings to their names.
7106 to append strings to their names.
7107 To copy all files in alist to
7107 To copy all files in alist to
7108 \family typewriter
7108 \family typewriter
7109 .bak
7109 .bak
7110 \family default
7110 \family default
7111 extensions, you must use:
7111 extensions, you must use:
7112 \layout Standard
7112 \layout Standard
7113
7113
7114
7114
7115 \family typewriter
7115 \family typewriter
7116 fperez[~/test]|12> for f in alist:
7116 fperez[~/test]|12> for f in alist:
7117 \newline
7117 \newline
7118
7118
7119 \begin_inset ERT
7119 \begin_inset ERT
7120 status Collapsed
7120 status Collapsed
7121
7121
7122 \layout Standard
7122 \layout Standard
7123
7123
7124 \backslash
7124 \backslash
7125 hspace*{0mm}
7125 hspace*{0mm}
7126 \end_inset
7126 \end_inset
7127
7127
7128 \SpecialChar ~
7128 \SpecialChar ~
7129 \SpecialChar ~
7129 \SpecialChar ~
7130 \SpecialChar ~
7130 \SpecialChar ~
7131 \SpecialChar ~
7131 \SpecialChar ~
7132 \SpecialChar ~
7132 \SpecialChar ~
7133 \SpecialChar ~
7133 \SpecialChar ~
7134 \SpecialChar ~
7134 \SpecialChar ~
7135 \SpecialChar ~
7135 \SpecialChar ~
7136 \SpecialChar ~
7136 \SpecialChar ~
7137 \SpecialChar ~
7137 \SpecialChar ~
7138 \SpecialChar ~
7138 \SpecialChar ~
7139 \SpecialChar ~
7139 \SpecialChar ~
7140 \SpecialChar ~
7140 \SpecialChar ~
7141 \SpecialChar ~
7141 \SpecialChar ~
7142 |..> \SpecialChar ~
7142 |..> \SpecialChar ~
7143 \SpecialChar ~
7143 \SpecialChar ~
7144 \SpecialChar ~
7144 \SpecialChar ~
7145 \SpecialChar ~
7145 \SpecialChar ~
7146 cp $f ${f}.bak
7146 cp $f ${f}.bak
7147 \layout Standard
7147 \layout Standard
7148
7148
7149 If you try using
7149 If you try using
7150 \family typewriter
7150 \family typewriter
7151 $f.bak
7151 $f.bak
7152 \family default
7152 \family default
7153 , you'll get an AttributeError exception saying that your string object
7153 , you'll get an AttributeError exception saying that your string object
7154 doesn't have a
7154 doesn't have a
7155 \family typewriter
7155 \family typewriter
7156 .bak
7156 .bak
7157 \family default
7157 \family default
7158 attribute.
7158 attribute.
7159 This is because the
7159 This is because the
7160 \family typewriter
7160 \family typewriter
7161 $
7161 $
7162 \family default
7162 \family default
7163 expansion mechanism allows you to expand full Python expressions:
7163 expansion mechanism allows you to expand full Python expressions:
7164 \layout Standard
7164 \layout Standard
7165
7165
7166
7166
7167 \family typewriter
7167 \family typewriter
7168 fperez[~/test]|13> echo "sys.platform is: $sys.platform"
7168 fperez[~/test]|13> echo "sys.platform is: $sys.platform"
7169 \newline
7169 \newline
7170 sys.platform is: linux2
7170 sys.platform is: linux2
7171 \layout Standard
7171 \layout Standard
7172
7172
7173 IPython's input history handling is still active, which allows you to rerun
7173 IPython's input history handling is still active, which allows you to rerun
7174 a single block of multi-line input by simply using exec:
7174 a single block of multi-line input by simply using exec:
7175 \newline
7175 \newline
7176
7176
7177 \family typewriter
7177 \family typewriter
7178 fperez[~/test]|14> $$alist = ls *.eps
7178 fperez[~/test]|14> $$alist = ls *.eps
7179 \newline
7179 \newline
7180 fperez[~/test]|15> exec _i11
7180 fperez[~/test]|15> exec _i11
7181 \newline
7181 \newline
7182 file image2.eps 921 image2.eps
7182 file image2.eps 921 image2.eps
7183 \newline
7183 \newline
7184 file image.eps 921 image.eps
7184 file image.eps 921 image.eps
7185 \layout Standard
7185 \layout Standard
7186
7186
7187 While these are new special-case syntaxes, they are designed to allow very
7187 While these are new special-case syntaxes, they are designed to allow very
7188 efficient use of the shell with minimal typing.
7188 efficient use of the shell with minimal typing.
7189 At an interactive shell prompt, conciseness of expression wins over readability.
7189 At an interactive shell prompt, conciseness of expression wins over readability.
7190 \layout Subsection
7190 \layout Subsection
7191
7191
7192 Useful functions and modules
7192 Useful functions and modules
7193 \layout Standard
7193 \layout Standard
7194
7194
7195 The os, sys and shutil modules from the Python standard library are automaticall
7195 The os, sys and shutil modules from the Python standard library are automaticall
7196 y loaded.
7196 y loaded.
7197 Some additional functions, useful for shell usage, are listed below.
7197 Some additional functions, useful for shell usage, are listed below.
7198 You can request more help about them with `
7198 You can request more help about them with `
7199 \family typewriter
7199 \family typewriter
7200 ?
7200 ?
7201 \family default
7201 \family default
7202 '.
7202 '.
7203 \layout Description
7203 \layout Description
7204
7204
7205
7205
7206 \family typewriter
7206 \family typewriter
7207 shell
7207 shell
7208 \family default
7208 \family default
7209 - execute a command in the underlying system shell
7209 - execute a command in the underlying system shell
7210 \layout Description
7210 \layout Description
7211
7211
7212
7212
7213 \family typewriter
7213 \family typewriter
7214 system
7214 system
7215 \family default
7215 \family default
7216 - like
7216 - like
7217 \family typewriter
7217 \family typewriter
7218 shell()
7218 shell()
7219 \family default
7219 \family default
7220 , but return the exit status of the command
7220 , but return the exit status of the command
7221 \layout Description
7221 \layout Description
7222
7222
7223
7223
7224 \family typewriter
7224 \family typewriter
7225 sout
7225 sout
7226 \family default
7226 \family default
7227 - capture the output of a command as a string
7227 - capture the output of a command as a string
7228 \layout Description
7228 \layout Description
7229
7229
7230
7230
7231 \family typewriter
7231 \family typewriter
7232 lout
7232 lout
7233 \family default
7233 \family default
7234 - capture the output of a command as a list (split on `
7234 - capture the output of a command as a list (split on `
7235 \backslash
7235 \backslash
7236 n')
7236 n')
7237 \layout Description
7237 \layout Description
7238
7238
7239
7239
7240 \family typewriter
7240 \family typewriter
7241 getoutputerror
7241 getoutputerror
7242 \family default
7242 \family default
7243 - capture (output,error) of a shell commandss
7243 - capture (output,error) of a shell commandss
7244 \layout Standard
7244 \layout Standard
7245
7245
7246
7246
7247 \family typewriter
7247 \family typewriter
7248 sout
7248 sout
7249 \family default
7249 \family default
7250 /
7250 /
7251 \family typewriter
7251 \family typewriter
7252 lout
7252 lout
7253 \family default
7253 \family default
7254 are the functional equivalents of
7254 are the functional equivalents of
7255 \family typewriter
7255 \family typewriter
7256 $
7256 $
7257 \family default
7257 \family default
7258 /
7258 /
7259 \family typewriter
7259 \family typewriter
7260 $$
7260 $$
7261 \family default
7261 \family default
7262 .
7262 .
7263 They are provided to allow you to capture system output in the middle of
7263 They are provided to allow you to capture system output in the middle of
7264 true python code, function definitions, etc (where
7264 true python code, function definitions, etc (where
7265 \family typewriter
7265 \family typewriter
7266 $
7266 $
7267 \family default
7267 \family default
7268 and
7268 and
7269 \family typewriter
7269 \family typewriter
7270 $$
7270 $$
7271 \family default
7271 \family default
7272 are invalid).
7272 are invalid).
7273 \layout Subsection
7273 \layout Subsection
7274
7274
7275 Directory management
7275 Directory management
7276 \layout Standard
7276 \layout Standard
7277
7277
7278 Since each command passed by pysh to the underlying system is executed in
7278 Since each command passed by pysh to the underlying system is executed in
7279 a subshell which exits immediately, you can NOT use !cd to navigate the
7279 a subshell which exits immediately, you can NOT use !cd to navigate the
7280 filesystem.
7280 filesystem.
7281 \layout Standard
7281 \layout Standard
7282
7282
7283 Pysh provides its own builtin
7283 Pysh provides its own builtin
7284 \family typewriter
7284 \family typewriter
7285 `%cd
7285 `%cd
7286 \family default
7286 \family default
7287 ' magic command to move in the filesystem (the
7287 ' magic command to move in the filesystem (the
7288 \family typewriter
7288 \family typewriter
7289 %
7289 %
7290 \family default
7290 \family default
7291 is not required with automagic on).
7291 is not required with automagic on).
7292 It also maintains a list of visited directories (use
7292 It also maintains a list of visited directories (use
7293 \family typewriter
7293 \family typewriter
7294 %dhist
7294 %dhist
7295 \family default
7295 \family default
7296 to see it) and allows direct switching to any of them.
7296 to see it) and allows direct switching to any of them.
7297 Type
7297 Type
7298 \family typewriter
7298 \family typewriter
7299 `cd?
7299 `cd?
7300 \family default
7300 \family default
7301 ' for more details.
7301 ' for more details.
7302 \layout Standard
7302 \layout Standard
7303
7303
7304
7304
7305 \family typewriter
7305 \family typewriter
7306 %pushd
7306 %pushd
7307 \family default
7307 \family default
7308 ,
7308 ,
7309 \family typewriter
7309 \family typewriter
7310 %popd
7310 %popd
7311 \family default
7311 \family default
7312 and
7312 and
7313 \family typewriter
7313 \family typewriter
7314 %dirs
7314 %dirs
7315 \family default
7315 \family default
7316 are provided for directory stack handling.
7316 are provided for directory stack handling.
7317 \layout Subsection
7317 \layout Subsection
7318
7318
7319 Prompt customization
7319 Prompt customization
7320 \layout Standard
7320 \layout Standard
7321
7321
7322 The supplied
7322 The supplied
7323 \family typewriter
7323 \family typewriter
7324 ipythonrc-pysh
7324 ipythonrc-pysh
7325 \family default
7325 \family default
7326 profile comes with an example of a very colored and detailed prompt, mainly
7326 profile comes with an example of a very colored and detailed prompt, mainly
7327 to serve as an illustration.
7327 to serve as an illustration.
7328 The valid escape sequences, besides color names, are:
7328 The valid escape sequences, besides color names, are:
7329 \layout Description
7329 \layout Description
7330
7330
7331
7331
7332 \backslash
7332 \backslash
7333 # - Prompt number.
7333 # - Prompt number.
7334 \layout Description
7334 \layout Description
7335
7335
7336
7336
7337 \backslash
7337 \backslash
7338 D - Dots, as many as there are digits in
7338 D - Dots, as many as there are digits in
7339 \backslash
7339 \backslash
7340 # (so they align).
7340 # (so they align).
7341 \layout Description
7341 \layout Description
7342
7342
7343
7343
7344 \backslash
7344 \backslash
7345 w - Current working directory (cwd).
7345 w - Current working directory (cwd).
7346 \layout Description
7346 \layout Description
7347
7347
7348
7348
7349 \backslash
7349 \backslash
7350 W - Basename of current working directory.
7350 W - Basename of current working directory.
7351 \layout Description
7351 \layout Description
7352
7352
7353
7353
7354 \backslash
7354 \backslash
7355 X
7355 X
7356 \emph on
7356 \emph on
7357 N
7357 N
7358 \emph default
7358 \emph default
7359 - Where
7359 - Where
7360 \emph on
7360 \emph on
7361 N
7361 N
7362 \emph default
7362 \emph default
7363 =0..5.
7363 =0..5.
7364 N terms of the cwd, with $HOME written as ~.
7364 N terms of the cwd, with $HOME written as ~.
7365 \layout Description
7365 \layout Description
7366
7366
7367
7367
7368 \backslash
7368 \backslash
7369 Y
7369 Y
7370 \emph on
7370 \emph on
7371 N
7371 N
7372 \emph default
7372 \emph default
7373 - Where
7373 - Where
7374 \emph on
7374 \emph on
7375 N
7375 N
7376 \emph default
7376 \emph default
7377 =0..5.
7377 =0..5.
7378 Like X
7378 Like X
7379 \emph on
7379 \emph on
7380 N
7380 N
7381 \emph default
7381 \emph default
7382 , but if ~ is term
7382 , but if ~ is term
7383 \emph on
7383 \emph on
7384 N
7384 N
7385 \emph default
7385 \emph default
7386 +1 it's also shown.
7386 +1 it's also shown.
7387 \layout Description
7387 \layout Description
7388
7388
7389
7389
7390 \backslash
7390 \backslash
7391 u - Username.
7391 u - Username.
7392 \layout Description
7392 \layout Description
7393
7393
7394
7394
7395 \backslash
7395 \backslash
7396 H - Full hostname.
7396 H - Full hostname.
7397 \layout Description
7397 \layout Description
7398
7398
7399
7399
7400 \backslash
7400 \backslash
7401 h - Hostname up to first '.'
7401 h - Hostname up to first '.'
7402 \layout Description
7402 \layout Description
7403
7403
7404
7404
7405 \backslash
7405 \backslash
7406 $ - Root symbol ($ or #).
7406 $ - Root symbol ($ or #).
7407
7407
7408 \layout Description
7408 \layout Description
7409
7409
7410
7410
7411 \backslash
7411 \backslash
7412 t - Current time, in H:M:S format.
7412 t - Current time, in H:M:S format.
7413 \layout Description
7413 \layout Description
7414
7414
7415
7415
7416 \backslash
7416 \backslash
7417 v - IPython release version.
7417 v - IPython release version.
7418
7418
7419 \layout Description
7419 \layout Description
7420
7420
7421
7421
7422 \backslash
7422 \backslash
7423 n - Newline.
7423 n - Newline.
7424
7424
7425 \layout Description
7425 \layout Description
7426
7426
7427
7427
7428 \backslash
7428 \backslash
7429 r - Carriage return.
7429 r - Carriage return.
7430
7430
7431 \layout Description
7431 \layout Description
7432
7432
7433
7433
7434 \backslash
7434 \backslash
7435
7435
7436 \backslash
7436 \backslash
7437 - An explicitly escaped '
7437 - An explicitly escaped '
7438 \backslash
7438 \backslash
7439 '.
7439 '.
7440 \layout Standard
7440 \layout Standard
7441
7441
7442 You can configure your prompt colors using any ANSI color escape.
7442 You can configure your prompt colors using any ANSI color escape.
7443 Each color escape sets the color for any subsequent text, until another
7443 Each color escape sets the color for any subsequent text, until another
7444 escape comes in and changes things.
7444 escape comes in and changes things.
7445 The valid color escapes are:
7445 The valid color escapes are:
7446 \layout Description
7446 \layout Description
7447
7447
7448
7448
7449 \backslash
7449 \backslash
7450 C_Black
7450 C_Black
7451 \layout Description
7451 \layout Description
7452
7452
7453
7453
7454 \backslash
7454 \backslash
7455 C_Blue
7455 C_Blue
7456 \layout Description
7456 \layout Description
7457
7457
7458
7458
7459 \backslash
7459 \backslash
7460 C_Brown
7460 C_Brown
7461 \layout Description
7461 \layout Description
7462
7462
7463
7463
7464 \backslash
7464 \backslash
7465 C_Cyan
7465 C_Cyan
7466 \layout Description
7466 \layout Description
7467
7467
7468
7468
7469 \backslash
7469 \backslash
7470 C_DarkGray
7470 C_DarkGray
7471 \layout Description
7471 \layout Description
7472
7472
7473
7473
7474 \backslash
7474 \backslash
7475 C_Green
7475 C_Green
7476 \layout Description
7476 \layout Description
7477
7477
7478
7478
7479 \backslash
7479 \backslash
7480 C_LightBlue
7480 C_LightBlue
7481 \layout Description
7481 \layout Description
7482
7482
7483
7483
7484 \backslash
7484 \backslash
7485 C_LightCyan
7485 C_LightCyan
7486 \layout Description
7486 \layout Description
7487
7487
7488
7488
7489 \backslash
7489 \backslash
7490 C_LightGray
7490 C_LightGray
7491 \layout Description
7491 \layout Description
7492
7492
7493
7493
7494 \backslash
7494 \backslash
7495 C_LightGreen
7495 C_LightGreen
7496 \layout Description
7496 \layout Description
7497
7497
7498
7498
7499 \backslash
7499 \backslash
7500 C_LightPurple
7500 C_LightPurple
7501 \layout Description
7501 \layout Description
7502
7502
7503
7503
7504 \backslash
7504 \backslash
7505 C_LightRed
7505 C_LightRed
7506 \layout Description
7506 \layout Description
7507
7507
7508
7508
7509 \backslash
7509 \backslash
7510 C_Purple
7510 C_Purple
7511 \layout Description
7511 \layout Description
7512
7512
7513
7513
7514 \backslash
7514 \backslash
7515 C_Red
7515 C_Red
7516 \layout Description
7516 \layout Description
7517
7517
7518
7518
7519 \backslash
7519 \backslash
7520 C_White
7520 C_White
7521 \layout Description
7521 \layout Description
7522
7522
7523
7523
7524 \backslash
7524 \backslash
7525 C_Yellow
7525 C_Yellow
7526 \layout Description
7526 \layout Description
7527
7527
7528
7528
7529 \backslash
7529 \backslash
7530 C_Normal Stop coloring, defaults to your terminal settings.
7530 C_Normal Stop coloring, defaults to your terminal settings.
7531 \layout Section
7531 \layout Section
7532
7532
7533
7533
7534 \begin_inset LatexCommand \label{sec:Threading-support}
7534 \begin_inset LatexCommand \label{sec:Threading-support}
7535
7535
7536 \end_inset
7536 \end_inset
7537
7537
7538 Threading support
7538 Threading support
7539 \layout Standard
7539 \layout Standard
7540
7540
7541
7541
7542 \series bold
7542 \series bold
7543 WARNING:
7543 WARNING:
7544 \series default
7544 \series default
7545 The threading support is still somewhat experimental, and it has only seen
7545 The threading support is still somewhat experimental, and it has only seen
7546 reasonable testing under Linux.
7546 reasonable testing under Linux.
7547 Threaded code is particularly tricky to debug, and it tends to show extremely
7547 Threaded code is particularly tricky to debug, and it tends to show extremely
7548 platform-dependent behavior.
7548 platform-dependent behavior.
7549 Since I only have access to Linux machines, I will have to rely on user's
7549 Since I only have access to Linux machines, I will have to rely on user's
7550 experiences and assistance for this area of IPython to improve under other
7550 experiences and assistance for this area of IPython to improve under other
7551 platforms.
7551 platforms.
7552 \layout Standard
7552 \layout Standard
7553
7553
7554 IPython, via the
7554 IPython, via the
7555 \family typewriter
7555 \family typewriter
7556 -gthread
7556 -gthread
7557 \family default
7557 \family default
7558 ,
7558 ,
7559 \family typewriter
7559 \family typewriter
7560 -qthread
7560 -qthread
7561 \family default
7561 \family default
7562 and
7562 and
7563 \family typewriter
7563 \family typewriter
7564 -wthread
7564 -wthread
7565 \family default
7565 \family default
7566 options (described in Sec.\SpecialChar ~
7566 options (described in Sec.\SpecialChar ~
7567
7567
7568 \begin_inset LatexCommand \ref{sec:threading-opts}
7568 \begin_inset LatexCommand \ref{sec:threading-opts}
7569
7569
7570 \end_inset
7570 \end_inset
7571
7571
7572 ), can run in multithreaded mode to support pyGTK, Qt and WXPython applications
7572 ), can run in multithreaded mode to support pyGTK, Qt and WXPython applications
7573 respectively.
7573 respectively.
7574 These GUI toolkits need to control the python main loop of execution, so
7574 These GUI toolkits need to control the python main loop of execution, so
7575 under a normal Python interpreter, starting a pyGTK, Qt or WXPython application
7575 under a normal Python interpreter, starting a pyGTK, Qt or WXPython application
7576 will immediately freeze the shell.
7576 will immediately freeze the shell.
7577
7577
7578 \layout Standard
7578 \layout Standard
7579
7579
7580 IPython, with one of these options (you can only use one at a time), separates
7580 IPython, with one of these options (you can only use one at a time), separates
7581 the graphical loop and IPython's code execution run into different threads.
7581 the graphical loop and IPython's code execution run into different threads.
7582 This allows you to test interactively (with
7582 This allows you to test interactively (with
7583 \family typewriter
7583 \family typewriter
7584 %run
7584 %run
7585 \family default
7585 \family default
7586 , for example) your GUI code without blocking.
7586 , for example) your GUI code without blocking.
7587 \layout Standard
7587 \layout Standard
7588
7588
7589 A nice mini-tutorial on using IPython along with the Qt Designer application
7589 A nice mini-tutorial on using IPython along with the Qt Designer application
7590 is available at the SciPy wiki:
7590 is available at the SciPy wiki:
7591 \begin_inset LatexCommand \htmlurl{http://www.scipy.org/wikis/topical_software/QtWithIPythonAndDesigner}
7591 \begin_inset LatexCommand \htmlurl{http://www.scipy.org/wikis/topical_software/QtWithIPythonAndDesigner}
7592
7592
7593 \end_inset
7593 \end_inset
7594
7594
7595 .
7595 .
7596 \layout Subsection
7596 \layout Subsection
7597
7597
7598 Tk issues
7598 Tk issues
7599 \layout Standard
7599 \layout Standard
7600
7600
7601 As indicated in Sec.\SpecialChar ~
7601 As indicated in Sec.\SpecialChar ~
7602
7602
7603 \begin_inset LatexCommand \ref{sec:threading-opts}
7603 \begin_inset LatexCommand \ref{sec:threading-opts}
7604
7604
7605 \end_inset
7605 \end_inset
7606
7606
7607 , a special
7607 , a special
7608 \family typewriter
7608 \family typewriter
7609 -tk
7609 -tk
7610 \family default
7610 \family default
7611 option is provided to try and allow Tk graphical applications to coexist
7611 option is provided to try and allow Tk graphical applications to coexist
7612 interactively with WX, Qt or GTK ones.
7612 interactively with WX, Qt or GTK ones.
7613 Whether this works at all, however, is very platform and configuration
7613 Whether this works at all, however, is very platform and configuration
7614 dependent.
7614 dependent.
7615 Please experiment with simple test cases before committing to using this
7615 Please experiment with simple test cases before committing to using this
7616 combination of Tk and GTK/Qt/WX threading in a production environment.
7616 combination of Tk and GTK/Qt/WX threading in a production environment.
7617 \layout Subsection
7617 \layout Subsection
7618
7618
7619 Signals and Threads
7619 Signals and Threads
7620 \layout Standard
7620 \layout Standard
7621
7621
7622 When any of the thread systems (GTK, Qt or WX) are active, either directly
7622 When any of the thread systems (GTK, Qt or WX) are active, either directly
7623 or via
7623 or via
7624 \family typewriter
7624 \family typewriter
7625 -pylab
7625 -pylab
7626 \family default
7626 \family default
7627 with a threaded backend, it is impossible to interrupt long-running Python
7627 with a threaded backend, it is impossible to interrupt long-running Python
7628 code via
7628 code via
7629 \family typewriter
7629 \family typewriter
7630 Ctrl-C
7630 Ctrl-C
7631 \family default
7631 \family default
7632 .
7632 .
7633 IPython can not pass the KeyboardInterrupt exception (or the underlying
7633 IPython can not pass the KeyboardInterrupt exception (or the underlying
7634
7634
7635 \family typewriter
7635 \family typewriter
7636 SIGINT
7636 SIGINT
7637 \family default
7637 \family default
7638 ) across threads, so any long-running process started from IPython will
7638 ) across threads, so any long-running process started from IPython will
7639 run to completion, or will have to be killed via an external (OS-based)
7639 run to completion, or will have to be killed via an external (OS-based)
7640 mechanism.
7640 mechanism.
7641 \layout Standard
7641 \layout Standard
7642
7642
7643 To the best of my knowledge, this limitation is imposed by the Python interprete
7643 To the best of my knowledge, this limitation is imposed by the Python interprete
7644 r itself, and it comes from the difficulty of writing portable signal/threaded
7644 r itself, and it comes from the difficulty of writing portable signal/threaded
7645 code.
7645 code.
7646 If any user is an expert on this topic and can suggest a better solution,
7646 If any user is an expert on this topic and can suggest a better solution,
7647 I would love to hear about it.
7647 I would love to hear about it.
7648 In the IPython sources, look at the
7648 In the IPython sources, look at the
7649 \family typewriter
7649 \family typewriter
7650 Shell.py
7650 Shell.py
7651 \family default
7651 \family default
7652 module, and in particular at the
7652 module, and in particular at the
7653 \family typewriter
7653 \family typewriter
7654 runcode()
7654 runcode()
7655 \family default
7655 \family default
7656 method.
7656 method.
7657
7657
7658 \layout Subsection
7658 \layout Subsection
7659
7659
7660 I/O pitfalls
7660 I/O pitfalls
7661 \layout Standard
7661 \layout Standard
7662
7662
7663 Be mindful that the Python interpreter switches between threads every
7663 Be mindful that the Python interpreter switches between threads every
7664 \begin_inset Formula $N$
7664 \begin_inset Formula $N$
7665 \end_inset
7665 \end_inset
7666
7666
7667 bytecodes, where the default value as of Python\SpecialChar ~
7667 bytecodes, where the default value as of Python\SpecialChar ~
7668 2.3 is
7668 2.3 is
7669 \begin_inset Formula $N=100.$
7669 \begin_inset Formula $N=100.$
7670 \end_inset
7670 \end_inset
7671
7671
7672 This value can be read by using the
7672 This value can be read by using the
7673 \family typewriter
7673 \family typewriter
7674 sys.getcheckinterval()
7674 sys.getcheckinterval()
7675 \family default
7675 \family default
7676 function, and it can be reset via
7676 function, and it can be reset via
7677 \family typewriter
7677 \family typewriter
7678 sys.setcheckinterval(
7678 sys.setcheckinterval(
7679 \emph on
7679 \emph on
7680 N
7680 N
7681 \emph default
7681 \emph default
7682 )
7682 )
7683 \family default
7683 \family default
7684 .
7684 .
7685 This switching of threads can cause subtly confusing effects if one of
7685 This switching of threads can cause subtly confusing effects if one of
7686 your threads is doing file I/O.
7686 your threads is doing file I/O.
7687 In text mode, most systems only flush file buffers when they encounter
7687 In text mode, most systems only flush file buffers when they encounter
7688 a
7688 a
7689 \family typewriter
7689 \family typewriter
7690 `
7690 `
7691 \backslash
7691 \backslash
7692 n'
7692 n'
7693 \family default
7693 \family default
7694 .
7694 .
7695 An instruction as simple as
7695 An instruction as simple as
7696 \family typewriter
7696 \family typewriter
7697
7697
7698 \newline
7698 \newline
7699 \SpecialChar ~
7699 \SpecialChar ~
7700 \SpecialChar ~
7700 \SpecialChar ~
7701 print >> filehandle,
7701 print >> filehandle,
7702 \begin_inset Quotes eld
7702 \begin_inset Quotes eld
7703 \end_inset
7703 \end_inset
7704
7704
7705 hello world
7705 hello world
7706 \begin_inset Quotes erd
7706 \begin_inset Quotes erd
7707 \end_inset
7707 \end_inset
7708
7708
7709
7709
7710 \family default
7710 \family default
7711
7711
7712 \newline
7712 \newline
7713 actually consists of several bytecodes, so it is possible that the newline
7713 actually consists of several bytecodes, so it is possible that the newline
7714 does not reach your file before the next thread switch.
7714 does not reach your file before the next thread switch.
7715 Similarly, if you are writing to a file in binary mode, the file won't
7715 Similarly, if you are writing to a file in binary mode, the file won't
7716 be flushed until the buffer fills, and your other thread may see apparently
7716 be flushed until the buffer fills, and your other thread may see apparently
7717 truncated files.
7717 truncated files.
7718
7718
7719 \layout Standard
7719 \layout Standard
7720
7720
7721 For this reason, if you are using IPython's thread support and have (for
7721 For this reason, if you are using IPython's thread support and have (for
7722 example) a GUI application which will read data generated by files written
7722 example) a GUI application which will read data generated by files written
7723 to from the IPython thread, the safest approach is to open all of your
7723 to from the IPython thread, the safest approach is to open all of your
7724 files in unbuffered mode (the third argument to the
7724 files in unbuffered mode (the third argument to the
7725 \family typewriter
7725 \family typewriter
7726 file/open
7726 file/open
7727 \family default
7727 \family default
7728 function is the buffering value):
7728 function is the buffering value):
7729 \newline
7729 \newline
7730
7730
7731 \family typewriter
7731 \family typewriter
7732 \SpecialChar ~
7732 \SpecialChar ~
7733 \SpecialChar ~
7733 \SpecialChar ~
7734 filehandle = open(filename,mode,0)
7734 filehandle = open(filename,mode,0)
7735 \layout Standard
7735 \layout Standard
7736
7736
7737 This is obviously a brute force way of avoiding race conditions with the
7737 This is obviously a brute force way of avoiding race conditions with the
7738 file buffering.
7738 file buffering.
7739 If you want to do it cleanly, and you have a resource which is being shared
7739 If you want to do it cleanly, and you have a resource which is being shared
7740 by the interactive IPython loop and your GUI thread, you should really
7740 by the interactive IPython loop and your GUI thread, you should really
7741 handle it with thread locking and syncrhonization properties.
7741 handle it with thread locking and syncrhonization properties.
7742 The Python documentation discusses these.
7742 The Python documentation discusses these.
7743 \layout Section
7743 \layout Section
7744
7744
7745
7745
7746 \begin_inset LatexCommand \label{sec:interactive-demos}
7746 \begin_inset LatexCommand \label{sec:interactive-demos}
7747
7747
7748 \end_inset
7748 \end_inset
7749
7749
7750 Interactive demos with IPython
7750 Interactive demos with IPython
7751 \layout Standard
7751 \layout Standard
7752
7752
7753 IPython ships with a basic system for running scripts interactively in sections,
7753 IPython ships with a basic system for running scripts interactively in sections,
7754 useful when presenting code to audiences.
7754 useful when presenting code to audiences.
7755 A few tags embedded in comments (so that the script remains valid Python
7755 A few tags embedded in comments (so that the script remains valid Python
7756 code) divide a file into separate blocks, and the demo can be run one block
7756 code) divide a file into separate blocks, and the demo can be run one block
7757 at a time, with IPython printing (with syntax highlighting) the block before
7757 at a time, with IPython printing (with syntax highlighting) the block before
7758 executing it, and returning to the interactive prompt after each block.
7758 executing it, and returning to the interactive prompt after each block.
7759 The interactive namespace is updated after each block is run with the contents
7759 The interactive namespace is updated after each block is run with the contents
7760 of the demo's namespace.
7760 of the demo's namespace.
7761 \layout Standard
7761 \layout Standard
7762
7762
7763 This allows you to show a piece of code, run it and then execute interactively
7763 This allows you to show a piece of code, run it and then execute interactively
7764 commands based on the variables just created.
7764 commands based on the variables just created.
7765 Once you want to continue, you simply execute the next block of the demo.
7765 Once you want to continue, you simply execute the next block of the demo.
7766 The following listing shows the markup necessary for dividing a script
7766 The following listing shows the markup necessary for dividing a script
7767 into sections for execution as a demo.
7767 into sections for execution as a demo.
7768 \layout Standard
7768 \layout Standard
7769
7769
7770
7770
7771 \begin_inset ERT
7771 \begin_inset ERT
7772 status Open
7772 status Open
7773
7773
7774 \layout Standard
7774 \layout Standard
7775
7775
7776 \backslash
7776 \backslash
7777 codelist{examples/example-demo.py}
7777 codelist{examples/example-demo.py}
7778 \end_inset
7778 \end_inset
7779
7779
7780
7780
7781 \layout Standard
7781 \layout Standard
7782
7782
7783 In order to run a file as a demo, you must first make a
7783 In order to run a file as a demo, you must first make a
7784 \family typewriter
7784 \family typewriter
7785 Demo
7785 Demo
7786 \family default
7786 \family default
7787 object out of it.
7787 object out of it.
7788 If the file is named
7788 If the file is named
7789 \family typewriter
7789 \family typewriter
7790 myscript.py
7790 myscript.py
7791 \family default
7791 \family default
7792 , the following code will make a demo:
7792 , the following code will make a demo:
7793 \layout LyX-Code
7793 \layout LyX-Code
7794
7794
7795 from IPython.demo import Demo
7795 from IPython.demo import Demo
7796 \layout LyX-Code
7796 \layout LyX-Code
7797
7797
7798 mydemo = Demo('myscript.py')
7798 mydemo = Demo('myscript.py')
7799 \layout Standard
7799 \layout Standard
7800
7800
7801 This creates the
7801 This creates the
7802 \family typewriter
7802 \family typewriter
7803 mydemo
7803 mydemo
7804 \family default
7804 \family default
7805 object, whose blocks you run one at a time by simply calling the object
7805 object, whose blocks you run one at a time by simply calling the object
7806 with no arguments.
7806 with no arguments.
7807 If you have autocall active in IPython (the default), all you need to do
7807 If you have autocall active in IPython (the default), all you need to do
7808 is type
7808 is type
7809 \layout LyX-Code
7809 \layout LyX-Code
7810
7810
7811 mydemo
7811 mydemo
7812 \layout Standard
7812 \layout Standard
7813
7813
7814 and IPython will call it, executing each block.
7814 and IPython will call it, executing each block.
7815 Demo objects can be restarted, you can move forward or back skipping blocks,
7815 Demo objects can be restarted, you can move forward or back skipping blocks,
7816 re-execute the last block, etc.
7816 re-execute the last block, etc.
7817 Simply use the Tab key on a demo object to see its methods, and call
7817 Simply use the Tab key on a demo object to see its methods, and call
7818 \family typewriter
7818 \family typewriter
7819 `?'
7819 `?'
7820 \family default
7820 \family default
7821 on them to see their docstrings for more usage details.
7821 on them to see their docstrings for more usage details.
7822 In addition, the
7822 In addition, the
7823 \family typewriter
7823 \family typewriter
7824 demo
7824 demo
7825 \family default
7825 \family default
7826 module itself contains a comprehensive docstring, which you can access
7826 module itself contains a comprehensive docstring, which you can access
7827 via
7827 via
7828 \layout LyX-Code
7828 \layout LyX-Code
7829
7829
7830 from IPython import demo
7830 from IPython import demo
7831 \layout LyX-Code
7831 \layout LyX-Code
7832
7832
7833 demo?
7833 demo?
7834 \layout Standard
7834 \layout Standard
7835
7835
7836
7836
7837 \series bold
7837 \series bold
7838 Limitations:
7838 Limitations:
7839 \series default
7839 \series default
7840 It is important to note that these demos are limited to fairly simple uses.
7840 It is important to note that these demos are limited to fairly simple uses.
7841 In particular, you can
7841 In particular, you can
7842 \emph on
7842 \emph on
7843 not
7843 not
7844 \emph default
7844 \emph default
7845 put division marks in indented code (loops, if statements, function definitions
7845 put division marks in indented code (loops, if statements, function definitions
7846 , etc.) Supporting something like this would basically require tracking the
7846 , etc.) Supporting something like this would basically require tracking the
7847 internal execution state of the Python interpreter, so only top-level divisions
7847 internal execution state of the Python interpreter, so only top-level divisions
7848 are allowed.
7848 are allowed.
7849 If you want to be able to open an IPython instance at an arbitrary point
7849 If you want to be able to open an IPython instance at an arbitrary point
7850 in a program, you can use IPython's embedding facilities, described in
7850 in a program, you can use IPython's embedding facilities, described in
7851 detail in Sec\SpecialChar \@.
7851 detail in Sec\SpecialChar \@.
7852 \SpecialChar ~
7852 \SpecialChar ~
7853
7853
7854 \begin_inset LatexCommand \ref{sec:embed}
7854 \begin_inset LatexCommand \ref{sec:embed}
7855
7855
7856 \end_inset
7856 \end_inset
7857
7857
7858 .
7858 .
7859 \layout Section
7859 \layout Section
7860
7860
7861
7861
7862 \begin_inset LatexCommand \label{sec:matplotlib-support}
7862 \begin_inset LatexCommand \label{sec:matplotlib-support}
7863
7863
7864 \end_inset
7864 \end_inset
7865
7865
7866 Plotting with
7866 Plotting with
7867 \family typewriter
7867 \family typewriter
7868 matplotlib
7868 matplotlib
7869 \family default
7869 \family default
7870
7870
7871 \layout Standard
7871 \layout Standard
7872
7872
7873 The matplotlib library (
7873 The matplotlib library (
7874 \begin_inset LatexCommand \htmlurl[http://matplotlib.sourceforge.net]{http://matplotlib.sourceforge.net}
7874 \begin_inset LatexCommand \htmlurl[http://matplotlib.sourceforge.net]{http://matplotlib.sourceforge.net}
7875
7875
7876 \end_inset
7876 \end_inset
7877
7877
7878 ) provides high quality 2D plotting for Python.
7878 ) provides high quality 2D plotting for Python.
7879 Matplotlib can produce plots on screen using a variety of GUI toolkits,
7879 Matplotlib can produce plots on screen using a variety of GUI toolkits,
7880 including Tk, GTK and WXPython.
7880 including Tk, GTK and WXPython.
7881 It also provides a number of commands useful for scientific computing,
7881 It also provides a number of commands useful for scientific computing,
7882 all with a syntax compatible with that of the popular Matlab program.
7882 all with a syntax compatible with that of the popular Matlab program.
7883 \layout Standard
7883 \layout Standard
7884
7884
7885 IPython accepts the special option
7885 IPython accepts the special option
7886 \family typewriter
7886 \family typewriter
7887 -pylab
7887 -pylab
7888 \family default
7888 \family default
7889 (Sec.\SpecialChar ~
7889 (Sec.\SpecialChar ~
7890
7890
7891 \begin_inset LatexCommand \ref{sec:cmd-line-opts}
7891 \begin_inset LatexCommand \ref{sec:cmd-line-opts}
7892
7892
7893 \end_inset
7893 \end_inset
7894
7894
7895 ).
7895 ).
7896 This configures it to support matplotlib, honoring the settings in the
7896 This configures it to support matplotlib, honoring the settings in the
7897
7897
7898 \family typewriter
7898 \family typewriter
7899 .matplotlibrc
7899 .matplotlibrc
7900 \family default
7900 \family default
7901 file.
7901 file.
7902 IPython will detect the user's choice of matplotlib GUI backend, and automatica
7902 IPython will detect the user's choice of matplotlib GUI backend, and automatica
7903 lly select the proper threading model to prevent blocking.
7903 lly select the proper threading model to prevent blocking.
7904 It also sets matplotlib in interactive mode and modifies
7904 It also sets matplotlib in interactive mode and modifies
7905 \family typewriter
7905 \family typewriter
7906 %run
7906 %run
7907 \family default
7907 \family default
7908 slightly, so that any matplotlib-based script can be executed using
7908 slightly, so that any matplotlib-based script can be executed using
7909 \family typewriter
7909 \family typewriter
7910 %run
7910 %run
7911 \family default
7911 \family default
7912 and the final
7912 and the final
7913 \family typewriter
7913 \family typewriter
7914 show()
7914 show()
7915 \family default
7915 \family default
7916 command does not block the interactive shell.
7916 command does not block the interactive shell.
7917 \layout Standard
7917 \layout Standard
7918
7918
7919 The
7919 The
7920 \family typewriter
7920 \family typewriter
7921 -pylab
7921 -pylab
7922 \family default
7922 \family default
7923 option must be given first in order for IPython to configure its threading
7923 option must be given first in order for IPython to configure its threading
7924 mode.
7924 mode.
7925 However, you can still issue other options afterwards.
7925 However, you can still issue other options afterwards.
7926 This allows you to have a matplotlib-based environment customized with
7926 This allows you to have a matplotlib-based environment customized with
7927 additional modules using the standard IPython profile mechanism (Sec.\SpecialChar ~
7927 additional modules using the standard IPython profile mechanism (Sec.\SpecialChar ~
7928
7928
7929 \begin_inset LatexCommand \ref{sec:profiles}
7929 \begin_inset LatexCommand \ref{sec:profiles}
7930
7930
7931 \end_inset
7931 \end_inset
7932
7932
7933 ): ``
7933 ): ``
7934 \family typewriter
7934 \family typewriter
7935 ipython -pylab -p myprofile
7935 ipython -pylab -p myprofile
7936 \family default
7936 \family default
7937 '' will load the profile defined in
7937 '' will load the profile defined in
7938 \family typewriter
7938 \family typewriter
7939 ipythonrc-myprofile
7939 ipythonrc-myprofile
7940 \family default
7940 \family default
7941 after configuring matplotlib.
7941 after configuring matplotlib.
7942 \layout Section
7942 \layout Section
7943
7943
7944
7944
7945 \begin_inset LatexCommand \label{sec:Gnuplot}
7945 \begin_inset LatexCommand \label{sec:Gnuplot}
7946
7946
7947 \end_inset
7947 \end_inset
7948
7948
7949 Plotting with
7949 Plotting with
7950 \family typewriter
7950 \family typewriter
7951 Gnuplot
7951 Gnuplot
7952 \layout Standard
7952 \layout Standard
7953
7953
7954 Through the magic extension system described in sec.
7954 Through the magic extension system described in sec.
7955
7955
7956 \begin_inset LatexCommand \ref{sec:magic}
7956 \begin_inset LatexCommand \ref{sec:magic}
7957
7957
7958 \end_inset
7958 \end_inset
7959
7959
7960 , IPython incorporates a mechanism for conveniently interfacing with the
7960 , IPython incorporates a mechanism for conveniently interfacing with the
7961 Gnuplot system (
7961 Gnuplot system (
7962 \begin_inset LatexCommand \htmlurl{http://www.gnuplot.info}
7962 \begin_inset LatexCommand \htmlurl{http://www.gnuplot.info}
7963
7963
7964 \end_inset
7964 \end_inset
7965
7965
7966 ).
7966 ).
7967 Gnuplot is a very complete 2D and 3D plotting package available for many
7967 Gnuplot is a very complete 2D and 3D plotting package available for many
7968 operating systems and commonly included in modern Linux distributions.
7968 operating systems and commonly included in modern Linux distributions.
7969
7969
7970 \layout Standard
7970 \layout Standard
7971
7971
7972 Besides having Gnuplot installed, this functionality requires the
7972 Besides having Gnuplot installed, this functionality requires the
7973 \family typewriter
7973 \family typewriter
7974 Gnuplot.py
7974 Gnuplot.py
7975 \family default
7975 \family default
7976 module for interfacing python with Gnuplot.
7976 module for interfacing python with Gnuplot.
7977 It can be downloaded from:
7977 It can be downloaded from:
7978 \begin_inset LatexCommand \htmlurl{http://gnuplot-py.sourceforge.net}
7978 \begin_inset LatexCommand \htmlurl{http://gnuplot-py.sourceforge.net}
7979
7979
7980 \end_inset
7980 \end_inset
7981
7981
7982 .
7982 .
7983 \layout Subsection
7983 \layout Subsection
7984
7984
7985 Proper Gnuplot configuration
7985 Proper Gnuplot configuration
7986 \layout Standard
7986 \layout Standard
7987
7987
7988 As of version 4.0, Gnuplot has excellent mouse and interactive keyboard support.
7988 As of version 4.0, Gnuplot has excellent mouse and interactive keyboard support.
7989 However, as of
7989 However, as of
7990 \family typewriter
7990 \family typewriter
7991 Gnuplot.py
7991 Gnuplot.py
7992 \family default
7992 \family default
7993 version 1.7, a new option was added to communicate between Python and Gnuplot
7993 version 1.7, a new option was added to communicate between Python and Gnuplot
7994 via FIFOs (pipes).
7994 via FIFOs (pipes).
7995 This mechanism, while fast, also breaks the mouse system.
7995 This mechanism, while fast, also breaks the mouse system.
7996 You must therefore set the variable
7996 You must therefore set the variable
7997 \family typewriter
7997 \family typewriter
7998 prefer_fifo_data
7998 prefer_fifo_data
7999 \family default
7999 \family default
8000 to
8000 to
8001 \family typewriter
8001 \family typewriter
8002 0
8002 0
8003 \family default
8003 \family default
8004 in file
8004 in file
8005 \family typewriter
8005 \family typewriter
8006 gp_unix.py
8006 gp_unix.py
8007 \family default
8007 \family default
8008 if you wish to keep the interactive mouse and keyboard features working
8008 if you wish to keep the interactive mouse and keyboard features working
8009 properly (
8009 properly (
8010 \family typewriter
8010 \family typewriter
8011 prefer_inline_data
8011 prefer_inline_data
8012 \family default
8012 \family default
8013 also must be
8013 also must be
8014 \family typewriter
8014 \family typewriter
8015 0
8015 0
8016 \family default
8016 \family default
8017 , but this is the default so unless you've changed it manually you should
8017 , but this is the default so unless you've changed it manually you should
8018 be fine).
8018 be fine).
8019 \layout Standard
8019 \layout Standard
8020
8020
8021 'Out of the box', Gnuplot is configured with a rather poor set of size,
8021 'Out of the box', Gnuplot is configured with a rather poor set of size,
8022 color and linewidth choices which make the graphs fairly hard to read on
8022 color and linewidth choices which make the graphs fairly hard to read on
8023 modern high-resolution displays (although they work fine on old 640x480
8023 modern high-resolution displays (although they work fine on old 640x480
8024 ones).
8024 ones).
8025 Below is a section of my
8025 Below is a section of my
8026 \family typewriter
8026 \family typewriter
8027 .Xdefaults
8027 .Xdefaults
8028 \family default
8028 \family default
8029 file which I use for having a more convenient Gnuplot setup.
8029 file which I use for having a more convenient Gnuplot setup.
8030 Remember to load it by running
8030 Remember to load it by running
8031 \family typewriter
8031 \family typewriter
8032 `xrdb .Xdefaults`
8032 `xrdb .Xdefaults`
8033 \family default
8033 \family default
8034 :
8034 :
8035 \layout Standard
8035 \layout Standard
8036
8036
8037
8037
8038 \family typewriter
8038 \family typewriter
8039 !******************************************************************
8039 !******************************************************************
8040 \newline
8040 \newline
8041 ! gnuplot options
8041 ! gnuplot options
8042 \newline
8042 \newline
8043 ! modify this for a convenient window size
8043 ! modify this for a convenient window size
8044 \newline
8044 \newline
8045 gnuplot*geometry: 780x580
8045 gnuplot*geometry: 780x580
8046 \layout Standard
8046 \layout Standard
8047
8047
8048
8048
8049 \family typewriter
8049 \family typewriter
8050 ! on-screen font (not for PostScript)
8050 ! on-screen font (not for PostScript)
8051 \newline
8051 \newline
8052 gnuplot*font: -misc-fixed-bold-r-normal--15-120-100-100-c-90-iso8859-1
8052 gnuplot*font: -misc-fixed-bold-r-normal--15-120-100-100-c-90-iso8859-1
8053 \layout Standard
8053 \layout Standard
8054
8054
8055
8055
8056 \family typewriter
8056 \family typewriter
8057 ! color options
8057 ! color options
8058 \newline
8058 \newline
8059 gnuplot*background: black
8059 gnuplot*background: black
8060 \newline
8060 \newline
8061 gnuplot*textColor: white
8061 gnuplot*textColor: white
8062 \newline
8062 \newline
8063 gnuplot*borderColor: white
8063 gnuplot*borderColor: white
8064 \newline
8064 \newline
8065 gnuplot*axisColor: white
8065 gnuplot*axisColor: white
8066 \newline
8066 \newline
8067 gnuplot*line1Color: red
8067 gnuplot*line1Color: red
8068 \newline
8068 \newline
8069 gnuplot*line2Color: green
8069 gnuplot*line2Color: green
8070 \newline
8070 \newline
8071 gnuplot*line3Color: blue
8071 gnuplot*line3Color: blue
8072 \newline
8072 \newline
8073 gnuplot*line4Color: magenta
8073 gnuplot*line4Color: magenta
8074 \newline
8074 \newline
8075 gnuplot*line5Color: cyan
8075 gnuplot*line5Color: cyan
8076 \newline
8076 \newline
8077 gnuplot*line6Color: sienna
8077 gnuplot*line6Color: sienna
8078 \newline
8078 \newline
8079 gnuplot*line7Color: orange
8079 gnuplot*line7Color: orange
8080 \newline
8080 \newline
8081 gnuplot*line8Color: coral
8081 gnuplot*line8Color: coral
8082 \layout Standard
8082 \layout Standard
8083
8083
8084
8084
8085 \family typewriter
8085 \family typewriter
8086 ! multiplicative factor for point styles
8086 ! multiplicative factor for point styles
8087 \newline
8087 \newline
8088 gnuplot*pointsize: 2
8088 gnuplot*pointsize: 2
8089 \layout Standard
8089 \layout Standard
8090
8090
8091
8091
8092 \family typewriter
8092 \family typewriter
8093 ! line width options (in pixels)
8093 ! line width options (in pixels)
8094 \newline
8094 \newline
8095 gnuplot*borderWidth: 2
8095 gnuplot*borderWidth: 2
8096 \newline
8096 \newline
8097 gnuplot*axisWidth: 2
8097 gnuplot*axisWidth: 2
8098 \newline
8098 \newline
8099 gnuplot*line1Width: 2
8099 gnuplot*line1Width: 2
8100 \newline
8100 \newline
8101 gnuplot*line2Width: 2
8101 gnuplot*line2Width: 2
8102 \newline
8102 \newline
8103 gnuplot*line3Width: 2
8103 gnuplot*line3Width: 2
8104 \newline
8104 \newline
8105 gnuplot*line4Width: 2
8105 gnuplot*line4Width: 2
8106 \newline
8106 \newline
8107 gnuplot*line5Width: 2
8107 gnuplot*line5Width: 2
8108 \newline
8108 \newline
8109 gnuplot*line6Width: 2
8109 gnuplot*line6Width: 2
8110 \newline
8110 \newline
8111 gnuplot*line7Width: 2
8111 gnuplot*line7Width: 2
8112 \newline
8112 \newline
8113 gnuplot*line8Width: 2
8113 gnuplot*line8Width: 2
8114 \layout Subsection
8114 \layout Subsection
8115
8115
8116 The
8116 The
8117 \family typewriter
8117 \family typewriter
8118 IPython.GnuplotRuntime
8118 IPython.GnuplotRuntime
8119 \family default
8119 \family default
8120 module
8120 module
8121 \layout Standard
8121 \layout Standard
8122
8122
8123 IPython includes a module called
8123 IPython includes a module called
8124 \family typewriter
8124 \family typewriter
8125 Gnuplot2.py
8125 Gnuplot2.py
8126 \family default
8126 \family default
8127 which extends and improves the default
8127 which extends and improves the default
8128 \family typewriter
8128 \family typewriter
8129 Gnuplot
8129 Gnuplot
8130 \family default
8130 \family default
8131 .
8131 .
8132 \family typewriter
8132 \family typewriter
8133 py
8133 py
8134 \family default
8134 \family default
8135 (which it still relies upon).
8135 (which it still relies upon).
8136 For example, the new
8136 For example, the new
8137 \family typewriter
8137 \family typewriter
8138 plot
8138 plot
8139 \family default
8139 \family default
8140 function adds several improvements to the original making it more convenient
8140 function adds several improvements to the original making it more convenient
8141 for interactive use, and
8141 for interactive use, and
8142 \family typewriter
8142 \family typewriter
8143 hardcopy
8143 hardcopy
8144 \family default
8144 \family default
8145 fixes a bug in the original which under some circumstances blocks the creation
8145 fixes a bug in the original which under some circumstances blocks the creation
8146 of PostScript output.
8146 of PostScript output.
8147 \layout Standard
8147 \layout Standard
8148
8148
8149 For scripting use,
8149 For scripting use,
8150 \family typewriter
8150 \family typewriter
8151 GnuplotRuntime.py
8151 GnuplotRuntime.py
8152 \family default
8152 \family default
8153 is provided, which wraps
8153 is provided, which wraps
8154 \family typewriter
8154 \family typewriter
8155 Gnuplot2.py
8155 Gnuplot2.py
8156 \family default
8156 \family default
8157 and creates a series of global aliases.
8157 and creates a series of global aliases.
8158 These make it easy to control Gnuplot plotting jobs through the Python
8158 These make it easy to control Gnuplot plotting jobs through the Python
8159 language.
8159 language.
8160 \layout Standard
8160 \layout Standard
8161
8161
8162 Below is some example code which illustrates how to configure Gnuplot inside
8162 Below is some example code which illustrates how to configure Gnuplot inside
8163 your own programs but have it available for further interactive use through
8163 your own programs but have it available for further interactive use through
8164 an embedded IPython instance.
8164 an embedded IPython instance.
8165 Simply run this file at a system prompt.
8165 Simply run this file at a system prompt.
8166 This file is provided as
8166 This file is provided as
8167 \family typewriter
8167 \family typewriter
8168 example-gnuplot.py
8168 example-gnuplot.py
8169 \family default
8169 \family default
8170 in the examples directory:
8170 in the examples directory:
8171 \layout Standard
8171 \layout Standard
8172
8172
8173
8173
8174 \begin_inset ERT
8174 \begin_inset ERT
8175 status Open
8175 status Open
8176
8176
8177 \layout Standard
8177 \layout Standard
8178
8178
8179 \backslash
8179 \backslash
8180 codelist{examples/example-gnuplot.py}
8180 codelist{examples/example-gnuplot.py}
8181 \end_inset
8181 \end_inset
8182
8182
8183
8183
8184 \layout Subsection
8184 \layout Subsection
8185
8185
8186 The
8186 The
8187 \family typewriter
8187 \family typewriter
8188 numeric
8188 numeric
8189 \family default
8189 \family default
8190 profile: a scientific computing environment
8190 profile: a scientific computing environment
8191 \layout Standard
8191 \layout Standard
8192
8192
8193 The
8193 The
8194 \family typewriter
8194 \family typewriter
8195 numeric
8195 numeric
8196 \family default
8196 \family default
8197 IPython profile, which you can activate with
8197 IPython profile, which you can activate with
8198 \family typewriter
8198 \family typewriter
8199 `ipython -p numeric
8199 `ipython -p numeric
8200 \family default
8200 \family default
8201 ' will automatically load the IPython Gnuplot extensions (plus Numeric and
8201 ' will automatically load the IPython Gnuplot extensions (plus Numeric and
8202 other useful things for numerical computing), contained in the
8202 other useful things for numerical computing), contained in the
8203 \family typewriter
8203 \family typewriter
8204 IPython.GnuplotInteractive
8204 IPython.GnuplotInteractive
8205 \family default
8205 \family default
8206 module.
8206 module.
8207 This will create the globals
8207 This will create the globals
8208 \family typewriter
8208 \family typewriter
8209 Gnuplot
8209 Gnuplot
8210 \family default
8210 \family default
8211 (an alias to the improved Gnuplot2 module),
8211 (an alias to the improved Gnuplot2 module),
8212 \family typewriter
8212 \family typewriter
8213 gp
8213 gp
8214 \family default
8214 \family default
8215 (a Gnuplot active instance), the new magic commands
8215 (a Gnuplot active instance), the new magic commands
8216 \family typewriter
8216 \family typewriter
8217 %gpc
8217 %gpc
8218 \family default
8218 \family default
8219 and
8219 and
8220 \family typewriter
8220 \family typewriter
8221 %gp_set_instance
8221 %gp_set_instance
8222 \family default
8222 \family default
8223 and several other convenient globals.
8223 and several other convenient globals.
8224 Type
8224 Type
8225 \family typewriter
8225 \family typewriter
8226 gphelp()
8226 gphelp()
8227 \family default
8227 \family default
8228 for further details.
8228 for further details.
8229 \layout Standard
8229 \layout Standard
8230
8230
8231 This should turn IPython into a convenient environment for numerical computing,
8231 This should turn IPython into a convenient environment for numerical computing,
8232 with all the functions in the NumPy library and the Gnuplot facilities
8232 with all the functions in the NumPy library and the Gnuplot facilities
8233 for plotting.
8233 for plotting.
8234 Further improvements can be obtained by loading the SciPy libraries for
8234 Further improvements can be obtained by loading the SciPy libraries for
8235 scientific computing, available at
8235 scientific computing, available at
8236 \begin_inset LatexCommand \htmlurl{http://scipy.org}
8236 \begin_inset LatexCommand \htmlurl{http://scipy.org}
8237
8237
8238 \end_inset
8238 \end_inset
8239
8239
8240 .
8240 .
8241 \layout Standard
8241 \layout Standard
8242
8242
8243 If you are in the middle of a working session with numerical objects and
8243 If you are in the middle of a working session with numerical objects and
8244 need to plot them but you didn't start the
8244 need to plot them but you didn't start the
8245 \family typewriter
8245 \family typewriter
8246 numeric
8246 numeric
8247 \family default
8247 \family default
8248 profile, you can load these extensions at any time by typing
8248 profile, you can load these extensions at any time by typing
8249 \newline
8249 \newline
8250
8250
8251 \family typewriter
8251 \family typewriter
8252 from IPython.GnuplotInteractive import *
8252 from IPython.GnuplotInteractive import *
8253 \newline
8253 \newline
8254
8254
8255 \family default
8255 \family default
8256 at the IPython prompt.
8256 at the IPython prompt.
8257 This will allow you to keep your objects intact and start using Gnuplot
8257 This will allow you to keep your objects intact and start using Gnuplot
8258 to view them.
8258 to view them.
8259 \layout Section
8259 \layout Section
8260
8260
8261 Reporting bugs
8261 Reporting bugs
8262 \layout Subsection*
8262 \layout Subsection*
8263
8263
8264 Automatic crash reports
8264 Automatic crash reports
8265 \layout Standard
8265 \layout Standard
8266
8266
8267 Ideally, IPython itself shouldn't crash.
8267 Ideally, IPython itself shouldn't crash.
8268 It will catch exceptions produced by you, but bugs in its internals will
8268 It will catch exceptions produced by you, but bugs in its internals will
8269 still crash it.
8269 still crash it.
8270 \layout Standard
8270 \layout Standard
8271
8271
8272 In such a situation, IPython will leave a file named
8272 In such a situation, IPython will leave a file named
8273 \family typewriter
8273 \family typewriter
8274 IPython_crash_report.txt
8274 IPython_crash_report.txt
8275 \family default
8275 \family default
8276 in your IPYTHONDIR directory (that way if crashes happen several times
8276 in your IPYTHONDIR directory (that way if crashes happen several times
8277 it won't litter many directories, the post-mortem file is always located
8277 it won't litter many directories, the post-mortem file is always located
8278 in the same place and new occurrences just overwrite the previous one).
8278 in the same place and new occurrences just overwrite the previous one).
8279 If you can mail this file to the developers (see sec.
8279 If you can mail this file to the developers (see sec.
8280
8280
8281 \begin_inset LatexCommand \ref{sec:credits}
8281 \begin_inset LatexCommand \ref{sec:credits}
8282
8282
8283 \end_inset
8283 \end_inset
8284
8284
8285 for names and addresses), it will help us
8285 for names and addresses), it will help us
8286 \emph on
8286 \emph on
8287 a lot
8287 a lot
8288 \emph default
8288 \emph default
8289 in understanding the cause of the problem and fixing it sooner.
8289 in understanding the cause of the problem and fixing it sooner.
8290 \layout Subsection*
8290 \layout Subsection*
8291
8291
8292 The bug tracker
8292 The bug tracker
8293 \layout Standard
8293 \layout Standard
8294
8294
8295 IPython also has an online bug-tracker, located at
8295 IPython also has an online bug-tracker, located at
8296 \begin_inset LatexCommand \htmlurl{http://www.scipy.net/roundup/ipython}
8296 \begin_inset LatexCommand \htmlurl{http://www.scipy.net/roundup/ipython}
8297
8297
8298 \end_inset
8298 \end_inset
8299
8299
8300 .
8300 .
8301 In addition to mailing the developers, it would be a good idea to file
8301 In addition to mailing the developers, it would be a good idea to file
8302 a bug report here.
8302 a bug report here.
8303 This will ensure that the issue is properly followed to conclusion.
8303 This will ensure that the issue is properly followed to conclusion.
8304 \layout Standard
8304 \layout Standard
8305
8305
8306 You can also use this bug tracker to file feature requests.
8306 You can also use this bug tracker to file feature requests.
8307 \layout Section
8307 \layout Section
8308
8308
8309 Brief history
8309 Brief history
8310 \layout Subsection
8310 \layout Subsection
8311
8311
8312 Origins
8312 Origins
8313 \layout Standard
8313 \layout Standard
8314
8314
8315 The current IPython system grew out of the following three projects:
8315 The current IPython system grew out of the following three projects:
8316 \layout List
8316 \layout List
8317 \labelwidthstring 00.00.0000
8317 \labelwidthstring 00.00.0000
8318
8318
8319 ipython by Fernando Pérez.
8319 ipython by Fernando Pérez.
8320 I was working on adding Mathematica-type prompts and a flexible configuration
8320 I was working on adding Mathematica-type prompts and a flexible configuration
8321 system (something better than
8321 system (something better than
8322 \family typewriter
8322 \family typewriter
8323 $PYTHONSTARTUP
8323 $PYTHONSTARTUP
8324 \family default
8324 \family default
8325 ) to the standard Python interactive interpreter.
8325 ) to the standard Python interactive interpreter.
8326 \layout List
8326 \layout List
8327 \labelwidthstring 00.00.0000
8327 \labelwidthstring 00.00.0000
8328
8328
8329 IPP by Janko Hauser.
8329 IPP by Janko Hauser.
8330 Very well organized, great usability.
8330 Very well organized, great usability.
8331 Had an old help system.
8331 Had an old help system.
8332 IPP was used as the `container' code into which I added the functionality
8332 IPP was used as the `container' code into which I added the functionality
8333 from ipython and LazyPython.
8333 from ipython and LazyPython.
8334 \layout List
8334 \layout List
8335 \labelwidthstring 00.00.0000
8335 \labelwidthstring 00.00.0000
8336
8336
8337 LazyPython by Nathan Gray.
8337 LazyPython by Nathan Gray.
8338 Simple but
8338 Simple but
8339 \emph on
8339 \emph on
8340 very
8340 very
8341 \emph default
8341 \emph default
8342 powerful.
8342 powerful.
8343 The quick syntax (auto parens, auto quotes) and verbose/colored tracebacks
8343 The quick syntax (auto parens, auto quotes) and verbose/colored tracebacks
8344 were all taken from here.
8344 were all taken from here.
8345 \layout Standard
8345 \layout Standard
8346
8346
8347 When I found out (see sec.
8347 When I found out (see sec.
8348
8348
8349 \begin_inset LatexCommand \ref{figgins}
8349 \begin_inset LatexCommand \ref{figgins}
8350
8350
8351 \end_inset
8351 \end_inset
8352
8352
8353 ) about IPP and LazyPython I tried to join all three into a unified system.
8353 ) about IPP and LazyPython I tried to join all three into a unified system.
8354 I thought this could provide a very nice working environment, both for
8354 I thought this could provide a very nice working environment, both for
8355 regular programming and scientific computing: shell-like features, IDL/Matlab
8355 regular programming and scientific computing: shell-like features, IDL/Matlab
8356 numerics, Mathematica-type prompt history and great object introspection
8356 numerics, Mathematica-type prompt history and great object introspection
8357 and help facilities.
8357 and help facilities.
8358 I think it worked reasonably well, though it was a lot more work than I
8358 I think it worked reasonably well, though it was a lot more work than I
8359 had initially planned.
8359 had initially planned.
8360 \layout Subsection
8360 \layout Subsection
8361
8361
8362 Current status
8362 Current status
8363 \layout Standard
8363 \layout Standard
8364
8364
8365 The above listed features work, and quite well for the most part.
8365 The above listed features work, and quite well for the most part.
8366 But until a major internal restructuring is done (see below), only bug
8366 But until a major internal restructuring is done (see below), only bug
8367 fixing will be done, no other features will be added (unless very minor
8367 fixing will be done, no other features will be added (unless very minor
8368 and well localized in the cleaner parts of the code).
8368 and well localized in the cleaner parts of the code).
8369 \layout Standard
8369 \layout Standard
8370
8370
8371 IPython consists of some 12000 lines of pure python code, of which roughly
8371 IPython consists of some 12000 lines of pure python code, of which roughly
8372 50% are fairly clean.
8372 50% are fairly clean.
8373 The other 50% are fragile, messy code which needs a massive restructuring
8373 The other 50% are fragile, messy code which needs a massive restructuring
8374 before any further major work is done.
8374 before any further major work is done.
8375 Even the messy code is fairly well documented though, and most of the problems
8375 Even the messy code is fairly well documented though, and most of the problems
8376 in the (non-existent) class design are well pointed to by a PyChecker run.
8376 in the (non-existent) class design are well pointed to by a PyChecker run.
8377 So the rewriting work isn't that bad, it will just be time-consuming.
8377 So the rewriting work isn't that bad, it will just be time-consuming.
8378 \layout Subsection
8378 \layout Subsection
8379
8379
8380 Future
8380 Future
8381 \layout Standard
8381 \layout Standard
8382
8382
8383 See the separate
8383 See the separate
8384 \family typewriter
8384 \family typewriter
8385 new_design
8385 new_design
8386 \family default
8386 \family default
8387 document for details.
8387 document for details.
8388 Ultimately, I would like to see IPython become part of the standard Python
8388 Ultimately, I would like to see IPython become part of the standard Python
8389 distribution as a `big brother with batteries' to the standard Python interacti
8389 distribution as a `big brother with batteries' to the standard Python interacti
8390 ve interpreter.
8390 ve interpreter.
8391 But that will never happen with the current state of the code, so all contribut
8391 But that will never happen with the current state of the code, so all contribut
8392 ions are welcome.
8392 ions are welcome.
8393 \layout Section
8393 \layout Section
8394
8394
8395 License
8395 License
8396 \layout Standard
8396 \layout Standard
8397
8397
8398 IPython is released under the terms of the BSD license, whose general form
8398 IPython is released under the terms of the BSD license, whose general form
8399 can be found at:
8399 can be found at:
8400 \begin_inset LatexCommand \htmlurl{http://www.opensource.org/licenses/bsd-license.php}
8400 \begin_inset LatexCommand \htmlurl{http://www.opensource.org/licenses/bsd-license.php}
8401
8401
8402 \end_inset
8402 \end_inset
8403
8403
8404 .
8404 .
8405 The full text of the IPython license is reproduced below:
8405 The full text of the IPython license is reproduced below:
8406 \layout Quote
8406 \layout Quote
8407
8407
8408
8408
8409 \family typewriter
8409 \family typewriter
8410 \size small
8410 \size small
8411 IPython is released under a BSD-type license.
8411 IPython is released under a BSD-type license.
8412 \layout Quote
8412 \layout Quote
8413
8413
8414
8414
8415 \family typewriter
8415 \family typewriter
8416 \size small
8416 \size small
8417 Copyright (c) 2001, 2002, 2003, 2004 Fernando Perez <fperez@colorado.edu>.
8417 Copyright (c) 2001, 2002, 2003, 2004 Fernando Perez <fperez@colorado.edu>.
8418 \layout Quote
8418 \layout Quote
8419
8419
8420
8420
8421 \family typewriter
8421 \family typewriter
8422 \size small
8422 \size small
8423 Copyright (c) 2001 Janko Hauser <jhauser@zscout.de> and
8423 Copyright (c) 2001 Janko Hauser <jhauser@zscout.de> and
8424 \newline
8424 \newline
8425 Nathaniel Gray <n8gray@caltech.edu>.
8425 Nathaniel Gray <n8gray@caltech.edu>.
8426 \layout Quote
8426 \layout Quote
8427
8427
8428
8428
8429 \family typewriter
8429 \family typewriter
8430 \size small
8430 \size small
8431 All rights reserved.
8431 All rights reserved.
8432 \layout Quote
8432 \layout Quote
8433
8433
8434
8434
8435 \family typewriter
8435 \family typewriter
8436 \size small
8436 \size small
8437 Redistribution and use in source and binary forms, with or without modification,
8437 Redistribution and use in source and binary forms, with or without modification,
8438 are permitted provided that the following conditions are met:
8438 are permitted provided that the following conditions are met:
8439 \layout Quote
8439 \layout Quote
8440
8440
8441
8441
8442 \family typewriter
8442 \family typewriter
8443 \size small
8443 \size small
8444 a.
8444 a.
8445 Redistributions of source code must retain the above copyright notice,
8445 Redistributions of source code must retain the above copyright notice,
8446 this list of conditions and the following disclaimer.
8446 this list of conditions and the following disclaimer.
8447 \layout Quote
8447 \layout Quote
8448
8448
8449
8449
8450 \family typewriter
8450 \family typewriter
8451 \size small
8451 \size small
8452 b.
8452 b.
8453 Redistributions in binary form must reproduce the above copyright notice,
8453 Redistributions in binary form must reproduce the above copyright notice,
8454 this list of conditions and the following disclaimer in the documentation
8454 this list of conditions and the following disclaimer in the documentation
8455 and/or other materials provided with the distribution.
8455 and/or other materials provided with the distribution.
8456 \layout Quote
8456 \layout Quote
8457
8457
8458
8458
8459 \family typewriter
8459 \family typewriter
8460 \size small
8460 \size small
8461 c.
8461 c.
8462 Neither the name of the copyright holders nor the names of any contributors
8462 Neither the name of the copyright holders nor the names of any contributors
8463 to this software may be used to endorse or promote products derived from
8463 to this software may be used to endorse or promote products derived from
8464 this software without specific prior written permission.
8464 this software without specific prior written permission.
8465 \layout Quote
8465 \layout Quote
8466
8466
8467
8467
8468 \family typewriter
8468 \family typewriter
8469 \size small
8469 \size small
8470 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
8470 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
8471 IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
8471 IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
8472 THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
8472 THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
8473 PURPOSE ARE DISCLAIMED.
8473 PURPOSE ARE DISCLAIMED.
8474 IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
8474 IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
8475 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
8475 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
8476 BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
8476 BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
8477 USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
8477 USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
8478 ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
8478 ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
8479 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
8479 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
8480 THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
8480 THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
8481
8481
8482 \layout Standard
8482 \layout Standard
8483
8483
8484 Individual authors are the holders of the copyright for their code and are
8484 Individual authors are the holders of the copyright for their code and are
8485 listed in each file.
8485 listed in each file.
8486 \layout Standard
8486 \layout Standard
8487
8487
8488 Some files (
8488 Some files (
8489 \family typewriter
8489 \family typewriter
8490 DPyGetOpt.py
8490 DPyGetOpt.py
8491 \family default
8491 \family default
8492 , for example) may be licensed under different conditions.
8492 , for example) may be licensed under different conditions.
8493 Ultimately each file indicates clearly the conditions under which its author/au
8493 Ultimately each file indicates clearly the conditions under which its author/au
8494 thors have decided to publish the code.
8494 thors have decided to publish the code.
8495 \layout Standard
8495 \layout Standard
8496
8496
8497 Versions of IPython up to and including 0.6.3 were released under the GNU
8497 Versions of IPython up to and including 0.6.3 were released under the GNU
8498 Lesser General Public License (LGPL), available at
8498 Lesser General Public License (LGPL), available at
8499 \begin_inset LatexCommand \htmlurl{http://www.gnu.org/copyleft/lesser.html}
8499 \begin_inset LatexCommand \htmlurl{http://www.gnu.org/copyleft/lesser.html}
8500
8500
8501 \end_inset
8501 \end_inset
8502
8502
8503 .
8503 .
8504 \layout Section
8504 \layout Section
8505
8505
8506
8506
8507 \begin_inset LatexCommand \label{sec:credits}
8507 \begin_inset LatexCommand \label{sec:credits}
8508
8508
8509 \end_inset
8509 \end_inset
8510
8510
8511 Credits
8511 Credits
8512 \layout Standard
8512 \layout Standard
8513
8513
8514 IPython is mainly developed by Fernando Pérez
8514 IPython is mainly developed by Fernando Pérez
8515 \family typewriter
8515 \family typewriter
8516 <fperez@colorado.edu>
8516 <fperez@colorado.edu>
8517 \family default
8517 \family default
8518 , but the project was born from mixing in Fernando's code with the IPP project
8518 , but the project was born from mixing in Fernando's code with the IPP project
8519 by Janko Hauser
8519 by Janko Hauser
8520 \family typewriter
8520 \family typewriter
8521 <jhauser-AT-zscout.de>
8521 <jhauser-AT-zscout.de>
8522 \family default
8522 \family default
8523 and LazyPython by Nathan Gray
8523 and LazyPython by Nathan Gray
8524 \family typewriter
8524 \family typewriter
8525 <n8gray-AT-caltech.edu>
8525 <n8gray-AT-caltech.edu>
8526 \family default
8526 \family default
8527 .
8527 .
8528 For all IPython-related requests, please contact Fernando.
8528 For all IPython-related requests, please contact Fernando.
8529
8529
8530 \layout Standard
8530 \layout Standard
8531
8531
8532 As of late 2005, the following developers have joined the core team:
8532 As of late 2005, the following developers have joined the core team:
8533 \layout List
8533 \layout List
8534 \labelwidthstring 00.00.0000
8534 \labelwidthstring 00.00.0000
8535
8535
8536 Robert\SpecialChar ~
8536 Robert\SpecialChar ~
8537 Kern
8537 Kern
8538 \family typewriter
8538 \family typewriter
8539 <rkern-AT-enthought.com>
8539 <rkern-AT-enthought.com>
8540 \family default
8540 \family default
8541 : co-mentored the 2005 Google Summer of Code project to develop python interacti
8541 : co-mentored the 2005 Google Summer of Code project to develop python interacti
8542 ve notebooks (XML documents) and graphical interface.
8542 ve notebooks (XML documents) and graphical interface.
8543 This project was awarded to the students Tzanko Matev
8543 This project was awarded to the students Tzanko Matev
8544 \family typewriter
8544 \family typewriter
8545 <tsanko-AT-gmail.com>
8545 <tsanko-AT-gmail.com>
8546 \family default
8546 \family default
8547 and Toni Alatalo
8547 and Toni Alatalo
8548 \family typewriter
8548 \family typewriter
8549 <antont-AT-an.org>
8549 <antont-AT-an.org>
8550 \layout List
8550 \layout List
8551 \labelwidthstring 00.00.0000
8551 \labelwidthstring 00.00.0000
8552
8552
8553 Brian\SpecialChar ~
8553 Brian\SpecialChar ~
8554 Granger
8554 Granger
8555 \family typewriter
8555 \family typewriter
8556 <bgranger-AT-scu.edu>
8556 <bgranger-AT-scu.edu>
8557 \family default
8557 \family default
8558 : extending IPython to allow support for interactive parallel computing.
8558 : extending IPython to allow support for interactive parallel computing.
8559 \layout Standard
8559 \layout Standard
8560
8560
8561 User or development help should be requested via the IPython mailing lists:
8561 User or development help should be requested via the IPython mailing lists:
8562 \layout Description
8562 \layout Description
8563
8563
8564 User\SpecialChar ~
8564 User\SpecialChar ~
8565 list:
8565 list:
8566 \begin_inset LatexCommand \htmlurl{http://scipy.net/mailman/listinfo/ipython-user}
8566 \begin_inset LatexCommand \htmlurl{http://scipy.net/mailman/listinfo/ipython-user}
8567
8567
8568 \end_inset
8568 \end_inset
8569
8569
8570
8570
8571 \layout Description
8571 \layout Description
8572
8572
8573 Developer's\SpecialChar ~
8573 Developer's\SpecialChar ~
8574 list:
8574 list:
8575 \begin_inset LatexCommand \htmlurl{http://scipy.net/mailman/listinfo/ipython-dev}
8575 \begin_inset LatexCommand \htmlurl{http://scipy.net/mailman/listinfo/ipython-dev}
8576
8576
8577 \end_inset
8577 \end_inset
8578
8578
8579
8579
8580 \layout Standard
8580 \layout Standard
8581
8581
8582 The IPython project is also very grateful to
8582 The IPython project is also very grateful to
8583 \begin_inset Foot
8583 \begin_inset Foot
8584 collapsed true
8584 collapsed true
8585
8585
8586 \layout Standard
8586 \layout Standard
8587
8587
8588 I've mangled email addresses to reduce spam, since the IPython manuals can
8588 I've mangled email addresses to reduce spam, since the IPython manuals can
8589 be accessed online.
8589 be accessed online.
8590 \end_inset
8590 \end_inset
8591
8591
8592 :
8592 :
8593 \layout Standard
8593 \layout Standard
8594
8594
8595 Bill Bumgarner
8595 Bill Bumgarner
8596 \family typewriter
8596 \family typewriter
8597 <bbum-AT-friday.com>
8597 <bbum-AT-friday.com>
8598 \family default
8598 \family default
8599 : for providing the DPyGetOpt module which gives very powerful and convenient
8599 : for providing the DPyGetOpt module which gives very powerful and convenient
8600 handling of command-line options (light years ahead of what Python 2.1.1's
8600 handling of command-line options (light years ahead of what Python 2.1.1's
8601 getopt module does).
8601 getopt module does).
8602 \layout Standard
8602 \layout Standard
8603
8603
8604 Ka-Ping Yee
8604 Ka-Ping Yee
8605 \family typewriter
8605 \family typewriter
8606 <ping-AT-lfw.org>
8606 <ping-AT-lfw.org>
8607 \family default
8607 \family default
8608 : for providing the Itpl module for convenient and powerful string interpolation
8608 : for providing the Itpl module for convenient and powerful string interpolation
8609 with a much nicer syntax than formatting through the '%' operator.
8609 with a much nicer syntax than formatting through the '%' operator.
8610 \layout Standard
8610 \layout Standard
8611
8611
8612 Arnd Bäcker
8612 Arnd Bäcker
8613 \family typewriter
8613 \family typewriter
8614 <baecker-AT-physik.tu-dresden.de>
8614 <baecker-AT-physik.tu-dresden.de>
8615 \family default
8615 \family default
8616 : for his many very useful suggestions and comments, and lots of help with
8616 : for his many very useful suggestions and comments, and lots of help with
8617 testing and documentation checking.
8617 testing and documentation checking.
8618 Many of IPython's newer features are a result of discussions with him (bugs
8618 Many of IPython's newer features are a result of discussions with him (bugs
8619 are still my fault, not his).
8619 are still my fault, not his).
8620 \layout Standard
8620 \layout Standard
8621
8621
8622 Obviously Guido van\SpecialChar ~
8622 Obviously Guido van\SpecialChar ~
8623 Rossum and the whole Python development team, that goes
8623 Rossum and the whole Python development team, that goes
8624 without saying.
8624 without saying.
8625 \layout Standard
8625 \layout Standard
8626
8626
8627 IPython's website is generously hosted at
8627 IPython's website is generously hosted at
8628 \begin_inset LatexCommand \htmlurl{http://ipython.scipy.org}
8628 \begin_inset LatexCommand \htmlurl{http://ipython.scipy.org}
8629
8629
8630 \end_inset
8630 \end_inset
8631
8631
8632 by Enthought (
8632 by Enthought (
8633 \begin_inset LatexCommand \htmlurl{http://www.enthought.com}
8633 \begin_inset LatexCommand \htmlurl{http://www.enthought.com}
8634
8634
8635 \end_inset
8635 \end_inset
8636
8636
8637 ).
8637 ).
8638 I am very grateful to them and all of the SciPy team for their contribution.
8638 I am very grateful to them and all of the SciPy team for their contribution.
8639 \layout Standard
8639 \layout Standard
8640
8640
8641
8641
8642 \begin_inset LatexCommand \label{figgins}
8642 \begin_inset LatexCommand \label{figgins}
8643
8643
8644 \end_inset
8644 \end_inset
8645
8645
8646 Fernando would also like to thank Stephen Figgins
8646 Fernando would also like to thank Stephen Figgins
8647 \family typewriter
8647 \family typewriter
8648 <fig-AT-monitor.net>
8648 <fig-AT-monitor.net>
8649 \family default
8649 \family default
8650 , an O'Reilly Python editor.
8650 , an O'Reilly Python editor.
8651 His Oct/11/2001 article about IPP and LazyPython, was what got this project
8651 His Oct/11/2001 article about IPP and LazyPython, was what got this project
8652 started.
8652 started.
8653 You can read it at:
8653 You can read it at:
8654 \begin_inset LatexCommand \htmlurl{http://www.onlamp.com/pub/a/python/2001/10/11/pythonnews.html}
8654 \begin_inset LatexCommand \htmlurl{http://www.onlamp.com/pub/a/python/2001/10/11/pythonnews.html}
8655
8655
8656 \end_inset
8656 \end_inset
8657
8657
8658 .
8658 .
8659 \layout Standard
8659 \layout Standard
8660
8660
8661 And last but not least, all the kind IPython users who have emailed new
8661 And last but not least, all the kind IPython users who have emailed new
8662 code, bug reports, fixes, comments and ideas.
8662 code, bug reports, fixes, comments and ideas.
8663 A brief list follows, please let me know if I have ommitted your name by
8663 A brief list follows, please let me know if I have ommitted your name by
8664 accident:
8664 accident:
8665 \layout List
8665 \layout List
8666 \labelwidthstring 00.00.0000
8666 \labelwidthstring 00.00.0000
8667
8667
8668 Jack\SpecialChar ~
8668 Jack\SpecialChar ~
8669 Moffit
8669 Moffit
8670 \family typewriter
8670 \family typewriter
8671 <jack-AT-xiph.org>
8671 <jack-AT-xiph.org>
8672 \family default
8672 \family default
8673 Bug fixes, including the infamous color problem.
8673 Bug fixes, including the infamous color problem.
8674 This bug alone caused many lost hours and frustration, many thanks to him
8674 This bug alone caused many lost hours and frustration, many thanks to him
8675 for the fix.
8675 for the fix.
8676 I've always been a fan of Ogg & friends, now I have one more reason to
8676 I've always been a fan of Ogg & friends, now I have one more reason to
8677 like these folks.
8677 like these folks.
8678 \newline
8678 \newline
8679 Jack is also contributing with Debian packaging and many other things.
8679 Jack is also contributing with Debian packaging and many other things.
8680 \layout List
8680 \layout List
8681 \labelwidthstring 00.00.0000
8681 \labelwidthstring 00.00.0000
8682
8682
8683 Alexander\SpecialChar ~
8683 Alexander\SpecialChar ~
8684 Schmolck
8684 Schmolck
8685 \family typewriter
8685 \family typewriter
8686 <a.schmolck-AT-gmx.net>
8686 <a.schmolck-AT-gmx.net>
8687 \family default
8687 \family default
8688 Emacs work, bug reports, bug fixes, ideas, lots more.
8688 Emacs work, bug reports, bug fixes, ideas, lots more.
8689 The ipython.el mode for (X)Emacs is Alex's code, providing full support
8689 The ipython.el mode for (X)Emacs is Alex's code, providing full support
8690 for IPython under (X)Emacs.
8690 for IPython under (X)Emacs.
8691 \layout List
8691 \layout List
8692 \labelwidthstring 00.00.0000
8692 \labelwidthstring 00.00.0000
8693
8693
8694 Andrea\SpecialChar ~
8694 Andrea\SpecialChar ~
8695 Riciputi
8695 Riciputi
8696 \family typewriter
8696 \family typewriter
8697 <andrea.riciputi-AT-libero.it>
8697 <andrea.riciputi-AT-libero.it>
8698 \family default
8698 \family default
8699 Mac OSX information, Fink package management.
8699 Mac OSX information, Fink package management.
8700 \layout List
8700 \layout List
8701 \labelwidthstring 00.00.0000
8701 \labelwidthstring 00.00.0000
8702
8702
8703 Gary\SpecialChar ~
8703 Gary\SpecialChar ~
8704 Bishop
8704 Bishop
8705 \family typewriter
8705 \family typewriter
8706 <gb-AT-cs.unc.edu>
8706 <gb-AT-cs.unc.edu>
8707 \family default
8707 \family default
8708 Bug reports, and patches to work around the exception handling idiosyncracies
8708 Bug reports, and patches to work around the exception handling idiosyncracies
8709 of WxPython.
8709 of WxPython.
8710 Readline and color support for Windows.
8710 Readline and color support for Windows.
8711 \layout List
8711 \layout List
8712 \labelwidthstring 00.00.0000
8712 \labelwidthstring 00.00.0000
8713
8713
8714 Jeffrey\SpecialChar ~
8714 Jeffrey\SpecialChar ~
8715 Collins
8715 Collins
8716 \family typewriter
8716 \family typewriter
8717 <Jeff.Collins-AT-vexcel.com>
8717 <Jeff.Collins-AT-vexcel.com>
8718 \family default
8718 \family default
8719 Bug reports.
8719 Bug reports.
8720 Much improved readline support, including fixes for Python 2.3.
8720 Much improved readline support, including fixes for Python 2.3.
8721 \layout List
8721 \layout List
8722 \labelwidthstring 00.00.0000
8722 \labelwidthstring 00.00.0000
8723
8723
8724 Dryice\SpecialChar ~
8724 Dryice\SpecialChar ~
8725 Liu
8725 Liu
8726 \family typewriter
8726 \family typewriter
8727 <dryice-AT-liu.com.cn>
8727 <dryice-AT-liu.com.cn>
8728 \family default
8728 \family default
8729 FreeBSD port.
8729 FreeBSD port.
8730 \layout List
8730 \layout List
8731 \labelwidthstring 00.00.0000
8731 \labelwidthstring 00.00.0000
8732
8732
8733 Mike\SpecialChar ~
8733 Mike\SpecialChar ~
8734 Heeter
8734 Heeter
8735 \family typewriter
8735 \family typewriter
8736 <korora-AT-SDF.LONESTAR.ORG>
8736 <korora-AT-SDF.LONESTAR.ORG>
8737 \layout List
8737 \layout List
8738 \labelwidthstring 00.00.0000
8738 \labelwidthstring 00.00.0000
8739
8739
8740 Christopher\SpecialChar ~
8740 Christopher\SpecialChar ~
8741 Hart
8741 Hart
8742 \family typewriter
8742 \family typewriter
8743 <hart-AT-caltech.edu>
8743 <hart-AT-caltech.edu>
8744 \family default
8744 \family default
8745 PDB integration.
8745 PDB integration.
8746 \layout List
8746 \layout List
8747 \labelwidthstring 00.00.0000
8747 \labelwidthstring 00.00.0000
8748
8748
8749 Milan\SpecialChar ~
8749 Milan\SpecialChar ~
8750 Zamazal
8750 Zamazal
8751 \family typewriter
8751 \family typewriter
8752 <pdm-AT-zamazal.org>
8752 <pdm-AT-zamazal.org>
8753 \family default
8753 \family default
8754 Emacs info.
8754 Emacs info.
8755 \layout List
8755 \layout List
8756 \labelwidthstring 00.00.0000
8756 \labelwidthstring 00.00.0000
8757
8757
8758 Philip\SpecialChar ~
8758 Philip\SpecialChar ~
8759 Hisley
8759 Hisley
8760 \family typewriter
8760 \family typewriter
8761 <compsys-AT-starpower.net>
8761 <compsys-AT-starpower.net>
8762 \layout List
8762 \layout List
8763 \labelwidthstring 00.00.0000
8763 \labelwidthstring 00.00.0000
8764
8764
8765 Holger\SpecialChar ~
8765 Holger\SpecialChar ~
8766 Krekel
8766 Krekel
8767 \family typewriter
8767 \family typewriter
8768 <pyth-AT-devel.trillke.net>
8768 <pyth-AT-devel.trillke.net>
8769 \family default
8769 \family default
8770 Tab completion, lots more.
8770 Tab completion, lots more.
8771 \layout List
8771 \layout List
8772 \labelwidthstring 00.00.0000
8772 \labelwidthstring 00.00.0000
8773
8773
8774 Robin\SpecialChar ~
8774 Robin\SpecialChar ~
8775 Siebler
8775 Siebler
8776 \family typewriter
8776 \family typewriter
8777 <robinsiebler-AT-starband.net>
8777 <robinsiebler-AT-starband.net>
8778 \layout List
8778 \layout List
8779 \labelwidthstring 00.00.0000
8779 \labelwidthstring 00.00.0000
8780
8780
8781 Ralf\SpecialChar ~
8781 Ralf\SpecialChar ~
8782 Ahlbrink
8782 Ahlbrink
8783 \family typewriter
8783 \family typewriter
8784 <ralf_ahlbrink-AT-web.de>
8784 <ralf_ahlbrink-AT-web.de>
8785 \layout List
8785 \layout List
8786 \labelwidthstring 00.00.0000
8786 \labelwidthstring 00.00.0000
8787
8787
8788 Thorsten\SpecialChar ~
8788 Thorsten\SpecialChar ~
8789 Kampe
8789 Kampe
8790 \family typewriter
8790 \family typewriter
8791 <thorsten-AT-thorstenkampe.de>
8791 <thorsten-AT-thorstenkampe.de>
8792 \layout List
8792 \layout List
8793 \labelwidthstring 00.00.0000
8793 \labelwidthstring 00.00.0000
8794
8794
8795 Fredrik\SpecialChar ~
8795 Fredrik\SpecialChar ~
8796 Kant
8796 Kant
8797 \family typewriter
8797 \family typewriter
8798 <fredrik.kant-AT-front.com>
8798 <fredrik.kant-AT-front.com>
8799 \family default
8799 \family default
8800 Windows setup.
8800 Windows setup.
8801 \layout List
8801 \layout List
8802 \labelwidthstring 00.00.0000
8802 \labelwidthstring 00.00.0000
8803
8803
8804 Syver\SpecialChar ~
8804 Syver\SpecialChar ~
8805 Enstad
8805 Enstad
8806 \family typewriter
8806 \family typewriter
8807 <syver-en-AT-online.no>
8807 <syver-en-AT-online.no>
8808 \family default
8808 \family default
8809 Windows setup.
8809 Windows setup.
8810 \layout List
8810 \layout List
8811 \labelwidthstring 00.00.0000
8811 \labelwidthstring 00.00.0000
8812
8812
8813 Richard
8813 Richard
8814 \family typewriter
8814 \family typewriter
8815 <rxe-AT-renre-europe.com>
8815 <rxe-AT-renre-europe.com>
8816 \family default
8816 \family default
8817 Global embedding.
8817 Global embedding.
8818 \layout List
8818 \layout List
8819 \labelwidthstring 00.00.0000
8819 \labelwidthstring 00.00.0000
8820
8820
8821 Hayden\SpecialChar ~
8821 Hayden\SpecialChar ~
8822 Callow
8822 Callow
8823 \family typewriter
8823 \family typewriter
8824 <h.callow-AT-elec.canterbury.ac.nz>
8824 <h.callow-AT-elec.canterbury.ac.nz>
8825 \family default
8825 \family default
8826 Gnuplot.py 1.6 compatibility.
8826 Gnuplot.py 1.6 compatibility.
8827 \layout List
8827 \layout List
8828 \labelwidthstring 00.00.0000
8828 \labelwidthstring 00.00.0000
8829
8829
8830 Leonardo\SpecialChar ~
8830 Leonardo\SpecialChar ~
8831 Santagada
8831 Santagada
8832 \family typewriter
8832 \family typewriter
8833 <retype-AT-terra.com.br>
8833 <retype-AT-terra.com.br>
8834 \family default
8834 \family default
8835 Fixes for Windows installation.
8835 Fixes for Windows installation.
8836 \layout List
8836 \layout List
8837 \labelwidthstring 00.00.0000
8837 \labelwidthstring 00.00.0000
8838
8838
8839 Christopher\SpecialChar ~
8839 Christopher\SpecialChar ~
8840 Armstrong
8840 Armstrong
8841 \family typewriter
8841 \family typewriter
8842 <radix-AT-twistedmatrix.com>
8842 <radix-AT-twistedmatrix.com>
8843 \family default
8843 \family default
8844 Bugfixes.
8844 Bugfixes.
8845 \layout List
8845 \layout List
8846 \labelwidthstring 00.00.0000
8846 \labelwidthstring 00.00.0000
8847
8847
8848 Francois\SpecialChar ~
8848 Francois\SpecialChar ~
8849 Pinard
8849 Pinard
8850 \family typewriter
8850 \family typewriter
8851 <pinard-AT-iro.umontreal.ca>
8851 <pinard-AT-iro.umontreal.ca>
8852 \family default
8852 \family default
8853 Code and documentation fixes.
8853 Code and documentation fixes.
8854 \layout List
8854 \layout List
8855 \labelwidthstring 00.00.0000
8855 \labelwidthstring 00.00.0000
8856
8856
8857 Cory\SpecialChar ~
8857 Cory\SpecialChar ~
8858 Dodt
8858 Dodt
8859 \family typewriter
8859 \family typewriter
8860 <cdodt-AT-fcoe.k12.ca.us>
8860 <cdodt-AT-fcoe.k12.ca.us>
8861 \family default
8861 \family default
8862 Bug reports and Windows ideas.
8862 Bug reports and Windows ideas.
8863 Patches for Windows installer.
8863 Patches for Windows installer.
8864 \layout List
8864 \layout List
8865 \labelwidthstring 00.00.0000
8865 \labelwidthstring 00.00.0000
8866
8866
8867 Olivier\SpecialChar ~
8867 Olivier\SpecialChar ~
8868 Aubert
8868 Aubert
8869 \family typewriter
8869 \family typewriter
8870 <oaubert-AT-bat710.univ-lyon1.fr>
8870 <oaubert-AT-bat710.univ-lyon1.fr>
8871 \family default
8871 \family default
8872 New magics.
8872 New magics.
8873 \layout List
8873 \layout List
8874 \labelwidthstring 00.00.0000
8874 \labelwidthstring 00.00.0000
8875
8875
8876 King\SpecialChar ~
8876 King\SpecialChar ~
8877 C.\SpecialChar ~
8877 C.\SpecialChar ~
8878 Shu
8878 Shu
8879 \family typewriter
8879 \family typewriter
8880 <kingshu-AT-myrealbox.com>
8880 <kingshu-AT-myrealbox.com>
8881 \family default
8881 \family default
8882 Autoindent patch.
8882 Autoindent patch.
8883 \layout List
8883 \layout List
8884 \labelwidthstring 00.00.0000
8884 \labelwidthstring 00.00.0000
8885
8885
8886 Chris\SpecialChar ~
8886 Chris\SpecialChar ~
8887 Drexler
8887 Drexler
8888 \family typewriter
8888 \family typewriter
8889 <chris-AT-ac-drexler.de>
8889 <chris-AT-ac-drexler.de>
8890 \family default
8890 \family default
8891 Readline packages for Win32/CygWin.
8891 Readline packages for Win32/CygWin.
8892 \layout List
8892 \layout List
8893 \labelwidthstring 00.00.0000
8893 \labelwidthstring 00.00.0000
8894
8894
8895 Gustavo\SpecialChar ~
8895 Gustavo\SpecialChar ~
8896 Córdova\SpecialChar ~
8896 Córdova\SpecialChar ~
8897 Avila
8897 Avila
8898 \family typewriter
8898 \family typewriter
8899 <gcordova-AT-sismex.com>
8899 <gcordova-AT-sismex.com>
8900 \family default
8900 \family default
8901 EvalDict code for nice, lightweight string interpolation.
8901 EvalDict code for nice, lightweight string interpolation.
8902 \layout List
8902 \layout List
8903 \labelwidthstring 00.00.0000
8903 \labelwidthstring 00.00.0000
8904
8904
8905 Kasper\SpecialChar ~
8905 Kasper\SpecialChar ~
8906 Souren
8906 Souren
8907 \family typewriter
8907 \family typewriter
8908 <Kasper.Souren-AT-ircam.fr>
8908 <Kasper.Souren-AT-ircam.fr>
8909 \family default
8909 \family default
8910 Bug reports, ideas.
8910 Bug reports, ideas.
8911 \layout List
8911 \layout List
8912 \labelwidthstring 00.00.0000
8912 \labelwidthstring 00.00.0000
8913
8913
8914 Gever\SpecialChar ~
8914 Gever\SpecialChar ~
8915 Tulley
8915 Tulley
8916 \family typewriter
8916 \family typewriter
8917 <gever-AT-helium.com>
8917 <gever-AT-helium.com>
8918 \family default
8918 \family default
8919 Code contributions.
8919 Code contributions.
8920 \layout List
8920 \layout List
8921 \labelwidthstring 00.00.0000
8921 \labelwidthstring 00.00.0000
8922
8922
8923 Ralf\SpecialChar ~
8923 Ralf\SpecialChar ~
8924 Schmitt
8924 Schmitt
8925 \family typewriter
8925 \family typewriter
8926 <ralf-AT-brainbot.com>
8926 <ralf-AT-brainbot.com>
8927 \family default
8927 \family default
8928 Bug reports & fixes.
8928 Bug reports & fixes.
8929 \layout List
8929 \layout List
8930 \labelwidthstring 00.00.0000
8930 \labelwidthstring 00.00.0000
8931
8931
8932 Oliver\SpecialChar ~
8932 Oliver\SpecialChar ~
8933 Sander
8933 Sander
8934 \family typewriter
8934 \family typewriter
8935 <osander-AT-gmx.de>
8935 <osander-AT-gmx.de>
8936 \family default
8936 \family default
8937 Bug reports.
8937 Bug reports.
8938 \layout List
8938 \layout List
8939 \labelwidthstring 00.00.0000
8939 \labelwidthstring 00.00.0000
8940
8940
8941 Rod\SpecialChar ~
8941 Rod\SpecialChar ~
8942 Holland
8942 Holland
8943 \family typewriter
8943 \family typewriter
8944 <rhh-AT-structurelabs.com>
8944 <rhh-AT-structurelabs.com>
8945 \family default
8945 \family default
8946 Bug reports and fixes to logging module.
8946 Bug reports and fixes to logging module.
8947 \layout List
8947 \layout List
8948 \labelwidthstring 00.00.0000
8948 \labelwidthstring 00.00.0000
8949
8949
8950 Daniel\SpecialChar ~
8950 Daniel\SpecialChar ~
8951 'Dang'\SpecialChar ~
8951 'Dang'\SpecialChar ~
8952 Griffith
8952 Griffith
8953 \family typewriter
8953 \family typewriter
8954 <pythondev-dang-AT-lazytwinacres.net>
8954 <pythondev-dang-AT-lazytwinacres.net>
8955 \family default
8955 \family default
8956 Fixes, enhancement suggestions for system shell use.
8956 Fixes, enhancement suggestions for system shell use.
8957 \layout List
8957 \layout List
8958 \labelwidthstring 00.00.0000
8958 \labelwidthstring 00.00.0000
8959
8959
8960 Viktor\SpecialChar ~
8960 Viktor\SpecialChar ~
8961 Ransmayr
8961 Ransmayr
8962 \family typewriter
8962 \family typewriter
8963 <viktor.ransmayr-AT-t-online.de>
8963 <viktor.ransmayr-AT-t-online.de>
8964 \family default
8964 \family default
8965 Tests and reports on Windows installation issues.
8965 Tests and reports on Windows installation issues.
8966 Contributed a true Windows binary installer.
8966 Contributed a true Windows binary installer.
8967 \layout List
8967 \layout List
8968 \labelwidthstring 00.00.0000
8968 \labelwidthstring 00.00.0000
8969
8969
8970 Mike\SpecialChar ~
8970 Mike\SpecialChar ~
8971 Salib
8971 Salib
8972 \family typewriter
8972 \family typewriter
8973 <msalib-AT-mit.edu>
8973 <msalib-AT-mit.edu>
8974 \family default
8974 \family default
8975 Help fixing a subtle bug related to traceback printing.
8975 Help fixing a subtle bug related to traceback printing.
8976 \layout List
8976 \layout List
8977 \labelwidthstring 00.00.0000
8977 \labelwidthstring 00.00.0000
8978
8978
8979 W.J.\SpecialChar ~
8979 W.J.\SpecialChar ~
8980 van\SpecialChar ~
8980 van\SpecialChar ~
8981 der\SpecialChar ~
8981 der\SpecialChar ~
8982 Laan
8982 Laan
8983 \family typewriter
8983 \family typewriter
8984 <gnufnork-AT-hetdigitalegat.nl>
8984 <gnufnork-AT-hetdigitalegat.nl>
8985 \family default
8985 \family default
8986 Bash-like prompt specials.
8986 Bash-like prompt specials.
8987 \layout List
8987 \layout List
8988 \labelwidthstring 00.00.0000
8988 \labelwidthstring 00.00.0000
8989
8989
8990 Ville\SpecialChar ~
8990 Ville\SpecialChar ~
8991 Vainio
8991 Vainio
8992 \family typewriter
8992 \family typewriter
8993 <vivainio-AT-kolumbus.fi>
8993 <vivainio-AT-kolumbus.fi>
8994 \family default
8994 \family default
8995 Bugfixes and suggestions.
8995 Bugfixes and suggestions.
8996 Excellent patches for many new features.
8996 Excellent patches for many new features.
8997 \layout List
8997 \layout List
8998 \labelwidthstring 00.00.0000
8998 \labelwidthstring 00.00.0000
8999
8999
9000 Antoon\SpecialChar ~
9000 Antoon\SpecialChar ~
9001 Pardon
9001 Pardon
9002 \family typewriter
9002 \family typewriter
9003 <Antoon.Pardon-AT-rece.vub.ac.be>
9003 <Antoon.Pardon-AT-rece.vub.ac.be>
9004 \family default
9004 \family default
9005 Critical fix for the multithreaded IPython.
9005 Critical fix for the multithreaded IPython.
9006 \layout List
9006 \layout List
9007 \labelwidthstring 00.00.0000
9007 \labelwidthstring 00.00.0000
9008
9008
9009 John\SpecialChar ~
9009 John\SpecialChar ~
9010 Hunter
9010 Hunter
9011 \family typewriter
9011 \family typewriter
9012 <jdhunter-AT-nitace.bsd.uchicago.edu>
9012 <jdhunter-AT-nitace.bsd.uchicago.edu>
9013 \family default
9013 \family default
9014 Matplotlib author, helped with all the development of support for matplotlib
9014 Matplotlib author, helped with all the development of support for matplotlib
9015 in IPyhton, including making necessary changes to matplotlib itself.
9015 in IPyhton, including making necessary changes to matplotlib itself.
9016 \layout List
9016 \layout List
9017 \labelwidthstring 00.00.0000
9017 \labelwidthstring 00.00.0000
9018
9018
9019 Matthew\SpecialChar ~
9019 Matthew\SpecialChar ~
9020 Arnison
9020 Arnison
9021 \family typewriter
9021 \family typewriter
9022 <maffew-AT-cat.org.au>
9022 <maffew-AT-cat.org.au>
9023 \family default
9023 \family default
9024 Bug reports, `
9024 Bug reports, `
9025 \family typewriter
9025 \family typewriter
9026 %run -d
9026 %run -d
9027 \family default
9027 \family default
9028 ' idea.
9028 ' idea.
9029 \layout List
9029 \layout List
9030 \labelwidthstring 00.00.0000
9030 \labelwidthstring 00.00.0000
9031
9031
9032 Prabhu\SpecialChar ~
9032 Prabhu\SpecialChar ~
9033 Ramachandran
9033 Ramachandran
9034 \family typewriter
9034 \family typewriter
9035 <prabhu_r-AT-users.sourceforge.net>
9035 <prabhu_r-AT-users.sourceforge.net>
9036 \family default
9036 \family default
9037 Help with (X)Emacs support, threading patches, ideas...
9037 Help with (X)Emacs support, threading patches, ideas...
9038 \layout List
9038 \layout List
9039 \labelwidthstring 00.00.0000
9039 \labelwidthstring 00.00.0000
9040
9040
9041 Norbert\SpecialChar ~
9041 Norbert\SpecialChar ~
9042 Tretkowski
9042 Tretkowski
9043 \family typewriter
9043 \family typewriter
9044 <tretkowski-AT-inittab.de>
9044 <tretkowski-AT-inittab.de>
9045 \family default
9045 \family default
9046 help with Debian packaging and distribution.
9046 help with Debian packaging and distribution.
9047 \layout List
9047 \layout List
9048 \labelwidthstring 00.00.0000
9048 \labelwidthstring 00.00.0000
9049
9049
9050 George\SpecialChar ~
9050 George\SpecialChar ~
9051 Sakkis <
9051 Sakkis <
9052 \family typewriter
9052 \family typewriter
9053 gsakkis-AT-eden.rutgers.edu>
9053 gsakkis-AT-eden.rutgers.edu>
9054 \family default
9054 \family default
9055 New matcher for tab-completing named arguments of user-defined functions.
9055 New matcher for tab-completing named arguments of user-defined functions.
9056 \layout List
9057 \labelwidthstring 00.00.0000
9058
9059 J�rgen\SpecialChar ~
9060 Stenarson
9061 \family typewriter
9062 <jorgen.stenarson-AT-bostream.nu>
9063 \family default
9064 Wildcard support implementation for searching namespaces.
9056 \the_end
9065 \the_end
General Comments 0
You need to be logged in to leave comments. Login now