Show More
@@ -1,847 +1,918 b'' | |||||
1 | # -*- coding: utf-8 -*- |
|
1 | # -*- coding: utf-8 -*- | |
2 | """ |
|
2 | """ | |
3 | Pdb debugger class. |
|
3 | Pdb debugger class. | |
4 |
|
4 | |||
5 | Modified from the standard pdb.Pdb class to avoid including readline, so that |
|
5 | Modified from the standard pdb.Pdb class to avoid including readline, so that | |
6 | the command line completion of other programs which include this isn't |
|
6 | the command line completion of other programs which include this isn't | |
7 | damaged. |
|
7 | damaged. | |
8 |
|
8 | |||
9 | In the future, this class will be expanded with improvements over the standard |
|
9 | In the future, this class will be expanded with improvements over the standard | |
10 | pdb. |
|
10 | pdb. | |
11 |
|
11 | |||
12 | The code in this file is mainly lifted out of cmd.py in Python 2.2, with minor |
|
12 | The code in this file is mainly lifted out of cmd.py in Python 2.2, with minor | |
13 | changes. Licensing should therefore be under the standard Python terms. For |
|
13 | changes. Licensing should therefore be under the standard Python terms. For | |
14 | details on the PSF (Python Software Foundation) standard license, see: |
|
14 | details on the PSF (Python Software Foundation) standard license, see: | |
15 |
|
15 | |||
16 | https://docs.python.org/2/license.html |
|
16 | https://docs.python.org/2/license.html | |
17 | """ |
|
17 | """ | |
18 |
|
18 | |||
19 | #***************************************************************************** |
|
19 | #***************************************************************************** | |
20 | # |
|
20 | # | |
21 | # This file is licensed under the PSF license. |
|
21 | # This file is licensed under the PSF license. | |
22 | # |
|
22 | # | |
23 | # Copyright (C) 2001 Python Software Foundation, www.python.org |
|
23 | # Copyright (C) 2001 Python Software Foundation, www.python.org | |
24 | # Copyright (C) 2005-2006 Fernando Perez. <fperez@colorado.edu> |
|
24 | # Copyright (C) 2005-2006 Fernando Perez. <fperez@colorado.edu> | |
25 | # |
|
25 | # | |
26 | # |
|
26 | # | |
27 | #***************************************************************************** |
|
27 | #***************************************************************************** | |
28 |
|
28 | |||
29 | import bdb |
|
29 | import bdb | |
30 | import functools |
|
30 | import functools | |
31 | import inspect |
|
31 | import inspect | |
32 | import linecache |
|
32 | import linecache | |
33 | import sys |
|
33 | import sys | |
34 | import warnings |
|
34 | import warnings | |
35 | import re |
|
35 | import re | |
|
36 | import os | |||
36 |
|
37 | |||
37 | from IPython import get_ipython |
|
38 | from IPython import get_ipython | |
38 | from IPython.utils import PyColorize |
|
39 | from IPython.utils import PyColorize | |
39 | from IPython.utils import coloransi, py3compat |
|
40 | from IPython.utils import coloransi, py3compat | |
40 | from IPython.core.excolors import exception_colors |
|
41 | from IPython.core.excolors import exception_colors | |
41 | from IPython.testing.skipdoctest import skip_doctest |
|
42 | from IPython.testing.skipdoctest import skip_doctest | |
42 |
|
43 | |||
43 |
|
44 | |||
44 | prompt = 'ipdb> ' |
|
45 | prompt = 'ipdb> ' | |
45 |
|
46 | |||
46 | #We have to check this directly from sys.argv, config struct not yet available |
|
47 | #We have to check this directly from sys.argv, config struct not yet available | |
47 | from pdb import Pdb as OldPdb |
|
48 | from pdb import Pdb as OldPdb | |
48 |
|
49 | |||
49 | # Allow the set_trace code to operate outside of an ipython instance, even if |
|
50 | # Allow the set_trace code to operate outside of an ipython instance, even if | |
50 | # it does so with some limitations. The rest of this support is implemented in |
|
51 | # it does so with some limitations. The rest of this support is implemented in | |
51 | # the Tracer constructor. |
|
52 | # the Tracer constructor. | |
52 |
|
53 | |||
53 | def make_arrow(pad): |
|
54 | def make_arrow(pad): | |
54 | """generate the leading arrow in front of traceback or debugger""" |
|
55 | """generate the leading arrow in front of traceback or debugger""" | |
55 | if pad >= 2: |
|
56 | if pad >= 2: | |
56 | return '-'*(pad-2) + '> ' |
|
57 | return '-'*(pad-2) + '> ' | |
57 | elif pad == 1: |
|
58 | elif pad == 1: | |
58 | return '>' |
|
59 | return '>' | |
59 | return '' |
|
60 | return '' | |
60 |
|
61 | |||
61 |
|
62 | |||
62 | def BdbQuit_excepthook(et, ev, tb, excepthook=None): |
|
63 | def BdbQuit_excepthook(et, ev, tb, excepthook=None): | |
63 | """Exception hook which handles `BdbQuit` exceptions. |
|
64 | """Exception hook which handles `BdbQuit` exceptions. | |
64 |
|
65 | |||
65 | All other exceptions are processed using the `excepthook` |
|
66 | All other exceptions are processed using the `excepthook` | |
66 | parameter. |
|
67 | parameter. | |
67 | """ |
|
68 | """ | |
68 | warnings.warn("`BdbQuit_excepthook` is deprecated since version 5.1", |
|
69 | warnings.warn("`BdbQuit_excepthook` is deprecated since version 5.1", | |
69 | DeprecationWarning, stacklevel=2) |
|
70 | DeprecationWarning, stacklevel=2) | |
70 | if et==bdb.BdbQuit: |
|
71 | if et==bdb.BdbQuit: | |
71 | print('Exiting Debugger.') |
|
72 | print('Exiting Debugger.') | |
72 | elif excepthook is not None: |
|
73 | elif excepthook is not None: | |
73 | excepthook(et, ev, tb) |
|
74 | excepthook(et, ev, tb) | |
74 | else: |
|
75 | else: | |
75 | # Backwards compatibility. Raise deprecation warning? |
|
76 | # Backwards compatibility. Raise deprecation warning? | |
76 | BdbQuit_excepthook.excepthook_ori(et,ev,tb) |
|
77 | BdbQuit_excepthook.excepthook_ori(et,ev,tb) | |
77 |
|
78 | |||
78 |
|
79 | |||
79 | def BdbQuit_IPython_excepthook(self,et,ev,tb,tb_offset=None): |
|
80 | def BdbQuit_IPython_excepthook(self,et,ev,tb,tb_offset=None): | |
80 | warnings.warn( |
|
81 | warnings.warn( | |
81 | "`BdbQuit_IPython_excepthook` is deprecated since version 5.1", |
|
82 | "`BdbQuit_IPython_excepthook` is deprecated since version 5.1", | |
82 | DeprecationWarning, stacklevel=2) |
|
83 | DeprecationWarning, stacklevel=2) | |
83 | print('Exiting Debugger.') |
|
84 | print('Exiting Debugger.') | |
84 |
|
85 | |||
85 |
|
86 | |||
86 | class Tracer(object): |
|
87 | class Tracer(object): | |
87 | """ |
|
88 | """ | |
88 | DEPRECATED |
|
89 | DEPRECATED | |
89 |
|
90 | |||
90 | Class for local debugging, similar to pdb.set_trace. |
|
91 | Class for local debugging, similar to pdb.set_trace. | |
91 |
|
92 | |||
92 | Instances of this class, when called, behave like pdb.set_trace, but |
|
93 | Instances of this class, when called, behave like pdb.set_trace, but | |
93 | providing IPython's enhanced capabilities. |
|
94 | providing IPython's enhanced capabilities. | |
94 |
|
95 | |||
95 | This is implemented as a class which must be initialized in your own code |
|
96 | This is implemented as a class which must be initialized in your own code | |
96 | and not as a standalone function because we need to detect at runtime |
|
97 | and not as a standalone function because we need to detect at runtime | |
97 | whether IPython is already active or not. That detection is done in the |
|
98 | whether IPython is already active or not. That detection is done in the | |
98 | constructor, ensuring that this code plays nicely with a running IPython, |
|
99 | constructor, ensuring that this code plays nicely with a running IPython, | |
99 | while functioning acceptably (though with limitations) if outside of it. |
|
100 | while functioning acceptably (though with limitations) if outside of it. | |
100 | """ |
|
101 | """ | |
101 |
|
102 | |||
102 | @skip_doctest |
|
103 | @skip_doctest | |
103 | def __init__(self, colors=None): |
|
104 | def __init__(self, colors=None): | |
104 | """ |
|
105 | """ | |
105 | DEPRECATED |
|
106 | DEPRECATED | |
106 |
|
107 | |||
107 | Create a local debugger instance. |
|
108 | Create a local debugger instance. | |
108 |
|
109 | |||
109 | Parameters |
|
110 | Parameters | |
110 | ---------- |
|
111 | ---------- | |
111 |
|
112 | |||
112 | colors : str, optional |
|
113 | colors : str, optional | |
113 | The name of the color scheme to use, it must be one of IPython's |
|
114 | The name of the color scheme to use, it must be one of IPython's | |
114 | valid color schemes. If not given, the function will default to |
|
115 | valid color schemes. If not given, the function will default to | |
115 | the current IPython scheme when running inside IPython, and to |
|
116 | the current IPython scheme when running inside IPython, and to | |
116 | 'NoColor' otherwise. |
|
117 | 'NoColor' otherwise. | |
117 |
|
118 | |||
118 | Examples |
|
119 | Examples | |
119 | -------- |
|
120 | -------- | |
120 | :: |
|
121 | :: | |
121 |
|
122 | |||
122 | from IPython.core.debugger import Tracer; debug_here = Tracer() |
|
123 | from IPython.core.debugger import Tracer; debug_here = Tracer() | |
123 |
|
124 | |||
124 | Later in your code:: |
|
125 | Later in your code:: | |
125 |
|
126 | |||
126 | debug_here() # -> will open up the debugger at that point. |
|
127 | debug_here() # -> will open up the debugger at that point. | |
127 |
|
128 | |||
128 | Once the debugger activates, you can use all of its regular commands to |
|
129 | Once the debugger activates, you can use all of its regular commands to | |
129 | step through code, set breakpoints, etc. See the pdb documentation |
|
130 | step through code, set breakpoints, etc. See the pdb documentation | |
130 | from the Python standard library for usage details. |
|
131 | from the Python standard library for usage details. | |
131 | """ |
|
132 | """ | |
132 | warnings.warn("`Tracer` is deprecated since version 5.1, directly use " |
|
133 | warnings.warn("`Tracer` is deprecated since version 5.1, directly use " | |
133 | "`IPython.core.debugger.Pdb.set_trace()`", |
|
134 | "`IPython.core.debugger.Pdb.set_trace()`", | |
134 | DeprecationWarning, stacklevel=2) |
|
135 | DeprecationWarning, stacklevel=2) | |
135 |
|
136 | |||
136 | ip = get_ipython() |
|
137 | ip = get_ipython() | |
137 | if ip is None: |
|
138 | if ip is None: | |
138 | # Outside of ipython, we set our own exception hook manually |
|
139 | # Outside of ipython, we set our own exception hook manually | |
139 | sys.excepthook = functools.partial(BdbQuit_excepthook, |
|
140 | sys.excepthook = functools.partial(BdbQuit_excepthook, | |
140 | excepthook=sys.excepthook) |
|
141 | excepthook=sys.excepthook) | |
141 | def_colors = 'NoColor' |
|
142 | def_colors = 'NoColor' | |
142 | else: |
|
143 | else: | |
143 | # In ipython, we use its custom exception handler mechanism |
|
144 | # In ipython, we use its custom exception handler mechanism | |
144 | def_colors = ip.colors |
|
145 | def_colors = ip.colors | |
145 | ip.set_custom_exc((bdb.BdbQuit,), BdbQuit_IPython_excepthook) |
|
146 | ip.set_custom_exc((bdb.BdbQuit,), BdbQuit_IPython_excepthook) | |
146 |
|
147 | |||
147 | if colors is None: |
|
148 | if colors is None: | |
148 | colors = def_colors |
|
149 | colors = def_colors | |
149 |
|
150 | |||
150 | # The stdlib debugger internally uses a modified repr from the `repr` |
|
151 | # The stdlib debugger internally uses a modified repr from the `repr` | |
151 | # module, that limits the length of printed strings to a hardcoded |
|
152 | # module, that limits the length of printed strings to a hardcoded | |
152 | # limit of 30 characters. That much trimming is too aggressive, let's |
|
153 | # limit of 30 characters. That much trimming is too aggressive, let's | |
153 | # at least raise that limit to 80 chars, which should be enough for |
|
154 | # at least raise that limit to 80 chars, which should be enough for | |
154 | # most interactive uses. |
|
155 | # most interactive uses. | |
155 | try: |
|
156 | try: | |
156 | from reprlib import aRepr |
|
157 | from reprlib import aRepr | |
157 | aRepr.maxstring = 80 |
|
158 | aRepr.maxstring = 80 | |
158 | except: |
|
159 | except: | |
159 | # This is only a user-facing convenience, so any error we encounter |
|
160 | # This is only a user-facing convenience, so any error we encounter | |
160 | # here can be warned about but can be otherwise ignored. These |
|
161 | # here can be warned about but can be otherwise ignored. These | |
161 | # printouts will tell us about problems if this API changes |
|
162 | # printouts will tell us about problems if this API changes | |
162 | import traceback |
|
163 | import traceback | |
163 | traceback.print_exc() |
|
164 | traceback.print_exc() | |
164 |
|
165 | |||
165 | self.debugger = Pdb(colors) |
|
166 | self.debugger = Pdb(colors) | |
166 |
|
167 | |||
167 | def __call__(self): |
|
168 | def __call__(self): | |
168 | """Starts an interactive debugger at the point where called. |
|
169 | """Starts an interactive debugger at the point where called. | |
169 |
|
170 | |||
170 | This is similar to the pdb.set_trace() function from the std lib, but |
|
171 | This is similar to the pdb.set_trace() function from the std lib, but | |
171 | using IPython's enhanced debugger.""" |
|
172 | using IPython's enhanced debugger.""" | |
172 |
|
173 | |||
173 | self.debugger.set_trace(sys._getframe().f_back) |
|
174 | self.debugger.set_trace(sys._getframe().f_back) | |
174 |
|
175 | |||
175 |
|
176 | |||
176 | RGX_EXTRA_INDENT = re.compile(r'(?<=\n)\s+') |
|
177 | RGX_EXTRA_INDENT = re.compile(r'(?<=\n)\s+') | |
177 |
|
178 | |||
178 |
|
179 | |||
179 | def strip_indentation(multiline_string): |
|
180 | def strip_indentation(multiline_string): | |
180 | return RGX_EXTRA_INDENT.sub('', multiline_string) |
|
181 | return RGX_EXTRA_INDENT.sub('', multiline_string) | |
181 |
|
182 | |||
182 |
|
183 | |||
183 | def decorate_fn_with_doc(new_fn, old_fn, additional_text=""): |
|
184 | def decorate_fn_with_doc(new_fn, old_fn, additional_text=""): | |
184 | """Make new_fn have old_fn's doc string. This is particularly useful |
|
185 | """Make new_fn have old_fn's doc string. This is particularly useful | |
185 | for the ``do_...`` commands that hook into the help system. |
|
186 | for the ``do_...`` commands that hook into the help system. | |
186 | Adapted from from a comp.lang.python posting |
|
187 | Adapted from from a comp.lang.python posting | |
187 | by Duncan Booth.""" |
|
188 | by Duncan Booth.""" | |
188 | def wrapper(*args, **kw): |
|
189 | def wrapper(*args, **kw): | |
189 | return new_fn(*args, **kw) |
|
190 | return new_fn(*args, **kw) | |
190 | if old_fn.__doc__: |
|
191 | if old_fn.__doc__: | |
191 | wrapper.__doc__ = strip_indentation(old_fn.__doc__) + additional_text |
|
192 | wrapper.__doc__ = strip_indentation(old_fn.__doc__) + additional_text | |
192 | return wrapper |
|
193 | return wrapper | |
193 |
|
194 | |||
194 |
|
195 | |||
195 | class Pdb(OldPdb): |
|
196 | class Pdb(OldPdb): | |
196 | """Modified Pdb class, does not load readline. |
|
197 | """Modified Pdb class, does not load readline. | |
197 |
|
198 | |||
198 | for a standalone version that uses prompt_toolkit, see |
|
199 | for a standalone version that uses prompt_toolkit, see | |
199 | `IPython.terminal.debugger.TerminalPdb` and |
|
200 | `IPython.terminal.debugger.TerminalPdb` and | |
200 | `IPython.terminal.debugger.set_trace()` |
|
201 | `IPython.terminal.debugger.set_trace()` | |
201 | """ |
|
202 | """ | |
202 |
|
203 | |||
203 | def __init__(self, color_scheme=None, completekey=None, |
|
204 | def __init__(self, color_scheme=None, completekey=None, | |
204 | stdin=None, stdout=None, context=5, **kwargs): |
|
205 | stdin=None, stdout=None, context=5, **kwargs): | |
205 | """Create a new IPython debugger. |
|
206 | """Create a new IPython debugger. | |
206 |
|
207 | |||
207 | :param color_scheme: Deprecated, do not use. |
|
208 | :param color_scheme: Deprecated, do not use. | |
208 | :param completekey: Passed to pdb.Pdb. |
|
209 | :param completekey: Passed to pdb.Pdb. | |
209 | :param stdin: Passed to pdb.Pdb. |
|
210 | :param stdin: Passed to pdb.Pdb. | |
210 | :param stdout: Passed to pdb.Pdb. |
|
211 | :param stdout: Passed to pdb.Pdb. | |
211 | :param context: Number of lines of source code context to show when |
|
212 | :param context: Number of lines of source code context to show when | |
212 | displaying stacktrace information. |
|
213 | displaying stacktrace information. | |
213 | :param kwargs: Passed to pdb.Pdb. |
|
214 | :param kwargs: Passed to pdb.Pdb. | |
214 | The possibilities are python version dependent, see the python |
|
215 | The possibilities are python version dependent, see the python | |
215 | docs for more info. |
|
216 | docs for more info. | |
216 | """ |
|
217 | """ | |
217 |
|
218 | |||
218 | # Parent constructor: |
|
219 | # Parent constructor: | |
219 | try: |
|
220 | try: | |
220 | self.context = int(context) |
|
221 | self.context = int(context) | |
221 | if self.context <= 0: |
|
222 | if self.context <= 0: | |
222 | raise ValueError("Context must be a positive integer") |
|
223 | raise ValueError("Context must be a positive integer") | |
223 | except (TypeError, ValueError): |
|
224 | except (TypeError, ValueError): | |
224 | raise ValueError("Context must be a positive integer") |
|
225 | raise ValueError("Context must be a positive integer") | |
225 |
|
226 | |||
226 | # `kwargs` ensures full compatibility with stdlib's `pdb.Pdb`. |
|
227 | # `kwargs` ensures full compatibility with stdlib's `pdb.Pdb`. | |
227 | OldPdb.__init__(self, completekey, stdin, stdout, **kwargs) |
|
228 | OldPdb.__init__(self, completekey, stdin, stdout, **kwargs) | |
228 |
|
229 | |||
229 | # IPython changes... |
|
230 | # IPython changes... | |
230 | self.shell = get_ipython() |
|
231 | self.shell = get_ipython() | |
231 |
|
232 | |||
232 | if self.shell is None: |
|
233 | if self.shell is None: | |
233 | save_main = sys.modules['__main__'] |
|
234 | save_main = sys.modules['__main__'] | |
234 | # No IPython instance running, we must create one |
|
235 | # No IPython instance running, we must create one | |
235 | from IPython.terminal.interactiveshell import \ |
|
236 | from IPython.terminal.interactiveshell import \ | |
236 | TerminalInteractiveShell |
|
237 | TerminalInteractiveShell | |
237 | self.shell = TerminalInteractiveShell.instance() |
|
238 | self.shell = TerminalInteractiveShell.instance() | |
238 | # needed by any code which calls __import__("__main__") after |
|
239 | # needed by any code which calls __import__("__main__") after | |
239 | # the debugger was entered. See also #9941. |
|
240 | # the debugger was entered. See also #9941. | |
240 | sys.modules['__main__'] = save_main |
|
241 | sys.modules['__main__'] = save_main | |
241 |
|
242 | |||
242 | if color_scheme is not None: |
|
243 | if color_scheme is not None: | |
243 | warnings.warn( |
|
244 | warnings.warn( | |
244 | "The `color_scheme` argument is deprecated since version 5.1", |
|
245 | "The `color_scheme` argument is deprecated since version 5.1", | |
245 | DeprecationWarning, stacklevel=2) |
|
246 | DeprecationWarning, stacklevel=2) | |
246 | else: |
|
247 | else: | |
247 | color_scheme = self.shell.colors |
|
248 | color_scheme = self.shell.colors | |
248 |
|
249 | |||
249 | self.aliases = {} |
|
250 | self.aliases = {} | |
250 |
|
251 | |||
251 | # Create color table: we copy the default one from the traceback |
|
252 | # Create color table: we copy the default one from the traceback | |
252 | # module and add a few attributes needed for debugging |
|
253 | # module and add a few attributes needed for debugging | |
253 | self.color_scheme_table = exception_colors() |
|
254 | self.color_scheme_table = exception_colors() | |
254 |
|
255 | |||
255 | # shorthands |
|
256 | # shorthands | |
256 | C = coloransi.TermColors |
|
257 | C = coloransi.TermColors | |
257 | cst = self.color_scheme_table |
|
258 | cst = self.color_scheme_table | |
258 |
|
259 | |||
259 | cst['NoColor'].colors.prompt = C.NoColor |
|
260 | cst['NoColor'].colors.prompt = C.NoColor | |
260 | cst['NoColor'].colors.breakpoint_enabled = C.NoColor |
|
261 | cst['NoColor'].colors.breakpoint_enabled = C.NoColor | |
261 | cst['NoColor'].colors.breakpoint_disabled = C.NoColor |
|
262 | cst['NoColor'].colors.breakpoint_disabled = C.NoColor | |
262 |
|
263 | |||
263 | cst['Linux'].colors.prompt = C.Green |
|
264 | cst['Linux'].colors.prompt = C.Green | |
264 | cst['Linux'].colors.breakpoint_enabled = C.LightRed |
|
265 | cst['Linux'].colors.breakpoint_enabled = C.LightRed | |
265 | cst['Linux'].colors.breakpoint_disabled = C.Red |
|
266 | cst['Linux'].colors.breakpoint_disabled = C.Red | |
266 |
|
267 | |||
267 | cst['LightBG'].colors.prompt = C.Blue |
|
268 | cst['LightBG'].colors.prompt = C.Blue | |
268 | cst['LightBG'].colors.breakpoint_enabled = C.LightRed |
|
269 | cst['LightBG'].colors.breakpoint_enabled = C.LightRed | |
269 | cst['LightBG'].colors.breakpoint_disabled = C.Red |
|
270 | cst['LightBG'].colors.breakpoint_disabled = C.Red | |
270 |
|
271 | |||
271 | cst['Neutral'].colors.prompt = C.Blue |
|
272 | cst['Neutral'].colors.prompt = C.Blue | |
272 | cst['Neutral'].colors.breakpoint_enabled = C.LightRed |
|
273 | cst['Neutral'].colors.breakpoint_enabled = C.LightRed | |
273 | cst['Neutral'].colors.breakpoint_disabled = C.Red |
|
274 | cst['Neutral'].colors.breakpoint_disabled = C.Red | |
274 |
|
275 | |||
275 |
|
276 | |||
276 | # Add a python parser so we can syntax highlight source while |
|
277 | # Add a python parser so we can syntax highlight source while | |
277 | # debugging. |
|
278 | # debugging. | |
278 | self.parser = PyColorize.Parser(style=color_scheme) |
|
279 | self.parser = PyColorize.Parser(style=color_scheme) | |
279 | self.set_colors(color_scheme) |
|
280 | self.set_colors(color_scheme) | |
280 |
|
281 | |||
281 | # Set the prompt - the default prompt is '(Pdb)' |
|
282 | # Set the prompt - the default prompt is '(Pdb)' | |
282 | self.prompt = prompt |
|
283 | self.prompt = prompt | |
283 | self.skip_hidden = True |
|
284 | self.skip_hidden = True | |
284 |
|
285 | |||
|
286 | # list of predicates we use to skip frames | |||
|
287 | self._predicates = {"tbhide": True, "readonly": True, "ipython_internal": True} | |||
|
288 | ||||
285 | def set_colors(self, scheme): |
|
289 | def set_colors(self, scheme): | |
286 | """Shorthand access to the color table scheme selector method.""" |
|
290 | """Shorthand access to the color table scheme selector method.""" | |
287 | self.color_scheme_table.set_active_scheme(scheme) |
|
291 | self.color_scheme_table.set_active_scheme(scheme) | |
288 | self.parser.style = scheme |
|
292 | self.parser.style = scheme | |
289 |
|
293 | |||
290 | def set_trace(self, frame=None): |
|
294 | def set_trace(self, frame=None): | |
291 | if frame is None: |
|
295 | if frame is None: | |
292 | frame = sys._getframe().f_back |
|
296 | frame = sys._getframe().f_back | |
293 | self.initial_frame = frame |
|
297 | self.initial_frame = frame | |
294 | return super().set_trace(frame) |
|
298 | return super().set_trace(frame) | |
295 |
|
299 | |||
|
300 | def _hidden_predicate(self, frame): | |||
|
301 | """ | |||
|
302 | Given a frame return whether it it should be hidden or not by IPython. | |||
|
303 | """ | |||
|
304 | ||||
|
305 | if self._predicates["readonly"]: | |||
|
306 | fname = frame.f_code.co_filename | |||
|
307 | # we need to check for file existence and interactively define | |||
|
308 | # function would otherwise appear as RO. | |||
|
309 | if os.path.isfile(fname) and not os.access(fname, os.W_OK): | |||
|
310 | return True | |||
|
311 | ||||
|
312 | if self._predicates["tbhide"]: | |||
|
313 | if frame in (self.curframe, getattr(self, "initial_frame", None)): | |||
|
314 | return False | |||
|
315 | else: | |||
|
316 | return frame.f_locals.get("__tracebackhide__", False) | |||
|
317 | ||||
|
318 | return False | |||
|
319 | ||||
296 | def hidden_frames(self, stack): |
|
320 | def hidden_frames(self, stack): | |
297 | """ |
|
321 | """ | |
298 | Given an index in the stack return wether it should be skipped. |
|
322 | Given an index in the stack return wether it should be skipped. | |
299 |
|
323 | |||
300 | This is used in up/down and where to skip frames. |
|
324 | This is used in up/down and where to skip frames. | |
301 | """ |
|
325 | """ | |
302 | # The f_locals dictionary is updated from the actual frame |
|
326 | # The f_locals dictionary is updated from the actual frame | |
303 | # locals whenever the .f_locals accessor is called, so we |
|
327 | # locals whenever the .f_locals accessor is called, so we | |
304 | # avoid calling it here to preserve self.curframe_locals. |
|
328 | # avoid calling it here to preserve self.curframe_locals. | |
305 | # Futhermore, there is no good reason to hide the current frame. |
|
329 | # Futhermore, there is no good reason to hide the current frame. | |
306 | ip_hide = [ |
|
330 | ip_hide = [self._hidden_predicate(s[0]) for s in stack] | |
307 | False |
|
|||
308 | if s[0] in (self.curframe, getattr(self, "initial_frame", None)) |
|
|||
309 | else s[0].f_locals.get("__tracebackhide__", False) |
|
|||
310 | for s in stack |
|
|||
311 | ] |
|
|||
312 | ip_start = [i for i, s in enumerate(ip_hide) if s == "__ipython_bottom__"] |
|
331 | ip_start = [i for i, s in enumerate(ip_hide) if s == "__ipython_bottom__"] | |
313 | if ip_start: |
|
332 | if ip_start and self._predicates["ipython_internal"]: | |
314 | ip_hide = [h if i > ip_start[0] else True for (i, h) in enumerate(ip_hide)] |
|
333 | ip_hide = [h if i > ip_start[0] else True for (i, h) in enumerate(ip_hide)] | |
315 | return ip_hide |
|
334 | return ip_hide | |
316 |
|
335 | |||
317 | def interaction(self, frame, traceback): |
|
336 | def interaction(self, frame, traceback): | |
318 | try: |
|
337 | try: | |
319 | OldPdb.interaction(self, frame, traceback) |
|
338 | OldPdb.interaction(self, frame, traceback) | |
320 | except KeyboardInterrupt: |
|
339 | except KeyboardInterrupt: | |
321 | self.stdout.write("\n" + self.shell.get_exception_only()) |
|
340 | self.stdout.write("\n" + self.shell.get_exception_only()) | |
322 |
|
341 | |||
323 | def new_do_frame(self, arg): |
|
342 | def new_do_frame(self, arg): | |
324 | OldPdb.do_frame(self, arg) |
|
343 | OldPdb.do_frame(self, arg) | |
325 |
|
344 | |||
326 | def new_do_quit(self, arg): |
|
345 | def new_do_quit(self, arg): | |
327 |
|
346 | |||
328 | if hasattr(self, 'old_all_completions'): |
|
347 | if hasattr(self, 'old_all_completions'): | |
329 | self.shell.Completer.all_completions=self.old_all_completions |
|
348 | self.shell.Completer.all_completions=self.old_all_completions | |
330 |
|
349 | |||
331 | return OldPdb.do_quit(self, arg) |
|
350 | return OldPdb.do_quit(self, arg) | |
332 |
|
351 | |||
333 | do_q = do_quit = decorate_fn_with_doc(new_do_quit, OldPdb.do_quit) |
|
352 | do_q = do_quit = decorate_fn_with_doc(new_do_quit, OldPdb.do_quit) | |
334 |
|
353 | |||
335 | def new_do_restart(self, arg): |
|
354 | def new_do_restart(self, arg): | |
336 | """Restart command. In the context of ipython this is exactly the same |
|
355 | """Restart command. In the context of ipython this is exactly the same | |
337 | thing as 'quit'.""" |
|
356 | thing as 'quit'.""" | |
338 | self.msg("Restart doesn't make sense here. Using 'quit' instead.") |
|
357 | self.msg("Restart doesn't make sense here. Using 'quit' instead.") | |
339 | return self.do_quit(arg) |
|
358 | return self.do_quit(arg) | |
340 |
|
359 | |||
341 | def print_stack_trace(self, context=None): |
|
360 | def print_stack_trace(self, context=None): | |
342 | Colors = self.color_scheme_table.active_colors |
|
361 | Colors = self.color_scheme_table.active_colors | |
343 | ColorsNormal = Colors.Normal |
|
362 | ColorsNormal = Colors.Normal | |
344 | if context is None: |
|
363 | if context is None: | |
345 | context = self.context |
|
364 | context = self.context | |
346 | try: |
|
365 | try: | |
347 | context=int(context) |
|
366 | context=int(context) | |
348 | if context <= 0: |
|
367 | if context <= 0: | |
349 | raise ValueError("Context must be a positive integer") |
|
368 | raise ValueError("Context must be a positive integer") | |
350 | except (TypeError, ValueError): |
|
369 | except (TypeError, ValueError): | |
351 | raise ValueError("Context must be a positive integer") |
|
370 | raise ValueError("Context must be a positive integer") | |
352 | try: |
|
371 | try: | |
353 | skipped = 0 |
|
372 | skipped = 0 | |
354 | for hidden, frame_lineno in zip(self.hidden_frames(self.stack), self.stack): |
|
373 | for hidden, frame_lineno in zip(self.hidden_frames(self.stack), self.stack): | |
355 | if hidden and self.skip_hidden: |
|
374 | if hidden and self.skip_hidden: | |
356 | skipped += 1 |
|
375 | skipped += 1 | |
357 | continue |
|
376 | continue | |
358 | if skipped: |
|
377 | if skipped: | |
359 | print( |
|
378 | print( | |
360 | f"{Colors.excName} [... skipping {skipped} hidden frame(s)]{ColorsNormal}\n" |
|
379 | f"{Colors.excName} [... skipping {skipped} hidden frame(s)]{ColorsNormal}\n" | |
361 | ) |
|
380 | ) | |
362 | skipped = 0 |
|
381 | skipped = 0 | |
363 | self.print_stack_entry(frame_lineno, context=context) |
|
382 | self.print_stack_entry(frame_lineno, context=context) | |
364 | if skipped: |
|
383 | if skipped: | |
365 | print( |
|
384 | print( | |
366 | f"{Colors.excName} [... skipping {skipped} hidden frame(s)]{ColorsNormal}\n" |
|
385 | f"{Colors.excName} [... skipping {skipped} hidden frame(s)]{ColorsNormal}\n" | |
367 | ) |
|
386 | ) | |
368 | except KeyboardInterrupt: |
|
387 | except KeyboardInterrupt: | |
369 | pass |
|
388 | pass | |
370 |
|
389 | |||
371 | def print_stack_entry(self, frame_lineno, prompt_prefix='\n-> ', |
|
390 | def print_stack_entry(self, frame_lineno, prompt_prefix='\n-> ', | |
372 | context=None): |
|
391 | context=None): | |
373 | if context is None: |
|
392 | if context is None: | |
374 | context = self.context |
|
393 | context = self.context | |
375 | try: |
|
394 | try: | |
376 | context=int(context) |
|
395 | context=int(context) | |
377 | if context <= 0: |
|
396 | if context <= 0: | |
378 | raise ValueError("Context must be a positive integer") |
|
397 | raise ValueError("Context must be a positive integer") | |
379 | except (TypeError, ValueError): |
|
398 | except (TypeError, ValueError): | |
380 | raise ValueError("Context must be a positive integer") |
|
399 | raise ValueError("Context must be a positive integer") | |
381 | print(self.format_stack_entry(frame_lineno, '', context), file=self.stdout) |
|
400 | print(self.format_stack_entry(frame_lineno, '', context), file=self.stdout) | |
382 |
|
401 | |||
383 | # vds: >> |
|
402 | # vds: >> | |
384 | frame, lineno = frame_lineno |
|
403 | frame, lineno = frame_lineno | |
385 | filename = frame.f_code.co_filename |
|
404 | filename = frame.f_code.co_filename | |
386 | self.shell.hooks.synchronize_with_editor(filename, lineno, 0) |
|
405 | self.shell.hooks.synchronize_with_editor(filename, lineno, 0) | |
387 | # vds: << |
|
406 | # vds: << | |
388 |
|
407 | |||
389 | def format_stack_entry(self, frame_lineno, lprefix=': ', context=None): |
|
408 | def format_stack_entry(self, frame_lineno, lprefix=': ', context=None): | |
390 | if context is None: |
|
409 | if context is None: | |
391 | context = self.context |
|
410 | context = self.context | |
392 | try: |
|
411 | try: | |
393 | context=int(context) |
|
412 | context=int(context) | |
394 | if context <= 0: |
|
413 | if context <= 0: | |
395 | print("Context must be a positive integer", file=self.stdout) |
|
414 | print("Context must be a positive integer", file=self.stdout) | |
396 | except (TypeError, ValueError): |
|
415 | except (TypeError, ValueError): | |
397 | print("Context must be a positive integer", file=self.stdout) |
|
416 | print("Context must be a positive integer", file=self.stdout) | |
398 | try: |
|
417 | try: | |
399 | import reprlib # Py 3 |
|
418 | import reprlib # Py 3 | |
400 | except ImportError: |
|
419 | except ImportError: | |
401 | import repr as reprlib # Py 2 |
|
420 | import repr as reprlib # Py 2 | |
402 |
|
421 | |||
403 | ret = [] |
|
422 | ret = [] | |
404 |
|
423 | |||
405 | Colors = self.color_scheme_table.active_colors |
|
424 | Colors = self.color_scheme_table.active_colors | |
406 | ColorsNormal = Colors.Normal |
|
425 | ColorsNormal = Colors.Normal | |
407 | tpl_link = u'%s%%s%s' % (Colors.filenameEm, ColorsNormal) |
|
426 | tpl_link = u'%s%%s%s' % (Colors.filenameEm, ColorsNormal) | |
408 | tpl_call = u'%s%%s%s%%s%s' % (Colors.vName, Colors.valEm, ColorsNormal) |
|
427 | tpl_call = u'%s%%s%s%%s%s' % (Colors.vName, Colors.valEm, ColorsNormal) | |
409 | tpl_line = u'%%s%s%%s %s%%s' % (Colors.lineno, ColorsNormal) |
|
428 | tpl_line = u'%%s%s%%s %s%%s' % (Colors.lineno, ColorsNormal) | |
410 | tpl_line_em = u'%%s%s%%s %s%%s%s' % (Colors.linenoEm, Colors.line, |
|
429 | tpl_line_em = u'%%s%s%%s %s%%s%s' % (Colors.linenoEm, Colors.line, | |
411 | ColorsNormal) |
|
430 | ColorsNormal) | |
412 |
|
431 | |||
413 | frame, lineno = frame_lineno |
|
432 | frame, lineno = frame_lineno | |
414 |
|
433 | |||
415 | return_value = '' |
|
434 | return_value = '' | |
416 | if '__return__' in frame.f_locals: |
|
435 | if '__return__' in frame.f_locals: | |
417 | rv = frame.f_locals['__return__'] |
|
436 | rv = frame.f_locals['__return__'] | |
418 | #return_value += '->' |
|
437 | #return_value += '->' | |
419 | return_value += reprlib.repr(rv) + '\n' |
|
438 | return_value += reprlib.repr(rv) + '\n' | |
420 | ret.append(return_value) |
|
439 | ret.append(return_value) | |
421 |
|
440 | |||
422 | #s = filename + '(' + `lineno` + ')' |
|
441 | #s = filename + '(' + `lineno` + ')' | |
423 | filename = self.canonic(frame.f_code.co_filename) |
|
442 | filename = self.canonic(frame.f_code.co_filename) | |
424 | link = tpl_link % py3compat.cast_unicode(filename) |
|
443 | link = tpl_link % py3compat.cast_unicode(filename) | |
425 |
|
444 | |||
426 | if frame.f_code.co_name: |
|
445 | if frame.f_code.co_name: | |
427 | func = frame.f_code.co_name |
|
446 | func = frame.f_code.co_name | |
428 | else: |
|
447 | else: | |
429 | func = "<lambda>" |
|
448 | func = "<lambda>" | |
430 |
|
449 | |||
431 | call = '' |
|
450 | call = '' | |
432 | if func != '?': |
|
451 | if func != '?': | |
433 | if '__args__' in frame.f_locals: |
|
452 | if '__args__' in frame.f_locals: | |
434 | args = reprlib.repr(frame.f_locals['__args__']) |
|
453 | args = reprlib.repr(frame.f_locals['__args__']) | |
435 | else: |
|
454 | else: | |
436 | args = '()' |
|
455 | args = '()' | |
437 | call = tpl_call % (func, args) |
|
456 | call = tpl_call % (func, args) | |
438 |
|
457 | |||
439 | # The level info should be generated in the same format pdb uses, to |
|
458 | # The level info should be generated in the same format pdb uses, to | |
440 | # avoid breaking the pdbtrack functionality of python-mode in *emacs. |
|
459 | # avoid breaking the pdbtrack functionality of python-mode in *emacs. | |
441 | if frame is self.curframe: |
|
460 | if frame is self.curframe: | |
442 | ret.append('> ') |
|
461 | ret.append('> ') | |
443 | else: |
|
462 | else: | |
444 | ret.append(' ') |
|
463 | ret.append(' ') | |
445 | ret.append(u'%s(%s)%s\n' % (link,lineno,call)) |
|
464 | ret.append(u'%s(%s)%s\n' % (link,lineno,call)) | |
446 |
|
465 | |||
447 | start = lineno - 1 - context//2 |
|
466 | start = lineno - 1 - context//2 | |
448 | lines = linecache.getlines(filename) |
|
467 | lines = linecache.getlines(filename) | |
449 | start = min(start, len(lines) - context) |
|
468 | start = min(start, len(lines) - context) | |
450 | start = max(start, 0) |
|
469 | start = max(start, 0) | |
451 | lines = lines[start : start + context] |
|
470 | lines = lines[start : start + context] | |
452 |
|
471 | |||
453 | for i,line in enumerate(lines): |
|
472 | for i,line in enumerate(lines): | |
454 | show_arrow = (start + 1 + i == lineno) |
|
473 | show_arrow = (start + 1 + i == lineno) | |
455 | linetpl = (frame is self.curframe or show_arrow) \ |
|
474 | linetpl = (frame is self.curframe or show_arrow) \ | |
456 | and tpl_line_em \ |
|
475 | and tpl_line_em \ | |
457 | or tpl_line |
|
476 | or tpl_line | |
458 | ret.append(self.__format_line(linetpl, filename, |
|
477 | ret.append(self.__format_line(linetpl, filename, | |
459 | start + 1 + i, line, |
|
478 | start + 1 + i, line, | |
460 | arrow = show_arrow) ) |
|
479 | arrow = show_arrow) ) | |
461 | return ''.join(ret) |
|
480 | return ''.join(ret) | |
462 |
|
481 | |||
463 | def __format_line(self, tpl_line, filename, lineno, line, arrow = False): |
|
482 | def __format_line(self, tpl_line, filename, lineno, line, arrow = False): | |
464 | bp_mark = "" |
|
483 | bp_mark = "" | |
465 | bp_mark_color = "" |
|
484 | bp_mark_color = "" | |
466 |
|
485 | |||
467 | new_line, err = self.parser.format2(line, 'str') |
|
486 | new_line, err = self.parser.format2(line, 'str') | |
468 | if not err: |
|
487 | if not err: | |
469 | line = new_line |
|
488 | line = new_line | |
470 |
|
489 | |||
471 | bp = None |
|
490 | bp = None | |
472 | if lineno in self.get_file_breaks(filename): |
|
491 | if lineno in self.get_file_breaks(filename): | |
473 | bps = self.get_breaks(filename, lineno) |
|
492 | bps = self.get_breaks(filename, lineno) | |
474 | bp = bps[-1] |
|
493 | bp = bps[-1] | |
475 |
|
494 | |||
476 | if bp: |
|
495 | if bp: | |
477 | Colors = self.color_scheme_table.active_colors |
|
496 | Colors = self.color_scheme_table.active_colors | |
478 | bp_mark = str(bp.number) |
|
497 | bp_mark = str(bp.number) | |
479 | bp_mark_color = Colors.breakpoint_enabled |
|
498 | bp_mark_color = Colors.breakpoint_enabled | |
480 | if not bp.enabled: |
|
499 | if not bp.enabled: | |
481 | bp_mark_color = Colors.breakpoint_disabled |
|
500 | bp_mark_color = Colors.breakpoint_disabled | |
482 |
|
501 | |||
483 | numbers_width = 7 |
|
502 | numbers_width = 7 | |
484 | if arrow: |
|
503 | if arrow: | |
485 | # This is the line with the error |
|
504 | # This is the line with the error | |
486 | pad = numbers_width - len(str(lineno)) - len(bp_mark) |
|
505 | pad = numbers_width - len(str(lineno)) - len(bp_mark) | |
487 | num = '%s%s' % (make_arrow(pad), str(lineno)) |
|
506 | num = '%s%s' % (make_arrow(pad), str(lineno)) | |
488 | else: |
|
507 | else: | |
489 | num = '%*s' % (numbers_width - len(bp_mark), str(lineno)) |
|
508 | num = '%*s' % (numbers_width - len(bp_mark), str(lineno)) | |
490 |
|
509 | |||
491 | return tpl_line % (bp_mark_color + bp_mark, num, line) |
|
510 | return tpl_line % (bp_mark_color + bp_mark, num, line) | |
492 |
|
511 | |||
493 |
|
512 | |||
494 | def print_list_lines(self, filename, first, last): |
|
513 | def print_list_lines(self, filename, first, last): | |
495 | """The printing (as opposed to the parsing part of a 'list' |
|
514 | """The printing (as opposed to the parsing part of a 'list' | |
496 | command.""" |
|
515 | command.""" | |
497 | try: |
|
516 | try: | |
498 | Colors = self.color_scheme_table.active_colors |
|
517 | Colors = self.color_scheme_table.active_colors | |
499 | ColorsNormal = Colors.Normal |
|
518 | ColorsNormal = Colors.Normal | |
500 | tpl_line = '%%s%s%%s %s%%s' % (Colors.lineno, ColorsNormal) |
|
519 | tpl_line = '%%s%s%%s %s%%s' % (Colors.lineno, ColorsNormal) | |
501 | tpl_line_em = '%%s%s%%s %s%%s%s' % (Colors.linenoEm, Colors.line, ColorsNormal) |
|
520 | tpl_line_em = '%%s%s%%s %s%%s%s' % (Colors.linenoEm, Colors.line, ColorsNormal) | |
502 | src = [] |
|
521 | src = [] | |
503 | if filename == "<string>" and hasattr(self, "_exec_filename"): |
|
522 | if filename == "<string>" and hasattr(self, "_exec_filename"): | |
504 | filename = self._exec_filename |
|
523 | filename = self._exec_filename | |
505 |
|
524 | |||
506 | for lineno in range(first, last+1): |
|
525 | for lineno in range(first, last+1): | |
507 | line = linecache.getline(filename, lineno) |
|
526 | line = linecache.getline(filename, lineno) | |
508 | if not line: |
|
527 | if not line: | |
509 | break |
|
528 | break | |
510 |
|
529 | |||
511 | if lineno == self.curframe.f_lineno: |
|
530 | if lineno == self.curframe.f_lineno: | |
512 | line = self.__format_line(tpl_line_em, filename, lineno, line, arrow = True) |
|
531 | line = self.__format_line(tpl_line_em, filename, lineno, line, arrow = True) | |
513 | else: |
|
532 | else: | |
514 | line = self.__format_line(tpl_line, filename, lineno, line, arrow = False) |
|
533 | line = self.__format_line(tpl_line, filename, lineno, line, arrow = False) | |
515 |
|
534 | |||
516 | src.append(line) |
|
535 | src.append(line) | |
517 | self.lineno = lineno |
|
536 | self.lineno = lineno | |
518 |
|
537 | |||
519 | print(''.join(src), file=self.stdout) |
|
538 | print(''.join(src), file=self.stdout) | |
520 |
|
539 | |||
521 | except KeyboardInterrupt: |
|
540 | except KeyboardInterrupt: | |
522 | pass |
|
541 | pass | |
523 |
|
542 | |||
|
543 | def do_skip_predicates(self, args): | |||
|
544 | """ | |||
|
545 | Turn on/off individual predicates as to whether a frame should be hidden/skip. | |||
|
546 | ||||
|
547 | The global option to skip (or not) hidden frames is set with skip_hidden | |||
|
548 | ||||
|
549 | To change the value of a predicate | |||
|
550 | ||||
|
551 | skip_predicates key [true|false] | |||
|
552 | ||||
|
553 | Call without arguments to see the current values. | |||
|
554 | ||||
|
555 | """ | |||
|
556 | if not args.strip(): | |||
|
557 | print("current predicates:") | |||
|
558 | for (p, v) in self._predicates.items(): | |||
|
559 | print(" ", p, ":", v) | |||
|
560 | return | |||
|
561 | type_value = args.strip().split(" ") | |||
|
562 | if len(type_value) != 2: | |||
|
563 | print( | |||
|
564 | f"Usage: skip_predicates <type> <value>, with <type> one of {set(self._predicates.keys())}" | |||
|
565 | ) | |||
|
566 | return | |||
|
567 | ||||
|
568 | type_, value = type_value | |||
|
569 | if type_ not in self._predicates: | |||
|
570 | print(f"{type_!r} not in {set(self._predicates.keys())}") | |||
|
571 | return | |||
|
572 | if value.lower() not in ("true", "yes", "1", "no", "false", "0"): | |||
|
573 | print( | |||
|
574 | f"{value!r} is invalid - use one of ('true', 'yes', '1', 'no', 'false', '0')" | |||
|
575 | ) | |||
|
576 | return | |||
|
577 | ||||
|
578 | self._predicates[type_] = value.lower() in ("true", "yes", "1") | |||
|
579 | if not any(self._predicates.values()): | |||
|
580 | print( | |||
|
581 | "Warning, all predicates set to False, skip_hidden may not have any effects." | |||
|
582 | ) | |||
|
583 | ||||
524 | def do_skip_hidden(self, arg): |
|
584 | def do_skip_hidden(self, arg): | |
525 | """ |
|
585 | """ | |
526 | Change whether or not we should skip frames with the |
|
586 | Change whether or not we should skip frames with the | |
527 | __tracebackhide__ attribute. |
|
587 | __tracebackhide__ attribute. | |
528 | """ |
|
588 | """ | |
529 | if arg.strip().lower() in ("true", "yes"): |
|
589 | if not arg.strip(): | |
|
590 | print( | |||
|
591 | f"skip_hidden = {self.skip_hidden}, use 'yes','no', 'true', or 'false' to change." | |||
|
592 | ) | |||
|
593 | elif arg.strip().lower() in ("true", "yes"): | |||
530 | self.skip_hidden = True |
|
594 | self.skip_hidden = True | |
531 | elif arg.strip().lower() in ("false", "no"): |
|
595 | elif arg.strip().lower() in ("false", "no"): | |
532 | self.skip_hidden = False |
|
596 | self.skip_hidden = False | |
|
597 | if not any(self._predicates.values()): | |||
|
598 | print( | |||
|
599 | "Warning, all predicates set to False, skip_hidden may not have any effects." | |||
|
600 | ) | |||
533 |
|
601 | |||
534 | def do_list(self, arg): |
|
602 | def do_list(self, arg): | |
535 | """Print lines of code from the current stack frame |
|
603 | """Print lines of code from the current stack frame | |
536 | """ |
|
604 | """ | |
537 | self.lastcmd = 'list' |
|
605 | self.lastcmd = 'list' | |
538 | last = None |
|
606 | last = None | |
539 | if arg: |
|
607 | if arg: | |
540 | try: |
|
608 | try: | |
541 | x = eval(arg, {}, {}) |
|
609 | x = eval(arg, {}, {}) | |
542 | if type(x) == type(()): |
|
610 | if type(x) == type(()): | |
543 | first, last = x |
|
611 | first, last = x | |
544 | first = int(first) |
|
612 | first = int(first) | |
545 | last = int(last) |
|
613 | last = int(last) | |
546 | if last < first: |
|
614 | if last < first: | |
547 | # Assume it's a count |
|
615 | # Assume it's a count | |
548 | last = first + last |
|
616 | last = first + last | |
549 | else: |
|
617 | else: | |
550 | first = max(1, int(x) - 5) |
|
618 | first = max(1, int(x) - 5) | |
551 | except: |
|
619 | except: | |
552 | print('*** Error in argument:', repr(arg), file=self.stdout) |
|
620 | print('*** Error in argument:', repr(arg), file=self.stdout) | |
553 | return |
|
621 | return | |
554 | elif self.lineno is None: |
|
622 | elif self.lineno is None: | |
555 | first = max(1, self.curframe.f_lineno - 5) |
|
623 | first = max(1, self.curframe.f_lineno - 5) | |
556 | else: |
|
624 | else: | |
557 | first = self.lineno + 1 |
|
625 | first = self.lineno + 1 | |
558 | if last is None: |
|
626 | if last is None: | |
559 | last = first + 10 |
|
627 | last = first + 10 | |
560 | self.print_list_lines(self.curframe.f_code.co_filename, first, last) |
|
628 | self.print_list_lines(self.curframe.f_code.co_filename, first, last) | |
561 |
|
629 | |||
562 | # vds: >> |
|
630 | # vds: >> | |
563 | lineno = first |
|
631 | lineno = first | |
564 | filename = self.curframe.f_code.co_filename |
|
632 | filename = self.curframe.f_code.co_filename | |
565 | self.shell.hooks.synchronize_with_editor(filename, lineno, 0) |
|
633 | self.shell.hooks.synchronize_with_editor(filename, lineno, 0) | |
566 | # vds: << |
|
634 | # vds: << | |
567 |
|
635 | |||
568 | do_l = do_list |
|
636 | do_l = do_list | |
569 |
|
637 | |||
570 | def getsourcelines(self, obj): |
|
638 | def getsourcelines(self, obj): | |
571 | lines, lineno = inspect.findsource(obj) |
|
639 | lines, lineno = inspect.findsource(obj) | |
572 | if inspect.isframe(obj) and obj.f_globals is obj.f_locals: |
|
640 | if inspect.isframe(obj) and obj.f_globals is obj.f_locals: | |
573 | # must be a module frame: do not try to cut a block out of it |
|
641 | # must be a module frame: do not try to cut a block out of it | |
574 | return lines, 1 |
|
642 | return lines, 1 | |
575 | elif inspect.ismodule(obj): |
|
643 | elif inspect.ismodule(obj): | |
576 | return lines, 1 |
|
644 | return lines, 1 | |
577 | return inspect.getblock(lines[lineno:]), lineno+1 |
|
645 | return inspect.getblock(lines[lineno:]), lineno+1 | |
578 |
|
646 | |||
579 | def do_longlist(self, arg): |
|
647 | def do_longlist(self, arg): | |
580 | """Print lines of code from the current stack frame. |
|
648 | """Print lines of code from the current stack frame. | |
581 |
|
649 | |||
582 | Shows more lines than 'list' does. |
|
650 | Shows more lines than 'list' does. | |
583 | """ |
|
651 | """ | |
584 | self.lastcmd = 'longlist' |
|
652 | self.lastcmd = 'longlist' | |
585 | try: |
|
653 | try: | |
586 | lines, lineno = self.getsourcelines(self.curframe) |
|
654 | lines, lineno = self.getsourcelines(self.curframe) | |
587 | except OSError as err: |
|
655 | except OSError as err: | |
588 | self.error(err) |
|
656 | self.error(err) | |
589 | return |
|
657 | return | |
590 | last = lineno + len(lines) |
|
658 | last = lineno + len(lines) | |
591 | self.print_list_lines(self.curframe.f_code.co_filename, lineno, last) |
|
659 | self.print_list_lines(self.curframe.f_code.co_filename, lineno, last) | |
592 | do_ll = do_longlist |
|
660 | do_ll = do_longlist | |
593 |
|
661 | |||
594 | def do_debug(self, arg): |
|
662 | def do_debug(self, arg): | |
595 | """debug code |
|
663 | """debug code | |
596 | Enter a recursive debugger that steps through the code |
|
664 | Enter a recursive debugger that steps through the code | |
597 | argument (which is an arbitrary expression or statement to be |
|
665 | argument (which is an arbitrary expression or statement to be | |
598 | executed in the current environment). |
|
666 | executed in the current environment). | |
599 | """ |
|
667 | """ | |
600 | trace_function = sys.gettrace() |
|
668 | trace_function = sys.gettrace() | |
601 | sys.settrace(None) |
|
669 | sys.settrace(None) | |
602 | globals = self.curframe.f_globals |
|
670 | globals = self.curframe.f_globals | |
603 | locals = self.curframe_locals |
|
671 | locals = self.curframe_locals | |
604 | p = self.__class__(completekey=self.completekey, |
|
672 | p = self.__class__(completekey=self.completekey, | |
605 | stdin=self.stdin, stdout=self.stdout) |
|
673 | stdin=self.stdin, stdout=self.stdout) | |
606 | p.use_rawinput = self.use_rawinput |
|
674 | p.use_rawinput = self.use_rawinput | |
607 | p.prompt = "(%s) " % self.prompt.strip() |
|
675 | p.prompt = "(%s) " % self.prompt.strip() | |
608 | self.message("ENTERING RECURSIVE DEBUGGER") |
|
676 | self.message("ENTERING RECURSIVE DEBUGGER") | |
609 | sys.call_tracing(p.run, (arg, globals, locals)) |
|
677 | sys.call_tracing(p.run, (arg, globals, locals)) | |
610 | self.message("LEAVING RECURSIVE DEBUGGER") |
|
678 | self.message("LEAVING RECURSIVE DEBUGGER") | |
611 | sys.settrace(trace_function) |
|
679 | sys.settrace(trace_function) | |
612 | self.lastcmd = p.lastcmd |
|
680 | self.lastcmd = p.lastcmd | |
613 |
|
681 | |||
614 | def do_pdef(self, arg): |
|
682 | def do_pdef(self, arg): | |
615 | """Print the call signature for any callable object. |
|
683 | """Print the call signature for any callable object. | |
616 |
|
684 | |||
617 | The debugger interface to %pdef""" |
|
685 | The debugger interface to %pdef""" | |
618 | namespaces = [ |
|
686 | namespaces = [ | |
619 | ("Locals", self.curframe_locals), |
|
687 | ("Locals", self.curframe_locals), | |
620 | ("Globals", self.curframe.f_globals), |
|
688 | ("Globals", self.curframe.f_globals), | |
621 | ] |
|
689 | ] | |
622 | self.shell.find_line_magic("pdef")(arg, namespaces=namespaces) |
|
690 | self.shell.find_line_magic("pdef")(arg, namespaces=namespaces) | |
623 |
|
691 | |||
624 | def do_pdoc(self, arg): |
|
692 | def do_pdoc(self, arg): | |
625 | """Print the docstring for an object. |
|
693 | """Print the docstring for an object. | |
626 |
|
694 | |||
627 | The debugger interface to %pdoc.""" |
|
695 | The debugger interface to %pdoc.""" | |
628 | namespaces = [ |
|
696 | namespaces = [ | |
629 | ("Locals", self.curframe_locals), |
|
697 | ("Locals", self.curframe_locals), | |
630 | ("Globals", self.curframe.f_globals), |
|
698 | ("Globals", self.curframe.f_globals), | |
631 | ] |
|
699 | ] | |
632 | self.shell.find_line_magic("pdoc")(arg, namespaces=namespaces) |
|
700 | self.shell.find_line_magic("pdoc")(arg, namespaces=namespaces) | |
633 |
|
701 | |||
634 | def do_pfile(self, arg): |
|
702 | def do_pfile(self, arg): | |
635 | """Print (or run through pager) the file where an object is defined. |
|
703 | """Print (or run through pager) the file where an object is defined. | |
636 |
|
704 | |||
637 | The debugger interface to %pfile. |
|
705 | The debugger interface to %pfile. | |
638 | """ |
|
706 | """ | |
639 | namespaces = [ |
|
707 | namespaces = [ | |
640 | ("Locals", self.curframe_locals), |
|
708 | ("Locals", self.curframe_locals), | |
641 | ("Globals", self.curframe.f_globals), |
|
709 | ("Globals", self.curframe.f_globals), | |
642 | ] |
|
710 | ] | |
643 | self.shell.find_line_magic("pfile")(arg, namespaces=namespaces) |
|
711 | self.shell.find_line_magic("pfile")(arg, namespaces=namespaces) | |
644 |
|
712 | |||
645 | def do_pinfo(self, arg): |
|
713 | def do_pinfo(self, arg): | |
646 | """Provide detailed information about an object. |
|
714 | """Provide detailed information about an object. | |
647 |
|
715 | |||
648 | The debugger interface to %pinfo, i.e., obj?.""" |
|
716 | The debugger interface to %pinfo, i.e., obj?.""" | |
649 | namespaces = [ |
|
717 | namespaces = [ | |
650 | ("Locals", self.curframe_locals), |
|
718 | ("Locals", self.curframe_locals), | |
651 | ("Globals", self.curframe.f_globals), |
|
719 | ("Globals", self.curframe.f_globals), | |
652 | ] |
|
720 | ] | |
653 | self.shell.find_line_magic("pinfo")(arg, namespaces=namespaces) |
|
721 | self.shell.find_line_magic("pinfo")(arg, namespaces=namespaces) | |
654 |
|
722 | |||
655 | def do_pinfo2(self, arg): |
|
723 | def do_pinfo2(self, arg): | |
656 | """Provide extra detailed information about an object. |
|
724 | """Provide extra detailed information about an object. | |
657 |
|
725 | |||
658 | The debugger interface to %pinfo2, i.e., obj??.""" |
|
726 | The debugger interface to %pinfo2, i.e., obj??.""" | |
659 | namespaces = [ |
|
727 | namespaces = [ | |
660 | ("Locals", self.curframe_locals), |
|
728 | ("Locals", self.curframe_locals), | |
661 | ("Globals", self.curframe.f_globals), |
|
729 | ("Globals", self.curframe.f_globals), | |
662 | ] |
|
730 | ] | |
663 | self.shell.find_line_magic("pinfo2")(arg, namespaces=namespaces) |
|
731 | self.shell.find_line_magic("pinfo2")(arg, namespaces=namespaces) | |
664 |
|
732 | |||
665 | def do_psource(self, arg): |
|
733 | def do_psource(self, arg): | |
666 | """Print (or run through pager) the source code for an object.""" |
|
734 | """Print (or run through pager) the source code for an object.""" | |
667 | namespaces = [ |
|
735 | namespaces = [ | |
668 | ("Locals", self.curframe_locals), |
|
736 | ("Locals", self.curframe_locals), | |
669 | ("Globals", self.curframe.f_globals), |
|
737 | ("Globals", self.curframe.f_globals), | |
670 | ] |
|
738 | ] | |
671 | self.shell.find_line_magic("psource")(arg, namespaces=namespaces) |
|
739 | self.shell.find_line_magic("psource")(arg, namespaces=namespaces) | |
672 |
|
740 | |||
673 | def do_where(self, arg): |
|
741 | def do_where(self, arg): | |
674 | """w(here) |
|
742 | """w(here) | |
675 | Print a stack trace, with the most recent frame at the bottom. |
|
743 | Print a stack trace, with the most recent frame at the bottom. | |
676 | An arrow indicates the "current frame", which determines the |
|
744 | An arrow indicates the "current frame", which determines the | |
677 | context of most commands. 'bt' is an alias for this command. |
|
745 | context of most commands. 'bt' is an alias for this command. | |
678 |
|
746 | |||
679 | Take a number as argument as an (optional) number of context line to |
|
747 | Take a number as argument as an (optional) number of context line to | |
680 | print""" |
|
748 | print""" | |
681 | if arg: |
|
749 | if arg: | |
682 | try: |
|
750 | try: | |
683 | context = int(arg) |
|
751 | context = int(arg) | |
684 | except ValueError as err: |
|
752 | except ValueError as err: | |
685 | self.error(err) |
|
753 | self.error(err) | |
686 | return |
|
754 | return | |
687 | self.print_stack_trace(context) |
|
755 | self.print_stack_trace(context) | |
688 | else: |
|
756 | else: | |
689 | self.print_stack_trace() |
|
757 | self.print_stack_trace() | |
690 |
|
758 | |||
691 | do_w = do_where |
|
759 | do_w = do_where | |
692 |
|
760 | |||
693 | def stop_here(self, frame): |
|
761 | def stop_here(self, frame): | |
694 | """Check if pdb should stop here""" |
|
762 | """Check if pdb should stop here""" | |
695 | if not super().stop_here(frame): |
|
763 | if not super().stop_here(frame): | |
696 | return False |
|
764 | return False | |
697 | if self.skip_hidden and frame.f_locals.get("__tracebackhide__", False): |
|
765 | hidden = False | |
|
766 | if self.skip_hidden: | |||
|
767 | hidden = self._hidden_predicate(frame) | |||
698 | if self._wait_for_mainpyfile: |
|
768 | if self._wait_for_mainpyfile: | |
699 | return False |
|
769 | return False | |
|
770 | if hidden: | |||
700 | Colors = self.color_scheme_table.active_colors |
|
771 | Colors = self.color_scheme_table.active_colors | |
701 | ColorsNormal = Colors.Normal |
|
772 | ColorsNormal = Colors.Normal | |
702 | print(f"{Colors.excName} [... skipped 1 hidden frame]{ColorsNormal}\n") |
|
773 | print(f"{Colors.excName} [... skipped 1 hidden frame]{ColorsNormal}\n") | |
703 | return False |
|
774 | return False | |
704 | return True |
|
775 | return True | |
705 |
|
776 | |||
706 | def do_up(self, arg): |
|
777 | def do_up(self, arg): | |
707 | """u(p) [count] |
|
778 | """u(p) [count] | |
708 | Move the current frame count (default one) levels up in the |
|
779 | Move the current frame count (default one) levels up in the | |
709 | stack trace (to an older frame). |
|
780 | stack trace (to an older frame). | |
710 |
|
781 | |||
711 | Will skip hidden frames. |
|
782 | Will skip hidden frames. | |
712 | """ |
|
783 | """ | |
713 |
|
|
784 | # modified version of upstream that skips | |
714 | # frames with __tracebackide__ |
|
785 | # frames with __tracebackhide__ | |
715 | if self.curindex == 0: |
|
786 | if self.curindex == 0: | |
716 | self.error("Oldest frame") |
|
787 | self.error("Oldest frame") | |
717 | return |
|
788 | return | |
718 | try: |
|
789 | try: | |
719 | count = int(arg or 1) |
|
790 | count = int(arg or 1) | |
720 | except ValueError: |
|
791 | except ValueError: | |
721 | self.error("Invalid frame count (%s)" % arg) |
|
792 | self.error("Invalid frame count (%s)" % arg) | |
722 | return |
|
793 | return | |
723 | skipped = 0 |
|
794 | skipped = 0 | |
724 | if count < 0: |
|
795 | if count < 0: | |
725 | _newframe = 0 |
|
796 | _newframe = 0 | |
726 | else: |
|
797 | else: | |
727 | _newindex = self.curindex |
|
798 | _newindex = self.curindex | |
728 | counter = 0 |
|
799 | counter = 0 | |
729 | hidden_frames = self.hidden_frames(self.stack) |
|
800 | hidden_frames = self.hidden_frames(self.stack) | |
730 | for i in range(self.curindex - 1, -1, -1): |
|
801 | for i in range(self.curindex - 1, -1, -1): | |
731 | frame = self.stack[i][0] |
|
802 | frame = self.stack[i][0] | |
732 | if hidden_frames[i] and self.skip_hidden: |
|
803 | if hidden_frames[i] and self.skip_hidden: | |
733 | skipped += 1 |
|
804 | skipped += 1 | |
734 | continue |
|
805 | continue | |
735 | counter += 1 |
|
806 | counter += 1 | |
736 | if counter >= count: |
|
807 | if counter >= count: | |
737 | break |
|
808 | break | |
738 | else: |
|
809 | else: | |
739 | # if no break occured. |
|
810 | # if no break occured. | |
740 | self.error("all frames above hidden") |
|
811 | self.error("all frames above hidden") | |
741 | return |
|
812 | return | |
742 |
|
813 | |||
743 | Colors = self.color_scheme_table.active_colors |
|
814 | Colors = self.color_scheme_table.active_colors | |
744 | ColorsNormal = Colors.Normal |
|
815 | ColorsNormal = Colors.Normal | |
745 | _newframe = i |
|
816 | _newframe = i | |
746 | self._select_frame(_newframe) |
|
817 | self._select_frame(_newframe) | |
747 | if skipped: |
|
818 | if skipped: | |
748 | print( |
|
819 | print( | |
749 | f"{Colors.excName} [... skipped {skipped} hidden frame(s)]{ColorsNormal}\n" |
|
820 | f"{Colors.excName} [... skipped {skipped} hidden frame(s)]{ColorsNormal}\n" | |
750 | ) |
|
821 | ) | |
751 |
|
822 | |||
752 | def do_down(self, arg): |
|
823 | def do_down(self, arg): | |
753 | """d(own) [count] |
|
824 | """d(own) [count] | |
754 | Move the current frame count (default one) levels down in the |
|
825 | Move the current frame count (default one) levels down in the | |
755 | stack trace (to a newer frame). |
|
826 | stack trace (to a newer frame). | |
756 |
|
827 | |||
757 | Will skip hidden frames. |
|
828 | Will skip hidden frames. | |
758 | """ |
|
829 | """ | |
759 | if self.curindex + 1 == len(self.stack): |
|
830 | if self.curindex + 1 == len(self.stack): | |
760 | self.error("Newest frame") |
|
831 | self.error("Newest frame") | |
761 | return |
|
832 | return | |
762 | try: |
|
833 | try: | |
763 | count = int(arg or 1) |
|
834 | count = int(arg or 1) | |
764 | except ValueError: |
|
835 | except ValueError: | |
765 | self.error("Invalid frame count (%s)" % arg) |
|
836 | self.error("Invalid frame count (%s)" % arg) | |
766 | return |
|
837 | return | |
767 | if count < 0: |
|
838 | if count < 0: | |
768 | _newframe = len(self.stack) - 1 |
|
839 | _newframe = len(self.stack) - 1 | |
769 | else: |
|
840 | else: | |
770 | _newindex = self.curindex |
|
841 | _newindex = self.curindex | |
771 | counter = 0 |
|
842 | counter = 0 | |
772 | skipped = 0 |
|
843 | skipped = 0 | |
773 | hidden_frames = self.hidden_frames(self.stack) |
|
844 | hidden_frames = self.hidden_frames(self.stack) | |
774 | for i in range(self.curindex + 1, len(self.stack)): |
|
845 | for i in range(self.curindex + 1, len(self.stack)): | |
775 | frame = self.stack[i][0] |
|
846 | frame = self.stack[i][0] | |
776 | if hidden_frames[i] and self.skip_hidden: |
|
847 | if hidden_frames[i] and self.skip_hidden: | |
777 | skipped += 1 |
|
848 | skipped += 1 | |
778 | continue |
|
849 | continue | |
779 | counter += 1 |
|
850 | counter += 1 | |
780 | if counter >= count: |
|
851 | if counter >= count: | |
781 | break |
|
852 | break | |
782 | else: |
|
853 | else: | |
783 | self.error("all frames bellow hidden") |
|
854 | self.error("all frames bellow hidden") | |
784 | return |
|
855 | return | |
785 |
|
856 | |||
786 | Colors = self.color_scheme_table.active_colors |
|
857 | Colors = self.color_scheme_table.active_colors | |
787 | ColorsNormal = Colors.Normal |
|
858 | ColorsNormal = Colors.Normal | |
788 | if skipped: |
|
859 | if skipped: | |
789 | print( |
|
860 | print( | |
790 | f"{Colors.excName} [... skipped {skipped} hidden frame(s)]{ColorsNormal}\n" |
|
861 | f"{Colors.excName} [... skipped {skipped} hidden frame(s)]{ColorsNormal}\n" | |
791 | ) |
|
862 | ) | |
792 | _newframe = i |
|
863 | _newframe = i | |
793 |
|
864 | |||
794 | self._select_frame(_newframe) |
|
865 | self._select_frame(_newframe) | |
795 |
|
866 | |||
796 | do_d = do_down |
|
867 | do_d = do_down | |
797 | do_u = do_up |
|
868 | do_u = do_up | |
798 |
|
869 | |||
799 | def do_context(self, context): |
|
870 | def do_context(self, context): | |
800 | """context number_of_lines |
|
871 | """context number_of_lines | |
801 | Set the number of lines of source code to show when displaying |
|
872 | Set the number of lines of source code to show when displaying | |
802 | stacktrace information. |
|
873 | stacktrace information. | |
803 | """ |
|
874 | """ | |
804 | try: |
|
875 | try: | |
805 | new_context = int(context) |
|
876 | new_context = int(context) | |
806 | if new_context <= 0: |
|
877 | if new_context <= 0: | |
807 | raise ValueError() |
|
878 | raise ValueError() | |
808 | self.context = new_context |
|
879 | self.context = new_context | |
809 | except ValueError: |
|
880 | except ValueError: | |
810 | self.error("The 'context' command requires a positive integer argument.") |
|
881 | self.error("The 'context' command requires a positive integer argument.") | |
811 |
|
882 | |||
812 |
|
883 | |||
813 | class InterruptiblePdb(Pdb): |
|
884 | class InterruptiblePdb(Pdb): | |
814 | """Version of debugger where KeyboardInterrupt exits the debugger altogether.""" |
|
885 | """Version of debugger where KeyboardInterrupt exits the debugger altogether.""" | |
815 |
|
886 | |||
816 | def cmdloop(self): |
|
887 | def cmdloop(self): | |
817 | """Wrap cmdloop() such that KeyboardInterrupt stops the debugger.""" |
|
888 | """Wrap cmdloop() such that KeyboardInterrupt stops the debugger.""" | |
818 | try: |
|
889 | try: | |
819 | return OldPdb.cmdloop(self) |
|
890 | return OldPdb.cmdloop(self) | |
820 | except KeyboardInterrupt: |
|
891 | except KeyboardInterrupt: | |
821 | self.stop_here = lambda frame: False |
|
892 | self.stop_here = lambda frame: False | |
822 | self.do_quit("") |
|
893 | self.do_quit("") | |
823 | sys.settrace(None) |
|
894 | sys.settrace(None) | |
824 | self.quitting = False |
|
895 | self.quitting = False | |
825 | raise |
|
896 | raise | |
826 |
|
897 | |||
827 | def _cmdloop(self): |
|
898 | def _cmdloop(self): | |
828 | while True: |
|
899 | while True: | |
829 | try: |
|
900 | try: | |
830 | # keyboard interrupts allow for an easy way to cancel |
|
901 | # keyboard interrupts allow for an easy way to cancel | |
831 | # the current command, so allow them during interactive input |
|
902 | # the current command, so allow them during interactive input | |
832 | self.allow_kbdint = True |
|
903 | self.allow_kbdint = True | |
833 | self.cmdloop() |
|
904 | self.cmdloop() | |
834 | self.allow_kbdint = False |
|
905 | self.allow_kbdint = False | |
835 | break |
|
906 | break | |
836 | except KeyboardInterrupt: |
|
907 | except KeyboardInterrupt: | |
837 | self.message('--KeyboardInterrupt--') |
|
908 | self.message('--KeyboardInterrupt--') | |
838 | raise |
|
909 | raise | |
839 |
|
910 | |||
840 |
|
911 | |||
841 | def set_trace(frame=None): |
|
912 | def set_trace(frame=None): | |
842 | """ |
|
913 | """ | |
843 | Start debugging from `frame`. |
|
914 | Start debugging from `frame`. | |
844 |
|
915 | |||
845 | If frame is not specified, debugging starts from caller's frame. |
|
916 | If frame is not specified, debugging starts from caller's frame. | |
846 | """ |
|
917 | """ | |
847 | Pdb().set_trace(frame or sys._getframe().f_back) |
|
918 | Pdb().set_trace(frame or sys._getframe().f_back) |
@@ -1,1336 +1,1380 b'' | |||||
1 | ============ |
|
1 | ============ | |
2 | 7.x Series |
|
2 | 7.x Series | |
3 | ============ |
|
3 | ============ | |
4 |
|
4 | |||
|
5 | ||||
|
6 | The debugger (and ``%debug`` magic) have been improved to skip and hide frames | |||
|
7 | originating from files that are not writable to the user, as these are less | |||
|
8 | likely to be the source of errors, or be part of system files. | |||
|
9 | ||||
|
10 | In addition to the global ``skip_hidden True|False`` command, the debugger has | |||
|
11 | gained finer grained control of predicates as to whether to a frame should be | |||
|
12 | considered hidden. So far 3 predicates are available and activated by default: | |||
|
13 | ||||
|
14 | - ``tbhide``: frames containing the local variable ``__tracebackhide__`` set to | |||
|
15 | True. | |||
|
16 | - ``readonly``: frames originating from readonly files. | |||
|
17 | - ``ipython_internal``: frames that are likely to be from IPython internal code. | |||
|
18 | ||||
|
19 | You can toggle individual predicates during a session with | |||
|
20 | ||||
|
21 | .. code-block:: | |||
|
22 | ||||
|
23 | ipdb> skip_predicates readonly False | |||
|
24 | ||||
|
25 | Read-only files will not be considered hidden frames. | |||
|
26 | ||||
|
27 | ||||
|
28 | You can call ``skip_predicates`` without arguments to see the states of current | |||
|
29 | predicates: | |||
|
30 | ||||
|
31 | .. code-block:: | |||
|
32 | ||||
|
33 | ipdb> skip_predicates | |||
|
34 | current predicates: | |||
|
35 | tbhide : True | |||
|
36 | readonly : True | |||
|
37 | ipython_internal : True | |||
|
38 | ||||
|
39 | If all predicates are set to ``False``, ``skip_hidden`` will practically have | |||
|
40 | no effect. We attempt to warn you when all predicates are False. | |||
|
41 | ||||
|
42 | Note that the ``readonly`` predicate may increase disk access as we check for | |||
|
43 | file access permission for all frames on many command invocation, but is usually | |||
|
44 | cached by operating system. Let us know if you encounter any issues. | |||
|
45 | ||||
|
46 | ||||
|
47 | ||||
|
48 | ||||
5 | .. _version 7.23: |
|
49 | .. _version 7.23: | |
6 |
|
50 | |||
7 | IPython 7.23 |
|
51 | IPython 7.23 | |
8 | ============ |
|
52 | ============ | |
9 |
|
53 | |||
10 | Third release of IPython for 2021, mostly containing bug fixes. A couple of not |
|
54 | Third release of IPython for 2021, mostly containing bug fixes. A couple of not | |
11 | typical updates: |
|
55 | typical updates: | |
12 |
|
56 | |||
13 | - We moved to GitHub actions away from Travis-CI, the transition may not be |
|
57 | - We moved to GitHub actions away from Travis-CI, the transition may not be | |
14 | 100% complete (not testing on nightly anymore), but as we ran out of |
|
58 | 100% complete (not testing on nightly anymore), but as we ran out of | |
15 | Travis-Ci hours on the IPython organisation that was a necessary step. |
|
59 | Travis-Ci hours on the IPython organisation that was a necessary step. | |
16 | :ghpull:`12900`. |
|
60 | :ghpull:`12900`. | |
17 |
|
61 | |||
18 | - We have a new dependency: ``matplotlib-inline``, which try to extract |
|
62 | - We have a new dependency: ``matplotlib-inline``, which try to extract | |
19 | matplotlib inline backend specific behavior. It is available on PyPI and |
|
63 | matplotlib inline backend specific behavior. It is available on PyPI and | |
20 | conda-forge thus should not be a problem to upgrade to this version. If you |
|
64 | conda-forge thus should not be a problem to upgrade to this version. If you | |
21 | are a package maintainer that might be an extra dependency to package first. |
|
65 | are a package maintainer that might be an extra dependency to package first. | |
22 | :ghpull:`12817` |
|
66 | :ghpull:`12817` | |
23 |
|
67 | |||
24 | In the addition/new feature category, ``display()`` now have a ``clear=True`` |
|
68 | In the addition/new feature category, ``display()`` now have a ``clear=True`` | |
25 | option to clear the display if any further outputs arrives, allowing users to |
|
69 | option to clear the display if any further outputs arrives, allowing users to | |
26 | avoid having to use ``clear_output()`` directly. :ghpull:`12823`. |
|
70 | avoid having to use ``clear_output()`` directly. :ghpull:`12823`. | |
27 |
|
71 | |||
28 | In bug fixes category, this release fix an issue when printing tracebacks |
|
72 | In bug fixes category, this release fix an issue when printing tracebacks | |
29 | containing Unicode characters :ghpull:`12758`. |
|
73 | containing Unicode characters :ghpull:`12758`. | |
30 |
|
74 | |||
31 | In code cleanup category :ghpull:`12932` remove usage of some deprecated |
|
75 | In code cleanup category :ghpull:`12932` remove usage of some deprecated | |
32 | functionality for compatibility with Python 3.10. |
|
76 | functionality for compatibility with Python 3.10. | |
33 |
|
77 | |||
34 |
|
78 | |||
35 | Thanks |
|
79 | Thanks | |
36 | ------ |
|
80 | ------ | |
37 |
|
81 | |||
38 | Many thanks to all the contributors to this release you can find all individual |
|
82 | Many thanks to all the contributors to this release you can find all individual | |
39 | contributions to this milestone `on github <https://github.com/ipython/ipython/milestone/86>`__. |
|
83 | contributions to this milestone `on github <https://github.com/ipython/ipython/milestone/86>`__. | |
40 | In particular MrMino for responding to almost all new issues, and triaging many |
|
84 | In particular MrMino for responding to almost all new issues, and triaging many | |
41 | of the old ones, as well as takluyver, minrk, willingc for reacting quikly when |
|
85 | of the old ones, as well as takluyver, minrk, willingc for reacting quikly when | |
42 | we ran out of CI Hours. |
|
86 | we ran out of CI Hours. | |
43 |
|
87 | |||
44 | Thanks as well to organisations, QuantStack (martinRenou and SylvainCorlay) for |
|
88 | Thanks as well to organisations, QuantStack (martinRenou and SylvainCorlay) for | |
45 | extracting matplotlib inline backend into its own package, and the `D. E. Shaw group |
|
89 | extracting matplotlib inline backend into its own package, and the `D. E. Shaw group | |
46 | <https://deshaw.com/>`__ for sponsoring work on IPython and related libraries. |
|
90 | <https://deshaw.com/>`__ for sponsoring work on IPython and related libraries. | |
47 |
|
91 | |||
48 |
|
92 | |||
49 | .. _version 7.22: |
|
93 | .. _version 7.22: | |
50 |
|
94 | |||
51 | IPython 7.22 |
|
95 | IPython 7.22 | |
52 | ============ |
|
96 | ============ | |
53 |
|
97 | |||
54 | Second release of IPython for 2021, mostly containing bug fixes. Here is a quick |
|
98 | Second release of IPython for 2021, mostly containing bug fixes. Here is a quick | |
55 | rundown of the few changes. |
|
99 | rundown of the few changes. | |
56 |
|
100 | |||
57 | - Fix some ``sys.excepthook`` shenanigan when embedding with qt, recommended if |
|
101 | - Fix some ``sys.excepthook`` shenanigan when embedding with qt, recommended if | |
58 | you β for example β use `napari <https://napari.org>`__. :ghpull:`12842`. |
|
102 | you β for example β use `napari <https://napari.org>`__. :ghpull:`12842`. | |
59 | - Fix bug when using the new ipdb ``%context`` magic :ghpull:`12844` |
|
103 | - Fix bug when using the new ipdb ``%context`` magic :ghpull:`12844` | |
60 | - Couples of deprecation cleanup :ghpull:`12868` |
|
104 | - Couples of deprecation cleanup :ghpull:`12868` | |
61 | - Update for new dpast.com api if you use the ``%pastbin`` magic. :ghpull:`12712` |
|
105 | - Update for new dpast.com api if you use the ``%pastbin`` magic. :ghpull:`12712` | |
62 | - Remove support for numpy before 1.16. :ghpull:`12836` |
|
106 | - Remove support for numpy before 1.16. :ghpull:`12836` | |
63 |
|
107 | |||
64 |
|
108 | |||
65 | Thanks |
|
109 | Thanks | |
66 | ------ |
|
110 | ------ | |
67 |
|
111 | |||
68 | We have a new team member that you should see more often on the IPython |
|
112 | We have a new team member that you should see more often on the IPython | |
69 | repository, BΕaΕΌej Michalik (@MrMino) have been doing regular contributions to |
|
113 | repository, BΕaΕΌej Michalik (@MrMino) have been doing regular contributions to | |
70 | IPython, and spent time replying to many issues and guiding new users to the |
|
114 | IPython, and spent time replying to many issues and guiding new users to the | |
71 | codebase; they now have triage permissions to the IPython repository and we'll |
|
115 | codebase; they now have triage permissions to the IPython repository and we'll | |
72 | work toward giving them more permission in the future. |
|
116 | work toward giving them more permission in the future. | |
73 |
|
117 | |||
74 | Many thanks to all the contributors to this release you can find all individual |
|
118 | Many thanks to all the contributors to this release you can find all individual | |
75 | contributions to this milestone `on github <https://github.com/ipython/ipython/milestone/84>`__. |
|
119 | contributions to this milestone `on github <https://github.com/ipython/ipython/milestone/84>`__. | |
76 |
|
120 | |||
77 | Thanks as well to organisations, QuantStack for working on debugger |
|
121 | Thanks as well to organisations, QuantStack for working on debugger | |
78 | compatibility for Xeus_python, and the `D. E. Shaw group |
|
122 | compatibility for Xeus_python, and the `D. E. Shaw group | |
79 | <https://deshaw.com/>`__ for sponsoring work on IPython and related libraries. |
|
123 | <https://deshaw.com/>`__ for sponsoring work on IPython and related libraries. | |
80 |
|
124 | |||
81 | .. _version 721: |
|
125 | .. _version 721: | |
82 |
|
126 | |||
83 | IPython 7.21 |
|
127 | IPython 7.21 | |
84 | ============ |
|
128 | ============ | |
85 |
|
129 | |||
86 | IPython 7.21 is the first release we have back on schedule of one release every |
|
130 | IPython 7.21 is the first release we have back on schedule of one release every | |
87 | month; it contains a number of minor fixes and improvements, notably, the new |
|
131 | month; it contains a number of minor fixes and improvements, notably, the new | |
88 | context command for ipdb |
|
132 | context command for ipdb | |
89 |
|
133 | |||
90 |
|
134 | |||
91 | New "context" command in ipdb |
|
135 | New "context" command in ipdb | |
92 | ----------------------------- |
|
136 | ----------------------------- | |
93 |
|
137 | |||
94 | It is now possible to change the number of lines shown in the backtrace |
|
138 | It is now possible to change the number of lines shown in the backtrace | |
95 | information in ipdb using "context" command. :ghpull:`12826` |
|
139 | information in ipdb using "context" command. :ghpull:`12826` | |
96 |
|
140 | |||
97 | (thanks @MrMino, there are other improvement from them on master). |
|
141 | (thanks @MrMino, there are other improvement from them on master). | |
98 |
|
142 | |||
99 | Other notable changes in IPython 7.21 |
|
143 | Other notable changes in IPython 7.21 | |
100 | ------------------------------------- |
|
144 | ------------------------------------- | |
101 |
|
145 | |||
102 | - Fix some issues on new osx-arm64 :ghpull:`12804`, :ghpull:`12807`. |
|
146 | - Fix some issues on new osx-arm64 :ghpull:`12804`, :ghpull:`12807`. | |
103 | - Compatibility with Xeus-Python for debugger protocol, :ghpull:`12809` |
|
147 | - Compatibility with Xeus-Python for debugger protocol, :ghpull:`12809` | |
104 | - Misc docs fixes for compatibility and uniformity with Numpydoc. |
|
148 | - Misc docs fixes for compatibility and uniformity with Numpydoc. | |
105 | :ghpull:`12824` |
|
149 | :ghpull:`12824` | |
106 |
|
150 | |||
107 |
|
151 | |||
108 | Thanks |
|
152 | Thanks | |
109 | ------ |
|
153 | ------ | |
110 |
|
154 | |||
111 | Many thanks to all the contributors to this release you can find all individual |
|
155 | Many thanks to all the contributors to this release you can find all individual | |
112 | contribution to this milestone `on github <https://github.com/ipython/ipython/milestone/83>`__. |
|
156 | contribution to this milestone `on github <https://github.com/ipython/ipython/milestone/83>`__. | |
113 |
|
157 | |||
114 |
|
158 | |||
115 | .. _version 720: |
|
159 | .. _version 720: | |
116 |
|
160 | |||
117 | IPython 7.20 |
|
161 | IPython 7.20 | |
118 | ============ |
|
162 | ============ | |
119 |
|
163 | |||
120 | IPython 7.20 is the accumulation of 3 month of work on IPython, spacing between |
|
164 | IPython 7.20 is the accumulation of 3 month of work on IPython, spacing between | |
121 | IPython release have been increased from the usual once a month for various |
|
165 | IPython release have been increased from the usual once a month for various | |
122 | reason. |
|
166 | reason. | |
123 |
|
167 | |||
124 | - Mainly as I'm too busy and the effectively sole maintainer, and |
|
168 | - Mainly as I'm too busy and the effectively sole maintainer, and | |
125 | - Second because not much changes happened before mid December. |
|
169 | - Second because not much changes happened before mid December. | |
126 |
|
170 | |||
127 | The main driver for this release was the new version of Jedi 0.18 breaking API; |
|
171 | The main driver for this release was the new version of Jedi 0.18 breaking API; | |
128 | which was taken care of in the master branch early in 2020 but not in 7.x as I |
|
172 | which was taken care of in the master branch early in 2020 but not in 7.x as I | |
129 | though that by now 8.0 would be out. |
|
173 | though that by now 8.0 would be out. | |
130 |
|
174 | |||
131 | The inclusion of a resolver in pip did not help and actually made things worse. |
|
175 | The inclusion of a resolver in pip did not help and actually made things worse. | |
132 | If usually I would have simply pinned Jedi to ``<0.18``; this is not a solution |
|
176 | If usually I would have simply pinned Jedi to ``<0.18``; this is not a solution | |
133 | anymore as now pip is free to install Jedi 0.18, and downgrade IPython. |
|
177 | anymore as now pip is free to install Jedi 0.18, and downgrade IPython. | |
134 |
|
178 | |||
135 | I'll do my best to keep the regular release, but as the 8.0-dev branch and 7.x |
|
179 | I'll do my best to keep the regular release, but as the 8.0-dev branch and 7.x | |
136 | are starting to diverge this is becoming difficult in particular with my limited |
|
180 | are starting to diverge this is becoming difficult in particular with my limited | |
137 | time, so if you have any cycles to spare I'll appreciate your help to respond to |
|
181 | time, so if you have any cycles to spare I'll appreciate your help to respond to | |
138 | issues and pushing 8.0 forward. |
|
182 | issues and pushing 8.0 forward. | |
139 |
|
183 | |||
140 | Here are thus some of the changes for IPython 7.20. |
|
184 | Here are thus some of the changes for IPython 7.20. | |
141 |
|
185 | |||
142 | - Support for PyQt5 >= 5.11 :ghpull:`12715` |
|
186 | - Support for PyQt5 >= 5.11 :ghpull:`12715` | |
143 | - ``%reset`` remove imports more agressively :ghpull:`12718` |
|
187 | - ``%reset`` remove imports more agressively :ghpull:`12718` | |
144 | - fix the ``%conda`` magic :ghpull:`12739` |
|
188 | - fix the ``%conda`` magic :ghpull:`12739` | |
145 | - compatibility with Jedi 0.18, and bump minimum Jedi version. :ghpull:`12793` |
|
189 | - compatibility with Jedi 0.18, and bump minimum Jedi version. :ghpull:`12793` | |
146 |
|
190 | |||
147 |
|
191 | |||
148 | .. _version 719: |
|
192 | .. _version 719: | |
149 |
|
193 | |||
150 | IPython 7.19 |
|
194 | IPython 7.19 | |
151 | ============ |
|
195 | ============ | |
152 |
|
196 | |||
153 | IPython 7.19 accumulative two month of works, bug fixes and improvements, there |
|
197 | IPython 7.19 accumulative two month of works, bug fixes and improvements, there | |
154 | was exceptionally no release last month. |
|
198 | was exceptionally no release last month. | |
155 |
|
199 | |||
156 | - Fix to restore the ability to specify more than one extension using command |
|
200 | - Fix to restore the ability to specify more than one extension using command | |
157 | line flags when using traitlets 5.0 :ghpull:`12543` |
|
201 | line flags when using traitlets 5.0 :ghpull:`12543` | |
158 | - Docs docs formatting that make the install commands work on zsh |
|
202 | - Docs docs formatting that make the install commands work on zsh | |
159 | :ghpull:`12587` |
|
203 | :ghpull:`12587` | |
160 | - Always display the last frame in tracebacks even if hidden with |
|
204 | - Always display the last frame in tracebacks even if hidden with | |
161 | ``__traceback_hide__`` :ghpull:`12601` |
|
205 | ``__traceback_hide__`` :ghpull:`12601` | |
162 | - Avoid an issue where a callback can be registered multiple times. |
|
206 | - Avoid an issue where a callback can be registered multiple times. | |
163 | :ghpull:`12625` |
|
207 | :ghpull:`12625` | |
164 | - Avoid an issue in debugger mode where frames changes could be lost. |
|
208 | - Avoid an issue in debugger mode where frames changes could be lost. | |
165 | :ghpull:`12627` |
|
209 | :ghpull:`12627` | |
166 |
|
210 | |||
167 | - Never hide the frames that invoke a debugger, even if marked as hidden by |
|
211 | - Never hide the frames that invoke a debugger, even if marked as hidden by | |
168 | ``__traceback_hide__`` :ghpull:`12631` |
|
212 | ``__traceback_hide__`` :ghpull:`12631` | |
169 | - Fix calling the debugger in a recursive manner :ghpull:`12659` |
|
213 | - Fix calling the debugger in a recursive manner :ghpull:`12659` | |
170 |
|
214 | |||
171 |
|
215 | |||
172 | A number of code changes have landed on master and we are getting close to |
|
216 | A number of code changes have landed on master and we are getting close to | |
173 | enough new features and codebase improvement that a 8.0 start to make sens. |
|
217 | enough new features and codebase improvement that a 8.0 start to make sens. | |
174 | For downstream packages, please start working on migrating downstream testing |
|
218 | For downstream packages, please start working on migrating downstream testing | |
175 | away from iptest and using pytest, as nose will not work on Python 3.10 and we |
|
219 | away from iptest and using pytest, as nose will not work on Python 3.10 and we | |
176 | will likely start removing it as a dependency for testing. |
|
220 | will likely start removing it as a dependency for testing. | |
177 |
|
221 | |||
178 | .. _version 718: |
|
222 | .. _version 718: | |
179 |
|
223 | |||
180 | IPython 7.18 |
|
224 | IPython 7.18 | |
181 | ============ |
|
225 | ============ | |
182 |
|
226 | |||
183 | IPython 7.18 is a minor release that mostly contains bugfixes. |
|
227 | IPython 7.18 is a minor release that mostly contains bugfixes. | |
184 |
|
228 | |||
185 | - ``CRLF`` is now handled by magics my default; solving some issues due to copy |
|
229 | - ``CRLF`` is now handled by magics my default; solving some issues due to copy | |
186 | pasting on windows. :ghpull:`12475` |
|
230 | pasting on windows. :ghpull:`12475` | |
187 |
|
231 | |||
188 | - Requiring pexpect ``>=4.3`` as we are Python 3.7+ only and earlier version of |
|
232 | - Requiring pexpect ``>=4.3`` as we are Python 3.7+ only and earlier version of | |
189 | pexpect will be incompatible. :ghpull:`12510` |
|
233 | pexpect will be incompatible. :ghpull:`12510` | |
190 |
|
234 | |||
191 | - Minimum jedi version is now 0.16. :ghpull:`12488` |
|
235 | - Minimum jedi version is now 0.16. :ghpull:`12488` | |
192 |
|
236 | |||
193 |
|
237 | |||
194 |
|
238 | |||
195 | .. _version 717: |
|
239 | .. _version 717: | |
196 |
|
240 | |||
197 | IPython 7.17 |
|
241 | IPython 7.17 | |
198 | ============ |
|
242 | ============ | |
199 |
|
243 | |||
200 | IPython 7.17 brings a couple of new improvements to API and a couple of user |
|
244 | IPython 7.17 brings a couple of new improvements to API and a couple of user | |
201 | facing changes to make the terminal experience more user friendly. |
|
245 | facing changes to make the terminal experience more user friendly. | |
202 |
|
246 | |||
203 | :ghpull:`12407` introduces the ability to pass extra argument to the IPython |
|
247 | :ghpull:`12407` introduces the ability to pass extra argument to the IPython | |
204 | debugger class; this is to help a new project from ``kmaork`` |
|
248 | debugger class; this is to help a new project from ``kmaork`` | |
205 | (https://github.com/kmaork/madbg) to feature a fully remote debugger. |
|
249 | (https://github.com/kmaork/madbg) to feature a fully remote debugger. | |
206 |
|
250 | |||
207 | :ghpull:`12410` finally remove support for 3.6, while the codebase is still |
|
251 | :ghpull:`12410` finally remove support for 3.6, while the codebase is still | |
208 | technically compatible; IPython will not install on Python 3.6. |
|
252 | technically compatible; IPython will not install on Python 3.6. | |
209 |
|
253 | |||
210 | lots of work on the debugger and hidden frames from ``@impact27`` in |
|
254 | lots of work on the debugger and hidden frames from ``@impact27`` in | |
211 | :ghpull:`12437`, :ghpull:`12445`, :ghpull:`12460` and in particular |
|
255 | :ghpull:`12437`, :ghpull:`12445`, :ghpull:`12460` and in particular | |
212 | :ghpull:`12453` which make the debug magic more robust at handling spaces. |
|
256 | :ghpull:`12453` which make the debug magic more robust at handling spaces. | |
213 |
|
257 | |||
214 | Biggest API addition is code transformation which is done before code execution; |
|
258 | Biggest API addition is code transformation which is done before code execution; | |
215 | IPython allows a number of hooks to catch non-valid Python syntax (magic, prompt |
|
259 | IPython allows a number of hooks to catch non-valid Python syntax (magic, prompt | |
216 | stripping...etc). Transformers are usually called many time; typically: |
|
260 | stripping...etc). Transformers are usually called many time; typically: | |
217 |
|
261 | |||
218 | - When trying to figure out whether the code is complete and valid (should we |
|
262 | - When trying to figure out whether the code is complete and valid (should we | |
219 | insert a new line or execute ?) |
|
263 | insert a new line or execute ?) | |
220 | - During actual code execution pass before giving the code to Python's |
|
264 | - During actual code execution pass before giving the code to Python's | |
221 | ``exec``. |
|
265 | ``exec``. | |
222 |
|
266 | |||
223 | This lead to issues when transformer might have had side effects; or do external |
|
267 | This lead to issues when transformer might have had side effects; or do external | |
224 | queries. Starting with IPython 7.17 you can expect your transformer to be called |
|
268 | queries. Starting with IPython 7.17 you can expect your transformer to be called | |
225 | less time. |
|
269 | less time. | |
226 |
|
270 | |||
227 | Input transformers are now called only once in the execution path of |
|
271 | Input transformers are now called only once in the execution path of | |
228 | `InteractiveShell`, allowing to register transformer that potentially have side |
|
272 | `InteractiveShell`, allowing to register transformer that potentially have side | |
229 | effects (note that this is not recommended). Internal methods `should_run_async`, and |
|
273 | effects (note that this is not recommended). Internal methods `should_run_async`, and | |
230 | `run_cell_async` now take a recommended optional `transformed_cell`, and |
|
274 | `run_cell_async` now take a recommended optional `transformed_cell`, and | |
231 | `preprocessing_exc_tuple` parameters that will become mandatory at some point in |
|
275 | `preprocessing_exc_tuple` parameters that will become mandatory at some point in | |
232 | the future; that is to say cells need to be explicitly transformed to be valid |
|
276 | the future; that is to say cells need to be explicitly transformed to be valid | |
233 | Python syntax ahead of trying to run them. :ghpull:`12440`; |
|
277 | Python syntax ahead of trying to run them. :ghpull:`12440`; | |
234 |
|
278 | |||
235 | ``input_transformers`` can now also have an attribute ``has_side_effects`` set |
|
279 | ``input_transformers`` can now also have an attribute ``has_side_effects`` set | |
236 | to `True`, when this attribute is present; this will prevent the transformers |
|
280 | to `True`, when this attribute is present; this will prevent the transformers | |
237 | from being ran when IPython is trying to guess whether the user input is |
|
281 | from being ran when IPython is trying to guess whether the user input is | |
238 | complete. Note that this may means you will need to explicitly execute in some |
|
282 | complete. Note that this may means you will need to explicitly execute in some | |
239 | case where your transformations are now not ran; but will not affect users with |
|
283 | case where your transformations are now not ran; but will not affect users with | |
240 | no custom extensions. |
|
284 | no custom extensions. | |
241 |
|
285 | |||
242 |
|
286 | |||
243 | API Changes |
|
287 | API Changes | |
244 | ----------- |
|
288 | ----------- | |
245 |
|
289 | |||
246 | Change of API and exposed objects automatically detected using `frappuccino |
|
290 | Change of API and exposed objects automatically detected using `frappuccino | |
247 | <https://pypi.org/project/frappuccino/>`_ |
|
291 | <https://pypi.org/project/frappuccino/>`_ | |
248 |
|
292 | |||
249 |
|
293 | |||
250 | The following items are new since 7.16.0:: |
|
294 | The following items are new since 7.16.0:: | |
251 |
|
295 | |||
252 | + IPython.core.interactiveshell.InteractiveShell.get_local_scope(self, stack_depth) |
|
296 | + IPython.core.interactiveshell.InteractiveShell.get_local_scope(self, stack_depth) | |
253 |
|
297 | |||
254 | The following signatures differ since 7.16.0:: |
|
298 | The following signatures differ since 7.16.0:: | |
255 |
|
299 | |||
256 | - IPython.core.interactiveshell.InteractiveShell.run_cell_async(self, raw_cell, store_history=False, silent=False, shell_futures=True) |
|
300 | - IPython.core.interactiveshell.InteractiveShell.run_cell_async(self, raw_cell, store_history=False, silent=False, shell_futures=True) | |
257 | + IPython.core.interactiveshell.InteractiveShell.run_cell_async(self, raw_cell, store_history=False, silent=False, shell_futures=True, *, transformed_cell=None, preprocessing_exc_tuple=None) |
|
301 | + IPython.core.interactiveshell.InteractiveShell.run_cell_async(self, raw_cell, store_history=False, silent=False, shell_futures=True, *, transformed_cell=None, preprocessing_exc_tuple=None) | |
258 |
|
302 | |||
259 | - IPython.core.interactiveshell.InteractiveShell.should_run_async(self, raw_cell) |
|
303 | - IPython.core.interactiveshell.InteractiveShell.should_run_async(self, raw_cell) | |
260 | + IPython.core.interactiveshell.InteractiveShell.should_run_async(self, raw_cell, *, transformed_cell=None, preprocessing_exc_tuple=None) |
|
304 | + IPython.core.interactiveshell.InteractiveShell.should_run_async(self, raw_cell, *, transformed_cell=None, preprocessing_exc_tuple=None) | |
261 |
|
305 | |||
262 | - IPython.terminal.debugger.TerminalPdb.pt_init(self) |
|
306 | - IPython.terminal.debugger.TerminalPdb.pt_init(self) | |
263 | + IPython.terminal.debugger.TerminalPdb.pt_init(self, pt_session_options=None) |
|
307 | + IPython.terminal.debugger.TerminalPdb.pt_init(self, pt_session_options=None) | |
264 |
|
308 | |||
265 | This method was added:: |
|
309 | This method was added:: | |
266 |
|
310 | |||
267 | + IPython.core.interactiveshell.InteractiveShell.get_local_scope |
|
311 | + IPython.core.interactiveshell.InteractiveShell.get_local_scope | |
268 |
|
312 | |||
269 | Which is now also present on subclasses:: |
|
313 | Which is now also present on subclasses:: | |
270 |
|
314 | |||
271 | + IPython.terminal.embed.InteractiveShellEmbed.get_local_scope |
|
315 | + IPython.terminal.embed.InteractiveShellEmbed.get_local_scope | |
272 | + IPython.terminal.interactiveshell.TerminalInteractiveShell.get_local_scope |
|
316 | + IPython.terminal.interactiveshell.TerminalInteractiveShell.get_local_scope | |
273 |
|
317 | |||
274 |
|
318 | |||
275 | .. _version 716: |
|
319 | .. _version 716: | |
276 |
|
320 | |||
277 | IPython 7.16 |
|
321 | IPython 7.16 | |
278 | ============ |
|
322 | ============ | |
279 |
|
323 | |||
280 |
|
324 | |||
281 | The default traceback mode will now skip frames that are marked with |
|
325 | The default traceback mode will now skip frames that are marked with | |
282 | ``__tracebackhide__ = True`` and show how many traceback frames have been |
|
326 | ``__tracebackhide__ = True`` and show how many traceback frames have been | |
283 | skipped. This can be toggled by using :magic:`xmode` with the ``--show`` or |
|
327 | skipped. This can be toggled by using :magic:`xmode` with the ``--show`` or | |
284 | ``--hide`` attribute. It will have no effect on non verbose traceback modes. |
|
328 | ``--hide`` attribute. It will have no effect on non verbose traceback modes. | |
285 |
|
329 | |||
286 | The ipython debugger also now understands ``__tracebackhide__`` as well and will |
|
330 | The ipython debugger also now understands ``__tracebackhide__`` as well and will | |
287 | skip hidden frames when displaying. Movement up and down the stack will skip the |
|
331 | skip hidden frames when displaying. Movement up and down the stack will skip the | |
288 | hidden frames and will show how many frames were hidden. Internal IPython frames |
|
332 | hidden frames and will show how many frames were hidden. Internal IPython frames | |
289 | are also now hidden by default. The behavior can be changed with the |
|
333 | are also now hidden by default. The behavior can be changed with the | |
290 | ``skip_hidden`` while in the debugger, command and accepts "yes", "no", "true" |
|
334 | ``skip_hidden`` while in the debugger, command and accepts "yes", "no", "true" | |
291 | and "false" case insensitive parameters. |
|
335 | and "false" case insensitive parameters. | |
292 |
|
336 | |||
293 |
|
337 | |||
294 | Misc Noticeable changes: |
|
338 | Misc Noticeable changes: | |
295 | ------------------------ |
|
339 | ------------------------ | |
296 |
|
340 | |||
297 | - Exceptions are now (re)raised when running notebooks via the :magic:`%run`, helping to catch issues in workflows and |
|
341 | - Exceptions are now (re)raised when running notebooks via the :magic:`%run`, helping to catch issues in workflows and | |
298 | pipelines. :ghpull:`12301` |
|
342 | pipelines. :ghpull:`12301` | |
299 | - Fix inputhook for qt 5.15.0 :ghpull:`12355` |
|
343 | - Fix inputhook for qt 5.15.0 :ghpull:`12355` | |
300 | - Fix wx inputhook :ghpull:`12375` |
|
344 | - Fix wx inputhook :ghpull:`12375` | |
301 | - Add handling for malformed pathext env var (Windows) :ghpull:`12367` |
|
345 | - Add handling for malformed pathext env var (Windows) :ghpull:`12367` | |
302 | - use $SHELL in system_piped :ghpull:`12360` for uniform behavior with |
|
346 | - use $SHELL in system_piped :ghpull:`12360` for uniform behavior with | |
303 | ipykernel. |
|
347 | ipykernel. | |
304 |
|
348 | |||
305 | Reproducible Build |
|
349 | Reproducible Build | |
306 | ------------------ |
|
350 | ------------------ | |
307 |
|
351 | |||
308 | IPython 7.15 reproducible build did not work, so we try again this month |
|
352 | IPython 7.15 reproducible build did not work, so we try again this month | |
309 | :ghpull:`12358`. |
|
353 | :ghpull:`12358`. | |
310 |
|
354 | |||
311 |
|
355 | |||
312 | API Changes |
|
356 | API Changes | |
313 | ----------- |
|
357 | ----------- | |
314 |
|
358 | |||
315 | Change of API and exposed objects automatically detected using `frappuccino |
|
359 | Change of API and exposed objects automatically detected using `frappuccino | |
316 | <https://pypi.org/project/frappuccino/>`_ (still in beta): |
|
360 | <https://pypi.org/project/frappuccino/>`_ (still in beta): | |
317 |
|
361 | |||
318 |
|
362 | |||
319 | The following items are new and mostly related to understanding ``__tracebackbhide__``:: |
|
363 | The following items are new and mostly related to understanding ``__tracebackbhide__``:: | |
320 |
|
364 | |||
321 | + IPython.core.debugger.Pdb.do_down(self, arg) |
|
365 | + IPython.core.debugger.Pdb.do_down(self, arg) | |
322 | + IPython.core.debugger.Pdb.do_skip_hidden(self, arg) |
|
366 | + IPython.core.debugger.Pdb.do_skip_hidden(self, arg) | |
323 | + IPython.core.debugger.Pdb.do_up(self, arg) |
|
367 | + IPython.core.debugger.Pdb.do_up(self, arg) | |
324 | + IPython.core.debugger.Pdb.hidden_frames(self, stack) |
|
368 | + IPython.core.debugger.Pdb.hidden_frames(self, stack) | |
325 | + IPython.core.debugger.Pdb.stop_here(self, frame) |
|
369 | + IPython.core.debugger.Pdb.stop_here(self, frame) | |
326 |
|
370 | |||
327 |
|
371 | |||
328 | The following items have been removed:: |
|
372 | The following items have been removed:: | |
329 |
|
373 | |||
330 | - IPython.core.debugger.Pdb.new_do_down |
|
374 | - IPython.core.debugger.Pdb.new_do_down | |
331 | - IPython.core.debugger.Pdb.new_do_up |
|
375 | - IPython.core.debugger.Pdb.new_do_up | |
332 |
|
376 | |||
333 | Those were implementation details. |
|
377 | Those were implementation details. | |
334 |
|
378 | |||
335 |
|
379 | |||
336 | .. _version 715: |
|
380 | .. _version 715: | |
337 |
|
381 | |||
338 | IPython 7.15 |
|
382 | IPython 7.15 | |
339 | ============ |
|
383 | ============ | |
340 |
|
384 | |||
341 | IPython 7.15 brings a number of bug fixes and user facing improvements. |
|
385 | IPython 7.15 brings a number of bug fixes and user facing improvements. | |
342 |
|
386 | |||
343 | Misc Noticeable changes: |
|
387 | Misc Noticeable changes: | |
344 | ------------------------ |
|
388 | ------------------------ | |
345 |
|
389 | |||
346 | - Long completion name have better elision in terminal :ghpull:`12284` |
|
390 | - Long completion name have better elision in terminal :ghpull:`12284` | |
347 | - I've started to test on Python 3.9 :ghpull:`12307` and fix some errors. |
|
391 | - I've started to test on Python 3.9 :ghpull:`12307` and fix some errors. | |
348 | - Hi DPI scaling of figures when using qt eventloop :ghpull:`12314` |
|
392 | - Hi DPI scaling of figures when using qt eventloop :ghpull:`12314` | |
349 | - Document the ability to have systemwide configuration for IPython. |
|
393 | - Document the ability to have systemwide configuration for IPython. | |
350 | :ghpull:`12328` |
|
394 | :ghpull:`12328` | |
351 | - Fix issues with input autoformatting :ghpull:`12336` |
|
395 | - Fix issues with input autoformatting :ghpull:`12336` | |
352 | - ``IPython.core.debugger.Pdb`` is now interruptible (:ghpull:`12168`, in 7.14 |
|
396 | - ``IPython.core.debugger.Pdb`` is now interruptible (:ghpull:`12168`, in 7.14 | |
353 | but forgotten in release notes) |
|
397 | but forgotten in release notes) | |
354 | - Video HTML attributes (:ghpull:`12212`, in 7.14 but forgotten in release |
|
398 | - Video HTML attributes (:ghpull:`12212`, in 7.14 but forgotten in release | |
355 | notes) |
|
399 | notes) | |
356 |
|
400 | |||
357 | Reproducible Build |
|
401 | Reproducible Build | |
358 | ------------------ |
|
402 | ------------------ | |
359 |
|
403 | |||
360 | Starting with IPython 7.15, I am attempting to provide reproducible builds, |
|
404 | Starting with IPython 7.15, I am attempting to provide reproducible builds, | |
361 | that is to say you should be able from the source tree to generate an sdist |
|
405 | that is to say you should be able from the source tree to generate an sdist | |
362 | and wheel that are identical byte for byte with the publish version on PyPI. |
|
406 | and wheel that are identical byte for byte with the publish version on PyPI. | |
363 |
|
407 | |||
364 | I've only tested on a couple of machines so far and the process is relatively |
|
408 | I've only tested on a couple of machines so far and the process is relatively | |
365 | straightforward, so this mean that IPython not only have a deterministic build |
|
409 | straightforward, so this mean that IPython not only have a deterministic build | |
366 | process, but also I have either removed, or put under control all effects of |
|
410 | process, but also I have either removed, or put under control all effects of | |
367 | the build environments on the final artifact. I encourage you to attempt the |
|
411 | the build environments on the final artifact. I encourage you to attempt the | |
368 | build process on your machine as documented in :ref:`core_developer_guide` |
|
412 | build process on your machine as documented in :ref:`core_developer_guide` | |
369 | and let me know if you do not obtain an identical artifact. |
|
413 | and let me know if you do not obtain an identical artifact. | |
370 |
|
414 | |||
371 | While reproducible builds is critical to check that the supply chain of (open |
|
415 | While reproducible builds is critical to check that the supply chain of (open | |
372 | source) software has not been compromised, it can also help to speedup many |
|
416 | source) software has not been compromised, it can also help to speedup many | |
373 | of the build processes in large environment (conda, apt...) by allowing |
|
417 | of the build processes in large environment (conda, apt...) by allowing | |
374 | better caching of intermediate build steps. |
|
418 | better caching of intermediate build steps. | |
375 |
|
419 | |||
376 | Learn more on `<https://reproducible-builds.org/>`_. `Reflections on trusting |
|
420 | Learn more on `<https://reproducible-builds.org/>`_. `Reflections on trusting | |
377 | trust <https://dl.acm.org/doi/10.1145/358198.358210>`_ is also one of the |
|
421 | trust <https://dl.acm.org/doi/10.1145/358198.358210>`_ is also one of the | |
378 | cornerstone and recommended reads on this subject. |
|
422 | cornerstone and recommended reads on this subject. | |
379 |
|
423 | |||
380 | .. note:: |
|
424 | .. note:: | |
381 |
|
425 | |||
382 | The build commit from which the sdist is generated is also `signed |
|
426 | The build commit from which the sdist is generated is also `signed | |
383 | <https://en.wikipedia.org/wiki/Digital_signature>`_, so you should be able to |
|
427 | <https://en.wikipedia.org/wiki/Digital_signature>`_, so you should be able to | |
384 | check it has not been compromised, and the git repository is a `merkle-tree |
|
428 | check it has not been compromised, and the git repository is a `merkle-tree | |
385 | <https://en.wikipedia.org/wiki/Merkle_tree>`_, you can check the consistency |
|
429 | <https://en.wikipedia.org/wiki/Merkle_tree>`_, you can check the consistency | |
386 | with `git-fsck <https://git-scm.com/docs/git-fsck>`_ which you likely `want |
|
430 | with `git-fsck <https://git-scm.com/docs/git-fsck>`_ which you likely `want | |
387 | to enable by default |
|
431 | to enable by default | |
388 | <https://gist.github.com/mbbx6spp/14b86437e794bffb4120>`_. |
|
432 | <https://gist.github.com/mbbx6spp/14b86437e794bffb4120>`_. | |
389 |
|
433 | |||
390 | NEP29: Last version to support Python 3.6 |
|
434 | NEP29: Last version to support Python 3.6 | |
391 | ----------------------------------------- |
|
435 | ----------------------------------------- | |
392 |
|
436 | |||
393 | IPython 7.15 will be the Last IPython version to officially support Python |
|
437 | IPython 7.15 will be the Last IPython version to officially support Python | |
394 | 3.6, as stated by `NumPy Enhancement Proposal 29 |
|
438 | 3.6, as stated by `NumPy Enhancement Proposal 29 | |
395 | <https://numpy.org/neps/nep-0029-deprecation_policy.html>`_. Starting with |
|
439 | <https://numpy.org/neps/nep-0029-deprecation_policy.html>`_. Starting with | |
396 | next minor version of IPython I may stop testing on Python 3.6 and may stop |
|
440 | next minor version of IPython I may stop testing on Python 3.6 and may stop | |
397 | publishing release artifacts that install on Python 3.6 |
|
441 | publishing release artifacts that install on Python 3.6 | |
398 |
|
442 | |||
399 | Highlighted features |
|
443 | Highlighted features | |
400 | -------------------- |
|
444 | -------------------- | |
401 |
|
445 | |||
402 | Highlighted features are not new, but seem to not be widely known, this |
|
446 | Highlighted features are not new, but seem to not be widely known, this | |
403 | section will help you discover in more narrative form what you can do with |
|
447 | section will help you discover in more narrative form what you can do with | |
404 | IPython. |
|
448 | IPython. | |
405 |
|
449 | |||
406 | Increase Tab Completion Menu Height |
|
450 | Increase Tab Completion Menu Height | |
407 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
451 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
408 |
|
452 | |||
409 | In terminal IPython it is possible to increase the hight of the tab-completion |
|
453 | In terminal IPython it is possible to increase the hight of the tab-completion | |
410 | menu. To do so set the value of |
|
454 | menu. To do so set the value of | |
411 | :configtrait:`TerminalInteractiveShell.space_for_menu`, this will reserve more |
|
455 | :configtrait:`TerminalInteractiveShell.space_for_menu`, this will reserve more | |
412 | space at the bottom of the screen for various kind of menus in IPython including |
|
456 | space at the bottom of the screen for various kind of menus in IPython including | |
413 | tab completion and searching in history. |
|
457 | tab completion and searching in history. | |
414 |
|
458 | |||
415 | Autoformat Code in the terminal |
|
459 | Autoformat Code in the terminal | |
416 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
460 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
417 |
|
461 | |||
418 | If you have a preferred code formatter, you can configure IPython to |
|
462 | If you have a preferred code formatter, you can configure IPython to | |
419 | reformat your code. Set the value of |
|
463 | reformat your code. Set the value of | |
420 | :configtrait:`TerminalInteractiveShell.autoformatter` to for example ``'black'`` |
|
464 | :configtrait:`TerminalInteractiveShell.autoformatter` to for example ``'black'`` | |
421 | and IPython will auto format your code when possible. |
|
465 | and IPython will auto format your code when possible. | |
422 |
|
466 | |||
423 |
|
467 | |||
424 | .. _version 714: |
|
468 | .. _version 714: | |
425 |
|
469 | |||
426 | IPython 7.14 |
|
470 | IPython 7.14 | |
427 | ============ |
|
471 | ============ | |
428 |
|
472 | |||
429 | IPython 7.14 is a minor release that fix a couple of bugs and prepare |
|
473 | IPython 7.14 is a minor release that fix a couple of bugs and prepare | |
430 | compatibility with new or future versions of some libraries. |
|
474 | compatibility with new or future versions of some libraries. | |
431 |
|
475 | |||
432 | Important changes: |
|
476 | Important changes: | |
433 | ------------------ |
|
477 | ------------------ | |
434 |
|
478 | |||
435 | - Fix compatibility with Sphinx 3+ :ghpull:`12235` |
|
479 | - Fix compatibility with Sphinx 3+ :ghpull:`12235` | |
436 | - Remove deprecated matplotlib parameter usage, compatibility with matplotlib |
|
480 | - Remove deprecated matplotlib parameter usage, compatibility with matplotlib | |
437 | 3.3+ :`122250` |
|
481 | 3.3+ :`122250` | |
438 |
|
482 | |||
439 | Misc Changes |
|
483 | Misc Changes | |
440 | ------------ |
|
484 | ------------ | |
441 |
|
485 | |||
442 | - set ``.py`` extension when editing current buffer in vi/emacs. :ghpull:`12167` |
|
486 | - set ``.py`` extension when editing current buffer in vi/emacs. :ghpull:`12167` | |
443 | - support for unicode identifiers in ``?``/``??`` :ghpull:`12208` |
|
487 | - support for unicode identifiers in ``?``/``??`` :ghpull:`12208` | |
444 | - add extra options to the ``Video`` Rich objects :ghpull:`12212` |
|
488 | - add extra options to the ``Video`` Rich objects :ghpull:`12212` | |
445 | - add pretty-printing to ``SimpleNamespace`` :ghpull:`12230` |
|
489 | - add pretty-printing to ``SimpleNamespace`` :ghpull:`12230` | |
446 |
|
490 | |||
447 | IPython.core.debugger.Pdb is now interruptible |
|
491 | IPython.core.debugger.Pdb is now interruptible | |
448 | ---------------------------------------------- |
|
492 | ---------------------------------------------- | |
449 |
|
493 | |||
450 | A ``KeyboardInterrupt`` will now interrupt IPython's extended debugger, in order to make Jupyter able to interrupt it. (:ghpull:`12168`) |
|
494 | A ``KeyboardInterrupt`` will now interrupt IPython's extended debugger, in order to make Jupyter able to interrupt it. (:ghpull:`12168`) | |
451 |
|
495 | |||
452 | Video HTML attributes |
|
496 | Video HTML attributes | |
453 | --------------------- |
|
497 | --------------------- | |
454 |
|
498 | |||
455 | Add an option to `IPython.display.Video` to change the attributes of the HTML display of the video (:ghpull:`12212`) |
|
499 | Add an option to `IPython.display.Video` to change the attributes of the HTML display of the video (:ghpull:`12212`) | |
456 |
|
500 | |||
457 |
|
501 | |||
458 | Pending deprecated imports |
|
502 | Pending deprecated imports | |
459 | -------------------------- |
|
503 | -------------------------- | |
460 |
|
504 | |||
461 | Many object present in ``IPython.core.display`` are there for internal use only, |
|
505 | Many object present in ``IPython.core.display`` are there for internal use only, | |
462 | and should already been imported from ``IPython.display`` by users and external |
|
506 | and should already been imported from ``IPython.display`` by users and external | |
463 | libraries. Trying to import those from ``IPython.core.display`` is still possible |
|
507 | libraries. Trying to import those from ``IPython.core.display`` is still possible | |
464 | but will trigger a |
|
508 | but will trigger a | |
465 | deprecation warning in later versions of IPython and will become errors in the |
|
509 | deprecation warning in later versions of IPython and will become errors in the | |
466 | future. |
|
510 | future. | |
467 |
|
511 | |||
468 | This will simplify compatibility with other Python kernels (like Xeus-Python), |
|
512 | This will simplify compatibility with other Python kernels (like Xeus-Python), | |
469 | and simplify code base. |
|
513 | and simplify code base. | |
470 |
|
514 | |||
471 |
|
515 | |||
472 |
|
516 | |||
473 |
|
517 | |||
474 | .. _version 713: |
|
518 | .. _version 713: | |
475 |
|
519 | |||
476 | IPython 7.13 |
|
520 | IPython 7.13 | |
477 | ============ |
|
521 | ============ | |
478 |
|
522 | |||
479 | IPython 7.13 is the final release of the 7.x branch since master is diverging |
|
523 | IPython 7.13 is the final release of the 7.x branch since master is diverging | |
480 | toward an 8.0. Exiting new features have already been merged in 8.0 and will |
|
524 | toward an 8.0. Exiting new features have already been merged in 8.0 and will | |
481 | not be available on the 7.x branch. All the changes below have been backported |
|
525 | not be available on the 7.x branch. All the changes below have been backported | |
482 | from the master branch. |
|
526 | from the master branch. | |
483 |
|
527 | |||
484 |
|
528 | |||
485 | - Fix inability to run PDB when inside an event loop :ghpull:`12141` |
|
529 | - Fix inability to run PDB when inside an event loop :ghpull:`12141` | |
486 | - Fix ability to interrupt some processes on windows :ghpull:`12137` |
|
530 | - Fix ability to interrupt some processes on windows :ghpull:`12137` | |
487 | - Fix debugger shortcuts :ghpull:`12132` |
|
531 | - Fix debugger shortcuts :ghpull:`12132` | |
488 | - improve tab completion when inside a string by removing irrelevant elements :ghpull:`12128` |
|
532 | - improve tab completion when inside a string by removing irrelevant elements :ghpull:`12128` | |
489 | - Fix display of filename tab completion when the path is long :ghpull:`12122` |
|
533 | - Fix display of filename tab completion when the path is long :ghpull:`12122` | |
490 | - Many removal of Python 2 specific code path :ghpull:`12110` |
|
534 | - Many removal of Python 2 specific code path :ghpull:`12110` | |
491 | - displaying wav files do not require NumPy anymore, and is 5x to 30x faster :ghpull:`12113` |
|
535 | - displaying wav files do not require NumPy anymore, and is 5x to 30x faster :ghpull:`12113` | |
492 |
|
536 | |||
493 | See the list of all closed issues and pull request on `github |
|
537 | See the list of all closed issues and pull request on `github | |
494 | <https://github.com/ipython/ipython/pulls?q=is%3Aclosed+milestone%3A7.13>`_. |
|
538 | <https://github.com/ipython/ipython/pulls?q=is%3Aclosed+milestone%3A7.13>`_. | |
495 |
|
539 | |||
496 | .. _version 712: |
|
540 | .. _version 712: | |
497 |
|
541 | |||
498 | IPython 7.12 |
|
542 | IPython 7.12 | |
499 | ============ |
|
543 | ============ | |
500 |
|
544 | |||
501 | IPython 7.12 is a minor update that mostly brings code cleanup, removal of |
|
545 | IPython 7.12 is a minor update that mostly brings code cleanup, removal of | |
502 | longtime deprecated function and a couple update to documentation cleanup as well. |
|
546 | longtime deprecated function and a couple update to documentation cleanup as well. | |
503 |
|
547 | |||
504 | Notable changes are the following: |
|
548 | Notable changes are the following: | |
505 |
|
549 | |||
506 | - Exit non-zero when ipython is given a file path to run that doesn't exist :ghpull:`12074` |
|
550 | - Exit non-zero when ipython is given a file path to run that doesn't exist :ghpull:`12074` | |
507 | - Test PR on ARM64 with Travis-CI :ghpull:`12073` |
|
551 | - Test PR on ARM64 with Travis-CI :ghpull:`12073` | |
508 | - Update CI to work with latest Pytest :ghpull:`12086` |
|
552 | - Update CI to work with latest Pytest :ghpull:`12086` | |
509 | - Add infrastructure to run ipykernel eventloop via trio :ghpull:`12097` |
|
553 | - Add infrastructure to run ipykernel eventloop via trio :ghpull:`12097` | |
510 | - Support git blame ignore revs :ghpull:`12091` |
|
554 | - Support git blame ignore revs :ghpull:`12091` | |
511 | - Start multi-line ``__repr__`` s on their own line :ghpull:`12099` |
|
555 | - Start multi-line ``__repr__`` s on their own line :ghpull:`12099` | |
512 |
|
556 | |||
513 | .. _version 7111: |
|
557 | .. _version 7111: | |
514 |
|
558 | |||
515 | IPython 7.11.1 |
|
559 | IPython 7.11.1 | |
516 | ============== |
|
560 | ============== | |
517 |
|
561 | |||
518 | A couple of deprecated functions (no-op) have been reintroduces in py3compat as |
|
562 | A couple of deprecated functions (no-op) have been reintroduces in py3compat as | |
519 | Cython was still relying on them, and will be removed in a couple of versions. |
|
563 | Cython was still relying on them, and will be removed in a couple of versions. | |
520 |
|
564 | |||
521 | .. _version 711: |
|
565 | .. _version 711: | |
522 |
|
566 | |||
523 | IPython 7.11 |
|
567 | IPython 7.11 | |
524 | ============ |
|
568 | ============ | |
525 |
|
569 | |||
526 | IPython 7.11 received a couple of compatibility fixes and code cleanup. |
|
570 | IPython 7.11 received a couple of compatibility fixes and code cleanup. | |
527 |
|
571 | |||
528 | A number of function in the ``py3compat`` have been removed; a number of types |
|
572 | A number of function in the ``py3compat`` have been removed; a number of types | |
529 | in the IPython code base are now non-ambiguous and now always ``unicode`` |
|
573 | in the IPython code base are now non-ambiguous and now always ``unicode`` | |
530 | instead of ``Union[Unicode,bytes]``; many of the relevant code path have thus |
|
574 | instead of ``Union[Unicode,bytes]``; many of the relevant code path have thus | |
531 | been simplified/cleaned and types annotation added. |
|
575 | been simplified/cleaned and types annotation added. | |
532 |
|
576 | |||
533 | IPython support several verbosity level from exceptions. ``xmode plain`` now |
|
577 | IPython support several verbosity level from exceptions. ``xmode plain`` now | |
534 | support chained exceptions. :ghpull:`11999` |
|
578 | support chained exceptions. :ghpull:`11999` | |
535 |
|
579 | |||
536 | We are starting to remove ``shell=True`` in some usages of subprocess. While not directly |
|
580 | We are starting to remove ``shell=True`` in some usages of subprocess. While not directly | |
537 | a security issue (as IPython is made to run arbitrary code anyway) it is not good |
|
581 | a security issue (as IPython is made to run arbitrary code anyway) it is not good | |
538 | practice and we'd like to show the example. :ghissue:`12023`. This discussion |
|
582 | practice and we'd like to show the example. :ghissue:`12023`. This discussion | |
539 | was started by ``@mschwager`` thanks to a new auditing tool they are working on |
|
583 | was started by ``@mschwager`` thanks to a new auditing tool they are working on | |
540 | with duo-labs (`dlint <https://github.com/duo-labs/dlint>`_). |
|
584 | with duo-labs (`dlint <https://github.com/duo-labs/dlint>`_). | |
541 |
|
585 | |||
542 | Work around some bugs in Python 3.9 tokenizer :ghpull:`12057` |
|
586 | Work around some bugs in Python 3.9 tokenizer :ghpull:`12057` | |
543 |
|
587 | |||
544 | IPython will now print its version after a crash. :ghpull:`11986` |
|
588 | IPython will now print its version after a crash. :ghpull:`11986` | |
545 |
|
589 | |||
546 | This is likely the last release from the 7.x series that will see new feature. |
|
590 | This is likely the last release from the 7.x series that will see new feature. | |
547 | The master branch will soon accept large code changes and thrilling new |
|
591 | The master branch will soon accept large code changes and thrilling new | |
548 | features; the 7.x branch will only start to accept critical bug fixes, and |
|
592 | features; the 7.x branch will only start to accept critical bug fixes, and | |
549 | update dependencies. |
|
593 | update dependencies. | |
550 |
|
594 | |||
551 | .. _version 7102: |
|
595 | .. _version 7102: | |
552 |
|
596 | |||
553 | IPython 7.10.2 |
|
597 | IPython 7.10.2 | |
554 | ============== |
|
598 | ============== | |
555 |
|
599 | |||
556 | IPython 7.10.2 fix a couple of extra incompatibility between IPython, ipdb, |
|
600 | IPython 7.10.2 fix a couple of extra incompatibility between IPython, ipdb, | |
557 | asyncio and Prompt Toolkit 3. |
|
601 | asyncio and Prompt Toolkit 3. | |
558 |
|
602 | |||
559 | .. _version 7101: |
|
603 | .. _version 7101: | |
560 |
|
604 | |||
561 | IPython 7.10.1 |
|
605 | IPython 7.10.1 | |
562 | ============== |
|
606 | ============== | |
563 |
|
607 | |||
564 | IPython 7.10.1 fix a couple of incompatibilities with Prompt toolkit 3 (please |
|
608 | IPython 7.10.1 fix a couple of incompatibilities with Prompt toolkit 3 (please | |
565 | update Prompt toolkit to 3.0.2 at least), and fixes some interaction with |
|
609 | update Prompt toolkit to 3.0.2 at least), and fixes some interaction with | |
566 | headless IPython. |
|
610 | headless IPython. | |
567 |
|
611 | |||
568 | .. _version 7100: |
|
612 | .. _version 7100: | |
569 |
|
613 | |||
570 | IPython 7.10.0 |
|
614 | IPython 7.10.0 | |
571 | ============== |
|
615 | ============== | |
572 |
|
616 | |||
573 | IPython 7.10 is the first double digit minor release in the last decade, and |
|
617 | IPython 7.10 is the first double digit minor release in the last decade, and | |
574 | first since the release of IPython 1.0, previous double digit minor release was |
|
618 | first since the release of IPython 1.0, previous double digit minor release was | |
575 | in August 2009. |
|
619 | in August 2009. | |
576 |
|
620 | |||
577 | We've been trying to give you regular release on the last Friday of every month |
|
621 | We've been trying to give you regular release on the last Friday of every month | |
578 | for a guaranty of rapid access to bug fixes and new features. |
|
622 | for a guaranty of rapid access to bug fixes and new features. | |
579 |
|
623 | |||
580 | Unlike the previous first few releases that have seen only a couple of code |
|
624 | Unlike the previous first few releases that have seen only a couple of code | |
581 | changes, 7.10 bring a number of changes, new features and bugfixes. |
|
625 | changes, 7.10 bring a number of changes, new features and bugfixes. | |
582 |
|
626 | |||
583 | Stop Support for Python 3.5 β Adopt NEP 29 |
|
627 | Stop Support for Python 3.5 β Adopt NEP 29 | |
584 | ------------------------------------------ |
|
628 | ------------------------------------------ | |
585 |
|
629 | |||
586 | IPython has decided to follow the informational `NEP 29 |
|
630 | IPython has decided to follow the informational `NEP 29 | |
587 | <https://numpy.org/neps/nep-0029-deprecation_policy.html>`_ which layout a clear |
|
631 | <https://numpy.org/neps/nep-0029-deprecation_policy.html>`_ which layout a clear | |
588 | policy as to which version of (C)Python and NumPy are supported. |
|
632 | policy as to which version of (C)Python and NumPy are supported. | |
589 |
|
633 | |||
590 | We thus dropped support for Python 3.5, and cleaned up a number of code path |
|
634 | We thus dropped support for Python 3.5, and cleaned up a number of code path | |
591 | that were Python-version dependant. If you are on 3.5 or earlier pip should |
|
635 | that were Python-version dependant. If you are on 3.5 or earlier pip should | |
592 | automatically give you the latest compatible version of IPython so you do not |
|
636 | automatically give you the latest compatible version of IPython so you do not | |
593 | need to pin to a given version. |
|
637 | need to pin to a given version. | |
594 |
|
638 | |||
595 | Support for Prompt Toolkit 3.0 |
|
639 | Support for Prompt Toolkit 3.0 | |
596 | ------------------------------ |
|
640 | ------------------------------ | |
597 |
|
641 | |||
598 | Prompt Toolkit 3.0 was release a week before IPython 7.10 and introduces a few |
|
642 | Prompt Toolkit 3.0 was release a week before IPython 7.10 and introduces a few | |
599 | breaking changes. We believe IPython 7.10 should be compatible with both Prompt |
|
643 | breaking changes. We believe IPython 7.10 should be compatible with both Prompt | |
600 | Toolkit 2.x and 3.x, though it has not been extensively tested with 3.x so |
|
644 | Toolkit 2.x and 3.x, though it has not been extensively tested with 3.x so | |
601 | please report any issues. |
|
645 | please report any issues. | |
602 |
|
646 | |||
603 |
|
647 | |||
604 | Prompt Rendering Performance improvements |
|
648 | Prompt Rendering Performance improvements | |
605 | ----------------------------------------- |
|
649 | ----------------------------------------- | |
606 |
|
650 | |||
607 | Pull Request :ghpull:`11933` introduced an optimisation in the prompt rendering |
|
651 | Pull Request :ghpull:`11933` introduced an optimisation in the prompt rendering | |
608 | logic that should decrease the resource usage of IPython when using the |
|
652 | logic that should decrease the resource usage of IPython when using the | |
609 | _default_ configuration but could potentially introduce a regression of |
|
653 | _default_ configuration but could potentially introduce a regression of | |
610 | functionalities if you are using a custom prompt. |
|
654 | functionalities if you are using a custom prompt. | |
611 |
|
655 | |||
612 | We know assume if you haven't changed the default keybindings that the prompt |
|
656 | We know assume if you haven't changed the default keybindings that the prompt | |
613 | **will not change** during the duration of your input β which is for example |
|
657 | **will not change** during the duration of your input β which is for example | |
614 | not true when using vi insert mode that switches between `[ins]` and `[nor]` |
|
658 | not true when using vi insert mode that switches between `[ins]` and `[nor]` | |
615 | for the current mode. |
|
659 | for the current mode. | |
616 |
|
660 | |||
617 | If you are experiencing any issue let us know. |
|
661 | If you are experiencing any issue let us know. | |
618 |
|
662 | |||
619 | Code autoformatting |
|
663 | Code autoformatting | |
620 | ------------------- |
|
664 | ------------------- | |
621 |
|
665 | |||
622 | The IPython terminal can now auto format your code just before entering a new |
|
666 | The IPython terminal can now auto format your code just before entering a new | |
623 | line or executing a command. To do so use the |
|
667 | line or executing a command. To do so use the | |
624 | ``--TerminalInteractiveShell.autoformatter`` option and set it to ``'black'``; |
|
668 | ``--TerminalInteractiveShell.autoformatter`` option and set it to ``'black'``; | |
625 | if black is installed IPython will use black to format your code when possible. |
|
669 | if black is installed IPython will use black to format your code when possible. | |
626 |
|
670 | |||
627 | IPython cannot always properly format your code; in particular it will |
|
671 | IPython cannot always properly format your code; in particular it will | |
628 | auto formatting with *black* will only work if: |
|
672 | auto formatting with *black* will only work if: | |
629 |
|
673 | |||
630 | - Your code does not contains magics or special python syntax. |
|
674 | - Your code does not contains magics or special python syntax. | |
631 |
|
675 | |||
632 | - There is no code after your cursor. |
|
676 | - There is no code after your cursor. | |
633 |
|
677 | |||
634 | The Black API is also still in motion; so this may not work with all versions of |
|
678 | The Black API is also still in motion; so this may not work with all versions of | |
635 | black. |
|
679 | black. | |
636 |
|
680 | |||
637 | It should be possible to register custom formatter, though the API is till in |
|
681 | It should be possible to register custom formatter, though the API is till in | |
638 | flux. |
|
682 | flux. | |
639 |
|
683 | |||
640 | Arbitrary Mimetypes Handing in Terminal (Aka inline images in terminal) |
|
684 | Arbitrary Mimetypes Handing in Terminal (Aka inline images in terminal) | |
641 | ----------------------------------------------------------------------- |
|
685 | ----------------------------------------------------------------------- | |
642 |
|
686 | |||
643 | When using IPython terminal it is now possible to register function to handle |
|
687 | When using IPython terminal it is now possible to register function to handle | |
644 | arbitrary mimetypes. While rendering non-text based representation was possible in |
|
688 | arbitrary mimetypes. While rendering non-text based representation was possible in | |
645 | many jupyter frontend; it was not possible in terminal IPython, as usually |
|
689 | many jupyter frontend; it was not possible in terminal IPython, as usually | |
646 | terminal are limited to displaying text. As many terminal these days provide |
|
690 | terminal are limited to displaying text. As many terminal these days provide | |
647 | escape sequences to display non-text; bringing this loved feature to IPython CLI |
|
691 | escape sequences to display non-text; bringing this loved feature to IPython CLI | |
648 | made a lot of sens. This functionality will not only allow inline images; but |
|
692 | made a lot of sens. This functionality will not only allow inline images; but | |
649 | allow opening of external program; for example ``mplayer`` to "display" sound |
|
693 | allow opening of external program; for example ``mplayer`` to "display" sound | |
650 | files. |
|
694 | files. | |
651 |
|
695 | |||
652 | So far only the hooks necessary for this are in place, but no default mime |
|
696 | So far only the hooks necessary for this are in place, but no default mime | |
653 | renderers added; so inline images will only be available via extensions. We will |
|
697 | renderers added; so inline images will only be available via extensions. We will | |
654 | progressively enable these features by default in the next few releases, and |
|
698 | progressively enable these features by default in the next few releases, and | |
655 | contribution is welcomed. |
|
699 | contribution is welcomed. | |
656 |
|
700 | |||
657 | We welcome any feedback on the API. See :ref:`shell_mimerenderer` for more |
|
701 | We welcome any feedback on the API. See :ref:`shell_mimerenderer` for more | |
658 | informations. |
|
702 | informations. | |
659 |
|
703 | |||
660 | This is originally based on work form in :ghpull:`10610` from @stephanh42 |
|
704 | This is originally based on work form in :ghpull:`10610` from @stephanh42 | |
661 | started over two years ago, and still a lot need to be done. |
|
705 | started over two years ago, and still a lot need to be done. | |
662 |
|
706 | |||
663 | MISC |
|
707 | MISC | |
664 | ---- |
|
708 | ---- | |
665 |
|
709 | |||
666 | - Completions can define their own ordering :ghpull:`11855` |
|
710 | - Completions can define their own ordering :ghpull:`11855` | |
667 | - Enable Plotting in the same cell than the one that import matplotlib |
|
711 | - Enable Plotting in the same cell than the one that import matplotlib | |
668 | :ghpull:`11916` |
|
712 | :ghpull:`11916` | |
669 | - Allow to store and restore multiple variables at once :ghpull:`11930` |
|
713 | - Allow to store and restore multiple variables at once :ghpull:`11930` | |
670 |
|
714 | |||
671 | You can see `all pull-requests <https://github.com/ipython/ipython/pulls?q=is%3Apr+milestone%3A7.10+is%3Aclosed>`_ for this release. |
|
715 | You can see `all pull-requests <https://github.com/ipython/ipython/pulls?q=is%3Apr+milestone%3A7.10+is%3Aclosed>`_ for this release. | |
672 |
|
716 | |||
673 | API Changes |
|
717 | API Changes | |
674 | ----------- |
|
718 | ----------- | |
675 |
|
719 | |||
676 | Change of API and exposed objects automatically detected using `frappuccino <https://pypi.org/project/frappuccino/>`_ (still in beta): |
|
720 | Change of API and exposed objects automatically detected using `frappuccino <https://pypi.org/project/frappuccino/>`_ (still in beta): | |
677 |
|
721 | |||
678 | The following items are new in IPython 7.10:: |
|
722 | The following items are new in IPython 7.10:: | |
679 |
|
723 | |||
680 | + IPython.terminal.shortcuts.reformat_text_before_cursor(buffer, document, shell) |
|
724 | + IPython.terminal.shortcuts.reformat_text_before_cursor(buffer, document, shell) | |
681 | + IPython.terminal.interactiveshell.PTK3 |
|
725 | + IPython.terminal.interactiveshell.PTK3 | |
682 | + IPython.terminal.interactiveshell.black_reformat_handler(text_before_cursor) |
|
726 | + IPython.terminal.interactiveshell.black_reformat_handler(text_before_cursor) | |
683 | + IPython.terminal.prompts.RichPromptDisplayHook.write_format_data(self, format_dict, md_dict='None') |
|
727 | + IPython.terminal.prompts.RichPromptDisplayHook.write_format_data(self, format_dict, md_dict='None') | |
684 |
|
728 | |||
685 | The following items have been removed in 7.10:: |
|
729 | The following items have been removed in 7.10:: | |
686 |
|
730 | |||
687 | - IPython.lib.pretty.DICT_IS_ORDERED |
|
731 | - IPython.lib.pretty.DICT_IS_ORDERED | |
688 |
|
732 | |||
689 | The following signatures differ between versions:: |
|
733 | The following signatures differ between versions:: | |
690 |
|
734 | |||
691 | - IPython.extensions.storemagic.restore_aliases(ip) |
|
735 | - IPython.extensions.storemagic.restore_aliases(ip) | |
692 | + IPython.extensions.storemagic.restore_aliases(ip, alias='None') |
|
736 | + IPython.extensions.storemagic.restore_aliases(ip, alias='None') | |
693 |
|
737 | |||
694 | Special Thanks |
|
738 | Special Thanks | |
695 | -------------- |
|
739 | -------------- | |
696 |
|
740 | |||
697 | - @stephanh42 who started the work on inline images in terminal 2 years ago |
|
741 | - @stephanh42 who started the work on inline images in terminal 2 years ago | |
698 | - @augustogoulart who spent a lot of time triaging issues and responding to |
|
742 | - @augustogoulart who spent a lot of time triaging issues and responding to | |
699 | users. |
|
743 | users. | |
700 | - @con-f-use who is my (@Carreau) first sponsor on GitHub, as a reminder if you |
|
744 | - @con-f-use who is my (@Carreau) first sponsor on GitHub, as a reminder if you | |
701 | like IPython, Jupyter and many other library of the SciPy stack you can |
|
745 | like IPython, Jupyter and many other library of the SciPy stack you can | |
702 | donate to numfocus.org non profit |
|
746 | donate to numfocus.org non profit | |
703 |
|
747 | |||
704 | .. _version 790: |
|
748 | .. _version 790: | |
705 |
|
749 | |||
706 | IPython 7.9.0 |
|
750 | IPython 7.9.0 | |
707 | ============= |
|
751 | ============= | |
708 |
|
752 | |||
709 | IPython 7.9 is a small release with a couple of improvement and bug fixes. |
|
753 | IPython 7.9 is a small release with a couple of improvement and bug fixes. | |
710 |
|
754 | |||
711 | - Xterm terminal title should be restored on exit :ghpull:`11910` |
|
755 | - Xterm terminal title should be restored on exit :ghpull:`11910` | |
712 | - special variables ``_``,``__``, ``___`` are not set anymore when cache size |
|
756 | - special variables ``_``,``__``, ``___`` are not set anymore when cache size | |
713 | is 0 or less. :ghpull:`11877` |
|
757 | is 0 or less. :ghpull:`11877` | |
714 | - Autoreload should have regained some speed by using a new heuristic logic to |
|
758 | - Autoreload should have regained some speed by using a new heuristic logic to | |
715 | find all objects needing reload. This should avoid large objects traversal |
|
759 | find all objects needing reload. This should avoid large objects traversal | |
716 | like pandas dataframes. :ghpull:`11876` |
|
760 | like pandas dataframes. :ghpull:`11876` | |
717 | - Get ready for Python 4. :ghpull:`11874` |
|
761 | - Get ready for Python 4. :ghpull:`11874` | |
718 | - `%env` Magic now has heuristic to hide potentially sensitive values :ghpull:`11896` |
|
762 | - `%env` Magic now has heuristic to hide potentially sensitive values :ghpull:`11896` | |
719 |
|
763 | |||
720 | This is a small release despite a number of Pull Request Pending that need to |
|
764 | This is a small release despite a number of Pull Request Pending that need to | |
721 | be reviewed/worked on. Many of the core developers have been busy outside of |
|
765 | be reviewed/worked on. Many of the core developers have been busy outside of | |
722 | IPython/Jupyter and we thanks all contributor for their patience; we'll work on |
|
766 | IPython/Jupyter and we thanks all contributor for their patience; we'll work on | |
723 | these as soon as we have time. |
|
767 | these as soon as we have time. | |
724 |
|
768 | |||
725 |
|
769 | |||
726 | .. _version780: |
|
770 | .. _version780: | |
727 |
|
771 | |||
728 | IPython 7.8.0 |
|
772 | IPython 7.8.0 | |
729 | ============= |
|
773 | ============= | |
730 |
|
774 | |||
731 | IPython 7.8.0 contain a few bugfix and 2 new APIs: |
|
775 | IPython 7.8.0 contain a few bugfix and 2 new APIs: | |
732 |
|
776 | |||
733 | - Enable changing the font color for LaTeX rendering :ghpull:`11840` |
|
777 | - Enable changing the font color for LaTeX rendering :ghpull:`11840` | |
734 | - and Re-Expose some PDB API (see below) |
|
778 | - and Re-Expose some PDB API (see below) | |
735 |
|
779 | |||
736 | Expose Pdb API |
|
780 | Expose Pdb API | |
737 | -------------- |
|
781 | -------------- | |
738 |
|
782 | |||
739 | Expose the built-in ``pdb.Pdb`` API. ``Pdb`` constructor arguments are generically |
|
783 | Expose the built-in ``pdb.Pdb`` API. ``Pdb`` constructor arguments are generically | |
740 | exposed, regardless of python version. |
|
784 | exposed, regardless of python version. | |
741 | Newly exposed arguments: |
|
785 | Newly exposed arguments: | |
742 |
|
786 | |||
743 | - ``skip`` - Python 3.1+ |
|
787 | - ``skip`` - Python 3.1+ | |
744 | - ``nosiginnt`` - Python 3.2+ |
|
788 | - ``nosiginnt`` - Python 3.2+ | |
745 | - ``readrc`` - Python 3.6+ |
|
789 | - ``readrc`` - Python 3.6+ | |
746 |
|
790 | |||
747 | Try it out:: |
|
791 | Try it out:: | |
748 |
|
792 | |||
749 | from IPython.terminal.debugger import TerminalPdb |
|
793 | from IPython.terminal.debugger import TerminalPdb | |
750 | pdb = TerminalPdb(skip=["skipthismodule"]) |
|
794 | pdb = TerminalPdb(skip=["skipthismodule"]) | |
751 |
|
795 | |||
752 |
|
796 | |||
753 | See :ghpull:`11840` |
|
797 | See :ghpull:`11840` | |
754 |
|
798 | |||
755 | .. _version770: |
|
799 | .. _version770: | |
756 |
|
800 | |||
757 | IPython 7.7.0 |
|
801 | IPython 7.7.0 | |
758 | ============= |
|
802 | ============= | |
759 |
|
803 | |||
760 | IPython 7.7.0 contain multiple bug fixes and documentation updates; Here are a |
|
804 | IPython 7.7.0 contain multiple bug fixes and documentation updates; Here are a | |
761 | few of the outstanding issue fixed: |
|
805 | few of the outstanding issue fixed: | |
762 |
|
806 | |||
763 | - Fix a bug introduced in 7.6 where the ``%matplotlib`` magic would fail on |
|
807 | - Fix a bug introduced in 7.6 where the ``%matplotlib`` magic would fail on | |
764 | previously acceptable arguments :ghpull:`11814`. |
|
808 | previously acceptable arguments :ghpull:`11814`. | |
765 | - Fix the manage location on freebsd :ghpull:`11808`. |
|
809 | - Fix the manage location on freebsd :ghpull:`11808`. | |
766 | - Fix error message about aliases after ``%reset`` call in ipykernel |
|
810 | - Fix error message about aliases after ``%reset`` call in ipykernel | |
767 | :ghpull:`11806` |
|
811 | :ghpull:`11806` | |
768 | - Fix Duplication completions in emacs :ghpull:`11803` |
|
812 | - Fix Duplication completions in emacs :ghpull:`11803` | |
769 |
|
813 | |||
770 | We are planning to adopt `NEP29 <https://github.com/numpy/numpy/pull/14086>`_ |
|
814 | We are planning to adopt `NEP29 <https://github.com/numpy/numpy/pull/14086>`_ | |
771 | (still currently in draft) which may make this minor version of IPython the |
|
815 | (still currently in draft) which may make this minor version of IPython the | |
772 | last one to support Python 3.5 and will make the code base more aggressive |
|
816 | last one to support Python 3.5 and will make the code base more aggressive | |
773 | toward removing compatibility with older versions of Python. |
|
817 | toward removing compatibility with older versions of Python. | |
774 |
|
818 | |||
775 | GitHub now support to give only "Triage" permissions to users; if you'd like to |
|
819 | GitHub now support to give only "Triage" permissions to users; if you'd like to | |
776 | help close stale issues and labels issues please reach to us with your GitHub |
|
820 | help close stale issues and labels issues please reach to us with your GitHub | |
777 | Username and we'll add you to the triage team. It is a great way to start |
|
821 | Username and we'll add you to the triage team. It is a great way to start | |
778 | contributing and a path toward getting commit rights. |
|
822 | contributing and a path toward getting commit rights. | |
779 |
|
823 | |||
780 | .. _version761: |
|
824 | .. _version761: | |
781 |
|
825 | |||
782 | IPython 7.6.1 |
|
826 | IPython 7.6.1 | |
783 | ============= |
|
827 | ============= | |
784 |
|
828 | |||
785 | IPython 7.6.1 contain a critical bugfix in the ``%timeit`` magic, which would |
|
829 | IPython 7.6.1 contain a critical bugfix in the ``%timeit`` magic, which would | |
786 | crash on some inputs as a side effect of :ghpull:`11716`. See :ghpull:`11812` |
|
830 | crash on some inputs as a side effect of :ghpull:`11716`. See :ghpull:`11812` | |
787 |
|
831 | |||
788 |
|
832 | |||
789 | .. _whatsnew760: |
|
833 | .. _whatsnew760: | |
790 |
|
834 | |||
791 | IPython 7.6.0 |
|
835 | IPython 7.6.0 | |
792 | ============= |
|
836 | ============= | |
793 |
|
837 | |||
794 | IPython 7.6.0 contains a couple of bug fixes and number of small features |
|
838 | IPython 7.6.0 contains a couple of bug fixes and number of small features | |
795 | additions as well as some compatibility with the current development version of |
|
839 | additions as well as some compatibility with the current development version of | |
796 | Python 3.8. |
|
840 | Python 3.8. | |
797 |
|
841 | |||
798 | - Add a ``-l`` option to :magic:`psearch` to list the available search |
|
842 | - Add a ``-l`` option to :magic:`psearch` to list the available search | |
799 | types. :ghpull:`11672` |
|
843 | types. :ghpull:`11672` | |
800 | - Support ``PathLike`` for ``DisplayObject`` and ``Image``. :ghpull:`11764` |
|
844 | - Support ``PathLike`` for ``DisplayObject`` and ``Image``. :ghpull:`11764` | |
801 | - Configurability of timeout in the test suite for slow platforms. |
|
845 | - Configurability of timeout in the test suite for slow platforms. | |
802 | :ghpull:`11756` |
|
846 | :ghpull:`11756` | |
803 | - Accept any casing for matplotlib backend. :ghpull:`121748` |
|
847 | - Accept any casing for matplotlib backend. :ghpull:`121748` | |
804 | - Properly skip test that requires numpy to be installed :ghpull:`11723` |
|
848 | - Properly skip test that requires numpy to be installed :ghpull:`11723` | |
805 | - More support for Python 3.8 and positional only arguments (pep570) |
|
849 | - More support for Python 3.8 and positional only arguments (pep570) | |
806 | :ghpull:`11720` |
|
850 | :ghpull:`11720` | |
807 | - Unicode names for the completion are loaded lazily on first use which |
|
851 | - Unicode names for the completion are loaded lazily on first use which | |
808 | should decrease startup time. :ghpull:`11693` |
|
852 | should decrease startup time. :ghpull:`11693` | |
809 | - Autoreload now update the types of reloaded objects; this for example allow |
|
853 | - Autoreload now update the types of reloaded objects; this for example allow | |
810 | pickling of reloaded objects. :ghpull:`11644` |
|
854 | pickling of reloaded objects. :ghpull:`11644` | |
811 | - Fix a bug where ``%%time`` magic would suppress cell output. :ghpull:`11716` |
|
855 | - Fix a bug where ``%%time`` magic would suppress cell output. :ghpull:`11716` | |
812 |
|
856 | |||
813 |
|
857 | |||
814 | Prepare migration to pytest (instead of nose) for testing |
|
858 | Prepare migration to pytest (instead of nose) for testing | |
815 | --------------------------------------------------------- |
|
859 | --------------------------------------------------------- | |
816 |
|
860 | |||
817 | Most of the work between 7.5 and 7.6 was to prepare the migration from our |
|
861 | Most of the work between 7.5 and 7.6 was to prepare the migration from our | |
818 | testing framework to pytest. Most of the test suite should now work by simply |
|
862 | testing framework to pytest. Most of the test suite should now work by simply | |
819 | issuing ``pytest`` from the root of the repository. |
|
863 | issuing ``pytest`` from the root of the repository. | |
820 |
|
864 | |||
821 | The migration to pytest is just at its beginning. Many of our test still rely |
|
865 | The migration to pytest is just at its beginning. Many of our test still rely | |
822 | on IPython-specific plugins for nose using pytest (doctest using IPython syntax |
|
866 | on IPython-specific plugins for nose using pytest (doctest using IPython syntax | |
823 | is one example of this where test appear as "passing", while no code has been |
|
867 | is one example of this where test appear as "passing", while no code has been | |
824 | ran). Many test also need to be updated like ``yield-test`` to be properly |
|
868 | ran). Many test also need to be updated like ``yield-test`` to be properly | |
825 | parametrized tests. |
|
869 | parametrized tests. | |
826 |
|
870 | |||
827 | Migration to pytest allowed me to discover a number of issues in our test |
|
871 | Migration to pytest allowed me to discover a number of issues in our test | |
828 | suite; which was hiding a number of subtle issues βΒ or not actually running |
|
872 | suite; which was hiding a number of subtle issues βΒ or not actually running | |
829 | some of the tests in our test suite β I have thus corrected many of those; like |
|
873 | some of the tests in our test suite β I have thus corrected many of those; like | |
830 | improperly closed resources; or used of deprecated features. I also made use of |
|
874 | improperly closed resources; or used of deprecated features. I also made use of | |
831 | the ``pytest --durations=...`` to find some of our slowest test and speed them |
|
875 | the ``pytest --durations=...`` to find some of our slowest test and speed them | |
832 | up (our test suite can now be up to 10% faster). Pytest as also a variety of |
|
876 | up (our test suite can now be up to 10% faster). Pytest as also a variety of | |
833 | plugins and flags which will make the code quality of IPython and the testing |
|
877 | plugins and flags which will make the code quality of IPython and the testing | |
834 | experience better. |
|
878 | experience better. | |
835 |
|
879 | |||
836 | Misc |
|
880 | Misc | |
837 | ---- |
|
881 | ---- | |
838 |
|
882 | |||
839 | We skipped the release of 7.6 at the end of May, but will attempt to get back |
|
883 | We skipped the release of 7.6 at the end of May, but will attempt to get back | |
840 | on schedule. We are starting to think about making introducing backward |
|
884 | on schedule. We are starting to think about making introducing backward | |
841 | incompatible change and start the 8.0 series. |
|
885 | incompatible change and start the 8.0 series. | |
842 |
|
886 | |||
843 | Special Thanks to Gabriel (@gpotter2 on GitHub), who among other took care many |
|
887 | Special Thanks to Gabriel (@gpotter2 on GitHub), who among other took care many | |
844 | of the remaining task for 7.4 and 7.5, like updating the website. |
|
888 | of the remaining task for 7.4 and 7.5, like updating the website. | |
845 |
|
889 | |||
846 | .. _whatsnew750: |
|
890 | .. _whatsnew750: | |
847 |
|
891 | |||
848 | IPython 7.5.0 |
|
892 | IPython 7.5.0 | |
849 | ============= |
|
893 | ============= | |
850 |
|
894 | |||
851 | IPython 7.5.0 consist mostly of bug-fixes, and documentation updates, with one |
|
895 | IPython 7.5.0 consist mostly of bug-fixes, and documentation updates, with one | |
852 | minor new feature. The `Audio` display element can now be assigned an element |
|
896 | minor new feature. The `Audio` display element can now be assigned an element | |
853 | id when displayed in browser. See :ghpull:`11670` |
|
897 | id when displayed in browser. See :ghpull:`11670` | |
854 |
|
898 | |||
855 | The major outstanding bug fix correct a change of behavior that was introduce |
|
899 | The major outstanding bug fix correct a change of behavior that was introduce | |
856 | in 7.4.0 where some cell magics would not be able to access or modify global |
|
900 | in 7.4.0 where some cell magics would not be able to access or modify global | |
857 | scope when using the ``@needs_local_scope`` decorator. This was typically |
|
901 | scope when using the ``@needs_local_scope`` decorator. This was typically | |
858 | encountered with the ``%%time`` and ``%%timeit`` magics. See :ghissue:`11659` |
|
902 | encountered with the ``%%time`` and ``%%timeit`` magics. See :ghissue:`11659` | |
859 | and :ghpull:`11698`. |
|
903 | and :ghpull:`11698`. | |
860 |
|
904 | |||
861 | .. _whatsnew740: |
|
905 | .. _whatsnew740: | |
862 |
|
906 | |||
863 | IPython 7.4.0 |
|
907 | IPython 7.4.0 | |
864 | ============= |
|
908 | ============= | |
865 |
|
909 | |||
866 | Unicode name completions |
|
910 | Unicode name completions | |
867 | ------------------------ |
|
911 | ------------------------ | |
868 |
|
912 | |||
869 | Previously, we provided completion for a unicode name with its relative symbol. |
|
913 | Previously, we provided completion for a unicode name with its relative symbol. | |
870 | With this, now IPython provides complete suggestions to unicode name symbols. |
|
914 | With this, now IPython provides complete suggestions to unicode name symbols. | |
871 |
|
915 | |||
872 | As on the PR, if user types ``\LAT<tab>``, IPython provides a list of |
|
916 | As on the PR, if user types ``\LAT<tab>``, IPython provides a list of | |
873 | possible completions. In this case, it would be something like:: |
|
917 | possible completions. In this case, it would be something like:: | |
874 |
|
918 | |||
875 | 'LATIN CAPITAL LETTER A', |
|
919 | 'LATIN CAPITAL LETTER A', | |
876 | 'LATIN CAPITAL LETTER B', |
|
920 | 'LATIN CAPITAL LETTER B', | |
877 | 'LATIN CAPITAL LETTER C', |
|
921 | 'LATIN CAPITAL LETTER C', | |
878 | 'LATIN CAPITAL LETTER D', |
|
922 | 'LATIN CAPITAL LETTER D', | |
879 | .... |
|
923 | .... | |
880 |
|
924 | |||
881 | This help to type unicode character that do not have short latex aliases, and |
|
925 | This help to type unicode character that do not have short latex aliases, and | |
882 | have long unicode names. for example ``Ν°``, ``\GREEK CAPITAL LETTER HETA``. |
|
926 | have long unicode names. for example ``Ν°``, ``\GREEK CAPITAL LETTER HETA``. | |
883 |
|
927 | |||
884 | This feature was contributed by Luciana Marques :ghpull:`11583`. |
|
928 | This feature was contributed by Luciana Marques :ghpull:`11583`. | |
885 |
|
929 | |||
886 | Make audio normalization optional |
|
930 | Make audio normalization optional | |
887 | --------------------------------- |
|
931 | --------------------------------- | |
888 |
|
932 | |||
889 | Added 'normalize' argument to `IPython.display.Audio`. This argument applies |
|
933 | Added 'normalize' argument to `IPython.display.Audio`. This argument applies | |
890 | when audio data is given as an array of samples. The default of `normalize=True` |
|
934 | when audio data is given as an array of samples. The default of `normalize=True` | |
891 | preserves prior behavior of normalizing the audio to the maximum possible range. |
|
935 | preserves prior behavior of normalizing the audio to the maximum possible range. | |
892 | Setting to `False` disables normalization. |
|
936 | Setting to `False` disables normalization. | |
893 |
|
937 | |||
894 |
|
938 | |||
895 | Miscellaneous |
|
939 | Miscellaneous | |
896 | ------------- |
|
940 | ------------- | |
897 |
|
941 | |||
898 | - Fix improper acceptation of ``return`` outside of functions. :ghpull:`11641`. |
|
942 | - Fix improper acceptation of ``return`` outside of functions. :ghpull:`11641`. | |
899 | - Fixed PyQt 5.11 backwards incompatibility causing sip import failure. |
|
943 | - Fixed PyQt 5.11 backwards incompatibility causing sip import failure. | |
900 | :ghpull:`11613`. |
|
944 | :ghpull:`11613`. | |
901 | - Fix Bug where ``type?`` would crash IPython. :ghpull:`1608`. |
|
945 | - Fix Bug where ``type?`` would crash IPython. :ghpull:`1608`. | |
902 | - Allow to apply ``@needs_local_scope`` to cell magics for convenience. |
|
946 | - Allow to apply ``@needs_local_scope`` to cell magics for convenience. | |
903 | :ghpull:`11542`. |
|
947 | :ghpull:`11542`. | |
904 |
|
948 | |||
905 | .. _whatsnew730: |
|
949 | .. _whatsnew730: | |
906 |
|
950 | |||
907 | IPython 7.3.0 |
|
951 | IPython 7.3.0 | |
908 | ============= |
|
952 | ============= | |
909 |
|
953 | |||
910 | .. _whatsnew720: |
|
954 | .. _whatsnew720: | |
911 |
|
955 | |||
912 | IPython 7.3.0 bring several bug fixes and small improvements that you will |
|
956 | IPython 7.3.0 bring several bug fixes and small improvements that you will | |
913 | described bellow. |
|
957 | described bellow. | |
914 |
|
958 | |||
915 | The biggest change to this release is the implementation of the ``%conda`` and |
|
959 | The biggest change to this release is the implementation of the ``%conda`` and | |
916 | ``%pip`` magics, that will attempt to install packages in the **current |
|
960 | ``%pip`` magics, that will attempt to install packages in the **current | |
917 | environment**. You may still need to restart your interpreter or kernel for the |
|
961 | environment**. You may still need to restart your interpreter or kernel for the | |
918 | change to be taken into account, but it should simplify installation of packages |
|
962 | change to be taken into account, but it should simplify installation of packages | |
919 | into remote environment. Installing using pip/conda from the command line is |
|
963 | into remote environment. Installing using pip/conda from the command line is | |
920 | still the prefer method. |
|
964 | still the prefer method. | |
921 |
|
965 | |||
922 | The ``%pip`` magic was already present, but was only printing a warning; now it |
|
966 | The ``%pip`` magic was already present, but was only printing a warning; now it | |
923 | will actually forward commands to pip. |
|
967 | will actually forward commands to pip. | |
924 |
|
968 | |||
925 | Misc bug fixes and improvements: |
|
969 | Misc bug fixes and improvements: | |
926 |
|
970 | |||
927 | - Compatibility with Python 3.8. |
|
971 | - Compatibility with Python 3.8. | |
928 | - Do not expand shell variable in execution magics, and added the |
|
972 | - Do not expand shell variable in execution magics, and added the | |
929 | ``no_var_expand`` decorator for magic requiring a similar functionality |
|
973 | ``no_var_expand`` decorator for magic requiring a similar functionality | |
930 | :ghpull:`11516` |
|
974 | :ghpull:`11516` | |
931 | - Add ``%pip`` and ``%conda`` magic :ghpull:`11524` |
|
975 | - Add ``%pip`` and ``%conda`` magic :ghpull:`11524` | |
932 | - Re-initialize posix aliases after a ``%reset`` :ghpull:`11528` |
|
976 | - Re-initialize posix aliases after a ``%reset`` :ghpull:`11528` | |
933 | - Allow the IPython command line to run ``*.ipynb`` files :ghpull:`11529` |
|
977 | - Allow the IPython command line to run ``*.ipynb`` files :ghpull:`11529` | |
934 |
|
978 | |||
935 | IPython 7.2.0 |
|
979 | IPython 7.2.0 | |
936 | ============= |
|
980 | ============= | |
937 |
|
981 | |||
938 | IPython 7.2.0 brings minor bugfixes, improvements, and new configuration options: |
|
982 | IPython 7.2.0 brings minor bugfixes, improvements, and new configuration options: | |
939 |
|
983 | |||
940 | - Fix a bug preventing PySide2 GUI integration from working :ghpull:`11464` |
|
984 | - Fix a bug preventing PySide2 GUI integration from working :ghpull:`11464` | |
941 | - Run CI on Mac OS ! :ghpull:`11471` |
|
985 | - Run CI on Mac OS ! :ghpull:`11471` | |
942 | - Fix IPython "Demo" mode. :ghpull:`11498` |
|
986 | - Fix IPython "Demo" mode. :ghpull:`11498` | |
943 | - Fix ``%run`` magic with path in name :ghpull:`11499` |
|
987 | - Fix ``%run`` magic with path in name :ghpull:`11499` | |
944 | - Fix: add CWD to sys.path *after* stdlib :ghpull:`11502` |
|
988 | - Fix: add CWD to sys.path *after* stdlib :ghpull:`11502` | |
945 | - Better rendering of signatures, especially long ones. :ghpull:`11505` |
|
989 | - Better rendering of signatures, especially long ones. :ghpull:`11505` | |
946 | - Re-enable jedi by default if it's installed :ghpull:`11506` |
|
990 | - Re-enable jedi by default if it's installed :ghpull:`11506` | |
947 | - Add New ``minimal`` exception reporting mode (useful for educational purpose). See :ghpull:`11509` |
|
991 | - Add New ``minimal`` exception reporting mode (useful for educational purpose). See :ghpull:`11509` | |
948 |
|
992 | |||
949 |
|
993 | |||
950 | Added ability to show subclasses when using pinfo and other utilities |
|
994 | Added ability to show subclasses when using pinfo and other utilities | |
951 | --------------------------------------------------------------------- |
|
995 | --------------------------------------------------------------------- | |
952 |
|
996 | |||
953 | When using ``?``/``??`` on a class, IPython will now list the first 10 subclasses. |
|
997 | When using ``?``/``??`` on a class, IPython will now list the first 10 subclasses. | |
954 |
|
998 | |||
955 | Special Thanks to Chris Mentzel of the Moore Foundation for this feature. Chris |
|
999 | Special Thanks to Chris Mentzel of the Moore Foundation for this feature. Chris | |
956 | is one of the people who played a critical role in IPython/Jupyter getting |
|
1000 | is one of the people who played a critical role in IPython/Jupyter getting | |
957 | funding. |
|
1001 | funding. | |
958 |
|
1002 | |||
959 | We are grateful for all the help Chris has given us over the years, |
|
1003 | We are grateful for all the help Chris has given us over the years, | |
960 | and we're now proud to have code contributed by Chris in IPython. |
|
1004 | and we're now proud to have code contributed by Chris in IPython. | |
961 |
|
1005 | |||
962 | OSMagics.cd_force_quiet configuration option |
|
1006 | OSMagics.cd_force_quiet configuration option | |
963 | -------------------------------------------- |
|
1007 | -------------------------------------------- | |
964 |
|
1008 | |||
965 | You can set this option to force the %cd magic to behave as if ``-q`` was passed: |
|
1009 | You can set this option to force the %cd magic to behave as if ``-q`` was passed: | |
966 | :: |
|
1010 | :: | |
967 |
|
1011 | |||
968 | In [1]: cd / |
|
1012 | In [1]: cd / | |
969 | / |
|
1013 | / | |
970 |
|
1014 | |||
971 | In [2]: %config OSMagics.cd_force_quiet = True |
|
1015 | In [2]: %config OSMagics.cd_force_quiet = True | |
972 |
|
1016 | |||
973 | In [3]: cd /tmp |
|
1017 | In [3]: cd /tmp | |
974 |
|
1018 | |||
975 | In [4]: |
|
1019 | In [4]: | |
976 |
|
1020 | |||
977 | See :ghpull:`11491` |
|
1021 | See :ghpull:`11491` | |
978 |
|
1022 | |||
979 | In vi editing mode, whether the prompt includes the current vi mode can now be configured |
|
1023 | In vi editing mode, whether the prompt includes the current vi mode can now be configured | |
980 | ----------------------------------------------------------------------------------------- |
|
1024 | ----------------------------------------------------------------------------------------- | |
981 |
|
1025 | |||
982 | Set the ``TerminalInteractiveShell.prompt_includes_vi_mode`` to a boolean value |
|
1026 | Set the ``TerminalInteractiveShell.prompt_includes_vi_mode`` to a boolean value | |
983 | (default: True) to control this feature. See :ghpull:`11492` |
|
1027 | (default: True) to control this feature. See :ghpull:`11492` | |
984 |
|
1028 | |||
985 | .. _whatsnew710: |
|
1029 | .. _whatsnew710: | |
986 |
|
1030 | |||
987 | IPython 7.1.0 |
|
1031 | IPython 7.1.0 | |
988 | ============= |
|
1032 | ============= | |
989 |
|
1033 | |||
990 | IPython 7.1.0 is the first minor release after 7.0.0 and mostly brings fixes to |
|
1034 | IPython 7.1.0 is the first minor release after 7.0.0 and mostly brings fixes to | |
991 | new features, internal refactoring, and fixes for regressions that happened during the 6.x->7.x |
|
1035 | new features, internal refactoring, and fixes for regressions that happened during the 6.x->7.x | |
992 | transition. It also brings **Compatibility with Python 3.7.1**, as we're |
|
1036 | transition. It also brings **Compatibility with Python 3.7.1**, as we're | |
993 | unwillingly relying on a bug in CPython. |
|
1037 | unwillingly relying on a bug in CPython. | |
994 |
|
1038 | |||
995 | New Core Dev: |
|
1039 | New Core Dev: | |
996 |
|
1040 | |||
997 | - We welcome Jonathan Slenders to the commiters. Jonathan has done a fantastic |
|
1041 | - We welcome Jonathan Slenders to the commiters. Jonathan has done a fantastic | |
998 | work on prompt_toolkit, and we'd like to recognise his impact by giving him |
|
1042 | work on prompt_toolkit, and we'd like to recognise his impact by giving him | |
999 | commit rights. :ghissue:`11397` |
|
1043 | commit rights. :ghissue:`11397` | |
1000 |
|
1044 | |||
1001 | Notable Changes |
|
1045 | Notable Changes | |
1002 |
|
1046 | |||
1003 | - Major update of "latex to unicode" tab completion map (see below) |
|
1047 | - Major update of "latex to unicode" tab completion map (see below) | |
1004 |
|
1048 | |||
1005 | Notable New Features: |
|
1049 | Notable New Features: | |
1006 |
|
1050 | |||
1007 | - Restore functionality and documentation of the **sphinx directive**, which |
|
1051 | - Restore functionality and documentation of the **sphinx directive**, which | |
1008 | is now stricter (fail on error by daefault), has new configuration options, |
|
1052 | is now stricter (fail on error by daefault), has new configuration options, | |
1009 | has a brand new documentation page :ref:`ipython_directive` (which needs |
|
1053 | has a brand new documentation page :ref:`ipython_directive` (which needs | |
1010 | some cleanup). It is also now *tested* so we hope to have less regressions. |
|
1054 | some cleanup). It is also now *tested* so we hope to have less regressions. | |
1011 | :ghpull:`11402` |
|
1055 | :ghpull:`11402` | |
1012 |
|
1056 | |||
1013 | - ``IPython.display.Video`` now supports ``width`` and ``height`` arguments, |
|
1057 | - ``IPython.display.Video`` now supports ``width`` and ``height`` arguments, | |
1014 | allowing a custom width and height to be set instead of using the video's |
|
1058 | allowing a custom width and height to be set instead of using the video's | |
1015 | width and height. :ghpull:`11353` |
|
1059 | width and height. :ghpull:`11353` | |
1016 |
|
1060 | |||
1017 | - Warn when using ``HTML('<iframe>')`` instead of ``IFrame`` :ghpull:`11350` |
|
1061 | - Warn when using ``HTML('<iframe>')`` instead of ``IFrame`` :ghpull:`11350` | |
1018 |
|
1062 | |||
1019 | - Allow Dynamic switching of editing mode between vi/emacs and show |
|
1063 | - Allow Dynamic switching of editing mode between vi/emacs and show | |
1020 | normal/input mode in prompt when using vi. :ghpull:`11390`. Use ``%config |
|
1064 | normal/input mode in prompt when using vi. :ghpull:`11390`. Use ``%config | |
1021 | TerminalInteractiveShell.editing_mode = 'vi'`` or ``%config |
|
1065 | TerminalInteractiveShell.editing_mode = 'vi'`` or ``%config | |
1022 | TerminalInteractiveShell.editing_mode = 'emacs'`` to dynamically switch |
|
1066 | TerminalInteractiveShell.editing_mode = 'emacs'`` to dynamically switch | |
1023 | between modes. |
|
1067 | between modes. | |
1024 |
|
1068 | |||
1025 |
|
1069 | |||
1026 | Notable Fixes: |
|
1070 | Notable Fixes: | |
1027 |
|
1071 | |||
1028 | - Fix entering of **multi-line blocks in terminal** IPython, and various |
|
1072 | - Fix entering of **multi-line blocks in terminal** IPython, and various | |
1029 | crashes in the new input transformation machinery :ghpull:`11354`, |
|
1073 | crashes in the new input transformation machinery :ghpull:`11354`, | |
1030 | :ghpull:`11356`, :ghpull:`11358`. These also fix a **Compatibility bug |
|
1074 | :ghpull:`11356`, :ghpull:`11358`. These also fix a **Compatibility bug | |
1031 | with Python 3.7.1**. |
|
1075 | with Python 3.7.1**. | |
1032 |
|
1076 | |||
1033 | - Fix moving through generator stack in ipdb :ghpull:`11266` |
|
1077 | - Fix moving through generator stack in ipdb :ghpull:`11266` | |
1034 |
|
1078 | |||
1035 | - %Magic command arguments now support quoting. :ghpull:`11330` |
|
1079 | - %Magic command arguments now support quoting. :ghpull:`11330` | |
1036 |
|
1080 | |||
1037 | - Re-add ``rprint`` and ``rprinte`` aliases. :ghpull:`11331` |
|
1081 | - Re-add ``rprint`` and ``rprinte`` aliases. :ghpull:`11331` | |
1038 |
|
1082 | |||
1039 | - Remove implicit dependency on ``ipython_genutils`` :ghpull:`11317` |
|
1083 | - Remove implicit dependency on ``ipython_genutils`` :ghpull:`11317` | |
1040 |
|
1084 | |||
1041 | - Make ``nonlocal`` raise ``SyntaxError`` instead of silently failing in async |
|
1085 | - Make ``nonlocal`` raise ``SyntaxError`` instead of silently failing in async | |
1042 | mode. :ghpull:`11382` |
|
1086 | mode. :ghpull:`11382` | |
1043 |
|
1087 | |||
1044 | - Fix mishandling of magics and ``= !`` assignment just after a dedent in |
|
1088 | - Fix mishandling of magics and ``= !`` assignment just after a dedent in | |
1045 | nested code blocks :ghpull:`11418` |
|
1089 | nested code blocks :ghpull:`11418` | |
1046 |
|
1090 | |||
1047 | - Fix instructions for custom shortcuts :ghpull:`11426` |
|
1091 | - Fix instructions for custom shortcuts :ghpull:`11426` | |
1048 |
|
1092 | |||
1049 |
|
1093 | |||
1050 | Notable Internals improvements: |
|
1094 | Notable Internals improvements: | |
1051 |
|
1095 | |||
1052 | - Use of ``os.scandir`` (Python 3 only) to speed up some file system operations. |
|
1096 | - Use of ``os.scandir`` (Python 3 only) to speed up some file system operations. | |
1053 | :ghpull:`11365` |
|
1097 | :ghpull:`11365` | |
1054 |
|
1098 | |||
1055 | - use ``perf_counter`` instead of ``clock`` for more precise |
|
1099 | - use ``perf_counter`` instead of ``clock`` for more precise | |
1056 | timing results with ``%time`` :ghpull:`11376` |
|
1100 | timing results with ``%time`` :ghpull:`11376` | |
1057 |
|
1101 | |||
1058 | Many thanks to all the contributors and in particular to ``bartskowron`` and |
|
1102 | Many thanks to all the contributors and in particular to ``bartskowron`` and | |
1059 | ``tonyfast`` who handled some pretty complicated bugs in the input machinery. We |
|
1103 | ``tonyfast`` who handled some pretty complicated bugs in the input machinery. We | |
1060 | had a number of first time contributors and maybe hacktoberfest participants that |
|
1104 | had a number of first time contributors and maybe hacktoberfest participants that | |
1061 | made significant contributions and helped us free some time to focus on more |
|
1105 | made significant contributions and helped us free some time to focus on more | |
1062 | complicated bugs. |
|
1106 | complicated bugs. | |
1063 |
|
1107 | |||
1064 | You |
|
1108 | You | |
1065 | can see all the closed issues and Merged PR, new features and fixes `here |
|
1109 | can see all the closed issues and Merged PR, new features and fixes `here | |
1066 | <https://github.com/ipython/ipython/issues?utf8=%E2%9C%93&q=+is%3Aclosed+milestone%3A7.1+>`_. |
|
1110 | <https://github.com/ipython/ipython/issues?utf8=%E2%9C%93&q=+is%3Aclosed+milestone%3A7.1+>`_. | |
1067 |
|
1111 | |||
1068 | Unicode Completion update |
|
1112 | Unicode Completion update | |
1069 | ------------------------- |
|
1113 | ------------------------- | |
1070 |
|
1114 | |||
1071 | In IPython 7.1 the Unicode completion map has been updated and synchronized with |
|
1115 | In IPython 7.1 the Unicode completion map has been updated and synchronized with | |
1072 | the Julia language. |
|
1116 | the Julia language. | |
1073 |
|
1117 | |||
1074 | Added and removed character characters: |
|
1118 | Added and removed character characters: | |
1075 |
|
1119 | |||
1076 | ``\jmath`` (``Θ·``), ``\\underleftrightarrow`` (U+034D, combining) have been |
|
1120 | ``\jmath`` (``Θ·``), ``\\underleftrightarrow`` (U+034D, combining) have been | |
1077 | added, while ``\\textasciicaron`` have been removed |
|
1121 | added, while ``\\textasciicaron`` have been removed | |
1078 |
|
1122 | |||
1079 | Some sequences have seen their prefix removed: |
|
1123 | Some sequences have seen their prefix removed: | |
1080 |
|
1124 | |||
1081 | - 6 characters ``\text...<tab>`` should now be inputed with ``\...<tab>`` directly, |
|
1125 | - 6 characters ``\text...<tab>`` should now be inputed with ``\...<tab>`` directly, | |
1082 | - 45 characters ``\Elz...<tab>`` should now be inputed with ``\...<tab>`` directly, |
|
1126 | - 45 characters ``\Elz...<tab>`` should now be inputed with ``\...<tab>`` directly, | |
1083 | - 65 characters ``\B...<tab>`` should now be inputed with ``\...<tab>`` directly, |
|
1127 | - 65 characters ``\B...<tab>`` should now be inputed with ``\...<tab>`` directly, | |
1084 | - 450 characters ``\m...<tab>`` should now be inputed with ``\...<tab>`` directly, |
|
1128 | - 450 characters ``\m...<tab>`` should now be inputed with ``\...<tab>`` directly, | |
1085 |
|
1129 | |||
1086 | Some sequences have seen their prefix shortened: |
|
1130 | Some sequences have seen their prefix shortened: | |
1087 |
|
1131 | |||
1088 | - 5 characters ``\mitBbb...<tab>`` should now be inputed with ``\bbi...<tab>`` directly, |
|
1132 | - 5 characters ``\mitBbb...<tab>`` should now be inputed with ``\bbi...<tab>`` directly, | |
1089 | - 52 characters ``\mit...<tab>`` should now be inputed with ``\i...<tab>`` directly, |
|
1133 | - 52 characters ``\mit...<tab>`` should now be inputed with ``\i...<tab>`` directly, | |
1090 | - 216 characters ``\mbfit...<tab>`` should now be inputed with ``\bi...<tab>`` directly, |
|
1134 | - 216 characters ``\mbfit...<tab>`` should now be inputed with ``\bi...<tab>`` directly, | |
1091 | - 222 characters ``\mbf...<tab>`` should now be inputed with ``\b...<tab>`` directly, |
|
1135 | - 222 characters ``\mbf...<tab>`` should now be inputed with ``\b...<tab>`` directly, | |
1092 |
|
1136 | |||
1093 | A couple of characters had their sequence simplified: |
|
1137 | A couple of characters had their sequence simplified: | |
1094 |
|
1138 | |||
1095 | - ``Γ°``, type ``\dh<tab>``, instead of ``\eth<tab>`` |
|
1139 | - ``Γ°``, type ``\dh<tab>``, instead of ``\eth<tab>`` | |
1096 | - ``Δ§``, type ``\hbar<tab>``, instead of ``\Elzxh<tab>`` |
|
1140 | - ``Δ§``, type ``\hbar<tab>``, instead of ``\Elzxh<tab>`` | |
1097 | - ``ΙΈ``, type ``\ltphi<tab>``, instead of ``\textphi<tab>`` |
|
1141 | - ``ΙΈ``, type ``\ltphi<tab>``, instead of ``\textphi<tab>`` | |
1098 | - ``Ο΄``, type ``\varTheta<tab>``, instead of ``\textTheta<tab>`` |
|
1142 | - ``Ο΄``, type ``\varTheta<tab>``, instead of ``\textTheta<tab>`` | |
1099 | - ``β``, type ``\eulermascheroni<tab>``, instead of ``\Eulerconst<tab>`` |
|
1143 | - ``β``, type ``\eulermascheroni<tab>``, instead of ``\Eulerconst<tab>`` | |
1100 | - ``β``, type ``\planck<tab>``, instead of ``\Planckconst<tab>`` |
|
1144 | - ``β``, type ``\planck<tab>``, instead of ``\Planckconst<tab>`` | |
1101 |
|
1145 | |||
1102 | - U+0336 (COMBINING LONG STROKE OVERLAY), type ``\strike<tab>``, instead of ``\Elzbar<tab>``. |
|
1146 | - U+0336 (COMBINING LONG STROKE OVERLAY), type ``\strike<tab>``, instead of ``\Elzbar<tab>``. | |
1103 |
|
1147 | |||
1104 | A couple of sequences have been updated: |
|
1148 | A couple of sequences have been updated: | |
1105 |
|
1149 | |||
1106 | - ``\varepsilon`` now gives ``Ι`` (GREEK SMALL LETTER EPSILON) instead of ``Ξ΅`` (GREEK LUNATE EPSILON SYMBOL), |
|
1150 | - ``\varepsilon`` now gives ``Ι`` (GREEK SMALL LETTER EPSILON) instead of ``Ξ΅`` (GREEK LUNATE EPSILON SYMBOL), | |
1107 | - ``\underbar`` now gives U+0331 (COMBINING MACRON BELOW) instead of U+0332 (COMBINING LOW LINE). |
|
1151 | - ``\underbar`` now gives U+0331 (COMBINING MACRON BELOW) instead of U+0332 (COMBINING LOW LINE). | |
1108 |
|
1152 | |||
1109 |
|
1153 | |||
1110 | .. _whatsnew700: |
|
1154 | .. _whatsnew700: | |
1111 |
|
1155 | |||
1112 | IPython 7.0.0 |
|
1156 | IPython 7.0.0 | |
1113 | ============= |
|
1157 | ============= | |
1114 |
|
1158 | |||
1115 | Released Thursday September 27th, 2018 |
|
1159 | Released Thursday September 27th, 2018 | |
1116 |
|
1160 | |||
1117 | IPython 7 includes major feature improvements. |
|
1161 | IPython 7 includes major feature improvements. | |
1118 | This is also the second major version of IPython to support only |
|
1162 | This is also the second major version of IPython to support only | |
1119 | Python 3 βΒ starting at Python 3.4. Python 2 is still community-supported |
|
1163 | Python 3 βΒ starting at Python 3.4. Python 2 is still community-supported | |
1120 | on the bugfix only 5.x branch, but we remind you that Python 2 "end of life" |
|
1164 | on the bugfix only 5.x branch, but we remind you that Python 2 "end of life" | |
1121 | is on Jan 1st 2020. |
|
1165 | is on Jan 1st 2020. | |
1122 |
|
1166 | |||
1123 | We were able to backport bug fixes to the 5.x branch thanks to our backport bot which |
|
1167 | We were able to backport bug fixes to the 5.x branch thanks to our backport bot which | |
1124 | backported more than `70 Pull-Requests |
|
1168 | backported more than `70 Pull-Requests | |
1125 | <https://github.com/ipython/ipython/pulls?page=3&q=is%3Apr+sort%3Aupdated-desc+author%3Aapp%2Fmeeseeksdev++5.x&utf8=%E2%9C%93>`_, but there are still many PRs that required manual work. This is an area of the project where you can easily contribute by looking for `PRs that still need manual backport <https://github.com/ipython/ipython/issues?q=label%3A%22Still+Needs+Manual+Backport%22+is%3Aclosed+sort%3Aupdated-desc>`_ |
|
1169 | <https://github.com/ipython/ipython/pulls?page=3&q=is%3Apr+sort%3Aupdated-desc+author%3Aapp%2Fmeeseeksdev++5.x&utf8=%E2%9C%93>`_, but there are still many PRs that required manual work. This is an area of the project where you can easily contribute by looking for `PRs that still need manual backport <https://github.com/ipython/ipython/issues?q=label%3A%22Still+Needs+Manual+Backport%22+is%3Aclosed+sort%3Aupdated-desc>`_ | |
1126 |
|
1170 | |||
1127 | The IPython 6.x branch will likely not see any further release unless critical |
|
1171 | The IPython 6.x branch will likely not see any further release unless critical | |
1128 | bugs are found. |
|
1172 | bugs are found. | |
1129 |
|
1173 | |||
1130 | Make sure you have pip > 9.0 before upgrading. You should be able to update by running: |
|
1174 | Make sure you have pip > 9.0 before upgrading. You should be able to update by running: | |
1131 |
|
1175 | |||
1132 | .. code:: |
|
1176 | .. code:: | |
1133 |
|
1177 | |||
1134 | pip install ipython --upgrade |
|
1178 | pip install ipython --upgrade | |
1135 |
|
1179 | |||
1136 | .. only:: ipydev |
|
1180 | .. only:: ipydev | |
1137 |
|
1181 | |||
1138 | If you are trying to install or update an ``alpha``, ``beta``, or ``rc`` |
|
1182 | If you are trying to install or update an ``alpha``, ``beta``, or ``rc`` | |
1139 | version, use pip ``--pre`` flag. |
|
1183 | version, use pip ``--pre`` flag. | |
1140 |
|
1184 | |||
1141 | .. code:: |
|
1185 | .. code:: | |
1142 |
|
1186 | |||
1143 | pip install ipython --upgrade --pre |
|
1187 | pip install ipython --upgrade --pre | |
1144 |
|
1188 | |||
1145 |
|
1189 | |||
1146 | Or, if you have conda installed: |
|
1190 | Or, if you have conda installed: | |
1147 |
|
1191 | |||
1148 | .. code:: |
|
1192 | .. code:: | |
1149 |
|
1193 | |||
1150 | conda install ipython |
|
1194 | conda install ipython | |
1151 |
|
1195 | |||
1152 |
|
1196 | |||
1153 |
|
1197 | |||
1154 | Prompt Toolkit 2.0 |
|
1198 | Prompt Toolkit 2.0 | |
1155 | ------------------ |
|
1199 | ------------------ | |
1156 |
|
1200 | |||
1157 | IPython 7.0+ now uses ``prompt_toolkit 2.0``. If you still need to use an earlier |
|
1201 | IPython 7.0+ now uses ``prompt_toolkit 2.0``. If you still need to use an earlier | |
1158 | ``prompt_toolkit`` version, you may need to pin IPython to ``<7.0``. |
|
1202 | ``prompt_toolkit`` version, you may need to pin IPython to ``<7.0``. | |
1159 |
|
1203 | |||
1160 | Autowait: Asynchronous REPL |
|
1204 | Autowait: Asynchronous REPL | |
1161 | --------------------------- |
|
1205 | --------------------------- | |
1162 |
|
1206 | |||
1163 | Staring with IPython 7.0 on Python 3.6+, IPython can automatically ``await`` |
|
1207 | Staring with IPython 7.0 on Python 3.6+, IPython can automatically ``await`` | |
1164 | top level code. You should not need to access an event loop or runner |
|
1208 | top level code. You should not need to access an event loop or runner | |
1165 | yourself. To learn more, read the :ref:`autoawait` section of our docs, see |
|
1209 | yourself. To learn more, read the :ref:`autoawait` section of our docs, see | |
1166 | :ghpull:`11265`, or try the following code:: |
|
1210 | :ghpull:`11265`, or try the following code:: | |
1167 |
|
1211 | |||
1168 | Python 3.6.0 |
|
1212 | Python 3.6.0 | |
1169 | Type 'copyright', 'credits' or 'license' for more information |
|
1213 | Type 'copyright', 'credits' or 'license' for more information | |
1170 | IPython 7.0.0 -- An enhanced Interactive Python. Type '?' for help. |
|
1214 | IPython 7.0.0 -- An enhanced Interactive Python. Type '?' for help. | |
1171 |
|
1215 | |||
1172 | In [1]: import aiohttp |
|
1216 | In [1]: import aiohttp | |
1173 | ...: result = aiohttp.get('https://api.github.com') |
|
1217 | ...: result = aiohttp.get('https://api.github.com') | |
1174 |
|
1218 | |||
1175 | In [2]: response = await result |
|
1219 | In [2]: response = await result | |
1176 | <pause for a few 100s ms> |
|
1220 | <pause for a few 100s ms> | |
1177 |
|
1221 | |||
1178 | In [3]: await response.json() |
|
1222 | In [3]: await response.json() | |
1179 | Out[3]: |
|
1223 | Out[3]: | |
1180 | {'authorizations_url': 'https://api.github.com/authorizations', |
|
1224 | {'authorizations_url': 'https://api.github.com/authorizations', | |
1181 | 'code_search_url': 'https://api.github.com/search/code?q={query}{&page,per_page,sort,order}', |
|
1225 | 'code_search_url': 'https://api.github.com/search/code?q={query}{&page,per_page,sort,order}', | |
1182 | ... |
|
1226 | ... | |
1183 | } |
|
1227 | } | |
1184 |
|
1228 | |||
1185 | .. note:: |
|
1229 | .. note:: | |
1186 |
|
1230 | |||
1187 | Async integration is experimental code, behavior may change or be removed |
|
1231 | Async integration is experimental code, behavior may change or be removed | |
1188 | between Python and IPython versions without warnings. |
|
1232 | between Python and IPython versions without warnings. | |
1189 |
|
1233 | |||
1190 | Integration is by default with `asyncio`, but other libraries can be configured -- |
|
1234 | Integration is by default with `asyncio`, but other libraries can be configured -- | |
1191 | like ``curio`` or ``trio`` -- to improve concurrency in the REPL:: |
|
1235 | like ``curio`` or ``trio`` -- to improve concurrency in the REPL:: | |
1192 |
|
1236 | |||
1193 | In [1]: %autoawait trio |
|
1237 | In [1]: %autoawait trio | |
1194 |
|
1238 | |||
1195 | In [2]: import trio |
|
1239 | In [2]: import trio | |
1196 |
|
1240 | |||
1197 | In [3]: async def child(i): |
|
1241 | In [3]: async def child(i): | |
1198 | ...: print(" child %s goes to sleep"%i) |
|
1242 | ...: print(" child %s goes to sleep"%i) | |
1199 | ...: await trio.sleep(2) |
|
1243 | ...: await trio.sleep(2) | |
1200 | ...: print(" child %s wakes up"%i) |
|
1244 | ...: print(" child %s wakes up"%i) | |
1201 |
|
1245 | |||
1202 | In [4]: print('parent start') |
|
1246 | In [4]: print('parent start') | |
1203 | ...: async with trio.open_nursery() as n: |
|
1247 | ...: async with trio.open_nursery() as n: | |
1204 | ...: for i in range(3): |
|
1248 | ...: for i in range(3): | |
1205 | ...: n.spawn(child, i) |
|
1249 | ...: n.spawn(child, i) | |
1206 | ...: print('parent end') |
|
1250 | ...: print('parent end') | |
1207 | parent start |
|
1251 | parent start | |
1208 | child 2 goes to sleep |
|
1252 | child 2 goes to sleep | |
1209 | child 0 goes to sleep |
|
1253 | child 0 goes to sleep | |
1210 | child 1 goes to sleep |
|
1254 | child 1 goes to sleep | |
1211 | <about 2 seconds pause> |
|
1255 | <about 2 seconds pause> | |
1212 | child 2 wakes up |
|
1256 | child 2 wakes up | |
1213 | child 1 wakes up |
|
1257 | child 1 wakes up | |
1214 | child 0 wakes up |
|
1258 | child 0 wakes up | |
1215 | parent end |
|
1259 | parent end | |
1216 |
|
1260 | |||
1217 | See :ref:`autoawait` for more information. |
|
1261 | See :ref:`autoawait` for more information. | |
1218 |
|
1262 | |||
1219 |
|
1263 | |||
1220 | Asynchronous code in a Notebook interface or any other frontend using the |
|
1264 | Asynchronous code in a Notebook interface or any other frontend using the | |
1221 | Jupyter Protocol will require further updates to the IPykernel package. |
|
1265 | Jupyter Protocol will require further updates to the IPykernel package. | |
1222 |
|
1266 | |||
1223 | Non-Asynchronous code |
|
1267 | Non-Asynchronous code | |
1224 | ~~~~~~~~~~~~~~~~~~~~~ |
|
1268 | ~~~~~~~~~~~~~~~~~~~~~ | |
1225 |
|
1269 | |||
1226 | As the internal API of IPython is now asynchronous, IPython needs to run under |
|
1270 | As the internal API of IPython is now asynchronous, IPython needs to run under | |
1227 | an event loop. In order to allow many workflows, (like using the :magic:`%run` |
|
1271 | an event loop. In order to allow many workflows, (like using the :magic:`%run` | |
1228 | magic, or copy-pasting code that explicitly starts/stop event loop), when |
|
1272 | magic, or copy-pasting code that explicitly starts/stop event loop), when | |
1229 | top-level code is detected as not being asynchronous, IPython code is advanced |
|
1273 | top-level code is detected as not being asynchronous, IPython code is advanced | |
1230 | via a pseudo-synchronous runner, and may not advance pending tasks. |
|
1274 | via a pseudo-synchronous runner, and may not advance pending tasks. | |
1231 |
|
1275 | |||
1232 | Change to Nested Embed |
|
1276 | Change to Nested Embed | |
1233 | ~~~~~~~~~~~~~~~~~~~~~~ |
|
1277 | ~~~~~~~~~~~~~~~~~~~~~~ | |
1234 |
|
1278 | |||
1235 | The introduction of the ability to run async code had some effect on the |
|
1279 | The introduction of the ability to run async code had some effect on the | |
1236 | ``IPython.embed()`` API. By default, embed will not allow you to run asynchronous |
|
1280 | ``IPython.embed()`` API. By default, embed will not allow you to run asynchronous | |
1237 | code unless an event loop is specified. |
|
1281 | code unless an event loop is specified. | |
1238 |
|
1282 | |||
1239 | Effects on Magics |
|
1283 | Effects on Magics | |
1240 | ~~~~~~~~~~~~~~~~~ |
|
1284 | ~~~~~~~~~~~~~~~~~ | |
1241 |
|
1285 | |||
1242 | Some magics will not work with async until they're updated. |
|
1286 | Some magics will not work with async until they're updated. | |
1243 | Contributions welcome. |
|
1287 | Contributions welcome. | |
1244 |
|
1288 | |||
1245 | Expected Future changes |
|
1289 | Expected Future changes | |
1246 | ~~~~~~~~~~~~~~~~~~~~~~~ |
|
1290 | ~~~~~~~~~~~~~~~~~~~~~~~ | |
1247 |
|
1291 | |||
1248 | We expect more internal but public IPython functions to become ``async``, and |
|
1292 | We expect more internal but public IPython functions to become ``async``, and | |
1249 | will likely end up having a persistent event loop while IPython is running. |
|
1293 | will likely end up having a persistent event loop while IPython is running. | |
1250 |
|
1294 | |||
1251 | Thanks |
|
1295 | Thanks | |
1252 | ~~~~~~ |
|
1296 | ~~~~~~ | |
1253 |
|
1297 | |||
1254 | This release took more than a year in the making. |
|
1298 | This release took more than a year in the making. | |
1255 | The code was rebased a number of |
|
1299 | The code was rebased a number of | |
1256 | times; leading to commit authorship that may have been lost in the final |
|
1300 | times; leading to commit authorship that may have been lost in the final | |
1257 | Pull-Request. Huge thanks to many people for contribution, discussion, code, |
|
1301 | Pull-Request. Huge thanks to many people for contribution, discussion, code, | |
1258 | documentation, use-cases: dalejung, danielballan, ellisonbg, fperez, gnestor, |
|
1302 | documentation, use-cases: dalejung, danielballan, ellisonbg, fperez, gnestor, | |
1259 | minrk, njsmith, pganssle, tacaswell, takluyver , vidartf ... And many others. |
|
1303 | minrk, njsmith, pganssle, tacaswell, takluyver , vidartf ... And many others. | |
1260 |
|
1304 | |||
1261 |
|
1305 | |||
1262 | Autoreload Improvement |
|
1306 | Autoreload Improvement | |
1263 | ---------------------- |
|
1307 | ---------------------- | |
1264 |
|
1308 | |||
1265 | The magic :magic:`%autoreload 2 <autoreload>` now captures new methods added to |
|
1309 | The magic :magic:`%autoreload 2 <autoreload>` now captures new methods added to | |
1266 | classes. Earlier, only methods existing as of the initial import were being |
|
1310 | classes. Earlier, only methods existing as of the initial import were being | |
1267 | tracked and updated. |
|
1311 | tracked and updated. | |
1268 |
|
1312 | |||
1269 | This new feature helps dual environment development - Jupyter+IDE - where the |
|
1313 | This new feature helps dual environment development - Jupyter+IDE - where the | |
1270 | code gradually moves from notebook cells to package files as it gets |
|
1314 | code gradually moves from notebook cells to package files as it gets | |
1271 | structured. |
|
1315 | structured. | |
1272 |
|
1316 | |||
1273 | **Example**: An instance of the class ``MyClass`` will be able to access the |
|
1317 | **Example**: An instance of the class ``MyClass`` will be able to access the | |
1274 | method ``cube()`` after it is uncommented and the file ``file1.py`` is saved on |
|
1318 | method ``cube()`` after it is uncommented and the file ``file1.py`` is saved on | |
1275 | disk. |
|
1319 | disk. | |
1276 |
|
1320 | |||
1277 |
|
1321 | |||
1278 | .. code:: |
|
1322 | .. code:: | |
1279 |
|
1323 | |||
1280 | # notebook |
|
1324 | # notebook | |
1281 |
|
1325 | |||
1282 | from mymodule import MyClass |
|
1326 | from mymodule import MyClass | |
1283 | first = MyClass(5) |
|
1327 | first = MyClass(5) | |
1284 |
|
1328 | |||
1285 | .. code:: |
|
1329 | .. code:: | |
1286 |
|
1330 | |||
1287 | # mymodule/file1.py |
|
1331 | # mymodule/file1.py | |
1288 |
|
1332 | |||
1289 | class MyClass: |
|
1333 | class MyClass: | |
1290 |
|
1334 | |||
1291 | def __init__(self, a=10): |
|
1335 | def __init__(self, a=10): | |
1292 | self.a = a |
|
1336 | self.a = a | |
1293 |
|
1337 | |||
1294 | def square(self): |
|
1338 | def square(self): | |
1295 | print('compute square') |
|
1339 | print('compute square') | |
1296 | return self.a*self.a |
|
1340 | return self.a*self.a | |
1297 |
|
1341 | |||
1298 | # def cube(self): |
|
1342 | # def cube(self): | |
1299 | # print('compute cube') |
|
1343 | # print('compute cube') | |
1300 | # return self.a*self.a*self.a |
|
1344 | # return self.a*self.a*self.a | |
1301 |
|
1345 | |||
1302 |
|
1346 | |||
1303 |
|
1347 | |||
1304 |
|
1348 | |||
1305 | Misc |
|
1349 | Misc | |
1306 | ---- |
|
1350 | ---- | |
1307 |
|
1351 | |||
1308 | The autoindent feature that was deprecated in 5.x was re-enabled and |
|
1352 | The autoindent feature that was deprecated in 5.x was re-enabled and | |
1309 | un-deprecated in :ghpull:`11257` |
|
1353 | un-deprecated in :ghpull:`11257` | |
1310 |
|
1354 | |||
1311 | Make :magic:`%run -n -i ... <run>` work correctly. Earlier, if :magic:`%run` was |
|
1355 | Make :magic:`%run -n -i ... <run>` work correctly. Earlier, if :magic:`%run` was | |
1312 | passed both arguments, ``-n`` would be silently ignored. See :ghpull:`10308` |
|
1356 | passed both arguments, ``-n`` would be silently ignored. See :ghpull:`10308` | |
1313 |
|
1357 | |||
1314 |
|
1358 | |||
1315 | The :cellmagic:`%%script` (as well as :cellmagic:`%%bash`, |
|
1359 | The :cellmagic:`%%script` (as well as :cellmagic:`%%bash`, | |
1316 | :cellmagic:`%%ruby`... ) cell magics now raise by default if the return code of |
|
1360 | :cellmagic:`%%ruby`... ) cell magics now raise by default if the return code of | |
1317 | the given code is non-zero (thus halting execution of further cells in a |
|
1361 | the given code is non-zero (thus halting execution of further cells in a | |
1318 | notebook). The behavior can be disable by passing the ``--no-raise-error`` flag. |
|
1362 | notebook). The behavior can be disable by passing the ``--no-raise-error`` flag. | |
1319 |
|
1363 | |||
1320 |
|
1364 | |||
1321 | Deprecations |
|
1365 | Deprecations | |
1322 | ------------ |
|
1366 | ------------ | |
1323 |
|
1367 | |||
1324 | A couple of unused functions and methods have been deprecated and will be removed |
|
1368 | A couple of unused functions and methods have been deprecated and will be removed | |
1325 | in future versions: |
|
1369 | in future versions: | |
1326 |
|
1370 | |||
1327 | - ``IPython.utils.io.raw_print_err`` |
|
1371 | - ``IPython.utils.io.raw_print_err`` | |
1328 | - ``IPython.utils.io.raw_print`` |
|
1372 | - ``IPython.utils.io.raw_print`` | |
1329 |
|
1373 | |||
1330 |
|
1374 | |||
1331 | Backwards incompatible changes |
|
1375 | Backwards incompatible changes | |
1332 | ------------------------------ |
|
1376 | ------------------------------ | |
1333 |
|
1377 | |||
1334 | * The API for transforming input before it is parsed as Python code has been |
|
1378 | * The API for transforming input before it is parsed as Python code has been | |
1335 | completely redesigned: any custom input transformations will need to be |
|
1379 | completely redesigned: any custom input transformations will need to be | |
1336 | rewritten. See :doc:`/config/inputtransforms` for details of the new API. |
|
1380 | rewritten. See :doc:`/config/inputtransforms` for details of the new API. |
General Comments 0
You need to be logged in to leave comments.
Login now