##// END OF EJS Templates
callable aliases now get _ip as first arg
vivainio -
Show More
@@ -1,174 +1,173
1 1 """ File system operations
2 2
3 3 Contains: Simple variants of normal unix shell commands (icp, imv, irm,
4 4 imkdir, igrep).
5 5
6 6 Some "otherwise handy" utils ('collect' for gathering files to
7 7 ~/_ipython/collect, 'inote' for collecting single note lines to
8 8 ~/_ipython/note.txt)
9 9
10 10 Mostly of use for bare windows installations where cygwin/equivalent is not
11 11 installed and you would otherwise need to deal with dos versions of the
12 12 commands (that e.g. don't understand / as path separator). These can
13 13 do some useful tricks on their own, though (like use 'mglob' patterns).
14 14
15 15 Not to be confused with ipipe commands (ils etc.) that also start with i.
16 16 """
17 17
18 18 import IPython.ipapi
19 19 ip = IPython.ipapi.get()
20 20
21 21 import shutil,os,shlex
22 22 from IPython.external import mglob
23 23 class IpyShellCmdException(Exception):
24 24 pass
25 25
26 26 def parse_args(args):
27 27 """ Given arg string 'CMD files... target', return ([files], target) """
28 28
29 29 tup = args.split(None, 1)
30 30 if len(tup) == 1:
31 31 raise IpyShellCmdException("Expected arguments for " + tup[0])
32 32
33 33 tup2 = shlex.split(tup[1])
34 34
35 35 flist, trg = mglob.expand(tup2[0:-1]), tup2[-1]
36 36 if not flist:
37 37 raise IpyShellCmdException("No files found:" + str(tup2[0:-1]))
38 38 return flist, trg
39 39
40 def icp(arg):
40 def icp(ip,arg):
41 41 """ icp files... targetdir
42 42
43 43 Copy all files to target, creating dirs for target if necessary
44 44
45 45 icp srcdir dstdir
46 46
47 47 Copy srcdir to distdir
48 48
49 49 """
50 50 import distutils.dir_util
51 51
52 52 fs, targetdir = parse_args(arg)
53 53 if not os.path.isdir(targetdir):
54 54 distutils.dir_util.mkpath(targetdir,verbose =1)
55 55 for f in fs:
56 56 shutil.copy2(f,targetdir)
57 57 return fs
58 58 ip.defalias("icp",icp)
59 59
60 def imv(arg):
60 def imv(ip,arg):
61 61 """ imv src tgt
62 62
63 63 Move source to target.
64 64 """
65 65
66 66 fs, target = parse_args(arg)
67 67 if len(fs) > 1:
68 68 assert os.path.isdir(target)
69 69 for f in fs:
70 70 shutil.move(f, target)
71 71 return fs
72 72 ip.defalias("imv",imv)
73 73
74 def irm(arg):
74 def irm(ip,arg):
75 75 """ irm path[s]...
76 76
77 77 Remove file[s] or dir[s] path. Dirs are deleted recursively.
78 78 """
79 79 paths = mglob.expand(arg.split(None,1)[1])
80 80 import distutils.dir_util
81 81 for p in paths:
82 82 print "rm",p
83 83 if os.path.isdir(p):
84 84 distutils.dir_util.remove_tree(p, verbose = 1)
85 85 else:
86 86 os.remove(p)
87 87
88 88 ip.defalias("irm",irm)
89 89
90 def imkdir(arg):
90 def imkdir(ip,arg):
91 91 """ imkdir path
92 92
93 93 Creates dir path, and all dirs on the road
94 94 """
95 95 import distutils.dir_util
96 96 targetdir = arg.split(None,1)[1]
97 97 distutils.dir_util.mkpath(targetdir,verbose =1)
98 98
99 99 ip.defalias("imkdir",imkdir)
100 100
101 def igrep(arg):
101 def igrep(ip,arg):
102 102 """ igrep PAT files...
103 103
104 104 Very dumb file scan, case-insensitive.
105 105
106 106 e.g.
107 107
108 108 igrep "test this" rec:*.py
109 109
110 110 """
111 111 elems = shlex.split(arg)
112 112 dummy, pat, fs = elems[0], elems[1], mglob.expand(elems[2:])
113 113 res = []
114 114 for f in fs:
115 115 found = False
116 116 for l in open(f):
117 117 if pat.lower() in l.lower():
118 118 if not found:
119 119 print "[[",f,"]]"
120 120 found = True
121 121 res.append(f)
122 122 print l.rstrip()
123 123 return res
124 124
125 125 ip.defalias("igrep",igrep)
126 126
127 def collect(arg):
127 def collect(ip,arg):
128 128 """ collect foo/a.txt rec:bar=*.py
129 129
130 130 Copies foo/a.txt to ~/_ipython/collect/foo/a.txt and *.py from bar,
131 131 likewise
132 132
133 133 Without args, try to open ~/_ipython/collect dir (in win32 at least).
134 134 """
135 135 from path import path
136 136 basedir = path(ip.options.ipythondir + '/collect')
137 137 try:
138 138 fs = mglob.expand(arg.split(None,1)[1])
139 139 except IndexError:
140 140 os.startfile(basedir)
141 141 return
142 142 for f in fs:
143 143 f = path(f)
144 144 trg = basedir / f.splitdrive()[1].lstrip('/\\')
145 145 if f.isdir():
146 146 print "mkdir",trg
147 147 trg.makedirs()
148 148 continue
149 149 dname = trg.dirname()
150 150 if not dname.isdir():
151 151 dname.makedirs()
152 152 print f,"=>",trg
153 153 shutil.copy2(f,trg)
154 154
155 155 ip.defalias("collect",collect)
156 156
157 def inote(arg):
157 def inote(ip,arg):
158 158 """ inote Hello world
159 159
160 160 Adds timestamp and Hello world to ~/_ipython/notes.txt
161 161
162 162 Without args, opens notes.txt for editing.
163 163 """
164 164 import time
165 165 fname = ip.options.ipythondir + '/notes.txt'
166 166
167 167 try:
168 168 entry = " === " + time.asctime() + ': ===\n' + arg.split(None,1)[1] + '\n'
169 169 f= open(fname, 'a').write(entry)
170 170 except IndexError:
171 171 ip.IP.hooks.editor(fname)
172 172
173 ip.defalias("inote",inote)
174
173 ip.defalias("inote",inote)
@@ -1,122 +1,122
1 1 # -*- coding: utf-8 -*-
2 2 """ IPython extension: add %rehashdir magic
3 3
4 4 Usage:
5 5
6 6 %rehashdir c:/bin c:/tools
7 7 - Add all executables under c:/bin and c:/tools to alias table, in
8 8 order to make them directly executable from any directory.
9 9
10 10 This also serves as an example on how to extend ipython
11 11 with new magic functions.
12 12
13 13 Unlike rest of ipython, this requires Python 2.4 (optional
14 14 extensions are allowed to do that).
15 15
16 16 """
17 17
18 18 import IPython.ipapi
19 19 ip = IPython.ipapi.get()
20 20
21 21
22 22 import os,re,fnmatch,sys
23 23
24 def selflaunch(line):
24 def selflaunch(ip,line):
25 25 """ Launch python script with 'this' interpreter
26 26
27 27 e.g. d:\foo\ipython.exe a.py
28 28
29 29 """
30 30 cmd = sys.executable + ' ' + line.split(None,1)[1]
31 31 print ">",cmd
32 32 os.system(cmd)
33 33
34 34 class PyLauncher:
35 35 """ Invoke selflanucher on the specified script
36 36
37 37 This is mostly useful for associating with scripts using::
38 38 _ip.defalias('foo',PyLauncher('foo_script.py'))
39 39
40 40 """
41 41 def __init__(self,script):
42 42 self.script = os.path.abspath(script)
43 def __call__(self, line):
43 def __call__(self, ip, line):
44 44 selflaunch("py " + self.script + ' ' + line)
45 45 def __repr__(self):
46 46 return 'PyLauncher("%s")' % self.script
47 47 def rehashdir_f(self,arg):
48 48 """ Add executables in all specified dirs to alias table
49 49
50 50 Usage:
51 51
52 52 %rehashdir c:/bin;c:/tools
53 53 - Add all executables under c:/bin and c:/tools to alias table, in
54 54 order to make them directly executable from any directory.
55 55
56 56 Without arguments, add all executables in current directory.
57 57
58 58 """
59 59
60 60 # most of the code copied from Magic.magic_rehashx
61 61
62 62 def isjunk(fname):
63 63 junk = ['*~']
64 64 for j in junk:
65 65 if fnmatch.fnmatch(fname, j):
66 66 return True
67 67 return False
68 68
69 69 created = []
70 70 if not arg:
71 71 arg = '.'
72 72 path = map(os.path.abspath,arg.split(';'))
73 73 alias_table = self.shell.alias_table
74 74
75 75 if os.name == 'posix':
76 76 isexec = lambda fname:os.path.isfile(fname) and \
77 77 os.access(fname,os.X_OK)
78 78 else:
79 79
80 80 try:
81 81 winext = os.environ['pathext'].replace(';','|').replace('.','')
82 82 except KeyError:
83 83 winext = 'exe|com|bat|py'
84 84 if 'py' not in winext:
85 85 winext += '|py'
86 86
87 87 execre = re.compile(r'(.*)\.(%s)$' % winext,re.IGNORECASE)
88 88 isexec = lambda fname:os.path.isfile(fname) and execre.match(fname)
89 89 savedir = os.getcwd()
90 90 try:
91 91 # write the whole loop for posix/Windows so we don't have an if in
92 92 # the innermost part
93 93 if os.name == 'posix':
94 94 for pdir in path:
95 95 os.chdir(pdir)
96 96 for ff in os.listdir(pdir):
97 97 if isexec(ff) and not isjunk(ff):
98 98 # each entry in the alias table must be (N,name),
99 99 # where N is the number of positional arguments of the
100 100 # alias.
101 101 src,tgt = os.path.splitext(ff)[0], os.path.abspath(ff)
102 102 created.append(src)
103 103 alias_table[src] = (0,tgt)
104 104 else:
105 105 for pdir in path:
106 106 os.chdir(pdir)
107 107 for ff in os.listdir(pdir):
108 108 if isexec(ff) and not isjunk(ff):
109 109 src, tgt = execre.sub(r'\1',ff), os.path.abspath(ff)
110 110 src = src.lower()
111 111 created.append(src)
112 112 alias_table[src] = (0,tgt)
113 113 # Make sure the alias table doesn't contain keywords or builtins
114 114 self.shell.alias_table_validate()
115 115 # Call again init_auto_alias() so we get 'rm -i' and other
116 116 # modified aliases since %rehashx will probably clobber them
117 117 # self.shell.init_auto_alias()
118 118 finally:
119 119 os.chdir(savedir)
120 120 return created
121 121
122 122 ip.expose_magic("rehashdir",rehashdir_f)
@@ -1,33 +1,43
1 1 #!/usr/bin/env python
2 2
3 3 import IPython.ipapi
4 4 ip = IPython.ipapi.get()
5 5
6 6 import os, subprocess
7 7
8 8 workdir = None
9 def workdir_f(line):
9 def workdir_f(ip,line):
10 """ Exceute commands residing in cwd elsewhere
11
12 Example::
13
14 workdir /myfiles
15 cd bin
16 workdir myscript.py
17
18 executes myscript.py (stored in bin, but not in path) in /myfiles
19 """
10 20 global workdir
11 21 dummy,cmd = line.split(None,1)
12 22 if os.path.isdir(cmd):
13 workdir = cmd
23 workdir = os.path.abspath(cmd)
14 24 print "Set workdir",workdir
15 25 elif workdir is None:
16 26 print "Please set workdir first by doing e.g. 'workdir q:/'"
17 27 else:
18 28 sp = cmd.split(None,1)
19 29 if len(sp) == 1:
20 30 head, tail = cmd, ''
21 31 else:
22 32 head, tail = sp
23 33 if os.path.isfile(head):
24 34 cmd = os.path.abspath(head) + ' ' + tail
25 print "Execute command",cmd,"in",workdir
26 ret = subprocess.call(cmd, shell = True, cwd = workdir)
35 print "Execute command '" + cmd+ "' in",workdir
36 olddir = os.getcwd()
37 os.chdir(workdir)
38 try:
39 os.system(cmd)
40 finally:
41 os.chdir(olddir)
27 42
28 43 ip.defalias("workdir",workdir_f)
29
30
31
32
33
@@ -1,2536 +1,2536
1 1 # -*- coding: utf-8 -*-
2 2 """
3 3 IPython -- An enhanced Interactive Python
4 4
5 5 Requires Python 2.3 or newer.
6 6
7 7 This file contains all the classes and helper functions specific to IPython.
8 8
9 $Id: iplib.py 2718 2007-09-05 21:54:50Z vivainio $
9 $Id: iplib.py 2719 2007-09-06 18:53:34Z vivainio $
10 10 """
11 11
12 12 #*****************************************************************************
13 13 # Copyright (C) 2001 Janko Hauser <jhauser@zscout.de> and
14 14 # Copyright (C) 2001-2006 Fernando Perez. <fperez@colorado.edu>
15 15 #
16 16 # Distributed under the terms of the BSD License. The full license is in
17 17 # the file COPYING, distributed as part of this software.
18 18 #
19 19 # Note: this code originally subclassed code.InteractiveConsole from the
20 20 # Python standard library. Over time, all of that class has been copied
21 21 # verbatim here for modifications which could not be accomplished by
22 22 # subclassing. At this point, there are no dependencies at all on the code
23 23 # module anymore (it is not even imported). The Python License (sec. 2)
24 24 # allows for this, but it's always nice to acknowledge credit where credit is
25 25 # due.
26 26 #*****************************************************************************
27 27
28 28 #****************************************************************************
29 29 # Modules and globals
30 30
31 31 from IPython import Release
32 32 __author__ = '%s <%s>\n%s <%s>' % \
33 33 ( Release.authors['Janko'] + Release.authors['Fernando'] )
34 34 __license__ = Release.license
35 35 __version__ = Release.version
36 36
37 37 # Python standard modules
38 38 import __main__
39 39 import __builtin__
40 40 import StringIO
41 41 import bdb
42 42 import cPickle as pickle
43 43 import codeop
44 44 import doctest
45 45 import exceptions
46 46 import glob
47 47 import inspect
48 48 import keyword
49 49 import new
50 50 import os
51 51 import pydoc
52 52 import re
53 53 import shutil
54 54 import string
55 55 import sys
56 56 import tempfile
57 57 import traceback
58 58 import types
59 59 import pickleshare
60 60 from sets import Set
61 61 from pprint import pprint, pformat
62 62
63 63 # IPython's own modules
64 64 #import IPython
65 65 from IPython import Debugger,OInspect,PyColorize,ultraTB
66 66 from IPython.ColorANSI import ColorScheme,ColorSchemeTable # too long names
67 67 from IPython.FakeModule import FakeModule
68 68 from IPython.Itpl import Itpl,itpl,printpl,ItplNS,itplns
69 69 from IPython.Logger import Logger
70 70 from IPython.Magic import Magic
71 71 from IPython.Prompts import CachedOutput
72 72 from IPython.ipstruct import Struct
73 73 from IPython.background_jobs import BackgroundJobManager
74 74 from IPython.usage import cmd_line_usage,interactive_usage
75 75 from IPython.genutils import *
76 76 from IPython.strdispatch import StrDispatch
77 77 import IPython.ipapi
78 78 import IPython.history
79 79 import IPython.prefilter as prefilter
80 80 import IPython.shadowns
81 81 # Globals
82 82
83 83 # store the builtin raw_input globally, and use this always, in case user code
84 84 # overwrites it (like wx.py.PyShell does)
85 85 raw_input_original = raw_input
86 86
87 87 # compiled regexps for autoindent management
88 88 dedent_re = re.compile(r'^\s+raise|^\s+return|^\s+pass')
89 89
90 90
91 91 #****************************************************************************
92 92 # Some utility function definitions
93 93
94 94 ini_spaces_re = re.compile(r'^(\s+)')
95 95
96 96 def num_ini_spaces(strng):
97 97 """Return the number of initial spaces in a string"""
98 98
99 99 ini_spaces = ini_spaces_re.match(strng)
100 100 if ini_spaces:
101 101 return ini_spaces.end()
102 102 else:
103 103 return 0
104 104
105 105 def softspace(file, newvalue):
106 106 """Copied from code.py, to remove the dependency"""
107 107
108 108 oldvalue = 0
109 109 try:
110 110 oldvalue = file.softspace
111 111 except AttributeError:
112 112 pass
113 113 try:
114 114 file.softspace = newvalue
115 115 except (AttributeError, TypeError):
116 116 # "attribute-less object" or "read-only attributes"
117 117 pass
118 118 return oldvalue
119 119
120 120
121 121 #****************************************************************************
122 122 # Local use exceptions
123 123 class SpaceInInput(exceptions.Exception): pass
124 124
125 125
126 126 #****************************************************************************
127 127 # Local use classes
128 128 class Bunch: pass
129 129
130 130 class Undefined: pass
131 131
132 132 class Quitter(object):
133 133 """Simple class to handle exit, similar to Python 2.5's.
134 134
135 135 It handles exiting in an ipython-safe manner, which the one in Python 2.5
136 136 doesn't do (obviously, since it doesn't know about ipython)."""
137 137
138 138 def __init__(self,shell,name):
139 139 self.shell = shell
140 140 self.name = name
141 141
142 142 def __repr__(self):
143 143 return 'Type %s() to exit.' % self.name
144 144 __str__ = __repr__
145 145
146 146 def __call__(self):
147 147 self.shell.exit()
148 148
149 149 class InputList(list):
150 150 """Class to store user input.
151 151
152 152 It's basically a list, but slices return a string instead of a list, thus
153 153 allowing things like (assuming 'In' is an instance):
154 154
155 155 exec In[4:7]
156 156
157 157 or
158 158
159 159 exec In[5:9] + In[14] + In[21:25]"""
160 160
161 161 def __getslice__(self,i,j):
162 162 return ''.join(list.__getslice__(self,i,j))
163 163
164 164 class SyntaxTB(ultraTB.ListTB):
165 165 """Extension which holds some state: the last exception value"""
166 166
167 167 def __init__(self,color_scheme = 'NoColor'):
168 168 ultraTB.ListTB.__init__(self,color_scheme)
169 169 self.last_syntax_error = None
170 170
171 171 def __call__(self, etype, value, elist):
172 172 self.last_syntax_error = value
173 173 ultraTB.ListTB.__call__(self,etype,value,elist)
174 174
175 175 def clear_err_state(self):
176 176 """Return the current error state and clear it"""
177 177 e = self.last_syntax_error
178 178 self.last_syntax_error = None
179 179 return e
180 180
181 181 #****************************************************************************
182 182 # Main IPython class
183 183
184 184 # FIXME: the Magic class is a mixin for now, and will unfortunately remain so
185 185 # until a full rewrite is made. I've cleaned all cross-class uses of
186 186 # attributes and methods, but too much user code out there relies on the
187 187 # equlity %foo == __IP.magic_foo, so I can't actually remove the mixin usage.
188 188 #
189 189 # But at least now, all the pieces have been separated and we could, in
190 190 # principle, stop using the mixin. This will ease the transition to the
191 191 # chainsaw branch.
192 192
193 193 # For reference, the following is the list of 'self.foo' uses in the Magic
194 194 # class as of 2005-12-28. These are names we CAN'T use in the main ipython
195 195 # class, to prevent clashes.
196 196
197 197 # ['self.__class__', 'self.__dict__', 'self._inspect', 'self._ofind',
198 198 # 'self.arg_err', 'self.extract_input', 'self.format_', 'self.lsmagic',
199 199 # 'self.magic_', 'self.options_table', 'self.parse', 'self.shell',
200 200 # 'self.value']
201 201
202 202 class InteractiveShell(object,Magic):
203 203 """An enhanced console for Python."""
204 204
205 205 # class attribute to indicate whether the class supports threads or not.
206 206 # Subclasses with thread support should override this as needed.
207 207 isthreaded = False
208 208
209 209 def __init__(self,name,usage=None,rc=Struct(opts=None,args=None),
210 210 user_ns = None,user_global_ns=None,banner2='',
211 211 custom_exceptions=((),None),embedded=False):
212 212
213 213 # log system
214 214 self.logger = Logger(self,logfname='ipython_log.py',logmode='rotate')
215 215
216 216 # some minimal strict typechecks. For some core data structures, I
217 217 # want actual basic python types, not just anything that looks like
218 218 # one. This is especially true for namespaces.
219 219 for ns in (user_ns,user_global_ns):
220 220 if ns is not None and type(ns) != types.DictType:
221 221 raise TypeError,'namespace must be a dictionary'
222 222
223 223 # Job manager (for jobs run as background threads)
224 224 self.jobs = BackgroundJobManager()
225 225
226 226 # Store the actual shell's name
227 227 self.name = name
228 228
229 229 # We need to know whether the instance is meant for embedding, since
230 230 # global/local namespaces need to be handled differently in that case
231 231 self.embedded = embedded
232 232 if embedded:
233 233 # Control variable so users can, from within the embedded instance,
234 234 # permanently deactivate it.
235 235 self.embedded_active = True
236 236
237 237 # command compiler
238 238 self.compile = codeop.CommandCompiler()
239 239
240 240 # User input buffer
241 241 self.buffer = []
242 242
243 243 # Default name given in compilation of code
244 244 self.filename = '<ipython console>'
245 245
246 246 # Install our own quitter instead of the builtins. For python2.3-2.4,
247 247 # this brings in behavior like 2.5, and for 2.5 it's identical.
248 248 __builtin__.exit = Quitter(self,'exit')
249 249 __builtin__.quit = Quitter(self,'quit')
250 250
251 251 # Make an empty namespace, which extension writers can rely on both
252 252 # existing and NEVER being used by ipython itself. This gives them a
253 253 # convenient location for storing additional information and state
254 254 # their extensions may require, without fear of collisions with other
255 255 # ipython names that may develop later.
256 256 self.meta = Struct()
257 257
258 258 # Create the namespace where the user will operate. user_ns is
259 259 # normally the only one used, and it is passed to the exec calls as
260 260 # the locals argument. But we do carry a user_global_ns namespace
261 261 # given as the exec 'globals' argument, This is useful in embedding
262 262 # situations where the ipython shell opens in a context where the
263 263 # distinction between locals and globals is meaningful.
264 264
265 265 # FIXME. For some strange reason, __builtins__ is showing up at user
266 266 # level as a dict instead of a module. This is a manual fix, but I
267 267 # should really track down where the problem is coming from. Alex
268 268 # Schmolck reported this problem first.
269 269
270 270 # A useful post by Alex Martelli on this topic:
271 271 # Re: inconsistent value from __builtins__
272 272 # Von: Alex Martelli <aleaxit@yahoo.com>
273 273 # Datum: Freitag 01 Oktober 2004 04:45:34 nachmittags/abends
274 274 # Gruppen: comp.lang.python
275 275
276 276 # Michael Hohn <hohn@hooknose.lbl.gov> wrote:
277 277 # > >>> print type(builtin_check.get_global_binding('__builtins__'))
278 278 # > <type 'dict'>
279 279 # > >>> print type(__builtins__)
280 280 # > <type 'module'>
281 281 # > Is this difference in return value intentional?
282 282
283 283 # Well, it's documented that '__builtins__' can be either a dictionary
284 284 # or a module, and it's been that way for a long time. Whether it's
285 285 # intentional (or sensible), I don't know. In any case, the idea is
286 286 # that if you need to access the built-in namespace directly, you
287 287 # should start with "import __builtin__" (note, no 's') which will
288 288 # definitely give you a module. Yeah, it's somewhat confusing:-(.
289 289
290 290 # These routines return properly built dicts as needed by the rest of
291 291 # the code, and can also be used by extension writers to generate
292 292 # properly initialized namespaces.
293 293 user_ns = IPython.ipapi.make_user_ns(user_ns)
294 294 user_global_ns = IPython.ipapi.make_user_global_ns(user_global_ns)
295 295
296 296 # Assign namespaces
297 297 # This is the namespace where all normal user variables live
298 298 self.user_ns = user_ns
299 299 # Embedded instances require a separate namespace for globals.
300 300 # Normally this one is unused by non-embedded instances.
301 301 self.user_global_ns = user_global_ns
302 302 # A namespace to keep track of internal data structures to prevent
303 303 # them from cluttering user-visible stuff. Will be updated later
304 304 self.internal_ns = {}
305 305
306 306 # Namespace of system aliases. Each entry in the alias
307 307 # table must be a 2-tuple of the form (N,name), where N is the number
308 308 # of positional arguments of the alias.
309 309 self.alias_table = {}
310 310
311 311 # A table holding all the namespaces IPython deals with, so that
312 312 # introspection facilities can search easily.
313 313 self.ns_table = {'user':user_ns,
314 314 'user_global':user_global_ns,
315 315 'alias':self.alias_table,
316 316 'internal':self.internal_ns,
317 317 'builtin':__builtin__.__dict__
318 318 }
319 319 # The user namespace MUST have a pointer to the shell itself.
320 320 self.user_ns[name] = self
321 321
322 322 # We need to insert into sys.modules something that looks like a
323 323 # module but which accesses the IPython namespace, for shelve and
324 324 # pickle to work interactively. Normally they rely on getting
325 325 # everything out of __main__, but for embedding purposes each IPython
326 326 # instance has its own private namespace, so we can't go shoving
327 327 # everything into __main__.
328 328
329 329 # note, however, that we should only do this for non-embedded
330 330 # ipythons, which really mimic the __main__.__dict__ with their own
331 331 # namespace. Embedded instances, on the other hand, should not do
332 332 # this because they need to manage the user local/global namespaces
333 333 # only, but they live within a 'normal' __main__ (meaning, they
334 334 # shouldn't overtake the execution environment of the script they're
335 335 # embedded in).
336 336
337 337 if not embedded:
338 338 try:
339 339 main_name = self.user_ns['__name__']
340 340 except KeyError:
341 341 raise KeyError,'user_ns dictionary MUST have a "__name__" key'
342 342 else:
343 343 #print "pickle hack in place" # dbg
344 344 #print 'main_name:',main_name # dbg
345 345 sys.modules[main_name] = FakeModule(self.user_ns)
346 346
347 347 # List of input with multi-line handling.
348 348 # Fill its zero entry, user counter starts at 1
349 349 self.input_hist = InputList(['\n'])
350 350 # This one will hold the 'raw' input history, without any
351 351 # pre-processing. This will allow users to retrieve the input just as
352 352 # it was exactly typed in by the user, with %hist -r.
353 353 self.input_hist_raw = InputList(['\n'])
354 354
355 355 # list of visited directories
356 356 try:
357 357 self.dir_hist = [os.getcwd()]
358 358 except OSError:
359 359 self.dir_hist = []
360 360
361 361 # dict of output history
362 362 self.output_hist = {}
363 363
364 364 # Get system encoding at startup time. Certain terminals (like Emacs
365 365 # under Win32 have it set to None, and we need to have a known valid
366 366 # encoding to use in the raw_input() method
367 367 self.stdin_encoding = sys.stdin.encoding or 'ascii'
368 368
369 369 # dict of things NOT to alias (keywords, builtins and some magics)
370 370 no_alias = {}
371 371 no_alias_magics = ['cd','popd','pushd','dhist','alias','unalias']
372 372 for key in keyword.kwlist + no_alias_magics:
373 373 no_alias[key] = 1
374 374 no_alias.update(__builtin__.__dict__)
375 375 self.no_alias = no_alias
376 376
377 377 # make global variables for user access to these
378 378 self.user_ns['_ih'] = self.input_hist
379 379 self.user_ns['_oh'] = self.output_hist
380 380 self.user_ns['_dh'] = self.dir_hist
381 381
382 382 # user aliases to input and output histories
383 383 self.user_ns['In'] = self.input_hist
384 384 self.user_ns['Out'] = self.output_hist
385 385
386 386 self.user_ns['_sh'] = IPython.shadowns
387 387 # Object variable to store code object waiting execution. This is
388 388 # used mainly by the multithreaded shells, but it can come in handy in
389 389 # other situations. No need to use a Queue here, since it's a single
390 390 # item which gets cleared once run.
391 391 self.code_to_run = None
392 392
393 393 # escapes for automatic behavior on the command line
394 394 self.ESC_SHELL = '!'
395 395 self.ESC_SH_CAP = '!!'
396 396 self.ESC_HELP = '?'
397 397 self.ESC_MAGIC = '%'
398 398 self.ESC_QUOTE = ','
399 399 self.ESC_QUOTE2 = ';'
400 400 self.ESC_PAREN = '/'
401 401
402 402 # And their associated handlers
403 403 self.esc_handlers = {self.ESC_PAREN : self.handle_auto,
404 404 self.ESC_QUOTE : self.handle_auto,
405 405 self.ESC_QUOTE2 : self.handle_auto,
406 406 self.ESC_MAGIC : self.handle_magic,
407 407 self.ESC_HELP : self.handle_help,
408 408 self.ESC_SHELL : self.handle_shell_escape,
409 409 self.ESC_SH_CAP : self.handle_shell_escape,
410 410 }
411 411
412 412 # class initializations
413 413 Magic.__init__(self,self)
414 414
415 415 # Python source parser/formatter for syntax highlighting
416 416 pyformat = PyColorize.Parser().format
417 417 self.pycolorize = lambda src: pyformat(src,'str',self.rc['colors'])
418 418
419 419 # hooks holds pointers used for user-side customizations
420 420 self.hooks = Struct()
421 421
422 422 self.strdispatchers = {}
423 423
424 424 # Set all default hooks, defined in the IPython.hooks module.
425 425 hooks = IPython.hooks
426 426 for hook_name in hooks.__all__:
427 427 # default hooks have priority 100, i.e. low; user hooks should have
428 428 # 0-100 priority
429 429 self.set_hook(hook_name,getattr(hooks,hook_name), 100)
430 430 #print "bound hook",hook_name
431 431
432 432 # Flag to mark unconditional exit
433 433 self.exit_now = False
434 434
435 435 self.usage_min = """\
436 436 An enhanced console for Python.
437 437 Some of its features are:
438 438 - Readline support if the readline library is present.
439 439 - Tab completion in the local namespace.
440 440 - Logging of input, see command-line options.
441 441 - System shell escape via ! , eg !ls.
442 442 - Magic commands, starting with a % (like %ls, %pwd, %cd, etc.)
443 443 - Keeps track of locally defined variables via %who, %whos.
444 444 - Show object information with a ? eg ?x or x? (use ?? for more info).
445 445 """
446 446 if usage: self.usage = usage
447 447 else: self.usage = self.usage_min
448 448
449 449 # Storage
450 450 self.rc = rc # This will hold all configuration information
451 451 self.pager = 'less'
452 452 # temporary files used for various purposes. Deleted at exit.
453 453 self.tempfiles = []
454 454
455 455 # Keep track of readline usage (later set by init_readline)
456 456 self.has_readline = False
457 457
458 458 # template for logfile headers. It gets resolved at runtime by the
459 459 # logstart method.
460 460 self.loghead_tpl = \
461 461 """#log# Automatic Logger file. *** THIS MUST BE THE FIRST LINE ***
462 462 #log# DO NOT CHANGE THIS LINE OR THE TWO BELOW
463 463 #log# opts = %s
464 464 #log# args = %s
465 465 #log# It is safe to make manual edits below here.
466 466 #log#-----------------------------------------------------------------------
467 467 """
468 468 # for pushd/popd management
469 469 try:
470 470 self.home_dir = get_home_dir()
471 471 except HomeDirError,msg:
472 472 fatal(msg)
473 473
474 474 self.dir_stack = [os.getcwd().replace(self.home_dir,'~')]
475 475
476 476 # Functions to call the underlying shell.
477 477
478 478 # The first is similar to os.system, but it doesn't return a value,
479 479 # and it allows interpolation of variables in the user's namespace.
480 480 self.system = lambda cmd: \
481 481 shell(self.var_expand(cmd,depth=2),
482 482 header=self.rc.system_header,
483 483 verbose=self.rc.system_verbose)
484 484
485 485 # These are for getoutput and getoutputerror:
486 486 self.getoutput = lambda cmd: \
487 487 getoutput(self.var_expand(cmd,depth=2),
488 488 header=self.rc.system_header,
489 489 verbose=self.rc.system_verbose)
490 490
491 491 self.getoutputerror = lambda cmd: \
492 492 getoutputerror(self.var_expand(cmd,depth=2),
493 493 header=self.rc.system_header,
494 494 verbose=self.rc.system_verbose)
495 495
496 496
497 497 # keep track of where we started running (mainly for crash post-mortem)
498 498 self.starting_dir = os.getcwd()
499 499
500 500 # Various switches which can be set
501 501 self.CACHELENGTH = 5000 # this is cheap, it's just text
502 502 self.BANNER = "Python %(version)s on %(platform)s\n" % sys.__dict__
503 503 self.banner2 = banner2
504 504
505 505 # TraceBack handlers:
506 506
507 507 # Syntax error handler.
508 508 self.SyntaxTB = SyntaxTB(color_scheme='NoColor')
509 509
510 510 # The interactive one is initialized with an offset, meaning we always
511 511 # want to remove the topmost item in the traceback, which is our own
512 512 # internal code. Valid modes: ['Plain','Context','Verbose']
513 513 self.InteractiveTB = ultraTB.AutoFormattedTB(mode = 'Plain',
514 514 color_scheme='NoColor',
515 515 tb_offset = 1)
516 516
517 517 # IPython itself shouldn't crash. This will produce a detailed
518 518 # post-mortem if it does. But we only install the crash handler for
519 519 # non-threaded shells, the threaded ones use a normal verbose reporter
520 520 # and lose the crash handler. This is because exceptions in the main
521 521 # thread (such as in GUI code) propagate directly to sys.excepthook,
522 522 # and there's no point in printing crash dumps for every user exception.
523 523 if self.isthreaded:
524 524 ipCrashHandler = ultraTB.FormattedTB()
525 525 else:
526 526 from IPython import CrashHandler
527 527 ipCrashHandler = CrashHandler.IPythonCrashHandler(self)
528 528 self.set_crash_handler(ipCrashHandler)
529 529
530 530 # and add any custom exception handlers the user may have specified
531 531 self.set_custom_exc(*custom_exceptions)
532 532
533 533 # indentation management
534 534 self.autoindent = False
535 535 self.indent_current_nsp = 0
536 536
537 537 # Make some aliases automatically
538 538 # Prepare list of shell aliases to auto-define
539 539 if os.name == 'posix':
540 540 auto_alias = ('mkdir mkdir', 'rmdir rmdir',
541 541 'mv mv -i','rm rm -i','cp cp -i',
542 542 'cat cat','less less','clear clear',
543 543 # a better ls
544 544 'ls ls -F',
545 545 # long ls
546 546 'll ls -lF')
547 547 # Extra ls aliases with color, which need special treatment on BSD
548 548 # variants
549 549 ls_extra = ( # color ls
550 550 'lc ls -F -o --color',
551 551 # ls normal files only
552 552 'lf ls -F -o --color %l | grep ^-',
553 553 # ls symbolic links
554 554 'lk ls -F -o --color %l | grep ^l',
555 555 # directories or links to directories,
556 556 'ldir ls -F -o --color %l | grep /$',
557 557 # things which are executable
558 558 'lx ls -F -o --color %l | grep ^-..x',
559 559 )
560 560 # The BSDs don't ship GNU ls, so they don't understand the
561 561 # --color switch out of the box
562 562 if 'bsd' in sys.platform:
563 563 ls_extra = ( # ls normal files only
564 564 'lf ls -lF | grep ^-',
565 565 # ls symbolic links
566 566 'lk ls -lF | grep ^l',
567 567 # directories or links to directories,
568 568 'ldir ls -lF | grep /$',
569 569 # things which are executable
570 570 'lx ls -lF | grep ^-..x',
571 571 )
572 572 auto_alias = auto_alias + ls_extra
573 573 elif os.name in ['nt','dos']:
574 574 auto_alias = ('dir dir /on', 'ls dir /on',
575 575 'ddir dir /ad /on', 'ldir dir /ad /on',
576 576 'mkdir mkdir','rmdir rmdir','echo echo',
577 577 'ren ren','cls cls','copy copy')
578 578 else:
579 579 auto_alias = ()
580 580 self.auto_alias = [s.split(None,1) for s in auto_alias]
581 581
582 582 # Produce a public API instance
583 583 self.api = IPython.ipapi.IPApi(self)
584 584
585 585 # Call the actual (public) initializer
586 586 self.init_auto_alias()
587 587
588 588 # track which builtins we add, so we can clean up later
589 589 self.builtins_added = {}
590 590 # This method will add the necessary builtins for operation, but
591 591 # tracking what it did via the builtins_added dict.
592 592 self.add_builtins()
593 593
594 594
595 595
596 596 # end __init__
597 597
598 598 def var_expand(self,cmd,depth=0):
599 599 """Expand python variables in a string.
600 600
601 601 The depth argument indicates how many frames above the caller should
602 602 be walked to look for the local namespace where to expand variables.
603 603
604 604 The global namespace for expansion is always the user's interactive
605 605 namespace.
606 606 """
607 607
608 608 return str(ItplNS(cmd.replace('#','\#'),
609 609 self.user_ns, # globals
610 610 # Skip our own frame in searching for locals:
611 611 sys._getframe(depth+1).f_locals # locals
612 612 ))
613 613
614 614 def pre_config_initialization(self):
615 615 """Pre-configuration init method
616 616
617 617 This is called before the configuration files are processed to
618 618 prepare the services the config files might need.
619 619
620 620 self.rc already has reasonable default values at this point.
621 621 """
622 622 rc = self.rc
623 623 try:
624 624 self.db = pickleshare.PickleShareDB(rc.ipythondir + "/db")
625 625 except exceptions.UnicodeDecodeError:
626 626 print "Your ipythondir can't be decoded to unicode!"
627 627 print "Please set HOME environment variable to something that"
628 628 print r"only has ASCII characters, e.g. c:\home"
629 629 print "Now it is",rc.ipythondir
630 630 sys.exit()
631 631 self.shadowhist = IPython.history.ShadowHist(self.db)
632 632
633 633
634 634 def post_config_initialization(self):
635 635 """Post configuration init method
636 636
637 637 This is called after the configuration files have been processed to
638 638 'finalize' the initialization."""
639 639
640 640 rc = self.rc
641 641
642 642 # Object inspector
643 643 self.inspector = OInspect.Inspector(OInspect.InspectColors,
644 644 PyColorize.ANSICodeColors,
645 645 'NoColor',
646 646 rc.object_info_string_level)
647 647
648 648 self.rl_next_input = None
649 649 self.rl_do_indent = False
650 650 # Load readline proper
651 651 if rc.readline:
652 652 self.init_readline()
653 653
654 654
655 655 # local shortcut, this is used a LOT
656 656 self.log = self.logger.log
657 657
658 658 # Initialize cache, set in/out prompts and printing system
659 659 self.outputcache = CachedOutput(self,
660 660 rc.cache_size,
661 661 rc.pprint,
662 662 input_sep = rc.separate_in,
663 663 output_sep = rc.separate_out,
664 664 output_sep2 = rc.separate_out2,
665 665 ps1 = rc.prompt_in1,
666 666 ps2 = rc.prompt_in2,
667 667 ps_out = rc.prompt_out,
668 668 pad_left = rc.prompts_pad_left)
669 669
670 670 # user may have over-ridden the default print hook:
671 671 try:
672 672 self.outputcache.__class__.display = self.hooks.display
673 673 except AttributeError:
674 674 pass
675 675
676 676 # I don't like assigning globally to sys, because it means when
677 677 # embedding instances, each embedded instance overrides the previous
678 678 # choice. But sys.displayhook seems to be called internally by exec,
679 679 # so I don't see a way around it. We first save the original and then
680 680 # overwrite it.
681 681 self.sys_displayhook = sys.displayhook
682 682 sys.displayhook = self.outputcache
683 683
684 684 # Monkeypatch doctest so that its core test runner method is protected
685 685 # from IPython's modified displayhook. Doctest expects the default
686 686 # displayhook behavior deep down, so our modification breaks it
687 687 # completely. For this reason, a hard monkeypatch seems like a
688 688 # reasonable solution rather than asking users to manually use a
689 689 # different doctest runner when under IPython.
690 690 try:
691 691 doctest.DocTestRunner
692 692 except AttributeError:
693 693 # This is only for python 2.3 compatibility, remove once we move to
694 694 # 2.4 only.
695 695 pass
696 696 else:
697 697 doctest.DocTestRunner.run = dhook_wrap(doctest.DocTestRunner.run)
698 698
699 699 # Set user colors (don't do it in the constructor above so that it
700 700 # doesn't crash if colors option is invalid)
701 701 self.magic_colors(rc.colors)
702 702
703 703 # Set calling of pdb on exceptions
704 704 self.call_pdb = rc.pdb
705 705
706 706 # Load user aliases
707 707 for alias in rc.alias:
708 708 self.magic_alias(alias)
709 709
710 710 self.hooks.late_startup_hook()
711 711
712 712 batchrun = False
713 713 for batchfile in [path(arg) for arg in self.rc.args
714 714 if arg.lower().endswith('.ipy')]:
715 715 if not batchfile.isfile():
716 716 print "No such batch file:", batchfile
717 717 continue
718 718 self.api.runlines(batchfile.text())
719 719 batchrun = True
720 720 # without -i option, exit after running the batch file
721 721 if batchrun and not self.rc.interact:
722 722 self.exit_now = True
723 723
724 724 def add_builtins(self):
725 725 """Store ipython references into the builtin namespace.
726 726
727 727 Some parts of ipython operate via builtins injected here, which hold a
728 728 reference to IPython itself."""
729 729
730 730 # TODO: deprecate all except _ip; 'jobs' should be installed
731 731 # by an extension and the rest are under _ip, ipalias is redundant
732 732 builtins_new = dict(__IPYTHON__ = self,
733 733 ip_set_hook = self.set_hook,
734 734 jobs = self.jobs,
735 735 ipmagic = wrap_deprecated(self.ipmagic,'_ip.magic()'),
736 736 ipalias = wrap_deprecated(self.ipalias),
737 737 ipsystem = wrap_deprecated(self.ipsystem,'_ip.system()'),
738 738 _ip = self.api
739 739 )
740 740 for biname,bival in builtins_new.items():
741 741 try:
742 742 # store the orignal value so we can restore it
743 743 self.builtins_added[biname] = __builtin__.__dict__[biname]
744 744 except KeyError:
745 745 # or mark that it wasn't defined, and we'll just delete it at
746 746 # cleanup
747 747 self.builtins_added[biname] = Undefined
748 748 __builtin__.__dict__[biname] = bival
749 749
750 750 # Keep in the builtins a flag for when IPython is active. We set it
751 751 # with setdefault so that multiple nested IPythons don't clobber one
752 752 # another. Each will increase its value by one upon being activated,
753 753 # which also gives us a way to determine the nesting level.
754 754 __builtin__.__dict__.setdefault('__IPYTHON__active',0)
755 755
756 756 def clean_builtins(self):
757 757 """Remove any builtins which might have been added by add_builtins, or
758 758 restore overwritten ones to their previous values."""
759 759 for biname,bival in self.builtins_added.items():
760 760 if bival is Undefined:
761 761 del __builtin__.__dict__[biname]
762 762 else:
763 763 __builtin__.__dict__[biname] = bival
764 764 self.builtins_added.clear()
765 765
766 766 def set_hook(self,name,hook, priority = 50, str_key = None, re_key = None):
767 767 """set_hook(name,hook) -> sets an internal IPython hook.
768 768
769 769 IPython exposes some of its internal API as user-modifiable hooks. By
770 770 adding your function to one of these hooks, you can modify IPython's
771 771 behavior to call at runtime your own routines."""
772 772
773 773 # At some point in the future, this should validate the hook before it
774 774 # accepts it. Probably at least check that the hook takes the number
775 775 # of args it's supposed to.
776 776
777 777 f = new.instancemethod(hook,self,self.__class__)
778 778
779 779 # check if the hook is for strdispatcher first
780 780 if str_key is not None:
781 781 sdp = self.strdispatchers.get(name, StrDispatch())
782 782 sdp.add_s(str_key, f, priority )
783 783 self.strdispatchers[name] = sdp
784 784 return
785 785 if re_key is not None:
786 786 sdp = self.strdispatchers.get(name, StrDispatch())
787 787 sdp.add_re(re.compile(re_key), f, priority )
788 788 self.strdispatchers[name] = sdp
789 789 return
790 790
791 791 dp = getattr(self.hooks, name, None)
792 792 if name not in IPython.hooks.__all__:
793 793 print "Warning! Hook '%s' is not one of %s" % (name, IPython.hooks.__all__ )
794 794 if not dp:
795 795 dp = IPython.hooks.CommandChainDispatcher()
796 796
797 797 try:
798 798 dp.add(f,priority)
799 799 except AttributeError:
800 800 # it was not commandchain, plain old func - replace
801 801 dp = f
802 802
803 803 setattr(self.hooks,name, dp)
804 804
805 805
806 806 #setattr(self.hooks,name,new.instancemethod(hook,self,self.__class__))
807 807
808 808 def set_crash_handler(self,crashHandler):
809 809 """Set the IPython crash handler.
810 810
811 811 This must be a callable with a signature suitable for use as
812 812 sys.excepthook."""
813 813
814 814 # Install the given crash handler as the Python exception hook
815 815 sys.excepthook = crashHandler
816 816
817 817 # The instance will store a pointer to this, so that runtime code
818 818 # (such as magics) can access it. This is because during the
819 819 # read-eval loop, it gets temporarily overwritten (to deal with GUI
820 820 # frameworks).
821 821 self.sys_excepthook = sys.excepthook
822 822
823 823
824 824 def set_custom_exc(self,exc_tuple,handler):
825 825 """set_custom_exc(exc_tuple,handler)
826 826
827 827 Set a custom exception handler, which will be called if any of the
828 828 exceptions in exc_tuple occur in the mainloop (specifically, in the
829 829 runcode() method.
830 830
831 831 Inputs:
832 832
833 833 - exc_tuple: a *tuple* of valid exceptions to call the defined
834 834 handler for. It is very important that you use a tuple, and NOT A
835 835 LIST here, because of the way Python's except statement works. If
836 836 you only want to trap a single exception, use a singleton tuple:
837 837
838 838 exc_tuple == (MyCustomException,)
839 839
840 840 - handler: this must be defined as a function with the following
841 841 basic interface: def my_handler(self,etype,value,tb).
842 842
843 843 This will be made into an instance method (via new.instancemethod)
844 844 of IPython itself, and it will be called if any of the exceptions
845 845 listed in the exc_tuple are caught. If the handler is None, an
846 846 internal basic one is used, which just prints basic info.
847 847
848 848 WARNING: by putting in your own exception handler into IPython's main
849 849 execution loop, you run a very good chance of nasty crashes. This
850 850 facility should only be used if you really know what you are doing."""
851 851
852 852 assert type(exc_tuple)==type(()) , \
853 853 "The custom exceptions must be given AS A TUPLE."
854 854
855 855 def dummy_handler(self,etype,value,tb):
856 856 print '*** Simple custom exception handler ***'
857 857 print 'Exception type :',etype
858 858 print 'Exception value:',value
859 859 print 'Traceback :',tb
860 860 print 'Source code :','\n'.join(self.buffer)
861 861
862 862 if handler is None: handler = dummy_handler
863 863
864 864 self.CustomTB = new.instancemethod(handler,self,self.__class__)
865 865 self.custom_exceptions = exc_tuple
866 866
867 867 def set_custom_completer(self,completer,pos=0):
868 868 """set_custom_completer(completer,pos=0)
869 869
870 870 Adds a new custom completer function.
871 871
872 872 The position argument (defaults to 0) is the index in the completers
873 873 list where you want the completer to be inserted."""
874 874
875 875 newcomp = new.instancemethod(completer,self.Completer,
876 876 self.Completer.__class__)
877 877 self.Completer.matchers.insert(pos,newcomp)
878 878
879 879 def set_completer(self):
880 880 """reset readline's completer to be our own."""
881 881 self.readline.set_completer(self.Completer.complete)
882 882
883 883 def _get_call_pdb(self):
884 884 return self._call_pdb
885 885
886 886 def _set_call_pdb(self,val):
887 887
888 888 if val not in (0,1,False,True):
889 889 raise ValueError,'new call_pdb value must be boolean'
890 890
891 891 # store value in instance
892 892 self._call_pdb = val
893 893
894 894 # notify the actual exception handlers
895 895 self.InteractiveTB.call_pdb = val
896 896 if self.isthreaded:
897 897 try:
898 898 self.sys_excepthook.call_pdb = val
899 899 except:
900 900 warn('Failed to activate pdb for threaded exception handler')
901 901
902 902 call_pdb = property(_get_call_pdb,_set_call_pdb,None,
903 903 'Control auto-activation of pdb at exceptions')
904 904
905 905
906 906 # These special functions get installed in the builtin namespace, to
907 907 # provide programmatic (pure python) access to magics, aliases and system
908 908 # calls. This is important for logging, user scripting, and more.
909 909
910 910 # We are basically exposing, via normal python functions, the three
911 911 # mechanisms in which ipython offers special call modes (magics for
912 912 # internal control, aliases for direct system access via pre-selected
913 913 # names, and !cmd for calling arbitrary system commands).
914 914
915 915 def ipmagic(self,arg_s):
916 916 """Call a magic function by name.
917 917
918 918 Input: a string containing the name of the magic function to call and any
919 919 additional arguments to be passed to the magic.
920 920
921 921 ipmagic('name -opt foo bar') is equivalent to typing at the ipython
922 922 prompt:
923 923
924 924 In[1]: %name -opt foo bar
925 925
926 926 To call a magic without arguments, simply use ipmagic('name').
927 927
928 928 This provides a proper Python function to call IPython's magics in any
929 929 valid Python code you can type at the interpreter, including loops and
930 930 compound statements. It is added by IPython to the Python builtin
931 931 namespace upon initialization."""
932 932
933 933 args = arg_s.split(' ',1)
934 934 magic_name = args[0]
935 935 magic_name = magic_name.lstrip(self.ESC_MAGIC)
936 936
937 937 try:
938 938 magic_args = args[1]
939 939 except IndexError:
940 940 magic_args = ''
941 941 fn = getattr(self,'magic_'+magic_name,None)
942 942 if fn is None:
943 943 error("Magic function `%s` not found." % magic_name)
944 944 else:
945 945 magic_args = self.var_expand(magic_args,1)
946 946 return fn(magic_args)
947 947
948 948 def ipalias(self,arg_s):
949 949 """Call an alias by name.
950 950
951 951 Input: a string containing the name of the alias to call and any
952 952 additional arguments to be passed to the magic.
953 953
954 954 ipalias('name -opt foo bar') is equivalent to typing at the ipython
955 955 prompt:
956 956
957 957 In[1]: name -opt foo bar
958 958
959 959 To call an alias without arguments, simply use ipalias('name').
960 960
961 961 This provides a proper Python function to call IPython's aliases in any
962 962 valid Python code you can type at the interpreter, including loops and
963 963 compound statements. It is added by IPython to the Python builtin
964 964 namespace upon initialization."""
965 965
966 966 args = arg_s.split(' ',1)
967 967 alias_name = args[0]
968 968 try:
969 969 alias_args = args[1]
970 970 except IndexError:
971 971 alias_args = ''
972 972 if alias_name in self.alias_table:
973 973 self.call_alias(alias_name,alias_args)
974 974 else:
975 975 error("Alias `%s` not found." % alias_name)
976 976
977 977 def ipsystem(self,arg_s):
978 978 """Make a system call, using IPython."""
979 979
980 980 self.system(arg_s)
981 981
982 982 def complete(self,text):
983 983 """Return a sorted list of all possible completions on text.
984 984
985 985 Inputs:
986 986
987 987 - text: a string of text to be completed on.
988 988
989 989 This is a wrapper around the completion mechanism, similar to what
990 990 readline does at the command line when the TAB key is hit. By
991 991 exposing it as a method, it can be used by other non-readline
992 992 environments (such as GUIs) for text completion.
993 993
994 994 Simple usage example:
995 995
996 996 In [1]: x = 'hello'
997 997
998 998 In [2]: __IP.complete('x.l')
999 999 Out[2]: ['x.ljust', 'x.lower', 'x.lstrip']"""
1000 1000
1001 1001 complete = self.Completer.complete
1002 1002 state = 0
1003 1003 # use a dict so we get unique keys, since ipyhton's multiple
1004 1004 # completers can return duplicates. When we make 2.4 a requirement,
1005 1005 # start using sets instead, which are faster.
1006 1006 comps = {}
1007 1007 while True:
1008 1008 newcomp = complete(text,state,line_buffer=text)
1009 1009 if newcomp is None:
1010 1010 break
1011 1011 comps[newcomp] = 1
1012 1012 state += 1
1013 1013 outcomps = comps.keys()
1014 1014 outcomps.sort()
1015 1015 return outcomps
1016 1016
1017 1017 def set_completer_frame(self, frame=None):
1018 1018 if frame:
1019 1019 self.Completer.namespace = frame.f_locals
1020 1020 self.Completer.global_namespace = frame.f_globals
1021 1021 else:
1022 1022 self.Completer.namespace = self.user_ns
1023 1023 self.Completer.global_namespace = self.user_global_ns
1024 1024
1025 1025 def init_auto_alias(self):
1026 1026 """Define some aliases automatically.
1027 1027
1028 1028 These are ALL parameter-less aliases"""
1029 1029
1030 1030 for alias,cmd in self.auto_alias:
1031 1031 self.getapi().defalias(alias,cmd)
1032 1032
1033 1033
1034 1034 def alias_table_validate(self,verbose=0):
1035 1035 """Update information about the alias table.
1036 1036
1037 1037 In particular, make sure no Python keywords/builtins are in it."""
1038 1038
1039 1039 no_alias = self.no_alias
1040 1040 for k in self.alias_table.keys():
1041 1041 if k in no_alias:
1042 1042 del self.alias_table[k]
1043 1043 if verbose:
1044 1044 print ("Deleting alias <%s>, it's a Python "
1045 1045 "keyword or builtin." % k)
1046 1046
1047 1047 def set_autoindent(self,value=None):
1048 1048 """Set the autoindent flag, checking for readline support.
1049 1049
1050 1050 If called with no arguments, it acts as a toggle."""
1051 1051
1052 1052 if not self.has_readline:
1053 1053 if os.name == 'posix':
1054 1054 warn("The auto-indent feature requires the readline library")
1055 1055 self.autoindent = 0
1056 1056 return
1057 1057 if value is None:
1058 1058 self.autoindent = not self.autoindent
1059 1059 else:
1060 1060 self.autoindent = value
1061 1061
1062 1062 def rc_set_toggle(self,rc_field,value=None):
1063 1063 """Set or toggle a field in IPython's rc config. structure.
1064 1064
1065 1065 If called with no arguments, it acts as a toggle.
1066 1066
1067 1067 If called with a non-existent field, the resulting AttributeError
1068 1068 exception will propagate out."""
1069 1069
1070 1070 rc_val = getattr(self.rc,rc_field)
1071 1071 if value is None:
1072 1072 value = not rc_val
1073 1073 setattr(self.rc,rc_field,value)
1074 1074
1075 1075 def user_setup(self,ipythondir,rc_suffix,mode='install'):
1076 1076 """Install the user configuration directory.
1077 1077
1078 1078 Can be called when running for the first time or to upgrade the user's
1079 1079 .ipython/ directory with the mode parameter. Valid modes are 'install'
1080 1080 and 'upgrade'."""
1081 1081
1082 1082 def wait():
1083 1083 try:
1084 1084 raw_input("Please press <RETURN> to start IPython.")
1085 1085 except EOFError:
1086 1086 print >> Term.cout
1087 1087 print '*'*70
1088 1088
1089 1089 cwd = os.getcwd() # remember where we started
1090 1090 glb = glob.glob
1091 1091 print '*'*70
1092 1092 if mode == 'install':
1093 1093 print \
1094 1094 """Welcome to IPython. I will try to create a personal configuration directory
1095 1095 where you can customize many aspects of IPython's functionality in:\n"""
1096 1096 else:
1097 1097 print 'I am going to upgrade your configuration in:'
1098 1098
1099 1099 print ipythondir
1100 1100
1101 1101 rcdirend = os.path.join('IPython','UserConfig')
1102 1102 cfg = lambda d: os.path.join(d,rcdirend)
1103 1103 try:
1104 1104 rcdir = filter(os.path.isdir,map(cfg,sys.path))[0]
1105 1105 except IOError:
1106 1106 warning = """
1107 1107 Installation error. IPython's directory was not found.
1108 1108
1109 1109 Check the following:
1110 1110
1111 1111 The ipython/IPython directory should be in a directory belonging to your
1112 1112 PYTHONPATH environment variable (that is, it should be in a directory
1113 1113 belonging to sys.path). You can copy it explicitly there or just link to it.
1114 1114
1115 1115 IPython will proceed with builtin defaults.
1116 1116 """
1117 1117 warn(warning)
1118 1118 wait()
1119 1119 return
1120 1120
1121 1121 if mode == 'install':
1122 1122 try:
1123 1123 shutil.copytree(rcdir,ipythondir)
1124 1124 os.chdir(ipythondir)
1125 1125 rc_files = glb("ipythonrc*")
1126 1126 for rc_file in rc_files:
1127 1127 os.rename(rc_file,rc_file+rc_suffix)
1128 1128 except:
1129 1129 warning = """
1130 1130
1131 1131 There was a problem with the installation:
1132 1132 %s
1133 1133 Try to correct it or contact the developers if you think it's a bug.
1134 1134 IPython will proceed with builtin defaults.""" % sys.exc_info()[1]
1135 1135 warn(warning)
1136 1136 wait()
1137 1137 return
1138 1138
1139 1139 elif mode == 'upgrade':
1140 1140 try:
1141 1141 os.chdir(ipythondir)
1142 1142 except:
1143 1143 print """
1144 1144 Can not upgrade: changing to directory %s failed. Details:
1145 1145 %s
1146 1146 """ % (ipythondir,sys.exc_info()[1])
1147 1147 wait()
1148 1148 return
1149 1149 else:
1150 1150 sources = glb(os.path.join(rcdir,'[A-Za-z]*'))
1151 1151 for new_full_path in sources:
1152 1152 new_filename = os.path.basename(new_full_path)
1153 1153 if new_filename.startswith('ipythonrc'):
1154 1154 new_filename = new_filename + rc_suffix
1155 1155 # The config directory should only contain files, skip any
1156 1156 # directories which may be there (like CVS)
1157 1157 if os.path.isdir(new_full_path):
1158 1158 continue
1159 1159 if os.path.exists(new_filename):
1160 1160 old_file = new_filename+'.old'
1161 1161 if os.path.exists(old_file):
1162 1162 os.remove(old_file)
1163 1163 os.rename(new_filename,old_file)
1164 1164 shutil.copy(new_full_path,new_filename)
1165 1165 else:
1166 1166 raise ValueError,'unrecognized mode for install:',`mode`
1167 1167
1168 1168 # Fix line-endings to those native to each platform in the config
1169 1169 # directory.
1170 1170 try:
1171 1171 os.chdir(ipythondir)
1172 1172 except:
1173 1173 print """
1174 1174 Problem: changing to directory %s failed.
1175 1175 Details:
1176 1176 %s
1177 1177
1178 1178 Some configuration files may have incorrect line endings. This should not
1179 1179 cause any problems during execution. """ % (ipythondir,sys.exc_info()[1])
1180 1180 wait()
1181 1181 else:
1182 1182 for fname in glb('ipythonrc*'):
1183 1183 try:
1184 1184 native_line_ends(fname,backup=0)
1185 1185 except IOError:
1186 1186 pass
1187 1187
1188 1188 if mode == 'install':
1189 1189 print """
1190 1190 Successful installation!
1191 1191
1192 1192 Please read the sections 'Initial Configuration' and 'Quick Tips' in the
1193 1193 IPython manual (there are both HTML and PDF versions supplied with the
1194 1194 distribution) to make sure that your system environment is properly configured
1195 1195 to take advantage of IPython's features.
1196 1196
1197 1197 Important note: the configuration system has changed! The old system is
1198 1198 still in place, but its setting may be partly overridden by the settings in
1199 1199 "~/.ipython/ipy_user_conf.py" config file. Please take a look at the file
1200 1200 if some of the new settings bother you.
1201 1201
1202 1202 """
1203 1203 else:
1204 1204 print """
1205 1205 Successful upgrade!
1206 1206
1207 1207 All files in your directory:
1208 1208 %(ipythondir)s
1209 1209 which would have been overwritten by the upgrade were backed up with a .old
1210 1210 extension. If you had made particular customizations in those files you may
1211 1211 want to merge them back into the new files.""" % locals()
1212 1212 wait()
1213 1213 os.chdir(cwd)
1214 1214 # end user_setup()
1215 1215
1216 1216 def atexit_operations(self):
1217 1217 """This will be executed at the time of exit.
1218 1218
1219 1219 Saving of persistent data should be performed here. """
1220 1220
1221 1221 #print '*** IPython exit cleanup ***' # dbg
1222 1222 # input history
1223 1223 self.savehist()
1224 1224
1225 1225 # Cleanup all tempfiles left around
1226 1226 for tfile in self.tempfiles:
1227 1227 try:
1228 1228 os.unlink(tfile)
1229 1229 except OSError:
1230 1230 pass
1231 1231
1232 1232 self.hooks.shutdown_hook()
1233 1233
1234 1234 def savehist(self):
1235 1235 """Save input history to a file (via readline library)."""
1236 1236 try:
1237 1237 self.readline.write_history_file(self.histfile)
1238 1238 except:
1239 1239 print 'Unable to save IPython command history to file: ' + \
1240 1240 `self.histfile`
1241 1241
1242 1242 def reloadhist(self):
1243 1243 """Reload the input history from disk file."""
1244 1244
1245 1245 if self.has_readline:
1246 1246 self.readline.clear_history()
1247 1247 self.readline.read_history_file(self.shell.histfile)
1248 1248
1249 1249 def history_saving_wrapper(self, func):
1250 1250 """ Wrap func for readline history saving
1251 1251
1252 1252 Convert func into callable that saves & restores
1253 1253 history around the call """
1254 1254
1255 1255 if not self.has_readline:
1256 1256 return func
1257 1257
1258 1258 def wrapper():
1259 1259 self.savehist()
1260 1260 try:
1261 1261 func()
1262 1262 finally:
1263 1263 readline.read_history_file(self.histfile)
1264 1264 return wrapper
1265 1265
1266 1266
1267 1267 def pre_readline(self):
1268 1268 """readline hook to be used at the start of each line.
1269 1269
1270 1270 Currently it handles auto-indent only."""
1271 1271
1272 1272 #debugx('self.indent_current_nsp','pre_readline:')
1273 1273
1274 1274 if self.rl_do_indent:
1275 1275 self.readline.insert_text(self.indent_current_str())
1276 1276 if self.rl_next_input is not None:
1277 1277 self.readline.insert_text(self.rl_next_input)
1278 1278 self.rl_next_input = None
1279 1279
1280 1280 def init_readline(self):
1281 1281 """Command history completion/saving/reloading."""
1282 1282
1283 1283
1284 1284 import IPython.rlineimpl as readline
1285 1285
1286 1286 if not readline.have_readline:
1287 1287 self.has_readline = 0
1288 1288 self.readline = None
1289 1289 # no point in bugging windows users with this every time:
1290 1290 warn('Readline services not available on this platform.')
1291 1291 else:
1292 1292 sys.modules['readline'] = readline
1293 1293 import atexit
1294 1294 from IPython.completer import IPCompleter
1295 1295 self.Completer = IPCompleter(self,
1296 1296 self.user_ns,
1297 1297 self.user_global_ns,
1298 1298 self.rc.readline_omit__names,
1299 1299 self.alias_table)
1300 1300 sdisp = self.strdispatchers.get('complete_command', StrDispatch())
1301 1301 self.strdispatchers['complete_command'] = sdisp
1302 1302 self.Completer.custom_completers = sdisp
1303 1303 # Platform-specific configuration
1304 1304 if os.name == 'nt':
1305 1305 self.readline_startup_hook = readline.set_pre_input_hook
1306 1306 else:
1307 1307 self.readline_startup_hook = readline.set_startup_hook
1308 1308
1309 1309 # Load user's initrc file (readline config)
1310 1310 inputrc_name = os.environ.get('INPUTRC')
1311 1311 if inputrc_name is None:
1312 1312 home_dir = get_home_dir()
1313 1313 if home_dir is not None:
1314 1314 inputrc_name = os.path.join(home_dir,'.inputrc')
1315 1315 if os.path.isfile(inputrc_name):
1316 1316 try:
1317 1317 readline.read_init_file(inputrc_name)
1318 1318 except:
1319 1319 warn('Problems reading readline initialization file <%s>'
1320 1320 % inputrc_name)
1321 1321
1322 1322 self.has_readline = 1
1323 1323 self.readline = readline
1324 1324 # save this in sys so embedded copies can restore it properly
1325 1325 sys.ipcompleter = self.Completer.complete
1326 1326 self.set_completer()
1327 1327
1328 1328 # Configure readline according to user's prefs
1329 1329 for rlcommand in self.rc.readline_parse_and_bind:
1330 1330 readline.parse_and_bind(rlcommand)
1331 1331
1332 1332 # remove some chars from the delimiters list
1333 1333 delims = readline.get_completer_delims()
1334 1334 delims = delims.translate(string._idmap,
1335 1335 self.rc.readline_remove_delims)
1336 1336 readline.set_completer_delims(delims)
1337 1337 # otherwise we end up with a monster history after a while:
1338 1338 readline.set_history_length(1000)
1339 1339 try:
1340 1340 #print '*** Reading readline history' # dbg
1341 1341 readline.read_history_file(self.histfile)
1342 1342 except IOError:
1343 1343 pass # It doesn't exist yet.
1344 1344
1345 1345 atexit.register(self.atexit_operations)
1346 1346 del atexit
1347 1347
1348 1348 # Configure auto-indent for all platforms
1349 1349 self.set_autoindent(self.rc.autoindent)
1350 1350
1351 1351 def ask_yes_no(self,prompt,default=True):
1352 1352 if self.rc.quiet:
1353 1353 return True
1354 1354 return ask_yes_no(prompt,default)
1355 1355
1356 1356 def _should_recompile(self,e):
1357 1357 """Utility routine for edit_syntax_error"""
1358 1358
1359 1359 if e.filename in ('<ipython console>','<input>','<string>',
1360 1360 '<console>','<BackgroundJob compilation>',
1361 1361 None):
1362 1362
1363 1363 return False
1364 1364 try:
1365 1365 if (self.rc.autoedit_syntax and
1366 1366 not self.ask_yes_no('Return to editor to correct syntax error? '
1367 1367 '[Y/n] ','y')):
1368 1368 return False
1369 1369 except EOFError:
1370 1370 return False
1371 1371
1372 1372 def int0(x):
1373 1373 try:
1374 1374 return int(x)
1375 1375 except TypeError:
1376 1376 return 0
1377 1377 # always pass integer line and offset values to editor hook
1378 1378 self.hooks.fix_error_editor(e.filename,
1379 1379 int0(e.lineno),int0(e.offset),e.msg)
1380 1380 return True
1381 1381
1382 1382 def edit_syntax_error(self):
1383 1383 """The bottom half of the syntax error handler called in the main loop.
1384 1384
1385 1385 Loop until syntax error is fixed or user cancels.
1386 1386 """
1387 1387
1388 1388 while self.SyntaxTB.last_syntax_error:
1389 1389 # copy and clear last_syntax_error
1390 1390 err = self.SyntaxTB.clear_err_state()
1391 1391 if not self._should_recompile(err):
1392 1392 return
1393 1393 try:
1394 1394 # may set last_syntax_error again if a SyntaxError is raised
1395 1395 self.safe_execfile(err.filename,self.user_ns)
1396 1396 except:
1397 1397 self.showtraceback()
1398 1398 else:
1399 1399 try:
1400 1400 f = file(err.filename)
1401 1401 try:
1402 1402 sys.displayhook(f.read())
1403 1403 finally:
1404 1404 f.close()
1405 1405 except:
1406 1406 self.showtraceback()
1407 1407
1408 1408 def showsyntaxerror(self, filename=None):
1409 1409 """Display the syntax error that just occurred.
1410 1410
1411 1411 This doesn't display a stack trace because there isn't one.
1412 1412
1413 1413 If a filename is given, it is stuffed in the exception instead
1414 1414 of what was there before (because Python's parser always uses
1415 1415 "<string>" when reading from a string).
1416 1416 """
1417 1417 etype, value, last_traceback = sys.exc_info()
1418 1418
1419 1419 # See note about these variables in showtraceback() below
1420 1420 sys.last_type = etype
1421 1421 sys.last_value = value
1422 1422 sys.last_traceback = last_traceback
1423 1423
1424 1424 if filename and etype is SyntaxError:
1425 1425 # Work hard to stuff the correct filename in the exception
1426 1426 try:
1427 1427 msg, (dummy_filename, lineno, offset, line) = value
1428 1428 except:
1429 1429 # Not the format we expect; leave it alone
1430 1430 pass
1431 1431 else:
1432 1432 # Stuff in the right filename
1433 1433 try:
1434 1434 # Assume SyntaxError is a class exception
1435 1435 value = SyntaxError(msg, (filename, lineno, offset, line))
1436 1436 except:
1437 1437 # If that failed, assume SyntaxError is a string
1438 1438 value = msg, (filename, lineno, offset, line)
1439 1439 self.SyntaxTB(etype,value,[])
1440 1440
1441 1441 def debugger(self,force=False):
1442 1442 """Call the pydb/pdb debugger.
1443 1443
1444 1444 Keywords:
1445 1445
1446 1446 - force(False): by default, this routine checks the instance call_pdb
1447 1447 flag and does not actually invoke the debugger if the flag is false.
1448 1448 The 'force' option forces the debugger to activate even if the flag
1449 1449 is false.
1450 1450 """
1451 1451
1452 1452 if not (force or self.call_pdb):
1453 1453 return
1454 1454
1455 1455 if not hasattr(sys,'last_traceback'):
1456 1456 error('No traceback has been produced, nothing to debug.')
1457 1457 return
1458 1458
1459 1459 # use pydb if available
1460 1460 if Debugger.has_pydb:
1461 1461 from pydb import pm
1462 1462 else:
1463 1463 # fallback to our internal debugger
1464 1464 pm = lambda : self.InteractiveTB.debugger(force=True)
1465 1465 self.history_saving_wrapper(pm)()
1466 1466
1467 1467 def showtraceback(self,exc_tuple = None,filename=None,tb_offset=None):
1468 1468 """Display the exception that just occurred.
1469 1469
1470 1470 If nothing is known about the exception, this is the method which
1471 1471 should be used throughout the code for presenting user tracebacks,
1472 1472 rather than directly invoking the InteractiveTB object.
1473 1473
1474 1474 A specific showsyntaxerror() also exists, but this method can take
1475 1475 care of calling it if needed, so unless you are explicitly catching a
1476 1476 SyntaxError exception, don't try to analyze the stack manually and
1477 1477 simply call this method."""
1478 1478
1479 1479
1480 1480 # Though this won't be called by syntax errors in the input line,
1481 1481 # there may be SyntaxError cases whith imported code.
1482 1482
1483 1483
1484 1484 if exc_tuple is None:
1485 1485 etype, value, tb = sys.exc_info()
1486 1486 else:
1487 1487 etype, value, tb = exc_tuple
1488 1488
1489 1489 if etype is SyntaxError:
1490 1490 self.showsyntaxerror(filename)
1491 1491 else:
1492 1492 # WARNING: these variables are somewhat deprecated and not
1493 1493 # necessarily safe to use in a threaded environment, but tools
1494 1494 # like pdb depend on their existence, so let's set them. If we
1495 1495 # find problems in the field, we'll need to revisit their use.
1496 1496 sys.last_type = etype
1497 1497 sys.last_value = value
1498 1498 sys.last_traceback = tb
1499 1499
1500 1500 if etype in self.custom_exceptions:
1501 1501 self.CustomTB(etype,value,tb)
1502 1502 else:
1503 1503 self.InteractiveTB(etype,value,tb,tb_offset=tb_offset)
1504 1504 if self.InteractiveTB.call_pdb and self.has_readline:
1505 1505 # pdb mucks up readline, fix it back
1506 1506 self.set_completer()
1507 1507
1508 1508
1509 1509 def mainloop(self,banner=None):
1510 1510 """Creates the local namespace and starts the mainloop.
1511 1511
1512 1512 If an optional banner argument is given, it will override the
1513 1513 internally created default banner."""
1514 1514
1515 1515 if self.rc.c: # Emulate Python's -c option
1516 1516 self.exec_init_cmd()
1517 1517 if banner is None:
1518 1518 if not self.rc.banner:
1519 1519 banner = ''
1520 1520 # banner is string? Use it directly!
1521 1521 elif isinstance(self.rc.banner,basestring):
1522 1522 banner = self.rc.banner
1523 1523 else:
1524 1524 banner = self.BANNER+self.banner2
1525 1525
1526 1526 self.interact(banner)
1527 1527
1528 1528 def exec_init_cmd(self):
1529 1529 """Execute a command given at the command line.
1530 1530
1531 1531 This emulates Python's -c option."""
1532 1532
1533 1533 #sys.argv = ['-c']
1534 1534 self.push(self.prefilter(self.rc.c, False))
1535 1535 if not self.rc.interact:
1536 1536 self.exit_now = True
1537 1537
1538 1538 def embed_mainloop(self,header='',local_ns=None,global_ns=None,stack_depth=0):
1539 1539 """Embeds IPython into a running python program.
1540 1540
1541 1541 Input:
1542 1542
1543 1543 - header: An optional header message can be specified.
1544 1544
1545 1545 - local_ns, global_ns: working namespaces. If given as None, the
1546 1546 IPython-initialized one is updated with __main__.__dict__, so that
1547 1547 program variables become visible but user-specific configuration
1548 1548 remains possible.
1549 1549
1550 1550 - stack_depth: specifies how many levels in the stack to go to
1551 1551 looking for namespaces (when local_ns and global_ns are None). This
1552 1552 allows an intermediate caller to make sure that this function gets
1553 1553 the namespace from the intended level in the stack. By default (0)
1554 1554 it will get its locals and globals from the immediate caller.
1555 1555
1556 1556 Warning: it's possible to use this in a program which is being run by
1557 1557 IPython itself (via %run), but some funny things will happen (a few
1558 1558 globals get overwritten). In the future this will be cleaned up, as
1559 1559 there is no fundamental reason why it can't work perfectly."""
1560 1560
1561 1561 # Get locals and globals from caller
1562 1562 if local_ns is None or global_ns is None:
1563 1563 call_frame = sys._getframe(stack_depth).f_back
1564 1564
1565 1565 if local_ns is None:
1566 1566 local_ns = call_frame.f_locals
1567 1567 if global_ns is None:
1568 1568 global_ns = call_frame.f_globals
1569 1569
1570 1570 # Update namespaces and fire up interpreter
1571 1571
1572 1572 # The global one is easy, we can just throw it in
1573 1573 self.user_global_ns = global_ns
1574 1574
1575 1575 # but the user/local one is tricky: ipython needs it to store internal
1576 1576 # data, but we also need the locals. We'll copy locals in the user
1577 1577 # one, but will track what got copied so we can delete them at exit.
1578 1578 # This is so that a later embedded call doesn't see locals from a
1579 1579 # previous call (which most likely existed in a separate scope).
1580 1580 local_varnames = local_ns.keys()
1581 1581 self.user_ns.update(local_ns)
1582 1582
1583 1583 # Patch for global embedding to make sure that things don't overwrite
1584 1584 # user globals accidentally. Thanks to Richard <rxe@renre-europe.com>
1585 1585 # FIXME. Test this a bit more carefully (the if.. is new)
1586 1586 if local_ns is None and global_ns is None:
1587 1587 self.user_global_ns.update(__main__.__dict__)
1588 1588
1589 1589 # make sure the tab-completer has the correct frame information, so it
1590 1590 # actually completes using the frame's locals/globals
1591 1591 self.set_completer_frame()
1592 1592
1593 1593 # before activating the interactive mode, we need to make sure that
1594 1594 # all names in the builtin namespace needed by ipython point to
1595 1595 # ourselves, and not to other instances.
1596 1596 self.add_builtins()
1597 1597
1598 1598 self.interact(header)
1599 1599
1600 1600 # now, purge out the user namespace from anything we might have added
1601 1601 # from the caller's local namespace
1602 1602 delvar = self.user_ns.pop
1603 1603 for var in local_varnames:
1604 1604 delvar(var,None)
1605 1605 # and clean builtins we may have overridden
1606 1606 self.clean_builtins()
1607 1607
1608 1608 def interact(self, banner=None):
1609 1609 """Closely emulate the interactive Python console.
1610 1610
1611 1611 The optional banner argument specify the banner to print
1612 1612 before the first interaction; by default it prints a banner
1613 1613 similar to the one printed by the real Python interpreter,
1614 1614 followed by the current class name in parentheses (so as not
1615 1615 to confuse this with the real interpreter -- since it's so
1616 1616 close!).
1617 1617
1618 1618 """
1619 1619
1620 1620 if self.exit_now:
1621 1621 # batch run -> do not interact
1622 1622 return
1623 1623 cprt = 'Type "copyright", "credits" or "license" for more information.'
1624 1624 if banner is None:
1625 1625 self.write("Python %s on %s\n%s\n(%s)\n" %
1626 1626 (sys.version, sys.platform, cprt,
1627 1627 self.__class__.__name__))
1628 1628 else:
1629 1629 self.write(banner)
1630 1630
1631 1631 more = 0
1632 1632
1633 1633 # Mark activity in the builtins
1634 1634 __builtin__.__dict__['__IPYTHON__active'] += 1
1635 1635
1636 1636 if self.has_readline:
1637 1637 self.readline_startup_hook(self.pre_readline)
1638 1638 # exit_now is set by a call to %Exit or %Quit
1639 1639
1640 1640 while not self.exit_now:
1641 1641 if more:
1642 1642 prompt = self.hooks.generate_prompt(True)
1643 1643 if self.autoindent:
1644 1644 self.rl_do_indent = True
1645 1645
1646 1646 else:
1647 1647 prompt = self.hooks.generate_prompt(False)
1648 1648 try:
1649 1649 line = self.raw_input(prompt,more)
1650 1650 if self.exit_now:
1651 1651 # quick exit on sys.std[in|out] close
1652 1652 break
1653 1653 if self.autoindent:
1654 1654 self.rl_do_indent = False
1655 1655
1656 1656 except KeyboardInterrupt:
1657 1657 self.write('\nKeyboardInterrupt\n')
1658 1658 self.resetbuffer()
1659 1659 # keep cache in sync with the prompt counter:
1660 1660 self.outputcache.prompt_count -= 1
1661 1661
1662 1662 if self.autoindent:
1663 1663 self.indent_current_nsp = 0
1664 1664 more = 0
1665 1665 except EOFError:
1666 1666 if self.autoindent:
1667 1667 self.rl_do_indent = False
1668 1668 self.readline_startup_hook(None)
1669 1669 self.write('\n')
1670 1670 self.exit()
1671 1671 except bdb.BdbQuit:
1672 1672 warn('The Python debugger has exited with a BdbQuit exception.\n'
1673 1673 'Because of how pdb handles the stack, it is impossible\n'
1674 1674 'for IPython to properly format this particular exception.\n'
1675 1675 'IPython will resume normal operation.')
1676 1676 except:
1677 1677 # exceptions here are VERY RARE, but they can be triggered
1678 1678 # asynchronously by signal handlers, for example.
1679 1679 self.showtraceback()
1680 1680 else:
1681 1681 more = self.push(line)
1682 1682 if (self.SyntaxTB.last_syntax_error and
1683 1683 self.rc.autoedit_syntax):
1684 1684 self.edit_syntax_error()
1685 1685
1686 1686 # We are off again...
1687 1687 __builtin__.__dict__['__IPYTHON__active'] -= 1
1688 1688
1689 1689 def excepthook(self, etype, value, tb):
1690 1690 """One more defense for GUI apps that call sys.excepthook.
1691 1691
1692 1692 GUI frameworks like wxPython trap exceptions and call
1693 1693 sys.excepthook themselves. I guess this is a feature that
1694 1694 enables them to keep running after exceptions that would
1695 1695 otherwise kill their mainloop. This is a bother for IPython
1696 1696 which excepts to catch all of the program exceptions with a try:
1697 1697 except: statement.
1698 1698
1699 1699 Normally, IPython sets sys.excepthook to a CrashHandler instance, so if
1700 1700 any app directly invokes sys.excepthook, it will look to the user like
1701 1701 IPython crashed. In order to work around this, we can disable the
1702 1702 CrashHandler and replace it with this excepthook instead, which prints a
1703 1703 regular traceback using our InteractiveTB. In this fashion, apps which
1704 1704 call sys.excepthook will generate a regular-looking exception from
1705 1705 IPython, and the CrashHandler will only be triggered by real IPython
1706 1706 crashes.
1707 1707
1708 1708 This hook should be used sparingly, only in places which are not likely
1709 1709 to be true IPython errors.
1710 1710 """
1711 1711 self.showtraceback((etype,value,tb),tb_offset=0)
1712 1712
1713 1713 def expand_aliases(self,fn,rest):
1714 1714 """ Expand multiple levels of aliases:
1715 1715
1716 1716 if:
1717 1717
1718 1718 alias foo bar /tmp
1719 1719 alias baz foo
1720 1720
1721 1721 then:
1722 1722
1723 1723 baz huhhahhei -> bar /tmp huhhahhei
1724 1724
1725 1725 """
1726 1726 line = fn + " " + rest
1727 1727
1728 1728 done = Set()
1729 1729 while 1:
1730 1730 pre,fn,rest = prefilter.splitUserInput(line,
1731 1731 prefilter.shell_line_split)
1732 1732 if fn in self.alias_table:
1733 1733 if fn in done:
1734 1734 warn("Cyclic alias definition, repeated '%s'" % fn)
1735 1735 return ""
1736 1736 done.add(fn)
1737 1737
1738 1738 l2 = self.transform_alias(fn,rest)
1739 1739 # dir -> dir
1740 1740 # print "alias",line, "->",l2 #dbg
1741 1741 if l2 == line:
1742 1742 break
1743 1743 # ls -> ls -F should not recurse forever
1744 1744 if l2.split(None,1)[0] == line.split(None,1)[0]:
1745 1745 line = l2
1746 1746 break
1747 1747
1748 1748 line=l2
1749 1749
1750 1750
1751 1751 # print "al expand to",line #dbg
1752 1752 else:
1753 1753 break
1754 1754
1755 1755 return line
1756 1756
1757 1757 def transform_alias(self, alias,rest=''):
1758 1758 """ Transform alias to system command string.
1759 1759 """
1760 1760 trg = self.alias_table[alias]
1761 1761
1762 1762 nargs,cmd = trg
1763 1763 # print trg #dbg
1764 1764 if ' ' in cmd and os.path.isfile(cmd):
1765 1765 cmd = '"%s"' % cmd
1766 1766
1767 1767 # Expand the %l special to be the user's input line
1768 1768 if cmd.find('%l') >= 0:
1769 1769 cmd = cmd.replace('%l',rest)
1770 1770 rest = ''
1771 1771 if nargs==0:
1772 1772 # Simple, argument-less aliases
1773 1773 cmd = '%s %s' % (cmd,rest)
1774 1774 else:
1775 1775 # Handle aliases with positional arguments
1776 1776 args = rest.split(None,nargs)
1777 1777 if len(args)< nargs:
1778 1778 error('Alias <%s> requires %s arguments, %s given.' %
1779 1779 (alias,nargs,len(args)))
1780 1780 return None
1781 1781 cmd = '%s %s' % (cmd % tuple(args[:nargs]),' '.join(args[nargs:]))
1782 1782 # Now call the macro, evaluating in the user's namespace
1783 1783 #print 'new command: <%r>' % cmd # dbg
1784 1784 return cmd
1785 1785
1786 1786 def call_alias(self,alias,rest=''):
1787 1787 """Call an alias given its name and the rest of the line.
1788 1788
1789 1789 This is only used to provide backwards compatibility for users of
1790 1790 ipalias(), use of which is not recommended for anymore."""
1791 1791
1792 1792 # Now call the macro, evaluating in the user's namespace
1793 1793 cmd = self.transform_alias(alias, rest)
1794 1794 try:
1795 1795 self.system(cmd)
1796 1796 except:
1797 1797 self.showtraceback()
1798 1798
1799 1799 def indent_current_str(self):
1800 1800 """return the current level of indentation as a string"""
1801 1801 return self.indent_current_nsp * ' '
1802 1802
1803 1803 def autoindent_update(self,line):
1804 1804 """Keep track of the indent level."""
1805 1805
1806 1806 #debugx('line')
1807 1807 #debugx('self.indent_current_nsp')
1808 1808 if self.autoindent:
1809 1809 if line:
1810 1810 inisp = num_ini_spaces(line)
1811 1811 if inisp < self.indent_current_nsp:
1812 1812 self.indent_current_nsp = inisp
1813 1813
1814 1814 if line[-1] == ':':
1815 1815 self.indent_current_nsp += 4
1816 1816 elif dedent_re.match(line):
1817 1817 self.indent_current_nsp -= 4
1818 1818 else:
1819 1819 self.indent_current_nsp = 0
1820 1820 def runlines(self,lines):
1821 1821 """Run a string of one or more lines of source.
1822 1822
1823 1823 This method is capable of running a string containing multiple source
1824 1824 lines, as if they had been entered at the IPython prompt. Since it
1825 1825 exposes IPython's processing machinery, the given strings can contain
1826 1826 magic calls (%magic), special shell access (!cmd), etc."""
1827 1827
1828 1828 # We must start with a clean buffer, in case this is run from an
1829 1829 # interactive IPython session (via a magic, for example).
1830 1830 self.resetbuffer()
1831 1831 lines = lines.split('\n')
1832 1832 more = 0
1833 1833
1834 1834 for line in lines:
1835 1835 # skip blank lines so we don't mess up the prompt counter, but do
1836 1836 # NOT skip even a blank line if we are in a code block (more is
1837 1837 # true)
1838 1838
1839 1839
1840 1840 if line or more:
1841 1841 # push to raw history, so hist line numbers stay in sync
1842 1842 self.input_hist_raw.append("# " + line + "\n")
1843 1843 more = self.push(self.prefilter(line,more))
1844 1844 # IPython's runsource returns None if there was an error
1845 1845 # compiling the code. This allows us to stop processing right
1846 1846 # away, so the user gets the error message at the right place.
1847 1847 if more is None:
1848 1848 break
1849 1849 else:
1850 1850 self.input_hist_raw.append("\n")
1851 1851 # final newline in case the input didn't have it, so that the code
1852 1852 # actually does get executed
1853 1853 if more:
1854 1854 self.push('\n')
1855 1855
1856 1856 def runsource(self, source, filename='<input>', symbol='single'):
1857 1857 """Compile and run some source in the interpreter.
1858 1858
1859 1859 Arguments are as for compile_command().
1860 1860
1861 1861 One several things can happen:
1862 1862
1863 1863 1) The input is incorrect; compile_command() raised an
1864 1864 exception (SyntaxError or OverflowError). A syntax traceback
1865 1865 will be printed by calling the showsyntaxerror() method.
1866 1866
1867 1867 2) The input is incomplete, and more input is required;
1868 1868 compile_command() returned None. Nothing happens.
1869 1869
1870 1870 3) The input is complete; compile_command() returned a code
1871 1871 object. The code is executed by calling self.runcode() (which
1872 1872 also handles run-time exceptions, except for SystemExit).
1873 1873
1874 1874 The return value is:
1875 1875
1876 1876 - True in case 2
1877 1877
1878 1878 - False in the other cases, unless an exception is raised, where
1879 1879 None is returned instead. This can be used by external callers to
1880 1880 know whether to continue feeding input or not.
1881 1881
1882 1882 The return value can be used to decide whether to use sys.ps1 or
1883 1883 sys.ps2 to prompt the next line."""
1884 1884
1885 1885 # if the source code has leading blanks, add 'if 1:\n' to it
1886 1886 # this allows execution of indented pasted code. It is tempting
1887 1887 # to add '\n' at the end of source to run commands like ' a=1'
1888 1888 # directly, but this fails for more complicated scenarios
1889 1889 if source[:1] in [' ', '\t']:
1890 1890 source = 'if 1:\n%s' % source
1891 1891
1892 1892 try:
1893 1893 code = self.compile(source,filename,symbol)
1894 1894 except (OverflowError, SyntaxError, ValueError):
1895 1895 # Case 1
1896 1896 self.showsyntaxerror(filename)
1897 1897 return None
1898 1898
1899 1899 if code is None:
1900 1900 # Case 2
1901 1901 return True
1902 1902
1903 1903 # Case 3
1904 1904 # We store the code object so that threaded shells and
1905 1905 # custom exception handlers can access all this info if needed.
1906 1906 # The source corresponding to this can be obtained from the
1907 1907 # buffer attribute as '\n'.join(self.buffer).
1908 1908 self.code_to_run = code
1909 1909 # now actually execute the code object
1910 1910 if self.runcode(code) == 0:
1911 1911 return False
1912 1912 else:
1913 1913 return None
1914 1914
1915 1915 def runcode(self,code_obj):
1916 1916 """Execute a code object.
1917 1917
1918 1918 When an exception occurs, self.showtraceback() is called to display a
1919 1919 traceback.
1920 1920
1921 1921 Return value: a flag indicating whether the code to be run completed
1922 1922 successfully:
1923 1923
1924 1924 - 0: successful execution.
1925 1925 - 1: an error occurred.
1926 1926 """
1927 1927
1928 1928 # Set our own excepthook in case the user code tries to call it
1929 1929 # directly, so that the IPython crash handler doesn't get triggered
1930 1930 old_excepthook,sys.excepthook = sys.excepthook, self.excepthook
1931 1931
1932 1932 # we save the original sys.excepthook in the instance, in case config
1933 1933 # code (such as magics) needs access to it.
1934 1934 self.sys_excepthook = old_excepthook
1935 1935 outflag = 1 # happens in more places, so it's easier as default
1936 1936 try:
1937 1937 try:
1938 1938 # Embedded instances require separate global/local namespaces
1939 1939 # so they can see both the surrounding (local) namespace and
1940 1940 # the module-level globals when called inside another function.
1941 1941 if self.embedded:
1942 1942 exec code_obj in self.user_global_ns, self.user_ns
1943 1943 # Normal (non-embedded) instances should only have a single
1944 1944 # namespace for user code execution, otherwise functions won't
1945 1945 # see interactive top-level globals.
1946 1946 else:
1947 1947 exec code_obj in self.user_ns
1948 1948 finally:
1949 1949 # Reset our crash handler in place
1950 1950 sys.excepthook = old_excepthook
1951 1951 except SystemExit:
1952 1952 self.resetbuffer()
1953 1953 self.showtraceback()
1954 1954 warn("Type %exit or %quit to exit IPython "
1955 1955 "(%Exit or %Quit do so unconditionally).",level=1)
1956 1956 except self.custom_exceptions:
1957 1957 etype,value,tb = sys.exc_info()
1958 1958 self.CustomTB(etype,value,tb)
1959 1959 except:
1960 1960 self.showtraceback()
1961 1961 else:
1962 1962 outflag = 0
1963 1963 if softspace(sys.stdout, 0):
1964 1964 print
1965 1965 # Flush out code object which has been run (and source)
1966 1966 self.code_to_run = None
1967 1967 return outflag
1968 1968
1969 1969 def push(self, line):
1970 1970 """Push a line to the interpreter.
1971 1971
1972 1972 The line should not have a trailing newline; it may have
1973 1973 internal newlines. The line is appended to a buffer and the
1974 1974 interpreter's runsource() method is called with the
1975 1975 concatenated contents of the buffer as source. If this
1976 1976 indicates that the command was executed or invalid, the buffer
1977 1977 is reset; otherwise, the command is incomplete, and the buffer
1978 1978 is left as it was after the line was appended. The return
1979 1979 value is 1 if more input is required, 0 if the line was dealt
1980 1980 with in some way (this is the same as runsource()).
1981 1981 """
1982 1982
1983 1983 # autoindent management should be done here, and not in the
1984 1984 # interactive loop, since that one is only seen by keyboard input. We
1985 1985 # need this done correctly even for code run via runlines (which uses
1986 1986 # push).
1987 1987
1988 1988 #print 'push line: <%s>' % line # dbg
1989 1989 for subline in line.splitlines():
1990 1990 self.autoindent_update(subline)
1991 1991 self.buffer.append(line)
1992 1992 more = self.runsource('\n'.join(self.buffer), self.filename)
1993 1993 if not more:
1994 1994 self.resetbuffer()
1995 1995 return more
1996 1996
1997 1997 def split_user_input(self, line):
1998 1998 # This is really a hold-over to support ipapi and some extensions
1999 1999 return prefilter.splitUserInput(line)
2000 2000
2001 2001 def resetbuffer(self):
2002 2002 """Reset the input buffer."""
2003 2003 self.buffer[:] = []
2004 2004
2005 2005 def raw_input(self,prompt='',continue_prompt=False):
2006 2006 """Write a prompt and read a line.
2007 2007
2008 2008 The returned line does not include the trailing newline.
2009 2009 When the user enters the EOF key sequence, EOFError is raised.
2010 2010
2011 2011 Optional inputs:
2012 2012
2013 2013 - prompt(''): a string to be printed to prompt the user.
2014 2014
2015 2015 - continue_prompt(False): whether this line is the first one or a
2016 2016 continuation in a sequence of inputs.
2017 2017 """
2018 2018
2019 2019 # Code run by the user may have modified the readline completer state.
2020 2020 # We must ensure that our completer is back in place.
2021 2021 if self.has_readline:
2022 2022 self.set_completer()
2023 2023
2024 2024 try:
2025 2025 line = raw_input_original(prompt).decode(self.stdin_encoding)
2026 2026 except ValueError:
2027 2027 warn("\n********\nYou or a %run:ed script called sys.stdin.close()"
2028 2028 " or sys.stdout.close()!\nExiting IPython!")
2029 2029 self.exit_now = True
2030 2030 return ""
2031 2031
2032 2032 # Try to be reasonably smart about not re-indenting pasted input more
2033 2033 # than necessary. We do this by trimming out the auto-indent initial
2034 2034 # spaces, if the user's actual input started itself with whitespace.
2035 2035 #debugx('self.buffer[-1]')
2036 2036
2037 2037 if self.autoindent:
2038 2038 if num_ini_spaces(line) > self.indent_current_nsp:
2039 2039 line = line[self.indent_current_nsp:]
2040 2040 self.indent_current_nsp = 0
2041 2041
2042 2042 # store the unfiltered input before the user has any chance to modify
2043 2043 # it.
2044 2044 if line.strip():
2045 2045 if continue_prompt:
2046 2046 self.input_hist_raw[-1] += '%s\n' % line
2047 2047 if self.has_readline: # and some config option is set?
2048 2048 try:
2049 2049 histlen = self.readline.get_current_history_length()
2050 2050 newhist = self.input_hist_raw[-1].rstrip()
2051 2051 self.readline.remove_history_item(histlen-1)
2052 2052 self.readline.replace_history_item(histlen-2,newhist)
2053 2053 except AttributeError:
2054 2054 pass # re{move,place}_history_item are new in 2.4.
2055 2055 else:
2056 2056 self.input_hist_raw.append('%s\n' % line)
2057 2057 # only entries starting at first column go to shadow history
2058 2058 if line.lstrip() == line:
2059 2059 self.shadowhist.add(line.strip())
2060 2060 elif not continue_prompt:
2061 2061 self.input_hist_raw.append('\n')
2062 2062 try:
2063 2063 lineout = self.prefilter(line,continue_prompt)
2064 2064 except:
2065 2065 # blanket except, in case a user-defined prefilter crashes, so it
2066 2066 # can't take all of ipython with it.
2067 2067 self.showtraceback()
2068 2068 return ''
2069 2069 else:
2070 2070 return lineout
2071 2071
2072 2072 def _prefilter(self, line, continue_prompt):
2073 2073 """Calls different preprocessors, depending on the form of line."""
2074 2074
2075 2075 # All handlers *must* return a value, even if it's blank ('').
2076 2076
2077 2077 # Lines are NOT logged here. Handlers should process the line as
2078 2078 # needed, update the cache AND log it (so that the input cache array
2079 2079 # stays synced).
2080 2080
2081 2081 #.....................................................................
2082 2082 # Code begins
2083 2083
2084 2084 #if line.startswith('%crash'): raise RuntimeError,'Crash now!' # dbg
2085 2085
2086 2086 # save the line away in case we crash, so the post-mortem handler can
2087 2087 # record it
2088 2088 self._last_input_line = line
2089 2089
2090 2090 #print '***line: <%s>' % line # dbg
2091 2091
2092 2092 if not line:
2093 2093 # Return immediately on purely empty lines, so that if the user
2094 2094 # previously typed some whitespace that started a continuation
2095 2095 # prompt, he can break out of that loop with just an empty line.
2096 2096 # This is how the default python prompt works.
2097 2097
2098 2098 # Only return if the accumulated input buffer was just whitespace!
2099 2099 if ''.join(self.buffer).isspace():
2100 2100 self.buffer[:] = []
2101 2101 return ''
2102 2102
2103 2103 line_info = prefilter.LineInfo(line, continue_prompt)
2104 2104
2105 2105 # the input history needs to track even empty lines
2106 2106 stripped = line.strip()
2107 2107
2108 2108 if not stripped:
2109 2109 if not continue_prompt:
2110 2110 self.outputcache.prompt_count -= 1
2111 2111 return self.handle_normal(line_info)
2112 2112
2113 2113 # print '***cont',continue_prompt # dbg
2114 2114 # special handlers are only allowed for single line statements
2115 2115 if continue_prompt and not self.rc.multi_line_specials:
2116 2116 return self.handle_normal(line_info)
2117 2117
2118 2118
2119 2119 # See whether any pre-existing handler can take care of it
2120 2120 rewritten = self.hooks.input_prefilter(stripped)
2121 2121 if rewritten != stripped: # ok, some prefilter did something
2122 2122 rewritten = line_info.pre + rewritten # add indentation
2123 2123 return self.handle_normal(prefilter.LineInfo(rewritten,
2124 2124 continue_prompt))
2125 2125
2126 2126 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
2127 2127
2128 2128 return prefilter.prefilter(line_info, self)
2129 2129
2130 2130
2131 2131 def _prefilter_dumb(self, line, continue_prompt):
2132 2132 """simple prefilter function, for debugging"""
2133 2133 return self.handle_normal(line,continue_prompt)
2134 2134
2135 2135
2136 2136 def multiline_prefilter(self, line, continue_prompt):
2137 2137 """ Run _prefilter for each line of input
2138 2138
2139 2139 Covers cases where there are multiple lines in the user entry,
2140 2140 which is the case when the user goes back to a multiline history
2141 2141 entry and presses enter.
2142 2142
2143 2143 """
2144 2144 out = []
2145 2145 for l in line.rstrip('\n').split('\n'):
2146 2146 out.append(self._prefilter(l, continue_prompt))
2147 2147 return '\n'.join(out)
2148 2148
2149 2149 # Set the default prefilter() function (this can be user-overridden)
2150 2150 prefilter = multiline_prefilter
2151 2151
2152 2152 def handle_normal(self,line_info):
2153 2153 """Handle normal input lines. Use as a template for handlers."""
2154 2154
2155 2155 # With autoindent on, we need some way to exit the input loop, and I
2156 2156 # don't want to force the user to have to backspace all the way to
2157 2157 # clear the line. The rule will be in this case, that either two
2158 2158 # lines of pure whitespace in a row, or a line of pure whitespace but
2159 2159 # of a size different to the indent level, will exit the input loop.
2160 2160 line = line_info.line
2161 2161 continue_prompt = line_info.continue_prompt
2162 2162
2163 2163 if (continue_prompt and self.autoindent and line.isspace() and
2164 2164 (0 < abs(len(line) - self.indent_current_nsp) <= 2 or
2165 2165 (self.buffer[-1]).isspace() )):
2166 2166 line = ''
2167 2167
2168 2168 self.log(line,line,continue_prompt)
2169 2169 return line
2170 2170
2171 2171 def handle_alias(self,line_info):
2172 2172 """Handle alias input lines. """
2173 2173 tgt = self.alias_table[line_info.iFun]
2174 2174 # print "=>",tgt #dbg
2175 2175 if callable(tgt):
2176 2176 if '$' in line_info.line:
2177 call_meth = '(_ip.itpl(%s))'
2177 call_meth = '(_ip, _ip.itpl(%s))'
2178 2178 else:
2179 call_meth = '(%s)'
2179 call_meth = '(_ip,%s)'
2180 2180 line_out = ("%s_sh.%s" + call_meth) % (line_info.preWhitespace,
2181 2181 line_info.iFun,
2182 2182 make_quoted_expr(line_info.line))
2183 2183 else:
2184 2184 transformed = self.expand_aliases(line_info.iFun,line_info.theRest)
2185 2185
2186 2186 # pre is needed, because it carries the leading whitespace. Otherwise
2187 2187 # aliases won't work in indented sections.
2188 2188 line_out = '%s_ip.system(%s)' % (line_info.preWhitespace,
2189 2189 make_quoted_expr( transformed ))
2190 2190
2191 2191 self.log(line_info.line,line_out,line_info.continue_prompt)
2192 2192 #print 'line out:',line_out # dbg
2193 2193 return line_out
2194 2194
2195 2195 def handle_shell_escape(self, line_info):
2196 2196 """Execute the line in a shell, empty return value"""
2197 2197 #print 'line in :', `line` # dbg
2198 2198 line = line_info.line
2199 2199 if line.lstrip().startswith('!!'):
2200 2200 # rewrite LineInfo's line, iFun and theRest to properly hold the
2201 2201 # call to %sx and the actual command to be executed, so
2202 2202 # handle_magic can work correctly. Note that this works even if
2203 2203 # the line is indented, so it handles multi_line_specials
2204 2204 # properly.
2205 2205 new_rest = line.lstrip()[2:]
2206 2206 line_info.line = '%ssx %s' % (self.ESC_MAGIC,new_rest)
2207 2207 line_info.iFun = 'sx'
2208 2208 line_info.theRest = new_rest
2209 2209 return self.handle_magic(line_info)
2210 2210 else:
2211 2211 cmd = line.lstrip().lstrip('!')
2212 2212 line_out = '%s_ip.system(%s)' % (line_info.preWhitespace,
2213 2213 make_quoted_expr(cmd))
2214 2214 # update cache/log and return
2215 2215 self.log(line,line_out,line_info.continue_prompt)
2216 2216 return line_out
2217 2217
2218 2218 def handle_magic(self, line_info):
2219 2219 """Execute magic functions."""
2220 2220 iFun = line_info.iFun
2221 2221 theRest = line_info.theRest
2222 2222 cmd = '%s_ip.magic(%s)' % (line_info.preWhitespace,
2223 2223 make_quoted_expr(iFun + " " + theRest))
2224 2224 self.log(line_info.line,cmd,line_info.continue_prompt)
2225 2225 #print 'in handle_magic, cmd=<%s>' % cmd # dbg
2226 2226 return cmd
2227 2227
2228 2228 def handle_auto(self, line_info):
2229 2229 """Hande lines which can be auto-executed, quoting if requested."""
2230 2230
2231 2231 #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg
2232 2232 line = line_info.line
2233 2233 iFun = line_info.iFun
2234 2234 theRest = line_info.theRest
2235 2235 pre = line_info.pre
2236 2236 continue_prompt = line_info.continue_prompt
2237 2237 obj = line_info.ofind(self)['obj']
2238 2238
2239 2239 # This should only be active for single-line input!
2240 2240 if continue_prompt:
2241 2241 self.log(line,line,continue_prompt)
2242 2242 return line
2243 2243
2244 2244 force_auto = isinstance(obj, IPython.ipapi.IPyAutocall)
2245 2245 auto_rewrite = True
2246 2246
2247 2247 if pre == self.ESC_QUOTE:
2248 2248 # Auto-quote splitting on whitespace
2249 2249 newcmd = '%s("%s")' % (iFun,'", "'.join(theRest.split()) )
2250 2250 elif pre == self.ESC_QUOTE2:
2251 2251 # Auto-quote whole string
2252 2252 newcmd = '%s("%s")' % (iFun,theRest)
2253 2253 elif pre == self.ESC_PAREN:
2254 2254 newcmd = '%s(%s)' % (iFun,",".join(theRest.split()))
2255 2255 else:
2256 2256 # Auto-paren.
2257 2257 # We only apply it to argument-less calls if the autocall
2258 2258 # parameter is set to 2. We only need to check that autocall is <
2259 2259 # 2, since this function isn't called unless it's at least 1.
2260 2260 if not theRest and (self.rc.autocall < 2) and not force_auto:
2261 2261 newcmd = '%s %s' % (iFun,theRest)
2262 2262 auto_rewrite = False
2263 2263 else:
2264 2264 if not force_auto and theRest.startswith('['):
2265 2265 if hasattr(obj,'__getitem__'):
2266 2266 # Don't autocall in this case: item access for an object
2267 2267 # which is BOTH callable and implements __getitem__.
2268 2268 newcmd = '%s %s' % (iFun,theRest)
2269 2269 auto_rewrite = False
2270 2270 else:
2271 2271 # if the object doesn't support [] access, go ahead and
2272 2272 # autocall
2273 2273 newcmd = '%s(%s)' % (iFun.rstrip(),theRest)
2274 2274 elif theRest.endswith(';'):
2275 2275 newcmd = '%s(%s);' % (iFun.rstrip(),theRest[:-1])
2276 2276 else:
2277 2277 newcmd = '%s(%s)' % (iFun.rstrip(), theRest)
2278 2278
2279 2279 if auto_rewrite:
2280 2280 rw = self.outputcache.prompt1.auto_rewrite() + newcmd
2281 2281
2282 2282 try:
2283 2283 # plain ascii works better w/ pyreadline, on some machines, so
2284 2284 # we use it and only print uncolored rewrite if we have unicode
2285 2285 rw = str(rw)
2286 2286 print >>Term.cout, rw
2287 2287 except UnicodeEncodeError:
2288 2288 print "-------------->" + newcmd
2289 2289
2290 2290 # log what is now valid Python, not the actual user input (without the
2291 2291 # final newline)
2292 2292 self.log(line,newcmd,continue_prompt)
2293 2293 return newcmd
2294 2294
2295 2295 def handle_help(self, line_info):
2296 2296 """Try to get some help for the object.
2297 2297
2298 2298 obj? or ?obj -> basic information.
2299 2299 obj?? or ??obj -> more details.
2300 2300 """
2301 2301
2302 2302 line = line_info.line
2303 2303 # We need to make sure that we don't process lines which would be
2304 2304 # otherwise valid python, such as "x=1 # what?"
2305 2305 try:
2306 2306 codeop.compile_command(line)
2307 2307 except SyntaxError:
2308 2308 # We should only handle as help stuff which is NOT valid syntax
2309 2309 if line[0]==self.ESC_HELP:
2310 2310 line = line[1:]
2311 2311 elif line[-1]==self.ESC_HELP:
2312 2312 line = line[:-1]
2313 2313 self.log(line,'#?'+line,line_info.continue_prompt)
2314 2314 if line:
2315 2315 #print 'line:<%r>' % line # dbg
2316 2316 self.magic_pinfo(line)
2317 2317 else:
2318 2318 page(self.usage,screen_lines=self.rc.screen_length)
2319 2319 return '' # Empty string is needed here!
2320 2320 except:
2321 2321 # Pass any other exceptions through to the normal handler
2322 2322 return self.handle_normal(line_info)
2323 2323 else:
2324 2324 # If the code compiles ok, we should handle it normally
2325 2325 return self.handle_normal(line_info)
2326 2326
2327 2327 def getapi(self):
2328 2328 """ Get an IPApi object for this shell instance
2329 2329
2330 2330 Getting an IPApi object is always preferable to accessing the shell
2331 2331 directly, but this holds true especially for extensions.
2332 2332
2333 2333 It should always be possible to implement an extension with IPApi
2334 2334 alone. If not, contact maintainer to request an addition.
2335 2335
2336 2336 """
2337 2337 return self.api
2338 2338
2339 2339 def handle_emacs(self, line_info):
2340 2340 """Handle input lines marked by python-mode."""
2341 2341
2342 2342 # Currently, nothing is done. Later more functionality can be added
2343 2343 # here if needed.
2344 2344
2345 2345 # The input cache shouldn't be updated
2346 2346 return line_info.line
2347 2347
2348 2348
2349 2349 def mktempfile(self,data=None):
2350 2350 """Make a new tempfile and return its filename.
2351 2351
2352 2352 This makes a call to tempfile.mktemp, but it registers the created
2353 2353 filename internally so ipython cleans it up at exit time.
2354 2354
2355 2355 Optional inputs:
2356 2356
2357 2357 - data(None): if data is given, it gets written out to the temp file
2358 2358 immediately, and the file is closed again."""
2359 2359
2360 2360 filename = tempfile.mktemp('.py','ipython_edit_')
2361 2361 self.tempfiles.append(filename)
2362 2362
2363 2363 if data:
2364 2364 tmp_file = open(filename,'w')
2365 2365 tmp_file.write(data)
2366 2366 tmp_file.close()
2367 2367 return filename
2368 2368
2369 2369 def write(self,data):
2370 2370 """Write a string to the default output"""
2371 2371 Term.cout.write(data)
2372 2372
2373 2373 def write_err(self,data):
2374 2374 """Write a string to the default error output"""
2375 2375 Term.cerr.write(data)
2376 2376
2377 2377 def exit(self):
2378 2378 """Handle interactive exit.
2379 2379
2380 2380 This method sets the exit_now attribute."""
2381 2381
2382 2382 if self.rc.confirm_exit:
2383 2383 if self.ask_yes_no('Do you really want to exit ([y]/n)?','y'):
2384 2384 self.exit_now = True
2385 2385 else:
2386 2386 self.exit_now = True
2387 2387
2388 2388 def safe_execfile(self,fname,*where,**kw):
2389 2389 """A safe version of the builtin execfile().
2390 2390
2391 2391 This version will never throw an exception, and knows how to handle
2392 2392 ipython logs as well."""
2393 2393
2394 2394 def syspath_cleanup():
2395 2395 """Internal cleanup routine for sys.path."""
2396 2396 if add_dname:
2397 2397 try:
2398 2398 sys.path.remove(dname)
2399 2399 except ValueError:
2400 2400 # For some reason the user has already removed it, ignore.
2401 2401 pass
2402 2402
2403 2403 fname = os.path.expanduser(fname)
2404 2404
2405 2405 # Find things also in current directory. This is needed to mimic the
2406 2406 # behavior of running a script from the system command line, where
2407 2407 # Python inserts the script's directory into sys.path
2408 2408 dname = os.path.dirname(os.path.abspath(fname))
2409 2409 add_dname = False
2410 2410 if dname not in sys.path:
2411 2411 sys.path.insert(0,dname)
2412 2412 add_dname = True
2413 2413
2414 2414 try:
2415 2415 xfile = open(fname)
2416 2416 except:
2417 2417 print >> Term.cerr, \
2418 2418 'Could not open file <%s> for safe execution.' % fname
2419 2419 syspath_cleanup()
2420 2420 return None
2421 2421
2422 2422 kw.setdefault('islog',0)
2423 2423 kw.setdefault('quiet',1)
2424 2424 kw.setdefault('exit_ignore',0)
2425 2425 first = xfile.readline()
2426 2426 loghead = str(self.loghead_tpl).split('\n',1)[0].strip()
2427 2427 xfile.close()
2428 2428 # line by line execution
2429 2429 if first.startswith(loghead) or kw['islog']:
2430 2430 print 'Loading log file <%s> one line at a time...' % fname
2431 2431 if kw['quiet']:
2432 2432 stdout_save = sys.stdout
2433 2433 sys.stdout = StringIO.StringIO()
2434 2434 try:
2435 2435 globs,locs = where[0:2]
2436 2436 except:
2437 2437 try:
2438 2438 globs = locs = where[0]
2439 2439 except:
2440 2440 globs = locs = globals()
2441 2441 badblocks = []
2442 2442
2443 2443 # we also need to identify indented blocks of code when replaying
2444 2444 # logs and put them together before passing them to an exec
2445 2445 # statement. This takes a bit of regexp and look-ahead work in the
2446 2446 # file. It's easiest if we swallow the whole thing in memory
2447 2447 # first, and manually walk through the lines list moving the
2448 2448 # counter ourselves.
2449 2449 indent_re = re.compile('\s+\S')
2450 2450 xfile = open(fname)
2451 2451 filelines = xfile.readlines()
2452 2452 xfile.close()
2453 2453 nlines = len(filelines)
2454 2454 lnum = 0
2455 2455 while lnum < nlines:
2456 2456 line = filelines[lnum]
2457 2457 lnum += 1
2458 2458 # don't re-insert logger status info into cache
2459 2459 if line.startswith('#log#'):
2460 2460 continue
2461 2461 else:
2462 2462 # build a block of code (maybe a single line) for execution
2463 2463 block = line
2464 2464 try:
2465 2465 next = filelines[lnum] # lnum has already incremented
2466 2466 except:
2467 2467 next = None
2468 2468 while next and indent_re.match(next):
2469 2469 block += next
2470 2470 lnum += 1
2471 2471 try:
2472 2472 next = filelines[lnum]
2473 2473 except:
2474 2474 next = None
2475 2475 # now execute the block of one or more lines
2476 2476 try:
2477 2477 exec block in globs,locs
2478 2478 except SystemExit:
2479 2479 pass
2480 2480 except:
2481 2481 badblocks.append(block.rstrip())
2482 2482 if kw['quiet']: # restore stdout
2483 2483 sys.stdout.close()
2484 2484 sys.stdout = stdout_save
2485 2485 print 'Finished replaying log file <%s>' % fname
2486 2486 if badblocks:
2487 2487 print >> sys.stderr, ('\nThe following lines/blocks in file '
2488 2488 '<%s> reported errors:' % fname)
2489 2489
2490 2490 for badline in badblocks:
2491 2491 print >> sys.stderr, badline
2492 2492 else: # regular file execution
2493 2493 try:
2494 2494 if sys.platform == 'win32' and sys.version_info < (2,5,1):
2495 2495 # Work around a bug in Python for Windows. The bug was
2496 2496 # fixed in in Python 2.5 r54159 and 54158, but that's still
2497 2497 # SVN Python as of March/07. For details, see:
2498 2498 # http://projects.scipy.org/ipython/ipython/ticket/123
2499 2499 try:
2500 2500 globs,locs = where[0:2]
2501 2501 except:
2502 2502 try:
2503 2503 globs = locs = where[0]
2504 2504 except:
2505 2505 globs = locs = globals()
2506 2506 exec file(fname) in globs,locs
2507 2507 else:
2508 2508 execfile(fname,*where)
2509 2509 except SyntaxError:
2510 2510 self.showsyntaxerror()
2511 2511 warn('Failure executing file: <%s>' % fname)
2512 2512 except SystemExit,status:
2513 2513 # Code that correctly sets the exit status flag to success (0)
2514 2514 # shouldn't be bothered with a traceback. Note that a plain
2515 2515 # sys.exit() does NOT set the message to 0 (it's empty) so that
2516 2516 # will still get a traceback. Note that the structure of the
2517 2517 # SystemExit exception changed between Python 2.4 and 2.5, so
2518 2518 # the checks must be done in a version-dependent way.
2519 2519 show = False
2520 2520
2521 2521 if sys.version_info[:2] > (2,5):
2522 2522 if status.message!=0 and not kw['exit_ignore']:
2523 2523 show = True
2524 2524 else:
2525 2525 if status.code and not kw['exit_ignore']:
2526 2526 show = True
2527 2527 if show:
2528 2528 self.showtraceback()
2529 2529 warn('Failure executing file: <%s>' % fname)
2530 2530 except:
2531 2531 self.showtraceback()
2532 2532 warn('Failure executing file: <%s>' % fname)
2533 2533
2534 2534 syspath_cleanup()
2535 2535
2536 2536 #************************* end of file <iplib.py> *****************************
@@ -1,7100 +1,7107
1 2007-09-06 Ville Vainio <vivainio@gmail.com>
2
3 * ipy_rehashdir.py, ipy_workdir.py, ipy_fsops.py, iplib.py:
4 Callable aliases now pass the _ip as first arg. This breaks
5 compatibility with earlier 0.8.2.svn series! (though they should
6 not have been in use yet outside these few extensions)
7
1 8 2007-09-05 Ville Vainio <vivainio@gmail.com>
2 9
3 10 * external/mglob.py: expand('dirname') => ['dirname'], instead
4 11 of ['dirname/foo','dirname/bar', ...].
5 12
6 13 * Extensions/ipy_fsops.py: added, has usefull shell utils for plain
7 14 win32 installations: icp, imv, imkdir, igrep, irm, collect (collect
8 15 is useful for others as well).
9 16
10 17 * iplib.py: on callable aliases (as opposed to old style aliases),
11 18 do var_expand() immediately, and use make_quoted_expr instead
12 19 of hardcoded r"""
13 20
14 21 * Extensions/ipy_profile_sh.py: Try to detect cygwin on win32,
15 22 if not available load ipy_fsops.py for cp, mv, etc. replacements
16 23
17 24 * OInspect.py, ipy_which.py: improve %which and obj? for callable
18 25 aliases
19 26
20 27 2007-09-04 Ville Vainio <vivainio@gmail.com>
21 28
22 29 * ipy_profile_zope.py: add zope profile, by Stefan Eletzhofer.
23 30 Relicensed under BSD with the authors approval.
24 31
25 32 * ipmaker.py, usage.py: Remove %magic from default banner, improve
26 33 %quickref
27 34
28 35 2007-09-03 Ville Vainio <vivainio@gmail.com>
29 36
30 37 * Magic.py: %time now passes expression through prefilter,
31 38 allowing IPython syntax.
32 39
33 40 2007-09-01 Ville Vainio <vivainio@gmail.com>
34 41
35 42 * ipmaker.py: Always show full traceback when newstyle config fails
36 43
37 44 2007-08-27 Ville Vainio <vivainio@gmail.com>
38 45
39 46 * Magic.py: fix %cd for nonexistent dir when dhist is empty, close #180
40 47
41 48 2007-08-26 Ville Vainio <vivainio@gmail.com>
42 49
43 50 * ipmaker.py: Command line args have the highest priority again
44 51
45 52 * iplib.py, ipmaker.py: -i command line argument now behaves as in
46 53 normal python, i.e. leaves the IPython session running after -c
47 54 command or running a batch file from command line.
48 55
49 56 2007-08-22 Ville Vainio <vivainio@gmail.com>
50 57
51 58 * iplib.py: no extra empty (last) line in raw hist w/ multiline
52 59 statements
53 60
54 61 * logger.py: Fix bug where blank lines in history were not
55 62 added until AFTER adding the current line; translated and raw
56 63 history should finally be in sync with prompt now.
57 64
58 65 * ipy_completers.py: quick_completer now makes it easy to create
59 66 trivial custom completers
60 67
61 68 * clearcmd.py: shadow history compression & erasing, fixed input hist
62 69 clearing.
63 70
64 71 * envpersist.py, history.py: %env (sh profile only), %hist completers
65 72
66 73 * genutils.py, Prompts.py, Magic.py: win32 - prompt (with \yDEPTH) and
67 74 term title now include the drive letter, and always use / instead of
68 75 os.sep (as per recommended approach for win32 ipython in general).
69 76
70 77 * ipykit.py, ipy_kitcfg.py: special launcher for ipykit. Allows running
71 78 plain python scripts from ipykit command line by running
72 79 "py myscript.py", even w/o installed python.
73 80
74 81 2007-08-21 Ville Vainio <vivainio@gmail.com>
75 82
76 83 * ipmaker.py: finding ipythonrc-PROF now skips ipy_profile_PROF.
77 84 (for backwards compatibility)
78 85
79 86 * history.py: switch back to %hist -t from %hist -r as default.
80 87 At least until raw history is fixed for good.
81 88
82 89 2007-08-20 Ville Vainio <vivainio@gmail.com>
83 90
84 91 * ipapi.py, iplib.py: DebugTools accessible via _ip.dbg, to catch &
85 92 locate alias redeclarations etc. Also, avoid handling
86 93 _ip.IP.alias_table directly, prefer using _ip.defalias.
87 94
88 95
89 96 2007-08-15 Ville Vainio <vivainio@gmail.com>
90 97
91 98 * prefilter.py: ! is now always served first
92 99
93 100 2007-08-15 Fernando Perez <Fernando.Perez@colorado.edu>
94 101
95 102 * IPython/iplib.py (safe_execfile): fix the SystemExit
96 103 auto-suppression code to work in Python2.4 (the internal structure
97 104 of that exception changed and I'd only tested the code with 2.5).
98 105 Bug reported by a SciPy attendee.
99 106
100 107 2007-08-13 Ville Vainio <vivainio@gmail.com>
101 108
102 109 * prefilter.py: reverted !c:/bin/foo fix, made % in
103 110 multiline specials work again
104 111
105 112 2007-08-13 Ville Vainio <vivainio@gmail.com>
106 113
107 114 * prefilter.py: Take more care to special-case !, so that
108 115 !c:/bin/foo.exe works.
109 116
110 117 * setup.py: if we are building eggs, strip all docs and
111 118 examples (it doesn't make sense to bytecompile examples,
112 119 and docs would be in an awkward place anyway).
113 120
114 121 * Ryan Krauss' patch fixes start menu shortcuts when IPython
115 122 is installed into a directory that has spaces in the name.
116 123
117 124 2007-08-13 Fernando Perez <Fernando.Perez@colorado.edu>
118 125
119 126 * IPython/Magic.py (magic_doctest_mode): fix prompt separators in
120 127 doctest profile and %doctest_mode, so they actually generate the
121 128 blank lines needed by doctest to separate individual tests.
122 129
123 130 * IPython/iplib.py (safe_execfile): modify so that running code
124 131 which calls sys.exit(0) (or equivalently, raise SystemExit(0))
125 132 doesn't get a printed traceback. Any other value in sys.exit(),
126 133 including the empty call, still generates a traceback. This
127 134 enables use of %run without having to pass '-e' for codes that
128 135 correctly set the exit status flag.
129 136
130 137 2007-08-12 Fernando Perez <Fernando.Perez@colorado.edu>
131 138
132 139 * IPython/iplib.py (InteractiveShell.post_config_initialization):
133 140 fix problems with doctests failing when run inside IPython due to
134 141 IPython's modifications of sys.displayhook.
135 142
136 143 2007-8-9 Fernando Perez <fperez@planck.colorado.edu>
137 144
138 145 * IPython/ipapi.py (to_user_ns): update to accept a dict as well as
139 146 a string with names.
140 147
141 148 2007-08-09 Fernando Perez <Fernando.Perez@colorado.edu>
142 149
143 150 * IPython/Magic.py (magic_doctest_mode): added new %doctest_mode
144 151 magic to toggle on/off the doctest pasting support without having
145 152 to leave a session to switch to a separate profile.
146 153
147 154 2007-08-08 Fernando Perez <Fernando.Perez@colorado.edu>
148 155
149 156 * IPython/Extensions/ipy_profile_doctest.py (main): fix prompt to
150 157 introduce a blank line between inputs, to conform to doctest
151 158 requirements.
152 159
153 160 * IPython/OInspect.py (Inspector.pinfo): fix another part where
154 161 auto-generated docstrings for new-style classes were showing up.
155 162
156 163 2007-08-07 Fernando Perez <Fernando.Perez@colorado.edu>
157 164
158 165 * api_changes: Add new file to track backward-incompatible
159 166 user-visible changes.
160 167
161 168 2007-08-06 Ville Vainio <vivainio@gmail.com>
162 169
163 170 * ipmaker.py: fix bug where user_config_ns didn't exist at all
164 171 before all the config files were handled.
165 172
166 173 2007-08-04 Fernando Perez <Fernando.Perez@colorado.edu>
167 174
168 175 * IPython/irunner.py (RunnerFactory): Add new factory class for
169 176 creating reusable runners based on filenames.
170 177
171 178 * IPython/Extensions/ipy_profile_doctest.py: New profile for
172 179 doctest support. It sets prompts/exceptions as similar to
173 180 standard Python as possible, so that ipython sessions in this
174 181 profile can be easily pasted as doctests with minimal
175 182 modifications. It also enables pasting of doctests from external
176 183 sources (even if they have leading whitespace), so that you can
177 184 rerun doctests from existing sources.
178 185
179 186 * IPython/iplib.py (_prefilter): fix a buglet where after entering
180 187 some whitespace, the prompt would become a continuation prompt
181 188 with no way of exiting it other than Ctrl-C. This fix brings us
182 189 into conformity with how the default python prompt works.
183 190
184 191 * IPython/Extensions/InterpreterPasteInput.py (prefilter_paste):
185 192 Add support for pasting not only lines that start with '>>>', but
186 193 also with ' >>>'. That is, arbitrary whitespace can now precede
187 194 the prompts. This makes the system useful for pasting doctests
188 195 from docstrings back into a normal session.
189 196
190 197 2007-08-02 Fernando Perez <Fernando.Perez@colorado.edu>
191 198
192 199 * IPython/Shell.py (IPShellEmbed.__call__): fix bug introduced in
193 200 r1357, which had killed multiple invocations of an embedded
194 201 ipython (this means that example-embed has been broken for over 1
195 202 year!!!). Rather than possibly breaking the batch stuff for which
196 203 the code in iplib.py/interact was introduced, I worked around the
197 204 problem in the embedding class in Shell.py. We really need a
198 205 bloody test suite for this code, I'm sick of finding stuff that
199 206 used to work breaking left and right every time I use an old
200 207 feature I hadn't touched in a few months.
201 208 (kill_embedded): Add a new magic that only shows up in embedded
202 209 mode, to allow users to permanently deactivate an embedded instance.
203 210
204 211 2007-08-01 Ville Vainio <vivainio@gmail.com>
205 212
206 213 * iplib.py, ipy_profile_sh.py (runlines): Fix the bug where raw
207 214 history gets out of sync on runlines (e.g. when running macros).
208 215
209 216 2007-07-31 Fernando Perez <Fernando.Perez@colorado.edu>
210 217
211 218 * IPython/Magic.py (magic_colors): fix win32-related error message
212 219 that could appear under *nix when readline was missing. Patch by
213 220 Scott Jackson, closes #175.
214 221
215 222 2007-07-29 Fernando Perez <Fernando.Perez@colorado.edu>
216 223
217 224 * IPython/Extensions/ipy_traits_completer.py: Add a new custom
218 225 completer that it traits-aware, so that traits objects don't show
219 226 all of their internal attributes all the time.
220 227
221 228 * IPython/genutils.py (dir2): moved this code from inside
222 229 completer.py to expose it publicly, so I could use it in the
223 230 wildcards bugfix.
224 231
225 232 * IPython/wildcard.py (NameSpace.__init__): fix a bug reported by
226 233 Stefan with Traits.
227 234
228 235 * IPython/completer.py (Completer.attr_matches): change internal
229 236 var name from 'object' to 'obj', since 'object' is now a builtin
230 237 and this can lead to weird bugs if reusing this code elsewhere.
231 238
232 239 2007-07-25 Fernando Perez <Fernando.Perez@colorado.edu>
233 240
234 241 * IPython/OInspect.py (Inspector.pinfo): fix small glitches in
235 242 'foo?' and update the code to prevent printing of default
236 243 docstrings that started appearing after I added support for
237 244 new-style classes. The approach I'm using isn't ideal (I just
238 245 special-case those strings) but I'm not sure how to more robustly
239 246 differentiate between truly user-written strings and Python's
240 247 automatic ones.
241 248
242 249 2007-07-09 Ville Vainio <vivainio@gmail.com>
243 250
244 251 * completer.py: Applied Matthew Neeley's patch:
245 252 Dynamic attributes from trait_names and _getAttributeNames are added
246 253 to the list of tab completions, but when this happens, the attribute
247 254 list is turned into a set, so the attributes are unordered when
248 255 printed, which makes it hard to find the right completion. This patch
249 256 turns this set back into a list and sort it.
250 257
251 258 2007-07-06 Fernando Perez <Fernando.Perez@colorado.edu>
252 259
253 260 * IPython/OInspect.py (Inspector.pinfo): Add support for new-style
254 261 classes in various inspector functions.
255 262
256 263 2007-06-28 Ville Vainio <vivainio@gmail.com>
257 264
258 265 * shadowns.py, iplib.py, ipapi.py, OInspect.py:
259 266 Implement "shadow" namespace, and callable aliases that reside there.
260 267 Use them by:
261 268
262 269 _ip.defalias('foo',myfunc) # creates _sh.foo that points to myfunc
263 270
264 271 foo hello world
265 272 (gets translated to:)
266 273 _sh.foo(r"""hello world""")
267 274
268 275 In practice, this kind of alias can take the role of a magic function
269 276
270 277 * New generic inspect_object, called on obj? and obj??
271 278
272 279 2007-06-15 Fernando Perez <Fernando.Perez@colorado.edu>
273 280
274 281 * IPython/ultraTB.py (findsource): fix a problem with
275 282 inspect.getfile that can cause crashes during traceback construction.
276 283
277 284 2007-06-14 Ville Vainio <vivainio@gmail.com>
278 285
279 286 * iplib.py (handle_auto): Try to use ascii for printing "--->"
280 287 autocall rewrite indication, becausesometimes unicode fails to print
281 288 properly (and you get ' - - - '). Use plain uncoloured ---> for
282 289 unicode.
283 290
284 291 * shadow history. Usable through "%hist -g <pat>" and "%rep 0123".
285 292
286 293 . pickleshare 'hash' commands (hget, hset, hcompress,
287 294 hdict) for efficient shadow history storage.
288 295
289 296 2007-06-13 Ville Vainio <vivainio@gmail.com>
290 297
291 298 * ipapi.py: _ip.to_user_ns(vars, interactive = True).
292 299 Added kw arg 'interactive', tell whether vars should be visible
293 300 with %whos.
294 301
295 302 2007-06-11 Ville Vainio <vivainio@gmail.com>
296 303
297 304 * pspersistence.py, Magic.py, iplib.py: directory history now saved
298 305 to db
299 306
300 307 * iplib.py: "ipython -c <cmd>" now passes the command through prefilter.
301 308 Also, it exits IPython immediately after evaluating the command (just like
302 309 std python)
303 310
304 311 2007-06-05 Walter Doerwald <walter@livinglogic.de>
305 312
306 313 * IPython/Extensions/ipipe.py: Added a new table icap, which executes a
307 314 Python string and captures the output. (Idea and original patch by
308 Stfan van der Walt)
315 Stefan van der Walt)
309 316
310 317 2007-06-01 Fernando Perez <Fernando.Perez@colorado.edu>
311 318
312 319 * IPython/ultraTB.py (VerboseTB.text): update printing of
313 320 exception types for Python 2.5 (now all exceptions in the stdlib
314 321 are new-style classes).
315 322
316 323 2007-05-31 Walter Doerwald <walter@livinglogic.de>
317 324
318 325 * IPython/Extensions/igrid.py: Add new commands refresh and
319 326 refresh_timer (mapped to "R"/"F5" and to the menu) which restarts
320 327 the iterator once (refresh) or after every x seconds (refresh_timer).
321 328 Add a working implementation of "searchexpression", where the text
322 329 entered is not the text to search for, but an expression that must
323 330 be true. Added display of shortcuts to the menu. Added commands "pickinput"
324 331 and "pickinputattr" that put the object or attribute under the cursor
325 332 in the input line. Split the statusbar to be able to display the currently
326 333 active refresh interval. (Patch by Nik Tautenhahn)
327 334
328 2007-05-29 Jrgen Stenarson <jorgen.stenarson@bostream.nu>
335 2007-05-29 Jorgen Stenarson <jorgen.stenarson@bostream.nu>
329 336
330 337 * fixing set_term_title to use ctypes as default
331 338
332 339 * fixing set_term_title fallback to work when curent dir
333 340 is on a windows network share
334 341
335 342 2007-05-28 Ville Vainio <vivainio@gmail.com>
336 343
337 344 * %cpaste: strip + with > from left (diffs).
338 345
339 346 * iplib.py: Fix crash when readline not installed
340 347
341 348 2007-05-26 Ville Vainio <vivainio@gmail.com>
342 349
343 350 * generics.py: intruduce easy to extend result_display generic
344 351 function (using simplegeneric.py).
345 352
346 353 * Fixed the append functionality of %set.
347 354
348 355 2007-05-25 Ville Vainio <vivainio@gmail.com>
349 356
350 357 * New magic: %rep (fetch / run old commands from history)
351 358
352 359 * New extension: mglob (%mglob magic), for powerful glob / find /filter
353 360 like functionality
354 361
355 362 % maghistory.py: %hist -g PATTERM greps the history for pattern
356 363
357 364 2007-05-24 Walter Doerwald <walter@livinglogic.de>
358 365
359 366 * IPython/Extensions/ipipe.py: Added a Table ihist that can be used to
360 367 browse the IPython input history
361 368
362 369 * IPython/Extensions/ibrowse.py: Added two command to ibrowse: pickinput
363 370 (mapped to "i") can be used to put the object under the curser in the input
364 371 line. pickinputattr (mapped to "I") does the same for the attribute under
365 372 the cursor.
366 373
367 374 2007-05-24 Ville Vainio <vivainio@gmail.com>
368 375
369 376 * Grand magic cleansing (changeset [2380]):
370 377
371 378 * Introduce ipy_legacy.py where the following magics were
372 379 moved:
373 380
374 381 pdef pdoc psource pfile rehash dhist Quit p r automagic autocall
375 382
376 383 If you need them, either use default profile or "import ipy_legacy"
377 384 in your ipy_user_conf.py
378 385
379 386 * Move sh and scipy profile to Extensions from UserConfig. this implies
380 387 you should not edit them, but you don't need to run %upgrade when
381 388 upgrading IPython anymore.
382 389
383 390 * %hist/%history now operates in "raw" mode by default. To get the old
384 391 behaviour, run '%hist -n' (native mode).
385 392
386 393 * split ipy_stock_completers.py to ipy_stock_completers.py and
387 394 ipy_app_completers.py. Stock completers (%cd, import, %run) are now
388 395 installed as default.
389 396
390 397 * sh profile now installs ipy_signals.py, for (hopefully) better ctrl+c
391 398 handling.
392 399
393 400 * iplib.py, ipapi.py: _ip.set_next_input(s) sets the next ("default")
394 401 input if readline is available.
395 402
396 403 2007-05-23 Ville Vainio <vivainio@gmail.com>
397 404
398 405 * macro.py: %store uses __getstate__ properly
399 406
400 407 * exesetup.py: added new setup script for creating
401 408 standalone IPython executables with py2exe (i.e.
402 409 no python installation required).
403 410
404 411 * Removed ipythonrc-scipy, ipy_profile_scipy.py takes
405 412 its place.
406 413
407 414 * rlineimpl.py, genutils.py (get_home_dir): py2exe support
408 415
409 416 2007-05-21 Ville Vainio <vivainio@gmail.com>
410 417
411 418 * platutil_win32.py (set_term_title): handle
412 419 failure of 'title' system call properly.
413 420
414 421 2007-05-17 Walter Doerwald <walter@livinglogic.de>
415 422
416 423 * IPython/Extensions/ipipe.py: Fix xrepr for ifiles.
417 424 (Bug detected by Paul Mueller).
418 425
419 426 2007-05-16 Ville Vainio <vivainio@gmail.com>
420 427
421 428 * ipy_profile_sci.py, ipython_win_post_install.py: Create
422 429 new "sci" profile, effectively a modern version of the old
423 430 "scipy" profile (which is now slated for deprecation).
424 431
425 432 2007-05-15 Ville Vainio <vivainio@gmail.com>
426 433
427 434 * pycolorize.py, pycolor.1: Paul Mueller's patches that
428 435 make pycolorize read input from stdin when run without arguments.
429 436
430 437 * Magic.py: do not require 'PATH' in %rehash/%rehashx. Closes #155
431 438
432 439 * ipy_rehashdir.py: rename ext_rehashdir to ipy_rehashdir, import
433 440 it in sh profile (instead of ipy_system_conf.py).
434 441
435 442 * Magic.py, ipy_rehashdir.py, ipy_profile_sh.py: System command
436 443 aliases are now lower case on windows (MyCommand.exe => mycommand).
437 444
438 445 * macro.py, ipapi.py, iplib.py, Prompts.py: Macro system rehaul.
439 446 Macros are now callable objects that inherit from ipapi.IPyAutocall,
440 447 i.e. get autocalled regardless of system autocall setting.
441 448
442 449 2007-05-10 Fernando Perez <Fernando.Perez@colorado.edu>
443 450
444 451 * IPython/rlineimpl.py: check for clear_history in readline and
445 452 make it a dummy no-op if not available. This function isn't
446 453 guaranteed to be in the API and appeared in Python 2.4, so we need
447 454 to check it ourselves. Also, clean up this file quite a bit.
448 455
449 456 * ipython.1: update man page and full manual with information
450 457 about threads (remove outdated warning). Closes #151.
451 458
452 459 2007-05-09 Fernando Perez <Fernando.Perez@colorado.edu>
453 460
454 461 * IPython/Extensions/ipy_constants.py: Add Gael's constants module
455 462 in trunk (note that this made it into the 0.8.1 release already,
456 463 but the changelogs didn't get coordinated). Many thanks to Gael
457 464 Varoquaux <gael.varoquaux-AT-normalesup.org>
458 465
459 466 2007-05-09 *** Released version 0.8.1
460 467
461 468 2007-05-10 Walter Doerwald <walter@livinglogic.de>
462 469
463 470 * IPython/Extensions/igrid.py: Incorporate html help into
464 471 the module, so we don't have to search for the file.
465 472
466 473 2007-05-02 Fernando Perez <Fernando.Perez@colorado.edu>
467 474
468 475 * test/test_irunner.py (RunnerTestCase._test_runner): Close #147.
469 476
470 477 2007-04-30 Ville Vainio <vivainio@gmail.com>
471 478
472 479 * iplib.py: (pre_config_initialization) Catch UnicodeDecodeError if the
473 480 user has illegal (non-ascii) home directory name
474 481
475 482 2007-04-27 Ville Vainio <vivainio@gmail.com>
476 483
477 484 * platutils_win32.py: implement set_term_title for windows
478 485
479 486 * Update version number
480 487
481 488 * ipy_profile_sh.py: more informative prompt (2 dir levels)
482 489
483 490 2007-04-26 Walter Doerwald <walter@livinglogic.de>
484 491
485 492 * IPython/Extensions/igrid.py: (igrid) Fix bug that surfaced
486 493 when the igrid input raised an exception. (Patch by Nik Tautenhahn,
487 494 bug discovered by Ville).
488 495
489 496 2007-04-26 Ville Vainio <vivainio@gmail.com>
490 497
491 498 * Extensions/ipy_completers.py: Olivier's module completer now
492 499 saves the list of root modules if it takes > 4 secs on the first run.
493 500
494 501 * Magic.py (%rehashx): %rehashx now clears the completer cache
495 502
496 503
497 504 2007-04-26 Fernando Perez <Fernando.Perez@colorado.edu>
498 505
499 506 * ipython.el: fix incorrect color scheme, reported by Stefan.
500 507 Closes #149.
501 508
502 509 * IPython/PyColorize.py (Parser.format2): fix state-handling
503 510 logic. I still don't like how that code handles state, but at
504 511 least now it should be correct, if inelegant. Closes #146.
505 512
506 513 2007-04-25 Ville Vainio <vivainio@gmail.com>
507 514
508 515 * Extensions/ipy_which.py: added extension for %which magic, works
509 516 a lot like unix 'which' but also finds and expands aliases, and
510 517 allows wildcards.
511 518
512 519 * ipapi.py (expand_alias): Now actually *return* the expanded alias,
513 520 as opposed to returning nothing.
514 521
515 522 * UserConfig/ipy_user_conf.py, ipy_profile_sh.py: do not import
516 523 ipy_stock_completers on default profile, do import on sh profile.
517 524
518 2007-04-22 Jrgen Stenarson <jorgen.stenarson@bostream.nu>
525 2007-04-22 Jorgen Stenarson <jorgen.stenarson@bostream.nu>
519 526
520 527 * Fix bug in iplib.py/safe_execfile when launching ipython with a script
521 528 like ipython.py foo.py which raised a IndexError.
522 529
523 530 2007-04-21 Ville Vainio <vivainio@gmail.com>
524 531
525 532 * Extensions/ipy_extutil.py: added extension to manage other ipython
526 533 extensions. Now only supports 'ls' == list extensions.
527 534
528 535 2007-04-20 Fernando Perez <Fernando.Perez@colorado.edu>
529 536
530 537 * IPython/Debugger.py (BdbQuit_excepthook): fix small bug that
531 538 would prevent use of the exception system outside of a running
532 539 IPython instance.
533 540
534 541 2007-04-20 Ville Vainio <vivainio@gmail.com>
535 542
536 543 * Extensions/ipy_render.py: added extension for easy
537 544 interactive text template rendering (to clipboard). Uses Ka-Ping Yee's
538 545 'Iptl' template notation,
539 546
540 547 * Extensions/ipy_completers.py: introduced Olivier Lauzanne's
541 548 safer & faster 'import' completer.
542 549
543 550 * ipapi.py: Introduced new ipapi methods, _ip.defmacro(name, value)
544 551 and _ip.defalias(name, command).
545 552
546 553 * Extensions/ipy_exportdb.py: New extension for exporting all the
547 554 %store'd data in a portable format (normal ipapi calls like
548 555 defmacro() etc.)
549 556
550 557 2007-04-19 Ville Vainio <vivainio@gmail.com>
551 558
552 559 * upgrade_dir.py: skip junk files like *.pyc
553 560
554 561 * Release.py: version number to 0.8.1
555 562
556 563 2007-04-18 Ville Vainio <vivainio@gmail.com>
557 564
558 565 * iplib.py (safe_execfile): make "ipython foo.py" work with 2.5.1c1
559 566 and later on win32.
560 567
561 568 2007-04-16 Ville Vainio <vivainio@gmail.com>
562 569
563 570 * iplib.py (showtraceback): Do not crash when running w/o readline.
564 571
565 572 2007-04-12 Walter Doerwald <walter@livinglogic.de>
566 573
567 574 * IPython/Extensions/ipipe.py: (ils) Directoy listings are now
568 575 sorted (case sensitive with files and dirs mixed).
569 576
570 577 2007-04-10 Fernando Perez <Fernando.Perez@colorado.edu>
571 578
572 579 * IPython/Release.py (version): Open trunk for 0.8.1 development.
573 580
574 581 2007-04-10 *** Released version 0.8.0
575 582
576 583 2007-04-07 Fernando Perez <Fernando.Perez@colorado.edu>
577 584
578 585 * Tag 0.8.0 for release.
579 586
580 587 * IPython/iplib.py (reloadhist): add API function to cleanly
581 588 reload the readline history, which was growing inappropriately on
582 589 every %run call.
583 590
584 591 * win32_manual_post_install.py (run): apply last part of Nicolas
585 592 Pernetty's patch (I'd accidentally applied it in a different
586 593 directory and this particular file didn't get patched).
587 594
588 595 2007-04-05 Fernando Perez <Fernando.Perez@colorado.edu>
589 596
590 597 * IPython/Shell.py (MAIN_THREAD_ID): get rid of my stupid hack to
591 598 find the main thread id and use the proper API call. Thanks to
592 599 Stefan for the fix.
593 600
594 601 * test/test_prefilter.py (esc_handler_tests): udpate one of Dan's
595 602 unit tests to reflect fixed ticket #52, and add more tests sent by
596 603 him.
597 604
598 605 * IPython/iplib.py (raw_input): restore the readline completer
599 606 state on every input, in case third-party code messed it up.
600 607 (_prefilter): revert recent addition of early-escape checks which
601 608 prevent many valid alias calls from working.
602 609
603 610 * IPython/Shell.py (MTInteractiveShell.runcode): add a tracking
604 611 flag for sigint handler so we don't run a full signal() call on
605 612 each runcode access.
606 613
607 614 * IPython/Magic.py (magic_whos): small improvement to diagnostic
608 615 message.
609 616
610 617 2007-04-04 Fernando Perez <Fernando.Perez@colorado.edu>
611 618
612 619 * IPython/Shell.py (sigint_handler): I *THINK* I finally got
613 620 asynchronous exceptions working, i.e., Ctrl-C can actually
614 621 interrupt long-running code in the multithreaded shells.
615 622
616 623 This is using Tomer Filiba's great ctypes-based trick:
617 624 http://sebulba.wikispaces.com/recipe+thread2. I'd already tried
618 625 this in the past, but hadn't been able to make it work before. So
619 626 far it looks like it's actually running, but this needs more
620 627 testing. If it really works, I'll be *very* happy, and we'll owe
621 628 a huge thank you to Tomer. My current implementation is ugly,
622 629 hackish and uses nasty globals, but I don't want to try and clean
623 630 anything up until we know if it actually works.
624 631
625 632 NOTE: this feature needs ctypes to work. ctypes is included in
626 633 Python2.5, but 2.4 users will need to manually install it. This
627 634 feature makes multi-threaded shells so much more usable that it's
628 635 a minor price to pay (ctypes is very easy to install, already a
629 636 requirement for win32 and available in major linux distros).
630 637
631 638 2007-04-04 Ville Vainio <vivainio@gmail.com>
632 639
633 640 * Extensions/ipy_completers.py, ipy_stock_completers.py:
634 641 Moved implementations of 'bundled' completers to ipy_completers.py,
635 642 they are only enabled in ipy_stock_completers.py.
636 643
637 644 2007-04-04 Fernando Perez <Fernando.Perez@colorado.edu>
638 645
639 646 * IPython/PyColorize.py (Parser.format2): Fix identation of
640 647 colorzied output and return early if color scheme is NoColor, to
641 648 avoid unnecessary and expensive tokenization. Closes #131.
642 649
643 650 2007-04-03 Fernando Perez <Fernando.Perez@colorado.edu>
644 651
645 652 * IPython/Debugger.py: disable the use of pydb version 1.17. It
646 653 has a critical bug (a missing import that makes post-mortem not
647 654 work at all). Unfortunately as of this time, this is the version
648 655 shipped with Ubuntu Edgy, so quite a few people have this one. I
649 656 hope Edgy will update to a more recent package.
650 657
651 658 2007-04-02 Fernando Perez <Fernando.Perez@colorado.edu>
652 659
653 660 * IPython/iplib.py (_prefilter): close #52, second part of a patch
654 661 set by Stefan (only the first part had been applied before).
655 662
656 663 * IPython/Extensions/ipy_stock_completers.py (module_completer):
657 664 remove usage of the dangerous pkgutil.walk_packages(). See
658 665 details in comments left in the code.
659 666
660 667 * IPython/Magic.py (magic_whos): add support for numpy arrays
661 668 similar to what we had for Numeric.
662 669
663 670 * IPython/completer.py (IPCompleter.complete): extend the
664 671 complete() call API to support completions by other mechanisms
665 672 than readline. Closes #109.
666 673
667 674 * IPython/iplib.py (safe_execfile): add a safeguard under Win32 to
668 675 protect against a bug in Python's execfile(). Closes #123.
669 676
670 677 2007-04-01 Fernando Perez <Fernando.Perez@colorado.edu>
671 678
672 679 * IPython/iplib.py (split_user_input): ensure that when splitting
673 680 user input, the part that can be treated as a python name is pure
674 681 ascii (Python identifiers MUST be pure ascii). Part of the
675 682 ongoing Unicode support work.
676 683
677 684 * IPython/Prompts.py (prompt_specials_color): Add \N for the
678 685 actual prompt number, without any coloring. This allows users to
679 686 produce numbered prompts with their own colors. Added after a
680 687 report/request by Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
681 688
682 689 2007-03-31 Walter Doerwald <walter@livinglogic.de>
683 690
684 691 * IPython/Extensions/igrid.py: Map the return key
685 692 to enter() and shift-return to enterattr().
686 693
687 694 2007-03-30 Fernando Perez <Fernando.Perez@colorado.edu>
688 695
689 696 * IPython/Magic.py (magic_psearch): add unicode support by
690 697 encoding to ascii the input, since this routine also only deals
691 698 with valid Python names. Fixes a bug reported by Stefan.
692 699
693 700 2007-03-29 Fernando Perez <Fernando.Perez@colorado.edu>
694 701
695 702 * IPython/Magic.py (_inspect): convert unicode input into ascii
696 703 before trying to evaluate it as a Python identifier. This fixes a
697 704 problem that the new unicode support had introduced when analyzing
698 705 long definition lines for functions.
699 706
700 707 2007-03-24 Walter Doerwald <walter@livinglogic.de>
701 708
702 709 * IPython/Extensions/igrid.py: Fix picking. Using
703 710 igrid with wxPython 2.6 and -wthread should work now.
704 711 igrid.display() simply tries to create a frame without
705 712 an application. Only if this fails an application is created.
706 713
707 714 2007-03-23 Walter Doerwald <walter@livinglogic.de>
708 715
709 716 * IPython/Extensions/path.py: Updated to version 2.2.
710 717
711 718 2007-03-23 Ville Vainio <vivainio@gmail.com>
712 719
713 720 * iplib.py: recursive alias expansion now works better, so that
714 721 cases like 'top' -> 'd:/cygwin/top' -> 'ls :/cygwin/top'
715 722 doesn't trip up the process, if 'd' has been aliased to 'ls'.
716 723
717 724 * Extensions/ipy_gnuglobal.py added, provides %global magic
718 725 for users of http://www.gnu.org/software/global
719 726
720 727 * iplib.py: '!command /?' now doesn't invoke IPython's help system.
721 728 Closes #52. Patch by Stefan van der Walt.
722 729
723 730 2007-03-23 Fernando Perez <Fernando.Perez@colorado.edu>
724 731
725 732 * IPython/FakeModule.py (FakeModule.__init__): Small fix to
726 733 respect the __file__ attribute when using %run. Thanks to a bug
727 734 report by Sebastian Rooks <sebastian.rooks-AT-free.fr>.
728 735
729 736 2007-03-22 Fernando Perez <Fernando.Perez@colorado.edu>
730 737
731 738 * IPython/iplib.py (raw_input): Fix mishandling of unicode at
732 739 input. Patch sent by Stefan.
733 740
734 2007-03-20 Jrgen Stenarson <jorgen.stenarson@bostream.nu>
741 2007-03-20 Jorgen Stenarson <jorgen.stenarson@bostream.nu>
735 742 * IPython/Extensions/ipy_stock_completer.py
736 743 shlex_split, fix bug in shlex_split. len function
737 744 call was missing an if statement. Caused shlex_split to
738 745 sometimes return "" as last element.
739 746
740 747 2007-03-18 Fernando Perez <Fernando.Perez@colorado.edu>
741 748
742 749 * IPython/completer.py
743 750 (IPCompleter.file_matches.single_dir_expand): fix a problem
744 751 reported by Stefan, where directories containign a single subdir
745 752 would be completed too early.
746 753
747 754 * IPython/Shell.py (_load_pylab): Make the execution of 'from
748 755 pylab import *' when -pylab is given be optional. A new flag,
749 756 pylab_import_all controls this behavior, the default is True for
750 757 backwards compatibility.
751 758
752 759 * IPython/ultraTB.py (_formatTracebackLines): Added (slightly
753 760 modified) R. Bernstein's patch for fully syntax highlighted
754 761 tracebacks. The functionality is also available under ultraTB for
755 762 non-ipython users (someone using ultraTB but outside an ipython
756 763 session). They can select the color scheme by setting the
757 764 module-level global DEFAULT_SCHEME. The highlight functionality
758 765 also works when debugging.
759 766
760 767 * IPython/genutils.py (IOStream.close): small patch by
761 768 R. Bernstein for improved pydb support.
762 769
763 770 * IPython/Debugger.py (Pdb.format_stack_entry): Added patch by
764 771 DaveS <davls@telus.net> to improve support of debugging under
765 772 NTEmacs, including improved pydb behavior.
766 773
767 774 * IPython/Magic.py (magic_prun): Fix saving of profile info for
768 775 Python 2.5, where the stats object API changed a little. Thanks
769 776 to a bug report by Paul Smith <paul.smith-AT-catugmt.com>.
770 777
771 778 * IPython/ColorANSI.py (InputTermColors.Normal): applied Nicolas
772 779 Pernetty's patch to improve support for (X)Emacs under Win32.
773 780
774 781 2007-03-17 Fernando Perez <Fernando.Perez@colorado.edu>
775 782
776 783 * IPython/Shell.py (hijack_wx): ipmort WX with current semantics
777 784 to quiet a deprecation warning that fires with Wx 2.8. Thanks to
778 785 a report by Nik Tautenhahn.
779 786
780 787 2007-03-16 Walter Doerwald <walter@livinglogic.de>
781 788
782 789 * setup.py: Add the igrid help files to the list of data files
783 790 to be installed alongside igrid.
784 791 * IPython/Extensions/igrid.py: (Patch by Nik Tautenhahn)
785 792 Show the input object of the igrid browser as the window tile.
786 793 Show the object the cursor is on in the statusbar.
787 794
788 795 2007-03-15 Ville Vainio <vivainio@gmail.com>
789 796
790 797 * Extensions/ipy_stock_completers.py: Fixed exception
791 798 on mismatching quotes in %run completer. Patch by
792 Jrgen Stenarson. Closes #127.
799 Jorgen Stenarson. Closes #127.
793 800
794 801 2007-03-14 Ville Vainio <vivainio@gmail.com>
795 802
796 803 * Extensions/ext_rehashdir.py: Do not do auto_alias
797 804 in %rehashdir, it clobbers %store'd aliases.
798 805
799 806 * UserConfig/ipy_profile_sh.py: envpersist.py extension
800 807 (beefed up %env) imported for sh profile.
801 808
802 809 2007-03-10 Walter Doerwald <walter@livinglogic.de>
803 810
804 811 * IPython/Extensions/ipipe.py: Prefer ibrowse over igrid
805 812 as the default browser.
806 813 * IPython/Extensions/igrid.py: Make a few igrid attributes private.
807 814 As igrid displays all attributes it ever encounters, fetch() (which has
808 815 been renamed to _fetch()) doesn't have to recalculate the display attributes
809 816 every time a new item is fetched. This should speed up scrolling.
810 817
811 818 2007-03-10 Fernando Perez <Fernando.Perez@colorado.edu>
812 819
813 820 * IPython/iplib.py (InteractiveShell.__init__): fix for Alex
814 821 Schmolck's recently reported tab-completion bug (my previous one
815 822 had a problem). Patch by Dan Milstein <danmil-AT-comcast.net>.
816 823
817 824 2007-03-09 Walter Doerwald <walter@livinglogic.de>
818 825
819 826 * IPython/Extensions/igrid.py: Patch by Nik Tautenhahn:
820 827 Close help window if exiting igrid.
821 828
822 2007-03-02 Jrgen Stenarson <jorgen.stenarson@bostream.nu>
829 2007-03-02 Jorgen Stenarson <jorgen.stenarson@bostream.nu>
823 830
824 831 * IPython/Extensions/ipy_defaults.py: Check if readline is available
825 832 before calling functions from readline.
826 833
827 834 2007-03-02 Walter Doerwald <walter@livinglogic.de>
828 835
829 836 * IPython/Extensions/igrid.py: Add Nik Tautenhahns igrid extension.
830 837 igrid is a wxPython-based display object for ipipe. If your system has
831 838 wx installed igrid will be the default display. Without wx ipipe falls
832 839 back to ibrowse (which needs curses). If no curses is installed ipipe
833 840 falls back to idump.
834 841
835 842 2007-03-01 Fernando Perez <Fernando.Perez@colorado.edu>
836 843
837 844 * IPython/iplib.py (split_user_inputBROKEN): temporarily disable
838 845 my changes from yesterday, they introduced bugs. Will reactivate
839 846 once I get a correct solution, which will be much easier thanks to
840 847 Dan Milstein's new prefilter test suite.
841 848
842 849 2007-02-28 Fernando Perez <Fernando.Perez@colorado.edu>
843 850
844 851 * IPython/iplib.py (split_user_input): fix input splitting so we
845 852 don't attempt attribute accesses on things that can't possibly be
846 853 valid Python attributes. After a bug report by Alex Schmolck.
847 854 (InteractiveShell.__init__): brown-paper bag fix; regexp broke
848 855 %magic with explicit % prefix.
849 856
850 857 2007-02-27 Fernando Perez <Fernando.Perez@colorado.edu>
851 858
852 859 * IPython/Shell.py (IPShellGTK.mainloop): update threads calls to
853 860 avoid a DeprecationWarning from GTK.
854 861
855 862 2007-02-22 Fernando Perez <Fernando.Perez@colorado.edu>
856 863
857 864 * IPython/genutils.py (clock): I modified clock() to return total
858 865 time, user+system. This is a more commonly needed metric. I also
859 866 introduced the new clocku/clocks to get only user/system time if
860 867 one wants those instead.
861 868
862 869 ***WARNING: API CHANGE*** clock() used to return only user time,
863 870 so if you want exactly the same results as before, use clocku
864 871 instead.
865 872
866 873 2007-02-22 Ville Vainio <vivainio@gmail.com>
867 874
868 875 * IPython/Extensions/ipy_p4.py: Extension for improved
869 876 p4 (perforce version control system) experience.
870 877 Adds %p4 magic with p4 command completion and
871 878 automatic -G argument (marshall output as python dict)
872 879
873 880 2007-02-19 Fernando Perez <Fernando.Perez@colorado.edu>
874 881
875 882 * IPython/demo.py (Demo.re_stop): make dashes optional in demo
876 883 stop marks.
877 884 (ClearingMixin): a simple mixin to easily make a Demo class clear
878 885 the screen in between blocks and have empty marquees. The
879 886 ClearDemo and ClearIPDemo classes that use it are included.
880 887
881 888 2007-02-18 Fernando Perez <Fernando.Perez@colorado.edu>
882 889
883 890 * IPython/irunner.py (pexpect_monkeypatch): patch pexpect to
884 891 protect against exceptions at Python shutdown time. Patch
885 892 sumbmitted to upstream.
886 893
887 894 2007-02-14 Walter Doerwald <walter@livinglogic.de>
888 895
889 896 * IPython/Extensions/ibrowse.py: If entering the first object level
890 897 (i.e. the object for which the browser has been started) fails,
891 898 now the error is raised directly (aborting the browser) instead of
892 899 running into an empty levels list later.
893 900
894 901 2007-02-03 Walter Doerwald <walter@livinglogic.de>
895 902
896 903 * IPython/Extensions/ipipe.py: Add an xrepr implementation
897 904 for the noitem object.
898 905
899 906 2007-01-31 Fernando Perez <Fernando.Perez@colorado.edu>
900 907
901 908 * IPython/completer.py (Completer.attr_matches): Fix small
902 909 tab-completion bug with Enthought Traits objects with units.
903 910 Thanks to a bug report by Tom Denniston
904 911 <tom.denniston-AT-alum.dartmouth.org>.
905 912
906 913 2007-01-27 Fernando Perez <Fernando.Perez@colorado.edu>
907 914
908 915 * IPython/Extensions/ipy_stock_completers.py (runlistpy): fix a
909 916 bug where only .ipy or .py would be completed. Once the first
910 917 argument to %run has been given, all completions are valid because
911 918 they are the arguments to the script, which may well be non-python
912 919 filenames.
913 920
914 921 * IPython/irunner.py (InteractiveRunner.run_source): major updates
915 922 to irunner to allow it to correctly support real doctesting of
916 923 out-of-process ipython code.
917 924
918 925 * IPython/Magic.py (magic_cd): Make the setting of the terminal
919 926 title an option (-noterm_title) because it completely breaks
920 927 doctesting.
921 928
922 929 * IPython/demo.py: fix IPythonDemo class that was not actually working.
923 930
924 931 2007-01-24 Fernando Perez <Fernando.Perez@colorado.edu>
925 932
926 933 * IPython/irunner.py (main): fix small bug where extensions were
927 934 not being correctly recognized.
928 935
929 936 2007-01-23 Walter Doerwald <walter@livinglogic.de>
930 937
931 938 * IPython/Extensions/ipipe.py (xiter): Make sure that iterating
932 939 a string containing a single line yields the string itself as the
933 940 only item.
934 941
935 942 * IPython/Extensions/ibrowse.py (ibrowse): Avoid entering an
936 943 object if it's the same as the one on the last level (This avoids
937 944 infinite recursion for one line strings).
938 945
939 946 2007-01-17 Fernando Perez <Fernando.Perez@colorado.edu>
940 947
941 948 * IPython/ultraTB.py (AutoFormattedTB.__call__): properly flush
942 949 all output streams before printing tracebacks. This ensures that
943 950 user output doesn't end up interleaved with traceback output.
944 951
945 952 2007-01-10 Ville Vainio <vivainio@gmail.com>
946 953
947 954 * Extensions/envpersist.py: Turbocharged %env that remembers
948 955 env vars across sessions; e.g. "%env PATH+=;/opt/scripts" or
949 956 "%env VISUAL=jed".
950 957
951 958 2007-01-05 Fernando Perez <Fernando.Perez@colorado.edu>
952 959
953 960 * IPython/iplib.py (showtraceback): ensure that we correctly call
954 961 custom handlers in all cases (some with pdb were slipping through,
955 962 but I'm not exactly sure why).
956 963
957 964 * IPython/Debugger.py (Tracer.__init__): added new class to
958 965 support set_trace-like usage of IPython's enhanced debugger.
959 966
960 967 2006-12-24 Ville Vainio <vivainio@gmail.com>
961 968
962 969 * ipmaker.py: more informative message when ipy_user_conf
963 970 import fails (suggest running %upgrade).
964 971
965 972 * tools/run_ipy_in_profiler.py: Utility to see where
966 973 the time during IPython startup is spent.
967 974
968 975 2006-12-20 Ville Vainio <vivainio@gmail.com>
969 976
970 977 * 0.7.3 is out - merge all from 0.7.3 branch to trunk
971 978
972 979 * ipapi.py: Add new ipapi method, expand_alias.
973 980
974 981 * Release.py: Bump up version to 0.7.4.svn
975 982
976 983 2006-12-17 Ville Vainio <vivainio@gmail.com>
977 984
978 985 * Extensions/jobctrl.py: Fixed &cmd arg arg...
979 986 to work properly on posix too
980 987
981 988 * Release.py: Update revnum (version is still just 0.7.3).
982 989
983 990 2006-12-15 Ville Vainio <vivainio@gmail.com>
984 991
985 992 * scripts/ipython_win_post_install: create ipython.py in
986 993 prefix + "/scripts".
987 994
988 995 * Release.py: Update version to 0.7.3.
989 996
990 997 2006-12-14 Ville Vainio <vivainio@gmail.com>
991 998
992 999 * scripts/ipython_win_post_install: Overwrite old shortcuts
993 1000 if they already exist
994 1001
995 1002 * Release.py: release 0.7.3rc2
996 1003
997 1004 2006-12-13 Ville Vainio <vivainio@gmail.com>
998 1005
999 1006 * Branch and update Release.py for 0.7.3rc1
1000 1007
1001 1008 2006-12-13 Fernando Perez <Fernando.Perez@colorado.edu>
1002 1009
1003 1010 * IPython/Shell.py (IPShellWX): update for current WX naming
1004 1011 conventions, to avoid a deprecation warning with current WX
1005 1012 versions. Thanks to a report by Danny Shevitz.
1006 1013
1007 1014 2006-12-12 Ville Vainio <vivainio@gmail.com>
1008 1015
1009 1016 * ipmaker.py: apply david cournapeau's patch to make
1010 1017 import_some work properly even when ipythonrc does
1011 1018 import_some on empty list (it was an old bug!).
1012 1019
1013 1020 * UserConfig/ipy_user_conf.py, UserConfig/ipythonrc:
1014 1021 Add deprecation note to ipythonrc and a url to wiki
1015 1022 in ipy_user_conf.py
1016 1023
1017 1024
1018 1025 * Magic.py (%run): %run myscript.ipy now runs myscript.ipy
1019 1026 as if it was typed on IPython command prompt, i.e.
1020 1027 as IPython script.
1021 1028
1022 1029 * example-magic.py, magic_grepl.py: remove outdated examples
1023 1030
1024 1031 2006-12-11 Fernando Perez <Fernando.Perez@colorado.edu>
1025 1032
1026 1033 * IPython/iplib.py (debugger): prevent a nasty traceback if %debug
1027 1034 is called before any exception has occurred.
1028 1035
1029 1036 2006-12-08 Ville Vainio <vivainio@gmail.com>
1030 1037
1031 1038 * Extensions/ipy_stock_completers.py: fix cd completer
1032 1039 to translate /'s to \'s again.
1033 1040
1034 1041 * completer.py: prevent traceback on file completions w/
1035 1042 backslash.
1036 1043
1037 1044 * Release.py: Update release number to 0.7.3b3 for release
1038 1045
1039 1046 2006-12-07 Ville Vainio <vivainio@gmail.com>
1040 1047
1041 1048 * Extensions/ipy_signals.py: Ignore ctrl+C in IPython process
1042 1049 while executing external code. Provides more shell-like behaviour
1043 1050 and overall better response to ctrl + C / ctrl + break.
1044 1051
1045 1052 * tools/make_tarball.py: new script to create tarball straight from svn
1046 1053 (setup.py sdist doesn't work on win32).
1047 1054
1048 1055 * Extensions/ipy_stock_completers.py: fix cd completer to give up
1049 1056 on dirnames with spaces and use the default completer instead.
1050 1057
1051 1058 * Revision.py: Change version to 0.7.3b2 for release.
1052 1059
1053 1060 2006-12-05 Ville Vainio <vivainio@gmail.com>
1054 1061
1055 1062 * Magic.py, iplib.py, completer.py: Apply R. Bernstein's
1056 1063 pydb patch 4 (rm debug printing, py 2.5 checking)
1057 1064
1058 1065 2006-11-30 Walter Doerwald <walter@livinglogic.de>
1059 1066 * IPython/Extensions/ibrowse.py: Add two new commands to ibrowse:
1060 1067 "refresh" (mapped to "r") refreshes the screen by restarting the iterator.
1061 1068 "refreshfind" (mapped to "R") does the same but tries to go back to the same
1062 1069 object the cursor was on before the refresh. The command "markrange" is
1063 1070 mapped to "%" now.
1064 1071 * IPython/Extensions/ibrowse.py: Make igrpentry and ipwdentry comparable.
1065 1072
1066 1073 2006-11-29 Fernando Perez <Fernando.Perez@colorado.edu>
1067 1074
1068 1075 * IPython/Magic.py (magic_debug): new %debug magic to activate the
1069 1076 interactive debugger on the last traceback, without having to call
1070 1077 %pdb and rerun your code. Made minor changes in various modules,
1071 1078 should automatically recognize pydb if available.
1072 1079
1073 1080 2006-11-28 Ville Vainio <vivainio@gmail.com>
1074 1081
1075 1082 * completer.py: If the text start with !, show file completions
1076 1083 properly. This helps when trying to complete command name
1077 1084 for shell escapes.
1078 1085
1079 1086 2006-11-27 Ville Vainio <vivainio@gmail.com>
1080 1087
1081 1088 * ipy_stock_completers.py: bzr completer submitted by Stefan van
1082 1089 der Walt. Clean up svn and hg completers by using a common
1083 1090 vcs_completer.
1084 1091
1085 1092 2006-11-26 Ville Vainio <vivainio@gmail.com>
1086 1093
1087 1094 * Remove ipconfig and %config; you should use _ip.options structure
1088 1095 directly instead!
1089 1096
1090 1097 * genutils.py: add wrap_deprecated function for deprecating callables
1091 1098
1092 1099 * iplib.py: deprecate ipmagic, ipsystem, ipalias. Use _ip.magic and
1093 1100 _ip.system instead. ipalias is redundant.
1094 1101
1095 1102 * Magic.py: %rehashdir no longer aliases 'cmdname' to 'cmdname.exe' on
1096 1103 win32, but just 'cmdname'. Other extensions (non-'exe') are still made
1097 1104 explicit.
1098 1105
1099 1106 * ipy_stock_completers.py: 'hg' (mercurial VCS) now has a custom
1100 1107 completer. Try it by entering 'hg ' and pressing tab.
1101 1108
1102 1109 * macro.py: Give Macro a useful __repr__ method
1103 1110
1104 1111 * Magic.py: %whos abbreviates the typename of Macro for brevity.
1105 1112
1106 1113 2006-11-24 Walter Doerwald <walter@livinglogic.de>
1107 1114 * IPython/Extensions/astyle.py: Do a relative import of ipipe, so that
1108 1115 we don't get a duplicate ipipe module, where registration of the xrepr
1109 1116 implementation for Text is useless.
1110 1117
1111 1118 * IPython/Extensions/ipipe.py: Fix __xrepr__() implementation for ils.
1112 1119
1113 1120 * IPython/Extensions/ibrowse.py: Fix keymapping for the enter command.
1114 1121
1115 1122 2006-11-24 Ville Vainio <vivainio@gmail.com>
1116 1123
1117 1124 * Magic.py, manual_base.lyx: Kirill Smelkov patch:
1118 1125 try to use "cProfile" instead of the slower pure python
1119 1126 "profile"
1120 1127
1121 1128 2006-11-23 Ville Vainio <vivainio@gmail.com>
1122 1129
1123 1130 * manual_base.lyx: Kirill Smelkov patch: Fix wrong
1124 1131 Qt+IPython+Designer link in documentation.
1125 1132
1126 1133 * Extensions/ipy_pydb.py: R. Bernstein's patch for passing
1127 1134 correct Pdb object to %pydb.
1128 1135
1129 1136
1130 1137 2006-11-22 Walter Doerwald <walter@livinglogic.de>
1131 1138 * IPython/Extensions/astyle.py: Text needs it's own implemenation of the
1132 1139 generic xrepr(), otherwise the list implementation would kick in.
1133 1140
1134 1141 2006-11-21 Ville Vainio <vivainio@gmail.com>
1135 1142
1136 1143 * upgrade_dir.py: Now actually overwrites a nonmodified user file
1137 1144 with one from UserConfig.
1138 1145
1139 1146 * ipy_profile_sh.py: Add dummy "depth" to var_expand lambda,
1140 1147 it was missing which broke the sh profile.
1141 1148
1142 1149 * completer.py: file completer now uses explicit '/' instead
1143 1150 of os.path.join, expansion of 'foo' was broken on win32
1144 1151 if there was one directory with name 'foobar'.
1145 1152
1146 1153 * A bunch of patches from Kirill Smelkov:
1147 1154
1148 1155 * [patch 9/9] doc: point bug-tracker URL to IPythons trac-tickets.
1149 1156
1150 1157 * [patch 7/9] Implement %page -r (page in raw mode) -
1151 1158
1152 1159 * [patch 5/9] ScientificPython webpage has moved
1153 1160
1154 1161 * [patch 4/9] The manual mentions %ds, should be %dhist
1155 1162
1156 1163 * [patch 3/9] Kill old bits from %prun doc.
1157 1164
1158 1165 * [patch 1/9] Fix typos here and there.
1159 1166
1160 1167 2006-11-08 Ville Vainio <vivainio@gmail.com>
1161 1168
1162 1169 * completer.py (attr_matches): catch all exceptions raised
1163 1170 by eval of expr with dots.
1164 1171
1165 1172 2006-11-07 Fernando Perez <Fernando.Perez@colorado.edu>
1166 1173
1167 1174 * IPython/iplib.py (runsource): Prepend an 'if 1:' to the user
1168 1175 input if it starts with whitespace. This allows you to paste
1169 1176 indented input from any editor without manually having to type in
1170 1177 the 'if 1:', which is convenient when working interactively.
1171 1178 Slightly modifed version of a patch by Bo Peng
1172 1179 <bpeng-AT-rice.edu>.
1173 1180
1174 1181 2006-11-03 Fernando Perez <Fernando.Perez@colorado.edu>
1175 1182
1176 1183 * IPython/irunner.py (main): modified irunner so it automatically
1177 1184 recognizes the right runner to use based on the extension (.py for
1178 1185 python, .ipy for ipython and .sage for sage).
1179 1186
1180 1187 * IPython/iplib.py (InteractiveShell.ipconfig): new builtin, also
1181 1188 visible in ipapi as ip.config(), to programatically control the
1182 1189 internal rc object. There's an accompanying %config magic for
1183 1190 interactive use, which has been enhanced to match the
1184 1191 funtionality in ipconfig.
1185 1192
1186 1193 * IPython/Magic.py (magic_system_verbose): Change %system_verbose
1187 1194 so it's not just a toggle, it now takes an argument. Add support
1188 1195 for a customizable header when making system calls, as the new
1189 1196 system_header variable in the ipythonrc file.
1190 1197
1191 1198 2006-11-03 Walter Doerwald <walter@livinglogic.de>
1192 1199
1193 1200 * IPython/Extensions/ipipe.py: xrepr(), xiter() and xattrs() are now
1194 1201 generic functions (using Philip J. Eby's simplegeneric package).
1195 1202 This makes it possible to customize the display of third-party classes
1196 1203 without having to monkeypatch them. xiter() no longer supports a mode
1197 1204 argument and the XMode class has been removed. The same functionality can
1198 1205 be implemented via IterAttributeDescriptor and IterMethodDescriptor.
1199 1206 One consequence of the switch to generic functions is that xrepr() and
1200 1207 xattrs() implementation must define the default value for the mode
1201 1208 argument themselves and xattrs() implementations must return real
1202 1209 descriptors.
1203 1210
1204 1211 * IPython/external: This new subpackage will contain all third-party
1205 1212 packages that are bundled with IPython. (The first one is simplegeneric).
1206 1213
1207 1214 * IPython/Extensions/ipipe.py (ifile/ils): Readd output of the parent
1208 1215 directory which as been dropped in r1703.
1209 1216
1210 1217 * IPython/Extensions/ipipe.py (iless): Fixed.
1211 1218
1212 1219 * IPython/Extensions/ibrowse: Fixed sorting under Python 2.3.
1213 1220
1214 1221 2006-11-03 Fernando Perez <Fernando.Perez@colorado.edu>
1215 1222
1216 1223 * IPython/iplib.py (InteractiveShell.var_expand): fix stack
1217 1224 handling in variable expansion so that shells and magics recognize
1218 1225 function local scopes correctly. Bug reported by Brian.
1219 1226
1220 1227 * scripts/ipython: remove the very first entry in sys.path which
1221 1228 Python auto-inserts for scripts, so that sys.path under IPython is
1222 1229 as similar as possible to that under plain Python.
1223 1230
1224 1231 * IPython/completer.py (IPCompleter.file_matches): Fix
1225 1232 tab-completion so that quotes are not closed unless the completion
1226 1233 is unambiguous. After a request by Stefan. Minor cleanups in
1227 1234 ipy_stock_completers.
1228 1235
1229 1236 2006-11-02 Ville Vainio <vivainio@gmail.com>
1230 1237
1231 1238 * ipy_stock_completers.py: Add %run and %cd completers.
1232 1239
1233 1240 * completer.py: Try running custom completer for both
1234 1241 "foo" and "%foo" if the command is just "foo". Ignore case
1235 1242 when filtering possible completions.
1236 1243
1237 1244 * UserConfig/ipy_user_conf.py: install stock completers as default
1238 1245
1239 1246 * iplib.py (history_saving_wrapper), debugger(), ipy_pydb.py:
1240 1247 simplified readline history save / restore through a wrapper
1241 1248 function
1242 1249
1243 1250
1244 1251 2006-10-31 Ville Vainio <vivainio@gmail.com>
1245 1252
1246 1253 * strdispatch.py, completer.py, ipy_stock_completers.py:
1247 1254 Allow str_key ("command") in completer hooks. Implement
1248 1255 trivial completer for 'import' (stdlib modules only). Rename
1249 1256 ipy_linux_package_managers.py to ipy_stock_completers.py.
1250 1257 SVN completer.
1251 1258
1252 1259 * Extensions/ledit.py: %magic line editor for easily and
1253 1260 incrementally manipulating lists of strings. The magic command
1254 1261 name is %led.
1255 1262
1256 1263 2006-10-30 Ville Vainio <vivainio@gmail.com>
1257 1264
1258 1265 * Debugger.py, iplib.py (debugger()): Add last set of Rocky
1259 1266 Bernsteins's patches for pydb integration.
1260 1267 http://bashdb.sourceforge.net/pydb/
1261 1268
1262 1269 * strdispatch.py, iplib.py, completer.py, IPython/__init__.py,
1263 1270 Extensions/ipy_linux_package_managers.py, hooks.py: Implement
1264 1271 custom completer hook to allow the users to implement their own
1265 1272 completers. See ipy_linux_package_managers.py for example. The
1266 1273 hook name is 'complete_command'.
1267 1274
1268 1275 2006-10-28 Fernando Perez <Fernando.Perez@colorado.edu>
1269 1276
1270 1277 * IPython/UserConfig/ipythonrc-scipy: minor cleanups to remove old
1271 1278 Numeric leftovers.
1272 1279
1273 1280 * ipython.el (py-execute-region): apply Stefan's patch to fix
1274 1281 garbled results if the python shell hasn't been previously started.
1275 1282
1276 1283 * IPython/genutils.py (arg_split): moved to genutils, since it's a
1277 1284 pretty generic function and useful for other things.
1278 1285
1279 1286 * IPython/OInspect.py (getsource): Add customizable source
1280 1287 extractor. After a request/patch form W. Stein (SAGE).
1281 1288
1282 1289 * IPython/irunner.py (InteractiveRunner.run_source): reset tty
1283 1290 window size to a more reasonable value from what pexpect does,
1284 1291 since their choice causes wrapping bugs with long input lines.
1285 1292
1286 1293 2006-10-28 Ville Vainio <vivainio@gmail.com>
1287 1294
1288 1295 * Magic.py (%run): Save and restore the readline history from
1289 1296 file around %run commands to prevent side effects from
1290 1297 %runned programs that might use readline (e.g. pydb).
1291 1298
1292 1299 * extensions/ipy_pydb.py: Adds %pydb magic when imported, for
1293 1300 invoking the pydb enhanced debugger.
1294 1301
1295 1302 2006-10-23 Walter Doerwald <walter@livinglogic.de>
1296 1303
1297 1304 * IPython/Extensions/ipipe.py (ifile): Remove all methods that
1298 1305 call the base class method and propagate the return value to
1299 1306 ifile. This is now done by path itself.
1300 1307
1301 1308 2006-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
1302 1309
1303 1310 * IPython/ipapi.py (IPApi.__init__): Added new entry to public
1304 1311 api: set_crash_handler(), to expose the ability to change the
1305 1312 internal crash handler.
1306 1313
1307 1314 * IPython/CrashHandler.py (CrashHandler.__init__): abstract out
1308 1315 the various parameters of the crash handler so that apps using
1309 1316 IPython as their engine can customize crash handling. Ipmlemented
1310 1317 at the request of SAGE.
1311 1318
1312 1319 2006-10-14 Ville Vainio <vivainio@gmail.com>
1313 1320
1314 1321 * Magic.py, ipython.el: applied first "safe" part of Rocky
1315 1322 Bernstein's patch set for pydb integration.
1316 1323
1317 1324 * Magic.py (%unalias, %alias): %store'd aliases can now be
1318 1325 removed with '%unalias'. %alias w/o args now shows most
1319 1326 interesting (stored / manually defined) aliases last
1320 1327 where they catch the eye w/o scrolling.
1321 1328
1322 1329 * Magic.py (%rehashx), ext_rehashdir.py: files with
1323 1330 'py' extension are always considered executable, even
1324 1331 when not in PATHEXT environment variable.
1325 1332
1326 1333 2006-10-12 Ville Vainio <vivainio@gmail.com>
1327 1334
1328 1335 * jobctrl.py: Add new "jobctrl" extension for spawning background
1329 1336 processes with "&find /". 'import jobctrl' to try it out. Requires
1330 1337 'subprocess' module, standard in python 2.4+.
1331 1338
1332 1339 * iplib.py (expand_aliases, handle_alias): Aliases expand transitively,
1333 1340 so if foo -> bar and bar -> baz, then foo -> baz.
1334 1341
1335 1342 2006-10-09 Fernando Perez <Fernando.Perez@colorado.edu>
1336 1343
1337 1344 * IPython/Magic.py (Magic.parse_options): add a new posix option
1338 1345 to allow parsing of input args in magics that doesn't strip quotes
1339 1346 (if posix=False). This also closes %timeit bug reported by
1340 1347 Stefan.
1341 1348
1342 1349 2006-10-03 Ville Vainio <vivainio@gmail.com>
1343 1350
1344 1351 * iplib.py (raw_input, interact): Return ValueError catching for
1345 1352 raw_input. Fixes infinite loop for sys.stdin.close() or
1346 1353 sys.stdout.close().
1347 1354
1348 1355 2006-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
1349 1356
1350 1357 * IPython/irunner.py (InteractiveRunner.run_source): small fixes
1351 1358 to help in handling doctests. irunner is now pretty useful for
1352 1359 running standalone scripts and simulate a full interactive session
1353 1360 in a format that can be then pasted as a doctest.
1354 1361
1355 1362 * IPython/iplib.py (InteractiveShell.__init__): Install exit/quit
1356 1363 on top of the default (useless) ones. This also fixes the nasty
1357 1364 way in which 2.5's Quitter() exits (reverted [1785]).
1358 1365
1359 1366 * IPython/Debugger.py (Pdb.__init__): Fix ipdb to work with python
1360 1367 2.5.
1361 1368
1362 1369 * IPython/ultraTB.py (TBTools.set_colors): Make sure that ipdb
1363 1370 color scheme is updated as well when color scheme is changed
1364 1371 interactively.
1365 1372
1366 1373 2006-09-27 Ville Vainio <vivainio@gmail.com>
1367 1374
1368 1375 * iplib.py (raw_input): python 2.5 closes stdin on quit -> avoid
1369 1376 infinite loop and just exit. It's a hack, but will do for a while.
1370 1377
1371 1378 2006-08-25 Walter Doerwald <walter@livinglogic.de>
1372 1379
1373 1380 * IPython/Extensions/ipipe.py (ils): Add arguments dirs and files to
1374 1381 the constructor, this makes it possible to get a list of only directories
1375 1382 or only files.
1376 1383
1377 1384 2006-08-12 Ville Vainio <vivainio@gmail.com>
1378 1385
1379 1386 * Fakemodule.py, OInspect.py: Reverted 2006-08-11 mods,
1380 1387 they broke unittest
1381 1388
1382 1389 2006-08-11 Ville Vainio <vivainio@gmail.com>
1383 1390
1384 1391 * Fakemodule.py, OInspect.py: remove 2006-08-09 monkepatch
1385 1392 by resolving issue properly, i.e. by inheriting FakeModule
1386 1393 from types.ModuleType. Pickling ipython interactive data
1387 1394 should still work as usual (testing appreciated).
1388 1395
1389 1396 2006-08-09 Fernando Perez <Fernando.Perez@colorado.edu>
1390 1397
1391 1398 * IPython/OInspect.py: monkeypatch inspect from the stdlib if
1392 1399 running under python 2.3 with code from 2.4 to fix a bug with
1393 1400 help(). Reported by the Debian maintainers, Norbert Tretkowski
1394 1401 <norbert-AT-tretkowski.de> and Alexandre Fayolle
1395 1402 <afayolle-AT-debian.org>.
1396 1403
1397 1404 2006-08-04 Walter Doerwald <walter@livinglogic.de>
1398 1405
1399 1406 * IPython/Extensions/ibrowse.py: Fixed the help message in the footer
1400 1407 (which was displaying "quit" twice).
1401 1408
1402 1409 2006-07-28 Walter Doerwald <walter@livinglogic.de>
1403 1410
1404 1411 * IPython/Extensions/ipipe.py: Fix isort.__iter__() (was still using
1405 1412 the mode argument).
1406 1413
1407 1414 2006-07-27 Walter Doerwald <walter@livinglogic.de>
1408 1415
1409 1416 * IPython/Extensions/ipipe.py: Fix getglobals() if we're
1410 1417 not running under IPython.
1411 1418
1412 1419 * IPython/Extensions/ipipe.py: Rename XAttr to AttributeDetail
1413 1420 and make it iterable (iterating over the attribute itself). Add two new
1414 1421 magic strings for __xattrs__(): If the string starts with "-", the attribute
1415 1422 will not be displayed in ibrowse's detail view (but it can still be
1416 1423 iterated over). This makes it possible to add attributes that are large
1417 1424 lists or generator methods to the detail view. Replace magic attribute names
1418 1425 and _attrname() and _getattr() with "descriptors": For each type of magic
1419 1426 attribute name there's a subclass of Descriptor: None -> SelfDescriptor();
1420 1427 "foo" -> AttributeDescriptor("foo"); "foo()" -> MethodDescriptor("foo");
1421 1428 "-foo" -> IterAttributeDescriptor("foo"); "-foo()" -> IterMethodDescriptor("foo");
1422 1429 foo() -> FunctionDescriptor(foo). Magic strings returned from __xattrs__()
1423 1430 are still supported.
1424 1431
1425 1432 * IPython/Extensions/ibrowse.py: If fetching the next row from the input
1426 1433 fails in ibrowse.fetch(), the exception object is added as the last item
1427 1434 and item fetching is canceled. This prevents ibrowse from aborting if e.g.
1428 1435 a generator throws an exception midway through execution.
1429 1436
1430 1437 * IPython/Extensions/ipipe.py: Turn ifile's properties mimetype and
1431 1438 encoding into methods.
1432 1439
1433 1440 2006-07-26 Ville Vainio <vivainio@gmail.com>
1434 1441
1435 1442 * iplib.py: history now stores multiline input as single
1436 1443 history entries. Patch by Jorgen Cederlof.
1437 1444
1438 1445 2006-07-18 Walter Doerwald <walter@livinglogic.de>
1439 1446
1440 1447 * IPython/Extensions/ibrowse.py: Make cursor visible over
1441 1448 non existing attributes.
1442 1449
1443 1450 2006-07-14 Walter Doerwald <walter@livinglogic.de>
1444 1451
1445 1452 * IPython/Extensions/ipipe.py (ix): Use os.popen4() so that the
1446 1453 error output of the running command doesn't mess up the screen.
1447 1454
1448 1455 2006-07-13 Walter Doerwald <walter@livinglogic.de>
1449 1456
1450 1457 * IPython/Extensions/ipipe.py (isort): Make isort usable without
1451 1458 argument. This sorts the items themselves.
1452 1459
1453 1460 2006-07-12 Walter Doerwald <walter@livinglogic.de>
1454 1461
1455 1462 * IPython/Extensions/ipipe.py (eval, ifilter, isort, ieval):
1456 1463 Compile expression strings into code objects. This should speed
1457 1464 up ifilter and friends somewhat.
1458 1465
1459 1466 2006-07-08 Ville Vainio <vivainio@gmail.com>
1460 1467
1461 1468 * Magic.py: %cpaste now strips > from the beginning of lines
1462 1469 to ease pasting quoted code from emails. Contributed by
1463 1470 Stefan van der Walt.
1464 1471
1465 1472 2006-06-29 Ville Vainio <vivainio@gmail.com>
1466 1473
1467 1474 * ipmaker.py, Shell.py: qt4agg matplotlib backend support for pylab
1468 1475 mode, patch contributed by Darren Dale. NEEDS TESTING!
1469 1476
1470 1477 2006-06-28 Walter Doerwald <walter@livinglogic.de>
1471 1478
1472 1479 * IPython/Extensions/ibrowse.py: Give the ibrowse cursor row
1473 1480 a blue background. Fix fetching new display rows when the browser
1474 1481 scrolls more than a screenful (e.g. by using the goto command).
1475 1482
1476 1483 2006-06-27 Ville Vainio <vivainio@gmail.com>
1477 1484
1478 1485 * Magic.py (_inspect, _ofind) Apply David Huard's
1479 1486 patch for displaying the correct docstring for 'property'
1480 1487 attributes.
1481 1488
1482 1489 2006-06-23 Walter Doerwald <walter@livinglogic.de>
1483 1490
1484 1491 * IPython/Extensions/ibrowse.py: Put the documentation of the keyboard
1485 1492 commands into the methods implementing them.
1486 1493
1487 1494 2006-06-22 Fernando Perez <Fernando.Perez@colorado.edu>
1488 1495
1489 1496 * ipython.el (ipython-indentation-hook): cleanup patch, submitted
1490 1497 by Kov Chai <tchaikov-AT-gmail.com>. He notes that the original
1491 1498 autoindent support was authored by Jin Liu.
1492 1499
1493 1500 2006-06-22 Walter Doerwald <walter@livinglogic.de>
1494 1501
1495 1502 * IPython/Extensions/ibrowse.py: Replace the plain dictionaries used
1496 1503 for keymaps with a custom class that simplifies handling.
1497 1504
1498 1505 2006-06-19 Walter Doerwald <walter@livinglogic.de>
1499 1506
1500 1507 * IPython/Extensions/ibrowse.py: ibrowse now properly handles terminal
1501 1508 resizing. This requires Python 2.5 to work.
1502 1509
1503 1510 2006-06-16 Walter Doerwald <walter@livinglogic.de>
1504 1511
1505 1512 * IPython/Extensions/ibrowse.py: Add two new commands to
1506 1513 ibrowse: "hideattr" (mapped to "h") hides the attribute under
1507 1514 the cursor. "unhiderattrs" (mapped to "H") reveals all hidden
1508 1515 attributes again. Remapped the help command to "?". Display
1509 1516 keycodes in the range 0x01-0x1F as CTRL-xx. Add CTRL-a and CTRL-e
1510 1517 as keys for the "home" and "end" commands. Add three new commands
1511 1518 to the input mode for "find" and friends: "delend" (CTRL-K)
1512 1519 deletes to the end of line. "incsearchup" searches upwards in the
1513 1520 command history for an input that starts with the text before the cursor.
1514 1521 "incsearchdown" does the same downwards. Removed a bogus mapping of
1515 1522 the x key to "delete".
1516 1523
1517 1524 2006-06-15 Ville Vainio <vivainio@gmail.com>
1518 1525
1519 1526 * iplib.py, hooks.py: Added new generate_prompt hook that can be
1520 1527 used to create prompts dynamically, instead of the "old" way of
1521 1528 assigning "magic" strings to prompt_in1 and prompt_in2. The old
1522 1529 way still works (it's invoked by the default hook), of course.
1523 1530
1524 1531 * Prompts.py: added generate_output_prompt hook for altering output
1525 1532 prompt
1526 1533
1527 1534 * Release.py: Changed version string to 0.7.3.svn.
1528 1535
1529 1536 2006-06-15 Walter Doerwald <walter@livinglogic.de>
1530 1537
1531 1538 * IPython/Extensions/ibrowse.py: Change _BrowserLevel.moveto() so that
1532 1539 the call to fetch() always tries to fetch enough data for at least one
1533 1540 full screen. This makes it possible to simply call moveto(0,0,True) in
1534 1541 the constructor. Fix typos and removed the obsolete goto attribute.
1535 1542
1536 1543 2006-06-12 Ville Vainio <vivainio@gmail.com>
1537 1544
1538 1545 * ipy_profile_sh.py: applied Krisha Mohan Gundu's patch for
1539 1546 allowing $variable interpolation within multiline statements,
1540 1547 though so far only with "sh" profile for a testing period.
1541 1548 The patch also enables splitting long commands with \ but it
1542 1549 doesn't work properly yet.
1543 1550
1544 1551 2006-06-12 Walter Doerwald <walter@livinglogic.de>
1545 1552
1546 1553 * IPython/Extensions/ibrowse.py (_dodisplay): Display the length of the
1547 1554 input history and the position of the cursor in the input history for
1548 1555 the find, findbackwards and goto command.
1549 1556
1550 1557 2006-06-10 Walter Doerwald <walter@livinglogic.de>
1551 1558
1552 1559 * IPython/Extensions/ibrowse.py: Add a class _CommandInput that
1553 1560 implements the basic functionality of browser commands that require
1554 1561 input. Reimplement the goto, find and findbackwards commands as
1555 1562 subclasses of _CommandInput. Add an input history and keymaps to those
1556 1563 commands. Add "\r" as a keyboard shortcut for the enterdefault and
1557 1564 execute commands.
1558 1565
1559 1566 2006-06-07 Ville Vainio <vivainio@gmail.com>
1560 1567
1561 1568 * iplib.py: ipython mybatch.ipy exits ipython immediately after
1562 1569 running the batch files instead of leaving the session open.
1563 1570
1564 1571 2006-06-07 Fernando Perez <Fernando.Perez@colorado.edu>
1565 1572
1566 1573 * IPython/iplib.py (InteractiveShell.__init__): update BSD fix, as
1567 1574 the original fix was incomplete. Patch submitted by W. Maier.
1568 1575
1569 1576 2006-06-07 Ville Vainio <vivainio@gmail.com>
1570 1577
1571 1578 * iplib.py,Magic.py, ipmaker.py (magic_rehashx):
1572 1579 Confirmation prompts can be supressed by 'quiet' option.
1573 1580 _ip.options.quiet = 1 means "assume yes for all yes/no queries".
1574 1581
1575 1582 2006-06-06 *** Released version 0.7.2
1576 1583
1577 1584 2006-06-06 Fernando Perez <Fernando.Perez@colorado.edu>
1578 1585
1579 1586 * IPython/Release.py (version): Made 0.7.2 final for release.
1580 1587 Repo tagged and release cut.
1581 1588
1582 1589 2006-06-05 Ville Vainio <vivainio@gmail.com>
1583 1590
1584 1591 * Magic.py (magic_rehashx): Honor no_alias list earlier in
1585 1592 %rehashx, to avoid clobbering builtins in ipy_profile_sh.py
1586 1593
1587 1594 * upgrade_dir.py: try import 'path' module a bit harder
1588 1595 (for %upgrade)
1589 1596
1590 1597 2006-06-03 Fernando Perez <Fernando.Perez@colorado.edu>
1591 1598
1592 1599 * IPython/genutils.py (ask_yes_no): treat EOF as a default answer
1593 1600 instead of looping 20 times.
1594 1601
1595 1602 * IPython/ipmaker.py (make_IPython): honor -ipythondir flag
1596 1603 correctly at initialization time. Bug reported by Krishna Mohan
1597 1604 Gundu <gkmohan-AT-gmail.com> on the user list.
1598 1605
1599 1606 * IPython/Release.py (version): Mark 0.7.2 version to start
1600 1607 testing for release on 06/06.
1601 1608
1602 1609 2006-05-31 Fernando Perez <Fernando.Perez@colorado.edu>
1603 1610
1604 1611 * scripts/irunner: thin script interface so users don't have to
1605 1612 find the module and call it as an executable, since modules rarely
1606 1613 live in people's PATH.
1607 1614
1608 1615 * IPython/irunner.py (InteractiveRunner.__init__): added
1609 1616 delaybeforesend attribute to control delays with newer versions of
1610 1617 pexpect. Thanks to detailed help from pexpect's author, Noah
1611 1618 Spurrier <noah-AT-noah.org>. Noted how to use the SAGE runner
1612 1619 correctly (it works in NoColor mode).
1613 1620
1614 1621 * IPython/iplib.py (handle_normal): fix nasty crash reported on
1615 1622 SAGE list, from improper log() calls.
1616 1623
1617 1624 2006-05-31 Ville Vainio <vivainio@gmail.com>
1618 1625
1619 1626 * upgrade_dir.py, Magic.py (magic_upgrade): call upgrade_dir
1620 1627 with args in parens to work correctly with dirs that have spaces.
1621 1628
1622 1629 2006-05-30 Fernando Perez <Fernando.Perez@colorado.edu>
1623 1630
1624 1631 * IPython/Logger.py (Logger.logstart): add option to log raw input
1625 1632 instead of the processed one. A -r flag was added to the
1626 1633 %logstart magic used for controlling logging.
1627 1634
1628 1635 2006-05-29 Fernando Perez <Fernando.Perez@colorado.edu>
1629 1636
1630 1637 * IPython/iplib.py (InteractiveShell.__init__): add check for the
1631 1638 *BSDs to omit --color from all 'ls' aliases, since *BSD ls doesn't
1632 1639 recognize the option. After a bug report by Will Maier. This
1633 1640 closes #64 (will do it after confirmation from W. Maier).
1634 1641
1635 1642 * IPython/irunner.py: New module to run scripts as if manually
1636 1643 typed into an interactive environment, based on pexpect. After a
1637 1644 submission by Ken Schutte <kschutte-AT-csail.mit.edu> on the
1638 1645 ipython-user list. Simple unittests in the tests/ directory.
1639 1646
1640 1647 * tools/release: add Will Maier, OpenBSD port maintainer, to
1641 1648 recepients list. We are now officially part of the OpenBSD ports:
1642 1649 http://www.openbsd.org/ports.html ! Many thanks to Will for the
1643 1650 work.
1644 1651
1645 1652 2006-05-26 Fernando Perez <Fernando.Perez@colorado.edu>
1646 1653
1647 1654 * IPython/ipmaker.py (make_IPython): modify sys.argv fix (below)
1648 1655 so that it doesn't break tkinter apps.
1649 1656
1650 1657 * IPython/iplib.py (_prefilter): fix bug where aliases would
1651 1658 shadow variables when autocall was fully off. Reported by SAGE
1652 1659 author William Stein.
1653 1660
1654 1661 * IPython/OInspect.py (Inspector.__init__): add a flag to control
1655 1662 at what detail level strings are computed when foo? is requested.
1656 1663 This allows users to ask for example that the string form of an
1657 1664 object is only computed when foo?? is called, or even never, by
1658 1665 setting the object_info_string_level >= 2 in the configuration
1659 1666 file. This new option has been added and documented. After a
1660 1667 request by SAGE to be able to control the printing of very large
1661 1668 objects more easily.
1662 1669
1663 1670 2006-05-25 Fernando Perez <Fernando.Perez@colorado.edu>
1664 1671
1665 1672 * IPython/ipmaker.py (make_IPython): remove the ipython call path
1666 1673 from sys.argv, to be 100% consistent with how Python itself works
1667 1674 (as seen for example with python -i file.py). After a bug report
1668 1675 by Jeffrey Collins.
1669 1676
1670 1677 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix
1671 1678 nasty bug which was preventing custom namespaces with -pylab,
1672 1679 reported by M. Foord. Minor cleanup, remove old matplotlib.matlab
1673 1680 compatibility (long gone from mpl).
1674 1681
1675 1682 * IPython/ipapi.py (make_session): name change: create->make. We
1676 1683 use make in other places (ipmaker,...), it's shorter and easier to
1677 1684 type and say, etc. I'm trying to clean things before 0.7.2 so
1678 1685 that I can keep things stable wrt to ipapi in the chainsaw branch.
1679 1686
1680 1687 * ipython.el: fix the py-pdbtrack-input-prompt variable so that
1681 1688 python-mode recognizes our debugger mode. Add support for
1682 1689 autoindent inside (X)emacs. After a patch sent in by Jin Liu
1683 1690 <m.liu.jin-AT-gmail.com> originally written by
1684 1691 doxgen-AT-newsmth.net (with minor modifications for xemacs
1685 1692 compatibility)
1686 1693
1687 1694 * IPython/Debugger.py (Pdb.format_stack_entry): fix formatting of
1688 1695 tracebacks when walking the stack so that the stack tracking system
1689 1696 in emacs' python-mode can identify the frames correctly.
1690 1697
1691 1698 * IPython/ipmaker.py (make_IPython): make the internal (and
1692 1699 default config) autoedit_syntax value false by default. Too many
1693 1700 users have complained to me (both on and off-list) about problems
1694 1701 with this option being on by default, so I'm making it default to
1695 1702 off. It can still be enabled by anyone via the usual mechanisms.
1696 1703
1697 1704 * IPython/completer.py (Completer.attr_matches): add support for
1698 1705 PyCrust-style _getAttributeNames magic method. Patch contributed
1699 1706 by <mscott-AT-goldenspud.com>. Closes #50.
1700 1707
1701 1708 * IPython/iplib.py (InteractiveShell.__init__): remove the
1702 1709 deletion of exit/quit from __builtin__, which can break
1703 1710 third-party tools like the Zope debugging console. The
1704 1711 %exit/%quit magics remain. In general, it's probably a good idea
1705 1712 not to delete anything from __builtin__, since we never know what
1706 1713 that will break. In any case, python now (for 2.5) will support
1707 1714 'real' exit/quit, so this issue is moot. Closes #55.
1708 1715
1709 1716 * IPython/genutils.py (with_obj): rename the 'with' function to
1710 1717 'withobj' to avoid incompatibilities with Python 2.5, where 'with'
1711 1718 becomes a language keyword. Closes #53.
1712 1719
1713 1720 * IPython/FakeModule.py (FakeModule.__init__): add a proper
1714 1721 __file__ attribute to this so it fools more things into thinking
1715 1722 it is a real module. Closes #59.
1716 1723
1717 1724 * IPython/Magic.py (magic_edit): add -n option to open the editor
1718 1725 at a specific line number. After a patch by Stefan van der Walt.
1719 1726
1720 1727 2006-05-23 Fernando Perez <Fernando.Perez@colorado.edu>
1721 1728
1722 1729 * IPython/iplib.py (edit_syntax_error): fix crash when for some
1723 1730 reason the file could not be opened. After automatic crash
1724 1731 reports sent by James Graham <jgraham-AT-ast.cam.ac.uk> and
1725 1732 Charles Dolan <charlespatrickdolan-AT-yahoo.com>.
1726 1733 (_should_recompile): Don't fire editor if using %bg, since there
1727 1734 is no file in the first place. From the same report as above.
1728 1735 (raw_input): protect against faulty third-party prefilters. After
1729 1736 an automatic crash report sent by Dirk Laurie <dirk-AT-sun.ac.za>
1730 1737 while running under SAGE.
1731 1738
1732 1739 2006-05-23 Ville Vainio <vivainio@gmail.com>
1733 1740
1734 1741 * ipapi.py: Stripped down ip.to_user_ns() to work only as
1735 1742 ip.to_user_ns("x1 y1"), which exposes vars x1 and y1. ipapi.get()
1736 1743 now returns None (again), unless dummy is specifically allowed by
1737 1744 ipapi.get(allow_dummy=True).
1738 1745
1739 1746 2006-05-18 Fernando Perez <Fernando.Perez@colorado.edu>
1740 1747
1741 1748 * IPython: remove all 2.2-compatibility objects and hacks from
1742 1749 everywhere, since we only support 2.3 at this point. Docs
1743 1750 updated.
1744 1751
1745 1752 * IPython/ipapi.py (IPApi.__init__): Cleanup of all getters.
1746 1753 Anything requiring extra validation can be turned into a Python
1747 1754 property in the future. I used a property for the db one b/c
1748 1755 there was a nasty circularity problem with the initialization
1749 1756 order, which right now I don't have time to clean up.
1750 1757
1751 1758 * IPython/Shell.py (MTInteractiveShell.runcode): Fix, I think,
1752 1759 another locking bug reported by Jorgen. I'm not 100% sure though,
1753 1760 so more testing is needed...
1754 1761
1755 1762 2006-05-17 Fernando Perez <Fernando.Perez@colorado.edu>
1756 1763
1757 1764 * IPython/ipapi.py (IPApi.to_user_ns): New function to inject
1758 1765 local variables from any routine in user code (typically executed
1759 1766 with %run) directly into the interactive namespace. Very useful
1760 1767 when doing complex debugging.
1761 1768 (IPythonNotRunning): Changed the default None object to a dummy
1762 1769 whose attributes can be queried as well as called without
1763 1770 exploding, to ease writing code which works transparently both in
1764 1771 and out of ipython and uses some of this API.
1765 1772
1766 1773 2006-05-16 Fernando Perez <Fernando.Perez@colorado.edu>
1767 1774
1768 1775 * IPython/hooks.py (result_display): Fix the fact that our display
1769 1776 hook was using str() instead of repr(), as the default python
1770 1777 console does. This had gone unnoticed b/c it only happened if
1771 1778 %Pprint was off, but the inconsistency was there.
1772 1779
1773 1780 2006-05-15 Ville Vainio <vivainio@gmail.com>
1774 1781
1775 1782 * Oinspect.py: Only show docstring for nonexisting/binary files
1776 1783 when doing object??, closing ticket #62
1777 1784
1778 1785 2006-05-13 Fernando Perez <Fernando.Perez@colorado.edu>
1779 1786
1780 1787 * IPython/Shell.py (MTInteractiveShell.runsource): Fix threading
1781 1788 bug, closes http://www.scipy.net/roundup/ipython/issue55. A lock
1782 1789 was being released in a routine which hadn't checked if it had
1783 1790 been the one to acquire it.
1784 1791
1785 1792 2006-05-07 Fernando Perez <Fernando.Perez@colorado.edu>
1786 1793
1787 1794 * IPython/Release.py (version): put out 0.7.2.rc1 for testing.
1788 1795
1789 1796 2006-04-11 Ville Vainio <vivainio@gmail.com>
1790 1797
1791 1798 * iplib.py, ipmaker.py: .ipy extension now means "ipython batch file"
1792 1799 in command line. E.g. "ipython test.ipy" runs test.ipy with ipython
1793 1800 prefilters, allowing stuff like magics and aliases in the file.
1794 1801
1795 1802 * Prompts.py, Extensions/clearcmd.py, ipy_system_conf.py: %clear magic
1796 1803 added. Supported now are "%clear in" and "%clear out" (clear input and
1797 1804 output history, respectively). Also fixed CachedOutput.flush to
1798 1805 properly flush the output cache.
1799 1806
1800 1807 * Extensions/pspersistence.py: Fix %store to avoid "%store obj.attr"
1801 1808 half-success (and fail explicitly).
1802 1809
1803 1810 2006-03-28 Ville Vainio <vivainio@gmail.com>
1804 1811
1805 1812 * iplib.py: Fix quoting of aliases so that only argless ones
1806 1813 are quoted
1807 1814
1808 1815 2006-03-28 Ville Vainio <vivainio@gmail.com>
1809 1816
1810 1817 * iplib.py: Quote aliases with spaces in the name.
1811 1818 "c:\program files\blah\bin" is now legal alias target.
1812 1819
1813 1820 * ext_rehashdir.py: Space no longer allowed as arg
1814 1821 separator, since space is legal in path names.
1815 1822
1816 1823 2006-03-16 Ville Vainio <vivainio@gmail.com>
1817 1824
1818 1825 * upgrade_dir.py: Take path.py from Extensions, correcting
1819 1826 %upgrade magic
1820 1827
1821 1828 * ipmaker.py: Suggest using %upgrade if ipy_user_conf.py isn't found.
1822 1829
1823 1830 * hooks.py: Only enclose editor binary in quotes if legal and
1824 1831 necessary (space in the name, and is an existing file). Fixes a bug
1825 1832 reported by Zachary Pincus.
1826 1833
1827 1834 2006-03-13 Fernando Perez <Fernando.Perez@colorado.edu>
1828 1835
1829 1836 * Manual: thanks to a tip on proper color handling for Emacs, by
1830 1837 Eric J Haywiser <ejh1-AT-MIT.EDU>.
1831 1838
1832 1839 * ipython.el: close http://www.scipy.net/roundup/ipython/issue57
1833 1840 by applying the provided patch. Thanks to Liu Jin
1834 1841 <m.liu.jin-AT-gmail.com> for the contribution. No problems under
1835 1842 XEmacs/Linux, I'm trusting the submitter that it actually helps
1836 1843 under win32/GNU Emacs. Will revisit if any problems are reported.
1837 1844
1838 1845 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
1839 1846
1840 1847 * IPython/Gnuplot2.py (_FileClass): update for current Gnuplot.py
1841 1848 from SVN, thanks to a patch by Ryan Woodard <rywo@bas.ac.uk>.
1842 1849
1843 1850 2006-03-12 Ville Vainio <vivainio@gmail.com>
1844 1851
1845 1852 * Magic.py (magic_timeit): Added %timeit magic, contributed by
1846 1853 Torsten Marek.
1847 1854
1848 1855 2006-03-12 Fernando Perez <Fernando.Perez@colorado.edu>
1849 1856
1850 1857 * IPython/Magic.py (magic_macro): fix so that the n1-n2 syntax for
1851 1858 line ranges works again.
1852 1859
1853 1860 2006-03-11 Fernando Perez <Fernando.Perez@colorado.edu>
1854 1861
1855 1862 * IPython/iplib.py (showtraceback): add back sys.last_traceback
1856 1863 and friends, after a discussion with Zach Pincus on ipython-user.
1857 1864 I'm not 100% sure, but after thinking about it quite a bit, it may
1858 1865 be OK. Testing with the multithreaded shells didn't reveal any
1859 1866 problems, but let's keep an eye out.
1860 1867
1861 1868 In the process, I fixed a few things which were calling
1862 1869 self.InteractiveTB() directly (like safe_execfile), which is a
1863 1870 mistake: ALL exception reporting should be done by calling
1864 1871 self.showtraceback(), which handles state and tab-completion and
1865 1872 more.
1866 1873
1867 1874 2006-03-01 Ville Vainio <vivainio@gmail.com>
1868 1875
1869 1876 * Extensions/ipipe.py: Added Walter Doerwald's "ipipe" module.
1870 1877 To use, do "from ipipe import *".
1871 1878
1872 1879 2006-02-24 Ville Vainio <vivainio@gmail.com>
1873 1880
1874 1881 * Magic.py, upgrade_dir.py: %upgrade magic added. Does things more
1875 1882 "cleanly" and safely than the older upgrade mechanism.
1876 1883
1877 1884 2006-02-21 Ville Vainio <vivainio@gmail.com>
1878 1885
1879 1886 * Magic.py: %save works again.
1880 1887
1881 1888 2006-02-15 Ville Vainio <vivainio@gmail.com>
1882 1889
1883 1890 * Magic.py: %Pprint works again
1884 1891
1885 1892 * Extensions/ipy_sane_defaults.py: Provide everything provided
1886 1893 in default ipythonrc, to make it possible to have a completely empty
1887 1894 ipythonrc (and thus completely rc-file free configuration)
1888 1895
1889 1896 2006-02-11 Fernando Perez <Fernando.Perez@colorado.edu>
1890 1897
1891 1898 * IPython/hooks.py (editor): quote the call to the editor command,
1892 1899 to allow commands with spaces in them. Problem noted by watching
1893 1900 Ian Oswald's video about textpad under win32 at
1894 1901 http://showmedo.com/videoListPage?listKey=PythonIPythonSeries
1895 1902
1896 1903 * IPython/UserConfig/ipythonrc: Replace @ signs with % when
1897 1904 describing magics (we haven't used @ for a loong time).
1898 1905
1899 1906 * IPython/ultraTB.py (VerboseTB.text.text_repr): Added patch
1900 1907 contributed by marienz to close
1901 1908 http://www.scipy.net/roundup/ipython/issue53.
1902 1909
1903 1910 2006-02-10 Ville Vainio <vivainio@gmail.com>
1904 1911
1905 1912 * genutils.py: getoutput now works in win32 too
1906 1913
1907 1914 * completer.py: alias and magic completion only invoked
1908 1915 at the first "item" in the line, to avoid "cd %store"
1909 1916 nonsense.
1910 1917
1911 1918 2006-02-09 Ville Vainio <vivainio@gmail.com>
1912 1919
1913 1920 * test/*: Added a unit testing framework (finally).
1914 1921 '%run runtests.py' to run test_*.
1915 1922
1916 1923 * ipapi.py: Exposed runlines and set_custom_exc
1917 1924
1918 1925 2006-02-07 Ville Vainio <vivainio@gmail.com>
1919 1926
1920 1927 * iplib.py: don't split "f 1 2" to "f(1,2)" in autocall,
1921 1928 instead use "f(1 2)" as before.
1922 1929
1923 1930 2006-02-05 Fernando Perez <Fernando.Perez@colorado.edu>
1924 1931
1925 1932 * IPython/demo.py (IPythonDemo): Add new classes to the demo
1926 1933 facilities, for demos processed by the IPython input filter
1927 1934 (IPythonDemo), and for running a script one-line-at-a-time as a
1928 1935 demo, both for pure Python (LineDemo) and for IPython-processed
1929 1936 input (IPythonLineDemo). After a request by Dave Kohel, from the
1930 1937 SAGE team.
1931 1938 (Demo.edit): added an edit() method to the demo objects, to edit
1932 1939 the in-memory copy of the last executed block.
1933 1940
1934 1941 * IPython/Magic.py (magic_edit): add '-r' option for 'raw'
1935 1942 processing to %edit, %macro and %save. These commands can now be
1936 1943 invoked on the unprocessed input as it was typed by the user
1937 1944 (without any prefilters applied). After requests by the SAGE team
1938 1945 at SAGE days 2006: http://modular.ucsd.edu/sage/days1/schedule.html.
1939 1946
1940 1947 2006-02-01 Ville Vainio <vivainio@gmail.com>
1941 1948
1942 1949 * setup.py, eggsetup.py: easy_install ipython==dev works
1943 1950 correctly now (on Linux)
1944 1951
1945 1952 * ipy_user_conf,ipmaker: user config changes, removed spurious
1946 1953 warnings
1947 1954
1948 1955 * iplib: if rc.banner is string, use it as is.
1949 1956
1950 1957 * Magic: %pycat accepts a string argument and pages it's contents.
1951 1958
1952 1959
1953 1960 2006-01-30 Ville Vainio <vivainio@gmail.com>
1954 1961
1955 1962 * pickleshare,pspersistence,ipapi,Magic: persistence overhaul.
1956 1963 Now %store and bookmarks work through PickleShare, meaning that
1957 1964 concurrent access is possible and all ipython sessions see the
1958 1965 same database situation all the time, instead of snapshot of
1959 1966 the situation when the session was started. Hence, %bookmark
1960 1967 results are immediately accessible from othes sessions. The database
1961 1968 is also available for use by user extensions. See:
1962 1969 http://www.python.org/pypi/pickleshare
1963 1970
1964 1971 * hooks.py: Two new hooks, 'shutdown_hook' and 'late_startup_hook'.
1965 1972
1966 1973 * aliases can now be %store'd
1967 1974
1968 1975 * path.py moved to Extensions so that pickleshare does not need
1969 1976 IPython-specific import. Extensions added to pythonpath right
1970 1977 at __init__.
1971 1978
1972 1979 * iplib.py: ipalias deprecated/redundant; aliases are converted and
1973 1980 called with _ip.system and the pre-transformed command string.
1974 1981
1975 1982 2006-01-29 Fernando Perez <Fernando.Perez@colorado.edu>
1976 1983
1977 1984 * IPython/iplib.py (interact): Fix that we were not catching
1978 1985 KeyboardInterrupt exceptions properly. I'm not quite sure why the
1979 1986 logic here had to change, but it's fixed now.
1980 1987
1981 1988 2006-01-29 Ville Vainio <vivainio@gmail.com>
1982 1989
1983 1990 * iplib.py: Try to import pyreadline on Windows.
1984 1991
1985 1992 2006-01-27 Ville Vainio <vivainio@gmail.com>
1986 1993
1987 1994 * iplib.py: Expose ipapi as _ip in builtin namespace.
1988 1995 Makes ipmagic (-> _ip.magic), ipsystem (-> _ip.system)
1989 1996 and ip_set_hook (-> _ip.set_hook) redundant. % and !
1990 1997 syntax now produce _ip.* variant of the commands.
1991 1998
1992 1999 * "_ip.options().autoedit_syntax = 2" automatically throws
1993 2000 user to editor for syntax error correction without prompting.
1994 2001
1995 2002 2006-01-27 Ville Vainio <vivainio@gmail.com>
1996 2003
1997 2004 * ipmaker.py: Give "realistic" sys.argv for scripts (without
1998 2005 'ipython' at argv[0]) executed through command line.
1999 2006 NOTE: this DEPRECATES calling ipython with multiple scripts
2000 2007 ("ipython a.py b.py c.py")
2001 2008
2002 2009 * iplib.py, hooks.py: Added configurable input prefilter,
2003 2010 named 'input_prefilter'. See ext_rescapture.py for example
2004 2011 usage.
2005 2012
2006 2013 * ext_rescapture.py, Magic.py: Better system command output capture
2007 2014 through 'var = !ls' (deprecates user-visible %sc). Same notation
2008 2015 applies for magics, 'var = %alias' assigns alias list to var.
2009 2016
2010 2017 * ipapi.py: added meta() for accessing extension-usable data store.
2011 2018
2012 2019 * iplib.py: added InteractiveShell.getapi(). New magics should be
2013 2020 written doing self.getapi() instead of using the shell directly.
2014 2021
2015 2022 * Magic.py: %store now allows doing %store foo > ~/myfoo.txt and
2016 2023 %store foo >> ~/myfoo.txt to store variables to files (in clean
2017 2024 textual form, not a restorable pickle).
2018 2025
2019 2026 * ipmaker.py: now import ipy_profile_PROFILENAME automatically
2020 2027
2021 2028 * usage.py, Magic.py: added %quickref
2022 2029
2023 2030 * iplib.py: ESC_PAREN fixes: /f 1 2 -> f(1,2), not f(1 2).
2024 2031
2025 2032 * GetoptErrors when invoking magics etc. with wrong args
2026 2033 are now more helpful:
2027 2034 GetoptError: option -l not recognized (allowed: "qb" )
2028 2035
2029 2036 2006-01-25 Fernando Perez <Fernando.Perez@colorado.edu>
2030 2037
2031 2038 * IPython/demo.py (Demo.show): Flush stdout after each block, so
2032 2039 computationally intensive blocks don't appear to stall the demo.
2033 2040
2034 2041 2006-01-24 Ville Vainio <vivainio@gmail.com>
2035 2042
2036 2043 * iplib.py, hooks.py: 'result_display' hook can return a non-None
2037 2044 value to manipulate resulting history entry.
2038 2045
2039 2046 * ipapi.py: Moved TryNext here from hooks.py. Moved functions
2040 2047 to instance methods of IPApi class, to make extending an embedded
2041 2048 IPython feasible. See ext_rehashdir.py for example usage.
2042 2049
2043 2050 * Merged 1071-1076 from branches/0.7.1
2044 2051
2045 2052
2046 2053 2006-01-23 Fernando Perez <Fernando.Perez@colorado.edu>
2047 2054
2048 2055 * tools/release (daystamp): Fix build tools to use the new
2049 2056 eggsetup.py script to build lightweight eggs.
2050 2057
2051 2058 * Applied changesets 1062 and 1064 before 0.7.1 release.
2052 2059
2053 2060 * IPython/Magic.py (magic_history): Add '-r' option to %hist, to
2054 2061 see the raw input history (without conversions like %ls ->
2055 2062 ipmagic("ls")). After a request from W. Stein, SAGE
2056 2063 (http://modular.ucsd.edu/sage) developer. This information is
2057 2064 stored in the input_hist_raw attribute of the IPython instance, so
2058 2065 developers can access it if needed (it's an InputList instance).
2059 2066
2060 2067 * Versionstring = 0.7.2.svn
2061 2068
2062 2069 * eggsetup.py: A separate script for constructing eggs, creates
2063 2070 proper launch scripts even on Windows (an .exe file in
2064 2071 \python24\scripts).
2065 2072
2066 2073 * ipapi.py: launch_new_instance, launch entry point needed for the
2067 2074 egg.
2068 2075
2069 2076 2006-01-23 Ville Vainio <vivainio@gmail.com>
2070 2077
2071 2078 * Added %cpaste magic for pasting python code
2072 2079
2073 2080 2006-01-22 Ville Vainio <vivainio@gmail.com>
2074 2081
2075 2082 * Merge from branches/0.7.1 into trunk, revs 1052-1057
2076 2083
2077 2084 * Versionstring = 0.7.2.svn
2078 2085
2079 2086 * eggsetup.py: A separate script for constructing eggs, creates
2080 2087 proper launch scripts even on Windows (an .exe file in
2081 2088 \python24\scripts).
2082 2089
2083 2090 * ipapi.py: launch_new_instance, launch entry point needed for the
2084 2091 egg.
2085 2092
2086 2093 2006-01-22 Fernando Perez <Fernando.Perez@colorado.edu>
2087 2094
2088 2095 * IPython/OInspect.py (Inspector.pinfo): fix bug where foo?? or
2089 2096 %pfile foo would print the file for foo even if it was a binary.
2090 2097 Now, extensions '.so' and '.dll' are skipped.
2091 2098
2092 2099 * IPython/Shell.py (MTInteractiveShell.__init__): Fix threading
2093 2100 bug, where macros would fail in all threaded modes. I'm not 100%
2094 2101 sure, so I'm going to put out an rc instead of making a release
2095 2102 today, and wait for feedback for at least a few days.
2096 2103
2097 2104 * IPython/iplib.py (handle_normal): fix (finally? somehow I doubt
2098 2105 it...) the handling of pasting external code with autoindent on.
2099 2106 To get out of a multiline input, the rule will appear for most
2100 2107 users unchanged: two blank lines or change the indent level
2101 2108 proposed by IPython. But there is a twist now: you can
2102 2109 add/subtract only *one or two spaces*. If you add/subtract three
2103 2110 or more (unless you completely delete the line), IPython will
2104 2111 accept that line, and you'll need to enter a second one of pure
2105 2112 whitespace. I know it sounds complicated, but I can't find a
2106 2113 different solution that covers all the cases, with the right
2107 2114 heuristics. Hopefully in actual use, nobody will really notice
2108 2115 all these strange rules and things will 'just work'.
2109 2116
2110 2117 2006-01-21 Fernando Perez <Fernando.Perez@colorado.edu>
2111 2118
2112 2119 * IPython/iplib.py (interact): catch exceptions which can be
2113 2120 triggered asynchronously by signal handlers. Thanks to an
2114 2121 automatic crash report, submitted by Colin Kingsley
2115 2122 <tercel-AT-gentoo.org>.
2116 2123
2117 2124 2006-01-20 Ville Vainio <vivainio@gmail.com>
2118 2125
2119 2126 * Ipython/Extensions/ext_rehashdir.py: Created a usable example
2120 2127 (%rehashdir, very useful, try it out) of how to extend ipython
2121 2128 with new magics. Also added Extensions dir to pythonpath to make
2122 2129 importing extensions easy.
2123 2130
2124 2131 * %store now complains when trying to store interactively declared
2125 2132 classes / instances of those classes.
2126 2133
2127 2134 * Extensions/ipy_system_conf.py, UserConfig/ipy_user_conf.py,
2128 2135 ipmaker.py: Config rehaul. Now ipy_..._conf.py are always imported
2129 2136 if they exist, and ipy_user_conf.py with some defaults is created for
2130 2137 the user.
2131 2138
2132 2139 * Startup rehashing done by the config file, not InterpreterExec.
2133 2140 This means system commands are available even without selecting the
2134 2141 pysh profile. It's the sensible default after all.
2135 2142
2136 2143 2006-01-20 Fernando Perez <Fernando.Perez@colorado.edu>
2137 2144
2138 2145 * IPython/iplib.py (raw_input): I _think_ I got the pasting of
2139 2146 multiline code with autoindent on working. But I am really not
2140 2147 sure, so this needs more testing. Will commit a debug-enabled
2141 2148 version for now, while I test it some more, so that Ville and
2142 2149 others may also catch any problems. Also made
2143 2150 self.indent_current_str() a method, to ensure that there's no
2144 2151 chance of the indent space count and the corresponding string
2145 2152 falling out of sync. All code needing the string should just call
2146 2153 the method.
2147 2154
2148 2155 2006-01-18 Fernando Perez <Fernando.Perez@colorado.edu>
2149 2156
2150 2157 * IPython/Magic.py (magic_edit): fix check for when users don't
2151 2158 save their output files, the try/except was in the wrong section.
2152 2159
2153 2160 2006-01-17 Fernando Perez <Fernando.Perez@colorado.edu>
2154 2161
2155 2162 * IPython/Magic.py (magic_run): fix __file__ global missing from
2156 2163 script's namespace when executed via %run. After a report by
2157 2164 Vivian.
2158 2165
2159 2166 * IPython/Debugger.py (Pdb.__init__): Fix breakage with '%run -d'
2160 2167 when using python 2.4. The parent constructor changed in 2.4, and
2161 2168 we need to track it directly (we can't call it, as it messes up
2162 2169 readline and tab-completion inside our pdb would stop working).
2163 2170 After a bug report by R. Bernstein <rocky-AT-panix.com>.
2164 2171
2165 2172 2006-01-16 Ville Vainio <vivainio@gmail.com>
2166 2173
2167 2174 * Ipython/magic.py: Reverted back to old %edit functionality
2168 2175 that returns file contents on exit.
2169 2176
2170 2177 * IPython/path.py: Added Jason Orendorff's "path" module to
2171 2178 IPython tree, http://www.jorendorff.com/articles/python/path/.
2172 2179 You can get path objects conveniently through %sc, and !!, e.g.:
2173 2180 sc files=ls
2174 2181 for p in files.paths: # or files.p
2175 2182 print p,p.mtime
2176 2183
2177 2184 * Ipython/iplib.py:"," and ";" autoquoting-upon-autocall
2178 2185 now work again without considering the exclusion regexp -
2179 2186 hence, things like ',foo my/path' turn to 'foo("my/path")'
2180 2187 instead of syntax error.
2181 2188
2182 2189
2183 2190 2006-01-14 Ville Vainio <vivainio@gmail.com>
2184 2191
2185 2192 * IPython/ipapi.py (ashook, asmagic, options): Added convenience
2186 2193 ipapi decorators for python 2.4 users, options() provides access to rc
2187 2194 data.
2188 2195
2189 2196 * IPython/Magic.py (magic_cd): %cd now accepts backslashes
2190 2197 as path separators (even on Linux ;-). Space character after
2191 2198 backslash (as yielded by tab completer) is still space;
2192 2199 "%cd long\ name" works as expected.
2193 2200
2194 2201 * IPython/ipapi.py,hooks.py,iplib.py: Hooks now implemented
2195 2202 as "chain of command", with priority. API stays the same,
2196 2203 TryNext exception raised by a hook function signals that
2197 2204 current hook failed and next hook should try handling it, as
2198 2205 suggested by Walter Dörwald <walter@livinglogic.de>. Walter also
2199 2206 requested configurable display hook, which is now implemented.
2200 2207
2201 2208 2006-01-13 Ville Vainio <vivainio@gmail.com>
2202 2209
2203 2210 * IPython/platutils*.py: platform specific utility functions,
2204 2211 so far only set_term_title is implemented (change terminal
2205 2212 label in windowing systems). %cd now changes the title to
2206 2213 current dir.
2207 2214
2208 2215 * IPython/Release.py: Added myself to "authors" list,
2209 2216 had to create new files.
2210 2217
2211 2218 * IPython/iplib.py (handle_shell_escape): fixed logical flaw in
2212 2219 shell escape; not a known bug but had potential to be one in the
2213 2220 future.
2214 2221
2215 2222 * IPython/ipapi.py (added),OInspect.py,iplib.py: "Public"
2216 2223 extension API for IPython! See the module for usage example. Fix
2217 2224 OInspect for docstring-less magic functions.
2218 2225
2219 2226
2220 2227 2006-01-13 Fernando Perez <Fernando.Perez@colorado.edu>
2221 2228
2222 2229 * IPython/iplib.py (raw_input): temporarily deactivate all
2223 2230 attempts at allowing pasting of code with autoindent on. It
2224 2231 introduced bugs (reported by Prabhu) and I can't seem to find a
2225 2232 robust combination which works in all cases. Will have to revisit
2226 2233 later.
2227 2234
2228 2235 * IPython/genutils.py: remove isspace() function. We've dropped
2229 2236 2.2 compatibility, so it's OK to use the string method.
2230 2237
2231 2238 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
2232 2239
2233 2240 * IPython/iplib.py (InteractiveShell.__init__): fix regexp
2234 2241 matching what NOT to autocall on, to include all python binary
2235 2242 operators (including things like 'and', 'or', 'is' and 'in').
2236 2243 Prompted by a bug report on 'foo & bar', but I realized we had
2237 2244 many more potential bug cases with other operators. The regexp is
2238 2245 self.re_exclude_auto, it's fairly commented.
2239 2246
2240 2247 2006-01-12 Ville Vainio <vivainio@gmail.com>
2241 2248
2242 2249 * IPython/iplib.py (make_quoted_expr,handle_shell_escape):
2243 2250 Prettified and hardened string/backslash quoting with ipsystem(),
2244 2251 ipalias() and ipmagic(). Now even \ characters are passed to
2245 2252 %magics, !shell escapes and aliases exactly as they are in the
2246 2253 ipython command line. Should improve backslash experience,
2247 2254 particularly in Windows (path delimiter for some commands that
2248 2255 won't understand '/'), but Unix benefits as well (regexps). %cd
2249 2256 magic still doesn't support backslash path delimiters, though. Also
2250 2257 deleted all pretense of supporting multiline command strings in
2251 2258 !system or %magic commands. Thanks to Jerry McRae for suggestions.
2252 2259
2253 2260 * doc/build_doc_instructions.txt added. Documentation on how to
2254 2261 use doc/update_manual.py, added yesterday. Both files contributed
2255 2262 by Jörgen Stenarson <jorgen.stenarson-AT-bostream.nu>. This slates
2256 2263 doc/*.sh for deprecation at a later date.
2257 2264
2258 2265 * /ipython.py Added ipython.py to root directory for
2259 2266 zero-installation (tar xzvf ipython.tgz; cd ipython; python
2260 2267 ipython.py) and development convenience (no need to keep doing
2261 2268 "setup.py install" between changes).
2262 2269
2263 2270 * Made ! and !! shell escapes work (again) in multiline expressions:
2264 2271 if 1:
2265 2272 !ls
2266 2273 !!ls
2267 2274
2268 2275 2006-01-12 Fernando Perez <Fernando.Perez@colorado.edu>
2269 2276
2270 2277 * IPython/ipstruct.py (Struct): Rename IPython.Struct to
2271 2278 IPython.ipstruct, to avoid local shadowing of the stdlib 'struct'
2272 2279 module in case-insensitive installation. Was causing crashes
2273 2280 under win32. Closes http://www.scipy.net/roundup/ipython/issue49.
2274 2281
2275 2282 * IPython/Magic.py (magic_pycat): Fix pycat, patch by Marien Zwart
2276 2283 <marienz-AT-gentoo.org>, closes
2277 2284 http://www.scipy.net/roundup/ipython/issue51.
2278 2285
2279 2286 2006-01-11 Fernando Perez <Fernando.Perez@colorado.edu>
2280 2287
2281 2288 * IPython/Shell.py (IPShellGTK.on_timer): Finally fix the
2282 2289 problem of excessive CPU usage under *nix and keyboard lag under
2283 2290 win32.
2284 2291
2285 2292 2006-01-10 *** Released version 0.7.0
2286 2293
2287 2294 2006-01-10 Fernando Perez <Fernando.Perez@colorado.edu>
2288 2295
2289 2296 * IPython/Release.py (revision): tag version number to 0.7.0,
2290 2297 ready for release.
2291 2298
2292 2299 * IPython/Magic.py (magic_edit): Add print statement to %edit so
2293 2300 it informs the user of the name of the temp. file used. This can
2294 2301 help if you decide later to reuse that same file, so you know
2295 2302 where to copy the info from.
2296 2303
2297 2304 2006-01-09 Fernando Perez <Fernando.Perez@colorado.edu>
2298 2305
2299 2306 * setup_bdist_egg.py: little script to build an egg. Added
2300 2307 support in the release tools as well.
2301 2308
2302 2309 2006-01-08 Fernando Perez <Fernando.Perez@colorado.edu>
2303 2310
2304 2311 * IPython/Shell.py (IPShellWX.__init__): add support for WXPython
2305 2312 version selection (new -wxversion command line and ipythonrc
2306 2313 parameter). Patch contributed by Arnd Baecker
2307 2314 <arnd.baecker-AT-web.de>.
2308 2315
2309 2316 * IPython/iplib.py (embed_mainloop): fix tab-completion in
2310 2317 embedded instances, for variables defined at the interactive
2311 2318 prompt of the embedded ipython. Reported by Arnd.
2312 2319
2313 2320 * IPython/Magic.py (magic_autocall): Fix %autocall magic. Now
2314 2321 it can be used as a (stateful) toggle, or with a direct parameter.
2315 2322
2316 2323 * IPython/ultraTB.py (_fixed_getinnerframes): remove debug assert which
2317 2324 could be triggered in certain cases and cause the traceback
2318 2325 printer not to work.
2319 2326
2320 2327 2006-01-07 Fernando Perez <Fernando.Perez@colorado.edu>
2321 2328
2322 2329 * IPython/iplib.py (_should_recompile): Small fix, closes
2323 2330 http://www.scipy.net/roundup/ipython/issue48. Patch by Scott.
2324 2331
2325 2332 2006-01-04 Fernando Perez <Fernando.Perez@colorado.edu>
2326 2333
2327 2334 * IPython/Shell.py (IPShellGTK.mainloop): fix bug in the GTK
2328 2335 backend for matplotlib (100% cpu utiliziation). Thanks to Charlie
2329 2336 Moad for help with tracking it down.
2330 2337
2331 2338 * IPython/iplib.py (handle_auto): fix autocall handling for
2332 2339 objects which support BOTH __getitem__ and __call__ (so that f [x]
2333 2340 is left alone, instead of becoming f([x]) automatically).
2334 2341
2335 2342 * IPython/Magic.py (magic_cd): fix crash when cd -b was used.
2336 2343 Ville's patch.
2337 2344
2338 2345 2006-01-03 Fernando Perez <Fernando.Perez@colorado.edu>
2339 2346
2340 2347 * IPython/iplib.py (handle_auto): changed autocall semantics to
2341 2348 include 'smart' mode, where the autocall transformation is NOT
2342 2349 applied if there are no arguments on the line. This allows you to
2343 2350 just type 'foo' if foo is a callable to see its internal form,
2344 2351 instead of having it called with no arguments (typically a
2345 2352 mistake). The old 'full' autocall still exists: for that, you
2346 2353 need to set the 'autocall' parameter to 2 in your ipythonrc file.
2347 2354
2348 2355 * IPython/completer.py (Completer.attr_matches): add
2349 2356 tab-completion support for Enthoughts' traits. After a report by
2350 2357 Arnd and a patch by Prabhu.
2351 2358
2352 2359 2006-01-02 Fernando Perez <Fernando.Perez@colorado.edu>
2353 2360
2354 2361 * IPython/ultraTB.py (_fixed_getinnerframes): added Alex
2355 2362 Schmolck's patch to fix inspect.getinnerframes().
2356 2363
2357 2364 * IPython/iplib.py (InteractiveShell.__init__): significant fixes
2358 2365 for embedded instances, regarding handling of namespaces and items
2359 2366 added to the __builtin__ one. Multiple embedded instances and
2360 2367 recursive embeddings should work better now (though I'm not sure
2361 2368 I've got all the corner cases fixed, that code is a bit of a brain
2362 2369 twister).
2363 2370
2364 2371 * IPython/Magic.py (magic_edit): added support to edit in-memory
2365 2372 macros (automatically creates the necessary temp files). %edit
2366 2373 also doesn't return the file contents anymore, it's just noise.
2367 2374
2368 2375 * IPython/completer.py (Completer.attr_matches): revert change to
2369 2376 complete only on attributes listed in __all__. I realized it
2370 2377 cripples the tab-completion system as a tool for exploring the
2371 2378 internals of unknown libraries (it renders any non-__all__
2372 2379 attribute off-limits). I got bit by this when trying to see
2373 2380 something inside the dis module.
2374 2381
2375 2382 2005-12-31 Fernando Perez <Fernando.Perez@colorado.edu>
2376 2383
2377 2384 * IPython/iplib.py (InteractiveShell.__init__): add .meta
2378 2385 namespace for users and extension writers to hold data in. This
2379 2386 follows the discussion in
2380 2387 http://projects.scipy.org/ipython/ipython/wiki/RefactoringIPython.
2381 2388
2382 2389 * IPython/completer.py (IPCompleter.complete): small patch to help
2383 2390 tab-completion under Emacs, after a suggestion by John Barnard
2384 2391 <barnarj-AT-ccf.org>.
2385 2392
2386 2393 * IPython/Magic.py (Magic.extract_input_slices): added support for
2387 2394 the slice notation in magics to use N-M to represent numbers N...M
2388 2395 (closed endpoints). This is used by %macro and %save.
2389 2396
2390 2397 * IPython/completer.py (Completer.attr_matches): for modules which
2391 2398 define __all__, complete only on those. After a patch by Jeffrey
2392 2399 Collins <jcollins_boulder-AT-earthlink.net>. Also, clean up and
2393 2400 speed up this routine.
2394 2401
2395 2402 * IPython/Logger.py (Logger.log): fix a history handling bug. I
2396 2403 don't know if this is the end of it, but the behavior now is
2397 2404 certainly much more correct. Note that coupled with macros,
2398 2405 slightly surprising (at first) behavior may occur: a macro will in
2399 2406 general expand to multiple lines of input, so upon exiting, the
2400 2407 in/out counters will both be bumped by the corresponding amount
2401 2408 (as if the macro's contents had been typed interactively). Typing
2402 2409 %hist will reveal the intermediate (silently processed) lines.
2403 2410
2404 2411 * IPython/Magic.py (magic_run): fix a subtle bug which could cause
2405 2412 pickle to fail (%run was overwriting __main__ and not restoring
2406 2413 it, but pickle relies on __main__ to operate).
2407 2414
2408 2415 * IPython/iplib.py (InteractiveShell): fix pdb calling: I'm now
2409 2416 using properties, but forgot to make the main InteractiveShell
2410 2417 class a new-style class. Properties fail silently, and
2411 2418 mysteriously, with old-style class (getters work, but
2412 2419 setters don't do anything).
2413 2420
2414 2421 2005-12-30 Fernando Perez <Fernando.Perez@colorado.edu>
2415 2422
2416 2423 * IPython/Magic.py (magic_history): fix history reporting bug (I
2417 2424 know some nasties are still there, I just can't seem to find a
2418 2425 reproducible test case to track them down; the input history is
2419 2426 falling out of sync...)
2420 2427
2421 2428 * IPython/iplib.py (handle_shell_escape): fix bug where both
2422 2429 aliases and system accesses where broken for indented code (such
2423 2430 as loops).
2424 2431
2425 2432 * IPython/genutils.py (shell): fix small but critical bug for
2426 2433 win32 system access.
2427 2434
2428 2435 2005-12-29 Fernando Perez <Fernando.Perez@colorado.edu>
2429 2436
2430 2437 * IPython/iplib.py (showtraceback): remove use of the
2431 2438 sys.last_{type/value/traceback} structures, which are non
2432 2439 thread-safe.
2433 2440 (_prefilter): change control flow to ensure that we NEVER
2434 2441 introspect objects when autocall is off. This will guarantee that
2435 2442 having an input line of the form 'x.y', where access to attribute
2436 2443 'y' has side effects, doesn't trigger the side effect TWICE. It
2437 2444 is important to note that, with autocall on, these side effects
2438 2445 can still happen.
2439 2446 (ipsystem): new builtin, to complete the ip{magic/alias/system}
2440 2447 trio. IPython offers these three kinds of special calls which are
2441 2448 not python code, and it's a good thing to have their call method
2442 2449 be accessible as pure python functions (not just special syntax at
2443 2450 the command line). It gives us a better internal implementation
2444 2451 structure, as well as exposing these for user scripting more
2445 2452 cleanly.
2446 2453
2447 2454 * IPython/macro.py (Macro.__init__): moved macros to a standalone
2448 2455 file. Now that they'll be more likely to be used with the
2449 2456 persistance system (%store), I want to make sure their module path
2450 2457 doesn't change in the future, so that we don't break things for
2451 2458 users' persisted data.
2452 2459
2453 2460 * IPython/iplib.py (autoindent_update): move indentation
2454 2461 management into the _text_ processing loop, not the keyboard
2455 2462 interactive one. This is necessary to correctly process non-typed
2456 2463 multiline input (such as macros).
2457 2464
2458 2465 * IPython/Magic.py (Magic.format_latex): patch by Stefan van der
2459 2466 Walt <stefan-AT-sun.ac.za> to fix latex formatting of docstrings,
2460 2467 which was producing problems in the resulting manual.
2461 2468 (magic_whos): improve reporting of instances (show their class,
2462 2469 instead of simply printing 'instance' which isn't terribly
2463 2470 informative).
2464 2471
2465 2472 * IPython/genutils.py (shell): commit Jorgen Stenarson's patch
2466 2473 (minor mods) to support network shares under win32.
2467 2474
2468 2475 * IPython/winconsole.py (get_console_size): add new winconsole
2469 2476 module and fixes to page_dumb() to improve its behavior under
2470 2477 win32. Contributed by Alexander Belchenko <bialix-AT-ukr.net>.
2471 2478
2472 2479 * IPython/Magic.py (Macro): simplified Macro class to just
2473 2480 subclass list. We've had only 2.2 compatibility for a very long
2474 2481 time, yet I was still avoiding subclassing the builtin types. No
2475 2482 more (I'm also starting to use properties, though I won't shift to
2476 2483 2.3-specific features quite yet).
2477 2484 (magic_store): added Ville's patch for lightweight variable
2478 2485 persistence, after a request on the user list by Matt Wilkie
2479 2486 <maphew-AT-gmail.com>. The new %store magic's docstring has full
2480 2487 details.
2481 2488
2482 2489 * IPython/iplib.py (InteractiveShell.post_config_initialization):
2483 2490 changed the default logfile name from 'ipython.log' to
2484 2491 'ipython_log.py'. These logs are real python files, and now that
2485 2492 we have much better multiline support, people are more likely to
2486 2493 want to use them as such. Might as well name them correctly.
2487 2494
2488 2495 * IPython/Magic.py: substantial cleanup. While we can't stop
2489 2496 using magics as mixins, due to the existing customizations 'out
2490 2497 there' which rely on the mixin naming conventions, at least I
2491 2498 cleaned out all cross-class name usage. So once we are OK with
2492 2499 breaking compatibility, the two systems can be separated.
2493 2500
2494 2501 * IPython/Logger.py: major cleanup. This one is NOT a mixin
2495 2502 anymore, and the class is a fair bit less hideous as well. New
2496 2503 features were also introduced: timestamping of input, and logging
2497 2504 of output results. These are user-visible with the -t and -o
2498 2505 options to %logstart. Closes
2499 2506 http://www.scipy.net/roundup/ipython/issue11 and a request by
2500 2507 William Stein (SAGE developer - http://modular.ucsd.edu/sage).
2501 2508
2502 2509 2005-12-28 Fernando Perez <Fernando.Perez@colorado.edu>
2503 2510
2504 2511 * IPython/iplib.py (handle_shell_escape): add Ville's patch to
2505 2512 better handle backslashes in paths. See the thread 'More Windows
2506 2513 questions part 2 - \/ characters revisited' on the iypthon user
2507 2514 list:
2508 2515 http://scipy.net/pipermail/ipython-user/2005-June/000907.html
2509 2516
2510 2517 (InteractiveShell.__init__): fix tab-completion bug in threaded shells.
2511 2518
2512 2519 (InteractiveShell.__init__): change threaded shells to not use the
2513 2520 ipython crash handler. This was causing more problems than not,
2514 2521 as exceptions in the main thread (GUI code, typically) would
2515 2522 always show up as a 'crash', when they really weren't.
2516 2523
2517 2524 The colors and exception mode commands (%colors/%xmode) have been
2518 2525 synchronized to also take this into account, so users can get
2519 2526 verbose exceptions for their threaded code as well. I also added
2520 2527 support for activating pdb inside this exception handler as well,
2521 2528 so now GUI authors can use IPython's enhanced pdb at runtime.
2522 2529
2523 2530 * IPython/ipmaker.py (make_IPython): make the autoedit_syntax flag
2524 2531 true by default, and add it to the shipped ipythonrc file. Since
2525 2532 this asks the user before proceeding, I think it's OK to make it
2526 2533 true by default.
2527 2534
2528 2535 * IPython/Magic.py (magic_exit): make new exit/quit magics instead
2529 2536 of the previous special-casing of input in the eval loop. I think
2530 2537 this is cleaner, as they really are commands and shouldn't have
2531 2538 a special role in the middle of the core code.
2532 2539
2533 2540 2005-12-27 Fernando Perez <Fernando.Perez@colorado.edu>
2534 2541
2535 2542 * IPython/iplib.py (edit_syntax_error): added support for
2536 2543 automatically reopening the editor if the file had a syntax error
2537 2544 in it. Thanks to scottt who provided the patch at:
2538 2545 http://www.scipy.net/roundup/ipython/issue36 (slightly modified
2539 2546 version committed).
2540 2547
2541 2548 * IPython/iplib.py (handle_normal): add suport for multi-line
2542 2549 input with emtpy lines. This fixes
2543 2550 http://www.scipy.net/roundup/ipython/issue43 and a similar
2544 2551 discussion on the user list.
2545 2552
2546 2553 WARNING: a behavior change is necessarily introduced to support
2547 2554 blank lines: now a single blank line with whitespace does NOT
2548 2555 break the input loop, which means that when autoindent is on, by
2549 2556 default hitting return on the next (indented) line does NOT exit.
2550 2557
2551 2558 Instead, to exit a multiline input you can either have:
2552 2559
2553 2560 - TWO whitespace lines (just hit return again), or
2554 2561 - a single whitespace line of a different length than provided
2555 2562 by the autoindent (add or remove a space).
2556 2563
2557 2564 * IPython/completer.py (MagicCompleter.__init__): new 'completer'
2558 2565 module to better organize all readline-related functionality.
2559 2566 I've deleted FlexCompleter and put all completion clases here.
2560 2567
2561 2568 * IPython/iplib.py (raw_input): improve indentation management.
2562 2569 It is now possible to paste indented code with autoindent on, and
2563 2570 the code is interpreted correctly (though it still looks bad on
2564 2571 screen, due to the line-oriented nature of ipython).
2565 2572 (MagicCompleter.complete): change behavior so that a TAB key on an
2566 2573 otherwise empty line actually inserts a tab, instead of completing
2567 2574 on the entire global namespace. This makes it easier to use the
2568 2575 TAB key for indentation. After a request by Hans Meine
2569 2576 <hans_meine-AT-gmx.net>
2570 2577 (_prefilter): add support so that typing plain 'exit' or 'quit'
2571 2578 does a sensible thing. Originally I tried to deviate as little as
2572 2579 possible from the default python behavior, but even that one may
2573 2580 change in this direction (thread on python-dev to that effect).
2574 2581 Regardless, ipython should do the right thing even if CPython's
2575 2582 '>>>' prompt doesn't.
2576 2583 (InteractiveShell): removed subclassing code.InteractiveConsole
2577 2584 class. By now we'd overridden just about all of its methods: I've
2578 2585 copied the remaining two over, and now ipython is a standalone
2579 2586 class. This will provide a clearer picture for the chainsaw
2580 2587 branch refactoring.
2581 2588
2582 2589 2005-12-26 Fernando Perez <Fernando.Perez@colorado.edu>
2583 2590
2584 2591 * IPython/ultraTB.py (VerboseTB.text): harden reporting against
2585 2592 failures for objects which break when dir() is called on them.
2586 2593
2587 2594 * IPython/FlexCompleter.py (Completer.__init__): Added support for
2588 2595 distinct local and global namespaces in the completer API. This
2589 2596 change allows us to properly handle completion with distinct
2590 2597 scopes, including in embedded instances (this had never really
2591 2598 worked correctly).
2592 2599
2593 2600 Note: this introduces a change in the constructor for
2594 2601 MagicCompleter, as a new global_namespace parameter is now the
2595 2602 second argument (the others were bumped one position).
2596 2603
2597 2604 2005-12-25 Fernando Perez <Fernando.Perez@colorado.edu>
2598 2605
2599 2606 * IPython/iplib.py (embed_mainloop): fix tab-completion in
2600 2607 embedded instances (which can be done now thanks to Vivian's
2601 2608 frame-handling fixes for pdb).
2602 2609 (InteractiveShell.__init__): Fix namespace handling problem in
2603 2610 embedded instances. We were overwriting __main__ unconditionally,
2604 2611 and this should only be done for 'full' (non-embedded) IPython;
2605 2612 embedded instances must respect the caller's __main__. Thanks to
2606 2613 a bug report by Yaroslav Bulatov <yaroslavvb-AT-gmail.com>
2607 2614
2608 2615 2005-12-24 Fernando Perez <Fernando.Perez@colorado.edu>
2609 2616
2610 2617 * setup.py: added download_url to setup(). This registers the
2611 2618 download address at PyPI, which is not only useful to humans
2612 2619 browsing the site, but is also picked up by setuptools (the Eggs
2613 2620 machinery). Thanks to Ville and R. Kern for the info/discussion
2614 2621 on this.
2615 2622
2616 2623 2005-12-23 Fernando Perez <Fernando.Perez@colorado.edu>
2617 2624
2618 2625 * IPython/Debugger.py (Pdb.__init__): Major pdb mode enhancements.
2619 2626 This brings a lot of nice functionality to the pdb mode, which now
2620 2627 has tab-completion, syntax highlighting, and better stack handling
2621 2628 than before. Many thanks to Vivian De Smedt
2622 2629 <vivian-AT-vdesmedt.com> for the original patches.
2623 2630
2624 2631 2005-12-08 Fernando Perez <Fernando.Perez@colorado.edu>
2625 2632
2626 2633 * IPython/Shell.py (IPShellGTK.mainloop): fix mainloop() calling
2627 2634 sequence to consistently accept the banner argument. The
2628 2635 inconsistency was tripping SAGE, thanks to Gary Zablackis
2629 2636 <gzabl-AT-yahoo.com> for the report.
2630 2637
2631 2638 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
2632 2639
2633 2640 * IPython/iplib.py (InteractiveShell.post_config_initialization):
2634 2641 Fix bug where a naked 'alias' call in the ipythonrc file would
2635 2642 cause a crash. Bug reported by Jorgen Stenarson.
2636 2643
2637 2644 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu>
2638 2645
2639 2646 * IPython/ipmaker.py (make_IPython): cleanups which should improve
2640 2647 startup time.
2641 2648
2642 2649 * IPython/iplib.py (runcode): my globals 'fix' for embedded
2643 2650 instances had introduced a bug with globals in normal code. Now
2644 2651 it's working in all cases.
2645 2652
2646 2653 * IPython/Magic.py (magic_psearch): Finish wildcard cleanup and
2647 2654 API changes. A new ipytonrc option, 'wildcards_case_sensitive'
2648 2655 has been introduced to set the default case sensitivity of the
2649 2656 searches. Users can still select either mode at runtime on a
2650 2657 per-search basis.
2651 2658
2652 2659 2005-11-13 Fernando Perez <Fernando.Perez@colorado.edu>
2653 2660
2654 2661 * IPython/wildcard.py (NameSpace.__init__): fix resolution of
2655 2662 attributes in wildcard searches for subclasses. Modified version
2656 2663 of a patch by Jorgen.
2657 2664
2658 2665 2005-11-12 Fernando Perez <Fernando.Perez@colorado.edu>
2659 2666
2660 2667 * IPython/iplib.py (embed_mainloop): Fix handling of globals for
2661 2668 embedded instances. I added a user_global_ns attribute to the
2662 2669 InteractiveShell class to handle this.
2663 2670
2664 2671 2005-10-31 Fernando Perez <Fernando.Perez@colorado.edu>
2665 2672
2666 2673 * IPython/Shell.py (IPShellGTK.mainloop): Change timeout_add to
2667 2674 idle_add, which fixes horrible keyboard lag problems under gtk 2.6
2668 2675 (reported under win32, but may happen also in other platforms).
2669 2676 Bug report and fix courtesy of Sean Moore <smm-AT-logic.bm>
2670 2677
2671 2678 2005-10-15 Fernando Perez <Fernando.Perez@colorado.edu>
2672 2679
2673 2680 * IPython/Magic.py (magic_psearch): new support for wildcard
2674 2681 patterns. Now, typing ?a*b will list all names which begin with a
2675 2682 and end in b, for example. The %psearch magic has full
2676 2683 docstrings. Many thanks to Jörgen Stenarson
2677 2684 <jorgen.stenarson-AT-bostream.nu>, author of the patches
2678 2685 implementing this functionality.
2679 2686
2680 2687 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
2681 2688
2682 2689 * Manual: fixed long-standing annoyance of double-dashes (as in
2683 2690 --prefix=~, for example) being stripped in the HTML version. This
2684 2691 is a latex2html bug, but a workaround was provided. Many thanks
2685 2692 to George K. Thiruvathukal <gthiruv-AT-luc.edu> for the detailed
2686 2693 help, and Michael Tobis <mtobis-AT-gmail.com> for getting the ball
2687 2694 rolling. This seemingly small issue had tripped a number of users
2688 2695 when first installing, so I'm glad to see it gone.
2689 2696
2690 2697 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu>
2691 2698
2692 2699 * IPython/Extensions/numeric_formats.py: fix missing import,
2693 2700 reported by Stephen Walton.
2694 2701
2695 2702 2005-09-24 Fernando Perez <Fernando.Perez@colorado.edu>
2696 2703
2697 2704 * IPython/demo.py: finish demo module, fully documented now.
2698 2705
2699 2706 * IPython/genutils.py (file_read): simple little utility to read a
2700 2707 file and ensure it's closed afterwards.
2701 2708
2702 2709 2005-09-23 Fernando Perez <Fernando.Perez@colorado.edu>
2703 2710
2704 2711 * IPython/demo.py (Demo.__init__): added support for individually
2705 2712 tagging blocks for automatic execution.
2706 2713
2707 2714 * IPython/Magic.py (magic_pycat): new %pycat magic for showing
2708 2715 syntax-highlighted python sources, requested by John.
2709 2716
2710 2717 2005-09-22 Fernando Perez <Fernando.Perez@colorado.edu>
2711 2718
2712 2719 * IPython/demo.py (Demo.again): fix bug where again() blocks after
2713 2720 finishing.
2714 2721
2715 2722 * IPython/genutils.py (shlex_split): moved from Magic to here,
2716 2723 where all 2.2 compatibility stuff lives. I needed it for demo.py.
2717 2724
2718 2725 * IPython/demo.py (Demo.__init__): added support for silent
2719 2726 blocks, improved marks as regexps, docstrings written.
2720 2727 (Demo.__init__): better docstring, added support for sys.argv.
2721 2728
2722 2729 * IPython/genutils.py (marquee): little utility used by the demo
2723 2730 code, handy in general.
2724 2731
2725 2732 * IPython/demo.py (Demo.__init__): new class for interactive
2726 2733 demos. Not documented yet, I just wrote it in a hurry for
2727 2734 scipy'05. Will docstring later.
2728 2735
2729 2736 2005-09-20 Fernando Perez <Fernando.Perez@colorado.edu>
2730 2737
2731 2738 * IPython/Shell.py (sigint_handler): Drastic simplification which
2732 2739 also seems to make Ctrl-C work correctly across threads! This is
2733 2740 so simple, that I can't beleive I'd missed it before. Needs more
2734 2741 testing, though.
2735 2742 (KBINT): Never mind, revert changes. I'm sure I'd tried something
2736 2743 like this before...
2737 2744
2738 2745 * IPython/genutils.py (get_home_dir): add protection against
2739 2746 non-dirs in win32 registry.
2740 2747
2741 2748 * IPython/iplib.py (InteractiveShell.alias_table_validate): fix
2742 2749 bug where dict was mutated while iterating (pysh crash).
2743 2750
2744 2751 2005-09-06 Fernando Perez <Fernando.Perez@colorado.edu>
2745 2752
2746 2753 * IPython/iplib.py (handle_auto): Fix inconsistency arising from
2747 2754 spurious newlines added by this routine. After a report by
2748 2755 F. Mantegazza.
2749 2756
2750 2757 2005-09-05 Fernando Perez <Fernando.Perez@colorado.edu>
2751 2758
2752 2759 * IPython/Shell.py (hijack_gtk): remove pygtk.require("2.0")
2753 2760 calls. These were a leftover from the GTK 1.x days, and can cause
2754 2761 problems in certain cases (after a report by John Hunter).
2755 2762
2756 2763 * IPython/iplib.py (InteractiveShell.__init__): Trap exception if
2757 2764 os.getcwd() fails at init time. Thanks to patch from David Remahl
2758 2765 <chmod007-AT-mac.com>.
2759 2766 (InteractiveShell.__init__): prevent certain special magics from
2760 2767 being shadowed by aliases. Closes
2761 2768 http://www.scipy.net/roundup/ipython/issue41.
2762 2769
2763 2770 2005-08-31 Fernando Perez <Fernando.Perez@colorado.edu>
2764 2771
2765 2772 * IPython/iplib.py (InteractiveShell.complete): Added new
2766 2773 top-level completion method to expose the completion mechanism
2767 2774 beyond readline-based environments.
2768 2775
2769 2776 2005-08-19 Fernando Perez <Fernando.Perez@colorado.edu>
2770 2777
2771 2778 * tools/ipsvnc (svnversion): fix svnversion capture.
2772 2779
2773 2780 * IPython/iplib.py (InteractiveShell.__init__): Add has_readline
2774 2781 attribute to self, which was missing. Before, it was set by a
2775 2782 routine which in certain cases wasn't being called, so the
2776 2783 instance could end up missing the attribute. This caused a crash.
2777 2784 Closes http://www.scipy.net/roundup/ipython/issue40.
2778 2785
2779 2786 2005-08-16 Fernando Perez <fperez@colorado.edu>
2780 2787
2781 2788 * IPython/ultraTB.py (VerboseTB.text): don't crash if object
2782 2789 contains non-string attribute. Closes
2783 2790 http://www.scipy.net/roundup/ipython/issue38.
2784 2791
2785 2792 2005-08-14 Fernando Perez <fperez@colorado.edu>
2786 2793
2787 2794 * tools/ipsvnc: Minor improvements, to add changeset info.
2788 2795
2789 2796 2005-08-12 Fernando Perez <fperez@colorado.edu>
2790 2797
2791 2798 * IPython/iplib.py (runsource): remove self.code_to_run_src
2792 2799 attribute. I realized this is nothing more than
2793 2800 '\n'.join(self.buffer), and having the same data in two different
2794 2801 places is just asking for synchronization bugs. This may impact
2795 2802 people who have custom exception handlers, so I need to warn
2796 2803 ipython-dev about it (F. Mantegazza may use them).
2797 2804
2798 2805 2005-07-29 Fernando Perez <Fernando.Perez@colorado.edu>
2799 2806
2800 2807 * IPython/genutils.py: fix 2.2 compatibility (generators)
2801 2808
2802 2809 2005-07-18 Fernando Perez <fperez@colorado.edu>
2803 2810
2804 2811 * IPython/genutils.py (get_home_dir): fix to help users with
2805 2812 invalid $HOME under win32.
2806 2813
2807 2814 2005-07-17 Fernando Perez <fperez@colorado.edu>
2808 2815
2809 2816 * IPython/Prompts.py (str_safe): Make unicode-safe. Also remove
2810 2817 some old hacks and clean up a bit other routines; code should be
2811 2818 simpler and a bit faster.
2812 2819
2813 2820 * IPython/iplib.py (interact): removed some last-resort attempts
2814 2821 to survive broken stdout/stderr. That code was only making it
2815 2822 harder to abstract out the i/o (necessary for gui integration),
2816 2823 and the crashes it could prevent were extremely rare in practice
2817 2824 (besides being fully user-induced in a pretty violent manner).
2818 2825
2819 2826 * IPython/genutils.py (IOStream.__init__): Simplify the i/o stuff.
2820 2827 Nothing major yet, but the code is simpler to read; this should
2821 2828 make it easier to do more serious modifications in the future.
2822 2829
2823 2830 * IPython/Extensions/InterpreterExec.py: Fix auto-quoting in pysh,
2824 2831 which broke in .15 (thanks to a report by Ville).
2825 2832
2826 2833 * IPython/Itpl.py (Itpl.__init__): add unicode support (it may not
2827 2834 be quite correct, I know next to nothing about unicode). This
2828 2835 will allow unicode strings to be used in prompts, amongst other
2829 2836 cases. It also will prevent ipython from crashing when unicode
2830 2837 shows up unexpectedly in many places. If ascii encoding fails, we
2831 2838 assume utf_8. Currently the encoding is not a user-visible
2832 2839 setting, though it could be made so if there is demand for it.
2833 2840
2834 2841 * IPython/ipmaker.py (make_IPython): remove old 2.1-specific hack.
2835 2842
2836 2843 * IPython/Struct.py (Struct.merge): switch keys() to iterator.
2837 2844
2838 2845 * IPython/background_jobs.py: moved 2.2 compatibility to genutils.
2839 2846
2840 2847 * IPython/genutils.py: Add 2.2 compatibility here, so all other
2841 2848 code can work transparently for 2.2/2.3.
2842 2849
2843 2850 2005-07-16 Fernando Perez <fperez@colorado.edu>
2844 2851
2845 2852 * IPython/ultraTB.py (ExceptionColors): Make a global variable
2846 2853 out of the color scheme table used for coloring exception
2847 2854 tracebacks. This allows user code to add new schemes at runtime.
2848 2855 This is a minimally modified version of the patch at
2849 2856 http://www.scipy.net/roundup/ipython/issue35, many thanks to pabw
2850 2857 for the contribution.
2851 2858
2852 2859 * IPython/FlexCompleter.py (Completer.attr_matches): Add a
2853 2860 slightly modified version of the patch in
2854 2861 http://www.scipy.net/roundup/ipython/issue34, which also allows me
2855 2862 to remove the previous try/except solution (which was costlier).
2856 2863 Thanks to Gaetan Lehmann <gaetan.lehmann-AT-jouy.inra.fr> for the fix.
2857 2864
2858 2865 2005-06-08 Fernando Perez <fperez@colorado.edu>
2859 2866
2860 2867 * IPython/iplib.py (write/write_err): Add methods to abstract all
2861 2868 I/O a bit more.
2862 2869
2863 2870 * IPython/Shell.py (IPShellGTK.mainloop): Fix GTK deprecation
2864 2871 warning, reported by Aric Hagberg, fix by JD Hunter.
2865 2872
2866 2873 2005-06-02 *** Released version 0.6.15
2867 2874
2868 2875 2005-06-01 Fernando Perez <fperez@colorado.edu>
2869 2876
2870 2877 * IPython/iplib.py (MagicCompleter.file_matches): Fix
2871 2878 tab-completion of filenames within open-quoted strings. Note that
2872 2879 this requires that in ~/.ipython/ipythonrc, users change the
2873 2880 readline delimiters configuration to read:
2874 2881
2875 2882 readline_remove_delims -/~
2876 2883
2877 2884
2878 2885 2005-05-31 *** Released version 0.6.14
2879 2886
2880 2887 2005-05-29 Fernando Perez <fperez@colorado.edu>
2881 2888
2882 2889 * IPython/ultraTB.py (VerboseTB.text): Fix crash for tracebacks
2883 2890 with files not on the filesystem. Reported by Eliyahu Sandler
2884 2891 <eli@gondolin.net>
2885 2892
2886 2893 2005-05-22 Fernando Perez <fperez@colorado.edu>
2887 2894
2888 2895 * IPython/iplib.py: Fix a few crashes in the --upgrade option.
2889 2896 After an initial report by LUK ShunTim <shuntim.luk@polyu.edu.hk>.
2890 2897
2891 2898 2005-05-19 Fernando Perez <fperez@colorado.edu>
2892 2899
2893 2900 * IPython/iplib.py (safe_execfile): close a file which could be
2894 2901 left open (causing problems in win32, which locks open files).
2895 2902 Thanks to a bug report by D Brown <dbrown2@yahoo.com>.
2896 2903
2897 2904 2005-05-18 Fernando Perez <fperez@colorado.edu>
2898 2905
2899 2906 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): pass all
2900 2907 keyword arguments correctly to safe_execfile().
2901 2908
2902 2909 2005-05-13 Fernando Perez <fperez@colorado.edu>
2903 2910
2904 2911 * ipython.1: Added info about Qt to manpage, and threads warning
2905 2912 to usage page (invoked with --help).
2906 2913
2907 2914 * IPython/iplib.py (MagicCompleter.python_func_kw_matches): Added
2908 2915 new matcher (it goes at the end of the priority list) to do
2909 2916 tab-completion on named function arguments. Submitted by George
2910 2917 Sakkis <gsakkis-AT-eden.rutgers.edu>. See the thread at
2911 2918 http://www.scipy.net/pipermail/ipython-dev/2005-April/000436.html
2912 2919 for more details.
2913 2920
2914 2921 * IPython/Magic.py (magic_run): Added new -e flag to ignore
2915 2922 SystemExit exceptions in the script being run. Thanks to a report
2916 2923 by danny shevitz <danny_shevitz-AT-yahoo.com>, about this
2917 2924 producing very annoying behavior when running unit tests.
2918 2925
2919 2926 2005-05-12 Fernando Perez <fperez@colorado.edu>
2920 2927
2921 2928 * IPython/iplib.py (handle_auto): fixed auto-quoting and parens,
2922 2929 which I'd broken (again) due to a changed regexp. In the process,
2923 2930 added ';' as an escape to auto-quote the whole line without
2924 2931 splitting its arguments. Thanks to a report by Jerry McRae
2925 2932 <qrs0xyc02-AT-sneakemail.com>.
2926 2933
2927 2934 * IPython/ultraTB.py (VerboseTB.text): protect against rare but
2928 2935 possible crashes caused by a TokenError. Reported by Ed Schofield
2929 2936 <schofield-AT-ftw.at>.
2930 2937
2931 2938 2005-05-06 Fernando Perez <fperez@colorado.edu>
2932 2939
2933 2940 * IPython/Shell.py (hijack_wx): Fix to work with WX v.2.6.
2934 2941
2935 2942 2005-04-29 Fernando Perez <fperez@colorado.edu>
2936 2943
2937 2944 * IPython/Shell.py (IPShellQt): Thanks to Denis Rivière
2938 2945 <nudz-AT-free.fr>, Yann Cointepas <yann-AT-sapetnioc.org> and Benjamin
2939 2946 Thyreau <Benji2-AT-decideur.info>, we now have a -qthread option
2940 2947 which provides support for Qt interactive usage (similar to the
2941 2948 existing one for WX and GTK). This had been often requested.
2942 2949
2943 2950 2005-04-14 *** Released version 0.6.13
2944 2951
2945 2952 2005-04-08 Fernando Perez <fperez@colorado.edu>
2946 2953
2947 2954 * IPython/Magic.py (Magic._ofind): remove docstring evaluation
2948 2955 from _ofind, which gets called on almost every input line. Now,
2949 2956 we only try to get docstrings if they are actually going to be
2950 2957 used (the overhead of fetching unnecessary docstrings can be
2951 2958 noticeable for certain objects, such as Pyro proxies).
2952 2959
2953 2960 * IPython/iplib.py (MagicCompleter.python_matches): Change the API
2954 2961 for completers. For some reason I had been passing them the state
2955 2962 variable, which completers never actually need, and was in
2956 2963 conflict with the rlcompleter API. Custom completers ONLY need to
2957 2964 take the text parameter.
2958 2965
2959 2966 * IPython/Extensions/InterpreterExec.py: Fix regexp so that magics
2960 2967 work correctly in pysh. I've also moved all the logic which used
2961 2968 to be in pysh.py here, which will prevent problems with future
2962 2969 upgrades. However, this time I must warn users to update their
2963 2970 pysh profile to include the line
2964 2971
2965 2972 import_all IPython.Extensions.InterpreterExec
2966 2973
2967 2974 because otherwise things won't work for them. They MUST also
2968 2975 delete pysh.py and the line
2969 2976
2970 2977 execfile pysh.py
2971 2978
2972 2979 from their ipythonrc-pysh.
2973 2980
2974 2981 * IPython/FlexCompleter.py (Completer.attr_matches): Make more
2975 2982 robust in the face of objects whose dir() returns non-strings
2976 2983 (which it shouldn't, but some broken libs like ITK do). Thanks to
2977 2984 a patch by John Hunter (implemented differently, though). Also
2978 2985 minor improvements by using .extend instead of + on lists.
2979 2986
2980 2987 * pysh.py:
2981 2988
2982 2989 2005-04-06 Fernando Perez <fperez@colorado.edu>
2983 2990
2984 2991 * IPython/ipmaker.py (make_IPython): Make multi_line_specials on
2985 2992 by default, so that all users benefit from it. Those who don't
2986 2993 want it can still turn it off.
2987 2994
2988 2995 * IPython/UserConfig/ipythonrc: Add multi_line_specials to the
2989 2996 config file, I'd forgotten about this, so users were getting it
2990 2997 off by default.
2991 2998
2992 2999 * IPython/iplib.py (ipmagic): big overhaul of the magic system for
2993 3000 consistency. Now magics can be called in multiline statements,
2994 3001 and python variables can be expanded in magic calls via $var.
2995 3002 This makes the magic system behave just like aliases or !system
2996 3003 calls.
2997 3004
2998 3005 2005-03-28 Fernando Perez <fperez@colorado.edu>
2999 3006
3000 3007 * IPython/iplib.py (handle_auto): cleanup to use %s instead of
3001 3008 expensive string additions for building command. Add support for
3002 3009 trailing ';' when autocall is used.
3003 3010
3004 3011 2005-03-26 Fernando Perez <fperez@colorado.edu>
3005 3012
3006 3013 * ipython.el: Fix http://www.scipy.net/roundup/ipython/issue31.
3007 3014 Bugfix by A. Schmolck, the ipython.el maintainer. Also make
3008 3015 ipython.el robust against prompts with any number of spaces
3009 3016 (including 0) after the ':' character.
3010 3017
3011 3018 * IPython/Prompts.py (Prompt2.set_p_str): Fix spurious space in
3012 3019 continuation prompt, which misled users to think the line was
3013 3020 already indented. Closes debian Bug#300847, reported to me by
3014 3021 Norbert Tretkowski <tretkowski-AT-inittab.de>.
3015 3022
3016 3023 2005-03-23 Fernando Perez <fperez@colorado.edu>
3017 3024
3018 3025 * IPython/Prompts.py (Prompt1.__str__): Make sure that prompts are
3019 3026 properly aligned if they have embedded newlines.
3020 3027
3021 3028 * IPython/iplib.py (runlines): Add a public method to expose
3022 3029 IPython's code execution machinery, so that users can run strings
3023 3030 as if they had been typed at the prompt interactively.
3024 3031 (InteractiveShell.__init__): Added getoutput() to the __IPYTHON__
3025 3032 methods which can call the system shell, but with python variable
3026 3033 expansion. The three such methods are: __IPYTHON__.system,
3027 3034 .getoutput and .getoutputerror. These need to be documented in a
3028 3035 'public API' section (to be written) of the manual.
3029 3036
3030 3037 2005-03-20 Fernando Perez <fperez@colorado.edu>
3031 3038
3032 3039 * IPython/iplib.py (InteractiveShell.set_custom_exc): new system
3033 3040 for custom exception handling. This is quite powerful, and it
3034 3041 allows for user-installable exception handlers which can trap
3035 3042 custom exceptions at runtime and treat them separately from
3036 3043 IPython's default mechanisms. At the request of Frédéric
3037 3044 Mantegazza <mantegazza-AT-ill.fr>.
3038 3045 (InteractiveShell.set_custom_completer): public API function to
3039 3046 add new completers at runtime.
3040 3047
3041 3048 2005-03-19 Fernando Perez <fperez@colorado.edu>
3042 3049
3043 3050 * IPython/OInspect.py (getdoc): Add a call to obj.getdoc(), to
3044 3051 allow objects which provide their docstrings via non-standard
3045 3052 mechanisms (like Pyro proxies) to still be inspected by ipython's
3046 3053 ? system.
3047 3054
3048 3055 * IPython/iplib.py (InteractiveShell.__init__): back off the _o/_e
3049 3056 automatic capture system. I tried quite hard to make it work
3050 3057 reliably, and simply failed. I tried many combinations with the
3051 3058 subprocess module, but eventually nothing worked in all needed
3052 3059 cases (not blocking stdin for the child, duplicating stdout
3053 3060 without blocking, etc). The new %sc/%sx still do capture to these
3054 3061 magical list/string objects which make shell use much more
3055 3062 conveninent, so not all is lost.
3056 3063
3057 3064 XXX - FIX MANUAL for the change above!
3058 3065
3059 3066 (runsource): I copied code.py's runsource() into ipython to modify
3060 3067 it a bit. Now the code object and source to be executed are
3061 3068 stored in ipython. This makes this info accessible to third-party
3062 3069 tools, like custom exception handlers. After a request by Frédéric
3063 3070 Mantegazza <mantegazza-AT-ill.fr>.
3064 3071
3065 3072 * IPython/UserConfig/ipythonrc: Add up/down arrow keys to
3066 3073 history-search via readline (like C-p/C-n). I'd wanted this for a
3067 3074 long time, but only recently found out how to do it. For users
3068 3075 who already have their ipythonrc files made and want this, just
3069 3076 add:
3070 3077
3071 3078 readline_parse_and_bind "\e[A": history-search-backward
3072 3079 readline_parse_and_bind "\e[B": history-search-forward
3073 3080
3074 3081 2005-03-18 Fernando Perez <fperez@colorado.edu>
3075 3082
3076 3083 * IPython/Magic.py (magic_sc): %sc and %sx now use the fancy
3077 3084 LSString and SList classes which allow transparent conversions
3078 3085 between list mode and whitespace-separated string.
3079 3086 (magic_r): Fix recursion problem in %r.
3080 3087
3081 3088 * IPython/genutils.py (LSString): New class to be used for
3082 3089 automatic storage of the results of all alias/system calls in _o
3083 3090 and _e (stdout/err). These provide a .l/.list attribute which
3084 3091 does automatic splitting on newlines. This means that for most
3085 3092 uses, you'll never need to do capturing of output with %sc/%sx
3086 3093 anymore, since ipython keeps this always done for you. Note that
3087 3094 only the LAST results are stored, the _o/e variables are
3088 3095 overwritten on each call. If you need to save their contents
3089 3096 further, simply bind them to any other name.
3090 3097
3091 3098 2005-03-17 Fernando Perez <fperez@colorado.edu>
3092 3099
3093 3100 * IPython/Prompts.py (BasePrompt.cwd_filt): a few more fixes for
3094 3101 prompt namespace handling.
3095 3102
3096 3103 2005-03-16 Fernando Perez <fperez@colorado.edu>
3097 3104
3098 3105 * IPython/Prompts.py (CachedOutput.__init__): Fix default and
3099 3106 classic prompts to be '>>> ' (final space was missing, and it
3100 3107 trips the emacs python mode).
3101 3108 (BasePrompt.__str__): Added safe support for dynamic prompt
3102 3109 strings. Now you can set your prompt string to be '$x', and the
3103 3110 value of x will be printed from your interactive namespace. The
3104 3111 interpolation syntax includes the full Itpl support, so
3105 3112 ${foo()+x+bar()} is a valid prompt string now, and the function
3106 3113 calls will be made at runtime.
3107 3114
3108 3115 2005-03-15 Fernando Perez <fperez@colorado.edu>
3109 3116
3110 3117 * IPython/Magic.py (magic_history): renamed %hist to %history, to
3111 3118 avoid name clashes in pylab. %hist still works, it just forwards
3112 3119 the call to %history.
3113 3120
3114 3121 2005-03-02 *** Released version 0.6.12
3115 3122
3116 3123 2005-03-02 Fernando Perez <fperez@colorado.edu>
3117 3124
3118 3125 * IPython/iplib.py (handle_magic): log magic calls properly as
3119 3126 ipmagic() function calls.
3120 3127
3121 3128 * IPython/Magic.py (magic_time): Improved %time to support
3122 3129 statements and provide wall-clock as well as CPU time.
3123 3130
3124 3131 2005-02-27 Fernando Perez <fperez@colorado.edu>
3125 3132
3126 3133 * IPython/hooks.py: New hooks module, to expose user-modifiable
3127 3134 IPython functionality in a clean manner. For now only the editor
3128 3135 hook is actually written, and other thigns which I intend to turn
3129 3136 into proper hooks aren't yet there. The display and prefilter
3130 3137 stuff, for example, should be hooks. But at least now the
3131 3138 framework is in place, and the rest can be moved here with more
3132 3139 time later. IPython had had a .hooks variable for a long time for
3133 3140 this purpose, but I'd never actually used it for anything.
3134 3141
3135 3142 2005-02-26 Fernando Perez <fperez@colorado.edu>
3136 3143
3137 3144 * IPython/ipmaker.py (make_IPython): make the default ipython
3138 3145 directory be called _ipython under win32, to follow more the
3139 3146 naming peculiarities of that platform (where buggy software like
3140 3147 Visual Sourcesafe breaks with .named directories). Reported by
3141 3148 Ville Vainio.
3142 3149
3143 3150 2005-02-23 Fernando Perez <fperez@colorado.edu>
3144 3151
3145 3152 * IPython/iplib.py (InteractiveShell.__init__): removed a few
3146 3153 auto_aliases for win32 which were causing problems. Users can
3147 3154 define the ones they personally like.
3148 3155
3149 3156 2005-02-21 Fernando Perez <fperez@colorado.edu>
3150 3157
3151 3158 * IPython/Magic.py (magic_time): new magic to time execution of
3152 3159 expressions. After a request by Charles Moad <cmoad-AT-indiana.edu>.
3153 3160
3154 3161 2005-02-19 Fernando Perez <fperez@colorado.edu>
3155 3162
3156 3163 * IPython/ConfigLoader.py (ConfigLoader.load): Allow empty strings
3157 3164 into keys (for prompts, for example).
3158 3165
3159 3166 * IPython/Prompts.py (BasePrompt.set_p_str): Fix to allow empty
3160 3167 prompts in case users want them. This introduces a small behavior
3161 3168 change: ipython does not automatically add a space to all prompts
3162 3169 anymore. To get the old prompts with a space, users should add it
3163 3170 manually to their ipythonrc file, so for example prompt_in1 should
3164 3171 now read 'In [\#]: ' instead of 'In [\#]:'.
3165 3172 (BasePrompt.__init__): New option prompts_pad_left (only in rc
3166 3173 file) to control left-padding of secondary prompts.
3167 3174
3168 3175 * IPython/Magic.py (Magic.profile_missing_notice): Don't crash if
3169 3176 the profiler can't be imported. Fix for Debian, which removed
3170 3177 profile.py because of License issues. I applied a slightly
3171 3178 modified version of the original Debian patch at
3172 3179 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=294500.
3173 3180
3174 3181 2005-02-17 Fernando Perez <fperez@colorado.edu>
3175 3182
3176 3183 * IPython/genutils.py (native_line_ends): Fix bug which would
3177 3184 cause improper line-ends under win32 b/c I was not opening files
3178 3185 in binary mode. Bug report and fix thanks to Ville.
3179 3186
3180 3187 * IPython/iplib.py (handle_auto): Fix bug which I introduced when
3181 3188 trying to catch spurious foo[1] autocalls. My fix actually broke
3182 3189 ',/' autoquote/call with explicit escape (bad regexp).
3183 3190
3184 3191 2005-02-15 *** Released version 0.6.11
3185 3192
3186 3193 2005-02-14 Fernando Perez <fperez@colorado.edu>
3187 3194
3188 3195 * IPython/background_jobs.py: New background job management
3189 3196 subsystem. This is implemented via a new set of classes, and
3190 3197 IPython now provides a builtin 'jobs' object for background job
3191 3198 execution. A convenience %bg magic serves as a lightweight
3192 3199 frontend for starting the more common type of calls. This was
3193 3200 inspired by discussions with B. Granger and the BackgroundCommand
3194 3201 class described in the book Python Scripting for Computational
3195 3202 Science, by H. P. Langtangen: http://folk.uio.no/hpl/scripting
3196 3203 (although ultimately no code from this text was used, as IPython's
3197 3204 system is a separate implementation).
3198 3205
3199 3206 * IPython/iplib.py (MagicCompleter.python_matches): add new option
3200 3207 to control the completion of single/double underscore names
3201 3208 separately. As documented in the example ipytonrc file, the
3202 3209 readline_omit__names variable can now be set to 2, to omit even
3203 3210 single underscore names. Thanks to a patch by Brian Wong
3204 3211 <BrianWong-AT-AirgoNetworks.Com>.
3205 3212 (InteractiveShell.__init__): Fix bug which would cause foo[1] to
3206 3213 be autocalled as foo([1]) if foo were callable. A problem for
3207 3214 things which are both callable and implement __getitem__.
3208 3215 (init_readline): Fix autoindentation for win32. Thanks to a patch
3209 3216 by Vivian De Smedt <vivian-AT-vdesmedt.com>.
3210 3217
3211 3218 2005-02-12 Fernando Perez <fperez@colorado.edu>
3212 3219
3213 3220 * IPython/ipmaker.py (make_IPython): Disabled the stout traps
3214 3221 which I had written long ago to sort out user error messages which
3215 3222 may occur during startup. This seemed like a good idea initially,
3216 3223 but it has proven a disaster in retrospect. I don't want to
3217 3224 change much code for now, so my fix is to set the internal 'debug'
3218 3225 flag to true everywhere, whose only job was precisely to control
3219 3226 this subsystem. This closes issue 28 (as well as avoiding all
3220 3227 sorts of strange hangups which occur from time to time).
3221 3228
3222 3229 2005-02-07 Fernando Perez <fperez@colorado.edu>
3223 3230
3224 3231 * IPython/Magic.py (magic_edit): Fix 'ed -p' not working when the
3225 3232 previous call produced a syntax error.
3226 3233
3227 3234 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
3228 3235 classes without constructor.
3229 3236
3230 3237 2005-02-06 Fernando Perez <fperez@colorado.edu>
3231 3238
3232 3239 * IPython/iplib.py (MagicCompleter.complete): Extend the list of
3233 3240 completions with the results of each matcher, so we return results
3234 3241 to the user from all namespaces. This breaks with ipython
3235 3242 tradition, but I think it's a nicer behavior. Now you get all
3236 3243 possible completions listed, from all possible namespaces (python,
3237 3244 filesystem, magics...) After a request by John Hunter
3238 3245 <jdhunter-AT-nitace.bsd.uchicago.edu>.
3239 3246
3240 3247 2005-02-05 Fernando Perez <fperez@colorado.edu>
3241 3248
3242 3249 * IPython/Magic.py (magic_prun): Fix bug where prun would fail if
3243 3250 the call had quote characters in it (the quotes were stripped).
3244 3251
3245 3252 2005-01-31 Fernando Perez <fperez@colorado.edu>
3246 3253
3247 3254 * IPython/iplib.py (InteractiveShell.__init__): reduce reliance on
3248 3255 Itpl.itpl() to make the code more robust against psyco
3249 3256 optimizations.
3250 3257
3251 3258 * IPython/Itpl.py (Itpl.__str__): Use a _getframe() call instead
3252 3259 of causing an exception. Quicker, cleaner.
3253 3260
3254 3261 2005-01-28 Fernando Perez <fperez@colorado.edu>
3255 3262
3256 3263 * scripts/ipython_win_post_install.py (install): hardcode
3257 3264 sys.prefix+'python.exe' as the executable path. It turns out that
3258 3265 during the post-installation run, sys.executable resolves to the
3259 3266 name of the binary installer! I should report this as a distutils
3260 3267 bug, I think. I updated the .10 release with this tiny fix, to
3261 3268 avoid annoying the lists further.
3262 3269
3263 3270 2005-01-27 *** Released version 0.6.10
3264 3271
3265 3272 2005-01-27 Fernando Perez <fperez@colorado.edu>
3266 3273
3267 3274 * IPython/numutils.py (norm): Added 'inf' as optional name for
3268 3275 L-infinity norm, included references to mathworld.com for vector
3269 3276 norm definitions.
3270 3277 (amin/amax): added amin/amax for array min/max. Similar to what
3271 3278 pylab ships with after the recent reorganization of names.
3272 3279 (spike/spike_odd): removed deprecated spike/spike_odd functions.
3273 3280
3274 3281 * ipython.el: committed Alex's recent fixes and improvements.
3275 3282 Tested with python-mode from CVS, and it looks excellent. Since
3276 3283 python-mode hasn't released anything in a while, I'm temporarily
3277 3284 putting a copy of today's CVS (v 4.70) of python-mode in:
3278 3285 http://ipython.scipy.org/tmp/python-mode.el
3279 3286
3280 3287 * scripts/ipython_win_post_install.py (install): Win32 fix to use
3281 3288 sys.executable for the executable name, instead of assuming it's
3282 3289 called 'python.exe' (the post-installer would have produced broken
3283 3290 setups on systems with a differently named python binary).
3284 3291
3285 3292 * IPython/PyColorize.py (Parser.__call__): change explicit '\n'
3286 3293 references to os.linesep, to make the code more
3287 3294 platform-independent. This is also part of the win32 coloring
3288 3295 fixes.
3289 3296
3290 3297 * IPython/genutils.py (page_dumb): Remove attempts to chop long
3291 3298 lines, which actually cause coloring bugs because the length of
3292 3299 the line is very difficult to correctly compute with embedded
3293 3300 escapes. This was the source of all the coloring problems under
3294 3301 Win32. I think that _finally_, Win32 users have a properly
3295 3302 working ipython in all respects. This would never have happened
3296 3303 if not for Gary Bishop and Viktor Ransmayr's great help and work.
3297 3304
3298 3305 2005-01-26 *** Released version 0.6.9
3299 3306
3300 3307 2005-01-25 Fernando Perez <fperez@colorado.edu>
3301 3308
3302 3309 * setup.py: finally, we have a true Windows installer, thanks to
3303 3310 the excellent work of Viktor Ransmayr
3304 3311 <viktor.ransmayr-AT-t-online.de>. The docs have been updated for
3305 3312 Windows users. The setup routine is quite a bit cleaner thanks to
3306 3313 this, and the post-install script uses the proper functions to
3307 3314 allow a clean de-installation using the standard Windows Control
3308 3315 Panel.
3309 3316
3310 3317 * IPython/genutils.py (get_home_dir): changed to use the $HOME
3311 3318 environment variable under all OSes (including win32) if
3312 3319 available. This will give consistency to win32 users who have set
3313 3320 this variable for any reason. If os.environ['HOME'] fails, the
3314 3321 previous policy of using HOMEDRIVE\HOMEPATH kicks in.
3315 3322
3316 3323 2005-01-24 Fernando Perez <fperez@colorado.edu>
3317 3324
3318 3325 * IPython/numutils.py (empty_like): add empty_like(), similar to
3319 3326 zeros_like() but taking advantage of the new empty() Numeric routine.
3320 3327
3321 3328 2005-01-23 *** Released version 0.6.8
3322 3329
3323 3330 2005-01-22 Fernando Perez <fperez@colorado.edu>
3324 3331
3325 3332 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): I removed the
3326 3333 automatic show() calls. After discussing things with JDH, it
3327 3334 turns out there are too many corner cases where this can go wrong.
3328 3335 It's best not to try to be 'too smart', and simply have ipython
3329 3336 reproduce as much as possible the default behavior of a normal
3330 3337 python shell.
3331 3338
3332 3339 * IPython/iplib.py (InteractiveShell.__init__): Modified the
3333 3340 line-splitting regexp and _prefilter() to avoid calling getattr()
3334 3341 on assignments. This closes
3335 3342 http://www.scipy.net/roundup/ipython/issue24. Note that Python's
3336 3343 readline uses getattr(), so a simple <TAB> keypress is still
3337 3344 enough to trigger getattr() calls on an object.
3338 3345
3339 3346 2005-01-21 Fernando Perez <fperez@colorado.edu>
3340 3347
3341 3348 * IPython/Shell.py (MatplotlibShellBase.magic_run): Fix the %run
3342 3349 docstring under pylab so it doesn't mask the original.
3343 3350
3344 3351 2005-01-21 *** Released version 0.6.7
3345 3352
3346 3353 2005-01-21 Fernando Perez <fperez@colorado.edu>
3347 3354
3348 3355 * IPython/Shell.py (MTInteractiveShell.runcode): Trap a crash with
3349 3356 signal handling for win32 users in multithreaded mode.
3350 3357
3351 3358 2005-01-17 Fernando Perez <fperez@colorado.edu>
3352 3359
3353 3360 * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting
3354 3361 instances with no __init__. After a crash report by Norbert Nemec
3355 3362 <Norbert-AT-nemec-online.de>.
3356 3363
3357 3364 2005-01-14 Fernando Perez <fperez@colorado.edu>
3358 3365
3359 3366 * IPython/ultraTB.py (VerboseTB.text): Fix bug in reporting of
3360 3367 names for verbose exceptions, when multiple dotted names and the
3361 3368 'parent' object were present on the same line.
3362 3369
3363 3370 2005-01-11 Fernando Perez <fperez@colorado.edu>
3364 3371
3365 3372 * IPython/genutils.py (flag_calls): new utility to trap and flag
3366 3373 calls in functions. I need it to clean up matplotlib support.
3367 3374 Also removed some deprecated code in genutils.
3368 3375
3369 3376 * IPython/Shell.py (MatplotlibShellBase.mplot_exec): small fix so
3370 3377 that matplotlib scripts called with %run, which don't call show()
3371 3378 themselves, still have their plotting windows open.
3372 3379
3373 3380 2005-01-05 Fernando Perez <fperez@colorado.edu>
3374 3381
3375 3382 * IPython/Shell.py (IPShellGTK.__init__): Patch by Andrew Straw
3376 3383 <astraw-AT-caltech.edu>, to fix gtk deprecation warnings.
3377 3384
3378 3385 2004-12-19 Fernando Perez <fperez@colorado.edu>
3379 3386
3380 3387 * IPython/Shell.py (MTInteractiveShell.runcode): Get rid of
3381 3388 parent_runcode, which was an eyesore. The same result can be
3382 3389 obtained with Python's regular superclass mechanisms.
3383 3390
3384 3391 2004-12-17 Fernando Perez <fperez@colorado.edu>
3385 3392
3386 3393 * IPython/Magic.py (Magic.magic_sc): Fix quote stripping problem
3387 3394 reported by Prabhu.
3388 3395 (Magic.magic_sx): direct all errors to Term.cerr (defaults to
3389 3396 sys.stderr) instead of explicitly calling sys.stderr. This helps
3390 3397 maintain our I/O abstractions clean, for future GUI embeddings.
3391 3398
3392 3399 * IPython/genutils.py (info): added new utility for sys.stderr
3393 3400 unified info message handling (thin wrapper around warn()).
3394 3401
3395 3402 * IPython/ultraTB.py (VerboseTB.text): Fix misreported global
3396 3403 composite (dotted) names on verbose exceptions.
3397 3404 (VerboseTB.nullrepr): harden against another kind of errors which
3398 3405 Python's inspect module can trigger, and which were crashing
3399 3406 IPython. Thanks to a report by Marco Lombardi
3400 3407 <mlombard-AT-ma010192.hq.eso.org>.
3401 3408
3402 3409 2004-12-13 *** Released version 0.6.6
3403 3410
3404 3411 2004-12-12 Fernando Perez <fperez@colorado.edu>
3405 3412
3406 3413 * IPython/Shell.py (IPShellGTK.mainloop): catch RuntimeErrors
3407 3414 generated by pygtk upon initialization if it was built without
3408 3415 threads (for matplotlib users). After a crash reported by
3409 3416 Leguijt, Jaap J SIEP-EPT-RES <Jaap.Leguijt-AT-shell.com>.
3410 3417
3411 3418 * IPython/ipmaker.py (make_IPython): fix small bug in the
3412 3419 import_some parameter for multiple imports.
3413 3420
3414 3421 * IPython/iplib.py (ipmagic): simplified the interface of
3415 3422 ipmagic() to take a single string argument, just as it would be
3416 3423 typed at the IPython cmd line.
3417 3424 (ipalias): Added new ipalias() with an interface identical to
3418 3425 ipmagic(). This completes exposing a pure python interface to the
3419 3426 alias and magic system, which can be used in loops or more complex
3420 3427 code where IPython's automatic line mangling is not active.
3421 3428
3422 3429 * IPython/genutils.py (timing): changed interface of timing to
3423 3430 simply run code once, which is the most common case. timings()
3424 3431 remains unchanged, for the cases where you want multiple runs.
3425 3432
3426 3433 * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix a
3427 3434 bug where Python2.2 crashes with exec'ing code which does not end
3428 3435 in a single newline. Python 2.3 is OK, so I hadn't noticed this
3429 3436 before.
3430 3437
3431 3438 2004-12-10 Fernando Perez <fperez@colorado.edu>
3432 3439
3433 3440 * IPython/Magic.py (Magic.magic_prun): changed name of option from
3434 3441 -t to -T, to accomodate the new -t flag in %run (the %run and
3435 3442 %prun options are kind of intermixed, and it's not easy to change
3436 3443 this with the limitations of python's getopt).
3437 3444
3438 3445 * IPython/Magic.py (Magic.magic_run): Added new -t option to time
3439 3446 the execution of scripts. It's not as fine-tuned as timeit.py,
3440 3447 but it works from inside ipython (and under 2.2, which lacks
3441 3448 timeit.py). Optionally a number of runs > 1 can be given for
3442 3449 timing very short-running code.
3443 3450
3444 3451 * IPython/genutils.py (uniq_stable): new routine which returns a
3445 3452 list of unique elements in any iterable, but in stable order of
3446 3453 appearance. I needed this for the ultraTB fixes, and it's a handy
3447 3454 utility.
3448 3455
3449 3456 * IPython/ultraTB.py (VerboseTB.text): Fix proper reporting of
3450 3457 dotted names in Verbose exceptions. This had been broken since
3451 3458 the very start, now x.y will properly be printed in a Verbose
3452 3459 traceback, instead of x being shown and y appearing always as an
3453 3460 'undefined global'. Getting this to work was a bit tricky,
3454 3461 because by default python tokenizers are stateless. Saved by
3455 3462 python's ability to easily add a bit of state to an arbitrary
3456 3463 function (without needing to build a full-blown callable object).
3457 3464
3458 3465 Also big cleanup of this code, which had horrendous runtime
3459 3466 lookups of zillions of attributes for colorization. Moved all
3460 3467 this code into a few templates, which make it cleaner and quicker.
3461 3468
3462 3469 Printout quality was also improved for Verbose exceptions: one
3463 3470 variable per line, and memory addresses are printed (this can be
3464 3471 quite handy in nasty debugging situations, which is what Verbose
3465 3472 is for).
3466 3473
3467 3474 * IPython/ipmaker.py (make_IPython): Do NOT execute files named in
3468 3475 the command line as scripts to be loaded by embedded instances.
3469 3476 Doing so has the potential for an infinite recursion if there are
3470 3477 exceptions thrown in the process. This fixes a strange crash
3471 3478 reported by Philippe MULLER <muller-AT-irit.fr>.
3472 3479
3473 3480 2004-12-09 Fernando Perez <fperez@colorado.edu>
3474 3481
3475 3482 * IPython/Shell.py (MatplotlibShellBase.use): Change pylab support
3476 3483 to reflect new names in matplotlib, which now expose the
3477 3484 matlab-compatible interface via a pylab module instead of the
3478 3485 'matlab' name. The new code is backwards compatible, so users of
3479 3486 all matplotlib versions are OK. Patch by J. Hunter.
3480 3487
3481 3488 * IPython/OInspect.py (Inspector.pinfo): Add to object? printing
3482 3489 of __init__ docstrings for instances (class docstrings are already
3483 3490 automatically printed). Instances with customized docstrings
3484 3491 (indep. of the class) are also recognized and all 3 separate
3485 3492 docstrings are printed (instance, class, constructor). After some
3486 3493 comments/suggestions by J. Hunter.
3487 3494
3488 3495 2004-12-05 Fernando Perez <fperez@colorado.edu>
3489 3496
3490 3497 * IPython/iplib.py (MagicCompleter.complete): Remove annoying
3491 3498 warnings when tab-completion fails and triggers an exception.
3492 3499
3493 3500 2004-12-03 Fernando Perez <fperez@colorado.edu>
3494 3501
3495 3502 * IPython/Magic.py (magic_prun): Fix bug where an exception would
3496 3503 be triggered when using 'run -p'. An incorrect option flag was
3497 3504 being set ('d' instead of 'D').
3498 3505 (manpage): fix missing escaped \- sign.
3499 3506
3500 3507 2004-11-30 *** Released version 0.6.5
3501 3508
3502 3509 2004-11-30 Fernando Perez <fperez@colorado.edu>
3503 3510
3504 3511 * IPython/Magic.py (Magic.magic_run): Fix bug in breakpoint
3505 3512 setting with -d option.
3506 3513
3507 3514 * setup.py (docfiles): Fix problem where the doc glob I was using
3508 3515 was COMPLETELY BROKEN. It was giving the right files by pure
3509 3516 accident, but failed once I tried to include ipython.el. Note:
3510 3517 glob() does NOT allow you to do exclusion on multiple endings!
3511 3518
3512 3519 2004-11-29 Fernando Perez <fperez@colorado.edu>
3513 3520
3514 3521 * IPython/usage.py (__doc__): cleaned up usage docstring, by using
3515 3522 the manpage as the source. Better formatting & consistency.
3516 3523
3517 3524 * IPython/Magic.py (magic_run): Added new -d option, to run
3518 3525 scripts under the control of the python pdb debugger. Note that
3519 3526 this required changing the %prun option -d to -D, to avoid a clash
3520 3527 (since %run must pass options to %prun, and getopt is too dumb to
3521 3528 handle options with string values with embedded spaces). Thanks
3522 3529 to a suggestion by Matthew Arnison <maffew-AT-cat.org.au>.
3523 3530 (magic_who_ls): added type matching to %who and %whos, so that one
3524 3531 can filter their output to only include variables of certain
3525 3532 types. Another suggestion by Matthew.
3526 3533 (magic_whos): Added memory summaries in kb and Mb for arrays.
3527 3534 (magic_who): Improve formatting (break lines every 9 vars).
3528 3535
3529 3536 2004-11-28 Fernando Perez <fperez@colorado.edu>
3530 3537
3531 3538 * IPython/Logger.py (Logger.log): Fix bug in syncing the input
3532 3539 cache when empty lines were present.
3533 3540
3534 3541 2004-11-24 Fernando Perez <fperez@colorado.edu>
3535 3542
3536 3543 * IPython/usage.py (__doc__): document the re-activated threading
3537 3544 options for WX and GTK.
3538 3545
3539 3546 2004-11-23 Fernando Perez <fperez@colorado.edu>
3540 3547
3541 3548 * IPython/Shell.py (start): Added Prabhu's big patch to reactivate
3542 3549 the -wthread and -gthread options, along with a new -tk one to try
3543 3550 and coordinate Tk threading with wx/gtk. The tk support is very
3544 3551 platform dependent, since it seems to require Tcl and Tk to be
3545 3552 built with threads (Fedora1/2 appears NOT to have it, but in
3546 3553 Prabhu's Debian boxes it works OK). But even with some Tk
3547 3554 limitations, this is a great improvement.
3548 3555
3549 3556 * IPython/Prompts.py (prompt_specials_color): Added \t for time
3550 3557 info in user prompts. Patch by Prabhu.
3551 3558
3552 3559 2004-11-18 Fernando Perez <fperez@colorado.edu>
3553 3560
3554 3561 * IPython/genutils.py (ask_yes_no): Add check for a max of 20
3555 3562 EOFErrors and bail, to avoid infinite loops if a non-terminating
3556 3563 file is fed into ipython. Patch submitted in issue 19 by user,
3557 3564 many thanks.
3558 3565
3559 3566 * IPython/iplib.py (InteractiveShell.handle_auto): do NOT trigger
3560 3567 autoquote/parens in continuation prompts, which can cause lots of
3561 3568 problems. Closes roundup issue 20.
3562 3569
3563 3570 2004-11-17 Fernando Perez <fperez@colorado.edu>
3564 3571
3565 3572 * debian/control (Build-Depends-Indep): Fix dpatch dependency,
3566 3573 reported as debian bug #280505. I'm not sure my local changelog
3567 3574 entry has the proper debian format (Jack?).
3568 3575
3569 3576 2004-11-08 *** Released version 0.6.4
3570 3577
3571 3578 2004-11-08 Fernando Perez <fperez@colorado.edu>
3572 3579
3573 3580 * IPython/iplib.py (init_readline): Fix exit message for Windows
3574 3581 when readline is active. Thanks to a report by Eric Jones
3575 3582 <eric-AT-enthought.com>.
3576 3583
3577 3584 2004-11-07 Fernando Perez <fperez@colorado.edu>
3578 3585
3579 3586 * IPython/genutils.py (page): Add a trap for OSError exceptions,
3580 3587 sometimes seen by win2k/cygwin users.
3581 3588
3582 3589 2004-11-06 Fernando Perez <fperez@colorado.edu>
3583 3590
3584 3591 * IPython/iplib.py (interact): Change the handling of %Exit from
3585 3592 trying to propagate a SystemExit to an internal ipython flag.
3586 3593 This is less elegant than using Python's exception mechanism, but
3587 3594 I can't get that to work reliably with threads, so under -pylab
3588 3595 %Exit was hanging IPython. Cross-thread exception handling is
3589 3596 really a bitch. Thaks to a bug report by Stephen Walton
3590 3597 <stephen.walton-AT-csun.edu>.
3591 3598
3592 3599 2004-11-04 Fernando Perez <fperez@colorado.edu>
3593 3600
3594 3601 * IPython/iplib.py (raw_input_original): store a pointer to the
3595 3602 true raw_input to harden against code which can modify it
3596 3603 (wx.py.PyShell does this and would otherwise crash ipython).
3597 3604 Thanks to a bug report by Jim Flowers <james.flowers-AT-lgx.com>.
3598 3605
3599 3606 * IPython/Shell.py (MTInteractiveShell.runsource): Cleaner fix for
3600 3607 Ctrl-C problem, which does not mess up the input line.
3601 3608
3602 3609 2004-11-03 Fernando Perez <fperez@colorado.edu>
3603 3610
3604 3611 * IPython/Release.py: Changed licensing to BSD, in all files.
3605 3612 (name): lowercase name for tarball/RPM release.
3606 3613
3607 3614 * IPython/OInspect.py (getdoc): wrap inspect.getdoc() safely for
3608 3615 use throughout ipython.
3609 3616
3610 3617 * IPython/Magic.py (Magic._ofind): Switch to using the new
3611 3618 OInspect.getdoc() function.
3612 3619
3613 3620 * IPython/Shell.py (sigint_handler): Hack to ignore the execution
3614 3621 of the line currently being canceled via Ctrl-C. It's extremely
3615 3622 ugly, but I don't know how to do it better (the problem is one of
3616 3623 handling cross-thread exceptions).
3617 3624
3618 3625 2004-10-28 Fernando Perez <fperez@colorado.edu>
3619 3626
3620 3627 * IPython/Shell.py (signal_handler): add signal handlers to trap
3621 3628 SIGINT and SIGSEGV in threaded code properly. Thanks to a bug
3622 3629 report by Francesc Alted.
3623 3630
3624 3631 2004-10-21 Fernando Perez <fperez@colorado.edu>
3625 3632
3626 3633 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Fix @
3627 3634 to % for pysh syntax extensions.
3628 3635
3629 3636 2004-10-09 Fernando Perez <fperez@colorado.edu>
3630 3637
3631 3638 * IPython/Magic.py (Magic.magic_whos): modify output of Numeric
3632 3639 arrays to print a more useful summary, without calling str(arr).
3633 3640 This avoids the problem of extremely lengthy computations which
3634 3641 occur if arr is large, and appear to the user as a system lockup
3635 3642 with 100% cpu activity. After a suggestion by Kristian Sandberg
3636 3643 <Kristian.Sandberg@colorado.edu>.
3637 3644 (Magic.__init__): fix bug in global magic escapes not being
3638 3645 correctly set.
3639 3646
3640 3647 2004-10-08 Fernando Perez <fperez@colorado.edu>
3641 3648
3642 3649 * IPython/Magic.py (__license__): change to absolute imports of
3643 3650 ipython's own internal packages, to start adapting to the absolute
3644 3651 import requirement of PEP-328.
3645 3652
3646 3653 * IPython/genutils.py (__author__): Fix coding to utf-8 on all
3647 3654 files, and standardize author/license marks through the Release
3648 3655 module instead of having per/file stuff (except for files with
3649 3656 particular licenses, like the MIT/PSF-licensed codes).
3650 3657
3651 3658 * IPython/Debugger.py: remove dead code for python 2.1
3652 3659
3653 3660 2004-10-04 Fernando Perez <fperez@colorado.edu>
3654 3661
3655 3662 * IPython/iplib.py (ipmagic): New function for accessing magics
3656 3663 via a normal python function call.
3657 3664
3658 3665 * IPython/Magic.py (Magic.magic_magic): Change the magic escape
3659 3666 from '@' to '%', to accomodate the new @decorator syntax of python
3660 3667 2.4.
3661 3668
3662 3669 2004-09-29 Fernando Perez <fperez@colorado.edu>
3663 3670
3664 3671 * IPython/Shell.py (MatplotlibShellBase.use): Added a wrapper to
3665 3672 matplotlib.use to prevent running scripts which try to switch
3666 3673 interactive backends from within ipython. This will just crash
3667 3674 the python interpreter, so we can't allow it (but a detailed error
3668 3675 is given to the user).
3669 3676
3670 3677 2004-09-28 Fernando Perez <fperez@colorado.edu>
3671 3678
3672 3679 * IPython/Shell.py (MatplotlibShellBase.mplot_exec):
3673 3680 matplotlib-related fixes so that using @run with non-matplotlib
3674 3681 scripts doesn't pop up spurious plot windows. This requires
3675 3682 matplotlib >= 0.63, where I had to make some changes as well.
3676 3683
3677 3684 * IPython/ipmaker.py (make_IPython): update version requirement to
3678 3685 python 2.2.
3679 3686
3680 3687 * IPython/iplib.py (InteractiveShell.mainloop): Add an optional
3681 3688 banner arg for embedded customization.
3682 3689
3683 3690 * IPython/Magic.py (Magic.__init__): big cleanup to remove all
3684 3691 explicit uses of __IP as the IPython's instance name. Now things
3685 3692 are properly handled via the shell.name value. The actual code
3686 3693 is a bit ugly b/c I'm doing it via a global in Magic.py, but this
3687 3694 is much better than before. I'll clean things completely when the
3688 3695 magic stuff gets a real overhaul.
3689 3696
3690 3697 * ipython.1: small fixes, sent in by Jack Moffit. He also sent in
3691 3698 minor changes to debian dir.
3692 3699
3693 3700 * IPython/iplib.py (InteractiveShell.__init__): Fix adding a
3694 3701 pointer to the shell itself in the interactive namespace even when
3695 3702 a user-supplied dict is provided. This is needed for embedding
3696 3703 purposes (found by tests with Michel Sanner).
3697 3704
3698 3705 2004-09-27 Fernando Perez <fperez@colorado.edu>
3699 3706
3700 3707 * IPython/UserConfig/ipythonrc: remove []{} from
3701 3708 readline_remove_delims, so that things like [modname.<TAB> do
3702 3709 proper completion. This disables [].TAB, but that's a less common
3703 3710 case than module names in list comprehensions, for example.
3704 3711 Thanks to a report by Andrea Riciputi.
3705 3712
3706 3713 2004-09-09 Fernando Perez <fperez@colorado.edu>
3707 3714
3708 3715 * IPython/Shell.py (IPShellGTK.mainloop): reorder to avoid
3709 3716 blocking problems in win32 and osx. Fix by John.
3710 3717
3711 3718 2004-09-08 Fernando Perez <fperez@colorado.edu>
3712 3719
3713 3720 * IPython/Shell.py (IPShellWX.OnInit): Fix output redirection bug
3714 3721 for Win32 and OSX. Fix by John Hunter.
3715 3722
3716 3723 2004-08-30 *** Released version 0.6.3
3717 3724
3718 3725 2004-08-30 Fernando Perez <fperez@colorado.edu>
3719 3726
3720 3727 * setup.py (isfile): Add manpages to list of dependent files to be
3721 3728 updated.
3722 3729
3723 3730 2004-08-27 Fernando Perez <fperez@colorado.edu>
3724 3731
3725 3732 * IPython/Shell.py (start): I've disabled -wthread and -gthread
3726 3733 for now. They don't really work with standalone WX/GTK code
3727 3734 (though matplotlib IS working fine with both of those backends).
3728 3735 This will neeed much more testing. I disabled most things with
3729 3736 comments, so turning it back on later should be pretty easy.
3730 3737
3731 3738 * IPython/iplib.py (InteractiveShell.__init__): Fix accidental
3732 3739 autocalling of expressions like r'foo', by modifying the line
3733 3740 split regexp. Closes
3734 3741 http://www.scipy.net/roundup/ipython/issue18, reported by Nicholas
3735 3742 Riley <ipythonbugs-AT-sabi.net>.
3736 3743 (InteractiveShell.mainloop): honor --nobanner with banner
3737 3744 extensions.
3738 3745
3739 3746 * IPython/Shell.py: Significant refactoring of all classes, so
3740 3747 that we can really support ALL matplotlib backends and threading
3741 3748 models (John spotted a bug with Tk which required this). Now we
3742 3749 should support single-threaded, WX-threads and GTK-threads, both
3743 3750 for generic code and for matplotlib.
3744 3751
3745 3752 * IPython/ipmaker.py (__call__): Changed -mpthread option to
3746 3753 -pylab, to simplify things for users. Will also remove the pylab
3747 3754 profile, since now all of matplotlib configuration is directly
3748 3755 handled here. This also reduces startup time.
3749 3756
3750 3757 * IPython/Shell.py (IPShellGTK.run): Fixed bug where mainloop() of
3751 3758 shell wasn't being correctly called. Also in IPShellWX.
3752 3759
3753 3760 * IPython/iplib.py (InteractiveShell.__init__): Added option to
3754 3761 fine-tune banner.
3755 3762
3756 3763 * IPython/numutils.py (spike): Deprecate these spike functions,
3757 3764 delete (long deprecated) gnuplot_exec handler.
3758 3765
3759 3766 2004-08-26 Fernando Perez <fperez@colorado.edu>
3760 3767
3761 3768 * ipython.1: Update for threading options, plus some others which
3762 3769 were missing.
3763 3770
3764 3771 * IPython/ipmaker.py (__call__): Added -wthread option for
3765 3772 wxpython thread handling. Make sure threading options are only
3766 3773 valid at the command line.
3767 3774
3768 3775 * scripts/ipython: moved shell selection into a factory function
3769 3776 in Shell.py, to keep the starter script to a minimum.
3770 3777
3771 3778 2004-08-25 Fernando Perez <fperez@colorado.edu>
3772 3779
3773 3780 * IPython/Shell.py (IPShellWX.wxexit): fixes to WX threading, by
3774 3781 John. Along with some recent changes he made to matplotlib, the
3775 3782 next versions of both systems should work very well together.
3776 3783
3777 3784 2004-08-24 Fernando Perez <fperez@colorado.edu>
3778 3785
3779 3786 * IPython/Magic.py (Magic.magic_prun): cleanup some dead code. I
3780 3787 tried to switch the profiling to using hotshot, but I'm getting
3781 3788 strange errors from prof.runctx() there. I may be misreading the
3782 3789 docs, but it looks weird. For now the profiling code will
3783 3790 continue to use the standard profiler.
3784 3791
3785 3792 2004-08-23 Fernando Perez <fperez@colorado.edu>
3786 3793
3787 3794 * IPython/Shell.py (IPShellWX.__init__): Improvements to the WX
3788 3795 threaded shell, by John Hunter. It's not quite ready yet, but
3789 3796 close.
3790 3797
3791 3798 2004-08-22 Fernando Perez <fperez@colorado.edu>
3792 3799
3793 3800 * IPython/iplib.py (InteractiveShell.interact): tab cleanups, also
3794 3801 in Magic and ultraTB.
3795 3802
3796 3803 * ipython.1: document threading options in manpage.
3797 3804
3798 3805 * scripts/ipython: Changed name of -thread option to -gthread,
3799 3806 since this is GTK specific. I want to leave the door open for a
3800 3807 -wthread option for WX, which will most likely be necessary. This
3801 3808 change affects usage and ipmaker as well.
3802 3809
3803 3810 * IPython/Shell.py (matplotlib_shell): Add a factory function to
3804 3811 handle the matplotlib shell issues. Code by John Hunter
3805 3812 <jdhunter-AT-nitace.bsd.uchicago.edu>.
3806 3813 (IPShellMatplotlibWX.__init__): Rudimentary WX support. It's
3807 3814 broken (and disabled for end users) for now, but it puts the
3808 3815 infrastructure in place.
3809 3816
3810 3817 2004-08-21 Fernando Perez <fperez@colorado.edu>
3811 3818
3812 3819 * ipythonrc-pylab: Add matplotlib support.
3813 3820
3814 3821 * matplotlib_config.py: new files for matplotlib support, part of
3815 3822 the pylab profile.
3816 3823
3817 3824 * IPython/usage.py (__doc__): documented the threading options.
3818 3825
3819 3826 2004-08-20 Fernando Perez <fperez@colorado.edu>
3820 3827
3821 3828 * ipython: Modified the main calling routine to handle the -thread
3822 3829 and -mpthread options. This needs to be done as a top-level hack,
3823 3830 because it determines which class to instantiate for IPython
3824 3831 itself.
3825 3832
3826 3833 * IPython/Shell.py (MTInteractiveShell.__init__): New set of
3827 3834 classes to support multithreaded GTK operation without blocking,
3828 3835 and matplotlib with all backends. This is a lot of still very
3829 3836 experimental code, and threads are tricky. So it may still have a
3830 3837 few rough edges... This code owes a lot to
3831 3838 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65109, by
3832 3839 Brian # McErlean and John Finlay, to Antoon Pardon for fixes, and
3833 3840 to John Hunter for all the matplotlib work.
3834 3841
3835 3842 * IPython/ipmaker.py (__call__): Added -thread and -mpthread
3836 3843 options for gtk thread and matplotlib support.
3837 3844
3838 3845 2004-08-16 Fernando Perez <fperez@colorado.edu>
3839 3846
3840 3847 * IPython/iplib.py (InteractiveShell.__init__): don't trigger
3841 3848 autocall for things like p*q,p/q,p+q,p-q, when p is callable. Bug
3842 3849 reported by Stephen Walton <stephen.walton-AT-csun.edu>.
3843 3850
3844 3851 2004-08-11 Fernando Perez <fperez@colorado.edu>
3845 3852
3846 3853 * setup.py (isfile): Fix build so documentation gets updated for
3847 3854 rpms (it was only done for .tgz builds).
3848 3855
3849 3856 2004-08-10 Fernando Perez <fperez@colorado.edu>
3850 3857
3851 3858 * genutils.py (Term): Fix misspell of stdin stream (sin->cin).
3852 3859
3853 3860 * iplib.py : Silence syntax error exceptions in tab-completion.
3854 3861
3855 3862 2004-08-05 Fernando Perez <fperez@colorado.edu>
3856 3863
3857 3864 * IPython/Prompts.py (Prompt2.set_colors): Fix incorrectly set
3858 3865 'color off' mark for continuation prompts. This was causing long
3859 3866 continuation lines to mis-wrap.
3860 3867
3861 3868 2004-08-01 Fernando Perez <fperez@colorado.edu>
3862 3869
3863 3870 * IPython/ipmaker.py (make_IPython): Allow the shell class used
3864 3871 for building ipython to be a parameter. All this is necessary
3865 3872 right now to have a multithreaded version, but this insane
3866 3873 non-design will be cleaned up soon. For now, it's a hack that
3867 3874 works.
3868 3875
3869 3876 * IPython/Shell.py (IPShell.__init__): Stop using mutable default
3870 3877 args in various places. No bugs so far, but it's a dangerous
3871 3878 practice.
3872 3879
3873 3880 2004-07-31 Fernando Perez <fperez@colorado.edu>
3874 3881
3875 3882 * IPython/iplib.py (complete): ignore SyntaxError exceptions to
3876 3883 fix completion of files with dots in their names under most
3877 3884 profiles (pysh was OK because the completion order is different).
3878 3885
3879 3886 2004-07-27 Fernando Perez <fperez@colorado.edu>
3880 3887
3881 3888 * IPython/iplib.py (InteractiveShell.__init__): build dict of
3882 3889 keywords manually, b/c the one in keyword.py was removed in python
3883 3890 2.4. Patch by Anakim Border <aborder-AT-users.sourceforge.net>.
3884 3891 This is NOT a bug under python 2.3 and earlier.
3885 3892
3886 3893 2004-07-26 Fernando Perez <fperez@colorado.edu>
3887 3894
3888 3895 * IPython/ultraTB.py (VerboseTB.text): Add another
3889 3896 linecache.checkcache() call to try to prevent inspect.py from
3890 3897 crashing under python 2.3. I think this fixes
3891 3898 http://www.scipy.net/roundup/ipython/issue17.
3892 3899
3893 3900 2004-07-26 *** Released version 0.6.2
3894 3901
3895 3902 2004-07-26 Fernando Perez <fperez@colorado.edu>
3896 3903
3897 3904 * IPython/Magic.py (Magic.magic_cd): Fix bug where 'cd -N' would
3898 3905 fail for any number.
3899 3906 (Magic.magic_bookmark): Fix bug where 'bookmark -l' would fail for
3900 3907 empty bookmarks.
3901 3908
3902 3909 2004-07-26 *** Released version 0.6.1
3903 3910
3904 3911 2004-07-26 Fernando Perez <fperez@colorado.edu>
3905 3912
3906 3913 * ipython_win_post_install.py (run): Added pysh shortcut for Windows.
3907 3914
3908 3915 * IPython/iplib.py (protect_filename): Applied Ville's patch for
3909 3916 escaping '()[]{}' in filenames.
3910 3917
3911 3918 * IPython/Magic.py (shlex_split): Fix handling of '*' and '?' for
3912 3919 Python 2.2 users who lack a proper shlex.split.
3913 3920
3914 3921 2004-07-19 Fernando Perez <fperez@colorado.edu>
3915 3922
3916 3923 * IPython/iplib.py (InteractiveShell.init_readline): Add support
3917 3924 for reading readline's init file. I follow the normal chain:
3918 3925 $INPUTRC is honored, otherwise ~/.inputrc is used. Thanks to a
3919 3926 report by Mike Heeter. This closes
3920 3927 http://www.scipy.net/roundup/ipython/issue16.
3921 3928
3922 3929 2004-07-18 Fernando Perez <fperez@colorado.edu>
3923 3930
3924 3931 * IPython/iplib.py (__init__): Add better handling of '\' under
3925 3932 Win32 for filenames. After a patch by Ville.
3926 3933
3927 3934 2004-07-17 Fernando Perez <fperez@colorado.edu>
3928 3935
3929 3936 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
3930 3937 autocalling would be triggered for 'foo is bar' if foo is
3931 3938 callable. I also cleaned up the autocall detection code to use a
3932 3939 regexp, which is faster. Bug reported by Alexander Schmolck.
3933 3940
3934 3941 * IPython/Magic.py (Magic.magic_pinfo): Fix bug where strings with
3935 3942 '?' in them would confuse the help system. Reported by Alex
3936 3943 Schmolck.
3937 3944
3938 3945 2004-07-16 Fernando Perez <fperez@colorado.edu>
3939 3946
3940 3947 * IPython/GnuplotInteractive.py (__all__): added plot2.
3941 3948
3942 3949 * IPython/Gnuplot2.py (Gnuplot.plot2): added new function for
3943 3950 plotting dictionaries, lists or tuples of 1d arrays.
3944 3951
3945 3952 * IPython/Magic.py (Magic.magic_hist): small clenaups and
3946 3953 optimizations.
3947 3954
3948 3955 * IPython/iplib.py:Remove old Changelog info for cleanup. This is
3949 3956 the information which was there from Janko's original IPP code:
3950 3957
3951 3958 03.05.99 20:53 porto.ifm.uni-kiel.de
3952 3959 --Started changelog.
3953 3960 --make clear do what it say it does
3954 3961 --added pretty output of lines from inputcache
3955 3962 --Made Logger a mixin class, simplifies handling of switches
3956 3963 --Added own completer class. .string<TAB> expands to last history
3957 3964 line which starts with string. The new expansion is also present
3958 3965 with Ctrl-r from the readline library. But this shows, who this
3959 3966 can be done for other cases.
3960 3967 --Added convention that all shell functions should accept a
3961 3968 parameter_string This opens the door for different behaviour for
3962 3969 each function. @cd is a good example of this.
3963 3970
3964 3971 04.05.99 12:12 porto.ifm.uni-kiel.de
3965 3972 --added logfile rotation
3966 3973 --added new mainloop method which freezes first the namespace
3967 3974
3968 3975 07.05.99 21:24 porto.ifm.uni-kiel.de
3969 3976 --added the docreader classes. Now there is a help system.
3970 3977 -This is only a first try. Currently it's not easy to put new
3971 3978 stuff in the indices. But this is the way to go. Info would be
3972 3979 better, but HTML is every where and not everybody has an info
3973 3980 system installed and it's not so easy to change html-docs to info.
3974 3981 --added global logfile option
3975 3982 --there is now a hook for object inspection method pinfo needs to
3976 3983 be provided for this. Can be reached by two '??'.
3977 3984
3978 3985 08.05.99 20:51 porto.ifm.uni-kiel.de
3979 3986 --added a README
3980 3987 --bug in rc file. Something has changed so functions in the rc
3981 3988 file need to reference the shell and not self. Not clear if it's a
3982 3989 bug or feature.
3983 3990 --changed rc file for new behavior
3984 3991
3985 3992 2004-07-15 Fernando Perez <fperez@colorado.edu>
3986 3993
3987 3994 * IPython/Logger.py (Logger.log): fixed recent bug where the input
3988 3995 cache was falling out of sync in bizarre manners when multi-line
3989 3996 input was present. Minor optimizations and cleanup.
3990 3997
3991 3998 (Logger): Remove old Changelog info for cleanup. This is the
3992 3999 information which was there from Janko's original code:
3993 4000
3994 4001 Changes to Logger: - made the default log filename a parameter
3995 4002
3996 4003 - put a check for lines beginning with !@? in log(). Needed
3997 4004 (even if the handlers properly log their lines) for mid-session
3998 4005 logging activation to work properly. Without this, lines logged
3999 4006 in mid session, which get read from the cache, would end up
4000 4007 'bare' (with !@? in the open) in the log. Now they are caught
4001 4008 and prepended with a #.
4002 4009
4003 4010 * IPython/iplib.py (InteractiveShell.init_readline): added check
4004 4011 in case MagicCompleter fails to be defined, so we don't crash.
4005 4012
4006 4013 2004-07-13 Fernando Perez <fperez@colorado.edu>
4007 4014
4008 4015 * IPython/Gnuplot2.py (Gnuplot.hardcopy): add automatic generation
4009 4016 of EPS if the requested filename ends in '.eps'.
4010 4017
4011 4018 2004-07-04 Fernando Perez <fperez@colorado.edu>
4012 4019
4013 4020 * IPython/iplib.py (InteractiveShell.handle_shell_escape): Fix
4014 4021 escaping of quotes when calling the shell.
4015 4022
4016 4023 2004-07-02 Fernando Perez <fperez@colorado.edu>
4017 4024
4018 4025 * IPython/Prompts.py (CachedOutput.update): Fix problem with
4019 4026 gettext not working because we were clobbering '_'. Fixes
4020 4027 http://www.scipy.net/roundup/ipython/issue6.
4021 4028
4022 4029 2004-07-01 Fernando Perez <fperez@colorado.edu>
4023 4030
4024 4031 * IPython/Magic.py (Magic.magic_cd): integrated bookmark handling
4025 4032 into @cd. Patch by Ville.
4026 4033
4027 4034 * IPython/iplib.py (InteractiveShell.post_config_initialization):
4028 4035 new function to store things after ipmaker runs. Patch by Ville.
4029 4036 Eventually this will go away once ipmaker is removed and the class
4030 4037 gets cleaned up, but for now it's ok. Key functionality here is
4031 4038 the addition of the persistent storage mechanism, a dict for
4032 4039 keeping data across sessions (for now just bookmarks, but more can
4033 4040 be implemented later).
4034 4041
4035 4042 * IPython/Magic.py (Magic.magic_bookmark): New bookmark system,
4036 4043 persistent across sections. Patch by Ville, I modified it
4037 4044 soemwhat to allow bookmarking arbitrary dirs other than CWD. Also
4038 4045 added a '-l' option to list all bookmarks.
4039 4046
4040 4047 * IPython/iplib.py (InteractiveShell.atexit_operations): new
4041 4048 center for cleanup. Registered with atexit.register(). I moved
4042 4049 here the old exit_cleanup(). After a patch by Ville.
4043 4050
4044 4051 * IPython/Magic.py (get_py_filename): added '~' to the accepted
4045 4052 characters in the hacked shlex_split for python 2.2.
4046 4053
4047 4054 * IPython/iplib.py (file_matches): more fixes to filenames with
4048 4055 whitespace in them. It's not perfect, but limitations in python's
4049 4056 readline make it impossible to go further.
4050 4057
4051 4058 2004-06-29 Fernando Perez <fperez@colorado.edu>
4052 4059
4053 4060 * IPython/iplib.py (file_matches): escape whitespace correctly in
4054 4061 filename completions. Bug reported by Ville.
4055 4062
4056 4063 2004-06-28 Fernando Perez <fperez@colorado.edu>
4057 4064
4058 4065 * IPython/ipmaker.py (__call__): Added per-profile histories. Now
4059 4066 the history file will be called 'history-PROFNAME' (or just
4060 4067 'history' if no profile is loaded). I was getting annoyed at
4061 4068 getting my Numerical work history clobbered by pysh sessions.
4062 4069
4063 4070 * IPython/iplib.py (InteractiveShell.__init__): Internal
4064 4071 getoutputerror() function so that we can honor the system_verbose
4065 4072 flag for _all_ system calls. I also added escaping of #
4066 4073 characters here to avoid confusing Itpl.
4067 4074
4068 4075 * IPython/Magic.py (shlex_split): removed call to shell in
4069 4076 parse_options and replaced it with shlex.split(). The annoying
4070 4077 part was that in Python 2.2, shlex.split() doesn't exist, so I had
4071 4078 to backport it from 2.3, with several frail hacks (the shlex
4072 4079 module is rather limited in 2.2). Thanks to a suggestion by Ville
4073 4080 Vainio <vivainio@kolumbus.fi>. For Python 2.3 there should be no
4074 4081 problem.
4075 4082
4076 4083 (Magic.magic_system_verbose): new toggle to print the actual
4077 4084 system calls made by ipython. Mainly for debugging purposes.
4078 4085
4079 4086 * IPython/GnuplotRuntime.py (gnu_out): fix bug for cygwin, which
4080 4087 doesn't support persistence. Reported (and fix suggested) by
4081 4088 Travis Caldwell <travis_caldwell2000@yahoo.com>.
4082 4089
4083 4090 2004-06-26 Fernando Perez <fperez@colorado.edu>
4084 4091
4085 4092 * IPython/Logger.py (Logger.log): fix to handle correctly empty
4086 4093 continue prompts.
4087 4094
4088 4095 * IPython/Extensions/InterpreterExec.py (pysh): moved the pysh()
4089 4096 function (basically a big docstring) and a few more things here to
4090 4097 speedup startup. pysh.py is now very lightweight. We want because
4091 4098 it gets execfile'd, while InterpreterExec gets imported, so
4092 4099 byte-compilation saves time.
4093 4100
4094 4101 2004-06-25 Fernando Perez <fperez@colorado.edu>
4095 4102
4096 4103 * IPython/Magic.py (Magic.magic_cd): Fixed to restore usage of 'cd
4097 4104 -NUM', which was recently broken.
4098 4105
4099 4106 * IPython/iplib.py (InteractiveShell.handle_shell_escape): allow !
4100 4107 in multi-line input (but not !!, which doesn't make sense there).
4101 4108
4102 4109 * IPython/UserConfig/ipythonrc: made autoindent on by default.
4103 4110 It's just too useful, and people can turn it off in the less
4104 4111 common cases where it's a problem.
4105 4112
4106 4113 2004-06-24 Fernando Perez <fperez@colorado.edu>
4107 4114
4108 4115 * IPython/iplib.py (InteractiveShell._prefilter): big change -
4109 4116 special syntaxes (like alias calling) is now allied in multi-line
4110 4117 input. This is still _very_ experimental, but it's necessary for
4111 4118 efficient shell usage combining python looping syntax with system
4112 4119 calls. For now it's restricted to aliases, I don't think it
4113 4120 really even makes sense to have this for magics.
4114 4121
4115 4122 2004-06-23 Fernando Perez <fperez@colorado.edu>
4116 4123
4117 4124 * IPython/Extensions/InterpreterExec.py (prefilter_shell): Added
4118 4125 $var=cmd <=> @sc var=cmd and $$var=cmd <=> @sc -l var=cmd.
4119 4126
4120 4127 * IPython/Magic.py (Magic.magic_rehashx): modified to handle
4121 4128 extensions under Windows (after code sent by Gary Bishop). The
4122 4129 extensions considered 'executable' are stored in IPython's rc
4123 4130 structure as win_exec_ext.
4124 4131
4125 4132 * IPython/genutils.py (shell): new function, like system() but
4126 4133 without return value. Very useful for interactive shell work.
4127 4134
4128 4135 * IPython/Magic.py (Magic.magic_unalias): New @unalias function to
4129 4136 delete aliases.
4130 4137
4131 4138 * IPython/iplib.py (InteractiveShell.alias_table_update): make
4132 4139 sure that the alias table doesn't contain python keywords.
4133 4140
4134 4141 2004-06-21 Fernando Perez <fperez@colorado.edu>
4135 4142
4136 4143 * IPython/Magic.py (Magic.magic_rehash): Fix crash when
4137 4144 non-existent items are found in $PATH. Reported by Thorsten.
4138 4145
4139 4146 2004-06-20 Fernando Perez <fperez@colorado.edu>
4140 4147
4141 4148 * IPython/iplib.py (complete): modified the completer so that the
4142 4149 order of priorities can be easily changed at runtime.
4143 4150
4144 4151 * IPython/Extensions/InterpreterExec.py (prefilter_shell):
4145 4152 Modified to auto-execute all lines beginning with '~', '/' or '.'.
4146 4153
4147 4154 * IPython/Magic.py (Magic.magic_sx): modified @sc and @sx to
4148 4155 expand Python variables prepended with $ in all system calls. The
4149 4156 same was done to InteractiveShell.handle_shell_escape. Now all
4150 4157 system access mechanisms (!, !!, @sc, @sx and aliases) allow the
4151 4158 expansion of python variables and expressions according to the
4152 4159 syntax of PEP-215 - http://www.python.org/peps/pep-0215.html.
4153 4160
4154 4161 Though PEP-215 has been rejected, a similar (but simpler) one
4155 4162 seems like it will go into Python 2.4, PEP-292 -
4156 4163 http://www.python.org/peps/pep-0292.html.
4157 4164
4158 4165 I'll keep the full syntax of PEP-215, since IPython has since the
4159 4166 start used Ka-Ping Yee's reference implementation discussed there
4160 4167 (Itpl), and I actually like the powerful semantics it offers.
4161 4168
4162 4169 In order to access normal shell variables, the $ has to be escaped
4163 4170 via an extra $. For example:
4164 4171
4165 4172 In [7]: PATH='a python variable'
4166 4173
4167 4174 In [8]: !echo $PATH
4168 4175 a python variable
4169 4176
4170 4177 In [9]: !echo $$PATH
4171 4178 /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:...
4172 4179
4173 4180 (Magic.parse_options): escape $ so the shell doesn't evaluate
4174 4181 things prematurely.
4175 4182
4176 4183 * IPython/iplib.py (InteractiveShell.call_alias): added the
4177 4184 ability for aliases to expand python variables via $.
4178 4185
4179 4186 * IPython/Magic.py (Magic.magic_rehash): based on the new alias
4180 4187 system, now there's a @rehash/@rehashx pair of magics. These work
4181 4188 like the csh rehash command, and can be invoked at any time. They
4182 4189 build a table of aliases to everything in the user's $PATH
4183 4190 (@rehash uses everything, @rehashx is slower but only adds
4184 4191 executable files). With this, the pysh.py-based shell profile can
4185 4192 now simply call rehash upon startup, and full access to all
4186 4193 programs in the user's path is obtained.
4187 4194
4188 4195 * IPython/iplib.py (InteractiveShell.call_alias): The new alias
4189 4196 functionality is now fully in place. I removed the old dynamic
4190 4197 code generation based approach, in favor of a much lighter one
4191 4198 based on a simple dict. The advantage is that this allows me to
4192 4199 now have thousands of aliases with negligible cost (unthinkable
4193 4200 with the old system).
4194 4201
4195 4202 2004-06-19 Fernando Perez <fperez@colorado.edu>
4196 4203
4197 4204 * IPython/iplib.py (__init__): extended MagicCompleter class to
4198 4205 also complete (last in priority) on user aliases.
4199 4206
4200 4207 * IPython/Itpl.py (Itpl.__str__): fixed order of globals/locals in
4201 4208 call to eval.
4202 4209 (ItplNS.__init__): Added a new class which functions like Itpl,
4203 4210 but allows configuring the namespace for the evaluation to occur
4204 4211 in.
4205 4212
4206 4213 2004-06-18 Fernando Perez <fperez@colorado.edu>
4207 4214
4208 4215 * IPython/iplib.py (InteractiveShell.runcode): modify to print a
4209 4216 better message when 'exit' or 'quit' are typed (a common newbie
4210 4217 confusion).
4211 4218
4212 4219 * IPython/Magic.py (Magic.magic_colors): Added the runtime color
4213 4220 check for Windows users.
4214 4221
4215 4222 * IPython/iplib.py (InteractiveShell.user_setup): removed
4216 4223 disabling of colors for Windows. I'll test at runtime and issue a
4217 4224 warning if Gary's readline isn't found, as to nudge users to
4218 4225 download it.
4219 4226
4220 4227 2004-06-16 Fernando Perez <fperez@colorado.edu>
4221 4228
4222 4229 * IPython/genutils.py (Stream.__init__): changed to print errors
4223 4230 to sys.stderr. I had a circular dependency here. Now it's
4224 4231 possible to run ipython as IDLE's shell (consider this pre-alpha,
4225 4232 since true stdout things end up in the starting terminal instead
4226 4233 of IDLE's out).
4227 4234
4228 4235 * IPython/Prompts.py (Prompt2.set_colors): prevent crashes for
4229 4236 users who haven't # updated their prompt_in2 definitions. Remove
4230 4237 eventually.
4231 4238 (multiple_replace): added credit to original ASPN recipe.
4232 4239
4233 4240 2004-06-15 Fernando Perez <fperez@colorado.edu>
4234 4241
4235 4242 * IPython/iplib.py (InteractiveShell.__init__): add 'cp' to the
4236 4243 list of auto-defined aliases.
4237 4244
4238 4245 2004-06-13 Fernando Perez <fperez@colorado.edu>
4239 4246
4240 4247 * setup.py (scriptfiles): Don't trigger win_post_install unless an
4241 4248 install was really requested (so setup.py can be used for other
4242 4249 things under Windows).
4243 4250
4244 4251 2004-06-10 Fernando Perez <fperez@colorado.edu>
4245 4252
4246 4253 * IPython/Logger.py (Logger.create_log): Manually remove any old
4247 4254 backup, since os.remove may fail under Windows. Fixes bug
4248 4255 reported by Thorsten.
4249 4256
4250 4257 2004-06-09 Fernando Perez <fperez@colorado.edu>
4251 4258
4252 4259 * examples/example-embed.py: fixed all references to %n (replaced
4253 4260 with \\# for ps1/out prompts and with \\D for ps2 prompts). Done
4254 4261 for all examples and the manual as well.
4255 4262
4256 4263 2004-06-08 Fernando Perez <fperez@colorado.edu>
4257 4264
4258 4265 * IPython/Prompts.py (Prompt2.set_p_str): fixed all prompt
4259 4266 alignment and color management. All 3 prompt subsystems now
4260 4267 inherit from BasePrompt.
4261 4268
4262 4269 * tools/release: updates for windows installer build and tag rpms
4263 4270 with python version (since paths are fixed).
4264 4271
4265 4272 * IPython/UserConfig/ipythonrc: modified to use \# instead of %n,
4266 4273 which will become eventually obsolete. Also fixed the default
4267 4274 prompt_in2 to use \D, so at least new users start with the correct
4268 4275 defaults.
4269 4276 WARNING: Users with existing ipythonrc files will need to apply
4270 4277 this fix manually!
4271 4278
4272 4279 * setup.py: make windows installer (.exe). This is finally the
4273 4280 integration of an old patch by Cory Dodt <dodt-AT-fcoe.k12.ca.us>,
4274 4281 which I hadn't included because it required Python 2.3 (or recent
4275 4282 distutils).
4276 4283
4277 4284 * IPython/usage.py (__doc__): update docs (and manpage) to reflect
4278 4285 usage of new '\D' escape.
4279 4286
4280 4287 * IPython/Prompts.py (ROOT_SYMBOL): Small fix for Windows (which
4281 4288 lacks os.getuid())
4282 4289 (CachedOutput.set_colors): Added the ability to turn coloring
4283 4290 on/off with @colors even for manually defined prompt colors. It
4284 4291 uses a nasty global, but it works safely and via the generic color
4285 4292 handling mechanism.
4286 4293 (Prompt2.__init__): Introduced new escape '\D' for continuation
4287 4294 prompts. It represents the counter ('\#') as dots.
4288 4295 *** NOTE *** THIS IS A BACKWARDS-INCOMPATIBLE CHANGE. Users will
4289 4296 need to update their ipythonrc files and replace '%n' with '\D' in
4290 4297 their prompt_in2 settings everywhere. Sorry, but there's
4291 4298 otherwise no clean way to get all prompts to properly align. The
4292 4299 ipythonrc shipped with IPython has been updated.
4293 4300
4294 4301 2004-06-07 Fernando Perez <fperez@colorado.edu>
4295 4302
4296 4303 * setup.py (isfile): Pass local_icons option to latex2html, so the
4297 4304 resulting HTML file is self-contained. Thanks to
4298 4305 dryice-AT-liu.com.cn for the tip.
4299 4306
4300 4307 * pysh.py: I created a new profile 'shell', which implements a
4301 4308 _rudimentary_ IPython-based shell. This is in NO WAY a realy
4302 4309 system shell, nor will it become one anytime soon. It's mainly
4303 4310 meant to illustrate the use of the new flexible bash-like prompts.
4304 4311 I guess it could be used by hardy souls for true shell management,
4305 4312 but it's no tcsh/bash... pysh.py is loaded by the 'shell'
4306 4313 profile. This uses the InterpreterExec extension provided by
4307 4314 W.J. van der Laan <gnufnork-AT-hetdigitalegat.nl>
4308 4315
4309 4316 * IPython/Prompts.py (PromptOut.__str__): now it will correctly
4310 4317 auto-align itself with the length of the previous input prompt
4311 4318 (taking into account the invisible color escapes).
4312 4319 (CachedOutput.__init__): Large restructuring of this class. Now
4313 4320 all three prompts (primary1, primary2, output) are proper objects,
4314 4321 managed by the 'parent' CachedOutput class. The code is still a
4315 4322 bit hackish (all prompts share state via a pointer to the cache),
4316 4323 but it's overall far cleaner than before.
4317 4324
4318 4325 * IPython/genutils.py (getoutputerror): modified to add verbose,
4319 4326 debug and header options. This makes the interface of all getout*
4320 4327 functions uniform.
4321 4328 (SystemExec.getoutputerror): added getoutputerror to SystemExec.
4322 4329
4323 4330 * IPython/Magic.py (Magic.default_option): added a function to
4324 4331 allow registering default options for any magic command. This
4325 4332 makes it easy to have profiles which customize the magics globally
4326 4333 for a certain use. The values set through this function are
4327 4334 picked up by the parse_options() method, which all magics should
4328 4335 use to parse their options.
4329 4336
4330 4337 * IPython/genutils.py (warn): modified the warnings framework to
4331 4338 use the Term I/O class. I'm trying to slowly unify all of
4332 4339 IPython's I/O operations to pass through Term.
4333 4340
4334 4341 * IPython/Prompts.py (Prompt2._str_other): Added functionality in
4335 4342 the secondary prompt to correctly match the length of the primary
4336 4343 one for any prompt. Now multi-line code will properly line up
4337 4344 even for path dependent prompts, such as the new ones available
4338 4345 via the prompt_specials.
4339 4346
4340 4347 2004-06-06 Fernando Perez <fperez@colorado.edu>
4341 4348
4342 4349 * IPython/Prompts.py (prompt_specials): Added the ability to have
4343 4350 bash-like special sequences in the prompts, which get
4344 4351 automatically expanded. Things like hostname, current working
4345 4352 directory and username are implemented already, but it's easy to
4346 4353 add more in the future. Thanks to a patch by W.J. van der Laan
4347 4354 <gnufnork-AT-hetdigitalegat.nl>
4348 4355 (prompt_specials): Added color support for prompt strings, so
4349 4356 users can define arbitrary color setups for their prompts.
4350 4357
4351 4358 2004-06-05 Fernando Perez <fperez@colorado.edu>
4352 4359
4353 4360 * IPython/genutils.py (Term.reopen_all): Added Windows-specific
4354 4361 code to load Gary Bishop's readline and configure it
4355 4362 automatically. Thanks to Gary for help on this.
4356 4363
4357 4364 2004-06-01 Fernando Perez <fperez@colorado.edu>
4358 4365
4359 4366 * IPython/Logger.py (Logger.create_log): fix bug for logging
4360 4367 with no filename (previous fix was incomplete).
4361 4368
4362 4369 2004-05-25 Fernando Perez <fperez@colorado.edu>
4363 4370
4364 4371 * IPython/Magic.py (Magic.parse_options): fix bug where naked
4365 4372 parens would get passed to the shell.
4366 4373
4367 4374 2004-05-20 Fernando Perez <fperez@colorado.edu>
4368 4375
4369 4376 * IPython/Magic.py (Magic.magic_prun): changed default profile
4370 4377 sort order to 'time' (the more common profiling need).
4371 4378
4372 4379 * IPython/OInspect.py (Inspector.pinfo): flush the inspect cache
4373 4380 so that source code shown is guaranteed in sync with the file on
4374 4381 disk (also changed in psource). Similar fix to the one for
4375 4382 ultraTB on 2004-05-06. Thanks to a bug report by Yann Le Du
4376 4383 <yann.ledu-AT-noos.fr>.
4377 4384
4378 4385 * IPython/Magic.py (Magic.parse_options): Fixed bug where commands
4379 4386 with a single option would not be correctly parsed. Closes
4380 4387 http://www.scipy.net/roundup/ipython/issue14. This bug had been
4381 4388 introduced in 0.6.0 (on 2004-05-06).
4382 4389
4383 4390 2004-05-13 *** Released version 0.6.0
4384 4391
4385 4392 2004-05-13 Fernando Perez <fperez@colorado.edu>
4386 4393
4387 4394 * debian/: Added debian/ directory to CVS, so that debian support
4388 4395 is publicly accessible. The debian package is maintained by Jack
4389 4396 Moffit <jack-AT-xiph.org>.
4390 4397
4391 4398 * Documentation: included the notes about an ipython-based system
4392 4399 shell (the hypothetical 'pysh') into the new_design.pdf document,
4393 4400 so that these ideas get distributed to users along with the
4394 4401 official documentation.
4395 4402
4396 4403 2004-05-10 Fernando Perez <fperez@colorado.edu>
4397 4404
4398 4405 * IPython/Logger.py (Logger.create_log): fix recently introduced
4399 4406 bug (misindented line) where logstart would fail when not given an
4400 4407 explicit filename.
4401 4408
4402 4409 2004-05-09 Fernando Perez <fperez@colorado.edu>
4403 4410
4404 4411 * IPython/Magic.py (Magic.parse_options): skip system call when
4405 4412 there are no options to look for. Faster, cleaner for the common
4406 4413 case.
4407 4414
4408 4415 * Documentation: many updates to the manual: describing Windows
4409 4416 support better, Gnuplot updates, credits, misc small stuff. Also
4410 4417 updated the new_design doc a bit.
4411 4418
4412 4419 2004-05-06 *** Released version 0.6.0.rc1
4413 4420
4414 4421 2004-05-06 Fernando Perez <fperez@colorado.edu>
4415 4422
4416 4423 * IPython/ultraTB.py (ListTB.text): modified a ton of string +=
4417 4424 operations to use the vastly more efficient list/''.join() method.
4418 4425 (FormattedTB.text): Fix
4419 4426 http://www.scipy.net/roundup/ipython/issue12 - exception source
4420 4427 extract not updated after reload. Thanks to Mike Salib
4421 4428 <msalib-AT-mit.edu> for pinning the source of the problem.
4422 4429 Fortunately, the solution works inside ipython and doesn't require
4423 4430 any changes to python proper.
4424 4431
4425 4432 * IPython/Magic.py (Magic.parse_options): Improved to process the
4426 4433 argument list as a true shell would (by actually using the
4427 4434 underlying system shell). This way, all @magics automatically get
4428 4435 shell expansion for variables. Thanks to a comment by Alex
4429 4436 Schmolck.
4430 4437
4431 4438 2004-04-04 Fernando Perez <fperez@colorado.edu>
4432 4439
4433 4440 * IPython/iplib.py (InteractiveShell.interact): Added a special
4434 4441 trap for a debugger quit exception, which is basically impossible
4435 4442 to handle by normal mechanisms, given what pdb does to the stack.
4436 4443 This fixes a crash reported by <fgibbons-AT-llama.med.harvard.edu>.
4437 4444
4438 4445 2004-04-03 Fernando Perez <fperez@colorado.edu>
4439 4446
4440 4447 * IPython/genutils.py (Term): Standardized the names of the Term
4441 4448 class streams to cin/cout/cerr, following C++ naming conventions
4442 4449 (I can't use in/out/err because 'in' is not a valid attribute
4443 4450 name).
4444 4451
4445 4452 * IPython/iplib.py (InteractiveShell.interact): don't increment
4446 4453 the prompt if there's no user input. By Daniel 'Dang' Griffith
4447 4454 <pythondev-dang-AT-lazytwinacres.net>, after a suggestion from
4448 4455 Francois Pinard.
4449 4456
4450 4457 2004-04-02 Fernando Perez <fperez@colorado.edu>
4451 4458
4452 4459 * IPython/genutils.py (Stream.__init__): Modified to survive at
4453 4460 least importing in contexts where stdin/out/err aren't true file
4454 4461 objects, such as PyCrust (they lack fileno() and mode). However,
4455 4462 the recovery facilities which rely on these things existing will
4456 4463 not work.
4457 4464
4458 4465 2004-04-01 Fernando Perez <fperez@colorado.edu>
4459 4466
4460 4467 * IPython/Magic.py (Magic.magic_sx): modified (as well as @sc) to
4461 4468 use the new getoutputerror() function, so it properly
4462 4469 distinguishes stdout/err.
4463 4470
4464 4471 * IPython/genutils.py (getoutputerror): added a function to
4465 4472 capture separately the standard output and error of a command.
4466 4473 After a comment from dang on the mailing lists. This code is
4467 4474 basically a modified version of commands.getstatusoutput(), from
4468 4475 the standard library.
4469 4476
4470 4477 * IPython/iplib.py (InteractiveShell.handle_shell_escape): added
4471 4478 '!!' as a special syntax (shorthand) to access @sx.
4472 4479
4473 4480 * IPython/Magic.py (Magic.magic_sx): new magic, to execute a shell
4474 4481 command and return its output as a list split on '\n'.
4475 4482
4476 4483 2004-03-31 Fernando Perez <fperez@colorado.edu>
4477 4484
4478 4485 * IPython/FakeModule.py (FakeModule.__init__): added __nonzero__
4479 4486 method to dictionaries used as FakeModule instances if they lack
4480 4487 it. At least pydoc in python2.3 breaks for runtime-defined
4481 4488 functions without this hack. At some point I need to _really_
4482 4489 understand what FakeModule is doing, because it's a gross hack.
4483 4490 But it solves Arnd's problem for now...
4484 4491
4485 4492 2004-02-27 Fernando Perez <fperez@colorado.edu>
4486 4493
4487 4494 * IPython/Logger.py (Logger.create_log): Fix bug where 'rotate'
4488 4495 mode would behave erratically. Also increased the number of
4489 4496 possible logs in rotate mod to 999. Thanks to Rod Holland
4490 4497 <rhh@StructureLABS.com> for the report and fixes.
4491 4498
4492 4499 2004-02-26 Fernando Perez <fperez@colorado.edu>
4493 4500
4494 4501 * IPython/genutils.py (page): Check that the curses module really
4495 4502 has the initscr attribute before trying to use it. For some
4496 4503 reason, the Solaris curses module is missing this. I think this
4497 4504 should be considered a Solaris python bug, but I'm not sure.
4498 4505
4499 4506 2004-01-17 Fernando Perez <fperez@colorado.edu>
4500 4507
4501 4508 * IPython/genutils.py (Stream.__init__): Changes to try to make
4502 4509 ipython robust against stdin/out/err being closed by the user.
4503 4510 This is 'user error' (and blocks a normal python session, at least
4504 4511 the stdout case). However, Ipython should be able to survive such
4505 4512 instances of abuse as gracefully as possible. To simplify the
4506 4513 coding and maintain compatibility with Gary Bishop's Term
4507 4514 contributions, I've made use of classmethods for this. I think
4508 4515 this introduces a dependency on python 2.2.
4509 4516
4510 4517 2004-01-13 Fernando Perez <fperez@colorado.edu>
4511 4518
4512 4519 * IPython/numutils.py (exp_safe): simplified the code a bit and
4513 4520 removed the need for importing the kinds module altogether.
4514 4521
4515 4522 2004-01-06 Fernando Perez <fperez@colorado.edu>
4516 4523
4517 4524 * IPython/Magic.py (Magic.magic_sc): Made the shell capture system
4518 4525 a magic function instead, after some community feedback. No
4519 4526 special syntax will exist for it, but its name is deliberately
4520 4527 very short.
4521 4528
4522 4529 2003-12-20 Fernando Perez <fperez@colorado.edu>
4523 4530
4524 4531 * IPython/iplib.py (InteractiveShell.handle_shell_assign): Added
4525 4532 new functionality, to automagically assign the result of a shell
4526 4533 command to a variable. I'll solicit some community feedback on
4527 4534 this before making it permanent.
4528 4535
4529 4536 * IPython/OInspect.py (Inspector.pinfo): Fix crash when info was
4530 4537 requested about callables for which inspect couldn't obtain a
4531 4538 proper argspec. Thanks to a crash report sent by Etienne
4532 4539 Posthumus <etienne-AT-apple01.cs.vu.nl>.
4533 4540
4534 4541 2003-12-09 Fernando Perez <fperez@colorado.edu>
4535 4542
4536 4543 * IPython/genutils.py (page): patch for the pager to work across
4537 4544 various versions of Windows. By Gary Bishop.
4538 4545
4539 4546 2003-12-04 Fernando Perez <fperez@colorado.edu>
4540 4547
4541 4548 * IPython/Gnuplot2.py (PlotItems): Fixes for working with
4542 4549 Gnuplot.py version 1.7, whose internal names changed quite a bit.
4543 4550 While I tested this and it looks ok, there may still be corner
4544 4551 cases I've missed.
4545 4552
4546 4553 2003-12-01 Fernando Perez <fperez@colorado.edu>
4547 4554
4548 4555 * IPython/iplib.py (InteractiveShell._prefilter): Fixed a bug
4549 4556 where a line like 'p,q=1,2' would fail because the automagic
4550 4557 system would be triggered for @p.
4551 4558
4552 4559 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): Tab-related
4553 4560 cleanups, code unmodified.
4554 4561
4555 4562 * IPython/genutils.py (Term): added a class for IPython to handle
4556 4563 output. In most cases it will just be a proxy for stdout/err, but
4557 4564 having this allows modifications to be made for some platforms,
4558 4565 such as handling color escapes under Windows. All of this code
4559 4566 was contributed by Gary Bishop, with minor modifications by me.
4560 4567 The actual changes affect many files.
4561 4568
4562 4569 2003-11-30 Fernando Perez <fperez@colorado.edu>
4563 4570
4564 4571 * IPython/iplib.py (file_matches): new completion code, courtesy
4565 4572 of Jeff Collins. This enables filename completion again under
4566 4573 python 2.3, which disabled it at the C level.
4567 4574
4568 4575 2003-11-11 Fernando Perez <fperez@colorado.edu>
4569 4576
4570 4577 * IPython/numutils.py (amap): Added amap() fn. Simple shorthand
4571 4578 for Numeric.array(map(...)), but often convenient.
4572 4579
4573 4580 2003-11-05 Fernando Perez <fperez@colorado.edu>
4574 4581
4575 4582 * IPython/numutils.py (frange): Changed a call from int() to
4576 4583 int(round()) to prevent a problem reported with arange() in the
4577 4584 numpy list.
4578 4585
4579 4586 2003-10-06 Fernando Perez <fperez@colorado.edu>
4580 4587
4581 4588 * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): changed to
4582 4589 prevent crashes if sys lacks an argv attribute (it happens with
4583 4590 embedded interpreters which build a bare-bones sys module).
4584 4591 Thanks to a report/bugfix by Adam Hupp <hupp-AT-cs.wisc.edu>.
4585 4592
4586 4593 2003-09-24 Fernando Perez <fperez@colorado.edu>
4587 4594
4588 4595 * IPython/Magic.py (Magic._ofind): blanket except around getattr()
4589 4596 to protect against poorly written user objects where __getattr__
4590 4597 raises exceptions other than AttributeError. Thanks to a bug
4591 4598 report by Oliver Sander <osander-AT-gmx.de>.
4592 4599
4593 4600 * IPython/FakeModule.py (FakeModule.__repr__): this method was
4594 4601 missing. Thanks to bug report by Ralf Schmitt <ralf-AT-brainbot.com>.
4595 4602
4596 4603 2003-09-09 Fernando Perez <fperez@colorado.edu>
4597 4604
4598 4605 * IPython/iplib.py (InteractiveShell._prefilter): fix bug where
4599 4606 unpacking a list whith a callable as first element would
4600 4607 mistakenly trigger autocalling. Thanks to a bug report by Jeffery
4601 4608 Collins.
4602 4609
4603 4610 2003-08-25 *** Released version 0.5.0
4604 4611
4605 4612 2003-08-22 Fernando Perez <fperez@colorado.edu>
4606 4613
4607 4614 * IPython/ultraTB.py (VerboseTB.linereader): Improved handling of
4608 4615 improperly defined user exceptions. Thanks to feedback from Mark
4609 4616 Russell <mrussell-AT-verio.net>.
4610 4617
4611 4618 2003-08-20 Fernando Perez <fperez@colorado.edu>
4612 4619
4613 4620 * IPython/OInspect.py (Inspector.pinfo): changed String Form
4614 4621 printing so that it would print multi-line string forms starting
4615 4622 with a new line. This way the formatting is better respected for
4616 4623 objects which work hard to make nice string forms.
4617 4624
4618 4625 * IPython/iplib.py (InteractiveShell.handle_auto): Fix bug where
4619 4626 autocall would overtake data access for objects with both
4620 4627 __getitem__ and __call__.
4621 4628
4622 4629 2003-08-19 *** Released version 0.5.0-rc1
4623 4630
4624 4631 2003-08-19 Fernando Perez <fperez@colorado.edu>
4625 4632
4626 4633 * IPython/deep_reload.py (load_tail): single tiny change here
4627 4634 seems to fix the long-standing bug of dreload() failing to work
4628 4635 for dotted names. But this module is pretty tricky, so I may have
4629 4636 missed some subtlety. Needs more testing!.
4630 4637
4631 4638 * IPython/ultraTB.py (VerboseTB.linereader): harden against user
4632 4639 exceptions which have badly implemented __str__ methods.
4633 4640 (VerboseTB.text): harden against inspect.getinnerframes crashing,
4634 4641 which I've been getting reports about from Python 2.3 users. I
4635 4642 wish I had a simple test case to reproduce the problem, so I could
4636 4643 either write a cleaner workaround or file a bug report if
4637 4644 necessary.
4638 4645
4639 4646 * IPython/Magic.py (Magic.magic_edit): fixed bug where after
4640 4647 making a class 'foo', file 'foo.py' couldn't be edited. Thanks to
4641 4648 a bug report by Tjabo Kloppenburg.
4642 4649
4643 4650 * IPython/ultraTB.py (VerboseTB.debugger): hardened against pdb
4644 4651 crashes. Wrapped the pdb call in a blanket try/except, since pdb
4645 4652 seems rather unstable. Thanks to a bug report by Tjabo
4646 4653 Kloppenburg <tjabo.kloppenburg-AT-unix-ag.uni-siegen.de>.
4647 4654
4648 4655 * IPython/Release.py (version): release 0.5.0-rc1. I want to put
4649 4656 this out soon because of the critical fixes in the inner loop for
4650 4657 generators.
4651 4658
4652 4659 * IPython/Magic.py (Magic.getargspec): removed. This (and
4653 4660 _get_def) have been obsoleted by OInspect for a long time, I
4654 4661 hadn't noticed that they were dead code.
4655 4662 (Magic._ofind): restored _ofind functionality for a few literals
4656 4663 (those in ["''",'""','[]','{}','()']). But it won't work anymore
4657 4664 for things like "hello".capitalize?, since that would require a
4658 4665 potentially dangerous eval() again.
4659 4666
4660 4667 * IPython/iplib.py (InteractiveShell._prefilter): reorganized the
4661 4668 logic a bit more to clean up the escapes handling and minimize the
4662 4669 use of _ofind to only necessary cases. The interactive 'feel' of
4663 4670 IPython should have improved quite a bit with the changes in
4664 4671 _prefilter and _ofind (besides being far safer than before).
4665 4672
4666 4673 * IPython/Magic.py (Magic.magic_edit): Fixed old bug (but rather
4667 4674 obscure, never reported). Edit would fail to find the object to
4668 4675 edit under some circumstances.
4669 4676 (Magic._ofind): CRITICAL FIX. Finally removed the eval() calls
4670 4677 which were causing double-calling of generators. Those eval calls
4671 4678 were _very_ dangerous, since code with side effects could be
4672 4679 triggered. As they say, 'eval is evil'... These were the
4673 4680 nastiest evals in IPython. Besides, _ofind is now far simpler,
4674 4681 and it should also be quite a bit faster. Its use of inspect is
4675 4682 also safer, so perhaps some of the inspect-related crashes I've
4676 4683 seen lately with Python 2.3 might be taken care of. That will
4677 4684 need more testing.
4678 4685
4679 4686 2003-08-17 Fernando Perez <fperez@colorado.edu>
4680 4687
4681 4688 * IPython/iplib.py (InteractiveShell._prefilter): significant
4682 4689 simplifications to the logic for handling user escapes. Faster
4683 4690 and simpler code.
4684 4691
4685 4692 2003-08-14 Fernando Perez <fperez@colorado.edu>
4686 4693
4687 4694 * IPython/numutils.py (sum_flat): rewrote to be non-recursive.
4688 4695 Now it requires O(N) storage (N=size(a)) for non-contiguous input,
4689 4696 but it should be quite a bit faster. And the recursive version
4690 4697 generated O(log N) intermediate storage for all rank>1 arrays,
4691 4698 even if they were contiguous.
4692 4699 (l1norm): Added this function.
4693 4700 (norm): Added this function for arbitrary norms (including
4694 4701 l-infinity). l1 and l2 are still special cases for convenience
4695 4702 and speed.
4696 4703
4697 4704 2003-08-03 Fernando Perez <fperez@colorado.edu>
4698 4705
4699 4706 * IPython/Magic.py (Magic.magic_edit): Removed all remaining string
4700 4707 exceptions, which now raise PendingDeprecationWarnings in Python
4701 4708 2.3. There were some in Magic and some in Gnuplot2.
4702 4709
4703 4710 2003-06-30 Fernando Perez <fperez@colorado.edu>
4704 4711
4705 4712 * IPython/genutils.py (page): modified to call curses only for
4706 4713 terminals where TERM=='xterm'. After problems under many other
4707 4714 terminals were reported by Keith Beattie <KSBeattie-AT-lbl.gov>.
4708 4715
4709 4716 * IPython/iplib.py (complete): removed spurious 'print "IE"' which
4710 4717 would be triggered when readline was absent. This was just an old
4711 4718 debugging statement I'd forgotten to take out.
4712 4719
4713 4720 2003-06-20 Fernando Perez <fperez@colorado.edu>
4714 4721
4715 4722 * IPython/genutils.py (clock): modified to return only user time
4716 4723 (not counting system time), after a discussion on scipy. While
4717 4724 system time may be a useful quantity occasionally, it may much
4718 4725 more easily be skewed by occasional swapping or other similar
4719 4726 activity.
4720 4727
4721 4728 2003-06-05 Fernando Perez <fperez@colorado.edu>
4722 4729
4723 4730 * IPython/numutils.py (identity): new function, for building
4724 4731 arbitrary rank Kronecker deltas (mostly backwards compatible with
4725 4732 Numeric.identity)
4726 4733
4727 4734 2003-06-03 Fernando Perez <fperez@colorado.edu>
4728 4735
4729 4736 * IPython/iplib.py (InteractiveShell.handle_magic): protect
4730 4737 arguments passed to magics with spaces, to allow trailing '\' to
4731 4738 work normally (mainly for Windows users).
4732 4739
4733 4740 2003-05-29 Fernando Perez <fperez@colorado.edu>
4734 4741
4735 4742 * IPython/ipmaker.py (make_IPython): Load site._Helper() as help
4736 4743 instead of pydoc.help. This fixes a bizarre behavior where
4737 4744 printing '%s' % locals() would trigger the help system. Now
4738 4745 ipython behaves like normal python does.
4739 4746
4740 4747 Note that if one does 'from pydoc import help', the bizarre
4741 4748 behavior returns, but this will also happen in normal python, so
4742 4749 it's not an ipython bug anymore (it has to do with how pydoc.help
4743 4750 is implemented).
4744 4751
4745 4752 2003-05-22 Fernando Perez <fperez@colorado.edu>
4746 4753
4747 4754 * IPython/FlexCompleter.py (Completer.attr_matches): fixed to
4748 4755 return [] instead of None when nothing matches, also match to end
4749 4756 of line. Patch by Gary Bishop.
4750 4757
4751 4758 * IPython/ipmaker.py (make_IPython): Added same sys.excepthook
4752 4759 protection as before, for files passed on the command line. This
4753 4760 prevents the CrashHandler from kicking in if user files call into
4754 4761 sys.excepthook (such as PyQt and WxWindows have a nasty habit of
4755 4762 doing). After a report by Kasper Souren <Kasper.Souren-AT-ircam.fr>
4756 4763
4757 4764 2003-05-20 *** Released version 0.4.0
4758 4765
4759 4766 2003-05-20 Fernando Perez <fperez@colorado.edu>
4760 4767
4761 4768 * setup.py: added support for manpages. It's a bit hackish b/c of
4762 4769 a bug in the way the bdist_rpm distutils target handles gzipped
4763 4770 manpages, but it works. After a patch by Jack.
4764 4771
4765 4772 2003-05-19 Fernando Perez <fperez@colorado.edu>
4766 4773
4767 4774 * IPython/numutils.py: added a mockup of the kinds module, since
4768 4775 it was recently removed from Numeric. This way, numutils will
4769 4776 work for all users even if they are missing kinds.
4770 4777
4771 4778 * IPython/Magic.py (Magic._ofind): Harden against an inspect
4772 4779 failure, which can occur with SWIG-wrapped extensions. After a
4773 4780 crash report from Prabhu.
4774 4781
4775 4782 2003-05-16 Fernando Perez <fperez@colorado.edu>
4776 4783
4777 4784 * IPython/iplib.py (InteractiveShell.excepthook): New method to
4778 4785 protect ipython from user code which may call directly
4779 4786 sys.excepthook (this looks like an ipython crash to the user, even
4780 4787 when it isn't). After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
4781 4788 This is especially important to help users of WxWindows, but may
4782 4789 also be useful in other cases.
4783 4790
4784 4791 * IPython/ultraTB.py (AutoFormattedTB.__call__): Changed to allow
4785 4792 an optional tb_offset to be specified, and to preserve exception
4786 4793 info if given. After a patch by Gary Bishop <gb-AT-cs.unc.edu>.
4787 4794
4788 4795 * ipython.1 (Default): Thanks to Jack's work, we now have manpages!
4789 4796
4790 4797 2003-05-15 Fernando Perez <fperez@colorado.edu>
4791 4798
4792 4799 * IPython/iplib.py (InteractiveShell.user_setup): Fix crash when
4793 4800 installing for a new user under Windows.
4794 4801
4795 4802 2003-05-12 Fernando Perez <fperez@colorado.edu>
4796 4803
4797 4804 * IPython/iplib.py (InteractiveShell.handle_emacs): New line
4798 4805 handler for Emacs comint-based lines. Currently it doesn't do
4799 4806 much (but importantly, it doesn't update the history cache). In
4800 4807 the future it may be expanded if Alex needs more functionality
4801 4808 there.
4802 4809
4803 4810 * IPython/CrashHandler.py (CrashHandler.__call__): Added platform
4804 4811 info to crash reports.
4805 4812
4806 4813 * IPython/iplib.py (InteractiveShell.mainloop): Added -c option,
4807 4814 just like Python's -c. Also fixed crash with invalid -color
4808 4815 option value at startup. Thanks to Will French
4809 4816 <wfrench-AT-bestweb.net> for the bug report.
4810 4817
4811 4818 2003-05-09 Fernando Perez <fperez@colorado.edu>
4812 4819
4813 4820 * IPython/genutils.py (EvalDict.__getitem__): Renamed EvalString
4814 4821 to EvalDict (it's a mapping, after all) and simplified its code
4815 4822 quite a bit, after a nice discussion on c.l.py where Gustavo
4816 4823 Córdova <gcordova-AT-sismex.com> suggested the new version.
4817 4824
4818 4825 2003-04-30 Fernando Perez <fperez@colorado.edu>
4819 4826
4820 4827 * IPython/genutils.py (timings_out): modified it to reduce its
4821 4828 overhead in the common reps==1 case.
4822 4829
4823 4830 2003-04-29 Fernando Perez <fperez@colorado.edu>
4824 4831
4825 4832 * IPython/genutils.py (timings_out): Modified to use the resource
4826 4833 module, which avoids the wraparound problems of time.clock().
4827 4834
4828 4835 2003-04-17 *** Released version 0.2.15pre4
4829 4836
4830 4837 2003-04-17 Fernando Perez <fperez@colorado.edu>
4831 4838
4832 4839 * setup.py (scriptfiles): Split windows-specific stuff over to a
4833 4840 separate file, in an attempt to have a Windows GUI installer.
4834 4841 That didn't work, but part of the groundwork is done.
4835 4842
4836 4843 * IPython/UserConfig/ipythonrc: Added M-i, M-o and M-I for
4837 4844 indent/unindent with 4 spaces. Particularly useful in combination
4838 4845 with the new auto-indent option.
4839 4846
4840 4847 2003-04-16 Fernando Perez <fperez@colorado.edu>
4841 4848
4842 4849 * IPython/Magic.py: various replacements of self.rc for
4843 4850 self.shell.rc. A lot more remains to be done to fully disentangle
4844 4851 this class from the main Shell class.
4845 4852
4846 4853 * IPython/GnuplotRuntime.py: added checks for mouse support so
4847 4854 that we don't try to enable it if the current gnuplot doesn't
4848 4855 really support it. Also added checks so that we don't try to
4849 4856 enable persist under Windows (where Gnuplot doesn't recognize the
4850 4857 option).
4851 4858
4852 4859 * IPython/iplib.py (InteractiveShell.interact): Added optional
4853 4860 auto-indenting code, after a patch by King C. Shu
4854 4861 <kingshu-AT-myrealbox.com>. It's off by default because it doesn't
4855 4862 get along well with pasting indented code. If I ever figure out
4856 4863 how to make that part go well, it will become on by default.
4857 4864
4858 4865 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixed bug which would
4859 4866 crash ipython if there was an unmatched '%' in the user's prompt
4860 4867 string. Reported by Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
4861 4868
4862 4869 * IPython/iplib.py (InteractiveShell.interact): removed the
4863 4870 ability to ask the user whether he wants to crash or not at the
4864 4871 'last line' exception handler. Calling functions at that point
4865 4872 changes the stack, and the error reports would have incorrect
4866 4873 tracebacks.
4867 4874
4868 4875 * IPython/Magic.py (Magic.magic_page): Added new @page magic, to
4869 4876 pass through a peger a pretty-printed form of any object. After a
4870 4877 contribution by Olivier Aubert <oaubert-AT-bat710.univ-lyon1.fr>
4871 4878
4872 4879 2003-04-14 Fernando Perez <fperez@colorado.edu>
4873 4880
4874 4881 * IPython/iplib.py (InteractiveShell.user_setup): Fixed bug where
4875 4882 all files in ~ would be modified at first install (instead of
4876 4883 ~/.ipython). This could be potentially disastrous, as the
4877 4884 modification (make line-endings native) could damage binary files.
4878 4885
4879 4886 2003-04-10 Fernando Perez <fperez@colorado.edu>
4880 4887
4881 4888 * IPython/iplib.py (InteractiveShell.handle_help): Modified to
4882 4889 handle only lines which are invalid python. This now means that
4883 4890 lines like 'x=1 #?' execute properly. Thanks to Jeffery Collins
4884 4891 for the bug report.
4885 4892
4886 4893 2003-04-01 Fernando Perez <fperez@colorado.edu>
4887 4894
4888 4895 * IPython/iplib.py (InteractiveShell.showtraceback): Fixed bug
4889 4896 where failing to set sys.last_traceback would crash pdb.pm().
4890 4897 Thanks to Jeffery D. Collins <Jeff.Collins-AT-vexcel.com> for the bug
4891 4898 report.
4892 4899
4893 4900 2003-03-25 Fernando Perez <fperez@colorado.edu>
4894 4901
4895 4902 * IPython/Magic.py (Magic.magic_prun): rstrip() output of profiler
4896 4903 before printing it (it had a lot of spurious blank lines at the
4897 4904 end).
4898 4905
4899 4906 * IPython/Gnuplot2.py (Gnuplot.hardcopy): fixed bug where lpr
4900 4907 output would be sent 21 times! Obviously people don't use this
4901 4908 too often, or I would have heard about it.
4902 4909
4903 4910 2003-03-24 Fernando Perez <fperez@colorado.edu>
4904 4911
4905 4912 * setup.py (scriptfiles): renamed the data_files parameter from
4906 4913 'base' to 'data' to fix rpm build issues. Thanks to Ralf Ahlbrink
4907 4914 for the patch.
4908 4915
4909 4916 2003-03-20 Fernando Perez <fperez@colorado.edu>
4910 4917
4911 4918 * IPython/genutils.py (error): added error() and fatal()
4912 4919 functions.
4913 4920
4914 4921 2003-03-18 *** Released version 0.2.15pre3
4915 4922
4916 4923 2003-03-18 Fernando Perez <fperez@colorado.edu>
4917 4924
4918 4925 * setupext/install_data_ext.py
4919 4926 (install_data_ext.initialize_options): Class contributed by Jack
4920 4927 Moffit for fixing the old distutils hack. He is sending this to
4921 4928 the distutils folks so in the future we may not need it as a
4922 4929 private fix.
4923 4930
4924 4931 * MANIFEST.in: Extensive reorganization, based on Jack Moffit's
4925 4932 changes for Debian packaging. See his patch for full details.
4926 4933 The old distutils hack of making the ipythonrc* files carry a
4927 4934 bogus .py extension is gone, at last. Examples were moved to a
4928 4935 separate subdir under doc/, and the separate executable scripts
4929 4936 now live in their own directory. Overall a great cleanup. The
4930 4937 manual was updated to use the new files, and setup.py has been
4931 4938 fixed for this setup.
4932 4939
4933 4940 * IPython/PyColorize.py (Parser.usage): made non-executable and
4934 4941 created a pycolor wrapper around it to be included as a script.
4935 4942
4936 4943 2003-03-12 *** Released version 0.2.15pre2
4937 4944
4938 4945 2003-03-12 Fernando Perez <fperez@colorado.edu>
4939 4946
4940 4947 * IPython/ColorANSI.py (make_color_table): Finally fixed the
4941 4948 long-standing problem with garbage characters in some terminals.
4942 4949 The issue was really that the \001 and \002 escapes must _only_ be
4943 4950 passed to input prompts (which call readline), but _never_ to
4944 4951 normal text to be printed on screen. I changed ColorANSI to have
4945 4952 two classes: TermColors and InputTermColors, each with the
4946 4953 appropriate escapes for input prompts or normal text. The code in
4947 4954 Prompts.py got slightly more complicated, but this very old and
4948 4955 annoying bug is finally fixed.
4949 4956
4950 4957 All the credit for nailing down the real origin of this problem
4951 4958 and the correct solution goes to Jack Moffit <jack-AT-xiph.org>.
4952 4959 *Many* thanks to him for spending quite a bit of effort on this.
4953 4960
4954 4961 2003-03-05 *** Released version 0.2.15pre1
4955 4962
4956 4963 2003-03-03 Fernando Perez <fperez@colorado.edu>
4957 4964
4958 4965 * IPython/FakeModule.py: Moved the former _FakeModule to a
4959 4966 separate file, because it's also needed by Magic (to fix a similar
4960 4967 pickle-related issue in @run).
4961 4968
4962 4969 2003-03-02 Fernando Perez <fperez@colorado.edu>
4963 4970
4964 4971 * IPython/Magic.py (Magic.magic_autocall): new magic to control
4965 4972 the autocall option at runtime.
4966 4973 (Magic.magic_dhist): changed self.user_ns to self.shell.user_ns
4967 4974 across Magic.py to start separating Magic from InteractiveShell.
4968 4975 (Magic._ofind): Fixed to return proper namespace for dotted
4969 4976 names. Before, a dotted name would always return 'not currently
4970 4977 defined', because it would find the 'parent'. s.x would be found,
4971 4978 but since 'x' isn't defined by itself, it would get confused.
4972 4979 (Magic.magic_run): Fixed pickling problems reported by Ralf
4973 4980 Ahlbrink <RAhlbrink-AT-RosenInspection.net>. The fix was similar to
4974 4981 that I'd used when Mike Heeter reported similar issues at the
4975 4982 top-level, but now for @run. It boils down to injecting the
4976 4983 namespace where code is being executed with something that looks
4977 4984 enough like a module to fool pickle.dump(). Since a pickle stores
4978 4985 a named reference to the importing module, we need this for
4979 4986 pickles to save something sensible.
4980 4987
4981 4988 * IPython/ipmaker.py (make_IPython): added an autocall option.
4982 4989
4983 4990 * IPython/iplib.py (InteractiveShell._prefilter): reordered all of
4984 4991 the auto-eval code. Now autocalling is an option, and the code is
4985 4992 also vastly safer. There is no more eval() involved at all.
4986 4993
4987 4994 2003-03-01 Fernando Perez <fperez@colorado.edu>
4988 4995
4989 4996 * IPython/Magic.py (Magic._ofind): Changed interface to return a
4990 4997 dict with named keys instead of a tuple.
4991 4998
4992 4999 * IPython: Started using CVS for IPython as of 0.2.15pre1.
4993 5000
4994 5001 * setup.py (make_shortcut): Fixed message about directories
4995 5002 created during Windows installation (the directories were ok, just
4996 5003 the printed message was misleading). Thanks to Chris Liechti
4997 5004 <cliechti-AT-gmx.net> for the heads up.
4998 5005
4999 5006 2003-02-21 Fernando Perez <fperez@colorado.edu>
5000 5007
5001 5008 * IPython/iplib.py (InteractiveShell._prefilter): Fixed catching
5002 5009 of ValueError exception when checking for auto-execution. This
5003 5010 one is raised by things like Numeric arrays arr.flat when the
5004 5011 array is non-contiguous.
5005 5012
5006 5013 2003-01-31 Fernando Perez <fperez@colorado.edu>
5007 5014
5008 5015 * IPython/genutils.py (SystemExec.bq): Fixed bug where bq would
5009 5016 not return any value at all (even though the command would get
5010 5017 executed).
5011 5018 (xsys): Flush stdout right after printing the command to ensure
5012 5019 proper ordering of commands and command output in the total
5013 5020 output.
5014 5021 (SystemExec/xsys/bq): Switched the names of xsys/bq and
5015 5022 system/getoutput as defaults. The old ones are kept for
5016 5023 compatibility reasons, so no code which uses this library needs
5017 5024 changing.
5018 5025
5019 5026 2003-01-27 *** Released version 0.2.14
5020 5027
5021 5028 2003-01-25 Fernando Perez <fperez@colorado.edu>
5022 5029
5023 5030 * IPython/Magic.py (Magic.magic_edit): Fixed problem where
5024 5031 functions defined in previous edit sessions could not be re-edited
5025 5032 (because the temp files were immediately removed). Now temp files
5026 5033 are removed only at IPython's exit.
5027 5034 (Magic.magic_run): Improved @run to perform shell-like expansions
5028 5035 on its arguments (~users and $VARS). With this, @run becomes more
5029 5036 like a normal command-line.
5030 5037
5031 5038 * IPython/Shell.py (IPShellEmbed.__call__): Fixed a bunch of small
5032 5039 bugs related to embedding and cleaned up that code. A fairly
5033 5040 important one was the impossibility to access the global namespace
5034 5041 through the embedded IPython (only local variables were visible).
5035 5042
5036 5043 2003-01-14 Fernando Perez <fperez@colorado.edu>
5037 5044
5038 5045 * IPython/iplib.py (InteractiveShell._prefilter): Fixed
5039 5046 auto-calling to be a bit more conservative. Now it doesn't get
5040 5047 triggered if any of '!=()<>' are in the rest of the input line, to
5041 5048 allow comparing callables. Thanks to Alex for the heads up.
5042 5049
5043 5050 2003-01-07 Fernando Perez <fperez@colorado.edu>
5044 5051
5045 5052 * IPython/genutils.py (page): fixed estimation of the number of
5046 5053 lines in a string to be paged to simply count newlines. This
5047 5054 prevents over-guessing due to embedded escape sequences. A better
5048 5055 long-term solution would involve stripping out the control chars
5049 5056 for the count, but it's potentially so expensive I just don't
5050 5057 think it's worth doing.
5051 5058
5052 5059 2002-12-19 *** Released version 0.2.14pre50
5053 5060
5054 5061 2002-12-19 Fernando Perez <fperez@colorado.edu>
5055 5062
5056 5063 * tools/release (version): Changed release scripts to inform
5057 5064 Andrea and build a NEWS file with a list of recent changes.
5058 5065
5059 5066 * IPython/ColorANSI.py (__all__): changed terminal detection
5060 5067 code. Seems to work better for xterms without breaking
5061 5068 konsole. Will need more testing to determine if WinXP and Mac OSX
5062 5069 also work ok.
5063 5070
5064 5071 2002-12-18 *** Released version 0.2.14pre49
5065 5072
5066 5073 2002-12-18 Fernando Perez <fperez@colorado.edu>
5067 5074
5068 5075 * Docs: added new info about Mac OSX, from Andrea.
5069 5076
5070 5077 * IPython/Gnuplot2.py (String): Added a String PlotItem class to
5071 5078 allow direct plotting of python strings whose format is the same
5072 5079 of gnuplot data files.
5073 5080
5074 5081 2002-12-16 Fernando Perez <fperez@colorado.edu>
5075 5082
5076 5083 * IPython/iplib.py (InteractiveShell.interact): fixed default (y)
5077 5084 value of exit question to be acknowledged.
5078 5085
5079 5086 2002-12-03 Fernando Perez <fperez@colorado.edu>
5080 5087
5081 5088 * IPython/ipmaker.py: removed generators, which had been added
5082 5089 by mistake in an earlier debugging run. This was causing trouble
5083 5090 to users of python 2.1.x. Thanks to Abel Daniel <abli-AT-freemail.hu>
5084 5091 for pointing this out.
5085 5092
5086 5093 2002-11-17 Fernando Perez <fperez@colorado.edu>
5087 5094
5088 5095 * Manual: updated the Gnuplot section.
5089 5096
5090 5097 * IPython/GnuplotRuntime.py: refactored a lot all this code, with
5091 5098 a much better split of what goes in Runtime and what goes in
5092 5099 Interactive.
5093 5100
5094 5101 * IPython/ipmaker.py: fixed bug where import_fail_info wasn't
5095 5102 being imported from iplib.
5096 5103
5097 5104 * IPython/GnuplotInteractive.py (magic_gpc): renamed @gp to @gpc
5098 5105 for command-passing. Now the global Gnuplot instance is called
5099 5106 'gp' instead of 'g', which was really a far too fragile and
5100 5107 common name.
5101 5108
5102 5109 * IPython/Gnuplot2.py (eps_fix_bbox): added this to fix broken
5103 5110 bounding boxes generated by Gnuplot for square plots.
5104 5111
5105 5112 * IPython/genutils.py (popkey): new function added. I should
5106 5113 suggest this on c.l.py as a dict method, it seems useful.
5107 5114
5108 5115 * IPython/Gnuplot2.py (Gnuplot.plot): Overhauled plot and replot
5109 5116 to transparently handle PostScript generation. MUCH better than
5110 5117 the previous plot_eps/replot_eps (which I removed now). The code
5111 5118 is also fairly clean and well documented now (including
5112 5119 docstrings).
5113 5120
5114 5121 2002-11-13 Fernando Perez <fperez@colorado.edu>
5115 5122
5116 5123 * IPython/Magic.py (Magic.magic_edit): fixed docstring
5117 5124 (inconsistent with options).
5118 5125
5119 5126 * IPython/Gnuplot2.py (Gnuplot.hardcopy): hardcopy had been
5120 5127 manually disabled, I don't know why. Fixed it.
5121 5128 (Gnuplot._plot_eps): added new plot_eps/replot_eps to get directly
5122 5129 eps output.
5123 5130
5124 5131 2002-11-12 Fernando Perez <fperez@colorado.edu>
5125 5132
5126 5133 * IPython/genutils.py (ask_yes_no): trap EOF and ^C so that they
5127 5134 don't propagate up to caller. Fixes crash reported by François
5128 5135 Pinard.
5129 5136
5130 5137 2002-11-09 Fernando Perez <fperez@colorado.edu>
5131 5138
5132 5139 * IPython/ipmaker.py (make_IPython): fixed problem with writing
5133 5140 history file for new users.
5134 5141 (make_IPython): fixed bug where initial install would leave the
5135 5142 user running in the .ipython dir.
5136 5143 (make_IPython): fixed bug where config dir .ipython would be
5137 5144 created regardless of the given -ipythondir option. Thanks to Cory
5138 5145 Dodt <cdodt-AT-fcoe.k12.ca.us> for the bug report.
5139 5146
5140 5147 * IPython/genutils.py (ask_yes_no): new function for asking yes/no
5141 5148 type confirmations. Will need to use it in all of IPython's code
5142 5149 consistently.
5143 5150
5144 5151 * IPython/CrashHandler.py (CrashHandler.__call__): changed the
5145 5152 context to print 31 lines instead of the default 5. This will make
5146 5153 the crash reports extremely detailed in case the problem is in
5147 5154 libraries I don't have access to.
5148 5155
5149 5156 * IPython/iplib.py (InteractiveShell.interact): changed the 'last
5150 5157 line of defense' code to still crash, but giving users fair
5151 5158 warning. I don't want internal errors to go unreported: if there's
5152 5159 an internal problem, IPython should crash and generate a full
5153 5160 report.
5154 5161
5155 5162 2002-11-08 Fernando Perez <fperez@colorado.edu>
5156 5163
5157 5164 * IPython/iplib.py (InteractiveShell.interact): added code to trap
5158 5165 otherwise uncaught exceptions which can appear if people set
5159 5166 sys.stdout to something badly broken. Thanks to a crash report
5160 5167 from henni-AT-mail.brainbot.com.
5161 5168
5162 5169 2002-11-04 Fernando Perez <fperez@colorado.edu>
5163 5170
5164 5171 * IPython/iplib.py (InteractiveShell.interact): added
5165 5172 __IPYTHON__active to the builtins. It's a flag which goes on when
5166 5173 the interaction starts and goes off again when it stops. This
5167 5174 allows embedding code to detect being inside IPython. Before this
5168 5175 was done via __IPYTHON__, but that only shows that an IPython
5169 5176 instance has been created.
5170 5177
5171 5178 * IPython/Magic.py (Magic.magic_env): I realized that in a
5172 5179 UserDict, instance.data holds the data as a normal dict. So I
5173 5180 modified @env to return os.environ.data instead of rebuilding a
5174 5181 dict by hand.
5175 5182
5176 5183 2002-11-02 Fernando Perez <fperez@colorado.edu>
5177 5184
5178 5185 * IPython/genutils.py (warn): changed so that level 1 prints no
5179 5186 header. Level 2 is now the default (with 'WARNING' header, as
5180 5187 before). I think I tracked all places where changes were needed in
5181 5188 IPython, but outside code using the old level numbering may have
5182 5189 broken.
5183 5190
5184 5191 * IPython/iplib.py (InteractiveShell.runcode): added this to
5185 5192 handle the tracebacks in SystemExit traps correctly. The previous
5186 5193 code (through interact) was printing more of the stack than
5187 5194 necessary, showing IPython internal code to the user.
5188 5195
5189 5196 * IPython/UserConfig/ipythonrc.py: Made confirm_exit 1 by
5190 5197 default. Now that the default at the confirmation prompt is yes,
5191 5198 it's not so intrusive. François' argument that ipython sessions
5192 5199 tend to be complex enough not to lose them from an accidental C-d,
5193 5200 is a valid one.
5194 5201
5195 5202 * IPython/iplib.py (InteractiveShell.interact): added a
5196 5203 showtraceback() call to the SystemExit trap, and modified the exit
5197 5204 confirmation to have yes as the default.
5198 5205
5199 5206 * IPython/UserConfig/ipythonrc.py: removed 'session' option from
5200 5207 this file. It's been gone from the code for a long time, this was
5201 5208 simply leftover junk.
5202 5209
5203 5210 2002-11-01 Fernando Perez <fperez@colorado.edu>
5204 5211
5205 5212 * IPython/UserConfig/ipythonrc.py: new confirm_exit option
5206 5213 added. If set, IPython now traps EOF and asks for
5207 5214 confirmation. After a request by François Pinard.
5208 5215
5209 5216 * IPython/Magic.py (Magic.magic_Exit): New @Exit and @Quit instead
5210 5217 of @abort, and with a new (better) mechanism for handling the
5211 5218 exceptions.
5212 5219
5213 5220 2002-10-27 Fernando Perez <fperez@colorado.edu>
5214 5221
5215 5222 * IPython/usage.py (__doc__): updated the --help information and
5216 5223 the ipythonrc file to indicate that -log generates
5217 5224 ./ipython.log. Also fixed the corresponding info in @logstart.
5218 5225 This and several other fixes in the manuals thanks to reports by
5219 5226 François Pinard <pinard-AT-iro.umontreal.ca>.
5220 5227
5221 5228 * IPython/Logger.py (Logger.switch_log): Fixed error message to
5222 5229 refer to @logstart (instead of @log, which doesn't exist).
5223 5230
5224 5231 * IPython/iplib.py (InteractiveShell._prefilter): fixed
5225 5232 AttributeError crash. Thanks to Christopher Armstrong
5226 5233 <radix-AT-twistedmatrix.com> for the report/fix. This bug had been
5227 5234 introduced recently (in 0.2.14pre37) with the fix to the eval
5228 5235 problem mentioned below.
5229 5236
5230 5237 2002-10-17 Fernando Perez <fperez@colorado.edu>
5231 5238
5232 5239 * IPython/ConfigLoader.py (ConfigLoader.load): Fixes for Windows
5233 5240 installation. Thanks to Leonardo Santagada <retype-AT-terra.com.br>.
5234 5241
5235 5242 * IPython/iplib.py (InteractiveShell._prefilter): Many changes to
5236 5243 this function to fix a problem reported by Alex Schmolck. He saw
5237 5244 it with list comprehensions and generators, which were getting
5238 5245 called twice. The real problem was an 'eval' call in testing for
5239 5246 automagic which was evaluating the input line silently.
5240 5247
5241 5248 This is a potentially very nasty bug, if the input has side
5242 5249 effects which must not be repeated. The code is much cleaner now,
5243 5250 without any blanket 'except' left and with a regexp test for
5244 5251 actual function names.
5245 5252
5246 5253 But an eval remains, which I'm not fully comfortable with. I just
5247 5254 don't know how to find out if an expression could be a callable in
5248 5255 the user's namespace without doing an eval on the string. However
5249 5256 that string is now much more strictly checked so that no code
5250 5257 slips by, so the eval should only happen for things that can
5251 5258 really be only function/method names.
5252 5259
5253 5260 2002-10-15 Fernando Perez <fperez@colorado.edu>
5254 5261
5255 5262 * Updated LyX to 1.2.1 so I can work on the docs again. Added Mac
5256 5263 OSX information to main manual, removed README_Mac_OSX file from
5257 5264 distribution. Also updated credits for recent additions.
5258 5265
5259 5266 2002-10-10 Fernando Perez <fperez@colorado.edu>
5260 5267
5261 5268 * README_Mac_OSX: Added a README for Mac OSX users for fixing
5262 5269 terminal-related issues. Many thanks to Andrea Riciputi
5263 5270 <andrea.riciputi-AT-libero.it> for writing it.
5264 5271
5265 5272 * IPython/UserConfig/ipythonrc.py: Fixes to various small issues,
5266 5273 thanks to Thorsten Kampe <thorsten-AT-thorstenkampe.de>.
5267 5274
5268 5275 * setup.py (make_shortcut): Fixes for Windows installation. Thanks
5269 5276 to Fredrik Kant <fredrik.kant-AT-front.com> and Syver Enstad
5270 5277 <syver-en-AT-online.no> who both submitted patches for this problem.
5271 5278
5272 5279 * IPython/iplib.py (InteractiveShell.embed_mainloop): Patch for
5273 5280 global embedding to make sure that things don't overwrite user
5274 5281 globals accidentally. Thanks to Richard <rxe-AT-renre-europe.com>
5275 5282
5276 5283 * IPython/Gnuplot2.py (gp): Patch for Gnuplot.py 1.6
5277 5284 compatibility. Thanks to Hayden Callow
5278 5285 <h.callow-AT-elec.canterbury.ac.nz>
5279 5286
5280 5287 2002-10-04 Fernando Perez <fperez@colorado.edu>
5281 5288
5282 5289 * IPython/Gnuplot2.py (PlotItem): Added 'index' option for
5283 5290 Gnuplot.File objects.
5284 5291
5285 5292 2002-07-23 Fernando Perez <fperez@colorado.edu>
5286 5293
5287 5294 * IPython/genutils.py (timing): Added timings() and timing() for
5288 5295 quick access to the most commonly needed data, the execution
5289 5296 times. Old timing() renamed to timings_out().
5290 5297
5291 5298 2002-07-18 Fernando Perez <fperez@colorado.edu>
5292 5299
5293 5300 * IPython/Shell.py (IPShellEmbed.restore_system_completer): fixed
5294 5301 bug with nested instances disrupting the parent's tab completion.
5295 5302
5296 5303 * IPython/iplib.py (all_completions): Added Alex Schmolck's
5297 5304 all_completions code to begin the emacs integration.
5298 5305
5299 5306 * IPython/Gnuplot2.py (zip_items): Added optional 'titles'
5300 5307 argument to allow titling individual arrays when plotting.
5301 5308
5302 5309 2002-07-15 Fernando Perez <fperez@colorado.edu>
5303 5310
5304 5311 * setup.py (make_shortcut): changed to retrieve the value of
5305 5312 'Program Files' directory from the registry (this value changes in
5306 5313 non-english versions of Windows). Thanks to Thomas Fanslau
5307 5314 <tfanslau-AT-gmx.de> for the report.
5308 5315
5309 5316 2002-07-10 Fernando Perez <fperez@colorado.edu>
5310 5317
5311 5318 * IPython/ultraTB.py (VerboseTB.debugger): enabled workaround for
5312 5319 a bug in pdb, which crashes if a line with only whitespace is
5313 5320 entered. Bug report submitted to sourceforge.
5314 5321
5315 5322 2002-07-09 Fernando Perez <fperez@colorado.edu>
5316 5323
5317 5324 * IPython/ultraTB.py (VerboseTB.nullrepr): fixed rare crash when
5318 5325 reporting exceptions (it's a bug in inspect.py, I just set a
5319 5326 workaround).
5320 5327
5321 5328 2002-07-08 Fernando Perez <fperez@colorado.edu>
5322 5329
5323 5330 * IPython/iplib.py (InteractiveShell.__init__): fixed reference to
5324 5331 __IPYTHON__ in __builtins__ to show up in user_ns.
5325 5332
5326 5333 2002-07-03 Fernando Perez <fperez@colorado.edu>
5327 5334
5328 5335 * IPython/GnuplotInteractive.py (magic_gp_set_default): changed
5329 5336 name from @gp_set_instance to @gp_set_default.
5330 5337
5331 5338 * IPython/ipmaker.py (make_IPython): default editor value set to
5332 5339 '0' (a string), to match the rc file. Otherwise will crash when
5333 5340 .strip() is called on it.
5334 5341
5335 5342
5336 5343 2002-06-28 Fernando Perez <fperez@colorado.edu>
5337 5344
5338 5345 * IPython/iplib.py (InteractiveShell.safe_execfile): fix importing
5339 5346 of files in current directory when a file is executed via
5340 5347 @run. Patch also by RA <ralf_ahlbrink-AT-web.de>.
5341 5348
5342 5349 * setup.py (manfiles): fix for rpm builds, submitted by RA
5343 5350 <ralf_ahlbrink-AT-web.de>. Now we have RPMs!
5344 5351
5345 5352 * IPython/ipmaker.py (make_IPython): fixed lookup of default
5346 5353 editor when set to '0'. Problem was, '0' evaluates to True (it's a
5347 5354 string!). A. Schmolck caught this one.
5348 5355
5349 5356 2002-06-27 Fernando Perez <fperez@colorado.edu>
5350 5357
5351 5358 * IPython/ipmaker.py (make_IPython): fixed bug when running user
5352 5359 defined files at the cmd line. __name__ wasn't being set to
5353 5360 __main__.
5354 5361
5355 5362 * IPython/Gnuplot2.py (zip_items): improved it so it can plot also
5356 5363 regular lists and tuples besides Numeric arrays.
5357 5364
5358 5365 * IPython/Prompts.py (CachedOutput.__call__): Added output
5359 5366 supression for input ending with ';'. Similar to Mathematica and
5360 5367 Matlab. The _* vars and Out[] list are still updated, just like
5361 5368 Mathematica behaves.
5362 5369
5363 5370 2002-06-25 Fernando Perez <fperez@colorado.edu>
5364 5371
5365 5372 * IPython/ConfigLoader.py (ConfigLoader.load): fixed checking of
5366 5373 .ini extensions for profiels under Windows.
5367 5374
5368 5375 * IPython/OInspect.py (Inspector.pinfo): improved alignment of
5369 5376 string form. Fix contributed by Alexander Schmolck
5370 5377 <a.schmolck-AT-gmx.net>
5371 5378
5372 5379 * IPython/GnuplotRuntime.py (gp_new): new function. Returns a
5373 5380 pre-configured Gnuplot instance.
5374 5381
5375 5382 2002-06-21 Fernando Perez <fperez@colorado.edu>
5376 5383
5377 5384 * IPython/numutils.py (exp_safe): new function, works around the
5378 5385 underflow problems in Numeric.
5379 5386 (log2): New fn. Safe log in base 2: returns exact integer answer
5380 5387 for exact integer powers of 2.
5381 5388
5382 5389 * IPython/Magic.py (get_py_filename): fixed it not expanding '~'
5383 5390 properly.
5384 5391
5385 5392 2002-06-20 Fernando Perez <fperez@colorado.edu>
5386 5393
5387 5394 * IPython/genutils.py (timing): new function like
5388 5395 Mathematica's. Similar to time_test, but returns more info.
5389 5396
5390 5397 2002-06-18 Fernando Perez <fperez@colorado.edu>
5391 5398
5392 5399 * IPython/Magic.py (Magic.magic_save): modified @save and @r
5393 5400 according to Mike Heeter's suggestions.
5394 5401
5395 5402 2002-06-16 Fernando Perez <fperez@colorado.edu>
5396 5403
5397 5404 * IPython/GnuplotRuntime.py: Massive overhaul to the Gnuplot
5398 5405 system. GnuplotMagic is gone as a user-directory option. New files
5399 5406 make it easier to use all the gnuplot stuff both from external
5400 5407 programs as well as from IPython. Had to rewrite part of
5401 5408 hardcopy() b/c of a strange bug: often the ps files simply don't
5402 5409 get created, and require a repeat of the command (often several
5403 5410 times).
5404 5411
5405 5412 * IPython/ultraTB.py (AutoFormattedTB.__call__): changed to
5406 5413 resolve output channel at call time, so that if sys.stderr has
5407 5414 been redirected by user this gets honored.
5408 5415
5409 5416 2002-06-13 Fernando Perez <fperez@colorado.edu>
5410 5417
5411 5418 * IPython/Shell.py (IPShell.__init__): Changed IPythonShell to
5412 5419 IPShell. Kept a copy with the old names to avoid breaking people's
5413 5420 embedded code.
5414 5421
5415 5422 * IPython/ipython: simplified it to the bare minimum after
5416 5423 Holger's suggestions. Added info about how to use it in
5417 5424 PYTHONSTARTUP.
5418 5425
5419 5426 * IPython/Shell.py (IPythonShell): changed the options passing
5420 5427 from a string with funky %s replacements to a straight list. Maybe
5421 5428 a bit more typing, but it follows sys.argv conventions, so there's
5422 5429 less special-casing to remember.
5423 5430
5424 5431 2002-06-12 Fernando Perez <fperez@colorado.edu>
5425 5432
5426 5433 * IPython/Magic.py (Magic.magic_r): new magic auto-repeat
5427 5434 command. Thanks to a suggestion by Mike Heeter.
5428 5435 (Magic.magic_pfile): added behavior to look at filenames if given
5429 5436 arg is not a defined object.
5430 5437 (Magic.magic_save): New @save function to save code snippets. Also
5431 5438 a Mike Heeter idea.
5432 5439
5433 5440 * IPython/UserConfig/GnuplotMagic.py (plot): Improvements to
5434 5441 plot() and replot(). Much more convenient now, especially for
5435 5442 interactive use.
5436 5443
5437 5444 * IPython/Magic.py (Magic.magic_run): Added .py automatically to
5438 5445 filenames.
5439 5446
5440 5447 2002-06-02 Fernando Perez <fperez@colorado.edu>
5441 5448
5442 5449 * IPython/Struct.py (Struct.__init__): modified to admit
5443 5450 initialization via another struct.
5444 5451
5445 5452 * IPython/genutils.py (SystemExec.__init__): New stateful
5446 5453 interface to xsys and bq. Useful for writing system scripts.
5447 5454
5448 5455 2002-05-30 Fernando Perez <fperez@colorado.edu>
5449 5456
5450 5457 * MANIFEST.in: Changed docfile selection to exclude all the lyx
5451 5458 documents. This will make the user download smaller (it's getting
5452 5459 too big).
5453 5460
5454 5461 2002-05-29 Fernando Perez <fperez@colorado.edu>
5455 5462
5456 5463 * IPython/iplib.py (_FakeModule.__init__): New class introduced to
5457 5464 fix problems with shelve and pickle. Seems to work, but I don't
5458 5465 know if corner cases break it. Thanks to Mike Heeter
5459 5466 <korora-AT-SDF.LONESTAR.ORG> for the bug reports and test cases.
5460 5467
5461 5468 2002-05-24 Fernando Perez <fperez@colorado.edu>
5462 5469
5463 5470 * IPython/Magic.py (Macro.__init__): fixed magics embedded in
5464 5471 macros having broken.
5465 5472
5466 5473 2002-05-21 Fernando Perez <fperez@colorado.edu>
5467 5474
5468 5475 * IPython/Magic.py (Magic.magic_logstart): fixed recently
5469 5476 introduced logging bug: all history before logging started was
5470 5477 being written one character per line! This came from the redesign
5471 5478 of the input history as a special list which slices to strings,
5472 5479 not to lists.
5473 5480
5474 5481 2002-05-20 Fernando Perez <fperez@colorado.edu>
5475 5482
5476 5483 * IPython/Prompts.py (CachedOutput.__init__): made the color table
5477 5484 be an attribute of all classes in this module. The design of these
5478 5485 classes needs some serious overhauling.
5479 5486
5480 5487 * IPython/DPyGetOpt.py (DPyGetOpt.setPosixCompliance): fixed bug
5481 5488 which was ignoring '_' in option names.
5482 5489
5483 5490 * IPython/ultraTB.py (FormattedTB.__init__): Changed
5484 5491 'Verbose_novars' to 'Context' and made it the new default. It's a
5485 5492 bit more readable and also safer than verbose.
5486 5493
5487 5494 * IPython/PyColorize.py (Parser.__call__): Fixed coloring of
5488 5495 triple-quoted strings.
5489 5496
5490 5497 * IPython/OInspect.py (__all__): new module exposing the object
5491 5498 introspection facilities. Now the corresponding magics are dummy
5492 5499 wrappers around this. Having this module will make it much easier
5493 5500 to put these functions into our modified pdb.
5494 5501 This new object inspector system uses the new colorizing module,
5495 5502 so source code and other things are nicely syntax highlighted.
5496 5503
5497 5504 2002-05-18 Fernando Perez <fperez@colorado.edu>
5498 5505
5499 5506 * IPython/ColorANSI.py: Split the coloring tools into a separate
5500 5507 module so I can use them in other code easier (they were part of
5501 5508 ultraTB).
5502 5509
5503 5510 2002-05-17 Fernando Perez <fperez@colorado.edu>
5504 5511
5505 5512 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
5506 5513 fixed it to set the global 'g' also to the called instance, as
5507 5514 long as 'g' was still a gnuplot instance (so it doesn't overwrite
5508 5515 user's 'g' variables).
5509 5516
5510 5517 * IPython/iplib.py (InteractiveShell.__init__): Added In/Out
5511 5518 global variables (aliases to _ih,_oh) so that users which expect
5512 5519 In[5] or Out[7] to work aren't unpleasantly surprised.
5513 5520 (InputList.__getslice__): new class to allow executing slices of
5514 5521 input history directly. Very simple class, complements the use of
5515 5522 macros.
5516 5523
5517 5524 2002-05-16 Fernando Perez <fperez@colorado.edu>
5518 5525
5519 5526 * setup.py (docdirbase): make doc directory be just doc/IPython
5520 5527 without version numbers, it will reduce clutter for users.
5521 5528
5522 5529 * IPython/Magic.py (Magic.magic_run): Add explicit local dict to
5523 5530 execfile call to prevent possible memory leak. See for details:
5524 5531 http://mail.python.org/pipermail/python-list/2002-February/088476.html
5525 5532
5526 5533 2002-05-15 Fernando Perez <fperez@colorado.edu>
5527 5534
5528 5535 * IPython/Magic.py (Magic.magic_psource): made the object
5529 5536 introspection names be more standard: pdoc, pdef, pfile and
5530 5537 psource. They all print/page their output, and it makes
5531 5538 remembering them easier. Kept old names for compatibility as
5532 5539 aliases.
5533 5540
5534 5541 2002-05-14 Fernando Perez <fperez@colorado.edu>
5535 5542
5536 5543 * IPython/UserConfig/GnuplotMagic.py: I think I finally understood
5537 5544 what the mouse problem was. The trick is to use gnuplot with temp
5538 5545 files and NOT with pipes (for data communication), because having
5539 5546 both pipes and the mouse on is bad news.
5540 5547
5541 5548 2002-05-13 Fernando Perez <fperez@colorado.edu>
5542 5549
5543 5550 * IPython/Magic.py (Magic._ofind): fixed namespace order search
5544 5551 bug. Information would be reported about builtins even when
5545 5552 user-defined functions overrode them.
5546 5553
5547 5554 2002-05-11 Fernando Perez <fperez@colorado.edu>
5548 5555
5549 5556 * IPython/__init__.py (__all__): removed FlexCompleter from
5550 5557 __all__ so that things don't fail in platforms without readline.
5551 5558
5552 5559 2002-05-10 Fernando Perez <fperez@colorado.edu>
5553 5560
5554 5561 * IPython/__init__.py (__all__): removed numutils from __all__ b/c
5555 5562 it requires Numeric, effectively making Numeric a dependency for
5556 5563 IPython.
5557 5564
5558 5565 * Released 0.2.13
5559 5566
5560 5567 * IPython/Magic.py (Magic.magic_prun): big overhaul to the
5561 5568 profiler interface. Now all the major options from the profiler
5562 5569 module are directly supported in IPython, both for single
5563 5570 expressions (@prun) and for full programs (@run -p).
5564 5571
5565 5572 2002-05-09 Fernando Perez <fperez@colorado.edu>
5566 5573
5567 5574 * IPython/Magic.py (Magic.magic_doc): fixed to show docstrings of
5568 5575 magic properly formatted for screen.
5569 5576
5570 5577 * setup.py (make_shortcut): Changed things to put pdf version in
5571 5578 doc/ instead of doc/manual (had to change lyxport a bit).
5572 5579
5573 5580 * IPython/Magic.py (Profile.string_stats): made profile runs go
5574 5581 through pager (they are long and a pager allows searching, saving,
5575 5582 etc.)
5576 5583
5577 5584 2002-05-08 Fernando Perez <fperez@colorado.edu>
5578 5585
5579 5586 * Released 0.2.12
5580 5587
5581 5588 2002-05-06 Fernando Perez <fperez@colorado.edu>
5582 5589
5583 5590 * IPython/Magic.py (Magic.magic_hist): small bug fixed (recently
5584 5591 introduced); 'hist n1 n2' was broken.
5585 5592 (Magic.magic_pdb): added optional on/off arguments to @pdb
5586 5593 (Magic.magic_run): added option -i to @run, which executes code in
5587 5594 the IPython namespace instead of a clean one. Also added @irun as
5588 5595 an alias to @run -i.
5589 5596
5590 5597 * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance):
5591 5598 fixed (it didn't really do anything, the namespaces were wrong).
5592 5599
5593 5600 * IPython/Debugger.py (__init__): Added workaround for python 2.1
5594 5601
5595 5602 * IPython/__init__.py (__all__): Fixed package namespace, now
5596 5603 'import IPython' does give access to IPython.<all> as
5597 5604 expected. Also renamed __release__ to Release.
5598 5605
5599 5606 * IPython/Debugger.py (__license__): created new Pdb class which
5600 5607 functions like a drop-in for the normal pdb.Pdb but does NOT
5601 5608 import readline by default. This way it doesn't muck up IPython's
5602 5609 readline handling, and now tab-completion finally works in the
5603 5610 debugger -- sort of. It completes things globally visible, but the
5604 5611 completer doesn't track the stack as pdb walks it. That's a bit
5605 5612 tricky, and I'll have to implement it later.
5606 5613
5607 5614 2002-05-05 Fernando Perez <fperez@colorado.edu>
5608 5615
5609 5616 * IPython/Magic.py (Magic.magic_oinfo): fixed formatting bug for
5610 5617 magic docstrings when printed via ? (explicit \'s were being
5611 5618 printed).
5612 5619
5613 5620 * IPython/ipmaker.py (make_IPython): fixed namespace
5614 5621 identification bug. Now variables loaded via logs or command-line
5615 5622 files are recognized in the interactive namespace by @who.
5616 5623
5617 5624 * IPython/iplib.py (InteractiveShell.safe_execfile): Fixed bug in
5618 5625 log replay system stemming from the string form of Structs.
5619 5626
5620 5627 * IPython/Magic.py (Macro.__init__): improved macros to properly
5621 5628 handle magic commands in them.
5622 5629 (Magic.magic_logstart): usernames are now expanded so 'logstart
5623 5630 ~/mylog' now works.
5624 5631
5625 5632 * IPython/iplib.py (complete): fixed bug where paths starting with
5626 5633 '/' would be completed as magic names.
5627 5634
5628 5635 2002-05-04 Fernando Perez <fperez@colorado.edu>
5629 5636
5630 5637 * IPython/Magic.py (Magic.magic_run): added options -p and -f to
5631 5638 allow running full programs under the profiler's control.
5632 5639
5633 5640 * IPython/ultraTB.py (FormattedTB.__init__): Added Verbose_novars
5634 5641 mode to report exceptions verbosely but without formatting
5635 5642 variables. This addresses the issue of ipython 'freezing' (it's
5636 5643 not frozen, but caught in an expensive formatting loop) when huge
5637 5644 variables are in the context of an exception.
5638 5645 (VerboseTB.text): Added '--->' markers at line where exception was
5639 5646 triggered. Much clearer to read, especially in NoColor modes.
5640 5647
5641 5648 * IPython/Magic.py (Magic.magic_run): bugfix: -n option had been
5642 5649 implemented in reverse when changing to the new parse_options().
5643 5650
5644 5651 2002-05-03 Fernando Perez <fperez@colorado.edu>
5645 5652
5646 5653 * IPython/Magic.py (Magic.parse_options): new function so that
5647 5654 magics can parse options easier.
5648 5655 (Magic.magic_prun): new function similar to profile.run(),
5649 5656 suggested by Chris Hart.
5650 5657 (Magic.magic_cd): fixed behavior so that it only changes if
5651 5658 directory actually is in history.
5652 5659
5653 5660 * IPython/usage.py (__doc__): added information about potential
5654 5661 slowness of Verbose exception mode when there are huge data
5655 5662 structures to be formatted (thanks to Archie Paulson).
5656 5663
5657 5664 * IPython/ipmaker.py (make_IPython): Changed default logging
5658 5665 (when simply called with -log) to use curr_dir/ipython.log in
5659 5666 rotate mode. Fixed crash which was occuring with -log before
5660 5667 (thanks to Jim Boyle).
5661 5668
5662 5669 2002-05-01 Fernando Perez <fperez@colorado.edu>
5663 5670
5664 5671 * Released 0.2.11 for these fixes (mainly the ultraTB one which
5665 5672 was nasty -- though somewhat of a corner case).
5666 5673
5667 5674 * IPython/ultraTB.py (AutoFormattedTB.text): renamed __text to
5668 5675 text (was a bug).
5669 5676
5670 5677 2002-04-30 Fernando Perez <fperez@colorado.edu>
5671 5678
5672 5679 * IPython/UserConfig/GnuplotMagic.py (magic_gp): Minor fix to add
5673 5680 a print after ^D or ^C from the user so that the In[] prompt
5674 5681 doesn't over-run the gnuplot one.
5675 5682
5676 5683 2002-04-29 Fernando Perez <fperez@colorado.edu>
5677 5684
5678 5685 * Released 0.2.10
5679 5686
5680 5687 * IPython/__release__.py (version): get date dynamically.
5681 5688
5682 5689 * Misc. documentation updates thanks to Arnd's comments. Also ran
5683 5690 a full spellcheck on the manual (hadn't been done in a while).
5684 5691
5685 5692 2002-04-27 Fernando Perez <fperez@colorado.edu>
5686 5693
5687 5694 * IPython/Magic.py (Magic.magic_logstart): Fixed bug where
5688 5695 starting a log in mid-session would reset the input history list.
5689 5696
5690 5697 2002-04-26 Fernando Perez <fperez@colorado.edu>
5691 5698
5692 5699 * IPython/iplib.py (InteractiveShell.wait): Fixed bug where not
5693 5700 all files were being included in an update. Now anything in
5694 5701 UserConfig that matches [A-Za-z]*.py will go (this excludes
5695 5702 __init__.py)
5696 5703
5697 5704 2002-04-25 Fernando Perez <fperez@colorado.edu>
5698 5705
5699 5706 * IPython/iplib.py (InteractiveShell.__init__): Added __IPYTHON__
5700 5707 to __builtins__ so that any form of embedded or imported code can
5701 5708 test for being inside IPython.
5702 5709
5703 5710 * IPython/UserConfig/GnuplotMagic.py: (magic_gp_set_instance):
5704 5711 changed to GnuplotMagic because it's now an importable module,
5705 5712 this makes the name follow that of the standard Gnuplot module.
5706 5713 GnuplotMagic can now be loaded at any time in mid-session.
5707 5714
5708 5715 2002-04-24 Fernando Perez <fperez@colorado.edu>
5709 5716
5710 5717 * IPython/numutils.py: removed SIUnits. It doesn't properly set
5711 5718 the globals (IPython has its own namespace) and the
5712 5719 PhysicalQuantity stuff is much better anyway.
5713 5720
5714 5721 * IPython/UserConfig/example-gnuplot.py (g2): Added gnuplot
5715 5722 embedding example to standard user directory for
5716 5723 distribution. Also put it in the manual.
5717 5724
5718 5725 * IPython/numutils.py (gnuplot_exec): Changed to take a gnuplot
5719 5726 instance as first argument (so it doesn't rely on some obscure
5720 5727 hidden global).
5721 5728
5722 5729 * IPython/UserConfig/ipythonrc.py: put () back in accepted
5723 5730 delimiters. While it prevents ().TAB from working, it allows
5724 5731 completions in open (... expressions. This is by far a more common
5725 5732 case.
5726 5733
5727 5734 2002-04-23 Fernando Perez <fperez@colorado.edu>
5728 5735
5729 5736 * IPython/Extensions/InterpreterPasteInput.py: new
5730 5737 syntax-processing module for pasting lines with >>> or ... at the
5731 5738 start.
5732 5739
5733 5740 * IPython/Extensions/PhysicalQ_Interactive.py
5734 5741 (PhysicalQuantityInteractive.__int__): fixed to work with either
5735 5742 Numeric or math.
5736 5743
5737 5744 * IPython/UserConfig/ipythonrc-numeric.py: reorganized the
5738 5745 provided profiles. Now we have:
5739 5746 -math -> math module as * and cmath with its own namespace.
5740 5747 -numeric -> Numeric as *, plus gnuplot & grace
5741 5748 -physics -> same as before
5742 5749
5743 5750 * IPython/Magic.py (Magic.magic_magic): Fixed bug where
5744 5751 user-defined magics wouldn't be found by @magic if they were
5745 5752 defined as class methods. Also cleaned up the namespace search
5746 5753 logic and the string building (to use %s instead of many repeated
5747 5754 string adds).
5748 5755
5749 5756 * IPython/UserConfig/example-magic.py (magic_foo): updated example
5750 5757 of user-defined magics to operate with class methods (cleaner, in
5751 5758 line with the gnuplot code).
5752 5759
5753 5760 2002-04-22 Fernando Perez <fperez@colorado.edu>
5754 5761
5755 5762 * setup.py: updated dependency list so that manual is updated when
5756 5763 all included files change.
5757 5764
5758 5765 * IPython/ipmaker.py (make_IPython): Fixed bug which was ignoring
5759 5766 the delimiter removal option (the fix is ugly right now).
5760 5767
5761 5768 * IPython/UserConfig/ipythonrc-physics.py: simplified not to load
5762 5769 all of the math profile (quicker loading, no conflict between
5763 5770 g-9.8 and g-gnuplot).
5764 5771
5765 5772 * IPython/CrashHandler.py (CrashHandler.__call__): changed default
5766 5773 name of post-mortem files to IPython_crash_report.txt.
5767 5774
5768 5775 * Cleanup/update of the docs. Added all the new readline info and
5769 5776 formatted all lists as 'real lists'.
5770 5777
5771 5778 * IPython/ipmaker.py (make_IPython): removed now-obsolete
5772 5779 tab-completion options, since the full readline parse_and_bind is
5773 5780 now accessible.
5774 5781
5775 5782 * IPython/iplib.py (InteractiveShell.init_readline): Changed
5776 5783 handling of readline options. Now users can specify any string to
5777 5784 be passed to parse_and_bind(), as well as the delimiters to be
5778 5785 removed.
5779 5786 (InteractiveShell.__init__): Added __name__ to the global
5780 5787 namespace so that things like Itpl which rely on its existence
5781 5788 don't crash.
5782 5789 (InteractiveShell._prefilter): Defined the default with a _ so
5783 5790 that prefilter() is easier to override, while the default one
5784 5791 remains available.
5785 5792
5786 5793 2002-04-18 Fernando Perez <fperez@colorado.edu>
5787 5794
5788 5795 * Added information about pdb in the docs.
5789 5796
5790 5797 2002-04-17 Fernando Perez <fperez@colorado.edu>
5791 5798
5792 5799 * IPython/ipmaker.py (make_IPython): added rc_override option to
5793 5800 allow passing config options at creation time which may override
5794 5801 anything set in the config files or command line. This is
5795 5802 particularly useful for configuring embedded instances.
5796 5803
5797 5804 2002-04-15 Fernando Perez <fperez@colorado.edu>
5798 5805
5799 5806 * IPython/Logger.py (Logger.log): Fixed a nasty bug which could
5800 5807 crash embedded instances because of the input cache falling out of
5801 5808 sync with the output counter.
5802 5809
5803 5810 * IPython/Shell.py (IPythonShellEmbed.__init__): added a debug
5804 5811 mode which calls pdb after an uncaught exception in IPython itself.
5805 5812
5806 5813 2002-04-14 Fernando Perez <fperez@colorado.edu>
5807 5814
5808 5815 * IPython/iplib.py (InteractiveShell.showtraceback): pdb mucks up
5809 5816 readline, fix it back after each call.
5810 5817
5811 5818 * IPython/ultraTB.py (AutoFormattedTB.__text): made text a private
5812 5819 method to force all access via __call__(), which guarantees that
5813 5820 traceback references are properly deleted.
5814 5821
5815 5822 * IPython/Prompts.py (CachedOutput._display): minor fixes to
5816 5823 improve printing when pprint is in use.
5817 5824
5818 5825 2002-04-13 Fernando Perez <fperez@colorado.edu>
5819 5826
5820 5827 * IPython/Shell.py (IPythonShellEmbed.__call__): SystemExit
5821 5828 exceptions aren't caught anymore. If the user triggers one, he
5822 5829 should know why he's doing it and it should go all the way up,
5823 5830 just like any other exception. So now @abort will fully kill the
5824 5831 embedded interpreter and the embedding code (unless that happens
5825 5832 to catch SystemExit).
5826 5833
5827 5834 * IPython/ultraTB.py (VerboseTB.__init__): added a call_pdb flag
5828 5835 and a debugger() method to invoke the interactive pdb debugger
5829 5836 after printing exception information. Also added the corresponding
5830 5837 -pdb option and @pdb magic to control this feature, and updated
5831 5838 the docs. After a suggestion from Christopher Hart
5832 5839 (hart-AT-caltech.edu).
5833 5840
5834 5841 2002-04-12 Fernando Perez <fperez@colorado.edu>
5835 5842
5836 5843 * IPython/Shell.py (IPythonShellEmbed.__init__): modified to use
5837 5844 the exception handlers defined by the user (not the CrashHandler)
5838 5845 so that user exceptions don't trigger an ipython bug report.
5839 5846
5840 5847 * IPython/ultraTB.py (ColorTB.__init__): made the color scheme
5841 5848 configurable (it should have always been so).
5842 5849
5843 5850 2002-03-26 Fernando Perez <fperez@colorado.edu>
5844 5851
5845 5852 * IPython/Shell.py (IPythonShellEmbed.__call__): many changes here
5846 5853 and there to fix embedding namespace issues. This should all be
5847 5854 done in a more elegant way.
5848 5855
5849 5856 2002-03-25 Fernando Perez <fperez@colorado.edu>
5850 5857
5851 5858 * IPython/genutils.py (get_home_dir): Try to make it work under
5852 5859 win9x also.
5853 5860
5854 5861 2002-03-20 Fernando Perez <fperez@colorado.edu>
5855 5862
5856 5863 * IPython/Shell.py (IPythonShellEmbed.__init__): leave
5857 5864 sys.displayhook untouched upon __init__.
5858 5865
5859 5866 2002-03-19 Fernando Perez <fperez@colorado.edu>
5860 5867
5861 5868 * Released 0.2.9 (for embedding bug, basically).
5862 5869
5863 5870 * IPython/Shell.py (IPythonShellEmbed.__call__): Trap SystemExit
5864 5871 exceptions so that enclosing shell's state can be restored.
5865 5872
5866 5873 * Changed magic_gnuplot.py to magic-gnuplot.py to standardize
5867 5874 naming conventions in the .ipython/ dir.
5868 5875
5869 5876 * IPython/iplib.py (InteractiveShell.init_readline): removed '-'
5870 5877 from delimiters list so filenames with - in them get expanded.
5871 5878
5872 5879 * IPython/Shell.py (IPythonShellEmbed.__call__): fixed bug with
5873 5880 sys.displayhook not being properly restored after an embedded call.
5874 5881
5875 5882 2002-03-18 Fernando Perez <fperez@colorado.edu>
5876 5883
5877 5884 * Released 0.2.8
5878 5885
5879 5886 * IPython/iplib.py (InteractiveShell.user_setup): fixed bug where
5880 5887 some files weren't being included in a -upgrade.
5881 5888 (InteractiveShell.init_readline): Added 'set show-all-if-ambiguous
5882 5889 on' so that the first tab completes.
5883 5890 (InteractiveShell.handle_magic): fixed bug with spaces around
5884 5891 quotes breaking many magic commands.
5885 5892
5886 5893 * setup.py: added note about ignoring the syntax error messages at
5887 5894 installation.
5888 5895
5889 5896 * IPython/UserConfig/magic_gnuplot.py (magic_gp): finished
5890 5897 streamlining the gnuplot interface, now there's only one magic @gp.
5891 5898
5892 5899 2002-03-17 Fernando Perez <fperez@colorado.edu>
5893 5900
5894 5901 * IPython/UserConfig/magic_gnuplot.py: new name for the
5895 5902 example-magic_pm.py file. Much enhanced system, now with a shell
5896 5903 for communicating directly with gnuplot, one command at a time.
5897 5904
5898 5905 * IPython/Magic.py (Magic.magic_run): added option -n to prevent
5899 5906 setting __name__=='__main__'.
5900 5907
5901 5908 * IPython/UserConfig/example-magic_pm.py (magic_pm): Added
5902 5909 mini-shell for accessing gnuplot from inside ipython. Should
5903 5910 extend it later for grace access too. Inspired by Arnd's
5904 5911 suggestion.
5905 5912
5906 5913 * IPython/iplib.py (InteractiveShell.handle_magic): fixed bug when
5907 5914 calling magic functions with () in their arguments. Thanks to Arnd
5908 5915 Baecker for pointing this to me.
5909 5916
5910 5917 * IPython/numutils.py (sum_flat): fixed bug. Would recurse
5911 5918 infinitely for integer or complex arrays (only worked with floats).
5912 5919
5913 5920 2002-03-16 Fernando Perez <fperez@colorado.edu>
5914 5921
5915 5922 * setup.py: Merged setup and setup_windows into a single script
5916 5923 which properly handles things for windows users.
5917 5924
5918 5925 2002-03-15 Fernando Perez <fperez@colorado.edu>
5919 5926
5920 5927 * Big change to the manual: now the magics are all automatically
5921 5928 documented. This information is generated from their docstrings
5922 5929 and put in a latex file included by the manual lyx file. This way
5923 5930 we get always up to date information for the magics. The manual
5924 5931 now also has proper version information, also auto-synced.
5925 5932
5926 5933 For this to work, an undocumented --magic_docstrings option was added.
5927 5934
5928 5935 2002-03-13 Fernando Perez <fperez@colorado.edu>
5929 5936
5930 5937 * IPython/ultraTB.py (TermColors): fixed problem with dark colors
5931 5938 under CDE terminals. An explicit ;2 color reset is needed in the escapes.
5932 5939
5933 5940 2002-03-12 Fernando Perez <fperez@colorado.edu>
5934 5941
5935 5942 * IPython/ultraTB.py (TermColors): changed color escapes again to
5936 5943 fix the (old, reintroduced) line-wrapping bug. Basically, if
5937 5944 \001..\002 aren't given in the color escapes, lines get wrapped
5938 5945 weirdly. But giving those screws up old xterms and emacs terms. So
5939 5946 I added some logic for emacs terms to be ok, but I can't identify old
5940 5947 xterms separately ($TERM=='xterm' for many terminals, like konsole).
5941 5948
5942 5949 2002-03-10 Fernando Perez <fperez@colorado.edu>
5943 5950
5944 5951 * IPython/usage.py (__doc__): Various documentation cleanups and
5945 5952 updates, both in usage docstrings and in the manual.
5946 5953
5947 5954 * IPython/Prompts.py (CachedOutput.set_colors): cleanups for
5948 5955 handling of caching. Set minimum acceptabe value for having a
5949 5956 cache at 20 values.
5950 5957
5951 5958 * IPython/iplib.py (InteractiveShell.user_setup): moved the
5952 5959 install_first_time function to a method, renamed it and added an
5953 5960 'upgrade' mode. Now people can update their config directory with
5954 5961 a simple command line switch (-upgrade, also new).
5955 5962
5956 5963 * IPython/Magic.py (Magic.magic_pfile): Made @pfile an alias to
5957 5964 @file (convenient for automagic users under Python >= 2.2).
5958 5965 Removed @files (it seemed more like a plural than an abbrev. of
5959 5966 'file show').
5960 5967
5961 5968 * IPython/iplib.py (install_first_time): Fixed crash if there were
5962 5969 backup files ('~') in .ipython/ install directory.
5963 5970
5964 5971 * IPython/ipmaker.py (make_IPython): fixes for new prompt
5965 5972 system. Things look fine, but these changes are fairly
5966 5973 intrusive. Test them for a few days.
5967 5974
5968 5975 * IPython/Prompts.py (CachedOutput.__init__): Massive rewrite of
5969 5976 the prompts system. Now all in/out prompt strings are user
5970 5977 controllable. This is particularly useful for embedding, as one
5971 5978 can tag embedded instances with particular prompts.
5972 5979
5973 5980 Also removed global use of sys.ps1/2, which now allows nested
5974 5981 embeddings without any problems. Added command-line options for
5975 5982 the prompt strings.
5976 5983
5977 5984 2002-03-08 Fernando Perez <fperez@colorado.edu>
5978 5985
5979 5986 * IPython/UserConfig/example-embed-short.py (ipshell): added
5980 5987 example file with the bare minimum code for embedding.
5981 5988
5982 5989 * IPython/Shell.py (IPythonShellEmbed.set_dummy_mode): added
5983 5990 functionality for the embeddable shell to be activated/deactivated
5984 5991 either globally or at each call.
5985 5992
5986 5993 * IPython/Prompts.py (Prompt1.auto_rewrite): Fixes the problem of
5987 5994 rewriting the prompt with '--->' for auto-inputs with proper
5988 5995 coloring. Now the previous UGLY hack in handle_auto() is gone, and
5989 5996 this is handled by the prompts class itself, as it should.
5990 5997
5991 5998 2002-03-05 Fernando Perez <fperez@colorado.edu>
5992 5999
5993 6000 * IPython/Magic.py (Magic.magic_logstart): Changed @log to
5994 6001 @logstart to avoid name clashes with the math log function.
5995 6002
5996 6003 * Big updates to X/Emacs section of the manual.
5997 6004
5998 6005 * Removed ipython_emacs. Milan explained to me how to pass
5999 6006 arguments to ipython through Emacs. Some day I'm going to end up
6000 6007 learning some lisp...
6001 6008
6002 6009 2002-03-04 Fernando Perez <fperez@colorado.edu>
6003 6010
6004 6011 * IPython/ipython_emacs: Created script to be used as the
6005 6012 py-python-command Emacs variable so we can pass IPython
6006 6013 parameters. I can't figure out how to tell Emacs directly to pass
6007 6014 parameters to IPython, so a dummy shell script will do it.
6008 6015
6009 6016 Other enhancements made for things to work better under Emacs'
6010 6017 various types of terminals. Many thanks to Milan Zamazal
6011 6018 <pdm-AT-zamazal.org> for all the suggestions and pointers.
6012 6019
6013 6020 2002-03-01 Fernando Perez <fperez@colorado.edu>
6014 6021
6015 6022 * IPython/ipmaker.py (make_IPython): added a --readline! option so
6016 6023 that loading of readline is now optional. This gives better
6017 6024 control to emacs users.
6018 6025
6019 6026 * IPython/ultraTB.py (__date__): Modified color escape sequences
6020 6027 and now things work fine under xterm and in Emacs' term buffers
6021 6028 (though not shell ones). Well, in emacs you get colors, but all
6022 6029 seem to be 'light' colors (no difference between dark and light
6023 6030 ones). But the garbage chars are gone, and also in xterms. It
6024 6031 seems that now I'm using 'cleaner' ansi sequences.
6025 6032
6026 6033 2002-02-21 Fernando Perez <fperez@colorado.edu>
6027 6034
6028 6035 * Released 0.2.7 (mainly to publish the scoping fix).
6029 6036
6030 6037 * IPython/Logger.py (Logger.logstate): added. A corresponding
6031 6038 @logstate magic was created.
6032 6039
6033 6040 * IPython/Magic.py: fixed nested scoping problem under Python
6034 6041 2.1.x (automagic wasn't working).
6035 6042
6036 6043 2002-02-20 Fernando Perez <fperez@colorado.edu>
6037 6044
6038 6045 * Released 0.2.6.
6039 6046
6040 6047 * IPython/OutputTrap.py (OutputTrap.__init__): added a 'quiet'
6041 6048 option so that logs can come out without any headers at all.
6042 6049
6043 6050 * IPython/UserConfig/ipythonrc-scipy.py: created a profile for
6044 6051 SciPy.
6045 6052
6046 6053 * IPython/iplib.py (InteractiveShell.embed_mainloop): Changed so
6047 6054 that embedded IPython calls don't require vars() to be explicitly
6048 6055 passed. Now they are extracted from the caller's frame (code
6049 6056 snatched from Eric Jones' weave). Added better documentation to
6050 6057 the section on embedding and the example file.
6051 6058
6052 6059 * IPython/genutils.py (page): Changed so that under emacs, it just
6053 6060 prints the string. You can then page up and down in the emacs
6054 6061 buffer itself. This is how the builtin help() works.
6055 6062
6056 6063 * IPython/Prompts.py (CachedOutput.__call__): Fixed issue with
6057 6064 macro scoping: macros need to be executed in the user's namespace
6058 6065 to work as if they had been typed by the user.
6059 6066
6060 6067 * IPython/Magic.py (Magic.magic_macro): Changed macros so they
6061 6068 execute automatically (no need to type 'exec...'). They then
6062 6069 behave like 'true macros'. The printing system was also modified
6063 6070 for this to work.
6064 6071
6065 6072 2002-02-19 Fernando Perez <fperez@colorado.edu>
6066 6073
6067 6074 * IPython/genutils.py (page_file): new function for paging files
6068 6075 in an OS-independent way. Also necessary for file viewing to work
6069 6076 well inside Emacs buffers.
6070 6077 (page): Added checks for being in an emacs buffer.
6071 6078 (page): fixed bug for Windows ($TERM isn't set in Windows). Fixed
6072 6079 same bug in iplib.
6073 6080
6074 6081 2002-02-18 Fernando Perez <fperez@colorado.edu>
6075 6082
6076 6083 * IPython/iplib.py (InteractiveShell.init_readline): modified use
6077 6084 of readline so that IPython can work inside an Emacs buffer.
6078 6085
6079 6086 * IPython/ultraTB.py (AutoFormattedTB.__call__): some fixes to
6080 6087 method signatures (they weren't really bugs, but it looks cleaner
6081 6088 and keeps PyChecker happy).
6082 6089
6083 6090 * IPython/ipmaker.py (make_IPython): added hooks Struct to __IP
6084 6091 for implementing various user-defined hooks. Currently only
6085 6092 display is done.
6086 6093
6087 6094 * IPython/Prompts.py (CachedOutput._display): changed display
6088 6095 functions so that they can be dynamically changed by users easily.
6089 6096
6090 6097 * IPython/Extensions/numeric_formats.py (num_display): added an
6091 6098 extension for printing NumPy arrays in flexible manners. It
6092 6099 doesn't do anything yet, but all the structure is in
6093 6100 place. Ultimately the plan is to implement output format control
6094 6101 like in Octave.
6095 6102
6096 6103 * IPython/Magic.py (Magic.lsmagic): changed so that bound magic
6097 6104 methods are found at run-time by all the automatic machinery.
6098 6105
6099 6106 2002-02-17 Fernando Perez <fperez@colorado.edu>
6100 6107
6101 6108 * setup_Windows.py (make_shortcut): documented. Cleaned up the
6102 6109 whole file a little.
6103 6110
6104 6111 * ToDo: closed this document. Now there's a new_design.lyx
6105 6112 document for all new ideas. Added making a pdf of it for the
6106 6113 end-user distro.
6107 6114
6108 6115 * IPython/Logger.py (Logger.switch_log): Created this to replace
6109 6116 logon() and logoff(). It also fixes a nasty crash reported by
6110 6117 Philip Hisley <compsys-AT-starpower.net>. Many thanks to him.
6111 6118
6112 6119 * IPython/iplib.py (complete): got auto-completion to work with
6113 6120 automagic (I had wanted this for a long time).
6114 6121
6115 6122 * IPython/Magic.py (Magic.magic_files): Added @files as an alias
6116 6123 to @file, since file() is now a builtin and clashes with automagic
6117 6124 for @file.
6118 6125
6119 6126 * Made some new files: Prompts, CrashHandler, Magic, Logger. All
6120 6127 of this was previously in iplib, which had grown to more than 2000
6121 6128 lines, way too long. No new functionality, but it makes managing
6122 6129 the code a bit easier.
6123 6130
6124 6131 * IPython/iplib.py (IPythonCrashHandler.__call__): Added version
6125 6132 information to crash reports.
6126 6133
6127 6134 2002-02-12 Fernando Perez <fperez@colorado.edu>
6128 6135
6129 6136 * Released 0.2.5.
6130 6137
6131 6138 2002-02-11 Fernando Perez <fperez@colorado.edu>
6132 6139
6133 6140 * Wrote a relatively complete Windows installer. It puts
6134 6141 everything in place, creates Start Menu entries and fixes the
6135 6142 color issues. Nothing fancy, but it works.
6136 6143
6137 6144 2002-02-10 Fernando Perez <fperez@colorado.edu>
6138 6145
6139 6146 * IPython/iplib.py (InteractiveShell.safe_execfile): added an
6140 6147 os.path.expanduser() call so that we can type @run ~/myfile.py and
6141 6148 have thigs work as expected.
6142 6149
6143 6150 * IPython/genutils.py (page): fixed exception handling so things
6144 6151 work both in Unix and Windows correctly. Quitting a pager triggers
6145 6152 an IOError/broken pipe in Unix, and in windows not finding a pager
6146 6153 is also an IOError, so I had to actually look at the return value
6147 6154 of the exception, not just the exception itself. Should be ok now.
6148 6155
6149 6156 * IPython/ultraTB.py (ColorSchemeTable.set_active_scheme):
6150 6157 modified to allow case-insensitive color scheme changes.
6151 6158
6152 6159 2002-02-09 Fernando Perez <fperez@colorado.edu>
6153 6160
6154 6161 * IPython/genutils.py (native_line_ends): new function to leave
6155 6162 user config files with os-native line-endings.
6156 6163
6157 6164 * README and manual updates.
6158 6165
6159 6166 * IPython/genutils.py: fixed unicode bug: use types.StringTypes
6160 6167 instead of StringType to catch Unicode strings.
6161 6168
6162 6169 * IPython/genutils.py (filefind): fixed bug for paths with
6163 6170 embedded spaces (very common in Windows).
6164 6171
6165 6172 * IPython/ipmaker.py (make_IPython): added a '.ini' to the rc
6166 6173 files under Windows, so that they get automatically associated
6167 6174 with a text editor. Windows makes it a pain to handle
6168 6175 extension-less files.
6169 6176
6170 6177 * IPython/iplib.py (InteractiveShell.init_readline): Made the
6171 6178 warning about readline only occur for Posix. In Windows there's no
6172 6179 way to get readline, so why bother with the warning.
6173 6180
6174 6181 * IPython/Struct.py (Struct.__str__): fixed to use self.__dict__
6175 6182 for __str__ instead of dir(self), since dir() changed in 2.2.
6176 6183
6177 6184 * Ported to Windows! Tested on XP, I suspect it should work fine
6178 6185 on NT/2000, but I don't think it will work on 98 et al. That
6179 6186 series of Windows is such a piece of junk anyway that I won't try
6180 6187 porting it there. The XP port was straightforward, showed a few
6181 6188 bugs here and there (fixed all), in particular some string
6182 6189 handling stuff which required considering Unicode strings (which
6183 6190 Windows uses). This is good, but hasn't been too tested :) No
6184 6191 fancy installer yet, I'll put a note in the manual so people at
6185 6192 least make manually a shortcut.
6186 6193
6187 6194 * IPython/iplib.py (Magic.magic_colors): Unified the color options
6188 6195 into a single one, "colors". This now controls both prompt and
6189 6196 exception color schemes, and can be changed both at startup
6190 6197 (either via command-line switches or via ipythonrc files) and at
6191 6198 runtime, with @colors.
6192 6199 (Magic.magic_run): renamed @prun to @run and removed the old
6193 6200 @run. The two were too similar to warrant keeping both.
6194 6201
6195 6202 2002-02-03 Fernando Perez <fperez@colorado.edu>
6196 6203
6197 6204 * IPython/iplib.py (install_first_time): Added comment on how to
6198 6205 configure the color options for first-time users. Put a <return>
6199 6206 request at the end so that small-terminal users get a chance to
6200 6207 read the startup info.
6201 6208
6202 6209 2002-01-23 Fernando Perez <fperez@colorado.edu>
6203 6210
6204 6211 * IPython/iplib.py (CachedOutput.update): Changed output memory
6205 6212 variable names from _o,_oo,_ooo,_o<n> to simply _,__,___,_<n>. For
6206 6213 input history we still use _i. Did this b/c these variable are
6207 6214 very commonly used in interactive work, so the less we need to
6208 6215 type the better off we are.
6209 6216 (Magic.magic_prun): updated @prun to better handle the namespaces
6210 6217 the file will run in, including a fix for __name__ not being set
6211 6218 before.
6212 6219
6213 6220 2002-01-20 Fernando Perez <fperez@colorado.edu>
6214 6221
6215 6222 * IPython/ultraTB.py (VerboseTB.linereader): Fixed printing of
6216 6223 extra garbage for Python 2.2. Need to look more carefully into
6217 6224 this later.
6218 6225
6219 6226 2002-01-19 Fernando Perez <fperez@colorado.edu>
6220 6227
6221 6228 * IPython/iplib.py (InteractiveShell.showtraceback): fixed to
6222 6229 display SyntaxError exceptions properly formatted when they occur
6223 6230 (they can be triggered by imported code).
6224 6231
6225 6232 2002-01-18 Fernando Perez <fperez@colorado.edu>
6226 6233
6227 6234 * IPython/iplib.py (InteractiveShell.safe_execfile): now
6228 6235 SyntaxError exceptions are reported nicely formatted, instead of
6229 6236 spitting out only offset information as before.
6230 6237 (Magic.magic_prun): Added the @prun function for executing
6231 6238 programs with command line args inside IPython.
6232 6239
6233 6240 2002-01-16 Fernando Perez <fperez@colorado.edu>
6234 6241
6235 6242 * IPython/iplib.py (Magic.magic_hist): Changed @hist and @dhist
6236 6243 to *not* include the last item given in a range. This brings their
6237 6244 behavior in line with Python's slicing:
6238 6245 a[n1:n2] -> a[n1]...a[n2-1]
6239 6246 It may be a bit less convenient, but I prefer to stick to Python's
6240 6247 conventions *everywhere*, so users never have to wonder.
6241 6248 (Magic.magic_macro): Added @macro function to ease the creation of
6242 6249 macros.
6243 6250
6244 6251 2002-01-05 Fernando Perez <fperez@colorado.edu>
6245 6252
6246 6253 * Released 0.2.4.
6247 6254
6248 6255 * IPython/iplib.py (Magic.magic_pdef):
6249 6256 (InteractiveShell.safe_execfile): report magic lines and error
6250 6257 lines without line numbers so one can easily copy/paste them for
6251 6258 re-execution.
6252 6259
6253 6260 * Updated manual with recent changes.
6254 6261
6255 6262 * IPython/iplib.py (Magic.magic_oinfo): added constructor
6256 6263 docstring printing when class? is called. Very handy for knowing
6257 6264 how to create class instances (as long as __init__ is well
6258 6265 documented, of course :)
6259 6266 (Magic.magic_doc): print both class and constructor docstrings.
6260 6267 (Magic.magic_pdef): give constructor info if passed a class and
6261 6268 __call__ info for callable object instances.
6262 6269
6263 6270 2002-01-04 Fernando Perez <fperez@colorado.edu>
6264 6271
6265 6272 * Made deep_reload() off by default. It doesn't always work
6266 6273 exactly as intended, so it's probably safer to have it off. It's
6267 6274 still available as dreload() anyway, so nothing is lost.
6268 6275
6269 6276 2002-01-02 Fernando Perez <fperez@colorado.edu>
6270 6277
6271 6278 * Released 0.2.3 (contacted R.Singh at CU about biopython course,
6272 6279 so I wanted an updated release).
6273 6280
6274 6281 2001-12-27 Fernando Perez <fperez@colorado.edu>
6275 6282
6276 6283 * IPython/iplib.py (InteractiveShell.interact): Added the original
6277 6284 code from 'code.py' for this module in order to change the
6278 6285 handling of a KeyboardInterrupt. This was necessary b/c otherwise
6279 6286 the history cache would break when the user hit Ctrl-C, and
6280 6287 interact() offers no way to add any hooks to it.
6281 6288
6282 6289 2001-12-23 Fernando Perez <fperez@colorado.edu>
6283 6290
6284 6291 * setup.py: added check for 'MANIFEST' before trying to remove
6285 6292 it. Thanks to Sean Reifschneider.
6286 6293
6287 6294 2001-12-22 Fernando Perez <fperez@colorado.edu>
6288 6295
6289 6296 * Released 0.2.2.
6290 6297
6291 6298 * Finished (reasonably) writing the manual. Later will add the
6292 6299 python-standard navigation stylesheets, but for the time being
6293 6300 it's fairly complete. Distribution will include html and pdf
6294 6301 versions.
6295 6302
6296 6303 * Bugfix: '.' wasn't being added to sys.path. Thanks to Prabhu
6297 6304 (MayaVi author).
6298 6305
6299 6306 2001-12-21 Fernando Perez <fperez@colorado.edu>
6300 6307
6301 6308 * Released 0.2.1. Barring any nasty bugs, this is it as far as a
6302 6309 good public release, I think (with the manual and the distutils
6303 6310 installer). The manual can use some work, but that can go
6304 6311 slowly. Otherwise I think it's quite nice for end users. Next
6305 6312 summer, rewrite the guts of it...
6306 6313
6307 6314 * Changed format of ipythonrc files to use whitespace as the
6308 6315 separator instead of an explicit '='. Cleaner.
6309 6316
6310 6317 2001-12-20 Fernando Perez <fperez@colorado.edu>
6311 6318
6312 6319 * Started a manual in LyX. For now it's just a quick merge of the
6313 6320 various internal docstrings and READMEs. Later it may grow into a
6314 6321 nice, full-blown manual.
6315 6322
6316 6323 * Set up a distutils based installer. Installation should now be
6317 6324 trivially simple for end-users.
6318 6325
6319 6326 2001-12-11 Fernando Perez <fperez@colorado.edu>
6320 6327
6321 6328 * Released 0.2.0. First public release, announced it at
6322 6329 comp.lang.python. From now on, just bugfixes...
6323 6330
6324 6331 * Went through all the files, set copyright/license notices and
6325 6332 cleaned up things. Ready for release.
6326 6333
6327 6334 2001-12-10 Fernando Perez <fperez@colorado.edu>
6328 6335
6329 6336 * Changed the first-time installer not to use tarfiles. It's more
6330 6337 robust now and less unix-dependent. Also makes it easier for
6331 6338 people to later upgrade versions.
6332 6339
6333 6340 * Changed @exit to @abort to reflect the fact that it's pretty
6334 6341 brutal (a sys.exit()). The difference between @abort and Ctrl-D
6335 6342 becomes significant only when IPyhton is embedded: in that case,
6336 6343 C-D closes IPython only, but @abort kills the enclosing program
6337 6344 too (unless it had called IPython inside a try catching
6338 6345 SystemExit).
6339 6346
6340 6347 * Created Shell module which exposes the actuall IPython Shell
6341 6348 classes, currently the normal and the embeddable one. This at
6342 6349 least offers a stable interface we won't need to change when
6343 6350 (later) the internals are rewritten. That rewrite will be confined
6344 6351 to iplib and ipmaker, but the Shell interface should remain as is.
6345 6352
6346 6353 * Added embed module which offers an embeddable IPShell object,
6347 6354 useful to fire up IPython *inside* a running program. Great for
6348 6355 debugging or dynamical data analysis.
6349 6356
6350 6357 2001-12-08 Fernando Perez <fperez@colorado.edu>
6351 6358
6352 6359 * Fixed small bug preventing seeing info from methods of defined
6353 6360 objects (incorrect namespace in _ofind()).
6354 6361
6355 6362 * Documentation cleanup. Moved the main usage docstrings to a
6356 6363 separate file, usage.py (cleaner to maintain, and hopefully in the
6357 6364 future some perlpod-like way of producing interactive, man and
6358 6365 html docs out of it will be found).
6359 6366
6360 6367 * Added @profile to see your profile at any time.
6361 6368
6362 6369 * Added @p as an alias for 'print'. It's especially convenient if
6363 6370 using automagic ('p x' prints x).
6364 6371
6365 6372 * Small cleanups and fixes after a pychecker run.
6366 6373
6367 6374 * Changed the @cd command to handle @cd - and @cd -<n> for
6368 6375 visiting any directory in _dh.
6369 6376
6370 6377 * Introduced _dh, a history of visited directories. @dhist prints
6371 6378 it out with numbers.
6372 6379
6373 6380 2001-12-07 Fernando Perez <fperez@colorado.edu>
6374 6381
6375 6382 * Released 0.1.22
6376 6383
6377 6384 * Made initialization a bit more robust against invalid color
6378 6385 options in user input (exit, not traceback-crash).
6379 6386
6380 6387 * Changed the bug crash reporter to write the report only in the
6381 6388 user's .ipython directory. That way IPython won't litter people's
6382 6389 hard disks with crash files all over the place. Also print on
6383 6390 screen the necessary mail command.
6384 6391
6385 6392 * With the new ultraTB, implemented LightBG color scheme for light
6386 6393 background terminals. A lot of people like white backgrounds, so I
6387 6394 guess we should at least give them something readable.
6388 6395
6389 6396 2001-12-06 Fernando Perez <fperez@colorado.edu>
6390 6397
6391 6398 * Modified the structure of ultraTB. Now there's a proper class
6392 6399 for tables of color schemes which allow adding schemes easily and
6393 6400 switching the active scheme without creating a new instance every
6394 6401 time (which was ridiculous). The syntax for creating new schemes
6395 6402 is also cleaner. I think ultraTB is finally done, with a clean
6396 6403 class structure. Names are also much cleaner (now there's proper
6397 6404 color tables, no need for every variable to also have 'color' in
6398 6405 its name).
6399 6406
6400 6407 * Broke down genutils into separate files. Now genutils only
6401 6408 contains utility functions, and classes have been moved to their
6402 6409 own files (they had enough independent functionality to warrant
6403 6410 it): ConfigLoader, OutputTrap, Struct.
6404 6411
6405 6412 2001-12-05 Fernando Perez <fperez@colorado.edu>
6406 6413
6407 6414 * IPython turns 21! Released version 0.1.21, as a candidate for
6408 6415 public consumption. If all goes well, release in a few days.
6409 6416
6410 6417 * Fixed path bug (files in Extensions/ directory wouldn't be found
6411 6418 unless IPython/ was explicitly in sys.path).
6412 6419
6413 6420 * Extended the FlexCompleter class as MagicCompleter to allow
6414 6421 completion of @-starting lines.
6415 6422
6416 6423 * Created __release__.py file as a central repository for release
6417 6424 info that other files can read from.
6418 6425
6419 6426 * Fixed small bug in logging: when logging was turned on in
6420 6427 mid-session, old lines with special meanings (!@?) were being
6421 6428 logged without the prepended comment, which is necessary since
6422 6429 they are not truly valid python syntax. This should make session
6423 6430 restores produce less errors.
6424 6431
6425 6432 * The namespace cleanup forced me to make a FlexCompleter class
6426 6433 which is nothing but a ripoff of rlcompleter, but with selectable
6427 6434 namespace (rlcompleter only works in __main__.__dict__). I'll try
6428 6435 to submit a note to the authors to see if this change can be
6429 6436 incorporated in future rlcompleter releases (Dec.6: done)
6430 6437
6431 6438 * More fixes to namespace handling. It was a mess! Now all
6432 6439 explicit references to __main__.__dict__ are gone (except when
6433 6440 really needed) and everything is handled through the namespace
6434 6441 dicts in the IPython instance. We seem to be getting somewhere
6435 6442 with this, finally...
6436 6443
6437 6444 * Small documentation updates.
6438 6445
6439 6446 * Created the Extensions directory under IPython (with an
6440 6447 __init__.py). Put the PhysicalQ stuff there. This directory should
6441 6448 be used for all special-purpose extensions.
6442 6449
6443 6450 * File renaming:
6444 6451 ipythonlib --> ipmaker
6445 6452 ipplib --> iplib
6446 6453 This makes a bit more sense in terms of what these files actually do.
6447 6454
6448 6455 * Moved all the classes and functions in ipythonlib to ipplib, so
6449 6456 now ipythonlib only has make_IPython(). This will ease up its
6450 6457 splitting in smaller functional chunks later.
6451 6458
6452 6459 * Cleaned up (done, I think) output of @whos. Better column
6453 6460 formatting, and now shows str(var) for as much as it can, which is
6454 6461 typically what one gets with a 'print var'.
6455 6462
6456 6463 2001-12-04 Fernando Perez <fperez@colorado.edu>
6457 6464
6458 6465 * Fixed namespace problems. Now builtin/IPyhton/user names get
6459 6466 properly reported in their namespace. Internal namespace handling
6460 6467 is finally getting decent (not perfect yet, but much better than
6461 6468 the ad-hoc mess we had).
6462 6469
6463 6470 * Removed -exit option. If people just want to run a python
6464 6471 script, that's what the normal interpreter is for. Less
6465 6472 unnecessary options, less chances for bugs.
6466 6473
6467 6474 * Added a crash handler which generates a complete post-mortem if
6468 6475 IPython crashes. This will help a lot in tracking bugs down the
6469 6476 road.
6470 6477
6471 6478 * Fixed nasty bug in auto-evaluation part of prefilter(). Names
6472 6479 which were boud to functions being reassigned would bypass the
6473 6480 logger, breaking the sync of _il with the prompt counter. This
6474 6481 would then crash IPython later when a new line was logged.
6475 6482
6476 6483 2001-12-02 Fernando Perez <fperez@colorado.edu>
6477 6484
6478 6485 * Made IPython a package. This means people don't have to clutter
6479 6486 their sys.path with yet another directory. Changed the INSTALL
6480 6487 file accordingly.
6481 6488
6482 6489 * Cleaned up the output of @who_ls, @who and @whos. @who_ls now
6483 6490 sorts its output (so @who shows it sorted) and @whos formats the
6484 6491 table according to the width of the first column. Nicer, easier to
6485 6492 read. Todo: write a generic table_format() which takes a list of
6486 6493 lists and prints it nicely formatted, with optional row/column
6487 6494 separators and proper padding and justification.
6488 6495
6489 6496 * Released 0.1.20
6490 6497
6491 6498 * Fixed bug in @log which would reverse the inputcache list (a
6492 6499 copy operation was missing).
6493 6500
6494 6501 * Code cleanup. @config was changed to use page(). Better, since
6495 6502 its output is always quite long.
6496 6503
6497 6504 * Itpl is back as a dependency. I was having too many problems
6498 6505 getting the parametric aliases to work reliably, and it's just
6499 6506 easier to code weird string operations with it than playing %()s
6500 6507 games. It's only ~6k, so I don't think it's too big a deal.
6501 6508
6502 6509 * Found (and fixed) a very nasty bug with history. !lines weren't
6503 6510 getting cached, and the out of sync caches would crash
6504 6511 IPython. Fixed it by reorganizing the prefilter/handlers/logger
6505 6512 division of labor a bit better. Bug fixed, cleaner structure.
6506 6513
6507 6514 2001-12-01 Fernando Perez <fperez@colorado.edu>
6508 6515
6509 6516 * Released 0.1.19
6510 6517
6511 6518 * Added option -n to @hist to prevent line number printing. Much
6512 6519 easier to copy/paste code this way.
6513 6520
6514 6521 * Created global _il to hold the input list. Allows easy
6515 6522 re-execution of blocks of code by slicing it (inspired by Janko's
6516 6523 comment on 'macros').
6517 6524
6518 6525 * Small fixes and doc updates.
6519 6526
6520 6527 * Rewrote @history function (was @h). Renamed it to @hist, @h is
6521 6528 much too fragile with automagic. Handles properly multi-line
6522 6529 statements and takes parameters.
6523 6530
6524 6531 2001-11-30 Fernando Perez <fperez@colorado.edu>
6525 6532
6526 6533 * Version 0.1.18 released.
6527 6534
6528 6535 * Fixed nasty namespace bug in initial module imports.
6529 6536
6530 6537 * Added copyright/license notes to all code files (except
6531 6538 DPyGetOpt). For the time being, LGPL. That could change.
6532 6539
6533 6540 * Rewrote a much nicer README, updated INSTALL, cleaned up
6534 6541 ipythonrc-* samples.
6535 6542
6536 6543 * Overall code/documentation cleanup. Basically ready for
6537 6544 release. Only remaining thing: licence decision (LGPL?).
6538 6545
6539 6546 * Converted load_config to a class, ConfigLoader. Now recursion
6540 6547 control is better organized. Doesn't include the same file twice.
6541 6548
6542 6549 2001-11-29 Fernando Perez <fperez@colorado.edu>
6543 6550
6544 6551 * Got input history working. Changed output history variables from
6545 6552 _p to _o so that _i is for input and _o for output. Just cleaner
6546 6553 convention.
6547 6554
6548 6555 * Implemented parametric aliases. This pretty much allows the
6549 6556 alias system to offer full-blown shell convenience, I think.
6550 6557
6551 6558 * Version 0.1.17 released, 0.1.18 opened.
6552 6559
6553 6560 * dot_ipython/ipythonrc (alias): added documentation.
6554 6561 (xcolor): Fixed small bug (xcolors -> xcolor)
6555 6562
6556 6563 * Changed the alias system. Now alias is a magic command to define
6557 6564 aliases just like the shell. Rationale: the builtin magics should
6558 6565 be there for things deeply connected to IPython's
6559 6566 architecture. And this is a much lighter system for what I think
6560 6567 is the really important feature: allowing users to define quickly
6561 6568 magics that will do shell things for them, so they can customize
6562 6569 IPython easily to match their work habits. If someone is really
6563 6570 desperate to have another name for a builtin alias, they can
6564 6571 always use __IP.magic_newname = __IP.magic_oldname. Hackish but
6565 6572 works.
6566 6573
6567 6574 2001-11-28 Fernando Perez <fperez@colorado.edu>
6568 6575
6569 6576 * Changed @file so that it opens the source file at the proper
6570 6577 line. Since it uses less, if your EDITOR environment is
6571 6578 configured, typing v will immediately open your editor of choice
6572 6579 right at the line where the object is defined. Not as quick as
6573 6580 having a direct @edit command, but for all intents and purposes it
6574 6581 works. And I don't have to worry about writing @edit to deal with
6575 6582 all the editors, less does that.
6576 6583
6577 6584 * Version 0.1.16 released, 0.1.17 opened.
6578 6585
6579 6586 * Fixed some nasty bugs in the page/page_dumb combo that could
6580 6587 crash IPython.
6581 6588
6582 6589 2001-11-27 Fernando Perez <fperez@colorado.edu>
6583 6590
6584 6591 * Version 0.1.15 released, 0.1.16 opened.
6585 6592
6586 6593 * Finally got ? and ?? to work for undefined things: now it's
6587 6594 possible to type {}.get? and get information about the get method
6588 6595 of dicts, or os.path? even if only os is defined (so technically
6589 6596 os.path isn't). Works at any level. For example, after import os,
6590 6597 os?, os.path?, os.path.abspath? all work. This is great, took some
6591 6598 work in _ofind.
6592 6599
6593 6600 * Fixed more bugs with logging. The sanest way to do it was to add
6594 6601 to @log a 'mode' parameter. Killed two in one shot (this mode
6595 6602 option was a request of Janko's). I think it's finally clean
6596 6603 (famous last words).
6597 6604
6598 6605 * Added a page_dumb() pager which does a decent job of paging on
6599 6606 screen, if better things (like less) aren't available. One less
6600 6607 unix dependency (someday maybe somebody will port this to
6601 6608 windows).
6602 6609
6603 6610 * Fixed problem in magic_log: would lock of logging out if log
6604 6611 creation failed (because it would still think it had succeeded).
6605 6612
6606 6613 * Improved the page() function using curses to auto-detect screen
6607 6614 size. Now it can make a much better decision on whether to print
6608 6615 or page a string. Option screen_length was modified: a value 0
6609 6616 means auto-detect, and that's the default now.
6610 6617
6611 6618 * Version 0.1.14 released, 0.1.15 opened. I think this is ready to
6612 6619 go out. I'll test it for a few days, then talk to Janko about
6613 6620 licences and announce it.
6614 6621
6615 6622 * Fixed the length of the auto-generated ---> prompt which appears
6616 6623 for auto-parens and auto-quotes. Getting this right isn't trivial,
6617 6624 with all the color escapes, different prompt types and optional
6618 6625 separators. But it seems to be working in all the combinations.
6619 6626
6620 6627 2001-11-26 Fernando Perez <fperez@colorado.edu>
6621 6628
6622 6629 * Wrote a regexp filter to get option types from the option names
6623 6630 string. This eliminates the need to manually keep two duplicate
6624 6631 lists.
6625 6632
6626 6633 * Removed the unneeded check_option_names. Now options are handled
6627 6634 in a much saner manner and it's easy to visually check that things
6628 6635 are ok.
6629 6636
6630 6637 * Updated version numbers on all files I modified to carry a
6631 6638 notice so Janko and Nathan have clear version markers.
6632 6639
6633 6640 * Updated docstring for ultraTB with my changes. I should send
6634 6641 this to Nathan.
6635 6642
6636 6643 * Lots of small fixes. Ran everything through pychecker again.
6637 6644
6638 6645 * Made loading of deep_reload an cmd line option. If it's not too
6639 6646 kosher, now people can just disable it. With -nodeep_reload it's
6640 6647 still available as dreload(), it just won't overwrite reload().
6641 6648
6642 6649 * Moved many options to the no| form (-opt and -noopt
6643 6650 accepted). Cleaner.
6644 6651
6645 6652 * Changed magic_log so that if called with no parameters, it uses
6646 6653 'rotate' mode. That way auto-generated logs aren't automatically
6647 6654 over-written. For normal logs, now a backup is made if it exists
6648 6655 (only 1 level of backups). A new 'backup' mode was added to the
6649 6656 Logger class to support this. This was a request by Janko.
6650 6657
6651 6658 * Added @logoff/@logon to stop/restart an active log.
6652 6659
6653 6660 * Fixed a lot of bugs in log saving/replay. It was pretty
6654 6661 broken. Now special lines (!@,/) appear properly in the command
6655 6662 history after a log replay.
6656 6663
6657 6664 * Tried and failed to implement full session saving via pickle. My
6658 6665 idea was to pickle __main__.__dict__, but modules can't be
6659 6666 pickled. This would be a better alternative to replaying logs, but
6660 6667 seems quite tricky to get to work. Changed -session to be called
6661 6668 -logplay, which more accurately reflects what it does. And if we
6662 6669 ever get real session saving working, -session is now available.
6663 6670
6664 6671 * Implemented color schemes for prompts also. As for tracebacks,
6665 6672 currently only NoColor and Linux are supported. But now the
6666 6673 infrastructure is in place, based on a generic ColorScheme
6667 6674 class. So writing and activating new schemes both for the prompts
6668 6675 and the tracebacks should be straightforward.
6669 6676
6670 6677 * Version 0.1.13 released, 0.1.14 opened.
6671 6678
6672 6679 * Changed handling of options for output cache. Now counter is
6673 6680 hardwired starting at 1 and one specifies the maximum number of
6674 6681 entries *in the outcache* (not the max prompt counter). This is
6675 6682 much better, since many statements won't increase the cache
6676 6683 count. It also eliminated some confusing options, now there's only
6677 6684 one: cache_size.
6678 6685
6679 6686 * Added 'alias' magic function and magic_alias option in the
6680 6687 ipythonrc file. Now the user can easily define whatever names he
6681 6688 wants for the magic functions without having to play weird
6682 6689 namespace games. This gives IPython a real shell-like feel.
6683 6690
6684 6691 * Fixed doc/?/?? for magics. Now all work, in all forms (explicit
6685 6692 @ or not).
6686 6693
6687 6694 This was one of the last remaining 'visible' bugs (that I know
6688 6695 of). I think if I can clean up the session loading so it works
6689 6696 100% I'll release a 0.2.0 version on c.p.l (talk to Janko first
6690 6697 about licensing).
6691 6698
6692 6699 2001-11-25 Fernando Perez <fperez@colorado.edu>
6693 6700
6694 6701 * Rewrote somewhat oinfo (?/??). Nicer, now uses page() and
6695 6702 there's a cleaner distinction between what ? and ?? show.
6696 6703
6697 6704 * Added screen_length option. Now the user can define his own
6698 6705 screen size for page() operations.
6699 6706
6700 6707 * Implemented magic shell-like functions with automatic code
6701 6708 generation. Now adding another function is just a matter of adding
6702 6709 an entry to a dict, and the function is dynamically generated at
6703 6710 run-time. Python has some really cool features!
6704 6711
6705 6712 * Renamed many options to cleanup conventions a little. Now all
6706 6713 are lowercase, and only underscores where needed. Also in the code
6707 6714 option name tables are clearer.
6708 6715
6709 6716 * Changed prompts a little. Now input is 'In [n]:' instead of
6710 6717 'In[n]:='. This allows it the numbers to be aligned with the
6711 6718 Out[n] numbers, and removes usage of ':=' which doesn't exist in
6712 6719 Python (it was a Mathematica thing). The '...' continuation prompt
6713 6720 was also changed a little to align better.
6714 6721
6715 6722 * Fixed bug when flushing output cache. Not all _p<n> variables
6716 6723 exist, so their deletion needs to be wrapped in a try:
6717 6724
6718 6725 * Figured out how to properly use inspect.formatargspec() (it
6719 6726 requires the args preceded by *). So I removed all the code from
6720 6727 _get_pdef in Magic, which was just replicating that.
6721 6728
6722 6729 * Added test to prefilter to allow redefining magic function names
6723 6730 as variables. This is ok, since the @ form is always available,
6724 6731 but whe should allow the user to define a variable called 'ls' if
6725 6732 he needs it.
6726 6733
6727 6734 * Moved the ToDo information from README into a separate ToDo.
6728 6735
6729 6736 * General code cleanup and small bugfixes. I think it's close to a
6730 6737 state where it can be released, obviously with a big 'beta'
6731 6738 warning on it.
6732 6739
6733 6740 * Got the magic function split to work. Now all magics are defined
6734 6741 in a separate class. It just organizes things a bit, and now
6735 6742 Xemacs behaves nicer (it was choking on InteractiveShell b/c it
6736 6743 was too long).
6737 6744
6738 6745 * Changed @clear to @reset to avoid potential confusions with
6739 6746 the shell command clear. Also renamed @cl to @clear, which does
6740 6747 exactly what people expect it to from their shell experience.
6741 6748
6742 6749 Added a check to the @reset command (since it's so
6743 6750 destructive, it's probably a good idea to ask for confirmation).
6744 6751 But now reset only works for full namespace resetting. Since the
6745 6752 del keyword is already there for deleting a few specific
6746 6753 variables, I don't see the point of having a redundant magic
6747 6754 function for the same task.
6748 6755
6749 6756 2001-11-24 Fernando Perez <fperez@colorado.edu>
6750 6757
6751 6758 * Updated the builtin docs (esp. the ? ones).
6752 6759
6753 6760 * Ran all the code through pychecker. Not terribly impressed with
6754 6761 it: lots of spurious warnings and didn't really find anything of
6755 6762 substance (just a few modules being imported and not used).
6756 6763
6757 6764 * Implemented the new ultraTB functionality into IPython. New
6758 6765 option: xcolors. This chooses color scheme. xmode now only selects
6759 6766 between Plain and Verbose. Better orthogonality.
6760 6767
6761 6768 * Large rewrite of ultraTB. Much cleaner now, with a separation of
6762 6769 mode and color scheme for the exception handlers. Now it's
6763 6770 possible to have the verbose traceback with no coloring.
6764 6771
6765 6772 2001-11-23 Fernando Perez <fperez@colorado.edu>
6766 6773
6767 6774 * Version 0.1.12 released, 0.1.13 opened.
6768 6775
6769 6776 * Removed option to set auto-quote and auto-paren escapes by
6770 6777 user. The chances of breaking valid syntax are just too high. If
6771 6778 someone *really* wants, they can always dig into the code.
6772 6779
6773 6780 * Made prompt separators configurable.
6774 6781
6775 6782 2001-11-22 Fernando Perez <fperez@colorado.edu>
6776 6783
6777 6784 * Small bugfixes in many places.
6778 6785
6779 6786 * Removed the MyCompleter class from ipplib. It seemed redundant
6780 6787 with the C-p,C-n history search functionality. Less code to
6781 6788 maintain.
6782 6789
6783 6790 * Moved all the original ipython.py code into ipythonlib.py. Right
6784 6791 now it's just one big dump into a function called make_IPython, so
6785 6792 no real modularity has been gained. But at least it makes the
6786 6793 wrapper script tiny, and since ipythonlib is a module, it gets
6787 6794 compiled and startup is much faster.
6788 6795
6789 6796 This is a reasobably 'deep' change, so we should test it for a
6790 6797 while without messing too much more with the code.
6791 6798
6792 6799 2001-11-21 Fernando Perez <fperez@colorado.edu>
6793 6800
6794 6801 * Version 0.1.11 released, 0.1.12 opened for further work.
6795 6802
6796 6803 * Removed dependency on Itpl. It was only needed in one place. It
6797 6804 would be nice if this became part of python, though. It makes life
6798 6805 *a lot* easier in some cases.
6799 6806
6800 6807 * Simplified the prefilter code a bit. Now all handlers are
6801 6808 expected to explicitly return a value (at least a blank string).
6802 6809
6803 6810 * Heavy edits in ipplib. Removed the help system altogether. Now
6804 6811 obj?/?? is used for inspecting objects, a magic @doc prints
6805 6812 docstrings, and full-blown Python help is accessed via the 'help'
6806 6813 keyword. This cleans up a lot of code (less to maintain) and does
6807 6814 the job. Since 'help' is now a standard Python component, might as
6808 6815 well use it and remove duplicate functionality.
6809 6816
6810 6817 Also removed the option to use ipplib as a standalone program. By
6811 6818 now it's too dependent on other parts of IPython to function alone.
6812 6819
6813 6820 * Fixed bug in genutils.pager. It would crash if the pager was
6814 6821 exited immediately after opening (broken pipe).
6815 6822
6816 6823 * Trimmed down the VerboseTB reporting a little. The header is
6817 6824 much shorter now and the repeated exception arguments at the end
6818 6825 have been removed. For interactive use the old header seemed a bit
6819 6826 excessive.
6820 6827
6821 6828 * Fixed small bug in output of @whos for variables with multi-word
6822 6829 types (only first word was displayed).
6823 6830
6824 6831 2001-11-17 Fernando Perez <fperez@colorado.edu>
6825 6832
6826 6833 * Version 0.1.10 released, 0.1.11 opened for further work.
6827 6834
6828 6835 * Modified dirs and friends. dirs now *returns* the stack (not
6829 6836 prints), so one can manipulate it as a variable. Convenient to
6830 6837 travel along many directories.
6831 6838
6832 6839 * Fixed bug in magic_pdef: would only work with functions with
6833 6840 arguments with default values.
6834 6841
6835 6842 2001-11-14 Fernando Perez <fperez@colorado.edu>
6836 6843
6837 6844 * Added the PhysicsInput stuff to dot_ipython so it ships as an
6838 6845 example with IPython. Various other minor fixes and cleanups.
6839 6846
6840 6847 * Version 0.1.9 released, 0.1.10 opened for further work.
6841 6848
6842 6849 * Added sys.path to the list of directories searched in the
6843 6850 execfile= option. It used to be the current directory and the
6844 6851 user's IPYTHONDIR only.
6845 6852
6846 6853 2001-11-13 Fernando Perez <fperez@colorado.edu>
6847 6854
6848 6855 * Reinstated the raw_input/prefilter separation that Janko had
6849 6856 initially. This gives a more convenient setup for extending the
6850 6857 pre-processor from the outside: raw_input always gets a string,
6851 6858 and prefilter has to process it. We can then redefine prefilter
6852 6859 from the outside and implement extensions for special
6853 6860 purposes.
6854 6861
6855 6862 Today I got one for inputting PhysicalQuantity objects
6856 6863 (from Scientific) without needing any function calls at
6857 6864 all. Extremely convenient, and it's all done as a user-level
6858 6865 extension (no IPython code was touched). Now instead of:
6859 6866 a = PhysicalQuantity(4.2,'m/s**2')
6860 6867 one can simply say
6861 6868 a = 4.2 m/s**2
6862 6869 or even
6863 6870 a = 4.2 m/s^2
6864 6871
6865 6872 I use this, but it's also a proof of concept: IPython really is
6866 6873 fully user-extensible, even at the level of the parsing of the
6867 6874 command line. It's not trivial, but it's perfectly doable.
6868 6875
6869 6876 * Added 'add_flip' method to inclusion conflict resolver. Fixes
6870 6877 the problem of modules being loaded in the inverse order in which
6871 6878 they were defined in
6872 6879
6873 6880 * Version 0.1.8 released, 0.1.9 opened for further work.
6874 6881
6875 6882 * Added magics pdef, source and file. They respectively show the
6876 6883 definition line ('prototype' in C), source code and full python
6877 6884 file for any callable object. The object inspector oinfo uses
6878 6885 these to show the same information.
6879 6886
6880 6887 * Version 0.1.7 released, 0.1.8 opened for further work.
6881 6888
6882 6889 * Separated all the magic functions into a class called Magic. The
6883 6890 InteractiveShell class was becoming too big for Xemacs to handle
6884 6891 (de-indenting a line would lock it up for 10 seconds while it
6885 6892 backtracked on the whole class!)
6886 6893
6887 6894 FIXME: didn't work. It can be done, but right now namespaces are
6888 6895 all messed up. Do it later (reverted it for now, so at least
6889 6896 everything works as before).
6890 6897
6891 6898 * Got the object introspection system (magic_oinfo) working! I
6892 6899 think this is pretty much ready for release to Janko, so he can
6893 6900 test it for a while and then announce it. Pretty much 100% of what
6894 6901 I wanted for the 'phase 1' release is ready. Happy, tired.
6895 6902
6896 6903 2001-11-12 Fernando Perez <fperez@colorado.edu>
6897 6904
6898 6905 * Version 0.1.6 released, 0.1.7 opened for further work.
6899 6906
6900 6907 * Fixed bug in printing: it used to test for truth before
6901 6908 printing, so 0 wouldn't print. Now checks for None.
6902 6909
6903 6910 * Fixed bug where auto-execs increase the prompt counter by 2 (b/c
6904 6911 they have to call len(str(sys.ps1)) ). But the fix is ugly, it
6905 6912 reaches by hand into the outputcache. Think of a better way to do
6906 6913 this later.
6907 6914
6908 6915 * Various small fixes thanks to Nathan's comments.
6909 6916
6910 6917 * Changed magic_pprint to magic_Pprint. This way it doesn't
6911 6918 collide with pprint() and the name is consistent with the command
6912 6919 line option.
6913 6920
6914 6921 * Changed prompt counter behavior to be fully like
6915 6922 Mathematica's. That is, even input that doesn't return a result
6916 6923 raises the prompt counter. The old behavior was kind of confusing
6917 6924 (getting the same prompt number several times if the operation
6918 6925 didn't return a result).
6919 6926
6920 6927 * Fixed Nathan's last name in a couple of places (Gray, not Graham).
6921 6928
6922 6929 * Fixed -Classic mode (wasn't working anymore).
6923 6930
6924 6931 * Added colored prompts using Nathan's new code. Colors are
6925 6932 currently hardwired, they can be user-configurable. For
6926 6933 developers, they can be chosen in file ipythonlib.py, at the
6927 6934 beginning of the CachedOutput class def.
6928 6935
6929 6936 2001-11-11 Fernando Perez <fperez@colorado.edu>
6930 6937
6931 6938 * Version 0.1.5 released, 0.1.6 opened for further work.
6932 6939
6933 6940 * Changed magic_env to *return* the environment as a dict (not to
6934 6941 print it). This way it prints, but it can also be processed.
6935 6942
6936 6943 * Added Verbose exception reporting to interactive
6937 6944 exceptions. Very nice, now even 1/0 at the prompt gives a verbose
6938 6945 traceback. Had to make some changes to the ultraTB file. This is
6939 6946 probably the last 'big' thing in my mental todo list. This ties
6940 6947 in with the next entry:
6941 6948
6942 6949 * Changed -Xi and -Xf to a single -xmode option. Now all the user
6943 6950 has to specify is Plain, Color or Verbose for all exception
6944 6951 handling.
6945 6952
6946 6953 * Removed ShellServices option. All this can really be done via
6947 6954 the magic system. It's easier to extend, cleaner and has automatic
6948 6955 namespace protection and documentation.
6949 6956
6950 6957 2001-11-09 Fernando Perez <fperez@colorado.edu>
6951 6958
6952 6959 * Fixed bug in output cache flushing (missing parameter to
6953 6960 __init__). Other small bugs fixed (found using pychecker).
6954 6961
6955 6962 * Version 0.1.4 opened for bugfixing.
6956 6963
6957 6964 2001-11-07 Fernando Perez <fperez@colorado.edu>
6958 6965
6959 6966 * Version 0.1.3 released, mainly because of the raw_input bug.
6960 6967
6961 6968 * Fixed NASTY bug in raw_input: input line wasn't properly parsed
6962 6969 and when testing for whether things were callable, a call could
6963 6970 actually be made to certain functions. They would get called again
6964 6971 once 'really' executed, with a resulting double call. A disaster
6965 6972 in many cases (list.reverse() would never work!).
6966 6973
6967 6974 * Removed prefilter() function, moved its code to raw_input (which
6968 6975 after all was just a near-empty caller for prefilter). This saves
6969 6976 a function call on every prompt, and simplifies the class a tiny bit.
6970 6977
6971 6978 * Fix _ip to __ip name in magic example file.
6972 6979
6973 6980 * Changed 'tar -x -f' to 'tar xvf' in auto-installer. This should
6974 6981 work with non-gnu versions of tar.
6975 6982
6976 6983 2001-11-06 Fernando Perez <fperez@colorado.edu>
6977 6984
6978 6985 * Version 0.1.2. Just to keep track of the recent changes.
6979 6986
6980 6987 * Fixed nasty bug in output prompt routine. It used to check 'if
6981 6988 arg != None...'. Problem is, this fails if arg implements a
6982 6989 special comparison (__cmp__) which disallows comparing to
6983 6990 None. Found it when trying to use the PhysicalQuantity module from
6984 6991 ScientificPython.
6985 6992
6986 6993 2001-11-05 Fernando Perez <fperez@colorado.edu>
6987 6994
6988 6995 * Also added dirs. Now the pushd/popd/dirs family functions
6989 6996 basically like the shell, with the added convenience of going home
6990 6997 when called with no args.
6991 6998
6992 6999 * pushd/popd slightly modified to mimic shell behavior more
6993 7000 closely.
6994 7001
6995 7002 * Added env,pushd,popd from ShellServices as magic functions. I
6996 7003 think the cleanest will be to port all desired functions from
6997 7004 ShellServices as magics and remove ShellServices altogether. This
6998 7005 will provide a single, clean way of adding functionality
6999 7006 (shell-type or otherwise) to IP.
7000 7007
7001 7008 2001-11-04 Fernando Perez <fperez@colorado.edu>
7002 7009
7003 7010 * Added .ipython/ directory to sys.path. This way users can keep
7004 7011 customizations there and access them via import.
7005 7012
7006 7013 2001-11-03 Fernando Perez <fperez@colorado.edu>
7007 7014
7008 7015 * Opened version 0.1.1 for new changes.
7009 7016
7010 7017 * Changed version number to 0.1.0: first 'public' release, sent to
7011 7018 Nathan and Janko.
7012 7019
7013 7020 * Lots of small fixes and tweaks.
7014 7021
7015 7022 * Minor changes to whos format. Now strings are shown, snipped if
7016 7023 too long.
7017 7024
7018 7025 * Changed ShellServices to work on __main__ so they show up in @who
7019 7026
7020 7027 * Help also works with ? at the end of a line:
7021 7028 ?sin and sin?
7022 7029 both produce the same effect. This is nice, as often I use the
7023 7030 tab-complete to find the name of a method, but I used to then have
7024 7031 to go to the beginning of the line to put a ? if I wanted more
7025 7032 info. Now I can just add the ? and hit return. Convenient.
7026 7033
7027 7034 2001-11-02 Fernando Perez <fperez@colorado.edu>
7028 7035
7029 7036 * Python version check (>=2.1) added.
7030 7037
7031 7038 * Added LazyPython documentation. At this point the docs are quite
7032 7039 a mess. A cleanup is in order.
7033 7040
7034 7041 * Auto-installer created. For some bizarre reason, the zipfiles
7035 7042 module isn't working on my system. So I made a tar version
7036 7043 (hopefully the command line options in various systems won't kill
7037 7044 me).
7038 7045
7039 7046 * Fixes to Struct in genutils. Now all dictionary-like methods are
7040 7047 protected (reasonably).
7041 7048
7042 7049 * Added pager function to genutils and changed ? to print usage
7043 7050 note through it (it was too long).
7044 7051
7045 7052 * Added the LazyPython functionality. Works great! I changed the
7046 7053 auto-quote escape to ';', it's on home row and next to '. But
7047 7054 both auto-quote and auto-paren (still /) escapes are command-line
7048 7055 parameters.
7049 7056
7050 7057
7051 7058 2001-11-01 Fernando Perez <fperez@colorado.edu>
7052 7059
7053 7060 * Version changed to 0.0.7. Fairly large change: configuration now
7054 7061 is all stored in a directory, by default .ipython. There, all
7055 7062 config files have normal looking names (not .names)
7056 7063
7057 7064 * Version 0.0.6 Released first to Lucas and Archie as a test
7058 7065 run. Since it's the first 'semi-public' release, change version to
7059 7066 > 0.0.6 for any changes now.
7060 7067
7061 7068 * Stuff I had put in the ipplib.py changelog:
7062 7069
7063 7070 Changes to InteractiveShell:
7064 7071
7065 7072 - Made the usage message a parameter.
7066 7073
7067 7074 - Require the name of the shell variable to be given. It's a bit
7068 7075 of a hack, but allows the name 'shell' not to be hardwired in the
7069 7076 magic (@) handler, which is problematic b/c it requires
7070 7077 polluting the global namespace with 'shell'. This in turn is
7071 7078 fragile: if a user redefines a variable called shell, things
7072 7079 break.
7073 7080
7074 7081 - magic @: all functions available through @ need to be defined
7075 7082 as magic_<name>, even though they can be called simply as
7076 7083 @<name>. This allows the special command @magic to gather
7077 7084 information automatically about all existing magic functions,
7078 7085 even if they are run-time user extensions, by parsing the shell
7079 7086 instance __dict__ looking for special magic_ names.
7080 7087
7081 7088 - mainloop: added *two* local namespace parameters. This allows
7082 7089 the class to differentiate between parameters which were there
7083 7090 before and after command line initialization was processed. This
7084 7091 way, later @who can show things loaded at startup by the
7085 7092 user. This trick was necessary to make session saving/reloading
7086 7093 really work: ideally after saving/exiting/reloading a session,
7087 7094 *everything* should look the same, including the output of @who. I
7088 7095 was only able to make this work with this double namespace
7089 7096 trick.
7090 7097
7091 7098 - added a header to the logfile which allows (almost) full
7092 7099 session restoring.
7093 7100
7094 7101 - prepend lines beginning with @ or !, with a and log
7095 7102 them. Why? !lines: may be useful to know what you did @lines:
7096 7103 they may affect session state. So when restoring a session, at
7097 7104 least inform the user of their presence. I couldn't quite get
7098 7105 them to properly re-execute, but at least the user is warned.
7099 7106
7100 7107 * Started ChangeLog.
@@ -1,30 +1,34
1 import sys
2 sys.path.append('..')
3
1 4 import IPython.ipapi
2 5
3 6 IPython.ipapi.make_session()
4 7 ip = IPython.ipapi.get()
5 8
6 9 def test_runlines():
7 10 ip.runlines(['a = 10', 'a+=1'])
8 11 ip.runlines('assert a == 11')
9 12 assert ip.user_ns['a'] == 11
10 13
11 14 def test_db():
12 15 ip.db['__unittest_'] = 12
13 16 assert ip.db['__unittest_'] == 12
14 17 del ip.db['__unittest_']
15 18 assert '__unittest_' not in ip.db
16 19
17 20 def test_defalias():
18 21 slot = [None]
19 22 # test callable alias
20 def cb(s):
23 def cb(localip,s):
24 assert localip is ip
21 25 slot[0] = s
22 26
23 27 ip.defalias('testalias', cb)
24 28 ip.runlines('testalias foo bar')
25 29 assert slot[0] == 'testalias foo bar'
26 30
27 31
28 32 test_runlines()
29 33 test_db()
30 34 test_defalias
General Comments 0
You need to be logged in to leave comments. Login now