Show More
This diff has been collapsed as it changes many lines, (523 lines changed) Show them Hide them | |||
@@ -0,0 +1,523 b'' | |||
|
1 | """Word completion for IPython. | |
|
2 | ||
|
3 | This module is a fork of the rlcompleter module in the Python standard | |
|
4 | library. The original enhancements made to rlcompleter have been sent | |
|
5 | upstream and were accepted as of Python 2.3, but we need a lot more | |
|
6 | functionality specific to IPython, so this module will continue to live as an | |
|
7 | IPython-specific utility. | |
|
8 | ||
|
9 | --------------------------------------------------------------------------- | |
|
10 | Original rlcompleter documentation: | |
|
11 | ||
|
12 | This requires the latest extension to the readline module (the | |
|
13 | completes keywords, built-ins and globals in __main__; when completing | |
|
14 | NAME.NAME..., it evaluates (!) the expression up to the last dot and | |
|
15 | completes its attributes. | |
|
16 | ||
|
17 | It's very cool to do "import string" type "string.", hit the | |
|
18 | completion key (twice), and see the list of names defined by the | |
|
19 | string module! | |
|
20 | ||
|
21 | Tip: to use the tab key as the completion key, call | |
|
22 | ||
|
23 | readline.parse_and_bind("tab: complete") | |
|
24 | ||
|
25 | Notes: | |
|
26 | ||
|
27 | - Exceptions raised by the completer function are *ignored* (and | |
|
28 | generally cause the completion to fail). This is a feature -- since | |
|
29 | readline sets the tty device in raw (or cbreak) mode, printing a | |
|
30 | traceback wouldn't work well without some complicated hoopla to save, | |
|
31 | reset and restore the tty state. | |
|
32 | ||
|
33 | - The evaluation of the NAME.NAME... form may cause arbitrary | |
|
34 | application defined code to be executed if an object with a | |
|
35 | __getattr__ hook is found. Since it is the responsibility of the | |
|
36 | application (or the user) to enable this feature, I consider this an | |
|
37 | acceptable risk. More complicated expressions (e.g. function calls or | |
|
38 | indexing operations) are *not* evaluated. | |
|
39 | ||
|
40 | - GNU readline is also used by the built-in functions input() and | |
|
41 | raw_input(), and thus these also benefit/suffer from the completer | |
|
42 | features. Clearly an interactive application can benefit by | |
|
43 | specifying its own completer function and using raw_input() for all | |
|
44 | its input. | |
|
45 | ||
|
46 | - When the original stdin is not a tty device, GNU readline is never | |
|
47 | used, and this module (and the readline module) are silently inactive. | |
|
48 | ||
|
49 | """ | |
|
50 | ||
|
51 | #***************************************************************************** | |
|
52 | # | |
|
53 | # Since this file is essentially a minimally modified copy of the rlcompleter | |
|
54 | # module which is part of the standard Python distribution, I assume that the | |
|
55 | # proper procedure is to maintain its copyright as belonging to the Python | |
|
56 | # Software Foundation (in addition to my own, for all new code). | |
|
57 | # | |
|
58 | # Copyright (C) 2001 Python Software Foundation, www.python.org | |
|
59 | # Copyright (C) 2001-2005 Fernando Perez. <fperez@colorado.edu> | |
|
60 | # | |
|
61 | # Distributed under the terms of the BSD License. The full license is in | |
|
62 | # the file COPYING, distributed as part of this software. | |
|
63 | # | |
|
64 | #***************************************************************************** | |
|
65 | ||
|
66 | import __builtin__ | |
|
67 | import __main__ | |
|
68 | import glob | |
|
69 | import keyword | |
|
70 | import os | |
|
71 | import re | |
|
72 | import readline | |
|
73 | import sys | |
|
74 | import types | |
|
75 | ||
|
76 | from IPython.genutils import shlex_split | |
|
77 | ||
|
78 | __all__ = ['Completer','IPCompleter'] | |
|
79 | ||
|
80 | def get_class_members(klass): | |
|
81 | ret = dir(klass) | |
|
82 | if hasattr(klass,'__bases__'): | |
|
83 | for base in klass.__bases__: | |
|
84 | ret.extend(get_class_members(base)) | |
|
85 | return ret | |
|
86 | ||
|
87 | class Completer: | |
|
88 | def __init__(self,namespace=None,global_namespace=None): | |
|
89 | """Create a new completer for the command line. | |
|
90 | ||
|
91 | Completer([namespace,global_namespace]) -> completer instance. | |
|
92 | ||
|
93 | If unspecified, the default namespace where completions are performed | |
|
94 | is __main__ (technically, __main__.__dict__). Namespaces should be | |
|
95 | given as dictionaries. | |
|
96 | ||
|
97 | An optional second namespace can be given. This allows the completer | |
|
98 | to handle cases where both the local and global scopes need to be | |
|
99 | distinguished. | |
|
100 | ||
|
101 | Completer instances should be used as the completion mechanism of | |
|
102 | readline via the set_completer() call: | |
|
103 | ||
|
104 | readline.set_completer(Completer(my_namespace).complete) | |
|
105 | """ | |
|
106 | ||
|
107 | if namespace and type(namespace) != types.DictType: | |
|
108 | raise TypeError,'namespace must be a dictionary' | |
|
109 | ||
|
110 | if global_namespace and type(global_namespace) != types.DictType: | |
|
111 | raise TypeError,'global_namespace must be a dictionary' | |
|
112 | ||
|
113 | # Don't bind to namespace quite yet, but flag whether the user wants a | |
|
114 | # specific namespace or to use __main__.__dict__. This will allow us | |
|
115 | # to bind to __main__.__dict__ at completion time, not now. | |
|
116 | if namespace is None: | |
|
117 | self.use_main_ns = 1 | |
|
118 | else: | |
|
119 | self.use_main_ns = 0 | |
|
120 | self.namespace = namespace | |
|
121 | ||
|
122 | # The global namespace, if given, can be bound directly | |
|
123 | if global_namespace is None: | |
|
124 | self.global_namespace = {} | |
|
125 | else: | |
|
126 | self.global_namespace = global_namespace | |
|
127 | ||
|
128 | def complete(self, text, state): | |
|
129 | """Return the next possible completion for 'text'. | |
|
130 | ||
|
131 | This is called successively with state == 0, 1, 2, ... until it | |
|
132 | returns None. The completion should begin with 'text'. | |
|
133 | ||
|
134 | """ | |
|
135 | if self.use_main_ns: | |
|
136 | self.namespace = __main__.__dict__ | |
|
137 | ||
|
138 | if state == 0: | |
|
139 | if "." in text: | |
|
140 | self.matches = self.attr_matches(text) | |
|
141 | else: | |
|
142 | self.matches = self.global_matches(text) | |
|
143 | try: | |
|
144 | return self.matches[state] | |
|
145 | except IndexError: | |
|
146 | return None | |
|
147 | ||
|
148 | def global_matches(self, text): | |
|
149 | """Compute matches when text is a simple name. | |
|
150 | ||
|
151 | Return a list of all keywords, built-in functions and names currently | |
|
152 | defined in self.namespace or self.global_namespace that match. | |
|
153 | ||
|
154 | """ | |
|
155 | matches = [] | |
|
156 | match_append = matches.append | |
|
157 | n = len(text) | |
|
158 | for lst in [keyword.kwlist, | |
|
159 | __builtin__.__dict__.keys(), | |
|
160 | self.namespace.keys(), | |
|
161 | self.global_namespace.keys()]: | |
|
162 | for word in lst: | |
|
163 | if word[:n] == text and word != "__builtins__": | |
|
164 | match_append(word) | |
|
165 | return matches | |
|
166 | ||
|
167 | def attr_matches(self, text): | |
|
168 | """Compute matches when text contains a dot. | |
|
169 | ||
|
170 | Assuming the text is of the form NAME.NAME....[NAME], and is | |
|
171 | evaluatable in self.namespace or self.global_namespace, it will be | |
|
172 | evaluated and its attributes (as revealed by dir()) are used as | |
|
173 | possible completions. (For class instances, class members are are | |
|
174 | also considered.) | |
|
175 | ||
|
176 | WARNING: this can still invoke arbitrary C code, if an object | |
|
177 | with a __getattr__ hook is evaluated. | |
|
178 | ||
|
179 | """ | |
|
180 | import re | |
|
181 | ||
|
182 | # Another option, seems to work great. Catches things like ''.<tab> | |
|
183 | m = re.match(r"(\S+(\.\w+)*)\.(\w*)$", text) | |
|
184 | ||
|
185 | if not m: | |
|
186 | return [] | |
|
187 | expr, attr = m.group(1, 3) | |
|
188 | try: | |
|
189 | object = eval(expr, self.namespace) | |
|
190 | except: | |
|
191 | object = eval(expr, self.global_namespace) | |
|
192 | words = [w for w in dir(object) if isinstance(w, basestring)] | |
|
193 | if hasattr(object,'__class__'): | |
|
194 | words.append('__class__') | |
|
195 | words.extend(get_class_members(object.__class__)) | |
|
196 | n = len(attr) | |
|
197 | matches = [] | |
|
198 | for word in words: | |
|
199 | if word[:n] == attr and word != "__builtins__": | |
|
200 | matches.append("%s.%s" % (expr, word)) | |
|
201 | return matches | |
|
202 | ||
|
203 | class IPCompleter(Completer): | |
|
204 | """Extension of the completer class with IPython-specific features""" | |
|
205 | ||
|
206 | def __init__(self,shell,namespace=None,global_namespace=None, | |
|
207 | omit__names=0,alias_table=None): | |
|
208 | """IPCompleter() -> completer | |
|
209 | ||
|
210 | Return a completer object suitable for use by the readline library | |
|
211 | via readline.set_completer(). | |
|
212 | ||
|
213 | Inputs: | |
|
214 | ||
|
215 | - shell: a pointer to the ipython shell itself. This is needed | |
|
216 | because this completer knows about magic functions, and those can | |
|
217 | only be accessed via the ipython instance. | |
|
218 | ||
|
219 | - namespace: an optional dict where completions are performed. | |
|
220 | ||
|
221 | - global_namespace: secondary optional dict for completions, to | |
|
222 | handle cases (such as IPython embedded inside functions) where | |
|
223 | both Python scopes are visible. | |
|
224 | ||
|
225 | - The optional omit__names parameter sets the completer to omit the | |
|
226 | 'magic' names (__magicname__) for python objects unless the text | |
|
227 | to be completed explicitly starts with one or more underscores. | |
|
228 | ||
|
229 | - If alias_table is supplied, it should be a dictionary of aliases | |
|
230 | to complete. """ | |
|
231 | ||
|
232 | Completer.__init__(self,namespace,global_namespace) | |
|
233 | self.magic_prefix = shell.name+'.magic_' | |
|
234 | self.magic_escape = shell.ESC_MAGIC | |
|
235 | self.readline = readline | |
|
236 | delims = self.readline.get_completer_delims() | |
|
237 | delims = delims.replace(self.magic_escape,'') | |
|
238 | self.readline.set_completer_delims(delims) | |
|
239 | self.get_line_buffer = self.readline.get_line_buffer | |
|
240 | self.omit__names = omit__names | |
|
241 | self.merge_completions = shell.rc.readline_merge_completions | |
|
242 | ||
|
243 | if alias_table is None: | |
|
244 | alias_table = {} | |
|
245 | self.alias_table = alias_table | |
|
246 | # Regexp to split filenames with spaces in them | |
|
247 | self.space_name_re = re.compile(r'([^\\] )') | |
|
248 | # Hold a local ref. to glob.glob for speed | |
|
249 | self.glob = glob.glob | |
|
250 | # Special handling of backslashes needed in win32 platforms | |
|
251 | if sys.platform == "win32": | |
|
252 | self.clean_glob = self._clean_glob_win32 | |
|
253 | else: | |
|
254 | self.clean_glob = self._clean_glob | |
|
255 | self.matchers = [self.python_matches, | |
|
256 | self.file_matches, | |
|
257 | self.alias_matches, | |
|
258 | self.python_func_kw_matches] | |
|
259 | ||
|
260 | # Code contributed by Alex Schmolck, for ipython/emacs integration | |
|
261 | def all_completions(self, text): | |
|
262 | """Return all possible completions for the benefit of emacs.""" | |
|
263 | ||
|
264 | completions = [] | |
|
265 | comp_append = completions.append | |
|
266 | try: | |
|
267 | for i in xrange(sys.maxint): | |
|
268 | res = self.complete(text, i) | |
|
269 | ||
|
270 | if not res: break | |
|
271 | ||
|
272 | comp_append(res) | |
|
273 | #XXX workaround for ``notDefined.<tab>`` | |
|
274 | except NameError: | |
|
275 | pass | |
|
276 | return completions | |
|
277 | # /end Alex Schmolck code. | |
|
278 | ||
|
279 | def _clean_glob(self,text): | |
|
280 | return self.glob("%s*" % text) | |
|
281 | ||
|
282 | def _clean_glob_win32(self,text): | |
|
283 | return [f.replace("\\","/") | |
|
284 | for f in self.glob("%s*" % text)] | |
|
285 | ||
|
286 | def file_matches(self, text): | |
|
287 | """Match filneames, expanding ~USER type strings. | |
|
288 | ||
|
289 | Most of the seemingly convoluted logic in this completer is an | |
|
290 | attempt to handle filenames with spaces in them. And yet it's not | |
|
291 | quite perfect, because Python's readline doesn't expose all of the | |
|
292 | GNU readline details needed for this to be done correctly. | |
|
293 | ||
|
294 | For a filename with a space in it, the printed completions will be | |
|
295 | only the parts after what's already been typed (instead of the | |
|
296 | full completions, as is normally done). I don't think with the | |
|
297 | current (as of Python 2.3) Python readline it's possible to do | |
|
298 | better.""" | |
|
299 | ||
|
300 | #print 'Completer->file_matches: <%s>' % text # dbg | |
|
301 | ||
|
302 | # chars that require escaping with backslash - i.e. chars | |
|
303 | # that readline treats incorrectly as delimiters, but we | |
|
304 | # don't want to treat as delimiters in filename matching | |
|
305 | # when escaped with backslash | |
|
306 | ||
|
307 | protectables = ' ()[]{}' | |
|
308 | ||
|
309 | def protect_filename(s): | |
|
310 | return "".join([(ch in protectables and '\\' + ch or ch) | |
|
311 | for ch in s]) | |
|
312 | ||
|
313 | lbuf = self.get_line_buffer()[:self.readline.get_endidx()] | |
|
314 | open_quotes = 0 # track strings with open quotes | |
|
315 | try: | |
|
316 | lsplit = shlex_split(lbuf)[-1] | |
|
317 | except ValueError: | |
|
318 | # typically an unmatched ", or backslash without escaped char. | |
|
319 | if lbuf.count('"')==1: | |
|
320 | open_quotes = 1 | |
|
321 | lsplit = lbuf.split('"')[-1] | |
|
322 | elif lbuf.count("'")==1: | |
|
323 | open_quotes = 1 | |
|
324 | lsplit = lbuf.split("'")[-1] | |
|
325 | else: | |
|
326 | return None | |
|
327 | except IndexError: | |
|
328 | # tab pressed on empty line | |
|
329 | lsplit = "" | |
|
330 | ||
|
331 | if lsplit != protect_filename(lsplit): | |
|
332 | # if protectables are found, do matching on the whole escaped | |
|
333 | # name | |
|
334 | has_protectables = 1 | |
|
335 | text0,text = text,lsplit | |
|
336 | else: | |
|
337 | has_protectables = 0 | |
|
338 | text = os.path.expanduser(text) | |
|
339 | ||
|
340 | if text == "": | |
|
341 | return [protect_filename(f) for f in self.glob("*")] | |
|
342 | ||
|
343 | m0 = self.clean_glob(text.replace('\\','')) | |
|
344 | if has_protectables: | |
|
345 | # If we had protectables, we need to revert our changes to the | |
|
346 | # beginning of filename so that we don't double-write the part | |
|
347 | # of the filename we have so far | |
|
348 | len_lsplit = len(lsplit) | |
|
349 | matches = [text0 + protect_filename(f[len_lsplit:]) for f in m0] | |
|
350 | else: | |
|
351 | if open_quotes: | |
|
352 | # if we have a string with an open quote, we don't need to | |
|
353 | # protect the names at all (and we _shouldn't_, as it | |
|
354 | # would cause bugs when the filesystem call is made). | |
|
355 | matches = m0 | |
|
356 | else: | |
|
357 | matches = [protect_filename(f) for f in m0] | |
|
358 | if len(matches) == 1 and os.path.isdir(matches[0]): | |
|
359 | # Takes care of links to directories also. Use '/' | |
|
360 | # explicitly, even under Windows, so that name completions | |
|
361 | # don't end up escaped. | |
|
362 | matches[0] += '/' | |
|
363 | return matches | |
|
364 | ||
|
365 | def alias_matches(self, text): | |
|
366 | """Match internal system aliases""" | |
|
367 | #print 'Completer->alias_matches:',text # dbg | |
|
368 | text = os.path.expanduser(text) | |
|
369 | aliases = self.alias_table.keys() | |
|
370 | if text == "": | |
|
371 | return aliases | |
|
372 | else: | |
|
373 | return [alias for alias in aliases if alias.startswith(text)] | |
|
374 | ||
|
375 | def python_matches(self,text): | |
|
376 | """Match attributes or global python names""" | |
|
377 | #print 'Completer->python_matches' # dbg | |
|
378 | if "." in text: | |
|
379 | try: | |
|
380 | matches = self.attr_matches(text) | |
|
381 | if text.endswith('.') and self.omit__names: | |
|
382 | if self.omit__names == 1: | |
|
383 | # true if txt is _not_ a __ name, false otherwise: | |
|
384 | no__name = (lambda txt: | |
|
385 | re.match(r'.*\.__.*?__',txt) is None) | |
|
386 | else: | |
|
387 | # true if txt is _not_ a _ name, false otherwise: | |
|
388 | no__name = (lambda txt: | |
|
389 | re.match(r'.*\._.*?',txt) is None) | |
|
390 | matches = filter(no__name, matches) | |
|
391 | except NameError: | |
|
392 | # catches <undefined attributes>.<tab> | |
|
393 | matches = [] | |
|
394 | else: | |
|
395 | matches = self.global_matches(text) | |
|
396 | # this is so completion finds magics when automagic is on: | |
|
397 | if matches == [] and not text.startswith(os.sep): | |
|
398 | matches = self.attr_matches(self.magic_prefix+text) | |
|
399 | return matches | |
|
400 | ||
|
401 | def _default_arguments(self, obj): | |
|
402 | """Return the list of default arguments of obj if it is callable, | |
|
403 | or empty list otherwise.""" | |
|
404 | ||
|
405 | if not (inspect.isfunction(obj) or inspect.ismethod(obj)): | |
|
406 | # for classes, check for __init__,__new__ | |
|
407 | if inspect.isclass(obj): | |
|
408 | obj = (getattr(obj,'__init__',None) or | |
|
409 | getattr(obj,'__new__',None)) | |
|
410 | # for all others, check if they are __call__able | |
|
411 | elif hasattr(obj, '__call__'): | |
|
412 | obj = obj.__call__ | |
|
413 | # XXX: is there a way to handle the builtins ? | |
|
414 | try: | |
|
415 | args,_,_1,defaults = inspect.getargspec(obj) | |
|
416 | if defaults: | |
|
417 | return args[-len(defaults):] | |
|
418 | except TypeError: pass | |
|
419 | return [] | |
|
420 | ||
|
421 | def python_func_kw_matches(self,text): | |
|
422 | """Match named parameters (kwargs) of the last open function""" | |
|
423 | ||
|
424 | if "." in text: # a parameter cannot be dotted | |
|
425 | return [] | |
|
426 | try: regexp = self.__funcParamsRegex | |
|
427 | except AttributeError: | |
|
428 | regexp = self.__funcParamsRegex = re.compile(r''' | |
|
429 | '.*?' | # single quoted strings or | |
|
430 | ".*?" | # double quoted strings or | |
|
431 | \w+ | # identifier | |
|
432 | \S # other characters | |
|
433 | ''', re.VERBOSE | re.DOTALL) | |
|
434 | # 1. find the nearest identifier that comes before an unclosed | |
|
435 | # parenthesis e.g. for "foo (1+bar(x), pa", the candidate is "foo" | |
|
436 | tokens = regexp.findall(self.get_line_buffer()) | |
|
437 | tokens.reverse() | |
|
438 | iterTokens = iter(tokens); openPar = 0 | |
|
439 | for token in iterTokens: | |
|
440 | if token == ')': | |
|
441 | openPar -= 1 | |
|
442 | elif token == '(': | |
|
443 | openPar += 1 | |
|
444 | if openPar > 0: | |
|
445 | # found the last unclosed parenthesis | |
|
446 | break | |
|
447 | else: | |
|
448 | return [] | |
|
449 | # 2. Concatenate dotted names ("foo.bar" for "foo.bar(x, pa" ) | |
|
450 | ids = [] | |
|
451 | isId = re.compile(r'\w+$').match | |
|
452 | while True: | |
|
453 | try: | |
|
454 | ids.append(iterTokens.next()) | |
|
455 | if not isId(ids[-1]): | |
|
456 | ids.pop(); break | |
|
457 | if not iterTokens.next() == '.': | |
|
458 | break | |
|
459 | except StopIteration: | |
|
460 | break | |
|
461 | # lookup the candidate callable matches either using global_matches | |
|
462 | # or attr_matches for dotted names | |
|
463 | if len(ids) == 1: | |
|
464 | callableMatches = self.global_matches(ids[0]) | |
|
465 | else: | |
|
466 | callableMatches = self.attr_matches('.'.join(ids[::-1])) | |
|
467 | argMatches = [] | |
|
468 | for callableMatch in callableMatches: | |
|
469 | try: namedArgs = self._default_arguments(eval(callableMatch, | |
|
470 | self.namespace)) | |
|
471 | except: continue | |
|
472 | for namedArg in namedArgs: | |
|
473 | if namedArg.startswith(text): | |
|
474 | argMatches.append("%s=" %namedArg) | |
|
475 | return argMatches | |
|
476 | ||
|
477 | def complete(self, text, state): | |
|
478 | """Return the next possible completion for 'text'. | |
|
479 | ||
|
480 | This is called successively with state == 0, 1, 2, ... until it | |
|
481 | returns None. The completion should begin with 'text'. """ | |
|
482 | ||
|
483 | #print '\n*** COMPLETE: <%s> (%s)' % (text,state) # dbg | |
|
484 | ||
|
485 | # if there is only a tab on a line with only whitespace, instead | |
|
486 | # of the mostly useless 'do you want to see all million | |
|
487 | # completions' message, just do the right thing and give the user | |
|
488 | # his tab! Incidentally, this enables pasting of tabbed text from | |
|
489 | # an editor (as long as autoindent is off). | |
|
490 | if not self.get_line_buffer().strip(): | |
|
491 | self.readline.insert_text('\t') | |
|
492 | return None | |
|
493 | ||
|
494 | magic_escape = self.magic_escape | |
|
495 | magic_prefix = self.magic_prefix | |
|
496 | ||
|
497 | try: | |
|
498 | if text.startswith(magic_escape): | |
|
499 | text = text.replace(magic_escape,magic_prefix) | |
|
500 | elif text.startswith('~'): | |
|
501 | text = os.path.expanduser(text) | |
|
502 | if state == 0: | |
|
503 | # Extend the list of completions with the results of each | |
|
504 | # matcher, so we return results to the user from all | |
|
505 | # namespaces. | |
|
506 | if self.merge_completions: | |
|
507 | self.matches = [] | |
|
508 | for matcher in self.matchers: | |
|
509 | self.matches.extend(matcher(text)) | |
|
510 | else: | |
|
511 | for matcher in self.matchers: | |
|
512 | self.matches = matcher(text) | |
|
513 | if self.matches: | |
|
514 | break | |
|
515 | ||
|
516 | try: | |
|
517 | return self.matches[state].replace(magic_prefix,magic_escape) | |
|
518 | except IndexError: | |
|
519 | return None | |
|
520 | except: | |
|
521 | #import traceback; traceback.print_exc() # dbg | |
|
522 | # If completion fails, don't annoy the user. | |
|
523 | return None |
This diff has been collapsed as it changes many lines, (518 lines changed) Show them Hide them | |||
@@ -1,2157 +1,1887 b'' | |||
|
1 | 1 | # -*- coding: utf-8 -*- |
|
2 | 2 | """ |
|
3 | 3 | IPython -- An enhanced Interactive Python |
|
4 | 4 | |
|
5 | 5 | Requires Python 2.1 or newer. |
|
6 | 6 | |
|
7 | 7 | This file contains all the classes and helper functions specific to IPython. |
|
8 | 8 | |
|
9 |
$Id: iplib.py 95 |
|
|
9 | $Id: iplib.py 957 2005-12-27 22:33:22Z fperez $ | |
|
10 | 10 | """ |
|
11 | 11 | |
|
12 | 12 | #***************************************************************************** |
|
13 | 13 | # Copyright (C) 2001 Janko Hauser <jhauser@zscout.de> and |
|
14 |
# Copyright (C) 2001-200 |
|
|
14 | # Copyright (C) 2001-2005 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 |
# Python standard library. Over time, |
|
|
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 | # subclassing. The Python License (sec. 2) allows for this, but it's always | |
|
23 | # nice to acknowledge credit where credit is due. | |
|
22 | # subclassing. At this point, there are no dependencies at all on the code | |
|
23 | # module anymore (it is not even imported). The Python License (sec. 2) | |
|
24 | # allows for this, but it's always nice to acknowledge credit where credit is | |
|
25 | # due. | |
|
24 | 26 | #***************************************************************************** |
|
25 | 27 | |
|
26 | 28 | #**************************************************************************** |
|
27 | 29 | # Modules and globals |
|
28 | 30 | |
|
29 | 31 | from __future__ import generators # for 2.2 backwards-compatibility |
|
30 | 32 | |
|
31 | 33 | from IPython import Release |
|
32 | 34 | __author__ = '%s <%s>\n%s <%s>' % \ |
|
33 | 35 | ( Release.authors['Janko'] + Release.authors['Fernando'] ) |
|
34 | 36 | __license__ = Release.license |
|
35 | 37 | __version__ = Release.version |
|
36 | 38 | |
|
37 | 39 | # Python standard modules |
|
38 | 40 | import __main__ |
|
39 | 41 | import __builtin__ |
|
42 | import bdb | |
|
43 | import codeop | |
|
44 | import cPickle as pickle | |
|
40 | 45 | import exceptions |
|
46 | import glob | |
|
47 | import inspect | |
|
41 | 48 | import keyword |
|
42 | 49 | import new |
|
43 | import os, sys, shutil | |
|
44 | import code, glob, types, re | |
|
45 | import string, StringIO | |
|
46 | import inspect, pydoc | |
|
47 | import bdb, pdb | |
|
48 | import UserList # don't subclass list so this works with Python2.1 | |
|
49 | from pprint import pprint, pformat | |
|
50 | import cPickle as pickle | |
|
50 | import os | |
|
51 | import pdb | |
|
52 | import pydoc | |
|
53 | import re | |
|
54 | import shutil | |
|
55 | import string | |
|
56 | import StringIO | |
|
57 | import sys | |
|
51 | 58 | import traceback |
|
52 | from codeop import CommandCompiler | |
|
59 | import types | |
|
60 | ||
|
61 | from pprint import pprint, pformat | |
|
53 | 62 | |
|
54 | 63 | # IPython's own modules |
|
55 | 64 | import IPython |
|
56 | 65 | from IPython import OInspect,PyColorize,ultraTB |
|
57 | 66 | from IPython.ColorANSI import ColorScheme,ColorSchemeTable # too long names |
|
58 | 67 | from IPython.Logger import Logger |
|
59 |
from IPython.Magic import Magic,magic2python |
|
|
68 | from IPython.Magic import Magic,magic2python | |
|
60 | 69 | from IPython.usage import cmd_line_usage,interactive_usage |
|
61 | 70 | from IPython.Struct import Struct |
|
62 | 71 | from IPython.Itpl import Itpl,itpl,printpl,ItplNS,itplns |
|
63 | 72 | from IPython.FakeModule import FakeModule |
|
64 | 73 | from IPython.background_jobs import BackgroundJobManager |
|
65 | 74 | from IPython.PyColorize import Parser |
|
66 | 75 | from IPython.genutils import * |
|
67 | 76 | |
|
68 | 77 | # Global pointer to the running |
|
69 | 78 | |
|
70 | 79 | # store the builtin raw_input globally, and use this always, in case user code |
|
71 | 80 | # overwrites it (like wx.py.PyShell does) |
|
72 | 81 | raw_input_original = raw_input |
|
73 | 82 | |
|
74 | 83 | #**************************************************************************** |
|
75 | 84 | # Some utility function definitions |
|
76 | 85 | |
|
77 | class Bunch: pass | |
|
78 | ||
|
79 | 86 | def esc_quotes(strng): |
|
80 | 87 | """Return the input string with single and double quotes escaped out""" |
|
81 | 88 | |
|
82 | 89 | return strng.replace('"','\\"').replace("'","\\'") |
|
83 | 90 | |
|
84 | 91 | def import_fail_info(mod_name,fns=None): |
|
85 | 92 | """Inform load failure for a module.""" |
|
86 | 93 | |
|
87 | 94 | if fns == None: |
|
88 | 95 | warn("Loading of %s failed.\n" % (mod_name,)) |
|
89 | 96 | else: |
|
90 | 97 | warn("Loading of %s from %s failed.\n" % (fns,mod_name)) |
|
91 | 98 | |
|
92 | 99 | def qw_lol(indata): |
|
93 | 100 | """qw_lol('a b') -> [['a','b']], |
|
94 | 101 | otherwise it's just a call to qw(). |
|
95 | 102 | |
|
96 | 103 | We need this to make sure the modules_some keys *always* end up as a |
|
97 | 104 | list of lists.""" |
|
98 | 105 | |
|
99 | 106 | if type(indata) in StringTypes: |
|
100 | 107 | return [qw(indata)] |
|
101 | 108 | else: |
|
102 | 109 | return qw(indata) |
|
103 | 110 | |
|
104 | 111 | def ipmagic(arg_s): |
|
105 | 112 | """Call a magic function by name. |
|
106 | 113 | |
|
107 | 114 | Input: a string containing the name of the magic function to call and any |
|
108 | 115 | additional arguments to be passed to the magic. |
|
109 | 116 | |
|
110 | 117 | ipmagic('name -opt foo bar') is equivalent to typing at the ipython |
|
111 | 118 | prompt: |
|
112 | 119 | |
|
113 | 120 | In[1]: %name -opt foo bar |
|
114 | 121 | |
|
115 | 122 | To call a magic without arguments, simply use ipmagic('name'). |
|
116 | 123 | |
|
117 | 124 | This provides a proper Python function to call IPython's magics in any |
|
118 | 125 | valid Python code you can type at the interpreter, including loops and |
|
119 | 126 | compound statements. It is added by IPython to the Python builtin |
|
120 | 127 | namespace upon initialization.""" |
|
121 | 128 | |
|
122 | 129 | args = arg_s.split(' ',1) |
|
123 | 130 | magic_name = args[0] |
|
124 | 131 | if magic_name.startswith(__IPYTHON__.ESC_MAGIC): |
|
125 | 132 | magic_name = magic_name[1:] |
|
126 | 133 | try: |
|
127 | 134 | magic_args = args[1] |
|
128 | 135 | except IndexError: |
|
129 | 136 | magic_args = '' |
|
130 | 137 | fn = getattr(__IPYTHON__,'magic_'+magic_name,None) |
|
131 | 138 | if fn is None: |
|
132 | 139 | error("Magic function `%s` not found." % magic_name) |
|
133 | 140 | else: |
|
134 | 141 | magic_args = __IPYTHON__.var_expand(magic_args) |
|
135 | 142 | return fn(magic_args) |
|
136 | 143 | |
|
137 | 144 | def ipalias(arg_s): |
|
138 | 145 | """Call an alias by name. |
|
139 | 146 | |
|
140 | 147 | Input: a string containing the name of the alias to call and any |
|
141 | 148 | additional arguments to be passed to the magic. |
|
142 | 149 | |
|
143 | 150 | ipalias('name -opt foo bar') is equivalent to typing at the ipython |
|
144 | 151 | prompt: |
|
145 | 152 | |
|
146 | 153 | In[1]: name -opt foo bar |
|
147 | 154 | |
|
148 | 155 | To call an alias without arguments, simply use ipalias('name'). |
|
149 | 156 | |
|
150 | 157 | This provides a proper Python function to call IPython's aliases in any |
|
151 | 158 | valid Python code you can type at the interpreter, including loops and |
|
152 | 159 | compound statements. It is added by IPython to the Python builtin |
|
153 | 160 | namespace upon initialization.""" |
|
154 | 161 | |
|
155 | 162 | args = arg_s.split(' ',1) |
|
156 | 163 | alias_name = args[0] |
|
157 | 164 | try: |
|
158 | 165 | alias_args = args[1] |
|
159 | 166 | except IndexError: |
|
160 | 167 | alias_args = '' |
|
161 | 168 | if alias_name in __IPYTHON__.alias_table: |
|
162 | 169 | __IPYTHON__.call_alias(alias_name,alias_args) |
|
163 | 170 | else: |
|
164 | 171 | error("Alias `%s` not found." % alias_name) |
|
165 | 172 | |
|
166 | #----------------------------------------------------------------------------- | |
|
167 | # Local use classes | |
|
168 | try: | |
|
169 | from IPython import FlexCompleter | |
|
170 | ||
|
171 | class MagicCompleter(FlexCompleter.Completer): | |
|
172 | """Extension of the completer class to work on %-prefixed lines.""" | |
|
173 | ||
|
174 | def __init__(self,shell,namespace=None,global_namespace=None, | |
|
175 | omit__names=0,alias_table=None): | |
|
176 | """MagicCompleter() -> completer | |
|
177 | ||
|
178 | Return a completer object suitable for use by the readline library | |
|
179 | via readline.set_completer(). | |
|
180 | ||
|
181 | Inputs: | |
|
182 | ||
|
183 | - shell: a pointer to the ipython shell itself. This is needed | |
|
184 | because this completer knows about magic functions, and those can | |
|
185 | only be accessed via the ipython instance. | |
|
186 | ||
|
187 | - namespace: an optional dict where completions are performed. | |
|
188 | ||
|
189 | - global_namespace: secondary optional dict for completions, to | |
|
190 | handle cases (such as IPython embedded inside functions) where | |
|
191 | both Python scopes are visible. | |
|
192 | ||
|
193 | - The optional omit__names parameter sets the completer to omit the | |
|
194 | 'magic' names (__magicname__) for python objects unless the text | |
|
195 | to be completed explicitly starts with one or more underscores. | |
|
196 | ||
|
197 | - If alias_table is supplied, it should be a dictionary of aliases | |
|
198 | to complete. """ | |
|
199 | ||
|
200 | FlexCompleter.Completer.__init__(self,namespace) | |
|
201 | self.magic_prefix = shell.name+'.magic_' | |
|
202 | self.magic_escape = shell.ESC_MAGIC | |
|
203 | self.readline = FlexCompleter.readline | |
|
204 | delims = self.readline.get_completer_delims() | |
|
205 | delims = delims.replace(self.magic_escape,'') | |
|
206 | self.readline.set_completer_delims(delims) | |
|
207 | self.get_line_buffer = self.readline.get_line_buffer | |
|
208 | self.omit__names = omit__names | |
|
209 | self.merge_completions = shell.rc.readline_merge_completions | |
|
210 | ||
|
211 | if alias_table is None: | |
|
212 | alias_table = {} | |
|
213 | self.alias_table = alias_table | |
|
214 | # Regexp to split filenames with spaces in them | |
|
215 | self.space_name_re = re.compile(r'([^\\] )') | |
|
216 | # Hold a local ref. to glob.glob for speed | |
|
217 | self.glob = glob.glob | |
|
218 | # Special handling of backslashes needed in win32 platforms | |
|
219 | if sys.platform == "win32": | |
|
220 | self.clean_glob = self._clean_glob_win32 | |
|
221 | else: | |
|
222 | self.clean_glob = self._clean_glob | |
|
223 | self.matchers = [self.python_matches, | |
|
224 | self.file_matches, | |
|
225 | self.alias_matches, | |
|
226 | self.python_func_kw_matches] | |
|
227 | ||
|
228 | # Code contributed by Alex Schmolck, for ipython/emacs integration | |
|
229 | def all_completions(self, text): | |
|
230 | """Return all possible completions for the benefit of emacs.""" | |
|
231 | ||
|
232 | completions = [] | |
|
233 | comp_append = completions.append | |
|
234 | try: | |
|
235 | for i in xrange(sys.maxint): | |
|
236 | res = self.complete(text, i) | |
|
237 | ||
|
238 | if not res: break | |
|
239 | ||
|
240 | comp_append(res) | |
|
241 | #XXX workaround for ``notDefined.<tab>`` | |
|
242 | except NameError: | |
|
243 | pass | |
|
244 | return completions | |
|
245 | # /end Alex Schmolck code. | |
|
246 | ||
|
247 | def _clean_glob(self,text): | |
|
248 | return self.glob("%s*" % text) | |
|
249 | ||
|
250 | def _clean_glob_win32(self,text): | |
|
251 | return [f.replace("\\","/") | |
|
252 | for f in self.glob("%s*" % text)] | |
|
253 | ||
|
254 | def file_matches(self, text): | |
|
255 | """Match filneames, expanding ~USER type strings. | |
|
256 | ||
|
257 | Most of the seemingly convoluted logic in this completer is an | |
|
258 | attempt to handle filenames with spaces in them. And yet it's not | |
|
259 | quite perfect, because Python's readline doesn't expose all of the | |
|
260 | GNU readline details needed for this to be done correctly. | |
|
261 | ||
|
262 | For a filename with a space in it, the printed completions will be | |
|
263 | only the parts after what's already been typed (instead of the | |
|
264 | full completions, as is normally done). I don't think with the | |
|
265 | current (as of Python 2.3) Python readline it's possible to do | |
|
266 | better.""" | |
|
267 | ||
|
268 | #print 'Completer->file_matches: <%s>' % text # dbg | |
|
269 | ||
|
270 | # chars that require escaping with backslash - i.e. chars | |
|
271 | # that readline treats incorrectly as delimiters, but we | |
|
272 | # don't want to treat as delimiters in filename matching | |
|
273 | # when escaped with backslash | |
|
274 | ||
|
275 | protectables = ' ()[]{}' | |
|
276 | ||
|
277 | def protect_filename(s): | |
|
278 | return "".join([(ch in protectables and '\\' + ch or ch) | |
|
279 | for ch in s]) | |
|
173 | def softspace(file, newvalue): | |
|
174 | """Copied from code.py, to remove the dependency""" | |
|
175 | oldvalue = 0 | |
|
176 | try: | |
|
177 | oldvalue = file.softspace | |
|
178 | except AttributeError: | |
|
179 | pass | |
|
180 | try: | |
|
181 | file.softspace = newvalue | |
|
182 | except (AttributeError, TypeError): | |
|
183 | # "attribute-less object" or "read-only attributes" | |
|
184 | pass | |
|
185 | return oldvalue | |
|
280 | 186 | |
|
281 | lbuf = self.get_line_buffer()[:self.readline.get_endidx()] | |
|
282 | open_quotes = 0 # track strings with open quotes | |
|
283 | try: | |
|
284 | lsplit = shlex_split(lbuf)[-1] | |
|
285 | except ValueError: | |
|
286 | # typically an unmatched ", or backslash without escaped char. | |
|
287 | if lbuf.count('"')==1: | |
|
288 | open_quotes = 1 | |
|
289 | lsplit = lbuf.split('"')[-1] | |
|
290 | elif lbuf.count("'")==1: | |
|
291 | open_quotes = 1 | |
|
292 | lsplit = lbuf.split("'")[-1] | |
|
293 | else: | |
|
294 | return None | |
|
295 | except IndexError: | |
|
296 | # tab pressed on empty line | |
|
297 | lsplit = "" | |
|
298 | ||
|
299 | if lsplit != protect_filename(lsplit): | |
|
300 | # if protectables are found, do matching on the whole escaped | |
|
301 | # name | |
|
302 | has_protectables = 1 | |
|
303 | text0,text = text,lsplit | |
|
304 | else: | |
|
305 | has_protectables = 0 | |
|
306 | text = os.path.expanduser(text) | |
|
307 | ||
|
308 | if text == "": | |
|
309 | return [protect_filename(f) for f in self.glob("*")] | |
|
310 | ||
|
311 | m0 = self.clean_glob(text.replace('\\','')) | |
|
312 | if has_protectables: | |
|
313 | # If we had protectables, we need to revert our changes to the | |
|
314 | # beginning of filename so that we don't double-write the part | |
|
315 | # of the filename we have so far | |
|
316 | len_lsplit = len(lsplit) | |
|
317 | matches = [text0 + protect_filename(f[len_lsplit:]) for f in m0] | |
|
318 | else: | |
|
319 | if open_quotes: | |
|
320 | # if we have a string with an open quote, we don't need to | |
|
321 | # protect the names at all (and we _shouldn't_, as it | |
|
322 | # would cause bugs when the filesystem call is made). | |
|
323 | matches = m0 | |
|
324 | else: | |
|
325 | matches = [protect_filename(f) for f in m0] | |
|
326 | if len(matches) == 1 and os.path.isdir(matches[0]): | |
|
327 | # Takes care of links to directories also. Use '/' | |
|
328 | # explicitly, even under Windows, so that name completions | |
|
329 | # don't end up escaped. | |
|
330 | matches[0] += '/' | |
|
331 | return matches | |
|
332 | ||
|
333 | def alias_matches(self, text): | |
|
334 | """Match internal system aliases""" | |
|
335 | #print 'Completer->alias_matches:',text # dbg | |
|
336 | text = os.path.expanduser(text) | |
|
337 | aliases = self.alias_table.keys() | |
|
338 | if text == "": | |
|
339 | return aliases | |
|
340 | else: | |
|
341 | return [alias for alias in aliases if alias.startswith(text)] | |
|
342 | ||
|
343 | def python_matches(self,text): | |
|
344 | """Match attributes or global python names""" | |
|
345 | #print 'Completer->python_matches' # dbg | |
|
346 | if "." in text: | |
|
347 | try: | |
|
348 | matches = self.attr_matches(text) | |
|
349 | if text.endswith('.') and self.omit__names: | |
|
350 | if self.omit__names == 1: | |
|
351 | # true if txt is _not_ a __ name, false otherwise: | |
|
352 | no__name = (lambda txt: | |
|
353 | re.match(r'.*\.__.*?__',txt) is None) | |
|
354 | else: | |
|
355 | # true if txt is _not_ a _ name, false otherwise: | |
|
356 | no__name = (lambda txt: | |
|
357 | re.match(r'.*\._.*?',txt) is None) | |
|
358 | matches = filter(no__name, matches) | |
|
359 | except NameError: | |
|
360 | # catches <undefined attributes>.<tab> | |
|
361 | matches = [] | |
|
362 | else: | |
|
363 | matches = self.global_matches(text) | |
|
364 | # this is so completion finds magics when automagic is on: | |
|
365 | if matches == [] and not text.startswith(os.sep): | |
|
366 | matches = self.attr_matches(self.magic_prefix+text) | |
|
367 | return matches | |
|
368 | ||
|
369 | def _default_arguments(self, obj): | |
|
370 | """Return the list of default arguments of obj if it is callable, | |
|
371 | or empty list otherwise.""" | |
|
372 | ||
|
373 | if not (inspect.isfunction(obj) or inspect.ismethod(obj)): | |
|
374 | # for classes, check for __init__,__new__ | |
|
375 | if inspect.isclass(obj): | |
|
376 | obj = (getattr(obj,'__init__',None) or | |
|
377 | getattr(obj,'__new__',None)) | |
|
378 | # for all others, check if they are __call__able | |
|
379 | elif hasattr(obj, '__call__'): | |
|
380 | obj = obj.__call__ | |
|
381 | # XXX: is there a way to handle the builtins ? | |
|
382 | try: | |
|
383 | args,_,_1,defaults = inspect.getargspec(obj) | |
|
384 | if defaults: | |
|
385 | return args[-len(defaults):] | |
|
386 | except TypeError: pass | |
|
387 | return [] | |
|
388 | ||
|
389 | def python_func_kw_matches(self,text): | |
|
390 | """Match named parameters (kwargs) of the last open function""" | |
|
391 | ||
|
392 | if "." in text: # a parameter cannot be dotted | |
|
393 | return [] | |
|
394 | try: regexp = self.__funcParamsRegex | |
|
395 | except AttributeError: | |
|
396 | regexp = self.__funcParamsRegex = re.compile(r''' | |
|
397 | '.*?' | # single quoted strings or | |
|
398 | ".*?" | # double quoted strings or | |
|
399 | \w+ | # identifier | |
|
400 | \S # other characters | |
|
401 | ''', re.VERBOSE | re.DOTALL) | |
|
402 | # 1. find the nearest identifier that comes before an unclosed | |
|
403 | # parenthesis e.g. for "foo (1+bar(x), pa", the candidate is "foo" | |
|
404 | tokens = regexp.findall(self.get_line_buffer()) | |
|
405 | tokens.reverse() | |
|
406 | iterTokens = iter(tokens); openPar = 0 | |
|
407 | for token in iterTokens: | |
|
408 | if token == ')': | |
|
409 | openPar -= 1 | |
|
410 | elif token == '(': | |
|
411 | openPar += 1 | |
|
412 | if openPar > 0: | |
|
413 | # found the last unclosed parenthesis | |
|
414 | break | |
|
415 | else: | |
|
416 | return [] | |
|
417 | # 2. Concatenate any dotted names (e.g. "foo.bar" for "foo.bar(x, pa" ) | |
|
418 | ids = [] | |
|
419 | isId = re.compile(r'\w+$').match | |
|
420 | while True: | |
|
421 | try: | |
|
422 | ids.append(iterTokens.next()) | |
|
423 | if not isId(ids[-1]): | |
|
424 | ids.pop(); break | |
|
425 | if not iterTokens.next() == '.': | |
|
426 | break | |
|
427 | except StopIteration: | |
|
428 | break | |
|
429 | # lookup the candidate callable matches either using global_matches | |
|
430 | # or attr_matches for dotted names | |
|
431 | if len(ids) == 1: | |
|
432 | callableMatches = self.global_matches(ids[0]) | |
|
433 | else: | |
|
434 | callableMatches = self.attr_matches('.'.join(ids[::-1])) | |
|
435 | argMatches = [] | |
|
436 | for callableMatch in callableMatches: | |
|
437 | try: namedArgs = self._default_arguments(eval(callableMatch, | |
|
438 | self.namespace)) | |
|
439 | except: continue | |
|
440 | for namedArg in namedArgs: | |
|
441 | if namedArg.startswith(text): | |
|
442 | argMatches.append("%s=" %namedArg) | |
|
443 | return argMatches | |
|
444 | ||
|
445 | def complete(self, text, state): | |
|
446 | """Return the next possible completion for 'text'. | |
|
447 | ||
|
448 | This is called successively with state == 0, 1, 2, ... until it | |
|
449 | returns None. The completion should begin with 'text'. """ | |
|
450 | ||
|
451 | #print '\n*** COMPLETE: <%s> (%s)' % (text,state) # dbg | |
|
452 | ||
|
453 | # if there is only a tab on a line with only whitespace, instead | |
|
454 | # of the mostly useless 'do you want to see all million | |
|
455 | # completions' message, just do the right thing and give the user | |
|
456 | # his tab! Incidentally, this enables pasting of tabbed text from | |
|
457 | # an editor (as long as autoindent is off). | |
|
458 | if not self.get_line_buffer().strip(): | |
|
459 | self.readline.insert_text('\t') | |
|
460 | return None | |
|
461 | ||
|
462 | magic_escape = self.magic_escape | |
|
463 | magic_prefix = self.magic_prefix | |
|
464 | ||
|
465 | try: | |
|
466 | if text.startswith(magic_escape): | |
|
467 | text = text.replace(magic_escape,magic_prefix) | |
|
468 | elif text.startswith('~'): | |
|
469 | text = os.path.expanduser(text) | |
|
470 | if state == 0: | |
|
471 | # Extend the list of completions with the results of each | |
|
472 | # matcher, so we return results to the user from all | |
|
473 | # namespaces. | |
|
474 | if self.merge_completions: | |
|
475 | self.matches = [] | |
|
476 | for matcher in self.matchers: | |
|
477 | self.matches.extend(matcher(text)) | |
|
478 | else: | |
|
479 | for matcher in self.matchers: | |
|
480 | self.matches = matcher(text) | |
|
481 | if self.matches: | |
|
482 | break | |
|
483 | ||
|
484 | try: | |
|
485 | return self.matches[state].replace(magic_prefix,magic_escape) | |
|
486 | except IndexError: | |
|
487 | return None | |
|
488 | except: | |
|
489 | # If completion fails, don't annoy the user. | |
|
490 | return None | |
|
491 | 187 | |
|
492 | except ImportError: | |
|
493 | pass # no readline support | |
|
188 | #**************************************************************************** | |
|
189 | # Local use exceptions | |
|
190 | class SpaceInInput(exceptions.Exception): pass | |
|
494 | 191 | |
|
495 | except KeyError: | |
|
496 | pass # Windows doesn't set TERM, it doesn't matter | |
|
192 | class IPythonExit(exceptions.Exception): pass | |
|
497 | 193 | |
|
194 | #**************************************************************************** | |
|
195 | # Local use classes | |
|
196 | class Bunch: pass | |
|
498 | 197 | |
|
499 |
class InputList( |
|
|
198 | class InputList(list): | |
|
500 | 199 | """Class to store user input. |
|
501 | 200 | |
|
502 | 201 | It's basically a list, but slices return a string instead of a list, thus |
|
503 | 202 | allowing things like (assuming 'In' is an instance): |
|
504 | 203 | |
|
505 | 204 | exec In[4:7] |
|
506 | 205 | |
|
507 | 206 | or |
|
508 | 207 | |
|
509 | 208 | exec In[5:9] + In[14] + In[21:25]""" |
|
510 | 209 | |
|
511 | 210 | def __getslice__(self,i,j): |
|
512 |
return ''.join( |
|
|
513 | ||
|
514 | #**************************************************************************** | |
|
515 | # Local use exceptions | |
|
516 | class SpaceInInput(exceptions.Exception): | |
|
517 | pass | |
|
211 | return ''.join(list.__getslice__(self,i,j)) | |
|
518 | 212 | |
|
519 | 213 | #**************************************************************************** |
|
520 | 214 | # Main IPython class |
|
521 | ||
|
522 | class InteractiveShell(code.InteractiveConsole, Logger, Magic): | |
|
215 | class InteractiveShell(Logger, Magic): | |
|
523 | 216 | """An enhanced console for Python.""" |
|
524 | 217 | |
|
525 | 218 | def __init__(self,name,usage=None,rc=Struct(opts=None,args=None), |
|
526 | 219 | user_ns = None,user_global_ns=None,banner2='', |
|
527 | 220 | custom_exceptions=((),None),embedded=False): |
|
528 | 221 | |
|
529 | 222 | # Put a reference to self in builtins so that any form of embedded or |
|
530 | 223 | # imported code can test for being inside IPython. |
|
531 | 224 | __builtin__.__IPYTHON__ = self |
|
532 | 225 | |
|
533 | 226 | # And load into builtins ipmagic/ipalias as well |
|
534 | 227 | __builtin__.ipmagic = ipmagic |
|
535 | 228 | __builtin__.ipalias = ipalias |
|
536 | 229 | |
|
537 | 230 | # Add to __builtin__ other parts of IPython's public API |
|
538 | 231 | __builtin__.ip_set_hook = self.set_hook |
|
539 | 232 | |
|
540 | 233 | # Keep in the builtins a flag for when IPython is active. We set it |
|
541 | 234 | # with setdefault so that multiple nested IPythons don't clobber one |
|
542 | 235 | # another. Each will increase its value by one upon being activated, |
|
543 | 236 | # which also gives us a way to determine the nesting level. |
|
544 | 237 | __builtin__.__dict__.setdefault('__IPYTHON__active',0) |
|
545 | 238 | |
|
546 | # Inform the user of ipython's fast exit magics. | |
|
547 | _exit = ' Use %Exit or %Quit to exit without confirmation.' | |
|
548 | __builtin__.exit += _exit | |
|
549 | __builtin__.quit += _exit | |
|
239 | # Do the intuitively correct thing for quit/exit: we remove the | |
|
240 | # builtins if they exist, and our own prefilter routine will handle | |
|
241 | # these special cases | |
|
242 | try: | |
|
243 | del __builtin__.exit, __builtin__.quit | |
|
244 | except AttributeError: | |
|
245 | pass | |
|
550 | 246 | |
|
551 | 247 | # We need to know whether the instance is meant for embedding, since |
|
552 | 248 | # global/local namespaces need to be handled differently in that case |
|
553 | 249 | self.embedded = embedded |
|
554 | 250 | |
|
555 | 251 | # compiler command |
|
556 | self.compile = CommandCompiler() | |
|
252 | self.compile = codeop.CommandCompiler() | |
|
557 | 253 | |
|
558 | 254 | # User input buffer |
|
559 | 255 | self.buffer = [] |
|
560 | 256 | |
|
561 | 257 | # Default name given in compilation of code |
|
562 | 258 | self.filename = '<ipython console>' |
|
563 | 259 | |
|
564 | 260 | # Create the namespace where the user will operate. user_ns is |
|
565 | 261 | # normally the only one used, and it is passed to the exec calls as |
|
566 | 262 | # the locals argument. But we do carry a user_global_ns namespace |
|
567 | 263 | # given as the exec 'globals' argument, This is useful in embedding |
|
568 | 264 | # situations where the ipython shell opens in a context where the |
|
569 | 265 | # distinction between locals and globals is meaningful. |
|
570 | 266 | |
|
571 | 267 | # FIXME. For some strange reason, __builtins__ is showing up at user |
|
572 | 268 | # level as a dict instead of a module. This is a manual fix, but I |
|
573 | 269 | # should really track down where the problem is coming from. Alex |
|
574 | 270 | # Schmolck reported this problem first. |
|
575 | 271 | |
|
576 | 272 | # A useful post by Alex Martelli on this topic: |
|
577 | 273 | # Re: inconsistent value from __builtins__ |
|
578 | 274 | # Von: Alex Martelli <aleaxit@yahoo.com> |
|
579 | 275 | # Datum: Freitag 01 Oktober 2004 04:45:34 nachmittags/abends |
|
580 | 276 | # Gruppen: comp.lang.python |
|
581 | 277 | # Referenzen: 1 |
|
582 | 278 | |
|
583 | 279 | # Michael Hohn <hohn@hooknose.lbl.gov> wrote: |
|
584 | 280 | # > >>> print type(builtin_check.get_global_binding('__builtins__')) |
|
585 | 281 | # > <type 'dict'> |
|
586 | 282 | # > >>> print type(__builtins__) |
|
587 | 283 | # > <type 'module'> |
|
588 | 284 | # > Is this difference in return value intentional? |
|
589 | 285 | |
|
590 | 286 | # Well, it's documented that '__builtins__' can be either a dictionary |
|
591 | 287 | # or a module, and it's been that way for a long time. Whether it's |
|
592 |
# intentional (or sensible), I don't know. In any case, the idea is |
|
|
593 |
# if you need to access the built-in namespace directly, you |
|
|
594 |
# with "import __builtin__" (note, no 's') which will |
|
|
595 | # a module. Yeah, it's somewhat confusing:-(. | |
|
288 | # intentional (or sensible), I don't know. In any case, the idea is | |
|
289 | # that if you need to access the built-in namespace directly, you | |
|
290 | # should start with "import __builtin__" (note, no 's') which will | |
|
291 | # definitely give you a module. Yeah, it's somewhat confusing:-(. | |
|
596 | 292 | |
|
597 | 293 | if user_ns is None: |
|
598 | 294 | # Set __name__ to __main__ to better match the behavior of the |
|
599 | 295 | # normal interpreter. |
|
600 | 296 | user_ns = {'__name__' :'__main__', |
|
601 | 297 | '__builtins__' : __builtin__, |
|
602 | 298 | } |
|
603 | 299 | |
|
604 | 300 | if user_global_ns is None: |
|
605 | 301 | user_global_ns = {} |
|
606 | 302 | |
|
607 | 303 | # Assign namespaces |
|
608 | 304 | # This is the namespace where all normal user variables live |
|
609 | 305 | self.user_ns = user_ns |
|
610 | 306 | # Embedded instances require a separate namespace for globals. |
|
611 | 307 | # Normally this one is unused by non-embedded instances. |
|
612 | 308 | self.user_global_ns = user_global_ns |
|
613 | 309 | # A namespace to keep track of internal data structures to prevent |
|
614 | 310 | # them from cluttering user-visible stuff. Will be updated later |
|
615 | 311 | self.internal_ns = {} |
|
616 | 312 | |
|
617 | 313 | # Namespace of system aliases. Each entry in the alias |
|
618 | 314 | # table must be a 2-tuple of the form (N,name), where N is the number |
|
619 | 315 | # of positional arguments of the alias. |
|
620 | 316 | self.alias_table = {} |
|
621 | 317 | |
|
622 | 318 | # A table holding all the namespaces IPython deals with, so that |
|
623 | 319 | # introspection facilities can search easily. |
|
624 | 320 | self.ns_table = {'user':user_ns, |
|
625 | 321 | 'user_global':user_global_ns, |
|
626 | 322 | 'alias':self.alias_table, |
|
627 | 323 | 'internal':self.internal_ns, |
|
628 | 324 | 'builtin':__builtin__.__dict__ |
|
629 | 325 | } |
|
630 | 326 | |
|
631 | 327 | # The user namespace MUST have a pointer to the shell itself. |
|
632 | 328 | self.user_ns[name] = self |
|
633 | 329 | |
|
634 | 330 | # We need to insert into sys.modules something that looks like a |
|
635 | 331 | # module but which accesses the IPython namespace, for shelve and |
|
636 | 332 | # pickle to work interactively. Normally they rely on getting |
|
637 | 333 | # everything out of __main__, but for embedding purposes each IPython |
|
638 | 334 | # instance has its own private namespace, so we can't go shoving |
|
639 | 335 | # everything into __main__. |
|
640 | 336 | |
|
641 | 337 | # note, however, that we should only do this for non-embedded |
|
642 | 338 | # ipythons, which really mimic the __main__.__dict__ with their own |
|
643 | 339 | # namespace. Embedded instances, on the other hand, should not do |
|
644 | 340 | # this because they need to manage the user local/global namespaces |
|
645 | 341 | # only, but they live within a 'normal' __main__ (meaning, they |
|
646 | 342 | # shouldn't overtake the execution environment of the script they're |
|
647 | 343 | # embedded in). |
|
648 | 344 | |
|
649 | 345 | if not embedded: |
|
650 | 346 | try: |
|
651 | 347 | main_name = self.user_ns['__name__'] |
|
652 | 348 | except KeyError: |
|
653 | 349 | raise KeyError,'user_ns dictionary MUST have a "__name__" key' |
|
654 | 350 | else: |
|
655 | 351 | #print "pickle hack in place" # dbg |
|
656 | 352 | sys.modules[main_name] = FakeModule(self.user_ns) |
|
657 | 353 | |
|
658 | 354 | # List of input with multi-line handling. |
|
659 | 355 | # Fill its zero entry, user counter starts at 1 |
|
660 | 356 | self.input_hist = InputList(['\n']) |
|
661 | 357 | |
|
662 | 358 | # list of visited directories |
|
663 | 359 | try: |
|
664 | 360 | self.dir_hist = [os.getcwd()] |
|
665 | 361 | except IOError, e: |
|
666 | 362 | self.dir_hist = [] |
|
667 | 363 | |
|
668 | 364 | # dict of output history |
|
669 | 365 | self.output_hist = {} |
|
670 | 366 | |
|
671 |
# dict of things NOT to alias (keywords, builtins and some |
|
|
367 | # dict of things NOT to alias (keywords, builtins and some magics) | |
|
672 | 368 | no_alias = {} |
|
673 | 369 | no_alias_magics = ['cd','popd','pushd','dhist','alias','unalias'] |
|
674 | 370 | for key in keyword.kwlist + no_alias_magics: |
|
675 | 371 | no_alias[key] = 1 |
|
676 | 372 | no_alias.update(__builtin__.__dict__) |
|
677 | 373 | self.no_alias = no_alias |
|
678 | 374 | |
|
679 | 375 | # make global variables for user access to these |
|
680 | 376 | self.user_ns['_ih'] = self.input_hist |
|
681 | 377 | self.user_ns['_oh'] = self.output_hist |
|
682 | 378 | self.user_ns['_dh'] = self.dir_hist |
|
683 | 379 | |
|
684 | 380 | # user aliases to input and output histories |
|
685 | 381 | self.user_ns['In'] = self.input_hist |
|
686 | 382 | self.user_ns['Out'] = self.output_hist |
|
687 | 383 | |
|
688 | 384 | # Store the actual shell's name |
|
689 | 385 | self.name = name |
|
690 | 386 | |
|
691 | 387 | # Object variable to store code object waiting execution. This is |
|
692 | 388 | # used mainly by the multithreaded shells, but it can come in handy in |
|
693 | 389 | # other situations. No need to use a Queue here, since it's a single |
|
694 | 390 | # item which gets cleared once run. |
|
695 | 391 | self.code_to_run = None |
|
696 | 392 | |
|
697 | 393 | # Job manager (for jobs run as background threads) |
|
698 | 394 | self.jobs = BackgroundJobManager() |
|
699 | 395 | # Put the job manager into builtins so it's always there. |
|
700 | 396 | __builtin__.jobs = self.jobs |
|
701 | 397 | |
|
702 | 398 | # escapes for automatic behavior on the command line |
|
703 | 399 | self.ESC_SHELL = '!' |
|
704 | 400 | self.ESC_HELP = '?' |
|
705 | 401 | self.ESC_MAGIC = '%' |
|
706 | 402 | self.ESC_QUOTE = ',' |
|
707 | 403 | self.ESC_QUOTE2 = ';' |
|
708 | 404 | self.ESC_PAREN = '/' |
|
709 | 405 | |
|
710 | 406 | # And their associated handlers |
|
711 | 407 | self.esc_handlers = {self.ESC_PAREN:self.handle_auto, |
|
712 | 408 | self.ESC_QUOTE:self.handle_auto, |
|
713 | 409 | self.ESC_QUOTE2:self.handle_auto, |
|
714 | 410 | self.ESC_MAGIC:self.handle_magic, |
|
715 | 411 | self.ESC_HELP:self.handle_help, |
|
716 | 412 | self.ESC_SHELL:self.handle_shell_escape, |
|
717 | 413 | } |
|
718 | 414 | |
|
719 | 415 | # class initializations |
|
720 | 416 | Logger.__init__(self,log_ns = self.user_ns) |
|
721 | 417 | Magic.__init__(self,self) |
|
722 | 418 | |
|
723 | 419 | # an ugly hack to get a pointer to the shell, so I can start writing |
|
724 | 420 | # magic code via this pointer instead of the current mixin salad. |
|
725 | 421 | Magic.set_shell(self,self) |
|
726 | 422 | |
|
727 | 423 | # Python source parser/formatter for syntax highlighting |
|
728 | 424 | pyformat = Parser().format |
|
729 | 425 | self.pycolorize = lambda src: pyformat(src,'str',self.rc['colors']) |
|
730 | 426 | |
|
731 | 427 | # hooks holds pointers used for user-side customizations |
|
732 | 428 | self.hooks = Struct() |
|
733 | 429 | |
|
734 | 430 | # Set all default hooks, defined in the IPython.hooks module. |
|
735 | 431 | hooks = IPython.hooks |
|
736 | 432 | for hook_name in hooks.__all__: |
|
737 | 433 | self.set_hook(hook_name,getattr(hooks,hook_name)) |
|
738 | 434 | |
|
739 | 435 | # Flag to mark unconditional exit |
|
740 | 436 | self.exit_now = False |
|
741 | 437 | |
|
742 | 438 | self.usage_min = """\ |
|
743 | 439 | An enhanced console for Python. |
|
744 | 440 | Some of its features are: |
|
745 | 441 | - Readline support if the readline library is present. |
|
746 | 442 | - Tab completion in the local namespace. |
|
747 | 443 | - Logging of input, see command-line options. |
|
748 | 444 | - System shell escape via ! , eg !ls. |
|
749 | 445 | - Magic commands, starting with a % (like %ls, %pwd, %cd, etc.) |
|
750 | 446 | - Keeps track of locally defined variables via %who, %whos. |
|
751 | 447 | - Show object information with a ? eg ?x or x? (use ?? for more info). |
|
752 | 448 | """ |
|
753 | 449 | if usage: self.usage = usage |
|
754 | 450 | else: self.usage = self.usage_min |
|
755 | 451 | |
|
756 | 452 | # Storage |
|
757 | 453 | self.rc = rc # This will hold all configuration information |
|
758 | 454 | self.inputcache = [] |
|
759 | 455 | self._boundcache = [] |
|
760 | 456 | self.pager = 'less' |
|
761 | 457 | # temporary files used for various purposes. Deleted at exit. |
|
762 | 458 | self.tempfiles = [] |
|
763 | 459 | |
|
764 | 460 | # Keep track of readline usage (later set by init_readline) |
|
765 |
self.has_readline = |
|
|
461 | self.has_readline = False | |
|
766 | 462 | |
|
767 | 463 | # for pushd/popd management |
|
768 | 464 | try: |
|
769 | 465 | self.home_dir = get_home_dir() |
|
770 | 466 | except HomeDirError,msg: |
|
771 | 467 | fatal(msg) |
|
772 | 468 | |
|
773 | 469 | self.dir_stack = [os.getcwd().replace(self.home_dir,'~')] |
|
774 | 470 | |
|
775 | 471 | # Functions to call the underlying shell. |
|
776 | 472 | |
|
777 | 473 | # utility to expand user variables via Itpl |
|
778 | 474 | self.var_expand = lambda cmd: str(ItplNS(cmd.replace('#','\#'), |
|
779 | 475 | self.user_ns)) |
|
780 | 476 | # The first is similar to os.system, but it doesn't return a value, |
|
781 | 477 | # and it allows interpolation of variables in the user's namespace. |
|
782 | 478 | self.system = lambda cmd: shell(self.var_expand(cmd), |
|
783 | 479 | header='IPython system call: ', |
|
784 | 480 | verbose=self.rc.system_verbose) |
|
785 | 481 | # These are for getoutput and getoutputerror: |
|
786 | 482 | self.getoutput = lambda cmd: \ |
|
787 | 483 | getoutput(self.var_expand(cmd), |
|
788 | 484 | header='IPython system call: ', |
|
789 | 485 | verbose=self.rc.system_verbose) |
|
790 | 486 | self.getoutputerror = lambda cmd: \ |
|
791 | 487 | getoutputerror(str(ItplNS(cmd.replace('#','\#'), |
|
792 | 488 | self.user_ns)), |
|
793 | 489 | header='IPython system call: ', |
|
794 | 490 | verbose=self.rc.system_verbose) |
|
795 | 491 | |
|
796 | 492 | # RegExp for splitting line contents into pre-char//first |
|
797 | 493 | # word-method//rest. For clarity, each group in on one line. |
|
798 | 494 | |
|
799 | 495 | # WARNING: update the regexp if the above escapes are changed, as they |
|
800 | 496 | # are hardwired in. |
|
801 | 497 | |
|
802 | 498 | # Don't get carried away with trying to make the autocalling catch too |
|
803 | 499 | # much: it's better to be conservative rather than to trigger hidden |
|
804 | 500 | # evals() somewhere and end up causing side effects. |
|
805 | 501 | |
|
806 | 502 | self.line_split = re.compile(r'^([\s*,;/])' |
|
807 | 503 | r'([\?\w\.]+\w*\s*)' |
|
808 | 504 | r'(\(?.*$)') |
|
809 | 505 | |
|
810 | 506 | # Original re, keep around for a while in case changes break something |
|
811 | 507 | #self.line_split = re.compile(r'(^[\s*!\?%,/]?)' |
|
812 | 508 | # r'(\s*[\?\w\.]+\w*\s*)' |
|
813 | 509 | # r'(\(?.*$)') |
|
814 | 510 | |
|
815 | 511 | # RegExp to identify potential function names |
|
816 | 512 | self.re_fun_name = re.compile(r'[a-zA-Z_]([a-zA-Z0-9_.]*) *$') |
|
817 | 513 | # RegExp to exclude strings with this start from autocalling |
|
818 | 514 | self.re_exclude_auto = re.compile('^[!=()<>,\*/\+-]|^is ') |
|
515 | ||
|
819 | 516 | # try to catch also methods for stuff in lists/tuples/dicts: off |
|
820 | 517 | # (experimental). For this to work, the line_split regexp would need |
|
821 | 518 | # to be modified so it wouldn't break things at '['. That line is |
|
822 | 519 | # nasty enough that I shouldn't change it until I can test it _well_. |
|
823 | 520 | #self.re_fun_name = re.compile (r'[a-zA-Z_]([a-zA-Z0-9_.\[\]]*) ?$') |
|
824 | 521 | |
|
825 | 522 | # keep track of where we started running (mainly for crash post-mortem) |
|
826 | 523 | self.starting_dir = os.getcwd() |
|
827 | 524 | |
|
828 | 525 | # Attributes for Logger mixin class, make defaults here |
|
829 |
self._dolog = |
|
|
526 | self._dolog = False | |
|
830 | 527 | self.LOG = '' |
|
831 | 528 | self.LOGDEF = '.InteractiveShell.log' |
|
832 | 529 | self.LOGMODE = 'over' |
|
833 | 530 | self.LOGHEAD = Itpl( |
|
834 | 531 | """#log# Automatic Logger file. *** THIS MUST BE THE FIRST LINE *** |
|
835 | 532 | #log# DO NOT CHANGE THIS LINE OR THE TWO BELOW |
|
836 | 533 | #log# opts = $self.rc.opts |
|
837 | 534 | #log# args = $self.rc.args |
|
838 | 535 | #log# It is safe to make manual edits below here. |
|
839 | 536 | #log#----------------------------------------------------------------------- |
|
840 | 537 | """) |
|
841 | 538 | # Various switches which can be set |
|
842 | 539 | self.CACHELENGTH = 5000 # this is cheap, it's just text |
|
843 | 540 | self.BANNER = "Python %(version)s on %(platform)s\n" % sys.__dict__ |
|
844 | 541 | self.banner2 = banner2 |
|
845 | 542 | |
|
846 | 543 | # TraceBack handlers: |
|
847 | 544 | # Need two, one for syntax errors and one for other exceptions. |
|
848 | 545 | self.SyntaxTB = ultraTB.ListTB(color_scheme='NoColor') |
|
849 | 546 | # This one is initialized with an offset, meaning we always want to |
|
850 | 547 | # remove the topmost item in the traceback, which is our own internal |
|
851 | 548 | # code. Valid modes: ['Plain','Context','Verbose'] |
|
852 | 549 | self.InteractiveTB = ultraTB.AutoFormattedTB(mode = 'Plain', |
|
853 | 550 | color_scheme='NoColor', |
|
854 | 551 | tb_offset = 1) |
|
855 | 552 | # and add any custom exception handlers the user may have specified |
|
856 | 553 | self.set_custom_exc(*custom_exceptions) |
|
857 | 554 | |
|
858 | 555 | # Object inspector |
|
859 | 556 | ins_colors = OInspect.InspectColors |
|
860 | 557 | code_colors = PyColorize.ANSICodeColors |
|
861 | 558 | self.inspector = OInspect.Inspector(ins_colors,code_colors,'NoColor') |
|
862 |
self.autoindent = |
|
|
559 | self.autoindent = False | |
|
863 | 560 | |
|
864 | 561 | # Make some aliases automatically |
|
865 | 562 | # Prepare list of shell aliases to auto-define |
|
866 | 563 | if os.name == 'posix': |
|
867 | 564 | auto_alias = ('mkdir mkdir', 'rmdir rmdir', |
|
868 | 565 | 'mv mv -i','rm rm -i','cp cp -i', |
|
869 | 566 | 'cat cat','less less','clear clear', |
|
870 | 567 | # a better ls |
|
871 | 568 | 'ls ls -F', |
|
872 | 569 | # long ls |
|
873 | 570 | 'll ls -lF', |
|
874 | 571 | # color ls |
|
875 | 572 | 'lc ls -F -o --color', |
|
876 | 573 | # ls normal files only |
|
877 | 574 | 'lf ls -F -o --color %l | grep ^-', |
|
878 | 575 | # ls symbolic links |
|
879 | 576 | 'lk ls -F -o --color %l | grep ^l', |
|
880 | 577 | # directories or links to directories, |
|
881 | 578 | 'ldir ls -F -o --color %l | grep /$', |
|
882 | 579 | # things which are executable |
|
883 | 580 | 'lx ls -F -o --color %l | grep ^-..x', |
|
884 | 581 | ) |
|
885 | 582 | elif os.name in ['nt','dos']: |
|
886 | 583 | auto_alias = ('dir dir /on', 'ls dir /on', |
|
887 | 584 | 'ddir dir /ad /on', 'ldir dir /ad /on', |
|
888 | 585 | 'mkdir mkdir','rmdir rmdir','echo echo', |
|
889 | 586 | 'ren ren','cls cls','copy copy') |
|
890 | 587 | else: |
|
891 | 588 | auto_alias = () |
|
892 | 589 | self.auto_alias = map(lambda s:s.split(None,1),auto_alias) |
|
893 | 590 | # Call the actual (public) initializer |
|
894 | 591 | self.init_auto_alias() |
|
895 | 592 | # end __init__ |
|
896 | 593 | |
|
897 | 594 | def set_hook(self,name,hook): |
|
898 | 595 | """set_hook(name,hook) -> sets an internal IPython hook. |
|
899 | 596 | |
|
900 | 597 | IPython exposes some of its internal API as user-modifiable hooks. By |
|
901 | 598 | resetting one of these hooks, you can modify IPython's behavior to |
|
902 | 599 | call at runtime your own routines.""" |
|
903 | 600 | |
|
904 | 601 | # At some point in the future, this should validate the hook before it |
|
905 | 602 | # accepts it. Probably at least check that the hook takes the number |
|
906 | 603 | # of args it's supposed to. |
|
907 | 604 | setattr(self.hooks,name,new.instancemethod(hook,self,self.__class__)) |
|
908 | 605 | |
|
909 | 606 | def set_custom_exc(self,exc_tuple,handler): |
|
910 | 607 | """set_custom_exc(exc_tuple,handler) |
|
911 | 608 | |
|
912 | 609 | Set a custom exception handler, which will be called if any of the |
|
913 | 610 | exceptions in exc_tuple occur in the mainloop (specifically, in the |
|
914 | 611 | runcode() method. |
|
915 | 612 | |
|
916 | 613 | Inputs: |
|
917 | 614 | |
|
918 | 615 | - exc_tuple: a *tuple* of valid exceptions to call the defined |
|
919 | 616 | handler for. It is very important that you use a tuple, and NOT A |
|
920 | 617 | LIST here, because of the way Python's except statement works. If |
|
921 | 618 | you only want to trap a single exception, use a singleton tuple: |
|
922 | 619 | |
|
923 | 620 | exc_tuple == (MyCustomException,) |
|
924 | 621 | |
|
925 | 622 | - handler: this must be defined as a function with the following |
|
926 | 623 | basic interface: def my_handler(self,etype,value,tb). |
|
927 | 624 | |
|
928 | 625 | This will be made into an instance method (via new.instancemethod) |
|
929 | 626 | of IPython itself, and it will be called if any of the exceptions |
|
930 | 627 | listed in the exc_tuple are caught. If the handler is None, an |
|
931 | 628 | internal basic one is used, which just prints basic info. |
|
932 | 629 | |
|
933 | 630 | WARNING: by putting in your own exception handler into IPython's main |
|
934 | 631 | execution loop, you run a very good chance of nasty crashes. This |
|
935 | 632 | facility should only be used if you really know what you are doing.""" |
|
936 | 633 | |
|
937 | 634 | assert type(exc_tuple)==type(()) , \ |
|
938 | 635 | "The custom exceptions must be given AS A TUPLE." |
|
939 | 636 | |
|
940 | 637 | def dummy_handler(self,etype,value,tb): |
|
941 | 638 | print '*** Simple custom exception handler ***' |
|
942 | 639 | print 'Exception type :',etype |
|
943 | 640 | print 'Exception value:',value |
|
944 | 641 | print 'Traceback :',tb |
|
945 | 642 | print 'Source code :','\n'.join(self.buffer) |
|
946 | 643 | |
|
947 | 644 | if handler is None: handler = dummy_handler |
|
948 | 645 | |
|
949 | 646 | self.CustomTB = new.instancemethod(handler,self,self.__class__) |
|
950 | 647 | self.custom_exceptions = exc_tuple |
|
951 | 648 | |
|
952 | 649 | def set_custom_completer(self,completer,pos=0): |
|
953 | 650 | """set_custom_completer(completer,pos=0) |
|
954 | 651 | |
|
955 | 652 | Adds a new custom completer function. |
|
956 | 653 | |
|
957 | 654 | The position argument (defaults to 0) is the index in the completers |
|
958 | 655 | list where you want the completer to be inserted.""" |
|
959 | 656 | |
|
960 | 657 | newcomp = new.instancemethod(completer,self.Completer, |
|
961 | 658 | self.Completer.__class__) |
|
962 | 659 | self.Completer.matchers.insert(pos,newcomp) |
|
963 | 660 | |
|
964 | 661 | def complete(self,text): |
|
965 | 662 | """Return a sorted list of all possible completions on text. |
|
966 | 663 | |
|
967 | 664 | Inputs: |
|
968 | 665 | |
|
969 | 666 | - text: a string of text to be completed on. |
|
970 | 667 | |
|
971 | 668 | This is a wrapper around the completion mechanism, similar to what |
|
972 | 669 | readline does at the command line when the TAB key is hit. By |
|
973 | 670 | exposing it as a method, it can be used by other non-readline |
|
974 | 671 | environments (such as GUIs) for text completion. |
|
975 | 672 | |
|
976 | 673 | Simple usage example: |
|
977 | 674 | |
|
978 | 675 | In [1]: x = 'hello' |
|
979 | 676 | |
|
980 | 677 | In [2]: __IP.complete('x.l') |
|
981 | 678 | Out[2]: ['x.ljust', 'x.lower', 'x.lstrip']""" |
|
982 | 679 | |
|
983 | 680 | complete = self.Completer.complete |
|
984 | 681 | state = 0 |
|
985 | 682 | # use a dict so we get unique keys, since ipyhton's multiple |
|
986 | 683 | # completers can return duplicates. |
|
987 | 684 | comps = {} |
|
988 | 685 | while True: |
|
989 | 686 | newcomp = complete(text,state) |
|
990 | 687 | if newcomp is None: |
|
991 | 688 | break |
|
992 | 689 | comps[newcomp] = 1 |
|
993 | 690 | state += 1 |
|
994 | 691 | outcomps = comps.keys() |
|
995 | 692 | outcomps.sort() |
|
996 | 693 | return outcomps |
|
997 | 694 | |
|
998 | 695 | def set_completer_frame(self, frame): |
|
999 | 696 | if frame: |
|
1000 | 697 | self.Completer.namespace = frame.f_locals |
|
1001 | 698 | self.Completer.global_namespace = frame.f_globals |
|
1002 | 699 | else: |
|
1003 | 700 | self.Completer.namespace = self.user_ns |
|
1004 | 701 | self.Completer.global_namespace = self.user_global_ns |
|
1005 | 702 | |
|
1006 | 703 | def post_config_initialization(self): |
|
1007 | 704 | """Post configuration init method |
|
1008 | 705 | |
|
1009 | 706 | This is called after the configuration files have been processed to |
|
1010 | 707 | 'finalize' the initialization.""" |
|
1011 | 708 | |
|
1012 | 709 | rc = self.rc |
|
1013 | 710 | |
|
1014 | 711 | # Load readline proper |
|
1015 | 712 | if rc.readline: |
|
1016 | 713 | self.init_readline() |
|
1017 | 714 | |
|
1018 |
# Set user colors (don't do it in the constructor above so that it |
|
|
1019 | # crash if colors option is invalid) | |
|
715 | # Set user colors (don't do it in the constructor above so that it | |
|
716 | # doesn't crash if colors option is invalid) | |
|
1020 | 717 | self.magic_colors(rc.colors) |
|
1021 | 718 | |
|
1022 | 719 | # Load user aliases |
|
1023 | 720 | for alias in rc.alias: |
|
1024 | 721 | self.magic_alias(alias) |
|
1025 | 722 | |
|
1026 | 723 | # dynamic data that survives through sessions |
|
1027 | 724 | # XXX make the filename a config option? |
|
1028 | 725 | persist_base = 'persist' |
|
1029 | 726 | if rc.profile: |
|
1030 | 727 | persist_base += '_%s' % rc.profile |
|
1031 | 728 | self.persist_fname = os.path.join(rc.ipythondir,persist_base) |
|
1032 | 729 | |
|
1033 | 730 | try: |
|
1034 | 731 | self.persist = pickle.load(file(self.persist_fname)) |
|
1035 | 732 | except: |
|
1036 | 733 | self.persist = {} |
|
1037 | 734 | |
|
1038 | 735 | def init_auto_alias(self): |
|
1039 | 736 | """Define some aliases automatically. |
|
1040 | 737 | |
|
1041 | 738 | These are ALL parameter-less aliases""" |
|
1042 | 739 | for alias,cmd in self.auto_alias: |
|
1043 | 740 | self.alias_table[alias] = (0,cmd) |
|
1044 | 741 | |
|
1045 | 742 | def alias_table_validate(self,verbose=0): |
|
1046 | 743 | """Update information about the alias table. |
|
1047 | 744 | |
|
1048 | 745 | In particular, make sure no Python keywords/builtins are in it.""" |
|
1049 | 746 | |
|
1050 | 747 | no_alias = self.no_alias |
|
1051 | 748 | for k in self.alias_table.keys(): |
|
1052 | 749 | if k in no_alias: |
|
1053 | 750 | del self.alias_table[k] |
|
1054 | 751 | if verbose: |
|
1055 | 752 | print ("Deleting alias <%s>, it's a Python " |
|
1056 | 753 | "keyword or builtin." % k) |
|
1057 | 754 | |
|
1058 | 755 | def set_autoindent(self,value=None): |
|
1059 | 756 | """Set the autoindent flag, checking for readline support. |
|
1060 | 757 | |
|
1061 | 758 | If called with no arguments, it acts as a toggle.""" |
|
1062 | 759 | |
|
1063 | 760 | if not self.has_readline: |
|
1064 | 761 | if os.name == 'posix': |
|
1065 | 762 | warn("The auto-indent feature requires the readline library") |
|
1066 | 763 | self.autoindent = 0 |
|
1067 | 764 | return |
|
1068 | 765 | if value is None: |
|
1069 | 766 | self.autoindent = not self.autoindent |
|
1070 | 767 | else: |
|
1071 | 768 | self.autoindent = value |
|
1072 | 769 | |
|
1073 | 770 | def rc_set_toggle(self,rc_field,value=None): |
|
1074 | 771 | """Set or toggle a field in IPython's rc config. structure. |
|
1075 | 772 | |
|
1076 | 773 | If called with no arguments, it acts as a toggle. |
|
1077 | 774 | |
|
1078 | 775 | If called with a non-existent field, the resulting AttributeError |
|
1079 | 776 | exception will propagate out.""" |
|
1080 | 777 | |
|
1081 | 778 | rc_val = getattr(self.rc,rc_field) |
|
1082 | 779 | if value is None: |
|
1083 | 780 | value = not rc_val |
|
1084 | 781 | setattr(self.rc,rc_field,value) |
|
1085 | 782 | |
|
1086 | 783 | def user_setup(self,ipythondir,rc_suffix,mode='install'): |
|
1087 | 784 | """Install the user configuration directory. |
|
1088 | 785 | |
|
1089 | 786 | Can be called when running for the first time or to upgrade the user's |
|
1090 | 787 | .ipython/ directory with the mode parameter. Valid modes are 'install' |
|
1091 | 788 | and 'upgrade'.""" |
|
1092 | 789 | |
|
1093 | 790 | def wait(): |
|
1094 | 791 | try: |
|
1095 | 792 | raw_input("Please press <RETURN> to start IPython.") |
|
1096 | 793 | except EOFError: |
|
1097 | 794 | print >> Term.cout |
|
1098 | 795 | print '*'*70 |
|
1099 | 796 | |
|
1100 | 797 | cwd = os.getcwd() # remember where we started |
|
1101 | 798 | glb = glob.glob |
|
1102 | 799 | print '*'*70 |
|
1103 | 800 | if mode == 'install': |
|
1104 | 801 | print \ |
|
1105 | 802 | """Welcome to IPython. I will try to create a personal configuration directory |
|
1106 | 803 | where you can customize many aspects of IPython's functionality in:\n""" |
|
1107 | 804 | else: |
|
1108 | 805 | print 'I am going to upgrade your configuration in:' |
|
1109 | 806 | |
|
1110 | 807 | print ipythondir |
|
1111 | 808 | |
|
1112 | 809 | rcdirend = os.path.join('IPython','UserConfig') |
|
1113 | 810 | cfg = lambda d: os.path.join(d,rcdirend) |
|
1114 | 811 | try: |
|
1115 | 812 | rcdir = filter(os.path.isdir,map(cfg,sys.path))[0] |
|
1116 | 813 | except IOError: |
|
1117 | 814 | warning = """ |
|
1118 | 815 | Installation error. IPython's directory was not found. |
|
1119 | 816 | |
|
1120 | 817 | Check the following: |
|
1121 | 818 | |
|
1122 | 819 | The ipython/IPython directory should be in a directory belonging to your |
|
1123 | 820 | PYTHONPATH environment variable (that is, it should be in a directory |
|
1124 | 821 | belonging to sys.path). You can copy it explicitly there or just link to it. |
|
1125 | 822 | |
|
1126 | 823 | IPython will proceed with builtin defaults. |
|
1127 | 824 | """ |
|
1128 | 825 | warn(warning) |
|
1129 | 826 | wait() |
|
1130 | 827 | return |
|
1131 | 828 | |
|
1132 | 829 | if mode == 'install': |
|
1133 | 830 | try: |
|
1134 | 831 | shutil.copytree(rcdir,ipythondir) |
|
1135 | 832 | os.chdir(ipythondir) |
|
1136 | 833 | rc_files = glb("ipythonrc*") |
|
1137 | 834 | for rc_file in rc_files: |
|
1138 | 835 | os.rename(rc_file,rc_file+rc_suffix) |
|
1139 | 836 | except: |
|
1140 | 837 | warning = """ |
|
1141 | 838 | |
|
1142 | 839 | There was a problem with the installation: |
|
1143 | 840 | %s |
|
1144 | 841 | Try to correct it or contact the developers if you think it's a bug. |
|
1145 | 842 | IPython will proceed with builtin defaults.""" % sys.exc_info()[1] |
|
1146 | 843 | warn(warning) |
|
1147 | 844 | wait() |
|
1148 | 845 | return |
|
1149 | 846 | |
|
1150 | 847 | elif mode == 'upgrade': |
|
1151 | 848 | try: |
|
1152 | 849 | os.chdir(ipythondir) |
|
1153 | 850 | except: |
|
1154 | 851 | print """ |
|
1155 | 852 | Can not upgrade: changing to directory %s failed. Details: |
|
1156 | 853 | %s |
|
1157 | 854 | """ % (ipythondir,sys.exc_info()[1]) |
|
1158 | 855 | wait() |
|
1159 | 856 | return |
|
1160 | 857 | else: |
|
1161 | 858 | sources = glb(os.path.join(rcdir,'[A-Za-z]*')) |
|
1162 | 859 | for new_full_path in sources: |
|
1163 | 860 | new_filename = os.path.basename(new_full_path) |
|
1164 | 861 | if new_filename.startswith('ipythonrc'): |
|
1165 | 862 | new_filename = new_filename + rc_suffix |
|
1166 | 863 | # The config directory should only contain files, skip any |
|
1167 | 864 | # directories which may be there (like CVS) |
|
1168 | 865 | if os.path.isdir(new_full_path): |
|
1169 | 866 | continue |
|
1170 | 867 | if os.path.exists(new_filename): |
|
1171 | 868 | old_file = new_filename+'.old' |
|
1172 | 869 | if os.path.exists(old_file): |
|
1173 | 870 | os.remove(old_file) |
|
1174 | 871 | os.rename(new_filename,old_file) |
|
1175 | 872 | shutil.copy(new_full_path,new_filename) |
|
1176 | 873 | else: |
|
1177 | 874 | raise ValueError,'unrecognized mode for install:',`mode` |
|
1178 | 875 | |
|
1179 | 876 | # Fix line-endings to those native to each platform in the config |
|
1180 | 877 | # directory. |
|
1181 | 878 | try: |
|
1182 | 879 | os.chdir(ipythondir) |
|
1183 | 880 | except: |
|
1184 | 881 | print """ |
|
1185 | 882 | Problem: changing to directory %s failed. |
|
1186 | 883 | Details: |
|
1187 | 884 | %s |
|
1188 | 885 | |
|
1189 | 886 | Some configuration files may have incorrect line endings. This should not |
|
1190 | 887 | cause any problems during execution. """ % (ipythondir,sys.exc_info()[1]) |
|
1191 | 888 | wait() |
|
1192 | 889 | else: |
|
1193 | 890 | for fname in glb('ipythonrc*'): |
|
1194 | 891 | try: |
|
1195 | 892 | native_line_ends(fname,backup=0) |
|
1196 | 893 | except IOError: |
|
1197 | 894 | pass |
|
1198 | 895 | |
|
1199 | 896 | if mode == 'install': |
|
1200 | 897 | print """ |
|
1201 | 898 | Successful installation! |
|
1202 | 899 | |
|
1203 | 900 | Please read the sections 'Initial Configuration' and 'Quick Tips' in the |
|
1204 | 901 | IPython manual (there are both HTML and PDF versions supplied with the |
|
1205 | 902 | distribution) to make sure that your system environment is properly configured |
|
1206 | 903 | to take advantage of IPython's features.""" |
|
1207 | 904 | else: |
|
1208 | 905 | print """ |
|
1209 | 906 | Successful upgrade! |
|
1210 | 907 | |
|
1211 | 908 | All files in your directory: |
|
1212 | 909 | %(ipythondir)s |
|
1213 | 910 | which would have been overwritten by the upgrade were backed up with a .old |
|
1214 | 911 | extension. If you had made particular customizations in those files you may |
|
1215 | 912 | want to merge them back into the new files.""" % locals() |
|
1216 | 913 | wait() |
|
1217 | 914 | os.chdir(cwd) |
|
1218 | 915 | # end user_setup() |
|
1219 | 916 | |
|
1220 | 917 | def atexit_operations(self): |
|
1221 | 918 | """This will be executed at the time of exit. |
|
1222 | 919 | |
|
1223 | 920 | Saving of persistent data should be performed here. """ |
|
1224 | 921 | |
|
1225 | 922 | # input history |
|
1226 | 923 | self.savehist() |
|
1227 | 924 | |
|
1228 | 925 | # Cleanup all tempfiles left around |
|
1229 | 926 | for tfile in self.tempfiles: |
|
1230 | 927 | try: |
|
1231 | 928 | os.unlink(tfile) |
|
1232 | 929 | except OSError: |
|
1233 | 930 | pass |
|
1234 | 931 | |
|
1235 | 932 | # save the "persistent data" catch-all dictionary |
|
1236 | 933 | try: |
|
1237 | 934 | pickle.dump(self.persist, open(self.persist_fname,"w")) |
|
1238 | 935 | except: |
|
1239 | 936 | print "*** ERROR *** persistent data saving failed." |
|
1240 | 937 | |
|
1241 | 938 | def savehist(self): |
|
1242 | 939 | """Save input history to a file (via readline library).""" |
|
1243 | 940 | try: |
|
1244 | 941 | self.readline.write_history_file(self.histfile) |
|
1245 | 942 | except: |
|
1246 | 943 | print 'Unable to save IPython command history to file: ' + \ |
|
1247 | 944 | `self.histfile` |
|
1248 | 945 | |
|
1249 | 946 | def pre_readline(self): |
|
1250 | 947 | """readline hook to be used at the start of each line. |
|
1251 | 948 | |
|
1252 | 949 | Currently it handles auto-indent only.""" |
|
1253 | 950 | |
|
1254 | 951 | self.readline.insert_text(' '* self.readline_indent) |
|
1255 | 952 | |
|
1256 | 953 | def init_readline(self): |
|
1257 | 954 | """Command history completion/saving/reloading.""" |
|
1258 | 955 | try: |
|
1259 | 956 | import readline |
|
1260 | self.Completer = MagicCompleter(self, | |
|
1261 | self.user_ns, | |
|
1262 | self.user_global_ns, | |
|
1263 | self.rc.readline_omit__names, | |
|
1264 | self.alias_table) | |
|
1265 | except ImportError,NameError: | |
|
1266 | # If FlexCompleter failed to import, MagicCompleter won't be | |
|
1267 | # defined. This can happen because of a problem with readline | |
|
957 | except ImportError: | |
|
1268 | 958 | self.has_readline = 0 |
|
959 | self.readline = None | |
|
1269 | 960 | # no point in bugging windows users with this every time: |
|
1270 | 961 | if os.name == 'posix': |
|
1271 | 962 | warn('Readline services not available on this platform.') |
|
1272 | 963 | else: |
|
1273 | 964 | import atexit |
|
965 | from IPython.completer import IPCompleter | |
|
966 | self.Completer = IPCompleter(self, | |
|
967 | self.user_ns, | |
|
968 | self.user_global_ns, | |
|
969 | self.rc.readline_omit__names, | |
|
970 | self.alias_table) | |
|
1274 | 971 | |
|
1275 | 972 | # Platform-specific configuration |
|
1276 | 973 | if os.name == 'nt': |
|
1277 | # readline under Windows modifies the default exit behavior | |
|
1278 | # from being Ctrl-Z/Return to the Unix Ctrl-D one. | |
|
1279 | __builtin__.exit = __builtin__.quit = \ | |
|
1280 | ('Use Ctrl-D (i.e. EOF) to exit. ' | |
|
1281 | 'Use %Exit or %Quit to exit without confirmation.') | |
|
1282 | 974 | self.readline_startup_hook = readline.set_pre_input_hook |
|
1283 | 975 | else: |
|
1284 | 976 | self.readline_startup_hook = readline.set_startup_hook |
|
1285 | 977 | |
|
1286 | 978 | # Load user's initrc file (readline config) |
|
1287 | 979 | inputrc_name = os.environ.get('INPUTRC') |
|
1288 | 980 | if inputrc_name is None: |
|
1289 | 981 | home_dir = get_home_dir() |
|
1290 | 982 | if home_dir is not None: |
|
1291 | 983 | inputrc_name = os.path.join(home_dir,'.inputrc') |
|
1292 | 984 | if os.path.isfile(inputrc_name): |
|
1293 | 985 | try: |
|
1294 | 986 | readline.read_init_file(inputrc_name) |
|
1295 | 987 | except: |
|
1296 | 988 | warn('Problems reading readline initialization file <%s>' |
|
1297 | 989 | % inputrc_name) |
|
1298 | 990 | |
|
1299 | 991 | self.has_readline = 1 |
|
1300 | 992 | self.readline = readline |
|
1301 | 993 | self.readline_indent = 0 # for auto-indenting via readline |
|
1302 | 994 | # save this in sys so embedded copies can restore it properly |
|
1303 | 995 | sys.ipcompleter = self.Completer.complete |
|
1304 | 996 | readline.set_completer(self.Completer.complete) |
|
1305 | 997 | |
|
1306 | 998 | # Configure readline according to user's prefs |
|
1307 | 999 | for rlcommand in self.rc.readline_parse_and_bind: |
|
1308 | 1000 | readline.parse_and_bind(rlcommand) |
|
1309 | 1001 | |
|
1310 | 1002 | # remove some chars from the delimiters list |
|
1311 | 1003 | delims = readline.get_completer_delims() |
|
1312 | 1004 | delims = delims.translate(string._idmap, |
|
1313 | 1005 | self.rc.readline_remove_delims) |
|
1314 | 1006 | readline.set_completer_delims(delims) |
|
1315 | 1007 | # otherwise we end up with a monster history after a while: |
|
1316 | 1008 | readline.set_history_length(1000) |
|
1317 | 1009 | try: |
|
1318 | 1010 | #print '*** Reading readline history' # dbg |
|
1319 | 1011 | readline.read_history_file(self.histfile) |
|
1320 | 1012 | except IOError: |
|
1321 | 1013 | pass # It doesn't exist yet. |
|
1322 | 1014 | |
|
1323 | 1015 | atexit.register(self.atexit_operations) |
|
1324 | 1016 | del atexit |
|
1325 | 1017 | |
|
1326 | 1018 | # Configure auto-indent for all platforms |
|
1327 | 1019 | self.set_autoindent(self.rc.autoindent) |
|
1328 | 1020 | |
|
1329 | 1021 | def showsyntaxerror(self, filename=None): |
|
1330 | 1022 | """Display the syntax error that just occurred. |
|
1331 | 1023 | |
|
1332 | 1024 | This doesn't display a stack trace because there isn't one. |
|
1333 | 1025 | |
|
1334 | 1026 | If a filename is given, it is stuffed in the exception instead |
|
1335 | 1027 | of what was there before (because Python's parser always uses |
|
1336 | 1028 | "<string>" when reading from a string). |
|
1337 | 1029 | """ |
|
1338 | 1030 | type, value, sys.last_traceback = sys.exc_info() |
|
1339 | 1031 | sys.last_type = type |
|
1340 | 1032 | sys.last_value = value |
|
1341 | 1033 | if filename and type is SyntaxError: |
|
1342 | 1034 | # Work hard to stuff the correct filename in the exception |
|
1343 | 1035 | try: |
|
1344 | 1036 | msg, (dummy_filename, lineno, offset, line) = value |
|
1345 | 1037 | except: |
|
1346 | 1038 | # Not the format we expect; leave it alone |
|
1347 | 1039 | pass |
|
1348 | 1040 | else: |
|
1349 | 1041 | # Stuff in the right filename |
|
1350 | 1042 | try: |
|
1351 | 1043 | # Assume SyntaxError is a class exception |
|
1352 | 1044 | value = SyntaxError(msg, (filename, lineno, offset, line)) |
|
1353 | 1045 | except: |
|
1354 | 1046 | # If that failed, assume SyntaxError is a string |
|
1355 | 1047 | value = msg, (filename, lineno, offset, line) |
|
1356 | 1048 | self.SyntaxTB(type,value,[]) |
|
1357 | 1049 | |
|
1358 | 1050 | def debugger(self): |
|
1359 | 1051 | """Call the pdb debugger.""" |
|
1360 | 1052 | |
|
1361 | 1053 | if not self.rc.pdb: |
|
1362 | 1054 | return |
|
1363 | 1055 | pdb.pm() |
|
1364 | 1056 | |
|
1365 | 1057 | def showtraceback(self,exc_tuple = None,filename=None): |
|
1366 | 1058 | """Display the exception that just occurred.""" |
|
1367 | 1059 | |
|
1368 | 1060 | # Though this won't be called by syntax errors in the input line, |
|
1369 | 1061 | # there may be SyntaxError cases whith imported code. |
|
1370 | 1062 | if exc_tuple is None: |
|
1371 | 1063 | type, value, tb = sys.exc_info() |
|
1372 | 1064 | else: |
|
1373 | 1065 | type, value, tb = exc_tuple |
|
1374 | 1066 | if type is SyntaxError: |
|
1375 | 1067 | self.showsyntaxerror(filename) |
|
1376 | 1068 | else: |
|
1377 | 1069 | sys.last_type = type |
|
1378 | 1070 | sys.last_value = value |
|
1379 | 1071 | sys.last_traceback = tb |
|
1380 | 1072 | self.InteractiveTB() |
|
1381 | 1073 | if self.InteractiveTB.call_pdb and self.has_readline: |
|
1382 | 1074 | # pdb mucks up readline, fix it back |
|
1383 | 1075 | self.readline.set_completer(self.Completer.complete) |
|
1384 | 1076 | |
|
1385 | 1077 | def update_cache(self, line): |
|
1386 | 1078 | """puts line into cache""" |
|
1387 | 1079 | self.inputcache.insert(0, line) # This copies the cache every time ... :-( |
|
1388 | 1080 | if len(self.inputcache) >= self.CACHELENGTH: |
|
1389 |
self.inputcache.pop() # This |
|
|
1081 | self.inputcache.pop() # This doesn't :-) | |
|
1390 | 1082 | |
|
1391 | 1083 | def mainloop(self,banner=None): |
|
1392 | 1084 | """Creates the local namespace and starts the mainloop. |
|
1393 | 1085 | |
|
1394 | 1086 | If an optional banner argument is given, it will override the |
|
1395 | 1087 | internally created default banner.""" |
|
1396 | 1088 | |
|
1397 | 1089 | if self.rc.c: # Emulate Python's -c option |
|
1398 | 1090 | self.exec_init_cmd() |
|
1399 | 1091 | if banner is None: |
|
1400 | 1092 | if self.rc.banner: |
|
1401 | 1093 | banner = self.BANNER+self.banner2 |
|
1402 | 1094 | else: |
|
1403 | 1095 | banner = '' |
|
1404 | 1096 | self.interact(banner) |
|
1405 | 1097 | |
|
1406 | 1098 | def exec_init_cmd(self): |
|
1407 | 1099 | """Execute a command given at the command line. |
|
1408 | 1100 | |
|
1409 | 1101 | This emulates Python's -c option.""" |
|
1410 | 1102 | |
|
1411 | 1103 | sys.argv = ['-c'] |
|
1412 | 1104 | self.push(self.rc.c) |
|
1413 | 1105 | |
|
1414 | 1106 | def embed_mainloop(self,header='',local_ns=None,global_ns=None,stack_depth=0): |
|
1415 | 1107 | """Embeds IPython into a running python program. |
|
1416 | 1108 | |
|
1417 | 1109 | Input: |
|
1418 | 1110 | |
|
1419 | 1111 | - header: An optional header message can be specified. |
|
1420 | 1112 | |
|
1421 | 1113 | - local_ns, global_ns: working namespaces. If given as None, the |
|
1422 | 1114 | IPython-initialized one is updated with __main__.__dict__, so that |
|
1423 | 1115 | program variables become visible but user-specific configuration |
|
1424 | 1116 | remains possible. |
|
1425 | 1117 | |
|
1426 | 1118 | - stack_depth: specifies how many levels in the stack to go to |
|
1427 | 1119 | looking for namespaces (when local_ns and global_ns are None). This |
|
1428 | 1120 | allows an intermediate caller to make sure that this function gets |
|
1429 | 1121 | the namespace from the intended level in the stack. By default (0) |
|
1430 | 1122 | it will get its locals and globals from the immediate caller. |
|
1431 | 1123 | |
|
1432 | 1124 | Warning: it's possible to use this in a program which is being run by |
|
1433 | 1125 | IPython itself (via %run), but some funny things will happen (a few |
|
1434 | 1126 | globals get overwritten). In the future this will be cleaned up, as |
|
1435 | 1127 | there is no fundamental reason why it can't work perfectly.""" |
|
1436 | 1128 | |
|
1437 | 1129 | # Get locals and globals from caller |
|
1438 | 1130 | if local_ns is None or global_ns is None: |
|
1439 | 1131 | call_frame = sys._getframe(stack_depth).f_back |
|
1440 | 1132 | |
|
1441 | 1133 | if local_ns is None: |
|
1442 | 1134 | local_ns = call_frame.f_locals |
|
1443 | 1135 | if global_ns is None: |
|
1444 | 1136 | global_ns = call_frame.f_globals |
|
1445 | 1137 | |
|
1446 | 1138 | # Update namespaces and fire up interpreter |
|
1447 | 1139 | self.user_ns = local_ns |
|
1448 | 1140 | self.user_global_ns = global_ns |
|
1449 | 1141 | |
|
1450 | 1142 | # Patch for global embedding to make sure that things don't overwrite |
|
1451 | 1143 | # user globals accidentally. Thanks to Richard <rxe@renre-europe.com> |
|
1452 | 1144 | # FIXME. Test this a bit more carefully (the if.. is new) |
|
1453 | 1145 | if local_ns is None and global_ns is None: |
|
1454 | 1146 | self.user_global_ns.update(__main__.__dict__) |
|
1455 | 1147 | |
|
1456 | 1148 | # make sure the tab-completer has the correct frame information, so it |
|
1457 | 1149 | # actually completes using the frame's locals/globals |
|
1458 | 1150 | self.set_completer_frame(call_frame) |
|
1459 | 1151 | |
|
1460 | 1152 | self.interact(header) |
|
1461 | 1153 | |
|
1462 | 1154 | def interact(self, banner=None): |
|
1463 | 1155 | """Closely emulate the interactive Python console. |
|
1464 | 1156 | |
|
1465 | 1157 | The optional banner argument specify the banner to print |
|
1466 | 1158 | before the first interaction; by default it prints a banner |
|
1467 | 1159 | similar to the one printed by the real Python interpreter, |
|
1468 | 1160 | followed by the current class name in parentheses (so as not |
|
1469 | 1161 | to confuse this with the real interpreter -- since it's so |
|
1470 | 1162 | close!). |
|
1471 | 1163 | |
|
1472 | 1164 | """ |
|
1473 | 1165 | cprt = 'Type "copyright", "credits" or "license" for more information.' |
|
1474 | 1166 | if banner is None: |
|
1475 | 1167 | self.write("Python %s on %s\n%s\n(%s)\n" % |
|
1476 | 1168 | (sys.version, sys.platform, cprt, |
|
1477 | 1169 | self.__class__.__name__)) |
|
1478 | 1170 | else: |
|
1479 | 1171 | self.write(banner) |
|
1480 | 1172 | |
|
1481 | 1173 | more = 0 |
|
1482 | 1174 | |
|
1483 | 1175 | # Mark activity in the builtins |
|
1484 | 1176 | __builtin__.__dict__['__IPYTHON__active'] += 1 |
|
1485 | 1177 | |
|
1486 | 1178 | # compiled regexps for autoindent management |
|
1487 | 1179 | ini_spaces_re = re.compile(r'^(\s+)') |
|
1488 | 1180 | dedent_re = re.compile(r'^\s+raise|^\s+return') |
|
1489 | 1181 | |
|
1490 | 1182 | # exit_now is set by a call to %Exit or %Quit |
|
1491 | 1183 | while not self.exit_now: |
|
1492 | 1184 | try: |
|
1493 | 1185 | if more: |
|
1494 | 1186 | prompt = self.outputcache.prompt2 |
|
1495 | 1187 | if self.autoindent: |
|
1496 | 1188 | self.readline_startup_hook(self.pre_readline) |
|
1497 | 1189 | else: |
|
1498 | 1190 | prompt = self.outputcache.prompt1 |
|
1499 | 1191 | try: |
|
1500 | 1192 | line = self.raw_input(prompt,more) |
|
1501 | 1193 | if self.autoindent: |
|
1502 | 1194 | self.readline_startup_hook(None) |
|
1503 | 1195 | except EOFError: |
|
1504 | 1196 | if self.autoindent: |
|
1505 | 1197 | self.readline_startup_hook(None) |
|
1506 | 1198 | self.write("\n") |
|
1507 |
|
|
|
1508 | if ask_yes_no('Do you really want to exit ([y]/n)?','y'): | |
|
1509 |
|
|
|
1510 | else: | |
|
1511 | break | |
|
1199 | self.exit() | |
|
1200 | except IPythonExit: | |
|
1201 | self.exit() | |
|
1512 | 1202 | else: |
|
1513 | 1203 | more = self.push(line) |
|
1514 | 1204 | # Auto-indent management |
|
1515 | 1205 | if self.autoindent: |
|
1516 | 1206 | if line: |
|
1517 | 1207 | ini_spaces = ini_spaces_re.match(line) |
|
1518 | 1208 | if ini_spaces: |
|
1519 | 1209 | nspaces = ini_spaces.end() |
|
1520 | 1210 | else: |
|
1521 | 1211 | nspaces = 0 |
|
1522 | 1212 | self.readline_indent = nspaces |
|
1523 | 1213 | |
|
1524 | 1214 | if line[-1] == ':': |
|
1525 | 1215 | self.readline_indent += 4 |
|
1526 | 1216 | elif dedent_re.match(line): |
|
1527 | 1217 | self.readline_indent -= 4 |
|
1528 | 1218 | else: |
|
1529 | 1219 | self.readline_indent = 0 |
|
1530 | 1220 | |
|
1531 | 1221 | except KeyboardInterrupt: |
|
1532 | 1222 | self.write("\nKeyboardInterrupt\n") |
|
1533 | 1223 | self.resetbuffer() |
|
1534 | 1224 | more = 0 |
|
1535 | 1225 | # keep cache in sync with the prompt counter: |
|
1536 | 1226 | self.outputcache.prompt_count -= 1 |
|
1537 | 1227 | |
|
1538 | 1228 | if self.autoindent: |
|
1539 | 1229 | self.readline_indent = 0 |
|
1540 | 1230 | |
|
1541 | 1231 | except bdb.BdbQuit: |
|
1542 | 1232 | warn("The Python debugger has exited with a BdbQuit exception.\n" |
|
1543 | 1233 | "Because of how pdb handles the stack, it is impossible\n" |
|
1544 | 1234 | "for IPython to properly format this particular exception.\n" |
|
1545 | 1235 | "IPython will resume normal operation.") |
|
1546 | 1236 | |
|
1547 | 1237 | # We are off again... |
|
1548 | 1238 | __builtin__.__dict__['__IPYTHON__active'] -= 1 |
|
1549 | 1239 | |
|
1550 | 1240 | def excepthook(self, type, value, tb): |
|
1551 | 1241 | """One more defense for GUI apps that call sys.excepthook. |
|
1552 | 1242 | |
|
1553 | 1243 | GUI frameworks like wxPython trap exceptions and call |
|
1554 | 1244 | sys.excepthook themselves. I guess this is a feature that |
|
1555 | 1245 | enables them to keep running after exceptions that would |
|
1556 | 1246 | otherwise kill their mainloop. This is a bother for IPython |
|
1557 | 1247 | which excepts to catch all of the program exceptions with a try: |
|
1558 | 1248 | except: statement. |
|
1559 | 1249 | |
|
1560 | 1250 | Normally, IPython sets sys.excepthook to a CrashHandler instance, so if |
|
1561 | 1251 | any app directly invokes sys.excepthook, it will look to the user like |
|
1562 | 1252 | IPython crashed. In order to work around this, we can disable the |
|
1563 | 1253 | CrashHandler and replace it with this excepthook instead, which prints a |
|
1564 | 1254 | regular traceback using our InteractiveTB. In this fashion, apps which |
|
1565 | 1255 | call sys.excepthook will generate a regular-looking exception from |
|
1566 | 1256 | IPython, and the CrashHandler will only be triggered by real IPython |
|
1567 | 1257 | crashes. |
|
1568 | 1258 | |
|
1569 | 1259 | This hook should be used sparingly, only in places which are not likely |
|
1570 | 1260 | to be true IPython errors. |
|
1571 | 1261 | """ |
|
1572 | 1262 | |
|
1573 | 1263 | self.InteractiveTB(type, value, tb, tb_offset=0) |
|
1574 | 1264 | if self.InteractiveTB.call_pdb and self.has_readline: |
|
1575 | 1265 | self.readline.set_completer(self.Completer.complete) |
|
1576 | 1266 | |
|
1577 | 1267 | def call_alias(self,alias,rest=''): |
|
1578 | 1268 | """Call an alias given its name and the rest of the line. |
|
1579 | 1269 | |
|
1580 | 1270 | This function MUST be given a proper alias, because it doesn't make |
|
1581 | 1271 | any checks when looking up into the alias table. The caller is |
|
1582 | 1272 | responsible for invoking it only with a valid alias.""" |
|
1583 | 1273 | |
|
1584 | 1274 | #print 'ALIAS: <%s>+<%s>' % (alias,rest) # dbg |
|
1585 | 1275 | nargs,cmd = self.alias_table[alias] |
|
1586 | 1276 | # Expand the %l special to be the user's input line |
|
1587 | 1277 | if cmd.find('%l') >= 0: |
|
1588 | 1278 | cmd = cmd.replace('%l',rest) |
|
1589 | 1279 | rest = '' |
|
1590 | 1280 | if nargs==0: |
|
1591 | 1281 | # Simple, argument-less aliases |
|
1592 | 1282 | cmd = '%s %s' % (cmd,rest) |
|
1593 | 1283 | else: |
|
1594 | 1284 | # Handle aliases with positional arguments |
|
1595 | 1285 | args = rest.split(None,nargs) |
|
1596 | 1286 | if len(args)< nargs: |
|
1597 | 1287 | error('Alias <%s> requires %s arguments, %s given.' % |
|
1598 | 1288 | (alias,nargs,len(args))) |
|
1599 | 1289 | return |
|
1600 | 1290 | cmd = '%s %s' % (cmd % tuple(args[:nargs]),' '.join(args[nargs:])) |
|
1601 | 1291 | # Now call the macro, evaluating in the user's namespace |
|
1602 | 1292 | try: |
|
1603 | 1293 | self.system(cmd) |
|
1604 | 1294 | except: |
|
1605 | 1295 | self.showtraceback() |
|
1606 | 1296 | |
|
1607 | 1297 | def runlines(self,lines): |
|
1608 | 1298 | """Run a string of one or more lines of source. |
|
1609 | 1299 | |
|
1610 | 1300 | This method is capable of running a string containing multiple source |
|
1611 | 1301 | lines, as if they had been entered at the IPython prompt. Since it |
|
1612 | 1302 | exposes IPython's processing machinery, the given strings can contain |
|
1613 | 1303 | magic calls (%magic), special shell access (!cmd), etc.""" |
|
1614 | 1304 | |
|
1615 | 1305 | # We must start with a clean buffer, in case this is run from an |
|
1616 | 1306 | # interactive IPython session (via a magic, for example). |
|
1617 | 1307 | self.resetbuffer() |
|
1618 | 1308 | lines = lines.split('\n') |
|
1619 | 1309 | more = 0 |
|
1620 | 1310 | for line in lines: |
|
1621 | 1311 | # skip blank lines so we don't mess up the prompt counter, but do |
|
1622 | 1312 | # NOT skip even a blank line if we are in a code block (more is |
|
1623 | 1313 | # true) |
|
1624 | 1314 | if line or more: |
|
1625 | 1315 | more = self.push((self.prefilter(line,more))) |
|
1626 | 1316 | # IPython's runsource returns None if there was an error |
|
1627 | 1317 | # compiling the code. This allows us to stop processing right |
|
1628 | 1318 | # away, so the user gets the error message at the right place. |
|
1629 | 1319 | if more is None: |
|
1630 | 1320 | break |
|
1631 | 1321 | # final newline in case the input didn't have it, so that the code |
|
1632 | 1322 | # actually does get executed |
|
1633 | 1323 | if more: |
|
1634 | 1324 | self.push('\n') |
|
1635 | 1325 | |
|
1636 | 1326 | def runsource(self, source, filename="<input>", symbol="single"): |
|
1637 | 1327 | """Compile and run some source in the interpreter. |
|
1638 | 1328 | |
|
1639 | 1329 | Arguments are as for compile_command(). |
|
1640 | 1330 | |
|
1641 | 1331 | One several things can happen: |
|
1642 | 1332 | |
|
1643 | 1333 | 1) The input is incorrect; compile_command() raised an |
|
1644 | 1334 | exception (SyntaxError or OverflowError). A syntax traceback |
|
1645 | 1335 | will be printed by calling the showsyntaxerror() method. |
|
1646 | 1336 | |
|
1647 | 1337 | 2) The input is incomplete, and more input is required; |
|
1648 | 1338 | compile_command() returned None. Nothing happens. |
|
1649 | 1339 | |
|
1650 | 1340 | 3) The input is complete; compile_command() returned a code |
|
1651 | 1341 | object. The code is executed by calling self.runcode() (which |
|
1652 | 1342 | also handles run-time exceptions, except for SystemExit). |
|
1653 | 1343 | |
|
1654 | 1344 | The return value is: |
|
1655 | 1345 | |
|
1656 | 1346 | - True in case 2 |
|
1657 | 1347 | |
|
1658 | 1348 | - False in the other cases, unless an exception is raised, where |
|
1659 | 1349 | None is returned instead. This can be used by external callers to |
|
1660 | 1350 | know whether to continue feeding input or not. |
|
1661 | 1351 | |
|
1662 | 1352 | The return value can be used to decide whether to use sys.ps1 or |
|
1663 | 1353 | sys.ps2 to prompt the next line.""" |
|
1664 | 1354 | |
|
1665 | 1355 | try: |
|
1666 | 1356 | code = self.compile(source, filename, symbol) |
|
1667 | 1357 | except (OverflowError, SyntaxError, ValueError): |
|
1668 | 1358 | # Case 1 |
|
1669 | 1359 | self.showsyntaxerror(filename) |
|
1670 | 1360 | return None |
|
1671 | 1361 | |
|
1672 | 1362 | if code is None: |
|
1673 | 1363 | # Case 2 |
|
1674 | 1364 | return True |
|
1675 | 1365 | |
|
1676 | 1366 | # Case 3 |
|
1677 | 1367 | # We store the code object so that threaded shells and |
|
1678 | 1368 | # custom exception handlers can access all this info if needed. |
|
1679 | 1369 | # The source corresponding to this can be obtained from the |
|
1680 | 1370 | # buffer attribute as '\n'.join(self.buffer). |
|
1681 | 1371 | self.code_to_run = code |
|
1682 | 1372 | # now actually execute the code object |
|
1683 | 1373 | if self.runcode(code) == 0: |
|
1684 | 1374 | return False |
|
1685 | 1375 | else: |
|
1686 | 1376 | return None |
|
1687 | 1377 | |
|
1688 | 1378 | def runcode(self,code_obj): |
|
1689 | 1379 | """Execute a code object. |
|
1690 | 1380 | |
|
1691 | 1381 | When an exception occurs, self.showtraceback() is called to display a |
|
1692 | 1382 | traceback. |
|
1693 | 1383 | |
|
1694 | 1384 | Return value: a flag indicating whether the code to be run completed |
|
1695 | 1385 | successfully: |
|
1696 | 1386 | |
|
1697 | 1387 | - 0: successful execution. |
|
1698 | 1388 | - 1: an error occurred. |
|
1699 | 1389 | """ |
|
1700 | 1390 | |
|
1701 | 1391 | # Set our own excepthook in case the user code tries to call it |
|
1702 | 1392 | # directly, so that the IPython crash handler doesn't get triggered |
|
1703 | 1393 | old_excepthook,sys.excepthook = sys.excepthook, self.excepthook |
|
1704 | 1394 | outflag = 1 # happens in more places, so it's easier as default |
|
1705 | 1395 | try: |
|
1706 | 1396 | try: |
|
1707 | 1397 | # Embedded instances require separate global/local namespaces |
|
1708 | 1398 | # so they can see both the surrounding (local) namespace and |
|
1709 | 1399 | # the module-level globals when called inside another function. |
|
1710 | 1400 | if self.embedded: |
|
1711 | 1401 | exec code_obj in self.user_global_ns, self.user_ns |
|
1712 | 1402 | # Normal (non-embedded) instances should only have a single |
|
1713 | 1403 | # namespace for user code execution, otherwise functions won't |
|
1714 | 1404 | # see interactive top-level globals. |
|
1715 | 1405 | else: |
|
1716 | 1406 | exec code_obj in self.user_ns |
|
1717 | 1407 | finally: |
|
1718 | 1408 | # Reset our crash handler in place |
|
1719 | 1409 | sys.excepthook = old_excepthook |
|
1720 | 1410 | except SystemExit: |
|
1721 | 1411 | self.resetbuffer() |
|
1722 | 1412 | self.showtraceback() |
|
1723 | warn( __builtin__.exit,level=1) | |
|
1413 | warn("Type exit or quit to exit IPython " | |
|
1414 | "(%Exit or %Quit do so unconditionally).",level=1) | |
|
1724 | 1415 | except self.custom_exceptions: |
|
1725 | 1416 | etype,value,tb = sys.exc_info() |
|
1726 | 1417 | self.CustomTB(etype,value,tb) |
|
1727 | 1418 | except: |
|
1728 | 1419 | self.showtraceback() |
|
1729 | 1420 | else: |
|
1730 | 1421 | outflag = 0 |
|
1731 |
if |
|
|
1422 | if softspace(sys.stdout, 0): | |
|
1732 | 1423 | |
|
1733 | 1424 | # Flush out code object which has been run (and source) |
|
1734 | 1425 | self.code_to_run = None |
|
1735 | 1426 | return outflag |
|
1427 | ||
|
1428 | def push(self, line): | |
|
1429 | """Push a line to the interpreter. | |
|
1430 | ||
|
1431 | The line should not have a trailing newline; it may have | |
|
1432 | internal newlines. The line is appended to a buffer and the | |
|
1433 | interpreter's runsource() method is called with the | |
|
1434 | concatenated contents of the buffer as source. If this | |
|
1435 | indicates that the command was executed or invalid, the buffer | |
|
1436 | is reset; otherwise, the command is incomplete, and the buffer | |
|
1437 | is left as it was after the line was appended. The return | |
|
1438 | value is 1 if more input is required, 0 if the line was dealt | |
|
1439 | with in some way (this is the same as runsource()). | |
|
1440 | ||
|
1441 | """ | |
|
1442 | self.buffer.append(line) | |
|
1443 | source = "\n".join(self.buffer) | |
|
1444 | more = self.runsource(source, self.filename) | |
|
1445 | if not more: | |
|
1446 | self.resetbuffer() | |
|
1447 | return more | |
|
1448 | ||
|
1449 | def resetbuffer(self): | |
|
1450 | """Reset the input buffer.""" | |
|
1451 | self.buffer[:] = [] | |
|
1736 | 1452 | |
|
1737 | 1453 | def raw_input(self,prompt='',continue_prompt=False): |
|
1738 | 1454 | """Write a prompt and read a line. |
|
1739 | 1455 | |
|
1740 | 1456 | The returned line does not include the trailing newline. |
|
1741 | 1457 | When the user enters the EOF key sequence, EOFError is raised. |
|
1742 | 1458 | |
|
1743 | 1459 | Optional inputs: |
|
1744 | 1460 | |
|
1745 | 1461 | - prompt(''): a string to be printed to prompt the user. |
|
1746 | 1462 | |
|
1747 | 1463 | - continue_prompt(False): whether this line is the first one or a |
|
1748 | 1464 | continuation in a sequence of inputs. |
|
1749 | 1465 | """ |
|
1750 | 1466 | |
|
1751 | 1467 | line = raw_input_original(prompt) |
|
1752 | 1468 | # Try to be reasonably smart about not re-indenting pasted input more |
|
1753 | 1469 | # than necessary. We do this by trimming out the auto-indent initial |
|
1754 | 1470 | # spaces, if the user's actual input started itself with whitespace. |
|
1755 | 1471 | if self.autoindent: |
|
1756 | 1472 | line2 = line[self.readline_indent:] |
|
1757 | 1473 | if line2[0:1] in (' ','\t'): |
|
1758 | 1474 | line = line2 |
|
1759 | 1475 | return self.prefilter(line,continue_prompt) |
|
1760 | 1476 | |
|
1761 | 1477 | def split_user_input(self,line): |
|
1762 | 1478 | """Split user input into pre-char, function part and rest.""" |
|
1763 | 1479 | |
|
1764 | 1480 | lsplit = self.line_split.match(line) |
|
1765 | 1481 | if lsplit is None: # no regexp match returns None |
|
1766 | 1482 | try: |
|
1767 | 1483 | iFun,theRest = line.split(None,1) |
|
1768 | 1484 | except ValueError: |
|
1769 | 1485 | iFun,theRest = line,'' |
|
1770 | 1486 | pre = re.match('^(\s*)(.*)',line).groups()[0] |
|
1771 | 1487 | else: |
|
1772 | 1488 | pre,iFun,theRest = lsplit.groups() |
|
1773 | 1489 | |
|
1774 | 1490 | #print 'line:<%s>' % line # dbg |
|
1775 | 1491 | #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun.strip(),theRest) # dbg |
|
1776 | 1492 | return pre,iFun.strip(),theRest |
|
1777 | 1493 | |
|
1778 | 1494 | def _prefilter(self, line, continue_prompt): |
|
1779 | 1495 | """Calls different preprocessors, depending on the form of line.""" |
|
1780 | 1496 | |
|
1781 | 1497 | # All handlers *must* return a value, even if it's blank (''). |
|
1782 | 1498 | |
|
1783 | 1499 | # Lines are NOT logged here. Handlers should process the line as |
|
1784 | 1500 | # needed, update the cache AND log it (so that the input cache array |
|
1785 | 1501 | # stays synced). |
|
1786 | 1502 | |
|
1787 | 1503 | # This function is _very_ delicate, and since it's also the one which |
|
1788 | 1504 | # determines IPython's response to user input, it must be as efficient |
|
1789 | 1505 | # as possible. For this reason it has _many_ returns in it, trying |
|
1790 | 1506 | # always to exit as quickly as it can figure out what it needs to do. |
|
1791 | 1507 | |
|
1792 | 1508 | # This function is the main responsible for maintaining IPython's |
|
1793 | 1509 | # behavior respectful of Python's semantics. So be _very_ careful if |
|
1794 | 1510 | # making changes to anything here. |
|
1795 | 1511 | |
|
1796 | 1512 | #..................................................................... |
|
1797 | 1513 | # Code begins |
|
1798 | 1514 | |
|
1799 | 1515 | #if line.startswith('%crash'): raise RuntimeError,'Crash now!' # dbg |
|
1800 | 1516 | |
|
1801 | 1517 | # save the line away in case we crash, so the post-mortem handler can |
|
1802 | 1518 | # record it |
|
1803 | 1519 | self._last_input_line = line |
|
1804 | 1520 | |
|
1805 | 1521 | #print '***line: <%s>' % line # dbg |
|
1806 | 1522 | |
|
1807 | 1523 | # the input history needs to track even empty lines |
|
1808 | 1524 | if not line.strip(): |
|
1809 | 1525 | if not continue_prompt: |
|
1810 | 1526 | self.outputcache.prompt_count -= 1 |
|
1811 | 1527 | return self.handle_normal('',continue_prompt) |
|
1812 | 1528 | |
|
1813 | 1529 | # print '***cont',continue_prompt # dbg |
|
1814 | 1530 | # special handlers are only allowed for single line statements |
|
1815 | 1531 | if continue_prompt and not self.rc.multi_line_specials: |
|
1816 | 1532 | return self.handle_normal(line,continue_prompt) |
|
1817 | 1533 | |
|
1818 | 1534 | # For the rest, we need the structure of the input |
|
1819 | 1535 | pre,iFun,theRest = self.split_user_input(line) |
|
1820 | 1536 | #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg |
|
1821 | 1537 | |
|
1822 | 1538 | # First check for explicit escapes in the last/first character |
|
1823 | 1539 | handler = None |
|
1824 | 1540 | if line[-1] == self.ESC_HELP: |
|
1825 | 1541 | handler = self.esc_handlers.get(line[-1]) # the ? can be at the end |
|
1826 | 1542 | if handler is None: |
|
1827 | 1543 | # look at the first character of iFun, NOT of line, so we skip |
|
1828 | 1544 | # leading whitespace in multiline input |
|
1829 | 1545 | handler = self.esc_handlers.get(iFun[0:1]) |
|
1830 | 1546 | if handler is not None: |
|
1831 | 1547 | return handler(line,continue_prompt,pre,iFun,theRest) |
|
1832 | 1548 | # Emacs ipython-mode tags certain input lines |
|
1833 | 1549 | if line.endswith('# PYTHON-MODE'): |
|
1834 | 1550 | return self.handle_emacs(line,continue_prompt) |
|
1835 | 1551 | |
|
1836 | 1552 | # Next, check if we can automatically execute this thing |
|
1837 | 1553 | |
|
1838 | 1554 | # Allow ! in multi-line statements if multi_line_specials is on: |
|
1839 | 1555 | if continue_prompt and self.rc.multi_line_specials and \ |
|
1840 | 1556 | iFun.startswith(self.ESC_SHELL): |
|
1841 | 1557 | return self.handle_shell_escape(line,continue_prompt, |
|
1842 | 1558 | pre=pre,iFun=iFun, |
|
1843 | 1559 | theRest=theRest) |
|
1844 | 1560 | |
|
1845 | 1561 | # Let's try to find if the input line is a magic fn |
|
1846 | 1562 | oinfo = None |
|
1847 | 1563 | if hasattr(self,'magic_'+iFun): |
|
1848 | 1564 | oinfo = self._ofind(iFun) # FIXME - _ofind is part of Magic |
|
1849 | 1565 | if oinfo['ismagic']: |
|
1850 | 1566 | # Be careful not to call magics when a variable assignment is |
|
1851 | 1567 | # being made (ls='hi', for example) |
|
1852 | 1568 | if self.rc.automagic and \ |
|
1853 | 1569 | (len(theRest)==0 or theRest[0] not in '!=()<>,') and \ |
|
1854 | 1570 | (self.rc.multi_line_specials or not continue_prompt): |
|
1855 | 1571 | return self.handle_magic(line,continue_prompt, |
|
1856 | 1572 | pre,iFun,theRest) |
|
1857 | 1573 | else: |
|
1858 | 1574 | return self.handle_normal(line,continue_prompt) |
|
1859 | 1575 | |
|
1860 | 1576 | # If the rest of the line begins with an (in)equality, assginment or |
|
1861 | 1577 | # function call, we should not call _ofind but simply execute it. |
|
1862 | 1578 | # This avoids spurious geattr() accesses on objects upon assignment. |
|
1863 | 1579 | # |
|
1864 | 1580 | # It also allows users to assign to either alias or magic names true |
|
1865 | 1581 | # python variables (the magic/alias systems always take second seat to |
|
1866 | 1582 | # true python code). |
|
1867 | 1583 | if theRest and theRest[0] in '!=()': |
|
1868 | 1584 | return self.handle_normal(line,continue_prompt) |
|
1869 | 1585 | |
|
1870 | 1586 | if oinfo is None: |
|
1871 | 1587 | oinfo = self._ofind(iFun) # FIXME - _ofind is part of Magic |
|
1872 | 1588 | |
|
1873 | 1589 | if not oinfo['found']: |
|
1590 | if iFun in ('quit','exit'): | |
|
1591 | raise IPythonExit | |
|
1874 | 1592 | return self.handle_normal(line,continue_prompt) |
|
1875 | 1593 | else: |
|
1876 | 1594 | #print 'iFun <%s> rest <%s>' % (iFun,theRest) # dbg |
|
1877 | 1595 | if oinfo['isalias']: |
|
1878 | 1596 | return self.handle_alias(line,continue_prompt, |
|
1879 | 1597 | pre,iFun,theRest) |
|
1880 | 1598 | |
|
1881 | 1599 | if self.rc.autocall and \ |
|
1882 | 1600 | not self.re_exclude_auto.match(theRest) and \ |
|
1883 | 1601 | self.re_fun_name.match(iFun) and \ |
|
1884 | 1602 | callable(oinfo['obj']) : |
|
1885 | 1603 | #print 'going auto' # dbg |
|
1886 | 1604 | return self.handle_auto(line,continue_prompt,pre,iFun,theRest) |
|
1887 | 1605 | else: |
|
1888 | 1606 | #print 'was callable?', callable(oinfo['obj']) # dbg |
|
1889 | 1607 | return self.handle_normal(line,continue_prompt) |
|
1890 | 1608 | |
|
1891 | 1609 | # If we get here, we have a normal Python line. Log and return. |
|
1892 | 1610 | return self.handle_normal(line,continue_prompt) |
|
1893 | 1611 | |
|
1894 | 1612 | def _prefilter_dumb(self, line, continue_prompt): |
|
1895 | 1613 | """simple prefilter function, for debugging""" |
|
1896 | 1614 | return self.handle_normal(line,continue_prompt) |
|
1897 | 1615 | |
|
1898 | 1616 | # Set the default prefilter() function (this can be user-overridden) |
|
1899 | 1617 | prefilter = _prefilter |
|
1900 | 1618 | |
|
1901 | 1619 | def handle_normal(self,line,continue_prompt=None, |
|
1902 | 1620 | pre=None,iFun=None,theRest=None): |
|
1903 | 1621 | """Handle normal input lines. Use as a template for handlers.""" |
|
1904 | 1622 | |
|
1905 | 1623 | self.log(line,continue_prompt) |
|
1906 | 1624 | self.update_cache(line) |
|
1907 | 1625 | return line |
|
1908 | 1626 | |
|
1909 | 1627 | def handle_alias(self,line,continue_prompt=None, |
|
1910 | 1628 | pre=None,iFun=None,theRest=None): |
|
1911 | 1629 | """Handle alias input lines. """ |
|
1912 | 1630 | |
|
1913 | 1631 | theRest = esc_quotes(theRest) |
|
1914 | 1632 | line_out = "%s%s.call_alias('%s','%s')" % (pre,self.name,iFun,theRest) |
|
1915 | 1633 | self.log(line_out,continue_prompt) |
|
1916 | 1634 | self.update_cache(line_out) |
|
1917 | 1635 | return line_out |
|
1918 | 1636 | |
|
1919 | 1637 | def handle_shell_escape(self, line, continue_prompt=None, |
|
1920 | 1638 | pre=None,iFun=None,theRest=None): |
|
1921 | 1639 | """Execute the line in a shell, empty return value""" |
|
1922 | 1640 | |
|
1923 | 1641 | #print 'line in :', `line` # dbg |
|
1924 | 1642 | # Example of a special handler. Others follow a similar pattern. |
|
1925 | 1643 | if continue_prompt: # multi-line statements |
|
1926 | 1644 | if iFun.startswith('!!'): |
|
1927 | 1645 | print 'SyntaxError: !! is not allowed in multiline statements' |
|
1928 | 1646 | return pre |
|
1929 | 1647 | else: |
|
1930 | 1648 | cmd = ("%s %s" % (iFun[1:],theRest)).replace('"','\\"') |
|
1931 | 1649 | line_out = '%s%s.system("%s")' % (pre,self.name,cmd) |
|
1932 | 1650 | #line_out = ('%s%s.system(' % (pre,self.name)) + repr(cmd) + ')' |
|
1933 | 1651 | else: # single-line input |
|
1934 | 1652 | if line.startswith('!!'): |
|
1935 | 1653 | # rewrite iFun/theRest to properly hold the call to %sx and |
|
1936 | 1654 | # the actual command to be executed, so handle_magic can work |
|
1937 | 1655 | # correctly |
|
1938 | 1656 | theRest = '%s %s' % (iFun[2:],theRest) |
|
1939 | 1657 | iFun = 'sx' |
|
1940 | 1658 | return self.handle_magic('%ssx %s' % (self.ESC_MAGIC,line[2:]), |
|
1941 | 1659 | continue_prompt,pre,iFun,theRest) |
|
1942 | 1660 | else: |
|
1943 | 1661 | cmd = esc_quotes(line[1:]) |
|
1944 | 1662 | line_out = '%s.system("%s")' % (self.name,cmd) |
|
1945 | 1663 | #line_out = ('%s.system(' % self.name) + repr(cmd)+ ')' |
|
1946 | 1664 | # update cache/log and return |
|
1947 | 1665 | self.log(line_out,continue_prompt) |
|
1948 | 1666 | self.update_cache(line_out) # readline cache gets normal line |
|
1949 | 1667 | #print 'line out r:', `line_out` # dbg |
|
1950 | 1668 | #print 'line out s:', line_out # dbg |
|
1951 | 1669 | return line_out |
|
1952 | 1670 | |
|
1953 | 1671 | def handle_magic(self, line, continue_prompt=None, |
|
1954 | 1672 | pre=None,iFun=None,theRest=None): |
|
1955 | 1673 | """Execute magic functions. |
|
1956 | 1674 | |
|
1957 | 1675 | Also log them with a prepended # so the log is clean Python.""" |
|
1958 | 1676 | |
|
1959 | 1677 | cmd = '%sipmagic("%s")' % (pre,esc_quotes('%s %s' % (iFun,theRest))) |
|
1960 | 1678 | self.log(cmd,continue_prompt) |
|
1961 | 1679 | self.update_cache(line) |
|
1962 | 1680 | #print 'in handle_magic, cmd=<%s>' % cmd # dbg |
|
1963 | 1681 | return cmd |
|
1964 | 1682 | |
|
1965 | 1683 | def handle_auto(self, line, continue_prompt=None, |
|
1966 | 1684 | pre=None,iFun=None,theRest=None): |
|
1967 | 1685 | """Hande lines which can be auto-executed, quoting if requested.""" |
|
1968 | 1686 | |
|
1969 | 1687 | #print 'pre <%s> iFun <%s> rest <%s>' % (pre,iFun,theRest) # dbg |
|
1970 | 1688 | |
|
1971 | 1689 | # This should only be active for single-line input! |
|
1972 | 1690 | if continue_prompt: |
|
1973 | 1691 | return line |
|
1974 | 1692 | |
|
1975 | 1693 | if pre == self.ESC_QUOTE: |
|
1976 | 1694 | # Auto-quote splitting on whitespace |
|
1977 | 1695 | newcmd = '%s("%s")' % (iFun,'", "'.join(theRest.split()) ) |
|
1978 | 1696 | elif pre == self.ESC_QUOTE2: |
|
1979 | 1697 | # Auto-quote whole string |
|
1980 | 1698 | newcmd = '%s("%s")' % (iFun,theRest) |
|
1981 | 1699 | else: |
|
1982 | 1700 | # Auto-paren |
|
1983 | 1701 | if theRest[0:1] in ('=','['): |
|
1984 | 1702 | # Don't autocall in these cases. They can be either |
|
1985 | 1703 | # rebindings of an existing callable's name, or item access |
|
1986 | 1704 | # for an object which is BOTH callable and implements |
|
1987 | 1705 | # __getitem__. |
|
1988 | 1706 | return '%s %s' % (iFun,theRest) |
|
1989 | 1707 | if theRest.endswith(';'): |
|
1990 | 1708 | newcmd = '%s(%s);' % (iFun.rstrip(),theRest[:-1]) |
|
1991 | 1709 | else: |
|
1992 | 1710 | newcmd = '%s(%s)' % (iFun.rstrip(),theRest) |
|
1993 | 1711 | |
|
1994 | 1712 | print >>Term.cout, self.outputcache.prompt1.auto_rewrite() + newcmd |
|
1995 | 1713 | # log what is now valid Python, not the actual user input (without the |
|
1996 | 1714 | # final newline) |
|
1997 | 1715 | self.log(newcmd,continue_prompt) |
|
1998 | 1716 | return newcmd |
|
1999 | 1717 | |
|
2000 | 1718 | def handle_help(self, line, continue_prompt=None, |
|
2001 | 1719 | pre=None,iFun=None,theRest=None): |
|
2002 | 1720 | """Try to get some help for the object. |
|
2003 | 1721 | |
|
2004 | 1722 | obj? or ?obj -> basic information. |
|
2005 | 1723 | obj?? or ??obj -> more details. |
|
2006 | 1724 | """ |
|
2007 | 1725 | |
|
2008 | 1726 | # We need to make sure that we don't process lines which would be |
|
2009 | 1727 | # otherwise valid python, such as "x=1 # what?" |
|
2010 | 1728 | try: |
|
2011 | code.compile_command(line) | |
|
1729 | codeop.compile_command(line) | |
|
2012 | 1730 | except SyntaxError: |
|
2013 | 1731 | # We should only handle as help stuff which is NOT valid syntax |
|
2014 | 1732 | if line[0]==self.ESC_HELP: |
|
2015 | 1733 | line = line[1:] |
|
2016 | 1734 | elif line[-1]==self.ESC_HELP: |
|
2017 | 1735 | line = line[:-1] |
|
2018 | 1736 | self.log('#?'+line) |
|
2019 | 1737 | self.update_cache(line) |
|
2020 | 1738 | if line: |
|
2021 | 1739 | self.magic_pinfo(line) |
|
2022 | 1740 | else: |
|
2023 | 1741 | page(self.usage,screen_lines=self.rc.screen_length) |
|
2024 | 1742 | return '' # Empty string is needed here! |
|
2025 | 1743 | except: |
|
2026 | 1744 | # Pass any other exceptions through to the normal handler |
|
2027 | 1745 | return self.handle_normal(line,continue_prompt) |
|
2028 | 1746 | else: |
|
2029 | 1747 | # If the code compiles ok, we should handle it normally |
|
2030 | 1748 | return self.handle_normal(line,continue_prompt) |
|
2031 | 1749 | |
|
2032 | 1750 | def handle_emacs(self,line,continue_prompt=None, |
|
2033 | 1751 | pre=None,iFun=None,theRest=None): |
|
2034 | 1752 | """Handle input lines marked by python-mode.""" |
|
2035 | 1753 | |
|
2036 | 1754 | # Currently, nothing is done. Later more functionality can be added |
|
2037 | 1755 | # here if needed. |
|
2038 | 1756 | |
|
2039 | 1757 | # The input cache shouldn't be updated |
|
2040 | 1758 | |
|
2041 | 1759 | return line |
|
2042 | 1760 | |
|
2043 | 1761 | def write(self,data): |
|
2044 | 1762 | """Write a string to the default output""" |
|
2045 | 1763 | Term.cout.write(data) |
|
2046 | 1764 | |
|
2047 | 1765 | def write_err(self,data): |
|
2048 | 1766 | """Write a string to the default error output""" |
|
2049 | 1767 | Term.cerr.write(data) |
|
2050 | 1768 | |
|
1769 | def exit(self): | |
|
1770 | """Handle interactive exit. | |
|
1771 | ||
|
1772 | This method sets the exit_now attribute.""" | |
|
1773 | ||
|
1774 | if self.rc.confirm_exit: | |
|
1775 | if ask_yes_no('Do you really want to exit ([y]/n)?','y'): | |
|
1776 | self.exit_now = True | |
|
1777 | else: | |
|
1778 | self.exit_now = True | |
|
1779 | return self.exit_now | |
|
1780 | ||
|
2051 | 1781 | def safe_execfile(self,fname,*where,**kw): |
|
2052 | 1782 | fname = os.path.expanduser(fname) |
|
2053 | 1783 | |
|
2054 | 1784 | # find things also in current directory |
|
2055 | 1785 | dname = os.path.dirname(fname) |
|
2056 | 1786 | if not sys.path.count(dname): |
|
2057 | 1787 | sys.path.append(dname) |
|
2058 | 1788 | |
|
2059 | 1789 | try: |
|
2060 | 1790 | xfile = open(fname) |
|
2061 | 1791 | except: |
|
2062 | 1792 | print >> Term.cerr, \ |
|
2063 | 1793 | 'Could not open file <%s> for safe execution.' % fname |
|
2064 | 1794 | return None |
|
2065 | 1795 | |
|
2066 | 1796 | kw.setdefault('islog',0) |
|
2067 | 1797 | kw.setdefault('quiet',1) |
|
2068 | 1798 | kw.setdefault('exit_ignore',0) |
|
2069 | 1799 | first = xfile.readline() |
|
2070 | 1800 | _LOGHEAD = str(self.LOGHEAD).split('\n',1)[0].strip() |
|
2071 | 1801 | xfile.close() |
|
2072 | 1802 | # line by line execution |
|
2073 | 1803 | if first.startswith(_LOGHEAD) or kw['islog']: |
|
2074 | 1804 | print 'Loading log file <%s> one line at a time...' % fname |
|
2075 | 1805 | if kw['quiet']: |
|
2076 | 1806 | stdout_save = sys.stdout |
|
2077 | 1807 | sys.stdout = StringIO.StringIO() |
|
2078 | 1808 | try: |
|
2079 | 1809 | globs,locs = where[0:2] |
|
2080 | 1810 | except: |
|
2081 | 1811 | try: |
|
2082 | 1812 | globs = locs = where[0] |
|
2083 | 1813 | except: |
|
2084 | 1814 | globs = locs = globals() |
|
2085 | 1815 | badblocks = [] |
|
2086 | 1816 | |
|
2087 | 1817 | # we also need to identify indented blocks of code when replaying |
|
2088 | 1818 | # logs and put them together before passing them to an exec |
|
2089 | 1819 | # statement. This takes a bit of regexp and look-ahead work in the |
|
2090 | 1820 | # file. It's easiest if we swallow the whole thing in memory |
|
2091 | 1821 | # first, and manually walk through the lines list moving the |
|
2092 | 1822 | # counter ourselves. |
|
2093 | 1823 | indent_re = re.compile('\s+\S') |
|
2094 | 1824 | xfile = open(fname) |
|
2095 | 1825 | filelines = xfile.readlines() |
|
2096 | 1826 | xfile.close() |
|
2097 | 1827 | nlines = len(filelines) |
|
2098 | 1828 | lnum = 0 |
|
2099 | 1829 | while lnum < nlines: |
|
2100 | 1830 | line = filelines[lnum] |
|
2101 | 1831 | lnum += 1 |
|
2102 | 1832 | # don't re-insert logger status info into cache |
|
2103 | 1833 | if line.startswith('#log#'): |
|
2104 | 1834 | continue |
|
2105 | 1835 | elif line.startswith('#%s'% self.ESC_MAGIC): |
|
2106 | 1836 | self.update_cache(line[1:]) |
|
2107 | 1837 | line = magic2python(line) |
|
2108 | 1838 | elif line.startswith('#!'): |
|
2109 | 1839 | self.update_cache(line[1:]) |
|
2110 | 1840 | else: |
|
2111 | 1841 | # build a block of code (maybe a single line) for execution |
|
2112 | 1842 | block = line |
|
2113 | 1843 | try: |
|
2114 | 1844 | next = filelines[lnum] # lnum has already incremented |
|
2115 | 1845 | except: |
|
2116 | 1846 | next = None |
|
2117 | 1847 | while next and indent_re.match(next): |
|
2118 | 1848 | block += next |
|
2119 | 1849 | lnum += 1 |
|
2120 | 1850 | try: |
|
2121 | 1851 | next = filelines[lnum] |
|
2122 | 1852 | except: |
|
2123 | 1853 | next = None |
|
2124 | 1854 | # now execute the block of one or more lines |
|
2125 | 1855 | try: |
|
2126 | 1856 | exec block in globs,locs |
|
2127 | 1857 | self.update_cache(block.rstrip()) |
|
2128 | 1858 | except SystemExit: |
|
2129 | 1859 | pass |
|
2130 | 1860 | except: |
|
2131 | 1861 | badblocks.append(block.rstrip()) |
|
2132 | 1862 | if kw['quiet']: # restore stdout |
|
2133 | 1863 | sys.stdout.close() |
|
2134 | 1864 | sys.stdout = stdout_save |
|
2135 | 1865 | print 'Finished replaying log file <%s>' % fname |
|
2136 | 1866 | if badblocks: |
|
2137 | print >> sys.stderr, \ | |
|
2138 | '\nThe following lines/blocks in file <%s> reported errors:' \ | |
|
2139 |
|
|
|
1867 | print >> sys.stderr, ('\nThe following lines/blocks in file ' | |
|
1868 | '<%s> reported errors:' % fname) | |
|
1869 | ||
|
2140 | 1870 | for badline in badblocks: |
|
2141 | 1871 | print >> sys.stderr, badline |
|
2142 | 1872 | else: # regular file execution |
|
2143 | 1873 | try: |
|
2144 | 1874 | execfile(fname,*where) |
|
2145 | 1875 | except SyntaxError: |
|
2146 | 1876 | etype, evalue = sys.exc_info()[0:2] |
|
2147 | 1877 | self.SyntaxTB(etype,evalue,[]) |
|
2148 | 1878 | warn('Failure executing file: <%s>' % fname) |
|
2149 | 1879 | except SystemExit,status: |
|
2150 | 1880 | if not kw['exit_ignore']: |
|
2151 | 1881 | self.InteractiveTB() |
|
2152 | 1882 | warn('Failure executing file: <%s>' % fname) |
|
2153 | 1883 | except: |
|
2154 | 1884 | self.InteractiveTB() |
|
2155 | 1885 | warn('Failure executing file: <%s>' % fname) |
|
2156 | 1886 | |
|
2157 | 1887 | #************************* end of file <iplib.py> ***************************** |
@@ -1,4531 +1,4546 b'' | |||
|
1 | 1 | 2005-12-27 Fernando Perez <Fernando.Perez@colorado.edu> |
|
2 | 2 | |
|
3 | * IPython/completer.py (MagicCompleter.__init__): new 'completer' | |
|
4 | module to better organize all readline-related functionality. | |
|
5 | I've deleted FlexCompleter and put all completion clases here. | |
|
6 | ||
|
3 | 7 | * IPython/iplib.py (raw_input): improve indentation management. |
|
4 | 8 | It is now possible to paste indented code with autoindent on, and |
|
5 | 9 | the code is interpreted correctly (though it still looks bad on |
|
6 | 10 | screen, due to the line-oriented nature of ipython). |
|
7 | 11 | (MagicCompleter.complete): change behavior so that a TAB key on an |
|
8 | 12 | otherwise empty line actually inserts a tab, instead of completing |
|
9 | 13 | on the entire global namespace. This makes it easier to use the |
|
10 | 14 | TAB key for indentation. After a request by Hans Meine |
|
11 | 15 | <hans_meine-AT-gmx.net> |
|
16 | (_prefilter): add support so that typing plain 'exit' or 'quit' | |
|
17 | does a sensible thing. Originally I tried to deviate as little as | |
|
18 | possible from the default python behavior, but even that one may | |
|
19 | change in this direction (thread on python-dev to that effect). | |
|
20 | Regardless, ipython should do the right thing even if CPython's | |
|
21 | '>>>' prompt doesn't. | |
|
22 | (InteractiveShell): removed subclassing code.InteractiveConsole | |
|
23 | class. By now we'd overridden just about all of its methods: I've | |
|
24 | copied the remaining two over, and now ipython is a standalone | |
|
25 | class. This will provide a clearer picture for the chainsaw | |
|
26 | branch refactoring. | |
|
12 | 27 | |
|
13 | 28 | 2005-12-26 Fernando Perez <Fernando.Perez@colorado.edu> |
|
14 | 29 | |
|
15 | 30 | * IPython/ultraTB.py (VerboseTB.text): harden reporting against |
|
16 | 31 | failures for objects which break when dir() is called on them. |
|
17 | 32 | |
|
18 | 33 | * IPython/FlexCompleter.py (Completer.__init__): Added support for |
|
19 | 34 | distinct local and global namespaces in the completer API. This |
|
20 | 35 | change allows us top properly handle completion with distinct |
|
21 | 36 | scopes, including in embedded instances (this had never really |
|
22 | 37 | worked correctly). |
|
23 | 38 | |
|
24 | 39 | Note: this introduces a change in the constructor for |
|
25 | 40 | MagicCompleter, as a new global_namespace parameter is now the |
|
26 | 41 | second argument (the others were bumped one position). |
|
27 | 42 | |
|
28 | 43 | 2005-12-25 Fernando Perez <Fernando.Perez@colorado.edu> |
|
29 | 44 | |
|
30 | 45 | * IPython/iplib.py (embed_mainloop): fix tab-completion in |
|
31 | 46 | embedded instances (which can be done now thanks to Vivian's |
|
32 | 47 | frame-handling fixes for pdb). |
|
33 | 48 | (InteractiveShell.__init__): Fix namespace handling problem in |
|
34 | 49 | embedded instances. We were overwriting __main__ unconditionally, |
|
35 | 50 | and this should only be done for 'full' (non-embedded) IPython; |
|
36 | 51 | embedded instances must respect the caller's __main__. Thanks to |
|
37 | 52 | a bug report by Yaroslav Bulatov <yaroslavvb-AT-gmail.com> |
|
38 | 53 | |
|
39 | 54 | 2005-12-24 Fernando Perez <Fernando.Perez@colorado.edu> |
|
40 | 55 | |
|
41 | 56 | * setup.py: added download_url to setup(). This registers the |
|
42 | 57 | download address at PyPI, which is not only useful to humans |
|
43 | 58 | browsing the site, but is also picked up by setuptools (the Eggs |
|
44 | 59 | machinery). Thanks to Ville and R. Kern for the info/discussion |
|
45 | 60 | on this. |
|
46 | 61 | |
|
47 | 62 | 2005-12-23 Fernando Perez <Fernando.Perez@colorado.edu> |
|
48 | 63 | |
|
49 | 64 | * IPython/Debugger.py (Pdb.__init__): Major pdb mode enhancements. |
|
50 | 65 | This brings a lot of nice functionality to the pdb mode, which now |
|
51 | 66 | has tab-completion, syntax highlighting, and better stack handling |
|
52 | 67 | than before. Many thanks to Vivian De Smedt |
|
53 | 68 | <vivian-AT-vdesmedt.com> for the original patches. |
|
54 | 69 | |
|
55 | 70 | 2005-12-08 Fernando Perez <Fernando.Perez@colorado.edu> |
|
56 | 71 | |
|
57 | 72 | * IPython/Shell.py (IPShellGTK.mainloop): fix mainloop() calling |
|
58 | 73 | sequence to consistently accept the banner argument. The |
|
59 | 74 | inconsistency was tripping SAGE, thanks to Gary Zablackis |
|
60 | 75 | <gzabl-AT-yahoo.com> for the report. |
|
61 | 76 | |
|
62 | 77 | 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu> |
|
63 | 78 | |
|
64 | 79 | * IPython/iplib.py (InteractiveShell.post_config_initialization): |
|
65 | 80 | Fix bug where a naked 'alias' call in the ipythonrc file would |
|
66 | 81 | cause a crash. Bug reported by Jorgen Stenarson. |
|
67 | 82 | |
|
68 | 83 | 2005-11-15 Fernando Perez <Fernando.Perez@colorado.edu> |
|
69 | 84 | |
|
70 | 85 | * IPython/ipmaker.py (make_IPython): cleanups which should improve |
|
71 | 86 | startup time. |
|
72 | 87 | |
|
73 | 88 | * IPython/iplib.py (runcode): my globals 'fix' for embedded |
|
74 | 89 | instances had introduced a bug with globals in normal code. Now |
|
75 | 90 | it's working in all cases. |
|
76 | 91 | |
|
77 | 92 | * IPython/Magic.py (magic_psearch): Finish wildcard cleanup and |
|
78 | 93 | API changes. A new ipytonrc option, 'wildcards_case_sensitive' |
|
79 | 94 | has been introduced to set the default case sensitivity of the |
|
80 | 95 | searches. Users can still select either mode at runtime on a |
|
81 | 96 | per-search basis. |
|
82 | 97 | |
|
83 | 98 | 2005-11-13 Fernando Perez <Fernando.Perez@colorado.edu> |
|
84 | 99 | |
|
85 | 100 | * IPython/wildcard.py (NameSpace.__init__): fix resolution of |
|
86 | 101 | attributes in wildcard searches for subclasses. Modified version |
|
87 | 102 | of a patch by Jorgen. |
|
88 | 103 | |
|
89 | 104 | 2005-11-12 Fernando Perez <Fernando.Perez@colorado.edu> |
|
90 | 105 | |
|
91 | 106 | * IPython/iplib.py (embed_mainloop): Fix handling of globals for |
|
92 | 107 | embedded instances. I added a user_global_ns attribute to the |
|
93 | 108 | InteractiveShell class to handle this. |
|
94 | 109 | |
|
95 | 110 | 2005-10-31 Fernando Perez <Fernando.Perez@colorado.edu> |
|
96 | 111 | |
|
97 | 112 | * IPython/Shell.py (IPShellGTK.mainloop): Change timeout_add to |
|
98 | 113 | idle_add, which fixes horrible keyboard lag problems under gtk 2.6 |
|
99 | 114 | (reported under win32, but may happen also in other platforms). |
|
100 | 115 | Bug report and fix courtesy of Sean Moore <smm-AT-logic.bm> |
|
101 | 116 | |
|
102 | 117 | 2005-10-15 Fernando Perez <Fernando.Perez@colorado.edu> |
|
103 | 118 | |
|
104 | 119 | * IPython/Magic.py (magic_psearch): new support for wildcard |
|
105 | 120 | patterns. Now, typing ?a*b will list all names which begin with a |
|
106 | 121 | and end in b, for example. The %psearch magic has full |
|
107 | 122 | docstrings. Many thanks to Jörgen Stenarson |
|
108 | 123 | <jorgen.stenarson-AT-bostream.nu>, author of the patches |
|
109 | 124 | implementing this functionality. |
|
110 | 125 | |
|
111 | 126 | 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu> |
|
112 | 127 | |
|
113 | 128 | * Manual: fixed long-standing annoyance of double-dashes (as in |
|
114 | 129 | --prefix=~, for example) being stripped in the HTML version. This |
|
115 | 130 | is a latex2html bug, but a workaround was provided. Many thanks |
|
116 | 131 | to George K. Thiruvathukal <gthiruv-AT-luc.edu> for the detailed |
|
117 | 132 | help, and Michael Tobis <mtobis-AT-gmail.com> for getting the ball |
|
118 | 133 | rolling. This seemingly small issue had tripped a number of users |
|
119 | 134 | when first installing, so I'm glad to see it gone. |
|
120 | 135 | |
|
121 | 136 | 2005-09-27 Fernando Perez <Fernando.Perez@colorado.edu> |
|
122 | 137 | |
|
123 | 138 | * IPython/Extensions/numeric_formats.py: fix missing import, |
|
124 | 139 | reported by Stephen Walton. |
|
125 | 140 | |
|
126 | 141 | 2005-09-24 Fernando Perez <Fernando.Perez@colorado.edu> |
|
127 | 142 | |
|
128 | 143 | * IPython/demo.py: finish demo module, fully documented now. |
|
129 | 144 | |
|
130 | 145 | * IPython/genutils.py (file_read): simple little utility to read a |
|
131 | 146 | file and ensure it's closed afterwards. |
|
132 | 147 | |
|
133 | 148 | 2005-09-23 Fernando Perez <Fernando.Perez@colorado.edu> |
|
134 | 149 | |
|
135 | 150 | * IPython/demo.py (Demo.__init__): added support for individually |
|
136 | 151 | tagging blocks for automatic execution. |
|
137 | 152 | |
|
138 | 153 | * IPython/Magic.py (magic_pycat): new %pycat magic for showing |
|
139 | 154 | syntax-highlighted python sources, requested by John. |
|
140 | 155 | |
|
141 | 156 | 2005-09-22 Fernando Perez <Fernando.Perez@colorado.edu> |
|
142 | 157 | |
|
143 | 158 | * IPython/demo.py (Demo.again): fix bug where again() blocks after |
|
144 | 159 | finishing. |
|
145 | 160 | |
|
146 | 161 | * IPython/genutils.py (shlex_split): moved from Magic to here, |
|
147 | 162 | where all 2.2 compatibility stuff lives. I needed it for demo.py. |
|
148 | 163 | |
|
149 | 164 | * IPython/demo.py (Demo.__init__): added support for silent |
|
150 | 165 | blocks, improved marks as regexps, docstrings written. |
|
151 | 166 | (Demo.__init__): better docstring, added support for sys.argv. |
|
152 | 167 | |
|
153 | 168 | * IPython/genutils.py (marquee): little utility used by the demo |
|
154 | 169 | code, handy in general. |
|
155 | 170 | |
|
156 | 171 | * IPython/demo.py (Demo.__init__): new class for interactive |
|
157 | 172 | demos. Not documented yet, I just wrote it in a hurry for |
|
158 | 173 | scipy'05. Will docstring later. |
|
159 | 174 | |
|
160 | 175 | 2005-09-20 Fernando Perez <Fernando.Perez@colorado.edu> |
|
161 | 176 | |
|
162 | 177 | * IPython/Shell.py (sigint_handler): Drastic simplification which |
|
163 | 178 | also seems to make Ctrl-C work correctly across threads! This is |
|
164 | 179 | so simple, that I can't beleive I'd missed it before. Needs more |
|
165 | 180 | testing, though. |
|
166 | 181 | (KBINT): Never mind, revert changes. I'm sure I'd tried something |
|
167 | 182 | like this before... |
|
168 | 183 | |
|
169 | 184 | * IPython/genutils.py (get_home_dir): add protection against |
|
170 | 185 | non-dirs in win32 registry. |
|
171 | 186 | |
|
172 | 187 | * IPython/iplib.py (InteractiveShell.alias_table_validate): fix |
|
173 | 188 | bug where dict was mutated while iterating (pysh crash). |
|
174 | 189 | |
|
175 | 190 | 2005-09-06 Fernando Perez <Fernando.Perez@colorado.edu> |
|
176 | 191 | |
|
177 | 192 | * IPython/iplib.py (handle_auto): Fix inconsistency arising from |
|
178 | 193 | spurious newlines added by this routine. After a report by |
|
179 | 194 | F. Mantegazza. |
|
180 | 195 | |
|
181 | 196 | 2005-09-05 Fernando Perez <Fernando.Perez@colorado.edu> |
|
182 | 197 | |
|
183 | 198 | * IPython/Shell.py (hijack_gtk): remove pygtk.require("2.0") |
|
184 | 199 | calls. These were a leftover from the GTK 1.x days, and can cause |
|
185 | 200 | problems in certain cases (after a report by John Hunter). |
|
186 | 201 | |
|
187 | 202 | * IPython/iplib.py (InteractiveShell.__init__): Trap exception if |
|
188 | 203 | os.getcwd() fails at init time. Thanks to patch from David Remahl |
|
189 | 204 | <chmod007-AT-mac.com>. |
|
190 | 205 | (InteractiveShell.__init__): prevent certain special magics from |
|
191 | 206 | being shadowed by aliases. Closes |
|
192 | 207 | http://www.scipy.net/roundup/ipython/issue41. |
|
193 | 208 | |
|
194 | 209 | 2005-08-31 Fernando Perez <Fernando.Perez@colorado.edu> |
|
195 | 210 | |
|
196 | 211 | * IPython/iplib.py (InteractiveShell.complete): Added new |
|
197 | 212 | top-level completion method to expose the completion mechanism |
|
198 | 213 | beyond readline-based environments. |
|
199 | 214 | |
|
200 | 215 | 2005-08-19 Fernando Perez <Fernando.Perez@colorado.edu> |
|
201 | 216 | |
|
202 | 217 | * tools/ipsvnc (svnversion): fix svnversion capture. |
|
203 | 218 | |
|
204 | 219 | * IPython/iplib.py (InteractiveShell.__init__): Add has_readline |
|
205 | 220 | attribute to self, which was missing. Before, it was set by a |
|
206 | 221 | routine which in certain cases wasn't being called, so the |
|
207 | 222 | instance could end up missing the attribute. This caused a crash. |
|
208 | 223 | Closes http://www.scipy.net/roundup/ipython/issue40. |
|
209 | 224 | |
|
210 | 225 | 2005-08-16 Fernando Perez <fperez@colorado.edu> |
|
211 | 226 | |
|
212 | 227 | * IPython/ultraTB.py (VerboseTB.text): don't crash if object |
|
213 | 228 | contains non-string attribute. Closes |
|
214 | 229 | http://www.scipy.net/roundup/ipython/issue38. |
|
215 | 230 | |
|
216 | 231 | 2005-08-14 Fernando Perez <fperez@colorado.edu> |
|
217 | 232 | |
|
218 | 233 | * tools/ipsvnc: Minor improvements, to add changeset info. |
|
219 | 234 | |
|
220 | 235 | 2005-08-12 Fernando Perez <fperez@colorado.edu> |
|
221 | 236 | |
|
222 | 237 | * IPython/iplib.py (runsource): remove self.code_to_run_src |
|
223 | 238 | attribute. I realized this is nothing more than |
|
224 | 239 | '\n'.join(self.buffer), and having the same data in two different |
|
225 | 240 | places is just asking for synchronization bugs. This may impact |
|
226 | 241 | people who have custom exception handlers, so I need to warn |
|
227 | 242 | ipython-dev about it (F. Mantegazza may use them). |
|
228 | 243 | |
|
229 | 244 | 2005-07-29 Fernando Perez <Fernando.Perez@colorado.edu> |
|
230 | 245 | |
|
231 | 246 | * IPython/genutils.py: fix 2.2 compatibility (generators) |
|
232 | 247 | |
|
233 | 248 | 2005-07-18 Fernando Perez <fperez@colorado.edu> |
|
234 | 249 | |
|
235 | 250 | * IPython/genutils.py (get_home_dir): fix to help users with |
|
236 | 251 | invalid $HOME under win32. |
|
237 | 252 | |
|
238 | 253 | 2005-07-17 Fernando Perez <fperez@colorado.edu> |
|
239 | 254 | |
|
240 | 255 | * IPython/Prompts.py (str_safe): Make unicode-safe. Also remove |
|
241 | 256 | some old hacks and clean up a bit other routines; code should be |
|
242 | 257 | simpler and a bit faster. |
|
243 | 258 | |
|
244 | 259 | * IPython/iplib.py (interact): removed some last-resort attempts |
|
245 | 260 | to survive broken stdout/stderr. That code was only making it |
|
246 | 261 | harder to abstract out the i/o (necessary for gui integration), |
|
247 | 262 | and the crashes it could prevent were extremely rare in practice |
|
248 | 263 | (besides being fully user-induced in a pretty violent manner). |
|
249 | 264 | |
|
250 | 265 | * IPython/genutils.py (IOStream.__init__): Simplify the i/o stuff. |
|
251 | 266 | Nothing major yet, but the code is simpler to read; this should |
|
252 | 267 | make it easier to do more serious modifications in the future. |
|
253 | 268 | |
|
254 | 269 | * IPython/Extensions/InterpreterExec.py: Fix auto-quoting in pysh, |
|
255 | 270 | which broke in .15 (thanks to a report by Ville). |
|
256 | 271 | |
|
257 | 272 | * IPython/Itpl.py (Itpl.__init__): add unicode support (it may not |
|
258 | 273 | be quite correct, I know next to nothing about unicode). This |
|
259 | 274 | will allow unicode strings to be used in prompts, amongst other |
|
260 | 275 | cases. It also will prevent ipython from crashing when unicode |
|
261 | 276 | shows up unexpectedly in many places. If ascii encoding fails, we |
|
262 | 277 | assume utf_8. Currently the encoding is not a user-visible |
|
263 | 278 | setting, though it could be made so if there is demand for it. |
|
264 | 279 | |
|
265 | 280 | * IPython/ipmaker.py (make_IPython): remove old 2.1-specific hack. |
|
266 | 281 | |
|
267 | 282 | * IPython/Struct.py (Struct.merge): switch keys() to iterator. |
|
268 | 283 | |
|
269 | 284 | * IPython/background_jobs.py: moved 2.2 compatibility to genutils. |
|
270 | 285 | |
|
271 | 286 | * IPython/genutils.py: Add 2.2 compatibility here, so all other |
|
272 | 287 | code can work transparently for 2.2/2.3. |
|
273 | 288 | |
|
274 | 289 | 2005-07-16 Fernando Perez <fperez@colorado.edu> |
|
275 | 290 | |
|
276 | 291 | * IPython/ultraTB.py (ExceptionColors): Make a global variable |
|
277 | 292 | out of the color scheme table used for coloring exception |
|
278 | 293 | tracebacks. This allows user code to add new schemes at runtime. |
|
279 | 294 | This is a minimally modified version of the patch at |
|
280 | 295 | http://www.scipy.net/roundup/ipython/issue35, many thanks to pabw |
|
281 | 296 | for the contribution. |
|
282 | 297 | |
|
283 | 298 | * IPython/FlexCompleter.py (Completer.attr_matches): Add a |
|
284 | 299 | slightly modified version of the patch in |
|
285 | 300 | http://www.scipy.net/roundup/ipython/issue34, which also allows me |
|
286 | 301 | to remove the previous try/except solution (which was costlier). |
|
287 | 302 | Thanks to Gaetan Lehmann <gaetan.lehmann-AT-jouy.inra.fr> for the fix. |
|
288 | 303 | |
|
289 | 304 | 2005-06-08 Fernando Perez <fperez@colorado.edu> |
|
290 | 305 | |
|
291 | 306 | * IPython/iplib.py (write/write_err): Add methods to abstract all |
|
292 | 307 | I/O a bit more. |
|
293 | 308 | |
|
294 | 309 | * IPython/Shell.py (IPShellGTK.mainloop): Fix GTK deprecation |
|
295 | 310 | warning, reported by Aric Hagberg, fix by JD Hunter. |
|
296 | 311 | |
|
297 | 312 | 2005-06-02 *** Released version 0.6.15 |
|
298 | 313 | |
|
299 | 314 | 2005-06-01 Fernando Perez <fperez@colorado.edu> |
|
300 | 315 | |
|
301 | 316 | * IPython/iplib.py (MagicCompleter.file_matches): Fix |
|
302 | 317 | tab-completion of filenames within open-quoted strings. Note that |
|
303 | 318 | this requires that in ~/.ipython/ipythonrc, users change the |
|
304 | 319 | readline delimiters configuration to read: |
|
305 | 320 | |
|
306 | 321 | readline_remove_delims -/~ |
|
307 | 322 | |
|
308 | 323 | |
|
309 | 324 | 2005-05-31 *** Released version 0.6.14 |
|
310 | 325 | |
|
311 | 326 | 2005-05-29 Fernando Perez <fperez@colorado.edu> |
|
312 | 327 | |
|
313 | 328 | * IPython/ultraTB.py (VerboseTB.text): Fix crash for tracebacks |
|
314 | 329 | with files not on the filesystem. Reported by Eliyahu Sandler |
|
315 | 330 | <eli@gondolin.net> |
|
316 | 331 | |
|
317 | 332 | 2005-05-22 Fernando Perez <fperez@colorado.edu> |
|
318 | 333 | |
|
319 | 334 | * IPython/iplib.py: Fix a few crashes in the --upgrade option. |
|
320 | 335 | After an initial report by LUK ShunTim <shuntim.luk@polyu.edu.hk>. |
|
321 | 336 | |
|
322 | 337 | 2005-05-19 Fernando Perez <fperez@colorado.edu> |
|
323 | 338 | |
|
324 | 339 | * IPython/iplib.py (safe_execfile): close a file which could be |
|
325 | 340 | left open (causing problems in win32, which locks open files). |
|
326 | 341 | Thanks to a bug report by D Brown <dbrown2@yahoo.com>. |
|
327 | 342 | |
|
328 | 343 | 2005-05-18 Fernando Perez <fperez@colorado.edu> |
|
329 | 344 | |
|
330 | 345 | * IPython/Shell.py (MatplotlibShellBase.mplot_exec): pass all |
|
331 | 346 | keyword arguments correctly to safe_execfile(). |
|
332 | 347 | |
|
333 | 348 | 2005-05-13 Fernando Perez <fperez@colorado.edu> |
|
334 | 349 | |
|
335 | 350 | * ipython.1: Added info about Qt to manpage, and threads warning |
|
336 | 351 | to usage page (invoked with --help). |
|
337 | 352 | |
|
338 | 353 | * IPython/iplib.py (MagicCompleter.python_func_kw_matches): Added |
|
339 | 354 | new matcher (it goes at the end of the priority list) to do |
|
340 | 355 | tab-completion on named function arguments. Submitted by George |
|
341 | 356 | Sakkis <gsakkis-AT-eden.rutgers.edu>. See the thread at |
|
342 | 357 | http://www.scipy.net/pipermail/ipython-dev/2005-April/000436.html |
|
343 | 358 | for more details. |
|
344 | 359 | |
|
345 | 360 | * IPython/Magic.py (magic_run): Added new -e flag to ignore |
|
346 | 361 | SystemExit exceptions in the script being run. Thanks to a report |
|
347 | 362 | by danny shevitz <danny_shevitz-AT-yahoo.com>, about this |
|
348 | 363 | producing very annoying behavior when running unit tests. |
|
349 | 364 | |
|
350 | 365 | 2005-05-12 Fernando Perez <fperez@colorado.edu> |
|
351 | 366 | |
|
352 | 367 | * IPython/iplib.py (handle_auto): fixed auto-quoting and parens, |
|
353 | 368 | which I'd broken (again) due to a changed regexp. In the process, |
|
354 | 369 | added ';' as an escape to auto-quote the whole line without |
|
355 | 370 | splitting its arguments. Thanks to a report by Jerry McRae |
|
356 | 371 | <qrs0xyc02-AT-sneakemail.com>. |
|
357 | 372 | |
|
358 | 373 | * IPython/ultraTB.py (VerboseTB.text): protect against rare but |
|
359 | 374 | possible crashes caused by a TokenError. Reported by Ed Schofield |
|
360 | 375 | <schofield-AT-ftw.at>. |
|
361 | 376 | |
|
362 | 377 | 2005-05-06 Fernando Perez <fperez@colorado.edu> |
|
363 | 378 | |
|
364 | 379 | * IPython/Shell.py (hijack_wx): Fix to work with WX v.2.6. |
|
365 | 380 | |
|
366 | 381 | 2005-04-29 Fernando Perez <fperez@colorado.edu> |
|
367 | 382 | |
|
368 | 383 | * IPython/Shell.py (IPShellQt): Thanks to Denis Rivière |
|
369 | 384 | <nudz-AT-free.fr>, Yann Cointepas <yann-AT-sapetnioc.org> and Benjamin |
|
370 | 385 | Thyreau <Benji2-AT-decideur.info>, we now have a -qthread option |
|
371 | 386 | which provides support for Qt interactive usage (similar to the |
|
372 | 387 | existing one for WX and GTK). This had been often requested. |
|
373 | 388 | |
|
374 | 389 | 2005-04-14 *** Released version 0.6.13 |
|
375 | 390 | |
|
376 | 391 | 2005-04-08 Fernando Perez <fperez@colorado.edu> |
|
377 | 392 | |
|
378 | 393 | * IPython/Magic.py (Magic._ofind): remove docstring evaluation |
|
379 | 394 | from _ofind, which gets called on almost every input line. Now, |
|
380 | 395 | we only try to get docstrings if they are actually going to be |
|
381 | 396 | used (the overhead of fetching unnecessary docstrings can be |
|
382 | 397 | noticeable for certain objects, such as Pyro proxies). |
|
383 | 398 | |
|
384 | 399 | * IPython/iplib.py (MagicCompleter.python_matches): Change the API |
|
385 | 400 | for completers. For some reason I had been passing them the state |
|
386 | 401 | variable, which completers never actually need, and was in |
|
387 | 402 | conflict with the rlcompleter API. Custom completers ONLY need to |
|
388 | 403 | take the text parameter. |
|
389 | 404 | |
|
390 | 405 | * IPython/Extensions/InterpreterExec.py: Fix regexp so that magics |
|
391 | 406 | work correctly in pysh. I've also moved all the logic which used |
|
392 | 407 | to be in pysh.py here, which will prevent problems with future |
|
393 | 408 | upgrades. However, this time I must warn users to update their |
|
394 | 409 | pysh profile to include the line |
|
395 | 410 | |
|
396 | 411 | import_all IPython.Extensions.InterpreterExec |
|
397 | 412 | |
|
398 | 413 | because otherwise things won't work for them. They MUST also |
|
399 | 414 | delete pysh.py and the line |
|
400 | 415 | |
|
401 | 416 | execfile pysh.py |
|
402 | 417 | |
|
403 | 418 | from their ipythonrc-pysh. |
|
404 | 419 | |
|
405 | 420 | * IPython/FlexCompleter.py (Completer.attr_matches): Make more |
|
406 | 421 | robust in the face of objects whose dir() returns non-strings |
|
407 | 422 | (which it shouldn't, but some broken libs like ITK do). Thanks to |
|
408 | 423 | a patch by John Hunter (implemented differently, though). Also |
|
409 | 424 | minor improvements by using .extend instead of + on lists. |
|
410 | 425 | |
|
411 | 426 | * pysh.py: |
|
412 | 427 | |
|
413 | 428 | 2005-04-06 Fernando Perez <fperez@colorado.edu> |
|
414 | 429 | |
|
415 | 430 | * IPython/ipmaker.py (make_IPython): Make multi_line_specials on |
|
416 | 431 | by default, so that all users benefit from it. Those who don't |
|
417 | 432 | want it can still turn it off. |
|
418 | 433 | |
|
419 | 434 | * IPython/UserConfig/ipythonrc: Add multi_line_specials to the |
|
420 | 435 | config file, I'd forgotten about this, so users were getting it |
|
421 | 436 | off by default. |
|
422 | 437 | |
|
423 | 438 | * IPython/iplib.py (ipmagic): big overhaul of the magic system for |
|
424 | 439 | consistency. Now magics can be called in multiline statements, |
|
425 | 440 | and python variables can be expanded in magic calls via $var. |
|
426 | 441 | This makes the magic system behave just like aliases or !system |
|
427 | 442 | calls. |
|
428 | 443 | |
|
429 | 444 | 2005-03-28 Fernando Perez <fperez@colorado.edu> |
|
430 | 445 | |
|
431 | 446 | * IPython/iplib.py (handle_auto): cleanup to use %s instead of |
|
432 | 447 | expensive string additions for building command. Add support for |
|
433 | 448 | trailing ';' when autocall is used. |
|
434 | 449 | |
|
435 | 450 | 2005-03-26 Fernando Perez <fperez@colorado.edu> |
|
436 | 451 | |
|
437 | 452 | * ipython.el: Fix http://www.scipy.net/roundup/ipython/issue31. |
|
438 | 453 | Bugfix by A. Schmolck, the ipython.el maintainer. Also make |
|
439 | 454 | ipython.el robust against prompts with any number of spaces |
|
440 | 455 | (including 0) after the ':' character. |
|
441 | 456 | |
|
442 | 457 | * IPython/Prompts.py (Prompt2.set_p_str): Fix spurious space in |
|
443 | 458 | continuation prompt, which misled users to think the line was |
|
444 | 459 | already indented. Closes debian Bug#300847, reported to me by |
|
445 | 460 | Norbert Tretkowski <tretkowski-AT-inittab.de>. |
|
446 | 461 | |
|
447 | 462 | 2005-03-23 Fernando Perez <fperez@colorado.edu> |
|
448 | 463 | |
|
449 | 464 | * IPython/Prompts.py (Prompt1.__str__): Make sure that prompts are |
|
450 | 465 | properly aligned if they have embedded newlines. |
|
451 | 466 | |
|
452 | 467 | * IPython/iplib.py (runlines): Add a public method to expose |
|
453 | 468 | IPython's code execution machinery, so that users can run strings |
|
454 | 469 | as if they had been typed at the prompt interactively. |
|
455 | 470 | (InteractiveShell.__init__): Added getoutput() to the __IPYTHON__ |
|
456 | 471 | methods which can call the system shell, but with python variable |
|
457 | 472 | expansion. The three such methods are: __IPYTHON__.system, |
|
458 | 473 | .getoutput and .getoutputerror. These need to be documented in a |
|
459 | 474 | 'public API' section (to be written) of the manual. |
|
460 | 475 | |
|
461 | 476 | 2005-03-20 Fernando Perez <fperez@colorado.edu> |
|
462 | 477 | |
|
463 | 478 | * IPython/iplib.py (InteractiveShell.set_custom_exc): new system |
|
464 | 479 | for custom exception handling. This is quite powerful, and it |
|
465 | 480 | allows for user-installable exception handlers which can trap |
|
466 | 481 | custom exceptions at runtime and treat them separately from |
|
467 | 482 | IPython's default mechanisms. At the request of Frédéric |
|
468 | 483 | Mantegazza <mantegazza-AT-ill.fr>. |
|
469 | 484 | (InteractiveShell.set_custom_completer): public API function to |
|
470 | 485 | add new completers at runtime. |
|
471 | 486 | |
|
472 | 487 | 2005-03-19 Fernando Perez <fperez@colorado.edu> |
|
473 | 488 | |
|
474 | 489 | * IPython/OInspect.py (getdoc): Add a call to obj.getdoc(), to |
|
475 | 490 | allow objects which provide their docstrings via non-standard |
|
476 | 491 | mechanisms (like Pyro proxies) to still be inspected by ipython's |
|
477 | 492 | ? system. |
|
478 | 493 | |
|
479 | 494 | * IPython/iplib.py (InteractiveShell.__init__): back off the _o/_e |
|
480 | 495 | automatic capture system. I tried quite hard to make it work |
|
481 | 496 | reliably, and simply failed. I tried many combinations with the |
|
482 | 497 | subprocess module, but eventually nothing worked in all needed |
|
483 | 498 | cases (not blocking stdin for the child, duplicating stdout |
|
484 | 499 | without blocking, etc). The new %sc/%sx still do capture to these |
|
485 | 500 | magical list/string objects which make shell use much more |
|
486 | 501 | conveninent, so not all is lost. |
|
487 | 502 | |
|
488 | 503 | XXX - FIX MANUAL for the change above! |
|
489 | 504 | |
|
490 | 505 | (runsource): I copied code.py's runsource() into ipython to modify |
|
491 | 506 | it a bit. Now the code object and source to be executed are |
|
492 | 507 | stored in ipython. This makes this info accessible to third-party |
|
493 | 508 | tools, like custom exception handlers. After a request by Frédéric |
|
494 | 509 | Mantegazza <mantegazza-AT-ill.fr>. |
|
495 | 510 | |
|
496 | 511 | * IPython/UserConfig/ipythonrc: Add up/down arrow keys to |
|
497 | 512 | history-search via readline (like C-p/C-n). I'd wanted this for a |
|
498 | 513 | long time, but only recently found out how to do it. For users |
|
499 | 514 | who already have their ipythonrc files made and want this, just |
|
500 | 515 | add: |
|
501 | 516 | |
|
502 | 517 | readline_parse_and_bind "\e[A": history-search-backward |
|
503 | 518 | readline_parse_and_bind "\e[B": history-search-forward |
|
504 | 519 | |
|
505 | 520 | 2005-03-18 Fernando Perez <fperez@colorado.edu> |
|
506 | 521 | |
|
507 | 522 | * IPython/Magic.py (magic_sc): %sc and %sx now use the fancy |
|
508 | 523 | LSString and SList classes which allow transparent conversions |
|
509 | 524 | between list mode and whitespace-separated string. |
|
510 | 525 | (magic_r): Fix recursion problem in %r. |
|
511 | 526 | |
|
512 | 527 | * IPython/genutils.py (LSString): New class to be used for |
|
513 | 528 | automatic storage of the results of all alias/system calls in _o |
|
514 | 529 | and _e (stdout/err). These provide a .l/.list attribute which |
|
515 | 530 | does automatic splitting on newlines. This means that for most |
|
516 | 531 | uses, you'll never need to do capturing of output with %sc/%sx |
|
517 | 532 | anymore, since ipython keeps this always done for you. Note that |
|
518 | 533 | only the LAST results are stored, the _o/e variables are |
|
519 | 534 | overwritten on each call. If you need to save their contents |
|
520 | 535 | further, simply bind them to any other name. |
|
521 | 536 | |
|
522 | 537 | 2005-03-17 Fernando Perez <fperez@colorado.edu> |
|
523 | 538 | |
|
524 | 539 | * IPython/Prompts.py (BasePrompt.cwd_filt): a few more fixes for |
|
525 | 540 | prompt namespace handling. |
|
526 | 541 | |
|
527 | 542 | 2005-03-16 Fernando Perez <fperez@colorado.edu> |
|
528 | 543 | |
|
529 | 544 | * IPython/Prompts.py (CachedOutput.__init__): Fix default and |
|
530 | 545 | classic prompts to be '>>> ' (final space was missing, and it |
|
531 | 546 | trips the emacs python mode). |
|
532 | 547 | (BasePrompt.__str__): Added safe support for dynamic prompt |
|
533 | 548 | strings. Now you can set your prompt string to be '$x', and the |
|
534 | 549 | value of x will be printed from your interactive namespace. The |
|
535 | 550 | interpolation syntax includes the full Itpl support, so |
|
536 | 551 | ${foo()+x+bar()} is a valid prompt string now, and the function |
|
537 | 552 | calls will be made at runtime. |
|
538 | 553 | |
|
539 | 554 | 2005-03-15 Fernando Perez <fperez@colorado.edu> |
|
540 | 555 | |
|
541 | 556 | * IPython/Magic.py (magic_history): renamed %hist to %history, to |
|
542 | 557 | avoid name clashes in pylab. %hist still works, it just forwards |
|
543 | 558 | the call to %history. |
|
544 | 559 | |
|
545 | 560 | 2005-03-02 *** Released version 0.6.12 |
|
546 | 561 | |
|
547 | 562 | 2005-03-02 Fernando Perez <fperez@colorado.edu> |
|
548 | 563 | |
|
549 | 564 | * IPython/iplib.py (handle_magic): log magic calls properly as |
|
550 | 565 | ipmagic() function calls. |
|
551 | 566 | |
|
552 | 567 | * IPython/Magic.py (magic_time): Improved %time to support |
|
553 | 568 | statements and provide wall-clock as well as CPU time. |
|
554 | 569 | |
|
555 | 570 | 2005-02-27 Fernando Perez <fperez@colorado.edu> |
|
556 | 571 | |
|
557 | 572 | * IPython/hooks.py: New hooks module, to expose user-modifiable |
|
558 | 573 | IPython functionality in a clean manner. For now only the editor |
|
559 | 574 | hook is actually written, and other thigns which I intend to turn |
|
560 | 575 | into proper hooks aren't yet there. The display and prefilter |
|
561 | 576 | stuff, for example, should be hooks. But at least now the |
|
562 | 577 | framework is in place, and the rest can be moved here with more |
|
563 | 578 | time later. IPython had had a .hooks variable for a long time for |
|
564 | 579 | this purpose, but I'd never actually used it for anything. |
|
565 | 580 | |
|
566 | 581 | 2005-02-26 Fernando Perez <fperez@colorado.edu> |
|
567 | 582 | |
|
568 | 583 | * IPython/ipmaker.py (make_IPython): make the default ipython |
|
569 | 584 | directory be called _ipython under win32, to follow more the |
|
570 | 585 | naming peculiarities of that platform (where buggy software like |
|
571 | 586 | Visual Sourcesafe breaks with .named directories). Reported by |
|
572 | 587 | Ville Vainio. |
|
573 | 588 | |
|
574 | 589 | 2005-02-23 Fernando Perez <fperez@colorado.edu> |
|
575 | 590 | |
|
576 | 591 | * IPython/iplib.py (InteractiveShell.__init__): removed a few |
|
577 | 592 | auto_aliases for win32 which were causing problems. Users can |
|
578 | 593 | define the ones they personally like. |
|
579 | 594 | |
|
580 | 595 | 2005-02-21 Fernando Perez <fperez@colorado.edu> |
|
581 | 596 | |
|
582 | 597 | * IPython/Magic.py (magic_time): new magic to time execution of |
|
583 | 598 | expressions. After a request by Charles Moad <cmoad-AT-indiana.edu>. |
|
584 | 599 | |
|
585 | 600 | 2005-02-19 Fernando Perez <fperez@colorado.edu> |
|
586 | 601 | |
|
587 | 602 | * IPython/ConfigLoader.py (ConfigLoader.load): Allow empty strings |
|
588 | 603 | into keys (for prompts, for example). |
|
589 | 604 | |
|
590 | 605 | * IPython/Prompts.py (BasePrompt.set_p_str): Fix to allow empty |
|
591 | 606 | prompts in case users want them. This introduces a small behavior |
|
592 | 607 | change: ipython does not automatically add a space to all prompts |
|
593 | 608 | anymore. To get the old prompts with a space, users should add it |
|
594 | 609 | manually to their ipythonrc file, so for example prompt_in1 should |
|
595 | 610 | now read 'In [\#]: ' instead of 'In [\#]:'. |
|
596 | 611 | (BasePrompt.__init__): New option prompts_pad_left (only in rc |
|
597 | 612 | file) to control left-padding of secondary prompts. |
|
598 | 613 | |
|
599 | 614 | * IPython/Magic.py (Magic.profile_missing_notice): Don't crash if |
|
600 | 615 | the profiler can't be imported. Fix for Debian, which removed |
|
601 | 616 | profile.py because of License issues. I applied a slightly |
|
602 | 617 | modified version of the original Debian patch at |
|
603 | 618 | http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=294500. |
|
604 | 619 | |
|
605 | 620 | 2005-02-17 Fernando Perez <fperez@colorado.edu> |
|
606 | 621 | |
|
607 | 622 | * IPython/genutils.py (native_line_ends): Fix bug which would |
|
608 | 623 | cause improper line-ends under win32 b/c I was not opening files |
|
609 | 624 | in binary mode. Bug report and fix thanks to Ville. |
|
610 | 625 | |
|
611 | 626 | * IPython/iplib.py (handle_auto): Fix bug which I introduced when |
|
612 | 627 | trying to catch spurious foo[1] autocalls. My fix actually broke |
|
613 | 628 | ',/' autoquote/call with explicit escape (bad regexp). |
|
614 | 629 | |
|
615 | 630 | 2005-02-15 *** Released version 0.6.11 |
|
616 | 631 | |
|
617 | 632 | 2005-02-14 Fernando Perez <fperez@colorado.edu> |
|
618 | 633 | |
|
619 | 634 | * IPython/background_jobs.py: New background job management |
|
620 | 635 | subsystem. This is implemented via a new set of classes, and |
|
621 | 636 | IPython now provides a builtin 'jobs' object for background job |
|
622 | 637 | execution. A convenience %bg magic serves as a lightweight |
|
623 | 638 | frontend for starting the more common type of calls. This was |
|
624 | 639 | inspired by discussions with B. Granger and the BackgroundCommand |
|
625 | 640 | class described in the book Python Scripting for Computational |
|
626 | 641 | Science, by H. P. Langtangen: http://folk.uio.no/hpl/scripting |
|
627 | 642 | (although ultimately no code from this text was used, as IPython's |
|
628 | 643 | system is a separate implementation). |
|
629 | 644 | |
|
630 | 645 | * IPython/iplib.py (MagicCompleter.python_matches): add new option |
|
631 | 646 | to control the completion of single/double underscore names |
|
632 | 647 | separately. As documented in the example ipytonrc file, the |
|
633 | 648 | readline_omit__names variable can now be set to 2, to omit even |
|
634 | 649 | single underscore names. Thanks to a patch by Brian Wong |
|
635 | 650 | <BrianWong-AT-AirgoNetworks.Com>. |
|
636 | 651 | (InteractiveShell.__init__): Fix bug which would cause foo[1] to |
|
637 | 652 | be autocalled as foo([1]) if foo were callable. A problem for |
|
638 | 653 | things which are both callable and implement __getitem__. |
|
639 | 654 | (init_readline): Fix autoindentation for win32. Thanks to a patch |
|
640 | 655 | by Vivian De Smedt <vivian-AT-vdesmedt.com>. |
|
641 | 656 | |
|
642 | 657 | 2005-02-12 Fernando Perez <fperez@colorado.edu> |
|
643 | 658 | |
|
644 | 659 | * IPython/ipmaker.py (make_IPython): Disabled the stout traps |
|
645 | 660 | which I had written long ago to sort out user error messages which |
|
646 | 661 | may occur during startup. This seemed like a good idea initially, |
|
647 | 662 | but it has proven a disaster in retrospect. I don't want to |
|
648 | 663 | change much code for now, so my fix is to set the internal 'debug' |
|
649 | 664 | flag to true everywhere, whose only job was precisely to control |
|
650 | 665 | this subsystem. This closes issue 28 (as well as avoiding all |
|
651 | 666 | sorts of strange hangups which occur from time to time). |
|
652 | 667 | |
|
653 | 668 | 2005-02-07 Fernando Perez <fperez@colorado.edu> |
|
654 | 669 | |
|
655 | 670 | * IPython/Magic.py (magic_edit): Fix 'ed -p' not working when the |
|
656 | 671 | previous call produced a syntax error. |
|
657 | 672 | |
|
658 | 673 | * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting |
|
659 | 674 | classes without constructor. |
|
660 | 675 | |
|
661 | 676 | 2005-02-06 Fernando Perez <fperez@colorado.edu> |
|
662 | 677 | |
|
663 | 678 | * IPython/iplib.py (MagicCompleter.complete): Extend the list of |
|
664 | 679 | completions with the results of each matcher, so we return results |
|
665 | 680 | to the user from all namespaces. This breaks with ipython |
|
666 | 681 | tradition, but I think it's a nicer behavior. Now you get all |
|
667 | 682 | possible completions listed, from all possible namespaces (python, |
|
668 | 683 | filesystem, magics...) After a request by John Hunter |
|
669 | 684 | <jdhunter-AT-nitace.bsd.uchicago.edu>. |
|
670 | 685 | |
|
671 | 686 | 2005-02-05 Fernando Perez <fperez@colorado.edu> |
|
672 | 687 | |
|
673 | 688 | * IPython/Magic.py (magic_prun): Fix bug where prun would fail if |
|
674 | 689 | the call had quote characters in it (the quotes were stripped). |
|
675 | 690 | |
|
676 | 691 | 2005-01-31 Fernando Perez <fperez@colorado.edu> |
|
677 | 692 | |
|
678 | 693 | * IPython/iplib.py (InteractiveShell.__init__): reduce reliance on |
|
679 | 694 | Itpl.itpl() to make the code more robust against psyco |
|
680 | 695 | optimizations. |
|
681 | 696 | |
|
682 | 697 | * IPython/Itpl.py (Itpl.__str__): Use a _getframe() call instead |
|
683 | 698 | of causing an exception. Quicker, cleaner. |
|
684 | 699 | |
|
685 | 700 | 2005-01-28 Fernando Perez <fperez@colorado.edu> |
|
686 | 701 | |
|
687 | 702 | * scripts/ipython_win_post_install.py (install): hardcode |
|
688 | 703 | sys.prefix+'python.exe' as the executable path. It turns out that |
|
689 | 704 | during the post-installation run, sys.executable resolves to the |
|
690 | 705 | name of the binary installer! I should report this as a distutils |
|
691 | 706 | bug, I think. I updated the .10 release with this tiny fix, to |
|
692 | 707 | avoid annoying the lists further. |
|
693 | 708 | |
|
694 | 709 | 2005-01-27 *** Released version 0.6.10 |
|
695 | 710 | |
|
696 | 711 | 2005-01-27 Fernando Perez <fperez@colorado.edu> |
|
697 | 712 | |
|
698 | 713 | * IPython/numutils.py (norm): Added 'inf' as optional name for |
|
699 | 714 | L-infinity norm, included references to mathworld.com for vector |
|
700 | 715 | norm definitions. |
|
701 | 716 | (amin/amax): added amin/amax for array min/max. Similar to what |
|
702 | 717 | pylab ships with after the recent reorganization of names. |
|
703 | 718 | (spike/spike_odd): removed deprecated spike/spike_odd functions. |
|
704 | 719 | |
|
705 | 720 | * ipython.el: committed Alex's recent fixes and improvements. |
|
706 | 721 | Tested with python-mode from CVS, and it looks excellent. Since |
|
707 | 722 | python-mode hasn't released anything in a while, I'm temporarily |
|
708 | 723 | putting a copy of today's CVS (v 4.70) of python-mode in: |
|
709 | 724 | http://ipython.scipy.org/tmp/python-mode.el |
|
710 | 725 | |
|
711 | 726 | * scripts/ipython_win_post_install.py (install): Win32 fix to use |
|
712 | 727 | sys.executable for the executable name, instead of assuming it's |
|
713 | 728 | called 'python.exe' (the post-installer would have produced broken |
|
714 | 729 | setups on systems with a differently named python binary). |
|
715 | 730 | |
|
716 | 731 | * IPython/PyColorize.py (Parser.__call__): change explicit '\n' |
|
717 | 732 | references to os.linesep, to make the code more |
|
718 | 733 | platform-independent. This is also part of the win32 coloring |
|
719 | 734 | fixes. |
|
720 | 735 | |
|
721 | 736 | * IPython/genutils.py (page_dumb): Remove attempts to chop long |
|
722 | 737 | lines, which actually cause coloring bugs because the length of |
|
723 | 738 | the line is very difficult to correctly compute with embedded |
|
724 | 739 | escapes. This was the source of all the coloring problems under |
|
725 | 740 | Win32. I think that _finally_, Win32 users have a properly |
|
726 | 741 | working ipython in all respects. This would never have happened |
|
727 | 742 | if not for Gary Bishop and Viktor Ransmayr's great help and work. |
|
728 | 743 | |
|
729 | 744 | 2005-01-26 *** Released version 0.6.9 |
|
730 | 745 | |
|
731 | 746 | 2005-01-25 Fernando Perez <fperez@colorado.edu> |
|
732 | 747 | |
|
733 | 748 | * setup.py: finally, we have a true Windows installer, thanks to |
|
734 | 749 | the excellent work of Viktor Ransmayr |
|
735 | 750 | <viktor.ransmayr-AT-t-online.de>. The docs have been updated for |
|
736 | 751 | Windows users. The setup routine is quite a bit cleaner thanks to |
|
737 | 752 | this, and the post-install script uses the proper functions to |
|
738 | 753 | allow a clean de-installation using the standard Windows Control |
|
739 | 754 | Panel. |
|
740 | 755 | |
|
741 | 756 | * IPython/genutils.py (get_home_dir): changed to use the $HOME |
|
742 | 757 | environment variable under all OSes (including win32) if |
|
743 | 758 | available. This will give consistency to win32 users who have set |
|
744 | 759 | this variable for any reason. If os.environ['HOME'] fails, the |
|
745 | 760 | previous policy of using HOMEDRIVE\HOMEPATH kicks in. |
|
746 | 761 | |
|
747 | 762 | 2005-01-24 Fernando Perez <fperez@colorado.edu> |
|
748 | 763 | |
|
749 | 764 | * IPython/numutils.py (empty_like): add empty_like(), similar to |
|
750 | 765 | zeros_like() but taking advantage of the new empty() Numeric routine. |
|
751 | 766 | |
|
752 | 767 | 2005-01-23 *** Released version 0.6.8 |
|
753 | 768 | |
|
754 | 769 | 2005-01-22 Fernando Perez <fperez@colorado.edu> |
|
755 | 770 | |
|
756 | 771 | * IPython/Shell.py (MatplotlibShellBase.mplot_exec): I removed the |
|
757 | 772 | automatic show() calls. After discussing things with JDH, it |
|
758 | 773 | turns out there are too many corner cases where this can go wrong. |
|
759 | 774 | It's best not to try to be 'too smart', and simply have ipython |
|
760 | 775 | reproduce as much as possible the default behavior of a normal |
|
761 | 776 | python shell. |
|
762 | 777 | |
|
763 | 778 | * IPython/iplib.py (InteractiveShell.__init__): Modified the |
|
764 | 779 | line-splitting regexp and _prefilter() to avoid calling getattr() |
|
765 | 780 | on assignments. This closes |
|
766 | 781 | http://www.scipy.net/roundup/ipython/issue24. Note that Python's |
|
767 | 782 | readline uses getattr(), so a simple <TAB> keypress is still |
|
768 | 783 | enough to trigger getattr() calls on an object. |
|
769 | 784 | |
|
770 | 785 | 2005-01-21 Fernando Perez <fperez@colorado.edu> |
|
771 | 786 | |
|
772 | 787 | * IPython/Shell.py (MatplotlibShellBase.magic_run): Fix the %run |
|
773 | 788 | docstring under pylab so it doesn't mask the original. |
|
774 | 789 | |
|
775 | 790 | 2005-01-21 *** Released version 0.6.7 |
|
776 | 791 | |
|
777 | 792 | 2005-01-21 Fernando Perez <fperez@colorado.edu> |
|
778 | 793 | |
|
779 | 794 | * IPython/Shell.py (MTInteractiveShell.runcode): Trap a crash with |
|
780 | 795 | signal handling for win32 users in multithreaded mode. |
|
781 | 796 | |
|
782 | 797 | 2005-01-17 Fernando Perez <fperez@colorado.edu> |
|
783 | 798 | |
|
784 | 799 | * IPython/OInspect.py (Inspector.pinfo): Fix crash when inspecting |
|
785 | 800 | instances with no __init__. After a crash report by Norbert Nemec |
|
786 | 801 | <Norbert-AT-nemec-online.de>. |
|
787 | 802 | |
|
788 | 803 | 2005-01-14 Fernando Perez <fperez@colorado.edu> |
|
789 | 804 | |
|
790 | 805 | * IPython/ultraTB.py (VerboseTB.text): Fix bug in reporting of |
|
791 | 806 | names for verbose exceptions, when multiple dotted names and the |
|
792 | 807 | 'parent' object were present on the same line. |
|
793 | 808 | |
|
794 | 809 | 2005-01-11 Fernando Perez <fperez@colorado.edu> |
|
795 | 810 | |
|
796 | 811 | * IPython/genutils.py (flag_calls): new utility to trap and flag |
|
797 | 812 | calls in functions. I need it to clean up matplotlib support. |
|
798 | 813 | Also removed some deprecated code in genutils. |
|
799 | 814 | |
|
800 | 815 | * IPython/Shell.py (MatplotlibShellBase.mplot_exec): small fix so |
|
801 | 816 | that matplotlib scripts called with %run, which don't call show() |
|
802 | 817 | themselves, still have their plotting windows open. |
|
803 | 818 | |
|
804 | 819 | 2005-01-05 Fernando Perez <fperez@colorado.edu> |
|
805 | 820 | |
|
806 | 821 | * IPython/Shell.py (IPShellGTK.__init__): Patch by Andrew Straw |
|
807 | 822 | <astraw-AT-caltech.edu>, to fix gtk deprecation warnings. |
|
808 | 823 | |
|
809 | 824 | 2004-12-19 Fernando Perez <fperez@colorado.edu> |
|
810 | 825 | |
|
811 | 826 | * IPython/Shell.py (MTInteractiveShell.runcode): Get rid of |
|
812 | 827 | parent_runcode, which was an eyesore. The same result can be |
|
813 | 828 | obtained with Python's regular superclass mechanisms. |
|
814 | 829 | |
|
815 | 830 | 2004-12-17 Fernando Perez <fperez@colorado.edu> |
|
816 | 831 | |
|
817 | 832 | * IPython/Magic.py (Magic.magic_sc): Fix quote stripping problem |
|
818 | 833 | reported by Prabhu. |
|
819 | 834 | (Magic.magic_sx): direct all errors to Term.cerr (defaults to |
|
820 | 835 | sys.stderr) instead of explicitly calling sys.stderr. This helps |
|
821 | 836 | maintain our I/O abstractions clean, for future GUI embeddings. |
|
822 | 837 | |
|
823 | 838 | * IPython/genutils.py (info): added new utility for sys.stderr |
|
824 | 839 | unified info message handling (thin wrapper around warn()). |
|
825 | 840 | |
|
826 | 841 | * IPython/ultraTB.py (VerboseTB.text): Fix misreported global |
|
827 | 842 | composite (dotted) names on verbose exceptions. |
|
828 | 843 | (VerboseTB.nullrepr): harden against another kind of errors which |
|
829 | 844 | Python's inspect module can trigger, and which were crashing |
|
830 | 845 | IPython. Thanks to a report by Marco Lombardi |
|
831 | 846 | <mlombard-AT-ma010192.hq.eso.org>. |
|
832 | 847 | |
|
833 | 848 | 2004-12-13 *** Released version 0.6.6 |
|
834 | 849 | |
|
835 | 850 | 2004-12-12 Fernando Perez <fperez@colorado.edu> |
|
836 | 851 | |
|
837 | 852 | * IPython/Shell.py (IPShellGTK.mainloop): catch RuntimeErrors |
|
838 | 853 | generated by pygtk upon initialization if it was built without |
|
839 | 854 | threads (for matplotlib users). After a crash reported by |
|
840 | 855 | Leguijt, Jaap J SIEP-EPT-RES <Jaap.Leguijt-AT-shell.com>. |
|
841 | 856 | |
|
842 | 857 | * IPython/ipmaker.py (make_IPython): fix small bug in the |
|
843 | 858 | import_some parameter for multiple imports. |
|
844 | 859 | |
|
845 | 860 | * IPython/iplib.py (ipmagic): simplified the interface of |
|
846 | 861 | ipmagic() to take a single string argument, just as it would be |
|
847 | 862 | typed at the IPython cmd line. |
|
848 | 863 | (ipalias): Added new ipalias() with an interface identical to |
|
849 | 864 | ipmagic(). This completes exposing a pure python interface to the |
|
850 | 865 | alias and magic system, which can be used in loops or more complex |
|
851 | 866 | code where IPython's automatic line mangling is not active. |
|
852 | 867 | |
|
853 | 868 | * IPython/genutils.py (timing): changed interface of timing to |
|
854 | 869 | simply run code once, which is the most common case. timings() |
|
855 | 870 | remains unchanged, for the cases where you want multiple runs. |
|
856 | 871 | |
|
857 | 872 | * IPython/Shell.py (MatplotlibShellBase._matplotlib_config): Fix a |
|
858 | 873 | bug where Python2.2 crashes with exec'ing code which does not end |
|
859 | 874 | in a single newline. Python 2.3 is OK, so I hadn't noticed this |
|
860 | 875 | before. |
|
861 | 876 | |
|
862 | 877 | 2004-12-10 Fernando Perez <fperez@colorado.edu> |
|
863 | 878 | |
|
864 | 879 | * IPython/Magic.py (Magic.magic_prun): changed name of option from |
|
865 | 880 | -t to -T, to accomodate the new -t flag in %run (the %run and |
|
866 | 881 | %prun options are kind of intermixed, and it's not easy to change |
|
867 | 882 | this with the limitations of python's getopt). |
|
868 | 883 | |
|
869 | 884 | * IPython/Magic.py (Magic.magic_run): Added new -t option to time |
|
870 | 885 | the execution of scripts. It's not as fine-tuned as timeit.py, |
|
871 | 886 | but it works from inside ipython (and under 2.2, which lacks |
|
872 | 887 | timeit.py). Optionally a number of runs > 1 can be given for |
|
873 | 888 | timing very short-running code. |
|
874 | 889 | |
|
875 | 890 | * IPython/genutils.py (uniq_stable): new routine which returns a |
|
876 | 891 | list of unique elements in any iterable, but in stable order of |
|
877 | 892 | appearance. I needed this for the ultraTB fixes, and it's a handy |
|
878 | 893 | utility. |
|
879 | 894 | |
|
880 | 895 | * IPython/ultraTB.py (VerboseTB.text): Fix proper reporting of |
|
881 | 896 | dotted names in Verbose exceptions. This had been broken since |
|
882 | 897 | the very start, now x.y will properly be printed in a Verbose |
|
883 | 898 | traceback, instead of x being shown and y appearing always as an |
|
884 | 899 | 'undefined global'. Getting this to work was a bit tricky, |
|
885 | 900 | because by default python tokenizers are stateless. Saved by |
|
886 | 901 | python's ability to easily add a bit of state to an arbitrary |
|
887 | 902 | function (without needing to build a full-blown callable object). |
|
888 | 903 | |
|
889 | 904 | Also big cleanup of this code, which had horrendous runtime |
|
890 | 905 | lookups of zillions of attributes for colorization. Moved all |
|
891 | 906 | this code into a few templates, which make it cleaner and quicker. |
|
892 | 907 | |
|
893 | 908 | Printout quality was also improved for Verbose exceptions: one |
|
894 | 909 | variable per line, and memory addresses are printed (this can be |
|
895 | 910 | quite handy in nasty debugging situations, which is what Verbose |
|
896 | 911 | is for). |
|
897 | 912 | |
|
898 | 913 | * IPython/ipmaker.py (make_IPython): Do NOT execute files named in |
|
899 | 914 | the command line as scripts to be loaded by embedded instances. |
|
900 | 915 | Doing so has the potential for an infinite recursion if there are |
|
901 | 916 | exceptions thrown in the process. This fixes a strange crash |
|
902 | 917 | reported by Philippe MULLER <muller-AT-irit.fr>. |
|
903 | 918 | |
|
904 | 919 | 2004-12-09 Fernando Perez <fperez@colorado.edu> |
|
905 | 920 | |
|
906 | 921 | * IPython/Shell.py (MatplotlibShellBase.use): Change pylab support |
|
907 | 922 | to reflect new names in matplotlib, which now expose the |
|
908 | 923 | matlab-compatible interface via a pylab module instead of the |
|
909 | 924 | 'matlab' name. The new code is backwards compatible, so users of |
|
910 | 925 | all matplotlib versions are OK. Patch by J. Hunter. |
|
911 | 926 | |
|
912 | 927 | * IPython/OInspect.py (Inspector.pinfo): Add to object? printing |
|
913 | 928 | of __init__ docstrings for instances (class docstrings are already |
|
914 | 929 | automatically printed). Instances with customized docstrings |
|
915 | 930 | (indep. of the class) are also recognized and all 3 separate |
|
916 | 931 | docstrings are printed (instance, class, constructor). After some |
|
917 | 932 | comments/suggestions by J. Hunter. |
|
918 | 933 | |
|
919 | 934 | 2004-12-05 Fernando Perez <fperez@colorado.edu> |
|
920 | 935 | |
|
921 | 936 | * IPython/iplib.py (MagicCompleter.complete): Remove annoying |
|
922 | 937 | warnings when tab-completion fails and triggers an exception. |
|
923 | 938 | |
|
924 | 939 | 2004-12-03 Fernando Perez <fperez@colorado.edu> |
|
925 | 940 | |
|
926 | 941 | * IPython/Magic.py (magic_prun): Fix bug where an exception would |
|
927 | 942 | be triggered when using 'run -p'. An incorrect option flag was |
|
928 | 943 | being set ('d' instead of 'D'). |
|
929 | 944 | (manpage): fix missing escaped \- sign. |
|
930 | 945 | |
|
931 | 946 | 2004-11-30 *** Released version 0.6.5 |
|
932 | 947 | |
|
933 | 948 | 2004-11-30 Fernando Perez <fperez@colorado.edu> |
|
934 | 949 | |
|
935 | 950 | * IPython/Magic.py (Magic.magic_run): Fix bug in breakpoint |
|
936 | 951 | setting with -d option. |
|
937 | 952 | |
|
938 | 953 | * setup.py (docfiles): Fix problem where the doc glob I was using |
|
939 | 954 | was COMPLETELY BROKEN. It was giving the right files by pure |
|
940 | 955 | accident, but failed once I tried to include ipython.el. Note: |
|
941 | 956 | glob() does NOT allow you to do exclusion on multiple endings! |
|
942 | 957 | |
|
943 | 958 | 2004-11-29 Fernando Perez <fperez@colorado.edu> |
|
944 | 959 | |
|
945 | 960 | * IPython/usage.py (__doc__): cleaned up usage docstring, by using |
|
946 | 961 | the manpage as the source. Better formatting & consistency. |
|
947 | 962 | |
|
948 | 963 | * IPython/Magic.py (magic_run): Added new -d option, to run |
|
949 | 964 | scripts under the control of the python pdb debugger. Note that |
|
950 | 965 | this required changing the %prun option -d to -D, to avoid a clash |
|
951 | 966 | (since %run must pass options to %prun, and getopt is too dumb to |
|
952 | 967 | handle options with string values with embedded spaces). Thanks |
|
953 | 968 | to a suggestion by Matthew Arnison <maffew-AT-cat.org.au>. |
|
954 | 969 | (magic_who_ls): added type matching to %who and %whos, so that one |
|
955 | 970 | can filter their output to only include variables of certain |
|
956 | 971 | types. Another suggestion by Matthew. |
|
957 | 972 | (magic_whos): Added memory summaries in kb and Mb for arrays. |
|
958 | 973 | (magic_who): Improve formatting (break lines every 9 vars). |
|
959 | 974 | |
|
960 | 975 | 2004-11-28 Fernando Perez <fperez@colorado.edu> |
|
961 | 976 | |
|
962 | 977 | * IPython/Logger.py (Logger.log): Fix bug in syncing the input |
|
963 | 978 | cache when empty lines were present. |
|
964 | 979 | |
|
965 | 980 | 2004-11-24 Fernando Perez <fperez@colorado.edu> |
|
966 | 981 | |
|
967 | 982 | * IPython/usage.py (__doc__): document the re-activated threading |
|
968 | 983 | options for WX and GTK. |
|
969 | 984 | |
|
970 | 985 | 2004-11-23 Fernando Perez <fperez@colorado.edu> |
|
971 | 986 | |
|
972 | 987 | * IPython/Shell.py (start): Added Prabhu's big patch to reactivate |
|
973 | 988 | the -wthread and -gthread options, along with a new -tk one to try |
|
974 | 989 | and coordinate Tk threading with wx/gtk. The tk support is very |
|
975 | 990 | platform dependent, since it seems to require Tcl and Tk to be |
|
976 | 991 | built with threads (Fedora1/2 appears NOT to have it, but in |
|
977 | 992 | Prabhu's Debian boxes it works OK). But even with some Tk |
|
978 | 993 | limitations, this is a great improvement. |
|
979 | 994 | |
|
980 | 995 | * IPython/Prompts.py (prompt_specials_color): Added \t for time |
|
981 | 996 | info in user prompts. Patch by Prabhu. |
|
982 | 997 | |
|
983 | 998 | 2004-11-18 Fernando Perez <fperez@colorado.edu> |
|
984 | 999 | |
|
985 | 1000 | * IPython/genutils.py (ask_yes_no): Add check for a max of 20 |
|
986 | 1001 | EOFErrors and bail, to avoid infinite loops if a non-terminating |
|
987 | 1002 | file is fed into ipython. Patch submitted in issue 19 by user, |
|
988 | 1003 | many thanks. |
|
989 | 1004 | |
|
990 | 1005 | * IPython/iplib.py (InteractiveShell.handle_auto): do NOT trigger |
|
991 | 1006 | autoquote/parens in continuation prompts, which can cause lots of |
|
992 | 1007 | problems. Closes roundup issue 20. |
|
993 | 1008 | |
|
994 | 1009 | 2004-11-17 Fernando Perez <fperez@colorado.edu> |
|
995 | 1010 | |
|
996 | 1011 | * debian/control (Build-Depends-Indep): Fix dpatch dependency, |
|
997 | 1012 | reported as debian bug #280505. I'm not sure my local changelog |
|
998 | 1013 | entry has the proper debian format (Jack?). |
|
999 | 1014 | |
|
1000 | 1015 | 2004-11-08 *** Released version 0.6.4 |
|
1001 | 1016 | |
|
1002 | 1017 | 2004-11-08 Fernando Perez <fperez@colorado.edu> |
|
1003 | 1018 | |
|
1004 | 1019 | * IPython/iplib.py (init_readline): Fix exit message for Windows |
|
1005 | 1020 | when readline is active. Thanks to a report by Eric Jones |
|
1006 | 1021 | <eric-AT-enthought.com>. |
|
1007 | 1022 | |
|
1008 | 1023 | 2004-11-07 Fernando Perez <fperez@colorado.edu> |
|
1009 | 1024 | |
|
1010 | 1025 | * IPython/genutils.py (page): Add a trap for OSError exceptions, |
|
1011 | 1026 | sometimes seen by win2k/cygwin users. |
|
1012 | 1027 | |
|
1013 | 1028 | 2004-11-06 Fernando Perez <fperez@colorado.edu> |
|
1014 | 1029 | |
|
1015 | 1030 | * IPython/iplib.py (interact): Change the handling of %Exit from |
|
1016 | 1031 | trying to propagate a SystemExit to an internal ipython flag. |
|
1017 | 1032 | This is less elegant than using Python's exception mechanism, but |
|
1018 | 1033 | I can't get that to work reliably with threads, so under -pylab |
|
1019 | 1034 | %Exit was hanging IPython. Cross-thread exception handling is |
|
1020 | 1035 | really a bitch. Thaks to a bug report by Stephen Walton |
|
1021 | 1036 | <stephen.walton-AT-csun.edu>. |
|
1022 | 1037 | |
|
1023 | 1038 | 2004-11-04 Fernando Perez <fperez@colorado.edu> |
|
1024 | 1039 | |
|
1025 | 1040 | * IPython/iplib.py (raw_input_original): store a pointer to the |
|
1026 | 1041 | true raw_input to harden against code which can modify it |
|
1027 | 1042 | (wx.py.PyShell does this and would otherwise crash ipython). |
|
1028 | 1043 | Thanks to a bug report by Jim Flowers <james.flowers-AT-lgx.com>. |
|
1029 | 1044 | |
|
1030 | 1045 | * IPython/Shell.py (MTInteractiveShell.runsource): Cleaner fix for |
|
1031 | 1046 | Ctrl-C problem, which does not mess up the input line. |
|
1032 | 1047 | |
|
1033 | 1048 | 2004-11-03 Fernando Perez <fperez@colorado.edu> |
|
1034 | 1049 | |
|
1035 | 1050 | * IPython/Release.py: Changed licensing to BSD, in all files. |
|
1036 | 1051 | (name): lowercase name for tarball/RPM release. |
|
1037 | 1052 | |
|
1038 | 1053 | * IPython/OInspect.py (getdoc): wrap inspect.getdoc() safely for |
|
1039 | 1054 | use throughout ipython. |
|
1040 | 1055 | |
|
1041 | 1056 | * IPython/Magic.py (Magic._ofind): Switch to using the new |
|
1042 | 1057 | OInspect.getdoc() function. |
|
1043 | 1058 | |
|
1044 | 1059 | * IPython/Shell.py (sigint_handler): Hack to ignore the execution |
|
1045 | 1060 | of the line currently being canceled via Ctrl-C. It's extremely |
|
1046 | 1061 | ugly, but I don't know how to do it better (the problem is one of |
|
1047 | 1062 | handling cross-thread exceptions). |
|
1048 | 1063 | |
|
1049 | 1064 | 2004-10-28 Fernando Perez <fperez@colorado.edu> |
|
1050 | 1065 | |
|
1051 | 1066 | * IPython/Shell.py (signal_handler): add signal handlers to trap |
|
1052 | 1067 | SIGINT and SIGSEGV in threaded code properly. Thanks to a bug |
|
1053 | 1068 | report by Francesc Alted. |
|
1054 | 1069 | |
|
1055 | 1070 | 2004-10-21 Fernando Perez <fperez@colorado.edu> |
|
1056 | 1071 | |
|
1057 | 1072 | * IPython/Extensions/InterpreterExec.py (prefilter_shell): Fix @ |
|
1058 | 1073 | to % for pysh syntax extensions. |
|
1059 | 1074 | |
|
1060 | 1075 | 2004-10-09 Fernando Perez <fperez@colorado.edu> |
|
1061 | 1076 | |
|
1062 | 1077 | * IPython/Magic.py (Magic.magic_whos): modify output of Numeric |
|
1063 | 1078 | arrays to print a more useful summary, without calling str(arr). |
|
1064 | 1079 | This avoids the problem of extremely lengthy computations which |
|
1065 | 1080 | occur if arr is large, and appear to the user as a system lockup |
|
1066 | 1081 | with 100% cpu activity. After a suggestion by Kristian Sandberg |
|
1067 | 1082 | <Kristian.Sandberg@colorado.edu>. |
|
1068 | 1083 | (Magic.__init__): fix bug in global magic escapes not being |
|
1069 | 1084 | correctly set. |
|
1070 | 1085 | |
|
1071 | 1086 | 2004-10-08 Fernando Perez <fperez@colorado.edu> |
|
1072 | 1087 | |
|
1073 | 1088 | * IPython/Magic.py (__license__): change to absolute imports of |
|
1074 | 1089 | ipython's own internal packages, to start adapting to the absolute |
|
1075 | 1090 | import requirement of PEP-328. |
|
1076 | 1091 | |
|
1077 | 1092 | * IPython/genutils.py (__author__): Fix coding to utf-8 on all |
|
1078 | 1093 | files, and standardize author/license marks through the Release |
|
1079 | 1094 | module instead of having per/file stuff (except for files with |
|
1080 | 1095 | particular licenses, like the MIT/PSF-licensed codes). |
|
1081 | 1096 | |
|
1082 | 1097 | * IPython/Debugger.py: remove dead code for python 2.1 |
|
1083 | 1098 | |
|
1084 | 1099 | 2004-10-04 Fernando Perez <fperez@colorado.edu> |
|
1085 | 1100 | |
|
1086 | 1101 | * IPython/iplib.py (ipmagic): New function for accessing magics |
|
1087 | 1102 | via a normal python function call. |
|
1088 | 1103 | |
|
1089 | 1104 | * IPython/Magic.py (Magic.magic_magic): Change the magic escape |
|
1090 | 1105 | from '@' to '%', to accomodate the new @decorator syntax of python |
|
1091 | 1106 | 2.4. |
|
1092 | 1107 | |
|
1093 | 1108 | 2004-09-29 Fernando Perez <fperez@colorado.edu> |
|
1094 | 1109 | |
|
1095 | 1110 | * IPython/Shell.py (MatplotlibShellBase.use): Added a wrapper to |
|
1096 | 1111 | matplotlib.use to prevent running scripts which try to switch |
|
1097 | 1112 | interactive backends from within ipython. This will just crash |
|
1098 | 1113 | the python interpreter, so we can't allow it (but a detailed error |
|
1099 | 1114 | is given to the user). |
|
1100 | 1115 | |
|
1101 | 1116 | 2004-09-28 Fernando Perez <fperez@colorado.edu> |
|
1102 | 1117 | |
|
1103 | 1118 | * IPython/Shell.py (MatplotlibShellBase.mplot_exec): |
|
1104 | 1119 | matplotlib-related fixes so that using @run with non-matplotlib |
|
1105 | 1120 | scripts doesn't pop up spurious plot windows. This requires |
|
1106 | 1121 | matplotlib >= 0.63, where I had to make some changes as well. |
|
1107 | 1122 | |
|
1108 | 1123 | * IPython/ipmaker.py (make_IPython): update version requirement to |
|
1109 | 1124 | python 2.2. |
|
1110 | 1125 | |
|
1111 | 1126 | * IPython/iplib.py (InteractiveShell.mainloop): Add an optional |
|
1112 | 1127 | banner arg for embedded customization. |
|
1113 | 1128 | |
|
1114 | 1129 | * IPython/Magic.py (Magic.__init__): big cleanup to remove all |
|
1115 | 1130 | explicit uses of __IP as the IPython's instance name. Now things |
|
1116 | 1131 | are properly handled via the shell.name value. The actual code |
|
1117 | 1132 | is a bit ugly b/c I'm doing it via a global in Magic.py, but this |
|
1118 | 1133 | is much better than before. I'll clean things completely when the |
|
1119 | 1134 | magic stuff gets a real overhaul. |
|
1120 | 1135 | |
|
1121 | 1136 | * ipython.1: small fixes, sent in by Jack Moffit. He also sent in |
|
1122 | 1137 | minor changes to debian dir. |
|
1123 | 1138 | |
|
1124 | 1139 | * IPython/iplib.py (InteractiveShell.__init__): Fix adding a |
|
1125 | 1140 | pointer to the shell itself in the interactive namespace even when |
|
1126 | 1141 | a user-supplied dict is provided. This is needed for embedding |
|
1127 | 1142 | purposes (found by tests with Michel Sanner). |
|
1128 | 1143 | |
|
1129 | 1144 | 2004-09-27 Fernando Perez <fperez@colorado.edu> |
|
1130 | 1145 | |
|
1131 | 1146 | * IPython/UserConfig/ipythonrc: remove []{} from |
|
1132 | 1147 | readline_remove_delims, so that things like [modname.<TAB> do |
|
1133 | 1148 | proper completion. This disables [].TAB, but that's a less common |
|
1134 | 1149 | case than module names in list comprehensions, for example. |
|
1135 | 1150 | Thanks to a report by Andrea Riciputi. |
|
1136 | 1151 | |
|
1137 | 1152 | 2004-09-09 Fernando Perez <fperez@colorado.edu> |
|
1138 | 1153 | |
|
1139 | 1154 | * IPython/Shell.py (IPShellGTK.mainloop): reorder to avoid |
|
1140 | 1155 | blocking problems in win32 and osx. Fix by John. |
|
1141 | 1156 | |
|
1142 | 1157 | 2004-09-08 Fernando Perez <fperez@colorado.edu> |
|
1143 | 1158 | |
|
1144 | 1159 | * IPython/Shell.py (IPShellWX.OnInit): Fix output redirection bug |
|
1145 | 1160 | for Win32 and OSX. Fix by John Hunter. |
|
1146 | 1161 | |
|
1147 | 1162 | 2004-08-30 *** Released version 0.6.3 |
|
1148 | 1163 | |
|
1149 | 1164 | 2004-08-30 Fernando Perez <fperez@colorado.edu> |
|
1150 | 1165 | |
|
1151 | 1166 | * setup.py (isfile): Add manpages to list of dependent files to be |
|
1152 | 1167 | updated. |
|
1153 | 1168 | |
|
1154 | 1169 | 2004-08-27 Fernando Perez <fperez@colorado.edu> |
|
1155 | 1170 | |
|
1156 | 1171 | * IPython/Shell.py (start): I've disabled -wthread and -gthread |
|
1157 | 1172 | for now. They don't really work with standalone WX/GTK code |
|
1158 | 1173 | (though matplotlib IS working fine with both of those backends). |
|
1159 | 1174 | This will neeed much more testing. I disabled most things with |
|
1160 | 1175 | comments, so turning it back on later should be pretty easy. |
|
1161 | 1176 | |
|
1162 | 1177 | * IPython/iplib.py (InteractiveShell.__init__): Fix accidental |
|
1163 | 1178 | autocalling of expressions like r'foo', by modifying the line |
|
1164 | 1179 | split regexp. Closes |
|
1165 | 1180 | http://www.scipy.net/roundup/ipython/issue18, reported by Nicholas |
|
1166 | 1181 | Riley <ipythonbugs-AT-sabi.net>. |
|
1167 | 1182 | (InteractiveShell.mainloop): honor --nobanner with banner |
|
1168 | 1183 | extensions. |
|
1169 | 1184 | |
|
1170 | 1185 | * IPython/Shell.py: Significant refactoring of all classes, so |
|
1171 | 1186 | that we can really support ALL matplotlib backends and threading |
|
1172 | 1187 | models (John spotted a bug with Tk which required this). Now we |
|
1173 | 1188 | should support single-threaded, WX-threads and GTK-threads, both |
|
1174 | 1189 | for generic code and for matplotlib. |
|
1175 | 1190 | |
|
1176 | 1191 | * IPython/ipmaker.py (__call__): Changed -mpthread option to |
|
1177 | 1192 | -pylab, to simplify things for users. Will also remove the pylab |
|
1178 | 1193 | profile, since now all of matplotlib configuration is directly |
|
1179 | 1194 | handled here. This also reduces startup time. |
|
1180 | 1195 | |
|
1181 | 1196 | * IPython/Shell.py (IPShellGTK.run): Fixed bug where mainloop() of |
|
1182 | 1197 | shell wasn't being correctly called. Also in IPShellWX. |
|
1183 | 1198 | |
|
1184 | 1199 | * IPython/iplib.py (InteractiveShell.__init__): Added option to |
|
1185 | 1200 | fine-tune banner. |
|
1186 | 1201 | |
|
1187 | 1202 | * IPython/numutils.py (spike): Deprecate these spike functions, |
|
1188 | 1203 | delete (long deprecated) gnuplot_exec handler. |
|
1189 | 1204 | |
|
1190 | 1205 | 2004-08-26 Fernando Perez <fperez@colorado.edu> |
|
1191 | 1206 | |
|
1192 | 1207 | * ipython.1: Update for threading options, plus some others which |
|
1193 | 1208 | were missing. |
|
1194 | 1209 | |
|
1195 | 1210 | * IPython/ipmaker.py (__call__): Added -wthread option for |
|
1196 | 1211 | wxpython thread handling. Make sure threading options are only |
|
1197 | 1212 | valid at the command line. |
|
1198 | 1213 | |
|
1199 | 1214 | * scripts/ipython: moved shell selection into a factory function |
|
1200 | 1215 | in Shell.py, to keep the starter script to a minimum. |
|
1201 | 1216 | |
|
1202 | 1217 | 2004-08-25 Fernando Perez <fperez@colorado.edu> |
|
1203 | 1218 | |
|
1204 | 1219 | * IPython/Shell.py (IPShellWX.wxexit): fixes to WX threading, by |
|
1205 | 1220 | John. Along with some recent changes he made to matplotlib, the |
|
1206 | 1221 | next versions of both systems should work very well together. |
|
1207 | 1222 | |
|
1208 | 1223 | 2004-08-24 Fernando Perez <fperez@colorado.edu> |
|
1209 | 1224 | |
|
1210 | 1225 | * IPython/Magic.py (Magic.magic_prun): cleanup some dead code. I |
|
1211 | 1226 | tried to switch the profiling to using hotshot, but I'm getting |
|
1212 | 1227 | strange errors from prof.runctx() there. I may be misreading the |
|
1213 | 1228 | docs, but it looks weird. For now the profiling code will |
|
1214 | 1229 | continue to use the standard profiler. |
|
1215 | 1230 | |
|
1216 | 1231 | 2004-08-23 Fernando Perez <fperez@colorado.edu> |
|
1217 | 1232 | |
|
1218 | 1233 | * IPython/Shell.py (IPShellWX.__init__): Improvements to the WX |
|
1219 | 1234 | threaded shell, by John Hunter. It's not quite ready yet, but |
|
1220 | 1235 | close. |
|
1221 | 1236 | |
|
1222 | 1237 | 2004-08-22 Fernando Perez <fperez@colorado.edu> |
|
1223 | 1238 | |
|
1224 | 1239 | * IPython/iplib.py (InteractiveShell.interact): tab cleanups, also |
|
1225 | 1240 | in Magic and ultraTB. |
|
1226 | 1241 | |
|
1227 | 1242 | * ipython.1: document threading options in manpage. |
|
1228 | 1243 | |
|
1229 | 1244 | * scripts/ipython: Changed name of -thread option to -gthread, |
|
1230 | 1245 | since this is GTK specific. I want to leave the door open for a |
|
1231 | 1246 | -wthread option for WX, which will most likely be necessary. This |
|
1232 | 1247 | change affects usage and ipmaker as well. |
|
1233 | 1248 | |
|
1234 | 1249 | * IPython/Shell.py (matplotlib_shell): Add a factory function to |
|
1235 | 1250 | handle the matplotlib shell issues. Code by John Hunter |
|
1236 | 1251 | <jdhunter-AT-nitace.bsd.uchicago.edu>. |
|
1237 | 1252 | (IPShellMatplotlibWX.__init__): Rudimentary WX support. It's |
|
1238 | 1253 | broken (and disabled for end users) for now, but it puts the |
|
1239 | 1254 | infrastructure in place. |
|
1240 | 1255 | |
|
1241 | 1256 | 2004-08-21 Fernando Perez <fperez@colorado.edu> |
|
1242 | 1257 | |
|
1243 | 1258 | * ipythonrc-pylab: Add matplotlib support. |
|
1244 | 1259 | |
|
1245 | 1260 | * matplotlib_config.py: new files for matplotlib support, part of |
|
1246 | 1261 | the pylab profile. |
|
1247 | 1262 | |
|
1248 | 1263 | * IPython/usage.py (__doc__): documented the threading options. |
|
1249 | 1264 | |
|
1250 | 1265 | 2004-08-20 Fernando Perez <fperez@colorado.edu> |
|
1251 | 1266 | |
|
1252 | 1267 | * ipython: Modified the main calling routine to handle the -thread |
|
1253 | 1268 | and -mpthread options. This needs to be done as a top-level hack, |
|
1254 | 1269 | because it determines which class to instantiate for IPython |
|
1255 | 1270 | itself. |
|
1256 | 1271 | |
|
1257 | 1272 | * IPython/Shell.py (MTInteractiveShell.__init__): New set of |
|
1258 | 1273 | classes to support multithreaded GTK operation without blocking, |
|
1259 | 1274 | and matplotlib with all backends. This is a lot of still very |
|
1260 | 1275 | experimental code, and threads are tricky. So it may still have a |
|
1261 | 1276 | few rough edges... This code owes a lot to |
|
1262 | 1277 | http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65109, by |
|
1263 | 1278 | Brian # McErlean and John Finlay, to Antoon Pardon for fixes, and |
|
1264 | 1279 | to John Hunter for all the matplotlib work. |
|
1265 | 1280 | |
|
1266 | 1281 | * IPython/ipmaker.py (__call__): Added -thread and -mpthread |
|
1267 | 1282 | options for gtk thread and matplotlib support. |
|
1268 | 1283 | |
|
1269 | 1284 | 2004-08-16 Fernando Perez <fperez@colorado.edu> |
|
1270 | 1285 | |
|
1271 | 1286 | * IPython/iplib.py (InteractiveShell.__init__): don't trigger |
|
1272 | 1287 | autocall for things like p*q,p/q,p+q,p-q, when p is callable. Bug |
|
1273 | 1288 | reported by Stephen Walton <stephen.walton-AT-csun.edu>. |
|
1274 | 1289 | |
|
1275 | 1290 | 2004-08-11 Fernando Perez <fperez@colorado.edu> |
|
1276 | 1291 | |
|
1277 | 1292 | * setup.py (isfile): Fix build so documentation gets updated for |
|
1278 | 1293 | rpms (it was only done for .tgz builds). |
|
1279 | 1294 | |
|
1280 | 1295 | 2004-08-10 Fernando Perez <fperez@colorado.edu> |
|
1281 | 1296 | |
|
1282 | 1297 | * genutils.py (Term): Fix misspell of stdin stream (sin->cin). |
|
1283 | 1298 | |
|
1284 | 1299 | * iplib.py : Silence syntax error exceptions in tab-completion. |
|
1285 | 1300 | |
|
1286 | 1301 | 2004-08-05 Fernando Perez <fperez@colorado.edu> |
|
1287 | 1302 | |
|
1288 | 1303 | * IPython/Prompts.py (Prompt2.set_colors): Fix incorrectly set |
|
1289 | 1304 | 'color off' mark for continuation prompts. This was causing long |
|
1290 | 1305 | continuation lines to mis-wrap. |
|
1291 | 1306 | |
|
1292 | 1307 | 2004-08-01 Fernando Perez <fperez@colorado.edu> |
|
1293 | 1308 | |
|
1294 | 1309 | * IPython/ipmaker.py (make_IPython): Allow the shell class used |
|
1295 | 1310 | for building ipython to be a parameter. All this is necessary |
|
1296 | 1311 | right now to have a multithreaded version, but this insane |
|
1297 | 1312 | non-design will be cleaned up soon. For now, it's a hack that |
|
1298 | 1313 | works. |
|
1299 | 1314 | |
|
1300 | 1315 | * IPython/Shell.py (IPShell.__init__): Stop using mutable default |
|
1301 | 1316 | args in various places. No bugs so far, but it's a dangerous |
|
1302 | 1317 | practice. |
|
1303 | 1318 | |
|
1304 | 1319 | 2004-07-31 Fernando Perez <fperez@colorado.edu> |
|
1305 | 1320 | |
|
1306 | 1321 | * IPython/iplib.py (complete): ignore SyntaxError exceptions to |
|
1307 | 1322 | fix completion of files with dots in their names under most |
|
1308 | 1323 | profiles (pysh was OK because the completion order is different). |
|
1309 | 1324 | |
|
1310 | 1325 | 2004-07-27 Fernando Perez <fperez@colorado.edu> |
|
1311 | 1326 | |
|
1312 | 1327 | * IPython/iplib.py (InteractiveShell.__init__): build dict of |
|
1313 | 1328 | keywords manually, b/c the one in keyword.py was removed in python |
|
1314 | 1329 | 2.4. Patch by Anakim Border <aborder-AT-users.sourceforge.net>. |
|
1315 | 1330 | This is NOT a bug under python 2.3 and earlier. |
|
1316 | 1331 | |
|
1317 | 1332 | 2004-07-26 Fernando Perez <fperez@colorado.edu> |
|
1318 | 1333 | |
|
1319 | 1334 | * IPython/ultraTB.py (VerboseTB.text): Add another |
|
1320 | 1335 | linecache.checkcache() call to try to prevent inspect.py from |
|
1321 | 1336 | crashing under python 2.3. I think this fixes |
|
1322 | 1337 | http://www.scipy.net/roundup/ipython/issue17. |
|
1323 | 1338 | |
|
1324 | 1339 | 2004-07-26 *** Released version 0.6.2 |
|
1325 | 1340 | |
|
1326 | 1341 | 2004-07-26 Fernando Perez <fperez@colorado.edu> |
|
1327 | 1342 | |
|
1328 | 1343 | * IPython/Magic.py (Magic.magic_cd): Fix bug where 'cd -N' would |
|
1329 | 1344 | fail for any number. |
|
1330 | 1345 | (Magic.magic_bookmark): Fix bug where 'bookmark -l' would fail for |
|
1331 | 1346 | empty bookmarks. |
|
1332 | 1347 | |
|
1333 | 1348 | 2004-07-26 *** Released version 0.6.1 |
|
1334 | 1349 | |
|
1335 | 1350 | 2004-07-26 Fernando Perez <fperez@colorado.edu> |
|
1336 | 1351 | |
|
1337 | 1352 | * ipython_win_post_install.py (run): Added pysh shortcut for Windows. |
|
1338 | 1353 | |
|
1339 | 1354 | * IPython/iplib.py (protect_filename): Applied Ville's patch for |
|
1340 | 1355 | escaping '()[]{}' in filenames. |
|
1341 | 1356 | |
|
1342 | 1357 | * IPython/Magic.py (shlex_split): Fix handling of '*' and '?' for |
|
1343 | 1358 | Python 2.2 users who lack a proper shlex.split. |
|
1344 | 1359 | |
|
1345 | 1360 | 2004-07-19 Fernando Perez <fperez@colorado.edu> |
|
1346 | 1361 | |
|
1347 | 1362 | * IPython/iplib.py (InteractiveShell.init_readline): Add support |
|
1348 | 1363 | for reading readline's init file. I follow the normal chain: |
|
1349 | 1364 | $INPUTRC is honored, otherwise ~/.inputrc is used. Thanks to a |
|
1350 | 1365 | report by Mike Heeter. This closes |
|
1351 | 1366 | http://www.scipy.net/roundup/ipython/issue16. |
|
1352 | 1367 | |
|
1353 | 1368 | 2004-07-18 Fernando Perez <fperez@colorado.edu> |
|
1354 | 1369 | |
|
1355 | 1370 | * IPython/iplib.py (__init__): Add better handling of '\' under |
|
1356 | 1371 | Win32 for filenames. After a patch by Ville. |
|
1357 | 1372 | |
|
1358 | 1373 | 2004-07-17 Fernando Perez <fperez@colorado.edu> |
|
1359 | 1374 | |
|
1360 | 1375 | * IPython/iplib.py (InteractiveShell._prefilter): fix bug where |
|
1361 | 1376 | autocalling would be triggered for 'foo is bar' if foo is |
|
1362 | 1377 | callable. I also cleaned up the autocall detection code to use a |
|
1363 | 1378 | regexp, which is faster. Bug reported by Alexander Schmolck. |
|
1364 | 1379 | |
|
1365 | 1380 | * IPython/Magic.py (Magic.magic_pinfo): Fix bug where strings with |
|
1366 | 1381 | '?' in them would confuse the help system. Reported by Alex |
|
1367 | 1382 | Schmolck. |
|
1368 | 1383 | |
|
1369 | 1384 | 2004-07-16 Fernando Perez <fperez@colorado.edu> |
|
1370 | 1385 | |
|
1371 | 1386 | * IPython/GnuplotInteractive.py (__all__): added plot2. |
|
1372 | 1387 | |
|
1373 | 1388 | * IPython/Gnuplot2.py (Gnuplot.plot2): added new function for |
|
1374 | 1389 | plotting dictionaries, lists or tuples of 1d arrays. |
|
1375 | 1390 | |
|
1376 | 1391 | * IPython/Magic.py (Magic.magic_hist): small clenaups and |
|
1377 | 1392 | optimizations. |
|
1378 | 1393 | |
|
1379 | 1394 | * IPython/iplib.py:Remove old Changelog info for cleanup. This is |
|
1380 | 1395 | the information which was there from Janko's original IPP code: |
|
1381 | 1396 | |
|
1382 | 1397 | 03.05.99 20:53 porto.ifm.uni-kiel.de |
|
1383 | 1398 | --Started changelog. |
|
1384 | 1399 | --make clear do what it say it does |
|
1385 | 1400 | --added pretty output of lines from inputcache |
|
1386 | 1401 | --Made Logger a mixin class, simplifies handling of switches |
|
1387 | 1402 | --Added own completer class. .string<TAB> expands to last history |
|
1388 | 1403 | line which starts with string. The new expansion is also present |
|
1389 | 1404 | with Ctrl-r from the readline library. But this shows, who this |
|
1390 | 1405 | can be done for other cases. |
|
1391 | 1406 | --Added convention that all shell functions should accept a |
|
1392 | 1407 | parameter_string This opens the door for different behaviour for |
|
1393 | 1408 | each function. @cd is a good example of this. |
|
1394 | 1409 | |
|
1395 | 1410 | 04.05.99 12:12 porto.ifm.uni-kiel.de |
|
1396 | 1411 | --added logfile rotation |
|
1397 | 1412 | --added new mainloop method which freezes first the namespace |
|
1398 | 1413 | |
|
1399 | 1414 | 07.05.99 21:24 porto.ifm.uni-kiel.de |
|
1400 | 1415 | --added the docreader classes. Now there is a help system. |
|
1401 | 1416 | -This is only a first try. Currently it's not easy to put new |
|
1402 | 1417 | stuff in the indices. But this is the way to go. Info would be |
|
1403 | 1418 | better, but HTML is every where and not everybody has an info |
|
1404 | 1419 | system installed and it's not so easy to change html-docs to info. |
|
1405 | 1420 | --added global logfile option |
|
1406 | 1421 | --there is now a hook for object inspection method pinfo needs to |
|
1407 | 1422 | be provided for this. Can be reached by two '??'. |
|
1408 | 1423 | |
|
1409 | 1424 | 08.05.99 20:51 porto.ifm.uni-kiel.de |
|
1410 | 1425 | --added a README |
|
1411 | 1426 | --bug in rc file. Something has changed so functions in the rc |
|
1412 | 1427 | file need to reference the shell and not self. Not clear if it's a |
|
1413 | 1428 | bug or feature. |
|
1414 | 1429 | --changed rc file for new behavior |
|
1415 | 1430 | |
|
1416 | 1431 | 2004-07-15 Fernando Perez <fperez@colorado.edu> |
|
1417 | 1432 | |
|
1418 | 1433 | * IPython/Logger.py (Logger.log): fixed recent bug where the input |
|
1419 | 1434 | cache was falling out of sync in bizarre manners when multi-line |
|
1420 | 1435 | input was present. Minor optimizations and cleanup. |
|
1421 | 1436 | |
|
1422 | 1437 | (Logger): Remove old Changelog info for cleanup. This is the |
|
1423 | 1438 | information which was there from Janko's original code: |
|
1424 | 1439 | |
|
1425 | 1440 | Changes to Logger: - made the default log filename a parameter |
|
1426 | 1441 | |
|
1427 | 1442 | - put a check for lines beginning with !@? in log(). Needed |
|
1428 | 1443 | (even if the handlers properly log their lines) for mid-session |
|
1429 | 1444 | logging activation to work properly. Without this, lines logged |
|
1430 | 1445 | in mid session, which get read from the cache, would end up |
|
1431 | 1446 | 'bare' (with !@? in the open) in the log. Now they are caught |
|
1432 | 1447 | and prepended with a #. |
|
1433 | 1448 | |
|
1434 | 1449 | * IPython/iplib.py (InteractiveShell.init_readline): added check |
|
1435 | 1450 | in case MagicCompleter fails to be defined, so we don't crash. |
|
1436 | 1451 | |
|
1437 | 1452 | 2004-07-13 Fernando Perez <fperez@colorado.edu> |
|
1438 | 1453 | |
|
1439 | 1454 | * IPython/Gnuplot2.py (Gnuplot.hardcopy): add automatic generation |
|
1440 | 1455 | of EPS if the requested filename ends in '.eps'. |
|
1441 | 1456 | |
|
1442 | 1457 | 2004-07-04 Fernando Perez <fperez@colorado.edu> |
|
1443 | 1458 | |
|
1444 | 1459 | * IPython/iplib.py (InteractiveShell.handle_shell_escape): Fix |
|
1445 | 1460 | escaping of quotes when calling the shell. |
|
1446 | 1461 | |
|
1447 | 1462 | 2004-07-02 Fernando Perez <fperez@colorado.edu> |
|
1448 | 1463 | |
|
1449 | 1464 | * IPython/Prompts.py (CachedOutput.update): Fix problem with |
|
1450 | 1465 | gettext not working because we were clobbering '_'. Fixes |
|
1451 | 1466 | http://www.scipy.net/roundup/ipython/issue6. |
|
1452 | 1467 | |
|
1453 | 1468 | 2004-07-01 Fernando Perez <fperez@colorado.edu> |
|
1454 | 1469 | |
|
1455 | 1470 | * IPython/Magic.py (Magic.magic_cd): integrated bookmark handling |
|
1456 | 1471 | into @cd. Patch by Ville. |
|
1457 | 1472 | |
|
1458 | 1473 | * IPython/iplib.py (InteractiveShell.post_config_initialization): |
|
1459 | 1474 | new function to store things after ipmaker runs. Patch by Ville. |
|
1460 | 1475 | Eventually this will go away once ipmaker is removed and the class |
|
1461 | 1476 | gets cleaned up, but for now it's ok. Key functionality here is |
|
1462 | 1477 | the addition of the persistent storage mechanism, a dict for |
|
1463 | 1478 | keeping data across sessions (for now just bookmarks, but more can |
|
1464 | 1479 | be implemented later). |
|
1465 | 1480 | |
|
1466 | 1481 | * IPython/Magic.py (Magic.magic_bookmark): New bookmark system, |
|
1467 | 1482 | persistent across sections. Patch by Ville, I modified it |
|
1468 | 1483 | soemwhat to allow bookmarking arbitrary dirs other than CWD. Also |
|
1469 | 1484 | added a '-l' option to list all bookmarks. |
|
1470 | 1485 | |
|
1471 | 1486 | * IPython/iplib.py (InteractiveShell.atexit_operations): new |
|
1472 | 1487 | center for cleanup. Registered with atexit.register(). I moved |
|
1473 | 1488 | here the old exit_cleanup(). After a patch by Ville. |
|
1474 | 1489 | |
|
1475 | 1490 | * IPython/Magic.py (get_py_filename): added '~' to the accepted |
|
1476 | 1491 | characters in the hacked shlex_split for python 2.2. |
|
1477 | 1492 | |
|
1478 | 1493 | * IPython/iplib.py (file_matches): more fixes to filenames with |
|
1479 | 1494 | whitespace in them. It's not perfect, but limitations in python's |
|
1480 | 1495 | readline make it impossible to go further. |
|
1481 | 1496 | |
|
1482 | 1497 | 2004-06-29 Fernando Perez <fperez@colorado.edu> |
|
1483 | 1498 | |
|
1484 | 1499 | * IPython/iplib.py (file_matches): escape whitespace correctly in |
|
1485 | 1500 | filename completions. Bug reported by Ville. |
|
1486 | 1501 | |
|
1487 | 1502 | 2004-06-28 Fernando Perez <fperez@colorado.edu> |
|
1488 | 1503 | |
|
1489 | 1504 | * IPython/ipmaker.py (__call__): Added per-profile histories. Now |
|
1490 | 1505 | the history file will be called 'history-PROFNAME' (or just |
|
1491 | 1506 | 'history' if no profile is loaded). I was getting annoyed at |
|
1492 | 1507 | getting my Numerical work history clobbered by pysh sessions. |
|
1493 | 1508 | |
|
1494 | 1509 | * IPython/iplib.py (InteractiveShell.__init__): Internal |
|
1495 | 1510 | getoutputerror() function so that we can honor the system_verbose |
|
1496 | 1511 | flag for _all_ system calls. I also added escaping of # |
|
1497 | 1512 | characters here to avoid confusing Itpl. |
|
1498 | 1513 | |
|
1499 | 1514 | * IPython/Magic.py (shlex_split): removed call to shell in |
|
1500 | 1515 | parse_options and replaced it with shlex.split(). The annoying |
|
1501 | 1516 | part was that in Python 2.2, shlex.split() doesn't exist, so I had |
|
1502 | 1517 | to backport it from 2.3, with several frail hacks (the shlex |
|
1503 | 1518 | module is rather limited in 2.2). Thanks to a suggestion by Ville |
|
1504 | 1519 | Vainio <vivainio@kolumbus.fi>. For Python 2.3 there should be no |
|
1505 | 1520 | problem. |
|
1506 | 1521 | |
|
1507 | 1522 | (Magic.magic_system_verbose): new toggle to print the actual |
|
1508 | 1523 | system calls made by ipython. Mainly for debugging purposes. |
|
1509 | 1524 | |
|
1510 | 1525 | * IPython/GnuplotRuntime.py (gnu_out): fix bug for cygwin, which |
|
1511 | 1526 | doesn't support persistence. Reported (and fix suggested) by |
|
1512 | 1527 | Travis Caldwell <travis_caldwell2000@yahoo.com>. |
|
1513 | 1528 | |
|
1514 | 1529 | 2004-06-26 Fernando Perez <fperez@colorado.edu> |
|
1515 | 1530 | |
|
1516 | 1531 | * IPython/Logger.py (Logger.log): fix to handle correctly empty |
|
1517 | 1532 | continue prompts. |
|
1518 | 1533 | |
|
1519 | 1534 | * IPython/Extensions/InterpreterExec.py (pysh): moved the pysh() |
|
1520 | 1535 | function (basically a big docstring) and a few more things here to |
|
1521 | 1536 | speedup startup. pysh.py is now very lightweight. We want because |
|
1522 | 1537 | it gets execfile'd, while InterpreterExec gets imported, so |
|
1523 | 1538 | byte-compilation saves time. |
|
1524 | 1539 | |
|
1525 | 1540 | 2004-06-25 Fernando Perez <fperez@colorado.edu> |
|
1526 | 1541 | |
|
1527 | 1542 | * IPython/Magic.py (Magic.magic_cd): Fixed to restore usage of 'cd |
|
1528 | 1543 | -NUM', which was recently broken. |
|
1529 | 1544 | |
|
1530 | 1545 | * IPython/iplib.py (InteractiveShell.handle_shell_escape): allow ! |
|
1531 | 1546 | in multi-line input (but not !!, which doesn't make sense there). |
|
1532 | 1547 | |
|
1533 | 1548 | * IPython/UserConfig/ipythonrc: made autoindent on by default. |
|
1534 | 1549 | It's just too useful, and people can turn it off in the less |
|
1535 | 1550 | common cases where it's a problem. |
|
1536 | 1551 | |
|
1537 | 1552 | 2004-06-24 Fernando Perez <fperez@colorado.edu> |
|
1538 | 1553 | |
|
1539 | 1554 | * IPython/iplib.py (InteractiveShell._prefilter): big change - |
|
1540 | 1555 | special syntaxes (like alias calling) is now allied in multi-line |
|
1541 | 1556 | input. This is still _very_ experimental, but it's necessary for |
|
1542 | 1557 | efficient shell usage combining python looping syntax with system |
|
1543 | 1558 | calls. For now it's restricted to aliases, I don't think it |
|
1544 | 1559 | really even makes sense to have this for magics. |
|
1545 | 1560 | |
|
1546 | 1561 | 2004-06-23 Fernando Perez <fperez@colorado.edu> |
|
1547 | 1562 | |
|
1548 | 1563 | * IPython/Extensions/InterpreterExec.py (prefilter_shell): Added |
|
1549 | 1564 | $var=cmd <=> @sc var=cmd and $$var=cmd <=> @sc -l var=cmd. |
|
1550 | 1565 | |
|
1551 | 1566 | * IPython/Magic.py (Magic.magic_rehashx): modified to handle |
|
1552 | 1567 | extensions under Windows (after code sent by Gary Bishop). The |
|
1553 | 1568 | extensions considered 'executable' are stored in IPython's rc |
|
1554 | 1569 | structure as win_exec_ext. |
|
1555 | 1570 | |
|
1556 | 1571 | * IPython/genutils.py (shell): new function, like system() but |
|
1557 | 1572 | without return value. Very useful for interactive shell work. |
|
1558 | 1573 | |
|
1559 | 1574 | * IPython/Magic.py (Magic.magic_unalias): New @unalias function to |
|
1560 | 1575 | delete aliases. |
|
1561 | 1576 | |
|
1562 | 1577 | * IPython/iplib.py (InteractiveShell.alias_table_update): make |
|
1563 | 1578 | sure that the alias table doesn't contain python keywords. |
|
1564 | 1579 | |
|
1565 | 1580 | 2004-06-21 Fernando Perez <fperez@colorado.edu> |
|
1566 | 1581 | |
|
1567 | 1582 | * IPython/Magic.py (Magic.magic_rehash): Fix crash when |
|
1568 | 1583 | non-existent items are found in $PATH. Reported by Thorsten. |
|
1569 | 1584 | |
|
1570 | 1585 | 2004-06-20 Fernando Perez <fperez@colorado.edu> |
|
1571 | 1586 | |
|
1572 | 1587 | * IPython/iplib.py (complete): modified the completer so that the |
|
1573 | 1588 | order of priorities can be easily changed at runtime. |
|
1574 | 1589 | |
|
1575 | 1590 | * IPython/Extensions/InterpreterExec.py (prefilter_shell): |
|
1576 | 1591 | Modified to auto-execute all lines beginning with '~', '/' or '.'. |
|
1577 | 1592 | |
|
1578 | 1593 | * IPython/Magic.py (Magic.magic_sx): modified @sc and @sx to |
|
1579 | 1594 | expand Python variables prepended with $ in all system calls. The |
|
1580 | 1595 | same was done to InteractiveShell.handle_shell_escape. Now all |
|
1581 | 1596 | system access mechanisms (!, !!, @sc, @sx and aliases) allow the |
|
1582 | 1597 | expansion of python variables and expressions according to the |
|
1583 | 1598 | syntax of PEP-215 - http://www.python.org/peps/pep-0215.html. |
|
1584 | 1599 | |
|
1585 | 1600 | Though PEP-215 has been rejected, a similar (but simpler) one |
|
1586 | 1601 | seems like it will go into Python 2.4, PEP-292 - |
|
1587 | 1602 | http://www.python.org/peps/pep-0292.html. |
|
1588 | 1603 | |
|
1589 | 1604 | I'll keep the full syntax of PEP-215, since IPython has since the |
|
1590 | 1605 | start used Ka-Ping Yee's reference implementation discussed there |
|
1591 | 1606 | (Itpl), and I actually like the powerful semantics it offers. |
|
1592 | 1607 | |
|
1593 | 1608 | In order to access normal shell variables, the $ has to be escaped |
|
1594 | 1609 | via an extra $. For example: |
|
1595 | 1610 | |
|
1596 | 1611 | In [7]: PATH='a python variable' |
|
1597 | 1612 | |
|
1598 | 1613 | In [8]: !echo $PATH |
|
1599 | 1614 | a python variable |
|
1600 | 1615 | |
|
1601 | 1616 | In [9]: !echo $$PATH |
|
1602 | 1617 | /usr/local/lf9560/bin:/usr/local/intel/compiler70/ia32/bin:... |
|
1603 | 1618 | |
|
1604 | 1619 | (Magic.parse_options): escape $ so the shell doesn't evaluate |
|
1605 | 1620 | things prematurely. |
|
1606 | 1621 | |
|
1607 | 1622 | * IPython/iplib.py (InteractiveShell.call_alias): added the |
|
1608 | 1623 | ability for aliases to expand python variables via $. |
|
1609 | 1624 | |
|
1610 | 1625 | * IPython/Magic.py (Magic.magic_rehash): based on the new alias |
|
1611 | 1626 | system, now there's a @rehash/@rehashx pair of magics. These work |
|
1612 | 1627 | like the csh rehash command, and can be invoked at any time. They |
|
1613 | 1628 | build a table of aliases to everything in the user's $PATH |
|
1614 | 1629 | (@rehash uses everything, @rehashx is slower but only adds |
|
1615 | 1630 | executable files). With this, the pysh.py-based shell profile can |
|
1616 | 1631 | now simply call rehash upon startup, and full access to all |
|
1617 | 1632 | programs in the user's path is obtained. |
|
1618 | 1633 | |
|
1619 | 1634 | * IPython/iplib.py (InteractiveShell.call_alias): The new alias |
|
1620 | 1635 | functionality is now fully in place. I removed the old dynamic |
|
1621 | 1636 | code generation based approach, in favor of a much lighter one |
|
1622 | 1637 | based on a simple dict. The advantage is that this allows me to |
|
1623 | 1638 | now have thousands of aliases with negligible cost (unthinkable |
|
1624 | 1639 | with the old system). |
|
1625 | 1640 | |
|
1626 | 1641 | 2004-06-19 Fernando Perez <fperez@colorado.edu> |
|
1627 | 1642 | |
|
1628 | 1643 | * IPython/iplib.py (__init__): extended MagicCompleter class to |
|
1629 | 1644 | also complete (last in priority) on user aliases. |
|
1630 | 1645 | |
|
1631 | 1646 | * IPython/Itpl.py (Itpl.__str__): fixed order of globals/locals in |
|
1632 | 1647 | call to eval. |
|
1633 | 1648 | (ItplNS.__init__): Added a new class which functions like Itpl, |
|
1634 | 1649 | but allows configuring the namespace for the evaluation to occur |
|
1635 | 1650 | in. |
|
1636 | 1651 | |
|
1637 | 1652 | 2004-06-18 Fernando Perez <fperez@colorado.edu> |
|
1638 | 1653 | |
|
1639 | 1654 | * IPython/iplib.py (InteractiveShell.runcode): modify to print a |
|
1640 | 1655 | better message when 'exit' or 'quit' are typed (a common newbie |
|
1641 | 1656 | confusion). |
|
1642 | 1657 | |
|
1643 | 1658 | * IPython/Magic.py (Magic.magic_colors): Added the runtime color |
|
1644 | 1659 | check for Windows users. |
|
1645 | 1660 | |
|
1646 | 1661 | * IPython/iplib.py (InteractiveShell.user_setup): removed |
|
1647 | 1662 | disabling of colors for Windows. I'll test at runtime and issue a |
|
1648 | 1663 | warning if Gary's readline isn't found, as to nudge users to |
|
1649 | 1664 | download it. |
|
1650 | 1665 | |
|
1651 | 1666 | 2004-06-16 Fernando Perez <fperez@colorado.edu> |
|
1652 | 1667 | |
|
1653 | 1668 | * IPython/genutils.py (Stream.__init__): changed to print errors |
|
1654 | 1669 | to sys.stderr. I had a circular dependency here. Now it's |
|
1655 | 1670 | possible to run ipython as IDLE's shell (consider this pre-alpha, |
|
1656 | 1671 | since true stdout things end up in the starting terminal instead |
|
1657 | 1672 | of IDLE's out). |
|
1658 | 1673 | |
|
1659 | 1674 | * IPython/Prompts.py (Prompt2.set_colors): prevent crashes for |
|
1660 | 1675 | users who haven't # updated their prompt_in2 definitions. Remove |
|
1661 | 1676 | eventually. |
|
1662 | 1677 | (multiple_replace): added credit to original ASPN recipe. |
|
1663 | 1678 | |
|
1664 | 1679 | 2004-06-15 Fernando Perez <fperez@colorado.edu> |
|
1665 | 1680 | |
|
1666 | 1681 | * IPython/iplib.py (InteractiveShell.__init__): add 'cp' to the |
|
1667 | 1682 | list of auto-defined aliases. |
|
1668 | 1683 | |
|
1669 | 1684 | 2004-06-13 Fernando Perez <fperez@colorado.edu> |
|
1670 | 1685 | |
|
1671 | 1686 | * setup.py (scriptfiles): Don't trigger win_post_install unless an |
|
1672 | 1687 | install was really requested (so setup.py can be used for other |
|
1673 | 1688 | things under Windows). |
|
1674 | 1689 | |
|
1675 | 1690 | 2004-06-10 Fernando Perez <fperez@colorado.edu> |
|
1676 | 1691 | |
|
1677 | 1692 | * IPython/Logger.py (Logger.create_log): Manually remove any old |
|
1678 | 1693 | backup, since os.remove may fail under Windows. Fixes bug |
|
1679 | 1694 | reported by Thorsten. |
|
1680 | 1695 | |
|
1681 | 1696 | 2004-06-09 Fernando Perez <fperez@colorado.edu> |
|
1682 | 1697 | |
|
1683 | 1698 | * examples/example-embed.py: fixed all references to %n (replaced |
|
1684 | 1699 | with \\# for ps1/out prompts and with \\D for ps2 prompts). Done |
|
1685 | 1700 | for all examples and the manual as well. |
|
1686 | 1701 | |
|
1687 | 1702 | 2004-06-08 Fernando Perez <fperez@colorado.edu> |
|
1688 | 1703 | |
|
1689 | 1704 | * IPython/Prompts.py (Prompt2.set_p_str): fixed all prompt |
|
1690 | 1705 | alignment and color management. All 3 prompt subsystems now |
|
1691 | 1706 | inherit from BasePrompt. |
|
1692 | 1707 | |
|
1693 | 1708 | * tools/release: updates for windows installer build and tag rpms |
|
1694 | 1709 | with python version (since paths are fixed). |
|
1695 | 1710 | |
|
1696 | 1711 | * IPython/UserConfig/ipythonrc: modified to use \# instead of %n, |
|
1697 | 1712 | which will become eventually obsolete. Also fixed the default |
|
1698 | 1713 | prompt_in2 to use \D, so at least new users start with the correct |
|
1699 | 1714 | defaults. |
|
1700 | 1715 | WARNING: Users with existing ipythonrc files will need to apply |
|
1701 | 1716 | this fix manually! |
|
1702 | 1717 | |
|
1703 | 1718 | * setup.py: make windows installer (.exe). This is finally the |
|
1704 | 1719 | integration of an old patch by Cory Dodt <dodt-AT-fcoe.k12.ca.us>, |
|
1705 | 1720 | which I hadn't included because it required Python 2.3 (or recent |
|
1706 | 1721 | distutils). |
|
1707 | 1722 | |
|
1708 | 1723 | * IPython/usage.py (__doc__): update docs (and manpage) to reflect |
|
1709 | 1724 | usage of new '\D' escape. |
|
1710 | 1725 | |
|
1711 | 1726 | * IPython/Prompts.py (ROOT_SYMBOL): Small fix for Windows (which |
|
1712 | 1727 | lacks os.getuid()) |
|
1713 | 1728 | (CachedOutput.set_colors): Added the ability to turn coloring |
|
1714 | 1729 | on/off with @colors even for manually defined prompt colors. It |
|
1715 | 1730 | uses a nasty global, but it works safely and via the generic color |
|
1716 | 1731 | handling mechanism. |
|
1717 | 1732 | (Prompt2.__init__): Introduced new escape '\D' for continuation |
|
1718 | 1733 | prompts. It represents the counter ('\#') as dots. |
|
1719 | 1734 | *** NOTE *** THIS IS A BACKWARDS-INCOMPATIBLE CHANGE. Users will |
|
1720 | 1735 | need to update their ipythonrc files and replace '%n' with '\D' in |
|
1721 | 1736 | their prompt_in2 settings everywhere. Sorry, but there's |
|
1722 | 1737 | otherwise no clean way to get all prompts to properly align. The |
|
1723 | 1738 | ipythonrc shipped with IPython has been updated. |
|
1724 | 1739 | |
|
1725 | 1740 | 2004-06-07 Fernando Perez <fperez@colorado.edu> |
|
1726 | 1741 | |
|
1727 | 1742 | * setup.py (isfile): Pass local_icons option to latex2html, so the |
|
1728 | 1743 | resulting HTML file is self-contained. Thanks to |
|
1729 | 1744 | dryice-AT-liu.com.cn for the tip. |
|
1730 | 1745 | |
|
1731 | 1746 | * pysh.py: I created a new profile 'shell', which implements a |
|
1732 | 1747 | _rudimentary_ IPython-based shell. This is in NO WAY a realy |
|
1733 | 1748 | system shell, nor will it become one anytime soon. It's mainly |
|
1734 | 1749 | meant to illustrate the use of the new flexible bash-like prompts. |
|
1735 | 1750 | I guess it could be used by hardy souls for true shell management, |
|
1736 | 1751 | but it's no tcsh/bash... pysh.py is loaded by the 'shell' |
|
1737 | 1752 | profile. This uses the InterpreterExec extension provided by |
|
1738 | 1753 | W.J. van der Laan <gnufnork-AT-hetdigitalegat.nl> |
|
1739 | 1754 | |
|
1740 | 1755 | * IPython/Prompts.py (PromptOut.__str__): now it will correctly |
|
1741 | 1756 | auto-align itself with the length of the previous input prompt |
|
1742 | 1757 | (taking into account the invisible color escapes). |
|
1743 | 1758 | (CachedOutput.__init__): Large restructuring of this class. Now |
|
1744 | 1759 | all three prompts (primary1, primary2, output) are proper objects, |
|
1745 | 1760 | managed by the 'parent' CachedOutput class. The code is still a |
|
1746 | 1761 | bit hackish (all prompts share state via a pointer to the cache), |
|
1747 | 1762 | but it's overall far cleaner than before. |
|
1748 | 1763 | |
|
1749 | 1764 | * IPython/genutils.py (getoutputerror): modified to add verbose, |
|
1750 | 1765 | debug and header options. This makes the interface of all getout* |
|
1751 | 1766 | functions uniform. |
|
1752 | 1767 | (SystemExec.getoutputerror): added getoutputerror to SystemExec. |
|
1753 | 1768 | |
|
1754 | 1769 | * IPython/Magic.py (Magic.default_option): added a function to |
|
1755 | 1770 | allow registering default options for any magic command. This |
|
1756 | 1771 | makes it easy to have profiles which customize the magics globally |
|
1757 | 1772 | for a certain use. The values set through this function are |
|
1758 | 1773 | picked up by the parse_options() method, which all magics should |
|
1759 | 1774 | use to parse their options. |
|
1760 | 1775 | |
|
1761 | 1776 | * IPython/genutils.py (warn): modified the warnings framework to |
|
1762 | 1777 | use the Term I/O class. I'm trying to slowly unify all of |
|
1763 | 1778 | IPython's I/O operations to pass through Term. |
|
1764 | 1779 | |
|
1765 | 1780 | * IPython/Prompts.py (Prompt2._str_other): Added functionality in |
|
1766 | 1781 | the secondary prompt to correctly match the length of the primary |
|
1767 | 1782 | one for any prompt. Now multi-line code will properly line up |
|
1768 | 1783 | even for path dependent prompts, such as the new ones available |
|
1769 | 1784 | via the prompt_specials. |
|
1770 | 1785 | |
|
1771 | 1786 | 2004-06-06 Fernando Perez <fperez@colorado.edu> |
|
1772 | 1787 | |
|
1773 | 1788 | * IPython/Prompts.py (prompt_specials): Added the ability to have |
|
1774 | 1789 | bash-like special sequences in the prompts, which get |
|
1775 | 1790 | automatically expanded. Things like hostname, current working |
|
1776 | 1791 | directory and username are implemented already, but it's easy to |
|
1777 | 1792 | add more in the future. Thanks to a patch by W.J. van der Laan |
|
1778 | 1793 | <gnufnork-AT-hetdigitalegat.nl> |
|
1779 | 1794 | (prompt_specials): Added color support for prompt strings, so |
|
1780 | 1795 | users can define arbitrary color setups for their prompts. |
|
1781 | 1796 | |
|
1782 | 1797 | 2004-06-05 Fernando Perez <fperez@colorado.edu> |
|
1783 | 1798 | |
|
1784 | 1799 | * IPython/genutils.py (Term.reopen_all): Added Windows-specific |
|
1785 | 1800 | code to load Gary Bishop's readline and configure it |
|
1786 | 1801 | automatically. Thanks to Gary for help on this. |
|
1787 | 1802 | |
|
1788 | 1803 | 2004-06-01 Fernando Perez <fperez@colorado.edu> |
|
1789 | 1804 | |
|
1790 | 1805 | * IPython/Logger.py (Logger.create_log): fix bug for logging |
|
1791 | 1806 | with no filename (previous fix was incomplete). |
|
1792 | 1807 | |
|
1793 | 1808 | 2004-05-25 Fernando Perez <fperez@colorado.edu> |
|
1794 | 1809 | |
|
1795 | 1810 | * IPython/Magic.py (Magic.parse_options): fix bug where naked |
|
1796 | 1811 | parens would get passed to the shell. |
|
1797 | 1812 | |
|
1798 | 1813 | 2004-05-20 Fernando Perez <fperez@colorado.edu> |
|
1799 | 1814 | |
|
1800 | 1815 | * IPython/Magic.py (Magic.magic_prun): changed default profile |
|
1801 | 1816 | sort order to 'time' (the more common profiling need). |
|
1802 | 1817 | |
|
1803 | 1818 | * IPython/OInspect.py (Inspector.pinfo): flush the inspect cache |
|
1804 | 1819 | so that source code shown is guaranteed in sync with the file on |
|
1805 | 1820 | disk (also changed in psource). Similar fix to the one for |
|
1806 | 1821 | ultraTB on 2004-05-06. Thanks to a bug report by Yann Le Du |
|
1807 | 1822 | <yann.ledu-AT-noos.fr>. |
|
1808 | 1823 | |
|
1809 | 1824 | * IPython/Magic.py (Magic.parse_options): Fixed bug where commands |
|
1810 | 1825 | with a single option would not be correctly parsed. Closes |
|
1811 | 1826 | http://www.scipy.net/roundup/ipython/issue14. This bug had been |
|
1812 | 1827 | introduced in 0.6.0 (on 2004-05-06). |
|
1813 | 1828 | |
|
1814 | 1829 | 2004-05-13 *** Released version 0.6.0 |
|
1815 | 1830 | |
|
1816 | 1831 | 2004-05-13 Fernando Perez <fperez@colorado.edu> |
|
1817 | 1832 | |
|
1818 | 1833 | * debian/: Added debian/ directory to CVS, so that debian support |
|
1819 | 1834 | is publicly accessible. The debian package is maintained by Jack |
|
1820 | 1835 | Moffit <jack-AT-xiph.org>. |
|
1821 | 1836 | |
|
1822 | 1837 | * Documentation: included the notes about an ipython-based system |
|
1823 | 1838 | shell (the hypothetical 'pysh') into the new_design.pdf document, |
|
1824 | 1839 | so that these ideas get distributed to users along with the |
|
1825 | 1840 | official documentation. |
|
1826 | 1841 | |
|
1827 | 1842 | 2004-05-10 Fernando Perez <fperez@colorado.edu> |
|
1828 | 1843 | |
|
1829 | 1844 | * IPython/Logger.py (Logger.create_log): fix recently introduced |
|
1830 | 1845 | bug (misindented line) where logstart would fail when not given an |
|
1831 | 1846 | explicit filename. |
|
1832 | 1847 | |
|
1833 | 1848 | 2004-05-09 Fernando Perez <fperez@colorado.edu> |
|
1834 | 1849 | |
|
1835 | 1850 | * IPython/Magic.py (Magic.parse_options): skip system call when |
|
1836 | 1851 | there are no options to look for. Faster, cleaner for the common |
|
1837 | 1852 | case. |
|
1838 | 1853 | |
|
1839 | 1854 | * Documentation: many updates to the manual: describing Windows |
|
1840 | 1855 | support better, Gnuplot updates, credits, misc small stuff. Also |
|
1841 | 1856 | updated the new_design doc a bit. |
|
1842 | 1857 | |
|
1843 | 1858 | 2004-05-06 *** Released version 0.6.0.rc1 |
|
1844 | 1859 | |
|
1845 | 1860 | 2004-05-06 Fernando Perez <fperez@colorado.edu> |
|
1846 | 1861 | |
|
1847 | 1862 | * IPython/ultraTB.py (ListTB.text): modified a ton of string += |
|
1848 | 1863 | operations to use the vastly more efficient list/''.join() method. |
|
1849 | 1864 | (FormattedTB.text): Fix |
|
1850 | 1865 | http://www.scipy.net/roundup/ipython/issue12 - exception source |
|
1851 | 1866 | extract not updated after reload. Thanks to Mike Salib |
|
1852 | 1867 | <msalib-AT-mit.edu> for pinning the source of the problem. |
|
1853 | 1868 | Fortunately, the solution works inside ipython and doesn't require |
|
1854 | 1869 | any changes to python proper. |
|
1855 | 1870 | |
|
1856 | 1871 | * IPython/Magic.py (Magic.parse_options): Improved to process the |
|
1857 | 1872 | argument list as a true shell would (by actually using the |
|
1858 | 1873 | underlying system shell). This way, all @magics automatically get |
|
1859 | 1874 | shell expansion for variables. Thanks to a comment by Alex |
|
1860 | 1875 | Schmolck. |
|
1861 | 1876 | |
|
1862 | 1877 | 2004-04-04 Fernando Perez <fperez@colorado.edu> |
|
1863 | 1878 | |
|
1864 | 1879 | * IPython/iplib.py (InteractiveShell.interact): Added a special |
|
1865 | 1880 | trap for a debugger quit exception, which is basically impossible |
|
1866 | 1881 | to handle by normal mechanisms, given what pdb does to the stack. |
|
1867 | 1882 | This fixes a crash reported by <fgibbons-AT-llama.med.harvard.edu>. |
|
1868 | 1883 | |
|
1869 | 1884 | 2004-04-03 Fernando Perez <fperez@colorado.edu> |
|
1870 | 1885 | |
|
1871 | 1886 | * IPython/genutils.py (Term): Standardized the names of the Term |
|
1872 | 1887 | class streams to cin/cout/cerr, following C++ naming conventions |
|
1873 | 1888 | (I can't use in/out/err because 'in' is not a valid attribute |
|
1874 | 1889 | name). |
|
1875 | 1890 | |
|
1876 | 1891 | * IPython/iplib.py (InteractiveShell.interact): don't increment |
|
1877 | 1892 | the prompt if there's no user input. By Daniel 'Dang' Griffith |
|
1878 | 1893 | <pythondev-dang-AT-lazytwinacres.net>, after a suggestion from |
|
1879 | 1894 | Francois Pinard. |
|
1880 | 1895 | |
|
1881 | 1896 | 2004-04-02 Fernando Perez <fperez@colorado.edu> |
|
1882 | 1897 | |
|
1883 | 1898 | * IPython/genutils.py (Stream.__init__): Modified to survive at |
|
1884 | 1899 | least importing in contexts where stdin/out/err aren't true file |
|
1885 | 1900 | objects, such as PyCrust (they lack fileno() and mode). However, |
|
1886 | 1901 | the recovery facilities which rely on these things existing will |
|
1887 | 1902 | not work. |
|
1888 | 1903 | |
|
1889 | 1904 | 2004-04-01 Fernando Perez <fperez@colorado.edu> |
|
1890 | 1905 | |
|
1891 | 1906 | * IPython/Magic.py (Magic.magic_sx): modified (as well as @sc) to |
|
1892 | 1907 | use the new getoutputerror() function, so it properly |
|
1893 | 1908 | distinguishes stdout/err. |
|
1894 | 1909 | |
|
1895 | 1910 | * IPython/genutils.py (getoutputerror): added a function to |
|
1896 | 1911 | capture separately the standard output and error of a command. |
|
1897 | 1912 | After a comment from dang on the mailing lists. This code is |
|
1898 | 1913 | basically a modified version of commands.getstatusoutput(), from |
|
1899 | 1914 | the standard library. |
|
1900 | 1915 | |
|
1901 | 1916 | * IPython/iplib.py (InteractiveShell.handle_shell_escape): added |
|
1902 | 1917 | '!!' as a special syntax (shorthand) to access @sx. |
|
1903 | 1918 | |
|
1904 | 1919 | * IPython/Magic.py (Magic.magic_sx): new magic, to execute a shell |
|
1905 | 1920 | command and return its output as a list split on '\n'. |
|
1906 | 1921 | |
|
1907 | 1922 | 2004-03-31 Fernando Perez <fperez@colorado.edu> |
|
1908 | 1923 | |
|
1909 | 1924 | * IPython/FakeModule.py (FakeModule.__init__): added __nonzero__ |
|
1910 | 1925 | method to dictionaries used as FakeModule instances if they lack |
|
1911 | 1926 | it. At least pydoc in python2.3 breaks for runtime-defined |
|
1912 | 1927 | functions without this hack. At some point I need to _really_ |
|
1913 | 1928 | understand what FakeModule is doing, because it's a gross hack. |
|
1914 | 1929 | But it solves Arnd's problem for now... |
|
1915 | 1930 | |
|
1916 | 1931 | 2004-02-27 Fernando Perez <fperez@colorado.edu> |
|
1917 | 1932 | |
|
1918 | 1933 | * IPython/Logger.py (Logger.create_log): Fix bug where 'rotate' |
|
1919 | 1934 | mode would behave erratically. Also increased the number of |
|
1920 | 1935 | possible logs in rotate mod to 999. Thanks to Rod Holland |
|
1921 | 1936 | <rhh@StructureLABS.com> for the report and fixes. |
|
1922 | 1937 | |
|
1923 | 1938 | 2004-02-26 Fernando Perez <fperez@colorado.edu> |
|
1924 | 1939 | |
|
1925 | 1940 | * IPython/genutils.py (page): Check that the curses module really |
|
1926 | 1941 | has the initscr attribute before trying to use it. For some |
|
1927 | 1942 | reason, the Solaris curses module is missing this. I think this |
|
1928 | 1943 | should be considered a Solaris python bug, but I'm not sure. |
|
1929 | 1944 | |
|
1930 | 1945 | 2004-01-17 Fernando Perez <fperez@colorado.edu> |
|
1931 | 1946 | |
|
1932 | 1947 | * IPython/genutils.py (Stream.__init__): Changes to try to make |
|
1933 | 1948 | ipython robust against stdin/out/err being closed by the user. |
|
1934 | 1949 | This is 'user error' (and blocks a normal python session, at least |
|
1935 | 1950 | the stdout case). However, Ipython should be able to survive such |
|
1936 | 1951 | instances of abuse as gracefully as possible. To simplify the |
|
1937 | 1952 | coding and maintain compatibility with Gary Bishop's Term |
|
1938 | 1953 | contributions, I've made use of classmethods for this. I think |
|
1939 | 1954 | this introduces a dependency on python 2.2. |
|
1940 | 1955 | |
|
1941 | 1956 | 2004-01-13 Fernando Perez <fperez@colorado.edu> |
|
1942 | 1957 | |
|
1943 | 1958 | * IPython/numutils.py (exp_safe): simplified the code a bit and |
|
1944 | 1959 | removed the need for importing the kinds module altogether. |
|
1945 | 1960 | |
|
1946 | 1961 | 2004-01-06 Fernando Perez <fperez@colorado.edu> |
|
1947 | 1962 | |
|
1948 | 1963 | * IPython/Magic.py (Magic.magic_sc): Made the shell capture system |
|
1949 | 1964 | a magic function instead, after some community feedback. No |
|
1950 | 1965 | special syntax will exist for it, but its name is deliberately |
|
1951 | 1966 | very short. |
|
1952 | 1967 | |
|
1953 | 1968 | 2003-12-20 Fernando Perez <fperez@colorado.edu> |
|
1954 | 1969 | |
|
1955 | 1970 | * IPython/iplib.py (InteractiveShell.handle_shell_assign): Added |
|
1956 | 1971 | new functionality, to automagically assign the result of a shell |
|
1957 | 1972 | command to a variable. I'll solicit some community feedback on |
|
1958 | 1973 | this before making it permanent. |
|
1959 | 1974 | |
|
1960 | 1975 | * IPython/OInspect.py (Inspector.pinfo): Fix crash when info was |
|
1961 | 1976 | requested about callables for which inspect couldn't obtain a |
|
1962 | 1977 | proper argspec. Thanks to a crash report sent by Etienne |
|
1963 | 1978 | Posthumus <etienne-AT-apple01.cs.vu.nl>. |
|
1964 | 1979 | |
|
1965 | 1980 | 2003-12-09 Fernando Perez <fperez@colorado.edu> |
|
1966 | 1981 | |
|
1967 | 1982 | * IPython/genutils.py (page): patch for the pager to work across |
|
1968 | 1983 | various versions of Windows. By Gary Bishop. |
|
1969 | 1984 | |
|
1970 | 1985 | 2003-12-04 Fernando Perez <fperez@colorado.edu> |
|
1971 | 1986 | |
|
1972 | 1987 | * IPython/Gnuplot2.py (PlotItems): Fixes for working with |
|
1973 | 1988 | Gnuplot.py version 1.7, whose internal names changed quite a bit. |
|
1974 | 1989 | While I tested this and it looks ok, there may still be corner |
|
1975 | 1990 | cases I've missed. |
|
1976 | 1991 | |
|
1977 | 1992 | 2003-12-01 Fernando Perez <fperez@colorado.edu> |
|
1978 | 1993 | |
|
1979 | 1994 | * IPython/iplib.py (InteractiveShell._prefilter): Fixed a bug |
|
1980 | 1995 | where a line like 'p,q=1,2' would fail because the automagic |
|
1981 | 1996 | system would be triggered for @p. |
|
1982 | 1997 | |
|
1983 | 1998 | * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): Tab-related |
|
1984 | 1999 | cleanups, code unmodified. |
|
1985 | 2000 | |
|
1986 | 2001 | * IPython/genutils.py (Term): added a class for IPython to handle |
|
1987 | 2002 | output. In most cases it will just be a proxy for stdout/err, but |
|
1988 | 2003 | having this allows modifications to be made for some platforms, |
|
1989 | 2004 | such as handling color escapes under Windows. All of this code |
|
1990 | 2005 | was contributed by Gary Bishop, with minor modifications by me. |
|
1991 | 2006 | The actual changes affect many files. |
|
1992 | 2007 | |
|
1993 | 2008 | 2003-11-30 Fernando Perez <fperez@colorado.edu> |
|
1994 | 2009 | |
|
1995 | 2010 | * IPython/iplib.py (file_matches): new completion code, courtesy |
|
1996 | 2011 | of Jeff Collins. This enables filename completion again under |
|
1997 | 2012 | python 2.3, which disabled it at the C level. |
|
1998 | 2013 | |
|
1999 | 2014 | 2003-11-11 Fernando Perez <fperez@colorado.edu> |
|
2000 | 2015 | |
|
2001 | 2016 | * IPython/numutils.py (amap): Added amap() fn. Simple shorthand |
|
2002 | 2017 | for Numeric.array(map(...)), but often convenient. |
|
2003 | 2018 | |
|
2004 | 2019 | 2003-11-05 Fernando Perez <fperez@colorado.edu> |
|
2005 | 2020 | |
|
2006 | 2021 | * IPython/numutils.py (frange): Changed a call from int() to |
|
2007 | 2022 | int(round()) to prevent a problem reported with arange() in the |
|
2008 | 2023 | numpy list. |
|
2009 | 2024 | |
|
2010 | 2025 | 2003-10-06 Fernando Perez <fperez@colorado.edu> |
|
2011 | 2026 | |
|
2012 | 2027 | * IPython/DPyGetOpt.py (DPyGetOpt.processArguments): changed to |
|
2013 | 2028 | prevent crashes if sys lacks an argv attribute (it happens with |
|
2014 | 2029 | embedded interpreters which build a bare-bones sys module). |
|
2015 | 2030 | Thanks to a report/bugfix by Adam Hupp <hupp-AT-cs.wisc.edu>. |
|
2016 | 2031 | |
|
2017 | 2032 | 2003-09-24 Fernando Perez <fperez@colorado.edu> |
|
2018 | 2033 | |
|
2019 | 2034 | * IPython/Magic.py (Magic._ofind): blanket except around getattr() |
|
2020 | 2035 | to protect against poorly written user objects where __getattr__ |
|
2021 | 2036 | raises exceptions other than AttributeError. Thanks to a bug |
|
2022 | 2037 | report by Oliver Sander <osander-AT-gmx.de>. |
|
2023 | 2038 | |
|
2024 | 2039 | * IPython/FakeModule.py (FakeModule.__repr__): this method was |
|
2025 | 2040 | missing. Thanks to bug report by Ralf Schmitt <ralf-AT-brainbot.com>. |
|
2026 | 2041 | |
|
2027 | 2042 | 2003-09-09 Fernando Perez <fperez@colorado.edu> |
|
2028 | 2043 | |
|
2029 | 2044 | * IPython/iplib.py (InteractiveShell._prefilter): fix bug where |
|
2030 | 2045 | unpacking a list whith a callable as first element would |
|
2031 | 2046 | mistakenly trigger autocalling. Thanks to a bug report by Jeffery |
|
2032 | 2047 | Collins. |
|
2033 | 2048 | |
|
2034 | 2049 | 2003-08-25 *** Released version 0.5.0 |
|
2035 | 2050 | |
|
2036 | 2051 | 2003-08-22 Fernando Perez <fperez@colorado.edu> |
|
2037 | 2052 | |
|
2038 | 2053 | * IPython/ultraTB.py (VerboseTB.linereader): Improved handling of |
|
2039 | 2054 | improperly defined user exceptions. Thanks to feedback from Mark |
|
2040 | 2055 | Russell <mrussell-AT-verio.net>. |
|
2041 | 2056 | |
|
2042 | 2057 | 2003-08-20 Fernando Perez <fperez@colorado.edu> |
|
2043 | 2058 | |
|
2044 | 2059 | * IPython/OInspect.py (Inspector.pinfo): changed String Form |
|
2045 | 2060 | printing so that it would print multi-line string forms starting |
|
2046 | 2061 | with a new line. This way the formatting is better respected for |
|
2047 | 2062 | objects which work hard to make nice string forms. |
|
2048 | 2063 | |
|
2049 | 2064 | * IPython/iplib.py (InteractiveShell.handle_auto): Fix bug where |
|
2050 | 2065 | autocall would overtake data access for objects with both |
|
2051 | 2066 | __getitem__ and __call__. |
|
2052 | 2067 | |
|
2053 | 2068 | 2003-08-19 *** Released version 0.5.0-rc1 |
|
2054 | 2069 | |
|
2055 | 2070 | 2003-08-19 Fernando Perez <fperez@colorado.edu> |
|
2056 | 2071 | |
|
2057 | 2072 | * IPython/deep_reload.py (load_tail): single tiny change here |
|
2058 | 2073 | seems to fix the long-standing bug of dreload() failing to work |
|
2059 | 2074 | for dotted names. But this module is pretty tricky, so I may have |
|
2060 | 2075 | missed some subtlety. Needs more testing!. |
|
2061 | 2076 | |
|
2062 | 2077 | * IPython/ultraTB.py (VerboseTB.linereader): harden against user |
|
2063 | 2078 | exceptions which have badly implemented __str__ methods. |
|
2064 | 2079 | (VerboseTB.text): harden against inspect.getinnerframes crashing, |
|
2065 | 2080 | which I've been getting reports about from Python 2.3 users. I |
|
2066 | 2081 | wish I had a simple test case to reproduce the problem, so I could |
|
2067 | 2082 | either write a cleaner workaround or file a bug report if |
|
2068 | 2083 | necessary. |
|
2069 | 2084 | |
|
2070 | 2085 | * IPython/Magic.py (Magic.magic_edit): fixed bug where after |
|
2071 | 2086 | making a class 'foo', file 'foo.py' couldn't be edited. Thanks to |
|
2072 | 2087 | a bug report by Tjabo Kloppenburg. |
|
2073 | 2088 | |
|
2074 | 2089 | * IPython/ultraTB.py (VerboseTB.debugger): hardened against pdb |
|
2075 | 2090 | crashes. Wrapped the pdb call in a blanket try/except, since pdb |
|
2076 | 2091 | seems rather unstable. Thanks to a bug report by Tjabo |
|
2077 | 2092 | Kloppenburg <tjabo.kloppenburg-AT-unix-ag.uni-siegen.de>. |
|
2078 | 2093 | |
|
2079 | 2094 | * IPython/Release.py (version): release 0.5.0-rc1. I want to put |
|
2080 | 2095 | this out soon because of the critical fixes in the inner loop for |
|
2081 | 2096 | generators. |
|
2082 | 2097 | |
|
2083 | 2098 | * IPython/Magic.py (Magic.getargspec): removed. This (and |
|
2084 | 2099 | _get_def) have been obsoleted by OInspect for a long time, I |
|
2085 | 2100 | hadn't noticed that they were dead code. |
|
2086 | 2101 | (Magic._ofind): restored _ofind functionality for a few literals |
|
2087 | 2102 | (those in ["''",'""','[]','{}','()']). But it won't work anymore |
|
2088 | 2103 | for things like "hello".capitalize?, since that would require a |
|
2089 | 2104 | potentially dangerous eval() again. |
|
2090 | 2105 | |
|
2091 | 2106 | * IPython/iplib.py (InteractiveShell._prefilter): reorganized the |
|
2092 | 2107 | logic a bit more to clean up the escapes handling and minimize the |
|
2093 | 2108 | use of _ofind to only necessary cases. The interactive 'feel' of |
|
2094 | 2109 | IPython should have improved quite a bit with the changes in |
|
2095 | 2110 | _prefilter and _ofind (besides being far safer than before). |
|
2096 | 2111 | |
|
2097 | 2112 | * IPython/Magic.py (Magic.magic_edit): Fixed old bug (but rather |
|
2098 | 2113 | obscure, never reported). Edit would fail to find the object to |
|
2099 | 2114 | edit under some circumstances. |
|
2100 | 2115 | (Magic._ofind): CRITICAL FIX. Finally removed the eval() calls |
|
2101 | 2116 | which were causing double-calling of generators. Those eval calls |
|
2102 | 2117 | were _very_ dangerous, since code with side effects could be |
|
2103 | 2118 | triggered. As they say, 'eval is evil'... These were the |
|
2104 | 2119 | nastiest evals in IPython. Besides, _ofind is now far simpler, |
|
2105 | 2120 | and it should also be quite a bit faster. Its use of inspect is |
|
2106 | 2121 | also safer, so perhaps some of the inspect-related crashes I've |
|
2107 | 2122 | seen lately with Python 2.3 might be taken care of. That will |
|
2108 | 2123 | need more testing. |
|
2109 | 2124 | |
|
2110 | 2125 | 2003-08-17 Fernando Perez <fperez@colorado.edu> |
|
2111 | 2126 | |
|
2112 | 2127 | * IPython/iplib.py (InteractiveShell._prefilter): significant |
|
2113 | 2128 | simplifications to the logic for handling user escapes. Faster |
|
2114 | 2129 | and simpler code. |
|
2115 | 2130 | |
|
2116 | 2131 | 2003-08-14 Fernando Perez <fperez@colorado.edu> |
|
2117 | 2132 | |
|
2118 | 2133 | * IPython/numutils.py (sum_flat): rewrote to be non-recursive. |
|
2119 | 2134 | Now it requires O(N) storage (N=size(a)) for non-contiguous input, |
|
2120 | 2135 | but it should be quite a bit faster. And the recursive version |
|
2121 | 2136 | generated O(log N) intermediate storage for all rank>1 arrays, |
|
2122 | 2137 | even if they were contiguous. |
|
2123 | 2138 | (l1norm): Added this function. |
|
2124 | 2139 | (norm): Added this function for arbitrary norms (including |
|
2125 | 2140 | l-infinity). l1 and l2 are still special cases for convenience |
|
2126 | 2141 | and speed. |
|
2127 | 2142 | |
|
2128 | 2143 | 2003-08-03 Fernando Perez <fperez@colorado.edu> |
|
2129 | 2144 | |
|
2130 | 2145 | * IPython/Magic.py (Magic.magic_edit): Removed all remaining string |
|
2131 | 2146 | exceptions, which now raise PendingDeprecationWarnings in Python |
|
2132 | 2147 | 2.3. There were some in Magic and some in Gnuplot2. |
|
2133 | 2148 | |
|
2134 | 2149 | 2003-06-30 Fernando Perez <fperez@colorado.edu> |
|
2135 | 2150 | |
|
2136 | 2151 | * IPython/genutils.py (page): modified to call curses only for |
|
2137 | 2152 | terminals where TERM=='xterm'. After problems under many other |
|
2138 | 2153 | terminals were reported by Keith Beattie <KSBeattie-AT-lbl.gov>. |
|
2139 | 2154 | |
|
2140 | 2155 | * IPython/iplib.py (complete): removed spurious 'print "IE"' which |
|
2141 | 2156 | would be triggered when readline was absent. This was just an old |
|
2142 | 2157 | debugging statement I'd forgotten to take out. |
|
2143 | 2158 | |
|
2144 | 2159 | 2003-06-20 Fernando Perez <fperez@colorado.edu> |
|
2145 | 2160 | |
|
2146 | 2161 | * IPython/genutils.py (clock): modified to return only user time |
|
2147 | 2162 | (not counting system time), after a discussion on scipy. While |
|
2148 | 2163 | system time may be a useful quantity occasionally, it may much |
|
2149 | 2164 | more easily be skewed by occasional swapping or other similar |
|
2150 | 2165 | activity. |
|
2151 | 2166 | |
|
2152 | 2167 | 2003-06-05 Fernando Perez <fperez@colorado.edu> |
|
2153 | 2168 | |
|
2154 | 2169 | * IPython/numutils.py (identity): new function, for building |
|
2155 | 2170 | arbitrary rank Kronecker deltas (mostly backwards compatible with |
|
2156 | 2171 | Numeric.identity) |
|
2157 | 2172 | |
|
2158 | 2173 | 2003-06-03 Fernando Perez <fperez@colorado.edu> |
|
2159 | 2174 | |
|
2160 | 2175 | * IPython/iplib.py (InteractiveShell.handle_magic): protect |
|
2161 | 2176 | arguments passed to magics with spaces, to allow trailing '\' to |
|
2162 | 2177 | work normally (mainly for Windows users). |
|
2163 | 2178 | |
|
2164 | 2179 | 2003-05-29 Fernando Perez <fperez@colorado.edu> |
|
2165 | 2180 | |
|
2166 | 2181 | * IPython/ipmaker.py (make_IPython): Load site._Helper() as help |
|
2167 | 2182 | instead of pydoc.help. This fixes a bizarre behavior where |
|
2168 | 2183 | printing '%s' % locals() would trigger the help system. Now |
|
2169 | 2184 | ipython behaves like normal python does. |
|
2170 | 2185 | |
|
2171 | 2186 | Note that if one does 'from pydoc import help', the bizarre |
|
2172 | 2187 | behavior returns, but this will also happen in normal python, so |
|
2173 | 2188 | it's not an ipython bug anymore (it has to do with how pydoc.help |
|
2174 | 2189 | is implemented). |
|
2175 | 2190 | |
|
2176 | 2191 | 2003-05-22 Fernando Perez <fperez@colorado.edu> |
|
2177 | 2192 | |
|
2178 | 2193 | * IPython/FlexCompleter.py (Completer.attr_matches): fixed to |
|
2179 | 2194 | return [] instead of None when nothing matches, also match to end |
|
2180 | 2195 | of line. Patch by Gary Bishop. |
|
2181 | 2196 | |
|
2182 | 2197 | * IPython/ipmaker.py (make_IPython): Added same sys.excepthook |
|
2183 | 2198 | protection as before, for files passed on the command line. This |
|
2184 | 2199 | prevents the CrashHandler from kicking in if user files call into |
|
2185 | 2200 | sys.excepthook (such as PyQt and WxWindows have a nasty habit of |
|
2186 | 2201 | doing). After a report by Kasper Souren <Kasper.Souren-AT-ircam.fr> |
|
2187 | 2202 | |
|
2188 | 2203 | 2003-05-20 *** Released version 0.4.0 |
|
2189 | 2204 | |
|
2190 | 2205 | 2003-05-20 Fernando Perez <fperez@colorado.edu> |
|
2191 | 2206 | |
|
2192 | 2207 | * setup.py: added support for manpages. It's a bit hackish b/c of |
|
2193 | 2208 | a bug in the way the bdist_rpm distutils target handles gzipped |
|
2194 | 2209 | manpages, but it works. After a patch by Jack. |
|
2195 | 2210 | |
|
2196 | 2211 | 2003-05-19 Fernando Perez <fperez@colorado.edu> |
|
2197 | 2212 | |
|
2198 | 2213 | * IPython/numutils.py: added a mockup of the kinds module, since |
|
2199 | 2214 | it was recently removed from Numeric. This way, numutils will |
|
2200 | 2215 | work for all users even if they are missing kinds. |
|
2201 | 2216 | |
|
2202 | 2217 | * IPython/Magic.py (Magic._ofind): Harden against an inspect |
|
2203 | 2218 | failure, which can occur with SWIG-wrapped extensions. After a |
|
2204 | 2219 | crash report from Prabhu. |
|
2205 | 2220 | |
|
2206 | 2221 | 2003-05-16 Fernando Perez <fperez@colorado.edu> |
|
2207 | 2222 | |
|
2208 | 2223 | * IPython/iplib.py (InteractiveShell.excepthook): New method to |
|
2209 | 2224 | protect ipython from user code which may call directly |
|
2210 | 2225 | sys.excepthook (this looks like an ipython crash to the user, even |
|
2211 | 2226 | when it isn't). After a patch by Gary Bishop <gb-AT-cs.unc.edu>. |
|
2212 | 2227 | This is especially important to help users of WxWindows, but may |
|
2213 | 2228 | also be useful in other cases. |
|
2214 | 2229 | |
|
2215 | 2230 | * IPython/ultraTB.py (AutoFormattedTB.__call__): Changed to allow |
|
2216 | 2231 | an optional tb_offset to be specified, and to preserve exception |
|
2217 | 2232 | info if given. After a patch by Gary Bishop <gb-AT-cs.unc.edu>. |
|
2218 | 2233 | |
|
2219 | 2234 | * ipython.1 (Default): Thanks to Jack's work, we now have manpages! |
|
2220 | 2235 | |
|
2221 | 2236 | 2003-05-15 Fernando Perez <fperez@colorado.edu> |
|
2222 | 2237 | |
|
2223 | 2238 | * IPython/iplib.py (InteractiveShell.user_setup): Fix crash when |
|
2224 | 2239 | installing for a new user under Windows. |
|
2225 | 2240 | |
|
2226 | 2241 | 2003-05-12 Fernando Perez <fperez@colorado.edu> |
|
2227 | 2242 | |
|
2228 | 2243 | * IPython/iplib.py (InteractiveShell.handle_emacs): New line |
|
2229 | 2244 | handler for Emacs comint-based lines. Currently it doesn't do |
|
2230 | 2245 | much (but importantly, it doesn't update the history cache). In |
|
2231 | 2246 | the future it may be expanded if Alex needs more functionality |
|
2232 | 2247 | there. |
|
2233 | 2248 | |
|
2234 | 2249 | * IPython/CrashHandler.py (CrashHandler.__call__): Added platform |
|
2235 | 2250 | info to crash reports. |
|
2236 | 2251 | |
|
2237 | 2252 | * IPython/iplib.py (InteractiveShell.mainloop): Added -c option, |
|
2238 | 2253 | just like Python's -c. Also fixed crash with invalid -color |
|
2239 | 2254 | option value at startup. Thanks to Will French |
|
2240 | 2255 | <wfrench-AT-bestweb.net> for the bug report. |
|
2241 | 2256 | |
|
2242 | 2257 | 2003-05-09 Fernando Perez <fperez@colorado.edu> |
|
2243 | 2258 | |
|
2244 | 2259 | * IPython/genutils.py (EvalDict.__getitem__): Renamed EvalString |
|
2245 | 2260 | to EvalDict (it's a mapping, after all) and simplified its code |
|
2246 | 2261 | quite a bit, after a nice discussion on c.l.py where Gustavo |
|
2247 | 2262 | Córdova <gcordova-AT-sismex.com> suggested the new version. |
|
2248 | 2263 | |
|
2249 | 2264 | 2003-04-30 Fernando Perez <fperez@colorado.edu> |
|
2250 | 2265 | |
|
2251 | 2266 | * IPython/genutils.py (timings_out): modified it to reduce its |
|
2252 | 2267 | overhead in the common reps==1 case. |
|
2253 | 2268 | |
|
2254 | 2269 | 2003-04-29 Fernando Perez <fperez@colorado.edu> |
|
2255 | 2270 | |
|
2256 | 2271 | * IPython/genutils.py (timings_out): Modified to use the resource |
|
2257 | 2272 | module, which avoids the wraparound problems of time.clock(). |
|
2258 | 2273 | |
|
2259 | 2274 | 2003-04-17 *** Released version 0.2.15pre4 |
|
2260 | 2275 | |
|
2261 | 2276 | 2003-04-17 Fernando Perez <fperez@colorado.edu> |
|
2262 | 2277 | |
|
2263 | 2278 | * setup.py (scriptfiles): Split windows-specific stuff over to a |
|
2264 | 2279 | separate file, in an attempt to have a Windows GUI installer. |
|
2265 | 2280 | That didn't work, but part of the groundwork is done. |
|
2266 | 2281 | |
|
2267 | 2282 | * IPython/UserConfig/ipythonrc: Added M-i, M-o and M-I for |
|
2268 | 2283 | indent/unindent with 4 spaces. Particularly useful in combination |
|
2269 | 2284 | with the new auto-indent option. |
|
2270 | 2285 | |
|
2271 | 2286 | 2003-04-16 Fernando Perez <fperez@colorado.edu> |
|
2272 | 2287 | |
|
2273 | 2288 | * IPython/Magic.py: various replacements of self.rc for |
|
2274 | 2289 | self.shell.rc. A lot more remains to be done to fully disentangle |
|
2275 | 2290 | this class from the main Shell class. |
|
2276 | 2291 | |
|
2277 | 2292 | * IPython/GnuplotRuntime.py: added checks for mouse support so |
|
2278 | 2293 | that we don't try to enable it if the current gnuplot doesn't |
|
2279 | 2294 | really support it. Also added checks so that we don't try to |
|
2280 | 2295 | enable persist under Windows (where Gnuplot doesn't recognize the |
|
2281 | 2296 | option). |
|
2282 | 2297 | |
|
2283 | 2298 | * IPython/iplib.py (InteractiveShell.interact): Added optional |
|
2284 | 2299 | auto-indenting code, after a patch by King C. Shu |
|
2285 | 2300 | <kingshu-AT-myrealbox.com>. It's off by default because it doesn't |
|
2286 | 2301 | get along well with pasting indented code. If I ever figure out |
|
2287 | 2302 | how to make that part go well, it will become on by default. |
|
2288 | 2303 | |
|
2289 | 2304 | * IPython/Prompts.py (Prompt1.auto_rewrite): Fixed bug which would |
|
2290 | 2305 | crash ipython if there was an unmatched '%' in the user's prompt |
|
2291 | 2306 | string. Reported by Thorsten Kampe <thorsten-AT-thorstenkampe.de>. |
|
2292 | 2307 | |
|
2293 | 2308 | * IPython/iplib.py (InteractiveShell.interact): removed the |
|
2294 | 2309 | ability to ask the user whether he wants to crash or not at the |
|
2295 | 2310 | 'last line' exception handler. Calling functions at that point |
|
2296 | 2311 | changes the stack, and the error reports would have incorrect |
|
2297 | 2312 | tracebacks. |
|
2298 | 2313 | |
|
2299 | 2314 | * IPython/Magic.py (Magic.magic_page): Added new @page magic, to |
|
2300 | 2315 | pass through a peger a pretty-printed form of any object. After a |
|
2301 | 2316 | contribution by Olivier Aubert <oaubert-AT-bat710.univ-lyon1.fr> |
|
2302 | 2317 | |
|
2303 | 2318 | 2003-04-14 Fernando Perez <fperez@colorado.edu> |
|
2304 | 2319 | |
|
2305 | 2320 | * IPython/iplib.py (InteractiveShell.user_setup): Fixed bug where |
|
2306 | 2321 | all files in ~ would be modified at first install (instead of |
|
2307 | 2322 | ~/.ipython). This could be potentially disastrous, as the |
|
2308 | 2323 | modification (make line-endings native) could damage binary files. |
|
2309 | 2324 | |
|
2310 | 2325 | 2003-04-10 Fernando Perez <fperez@colorado.edu> |
|
2311 | 2326 | |
|
2312 | 2327 | * IPython/iplib.py (InteractiveShell.handle_help): Modified to |
|
2313 | 2328 | handle only lines which are invalid python. This now means that |
|
2314 | 2329 | lines like 'x=1 #?' execute properly. Thanks to Jeffery Collins |
|
2315 | 2330 | for the bug report. |
|
2316 | 2331 | |
|
2317 | 2332 | 2003-04-01 Fernando Perez <fperez@colorado.edu> |
|
2318 | 2333 | |
|
2319 | 2334 | * IPython/iplib.py (InteractiveShell.showtraceback): Fixed bug |
|
2320 | 2335 | where failing to set sys.last_traceback would crash pdb.pm(). |
|
2321 | 2336 | Thanks to Jeffery D. Collins <Jeff.Collins-AT-vexcel.com> for the bug |
|
2322 | 2337 | report. |
|
2323 | 2338 | |
|
2324 | 2339 | 2003-03-25 Fernando Perez <fperez@colorado.edu> |
|
2325 | 2340 | |
|
2326 | 2341 | * IPython/Magic.py (Magic.magic_prun): rstrip() output of profiler |
|
2327 | 2342 | before printing it (it had a lot of spurious blank lines at the |
|
2328 | 2343 | end). |
|
2329 | 2344 | |
|
2330 | 2345 | * IPython/Gnuplot2.py (Gnuplot.hardcopy): fixed bug where lpr |
|
2331 | 2346 | output would be sent 21 times! Obviously people don't use this |
|
2332 | 2347 | too often, or I would have heard about it. |
|
2333 | 2348 | |
|
2334 | 2349 | 2003-03-24 Fernando Perez <fperez@colorado.edu> |
|
2335 | 2350 | |
|
2336 | 2351 | * setup.py (scriptfiles): renamed the data_files parameter from |
|
2337 | 2352 | 'base' to 'data' to fix rpm build issues. Thanks to Ralf Ahlbrink |
|
2338 | 2353 | for the patch. |
|
2339 | 2354 | |
|
2340 | 2355 | 2003-03-20 Fernando Perez <fperez@colorado.edu> |
|
2341 | 2356 | |
|
2342 | 2357 | * IPython/genutils.py (error): added error() and fatal() |
|
2343 | 2358 | functions. |
|
2344 | 2359 | |
|
2345 | 2360 | 2003-03-18 *** Released version 0.2.15pre3 |
|
2346 | 2361 | |
|
2347 | 2362 | 2003-03-18 Fernando Perez <fperez@colorado.edu> |
|
2348 | 2363 | |
|
2349 | 2364 | * setupext/install_data_ext.py |
|
2350 | 2365 | (install_data_ext.initialize_options): Class contributed by Jack |
|
2351 | 2366 | Moffit for fixing the old distutils hack. He is sending this to |
|
2352 | 2367 | the distutils folks so in the future we may not need it as a |
|
2353 | 2368 | private fix. |
|
2354 | 2369 | |
|
2355 | 2370 | * MANIFEST.in: Extensive reorganization, based on Jack Moffit's |
|
2356 | 2371 | changes for Debian packaging. See his patch for full details. |
|
2357 | 2372 | The old distutils hack of making the ipythonrc* files carry a |
|
2358 | 2373 | bogus .py extension is gone, at last. Examples were moved to a |
|
2359 | 2374 | separate subdir under doc/, and the separate executable scripts |
|
2360 | 2375 | now live in their own directory. Overall a great cleanup. The |
|
2361 | 2376 | manual was updated to use the new files, and setup.py has been |
|
2362 | 2377 | fixed for this setup. |
|
2363 | 2378 | |
|
2364 | 2379 | * IPython/PyColorize.py (Parser.usage): made non-executable and |
|
2365 | 2380 | created a pycolor wrapper around it to be included as a script. |
|
2366 | 2381 | |
|
2367 | 2382 | 2003-03-12 *** Released version 0.2.15pre2 |
|
2368 | 2383 | |
|
2369 | 2384 | 2003-03-12 Fernando Perez <fperez@colorado.edu> |
|
2370 | 2385 | |
|
2371 | 2386 | * IPython/ColorANSI.py (make_color_table): Finally fixed the |
|
2372 | 2387 | long-standing problem with garbage characters in some terminals. |
|
2373 | 2388 | The issue was really that the \001 and \002 escapes must _only_ be |
|
2374 | 2389 | passed to input prompts (which call readline), but _never_ to |
|
2375 | 2390 | normal text to be printed on screen. I changed ColorANSI to have |
|
2376 | 2391 | two classes: TermColors and InputTermColors, each with the |
|
2377 | 2392 | appropriate escapes for input prompts or normal text. The code in |
|
2378 | 2393 | Prompts.py got slightly more complicated, but this very old and |
|
2379 | 2394 | annoying bug is finally fixed. |
|
2380 | 2395 | |
|
2381 | 2396 | All the credit for nailing down the real origin of this problem |
|
2382 | 2397 | and the correct solution goes to Jack Moffit <jack-AT-xiph.org>. |
|
2383 | 2398 | *Many* thanks to him for spending quite a bit of effort on this. |
|
2384 | 2399 | |
|
2385 | 2400 | 2003-03-05 *** Released version 0.2.15pre1 |
|
2386 | 2401 | |
|
2387 | 2402 | 2003-03-03 Fernando Perez <fperez@colorado.edu> |
|
2388 | 2403 | |
|
2389 | 2404 | * IPython/FakeModule.py: Moved the former _FakeModule to a |
|
2390 | 2405 | separate file, because it's also needed by Magic (to fix a similar |
|
2391 | 2406 | pickle-related issue in @run). |
|
2392 | 2407 | |
|
2393 | 2408 | 2003-03-02 Fernando Perez <fperez@colorado.edu> |
|
2394 | 2409 | |
|
2395 | 2410 | * IPython/Magic.py (Magic.magic_autocall): new magic to control |
|
2396 | 2411 | the autocall option at runtime. |
|
2397 | 2412 | (Magic.magic_dhist): changed self.user_ns to self.shell.user_ns |
|
2398 | 2413 | across Magic.py to start separating Magic from InteractiveShell. |
|
2399 | 2414 | (Magic._ofind): Fixed to return proper namespace for dotted |
|
2400 | 2415 | names. Before, a dotted name would always return 'not currently |
|
2401 | 2416 | defined', because it would find the 'parent'. s.x would be found, |
|
2402 | 2417 | but since 'x' isn't defined by itself, it would get confused. |
|
2403 | 2418 | (Magic.magic_run): Fixed pickling problems reported by Ralf |
|
2404 | 2419 | Ahlbrink <RAhlbrink-AT-RosenInspection.net>. The fix was similar to |
|
2405 | 2420 | that I'd used when Mike Heeter reported similar issues at the |
|
2406 | 2421 | top-level, but now for @run. It boils down to injecting the |
|
2407 | 2422 | namespace where code is being executed with something that looks |
|
2408 | 2423 | enough like a module to fool pickle.dump(). Since a pickle stores |
|
2409 | 2424 | a named reference to the importing module, we need this for |
|
2410 | 2425 | pickles to save something sensible. |
|
2411 | 2426 | |
|
2412 | 2427 | * IPython/ipmaker.py (make_IPython): added an autocall option. |
|
2413 | 2428 | |
|
2414 | 2429 | * IPython/iplib.py (InteractiveShell._prefilter): reordered all of |
|
2415 | 2430 | the auto-eval code. Now autocalling is an option, and the code is |
|
2416 | 2431 | also vastly safer. There is no more eval() involved at all. |
|
2417 | 2432 | |
|
2418 | 2433 | 2003-03-01 Fernando Perez <fperez@colorado.edu> |
|
2419 | 2434 | |
|
2420 | 2435 | * IPython/Magic.py (Magic._ofind): Changed interface to return a |
|
2421 | 2436 | dict with named keys instead of a tuple. |
|
2422 | 2437 | |
|
2423 | 2438 | * IPython: Started using CVS for IPython as of 0.2.15pre1. |
|
2424 | 2439 | |
|
2425 | 2440 | * setup.py (make_shortcut): Fixed message about directories |
|
2426 | 2441 | created during Windows installation (the directories were ok, just |
|
2427 | 2442 | the printed message was misleading). Thanks to Chris Liechti |
|
2428 | 2443 | <cliechti-AT-gmx.net> for the heads up. |
|
2429 | 2444 | |
|
2430 | 2445 | 2003-02-21 Fernando Perez <fperez@colorado.edu> |
|
2431 | 2446 | |
|
2432 | 2447 | * IPython/iplib.py (InteractiveShell._prefilter): Fixed catching |
|
2433 | 2448 | of ValueError exception when checking for auto-execution. This |
|
2434 | 2449 | one is raised by things like Numeric arrays arr.flat when the |
|
2435 | 2450 | array is non-contiguous. |
|
2436 | 2451 | |
|
2437 | 2452 | 2003-01-31 Fernando Perez <fperez@colorado.edu> |
|
2438 | 2453 | |
|
2439 | 2454 | * IPython/genutils.py (SystemExec.bq): Fixed bug where bq would |
|
2440 | 2455 | not return any value at all (even though the command would get |
|
2441 | 2456 | executed). |
|
2442 | 2457 | (xsys): Flush stdout right after printing the command to ensure |
|
2443 | 2458 | proper ordering of commands and command output in the total |
|
2444 | 2459 | output. |
|
2445 | 2460 | (SystemExec/xsys/bq): Switched the names of xsys/bq and |
|
2446 | 2461 | system/getoutput as defaults. The old ones are kept for |
|
2447 | 2462 | compatibility reasons, so no code which uses this library needs |
|
2448 | 2463 | changing. |
|
2449 | 2464 | |
|
2450 | 2465 | 2003-01-27 *** Released version 0.2.14 |
|
2451 | 2466 | |
|
2452 | 2467 | 2003-01-25 Fernando Perez <fperez@colorado.edu> |
|
2453 | 2468 | |
|
2454 | 2469 | * IPython/Magic.py (Magic.magic_edit): Fixed problem where |
|
2455 | 2470 | functions defined in previous edit sessions could not be re-edited |
|
2456 | 2471 | (because the temp files were immediately removed). Now temp files |
|
2457 | 2472 | are removed only at IPython's exit. |
|
2458 | 2473 | (Magic.magic_run): Improved @run to perform shell-like expansions |
|
2459 | 2474 | on its arguments (~users and $VARS). With this, @run becomes more |
|
2460 | 2475 | like a normal command-line. |
|
2461 | 2476 | |
|
2462 | 2477 | * IPython/Shell.py (IPShellEmbed.__call__): Fixed a bunch of small |
|
2463 | 2478 | bugs related to embedding and cleaned up that code. A fairly |
|
2464 | 2479 | important one was the impossibility to access the global namespace |
|
2465 | 2480 | through the embedded IPython (only local variables were visible). |
|
2466 | 2481 | |
|
2467 | 2482 | 2003-01-14 Fernando Perez <fperez@colorado.edu> |
|
2468 | 2483 | |
|
2469 | 2484 | * IPython/iplib.py (InteractiveShell._prefilter): Fixed |
|
2470 | 2485 | auto-calling to be a bit more conservative. Now it doesn't get |
|
2471 | 2486 | triggered if any of '!=()<>' are in the rest of the input line, to |
|
2472 | 2487 | allow comparing callables. Thanks to Alex for the heads up. |
|
2473 | 2488 | |
|
2474 | 2489 | 2003-01-07 Fernando Perez <fperez@colorado.edu> |
|
2475 | 2490 | |
|
2476 | 2491 | * IPython/genutils.py (page): fixed estimation of the number of |
|
2477 | 2492 | lines in a string to be paged to simply count newlines. This |
|
2478 | 2493 | prevents over-guessing due to embedded escape sequences. A better |
|
2479 | 2494 | long-term solution would involve stripping out the control chars |
|
2480 | 2495 | for the count, but it's potentially so expensive I just don't |
|
2481 | 2496 | think it's worth doing. |
|
2482 | 2497 | |
|
2483 | 2498 | 2002-12-19 *** Released version 0.2.14pre50 |
|
2484 | 2499 | |
|
2485 | 2500 | 2002-12-19 Fernando Perez <fperez@colorado.edu> |
|
2486 | 2501 | |
|
2487 | 2502 | * tools/release (version): Changed release scripts to inform |
|
2488 | 2503 | Andrea and build a NEWS file with a list of recent changes. |
|
2489 | 2504 | |
|
2490 | 2505 | * IPython/ColorANSI.py (__all__): changed terminal detection |
|
2491 | 2506 | code. Seems to work better for xterms without breaking |
|
2492 | 2507 | konsole. Will need more testing to determine if WinXP and Mac OSX |
|
2493 | 2508 | also work ok. |
|
2494 | 2509 | |
|
2495 | 2510 | 2002-12-18 *** Released version 0.2.14pre49 |
|
2496 | 2511 | |
|
2497 | 2512 | 2002-12-18 Fernando Perez <fperez@colorado.edu> |
|
2498 | 2513 | |
|
2499 | 2514 | * Docs: added new info about Mac OSX, from Andrea. |
|
2500 | 2515 | |
|
2501 | 2516 | * IPython/Gnuplot2.py (String): Added a String PlotItem class to |
|
2502 | 2517 | allow direct plotting of python strings whose format is the same |
|
2503 | 2518 | of gnuplot data files. |
|
2504 | 2519 | |
|
2505 | 2520 | 2002-12-16 Fernando Perez <fperez@colorado.edu> |
|
2506 | 2521 | |
|
2507 | 2522 | * IPython/iplib.py (InteractiveShell.interact): fixed default (y) |
|
2508 | 2523 | value of exit question to be acknowledged. |
|
2509 | 2524 | |
|
2510 | 2525 | 2002-12-03 Fernando Perez <fperez@colorado.edu> |
|
2511 | 2526 | |
|
2512 | 2527 | * IPython/ipmaker.py: removed generators, which had been added |
|
2513 | 2528 | by mistake in an earlier debugging run. This was causing trouble |
|
2514 | 2529 | to users of python 2.1.x. Thanks to Abel Daniel <abli-AT-freemail.hu> |
|
2515 | 2530 | for pointing this out. |
|
2516 | 2531 | |
|
2517 | 2532 | 2002-11-17 Fernando Perez <fperez@colorado.edu> |
|
2518 | 2533 | |
|
2519 | 2534 | * Manual: updated the Gnuplot section. |
|
2520 | 2535 | |
|
2521 | 2536 | * IPython/GnuplotRuntime.py: refactored a lot all this code, with |
|
2522 | 2537 | a much better split of what goes in Runtime and what goes in |
|
2523 | 2538 | Interactive. |
|
2524 | 2539 | |
|
2525 | 2540 | * IPython/ipmaker.py: fixed bug where import_fail_info wasn't |
|
2526 | 2541 | being imported from iplib. |
|
2527 | 2542 | |
|
2528 | 2543 | * IPython/GnuplotInteractive.py (magic_gpc): renamed @gp to @gpc |
|
2529 | 2544 | for command-passing. Now the global Gnuplot instance is called |
|
2530 | 2545 | 'gp' instead of 'g', which was really a far too fragile and |
|
2531 | 2546 | common name. |
|
2532 | 2547 | |
|
2533 | 2548 | * IPython/Gnuplot2.py (eps_fix_bbox): added this to fix broken |
|
2534 | 2549 | bounding boxes generated by Gnuplot for square plots. |
|
2535 | 2550 | |
|
2536 | 2551 | * IPython/genutils.py (popkey): new function added. I should |
|
2537 | 2552 | suggest this on c.l.py as a dict method, it seems useful. |
|
2538 | 2553 | |
|
2539 | 2554 | * IPython/Gnuplot2.py (Gnuplot.plot): Overhauled plot and replot |
|
2540 | 2555 | to transparently handle PostScript generation. MUCH better than |
|
2541 | 2556 | the previous plot_eps/replot_eps (which I removed now). The code |
|
2542 | 2557 | is also fairly clean and well documented now (including |
|
2543 | 2558 | docstrings). |
|
2544 | 2559 | |
|
2545 | 2560 | 2002-11-13 Fernando Perez <fperez@colorado.edu> |
|
2546 | 2561 | |
|
2547 | 2562 | * IPython/Magic.py (Magic.magic_edit): fixed docstring |
|
2548 | 2563 | (inconsistent with options). |
|
2549 | 2564 | |
|
2550 | 2565 | * IPython/Gnuplot2.py (Gnuplot.hardcopy): hardcopy had been |
|
2551 | 2566 | manually disabled, I don't know why. Fixed it. |
|
2552 | 2567 | (Gnuplot._plot_eps): added new plot_eps/replot_eps to get directly |
|
2553 | 2568 | eps output. |
|
2554 | 2569 | |
|
2555 | 2570 | 2002-11-12 Fernando Perez <fperez@colorado.edu> |
|
2556 | 2571 | |
|
2557 | 2572 | * IPython/genutils.py (ask_yes_no): trap EOF and ^C so that they |
|
2558 | 2573 | don't propagate up to caller. Fixes crash reported by François |
|
2559 | 2574 | Pinard. |
|
2560 | 2575 | |
|
2561 | 2576 | 2002-11-09 Fernando Perez <fperez@colorado.edu> |
|
2562 | 2577 | |
|
2563 | 2578 | * IPython/ipmaker.py (make_IPython): fixed problem with writing |
|
2564 | 2579 | history file for new users. |
|
2565 | 2580 | (make_IPython): fixed bug where initial install would leave the |
|
2566 | 2581 | user running in the .ipython dir. |
|
2567 | 2582 | (make_IPython): fixed bug where config dir .ipython would be |
|
2568 | 2583 | created regardless of the given -ipythondir option. Thanks to Cory |
|
2569 | 2584 | Dodt <cdodt-AT-fcoe.k12.ca.us> for the bug report. |
|
2570 | 2585 | |
|
2571 | 2586 | * IPython/genutils.py (ask_yes_no): new function for asking yes/no |
|
2572 | 2587 | type confirmations. Will need to use it in all of IPython's code |
|
2573 | 2588 | consistently. |
|
2574 | 2589 | |
|
2575 | 2590 | * IPython/CrashHandler.py (CrashHandler.__call__): changed the |
|
2576 | 2591 | context to print 31 lines instead of the default 5. This will make |
|
2577 | 2592 | the crash reports extremely detailed in case the problem is in |
|
2578 | 2593 | libraries I don't have access to. |
|
2579 | 2594 | |
|
2580 | 2595 | * IPython/iplib.py (InteractiveShell.interact): changed the 'last |
|
2581 | 2596 | line of defense' code to still crash, but giving users fair |
|
2582 | 2597 | warning. I don't want internal errors to go unreported: if there's |
|
2583 | 2598 | an internal problem, IPython should crash and generate a full |
|
2584 | 2599 | report. |
|
2585 | 2600 | |
|
2586 | 2601 | 2002-11-08 Fernando Perez <fperez@colorado.edu> |
|
2587 | 2602 | |
|
2588 | 2603 | * IPython/iplib.py (InteractiveShell.interact): added code to trap |
|
2589 | 2604 | otherwise uncaught exceptions which can appear if people set |
|
2590 | 2605 | sys.stdout to something badly broken. Thanks to a crash report |
|
2591 | 2606 | from henni-AT-mail.brainbot.com. |
|
2592 | 2607 | |
|
2593 | 2608 | 2002-11-04 Fernando Perez <fperez@colorado.edu> |
|
2594 | 2609 | |
|
2595 | 2610 | * IPython/iplib.py (InteractiveShell.interact): added |
|
2596 | 2611 | __IPYTHON__active to the builtins. It's a flag which goes on when |
|
2597 | 2612 | the interaction starts and goes off again when it stops. This |
|
2598 | 2613 | allows embedding code to detect being inside IPython. Before this |
|
2599 | 2614 | was done via __IPYTHON__, but that only shows that an IPython |
|
2600 | 2615 | instance has been created. |
|
2601 | 2616 | |
|
2602 | 2617 | * IPython/Magic.py (Magic.magic_env): I realized that in a |
|
2603 | 2618 | UserDict, instance.data holds the data as a normal dict. So I |
|
2604 | 2619 | modified @env to return os.environ.data instead of rebuilding a |
|
2605 | 2620 | dict by hand. |
|
2606 | 2621 | |
|
2607 | 2622 | 2002-11-02 Fernando Perez <fperez@colorado.edu> |
|
2608 | 2623 | |
|
2609 | 2624 | * IPython/genutils.py (warn): changed so that level 1 prints no |
|
2610 | 2625 | header. Level 2 is now the default (with 'WARNING' header, as |
|
2611 | 2626 | before). I think I tracked all places where changes were needed in |
|
2612 | 2627 | IPython, but outside code using the old level numbering may have |
|
2613 | 2628 | broken. |
|
2614 | 2629 | |
|
2615 | 2630 | * IPython/iplib.py (InteractiveShell.runcode): added this to |
|
2616 | 2631 | handle the tracebacks in SystemExit traps correctly. The previous |
|
2617 | 2632 | code (through interact) was printing more of the stack than |
|
2618 | 2633 | necessary, showing IPython internal code to the user. |
|
2619 | 2634 | |
|
2620 | 2635 | * IPython/UserConfig/ipythonrc.py: Made confirm_exit 1 by |
|
2621 | 2636 | default. Now that the default at the confirmation prompt is yes, |
|
2622 | 2637 | it's not so intrusive. François' argument that ipython sessions |
|
2623 | 2638 | tend to be complex enough not to lose them from an accidental C-d, |
|
2624 | 2639 | is a valid one. |
|
2625 | 2640 | |
|
2626 | 2641 | * IPython/iplib.py (InteractiveShell.interact): added a |
|
2627 | 2642 | showtraceback() call to the SystemExit trap, and modified the exit |
|
2628 | 2643 | confirmation to have yes as the default. |
|
2629 | 2644 | |
|
2630 | 2645 | * IPython/UserConfig/ipythonrc.py: removed 'session' option from |
|
2631 | 2646 | this file. It's been gone from the code for a long time, this was |
|
2632 | 2647 | simply leftover junk. |
|
2633 | 2648 | |
|
2634 | 2649 | 2002-11-01 Fernando Perez <fperez@colorado.edu> |
|
2635 | 2650 | |
|
2636 | 2651 | * IPython/UserConfig/ipythonrc.py: new confirm_exit option |
|
2637 | 2652 | added. If set, IPython now traps EOF and asks for |
|
2638 | 2653 | confirmation. After a request by François Pinard. |
|
2639 | 2654 | |
|
2640 | 2655 | * IPython/Magic.py (Magic.magic_Exit): New @Exit and @Quit instead |
|
2641 | 2656 | of @abort, and with a new (better) mechanism for handling the |
|
2642 | 2657 | exceptions. |
|
2643 | 2658 | |
|
2644 | 2659 | 2002-10-27 Fernando Perez <fperez@colorado.edu> |
|
2645 | 2660 | |
|
2646 | 2661 | * IPython/usage.py (__doc__): updated the --help information and |
|
2647 | 2662 | the ipythonrc file to indicate that -log generates |
|
2648 | 2663 | ./ipython.log. Also fixed the corresponding info in @logstart. |
|
2649 | 2664 | This and several other fixes in the manuals thanks to reports by |
|
2650 | 2665 | François Pinard <pinard-AT-iro.umontreal.ca>. |
|
2651 | 2666 | |
|
2652 | 2667 | * IPython/Logger.py (Logger.switch_log): Fixed error message to |
|
2653 | 2668 | refer to @logstart (instead of @log, which doesn't exist). |
|
2654 | 2669 | |
|
2655 | 2670 | * IPython/iplib.py (InteractiveShell._prefilter): fixed |
|
2656 | 2671 | AttributeError crash. Thanks to Christopher Armstrong |
|
2657 | 2672 | <radix-AT-twistedmatrix.com> for the report/fix. This bug had been |
|
2658 | 2673 | introduced recently (in 0.2.14pre37) with the fix to the eval |
|
2659 | 2674 | problem mentioned below. |
|
2660 | 2675 | |
|
2661 | 2676 | 2002-10-17 Fernando Perez <fperez@colorado.edu> |
|
2662 | 2677 | |
|
2663 | 2678 | * IPython/ConfigLoader.py (ConfigLoader.load): Fixes for Windows |
|
2664 | 2679 | installation. Thanks to Leonardo Santagada <retype-AT-terra.com.br>. |
|
2665 | 2680 | |
|
2666 | 2681 | * IPython/iplib.py (InteractiveShell._prefilter): Many changes to |
|
2667 | 2682 | this function to fix a problem reported by Alex Schmolck. He saw |
|
2668 | 2683 | it with list comprehensions and generators, which were getting |
|
2669 | 2684 | called twice. The real problem was an 'eval' call in testing for |
|
2670 | 2685 | automagic which was evaluating the input line silently. |
|
2671 | 2686 | |
|
2672 | 2687 | This is a potentially very nasty bug, if the input has side |
|
2673 | 2688 | effects which must not be repeated. The code is much cleaner now, |
|
2674 | 2689 | without any blanket 'except' left and with a regexp test for |
|
2675 | 2690 | actual function names. |
|
2676 | 2691 | |
|
2677 | 2692 | But an eval remains, which I'm not fully comfortable with. I just |
|
2678 | 2693 | don't know how to find out if an expression could be a callable in |
|
2679 | 2694 | the user's namespace without doing an eval on the string. However |
|
2680 | 2695 | that string is now much more strictly checked so that no code |
|
2681 | 2696 | slips by, so the eval should only happen for things that can |
|
2682 | 2697 | really be only function/method names. |
|
2683 | 2698 | |
|
2684 | 2699 | 2002-10-15 Fernando Perez <fperez@colorado.edu> |
|
2685 | 2700 | |
|
2686 | 2701 | * Updated LyX to 1.2.1 so I can work on the docs again. Added Mac |
|
2687 | 2702 | OSX information to main manual, removed README_Mac_OSX file from |
|
2688 | 2703 | distribution. Also updated credits for recent additions. |
|
2689 | 2704 | |
|
2690 | 2705 | 2002-10-10 Fernando Perez <fperez@colorado.edu> |
|
2691 | 2706 | |
|
2692 | 2707 | * README_Mac_OSX: Added a README for Mac OSX users for fixing |
|
2693 | 2708 | terminal-related issues. Many thanks to Andrea Riciputi |
|
2694 | 2709 | <andrea.riciputi-AT-libero.it> for writing it. |
|
2695 | 2710 | |
|
2696 | 2711 | * IPython/UserConfig/ipythonrc.py: Fixes to various small issues, |
|
2697 | 2712 | thanks to Thorsten Kampe <thorsten-AT-thorstenkampe.de>. |
|
2698 | 2713 | |
|
2699 | 2714 | * setup.py (make_shortcut): Fixes for Windows installation. Thanks |
|
2700 | 2715 | to Fredrik Kant <fredrik.kant-AT-front.com> and Syver Enstad |
|
2701 | 2716 | <syver-en-AT-online.no> who both submitted patches for this problem. |
|
2702 | 2717 | |
|
2703 | 2718 | * IPython/iplib.py (InteractiveShell.embed_mainloop): Patch for |
|
2704 | 2719 | global embedding to make sure that things don't overwrite user |
|
2705 | 2720 | globals accidentally. Thanks to Richard <rxe-AT-renre-europe.com> |
|
2706 | 2721 | |
|
2707 | 2722 | * IPython/Gnuplot2.py (gp): Patch for Gnuplot.py 1.6 |
|
2708 | 2723 | compatibility. Thanks to Hayden Callow |
|
2709 | 2724 | <h.callow-AT-elec.canterbury.ac.nz> |
|
2710 | 2725 | |
|
2711 | 2726 | 2002-10-04 Fernando Perez <fperez@colorado.edu> |
|
2712 | 2727 | |
|
2713 | 2728 | * IPython/Gnuplot2.py (PlotItem): Added 'index' option for |
|
2714 | 2729 | Gnuplot.File objects. |
|
2715 | 2730 | |
|
2716 | 2731 | 2002-07-23 Fernando Perez <fperez@colorado.edu> |
|
2717 | 2732 | |
|
2718 | 2733 | * IPython/genutils.py (timing): Added timings() and timing() for |
|
2719 | 2734 | quick access to the most commonly needed data, the execution |
|
2720 | 2735 | times. Old timing() renamed to timings_out(). |
|
2721 | 2736 | |
|
2722 | 2737 | 2002-07-18 Fernando Perez <fperez@colorado.edu> |
|
2723 | 2738 | |
|
2724 | 2739 | * IPython/Shell.py (IPShellEmbed.restore_system_completer): fixed |
|
2725 | 2740 | bug with nested instances disrupting the parent's tab completion. |
|
2726 | 2741 | |
|
2727 | 2742 | * IPython/iplib.py (all_completions): Added Alex Schmolck's |
|
2728 | 2743 | all_completions code to begin the emacs integration. |
|
2729 | 2744 | |
|
2730 | 2745 | * IPython/Gnuplot2.py (zip_items): Added optional 'titles' |
|
2731 | 2746 | argument to allow titling individual arrays when plotting. |
|
2732 | 2747 | |
|
2733 | 2748 | 2002-07-15 Fernando Perez <fperez@colorado.edu> |
|
2734 | 2749 | |
|
2735 | 2750 | * setup.py (make_shortcut): changed to retrieve the value of |
|
2736 | 2751 | 'Program Files' directory from the registry (this value changes in |
|
2737 | 2752 | non-english versions of Windows). Thanks to Thomas Fanslau |
|
2738 | 2753 | <tfanslau-AT-gmx.de> for the report. |
|
2739 | 2754 | |
|
2740 | 2755 | 2002-07-10 Fernando Perez <fperez@colorado.edu> |
|
2741 | 2756 | |
|
2742 | 2757 | * IPython/ultraTB.py (VerboseTB.debugger): enabled workaround for |
|
2743 | 2758 | a bug in pdb, which crashes if a line with only whitespace is |
|
2744 | 2759 | entered. Bug report submitted to sourceforge. |
|
2745 | 2760 | |
|
2746 | 2761 | 2002-07-09 Fernando Perez <fperez@colorado.edu> |
|
2747 | 2762 | |
|
2748 | 2763 | * IPython/ultraTB.py (VerboseTB.nullrepr): fixed rare crash when |
|
2749 | 2764 | reporting exceptions (it's a bug in inspect.py, I just set a |
|
2750 | 2765 | workaround). |
|
2751 | 2766 | |
|
2752 | 2767 | 2002-07-08 Fernando Perez <fperez@colorado.edu> |
|
2753 | 2768 | |
|
2754 | 2769 | * IPython/iplib.py (InteractiveShell.__init__): fixed reference to |
|
2755 | 2770 | __IPYTHON__ in __builtins__ to show up in user_ns. |
|
2756 | 2771 | |
|
2757 | 2772 | 2002-07-03 Fernando Perez <fperez@colorado.edu> |
|
2758 | 2773 | |
|
2759 | 2774 | * IPython/GnuplotInteractive.py (magic_gp_set_default): changed |
|
2760 | 2775 | name from @gp_set_instance to @gp_set_default. |
|
2761 | 2776 | |
|
2762 | 2777 | * IPython/ipmaker.py (make_IPython): default editor value set to |
|
2763 | 2778 | '0' (a string), to match the rc file. Otherwise will crash when |
|
2764 | 2779 | .strip() is called on it. |
|
2765 | 2780 | |
|
2766 | 2781 | |
|
2767 | 2782 | 2002-06-28 Fernando Perez <fperez@colorado.edu> |
|
2768 | 2783 | |
|
2769 | 2784 | * IPython/iplib.py (InteractiveShell.safe_execfile): fix importing |
|
2770 | 2785 | of files in current directory when a file is executed via |
|
2771 | 2786 | @run. Patch also by RA <ralf_ahlbrink-AT-web.de>. |
|
2772 | 2787 | |
|
2773 | 2788 | * setup.py (manfiles): fix for rpm builds, submitted by RA |
|
2774 | 2789 | <ralf_ahlbrink-AT-web.de>. Now we have RPMs! |
|
2775 | 2790 | |
|
2776 | 2791 | * IPython/ipmaker.py (make_IPython): fixed lookup of default |
|
2777 | 2792 | editor when set to '0'. Problem was, '0' evaluates to True (it's a |
|
2778 | 2793 | string!). A. Schmolck caught this one. |
|
2779 | 2794 | |
|
2780 | 2795 | 2002-06-27 Fernando Perez <fperez@colorado.edu> |
|
2781 | 2796 | |
|
2782 | 2797 | * IPython/ipmaker.py (make_IPython): fixed bug when running user |
|
2783 | 2798 | defined files at the cmd line. __name__ wasn't being set to |
|
2784 | 2799 | __main__. |
|
2785 | 2800 | |
|
2786 | 2801 | * IPython/Gnuplot2.py (zip_items): improved it so it can plot also |
|
2787 | 2802 | regular lists and tuples besides Numeric arrays. |
|
2788 | 2803 | |
|
2789 | 2804 | * IPython/Prompts.py (CachedOutput.__call__): Added output |
|
2790 | 2805 | supression for input ending with ';'. Similar to Mathematica and |
|
2791 | 2806 | Matlab. The _* vars and Out[] list are still updated, just like |
|
2792 | 2807 | Mathematica behaves. |
|
2793 | 2808 | |
|
2794 | 2809 | 2002-06-25 Fernando Perez <fperez@colorado.edu> |
|
2795 | 2810 | |
|
2796 | 2811 | * IPython/ConfigLoader.py (ConfigLoader.load): fixed checking of |
|
2797 | 2812 | .ini extensions for profiels under Windows. |
|
2798 | 2813 | |
|
2799 | 2814 | * IPython/OInspect.py (Inspector.pinfo): improved alignment of |
|
2800 | 2815 | string form. Fix contributed by Alexander Schmolck |
|
2801 | 2816 | <a.schmolck-AT-gmx.net> |
|
2802 | 2817 | |
|
2803 | 2818 | * IPython/GnuplotRuntime.py (gp_new): new function. Returns a |
|
2804 | 2819 | pre-configured Gnuplot instance. |
|
2805 | 2820 | |
|
2806 | 2821 | 2002-06-21 Fernando Perez <fperez@colorado.edu> |
|
2807 | 2822 | |
|
2808 | 2823 | * IPython/numutils.py (exp_safe): new function, works around the |
|
2809 | 2824 | underflow problems in Numeric. |
|
2810 | 2825 | (log2): New fn. Safe log in base 2: returns exact integer answer |
|
2811 | 2826 | for exact integer powers of 2. |
|
2812 | 2827 | |
|
2813 | 2828 | * IPython/Magic.py (get_py_filename): fixed it not expanding '~' |
|
2814 | 2829 | properly. |
|
2815 | 2830 | |
|
2816 | 2831 | 2002-06-20 Fernando Perez <fperez@colorado.edu> |
|
2817 | 2832 | |
|
2818 | 2833 | * IPython/genutils.py (timing): new function like |
|
2819 | 2834 | Mathematica's. Similar to time_test, but returns more info. |
|
2820 | 2835 | |
|
2821 | 2836 | 2002-06-18 Fernando Perez <fperez@colorado.edu> |
|
2822 | 2837 | |
|
2823 | 2838 | * IPython/Magic.py (Magic.magic_save): modified @save and @r |
|
2824 | 2839 | according to Mike Heeter's suggestions. |
|
2825 | 2840 | |
|
2826 | 2841 | 2002-06-16 Fernando Perez <fperez@colorado.edu> |
|
2827 | 2842 | |
|
2828 | 2843 | * IPython/GnuplotRuntime.py: Massive overhaul to the Gnuplot |
|
2829 | 2844 | system. GnuplotMagic is gone as a user-directory option. New files |
|
2830 | 2845 | make it easier to use all the gnuplot stuff both from external |
|
2831 | 2846 | programs as well as from IPython. Had to rewrite part of |
|
2832 | 2847 | hardcopy() b/c of a strange bug: often the ps files simply don't |
|
2833 | 2848 | get created, and require a repeat of the command (often several |
|
2834 | 2849 | times). |
|
2835 | 2850 | |
|
2836 | 2851 | * IPython/ultraTB.py (AutoFormattedTB.__call__): changed to |
|
2837 | 2852 | resolve output channel at call time, so that if sys.stderr has |
|
2838 | 2853 | been redirected by user this gets honored. |
|
2839 | 2854 | |
|
2840 | 2855 | 2002-06-13 Fernando Perez <fperez@colorado.edu> |
|
2841 | 2856 | |
|
2842 | 2857 | * IPython/Shell.py (IPShell.__init__): Changed IPythonShell to |
|
2843 | 2858 | IPShell. Kept a copy with the old names to avoid breaking people's |
|
2844 | 2859 | embedded code. |
|
2845 | 2860 | |
|
2846 | 2861 | * IPython/ipython: simplified it to the bare minimum after |
|
2847 | 2862 | Holger's suggestions. Added info about how to use it in |
|
2848 | 2863 | PYTHONSTARTUP. |
|
2849 | 2864 | |
|
2850 | 2865 | * IPython/Shell.py (IPythonShell): changed the options passing |
|
2851 | 2866 | from a string with funky %s replacements to a straight list. Maybe |
|
2852 | 2867 | a bit more typing, but it follows sys.argv conventions, so there's |
|
2853 | 2868 | less special-casing to remember. |
|
2854 | 2869 | |
|
2855 | 2870 | 2002-06-12 Fernando Perez <fperez@colorado.edu> |
|
2856 | 2871 | |
|
2857 | 2872 | * IPython/Magic.py (Magic.magic_r): new magic auto-repeat |
|
2858 | 2873 | command. Thanks to a suggestion by Mike Heeter. |
|
2859 | 2874 | (Magic.magic_pfile): added behavior to look at filenames if given |
|
2860 | 2875 | arg is not a defined object. |
|
2861 | 2876 | (Magic.magic_save): New @save function to save code snippets. Also |
|
2862 | 2877 | a Mike Heeter idea. |
|
2863 | 2878 | |
|
2864 | 2879 | * IPython/UserConfig/GnuplotMagic.py (plot): Improvements to |
|
2865 | 2880 | plot() and replot(). Much more convenient now, especially for |
|
2866 | 2881 | interactive use. |
|
2867 | 2882 | |
|
2868 | 2883 | * IPython/Magic.py (Magic.magic_run): Added .py automatically to |
|
2869 | 2884 | filenames. |
|
2870 | 2885 | |
|
2871 | 2886 | 2002-06-02 Fernando Perez <fperez@colorado.edu> |
|
2872 | 2887 | |
|
2873 | 2888 | * IPython/Struct.py (Struct.__init__): modified to admit |
|
2874 | 2889 | initialization via another struct. |
|
2875 | 2890 | |
|
2876 | 2891 | * IPython/genutils.py (SystemExec.__init__): New stateful |
|
2877 | 2892 | interface to xsys and bq. Useful for writing system scripts. |
|
2878 | 2893 | |
|
2879 | 2894 | 2002-05-30 Fernando Perez <fperez@colorado.edu> |
|
2880 | 2895 | |
|
2881 | 2896 | * MANIFEST.in: Changed docfile selection to exclude all the lyx |
|
2882 | 2897 | documents. This will make the user download smaller (it's getting |
|
2883 | 2898 | too big). |
|
2884 | 2899 | |
|
2885 | 2900 | 2002-05-29 Fernando Perez <fperez@colorado.edu> |
|
2886 | 2901 | |
|
2887 | 2902 | * IPython/iplib.py (_FakeModule.__init__): New class introduced to |
|
2888 | 2903 | fix problems with shelve and pickle. Seems to work, but I don't |
|
2889 | 2904 | know if corner cases break it. Thanks to Mike Heeter |
|
2890 | 2905 | <korora-AT-SDF.LONESTAR.ORG> for the bug reports and test cases. |
|
2891 | 2906 | |
|
2892 | 2907 | 2002-05-24 Fernando Perez <fperez@colorado.edu> |
|
2893 | 2908 | |
|
2894 | 2909 | * IPython/Magic.py (Macro.__init__): fixed magics embedded in |
|
2895 | 2910 | macros having broken. |
|
2896 | 2911 | |
|
2897 | 2912 | 2002-05-21 Fernando Perez <fperez@colorado.edu> |
|
2898 | 2913 | |
|
2899 | 2914 | * IPython/Magic.py (Magic.magic_logstart): fixed recently |
|
2900 | 2915 | introduced logging bug: all history before logging started was |
|
2901 | 2916 | being written one character per line! This came from the redesign |
|
2902 | 2917 | of the input history as a special list which slices to strings, |
|
2903 | 2918 | not to lists. |
|
2904 | 2919 | |
|
2905 | 2920 | 2002-05-20 Fernando Perez <fperez@colorado.edu> |
|
2906 | 2921 | |
|
2907 | 2922 | * IPython/Prompts.py (CachedOutput.__init__): made the color table |
|
2908 | 2923 | be an attribute of all classes in this module. The design of these |
|
2909 | 2924 | classes needs some serious overhauling. |
|
2910 | 2925 | |
|
2911 | 2926 | * IPython/DPyGetOpt.py (DPyGetOpt.setPosixCompliance): fixed bug |
|
2912 | 2927 | which was ignoring '_' in option names. |
|
2913 | 2928 | |
|
2914 | 2929 | * IPython/ultraTB.py (FormattedTB.__init__): Changed |
|
2915 | 2930 | 'Verbose_novars' to 'Context' and made it the new default. It's a |
|
2916 | 2931 | bit more readable and also safer than verbose. |
|
2917 | 2932 | |
|
2918 | 2933 | * IPython/PyColorize.py (Parser.__call__): Fixed coloring of |
|
2919 | 2934 | triple-quoted strings. |
|
2920 | 2935 | |
|
2921 | 2936 | * IPython/OInspect.py (__all__): new module exposing the object |
|
2922 | 2937 | introspection facilities. Now the corresponding magics are dummy |
|
2923 | 2938 | wrappers around this. Having this module will make it much easier |
|
2924 | 2939 | to put these functions into our modified pdb. |
|
2925 | 2940 | This new object inspector system uses the new colorizing module, |
|
2926 | 2941 | so source code and other things are nicely syntax highlighted. |
|
2927 | 2942 | |
|
2928 | 2943 | 2002-05-18 Fernando Perez <fperez@colorado.edu> |
|
2929 | 2944 | |
|
2930 | 2945 | * IPython/ColorANSI.py: Split the coloring tools into a separate |
|
2931 | 2946 | module so I can use them in other code easier (they were part of |
|
2932 | 2947 | ultraTB). |
|
2933 | 2948 | |
|
2934 | 2949 | 2002-05-17 Fernando Perez <fperez@colorado.edu> |
|
2935 | 2950 | |
|
2936 | 2951 | * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance): |
|
2937 | 2952 | fixed it to set the global 'g' also to the called instance, as |
|
2938 | 2953 | long as 'g' was still a gnuplot instance (so it doesn't overwrite |
|
2939 | 2954 | user's 'g' variables). |
|
2940 | 2955 | |
|
2941 | 2956 | * IPython/iplib.py (InteractiveShell.__init__): Added In/Out |
|
2942 | 2957 | global variables (aliases to _ih,_oh) so that users which expect |
|
2943 | 2958 | In[5] or Out[7] to work aren't unpleasantly surprised. |
|
2944 | 2959 | (InputList.__getslice__): new class to allow executing slices of |
|
2945 | 2960 | input history directly. Very simple class, complements the use of |
|
2946 | 2961 | macros. |
|
2947 | 2962 | |
|
2948 | 2963 | 2002-05-16 Fernando Perez <fperez@colorado.edu> |
|
2949 | 2964 | |
|
2950 | 2965 | * setup.py (docdirbase): make doc directory be just doc/IPython |
|
2951 | 2966 | without version numbers, it will reduce clutter for users. |
|
2952 | 2967 | |
|
2953 | 2968 | * IPython/Magic.py (Magic.magic_run): Add explicit local dict to |
|
2954 | 2969 | execfile call to prevent possible memory leak. See for details: |
|
2955 | 2970 | http://mail.python.org/pipermail/python-list/2002-February/088476.html |
|
2956 | 2971 | |
|
2957 | 2972 | 2002-05-15 Fernando Perez <fperez@colorado.edu> |
|
2958 | 2973 | |
|
2959 | 2974 | * IPython/Magic.py (Magic.magic_psource): made the object |
|
2960 | 2975 | introspection names be more standard: pdoc, pdef, pfile and |
|
2961 | 2976 | psource. They all print/page their output, and it makes |
|
2962 | 2977 | remembering them easier. Kept old names for compatibility as |
|
2963 | 2978 | aliases. |
|
2964 | 2979 | |
|
2965 | 2980 | 2002-05-14 Fernando Perez <fperez@colorado.edu> |
|
2966 | 2981 | |
|
2967 | 2982 | * IPython/UserConfig/GnuplotMagic.py: I think I finally understood |
|
2968 | 2983 | what the mouse problem was. The trick is to use gnuplot with temp |
|
2969 | 2984 | files and NOT with pipes (for data communication), because having |
|
2970 | 2985 | both pipes and the mouse on is bad news. |
|
2971 | 2986 | |
|
2972 | 2987 | 2002-05-13 Fernando Perez <fperez@colorado.edu> |
|
2973 | 2988 | |
|
2974 | 2989 | * IPython/Magic.py (Magic._ofind): fixed namespace order search |
|
2975 | 2990 | bug. Information would be reported about builtins even when |
|
2976 | 2991 | user-defined functions overrode them. |
|
2977 | 2992 | |
|
2978 | 2993 | 2002-05-11 Fernando Perez <fperez@colorado.edu> |
|
2979 | 2994 | |
|
2980 | 2995 | * IPython/__init__.py (__all__): removed FlexCompleter from |
|
2981 | 2996 | __all__ so that things don't fail in platforms without readline. |
|
2982 | 2997 | |
|
2983 | 2998 | 2002-05-10 Fernando Perez <fperez@colorado.edu> |
|
2984 | 2999 | |
|
2985 | 3000 | * IPython/__init__.py (__all__): removed numutils from __all__ b/c |
|
2986 | 3001 | it requires Numeric, effectively making Numeric a dependency for |
|
2987 | 3002 | IPython. |
|
2988 | 3003 | |
|
2989 | 3004 | * Released 0.2.13 |
|
2990 | 3005 | |
|
2991 | 3006 | * IPython/Magic.py (Magic.magic_prun): big overhaul to the |
|
2992 | 3007 | profiler interface. Now all the major options from the profiler |
|
2993 | 3008 | module are directly supported in IPython, both for single |
|
2994 | 3009 | expressions (@prun) and for full programs (@run -p). |
|
2995 | 3010 | |
|
2996 | 3011 | 2002-05-09 Fernando Perez <fperez@colorado.edu> |
|
2997 | 3012 | |
|
2998 | 3013 | * IPython/Magic.py (Magic.magic_doc): fixed to show docstrings of |
|
2999 | 3014 | magic properly formatted for screen. |
|
3000 | 3015 | |
|
3001 | 3016 | * setup.py (make_shortcut): Changed things to put pdf version in |
|
3002 | 3017 | doc/ instead of doc/manual (had to change lyxport a bit). |
|
3003 | 3018 | |
|
3004 | 3019 | * IPython/Magic.py (Profile.string_stats): made profile runs go |
|
3005 | 3020 | through pager (they are long and a pager allows searching, saving, |
|
3006 | 3021 | etc.) |
|
3007 | 3022 | |
|
3008 | 3023 | 2002-05-08 Fernando Perez <fperez@colorado.edu> |
|
3009 | 3024 | |
|
3010 | 3025 | * Released 0.2.12 |
|
3011 | 3026 | |
|
3012 | 3027 | 2002-05-06 Fernando Perez <fperez@colorado.edu> |
|
3013 | 3028 | |
|
3014 | 3029 | * IPython/Magic.py (Magic.magic_hist): small bug fixed (recently |
|
3015 | 3030 | introduced); 'hist n1 n2' was broken. |
|
3016 | 3031 | (Magic.magic_pdb): added optional on/off arguments to @pdb |
|
3017 | 3032 | (Magic.magic_run): added option -i to @run, which executes code in |
|
3018 | 3033 | the IPython namespace instead of a clean one. Also added @irun as |
|
3019 | 3034 | an alias to @run -i. |
|
3020 | 3035 | |
|
3021 | 3036 | * IPython/UserConfig/GnuplotMagic.py (magic_gp_set_instance): |
|
3022 | 3037 | fixed (it didn't really do anything, the namespaces were wrong). |
|
3023 | 3038 | |
|
3024 | 3039 | * IPython/Debugger.py (__init__): Added workaround for python 2.1 |
|
3025 | 3040 | |
|
3026 | 3041 | * IPython/__init__.py (__all__): Fixed package namespace, now |
|
3027 | 3042 | 'import IPython' does give access to IPython.<all> as |
|
3028 | 3043 | expected. Also renamed __release__ to Release. |
|
3029 | 3044 | |
|
3030 | 3045 | * IPython/Debugger.py (__license__): created new Pdb class which |
|
3031 | 3046 | functions like a drop-in for the normal pdb.Pdb but does NOT |
|
3032 | 3047 | import readline by default. This way it doesn't muck up IPython's |
|
3033 | 3048 | readline handling, and now tab-completion finally works in the |
|
3034 | 3049 | debugger -- sort of. It completes things globally visible, but the |
|
3035 | 3050 | completer doesn't track the stack as pdb walks it. That's a bit |
|
3036 | 3051 | tricky, and I'll have to implement it later. |
|
3037 | 3052 | |
|
3038 | 3053 | 2002-05-05 Fernando Perez <fperez@colorado.edu> |
|
3039 | 3054 | |
|
3040 | 3055 | * IPython/Magic.py (Magic.magic_oinfo): fixed formatting bug for |
|
3041 | 3056 | magic docstrings when printed via ? (explicit \'s were being |
|
3042 | 3057 | printed). |
|
3043 | 3058 | |
|
3044 | 3059 | * IPython/ipmaker.py (make_IPython): fixed namespace |
|
3045 | 3060 | identification bug. Now variables loaded via logs or command-line |
|
3046 | 3061 | files are recognized in the interactive namespace by @who. |
|
3047 | 3062 | |
|
3048 | 3063 | * IPython/iplib.py (InteractiveShell.safe_execfile): Fixed bug in |
|
3049 | 3064 | log replay system stemming from the string form of Structs. |
|
3050 | 3065 | |
|
3051 | 3066 | * IPython/Magic.py (Macro.__init__): improved macros to properly |
|
3052 | 3067 | handle magic commands in them. |
|
3053 | 3068 | (Magic.magic_logstart): usernames are now expanded so 'logstart |
|
3054 | 3069 | ~/mylog' now works. |
|
3055 | 3070 | |
|
3056 | 3071 | * IPython/iplib.py (complete): fixed bug where paths starting with |
|
3057 | 3072 | '/' would be completed as magic names. |
|
3058 | 3073 | |
|
3059 | 3074 | 2002-05-04 Fernando Perez <fperez@colorado.edu> |
|
3060 | 3075 | |
|
3061 | 3076 | * IPython/Magic.py (Magic.magic_run): added options -p and -f to |
|
3062 | 3077 | allow running full programs under the profiler's control. |
|
3063 | 3078 | |
|
3064 | 3079 | * IPython/ultraTB.py (FormattedTB.__init__): Added Verbose_novars |
|
3065 | 3080 | mode to report exceptions verbosely but without formatting |
|
3066 | 3081 | variables. This addresses the issue of ipython 'freezing' (it's |
|
3067 | 3082 | not frozen, but caught in an expensive formatting loop) when huge |
|
3068 | 3083 | variables are in the context of an exception. |
|
3069 | 3084 | (VerboseTB.text): Added '--->' markers at line where exception was |
|
3070 | 3085 | triggered. Much clearer to read, especially in NoColor modes. |
|
3071 | 3086 | |
|
3072 | 3087 | * IPython/Magic.py (Magic.magic_run): bugfix: -n option had been |
|
3073 | 3088 | implemented in reverse when changing to the new parse_options(). |
|
3074 | 3089 | |
|
3075 | 3090 | 2002-05-03 Fernando Perez <fperez@colorado.edu> |
|
3076 | 3091 | |
|
3077 | 3092 | * IPython/Magic.py (Magic.parse_options): new function so that |
|
3078 | 3093 | magics can parse options easier. |
|
3079 | 3094 | (Magic.magic_prun): new function similar to profile.run(), |
|
3080 | 3095 | suggested by Chris Hart. |
|
3081 | 3096 | (Magic.magic_cd): fixed behavior so that it only changes if |
|
3082 | 3097 | directory actually is in history. |
|
3083 | 3098 | |
|
3084 | 3099 | * IPython/usage.py (__doc__): added information about potential |
|
3085 | 3100 | slowness of Verbose exception mode when there are huge data |
|
3086 | 3101 | structures to be formatted (thanks to Archie Paulson). |
|
3087 | 3102 | |
|
3088 | 3103 | * IPython/ipmaker.py (make_IPython): Changed default logging |
|
3089 | 3104 | (when simply called with -log) to use curr_dir/ipython.log in |
|
3090 | 3105 | rotate mode. Fixed crash which was occuring with -log before |
|
3091 | 3106 | (thanks to Jim Boyle). |
|
3092 | 3107 | |
|
3093 | 3108 | 2002-05-01 Fernando Perez <fperez@colorado.edu> |
|
3094 | 3109 | |
|
3095 | 3110 | * Released 0.2.11 for these fixes (mainly the ultraTB one which |
|
3096 | 3111 | was nasty -- though somewhat of a corner case). |
|
3097 | 3112 | |
|
3098 | 3113 | * IPython/ultraTB.py (AutoFormattedTB.text): renamed __text to |
|
3099 | 3114 | text (was a bug). |
|
3100 | 3115 | |
|
3101 | 3116 | 2002-04-30 Fernando Perez <fperez@colorado.edu> |
|
3102 | 3117 | |
|
3103 | 3118 | * IPython/UserConfig/GnuplotMagic.py (magic_gp): Minor fix to add |
|
3104 | 3119 | a print after ^D or ^C from the user so that the In[] prompt |
|
3105 | 3120 | doesn't over-run the gnuplot one. |
|
3106 | 3121 | |
|
3107 | 3122 | 2002-04-29 Fernando Perez <fperez@colorado.edu> |
|
3108 | 3123 | |
|
3109 | 3124 | * Released 0.2.10 |
|
3110 | 3125 | |
|
3111 | 3126 | * IPython/__release__.py (version): get date dynamically. |
|
3112 | 3127 | |
|
3113 | 3128 | * Misc. documentation updates thanks to Arnd's comments. Also ran |
|
3114 | 3129 | a full spellcheck on the manual (hadn't been done in a while). |
|
3115 | 3130 | |
|
3116 | 3131 | 2002-04-27 Fernando Perez <fperez@colorado.edu> |
|
3117 | 3132 | |
|
3118 | 3133 | * IPython/Magic.py (Magic.magic_logstart): Fixed bug where |
|
3119 | 3134 | starting a log in mid-session would reset the input history list. |
|
3120 | 3135 | |
|
3121 | 3136 | 2002-04-26 Fernando Perez <fperez@colorado.edu> |
|
3122 | 3137 | |
|
3123 | 3138 | * IPython/iplib.py (InteractiveShell.wait): Fixed bug where not |
|
3124 | 3139 | all files were being included in an update. Now anything in |
|
3125 | 3140 | UserConfig that matches [A-Za-z]*.py will go (this excludes |
|
3126 | 3141 | __init__.py) |
|
3127 | 3142 | |
|
3128 | 3143 | 2002-04-25 Fernando Perez <fperez@colorado.edu> |
|
3129 | 3144 | |
|
3130 | 3145 | * IPython/iplib.py (InteractiveShell.__init__): Added __IPYTHON__ |
|
3131 | 3146 | to __builtins__ so that any form of embedded or imported code can |
|
3132 | 3147 | test for being inside IPython. |
|
3133 | 3148 | |
|
3134 | 3149 | * IPython/UserConfig/GnuplotMagic.py: (magic_gp_set_instance): |
|
3135 | 3150 | changed to GnuplotMagic because it's now an importable module, |
|
3136 | 3151 | this makes the name follow that of the standard Gnuplot module. |
|
3137 | 3152 | GnuplotMagic can now be loaded at any time in mid-session. |
|
3138 | 3153 | |
|
3139 | 3154 | 2002-04-24 Fernando Perez <fperez@colorado.edu> |
|
3140 | 3155 | |
|
3141 | 3156 | * IPython/numutils.py: removed SIUnits. It doesn't properly set |
|
3142 | 3157 | the globals (IPython has its own namespace) and the |
|
3143 | 3158 | PhysicalQuantity stuff is much better anyway. |
|
3144 | 3159 | |
|
3145 | 3160 | * IPython/UserConfig/example-gnuplot.py (g2): Added gnuplot |
|
3146 | 3161 | embedding example to standard user directory for |
|
3147 | 3162 | distribution. Also put it in the manual. |
|
3148 | 3163 | |
|
3149 | 3164 | * IPython/numutils.py (gnuplot_exec): Changed to take a gnuplot |
|
3150 | 3165 | instance as first argument (so it doesn't rely on some obscure |
|
3151 | 3166 | hidden global). |
|
3152 | 3167 | |
|
3153 | 3168 | * IPython/UserConfig/ipythonrc.py: put () back in accepted |
|
3154 | 3169 | delimiters. While it prevents ().TAB from working, it allows |
|
3155 | 3170 | completions in open (... expressions. This is by far a more common |
|
3156 | 3171 | case. |
|
3157 | 3172 | |
|
3158 | 3173 | 2002-04-23 Fernando Perez <fperez@colorado.edu> |
|
3159 | 3174 | |
|
3160 | 3175 | * IPython/Extensions/InterpreterPasteInput.py: new |
|
3161 | 3176 | syntax-processing module for pasting lines with >>> or ... at the |
|
3162 | 3177 | start. |
|
3163 | 3178 | |
|
3164 | 3179 | * IPython/Extensions/PhysicalQ_Interactive.py |
|
3165 | 3180 | (PhysicalQuantityInteractive.__int__): fixed to work with either |
|
3166 | 3181 | Numeric or math. |
|
3167 | 3182 | |
|
3168 | 3183 | * IPython/UserConfig/ipythonrc-numeric.py: reorganized the |
|
3169 | 3184 | provided profiles. Now we have: |
|
3170 | 3185 | -math -> math module as * and cmath with its own namespace. |
|
3171 | 3186 | -numeric -> Numeric as *, plus gnuplot & grace |
|
3172 | 3187 | -physics -> same as before |
|
3173 | 3188 | |
|
3174 | 3189 | * IPython/Magic.py (Magic.magic_magic): Fixed bug where |
|
3175 | 3190 | user-defined magics wouldn't be found by @magic if they were |
|
3176 | 3191 | defined as class methods. Also cleaned up the namespace search |
|
3177 | 3192 | logic and the string building (to use %s instead of many repeated |
|
3178 | 3193 | string adds). |
|
3179 | 3194 | |
|
3180 | 3195 | * IPython/UserConfig/example-magic.py (magic_foo): updated example |
|
3181 | 3196 | of user-defined magics to operate with class methods (cleaner, in |
|
3182 | 3197 | line with the gnuplot code). |
|
3183 | 3198 | |
|
3184 | 3199 | 2002-04-22 Fernando Perez <fperez@colorado.edu> |
|
3185 | 3200 | |
|
3186 | 3201 | * setup.py: updated dependency list so that manual is updated when |
|
3187 | 3202 | all included files change. |
|
3188 | 3203 | |
|
3189 | 3204 | * IPython/ipmaker.py (make_IPython): Fixed bug which was ignoring |
|
3190 | 3205 | the delimiter removal option (the fix is ugly right now). |
|
3191 | 3206 | |
|
3192 | 3207 | * IPython/UserConfig/ipythonrc-physics.py: simplified not to load |
|
3193 | 3208 | all of the math profile (quicker loading, no conflict between |
|
3194 | 3209 | g-9.8 and g-gnuplot). |
|
3195 | 3210 | |
|
3196 | 3211 | * IPython/CrashHandler.py (CrashHandler.__call__): changed default |
|
3197 | 3212 | name of post-mortem files to IPython_crash_report.txt. |
|
3198 | 3213 | |
|
3199 | 3214 | * Cleanup/update of the docs. Added all the new readline info and |
|
3200 | 3215 | formatted all lists as 'real lists'. |
|
3201 | 3216 | |
|
3202 | 3217 | * IPython/ipmaker.py (make_IPython): removed now-obsolete |
|
3203 | 3218 | tab-completion options, since the full readline parse_and_bind is |
|
3204 | 3219 | now accessible. |
|
3205 | 3220 | |
|
3206 | 3221 | * IPython/iplib.py (InteractiveShell.init_readline): Changed |
|
3207 | 3222 | handling of readline options. Now users can specify any string to |
|
3208 | 3223 | be passed to parse_and_bind(), as well as the delimiters to be |
|
3209 | 3224 | removed. |
|
3210 | 3225 | (InteractiveShell.__init__): Added __name__ to the global |
|
3211 | 3226 | namespace so that things like Itpl which rely on its existence |
|
3212 | 3227 | don't crash. |
|
3213 | 3228 | (InteractiveShell._prefilter): Defined the default with a _ so |
|
3214 | 3229 | that prefilter() is easier to override, while the default one |
|
3215 | 3230 | remains available. |
|
3216 | 3231 | |
|
3217 | 3232 | 2002-04-18 Fernando Perez <fperez@colorado.edu> |
|
3218 | 3233 | |
|
3219 | 3234 | * Added information about pdb in the docs. |
|
3220 | 3235 | |
|
3221 | 3236 | 2002-04-17 Fernando Perez <fperez@colorado.edu> |
|
3222 | 3237 | |
|
3223 | 3238 | * IPython/ipmaker.py (make_IPython): added rc_override option to |
|
3224 | 3239 | allow passing config options at creation time which may override |
|
3225 | 3240 | anything set in the config files or command line. This is |
|
3226 | 3241 | particularly useful for configuring embedded instances. |
|
3227 | 3242 | |
|
3228 | 3243 | 2002-04-15 Fernando Perez <fperez@colorado.edu> |
|
3229 | 3244 | |
|
3230 | 3245 | * IPython/Logger.py (Logger.log): Fixed a nasty bug which could |
|
3231 | 3246 | crash embedded instances because of the input cache falling out of |
|
3232 | 3247 | sync with the output counter. |
|
3233 | 3248 | |
|
3234 | 3249 | * IPython/Shell.py (IPythonShellEmbed.__init__): added a debug |
|
3235 | 3250 | mode which calls pdb after an uncaught exception in IPython itself. |
|
3236 | 3251 | |
|
3237 | 3252 | 2002-04-14 Fernando Perez <fperez@colorado.edu> |
|
3238 | 3253 | |
|
3239 | 3254 | * IPython/iplib.py (InteractiveShell.showtraceback): pdb mucks up |
|
3240 | 3255 | readline, fix it back after each call. |
|
3241 | 3256 | |
|
3242 | 3257 | * IPython/ultraTB.py (AutoFormattedTB.__text): made text a private |
|
3243 | 3258 | method to force all access via __call__(), which guarantees that |
|
3244 | 3259 | traceback references are properly deleted. |
|
3245 | 3260 | |
|
3246 | 3261 | * IPython/Prompts.py (CachedOutput._display): minor fixes to |
|
3247 | 3262 | improve printing when pprint is in use. |
|
3248 | 3263 | |
|
3249 | 3264 | 2002-04-13 Fernando Perez <fperez@colorado.edu> |
|
3250 | 3265 | |
|
3251 | 3266 | * IPython/Shell.py (IPythonShellEmbed.__call__): SystemExit |
|
3252 | 3267 | exceptions aren't caught anymore. If the user triggers one, he |
|
3253 | 3268 | should know why he's doing it and it should go all the way up, |
|
3254 | 3269 | just like any other exception. So now @abort will fully kill the |
|
3255 | 3270 | embedded interpreter and the embedding code (unless that happens |
|
3256 | 3271 | to catch SystemExit). |
|
3257 | 3272 | |
|
3258 | 3273 | * IPython/ultraTB.py (VerboseTB.__init__): added a call_pdb flag |
|
3259 | 3274 | and a debugger() method to invoke the interactive pdb debugger |
|
3260 | 3275 | after printing exception information. Also added the corresponding |
|
3261 | 3276 | -pdb option and @pdb magic to control this feature, and updated |
|
3262 | 3277 | the docs. After a suggestion from Christopher Hart |
|
3263 | 3278 | (hart-AT-caltech.edu). |
|
3264 | 3279 | |
|
3265 | 3280 | 2002-04-12 Fernando Perez <fperez@colorado.edu> |
|
3266 | 3281 | |
|
3267 | 3282 | * IPython/Shell.py (IPythonShellEmbed.__init__): modified to use |
|
3268 | 3283 | the exception handlers defined by the user (not the CrashHandler) |
|
3269 | 3284 | so that user exceptions don't trigger an ipython bug report. |
|
3270 | 3285 | |
|
3271 | 3286 | * IPython/ultraTB.py (ColorTB.__init__): made the color scheme |
|
3272 | 3287 | configurable (it should have always been so). |
|
3273 | 3288 | |
|
3274 | 3289 | 2002-03-26 Fernando Perez <fperez@colorado.edu> |
|
3275 | 3290 | |
|
3276 | 3291 | * IPython/Shell.py (IPythonShellEmbed.__call__): many changes here |
|
3277 | 3292 | and there to fix embedding namespace issues. This should all be |
|
3278 | 3293 | done in a more elegant way. |
|
3279 | 3294 | |
|
3280 | 3295 | 2002-03-25 Fernando Perez <fperez@colorado.edu> |
|
3281 | 3296 | |
|
3282 | 3297 | * IPython/genutils.py (get_home_dir): Try to make it work under |
|
3283 | 3298 | win9x also. |
|
3284 | 3299 | |
|
3285 | 3300 | 2002-03-20 Fernando Perez <fperez@colorado.edu> |
|
3286 | 3301 | |
|
3287 | 3302 | * IPython/Shell.py (IPythonShellEmbed.__init__): leave |
|
3288 | 3303 | sys.displayhook untouched upon __init__. |
|
3289 | 3304 | |
|
3290 | 3305 | 2002-03-19 Fernando Perez <fperez@colorado.edu> |
|
3291 | 3306 | |
|
3292 | 3307 | * Released 0.2.9 (for embedding bug, basically). |
|
3293 | 3308 | |
|
3294 | 3309 | * IPython/Shell.py (IPythonShellEmbed.__call__): Trap SystemExit |
|
3295 | 3310 | exceptions so that enclosing shell's state can be restored. |
|
3296 | 3311 | |
|
3297 | 3312 | * Changed magic_gnuplot.py to magic-gnuplot.py to standardize |
|
3298 | 3313 | naming conventions in the .ipython/ dir. |
|
3299 | 3314 | |
|
3300 | 3315 | * IPython/iplib.py (InteractiveShell.init_readline): removed '-' |
|
3301 | 3316 | from delimiters list so filenames with - in them get expanded. |
|
3302 | 3317 | |
|
3303 | 3318 | * IPython/Shell.py (IPythonShellEmbed.__call__): fixed bug with |
|
3304 | 3319 | sys.displayhook not being properly restored after an embedded call. |
|
3305 | 3320 | |
|
3306 | 3321 | 2002-03-18 Fernando Perez <fperez@colorado.edu> |
|
3307 | 3322 | |
|
3308 | 3323 | * Released 0.2.8 |
|
3309 | 3324 | |
|
3310 | 3325 | * IPython/iplib.py (InteractiveShell.user_setup): fixed bug where |
|
3311 | 3326 | some files weren't being included in a -upgrade. |
|
3312 | 3327 | (InteractiveShell.init_readline): Added 'set show-all-if-ambiguous |
|
3313 | 3328 | on' so that the first tab completes. |
|
3314 | 3329 | (InteractiveShell.handle_magic): fixed bug with spaces around |
|
3315 | 3330 | quotes breaking many magic commands. |
|
3316 | 3331 | |
|
3317 | 3332 | * setup.py: added note about ignoring the syntax error messages at |
|
3318 | 3333 | installation. |
|
3319 | 3334 | |
|
3320 | 3335 | * IPython/UserConfig/magic_gnuplot.py (magic_gp): finished |
|
3321 | 3336 | streamlining the gnuplot interface, now there's only one magic @gp. |
|
3322 | 3337 | |
|
3323 | 3338 | 2002-03-17 Fernando Perez <fperez@colorado.edu> |
|
3324 | 3339 | |
|
3325 | 3340 | * IPython/UserConfig/magic_gnuplot.py: new name for the |
|
3326 | 3341 | example-magic_pm.py file. Much enhanced system, now with a shell |
|
3327 | 3342 | for communicating directly with gnuplot, one command at a time. |
|
3328 | 3343 | |
|
3329 | 3344 | * IPython/Magic.py (Magic.magic_run): added option -n to prevent |
|
3330 | 3345 | setting __name__=='__main__'. |
|
3331 | 3346 | |
|
3332 | 3347 | * IPython/UserConfig/example-magic_pm.py (magic_pm): Added |
|
3333 | 3348 | mini-shell for accessing gnuplot from inside ipython. Should |
|
3334 | 3349 | extend it later for grace access too. Inspired by Arnd's |
|
3335 | 3350 | suggestion. |
|
3336 | 3351 | |
|
3337 | 3352 | * IPython/iplib.py (InteractiveShell.handle_magic): fixed bug when |
|
3338 | 3353 | calling magic functions with () in their arguments. Thanks to Arnd |
|
3339 | 3354 | Baecker for pointing this to me. |
|
3340 | 3355 | |
|
3341 | 3356 | * IPython/numutils.py (sum_flat): fixed bug. Would recurse |
|
3342 | 3357 | infinitely for integer or complex arrays (only worked with floats). |
|
3343 | 3358 | |
|
3344 | 3359 | 2002-03-16 Fernando Perez <fperez@colorado.edu> |
|
3345 | 3360 | |
|
3346 | 3361 | * setup.py: Merged setup and setup_windows into a single script |
|
3347 | 3362 | which properly handles things for windows users. |
|
3348 | 3363 | |
|
3349 | 3364 | 2002-03-15 Fernando Perez <fperez@colorado.edu> |
|
3350 | 3365 | |
|
3351 | 3366 | * Big change to the manual: now the magics are all automatically |
|
3352 | 3367 | documented. This information is generated from their docstrings |
|
3353 | 3368 | and put in a latex file included by the manual lyx file. This way |
|
3354 | 3369 | we get always up to date information for the magics. The manual |
|
3355 | 3370 | now also has proper version information, also auto-synced. |
|
3356 | 3371 | |
|
3357 | 3372 | For this to work, an undocumented --magic_docstrings option was added. |
|
3358 | 3373 | |
|
3359 | 3374 | 2002-03-13 Fernando Perez <fperez@colorado.edu> |
|
3360 | 3375 | |
|
3361 | 3376 | * IPython/ultraTB.py (TermColors): fixed problem with dark colors |
|
3362 | 3377 | under CDE terminals. An explicit ;2 color reset is needed in the escapes. |
|
3363 | 3378 | |
|
3364 | 3379 | 2002-03-12 Fernando Perez <fperez@colorado.edu> |
|
3365 | 3380 | |
|
3366 | 3381 | * IPython/ultraTB.py (TermColors): changed color escapes again to |
|
3367 | 3382 | fix the (old, reintroduced) line-wrapping bug. Basically, if |
|
3368 | 3383 | \001..\002 aren't given in the color escapes, lines get wrapped |
|
3369 | 3384 | weirdly. But giving those screws up old xterms and emacs terms. So |
|
3370 | 3385 | I added some logic for emacs terms to be ok, but I can't identify old |
|
3371 | 3386 | xterms separately ($TERM=='xterm' for many terminals, like konsole). |
|
3372 | 3387 | |
|
3373 | 3388 | 2002-03-10 Fernando Perez <fperez@colorado.edu> |
|
3374 | 3389 | |
|
3375 | 3390 | * IPython/usage.py (__doc__): Various documentation cleanups and |
|
3376 | 3391 | updates, both in usage docstrings and in the manual. |
|
3377 | 3392 | |
|
3378 | 3393 | * IPython/Prompts.py (CachedOutput.set_colors): cleanups for |
|
3379 | 3394 | handling of caching. Set minimum acceptabe value for having a |
|
3380 | 3395 | cache at 20 values. |
|
3381 | 3396 | |
|
3382 | 3397 | * IPython/iplib.py (InteractiveShell.user_setup): moved the |
|
3383 | 3398 | install_first_time function to a method, renamed it and added an |
|
3384 | 3399 | 'upgrade' mode. Now people can update their config directory with |
|
3385 | 3400 | a simple command line switch (-upgrade, also new). |
|
3386 | 3401 | |
|
3387 | 3402 | * IPython/Magic.py (Magic.magic_pfile): Made @pfile an alias to |
|
3388 | 3403 | @file (convenient for automagic users under Python >= 2.2). |
|
3389 | 3404 | Removed @files (it seemed more like a plural than an abbrev. of |
|
3390 | 3405 | 'file show'). |
|
3391 | 3406 | |
|
3392 | 3407 | * IPython/iplib.py (install_first_time): Fixed crash if there were |
|
3393 | 3408 | backup files ('~') in .ipython/ install directory. |
|
3394 | 3409 | |
|
3395 | 3410 | * IPython/ipmaker.py (make_IPython): fixes for new prompt |
|
3396 | 3411 | system. Things look fine, but these changes are fairly |
|
3397 | 3412 | intrusive. Test them for a few days. |
|
3398 | 3413 | |
|
3399 | 3414 | * IPython/Prompts.py (CachedOutput.__init__): Massive rewrite of |
|
3400 | 3415 | the prompts system. Now all in/out prompt strings are user |
|
3401 | 3416 | controllable. This is particularly useful for embedding, as one |
|
3402 | 3417 | can tag embedded instances with particular prompts. |
|
3403 | 3418 | |
|
3404 | 3419 | Also removed global use of sys.ps1/2, which now allows nested |
|
3405 | 3420 | embeddings without any problems. Added command-line options for |
|
3406 | 3421 | the prompt strings. |
|
3407 | 3422 | |
|
3408 | 3423 | 2002-03-08 Fernando Perez <fperez@colorado.edu> |
|
3409 | 3424 | |
|
3410 | 3425 | * IPython/UserConfig/example-embed-short.py (ipshell): added |
|
3411 | 3426 | example file with the bare minimum code for embedding. |
|
3412 | 3427 | |
|
3413 | 3428 | * IPython/Shell.py (IPythonShellEmbed.set_dummy_mode): added |
|
3414 | 3429 | functionality for the embeddable shell to be activated/deactivated |
|
3415 | 3430 | either globally or at each call. |
|
3416 | 3431 | |
|
3417 | 3432 | * IPython/Prompts.py (Prompt1.auto_rewrite): Fixes the problem of |
|
3418 | 3433 | rewriting the prompt with '--->' for auto-inputs with proper |
|
3419 | 3434 | coloring. Now the previous UGLY hack in handle_auto() is gone, and |
|
3420 | 3435 | this is handled by the prompts class itself, as it should. |
|
3421 | 3436 | |
|
3422 | 3437 | 2002-03-05 Fernando Perez <fperez@colorado.edu> |
|
3423 | 3438 | |
|
3424 | 3439 | * IPython/Magic.py (Magic.magic_logstart): Changed @log to |
|
3425 | 3440 | @logstart to avoid name clashes with the math log function. |
|
3426 | 3441 | |
|
3427 | 3442 | * Big updates to X/Emacs section of the manual. |
|
3428 | 3443 | |
|
3429 | 3444 | * Removed ipython_emacs. Milan explained to me how to pass |
|
3430 | 3445 | arguments to ipython through Emacs. Some day I'm going to end up |
|
3431 | 3446 | learning some lisp... |
|
3432 | 3447 | |
|
3433 | 3448 | 2002-03-04 Fernando Perez <fperez@colorado.edu> |
|
3434 | 3449 | |
|
3435 | 3450 | * IPython/ipython_emacs: Created script to be used as the |
|
3436 | 3451 | py-python-command Emacs variable so we can pass IPython |
|
3437 | 3452 | parameters. I can't figure out how to tell Emacs directly to pass |
|
3438 | 3453 | parameters to IPython, so a dummy shell script will do it. |
|
3439 | 3454 | |
|
3440 | 3455 | Other enhancements made for things to work better under Emacs' |
|
3441 | 3456 | various types of terminals. Many thanks to Milan Zamazal |
|
3442 | 3457 | <pdm-AT-zamazal.org> for all the suggestions and pointers. |
|
3443 | 3458 | |
|
3444 | 3459 | 2002-03-01 Fernando Perez <fperez@colorado.edu> |
|
3445 | 3460 | |
|
3446 | 3461 | * IPython/ipmaker.py (make_IPython): added a --readline! option so |
|
3447 | 3462 | that loading of readline is now optional. This gives better |
|
3448 | 3463 | control to emacs users. |
|
3449 | 3464 | |
|
3450 | 3465 | * IPython/ultraTB.py (__date__): Modified color escape sequences |
|
3451 | 3466 | and now things work fine under xterm and in Emacs' term buffers |
|
3452 | 3467 | (though not shell ones). Well, in emacs you get colors, but all |
|
3453 | 3468 | seem to be 'light' colors (no difference between dark and light |
|
3454 | 3469 | ones). But the garbage chars are gone, and also in xterms. It |
|
3455 | 3470 | seems that now I'm using 'cleaner' ansi sequences. |
|
3456 | 3471 | |
|
3457 | 3472 | 2002-02-21 Fernando Perez <fperez@colorado.edu> |
|
3458 | 3473 | |
|
3459 | 3474 | * Released 0.2.7 (mainly to publish the scoping fix). |
|
3460 | 3475 | |
|
3461 | 3476 | * IPython/Logger.py (Logger.logstate): added. A corresponding |
|
3462 | 3477 | @logstate magic was created. |
|
3463 | 3478 | |
|
3464 | 3479 | * IPython/Magic.py: fixed nested scoping problem under Python |
|
3465 | 3480 | 2.1.x (automagic wasn't working). |
|
3466 | 3481 | |
|
3467 | 3482 | 2002-02-20 Fernando Perez <fperez@colorado.edu> |
|
3468 | 3483 | |
|
3469 | 3484 | * Released 0.2.6. |
|
3470 | 3485 | |
|
3471 | 3486 | * IPython/OutputTrap.py (OutputTrap.__init__): added a 'quiet' |
|
3472 | 3487 | option so that logs can come out without any headers at all. |
|
3473 | 3488 | |
|
3474 | 3489 | * IPython/UserConfig/ipythonrc-scipy.py: created a profile for |
|
3475 | 3490 | SciPy. |
|
3476 | 3491 | |
|
3477 | 3492 | * IPython/iplib.py (InteractiveShell.embed_mainloop): Changed so |
|
3478 | 3493 | that embedded IPython calls don't require vars() to be explicitly |
|
3479 | 3494 | passed. Now they are extracted from the caller's frame (code |
|
3480 | 3495 | snatched from Eric Jones' weave). Added better documentation to |
|
3481 | 3496 | the section on embedding and the example file. |
|
3482 | 3497 | |
|
3483 | 3498 | * IPython/genutils.py (page): Changed so that under emacs, it just |
|
3484 | 3499 | prints the string. You can then page up and down in the emacs |
|
3485 | 3500 | buffer itself. This is how the builtin help() works. |
|
3486 | 3501 | |
|
3487 | 3502 | * IPython/Prompts.py (CachedOutput.__call__): Fixed issue with |
|
3488 | 3503 | macro scoping: macros need to be executed in the user's namespace |
|
3489 | 3504 | to work as if they had been typed by the user. |
|
3490 | 3505 | |
|
3491 | 3506 | * IPython/Magic.py (Magic.magic_macro): Changed macros so they |
|
3492 | 3507 | execute automatically (no need to type 'exec...'). They then |
|
3493 | 3508 | behave like 'true macros'. The printing system was also modified |
|
3494 | 3509 | for this to work. |
|
3495 | 3510 | |
|
3496 | 3511 | 2002-02-19 Fernando Perez <fperez@colorado.edu> |
|
3497 | 3512 | |
|
3498 | 3513 | * IPython/genutils.py (page_file): new function for paging files |
|
3499 | 3514 | in an OS-independent way. Also necessary for file viewing to work |
|
3500 | 3515 | well inside Emacs buffers. |
|
3501 | 3516 | (page): Added checks for being in an emacs buffer. |
|
3502 | 3517 | (page): fixed bug for Windows ($TERM isn't set in Windows). Fixed |
|
3503 | 3518 | same bug in iplib. |
|
3504 | 3519 | |
|
3505 | 3520 | 2002-02-18 Fernando Perez <fperez@colorado.edu> |
|
3506 | 3521 | |
|
3507 | 3522 | * IPython/iplib.py (InteractiveShell.init_readline): modified use |
|
3508 | 3523 | of readline so that IPython can work inside an Emacs buffer. |
|
3509 | 3524 | |
|
3510 | 3525 | * IPython/ultraTB.py (AutoFormattedTB.__call__): some fixes to |
|
3511 | 3526 | method signatures (they weren't really bugs, but it looks cleaner |
|
3512 | 3527 | and keeps PyChecker happy). |
|
3513 | 3528 | |
|
3514 | 3529 | * IPython/ipmaker.py (make_IPython): added hooks Struct to __IP |
|
3515 | 3530 | for implementing various user-defined hooks. Currently only |
|
3516 | 3531 | display is done. |
|
3517 | 3532 | |
|
3518 | 3533 | * IPython/Prompts.py (CachedOutput._display): changed display |
|
3519 | 3534 | functions so that they can be dynamically changed by users easily. |
|
3520 | 3535 | |
|
3521 | 3536 | * IPython/Extensions/numeric_formats.py (num_display): added an |
|
3522 | 3537 | extension for printing NumPy arrays in flexible manners. It |
|
3523 | 3538 | doesn't do anything yet, but all the structure is in |
|
3524 | 3539 | place. Ultimately the plan is to implement output format control |
|
3525 | 3540 | like in Octave. |
|
3526 | 3541 | |
|
3527 | 3542 | * IPython/Magic.py (Magic.lsmagic): changed so that bound magic |
|
3528 | 3543 | methods are found at run-time by all the automatic machinery. |
|
3529 | 3544 | |
|
3530 | 3545 | 2002-02-17 Fernando Perez <fperez@colorado.edu> |
|
3531 | 3546 | |
|
3532 | 3547 | * setup_Windows.py (make_shortcut): documented. Cleaned up the |
|
3533 | 3548 | whole file a little. |
|
3534 | 3549 | |
|
3535 | 3550 | * ToDo: closed this document. Now there's a new_design.lyx |
|
3536 | 3551 | document for all new ideas. Added making a pdf of it for the |
|
3537 | 3552 | end-user distro. |
|
3538 | 3553 | |
|
3539 | 3554 | * IPython/Logger.py (Logger.switch_log): Created this to replace |
|
3540 | 3555 | logon() and logoff(). It also fixes a nasty crash reported by |
|
3541 | 3556 | Philip Hisley <compsys-AT-starpower.net>. Many thanks to him. |
|
3542 | 3557 | |
|
3543 | 3558 | * IPython/iplib.py (complete): got auto-completion to work with |
|
3544 | 3559 | automagic (I had wanted this for a long time). |
|
3545 | 3560 | |
|
3546 | 3561 | * IPython/Magic.py (Magic.magic_files): Added @files as an alias |
|
3547 | 3562 | to @file, since file() is now a builtin and clashes with automagic |
|
3548 | 3563 | for @file. |
|
3549 | 3564 | |
|
3550 | 3565 | * Made some new files: Prompts, CrashHandler, Magic, Logger. All |
|
3551 | 3566 | of this was previously in iplib, which had grown to more than 2000 |
|
3552 | 3567 | lines, way too long. No new functionality, but it makes managing |
|
3553 | 3568 | the code a bit easier. |
|
3554 | 3569 | |
|
3555 | 3570 | * IPython/iplib.py (IPythonCrashHandler.__call__): Added version |
|
3556 | 3571 | information to crash reports. |
|
3557 | 3572 | |
|
3558 | 3573 | 2002-02-12 Fernando Perez <fperez@colorado.edu> |
|
3559 | 3574 | |
|
3560 | 3575 | * Released 0.2.5. |
|
3561 | 3576 | |
|
3562 | 3577 | 2002-02-11 Fernando Perez <fperez@colorado.edu> |
|
3563 | 3578 | |
|
3564 | 3579 | * Wrote a relatively complete Windows installer. It puts |
|
3565 | 3580 | everything in place, creates Start Menu entries and fixes the |
|
3566 | 3581 | color issues. Nothing fancy, but it works. |
|
3567 | 3582 | |
|
3568 | 3583 | 2002-02-10 Fernando Perez <fperez@colorado.edu> |
|
3569 | 3584 | |
|
3570 | 3585 | * IPython/iplib.py (InteractiveShell.safe_execfile): added an |
|
3571 | 3586 | os.path.expanduser() call so that we can type @run ~/myfile.py and |
|
3572 | 3587 | have thigs work as expected. |
|
3573 | 3588 | |
|
3574 | 3589 | * IPython/genutils.py (page): fixed exception handling so things |
|
3575 | 3590 | work both in Unix and Windows correctly. Quitting a pager triggers |
|
3576 | 3591 | an IOError/broken pipe in Unix, and in windows not finding a pager |
|
3577 | 3592 | is also an IOError, so I had to actually look at the return value |
|
3578 | 3593 | of the exception, not just the exception itself. Should be ok now. |
|
3579 | 3594 | |
|
3580 | 3595 | * IPython/ultraTB.py (ColorSchemeTable.set_active_scheme): |
|
3581 | 3596 | modified to allow case-insensitive color scheme changes. |
|
3582 | 3597 | |
|
3583 | 3598 | 2002-02-09 Fernando Perez <fperez@colorado.edu> |
|
3584 | 3599 | |
|
3585 | 3600 | * IPython/genutils.py (native_line_ends): new function to leave |
|
3586 | 3601 | user config files with os-native line-endings. |
|
3587 | 3602 | |
|
3588 | 3603 | * README and manual updates. |
|
3589 | 3604 | |
|
3590 | 3605 | * IPython/genutils.py: fixed unicode bug: use types.StringTypes |
|
3591 | 3606 | instead of StringType to catch Unicode strings. |
|
3592 | 3607 | |
|
3593 | 3608 | * IPython/genutils.py (filefind): fixed bug for paths with |
|
3594 | 3609 | embedded spaces (very common in Windows). |
|
3595 | 3610 | |
|
3596 | 3611 | * IPython/ipmaker.py (make_IPython): added a '.ini' to the rc |
|
3597 | 3612 | files under Windows, so that they get automatically associated |
|
3598 | 3613 | with a text editor. Windows makes it a pain to handle |
|
3599 | 3614 | extension-less files. |
|
3600 | 3615 | |
|
3601 | 3616 | * IPython/iplib.py (InteractiveShell.init_readline): Made the |
|
3602 | 3617 | warning about readline only occur for Posix. In Windows there's no |
|
3603 | 3618 | way to get readline, so why bother with the warning. |
|
3604 | 3619 | |
|
3605 | 3620 | * IPython/Struct.py (Struct.__str__): fixed to use self.__dict__ |
|
3606 | 3621 | for __str__ instead of dir(self), since dir() changed in 2.2. |
|
3607 | 3622 | |
|
3608 | 3623 | * Ported to Windows! Tested on XP, I suspect it should work fine |
|
3609 | 3624 | on NT/2000, but I don't think it will work on 98 et al. That |
|
3610 | 3625 | series of Windows is such a piece of junk anyway that I won't try |
|
3611 | 3626 | porting it there. The XP port was straightforward, showed a few |
|
3612 | 3627 | bugs here and there (fixed all), in particular some string |
|
3613 | 3628 | handling stuff which required considering Unicode strings (which |
|
3614 | 3629 | Windows uses). This is good, but hasn't been too tested :) No |
|
3615 | 3630 | fancy installer yet, I'll put a note in the manual so people at |
|
3616 | 3631 | least make manually a shortcut. |
|
3617 | 3632 | |
|
3618 | 3633 | * IPython/iplib.py (Magic.magic_colors): Unified the color options |
|
3619 | 3634 | into a single one, "colors". This now controls both prompt and |
|
3620 | 3635 | exception color schemes, and can be changed both at startup |
|
3621 | 3636 | (either via command-line switches or via ipythonrc files) and at |
|
3622 | 3637 | runtime, with @colors. |
|
3623 | 3638 | (Magic.magic_run): renamed @prun to @run and removed the old |
|
3624 | 3639 | @run. The two were too similar to warrant keeping both. |
|
3625 | 3640 | |
|
3626 | 3641 | 2002-02-03 Fernando Perez <fperez@colorado.edu> |
|
3627 | 3642 | |
|
3628 | 3643 | * IPython/iplib.py (install_first_time): Added comment on how to |
|
3629 | 3644 | configure the color options for first-time users. Put a <return> |
|
3630 | 3645 | request at the end so that small-terminal users get a chance to |
|
3631 | 3646 | read the startup info. |
|
3632 | 3647 | |
|
3633 | 3648 | 2002-01-23 Fernando Perez <fperez@colorado.edu> |
|
3634 | 3649 | |
|
3635 | 3650 | * IPython/iplib.py (CachedOutput.update): Changed output memory |
|
3636 | 3651 | variable names from _o,_oo,_ooo,_o<n> to simply _,__,___,_<n>. For |
|
3637 | 3652 | input history we still use _i. Did this b/c these variable are |
|
3638 | 3653 | very commonly used in interactive work, so the less we need to |
|
3639 | 3654 | type the better off we are. |
|
3640 | 3655 | (Magic.magic_prun): updated @prun to better handle the namespaces |
|
3641 | 3656 | the file will run in, including a fix for __name__ not being set |
|
3642 | 3657 | before. |
|
3643 | 3658 | |
|
3644 | 3659 | 2002-01-20 Fernando Perez <fperez@colorado.edu> |
|
3645 | 3660 | |
|
3646 | 3661 | * IPython/ultraTB.py (VerboseTB.linereader): Fixed printing of |
|
3647 | 3662 | extra garbage for Python 2.2. Need to look more carefully into |
|
3648 | 3663 | this later. |
|
3649 | 3664 | |
|
3650 | 3665 | 2002-01-19 Fernando Perez <fperez@colorado.edu> |
|
3651 | 3666 | |
|
3652 | 3667 | * IPython/iplib.py (InteractiveShell.showtraceback): fixed to |
|
3653 | 3668 | display SyntaxError exceptions properly formatted when they occur |
|
3654 | 3669 | (they can be triggered by imported code). |
|
3655 | 3670 | |
|
3656 | 3671 | 2002-01-18 Fernando Perez <fperez@colorado.edu> |
|
3657 | 3672 | |
|
3658 | 3673 | * IPython/iplib.py (InteractiveShell.safe_execfile): now |
|
3659 | 3674 | SyntaxError exceptions are reported nicely formatted, instead of |
|
3660 | 3675 | spitting out only offset information as before. |
|
3661 | 3676 | (Magic.magic_prun): Added the @prun function for executing |
|
3662 | 3677 | programs with command line args inside IPython. |
|
3663 | 3678 | |
|
3664 | 3679 | 2002-01-16 Fernando Perez <fperez@colorado.edu> |
|
3665 | 3680 | |
|
3666 | 3681 | * IPython/iplib.py (Magic.magic_hist): Changed @hist and @dhist |
|
3667 | 3682 | to *not* include the last item given in a range. This brings their |
|
3668 | 3683 | behavior in line with Python's slicing: |
|
3669 | 3684 | a[n1:n2] -> a[n1]...a[n2-1] |
|
3670 | 3685 | It may be a bit less convenient, but I prefer to stick to Python's |
|
3671 | 3686 | conventions *everywhere*, so users never have to wonder. |
|
3672 | 3687 | (Magic.magic_macro): Added @macro function to ease the creation of |
|
3673 | 3688 | macros. |
|
3674 | 3689 | |
|
3675 | 3690 | 2002-01-05 Fernando Perez <fperez@colorado.edu> |
|
3676 | 3691 | |
|
3677 | 3692 | * Released 0.2.4. |
|
3678 | 3693 | |
|
3679 | 3694 | * IPython/iplib.py (Magic.magic_pdef): |
|
3680 | 3695 | (InteractiveShell.safe_execfile): report magic lines and error |
|
3681 | 3696 | lines without line numbers so one can easily copy/paste them for |
|
3682 | 3697 | re-execution. |
|
3683 | 3698 | |
|
3684 | 3699 | * Updated manual with recent changes. |
|
3685 | 3700 | |
|
3686 | 3701 | * IPython/iplib.py (Magic.magic_oinfo): added constructor |
|
3687 | 3702 | docstring printing when class? is called. Very handy for knowing |
|
3688 | 3703 | how to create class instances (as long as __init__ is well |
|
3689 | 3704 | documented, of course :) |
|
3690 | 3705 | (Magic.magic_doc): print both class and constructor docstrings. |
|
3691 | 3706 | (Magic.magic_pdef): give constructor info if passed a class and |
|
3692 | 3707 | __call__ info for callable object instances. |
|
3693 | 3708 | |
|
3694 | 3709 | 2002-01-04 Fernando Perez <fperez@colorado.edu> |
|
3695 | 3710 | |
|
3696 | 3711 | * Made deep_reload() off by default. It doesn't always work |
|
3697 | 3712 | exactly as intended, so it's probably safer to have it off. It's |
|
3698 | 3713 | still available as dreload() anyway, so nothing is lost. |
|
3699 | 3714 | |
|
3700 | 3715 | 2002-01-02 Fernando Perez <fperez@colorado.edu> |
|
3701 | 3716 | |
|
3702 | 3717 | * Released 0.2.3 (contacted R.Singh at CU about biopython course, |
|
3703 | 3718 | so I wanted an updated release). |
|
3704 | 3719 | |
|
3705 | 3720 | 2001-12-27 Fernando Perez <fperez@colorado.edu> |
|
3706 | 3721 | |
|
3707 | 3722 | * IPython/iplib.py (InteractiveShell.interact): Added the original |
|
3708 | 3723 | code from 'code.py' for this module in order to change the |
|
3709 | 3724 | handling of a KeyboardInterrupt. This was necessary b/c otherwise |
|
3710 | 3725 | the history cache would break when the user hit Ctrl-C, and |
|
3711 | 3726 | interact() offers no way to add any hooks to it. |
|
3712 | 3727 | |
|
3713 | 3728 | 2001-12-23 Fernando Perez <fperez@colorado.edu> |
|
3714 | 3729 | |
|
3715 | 3730 | * setup.py: added check for 'MANIFEST' before trying to remove |
|
3716 | 3731 | it. Thanks to Sean Reifschneider. |
|
3717 | 3732 | |
|
3718 | 3733 | 2001-12-22 Fernando Perez <fperez@colorado.edu> |
|
3719 | 3734 | |
|
3720 | 3735 | * Released 0.2.2. |
|
3721 | 3736 | |
|
3722 | 3737 | * Finished (reasonably) writing the manual. Later will add the |
|
3723 | 3738 | python-standard navigation stylesheets, but for the time being |
|
3724 | 3739 | it's fairly complete. Distribution will include html and pdf |
|
3725 | 3740 | versions. |
|
3726 | 3741 | |
|
3727 | 3742 | * Bugfix: '.' wasn't being added to sys.path. Thanks to Prabhu |
|
3728 | 3743 | (MayaVi author). |
|
3729 | 3744 | |
|
3730 | 3745 | 2001-12-21 Fernando Perez <fperez@colorado.edu> |
|
3731 | 3746 | |
|
3732 | 3747 | * Released 0.2.1. Barring any nasty bugs, this is it as far as a |
|
3733 | 3748 | good public release, I think (with the manual and the distutils |
|
3734 | 3749 | installer). The manual can use some work, but that can go |
|
3735 | 3750 | slowly. Otherwise I think it's quite nice for end users. Next |
|
3736 | 3751 | summer, rewrite the guts of it... |
|
3737 | 3752 | |
|
3738 | 3753 | * Changed format of ipythonrc files to use whitespace as the |
|
3739 | 3754 | separator instead of an explicit '='. Cleaner. |
|
3740 | 3755 | |
|
3741 | 3756 | 2001-12-20 Fernando Perez <fperez@colorado.edu> |
|
3742 | 3757 | |
|
3743 | 3758 | * Started a manual in LyX. For now it's just a quick merge of the |
|
3744 | 3759 | various internal docstrings and READMEs. Later it may grow into a |
|
3745 | 3760 | nice, full-blown manual. |
|
3746 | 3761 | |
|
3747 | 3762 | * Set up a distutils based installer. Installation should now be |
|
3748 | 3763 | trivially simple for end-users. |
|
3749 | 3764 | |
|
3750 | 3765 | 2001-12-11 Fernando Perez <fperez@colorado.edu> |
|
3751 | 3766 | |
|
3752 | 3767 | * Released 0.2.0. First public release, announced it at |
|
3753 | 3768 | comp.lang.python. From now on, just bugfixes... |
|
3754 | 3769 | |
|
3755 | 3770 | * Went through all the files, set copyright/license notices and |
|
3756 | 3771 | cleaned up things. Ready for release. |
|
3757 | 3772 | |
|
3758 | 3773 | 2001-12-10 Fernando Perez <fperez@colorado.edu> |
|
3759 | 3774 | |
|
3760 | 3775 | * Changed the first-time installer not to use tarfiles. It's more |
|
3761 | 3776 | robust now and less unix-dependent. Also makes it easier for |
|
3762 | 3777 | people to later upgrade versions. |
|
3763 | 3778 | |
|
3764 | 3779 | * Changed @exit to @abort to reflect the fact that it's pretty |
|
3765 | 3780 | brutal (a sys.exit()). The difference between @abort and Ctrl-D |
|
3766 | 3781 | becomes significant only when IPyhton is embedded: in that case, |
|
3767 | 3782 | C-D closes IPython only, but @abort kills the enclosing program |
|
3768 | 3783 | too (unless it had called IPython inside a try catching |
|
3769 | 3784 | SystemExit). |
|
3770 | 3785 | |
|
3771 | 3786 | * Created Shell module which exposes the actuall IPython Shell |
|
3772 | 3787 | classes, currently the normal and the embeddable one. This at |
|
3773 | 3788 | least offers a stable interface we won't need to change when |
|
3774 | 3789 | (later) the internals are rewritten. That rewrite will be confined |
|
3775 | 3790 | to iplib and ipmaker, but the Shell interface should remain as is. |
|
3776 | 3791 | |
|
3777 | 3792 | * Added embed module which offers an embeddable IPShell object, |
|
3778 | 3793 | useful to fire up IPython *inside* a running program. Great for |
|
3779 | 3794 | debugging or dynamical data analysis. |
|
3780 | 3795 | |
|
3781 | 3796 | 2001-12-08 Fernando Perez <fperez@colorado.edu> |
|
3782 | 3797 | |
|
3783 | 3798 | * Fixed small bug preventing seeing info from methods of defined |
|
3784 | 3799 | objects (incorrect namespace in _ofind()). |
|
3785 | 3800 | |
|
3786 | 3801 | * Documentation cleanup. Moved the main usage docstrings to a |
|
3787 | 3802 | separate file, usage.py (cleaner to maintain, and hopefully in the |
|
3788 | 3803 | future some perlpod-like way of producing interactive, man and |
|
3789 | 3804 | html docs out of it will be found). |
|
3790 | 3805 | |
|
3791 | 3806 | * Added @profile to see your profile at any time. |
|
3792 | 3807 | |
|
3793 | 3808 | * Added @p as an alias for 'print'. It's especially convenient if |
|
3794 | 3809 | using automagic ('p x' prints x). |
|
3795 | 3810 | |
|
3796 | 3811 | * Small cleanups and fixes after a pychecker run. |
|
3797 | 3812 | |
|
3798 | 3813 | * Changed the @cd command to handle @cd - and @cd -<n> for |
|
3799 | 3814 | visiting any directory in _dh. |
|
3800 | 3815 | |
|
3801 | 3816 | * Introduced _dh, a history of visited directories. @dhist prints |
|
3802 | 3817 | it out with numbers. |
|
3803 | 3818 | |
|
3804 | 3819 | 2001-12-07 Fernando Perez <fperez@colorado.edu> |
|
3805 | 3820 | |
|
3806 | 3821 | * Released 0.1.22 |
|
3807 | 3822 | |
|
3808 | 3823 | * Made initialization a bit more robust against invalid color |
|
3809 | 3824 | options in user input (exit, not traceback-crash). |
|
3810 | 3825 | |
|
3811 | 3826 | * Changed the bug crash reporter to write the report only in the |
|
3812 | 3827 | user's .ipython directory. That way IPython won't litter people's |
|
3813 | 3828 | hard disks with crash files all over the place. Also print on |
|
3814 | 3829 | screen the necessary mail command. |
|
3815 | 3830 | |
|
3816 | 3831 | * With the new ultraTB, implemented LightBG color scheme for light |
|
3817 | 3832 | background terminals. A lot of people like white backgrounds, so I |
|
3818 | 3833 | guess we should at least give them something readable. |
|
3819 | 3834 | |
|
3820 | 3835 | 2001-12-06 Fernando Perez <fperez@colorado.edu> |
|
3821 | 3836 | |
|
3822 | 3837 | * Modified the structure of ultraTB. Now there's a proper class |
|
3823 | 3838 | for tables of color schemes which allow adding schemes easily and |
|
3824 | 3839 | switching the active scheme without creating a new instance every |
|
3825 | 3840 | time (which was ridiculous). The syntax for creating new schemes |
|
3826 | 3841 | is also cleaner. I think ultraTB is finally done, with a clean |
|
3827 | 3842 | class structure. Names are also much cleaner (now there's proper |
|
3828 | 3843 | color tables, no need for every variable to also have 'color' in |
|
3829 | 3844 | its name). |
|
3830 | 3845 | |
|
3831 | 3846 | * Broke down genutils into separate files. Now genutils only |
|
3832 | 3847 | contains utility functions, and classes have been moved to their |
|
3833 | 3848 | own files (they had enough independent functionality to warrant |
|
3834 | 3849 | it): ConfigLoader, OutputTrap, Struct. |
|
3835 | 3850 | |
|
3836 | 3851 | 2001-12-05 Fernando Perez <fperez@colorado.edu> |
|
3837 | 3852 | |
|
3838 | 3853 | * IPython turns 21! Released version 0.1.21, as a candidate for |
|
3839 | 3854 | public consumption. If all goes well, release in a few days. |
|
3840 | 3855 | |
|
3841 | 3856 | * Fixed path bug (files in Extensions/ directory wouldn't be found |
|
3842 | 3857 | unless IPython/ was explicitly in sys.path). |
|
3843 | 3858 | |
|
3844 | 3859 | * Extended the FlexCompleter class as MagicCompleter to allow |
|
3845 | 3860 | completion of @-starting lines. |
|
3846 | 3861 | |
|
3847 | 3862 | * Created __release__.py file as a central repository for release |
|
3848 | 3863 | info that other files can read from. |
|
3849 | 3864 | |
|
3850 | 3865 | * Fixed small bug in logging: when logging was turned on in |
|
3851 | 3866 | mid-session, old lines with special meanings (!@?) were being |
|
3852 | 3867 | logged without the prepended comment, which is necessary since |
|
3853 | 3868 | they are not truly valid python syntax. This should make session |
|
3854 | 3869 | restores produce less errors. |
|
3855 | 3870 | |
|
3856 | 3871 | * The namespace cleanup forced me to make a FlexCompleter class |
|
3857 | 3872 | which is nothing but a ripoff of rlcompleter, but with selectable |
|
3858 | 3873 | namespace (rlcompleter only works in __main__.__dict__). I'll try |
|
3859 | 3874 | to submit a note to the authors to see if this change can be |
|
3860 | 3875 | incorporated in future rlcompleter releases (Dec.6: done) |
|
3861 | 3876 | |
|
3862 | 3877 | * More fixes to namespace handling. It was a mess! Now all |
|
3863 | 3878 | explicit references to __main__.__dict__ are gone (except when |
|
3864 | 3879 | really needed) and everything is handled through the namespace |
|
3865 | 3880 | dicts in the IPython instance. We seem to be getting somewhere |
|
3866 | 3881 | with this, finally... |
|
3867 | 3882 | |
|
3868 | 3883 | * Small documentation updates. |
|
3869 | 3884 | |
|
3870 | 3885 | * Created the Extensions directory under IPython (with an |
|
3871 | 3886 | __init__.py). Put the PhysicalQ stuff there. This directory should |
|
3872 | 3887 | be used for all special-purpose extensions. |
|
3873 | 3888 | |
|
3874 | 3889 | * File renaming: |
|
3875 | 3890 | ipythonlib --> ipmaker |
|
3876 | 3891 | ipplib --> iplib |
|
3877 | 3892 | This makes a bit more sense in terms of what these files actually do. |
|
3878 | 3893 | |
|
3879 | 3894 | * Moved all the classes and functions in ipythonlib to ipplib, so |
|
3880 | 3895 | now ipythonlib only has make_IPython(). This will ease up its |
|
3881 | 3896 | splitting in smaller functional chunks later. |
|
3882 | 3897 | |
|
3883 | 3898 | * Cleaned up (done, I think) output of @whos. Better column |
|
3884 | 3899 | formatting, and now shows str(var) for as much as it can, which is |
|
3885 | 3900 | typically what one gets with a 'print var'. |
|
3886 | 3901 | |
|
3887 | 3902 | 2001-12-04 Fernando Perez <fperez@colorado.edu> |
|
3888 | 3903 | |
|
3889 | 3904 | * Fixed namespace problems. Now builtin/IPyhton/user names get |
|
3890 | 3905 | properly reported in their namespace. Internal namespace handling |
|
3891 | 3906 | is finally getting decent (not perfect yet, but much better than |
|
3892 | 3907 | the ad-hoc mess we had). |
|
3893 | 3908 | |
|
3894 | 3909 | * Removed -exit option. If people just want to run a python |
|
3895 | 3910 | script, that's what the normal interpreter is for. Less |
|
3896 | 3911 | unnecessary options, less chances for bugs. |
|
3897 | 3912 | |
|
3898 | 3913 | * Added a crash handler which generates a complete post-mortem if |
|
3899 | 3914 | IPython crashes. This will help a lot in tracking bugs down the |
|
3900 | 3915 | road. |
|
3901 | 3916 | |
|
3902 | 3917 | * Fixed nasty bug in auto-evaluation part of prefilter(). Names |
|
3903 | 3918 | which were boud to functions being reassigned would bypass the |
|
3904 | 3919 | logger, breaking the sync of _il with the prompt counter. This |
|
3905 | 3920 | would then crash IPython later when a new line was logged. |
|
3906 | 3921 | |
|
3907 | 3922 | 2001-12-02 Fernando Perez <fperez@colorado.edu> |
|
3908 | 3923 | |
|
3909 | 3924 | * Made IPython a package. This means people don't have to clutter |
|
3910 | 3925 | their sys.path with yet another directory. Changed the INSTALL |
|
3911 | 3926 | file accordingly. |
|
3912 | 3927 | |
|
3913 | 3928 | * Cleaned up the output of @who_ls, @who and @whos. @who_ls now |
|
3914 | 3929 | sorts its output (so @who shows it sorted) and @whos formats the |
|
3915 | 3930 | table according to the width of the first column. Nicer, easier to |
|
3916 | 3931 | read. Todo: write a generic table_format() which takes a list of |
|
3917 | 3932 | lists and prints it nicely formatted, with optional row/column |
|
3918 | 3933 | separators and proper padding and justification. |
|
3919 | 3934 | |
|
3920 | 3935 | * Released 0.1.20 |
|
3921 | 3936 | |
|
3922 | 3937 | * Fixed bug in @log which would reverse the inputcache list (a |
|
3923 | 3938 | copy operation was missing). |
|
3924 | 3939 | |
|
3925 | 3940 | * Code cleanup. @config was changed to use page(). Better, since |
|
3926 | 3941 | its output is always quite long. |
|
3927 | 3942 | |
|
3928 | 3943 | * Itpl is back as a dependency. I was having too many problems |
|
3929 | 3944 | getting the parametric aliases to work reliably, and it's just |
|
3930 | 3945 | easier to code weird string operations with it than playing %()s |
|
3931 | 3946 | games. It's only ~6k, so I don't think it's too big a deal. |
|
3932 | 3947 | |
|
3933 | 3948 | * Found (and fixed) a very nasty bug with history. !lines weren't |
|
3934 | 3949 | getting cached, and the out of sync caches would crash |
|
3935 | 3950 | IPython. Fixed it by reorganizing the prefilter/handlers/logger |
|
3936 | 3951 | division of labor a bit better. Bug fixed, cleaner structure. |
|
3937 | 3952 | |
|
3938 | 3953 | 2001-12-01 Fernando Perez <fperez@colorado.edu> |
|
3939 | 3954 | |
|
3940 | 3955 | * Released 0.1.19 |
|
3941 | 3956 | |
|
3942 | 3957 | * Added option -n to @hist to prevent line number printing. Much |
|
3943 | 3958 | easier to copy/paste code this way. |
|
3944 | 3959 | |
|
3945 | 3960 | * Created global _il to hold the input list. Allows easy |
|
3946 | 3961 | re-execution of blocks of code by slicing it (inspired by Janko's |
|
3947 | 3962 | comment on 'macros'). |
|
3948 | 3963 | |
|
3949 | 3964 | * Small fixes and doc updates. |
|
3950 | 3965 | |
|
3951 | 3966 | * Rewrote @history function (was @h). Renamed it to @hist, @h is |
|
3952 | 3967 | much too fragile with automagic. Handles properly multi-line |
|
3953 | 3968 | statements and takes parameters. |
|
3954 | 3969 | |
|
3955 | 3970 | 2001-11-30 Fernando Perez <fperez@colorado.edu> |
|
3956 | 3971 | |
|
3957 | 3972 | * Version 0.1.18 released. |
|
3958 | 3973 | |
|
3959 | 3974 | * Fixed nasty namespace bug in initial module imports. |
|
3960 | 3975 | |
|
3961 | 3976 | * Added copyright/license notes to all code files (except |
|
3962 | 3977 | DPyGetOpt). For the time being, LGPL. That could change. |
|
3963 | 3978 | |
|
3964 | 3979 | * Rewrote a much nicer README, updated INSTALL, cleaned up |
|
3965 | 3980 | ipythonrc-* samples. |
|
3966 | 3981 | |
|
3967 | 3982 | * Overall code/documentation cleanup. Basically ready for |
|
3968 | 3983 | release. Only remaining thing: licence decision (LGPL?). |
|
3969 | 3984 | |
|
3970 | 3985 | * Converted load_config to a class, ConfigLoader. Now recursion |
|
3971 | 3986 | control is better organized. Doesn't include the same file twice. |
|
3972 | 3987 | |
|
3973 | 3988 | 2001-11-29 Fernando Perez <fperez@colorado.edu> |
|
3974 | 3989 | |
|
3975 | 3990 | * Got input history working. Changed output history variables from |
|
3976 | 3991 | _p to _o so that _i is for input and _o for output. Just cleaner |
|
3977 | 3992 | convention. |
|
3978 | 3993 | |
|
3979 | 3994 | * Implemented parametric aliases. This pretty much allows the |
|
3980 | 3995 | alias system to offer full-blown shell convenience, I think. |
|
3981 | 3996 | |
|
3982 | 3997 | * Version 0.1.17 released, 0.1.18 opened. |
|
3983 | 3998 | |
|
3984 | 3999 | * dot_ipython/ipythonrc (alias): added documentation. |
|
3985 | 4000 | (xcolor): Fixed small bug (xcolors -> xcolor) |
|
3986 | 4001 | |
|
3987 | 4002 | * Changed the alias system. Now alias is a magic command to define |
|
3988 | 4003 | aliases just like the shell. Rationale: the builtin magics should |
|
3989 | 4004 | be there for things deeply connected to IPython's |
|
3990 | 4005 | architecture. And this is a much lighter system for what I think |
|
3991 | 4006 | is the really important feature: allowing users to define quickly |
|
3992 | 4007 | magics that will do shell things for them, so they can customize |
|
3993 | 4008 | IPython easily to match their work habits. If someone is really |
|
3994 | 4009 | desperate to have another name for a builtin alias, they can |
|
3995 | 4010 | always use __IP.magic_newname = __IP.magic_oldname. Hackish but |
|
3996 | 4011 | works. |
|
3997 | 4012 | |
|
3998 | 4013 | 2001-11-28 Fernando Perez <fperez@colorado.edu> |
|
3999 | 4014 | |
|
4000 | 4015 | * Changed @file so that it opens the source file at the proper |
|
4001 | 4016 | line. Since it uses less, if your EDITOR environment is |
|
4002 | 4017 | configured, typing v will immediately open your editor of choice |
|
4003 | 4018 | right at the line where the object is defined. Not as quick as |
|
4004 | 4019 | having a direct @edit command, but for all intents and purposes it |
|
4005 | 4020 | works. And I don't have to worry about writing @edit to deal with |
|
4006 | 4021 | all the editors, less does that. |
|
4007 | 4022 | |
|
4008 | 4023 | * Version 0.1.16 released, 0.1.17 opened. |
|
4009 | 4024 | |
|
4010 | 4025 | * Fixed some nasty bugs in the page/page_dumb combo that could |
|
4011 | 4026 | crash IPython. |
|
4012 | 4027 | |
|
4013 | 4028 | 2001-11-27 Fernando Perez <fperez@colorado.edu> |
|
4014 | 4029 | |
|
4015 | 4030 | * Version 0.1.15 released, 0.1.16 opened. |
|
4016 | 4031 | |
|
4017 | 4032 | * Finally got ? and ?? to work for undefined things: now it's |
|
4018 | 4033 | possible to type {}.get? and get information about the get method |
|
4019 | 4034 | of dicts, or os.path? even if only os is defined (so technically |
|
4020 | 4035 | os.path isn't). Works at any level. For example, after import os, |
|
4021 | 4036 | os?, os.path?, os.path.abspath? all work. This is great, took some |
|
4022 | 4037 | work in _ofind. |
|
4023 | 4038 | |
|
4024 | 4039 | * Fixed more bugs with logging. The sanest way to do it was to add |
|
4025 | 4040 | to @log a 'mode' parameter. Killed two in one shot (this mode |
|
4026 | 4041 | option was a request of Janko's). I think it's finally clean |
|
4027 | 4042 | (famous last words). |
|
4028 | 4043 | |
|
4029 | 4044 | * Added a page_dumb() pager which does a decent job of paging on |
|
4030 | 4045 | screen, if better things (like less) aren't available. One less |
|
4031 | 4046 | unix dependency (someday maybe somebody will port this to |
|
4032 | 4047 | windows). |
|
4033 | 4048 | |
|
4034 | 4049 | * Fixed problem in magic_log: would lock of logging out if log |
|
4035 | 4050 | creation failed (because it would still think it had succeeded). |
|
4036 | 4051 | |
|
4037 | 4052 | * Improved the page() function using curses to auto-detect screen |
|
4038 | 4053 | size. Now it can make a much better decision on whether to print |
|
4039 | 4054 | or page a string. Option screen_length was modified: a value 0 |
|
4040 | 4055 | means auto-detect, and that's the default now. |
|
4041 | 4056 | |
|
4042 | 4057 | * Version 0.1.14 released, 0.1.15 opened. I think this is ready to |
|
4043 | 4058 | go out. I'll test it for a few days, then talk to Janko about |
|
4044 | 4059 | licences and announce it. |
|
4045 | 4060 | |
|
4046 | 4061 | * Fixed the length of the auto-generated ---> prompt which appears |
|
4047 | 4062 | for auto-parens and auto-quotes. Getting this right isn't trivial, |
|
4048 | 4063 | with all the color escapes, different prompt types and optional |
|
4049 | 4064 | separators. But it seems to be working in all the combinations. |
|
4050 | 4065 | |
|
4051 | 4066 | 2001-11-26 Fernando Perez <fperez@colorado.edu> |
|
4052 | 4067 | |
|
4053 | 4068 | * Wrote a regexp filter to get option types from the option names |
|
4054 | 4069 | string. This eliminates the need to manually keep two duplicate |
|
4055 | 4070 | lists. |
|
4056 | 4071 | |
|
4057 | 4072 | * Removed the unneeded check_option_names. Now options are handled |
|
4058 | 4073 | in a much saner manner and it's easy to visually check that things |
|
4059 | 4074 | are ok. |
|
4060 | 4075 | |
|
4061 | 4076 | * Updated version numbers on all files I modified to carry a |
|
4062 | 4077 | notice so Janko and Nathan have clear version markers. |
|
4063 | 4078 | |
|
4064 | 4079 | * Updated docstring for ultraTB with my changes. I should send |
|
4065 | 4080 | this to Nathan. |
|
4066 | 4081 | |
|
4067 | 4082 | * Lots of small fixes. Ran everything through pychecker again. |
|
4068 | 4083 | |
|
4069 | 4084 | * Made loading of deep_reload an cmd line option. If it's not too |
|
4070 | 4085 | kosher, now people can just disable it. With -nodeep_reload it's |
|
4071 | 4086 | still available as dreload(), it just won't overwrite reload(). |
|
4072 | 4087 | |
|
4073 | 4088 | * Moved many options to the no| form (-opt and -noopt |
|
4074 | 4089 | accepted). Cleaner. |
|
4075 | 4090 | |
|
4076 | 4091 | * Changed magic_log so that if called with no parameters, it uses |
|
4077 | 4092 | 'rotate' mode. That way auto-generated logs aren't automatically |
|
4078 | 4093 | over-written. For normal logs, now a backup is made if it exists |
|
4079 | 4094 | (only 1 level of backups). A new 'backup' mode was added to the |
|
4080 | 4095 | Logger class to support this. This was a request by Janko. |
|
4081 | 4096 | |
|
4082 | 4097 | * Added @logoff/@logon to stop/restart an active log. |
|
4083 | 4098 | |
|
4084 | 4099 | * Fixed a lot of bugs in log saving/replay. It was pretty |
|
4085 | 4100 | broken. Now special lines (!@,/) appear properly in the command |
|
4086 | 4101 | history after a log replay. |
|
4087 | 4102 | |
|
4088 | 4103 | * Tried and failed to implement full session saving via pickle. My |
|
4089 | 4104 | idea was to pickle __main__.__dict__, but modules can't be |
|
4090 | 4105 | pickled. This would be a better alternative to replaying logs, but |
|
4091 | 4106 | seems quite tricky to get to work. Changed -session to be called |
|
4092 | 4107 | -logplay, which more accurately reflects what it does. And if we |
|
4093 | 4108 | ever get real session saving working, -session is now available. |
|
4094 | 4109 | |
|
4095 | 4110 | * Implemented color schemes for prompts also. As for tracebacks, |
|
4096 | 4111 | currently only NoColor and Linux are supported. But now the |
|
4097 | 4112 | infrastructure is in place, based on a generic ColorScheme |
|
4098 | 4113 | class. So writing and activating new schemes both for the prompts |
|
4099 | 4114 | and the tracebacks should be straightforward. |
|
4100 | 4115 | |
|
4101 | 4116 | * Version 0.1.13 released, 0.1.14 opened. |
|
4102 | 4117 | |
|
4103 | 4118 | * Changed handling of options for output cache. Now counter is |
|
4104 | 4119 | hardwired starting at 1 and one specifies the maximum number of |
|
4105 | 4120 | entries *in the outcache* (not the max prompt counter). This is |
|
4106 | 4121 | much better, since many statements won't increase the cache |
|
4107 | 4122 | count. It also eliminated some confusing options, now there's only |
|
4108 | 4123 | one: cache_size. |
|
4109 | 4124 | |
|
4110 | 4125 | * Added 'alias' magic function and magic_alias option in the |
|
4111 | 4126 | ipythonrc file. Now the user can easily define whatever names he |
|
4112 | 4127 | wants for the magic functions without having to play weird |
|
4113 | 4128 | namespace games. This gives IPython a real shell-like feel. |
|
4114 | 4129 | |
|
4115 | 4130 | * Fixed doc/?/?? for magics. Now all work, in all forms (explicit |
|
4116 | 4131 | @ or not). |
|
4117 | 4132 | |
|
4118 | 4133 | This was one of the last remaining 'visible' bugs (that I know |
|
4119 | 4134 | of). I think if I can clean up the session loading so it works |
|
4120 | 4135 | 100% I'll release a 0.2.0 version on c.p.l (talk to Janko first |
|
4121 | 4136 | about licensing). |
|
4122 | 4137 | |
|
4123 | 4138 | 2001-11-25 Fernando Perez <fperez@colorado.edu> |
|
4124 | 4139 | |
|
4125 | 4140 | * Rewrote somewhat oinfo (?/??). Nicer, now uses page() and |
|
4126 | 4141 | there's a cleaner distinction between what ? and ?? show. |
|
4127 | 4142 | |
|
4128 | 4143 | * Added screen_length option. Now the user can define his own |
|
4129 | 4144 | screen size for page() operations. |
|
4130 | 4145 | |
|
4131 | 4146 | * Implemented magic shell-like functions with automatic code |
|
4132 | 4147 | generation. Now adding another function is just a matter of adding |
|
4133 | 4148 | an entry to a dict, and the function is dynamically generated at |
|
4134 | 4149 | run-time. Python has some really cool features! |
|
4135 | 4150 | |
|
4136 | 4151 | * Renamed many options to cleanup conventions a little. Now all |
|
4137 | 4152 | are lowercase, and only underscores where needed. Also in the code |
|
4138 | 4153 | option name tables are clearer. |
|
4139 | 4154 | |
|
4140 | 4155 | * Changed prompts a little. Now input is 'In [n]:' instead of |
|
4141 | 4156 | 'In[n]:='. This allows it the numbers to be aligned with the |
|
4142 | 4157 | Out[n] numbers, and removes usage of ':=' which doesn't exist in |
|
4143 | 4158 | Python (it was a Mathematica thing). The '...' continuation prompt |
|
4144 | 4159 | was also changed a little to align better. |
|
4145 | 4160 | |
|
4146 | 4161 | * Fixed bug when flushing output cache. Not all _p<n> variables |
|
4147 | 4162 | exist, so their deletion needs to be wrapped in a try: |
|
4148 | 4163 | |
|
4149 | 4164 | * Figured out how to properly use inspect.formatargspec() (it |
|
4150 | 4165 | requires the args preceded by *). So I removed all the code from |
|
4151 | 4166 | _get_pdef in Magic, which was just replicating that. |
|
4152 | 4167 | |
|
4153 | 4168 | * Added test to prefilter to allow redefining magic function names |
|
4154 | 4169 | as variables. This is ok, since the @ form is always available, |
|
4155 | 4170 | but whe should allow the user to define a variable called 'ls' if |
|
4156 | 4171 | he needs it. |
|
4157 | 4172 | |
|
4158 | 4173 | * Moved the ToDo information from README into a separate ToDo. |
|
4159 | 4174 | |
|
4160 | 4175 | * General code cleanup and small bugfixes. I think it's close to a |
|
4161 | 4176 | state where it can be released, obviously with a big 'beta' |
|
4162 | 4177 | warning on it. |
|
4163 | 4178 | |
|
4164 | 4179 | * Got the magic function split to work. Now all magics are defined |
|
4165 | 4180 | in a separate class. It just organizes things a bit, and now |
|
4166 | 4181 | Xemacs behaves nicer (it was choking on InteractiveShell b/c it |
|
4167 | 4182 | was too long). |
|
4168 | 4183 | |
|
4169 | 4184 | * Changed @clear to @reset to avoid potential confusions with |
|
4170 | 4185 | the shell command clear. Also renamed @cl to @clear, which does |
|
4171 | 4186 | exactly what people expect it to from their shell experience. |
|
4172 | 4187 | |
|
4173 | 4188 | Added a check to the @reset command (since it's so |
|
4174 | 4189 | destructive, it's probably a good idea to ask for confirmation). |
|
4175 | 4190 | But now reset only works for full namespace resetting. Since the |
|
4176 | 4191 | del keyword is already there for deleting a few specific |
|
4177 | 4192 | variables, I don't see the point of having a redundant magic |
|
4178 | 4193 | function for the same task. |
|
4179 | 4194 | |
|
4180 | 4195 | 2001-11-24 Fernando Perez <fperez@colorado.edu> |
|
4181 | 4196 | |
|
4182 | 4197 | * Updated the builtin docs (esp. the ? ones). |
|
4183 | 4198 | |
|
4184 | 4199 | * Ran all the code through pychecker. Not terribly impressed with |
|
4185 | 4200 | it: lots of spurious warnings and didn't really find anything of |
|
4186 | 4201 | substance (just a few modules being imported and not used). |
|
4187 | 4202 | |
|
4188 | 4203 | * Implemented the new ultraTB functionality into IPython. New |
|
4189 | 4204 | option: xcolors. This chooses color scheme. xmode now only selects |
|
4190 | 4205 | between Plain and Verbose. Better orthogonality. |
|
4191 | 4206 | |
|
4192 | 4207 | * Large rewrite of ultraTB. Much cleaner now, with a separation of |
|
4193 | 4208 | mode and color scheme for the exception handlers. Now it's |
|
4194 | 4209 | possible to have the verbose traceback with no coloring. |
|
4195 | 4210 | |
|
4196 | 4211 | 2001-11-23 Fernando Perez <fperez@colorado.edu> |
|
4197 | 4212 | |
|
4198 | 4213 | * Version 0.1.12 released, 0.1.13 opened. |
|
4199 | 4214 | |
|
4200 | 4215 | * Removed option to set auto-quote and auto-paren escapes by |
|
4201 | 4216 | user. The chances of breaking valid syntax are just too high. If |
|
4202 | 4217 | someone *really* wants, they can always dig into the code. |
|
4203 | 4218 | |
|
4204 | 4219 | * Made prompt separators configurable. |
|
4205 | 4220 | |
|
4206 | 4221 | 2001-11-22 Fernando Perez <fperez@colorado.edu> |
|
4207 | 4222 | |
|
4208 | 4223 | * Small bugfixes in many places. |
|
4209 | 4224 | |
|
4210 | 4225 | * Removed the MyCompleter class from ipplib. It seemed redundant |
|
4211 | 4226 | with the C-p,C-n history search functionality. Less code to |
|
4212 | 4227 | maintain. |
|
4213 | 4228 | |
|
4214 | 4229 | * Moved all the original ipython.py code into ipythonlib.py. Right |
|
4215 | 4230 | now it's just one big dump into a function called make_IPython, so |
|
4216 | 4231 | no real modularity has been gained. But at least it makes the |
|
4217 | 4232 | wrapper script tiny, and since ipythonlib is a module, it gets |
|
4218 | 4233 | compiled and startup is much faster. |
|
4219 | 4234 | |
|
4220 | 4235 | This is a reasobably 'deep' change, so we should test it for a |
|
4221 | 4236 | while without messing too much more with the code. |
|
4222 | 4237 | |
|
4223 | 4238 | 2001-11-21 Fernando Perez <fperez@colorado.edu> |
|
4224 | 4239 | |
|
4225 | 4240 | * Version 0.1.11 released, 0.1.12 opened for further work. |
|
4226 | 4241 | |
|
4227 | 4242 | * Removed dependency on Itpl. It was only needed in one place. It |
|
4228 | 4243 | would be nice if this became part of python, though. It makes life |
|
4229 | 4244 | *a lot* easier in some cases. |
|
4230 | 4245 | |
|
4231 | 4246 | * Simplified the prefilter code a bit. Now all handlers are |
|
4232 | 4247 | expected to explicitly return a value (at least a blank string). |
|
4233 | 4248 | |
|
4234 | 4249 | * Heavy edits in ipplib. Removed the help system altogether. Now |
|
4235 | 4250 | obj?/?? is used for inspecting objects, a magic @doc prints |
|
4236 | 4251 | docstrings, and full-blown Python help is accessed via the 'help' |
|
4237 | 4252 | keyword. This cleans up a lot of code (less to maintain) and does |
|
4238 | 4253 | the job. Since 'help' is now a standard Python component, might as |
|
4239 | 4254 | well use it and remove duplicate functionality. |
|
4240 | 4255 | |
|
4241 | 4256 | Also removed the option to use ipplib as a standalone program. By |
|
4242 | 4257 | now it's too dependent on other parts of IPython to function alone. |
|
4243 | 4258 | |
|
4244 | 4259 | * Fixed bug in genutils.pager. It would crash if the pager was |
|
4245 | 4260 | exited immediately after opening (broken pipe). |
|
4246 | 4261 | |
|
4247 | 4262 | * Trimmed down the VerboseTB reporting a little. The header is |
|
4248 | 4263 | much shorter now and the repeated exception arguments at the end |
|
4249 | 4264 | have been removed. For interactive use the old header seemed a bit |
|
4250 | 4265 | excessive. |
|
4251 | 4266 | |
|
4252 | 4267 | * Fixed small bug in output of @whos for variables with multi-word |
|
4253 | 4268 | types (only first word was displayed). |
|
4254 | 4269 | |
|
4255 | 4270 | 2001-11-17 Fernando Perez <fperez@colorado.edu> |
|
4256 | 4271 | |
|
4257 | 4272 | * Version 0.1.10 released, 0.1.11 opened for further work. |
|
4258 | 4273 | |
|
4259 | 4274 | * Modified dirs and friends. dirs now *returns* the stack (not |
|
4260 | 4275 | prints), so one can manipulate it as a variable. Convenient to |
|
4261 | 4276 | travel along many directories. |
|
4262 | 4277 | |
|
4263 | 4278 | * Fixed bug in magic_pdef: would only work with functions with |
|
4264 | 4279 | arguments with default values. |
|
4265 | 4280 | |
|
4266 | 4281 | 2001-11-14 Fernando Perez <fperez@colorado.edu> |
|
4267 | 4282 | |
|
4268 | 4283 | * Added the PhysicsInput stuff to dot_ipython so it ships as an |
|
4269 | 4284 | example with IPython. Various other minor fixes and cleanups. |
|
4270 | 4285 | |
|
4271 | 4286 | * Version 0.1.9 released, 0.1.10 opened for further work. |
|
4272 | 4287 | |
|
4273 | 4288 | * Added sys.path to the list of directories searched in the |
|
4274 | 4289 | execfile= option. It used to be the current directory and the |
|
4275 | 4290 | user's IPYTHONDIR only. |
|
4276 | 4291 | |
|
4277 | 4292 | 2001-11-13 Fernando Perez <fperez@colorado.edu> |
|
4278 | 4293 | |
|
4279 | 4294 | * Reinstated the raw_input/prefilter separation that Janko had |
|
4280 | 4295 | initially. This gives a more convenient setup for extending the |
|
4281 | 4296 | pre-processor from the outside: raw_input always gets a string, |
|
4282 | 4297 | and prefilter has to process it. We can then redefine prefilter |
|
4283 | 4298 | from the outside and implement extensions for special |
|
4284 | 4299 | purposes. |
|
4285 | 4300 | |
|
4286 | 4301 | Today I got one for inputting PhysicalQuantity objects |
|
4287 | 4302 | (from Scientific) without needing any function calls at |
|
4288 | 4303 | all. Extremely convenient, and it's all done as a user-level |
|
4289 | 4304 | extension (no IPython code was touched). Now instead of: |
|
4290 | 4305 | a = PhysicalQuantity(4.2,'m/s**2') |
|
4291 | 4306 | one can simply say |
|
4292 | 4307 | a = 4.2 m/s**2 |
|
4293 | 4308 | or even |
|
4294 | 4309 | a = 4.2 m/s^2 |
|
4295 | 4310 | |
|
4296 | 4311 | I use this, but it's also a proof of concept: IPython really is |
|
4297 | 4312 | fully user-extensible, even at the level of the parsing of the |
|
4298 | 4313 | command line. It's not trivial, but it's perfectly doable. |
|
4299 | 4314 | |
|
4300 | 4315 | * Added 'add_flip' method to inclusion conflict resolver. Fixes |
|
4301 | 4316 | the problem of modules being loaded in the inverse order in which |
|
4302 | 4317 | they were defined in |
|
4303 | 4318 | |
|
4304 | 4319 | * Version 0.1.8 released, 0.1.9 opened for further work. |
|
4305 | 4320 | |
|
4306 | 4321 | * Added magics pdef, source and file. They respectively show the |
|
4307 | 4322 | definition line ('prototype' in C), source code and full python |
|
4308 | 4323 | file for any callable object. The object inspector oinfo uses |
|
4309 | 4324 | these to show the same information. |
|
4310 | 4325 | |
|
4311 | 4326 | * Version 0.1.7 released, 0.1.8 opened for further work. |
|
4312 | 4327 | |
|
4313 | 4328 | * Separated all the magic functions into a class called Magic. The |
|
4314 | 4329 | InteractiveShell class was becoming too big for Xemacs to handle |
|
4315 | 4330 | (de-indenting a line would lock it up for 10 seconds while it |
|
4316 | 4331 | backtracked on the whole class!) |
|
4317 | 4332 | |
|
4318 | 4333 | FIXME: didn't work. It can be done, but right now namespaces are |
|
4319 | 4334 | all messed up. Do it later (reverted it for now, so at least |
|
4320 | 4335 | everything works as before). |
|
4321 | 4336 | |
|
4322 | 4337 | * Got the object introspection system (magic_oinfo) working! I |
|
4323 | 4338 | think this is pretty much ready for release to Janko, so he can |
|
4324 | 4339 | test it for a while and then announce it. Pretty much 100% of what |
|
4325 | 4340 | I wanted for the 'phase 1' release is ready. Happy, tired. |
|
4326 | 4341 | |
|
4327 | 4342 | 2001-11-12 Fernando Perez <fperez@colorado.edu> |
|
4328 | 4343 | |
|
4329 | 4344 | * Version 0.1.6 released, 0.1.7 opened for further work. |
|
4330 | 4345 | |
|
4331 | 4346 | * Fixed bug in printing: it used to test for truth before |
|
4332 | 4347 | printing, so 0 wouldn't print. Now checks for None. |
|
4333 | 4348 | |
|
4334 | 4349 | * Fixed bug where auto-execs increase the prompt counter by 2 (b/c |
|
4335 | 4350 | they have to call len(str(sys.ps1)) ). But the fix is ugly, it |
|
4336 | 4351 | reaches by hand into the outputcache. Think of a better way to do |
|
4337 | 4352 | this later. |
|
4338 | 4353 | |
|
4339 | 4354 | * Various small fixes thanks to Nathan's comments. |
|
4340 | 4355 | |
|
4341 | 4356 | * Changed magic_pprint to magic_Pprint. This way it doesn't |
|
4342 | 4357 | collide with pprint() and the name is consistent with the command |
|
4343 | 4358 | line option. |
|
4344 | 4359 | |
|
4345 | 4360 | * Changed prompt counter behavior to be fully like |
|
4346 | 4361 | Mathematica's. That is, even input that doesn't return a result |
|
4347 | 4362 | raises the prompt counter. The old behavior was kind of confusing |
|
4348 | 4363 | (getting the same prompt number several times if the operation |
|
4349 | 4364 | didn't return a result). |
|
4350 | 4365 | |
|
4351 | 4366 | * Fixed Nathan's last name in a couple of places (Gray, not Graham). |
|
4352 | 4367 | |
|
4353 | 4368 | * Fixed -Classic mode (wasn't working anymore). |
|
4354 | 4369 | |
|
4355 | 4370 | * Added colored prompts using Nathan's new code. Colors are |
|
4356 | 4371 | currently hardwired, they can be user-configurable. For |
|
4357 | 4372 | developers, they can be chosen in file ipythonlib.py, at the |
|
4358 | 4373 | beginning of the CachedOutput class def. |
|
4359 | 4374 | |
|
4360 | 4375 | 2001-11-11 Fernando Perez <fperez@colorado.edu> |
|
4361 | 4376 | |
|
4362 | 4377 | * Version 0.1.5 released, 0.1.6 opened for further work. |
|
4363 | 4378 | |
|
4364 | 4379 | * Changed magic_env to *return* the environment as a dict (not to |
|
4365 | 4380 | print it). This way it prints, but it can also be processed. |
|
4366 | 4381 | |
|
4367 | 4382 | * Added Verbose exception reporting to interactive |
|
4368 | 4383 | exceptions. Very nice, now even 1/0 at the prompt gives a verbose |
|
4369 | 4384 | traceback. Had to make some changes to the ultraTB file. This is |
|
4370 | 4385 | probably the last 'big' thing in my mental todo list. This ties |
|
4371 | 4386 | in with the next entry: |
|
4372 | 4387 | |
|
4373 | 4388 | * Changed -Xi and -Xf to a single -xmode option. Now all the user |
|
4374 | 4389 | has to specify is Plain, Color or Verbose for all exception |
|
4375 | 4390 | handling. |
|
4376 | 4391 | |
|
4377 | 4392 | * Removed ShellServices option. All this can really be done via |
|
4378 | 4393 | the magic system. It's easier to extend, cleaner and has automatic |
|
4379 | 4394 | namespace protection and documentation. |
|
4380 | 4395 | |
|
4381 | 4396 | 2001-11-09 Fernando Perez <fperez@colorado.edu> |
|
4382 | 4397 | |
|
4383 | 4398 | * Fixed bug in output cache flushing (missing parameter to |
|
4384 | 4399 | __init__). Other small bugs fixed (found using pychecker). |
|
4385 | 4400 | |
|
4386 | 4401 | * Version 0.1.4 opened for bugfixing. |
|
4387 | 4402 | |
|
4388 | 4403 | 2001-11-07 Fernando Perez <fperez@colorado.edu> |
|
4389 | 4404 | |
|
4390 | 4405 | * Version 0.1.3 released, mainly because of the raw_input bug. |
|
4391 | 4406 | |
|
4392 | 4407 | * Fixed NASTY bug in raw_input: input line wasn't properly parsed |
|
4393 | 4408 | and when testing for whether things were callable, a call could |
|
4394 | 4409 | actually be made to certain functions. They would get called again |
|
4395 | 4410 | once 'really' executed, with a resulting double call. A disaster |
|
4396 | 4411 | in many cases (list.reverse() would never work!). |
|
4397 | 4412 | |
|
4398 | 4413 | * Removed prefilter() function, moved its code to raw_input (which |
|
4399 | 4414 | after all was just a near-empty caller for prefilter). This saves |
|
4400 | 4415 | a function call on every prompt, and simplifies the class a tiny bit. |
|
4401 | 4416 | |
|
4402 | 4417 | * Fix _ip to __ip name in magic example file. |
|
4403 | 4418 | |
|
4404 | 4419 | * Changed 'tar -x -f' to 'tar xvf' in auto-installer. This should |
|
4405 | 4420 | work with non-gnu versions of tar. |
|
4406 | 4421 | |
|
4407 | 4422 | 2001-11-06 Fernando Perez <fperez@colorado.edu> |
|
4408 | 4423 | |
|
4409 | 4424 | * Version 0.1.2. Just to keep track of the recent changes. |
|
4410 | 4425 | |
|
4411 | 4426 | * Fixed nasty bug in output prompt routine. It used to check 'if |
|
4412 | 4427 | arg != None...'. Problem is, this fails if arg implements a |
|
4413 | 4428 | special comparison (__cmp__) which disallows comparing to |
|
4414 | 4429 | None. Found it when trying to use the PhysicalQuantity module from |
|
4415 | 4430 | ScientificPython. |
|
4416 | 4431 | |
|
4417 | 4432 | 2001-11-05 Fernando Perez <fperez@colorado.edu> |
|
4418 | 4433 | |
|
4419 | 4434 | * Also added dirs. Now the pushd/popd/dirs family functions |
|
4420 | 4435 | basically like the shell, with the added convenience of going home |
|
4421 | 4436 | when called with no args. |
|
4422 | 4437 | |
|
4423 | 4438 | * pushd/popd slightly modified to mimic shell behavior more |
|
4424 | 4439 | closely. |
|
4425 | 4440 | |
|
4426 | 4441 | * Added env,pushd,popd from ShellServices as magic functions. I |
|
4427 | 4442 | think the cleanest will be to port all desired functions from |
|
4428 | 4443 | ShellServices as magics and remove ShellServices altogether. This |
|
4429 | 4444 | will provide a single, clean way of adding functionality |
|
4430 | 4445 | (shell-type or otherwise) to IP. |
|
4431 | 4446 | |
|
4432 | 4447 | 2001-11-04 Fernando Perez <fperez@colorado.edu> |
|
4433 | 4448 | |
|
4434 | 4449 | * Added .ipython/ directory to sys.path. This way users can keep |
|
4435 | 4450 | customizations there and access them via import. |
|
4436 | 4451 | |
|
4437 | 4452 | 2001-11-03 Fernando Perez <fperez@colorado.edu> |
|
4438 | 4453 | |
|
4439 | 4454 | * Opened version 0.1.1 for new changes. |
|
4440 | 4455 | |
|
4441 | 4456 | * Changed version number to 0.1.0: first 'public' release, sent to |
|
4442 | 4457 | Nathan and Janko. |
|
4443 | 4458 | |
|
4444 | 4459 | * Lots of small fixes and tweaks. |
|
4445 | 4460 | |
|
4446 | 4461 | * Minor changes to whos format. Now strings are shown, snipped if |
|
4447 | 4462 | too long. |
|
4448 | 4463 | |
|
4449 | 4464 | * Changed ShellServices to work on __main__ so they show up in @who |
|
4450 | 4465 | |
|
4451 | 4466 | * Help also works with ? at the end of a line: |
|
4452 | 4467 | ?sin and sin? |
|
4453 | 4468 | both produce the same effect. This is nice, as often I use the |
|
4454 | 4469 | tab-complete to find the name of a method, but I used to then have |
|
4455 | 4470 | to go to the beginning of the line to put a ? if I wanted more |
|
4456 | 4471 | info. Now I can just add the ? and hit return. Convenient. |
|
4457 | 4472 | |
|
4458 | 4473 | 2001-11-02 Fernando Perez <fperez@colorado.edu> |
|
4459 | 4474 | |
|
4460 | 4475 | * Python version check (>=2.1) added. |
|
4461 | 4476 | |
|
4462 | 4477 | * Added LazyPython documentation. At this point the docs are quite |
|
4463 | 4478 | a mess. A cleanup is in order. |
|
4464 | 4479 | |
|
4465 | 4480 | * Auto-installer created. For some bizarre reason, the zipfiles |
|
4466 | 4481 | module isn't working on my system. So I made a tar version |
|
4467 | 4482 | (hopefully the command line options in various systems won't kill |
|
4468 | 4483 | me). |
|
4469 | 4484 | |
|
4470 | 4485 | * Fixes to Struct in genutils. Now all dictionary-like methods are |
|
4471 | 4486 | protected (reasonably). |
|
4472 | 4487 | |
|
4473 | 4488 | * Added pager function to genutils and changed ? to print usage |
|
4474 | 4489 | note through it (it was too long). |
|
4475 | 4490 | |
|
4476 | 4491 | * Added the LazyPython functionality. Works great! I changed the |
|
4477 | 4492 | auto-quote escape to ';', it's on home row and next to '. But |
|
4478 | 4493 | both auto-quote and auto-paren (still /) escapes are command-line |
|
4479 | 4494 | parameters. |
|
4480 | 4495 | |
|
4481 | 4496 | |
|
4482 | 4497 | 2001-11-01 Fernando Perez <fperez@colorado.edu> |
|
4483 | 4498 | |
|
4484 | 4499 | * Version changed to 0.0.7. Fairly large change: configuration now |
|
4485 | 4500 | is all stored in a directory, by default .ipython. There, all |
|
4486 | 4501 | config files have normal looking names (not .names) |
|
4487 | 4502 | |
|
4488 | 4503 | * Version 0.0.6 Released first to Lucas and Archie as a test |
|
4489 | 4504 | run. Since it's the first 'semi-public' release, change version to |
|
4490 | 4505 | > 0.0.6 for any changes now. |
|
4491 | 4506 | |
|
4492 | 4507 | * Stuff I had put in the ipplib.py changelog: |
|
4493 | 4508 | |
|
4494 | 4509 | Changes to InteractiveShell: |
|
4495 | 4510 | |
|
4496 | 4511 | - Made the usage message a parameter. |
|
4497 | 4512 | |
|
4498 | 4513 | - Require the name of the shell variable to be given. It's a bit |
|
4499 | 4514 | of a hack, but allows the name 'shell' not to be hardwire in the |
|
4500 | 4515 | magic (@) handler, which is problematic b/c it requires |
|
4501 | 4516 | polluting the global namespace with 'shell'. This in turn is |
|
4502 | 4517 | fragile: if a user redefines a variable called shell, things |
|
4503 | 4518 | break. |
|
4504 | 4519 | |
|
4505 | 4520 | - magic @: all functions available through @ need to be defined |
|
4506 | 4521 | as magic_<name>, even though they can be called simply as |
|
4507 | 4522 | @<name>. This allows the special command @magic to gather |
|
4508 | 4523 | information automatically about all existing magic functions, |
|
4509 | 4524 | even if they are run-time user extensions, by parsing the shell |
|
4510 | 4525 | instance __dict__ looking for special magic_ names. |
|
4511 | 4526 | |
|
4512 | 4527 | - mainloop: added *two* local namespace parameters. This allows |
|
4513 | 4528 | the class to differentiate between parameters which were there |
|
4514 | 4529 | before and after command line initialization was processed. This |
|
4515 | 4530 | way, later @who can show things loaded at startup by the |
|
4516 | 4531 | user. This trick was necessary to make session saving/reloading |
|
4517 | 4532 | really work: ideally after saving/exiting/reloading a session, |
|
4518 | 4533 | *everythin* should look the same, including the output of @who. I |
|
4519 | 4534 | was only able to make this work with this double namespace |
|
4520 | 4535 | trick. |
|
4521 | 4536 | |
|
4522 | 4537 | - added a header to the logfile which allows (almost) full |
|
4523 | 4538 | session restoring. |
|
4524 | 4539 | |
|
4525 | 4540 | - prepend lines beginning with @ or !, with a and log |
|
4526 | 4541 | them. Why? !lines: may be useful to know what you did @lines: |
|
4527 | 4542 | they may affect session state. So when restoring a session, at |
|
4528 | 4543 | least inform the user of their presence. I couldn't quite get |
|
4529 | 4544 | them to properly re-execute, but at least the user is warned. |
|
4530 | 4545 | |
|
4531 | 4546 | * Started ChangeLog. |
|
1 | NO CONTENT: file was removed |
General Comments 0
You need to be logged in to leave comments.
Login now